collabmd 0.1.44 → 0.1.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -19
- package/bin/collabmd.js +27 -1
- package/dist/client/assets/CodeMirrorEditor-UCMRAMCV-CYM5nxUi.js +1 -0
- package/dist/client/assets/browser-utils--H_DkyEF.js +1 -0
- package/dist/client/assets/chunk-ERSWUTIN-hHdvnhaY.js +41 -0
- package/dist/client/assets/{chunk-CZQZEIFA-DT3N9fo7.js → chunk-YGJVY4SA-CjSe7Bx7.js} +2 -2
- package/dist/client/assets/comment-thread-store-CdcwrObc.js +1 -0
- package/dist/client/assets/comment-threads-9J6Em-_y.js +4 -0
- package/dist/client/assets/comment-ui-shared-BC4pt4w8.js +7 -0
- package/dist/client/assets/dist-B5HTH2BO.js +1 -0
- package/dist/client/assets/{dist-DhLvC8DS.js → dist-B5Jf1SLZ.js} +2 -2
- package/dist/client/assets/{dist-CnL7Y2sM.js → dist-BDt3rz7l.js} +1 -1
- package/dist/client/assets/dist-BEwK4csK.js +1 -0
- package/dist/client/assets/dist-BKW4PALF.js +1 -0
- package/dist/client/assets/dist-BWcHHOx-.js +1 -0
- package/dist/client/assets/{dist-CYZmbokb.js → dist-BalScOwZ.js} +9 -9
- package/dist/client/assets/dist-Bf8f4HmM.js +6 -0
- package/dist/client/assets/dist-BjHJDtyU.js +1 -0
- package/dist/client/assets/dist-Bm6pf9Bl.js +1 -0
- package/dist/client/assets/dist-BoVBdSjk.js +1 -0
- package/dist/client/assets/dist-CC5IrQMG.js +1 -0
- package/dist/client/assets/{dist-C11hHqv_.js → dist-CCP_AKPG.js} +12 -12
- package/dist/client/assets/dist-CZgOmxK6.js +1 -0
- package/dist/client/assets/{dist-D2AQ-76g.js → dist-Cqhv5LAk.js} +1 -1
- package/dist/client/assets/{dist-MvcV4190.js → dist-D-Z6FLem.js} +1 -1
- package/dist/client/assets/dist-DLMiIsNC.js +11 -0
- package/dist/client/assets/{dist-3bgCp7iY.js → dist-DZKu9Cs8.js} +1 -1
- package/dist/client/assets/dist-DaYdhcVs.js +1 -0
- package/dist/client/assets/dist-FWJsgGYI.js +1 -0
- package/dist/client/assets/dist-Kh2COra_.js +1 -0
- package/dist/client/assets/{dist-JYEDRrPT.js → dist-PDZ3bSqm.js} +1 -1
- package/dist/client/assets/{dist-Drp8uu5J.js → dist-TjMh8n1u.js} +1 -1
- package/dist/client/assets/{dist-DGb27Dl6.js → dist-dtAdgL39.js} +1 -1
- package/dist/client/assets/dist-jv4WdPnK.js +9 -0
- package/dist/client/assets/{dist-DK5Gs2wa.js → dist-rGBmqxC7.js} +1 -1
- package/dist/client/assets/{dist-DCzuX1AF.js → dist-shrl6K_0.js} +1 -1
- package/dist/client/assets/dist-tOaegDYS2.js +1 -0
- package/dist/client/assets/dist-ule2n6ak.js +1 -0
- package/dist/client/assets/dist-xElaxbia.js +1 -0
- package/dist/client/assets/drawio-editor-FzY1cVw8.js +9 -0
- package/dist/client/assets/drawioEditor-BjiKJqlc.js +2 -0
- package/dist/client/assets/editor-session-Cm9ekeNo.js +54 -0
- package/dist/client/assets/embedded-editor-base-CwTkk911.css +1 -0
- package/dist/client/assets/{en-GADW4C6J-DQ6zyCEM.js → en-7NFCYGKX-BrgYZAEe.js} +1 -1
- package/dist/client/assets/{preview-render-profile-BZzGSg6K.js → es-DXGV3RHd.js} +13 -13
- package/dist/client/assets/excalidraw-editor-B46zsTFI.js +9 -0
- package/dist/client/assets/excalidraw-editor-Bt7gMSoh.css +1 -0
- package/dist/client/assets/excalidraw-scene-BOben2gr.js +1 -0
- package/dist/client/assets/excalidrawEditor-CT2pHq7e.js +2 -0
- package/dist/client/assets/export-page-A7NHawJY.js +39 -0
- package/dist/client/assets/exportDocument-B2L8fe34.css +1 -0
- package/dist/client/assets/exportDocument-BaqcOAAW.js +2 -0
- package/dist/client/assets/file-icon-svg-CQAjlWjK.js +1 -0
- package/dist/client/assets/file-kind-BbqgGzpc.js +1 -0
- package/dist/client/assets/image-QXRYHUNP-SWEV8H0J.js +1 -0
- package/dist/client/assets/index-ClbjMBVt.js +2 -0
- package/dist/client/assets/index-Pum8ET-5.css +1 -0
- package/dist/client/assets/main-B3uPyqic.js +893 -0
- package/dist/client/assets/modulepreload-polyfill-P2Xu9kJm.js +1 -0
- package/dist/client/assets/pdf-BL9Pr2D5.js +54 -0
- package/dist/client/assets/pdf.worker-CLesOks4.mjs +64857 -0
- package/dist/client/assets/pdf_viewer-FVkkThnz.js +551 -0
- package/dist/client/assets/preview-diagram-utils-txBCoW8d.js +1 -0
- package/dist/client/assets/{preview-render-compiler-BSaQO_p3.js → preview-render-compiler-BD-XhkS2.js} +2 -2
- package/dist/client/assets/preview-render-compiler-BKedaMxx.js +1 -0
- package/dist/client/assets/preview-render-profile-CE-5rVTC.js +1 -0
- package/dist/client/assets/{preview-render-worker-B42LWvrD.js → preview-render-worker-CiPqc9n6.js} +20 -20
- package/dist/client/assets/prod-Dy20X7eT.js +1 -0
- package/dist/client/assets/prod-hnwh7wRM.js +177 -0
- package/dist/client/assets/quick-switcher-controller-fqOYR7qR.js +12 -0
- package/dist/client/assets/runtime-config-BLrEKVO1.js +1 -0
- package/dist/client/assets/vault-api-client-_LpV1aIn.js +6 -0
- package/dist/client/assets/{yjs-provider-reset-guard-Cox4nxwu.js → yjs-provider-reset-guard-DE0vINDP.js} +1 -1
- package/dist/client/drawio-editor.html +3 -2
- package/dist/client/excalidraw-editor.html +3 -2
- package/dist/client/export-document.html +4 -3
- package/dist/client/index.html +109 -27
- package/docker-compose.yml +42 -0
- package/package.json +26 -15
- package/scripts/local-structurizr-compose.mjs +101 -0
- package/src/client/app/drawio-editor-entry.js +0 -3
- package/src/client/app/drawio-editor.html +1 -0
- package/src/client/app/excalidraw-editor-entry.js +0 -3
- package/src/client/app/excalidraw-editor.html +1 -0
- package/src/client/app/export-document-entry.js +0 -3
- package/src/client/app/export-document.html +1 -0
- package/src/client/app/index.html +106 -24
- package/src/client/app/main-entry.js +0 -5
- package/src/client/application/app-shell/chat-feature.js +180 -124
- package/src/client/application/app-shell/comments-feature.js +20 -11
- package/src/client/application/app-shell/git-feature.js +16 -9
- package/src/client/application/app-shell/presence-feature.js +18 -11
- package/src/client/application/app-shell/ui-feature-shell.js +78 -17
- package/src/client/application/app-shell/ui-feature-sidebar.js +74 -1
- package/src/client/application/app-shell/ui-feature-tab-activity.js +2 -2
- package/src/client/application/app-shell/ui-feature-toolbar.js +2 -52
- package/src/client/application/app-shell/workspace-feature.js +27 -84
- package/src/client/application/app-shell-elements.js +9 -1
- package/src/client/application/diagram-chrome.js +161 -166
- package/src/client/application/diagram-preview-export.js +7 -34
- package/src/client/application/diagram-preview-hydrator.js +1 -19
- package/src/client/application/markdown-frontmatter.js +0 -2
- package/src/client/application/mermaid-preview-hydrator.js +1 -14
- package/src/client/application/pdf-preview-controller.js +992 -0
- package/src/client/application/plantuml-preview-hydrator.js +0 -10
- package/src/client/application/preview-diagram-utils.js +31 -2
- package/src/client/application/preview-render-compiler.js +2 -1
- package/src/client/application/preview-renderer.js +2 -2
- package/src/client/application/quick-switcher-loader.js +3 -1
- package/src/client/application/structurizr-preview-controller.js +395 -0
- package/src/client/application/workspace-coordinator.js +25 -3
- package/src/client/application/workspace-preview-controller.js +91 -5
- package/src/client/bootstrap/collabmd-app-shell.js +155 -43
- package/src/client/browser-utils.js +44 -0
- package/src/client/domain/excalidraw-collaboration.js +0 -2
- package/src/client/domain/room.js +38 -0
- package/src/client/domain/runtime-paths.js +26 -5
- package/src/client/domain/structurizr-language.js +99 -0
- package/src/client/domain/vault-paths.js +48 -0
- package/src/client/excalidraw-editor.js +833 -51
- package/src/client/export/export-pipeline.js +6 -34
- package/src/client/infrastructure/auth-client.js +4 -10
- package/src/client/infrastructure/browser-notification-port.js +33 -20
- package/src/client/infrastructure/browser-preferences-port.js +46 -9
- package/src/client/infrastructure/comment-thread-store.js +34 -13
- package/src/client/infrastructure/editor-session.js +10 -0
- package/src/client/infrastructure/editor-view-adapter.js +133 -5
- package/src/client/infrastructure/excalidraw-room-client.js +103 -14
- package/src/client/infrastructure/git-api-client.js +5 -0
- package/src/client/infrastructure/lobby-presence.js +1 -0
- package/src/client/infrastructure/vault-api-client.js +51 -0
- package/src/client/infrastructure/workspace-sync-client.js +13 -1
- package/src/client/presentation/comment-overview-controller.js +18 -53
- package/src/client/presentation/comment-ui/comment-ui-card.js +1 -12
- package/src/client/presentation/comment-ui/comment-ui-layout.js +242 -219
- package/src/client/presentation/comment-ui/comment-ui-render.js +32 -45
- package/src/client/presentation/comment-ui/comment-ui-shared.js +68 -13
- package/src/client/presentation/comment-ui-controller.js +5 -1
- package/src/client/presentation/drawio-embed-controller.js +9 -102
- package/src/client/presentation/drawio-viewer.js +118 -0
- package/src/client/presentation/excalidraw-embed-controller.js +74 -8
- package/src/client/presentation/file-action-controller.js +134 -0
- package/src/client/presentation/file-explorer-controller.js +33 -3
- package/src/client/presentation/file-explorer-view.js +59 -34
- package/src/client/presentation/file-icon-svg.js +40 -0
- package/src/client/presentation/file-tree-state.js +12 -4
- package/src/client/presentation/git-diff-view-controller.js +731 -3
- package/src/client/presentation/outline-controller.js +86 -0
- package/src/client/presentation/quick-switcher-controller.js +257 -74
- package/src/client/presentation/quick-switcher-text-search.js +3 -3
- package/src/client/presentation/toast-controller.js +3 -0
- package/src/client/styles/components/feedback.css +6 -0
- package/src/client/styles/components/navigation.css +11 -1
- package/src/client/styles/features/collaboration-chat.css +49 -53
- package/src/client/styles/features/collaboration-presence.css +9 -7
- package/src/client/styles/features/comment-card.css +25 -11
- package/src/client/styles/features/comment-overlays.css +0 -4
- package/src/client/styles/features/comment-overview.css +44 -21
- package/src/client/styles/features/comments-drawer.css +2 -100
- package/src/client/styles/features/diagram-preview.css +81 -18
- package/src/client/styles/features/diff-special.css +309 -0
- package/src/client/styles/features/embedded-preview.css +8 -33
- package/src/client/styles/features/quick-switcher.css +8 -0
- package/src/client/styles/foundation/themes.css +6 -0
- package/src/client/styles/foundation/tokens.css +1 -0
- package/src/client/styles/layout/editor-page.css +40 -0
- package/src/client/styles/layout/responsive.css +31 -1
- package/src/client/styles/layout/shell.css +383 -7
- package/src/client/styles/layout/sidebar.css +47 -15
- package/src/client/styles/layout/view-modes.css +1 -0
- package/src/client/styles/overrides/codemirror.css +217 -15
- package/src/client/styles/style.css +1 -0
- package/src/client/styles/surfaces/excalidraw-editor.css +294 -0
- package/src/domain/comment-threads.js +63 -5
- package/src/domain/excalidraw-room-codec.js +6 -4
- package/src/domain/file-kind.js +35 -3
- package/src/server/application/workspace-reconciliation.js +1 -1
- package/src/server/config/env.js +79 -0
- package/src/server/create-app-server.js +14 -3
- package/src/server/domain/bases/base-definition.js +1 -1
- package/src/server/domain/bases/base-expression-runtime.js +1 -4
- package/src/server/domain/bases/base-index-snapshot-store.js +1 -4
- package/src/server/domain/bases/base-query-service.js +1 -77
- package/src/server/domain/bases/base-transform.js +1 -4
- package/src/server/domain/collaboration/collaboration-room.js +55 -21
- package/src/server/domain/comment-overview.js +25 -8
- package/src/server/domain/docx-exporter.js +24 -33
- package/src/server/domain/ripgrep-search-service.js +7 -1
- package/src/server/domain/workspace-state.js +32 -11
- package/src/server/infrastructure/git/diff-service.js +29 -13
- package/src/server/infrastructure/git/git-service.js +61 -10
- package/src/server/infrastructure/git/history-service.js +96 -29
- package/src/server/infrastructure/git/image-mime.js +14 -0
- package/src/server/infrastructure/git/path-utils.js +1 -1
- package/src/server/infrastructure/git/responses.js +0 -95
- package/src/server/infrastructure/git/untracked-files.js +28 -1
- package/src/server/infrastructure/github/github-app-client.js +22 -15
- package/src/server/infrastructure/http/create-git-api-query-handler.js +31 -1
- package/src/server/infrastructure/http/create-request-handler.js +18 -31
- package/src/server/infrastructure/http/create-static-handler.js +5 -2
- package/src/server/infrastructure/http/create-structurizr-api-handler.js +145 -0
- package/src/server/infrastructure/http/create-vault-api-command-handler.js +70 -8
- package/src/server/infrastructure/http/create-vault-api-query-handler.js +51 -3
- package/src/server/infrastructure/http/http-errors.js +7 -1
- package/src/server/infrastructure/http/http-request-helpers.js +22 -0
- package/src/server/infrastructure/persistence/path-utils.js +1 -1
- package/src/server/infrastructure/persistence/vault-file-store.js +3 -0
- package/src/server/infrastructure/structurizr/structurizr-embed.css +43 -0
- package/src/server/infrastructure/structurizr/structurizr-workspace-service.js +374 -0
- package/src/server/infrastructure/websocket/attach-collaboration-gateway.js +4 -22
- package/dist/client/assets/CodeMirrorEditor-UCMRAMCV-CbSISC1w.js +0 -1
- package/dist/client/assets/bases-preview-controller-2pLHk0uk.js +0 -143
- package/dist/client/assets/browser-utils-CKtI_rZl.js +0 -1
- package/dist/client/assets/button-BCEiw4Rw.js +0 -1
- package/dist/client/assets/chunk-AXR3VHVW-0GTk_evH.js +0 -41
- package/dist/client/assets/comment-threads-D-iKphIp.js +0 -4
- package/dist/client/assets/diagram-action-icons-aa_KOv9h.js +0 -36
- package/dist/client/assets/dist-BH87JoHx.js +0 -11
- package/dist/client/assets/dist-BIkPRZO7.js +0 -6
- package/dist/client/assets/dist-BqCsFpx4.js +0 -1
- package/dist/client/assets/dist-C2JHCt8U.js +0 -1
- package/dist/client/assets/dist-CZjTtmTu.js +0 -1
- package/dist/client/assets/dist-Cig4Ov_X.js +0 -1
- package/dist/client/assets/dist-CqQEC8gR.js +0 -1
- package/dist/client/assets/dist-D4Rzqod1.js +0 -1
- package/dist/client/assets/dist-D5sn-mwk.js +0 -9
- package/dist/client/assets/dist-D7G-n87v.js +0 -1
- package/dist/client/assets/dist-DRqOrNgN.js +0 -1
- package/dist/client/assets/dist-DetkMS_4.js +0 -1
- package/dist/client/assets/dist-Dp6FVkQ1.js +0 -1
- package/dist/client/assets/dist-DtbjNB28.js +0 -1
- package/dist/client/assets/dist-DyrYcvpo2.js +0 -1
- package/dist/client/assets/dist-GrygD2zE.js +0 -1
- package/dist/client/assets/dist-HmEpWUow.js +0 -1
- package/dist/client/assets/dist-RTa81Km7.js +0 -1
- package/dist/client/assets/drawio-editor-DDvFoarP.js +0 -9
- package/dist/client/assets/drawio-embed-controller-BD1GTRwn.js +0 -1
- package/dist/client/assets/drawioEditor-Bu5grlH5.js +0 -2
- package/dist/client/assets/editor-session-DGlpiAsK.js +0 -16
- package/dist/client/assets/embedded-editor-base-C9roKYpW.css +0 -1
- package/dist/client/assets/excalidraw-editor-BHu6k8d4.js +0 -9
- package/dist/client/assets/excalidraw-editor-Cr_184EF.css +0 -1
- package/dist/client/assets/excalidraw-embed-controller-y2fenN_g.js +0 -1
- package/dist/client/assets/excalidraw-embed-reconciler-DGiagExg.js +0 -1
- package/dist/client/assets/excalidraw-scene-BvsQ6mLP.js +0 -176
- package/dist/client/assets/excalidrawEditor-4vFE--Uw.js +0 -2
- package/dist/client/assets/export-page-Cby8JzPO.js +0 -39
- package/dist/client/assets/exportDocument-C9v-bc7I.css +0 -1
- package/dist/client/assets/exportDocument-CRHCfsdo.js +0 -2
- package/dist/client/assets/file-history-view-controller-BDjEV9xJ.js +0 -112
- package/dist/client/assets/file-kind-BKPOIRPE.js +0 -1
- package/dist/client/assets/git-diff-view-controller-DgdM1aqb.js +0 -150
- package/dist/client/assets/git-panel-controller-BDTR2HVp.js +0 -207
- package/dist/client/assets/image-XGD7JQR6-XDUWHRpO.js +0 -1
- package/dist/client/assets/index-7xOyXDhP.css +0 -1
- package/dist/client/assets/index-Bz1KuQ6y.js +0 -2
- package/dist/client/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/dist/client/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/dist/client/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/dist/client/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/dist/client/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/dist/client/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/dist/client/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
- package/dist/client/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
- package/dist/client/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/dist/client/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
- package/dist/client/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
- package/dist/client/assets/main-Ci07m9oP.js +0 -152
- package/dist/client/assets/preview-diagram-utils-n_bbJA9V.js +0 -1
- package/dist/client/assets/preview-render-compiler-csGM5ZFz.js +0 -1
- package/dist/client/assets/quick-switcher-controller-CoiYvllm.js +0 -12
- package/dist/client/assets/room-CDrmIdDt.js +0 -1
- package/dist/client/assets/runtime-config-CDgeuPWN.js +0 -1
- package/dist/client/assets/runtime-config-loader-BHGniHP5.js +0 -1
- package/dist/client/assets/runtime-paths-DvpihCEq.js +0 -1
- package/dist/client/assets/segmented-control-DJrHSz8M.js +0 -1
- package/dist/client/assets/vault-api-client-sLB2bo56.js +0 -1
- package/dist/client/assets/vault-paths-CVkuh0j-.js +0 -5
- package/src/client/bootstrap/lazy-controller-feature.js +0 -433
- package/src/client/infrastructure/backlinks-api-client.js +0 -16
- package/src/client/infrastructure/plantuml-api-client.js +0 -19
- package/src/client/infrastructure/runtime-config-loader.js +0 -56
- package/src/server/domain/collaboration/room-persistence-controller.js +0 -80
- package/src/server/infrastructure/git/command-runner.js +0 -49
- package/src/server/infrastructure/git/errors.js +0 -8
- package/src/server/infrastructure/http/create-esm-proxy-handler.js +0 -130
|
@@ -32,18 +32,12 @@ export class PlantUmlPreviewHydrator extends DiagramPreviewHydrator {
|
|
|
32
32
|
shellClassName: 'plantuml-shell',
|
|
33
33
|
sourceClassName: 'plantuml-source',
|
|
34
34
|
});
|
|
35
|
-
this.renderer = renderer;
|
|
36
35
|
this.diagramChrome = renderer.diagramChrome;
|
|
37
36
|
this.renderClient = renderClient;
|
|
38
37
|
this.svgCache = new Map();
|
|
39
38
|
this.svgInflightRequests = new Map();
|
|
40
39
|
}
|
|
41
40
|
|
|
42
|
-
destroy() {
|
|
43
|
-
this.cancelHydration();
|
|
44
|
-
this.clearPreservedShells();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
41
|
cancelHydration({ preserveActiveShell = false } = {}) {
|
|
48
42
|
super.cancelHydration();
|
|
49
43
|
if (!preserveActiveShell) {
|
|
@@ -51,10 +45,6 @@ export class PlantUmlPreviewHydrator extends DiagramPreviewHydrator {
|
|
|
51
45
|
}
|
|
52
46
|
}
|
|
53
47
|
|
|
54
|
-
scheduleActiveRefit() {
|
|
55
|
-
this.diagramChrome?.scheduleActiveRefitOnNextFrame?.();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
48
|
handleReconcile({ restoredMaximizedShell }) {
|
|
59
49
|
if (restoredMaximizedShell) {
|
|
60
50
|
document.body.classList.add('plantuml-maximized-open');
|
|
@@ -8,6 +8,37 @@ export {
|
|
|
8
8
|
requestIdleRender,
|
|
9
9
|
} from '../browser-utils.js';
|
|
10
10
|
|
|
11
|
+
export function encodeSvgDataUrl(svgMarkup) {
|
|
12
|
+
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svgMarkup)}`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function loadImage(src) {
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
const image = new Image();
|
|
18
|
+
image.decoding = 'async';
|
|
19
|
+
image.addEventListener('load', () => resolve(image), { once: true });
|
|
20
|
+
image.addEventListener('error', () => reject(new Error(`Failed to load image: ${src}`)), { once: true });
|
|
21
|
+
image.src = src;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function resolveSvgDimensions(svgElement) {
|
|
26
|
+
const widthAttr = Number.parseFloat(svgElement.getAttribute('width') || '');
|
|
27
|
+
const heightAttr = Number.parseFloat(svgElement.getAttribute('height') || '');
|
|
28
|
+
const viewBoxParts = (svgElement.getAttribute('viewBox') || '')
|
|
29
|
+
.split(/\s+/u)
|
|
30
|
+
.map((value) => Number.parseFloat(value));
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
height: Number.isFinite(heightAttr) && heightAttr > 0
|
|
34
|
+
? heightAttr
|
|
35
|
+
: (Number.isFinite(viewBoxParts[3]) && viewBoxParts[3] > 0 ? viewBoxParts[3] : 800),
|
|
36
|
+
width: Number.isFinite(widthAttr) && widthAttr > 0
|
|
37
|
+
? widthAttr
|
|
38
|
+
: (Number.isFinite(viewBoxParts[2]) && viewBoxParts[2] > 0 ? viewBoxParts[2] : 1200),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
11
42
|
export function syncAttribute(target, source, name) {
|
|
12
43
|
const nextValue = source.getAttribute(name);
|
|
13
44
|
if (nextValue === null) {
|
|
@@ -62,10 +93,8 @@ export function normalizeMermaidSvg(svg) {
|
|
|
62
93
|
export function getFrameViewportSize(frame) {
|
|
63
94
|
const styles = window.getComputedStyle(frame);
|
|
64
95
|
const paddingX = Number.parseFloat(styles.paddingLeft || '0') + Number.parseFloat(styles.paddingRight || '0');
|
|
65
|
-
const paddingY = Number.parseFloat(styles.paddingTop || '0') + Number.parseFloat(styles.paddingBottom || '0');
|
|
66
96
|
|
|
67
97
|
return {
|
|
68
|
-
height: Math.max(frame.clientHeight - paddingY, 0),
|
|
69
98
|
width: Math.max(frame.clientWidth - paddingX, 0),
|
|
70
99
|
};
|
|
71
100
|
}
|
|
@@ -5,7 +5,8 @@ import { isImageAttachmentFilePath } from '../../domain/file-kind.js';
|
|
|
5
5
|
import { resolveVaultRelativePath } from '../../domain/vault-paths.js';
|
|
6
6
|
import { resolveWikiTargetPath } from '../../domain/wiki-link-resolver.js';
|
|
7
7
|
import { escapeHtml } from '../domain/vault-utils.js';
|
|
8
|
-
import { extractYamlFrontmatter
|
|
8
|
+
import { extractYamlFrontmatter } from '../../domain/yaml-frontmatter.js';
|
|
9
|
+
import { renderFrontmatterBlock } from './markdown-frontmatter.js';
|
|
9
10
|
import { analyzeMarkdownComplexity } from './preview-render-profile.js';
|
|
10
11
|
|
|
11
12
|
const DIRECT_VIDEO_MIME_TYPES = Object.freeze({
|
|
@@ -91,8 +91,8 @@ export class PreviewRenderer {
|
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
this.handleWindowResize = () => {
|
|
94
|
-
this.
|
|
95
|
-
this.
|
|
94
|
+
this.scheduleActiveMermaidRefit();
|
|
95
|
+
this.scheduleActivePlantUmlRefit();
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
this.diagramChrome = new DiagramChrome({
|
|
@@ -22,8 +22,10 @@ export async function ensureQuickSwitcherInstance(host) {
|
|
|
22
22
|
if (!host.quickSwitcher) {
|
|
23
23
|
host.quickSwitcher = new QuickSwitcherController({
|
|
24
24
|
getFileList: () => host.fileExplorer.flatFiles,
|
|
25
|
+
getFileMetadata: () => host.fileExplorer.fileEntries,
|
|
26
|
+
getRecentFiles: () => host.preferences?.getRecentFiles?.() ?? [],
|
|
25
27
|
getSearchConfig: () => host.runtimeConfig.search ?? {},
|
|
26
|
-
onFileSelect: (filePath) => host.handleFileSelection(filePath, {
|
|
28
|
+
onFileSelect: (filePath) => host.workspaceRouteController.handleFileSelection(filePath, {
|
|
27
29
|
closeSidebarOnMobile: true,
|
|
28
30
|
revealInTree: true,
|
|
29
31
|
}),
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import { resolveAppPath } from '../domain/runtime-paths.js';
|
|
2
|
+
import { setDiagramActionButtonIcon } from '../domain/diagram-action-icons.js';
|
|
3
|
+
|
|
4
|
+
const SYNC_DEBOUNCE_MS = 300;
|
|
5
|
+
const FRAME_FIT_ATTEMPTS = 20;
|
|
6
|
+
const FRAME_FIT_INTERVAL_MS = 50;
|
|
7
|
+
|
|
8
|
+
function decodeViewKey(hash = '') {
|
|
9
|
+
const normalized = String(hash ?? '').replace(/^#/, '');
|
|
10
|
+
if (!normalized) {
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
return decodeURIComponent(normalized);
|
|
16
|
+
} catch {
|
|
17
|
+
return normalized;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function readFrameState(iframe) {
|
|
22
|
+
try {
|
|
23
|
+
const frameDocument = iframe?.contentDocument;
|
|
24
|
+
const layer = frameDocument?.querySelector('.joint-layers');
|
|
25
|
+
const viewport = frameDocument?.querySelector('#diagram-viewport');
|
|
26
|
+
const zoom = layer ? new DOMMatrixReadOnly(getComputedStyle(layer).transform).a : 0;
|
|
27
|
+
return {
|
|
28
|
+
scrollLeft: viewport?.scrollLeft ?? 0,
|
|
29
|
+
scrollTop: viewport?.scrollTop ?? 0,
|
|
30
|
+
zoom: Number.isFinite(zoom) && zoom > 0 ? zoom : null,
|
|
31
|
+
};
|
|
32
|
+
} catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class StructurizrPreviewController {
|
|
38
|
+
constructor({
|
|
39
|
+
enabled = false,
|
|
40
|
+
syncWorkspace,
|
|
41
|
+
}) {
|
|
42
|
+
this.enabled = Boolean(enabled);
|
|
43
|
+
this.syncWorkspace = syncWorkspace;
|
|
44
|
+
this.iframe = null;
|
|
45
|
+
this.shell = null;
|
|
46
|
+
this.status = null;
|
|
47
|
+
this.maximizeButton = null;
|
|
48
|
+
this.filePath = null;
|
|
49
|
+
this.viewKey = '';
|
|
50
|
+
this.lastVersion = null;
|
|
51
|
+
this.syncTimer = null;
|
|
52
|
+
this.syncToken = 0;
|
|
53
|
+
this.frameFitTimer = null;
|
|
54
|
+
this.frameHost = null;
|
|
55
|
+
this.pendingIframe = null;
|
|
56
|
+
this.pendingVersion = null;
|
|
57
|
+
this.handleFrameLoad = (event) => {
|
|
58
|
+
const iframe = event?.currentTarget || this.iframe;
|
|
59
|
+
if (!iframe) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
if (iframe === this.iframe) {
|
|
65
|
+
this.viewKey = decodeViewKey(iframe.contentWindow?.location?.hash || '') || this.viewKey;
|
|
66
|
+
iframe.contentWindow?.addEventListener('hashchange', this.handleFrameHashChange);
|
|
67
|
+
}
|
|
68
|
+
this.prepareFrame(iframe);
|
|
69
|
+
} catch {
|
|
70
|
+
if (iframe === this.pendingIframe) {
|
|
71
|
+
this.commitPendingIframe(iframe);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
this.handleFrameHashChange = () => {
|
|
76
|
+
try {
|
|
77
|
+
this.viewKey = decodeViewKey(this.iframe?.contentWindow?.location?.hash || '') || this.viewKey;
|
|
78
|
+
} catch {
|
|
79
|
+
// Ignore inaccessible frame locations.
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
setStatus(message = '', { error = false } = {}) {
|
|
85
|
+
if (!this.status) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
this.status.textContent = message;
|
|
90
|
+
this.status.hidden = !message;
|
|
91
|
+
this.status.classList.toggle('is-error', error);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
prepareFrame(iframe = this.iframe) {
|
|
95
|
+
const frameDocument = iframe?.contentDocument;
|
|
96
|
+
if (!frameDocument?.head) {
|
|
97
|
+
if (iframe === this.pendingIframe) {
|
|
98
|
+
this.commitPendingIframe(iframe);
|
|
99
|
+
}
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
iframe.contentWindow?.dispatchEvent(new Event('resize'));
|
|
104
|
+
this.scheduleFrameFit(iframe, iframe === this.pendingIframe ? () => this.commitPendingIframe(iframe) : null);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
fitFrameToCanvas(iframe = this.iframe) {
|
|
108
|
+
const frameDocument = iframe?.contentDocument;
|
|
109
|
+
const canvas = frameDocument?.querySelector('#diagram-canvas');
|
|
110
|
+
if (!canvas) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
if (iframe === this.pendingIframe && !frameDocument.querySelector('.joint-layers')) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
try {
|
|
118
|
+
const diagram = iframe?.contentWindow?.structurizr?.diagram;
|
|
119
|
+
diagram?.setEmbedded?.(true);
|
|
120
|
+
diagram?.resize?.();
|
|
121
|
+
diagram?.zoomToWidthOrHeight?.();
|
|
122
|
+
} catch {
|
|
123
|
+
// The frame can be cross-origin in custom deployments; the CSS crop still applies.
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const { width, height } = canvas.getBoundingClientRect();
|
|
127
|
+
if (!width || !height) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
disposeFrame(iframe) {
|
|
135
|
+
if (!iframe) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
try {
|
|
140
|
+
iframe.contentWindow?.removeEventListener?.('hashchange', this.handleFrameHashChange);
|
|
141
|
+
} catch {
|
|
142
|
+
// Ignore inaccessible frame windows during cleanup.
|
|
143
|
+
}
|
|
144
|
+
iframe.removeEventListener('load', this.handleFrameLoad);
|
|
145
|
+
iframe.remove();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
discardPendingIframe() {
|
|
149
|
+
if (!this.pendingIframe) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
clearTimeout(this.frameFitTimer);
|
|
154
|
+
this.frameFitTimer = null;
|
|
155
|
+
this.disposeFrame(this.pendingIframe);
|
|
156
|
+
this.pendingIframe = null;
|
|
157
|
+
this.pendingVersion = null;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
commitPendingIframe(iframe) {
|
|
161
|
+
if (iframe !== this.pendingIframe || !this.shell?.isConnected) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const previousIframe = this.iframe;
|
|
166
|
+
const nextVersion = this.pendingVersion;
|
|
167
|
+
const frameState = readFrameState(previousIframe);
|
|
168
|
+
this.pendingIframe = null;
|
|
169
|
+
this.pendingVersion = null;
|
|
170
|
+
if (frameState?.zoom) {
|
|
171
|
+
try {
|
|
172
|
+
iframe.contentWindow?.structurizr?.diagram?.zoomTo?.(frameState.zoom);
|
|
173
|
+
} catch {
|
|
174
|
+
// Keep the new diagram usable when a custom viewer does not expose zoom controls.
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
try {
|
|
178
|
+
const viewport = iframe.contentDocument?.querySelector('#diagram-viewport');
|
|
179
|
+
if (viewport && frameState) {
|
|
180
|
+
viewport.scrollLeft = frameState.scrollLeft;
|
|
181
|
+
viewport.scrollTop = frameState.scrollTop;
|
|
182
|
+
}
|
|
183
|
+
} catch {
|
|
184
|
+
// Cross-origin custom viewers cannot restore viewport coordinates.
|
|
185
|
+
}
|
|
186
|
+
this.disposeFrame(previousIframe);
|
|
187
|
+
iframe.style.visibility = '';
|
|
188
|
+
iframe.style.pointerEvents = '';
|
|
189
|
+
iframe.removeAttribute('aria-hidden');
|
|
190
|
+
this.iframe = iframe;
|
|
191
|
+
this.lastVersion = nextVersion;
|
|
192
|
+
|
|
193
|
+
try {
|
|
194
|
+
this.viewKey = decodeViewKey(iframe.contentWindow?.location?.hash || '') || this.viewKey;
|
|
195
|
+
iframe.contentWindow?.addEventListener('hashchange', this.handleFrameHashChange);
|
|
196
|
+
} catch {
|
|
197
|
+
// Cross-origin deployments cannot expose the frame hash.
|
|
198
|
+
}
|
|
199
|
+
this.setStatus('');
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
createIframe() {
|
|
203
|
+
const iframe = document.createElement('iframe');
|
|
204
|
+
iframe.className = 'structurizr-preview-iframe';
|
|
205
|
+
iframe.title = 'Structurizr architecture diagram';
|
|
206
|
+
iframe.loading = 'eager';
|
|
207
|
+
iframe.referrerPolicy = 'same-origin';
|
|
208
|
+
iframe.addEventListener('load', this.handleFrameLoad);
|
|
209
|
+
return iframe;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
syncMaximizeButtonState() {
|
|
213
|
+
if (!this.maximizeButton || !this.shell) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const isMaximized = this.shell.classList.contains('is-maximized');
|
|
218
|
+
setDiagramActionButtonIcon(this.maximizeButton, isMaximized ? 'restore' : 'maximize');
|
|
219
|
+
const label = isMaximized ? 'Restore diagram size' : 'Maximize diagram';
|
|
220
|
+
this.maximizeButton.title = label;
|
|
221
|
+
this.maximizeButton.setAttribute('aria-label', label);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
setMaximized(shouldMaximize) {
|
|
225
|
+
const isMaximized = Boolean(shouldMaximize);
|
|
226
|
+
this.shell?.classList.toggle('is-maximized', isMaximized);
|
|
227
|
+
document.body?.classList.toggle('structurizr-maximized-open', isMaximized);
|
|
228
|
+
this.syncMaximizeButtonState();
|
|
229
|
+
this.iframe?.contentWindow?.dispatchEvent(new Event('resize'));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
scheduleFrameFit(iframe = this.iframe, onReady = null) {
|
|
233
|
+
if (!iframe) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
clearTimeout(this.frameFitTimer);
|
|
238
|
+
let attempts = 0;
|
|
239
|
+
const fit = () => {
|
|
240
|
+
this.frameFitTimer = null;
|
|
241
|
+
if (this.fitFrameToCanvas(iframe) || attempts >= FRAME_FIT_ATTEMPTS) {
|
|
242
|
+
onReady?.();
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
attempts += 1;
|
|
247
|
+
this.frameFitTimer = setTimeout(fit, FRAME_FIT_INTERVAL_MS);
|
|
248
|
+
};
|
|
249
|
+
fit();
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
mount(renderHost, filePath) {
|
|
253
|
+
const fileChanged = Boolean(this.filePath && this.filePath !== filePath);
|
|
254
|
+
if (fileChanged) {
|
|
255
|
+
this.setMaximized(false);
|
|
256
|
+
this.discardPendingIframe();
|
|
257
|
+
this.disposeFrame(this.iframe);
|
|
258
|
+
this.iframe = null;
|
|
259
|
+
this.lastVersion = null;
|
|
260
|
+
this.viewKey = '';
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
this.filePath = filePath;
|
|
264
|
+
|
|
265
|
+
if (this.shell?.isConnected && this.shell.parentElement === renderHost) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
clearTimeout(this.frameFitTimer);
|
|
270
|
+
this.frameFitTimer = null;
|
|
271
|
+
this.shell = document.createElement('section');
|
|
272
|
+
this.shell.className = 'structurizr-preview-shell diagram-preview-shell';
|
|
273
|
+
this.shell.dataset.structurizrPreview = 'true';
|
|
274
|
+
|
|
275
|
+
const header = document.createElement('div');
|
|
276
|
+
header.className = 'structurizr-preview-header diagram-preview-toolbar';
|
|
277
|
+
|
|
278
|
+
const label = document.createElement('span');
|
|
279
|
+
label.className = 'structurizr-preview-label';
|
|
280
|
+
label.textContent = String(filePath).split('/').pop()?.replace(/\.dsl$/i, '') || 'Structurizr';
|
|
281
|
+
|
|
282
|
+
this.maximizeButton = document.createElement('button');
|
|
283
|
+
this.maximizeButton.type = 'button';
|
|
284
|
+
this.maximizeButton.className = 'structurizr-preview-btn ui-preview-action ui-preview-action--icon-only';
|
|
285
|
+
this.maximizeButton.dataset.action = 'toggle-maximize';
|
|
286
|
+
this.maximizeButton.addEventListener('click', (event) => {
|
|
287
|
+
event.preventDefault();
|
|
288
|
+
this.setMaximized(!this.shell?.classList.contains('is-maximized'));
|
|
289
|
+
});
|
|
290
|
+
header.append(label, this.maximizeButton);
|
|
291
|
+
this.syncMaximizeButtonState();
|
|
292
|
+
|
|
293
|
+
this.status = document.createElement('div');
|
|
294
|
+
this.status.className = 'structurizr-preview-status';
|
|
295
|
+
this.status.setAttribute('aria-live', 'polite');
|
|
296
|
+
this.status.setAttribute('role', 'status');
|
|
297
|
+
this.status.hidden = true;
|
|
298
|
+
|
|
299
|
+
this.frameHost = document.createElement('div');
|
|
300
|
+
this.frameHost.className = 'structurizr-preview-stage';
|
|
301
|
+
this.shell.append(header, this.status, this.frameHost);
|
|
302
|
+
|
|
303
|
+
renderHost?.replaceChildren(this.shell);
|
|
304
|
+
this.iframe = null;
|
|
305
|
+
this.pendingIframe = null;
|
|
306
|
+
this.pendingVersion = null;
|
|
307
|
+
this.lastVersion = null;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
async render({ filePath, renderHost, source = '' }) {
|
|
311
|
+
this.mount(renderHost, filePath);
|
|
312
|
+
return this.syncNow({ filePath, source: String(source ?? '') });
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
queueSync({ filePath, source = '' } = {}) {
|
|
316
|
+
clearTimeout(this.syncTimer);
|
|
317
|
+
this.syncTimer = setTimeout(() => {
|
|
318
|
+
this.syncTimer = null;
|
|
319
|
+
void this.syncNow({ filePath, source: String(source ?? '') });
|
|
320
|
+
}, SYNC_DEBOUNCE_MS);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
async syncNow({ filePath, source = '' } = {}) {
|
|
324
|
+
if (filePath !== this.filePath) {
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const token = ++this.syncToken;
|
|
329
|
+
if (!this.enabled) {
|
|
330
|
+
this.setStatus('Structurizr preview is not configured. Start CollabMD with --local-structurizr.', { error: true });
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
if (!this.iframe) {
|
|
335
|
+
this.setStatus('Validating Structurizr workspace…');
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
try {
|
|
339
|
+
const payload = await this.syncWorkspace({ path: filePath, source });
|
|
340
|
+
if (token !== this.syncToken || filePath !== this.filePath) {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
const nextVersion = payload?.version || null;
|
|
345
|
+
const route = resolveAppPath('/workspace/1/diagrams');
|
|
346
|
+
const hash = this.viewKey ? `#${encodeURIComponent(this.viewKey)}` : '';
|
|
347
|
+
if (!this.iframe) {
|
|
348
|
+
const iframe = this.createIframe();
|
|
349
|
+
this.iframe = iframe;
|
|
350
|
+
this.frameHost?.appendChild(iframe);
|
|
351
|
+
iframe.src = `${route}${hash}`;
|
|
352
|
+
this.lastVersion = nextVersion;
|
|
353
|
+
} else if (nextVersion !== this.lastVersion) {
|
|
354
|
+
this.discardPendingIframe();
|
|
355
|
+
const iframe = this.createIframe();
|
|
356
|
+
iframe.style.visibility = 'hidden';
|
|
357
|
+
iframe.style.pointerEvents = 'none';
|
|
358
|
+
iframe.setAttribute('aria-hidden', 'true');
|
|
359
|
+
this.pendingIframe = iframe;
|
|
360
|
+
this.pendingVersion = nextVersion;
|
|
361
|
+
this.frameHost?.appendChild(iframe);
|
|
362
|
+
iframe.src = `${route}${hash}`;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
this.setStatus('');
|
|
366
|
+
return true;
|
|
367
|
+
} catch (error) {
|
|
368
|
+
if (token !== this.syncToken || filePath !== this.filePath) {
|
|
369
|
+
return false;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
this.setStatus(error?.message || 'Failed to load Structurizr workspace.', { error: true });
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
reset() {
|
|
378
|
+
this.setMaximized(false);
|
|
379
|
+
clearTimeout(this.syncTimer);
|
|
380
|
+
this.syncTimer = null;
|
|
381
|
+
clearTimeout(this.frameFitTimer);
|
|
382
|
+
this.frameFitTimer = null;
|
|
383
|
+
this.syncToken += 1;
|
|
384
|
+
this.discardPendingIframe();
|
|
385
|
+
this.disposeFrame(this.iframe);
|
|
386
|
+
this.iframe = null;
|
|
387
|
+
this.frameHost = null;
|
|
388
|
+
this.shell = null;
|
|
389
|
+
this.status = null;
|
|
390
|
+
this.maximizeButton = null;
|
|
391
|
+
this.filePath = null;
|
|
392
|
+
this.lastVersion = null;
|
|
393
|
+
this.viewKey = '';
|
|
394
|
+
}
|
|
395
|
+
}
|
|
@@ -21,6 +21,7 @@ export class WorkspaceCoordinator {
|
|
|
21
21
|
getDisplayName,
|
|
22
22
|
getFileList,
|
|
23
23
|
getLineWrappingEnabled,
|
|
24
|
+
getVimModeEnabled,
|
|
24
25
|
getLocalUser,
|
|
25
26
|
getStoredUserName,
|
|
26
27
|
getTheme,
|
|
@@ -28,8 +29,10 @@ export class WorkspaceCoordinator {
|
|
|
28
29
|
isDrawioFile,
|
|
29
30
|
isExcalidrawFile,
|
|
30
31
|
isImageFile,
|
|
32
|
+
isPdfFile,
|
|
31
33
|
isMermaidFile,
|
|
32
34
|
isPlantUmlFile,
|
|
35
|
+
isStructurizrWorkspaceFile,
|
|
33
36
|
isTabActive,
|
|
34
37
|
loadBootstrapContent = null,
|
|
35
38
|
loadEditorSessionClass,
|
|
@@ -49,6 +52,8 @@ export class WorkspaceCoordinator {
|
|
|
49
52
|
onRenderExcalidrawPreview,
|
|
50
53
|
onRenderDrawioPreview,
|
|
51
54
|
onRenderImagePreview,
|
|
55
|
+
onRenderPdfPreview,
|
|
56
|
+
onRenderStructurizrPreview,
|
|
52
57
|
onSyncWrapToggle,
|
|
53
58
|
onUpdateActiveFile,
|
|
54
59
|
onUpdateCurrentFile,
|
|
@@ -68,6 +73,7 @@ export class WorkspaceCoordinator {
|
|
|
68
73
|
this.getDisplayName = getDisplayName;
|
|
69
74
|
this.getFileList = getFileList;
|
|
70
75
|
this.getLineWrappingEnabled = getLineWrappingEnabled;
|
|
76
|
+
this.getVimModeEnabled = getVimModeEnabled ?? (() => false);
|
|
71
77
|
this.getLocalUser = getLocalUser;
|
|
72
78
|
this.getStoredUserName = getStoredUserName;
|
|
73
79
|
this.getTheme = getTheme;
|
|
@@ -75,8 +81,10 @@ export class WorkspaceCoordinator {
|
|
|
75
81
|
this.isDrawioFile = isDrawioFile ?? (() => false);
|
|
76
82
|
this.isExcalidrawFile = isExcalidrawFile ?? (() => false);
|
|
77
83
|
this.isImageFile = isImageFile ?? (() => false);
|
|
84
|
+
this.isPdfFile = isPdfFile ?? (() => false);
|
|
78
85
|
this.isMermaidFile = isMermaidFile ?? (() => false);
|
|
79
86
|
this.isPlantUmlFile = isPlantUmlFile ?? (() => false);
|
|
87
|
+
this.isStructurizrWorkspaceFile = isStructurizrWorkspaceFile ?? (() => false);
|
|
80
88
|
this.isTabActive = isTabActive;
|
|
81
89
|
this.loadBootstrapContent = loadBootstrapContent;
|
|
82
90
|
this.loadEditorSessionClassPort = loadEditorSessionClass;
|
|
@@ -96,6 +104,8 @@ export class WorkspaceCoordinator {
|
|
|
96
104
|
this.onRenderDrawioPreview = onRenderDrawioPreview;
|
|
97
105
|
this.onRenderExcalidrawPreview = onRenderExcalidrawPreview;
|
|
98
106
|
this.onRenderImagePreview = onRenderImagePreview;
|
|
107
|
+
this.onRenderPdfPreview = onRenderPdfPreview;
|
|
108
|
+
this.onRenderStructurizrPreview = onRenderStructurizrPreview;
|
|
99
109
|
this.onSyncWrapToggle = onSyncWrapToggle;
|
|
100
110
|
this.onUpdateActiveFile = onUpdateActiveFile;
|
|
101
111
|
this.onUpdateCurrentFile = onUpdateCurrentFile;
|
|
@@ -171,12 +181,19 @@ export class WorkspaceCoordinator {
|
|
|
171
181
|
filePath,
|
|
172
182
|
isExcalidraw = false,
|
|
173
183
|
isImage = false,
|
|
184
|
+
isPdf = false,
|
|
174
185
|
supportsBacklinks,
|
|
175
186
|
}) {
|
|
176
187
|
if (isExcalidraw) this.onRenderExcalidrawPreview(filePath);
|
|
177
188
|
if (isBase || isBaseFilePath(filePath)) this.onRenderBasePreview(filePath);
|
|
178
189
|
if (isDrawio) this.onRenderDrawioPreview(filePath);
|
|
179
190
|
if (isImage) this.onRenderImagePreview(filePath);
|
|
191
|
+
if (isPdf) this.onRenderPdfPreview(filePath);
|
|
192
|
+
if (this.isStructurizrWorkspaceFile(filePath)) {
|
|
193
|
+
this.onRenderStructurizrPreview(filePath, {
|
|
194
|
+
source: this.session?.getText?.() ?? '',
|
|
195
|
+
});
|
|
196
|
+
}
|
|
180
197
|
this.onSyncWrapToggle();
|
|
181
198
|
if (supportsBacklinks) this.loadBacklinks(filePath);
|
|
182
199
|
}
|
|
@@ -192,13 +209,15 @@ export class WorkspaceCoordinator {
|
|
|
192
209
|
const isExcalidraw = this.isExcalidrawFile(filePath);
|
|
193
210
|
const isBase = this.isBaseFile(filePath);
|
|
194
211
|
const isImage = this.isImageFile(filePath);
|
|
212
|
+
const isPdf = this.isPdfFile(filePath);
|
|
195
213
|
const isMermaid = this.isMermaidFile(filePath);
|
|
196
214
|
const isPlantUml = this.isPlantUmlFile(filePath);
|
|
215
|
+
const isStructurizrWorkspace = this.isStructurizrWorkspaceFile(filePath);
|
|
197
216
|
|
|
198
217
|
if (
|
|
199
218
|
filePath === this.stateStore.currentFilePath
|
|
200
219
|
&& normalizedDrawioMode === currentDrawioMode
|
|
201
|
-
&& (this.session || isDrawio || isExcalidraw || isImage)
|
|
220
|
+
&& (this.session || isDrawio || isExcalidraw || isImage || isPdf)
|
|
202
221
|
) {
|
|
203
222
|
this.onUpdateActiveFile(filePath);
|
|
204
223
|
this.onUpdateLobbyCurrentFile(filePath);
|
|
@@ -211,11 +230,11 @@ export class WorkspaceCoordinator {
|
|
|
211
230
|
this.cleanupSession();
|
|
212
231
|
const chromeState = this.prepareForFileOpen(filePath, {
|
|
213
232
|
drawioMode: normalizedDrawioMode,
|
|
214
|
-
resetConnectionState: !isDrawio && !isExcalidraw && !isImage,
|
|
233
|
+
resetConnectionState: !isDrawio && !isExcalidraw && !isImage && !isPdf,
|
|
215
234
|
});
|
|
216
235
|
this.reportFileOpenMetric('open_started', loadToken, { filePath });
|
|
217
236
|
|
|
218
|
-
if (isDrawio || isExcalidraw || isImage) {
|
|
237
|
+
if (isDrawio || isExcalidraw || isImage || isPdf) {
|
|
219
238
|
this.onSessionAssigned?.(null);
|
|
220
239
|
|
|
221
240
|
if (loadToken !== this.stateStore.sessionLoadToken) {
|
|
@@ -229,6 +248,7 @@ export class WorkspaceCoordinator {
|
|
|
229
248
|
isDrawio,
|
|
230
249
|
isExcalidraw,
|
|
231
250
|
isImage,
|
|
251
|
+
isPdf,
|
|
232
252
|
session: null,
|
|
233
253
|
supportsBacklinks: chromeState.supportsBacklinks,
|
|
234
254
|
});
|
|
@@ -241,6 +261,7 @@ export class WorkspaceCoordinator {
|
|
|
241
261
|
getFileList: this.getFileList,
|
|
242
262
|
lineWrappingEnabled: this.getLineWrappingEnabled(),
|
|
243
263
|
localUser: this.getLocalUser(),
|
|
264
|
+
vimModeEnabled: this.getVimModeEnabled(),
|
|
244
265
|
onAwarenessChange: (users) => this.onFileAwarenessChange(users),
|
|
245
266
|
onConnectionChange: (state) => this.onConnectionChange(state),
|
|
246
267
|
onCommentsChange: (threads) => this.onCommentsChange?.(threads),
|
|
@@ -253,6 +274,7 @@ export class WorkspaceCoordinator {
|
|
|
253
274
|
isBase,
|
|
254
275
|
isMermaid,
|
|
255
276
|
isPlantUml,
|
|
277
|
+
isStructurizrWorkspace,
|
|
256
278
|
});
|
|
257
279
|
},
|
|
258
280
|
onImagePaste: (file) => this.onImagePaste?.(file),
|