@smartdoca/markdown 0.4.2 → 0.4.4

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/dist/style.css CHANGED
@@ -1 +1 @@
1
- .exmd-editor{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;color:#292825;font-synthesis:none}.exmd-editor,.exmd-editor *{box-sizing:border-box}.exmd-editor button{font:inherit}.exmd-editor.app-shell{display:grid;grid-template-rows:64px auto 1fr 34px;background:#f7f7f5;overflow:hidden}.topbar{display:flex;align-items:center;gap:22px;padding:0 24px;border-bottom:1px solid #e6e4df;background:#ffffffeb}.brand{display:flex;align-items:center;gap:11px;margin-right:auto}.brand-mark{display:grid;place-items:center;width:34px;height:34px;color:#fff;background:#282725;border-radius:10px;font-family:serif;font-weight:700}.brand div{display:grid;gap:2px}.brand strong{font-size:14px}.brand small{color:#949087;font-size:11px}.sync-state{display:flex;align-items:center;gap:6px;color:#8c887f;font-size:12px}.sync-state svg{width:14px}.sync-state.ready{color:#3d806b}.sync-state.error{color:#b64545}.spin{animation:spin 1s linear infinite}.collaboration-loading{display:grid;min-height:240px;place-items:center;color:#8c887f;font-size:13px}.presence{display:flex;align-items:center;gap:8px;color:#716e67;font-size:12px}.avatars{display:flex}.avatars span{display:grid;place-items:center;width:27px;height:27px;margin-left:-6px;border:2px solid #fff;border-radius:50%;color:#fff;font-size:11px;font-weight:700}.avatars span:first-child{margin-left:0}.toolbar{min-height:50px;display:flex;align-items:center;gap:8px;padding:7px 18px;border-bottom:1px solid #e6e4df;background:#fff;overflow-x:auto}.tool-group{display:flex;gap:2px}.toolbar button{min-width:32px;height:32px;padding:0 8px;border:0;border-radius:7px;color:#56534d;background:transparent;cursor:pointer;font-size:13px;font-weight:650}.toolbar button:hover{background:#f0efeb;color:#242320}.toolbar button.active{color:#6248bd;background:#eee9ff}.toolbar svg{width:16px;height:16px;vertical-align:middle}.toolbar .italic{font-style:italic}.tool-divider{width:1px;height:22px;flex:0 0 auto;background:#ebe9e4}.toolbar-spacer{flex:1}.download-button{display:flex;align-items:center;gap:6px;padding:0 12px!important;background:#282725!important;color:#fff!important}.rich-tools{align-items:center;gap:7px}.rich-tools select{height:32px;max-width:116px;padding:0 24px 0 9px;border:1px solid #e4e1da;border-radius:7px;color:#56534d;background:#fff;font:inherit;font-size:12px;cursor:pointer}.color-tool{position:relative;display:grid;place-items:center;width:32px;height:32px;border-radius:7px;color:#56534d;font-weight:700;cursor:pointer}.color-tool:hover{background:#f0efeb}.color-tool span{border-bottom:3px solid #d14f4f;line-height:18px}.color-tool input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}.notice{position:fixed;z-index:20;top:122px;left:50%;transform:translate(-50%);padding:8px 14px;border-radius:8px;color:#fff;background:#292825;box-shadow:0 5px 18px #0002;font-size:12px}.notice.error{background:#b64b4b}.workspace{min-height:0;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);background:#ebeae6;gap:1px}.workspace.mode-edit,.workspace.mode-preview{grid-template-columns:minmax(0,1fr)}.editor-pane,.preview-pane{min-width:0;min-height:0;position:relative;overflow:auto;background:#fff}.pane-label{position:sticky;z-index:5;top:0;height:32px;padding:0 18px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #efeee9;color:#aaa69d;background:#fcfcfaeb;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);font-size:10px;letter-spacing:.08em;text-transform:uppercase}.cm-editor{min-height:100%;font-size:14px}.cm-editor.cm-focused{outline:none}.cm-scroller{padding:20px 0 80px;font-family:SFMono-Regular,Consolas,Liberation Mono,monospace!important;line-height:1.75}.cm-content{max-width:820px;margin:0 auto;padding:0 36px!important}.cm-gutters{color:#c5c1b9;background:#fff!important;border:0!important}.cm-activeLine,.cm-activeLineGutter{background:#faf9f6!important}.cm-ySelectionInfo{font-family:Inter,sans-serif}.exmd-remote-selection{background:color-mix(in srgb,var(--exmd-selection-color) 24%,transparent);border-bottom:2px solid var(--exmd-selection-color)}.exmd-editor .editor-pane[hidden]{display:none}.exmd-editor .exmd-remote-caret{display:inline;position:relative;border-left:2px solid var(--exmd-selection-color);margin-left:-1px;margin-right:-1px;pointer-events:none}.exmd-editor .exmd-remote-label{position:absolute;bottom:100%;left:-2px;padding:1px 5px;border-radius:3px 3px 3px 0;background:var(--exmd-selection-color);color:#fff;white-space:nowrap;font:11px/1.4 system-ui,sans-serif;z-index:4}.exmd-editor .exmd-comment-anchor{text-decoration:underline 2px #d8a12c;text-underline-offset:3px;cursor:pointer}.exmd-editor .exmd-comment-active{background:#ffe5a1}.exmd-host-actions{display:flex;gap:4px;flex-shrink:0}.exmd-host-actions button{display:inline-flex;align-items:center;justify-content:center;min-height:30px;padding:5px 9px;border:0;border-radius:5px;background:transparent;color:#534622;cursor:pointer;font:13px/1.4 system-ui,sans-serif}.exmd-host-actions button:hover{background:#fff2c6}.exmd-host-actions button:disabled{opacity:.4;cursor:not-allowed}.exmd-host-actions svg{width:16px;height:16px}.exmd-selection-toolbar{padding:4px;background:#fff;border:1px solid #e2d9c0;border-radius:8px;box-shadow:0 4px 18px #0002}.markdown-body{max-width:820px;margin:0 auto;padding:34px 46px 100px;line-height:1.75;color:#363431;overflow-wrap:anywhere}.markdown-body h1,.markdown-body h2,.markdown-body h3{color:#22211f;line-height:1.3;margin:1.6em 0 .65em}.markdown-body h1:first-child{margin-top:.15em}.markdown-body h1{font-size:2em;letter-spacing:-.035em}.markdown-body h2{padding-bottom:.25em;border-bottom:1px solid #ebe8e1;font-size:1.45em}.markdown-body p{margin:.8em 0}.markdown-body a{color:#6550bd}.markdown-body blockquote{margin:1.1em 0;padding:.1em 1em;border-left:3px solid #9a88dc;color:#6b6760;background:#f8f6fd}.markdown-body code{padding:.16em .38em;border-radius:5px;color:#a3475a;background:#f3f1ed;font-family:SFMono-Regular,Consolas,monospace;font-size:.88em}.markdown-body pre{padding:18px;overflow:auto;border:1px solid #e7e4dd;border-radius:10px;background:#f7f6f3}.markdown-body pre code{padding:0;color:inherit;background:transparent}.markdown-body img{display:block;max-width:100%;max-height:620px;margin:22px auto;border-radius:8px;box-shadow:0 2px 12px #00000012}.markdown-body table{width:100%;border-collapse:collapse}.markdown-body th,.markdown-body td{padding:8px 12px;border:1px solid #dedbd4}.markdown-body th{background:#f6f5f2;text-align:left}.markdown-body li.task-list-item{list-style:none}.markdown-body input[type=checkbox]{margin-left:-1.35em}.mermaid-diagram{margin:22px 0;overflow:auto;text-align:center}.mermaid-diagram svg{display:block;max-width:100%;height:auto;margin:0 auto}.diagram-error{margin:18px 0;padding:12px;border-radius:8px;color:#a33d3d;background:#fff0f0;font-size:13px}.markdown-body .highlighted-code{margin:18px 0;padding:16px 0;border:1px solid #e7e4dd;border-radius:10px;font-size:13px;line-height:1.65}.highlighted-code .hljs{display:block;padding:0 18px;color:#24292e;background:transparent}.hljs-comment,.hljs-quote{color:#6a737d;font-style:italic}.hljs-keyword,.hljs-selector-tag,.hljs-subst{color:#d73a49}.hljs-string,.hljs-doctag,.hljs-regexp{color:#032f62}.hljs-title,.hljs-section,.hljs-selector-id{color:#6f42c1;font-weight:600}.hljs-number,.hljs-literal,.hljs-variable,.hljs-template-variable{color:#005cc5}.hljs-type,.hljs-class .hljs-title,.hljs-built_in{color:#e36209}.hljs-attr,.hljs-attribute,.hljs-name{color:#22863a}.hljs-meta{color:#735c0f}.hljs-symbol,.hljs-bullet{color:#005cc5}.katex-display{margin:1.4em 0!important;overflow-x:auto;overflow-y:hidden}.exmd-editor footer{display:flex;justify-content:space-between;align-items:center;padding:0 18px;border-top:1px solid #e4e2dc;color:#9b978e;background:#fafaf8;font-size:10px;letter-spacing:.02em}@keyframes spin{to{transform:rotate(360deg)}}@media(max-width:760px){.workspace.mode-split{grid-template-columns:1fr;grid-template-rows:1fr 1fr}.presence>span,.history-tools,.format-tools button:nth-child(n+7),.tool-divider{display:none}.topbar{padding:0 14px}.toolbar{padding-inline:8px}.markdown-body{padding-inline:24px}.cm-content{padding-inline:18px!important}}
1
+ .exmd-editor{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;color:#292825;font-synthesis:none}.exmd-editor,.exmd-editor *{box-sizing:border-box}.exmd-editor button{font:inherit}.exmd-editor.app-shell{display:grid;grid-template-rows:64px auto 1fr 34px;background:#f7f7f5;overflow:hidden}.topbar{display:flex;align-items:center;gap:22px;padding:0 24px;border-bottom:1px solid #e6e4df;background:#ffffffeb}.brand{display:flex;align-items:center;gap:11px;margin-right:auto}.brand-mark{display:grid;place-items:center;width:34px;height:34px;color:#fff;background:#282725;border-radius:10px;font-family:serif;font-weight:700}.brand div{display:grid;gap:2px}.brand strong{font-size:14px}.brand small{color:#949087;font-size:11px}.sync-state{display:flex;align-items:center;gap:6px;color:#8c887f;font-size:12px}.sync-state svg{width:14px}.sync-state.ready{color:#3d806b}.sync-state.error{color:#b64545}.spin{animation:spin 1s linear infinite}.collaboration-loading{display:grid;min-height:240px;place-items:center;color:#8c887f;font-size:13px}.presence{display:flex;align-items:center;gap:8px;color:#716e67;font-size:12px}.avatars{display:flex}.avatars span{display:grid;place-items:center;width:27px;height:27px;margin-left:-6px;border:2px solid #fff;border-radius:50%;color:#fff;font-size:11px;font-weight:700}.avatars span:first-child{margin-left:0}.toolbar{min-height:50px;display:flex;align-items:center;gap:8px;padding:7px 18px;border-bottom:1px solid #e6e4df;background:#fff;overflow-x:auto}.tool-group{display:flex;gap:2px}.toolbar button{min-width:32px;height:32px;padding:0 8px;border:0;border-radius:7px;color:#56534d;background:transparent;cursor:pointer;font-size:13px;font-weight:650}.toolbar button:hover{background:#f0efeb;color:#242320}.toolbar button.active{color:#6248bd;background:#eee9ff}.toolbar svg{width:16px;height:16px;vertical-align:middle}.toolbar .italic{font-style:italic}.tool-divider{width:1px;height:22px;flex:0 0 auto;background:#ebe9e4}.toolbar-spacer{flex:1}.download-button{display:flex;align-items:center;gap:6px;padding:0 12px!important;background:#282725!important;color:#fff!important}.rich-tools{align-items:center;gap:7px}.rich-tools select{height:32px;max-width:116px;padding:0 24px 0 9px;border:1px solid #e4e1da;border-radius:7px;color:#56534d;background:#fff;font:inherit;font-size:12px;cursor:pointer}.color-tool{position:relative;display:grid;place-items:center;width:32px;height:32px;border-radius:7px;color:#56534d;font-weight:700;cursor:pointer}.color-tool:hover{background:#f0efeb}.color-tool span{border-bottom:3px solid #d14f4f;line-height:18px}.color-tool input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}.notice{position:fixed;z-index:20;top:122px;left:50%;transform:translate(-50%);padding:8px 14px;border-radius:8px;color:#fff;background:#292825;box-shadow:0 5px 18px #0002;font-size:12px}.notice.error{background:#b64b4b}.workspace{min-height:0;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);background:#ebeae6;gap:1px}.workspace.mode-edit,.workspace.mode-preview{grid-template-columns:minmax(0,1fr)}.editor-pane,.preview-pane{min-width:0;min-height:0;position:relative;overflow:auto;background:#fff}.pane-label{position:sticky;z-index:5;top:0;height:32px;padding:0 18px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #efeee9;color:#aaa69d;background:#fcfcfaeb;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);font-size:10px;letter-spacing:.08em;text-transform:uppercase}.cm-editor{min-height:100%;font-size:14px}.cm-editor.cm-focused{outline:none}.cm-scroller{padding:20px 0 80px;font-family:SFMono-Regular,Consolas,Liberation Mono,monospace!important;line-height:1.75}.cm-content{max-width:820px;margin:0 auto;padding:0 36px!important}.cm-gutters{color:#c5c1b9;background:#fff!important;border:0!important}.cm-activeLine,.cm-activeLineGutter{background:#faf9f6!important}.cm-ySelectionInfo{font-family:Inter,sans-serif}.exmd-remote-selection{background:color-mix(in srgb,var(--exmd-selection-color) 24%,transparent);border-bottom:2px solid var(--exmd-selection-color)}.exmd-editor .editor-pane[hidden]{display:none}.exmd-editor .exmd-remote-caret{display:inline;position:relative;border-left:2px solid var(--exmd-selection-color);margin-left:-1px;margin-right:-1px;pointer-events:none}.exmd-editor .exmd-remote-label{position:absolute;bottom:100%;left:-2px;padding:1px 5px;border-radius:3px 3px 3px 0;background:var(--exmd-selection-color);color:#fff;white-space:nowrap;font:11px/1.4 system-ui,sans-serif;z-index:4}.exmd-editor .exmd-comment-anchor{text-decoration:underline 2px #d8a12c;text-underline-offset:3px;cursor:pointer}.exmd-editor .exmd-comment-active{background:#ffe5a1}.exmd-host-actions{display:flex;gap:4px;flex-shrink:0}.exmd-host-actions button{display:inline-flex;align-items:center;justify-content:center;min-height:30px;padding:5px 9px;border:0;border-radius:5px;background:transparent;color:#534622;cursor:pointer;font:13px/1.4 system-ui,sans-serif}.exmd-host-actions button:hover{background:#fff2c6}.exmd-host-actions button:disabled{opacity:.4;cursor:not-allowed}.exmd-host-actions svg{width:16px;height:16px}.exmd-selection-toolbar{padding:4px;background:#fff;border:1px solid #e2d9c0;border-radius:8px;box-shadow:0 4px 18px #0002}.markdown-body{max-width:820px;margin:0 auto;padding:34px 46px 100px;line-height:1.75;color:#363431;overflow-wrap:anywhere}.markdown-body h1,.markdown-body h2,.markdown-body h3{color:#22211f;line-height:1.3;margin:1.6em 0 .65em}.markdown-body h1:first-child{margin-top:.15em}.markdown-body h1{font-size:2em;letter-spacing:-.035em}.markdown-body h2{padding-bottom:.25em;border-bottom:1px solid #ebe8e1;font-size:1.45em}.markdown-body p{margin:.8em 0}.markdown-body a{color:#6550bd}.markdown-body blockquote{margin:1.1em 0;padding:.1em 1em;border-left:3px solid #9a88dc;color:#6b6760;background:#f8f6fd}.markdown-body code{padding:.16em .38em;border-radius:5px;color:#a3475a;background:#f3f1ed;font-family:SFMono-Regular,Consolas,monospace;font-size:.88em}.markdown-body pre{padding:18px;overflow:auto;border:1px solid #e7e4dd;border-radius:10px;background:#f7f6f3}.markdown-body pre code{padding:0;color:inherit;background:transparent}.markdown-body img{display:block;max-width:100%;max-height:620px;margin:22px auto;border-radius:8px;box-shadow:0 2px 12px #00000012}.markdown-body table{width:100%;border-collapse:collapse}.markdown-body th,.markdown-body td{padding:8px 12px;border:1px solid #dedbd4}.markdown-body th{background:#f6f5f2;text-align:left}.markdown-body li.task-list-item{list-style:none}.markdown-body input[type=checkbox]{margin-left:-1.35em}.mermaid-diagram{margin:22px 0;overflow:auto;text-align:center}.mermaid-diagram svg{display:block;max-width:100%;height:auto;margin:0 auto}.diagram-error{margin:18px 0;padding:12px;border-radius:8px;color:#a33d3d;background:#fff0f0;font-size:13px}.markdown-body .highlighted-code{margin:18px 0;padding:16px 0;border:1px solid #e7e4dd;border-radius:10px;font-size:13px;line-height:1.65}.highlighted-code .hljs{display:block;padding:0 18px;color:#24292e;background:transparent}.hljs-comment,.hljs-quote{color:#6a737d;font-style:italic}.hljs-keyword,.hljs-selector-tag,.hljs-subst{color:#d73a49}.hljs-string,.hljs-doctag,.hljs-regexp{color:#032f62}.hljs-title,.hljs-section,.hljs-selector-id{color:#6f42c1;font-weight:600}.hljs-number,.hljs-literal,.hljs-variable,.hljs-template-variable{color:#005cc5}.hljs-type,.hljs-class .hljs-title,.hljs-built_in{color:#e36209}.hljs-attr,.hljs-attribute,.hljs-name{color:#22863a}.hljs-meta{color:#735c0f}.hljs-symbol,.hljs-bullet{color:#005cc5}.katex-display{margin:1.4em 0!important;overflow-x:auto;overflow-y:hidden}.exmd-editor footer{display:flex;justify-content:space-between;align-items:center;padding:0 18px;border-top:1px solid #e4e2dc;color:#9b978e;background:#fafaf8;font-size:10px;letter-spacing:.02em}@keyframes spin{to{transform:rotate(360deg)}}@media(max-width:760px){.workspace.mode-split{grid-template-columns:1fr;grid-template-rows:1fr 1fr}.presence>span,.history-tools,.format-tools button:nth-child(n+7),.tool-divider{display:none}.topbar{padding:0 14px}.toolbar{padding-inline:8px}.markdown-body{padding-inline:24px}.cm-content{padding-inline:18px!important}}.exmd-image-lightbox,.exmd-image-lightbox *{box-sizing:border-box}.exmd-image-lightbox{position:fixed;z-index:10000;inset:0;overflow:hidden;outline:none;color:#fff;background:#111215f0;font:13px/1.4 Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.exmd-image-lightbox button{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:36px;height:36px;padding:7px;border:0;border-radius:8px;color:#fff;background:#ffffff17;cursor:pointer;font:inherit}.exmd-image-lightbox button:hover{background:#ffffff2e}.exmd-image-lightbox button:focus-visible{outline:2px solid #b8a9ff;outline-offset:3px}.exmd-image-lightbox button:disabled{opacity:.3;cursor:default}.exmd-image-lightbox button svg{width:20px;height:20px}.exmd-image-lightbox-toolbar{position:absolute;z-index:2;inset:16px 20px auto;display:flex;align-items:center;gap:8px;min-height:40px}.exmd-image-lightbox-title{overflow:hidden;min-width:0;margin-right:auto;color:#eee;text-overflow:ellipsis;white-space:nowrap}.exmd-image-lightbox-counter{padding:0 10px;white-space:nowrap;color:#c5c5cb;font-variant-numeric:tabular-nums}.exmd-image-lightbox-scale{min-width:42px;text-align:center;color:#c5c5cb;font-variant-numeric:tabular-nums}.exmd-image-lightbox-close{margin-left:8px}.exmd-image-lightbox-stage{position:absolute;inset:72px 0 50px;display:grid;place-items:center;overflow:hidden;touch-action:none;-webkit-user-select:none;user-select:none;cursor:grab}.exmd-image-lightbox-stage.is-dragging{cursor:grabbing}.exmd-image-lightbox-image{display:block;max-width:calc(100vw - 112px);max-height:calc(100vh - 152px);object-fit:contain;transform-origin:center;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.exmd-image-lightbox-unavailable{padding:24px;color:#c5c5cb;cursor:default}.exmd-image-lightbox .exmd-image-lightbox-previous,.exmd-image-lightbox .exmd-image-lightbox-next{position:absolute;z-index:2;top:50%;width:40px;height:48px;margin-top:-24px;background:#0000007a}.exmd-image-lightbox-previous{left:16px}.exmd-image-lightbox-next{right:16px}.exmd-image-lightbox-hint{position:absolute;bottom:12px;left:16px;right:16px;margin:0;text-align:center;color:#9999a3;pointer-events:none}@media(max-width:600px){.exmd-image-lightbox-toolbar{inset:10px 10px auto;gap:4px}.exmd-image-lightbox-title{flex:1}.exmd-image-lightbox-counter{padding:0 4px}.exmd-image-lightbox-scale{display:none}.exmd-image-lightbox-close{margin-left:2px}.exmd-image-lightbox-image{max-width:calc(100vw - 48px)}.exmd-image-lightbox-previous{left:8px}.exmd-image-lightbox-next{right:8px}.exmd-image-lightbox-hint{font-size:11px}}.markdown-body [data-exmd-preview-kind]{cursor:zoom-in}.markdown-body [data-exmd-preview-kind]:focus-visible{outline:2px solid #8d77d7;outline-offset:4px}
@@ -0,0 +1,13 @@
1
+ import { type EditorMessages } from '../editor/i18n';
2
+ import type { MarkdownPreviewImage } from '../editor/image-preview';
3
+ interface ImageLightboxProps {
4
+ images: readonly MarkdownPreviewImage[];
5
+ index: number;
6
+ onClose(): void;
7
+ locale?: string;
8
+ messages?: EditorMessages;
9
+ }
10
+ /** A view-only gallery. Resource authorization and URL resolution stay with the host. */
11
+ export declare function ImageLightbox({ images, index, onClose, locale, messages }: ImageLightboxProps): import("react").ReactPortal | null;
12
+ export {};
13
+ //# sourceMappingURL=ImageLightbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageLightbox.d.ts","sourceRoot":"","sources":["../../../src/components/ImageLightbox.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAEnE,UAAU,kBAAkB;IAC1B,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAA;IACvC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,IAAI,IAAI,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,cAAc,CAAA;CAC1B;AAeD,yFAAyF;AACzF,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,kBAAkB,sCA6I7F"}
@@ -1,8 +1,11 @@
1
- import type { EditorMessages } from '../editor/i18n';
1
+ import { type EditorMessages } from '../editor/i18n';
2
2
  import type { MarkdownPreviewInteraction } from '../editor/preview-interaction';
3
+ import { type MarkdownImagePreviewEvent } from '../editor/image-preview';
3
4
  export interface MarkdownPreviewProps {
4
5
  value: string;
5
6
  resolveImageUrl?: (path: string) => string | Promise<string>;
7
+ /** When supplied, the host takes over preview and gallery navigation, including in readonly mode. */
8
+ onImagePreview?: (event: MarkdownImagePreviewEvent) => void;
6
9
  /** Forward unchanged from a custom Preview wrapper to retain precise selection/comment support. */
7
10
  interaction?: MarkdownPreviewInteraction;
8
11
  locale?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownPreview.d.ts","sourceRoot":"","sources":["../../../src/components/MarkdownPreview.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAA;AAiB/E,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAC5D,mGAAmG;IACnG,WAAW,CAAC,EAAE,0BAA0B,CAAA;IACxC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,cAAc,CAAA;CAC1B;AAED,eAAO,MAAM,eAAe,4DAyB1B,CAAA"}
1
+ {"version":3,"file":"MarkdownPreview.d.ts","sourceRoot":"","sources":["../../../src/components/MarkdownPreview.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAA;AAC/E,OAAO,EAAwB,KAAK,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAkB9F,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAC5D,qGAAqG;IACrG,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAA;IAC3D,mGAAmG;IACnG,WAAW,CAAC,EAAE,0BAA0B,CAAA;IACxC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,cAAc,CAAA;CAC1B;AAED,eAAO,MAAM,eAAe,4DAsE1B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"MermaidDiagram.d.ts","sourceRoot":"","sources":["../../../src/components/MermaidDiagram.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAI/D,MAAM,WAAW,mBAAmB;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,cAAc,CAAA;CAAE;AACjG,eAAO,MAAM,cAAc,2DAmBzB,CAAA"}
1
+ {"version":3,"file":"MermaidDiagram.d.ts","sourceRoot":"","sources":["../../../src/components/MermaidDiagram.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAI/D,MAAM,WAAW,mBAAmB;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,cAAc,CAAA;CAAE;AACjG,eAAO,MAAM,cAAc,2DAoBzB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../src/editor/i18n.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAA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GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,KAAK,MAAM,CAAA;AAEvE,iGAAiG;AACjG,wBAAgB,mBAAmB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAGhE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAEjE;AA+QD,wBAAgB,iBAAiB,IAAI;IAAE,EAAE,EAAE,MAAM,EAAE,CAAC;IAAC,EAAE,EAAE,MAAM,EAAE,CAAA;CAAE,CAElE;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,MAAM,CAsB5H;AAED,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,SAAS,CAEnF;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,MAAM,CAIpJ"}
@@ -0,0 +1,30 @@
1
+ /** A view-only media occurrence in the current Markdown document. */
2
+ export interface MarkdownPreviewImage {
3
+ /** Source identity plus occurrence; stable across URL refreshes and unrelated text edits. Not a permanent anchor. */
4
+ id: string;
5
+ kind: 'image' | 'mermaid';
6
+ /** Original Markdown resource path. The host owns its authorization and URL resolution. */
7
+ path?: string;
8
+ /** Currently resolved display URL, or generated Mermaid SVG data URL. Never persist it. */
9
+ src?: string;
10
+ alt: string;
11
+ title?: string;
12
+ /** UTF-16 offsets in the displayed Markdown snapshot, when supplied by the parser. */
13
+ source?: {
14
+ from: number;
15
+ to: number;
16
+ };
17
+ width?: number;
18
+ height?: number;
19
+ }
20
+ export interface MarkdownImagePreviewEvent {
21
+ image: MarkdownPreviewImage;
22
+ /** All media occurrences in this preview, in document order, including unresolved images. */
23
+ images: readonly MarkdownPreviewImage[];
24
+ index: number;
25
+ }
26
+ export declare function collectPreviewImages(root: HTMLElement): {
27
+ elements: HTMLElement[];
28
+ images: MarkdownPreviewImage[];
29
+ };
30
+ //# sourceMappingURL=image-preview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-preview.d.ts","sourceRoot":"","sources":["../../../src/editor/image-preview.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,MAAM,WAAW,oBAAoB;IACnC,qHAAqH;IACrH,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,OAAO,GAAG,SAAS,CAAA;IACzB,2FAA2F;IAC3F,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2FAA2F;IAC3F,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sFAAsF;IACtF,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAA;IACrC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,oBAAoB,CAAA;IAC3B,6FAA6F;IAC7F,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAA;IACvC,KAAK,EAAE,MAAM,CAAA;CACd;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW;;;EAsCrD"}
@@ -0,0 +1,77 @@
1
+ import type { EditorMessages } from './i18n';
2
+ export declare const PDF_FILE_MIME: "application/pdf";
3
+ export declare const DEFAULT_PDF_IMPORT_MAX_BYTES: number;
4
+ export declare const DEFAULT_PDF_IMPORT_MAX_PAGES = 100;
5
+ export declare const DEFAULT_PDF_IMPORT_MAX_IMAGE_PIXELS = 40000000;
6
+ export declare const DEFAULT_PDF_IMPORT_TIMEOUT_MS = 30000;
7
+ export type PdfFileWarningCode = 'NO_TEXT_EXTRACTED' | 'COMPLEX_LAYOUT' | 'MULTI_COLUMN_LAYOUT' | 'COMPLEX_TABLE' | 'EXTERNAL_URL_SKIPPED' | 'UNSAFE_URL_SKIPPED' | 'IMAGE_EXTRACT_FAILED' | 'IMAGE_PIXEL_LIMIT' | 'RESOURCE_UNRESOLVED' | 'RESOURCE_RESOLUTION_FAILED' | 'FONT_FALLBACK' | 'MATH_DEGRADED' | 'UNSUPPORTED_CONTENT';
8
+ export interface PdfFileWarning {
9
+ code: PdfFileWarningCode;
10
+ message: string;
11
+ page?: number;
12
+ path?: string;
13
+ }
14
+ export type PdfFileErrorCode = 'READ_FAILED' | 'FILE_TOO_LARGE' | 'PAGE_LIMIT_EXCEEDED' | 'IMAGE_PIXEL_LIMIT' | 'INVALID_PDF' | 'PASSWORD_REQUIRED' | 'ABORTED' | 'TIMEOUT';
15
+ export declare class PdfFileError extends Error {
16
+ readonly code: PdfFileErrorCode;
17
+ readonly cause?: unknown;
18
+ constructor(code: PdfFileErrorCode, message: string, cause?: unknown);
19
+ }
20
+ export interface PdfImportOptions {
21
+ maxBytes?: number;
22
+ maxPages?: number;
23
+ maxImagePixels?: number;
24
+ timeoutMs?: number;
25
+ signal?: AbortSignal;
26
+ locale?: string;
27
+ messages?: EditorMessages;
28
+ }
29
+ export interface PdfImportResource {
30
+ key: string;
31
+ bytes: Uint8Array;
32
+ filename: string;
33
+ mimeType: string;
34
+ alt?: string;
35
+ }
36
+ export interface PdfImportResult {
37
+ ok: true;
38
+ markdown: string;
39
+ resources: PdfImportResource[];
40
+ metadata?: {
41
+ title?: string;
42
+ author?: string;
43
+ };
44
+ warnings: PdfFileWarning[];
45
+ }
46
+ export interface PdfExportOptions {
47
+ fileName?: string;
48
+ signal?: AbortSignal;
49
+ resolveResource?: (resource: {
50
+ path: string;
51
+ alt?: string;
52
+ }) => Promise<{
53
+ bytes: Blob | Uint8Array;
54
+ }>;
55
+ /** Optional embedded TTF/OTF font. Supplying a CJK font preserves Chinese glyphs. */
56
+ fontBytes?: Uint8Array | ArrayBuffer;
57
+ /** Whether to subset the embedded font. Disable for CJK fonts when the renderer has incomplete CMap support. */
58
+ fontSubset?: boolean;
59
+ fontName?: string;
60
+ margin?: number | {
61
+ top?: number;
62
+ right?: number;
63
+ bottom?: number;
64
+ left?: number;
65
+ };
66
+ pageSize?: [number, number];
67
+ locale?: string;
68
+ messages?: EditorMessages;
69
+ }
70
+ export interface PdfExportResult {
71
+ blob: Blob;
72
+ fileName: string;
73
+ mimeType: typeof PDF_FILE_MIME;
74
+ warnings: PdfFileWarning[];
75
+ }
76
+ export type PdfFileInput = Blob | File | ArrayBuffer | ArrayBufferView;
77
+ //# sourceMappingURL=pdf-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdf-contract.d.ts","sourceRoot":"","sources":["../../../src/editor/pdf-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAE5C,eAAO,MAAM,aAAa,EAAG,iBAA0B,CAAA;AACvD,eAAO,MAAM,4BAA4B,QAAmB,CAAA;AAC5D,eAAO,MAAM,4BAA4B,MAAM,CAAA;AAC/C,eAAO,MAAM,mCAAmC,WAAa,CAAA;AAC7D,eAAO,MAAM,6BAA6B,QAAS,CAAA;AAEnD,MAAM,MAAM,kBAAkB,GAC1B,mBAAmB,GACnB,gBAAgB,GAChB,qBAAqB,GACrB,eAAe,GACf,sBAAsB,GACtB,oBAAoB,GACpB,sBAAsB,GACtB,mBAAmB,GACnB,qBAAqB,GACrB,4BAA4B,GAC5B,eAAe,GACf,eAAe,GACf,qBAAqB,CAAA;AAEzB,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,kBAAkB,CAAA;IACxB,OA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C/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC;QAAE,KAAK,EAAE,IAAI,GAAG,UAAU,CAAA;KAAE,CAAC,CAAA;IACrG,qFAAqF;IACrF,SAAS,CAAC,EAAE,UAAU,GAAG,WAAW,CAAA;IACpC,gHAAgH;IAChH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAClF,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,cAAc,CAAA;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,OAAO,aAAa,CAAA;IAC9B,QAAQ,EAAE,cAAc,EAAE,CAAA;CAC3B;AAED,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,WAAW,GAAG,eAAe,CAAA"}
@@ -0,0 +1,7 @@
1
+ import 'pdfjs-dist/legacy/build/pdf.worker.mjs';
2
+ import type { PdfFileInput, PdfImportOptions, PdfImportResult, PdfExportOptions, PdfExportResult } from './pdf-contract';
3
+ /** Extracts local PDF content only. It never uses PDF URLs, fetch, Doca APIs or Yjs. */
4
+ export declare function importPdfFile(file: PdfFileInput, options?: PdfImportOptions): Promise<PdfImportResult>;
5
+ /** Generates a PDF from Markdown without mounting or reading the editor DOM. */
6
+ export declare function exportPdfFile(markdown: string, options?: PdfExportOptions): Promise<PdfExportResult>;
7
+ //# sourceMappingURL=pdf-file-impl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdf-file-impl.d.ts","sourceRoot":"","sources":["../../../src/editor/pdf-file-impl.ts"],"names":[],"mappings":"AAIA,OAAO,wCAAwC,CAAA;AAO/C,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAqB,gBAAgB,EAChG,eAAe,EAAoC,MAAM,gBAAgB,CAAA;AAsN3E,wFAAwF;AACxF,wBAAsB,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAqHhH;AA0JD,gFAAgF;AAChF,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAgP9G"}
@@ -1,81 +1,7 @@
1
- import 'pdfjs-dist/legacy/build/pdf.worker.mjs';
2
- import { type EditorMessages } from './i18n';
3
- export declare const PDF_FILE_MIME: "application/pdf";
4
- export declare const DEFAULT_PDF_IMPORT_MAX_BYTES: number;
5
- export declare const DEFAULT_PDF_IMPORT_MAX_PAGES = 100;
6
- export declare const DEFAULT_PDF_IMPORT_MAX_IMAGE_PIXELS = 40000000;
7
- export declare const DEFAULT_PDF_IMPORT_TIMEOUT_MS = 30000;
8
- export type PdfFileWarningCode = 'NO_TEXT_EXTRACTED' | 'COMPLEX_LAYOUT' | 'MULTI_COLUMN_LAYOUT' | 'COMPLEX_TABLE' | 'EXTERNAL_URL_SKIPPED' | 'UNSAFE_URL_SKIPPED' | 'IMAGE_EXTRACT_FAILED' | 'IMAGE_PIXEL_LIMIT' | 'RESOURCE_UNRESOLVED' | 'RESOURCE_RESOLUTION_FAILED' | 'FONT_FALLBACK' | 'MATH_DEGRADED' | 'UNSUPPORTED_CONTENT';
9
- export interface PdfFileWarning {
10
- code: PdfFileWarningCode;
11
- message: string;
12
- page?: number;
13
- path?: string;
14
- }
15
- export type PdfFileErrorCode = 'READ_FAILED' | 'FILE_TOO_LARGE' | 'PAGE_LIMIT_EXCEEDED' | 'IMAGE_PIXEL_LIMIT' | 'INVALID_PDF' | 'PASSWORD_REQUIRED' | 'ABORTED' | 'TIMEOUT';
16
- export declare class PdfFileError extends Error {
17
- readonly code: PdfFileErrorCode;
18
- readonly cause?: unknown;
19
- constructor(code: PdfFileErrorCode, message: string, cause?: unknown);
20
- }
21
- export interface PdfImportOptions {
22
- maxBytes?: number;
23
- maxPages?: number;
24
- maxImagePixels?: number;
25
- timeoutMs?: number;
26
- signal?: AbortSignal;
27
- locale?: string;
28
- messages?: EditorMessages;
29
- }
30
- export interface PdfImportResource {
31
- key: string;
32
- bytes: Uint8Array;
33
- filename: string;
34
- mimeType: string;
35
- alt?: string;
36
- }
37
- export interface PdfImportResult {
38
- ok: true;
39
- markdown: string;
40
- resources: PdfImportResource[];
41
- metadata?: {
42
- title?: string;
43
- author?: string;
44
- };
45
- warnings: PdfFileWarning[];
46
- }
47
- export interface PdfExportOptions {
48
- fileName?: string;
49
- signal?: AbortSignal;
50
- resolveResource?: (resource: {
51
- path: string;
52
- alt?: string;
53
- }) => Promise<{
54
- bytes: Blob | Uint8Array;
55
- }>;
56
- /** Optional embedded TTF/OTF font. Supplying a CJK font preserves Chinese glyphs. */
57
- fontBytes?: Uint8Array | ArrayBuffer;
58
- /** Whether to subset the embedded font. Disable for CJK fonts when the renderer has incomplete CMap support. */
59
- fontSubset?: boolean;
60
- fontName?: string;
61
- margin?: number | {
62
- top?: number;
63
- right?: number;
64
- bottom?: number;
65
- left?: number;
66
- };
67
- pageSize?: [number, number];
68
- locale?: string;
69
- messages?: EditorMessages;
70
- }
71
- export interface PdfExportResult {
72
- blob: Blob;
73
- fileName: string;
74
- mimeType: typeof PDF_FILE_MIME;
75
- warnings: PdfFileWarning[];
76
- }
77
- export type PdfFileInput = Blob | File | ArrayBuffer | ArrayBufferView;
78
- /** Extracts local PDF content only. It never uses PDF URLs, fetch, Doca APIs or Yjs. */
1
+ import type { PdfFileInput, PdfImportOptions, PdfImportResult, PdfExportOptions, PdfExportResult } from './pdf-contract';
2
+ export { PdfFileError, PDF_FILE_MIME, DEFAULT_PDF_IMPORT_MAX_BYTES, DEFAULT_PDF_IMPORT_MAX_PAGES, DEFAULT_PDF_IMPORT_MAX_IMAGE_PIXELS, DEFAULT_PDF_IMPORT_TIMEOUT_MS } from './pdf-contract';
3
+ export type { PdfFileInput, PdfImportOptions, PdfImportResult, PdfImportResource, PdfExportOptions, PdfExportResult, PdfFileWarning, PdfFileWarningCode, PdfFileErrorCode } from './pdf-contract';
4
+ /** Extracts local PDF content only. PDF runtimes load on the first explicit conversion. */
79
5
  export declare function importPdfFile(file: PdfFileInput, options?: PdfImportOptions): Promise<PdfImportResult>;
80
6
  /** Generates a PDF from Markdown without mounting or reading the editor DOM. */
81
7
  export declare function exportPdfFile(markdown: string, options?: PdfExportOptions): Promise<PdfExportResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"pdf-file.d.ts","sourceRoot":"","sources":["../../../src/editor/pdf-file.ts"],"names":[],"mappings":"AAIA,OAAO,wCAAwC,CAAA;AAI/C,OAAO,EAAiB,KAAK,cAAc,EAAkB,MAAM,QAAQ,CAAA;AAE3E,eAAO,MAAM,aAAa,EAAG,iBAA0B,CAAA;AACvD,eAAO,MAAM,4BAA4B,QAAmB,CAAA;AAC5D,eAAO,MAAM,4BAA4B,MAAM,CAAA;AAC/C,eAAO,MAAM,mCAAmC,WAAa,CAAA;AAC7D,eAAO,MAAM,6BAA6B,QAAS,CAAA;AAEnD,MAAM,MAAM,kBAAkB,GAC1B,mBAAmB,GACnB,gBAAgB,GAChB,qBAAqB,GACrB,eAAe,GACf,sBAAsB,GACtB,oBAAoB,GACpB,sBAAsB,GACtB,mBAAmB,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O,CAAC,eAAe,CAAC,CAqHhH;AA0JD,gFAAgF;AAChF,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAgP9G"}
1
+ {"version":3,"file":"pdf-file.d.ts","sourceRoot":"","sources":["../../../src/editor/pdf-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAExH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,4BAA4B,EAAE,4BAA4B,EAC9F,mCAAmC,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAC5F,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EAAE,gBAAgB,EAChG,eAAe,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAE/F,2FAA2F;AAC3F,wBAAsB,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAGhH;AAED,gFAAgF;AAChF,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAG9G"}
@@ -2,6 +2,7 @@ import { type ComponentType } from 'react';
2
2
  import type { CollaborationSession, CollaborationUser, ConnectionState, ViewMode } from '../editor/types';
3
3
  import type { ToolbarProps } from '../components/Toolbar';
4
4
  import type { MarkdownPreviewProps } from '../components/MarkdownPreview';
5
+ import type { MarkdownImagePreviewEvent } from '../editor/image-preview';
5
6
  import type { CollaborativeMarkdownEditorHandle, EditorMode, EditorResources, MarkdownSelectionAction } from '../editor/integration';
6
7
  import { type EditorMessages } from '../editor/i18n';
7
8
  export interface EditorHeaderProps {
@@ -50,6 +51,8 @@ export interface CollaborativeMarkdownEditorProps {
50
51
  mode?: EditorMode;
51
52
  /** Host-owned asset callbacks. Keep this object reference stable for the document session. */
52
53
  resources?: EditorResources;
54
+ /** Host-owned image/diagram preview and document gallery. Omit to use the built-in lightbox. */
55
+ onImagePreview?: (event: MarkdownImagePreviewEvent) => void;
53
56
  onUploadProgress?: (percent: number) => void;
54
57
  onChange?: (markdown: string) => void;
55
58
  onConnectionChange?: (state: ConnectionState) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"CollaborativeMarkdownEditor.d.ts","sourceRoot":"","sources":["../../../src/lib/CollaborativeMarkdownEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4F,KAAK,aAAa,EAAE,MAAM,OAAO,CAAA;AAoBpI,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACzG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AACzE,OAAO,KAAK,EAAE,iCAAiC,EAAE,UAAU,EAAE,eAAe,EACtD,uBAAuB,EAAkC,MAAM,uBAAuB,CAAA;AAK5G,OAAO,EAAwD,KAAK,cAAc,EAAsB,MAAM,gBAAgB,CAAA;AAE9H,MAAM,WAAW,iBAAiB;IAAG,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,oBAAoB,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,cAAc,CAAA;CAAE;AAC/I,MAAM,WAAW,kBAAkB;IAAG,KAAK,EAAE,eAAe,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,cAAc,CAAA;CAAE;AACjI,MAAM,WAAW,iBAAiB;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K,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,iBAAiB,+BAKlG;AACD,wBAAgB,oBAAoB,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,kBAAkB,+BAAsI;AACjO,wBAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,iBAAiB,+BAGpF"}
@@ -3,6 +3,7 @@ export { CollaborativeMarkdownEditor, DefaultEditorHeader, DefaultEditorLoading,
3
3
  export type { CollaborativeMarkdownEditorProps, CollaborativeMarkdownEditorComponents, EditorHeaderProps, EditorLoadingProps, EditorFooterProps } from './CollaborativeMarkdownEditor';
4
4
  export { MarkdownPreview } from '../components/MarkdownPreview';
5
5
  export type { MarkdownPreviewProps } from '../components/MarkdownPreview';
6
+ export type { MarkdownPreviewImage, MarkdownImagePreviewEvent } from '../editor/image-preview';
6
7
  export type { MarkdownPreviewInteraction } from '../editor/preview-interaction';
7
8
  export { Toolbar } from '../components/Toolbar';
8
9
  export type { ToolbarProps } from '../components/Toolbar';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AAEtB,OAAO,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAC3I,YAAY,EAAE,gCAAgC,EAAE,qCAAqC,EACnF,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,YAAY,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AACzE,YAAY,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAA;AAC/E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,YAAY,E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;AAChG,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EAAE,gBAAgB,EAChG,eAAe,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACnG,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,mBAAmB,EAAE,eAAe,EAAE,mBAAmB,EAC9F,iBAAiB,EAAE,mBAAmB,EAAE,iCAAiC,EACzE,kBAAkB,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAA;AAC5G,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,2BAA2B,EACxF,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AACvF,YAAY,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC7F,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAChE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAClF,YAAY,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,kBAAkB,EACjF,iBAAiB,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAChG,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,YAAY,EACvF,kBAAkB,EAAE,sBAAsB,EAAE,eAAe,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC3G,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClF,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA"}
@@ -20,3 +20,7 @@
20
20
  - 评论锚点使用永久 Yjs RelativePosition,不能复用 awareness 游标。
21
21
 
22
22
  当前 `y-websocket` 适配器用于本地演示,没有持久化 ACK,因此公开的 `saveState` 固定为 `unavailable`。产品界面不应据此显示“已保存”。
23
+
24
+ ## 图片预览边界(0.4.4)
25
+
26
+ `onImagePreview` 可由宿主接管当前图片和同文档图集;原始资源 `path` 保留,URL 解析和资源 ACL 仍归宿主。未传回调时使用内置拖动、缩放与切图界面。图片和 Mermaid 图表预览均只改变组件状态,不写 Y.Text、不重建编辑器、不进入 undo/outbox。协议、codec/schema、基线、历史读取与存储格式均未改变。事件定义和稳定性范围见 [IMAGE_PREVIEW.md](IMAGE_PREVIEW.md)。
@@ -0,0 +1,62 @@
1
+ # Image preview contract
2
+
3
+ Available from `@smartdoca/markdown` 0.4.4. The package root exports the types
4
+ `MarkdownImagePreviewEvent` and `MarkdownPreviewImage`. Both
5
+ `CollaborativeMarkdownEditorProps` and `MarkdownPreviewProps` provide:
6
+
7
+ ```ts
8
+ onImagePreview?: (event: MarkdownImagePreviewEvent) => void
9
+ ```
10
+
11
+ When supplied, the callback completely owns preview. Otherwise the package opens
12
+ its built-in gallery. A custom `components.Preview` must forward the prop to
13
+ `MarkdownPreview` to retain this behavior, as it forwards `interaction` for comments.
14
+
15
+ ```tsx
16
+ const onImagePreview = (event: MarkdownImagePreviewEvent) => {
17
+ // The host already knows the document ID and its current access flags.
18
+ // Authorize image.path through the host asset service; do not persist image.src.
19
+ openHostGallery(event.images, event.index)
20
+ }
21
+ ```
22
+
23
+ `event.image === event.images[event.index]`. `images` is a snapshot of the current
24
+ preview in document order: ordinary Markdown images, reference images, sanitized
25
+ HTML images, repeated resource occurrences, and successfully rendered Mermaid
26
+ diagrams. It is scoped to one `MarkdownPreview`; it never queries other documents
27
+ or the host's asset directory. Unresolved images remain in the collection with
28
+ their original `path` and an absent `src`. Diagrams without a rendered SVG cannot
29
+ be previewed and are omitted.
30
+
31
+ Each item contains:
32
+
33
+ | Field | Meaning |
34
+ | --- | --- |
35
+ | `id` | Deterministic kind/source identity plus occurrence number. Stable through signed-URL refreshes and unrelated text edits. Duplicate insertion/reordering can change occurrence identity; this is not a persistent comment anchor. |
36
+ | `kind` | `image` or `mermaid`. |
37
+ | `path?` | For images, the original renderer resource path, before `resolveImageUrl` / `resources.resolveUrl`. It is the host-owned resource identity. |
38
+ | `src?` | Current resolved display URL for images; generated SVG data URL for diagrams. Transient view state, never a durable resource identifier or authorization grant. |
39
+ | `alt` / `title?` | Document-provided display text; diagram alt text uses the UI catalog. |
40
+ | `source?` | UTF-16 `from` / `to` offsets in the displayed Markdown snapshot, when the parser supplies them. Offsets are not permanent anchors and can lag current editing while preview debounce is active. |
41
+ | `width?` / `height?` | Known natural image dimensions or SVG view-box dimensions. |
42
+
43
+ The callback is synchronous and its return value is ignored. Hosts may launch
44
+ their own async URL resolution inside it. The latest callback is used on each
45
+ activation. Linked images prevent link navigation when preview opens. Enter and
46
+ Space activate focused images and diagrams; readonly mode uses the same callback.
47
+
48
+ The built-in gallery supports pointer drag at every zoom, wheel/button zoom,
49
+ previous/next buttons, arrow keys, initial-zoom touch swipes, reset, Escape,
50
+ focus containment/restoration, and restoring the body's previous scroll state.
51
+ Changing displayed Markdown, the resolver, or preview ownership closes its
52
+ snapshot. Preview does not upload/download resources, create a transport, write
53
+ Markdown/Yjs, replace the editor, or change undo history.
54
+
55
+ While the built-in gallery is open, pending image URL resolutions refresh the
56
+ existing snapshot items in place. They do not change the active occurrence or
57
+ write to the document. A pending Mermaid rerender cannot expose the preceding
58
+ diagram SVG under a new source identity.
59
+
60
+ This optional UI boundary introduces no codec, schema, migration, legacy reader,
61
+ format default, or stored-data conversion. Host ACLs and existing resource access
62
+ flags must still be enforced when opening a gallery or resolving another item.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartdoca/markdown",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "files": [
17
17
  "dist",
18
- "docs",
18
+ "docs/*.md",
19
19
  "examples",
20
20
  "README.md",
21
21
  "LICENSE"
@@ -35,6 +35,7 @@
35
35
  "test:idle": "yarn build:lib && node --test tests/idle.test.mjs",
36
36
  "test:files": "yarn build:lib && node --test tests/markdown-file.test.mjs",
37
37
  "test:pdf": "yarn build:lib && node --test tests/pdf-file.test.mjs",
38
+ "test:pdf-lazy": "yarn build:lib && node --test tests/pdf-lazy.test.mjs",
38
39
  "test:i18n": "node --experimental-strip-types --test tests/i18n.test.mjs",
39
40
  "test:browser": "yarn build:lib && vite --host 127.0.0.1 --port 5198 --strictPort --open /tests/browser/index.html",
40
41
  "preview": "vite preview"
@@ -85,7 +86,7 @@
85
86
  "vite": "^7.1.4",
86
87
  "yjs": "^13.6.27"
87
88
  },
88
- "license": "AGPL-3.0-only",
89
+ "license": "MIT",
89
90
  "repository": {
90
91
  "type": "git",
91
92
  "url": "git+https://github.com/smartdoca/markdown.git"