superdoc 2.7.0-next.2 → 2.7.0-next.21
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/chunks/{create-super-doc-ui-C44xPZxz.cjs → create-super-doc-ui-B5nhSKqa.cjs} +11 -3
- package/dist/chunks/{create-super-doc-ui-BTNVc3UD.es.js → create-super-doc-ui-BJ6D4BfN.es.js} +11 -3
- package/dist/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/document-api/src/capabilities/capabilities.d.ts +3 -0
- package/dist/document-api/src/capabilities/html-markdown-support.d.ts +66 -0
- package/dist/document-api/src/content-projection/validation.d.ts +3 -0
- package/dist/document-api/src/contract/command-catalog.d.ts +1 -1
- package/dist/document-api/src/contract/operation-definitions.d.ts +34 -1
- package/dist/document-api/src/contract/operation-registry.d.ts +20 -3
- package/dist/document-api/src/diff/diff.types.d.ts +19 -8
- package/dist/document-api/src/diff/index.d.ts +1 -1
- package/dist/document-api/src/get-html/get-html.d.ts +6 -6
- package/dist/document-api/src/get-markdown/get-markdown.d.ts +2 -4
- package/dist/document-api/src/index.d.ts +19 -4
- package/dist/document-api/src/insert/insert.d.ts +12 -2
- package/dist/document-api/src/project-html/project-html.d.ts +5 -0
- package/dist/document-api/src/project-markdown/project-markdown.d.ts +5 -0
- package/dist/document-api/src/ranges/ranges.types.d.ts +5 -2
- package/dist/document-api/src/replace/replace.d.ts +18 -6
- package/dist/document-api/src/types/address.d.ts +2 -0
- package/dist/document-api/src/types/content-projection.d.ts +129 -0
- package/dist/document-api/src/types/index.d.ts +1 -0
- package/dist/document-api/src/types/mutation-plan.types.d.ts +1 -1
- package/dist/document-api/src/types/receipt.d.ts +1 -1
- package/dist/document-api/src/types/sd-contract.d.ts +9 -3
- package/dist/document-api/src/types/structural-input.d.ts +18 -3
- package/dist/document-api/src/write/write.d.ts +8 -3
- package/dist/layout-engine/painters/dom/src/index.d.ts +2 -0
- package/dist/layout-engine/painters/dom/src/web-flow/index.d.ts +3 -0
- package/dist/layout-engine/painters/dom/src/web-flow/painter.d.ts +2 -0
- package/dist/layout-engine/painters/dom/src/web-flow/render.d.ts +8 -0
- package/dist/layout-engine/painters/dom/src/web-flow/styles.d.ts +10 -0
- package/dist/layout-engine/painters/dom/src/web-flow/types.d.ts +77 -0
- package/dist/public/ui-react.cjs +1 -1
- package/dist/public/ui-react.es.js +1 -1
- package/dist/public/ui.cjs +1 -1
- package/dist/public/ui.es.js +1 -1
- package/dist/style.css +10 -4
- package/dist/style.layered.css +10 -4
- package/dist/superdoc/src/composables/use-link-popover.d.ts +3 -14
- package/dist/superdoc/src/core/types/index.d.ts +12 -5
- package/dist/superdoc/src/public/index.d.cts +6 -0
- package/dist/superdoc/src/public/index.d.ts +1 -0
- package/dist/superdoc/src/public/ui/types.d.ts +1 -1
- package/dist/superdoc/src/public/ui.d.cts +4 -0
- package/dist/superdoc/src/public/ui.d.ts +1 -1
- package/dist/superdoc.cjs +49 -129
- package/dist/superdoc.es.js +49 -129
- package/dist/word-layout/src/index.d.ts +2 -0
- package/dist/word-layout/src/list-marker.d.ts +8 -0
- package/dist/word-layout/src/review-aware-numbering.d.ts +41 -0
- package/dist-cdn/style.layered.css +1 -1
- package/dist-cdn/superdoc.min.css +1 -1
- package/dist-cdn/superdoc.min.js +37 -37
- package/package.json +2 -2
|
@@ -24,6 +24,7 @@ export type { DirectSurfaceRequest } from '../core/types/index.js';
|
|
|
24
24
|
export type { DocRange } from '../core/types/index.js';
|
|
25
25
|
export type { Document } from '../core/types/index.js';
|
|
26
26
|
export type { DocumentApi } from '../../../document-api/src/index.js';
|
|
27
|
+
export type { DiffApplyOperationReceipt, DiffApplyResult, DiffApplyReviewItem } from '../../../document-api/src/index.js';
|
|
27
28
|
export type { DocumentMode } from '../core/types/index.js';
|
|
28
29
|
export type { DocumentProtectionState } from '../../../document-api/src/index.js';
|
|
29
30
|
export type { EntityAddress } from '../../../document-api/src/index.js';
|
|
@@ -27,7 +27,7 @@ import { SuperDocUIReason } from './reasons.js';
|
|
|
27
27
|
* (`scripts/ensure-types.cjs` `rewriteDocApiPaths`), so no bare private
|
|
28
28
|
* specifier leaks into the emitted `.d.ts`.
|
|
29
29
|
*/
|
|
30
|
-
export type { Receipt, SelectionInfo, SelectionTarget, SelectionPoint, TextTarget, TextAddress, ScrollIntoViewInput, ScrollIntoViewOutput, DocumentApi, EntityAddress, CommentsListQuery as DocumentApiCommentsListQuery, CommentsListResult, TrackChangesListResult, ContentControlsListResult, ContentControlInfo, } from '../../../../document-api/src/index.js';
|
|
30
|
+
export type { Receipt, SelectionInfo, SelectionTarget, SelectionPoint, TextTarget, TextAddress, ScrollIntoViewInput, ScrollIntoViewOutput, DocumentApi, EntityAddress, CommentsListQuery as DocumentApiCommentsListQuery, CommentsListResult, TrackChangesListResult, ContentControlsListResult, ContentControlInfo, RichContentInsertInput, SDHtmlMarkdownSupportCheckResult, } from '../../../../document-api/src/index.js';
|
|
31
31
|
export type { StyleCatalogView, StyleCatalogItemType, StyleCatalogFilterType, StyleProvenance, StyleCatalogItemVisibility, StyleCatalogItemUsage, StyleCatalogItemPreview, StyleCatalogItem, StyleCatalogDefaults, StyleCatalogDiagnostic, StyleCatalogSourceStatus, StylesGetCatalogInput, StylesGetCatalogResult, } from '../../../../document-api/src/index.js';
|
|
32
32
|
export type { ListPresetId } from '../../../../document-api/src/index.js';
|
|
33
33
|
export type { BrowserDocumentApi, PartialBrowserDocumentApi } from '../browser-document-api.js';
|
|
@@ -37,8 +37,10 @@ import type { FontsSlice as __Cjs_FontsSlice } from './ui.js' with { "resolution
|
|
|
37
37
|
import type { MetadataHandle as __Cjs_MetadataHandle } from './ui.js' with { "resolution-mode": "import" };
|
|
38
38
|
import type { PartialBrowserDocumentApi as __Cjs_PartialBrowserDocumentApi } from './ui.js' with { "resolution-mode": "import" };
|
|
39
39
|
import type { Receipt as __Cjs_Receipt } from './ui.js' with { "resolution-mode": "import" };
|
|
40
|
+
import type { RichContentInsertInput as __Cjs_RichContentInsertInput } from './ui.js' with { "resolution-mode": "import" };
|
|
40
41
|
import type { ScrollIntoViewInput as __Cjs_ScrollIntoViewInput } from './ui.js' with { "resolution-mode": "import" };
|
|
41
42
|
import type { ScrollIntoViewOutput as __Cjs_ScrollIntoViewOutput } from './ui.js' with { "resolution-mode": "import" };
|
|
43
|
+
import type { SDHtmlMarkdownSupportCheckResult as __Cjs_SDHtmlMarkdownSupportCheckResult } from './ui.js' with { "resolution-mode": "import" };
|
|
42
44
|
import type { SelectionCapture as __Cjs_SelectionCapture } from './ui.js' with { "resolution-mode": "import" };
|
|
43
45
|
import type { SelectionHandle as __Cjs_SelectionHandle } from './ui.js' with { "resolution-mode": "import" };
|
|
44
46
|
import type { SelectionInfo as __Cjs_SelectionInfo } from './ui.js' with { "resolution-mode": "import" };
|
|
@@ -134,8 +136,10 @@ export type { __Cjs_FontsSlice as FontsSlice };
|
|
|
134
136
|
export type { __Cjs_MetadataHandle as MetadataHandle };
|
|
135
137
|
export type { __Cjs_PartialBrowserDocumentApi as PartialBrowserDocumentApi };
|
|
136
138
|
export type { __Cjs_Receipt as Receipt };
|
|
139
|
+
export type { __Cjs_RichContentInsertInput as RichContentInsertInput };
|
|
137
140
|
export type { __Cjs_ScrollIntoViewInput as ScrollIntoViewInput };
|
|
138
141
|
export type { __Cjs_ScrollIntoViewOutput as ScrollIntoViewOutput };
|
|
142
|
+
export type { __Cjs_SDHtmlMarkdownSupportCheckResult as SDHtmlMarkdownSupportCheckResult };
|
|
139
143
|
export type { __Cjs_SelectionCapture as SelectionCapture };
|
|
140
144
|
export type { __Cjs_SelectionHandle as SelectionHandle };
|
|
141
145
|
export type { __Cjs_SelectionInfo as SelectionInfo };
|
|
@@ -26,4 +26,4 @@
|
|
|
26
26
|
export { createSuperDocUI } from './ui/create-super-doc-ui.js';
|
|
27
27
|
export { shallowEqual } from './ui/equality.js';
|
|
28
28
|
export { BUILT_IN_COMMAND_IDS } from './ui/commands.js';
|
|
29
|
-
export type { EqualityFn, SelectorFn, Subscribable, SuperDocUI, BorrowedSuperDocUI, SuperDocUIOptions, SuperDocUIState, SuperDocUIScope, SuperDocLike, SuperDocEditorLike, CommandHandle, CommandState, CommandExecutionResult, WorkflowReceipt, WorkflowActionResult, WorkflowScrollResult, SelectionRestoreResult, SuperDocUIReason, CommandsHandle, ContextMenuItem, CustomCommandContext, CustomCommandHandle, CustomCommandHandleState, CustomCommandRegistration, CustomCommandRegistrationResult, MetadataHandle, SelectionHandle, ToolbarHandle, CommentsHandle, TrackChangesHandle, ContentControlsHandle, ContentControlFocusResult, FontsHandle, ZoomHandle, DocumentHandle, ViewportHandle, StylesHandle, ActiveParagraphStyle, SliceStatus, SelectionSlice, SelectionCapture, CommentAnchorCapture, ToolbarSnapshotSlice, CommentsSlice, TrackChangesSlice, ContentControlsSlice, FontsSlice, ZoomSlice, DocumentSlice, StylesSlice, StyleCatalogView, StyleCatalogItemType, StyleCatalogFilterType, StyleProvenance, StyleCatalogItemVisibility, StyleCatalogItemUsage, StyleCatalogItemPreview, StyleCatalogItem, StyleCatalogDefaults, StyleCatalogDiagnostic, StyleCatalogSourceStatus, StylesGetCatalogInput, StylesGetCatalogResult, CommentInfo, CommentsListQuery, TrackChangeInfo, TrackChangePointHit, TrackChangesItem, FontFamilyOption, FontSizeOption, CommentAddress, TrackedChangeAddress, ContentControlViewportAddress, ViewportEntityAddress, ViewportEntityHit, ViewportContext, ViewportRect, ViewportGetRectInput, ViewportRectResult, BrowserDocumentApi, PartialBrowserDocumentApi, DocumentApi, Receipt, SelectionInfo, SelectionTarget, SelectionPoint, TextTarget, TextAddress, ScrollIntoViewInput, ScrollIntoViewOutput, EntityAddress, CommentsListResult, TrackChangesListResult, ContentControlsListResult, ContentControlInfo, } from './ui/types.js';
|
|
29
|
+
export type { EqualityFn, SelectorFn, Subscribable, SuperDocUI, BorrowedSuperDocUI, SuperDocUIOptions, SuperDocUIState, SuperDocUIScope, SuperDocLike, SuperDocEditorLike, CommandHandle, CommandState, CommandExecutionResult, WorkflowReceipt, WorkflowActionResult, WorkflowScrollResult, SelectionRestoreResult, SuperDocUIReason, CommandsHandle, ContextMenuItem, CustomCommandContext, CustomCommandHandle, CustomCommandHandleState, CustomCommandRegistration, CustomCommandRegistrationResult, MetadataHandle, SelectionHandle, ToolbarHandle, CommentsHandle, TrackChangesHandle, ContentControlsHandle, ContentControlFocusResult, FontsHandle, ZoomHandle, DocumentHandle, ViewportHandle, StylesHandle, ActiveParagraphStyle, SliceStatus, SelectionSlice, SelectionCapture, CommentAnchorCapture, ToolbarSnapshotSlice, CommentsSlice, TrackChangesSlice, ContentControlsSlice, FontsSlice, ZoomSlice, DocumentSlice, StylesSlice, StyleCatalogView, StyleCatalogItemType, StyleCatalogFilterType, StyleProvenance, StyleCatalogItemVisibility, StyleCatalogItemUsage, StyleCatalogItemPreview, StyleCatalogItem, StyleCatalogDefaults, StyleCatalogDiagnostic, StyleCatalogSourceStatus, StylesGetCatalogInput, StylesGetCatalogResult, CommentInfo, CommentsListQuery, TrackChangeInfo, TrackChangePointHit, TrackChangesItem, FontFamilyOption, FontSizeOption, CommentAddress, TrackedChangeAddress, ContentControlViewportAddress, ViewportEntityAddress, ViewportEntityHit, ViewportContext, ViewportRect, ViewportGetRectInput, ViewportRectResult, BrowserDocumentApi, PartialBrowserDocumentApi, DocumentApi, Receipt, SelectionInfo, SelectionTarget, SelectionPoint, TextTarget, TextAddress, ScrollIntoViewInput, ScrollIntoViewOutput, EntityAddress, CommentsListResult, TrackChangesListResult, ContentControlsListResult, ContentControlInfo, RichContentInsertInput, SDHtmlMarkdownSupportCheckResult, } from './ui/types.js';
|
package/dist/superdoc.cjs
CHANGED
|
@@ -4,7 +4,7 @@ const require_blank_docx = require("./chunks/blank-docx-BuFAbRjs.cjs");
|
|
|
4
4
|
const require_eventemitter3 = require("./chunks/eventemitter3-D38u8ta_.cjs");
|
|
5
5
|
const require_uuid = require("./chunks/uuid-BhG0ngwk.cjs");
|
|
6
6
|
const require_jszip = require("./chunks/jszip-RC64TPzL.cjs");
|
|
7
|
-
const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-
|
|
7
|
+
const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-B5nhSKqa.cjs");
|
|
8
8
|
const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-SDR04tiH.cjs");
|
|
9
9
|
const require_constants = require("./chunks/constants-DpXuDx_g.cjs");
|
|
10
10
|
let vue = require("vue");
|
|
@@ -8480,7 +8480,13 @@ var useCommentsStore = defineStore("comments", () => {
|
|
|
8480
8480
|
documentId: v2Adapter.documentId,
|
|
8481
8481
|
items: outcome.items
|
|
8482
8482
|
});
|
|
8483
|
-
|
|
8483
|
+
const hadPendingComment = !!pendingComment.value;
|
|
8484
|
+
if (hadPendingComment) removePendingComment(superdoc);
|
|
8485
|
+
const createdId = reconciled?.added?.commentId ?? null;
|
|
8486
|
+
if (hadPendingComment && createdId) {
|
|
8487
|
+
setActiveComment(superdoc, createdId);
|
|
8488
|
+
setActiveFloatingCommentInstance(createdId);
|
|
8489
|
+
}
|
|
8484
8490
|
if (broadcastChanges) superdoc.emit("comments-update", {
|
|
8485
8491
|
type: COMMENT_EVENTS.ADD,
|
|
8486
8492
|
comment: reconciled?.added?.getValues?.() ?? null
|
|
@@ -8506,7 +8512,12 @@ var useCommentsStore = defineStore("comments", () => {
|
|
|
8506
8512
|
if (parentComment) newComment.isInternal = parentComment.isInternal;
|
|
8507
8513
|
if (!superdoc.config.isInternal) newComment.isInternal = false;
|
|
8508
8514
|
commentsList.value.push(newComment);
|
|
8515
|
+
const hadPendingComment = !!pendingComment.value;
|
|
8509
8516
|
removePendingComment(superdoc);
|
|
8517
|
+
if (hadPendingComment) {
|
|
8518
|
+
activeComment.value = newComment.commentId;
|
|
8519
|
+
setActiveFloatingCommentInstance(newComment.commentId);
|
|
8520
|
+
}
|
|
8510
8521
|
if (!skipEditorUpdate && !comment.trackedChange && superdoc.activeEditor?.commands && !comment.parentCommentId) superdoc.activeEditor.commands.insertComment({
|
|
8511
8522
|
...newComment.getValues(),
|
|
8512
8523
|
skipEmit: true
|
|
@@ -18195,10 +18206,9 @@ function scrollToElement(targetElement, options = {
|
|
|
18195
18206
|
*/
|
|
18196
18207
|
/**
|
|
18197
18208
|
* Result of `doc.bookmarks.get()` as read here (Document API `BookmarkInfo`).
|
|
18198
|
-
* `range.from.blockId`
|
|
18199
|
-
*
|
|
18200
|
-
*
|
|
18201
|
-
* since `revealBodyTarget`/`pageIndexForBodyTarget` are body-only.
|
|
18209
|
+
* `range.from.blockId` identifies the model paragraph sent to the viewport.
|
|
18210
|
+
* `address.story` is populated for non-body bookmarks (omitted for body),
|
|
18211
|
+
* which keeps anchor navigation scoped to body targets.
|
|
18202
18212
|
* @typedef {Object} BookmarkGetResult
|
|
18203
18213
|
* @property {{ story?: { kind?: string, storyType?: string } }} [address]
|
|
18204
18214
|
* @property {{ from?: { blockId?: string } }} [range]
|
|
@@ -18217,15 +18227,6 @@ function scrollToElement(targetElement, options = {
|
|
|
18217
18227
|
* @property {{ get?: (input: { target: { kind: 'entity', entityType: 'bookmark', name: string } }) => BookmarkGetResult | Promise<BookmarkGetResult | null | undefined> | null | undefined } | null} [bookmarks]
|
|
18218
18228
|
*/
|
|
18219
18229
|
/**
|
|
18220
|
-
* Result of `activeEditor.pageMetrics.revealBodyTarget()` as read here
|
|
18221
|
-
* (`V2EditorHostRevealBodyTargetResult`). Only available in editing/
|
|
18222
|
-
* suggesting mode — the host rejects with `editing-not-mounted` in
|
|
18223
|
-
* viewing mode.
|
|
18224
|
-
* @typedef {Object} RevealBodyTargetResult
|
|
18225
|
-
* @property {'revealed' | 'rejected'} [status]
|
|
18226
|
-
* @property {string} [reason]
|
|
18227
|
-
*/
|
|
18228
|
-
/**
|
|
18229
18230
|
* The `v2-link-click` payload the shell relays from the v2 host's
|
|
18230
18231
|
* `onLinkClick` callback.
|
|
18231
18232
|
* @typedef {Object} LinkClickPayload
|
|
@@ -18567,20 +18568,8 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getResolver
|
|
|
18567
18568
|
handle.result?.then?.((outcome) => clearCurrentPopover(handle, outcome), () => clearCurrentPopover(handle));
|
|
18568
18569
|
}
|
|
18569
18570
|
/**
|
|
18570
|
-
*
|
|
18571
|
-
*
|
|
18572
|
-
* (`data-bookmark-marker`/`data-bookmark-name`) is a best-effort fast
|
|
18573
|
-
* path only: layout-engine measuring drops those zero-width marker runs
|
|
18574
|
-
* from paint whenever the wrapping paragraph has other visible content
|
|
18575
|
-
* (the standard shape for a TOC bookmark wrapping heading text,
|
|
18576
|
-
* `<w:bookmarkStart .../><w:r>Heading</w:r><w:bookmarkEnd/>`) — but it
|
|
18577
|
-
* DOES survive for a standalone/empty bookmark paragraph (a supported v2
|
|
18578
|
-
* shape, see `v2-layout-adapter/src/empty-paragraph.test.ts` and
|
|
18579
|
-
* `isSyntheticStandaloneBookmarkParagraph` in
|
|
18580
|
-
* `v2-host/src/compose-exact-complete-render.ts`), where it lets a
|
|
18581
|
-
* mounted bookmark scroll immediately without a Document API round trip.
|
|
18582
|
-
* `findPaintedParagraphByParaId` remains the reliable fallback for the
|
|
18583
|
-
* common (marker-not-painted) case.
|
|
18571
|
+
* Find a mounted named anchor for runtimes that do not expose the bookmark
|
|
18572
|
+
* model. Model-backed runtimes never use DOM identity for navigation.
|
|
18584
18573
|
* @param {HTMLElement | null} container
|
|
18585
18574
|
* @param {string} escapedAnchorName
|
|
18586
18575
|
* @returns {HTMLElement | null}
|
|
@@ -18589,44 +18578,6 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getResolver
|
|
|
18589
18578
|
return container?.querySelector?.(`a[name='${escapedAnchorName}'], [data-bookmark-marker='start'][data-bookmark-name='${escapedAnchorName}']`) ?? null;
|
|
18590
18579
|
}
|
|
18591
18580
|
/**
|
|
18592
|
-
* Find the painted paragraph element for a `w14:paraId`, mirroring the
|
|
18593
|
-
* attribute chain `paintedParaIdElement` uses in v2-host
|
|
18594
|
-
* (`create-v2-editor-host.ts`) to confirm a paragraph is painted.
|
|
18595
|
-
* @param {HTMLElement | null} container
|
|
18596
|
-
* @param {string} paraId
|
|
18597
|
-
* @returns {HTMLElement | null}
|
|
18598
|
-
*/
|
|
18599
|
-
function findPaintedParagraphByParaId(container, paraId) {
|
|
18600
|
-
if (!container) return null;
|
|
18601
|
-
const escaped = cssEscape(paraId);
|
|
18602
|
-
return container.querySelector(`[data-source-node-id='${escaped}']`) ?? container.querySelector(`[data-layout-paraid='${escaped}']`) ?? container.querySelector(`[data-block-id$='/${escaped}']`) ?? container.querySelector(`[data-layout-block-ref$='/${escaped}']`) ?? null;
|
|
18603
|
-
}
|
|
18604
|
-
/**
|
|
18605
|
-
* Poll for an element across a bounded number of animation frames. Used
|
|
18606
|
-
* after `scrollToPage()` in review/viewing mode, where — unlike
|
|
18607
|
-
* `revealBodyTarget` in editing mode — there is no promise that resolves
|
|
18608
|
-
* once the deep-jumped page's geometry reconciles and paints.
|
|
18609
|
-
* @param {() => HTMLElement | null} lookup
|
|
18610
|
-
* @param {number} maxTicks
|
|
18611
|
-
* @returns {Promise<HTMLElement | null>}
|
|
18612
|
-
*/
|
|
18613
|
-
function pollForElement(lookup, maxTicks = 30) {
|
|
18614
|
-
return new Promise((resolve) => {
|
|
18615
|
-
const raf = typeof window !== "undefined" ? window.requestAnimationFrame : null;
|
|
18616
|
-
let ticks = 0;
|
|
18617
|
-
const tick = () => {
|
|
18618
|
-
const found = lookup();
|
|
18619
|
-
if (found || ticks >= maxTicks || typeof raf !== "function") {
|
|
18620
|
-
resolve(found ?? null);
|
|
18621
|
-
return;
|
|
18622
|
-
}
|
|
18623
|
-
ticks += 1;
|
|
18624
|
-
raf(tick);
|
|
18625
|
-
};
|
|
18626
|
-
tick();
|
|
18627
|
-
});
|
|
18628
|
-
}
|
|
18629
|
-
/**
|
|
18630
18581
|
* Move the editable caret to the start of a resolved target paragraph after
|
|
18631
18582
|
* navigating to it. Mirrors V1's `goToAnchor`, whose final step places the
|
|
18632
18583
|
* caret at the bookmark position: without it a V2 TOC click only scrolls, so
|
|
@@ -18666,87 +18617,59 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getResolver
|
|
|
18666
18617
|
} catch {}
|
|
18667
18618
|
}
|
|
18668
18619
|
/**
|
|
18669
|
-
* Navigate to
|
|
18670
|
-
*
|
|
18671
|
-
* resolves the bookmark's target paragraph through the Document API and
|
|
18672
|
-
* scrolls to that paragraph by its `paraId` — not to a bookmark-marker
|
|
18673
|
-
* element, which layout-engine measuring may have excluded from paint.
|
|
18674
|
-
*
|
|
18675
|
-
* In editing/suggesting mode (`placeCaret`), also moves the caret to the
|
|
18676
|
-
* start of the resolved target paragraph, matching V1's `goToAnchor`.
|
|
18677
|
-
*
|
|
18678
|
-
* If the paragraph isn't mounted (the v2 layout engine only mounts a
|
|
18679
|
-
* sliding window of pages), asks the host to reveal it:
|
|
18680
|
-
* - In editing/suggesting mode, `pageMetrics.revealBodyTarget` deep-jumps
|
|
18681
|
-
* into unmounted pages and resolves once the target is painted. Any
|
|
18682
|
-
* rejection here OTHER than `editing-not-mounted` is a real failure of
|
|
18683
|
-
* this strong, paint-confirmed path and is left as a no-op rather than
|
|
18684
|
-
* silently degrading to the weaker path below.
|
|
18685
|
-
* - In viewing mode the host is mounted in "review" mode, where
|
|
18686
|
-
* `revealBodyTarget` always rejects with reason `editing-not-mounted`
|
|
18687
|
-
* (or is simply unpublished); only then falls back to
|
|
18688
|
-
* `pageIndexForBodyTarget` + `scrollToPage` (neither gated on mount
|
|
18689
|
-
* mode) and polls for paint, since neither returns a paint-complete
|
|
18690
|
-
* promise.
|
|
18691
|
-
*
|
|
18692
|
-
* Out of scope: bookmarks outside the body story (headers/footers/
|
|
18693
|
-
* footnotes) — `revealBodyTarget`/`pageIndexForBodyTarget` are body-only.
|
|
18620
|
+
* Navigate to a body bookmark through its model address. A mounted-anchor
|
|
18621
|
+
* fallback is reserved for runtimes without a callable bookmark model.
|
|
18694
18622
|
* @param {string | null | undefined} anchorUrl
|
|
18695
18623
|
* @param {{ placeCaret?: boolean }} [options]
|
|
18696
18624
|
*/
|
|
18697
18625
|
async function navigateToAnchor(anchorUrl, { placeCaret = false } = {}) {
|
|
18698
18626
|
if (typeof anchorUrl !== "string" || !anchorUrl.startsWith("#")) return;
|
|
18699
18627
|
const anchorName = anchorUrl.slice(1);
|
|
18700
|
-
const escapedAnchorName = cssEscape(anchorName);
|
|
18701
|
-
const mountedAnchor = findMountedAnchor(getUi()?.viewport?.getHost?.() ?? null, escapedAnchorName);
|
|
18702
|
-
if (mountedAnchor) {
|
|
18703
|
-
scrollToElement(mountedAnchor);
|
|
18704
|
-
return;
|
|
18705
|
-
}
|
|
18706
18628
|
/** @type {LinkPopoverDocumentApi | null | undefined} */
|
|
18707
18629
|
const doc = getActiveEditor()?.doc;
|
|
18630
|
+
const bookmarkGet = doc?.bookmarks?.get;
|
|
18631
|
+
if (typeof bookmarkGet !== "function") {
|
|
18632
|
+
const mountedAnchor = findMountedAnchor(getUi()?.viewport?.getHost?.() ?? null, cssEscape(anchorName));
|
|
18633
|
+
if (mountedAnchor) scrollToElement(mountedAnchor, {
|
|
18634
|
+
block: "start",
|
|
18635
|
+
behavior: "instant"
|
|
18636
|
+
});
|
|
18637
|
+
return;
|
|
18638
|
+
}
|
|
18708
18639
|
/** @type {BookmarkGetResult | null} */
|
|
18709
18640
|
let bookmark = null;
|
|
18710
18641
|
try {
|
|
18711
|
-
bookmark = await Promise.resolve(doc
|
|
18642
|
+
bookmark = await Promise.resolve(bookmarkGet.call(doc.bookmarks, { target: {
|
|
18712
18643
|
kind: "entity",
|
|
18713
18644
|
entityType: "bookmark",
|
|
18714
18645
|
name: anchorName
|
|
18715
18646
|
} }));
|
|
18716
18647
|
bookmark ??= null;
|
|
18717
18648
|
} catch {
|
|
18718
|
-
|
|
18649
|
+
return;
|
|
18719
18650
|
}
|
|
18720
18651
|
const story = bookmark?.address?.story;
|
|
18721
18652
|
if (story && story.storyType !== "body") return;
|
|
18722
18653
|
const blockId = bookmark?.range?.from?.blockId;
|
|
18723
18654
|
if (typeof blockId !== "string") return;
|
|
18724
18655
|
if (placeCaret) await placeCaretAtHeadingStart(blockId);
|
|
18725
|
-
const
|
|
18726
|
-
|
|
18727
|
-
|
|
18728
|
-
return;
|
|
18729
|
-
}
|
|
18730
|
-
const pageMetrics = getActiveEditor()?.pageMetrics;
|
|
18731
|
-
const revealBodyTarget = pageMetrics?.revealBodyTarget;
|
|
18732
|
-
let revealResult;
|
|
18656
|
+
const viewport = getUi()?.viewport;
|
|
18657
|
+
const scrollIntoView = viewport?.scrollIntoView;
|
|
18658
|
+
if (typeof scrollIntoView !== "function") return;
|
|
18733
18659
|
try {
|
|
18734
|
-
|
|
18735
|
-
|
|
18736
|
-
|
|
18737
|
-
|
|
18738
|
-
|
|
18739
|
-
|
|
18740
|
-
|
|
18741
|
-
|
|
18742
|
-
|
|
18743
|
-
|
|
18744
|
-
|
|
18745
|
-
|
|
18746
|
-
|
|
18747
|
-
if (typeof pageIndex !== "number" || !scrollToPage?.(pageIndex)) return;
|
|
18748
|
-
const revealedByScroll = await pollForElement(() => findPaintedParagraphByParaId(getUi()?.viewport?.getHost?.() ?? null, blockId));
|
|
18749
|
-
if (revealedByScroll) scrollToElement(revealedByScroll);
|
|
18660
|
+
await Promise.resolve(scrollIntoView.call(viewport, {
|
|
18661
|
+
target: {
|
|
18662
|
+
kind: "text",
|
|
18663
|
+
blockId,
|
|
18664
|
+
range: {
|
|
18665
|
+
start: 0,
|
|
18666
|
+
end: 0
|
|
18667
|
+
}
|
|
18668
|
+
},
|
|
18669
|
+
block: "start",
|
|
18670
|
+
behavior: "instant"
|
|
18671
|
+
}));
|
|
18672
|
+
} catch {}
|
|
18750
18673
|
}
|
|
18751
18674
|
/**
|
|
18752
18675
|
* @param {LinkPopoverContext} ctx
|
|
@@ -41688,6 +41611,7 @@ var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts
|
|
|
41688
41611
|
item: tableActionsItem,
|
|
41689
41612
|
argument: { command }
|
|
41690
41613
|
});
|
|
41614
|
+
refocusEditorSurface(superToolbar);
|
|
41691
41615
|
}
|
|
41692
41616
|
});
|
|
41693
41617
|
}
|
|
@@ -43572,10 +43496,6 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
43572
43496
|
this.config.layoutEngineOptions = this.config.layoutEngineOptions || {};
|
|
43573
43497
|
const isWebLayout = this.config.viewOptions?.layout === "web";
|
|
43574
43498
|
const isSemanticFlow = this.config.layoutEngineOptions?.flowMode === "semantic";
|
|
43575
|
-
if (isWebLayout && this.config.useLayoutEngine && !isSemanticFlow) {
|
|
43576
|
-
console.warn("[SuperDoc] Web layout uses PM fallback unless layoutEngineOptions.flowMode is set to 'semantic'. Automatically disabling layout engine.");
|
|
43577
|
-
this.config.useLayoutEngine = false;
|
|
43578
|
-
}
|
|
43579
43499
|
if (!isWebLayout && isSemanticFlow) {
|
|
43580
43500
|
console.warn("[SuperDoc] flowMode 'semantic' is only valid with web layout. Coercing to 'paginated'.");
|
|
43581
43501
|
this.config.layoutEngineOptions.flowMode = "paginated";
|
|
@@ -43606,7 +43526,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
|
|
|
43606
43526
|
this.config.colors = shuffleArray(this.config.colors);
|
|
43607
43527
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
43608
43528
|
this.colorIndex = 0;
|
|
43609
|
-
this.version = "2.7.0-next.
|
|
43529
|
+
this.version = "2.7.0-next.21";
|
|
43610
43530
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
43611
43531
|
this.superdocId = config.superdocId || require_uuid.v4();
|
|
43612
43532
|
this.colors = this.config.colors ?? [];
|
package/dist/superdoc.es.js
CHANGED
|
@@ -3,7 +3,7 @@ import { t as blank_default } from "./chunks/blank-docx-DzQccOlW.es.js";
|
|
|
3
3
|
import { t as import_eventemitter3 } from "./chunks/eventemitter3-CMOjDs74.es.js";
|
|
4
4
|
import { t as v4 } from "./chunks/uuid-H0Xcmmhy.es.js";
|
|
5
5
|
import { a as init_dist$1, i as global, n as init_dist$2, o as Buffer, r as process$1, s as init_dist, t as require_jszip_min } from "./chunks/jszip-VxCFV9YS.es.js";
|
|
6
|
-
import { a as DOM_CLASS_NAMES, i as getV2TrackedChangeMutationImpact, t as createSuperDocUI } from "./chunks/create-super-doc-ui-
|
|
6
|
+
import { a as DOM_CLASS_NAMES, i as getV2TrackedChangeMutationImpact, t as createSuperDocUI } from "./chunks/create-super-doc-ui-BJ6D4BfN.es.js";
|
|
7
7
|
import { t as _plugin_vue_export_helper_default } from "./chunks/_plugin-vue_export-helper-BOaGB7Aw.es.js";
|
|
8
8
|
import { t as PDF_TO_CSS_UNITS } from "./chunks/constants-B6VBlmKp.es.js";
|
|
9
9
|
import * as Vue from "vue";
|
|
@@ -8479,7 +8479,13 @@ var useCommentsStore = defineStore("comments", () => {
|
|
|
8479
8479
|
documentId: v2Adapter.documentId,
|
|
8480
8480
|
items: outcome.items
|
|
8481
8481
|
});
|
|
8482
|
-
|
|
8482
|
+
const hadPendingComment = !!pendingComment.value;
|
|
8483
|
+
if (hadPendingComment) removePendingComment(superdoc);
|
|
8484
|
+
const createdId = reconciled?.added?.commentId ?? null;
|
|
8485
|
+
if (hadPendingComment && createdId) {
|
|
8486
|
+
setActiveComment(superdoc, createdId);
|
|
8487
|
+
setActiveFloatingCommentInstance(createdId);
|
|
8488
|
+
}
|
|
8483
8489
|
if (broadcastChanges) superdoc.emit("comments-update", {
|
|
8484
8490
|
type: COMMENT_EVENTS.ADD,
|
|
8485
8491
|
comment: reconciled?.added?.getValues?.() ?? null
|
|
@@ -8505,7 +8511,12 @@ var useCommentsStore = defineStore("comments", () => {
|
|
|
8505
8511
|
if (parentComment) newComment.isInternal = parentComment.isInternal;
|
|
8506
8512
|
if (!superdoc.config.isInternal) newComment.isInternal = false;
|
|
8507
8513
|
commentsList.value.push(newComment);
|
|
8514
|
+
const hadPendingComment = !!pendingComment.value;
|
|
8508
8515
|
removePendingComment(superdoc);
|
|
8516
|
+
if (hadPendingComment) {
|
|
8517
|
+
activeComment.value = newComment.commentId;
|
|
8518
|
+
setActiveFloatingCommentInstance(newComment.commentId);
|
|
8519
|
+
}
|
|
8509
8520
|
if (!skipEditorUpdate && !comment.trackedChange && superdoc.activeEditor?.commands && !comment.parentCommentId) superdoc.activeEditor.commands.insertComment({
|
|
8510
8521
|
...newComment.getValues(),
|
|
8511
8522
|
skipEmit: true
|
|
@@ -18163,10 +18174,9 @@ function scrollToElement(targetElement, options = {
|
|
|
18163
18174
|
*/
|
|
18164
18175
|
/**
|
|
18165
18176
|
* Result of `doc.bookmarks.get()` as read here (Document API `BookmarkInfo`).
|
|
18166
|
-
* `range.from.blockId`
|
|
18167
|
-
*
|
|
18168
|
-
*
|
|
18169
|
-
* since `revealBodyTarget`/`pageIndexForBodyTarget` are body-only.
|
|
18177
|
+
* `range.from.blockId` identifies the model paragraph sent to the viewport.
|
|
18178
|
+
* `address.story` is populated for non-body bookmarks (omitted for body),
|
|
18179
|
+
* which keeps anchor navigation scoped to body targets.
|
|
18170
18180
|
* @typedef {Object} BookmarkGetResult
|
|
18171
18181
|
* @property {{ story?: { kind?: string, storyType?: string } }} [address]
|
|
18172
18182
|
* @property {{ from?: { blockId?: string } }} [range]
|
|
@@ -18185,15 +18195,6 @@ function scrollToElement(targetElement, options = {
|
|
|
18185
18195
|
* @property {{ get?: (input: { target: { kind: 'entity', entityType: 'bookmark', name: string } }) => BookmarkGetResult | Promise<BookmarkGetResult | null | undefined> | null | undefined } | null} [bookmarks]
|
|
18186
18196
|
*/
|
|
18187
18197
|
/**
|
|
18188
|
-
* Result of `activeEditor.pageMetrics.revealBodyTarget()` as read here
|
|
18189
|
-
* (`V2EditorHostRevealBodyTargetResult`). Only available in editing/
|
|
18190
|
-
* suggesting mode — the host rejects with `editing-not-mounted` in
|
|
18191
|
-
* viewing mode.
|
|
18192
|
-
* @typedef {Object} RevealBodyTargetResult
|
|
18193
|
-
* @property {'revealed' | 'rejected'} [status]
|
|
18194
|
-
* @property {string} [reason]
|
|
18195
|
-
*/
|
|
18196
|
-
/**
|
|
18197
18198
|
* The `v2-link-click` payload the shell relays from the v2 host's
|
|
18198
18199
|
* `onLinkClick` callback.
|
|
18199
18200
|
* @typedef {Object} LinkClickPayload
|
|
@@ -18535,20 +18536,8 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getResolver
|
|
|
18535
18536
|
handle.result?.then?.((outcome) => clearCurrentPopover(handle, outcome), () => clearCurrentPopover(handle));
|
|
18536
18537
|
}
|
|
18537
18538
|
/**
|
|
18538
|
-
*
|
|
18539
|
-
*
|
|
18540
|
-
* (`data-bookmark-marker`/`data-bookmark-name`) is a best-effort fast
|
|
18541
|
-
* path only: layout-engine measuring drops those zero-width marker runs
|
|
18542
|
-
* from paint whenever the wrapping paragraph has other visible content
|
|
18543
|
-
* (the standard shape for a TOC bookmark wrapping heading text,
|
|
18544
|
-
* `<w:bookmarkStart .../><w:r>Heading</w:r><w:bookmarkEnd/>`) — but it
|
|
18545
|
-
* DOES survive for a standalone/empty bookmark paragraph (a supported v2
|
|
18546
|
-
* shape, see `v2-layout-adapter/src/empty-paragraph.test.ts` and
|
|
18547
|
-
* `isSyntheticStandaloneBookmarkParagraph` in
|
|
18548
|
-
* `v2-host/src/compose-exact-complete-render.ts`), where it lets a
|
|
18549
|
-
* mounted bookmark scroll immediately without a Document API round trip.
|
|
18550
|
-
* `findPaintedParagraphByParaId` remains the reliable fallback for the
|
|
18551
|
-
* common (marker-not-painted) case.
|
|
18539
|
+
* Find a mounted named anchor for runtimes that do not expose the bookmark
|
|
18540
|
+
* model. Model-backed runtimes never use DOM identity for navigation.
|
|
18552
18541
|
* @param {HTMLElement | null} container
|
|
18553
18542
|
* @param {string} escapedAnchorName
|
|
18554
18543
|
* @returns {HTMLElement | null}
|
|
@@ -18557,44 +18546,6 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getResolver
|
|
|
18557
18546
|
return container?.querySelector?.(`a[name='${escapedAnchorName}'], [data-bookmark-marker='start'][data-bookmark-name='${escapedAnchorName}']`) ?? null;
|
|
18558
18547
|
}
|
|
18559
18548
|
/**
|
|
18560
|
-
* Find the painted paragraph element for a `w14:paraId`, mirroring the
|
|
18561
|
-
* attribute chain `paintedParaIdElement` uses in v2-host
|
|
18562
|
-
* (`create-v2-editor-host.ts`) to confirm a paragraph is painted.
|
|
18563
|
-
* @param {HTMLElement | null} container
|
|
18564
|
-
* @param {string} paraId
|
|
18565
|
-
* @returns {HTMLElement | null}
|
|
18566
|
-
*/
|
|
18567
|
-
function findPaintedParagraphByParaId(container, paraId) {
|
|
18568
|
-
if (!container) return null;
|
|
18569
|
-
const escaped = cssEscape(paraId);
|
|
18570
|
-
return container.querySelector(`[data-source-node-id='${escaped}']`) ?? container.querySelector(`[data-layout-paraid='${escaped}']`) ?? container.querySelector(`[data-block-id$='/${escaped}']`) ?? container.querySelector(`[data-layout-block-ref$='/${escaped}']`) ?? null;
|
|
18571
|
-
}
|
|
18572
|
-
/**
|
|
18573
|
-
* Poll for an element across a bounded number of animation frames. Used
|
|
18574
|
-
* after `scrollToPage()` in review/viewing mode, where — unlike
|
|
18575
|
-
* `revealBodyTarget` in editing mode — there is no promise that resolves
|
|
18576
|
-
* once the deep-jumped page's geometry reconciles and paints.
|
|
18577
|
-
* @param {() => HTMLElement | null} lookup
|
|
18578
|
-
* @param {number} maxTicks
|
|
18579
|
-
* @returns {Promise<HTMLElement | null>}
|
|
18580
|
-
*/
|
|
18581
|
-
function pollForElement(lookup, maxTicks = 30) {
|
|
18582
|
-
return new Promise((resolve) => {
|
|
18583
|
-
const raf = typeof window !== "undefined" ? window.requestAnimationFrame : null;
|
|
18584
|
-
let ticks = 0;
|
|
18585
|
-
const tick = () => {
|
|
18586
|
-
const found = lookup();
|
|
18587
|
-
if (found || ticks >= maxTicks || typeof raf !== "function") {
|
|
18588
|
-
resolve(found ?? null);
|
|
18589
|
-
return;
|
|
18590
|
-
}
|
|
18591
|
-
ticks += 1;
|
|
18592
|
-
raf(tick);
|
|
18593
|
-
};
|
|
18594
|
-
tick();
|
|
18595
|
-
});
|
|
18596
|
-
}
|
|
18597
|
-
/**
|
|
18598
18549
|
* Move the editable caret to the start of a resolved target paragraph after
|
|
18599
18550
|
* navigating to it. Mirrors V1's `goToAnchor`, whose final step places the
|
|
18600
18551
|
* caret at the bookmark position: without it a V2 TOC click only scrolls, so
|
|
@@ -18634,87 +18585,59 @@ function useLinkPopover({ getSurfaceManager, getActiveEditor, getUi, getResolver
|
|
|
18634
18585
|
} catch {}
|
|
18635
18586
|
}
|
|
18636
18587
|
/**
|
|
18637
|
-
* Navigate to
|
|
18638
|
-
*
|
|
18639
|
-
* resolves the bookmark's target paragraph through the Document API and
|
|
18640
|
-
* scrolls to that paragraph by its `paraId` — not to a bookmark-marker
|
|
18641
|
-
* element, which layout-engine measuring may have excluded from paint.
|
|
18642
|
-
*
|
|
18643
|
-
* In editing/suggesting mode (`placeCaret`), also moves the caret to the
|
|
18644
|
-
* start of the resolved target paragraph, matching V1's `goToAnchor`.
|
|
18645
|
-
*
|
|
18646
|
-
* If the paragraph isn't mounted (the v2 layout engine only mounts a
|
|
18647
|
-
* sliding window of pages), asks the host to reveal it:
|
|
18648
|
-
* - In editing/suggesting mode, `pageMetrics.revealBodyTarget` deep-jumps
|
|
18649
|
-
* into unmounted pages and resolves once the target is painted. Any
|
|
18650
|
-
* rejection here OTHER than `editing-not-mounted` is a real failure of
|
|
18651
|
-
* this strong, paint-confirmed path and is left as a no-op rather than
|
|
18652
|
-
* silently degrading to the weaker path below.
|
|
18653
|
-
* - In viewing mode the host is mounted in "review" mode, where
|
|
18654
|
-
* `revealBodyTarget` always rejects with reason `editing-not-mounted`
|
|
18655
|
-
* (or is simply unpublished); only then falls back to
|
|
18656
|
-
* `pageIndexForBodyTarget` + `scrollToPage` (neither gated on mount
|
|
18657
|
-
* mode) and polls for paint, since neither returns a paint-complete
|
|
18658
|
-
* promise.
|
|
18659
|
-
*
|
|
18660
|
-
* Out of scope: bookmarks outside the body story (headers/footers/
|
|
18661
|
-
* footnotes) — `revealBodyTarget`/`pageIndexForBodyTarget` are body-only.
|
|
18588
|
+
* Navigate to a body bookmark through its model address. A mounted-anchor
|
|
18589
|
+
* fallback is reserved for runtimes without a callable bookmark model.
|
|
18662
18590
|
* @param {string | null | undefined} anchorUrl
|
|
18663
18591
|
* @param {{ placeCaret?: boolean }} [options]
|
|
18664
18592
|
*/
|
|
18665
18593
|
async function navigateToAnchor(anchorUrl, { placeCaret = false } = {}) {
|
|
18666
18594
|
if (typeof anchorUrl !== "string" || !anchorUrl.startsWith("#")) return;
|
|
18667
18595
|
const anchorName = anchorUrl.slice(1);
|
|
18668
|
-
const escapedAnchorName = cssEscape(anchorName);
|
|
18669
|
-
const mountedAnchor = findMountedAnchor(getUi()?.viewport?.getHost?.() ?? null, escapedAnchorName);
|
|
18670
|
-
if (mountedAnchor) {
|
|
18671
|
-
scrollToElement(mountedAnchor);
|
|
18672
|
-
return;
|
|
18673
|
-
}
|
|
18674
18596
|
/** @type {LinkPopoverDocumentApi | null | undefined} */
|
|
18675
18597
|
const doc = getActiveEditor()?.doc;
|
|
18598
|
+
const bookmarkGet = doc?.bookmarks?.get;
|
|
18599
|
+
if (typeof bookmarkGet !== "function") {
|
|
18600
|
+
const mountedAnchor = findMountedAnchor(getUi()?.viewport?.getHost?.() ?? null, cssEscape(anchorName));
|
|
18601
|
+
if (mountedAnchor) scrollToElement(mountedAnchor, {
|
|
18602
|
+
block: "start",
|
|
18603
|
+
behavior: "instant"
|
|
18604
|
+
});
|
|
18605
|
+
return;
|
|
18606
|
+
}
|
|
18676
18607
|
/** @type {BookmarkGetResult | null} */
|
|
18677
18608
|
let bookmark = null;
|
|
18678
18609
|
try {
|
|
18679
|
-
bookmark = await Promise.resolve(doc
|
|
18610
|
+
bookmark = await Promise.resolve(bookmarkGet.call(doc.bookmarks, { target: {
|
|
18680
18611
|
kind: "entity",
|
|
18681
18612
|
entityType: "bookmark",
|
|
18682
18613
|
name: anchorName
|
|
18683
18614
|
} }));
|
|
18684
18615
|
bookmark ??= null;
|
|
18685
18616
|
} catch {
|
|
18686
|
-
|
|
18617
|
+
return;
|
|
18687
18618
|
}
|
|
18688
18619
|
const story = bookmark?.address?.story;
|
|
18689
18620
|
if (story && story.storyType !== "body") return;
|
|
18690
18621
|
const blockId = bookmark?.range?.from?.blockId;
|
|
18691
18622
|
if (typeof blockId !== "string") return;
|
|
18692
18623
|
if (placeCaret) await placeCaretAtHeadingStart(blockId);
|
|
18693
|
-
const
|
|
18694
|
-
|
|
18695
|
-
|
|
18696
|
-
return;
|
|
18697
|
-
}
|
|
18698
|
-
const pageMetrics = getActiveEditor()?.pageMetrics;
|
|
18699
|
-
const revealBodyTarget = pageMetrics?.revealBodyTarget;
|
|
18700
|
-
let revealResult;
|
|
18624
|
+
const viewport = getUi()?.viewport;
|
|
18625
|
+
const scrollIntoView = viewport?.scrollIntoView;
|
|
18626
|
+
if (typeof scrollIntoView !== "function") return;
|
|
18701
18627
|
try {
|
|
18702
|
-
|
|
18703
|
-
|
|
18704
|
-
|
|
18705
|
-
|
|
18706
|
-
|
|
18707
|
-
|
|
18708
|
-
|
|
18709
|
-
|
|
18710
|
-
|
|
18711
|
-
|
|
18712
|
-
|
|
18713
|
-
|
|
18714
|
-
|
|
18715
|
-
if (typeof pageIndex !== "number" || !scrollToPage?.(pageIndex)) return;
|
|
18716
|
-
const revealedByScroll = await pollForElement(() => findPaintedParagraphByParaId(getUi()?.viewport?.getHost?.() ?? null, blockId));
|
|
18717
|
-
if (revealedByScroll) scrollToElement(revealedByScroll);
|
|
18628
|
+
await Promise.resolve(scrollIntoView.call(viewport, {
|
|
18629
|
+
target: {
|
|
18630
|
+
kind: "text",
|
|
18631
|
+
blockId,
|
|
18632
|
+
range: {
|
|
18633
|
+
start: 0,
|
|
18634
|
+
end: 0
|
|
18635
|
+
}
|
|
18636
|
+
},
|
|
18637
|
+
block: "start",
|
|
18638
|
+
behavior: "instant"
|
|
18639
|
+
}));
|
|
18640
|
+
} catch {}
|
|
18718
18641
|
}
|
|
18719
18642
|
/**
|
|
18720
18643
|
* @param {LinkPopoverContext} ctx
|
|
@@ -41621,6 +41544,7 @@ var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts
|
|
|
41621
41544
|
item: tableActionsItem,
|
|
41622
41545
|
argument: { command }
|
|
41623
41546
|
});
|
|
41547
|
+
refocusEditorSurface(superToolbar);
|
|
41624
41548
|
}
|
|
41625
41549
|
});
|
|
41626
41550
|
}
|
|
@@ -43505,10 +43429,6 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
43505
43429
|
this.config.layoutEngineOptions = this.config.layoutEngineOptions || {};
|
|
43506
43430
|
const isWebLayout = this.config.viewOptions?.layout === "web";
|
|
43507
43431
|
const isSemanticFlow = this.config.layoutEngineOptions?.flowMode === "semantic";
|
|
43508
|
-
if (isWebLayout && this.config.useLayoutEngine && !isSemanticFlow) {
|
|
43509
|
-
console.warn("[SuperDoc] Web layout uses PM fallback unless layoutEngineOptions.flowMode is set to 'semantic'. Automatically disabling layout engine.");
|
|
43510
|
-
this.config.useLayoutEngine = false;
|
|
43511
|
-
}
|
|
43512
43432
|
if (!isWebLayout && isSemanticFlow) {
|
|
43513
43433
|
console.warn("[SuperDoc] flowMode 'semantic' is only valid with web layout. Coercing to 'paginated'.");
|
|
43514
43434
|
this.config.layoutEngineOptions.flowMode = "paginated";
|
|
@@ -43539,7 +43459,7 @@ var SuperDoc = class extends import_eventemitter3.default {
|
|
|
43539
43459
|
this.config.colors = shuffleArray(this.config.colors);
|
|
43540
43460
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
43541
43461
|
this.colorIndex = 0;
|
|
43542
|
-
this.version = "2.7.0-next.
|
|
43462
|
+
this.version = "2.7.0-next.21";
|
|
43543
43463
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
43544
43464
|
this.superdocId = config.superdocId || v4();
|
|
43545
43465
|
this.colors = this.config.colors ?? [];
|
|
@@ -7,6 +7,8 @@ export { createNumberingManager } from './numbering-manager.js';
|
|
|
7
7
|
export type { NumberingManager, NumberingManagerSnapshot, NumberingCursor } from './numbering-manager.js';
|
|
8
8
|
export { computeWordListMarker } from './list-marker.js';
|
|
9
9
|
export type { ComputeWordListMarkerInput, ComputeWordListMarkerResult, WordListMarkerDefinition, } from './list-marker.js';
|
|
10
|
+
export { createReviewAwareWordNumberingSequence, reviewAwareWordNumberingCounterScope, } from './review-aware-numbering.js';
|
|
11
|
+
export type { ReviewAwareNumberingMembership, ReviewAwareNumberingStateMode, ReviewAwareWordMarkerFact, ReviewAwareWordNumberingDefinition, ReviewAwareWordNumberingResult, ReviewAwareWordNumberingSequence, ReviewAwareWordNumberingSnapshot, } from './review-aware-numbering.js';
|
|
10
12
|
/**
|
|
11
13
|
* Computes the complete layout properties for a Word paragraph, including indentation,
|
|
12
14
|
* tabs, and optional list marker positioning.
|
|
@@ -19,6 +19,14 @@ export interface WordListMarkerDefinition {
|
|
|
19
19
|
numFmt?: string;
|
|
20
20
|
/** Custom format string when `numFmt === 'custom'`. */
|
|
21
21
|
customFormat?: string;
|
|
22
|
+
/** True when the level carries Word's legal-numbering semantics. */
|
|
23
|
+
isLegal?: boolean;
|
|
24
|
+
/** Effective numbering formats for placeholders that reference each level. */
|
|
25
|
+
levelNumberingFormats?: Array<{
|
|
26
|
+
ilvl: number;
|
|
27
|
+
numFmt?: string;
|
|
28
|
+
customFormat?: string;
|
|
29
|
+
}>;
|
|
22
30
|
/** `w:suff`. Defaults to `tab` when absent. */
|
|
23
31
|
suffix?: string;
|
|
24
32
|
/** `w:lvlJc`. Defaults to `left`. */
|