From 9310a024edbcffcda41e577e4442e5e7e26533ef Mon Sep 17 00:00:00 2001 From: Antoine Clausse Date: Tue, 24 Jun 2025 10:10:36 +0200 Subject: [PATCH] [web] Fix Editor Stories (#26535) * Fix storybook stories * Add `chat` to `ol-capabilities` in Storybook GitOrigin-RevId: 0816c82170ebc3bfe9ca2d7f02766364c693365a --- services/web/.storybook/preview.tsx | 6 ++++++ .../web/frontend/stories/file-view/file-view.stories.jsx | 1 + services/web/frontend/stories/fixtures/compile.js | 2 +- services/web/frontend/stories/pdf-preview.stories.jsx | 2 +- .../stories/source-editor/source-editor.stories.tsx | 3 +++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/services/web/.storybook/preview.tsx b/services/web/.storybook/preview.tsx index 320caac144..c5d50da27a 100644 --- a/services/web/.storybook/preview.tsx +++ b/services/web/.storybook/preview.tsx @@ -13,6 +13,12 @@ import en from '../../../services/web/locales/en.json' function resetMeta() { window.metaAttributesCache = new Map() window.metaAttributesCache.set('ol-i18n', { currentLangCode: 'en' }) + window.metaAttributesCache.set('ol-projectHistoryBlobsEnabled', true) + window.metaAttributesCache.set('ol-capabilities', ['chat']) + window.metaAttributesCache.set('ol-compileSettings', { + reducedTimeoutWarning: 'default', + compileTimeout: 20, + }) window.metaAttributesCache.set('ol-ExposedSettings', { adminEmail: 'placeholder@example.com', appName: 'Overleaf', diff --git a/services/web/frontend/stories/file-view/file-view.stories.jsx b/services/web/frontend/stories/file-view/file-view.stories.jsx index 5622e6eb52..80c4363c9d 100644 --- a/services/web/frontend/stories/file-view/file-view.stories.jsx +++ b/services/web/frontend/stories/file-view/file-view.stories.jsx @@ -35,6 +35,7 @@ const setupFetchMock = fetchMock => { const fileData = { id: 'file-id', name: 'file.tex', + hash: 'c0ffee', created: new Date().toISOString(), } diff --git a/services/web/frontend/stories/fixtures/compile.js b/services/web/frontend/stories/fixtures/compile.js index bc7ebfae8b..e31a4488e4 100644 --- a/services/web/frontend/stories/fixtures/compile.js +++ b/services/web/frontend/stories/fixtures/compile.js @@ -100,7 +100,7 @@ export const mockClearCache = fetchMock => }) export const mockBuildFile = fetchMock => - fetchMock.get('express:/build/:file', url => { + fetchMock.get('express:/build/:file', ({ url }) => { const { pathname } = new URL(url, 'https://example.com') switch (pathname) { diff --git a/services/web/frontend/stories/pdf-preview.stories.jsx b/services/web/frontend/stories/pdf-preview.stories.jsx index 0233006a00..df0429734e 100644 --- a/services/web/frontend/stories/pdf-preview.stories.jsx +++ b/services/web/frontend/stories/pdf-preview.stories.jsx @@ -319,7 +319,7 @@ export const HybridToolbar = () => { export const FileList = () => { const fileList = useMemo(() => { - return buildFileList(cloneDeep(outputFiles)) + return buildFileList(cloneDeep(outputFiles), {}) }, []) return ( diff --git a/services/web/frontend/stories/source-editor/source-editor.stories.tsx b/services/web/frontend/stories/source-editor/source-editor.stories.tsx index 3cc6b1c95f..184c4faa46 100644 --- a/services/web/frontend/stories/source-editor/source-editor.stories.tsx +++ b/services/web/frontend/stories/source-editor/source-editor.stories.tsx @@ -189,6 +189,9 @@ const mockDoc = (content: string, changes: Array> = []) => { detachFromCM6: () => { // Do nothing }, + getType: () => { + return 'history-ot' + }, on: () => { // Do nothing },