@stll/folio-core 0.73.0 → 0.74.0
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/ai-edits/headless.js +2 -5
- package/dist/ai-edits/pendingJoin.js +6 -1
- package/dist/ai-edits/result-validation.js +1 -1
- package/dist/ai-edits/snapshot.js +1 -1
- package/dist/ai-edits/table-cell-mutations.js +1 -1
- package/dist/ai-edits/tracked-batch-fidelity.js +1 -1
- package/dist/canonical/canonicalInlineGaps.d.ts +56 -0
- package/dist/canonical/canonicalInlineGaps.js +118 -0
- package/dist/canonical/canonicalInlineProjection.d.ts +4 -13
- package/dist/canonical/canonicalInlineProjection.js +6 -28
- package/dist/canonical/canonicalProjectionBlocks.d.ts +4 -4
- package/dist/canonical/canonicalPublicOperations.js +70 -27
- package/dist/canonical/canonicalSelection.js +1 -1
- package/dist/canonical/canonicalSession.js +14 -21
- package/dist/controller/autocompleteSuggestion.js +1 -1
- package/dist/controller/canonicalClipboard.js +2 -2
- package/dist/controller/canonicalComposition.js +1 -1
- package/dist/controller/canonicalInput.js +1 -1
- package/dist/controller/canonicalPresence.js +1 -1
- package/dist/controller/canonicalRoomAuthority.js +1 -1
- package/dist/controller/canonicalRoomWire.js +1 -1
- package/dist/controller/canonicalStructure.js +1 -1
- package/dist/controller/canonicalTabRoom.js +1 -1
- package/dist/controller/canonicalYjsRoom.js +1 -1
- package/dist/controller/hiddenEditorApi.js +2 -17
- package/dist/controller/hiddenEditorManager.js +4 -8
- package/dist/document-operations.js +1 -1
- package/dist/docx/canonicalSave.d.ts +1 -1
- package/dist/docx/canonicalSave.js +1 -1
- package/dist/docx/canonicalSessionInput.js +1 -1
- package/dist/docx/containerChildren.js +1 -1
- package/dist/docx/createDocx.d.ts +4 -0
- package/dist/docx/createDocx.js +6 -0
- package/dist/docx/modelValidation.js +1 -1
- package/dist/docx/parser.js +1 -1
- package/dist/docx/reviewResolutionProvenance.js +1 -1
- package/dist/docx/rezip.d.ts +1 -1
- package/dist/docx/rezip.js +2 -2
- package/dist/docx/serializer/borderSerializer.js +1 -1
- package/dist/docx/serializer/commentSerializer.js +1 -1
- package/dist/docx/serializer/documentSerializer.js +1 -1
- package/dist/docx/serializer/paragraphSerializer.js +3 -3
- package/dist/docx/serializer/runSerializer.js +1 -1
- package/dist/docx/serializer/sectionPropertiesSerializer.js +1 -1
- package/dist/docx/serializer/tableSerializer.js +1 -1
- package/dist/docx/serializer/textFormattingSerializer.js +1 -1
- package/dist/docx/serializer/trackedChangeAttributes.js +1 -1
- package/dist/docx/server/templatePlan/apply.js +69 -11
- package/dist/docx/server/templatePlan/inspect.js +88 -35
- package/dist/docx/server/templatePlan/labels.d.ts +10 -1
- package/dist/docx/server/templatePlan/labels.js +31 -2
- package/dist/docx/server/templatePlan/plan.d.ts +2 -0
- package/dist/docx/server/templatePlan/plan.js +41 -7
- package/dist/docx/server/templatePlan/planShape.js +22 -3
- package/dist/docx/server/templatePlan/types.d.ts +38 -2
- package/dist/docx/server/templatePlan/types.js +1 -0
- package/dist/docx/server/templatePlan/verify.js +11 -3
- package/dist/docx/server/templatePlan/xml.d.ts +5 -0
- package/dist/docx/server/templatePlan/xml.js +7 -1
- package/dist/docx/storyBlockReplay.js +1 -1
- package/dist/docx/xmlParser.js +1 -1
- package/dist/i18n/loadMessages.d.ts +5 -0
- package/dist/i18n/loadMessages.js +46 -0
- package/dist/i18n/locales.d.ts +3 -0
- package/dist/i18n/locales.js +17 -0
- package/dist/i18n/messages.d.ts +3 -2
- package/dist/i18n/messages.js +4 -16
- package/dist/internal/clipboardTransformPlugin.d.ts +3 -0
- package/dist/internal/clipboardTransformPlugin.js +13 -0
- package/dist/internal/extensionRuntime.d.ts +7 -0
- package/dist/internal/extensionRuntime.js +28 -0
- package/dist/internal/paragraphFormattingSerialization.js +1 -1
- package/dist/internal/starterKitExtensions.d.ts +20 -0
- package/dist/internal/starterKitExtensions.js +123 -0
- package/dist/internal/wholeStoryRevisionResolution.js +2 -2
- package/dist/prosemirror/attrs/index.js +1 -1
- package/dist/prosemirror/canonicalSelectionRange.js +1 -1
- package/dist/prosemirror/canonicalTableCommands.js +1 -1
- package/dist/prosemirror/commands/comments.js +3 -3
- package/dist/prosemirror/commands/contentControls.js +1 -1
- package/dist/prosemirror/commands/pastePlainText.js +2 -3
- package/dist/prosemirror/commands/replaceRangeText.js +1 -1
- package/dist/prosemirror/commentRecords.js +2 -2
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +0 -5
- package/dist/prosemirror/conversion/fromProseDoc.js +2 -9
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/index.js +2 -2
- package/dist/prosemirror/extensions/ExtensionManager.js +4 -22
- package/dist/prosemirror/extensions/StarterKit.d.ts +4 -27
- package/dist/prosemirror/extensions/StarterKit.js +29 -115
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +2 -2
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +1 -1
- package/dist/prosemirror/extensions/features/ListExtension.js +7 -2
- package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +1 -1
- package/dist/prosemirror/extensions/index.d.ts +2 -1
- package/dist/prosemirror/extensions/marks/FootnoteRefExtension.js +8 -3
- package/dist/prosemirror/extensions/nodes/TableExtension.js +7 -40
- package/dist/prosemirror/hyperlinkRemoval.js +7 -2
- package/dist/prosemirror/index.d.ts +2 -2
- package/dist/prosemirror/index.js +2 -2
- package/dist/prosemirror/keptRangeBoundaries.js +1 -1
- package/dist/prosemirror/listNumbering.js +1 -1
- package/dist/prosemirror/noteReferenceOccurrences.js +1 -1
- package/dist/prosemirror/noteReferenceReview.d.ts +2 -56
- package/dist/prosemirror/noteReferenceReview.js +2 -243
- package/dist/prosemirror/pastedCommentCopies.js +1 -1
- package/dist/prosemirror/plugins/documentNumbering.js +1 -1
- package/dist/prosemirror/plugins/documentStyles.js +1 -1
- package/dist/prosemirror/replacedAnnotations.js +1 -1
- package/dist/prosemirror/suggestionCommands.d.ts +47 -0
- package/dist/prosemirror/suggestionCommands.js +31 -0
- package/dist/prosemirror/tableCellPaste.js +1 -1
- package/dist/prosemirror/tableRunIn.js +1 -1
- package/dist/prosemirror/textInput.js +1 -1
- package/dist/types/canonicalCapabilities.d.ts +6 -52
- package/dist/types/canonicalCapabilities.js +6 -52
- package/package.json +2 -2
- package/dist/ai-edits/apply.d.ts +0 -94
- package/dist/ai-edits/apply.js +0 -6637
- package/dist/ai-edits/note-story-inventory.d.ts +0 -5
- package/dist/ai-edits/note-story-inventory.js +0 -10
- package/dist/ai-edits/revisionStretches.d.ts +0 -32
- package/dist/ai-edits/revisionStretches.js +0 -147
- package/dist/document-operations-apply.d.ts +0 -15
- package/dist/document-operations-apply.js +0 -280
- package/dist/prosemirror/extensions/core/HistoryExtension.d.ts +0 -12
- package/dist/prosemirror/extensions/core/HistoryExtension.js +0 -114
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +0 -23
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +0 -270
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +0 -51
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +0 -411
- package/dist/prosemirror/plugins/suggestionMode.d.ts +0 -92
- package/dist/prosemirror/plugins/suggestionMode.js +0 -1515
- package/dist/prosemirror/tablePositionedBookmarks.d.ts +0 -8
- package/dist/prosemirror/tablePositionedBookmarks.js +0 -80
|
@@ -20,6 +20,11 @@ export declare const wAttr: (element: XmlElement | null | undefined, localName:
|
|
|
20
20
|
/** `w:val` of the child `localName`, or null when the child is absent. */
|
|
21
21
|
export declare const wChildVal: (element: XmlElement | null | undefined, localName: string) => string | null;
|
|
22
22
|
export declare const integerOrNull: (value: string | null) => number | null;
|
|
23
|
+
/**
|
|
24
|
+
* A length attribute in twentieths of a point: a plain number, or a
|
|
25
|
+
* universal measure (`1in`, `2.54cm`), which the schema allows in its place.
|
|
26
|
+
*/
|
|
27
|
+
export declare const twipsOrNull: (value: string | null) => number | null;
|
|
23
28
|
/** The largest of `values`, or `floor` when none is larger. */
|
|
24
29
|
export declare const maxOf: (values: Iterable<number>, floor: number) => number;
|
|
25
30
|
/** A relationship attribute (`r:id`, `r:embed`, ...) by local name. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { spliceXml } from "../../selectiveXmlPatch.js";
|
|
2
|
+
import { universalMeasureAs } from "../../universalMeasure.js";
|
|
2
3
|
import { NAMESPACES, OFFICE_RELATIONSHIP_NAMESPACE_URIS, WORDPROCESSINGML_NAMESPACE_URIS, getAttributeByNamespaceUri, getLocalName } from "../../xmlParser.js";
|
|
3
4
|
import { escapeXmlAttribute, escapeXmlText } from "@stll/docx-core";
|
|
4
5
|
import { getXmlSourceRange, parseStreamingXmlWithSourceRanges } from "@stll/docx-core/xml";
|
|
@@ -26,6 +27,11 @@ const integerOrNull = (value) => {
|
|
|
26
27
|
const parsed = Number.parseInt(value, 10);
|
|
27
28
|
return Number.isSafeInteger(parsed) ? parsed : null;
|
|
28
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* A length attribute in twentieths of a point: a plain number, or a
|
|
32
|
+
* universal measure (`1in`, `2.54cm`), which the schema allows in its place.
|
|
33
|
+
*/
|
|
34
|
+
const twipsOrNull = (value) => integerOrNull(value) ?? (value === null ? null : universalMeasureAs(value.trim(), "twips") ?? null);
|
|
29
35
|
/** The largest of `values`, or `floor` when none is larger. */
|
|
30
36
|
const maxOf = (values, floor) => {
|
|
31
37
|
let max = floor;
|
|
@@ -116,4 +122,4 @@ const walkElements = (root, visit) => {
|
|
|
116
122
|
}
|
|
117
123
|
}
|
|
118
124
|
};
|
|
119
|
-
export { MARKUP_COMPATIBILITY_NAMESPACE, MATH_NAMESPACE, elementChildren, escapeXmlAttribute, escapeXmlText, innerRangeOf, integerOrNull, isW, maxOf, partPrefixes, prefixFor, rangeOf, readRawPart, relationshipAttr, sliceWithSplices, spliceXml, wAttr, wChild, wChildVal, wChildren, wName, walkElements };
|
|
125
|
+
export { MARKUP_COMPATIBILITY_NAMESPACE, MATH_NAMESPACE, elementChildren, escapeXmlAttribute, escapeXmlText, innerRangeOf, integerOrNull, isW, maxOf, partPrefixes, prefixFor, rangeOf, readRawPart, relationshipAttr, sliceWithSplices, spliceXml, twipsOrNull, wAttr, wChild, wChildVal, wChildren, wName, walkElements };
|
|
@@ -3,8 +3,8 @@ import { spliceXml } from "./selectiveXmlPatch.js";
|
|
|
3
3
|
import { TRANSITIONAL_NAMESPACE_BY_STRICT_URI } from "./strictValueEncodings.gen.js";
|
|
4
4
|
import { captureSourceProfileXml, hasReplayOpeningDeclarations, isSafeCapturedXmlDocument, isSafeCompactReplayFragment, prepareCompactReplaySuffix } from "./verbatimCapture.js";
|
|
5
5
|
import { WORDPROCESSINGML_NAMESPACE_URIS, getAttributeByNamespaceUri, getChildElements, getLocalName, getNamespaceUri } from "./xmlParser.js";
|
|
6
|
-
import { DOCX_CONFORMANCE_CLASSES } from "@stll/docx-core/model";
|
|
7
6
|
import { escapeXmlAttribute } from "@stll/docx-core";
|
|
7
|
+
import { DOCX_CONFORMANCE_CLASSES } from "@stll/docx-core/model";
|
|
8
8
|
import { getXmlSourceRange, parseStreamingXml, parseStreamingXmlWithSourceRanges } from "@stll/docx-core/xml";
|
|
9
9
|
// src/docx/storyBlockReplay.ts
|
|
10
10
|
/**
|
package/dist/docx/xmlParser.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NUMBERS_PER_PERCENT, percentageSpelling, transitionalSlotEncoding } from "./transitionalSpelling.js";
|
|
2
2
|
import { universalMeasureAs } from "./universalMeasure.js";
|
|
3
|
-
import { PARSE_WARNING_CODES } from "@stll/docx-core/model";
|
|
4
3
|
import { escapeXmlAttribute, escapeXmlText } from "@stll/docx-core";
|
|
4
|
+
import { PARSE_WARNING_CODES } from "@stll/docx-core/model";
|
|
5
5
|
import { EMPTY_NAMESPACE_SCOPE, OOXML_NAMESPACE_SCOPE, OOXML_NS, attachXmlNamespaceContext, resolveNamespaceUri } from "@stll/docx-core/xml/namespaces";
|
|
6
6
|
import { XmlReadError, readXml } from "@stll/docx-core/xml";
|
|
7
7
|
// src/docx/xmlParser.ts
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FolioMessages } from "./messages.js";
|
|
2
|
+
/** Read English or a catalog that has already loaded. */
|
|
3
|
+
export declare const getLoadedFolioMessages: (locale: string) => FolioMessages | undefined;
|
|
4
|
+
/** Load just the catalog for the requested locale. */
|
|
5
|
+
export declare const loadFolioMessages: (locale: string) => Promise<FolioMessages>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { resolveFolioLocale } from "./locales.js";
|
|
2
|
+
import messages from "./messages/en.gen.js";
|
|
3
|
+
// src/i18n/loadMessages.ts
|
|
4
|
+
const loaders = {
|
|
5
|
+
ar: () => import("./messages/ar.gen.js"),
|
|
6
|
+
cs: () => import("./messages/cs.gen.js"),
|
|
7
|
+
de: () => import("./messages/de.gen.js"),
|
|
8
|
+
es: () => import("./messages/es.gen.js"),
|
|
9
|
+
et: () => import("./messages/et.gen.js"),
|
|
10
|
+
fr: () => import("./messages/fr.gen.js"),
|
|
11
|
+
he: () => import("./messages/he.gen.js"),
|
|
12
|
+
hi: () => import("./messages/hi.gen.js"),
|
|
13
|
+
hu: () => import("./messages/hu.gen.js"),
|
|
14
|
+
lt: () => import("./messages/lt.gen.js"),
|
|
15
|
+
lv: () => import("./messages/lv.gen.js"),
|
|
16
|
+
pl: () => import("./messages/pl.gen.js"),
|
|
17
|
+
"pt-BR": () => import("./messages/pt-BR.gen.js"),
|
|
18
|
+
sk: () => import("./messages/sk.gen.js"),
|
|
19
|
+
tr: () => import("./messages/tr.gen.js"),
|
|
20
|
+
"zh-CN": () => import("./messages/zh-CN.gen.js")
|
|
21
|
+
};
|
|
22
|
+
const catalogs = /* @__PURE__ */ new Map();
|
|
23
|
+
/** Read English or a catalog that has already loaded. */
|
|
24
|
+
const getLoadedFolioMessages = (locale) => {
|
|
25
|
+
const resolved = resolveFolioLocale(locale);
|
|
26
|
+
if (resolved === "en") return messages;
|
|
27
|
+
const cached = catalogs.get(resolved);
|
|
28
|
+
return cached instanceof Promise ? void 0 : cached;
|
|
29
|
+
};
|
|
30
|
+
/** Load just the catalog for the requested locale. */
|
|
31
|
+
const loadFolioMessages = (locale) => {
|
|
32
|
+
const resolved = resolveFolioLocale(locale);
|
|
33
|
+
if (resolved === "en") return Promise.resolve(messages);
|
|
34
|
+
const cached = catalogs.get(resolved);
|
|
35
|
+
if (cached !== void 0) return Promise.resolve(cached);
|
|
36
|
+
const pending = loaders[resolved]().then(({ messages }) => {
|
|
37
|
+
catalogs.set(resolved, messages);
|
|
38
|
+
return messages;
|
|
39
|
+
}, (error) => {
|
|
40
|
+
catalogs.delete(resolved);
|
|
41
|
+
throw error;
|
|
42
|
+
});
|
|
43
|
+
catalogs.set(resolved, pending);
|
|
44
|
+
return pending;
|
|
45
|
+
};
|
|
46
|
+
export { getLoadedFolioMessages, loadFolioMessages };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FOLIO_LOCALES } from "./messages/locales.js";
|
|
2
|
+
// src/i18n/locales.ts
|
|
3
|
+
const FOLIO_LOCALE_SET = new Set(FOLIO_LOCALES);
|
|
4
|
+
const isFolioLocale = (locale) => FOLIO_LOCALE_SET.has(locale);
|
|
5
|
+
const baseLanguageOf = (locale) => {
|
|
6
|
+
try {
|
|
7
|
+
return new Intl.Locale(locale).language;
|
|
8
|
+
} catch {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const resolveFolioLocale = (locale) => {
|
|
13
|
+
if (isFolioLocale(locale)) return locale;
|
|
14
|
+
const base = baseLanguageOf(locale);
|
|
15
|
+
return base !== null && isFolioLocale(base) ? base : "en";
|
|
16
|
+
};
|
|
17
|
+
export { isFolioLocale, resolveFolioLocale };
|
package/dist/i18n/messages.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { loadFolioMessages } from "./loadMessages.js";
|
|
2
|
+
import { isFolioLocale } from "./locales.js";
|
|
1
3
|
import { FOLIO_LOCALES, FolioLocale } from "./messages/locales.js";
|
|
2
4
|
type FolioMessageTree = {
|
|
3
5
|
[key: string]: string | FolioMessageTree;
|
|
@@ -5,6 +7,5 @@ type FolioMessageTree = {
|
|
|
5
7
|
export type FolioMessages = {
|
|
6
8
|
folio: FolioMessageTree;
|
|
7
9
|
};
|
|
8
|
-
export declare const isFolioLocale: (locale: string) => locale is FolioLocale;
|
|
9
10
|
export declare const getFolioMessages: (locale: string) => FolioMessages;
|
|
10
|
-
export { FOLIO_LOCALES, type FolioLocale };
|
|
11
|
+
export { FOLIO_LOCALES, type FolioLocale, isFolioLocale, loadFolioMessages };
|
package/dist/i18n/messages.js
CHANGED
|
@@ -1,20 +1,8 @@
|
|
|
1
|
+
import { loadFolioMessages } from "./loadMessages.js";
|
|
2
|
+
import { isFolioLocale, resolveFolioLocale } from "./locales.js";
|
|
1
3
|
import { CATALOGS as CATALOGS$1 } from "./messages/catalogs.gen.js";
|
|
2
4
|
import { FOLIO_LOCALES } from "./messages/locales.js";
|
|
3
5
|
// src/i18n/messages.ts
|
|
4
6
|
const CATALOGS = CATALOGS$1;
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const baseLanguageOf = (locale) => {
|
|
8
|
-
try {
|
|
9
|
-
return new Intl.Locale(locale).language;
|
|
10
|
-
} catch {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
const getFolioMessages = (locale) => {
|
|
15
|
-
if (isFolioLocale(locale)) return CATALOGS[locale];
|
|
16
|
-
const base = baseLanguageOf(locale);
|
|
17
|
-
if (base !== null && isFolioLocale(base)) return CATALOGS[base];
|
|
18
|
-
return CATALOGS.en;
|
|
19
|
-
};
|
|
20
|
-
export { FOLIO_LOCALES, getFolioMessages, isFolioLocale };
|
|
7
|
+
const getFolioMessages = (locale) => CATALOGS[resolveFolioLocale(locale)];
|
|
8
|
+
export { FOLIO_LOCALES, getFolioMessages, isFolioLocale, loadFolioMessages };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Plugin } from "prosemirror-state";
|
|
2
|
+
/** Retain the copy and paste transforms a view can use independently of an editor plugin. */
|
|
3
|
+
export declare const clipboardTransformPlugin: ({ transformPastedHTML, transformPasted, transformCopied, clipboardTextSerializer }: Plugin["props"]) => Plugin<any>[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Plugin } from "prosemirror-state";
|
|
2
|
+
// src/internal/clipboardTransformPlugin.ts
|
|
3
|
+
/** Retain the copy and paste transforms a view can use independently of an editor plugin. */
|
|
4
|
+
const clipboardTransformPlugin = ({ transformPastedHTML, transformPasted, transformCopied, clipboardTextSerializer }) => {
|
|
5
|
+
if (transformPastedHTML === void 0 && transformPasted === void 0 && transformCopied === void 0 && clipboardTextSerializer === void 0) return [];
|
|
6
|
+
return [new Plugin({ props: {
|
|
7
|
+
...transformPastedHTML === void 0 ? {} : { transformPastedHTML },
|
|
8
|
+
...transformPasted === void 0 ? {} : { transformPasted },
|
|
9
|
+
...transformCopied === void 0 ? {} : { transformCopied },
|
|
10
|
+
...clipboardTextSerializer === void 0 ? {} : { clipboardTextSerializer }
|
|
11
|
+
} })];
|
|
12
|
+
};
|
|
13
|
+
export { clipboardTransformPlugin };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AnyExtension, ExtensionCommandMap } from "../prosemirror/extensions/types.js";
|
|
2
|
+
import { Plugin } from "prosemirror-state";
|
|
3
|
+
import { Schema } from "prosemirror-model";
|
|
4
|
+
export declare const createExtensionRuntime: (extensions: readonly AnyExtension[], schema: Schema) => {
|
|
5
|
+
plugins: Plugin<any>[];
|
|
6
|
+
commandRegistry: ExtensionCommandMap;
|
|
7
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createNativeNavigationPlugin } from "../prosemirror/nativeSelection.js";
|
|
2
|
+
import { areTransactionInvariantsEnabled, createTransactionInvariantPlugin } from "../prosemirror/plugins/transactionInvariants.js";
|
|
3
|
+
import { createTextInputPlugin } from "../prosemirror/textInput.js";
|
|
4
|
+
import { keymap } from "prosemirror-keymap";
|
|
5
|
+
// src/internal/extensionRuntime.ts
|
|
6
|
+
const createExtensionRuntime = (extensions, schema) => {
|
|
7
|
+
const ctx = { schema };
|
|
8
|
+
const allKeyboardShortcuts = [];
|
|
9
|
+
const allPlugins = [];
|
|
10
|
+
const allCommands = {};
|
|
11
|
+
for (const ext of extensions) {
|
|
12
|
+
const runtime = ext.onSchemaReady(ctx);
|
|
13
|
+
if (runtime.commands) Object.assign(allCommands, runtime.commands);
|
|
14
|
+
if (runtime.keyboardShortcuts) allKeyboardShortcuts.push(runtime.keyboardShortcuts);
|
|
15
|
+
if (runtime.plugins) allPlugins.push(...runtime.plugins);
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
plugins: [
|
|
19
|
+
createTextInputPlugin(),
|
|
20
|
+
createNativeNavigationPlugin(),
|
|
21
|
+
...allPlugins,
|
|
22
|
+
...allKeyboardShortcuts.map((shortcuts) => keymap(shortcuts)),
|
|
23
|
+
...areTransactionInvariantsEnabled() ? [createTransactionInvariantPlugin()] : []
|
|
24
|
+
],
|
|
25
|
+
commandRegistry: allCommands
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export { createExtensionRuntime };
|
|
@@ -5,8 +5,8 @@ import { intAttr } from "../docx/serializer/xmlUtils.js";
|
|
|
5
5
|
import { TRANSITIONAL_NAME_BY_STRICT_NAME } from "../docx/strictNames.gen.js";
|
|
6
6
|
import { createCapturedXmlSanitizer } from "../docx/verbatimCapture.js";
|
|
7
7
|
import { NAMESPACES, OOXML_NAMESPACE_SCOPE } from "../docx/xmlParser.js";
|
|
8
|
-
import { outlineLevelStatedValue, paragraphNumberingSlots } from "@stll/docx-core/model";
|
|
9
8
|
import { escapeXmlAttribute, serializeOnOffElement } from "@stll/docx-core";
|
|
9
|
+
import { outlineLevelStatedValue, paragraphNumberingSlots } from "@stll/docx-core/model";
|
|
10
10
|
import { serializeSequenceChildren } from "@stll/docx-core/schema";
|
|
11
11
|
// src/internal/paragraphFormattingSerialization.ts
|
|
12
12
|
/** Only an absent paragraph override leaves numbering wholly to its style. */
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HistoryShortcutOwner } from "../prosemirror/extensions/core/historyCommands.js";
|
|
2
|
+
import { AnyExtension } from "../prosemirror/extensions/types.js";
|
|
3
|
+
import { SelectionChangeCallback } from "../prosemirror/plugins/selectionTracker.js";
|
|
4
|
+
/** Options for the DOCX editor extension set. */
|
|
5
|
+
export type StarterKitOptions = {
|
|
6
|
+
/** Extensions to disable by name */
|
|
7
|
+
disable?: string[];
|
|
8
|
+
/** @deprecated The session owns history. This option has no effect. */
|
|
9
|
+
historyDepth?: number;
|
|
10
|
+
/** @deprecated The session owns history grouping. This option has no effect. */
|
|
11
|
+
historyNewGroupDelay?: number;
|
|
12
|
+
/** Who answers the undo and redo keys (default: `"editor"`). */
|
|
13
|
+
historyShortcuts?: HistoryShortcutOwner;
|
|
14
|
+
/** Selection change callback */
|
|
15
|
+
onSelectionChange?: SelectionChangeCallback;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Assemble the DOCX extension set shared with the reference editor.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createStarterKitExtensions(options?: StarterKitOptions): AnyExtension[];
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { DocExtension } from "../prosemirror/extensions/core/DocExtension.js";
|
|
2
|
+
import { ParagraphExtension } from "../prosemirror/extensions/core/ParagraphExtension.js";
|
|
3
|
+
import { TextExtension } from "../prosemirror/extensions/core/TextExtension.js";
|
|
4
|
+
import { historyKeyboardShortcuts, redoCommand, undoCommand } from "../prosemirror/extensions/core/historyCommands.js";
|
|
5
|
+
import { createExtension } from "../prosemirror/extensions/create.js";
|
|
6
|
+
import { AutoBidiDetectionExtension } from "../prosemirror/extensions/features/AutoBidiDetectionExtension.js";
|
|
7
|
+
import { BaseKeymapExtension } from "../prosemirror/extensions/features/BaseKeymapExtension.js";
|
|
8
|
+
import { BidiShortcutExtension } from "../prosemirror/extensions/features/BidiShortcutExtension.js";
|
|
9
|
+
import { ContentControlWidgetsExtension } from "../prosemirror/extensions/features/ContentControlWidgetsExtension.js";
|
|
10
|
+
import { DropCursorExtension } from "../prosemirror/extensions/features/DropCursorExtension.js";
|
|
11
|
+
import { EmptyParagraphFormatExtension } from "../prosemirror/extensions/features/EmptyParagraphFormatExtension.js";
|
|
12
|
+
import { GapCursorExtension } from "../prosemirror/extensions/features/GapCursorExtension.js";
|
|
13
|
+
import { ImageDragExtension } from "../prosemirror/extensions/features/ImageDragExtension.js";
|
|
14
|
+
import { ImagePasteExtension } from "../prosemirror/extensions/features/ImagePasteExtension.js";
|
|
15
|
+
import { JoinedRunStyleExtension } from "../prosemirror/extensions/features/JoinedRunStyleExtension.js";
|
|
16
|
+
import { ListExtension } from "../prosemirror/extensions/features/ListExtension.js";
|
|
17
|
+
import { PasteCleanupExtension } from "../prosemirror/extensions/features/PasteCleanupExtension.js";
|
|
18
|
+
import { PasteStyleInlinerExtension } from "../prosemirror/extensions/features/PasteStyleInlinerExtension.js";
|
|
19
|
+
import { SelectionTrackerExtension } from "../prosemirror/extensions/features/SelectionTrackerExtension.js";
|
|
20
|
+
import { MARK_EXTENSIONS, MARK_NESTING_ORDER } from "../prosemirror/extensions/markRegistry.js";
|
|
21
|
+
import { BlockBookmarkBoundaryExtension } from "../prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.js";
|
|
22
|
+
import { BlockCommentRangeBoundaryExtension } from "../prosemirror/extensions/nodes/BlockCommentRangeBoundaryExtension.js";
|
|
23
|
+
import { BlockCustomXmlExtension } from "../prosemirror/extensions/nodes/BlockCustomXmlExtension.js";
|
|
24
|
+
import { BlockMoveRangeBoundaryExtension } from "../prosemirror/extensions/nodes/BlockMoveRangeBoundaryExtension.js";
|
|
25
|
+
import { BlockSdtExtension } from "../prosemirror/extensions/nodes/BlockSdtExtension.js";
|
|
26
|
+
import { BookmarkBoundaryExtension } from "../prosemirror/extensions/nodes/BookmarkBoundaryExtension.js";
|
|
27
|
+
import { CommentRangeBoundaryExtension } from "../prosemirror/extensions/nodes/CommentRangeBoundaryExtension.js";
|
|
28
|
+
import { CommentReferenceExtension } from "../prosemirror/extensions/nodes/CommentReferenceExtension.js";
|
|
29
|
+
import { FieldExtension, StructuredFieldExtension } from "../prosemirror/extensions/nodes/FieldExtension.js";
|
|
30
|
+
import { HardBreakExtension } from "../prosemirror/extensions/nodes/HardBreakExtension.js";
|
|
31
|
+
import { HorizontalRuleExtension } from "../prosemirror/extensions/nodes/HorizontalRuleExtension.js";
|
|
32
|
+
import { ImageExtension } from "../prosemirror/extensions/nodes/ImageExtension.js";
|
|
33
|
+
import { MathExtension } from "../prosemirror/extensions/nodes/MathExtension.js";
|
|
34
|
+
import { MoveRangeBoundaryExtension } from "../prosemirror/extensions/nodes/MoveRangeBoundaryExtension.js";
|
|
35
|
+
import { NoteMarkerExtension } from "../prosemirror/extensions/nodes/NoteMarkerExtension.js";
|
|
36
|
+
import { PageBreakExtension } from "../prosemirror/extensions/nodes/PageBreakExtension.js";
|
|
37
|
+
import { PageBreakRunExtension } from "../prosemirror/extensions/nodes/PageBreakRunExtension.js";
|
|
38
|
+
import { PreservedBlockExtension } from "../prosemirror/extensions/nodes/PreservedBlockExtension.js";
|
|
39
|
+
import { PreservedXmlExtension } from "../prosemirror/extensions/nodes/PreservedXmlExtension.js";
|
|
40
|
+
import { RangeAnchorExtension } from "../prosemirror/extensions/nodes/RangeAnchorExtension.js";
|
|
41
|
+
import { RenderedPageBreakExtension } from "../prosemirror/extensions/nodes/RenderedPageBreakExtension.js";
|
|
42
|
+
import { SdtExtension } from "../prosemirror/extensions/nodes/SdtExtension.js";
|
|
43
|
+
import { ShapeExtension } from "../prosemirror/extensions/nodes/ShapeExtension.js";
|
|
44
|
+
import { SymbolExtension } from "../prosemirror/extensions/nodes/SymbolExtension.js";
|
|
45
|
+
import { TabExtension } from "../prosemirror/extensions/nodes/TabExtension.js";
|
|
46
|
+
import { createTableExtensions } from "../prosemirror/extensions/nodes/TableExtension.js";
|
|
47
|
+
import { TextBoxAnchorExtension } from "../prosemirror/extensions/nodes/TextBoxAnchorExtension.js";
|
|
48
|
+
import { TextBoxExtension } from "../prosemirror/extensions/nodes/TextBoxExtension.js";
|
|
49
|
+
// src/internal/starterKitExtensions.ts
|
|
50
|
+
/**
|
|
51
|
+
* Assemble the DOCX extension set shared with the reference editor.
|
|
52
|
+
*/
|
|
53
|
+
function createStarterKitExtensions(options = {}) {
|
|
54
|
+
const disabled = options.disable ? new Set(options.disable) : /* @__PURE__ */ new Set();
|
|
55
|
+
const extensions = [];
|
|
56
|
+
let internalClipboardToken;
|
|
57
|
+
const getInternalClipboardToken = () => {
|
|
58
|
+
internalClipboardToken ??= globalThis.crypto.randomUUID();
|
|
59
|
+
return internalClipboardToken;
|
|
60
|
+
};
|
|
61
|
+
function add(name, ext) {
|
|
62
|
+
if (!disabled.has(name)) extensions.push(ext);
|
|
63
|
+
}
|
|
64
|
+
add("doc", DocExtension());
|
|
65
|
+
add("text", TextExtension());
|
|
66
|
+
add("paragraph", ParagraphExtension());
|
|
67
|
+
add("history", createExtension({
|
|
68
|
+
name: "history",
|
|
69
|
+
onSchemaReady: () => ({
|
|
70
|
+
commands: {
|
|
71
|
+
undo: undoCommand,
|
|
72
|
+
redo: redoCommand
|
|
73
|
+
},
|
|
74
|
+
...options.historyShortcuts !== "host" && { keyboardShortcuts: historyKeyboardShortcuts }
|
|
75
|
+
})
|
|
76
|
+
})());
|
|
77
|
+
for (const name of MARK_NESTING_ORDER) add(name, MARK_EXTENSIONS[name]({ getInternalClipboardToken }));
|
|
78
|
+
add("bookmarkBoundary", BookmarkBoundaryExtension({ getInternalClipboardToken }));
|
|
79
|
+
add("blockBookmarkBoundary", BlockBookmarkBoundaryExtension({ getInternalClipboardToken }));
|
|
80
|
+
add("blockMoveRangeBoundary", BlockMoveRangeBoundaryExtension({ getInternalClipboardToken }));
|
|
81
|
+
add("blockCommentRangeBoundary", BlockCommentRangeBoundaryExtension());
|
|
82
|
+
add("commentReference", CommentReferenceExtension({ getInternalClipboardToken }));
|
|
83
|
+
add("commentRangeBoundary", CommentRangeBoundaryExtension({ getInternalClipboardToken }));
|
|
84
|
+
add("moveRangeBoundary", MoveRangeBoundaryExtension({ getInternalClipboardToken }));
|
|
85
|
+
add("rangeAnchor", RangeAnchorExtension({ getInternalClipboardToken }));
|
|
86
|
+
add("hardBreak", HardBreakExtension());
|
|
87
|
+
add("tab", TabExtension());
|
|
88
|
+
add("symbol", SymbolExtension());
|
|
89
|
+
add("preservedXml", PreservedXmlExtension());
|
|
90
|
+
add("noteMarker", NoteMarkerExtension());
|
|
91
|
+
add("image", ImageExtension());
|
|
92
|
+
add("textBox", TextBoxExtension());
|
|
93
|
+
add("textBoxAnchor", TextBoxAnchorExtension({ getInternalClipboardToken }));
|
|
94
|
+
add("shape", ShapeExtension());
|
|
95
|
+
add("imageDrag", ImageDragExtension());
|
|
96
|
+
add("imagePaste", ImagePasteExtension());
|
|
97
|
+
add("dropCursor", DropCursorExtension());
|
|
98
|
+
add("gapCursor", GapCursorExtension());
|
|
99
|
+
add("horizontalRule", HorizontalRuleExtension());
|
|
100
|
+
add("pageBreak", PageBreakExtension());
|
|
101
|
+
add("pageBreakRun", PageBreakRunExtension());
|
|
102
|
+
add("renderedPageBreak", RenderedPageBreakExtension());
|
|
103
|
+
add("field", FieldExtension({ getInternalClipboardToken }));
|
|
104
|
+
add("field", StructuredFieldExtension({ getInternalClipboardToken }));
|
|
105
|
+
add("sdt", SdtExtension());
|
|
106
|
+
add("blockSdt", BlockSdtExtension());
|
|
107
|
+
add("blockCustomXml", BlockCustomXmlExtension());
|
|
108
|
+
add("preservedBlock", PreservedBlockExtension());
|
|
109
|
+
add("math", MathExtension());
|
|
110
|
+
if (!disabled.has("table")) extensions.push(...createTableExtensions());
|
|
111
|
+
add("pasteCleanup", PasteCleanupExtension({ getInternalClipboardToken }));
|
|
112
|
+
add("pasteStyleInliner", PasteStyleInlinerExtension());
|
|
113
|
+
add("list", ListExtension());
|
|
114
|
+
add("baseKeymap", BaseKeymapExtension());
|
|
115
|
+
add("emptyParagraphFormat", EmptyParagraphFormatExtension());
|
|
116
|
+
add("joinedRunStyle", JoinedRunStyleExtension());
|
|
117
|
+
add("selectionTracker", options.onSelectionChange === void 0 ? SelectionTrackerExtension() : SelectionTrackerExtension({ onSelectionChange: options.onSelectionChange }));
|
|
118
|
+
add("bidiShortcut", BidiShortcutExtension());
|
|
119
|
+
add("autoBidiDetection", AutoBidiDetectionExtension());
|
|
120
|
+
add("contentControlWidgets", ContentControlWidgetsExtension());
|
|
121
|
+
return extensions;
|
|
122
|
+
}
|
|
123
|
+
export { createStarterKitExtensions };
|
|
@@ -19,10 +19,10 @@ import { paragraphContentOf } from "../prosemirror/zeroWidthAnchors.js";
|
|
|
19
19
|
import { recordNodeResolution } from "./revisionResolutionEdits.js";
|
|
20
20
|
import { resolveInlineRevisions } from "./revisionResolutionInline.js";
|
|
21
21
|
import { composeRevisionResolutionMaps } from "./revisionResolutionStep.js";
|
|
22
|
-
import { Fragment, Slice } from "prosemirror-model";
|
|
23
|
-
import { Mapping, ReplaceStep, StepMap, Transform } from "prosemirror-transform";
|
|
24
22
|
import { REVIEW_CARRIERS } from "@stll/docx-core/model";
|
|
25
23
|
import { paragraphMarkOutcome } from "@stll/docx-core/ops";
|
|
24
|
+
import { Fragment, Slice } from "prosemirror-model";
|
|
25
|
+
import { Mapping, ReplaceStep, StepMap, Transform } from "prosemirror-transform";
|
|
26
26
|
// src/internal/wholeStoryRevisionResolution.ts
|
|
27
27
|
const resolveProperties = ({ doc, mode, styleResolver, numbering, steps, changedRanges }) => {
|
|
28
28
|
const removedMark = doc.type.schema.marks[mode === "accept" ? "deletion" : "insertion"];
|
|
@@ -16,8 +16,8 @@ import { isParagraphDirection } from "../paragraphDirection.js";
|
|
|
16
16
|
import { COMPLEX_SCRIPT_RUN_PROPERTY_KEYS, RUN_FORMATTING_BOOLEAN_PROPERTIES, RUN_FORMATTING_VALUE_PROPERTIES, TRACKED_CHANGE_PROVENANCE_VALUES } from "../schema/marks.js";
|
|
17
17
|
import { PRESERVED_XML_LEVELS, TEXT_BOX_TEXT_BODY_CONTENT_STATE_TYPES } from "../schema/nodes.js";
|
|
18
18
|
import { DRAWING_RAW_XML_MODES, THEME_COLORS, isOoxmlSymbolCharacter } from "@stll/docx-core/model";
|
|
19
|
-
import { isCopyOriginAncestors } from "@stll/docx-core/ops";
|
|
20
19
|
import { isSafePreservedChildXml, isWithinPreservedMarkupBudget } from "@stll/docx-core/schema";
|
|
20
|
+
import { isCopyOriginAncestors } from "@stll/docx-core/ops";
|
|
21
21
|
// src/prosemirror/attrs/index.ts
|
|
22
22
|
const RUN_FORMATTING_VALUE_PROPERTY_SET = new Set(RUN_FORMATTING_VALUE_PROPERTIES);
|
|
23
23
|
const PRESERVED_XML_LEVEL_VALUES = new Set(Object.values(PRESERVED_XML_LEVELS));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CellSelection } from "prosemirror-tables";
|
|
2
1
|
import { AllSelection, Selection } from "prosemirror-state";
|
|
2
|
+
import { CellSelection } from "prosemirror-tables";
|
|
3
3
|
// src/prosemirror/canonicalSelectionRange.ts
|
|
4
4
|
/** Document edges denote the first and last editable content gaps. */
|
|
5
5
|
const canonicalContentPosition = (doc, position) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs } from "./attrs/index.js";
|
|
2
2
|
import { withCanonicalCommand } from "./canonicalCommands.js";
|
|
3
3
|
import { standaloneTableRowsFromProseMirror, tableAttrsToFormatting, tableCellAttrsToFormatting, tableRowAttrsToFormatting } from "./conversion/fromProseDoc.js";
|
|
4
|
-
import { isInTable, selectedRect } from "prosemirror-tables";
|
|
5
4
|
import { DOCUMENT_OP_TYPES } from "@stll/docx-core/ops";
|
|
5
|
+
import { isInTable, selectedRect } from "prosemirror-tables";
|
|
6
6
|
// src/prosemirror/canonicalTableCommands.ts
|
|
7
7
|
const SCOPES = {
|
|
8
8
|
table: "table",
|
|
@@ -42,11 +42,11 @@ import { resolveNodePropertyChangeAttrs } from "./resolveNodePropertyChangeAttrs
|
|
|
42
42
|
import { resolveParagraphChangeAttrs } from "./resolveParagraphProperties.js";
|
|
43
43
|
import { hasMatchingCollapsedTableCellMerge, resolveCollapsedTableCellMerge, resolveVisibleTableCellMerge } from "./tableCellMergeResolution.js";
|
|
44
44
|
import { panic } from "better-result";
|
|
45
|
-
import { Fragment } from "prosemirror-model";
|
|
46
|
-
import { TableMap } from "prosemirror-tables";
|
|
47
|
-
import { Mapping } from "prosemirror-transform";
|
|
48
45
|
import { PARAGRAPH_MARK_CHANGE_KINDS, REVIEW_CARRIERS } from "@stll/docx-core/model";
|
|
49
46
|
import { paragraphMarkOutcome } from "@stll/docx-core/ops";
|
|
47
|
+
import { TableMap } from "prosemirror-tables";
|
|
48
|
+
import { Fragment } from "prosemirror-model";
|
|
49
|
+
import { Mapping } from "prosemirror-transform";
|
|
50
50
|
import { closeHistory } from "prosemirror-history";
|
|
51
51
|
// src/prosemirror/commands/comments.ts
|
|
52
52
|
/**
|
|
@@ -5,7 +5,7 @@ import { formatDate } from "../../docx/fieldParser.js";
|
|
|
5
5
|
import { preservedSdtChild, withoutPreservedSdtChild } from "../../docx/sdtProperties.js";
|
|
6
6
|
import { expectBlockSdtAttrs } from "../attrs/index.js";
|
|
7
7
|
import { withCanonicalCommand } from "../canonicalCommands.js";
|
|
8
|
-
import { SUGGESTION_BYPASS_META } from "../
|
|
8
|
+
import { SUGGESTION_BYPASS_META } from "../suggestionCommands.js";
|
|
9
9
|
// src/prosemirror/commands/contentControls.ts
|
|
10
10
|
function nodeMatchesFilter(node, pos, filter) {
|
|
11
11
|
if (node.type.name !== "blockSdt") return false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { dispatchClipboardIntent } from "../clipboardIntent.js";
|
|
2
|
-
import {
|
|
2
|
+
import { pasteAsSuggestion } from "../suggestionCommands.js";
|
|
3
3
|
import { Fragment, Slice } from "prosemirror-model";
|
|
4
4
|
// src/prosemirror/commands/pastePlainText.ts
|
|
5
5
|
/**
|
|
@@ -40,8 +40,7 @@ function buildPlainTextSlice(text, schema) {
|
|
|
40
40
|
*/
|
|
41
41
|
const pastePlainTextSlice = (view, slice) => {
|
|
42
42
|
if (dispatchClipboardIntent(view, slice) !== void 0) return;
|
|
43
|
-
|
|
44
|
-
if (suggesting?.active && handleSuggestionPaste(view, slice, suggesting)) return;
|
|
43
|
+
if (pasteAsSuggestion(view, slice)) return;
|
|
45
44
|
view.dispatch(view.state.tr.replaceSelection(slice).scrollIntoView().setMeta("paste", true).setMeta("uiEvent", "paste"));
|
|
46
45
|
};
|
|
47
46
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { withCanonicalCommand } from "../canonicalCommands.js";
|
|
2
|
-
import { deleteSelectionAsSuggestion } from "../
|
|
2
|
+
import { deleteSelectionAsSuggestion } from "../suggestionCommands.js";
|
|
3
3
|
// src/prosemirror/commands/replaceRangeText.ts
|
|
4
4
|
const replaceRangeText = ({ from, to, text }) => withCanonicalCommand((state, dispatch) => {
|
|
5
5
|
if (from > to || to > state.doc.content.size) return false;
|
|
@@ -6,11 +6,11 @@ import "./extensions/nodes/RangeAnchorExtension.js";
|
|
|
6
6
|
import { mapPlacedRanges, pastedRepeatsOf } from "./pastePlacement.js";
|
|
7
7
|
import { settleDroppedComments, settlePastedComments, settlePlacedComments } from "./pastedCommentCopies.js";
|
|
8
8
|
import { createPluginKeyOwner } from "./pluginKeyOwner.js";
|
|
9
|
-
import { SUGGESTION_BYPASS_META } from "./plugins/suggestionMode.js";
|
|
10
9
|
import { readRangeAnchorAttrs } from "./rangeAnchorAttrs.js";
|
|
10
|
+
import { SUGGESTION_BYPASS_META } from "./suggestionCommands.js";
|
|
11
11
|
import { panic } from "better-result";
|
|
12
|
-
import { Step, StepMap, StepResult } from "prosemirror-transform";
|
|
13
12
|
import { Plugin, Selection } from "prosemirror-state";
|
|
13
|
+
import { Step, StepMap, StepResult } from "prosemirror-transform";
|
|
14
14
|
import { closeHistory } from "prosemirror-history";
|
|
15
15
|
// src/prosemirror/commentRecords.ts
|
|
16
16
|
/**
|
|
@@ -44,11 +44,6 @@ export declare const standaloneTableCellFromProseMirror: (node: Node) => documen
|
|
|
44
44
|
/** A table node's rows as the save writes them, vertical merges included. */
|
|
45
45
|
export declare const standaloneTableRowsFromProseMirror: (node: Node) => document_d_exports.TableRow[];
|
|
46
46
|
export declare function tableCellAttrsToFormatting(attrs: TableCellAttrs): document_d_exports.TableCellFormatting | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* Update a Document with content from a ProseMirror document
|
|
49
|
-
* Preserves all non-content parts of the original document
|
|
50
|
-
*/
|
|
51
|
-
export declare function updateDocumentContent(originalDocument: document_d_exports.Document, pmDoc: Node): document_d_exports.Document;
|
|
52
47
|
/**
|
|
53
48
|
* Convert a ProseMirror document back to an array of `BlockContent` blocks
|
|
54
49
|
* (paragraphs, tables, and block-level content controls).
|
|
@@ -68,9 +68,9 @@ import { hyphenElementRunContent } from "./hyphenTextCarriers.js";
|
|
|
68
68
|
import { hasSinkChildren } from "./preservedSinkCarriers.js";
|
|
69
69
|
import { decodeSdtListItems, sdtPropertiesFromAttrs, sdtPropertiesMatchAttrs } from "./sdtAttrs.js";
|
|
70
70
|
import { TaggedError, panic } from "better-result";
|
|
71
|
-
import { Fragment } from "prosemirror-model";
|
|
72
71
|
import { DRAWING_RAW_XML_MODES, finalizeParagraphFormatting, relationshipIdOf, setDocumentBodyComments } from "@stll/docx-core/model";
|
|
73
72
|
import { registerStatedParagraphFormatting, survivingComments } from "@stll/docx-core/ops";
|
|
73
|
+
import { Fragment } from "prosemirror-model";
|
|
74
74
|
// src/prosemirror/conversion/fromProseDoc.ts
|
|
75
75
|
/**
|
|
76
76
|
* ProseMirror to Document Conversion
|
|
@@ -3901,13 +3901,6 @@ function convertPMTextBox(node, styleResolver = null) {
|
|
|
3901
3901
|
};
|
|
3902
3902
|
}
|
|
3903
3903
|
/**
|
|
3904
|
-
* Update a Document with content from a ProseMirror document
|
|
3905
|
-
* Preserves all non-content parts of the original document
|
|
3906
|
-
*/
|
|
3907
|
-
function updateDocumentContent(originalDocument, pmDoc) {
|
|
3908
|
-
return fromProseDoc(pmDoc, originalDocument, { stylesheetSource: { type: "package" } });
|
|
3909
|
-
}
|
|
3910
|
-
/**
|
|
3911
3904
|
* Convert a ProseMirror document back to an array of `BlockContent` blocks
|
|
3912
3905
|
* (paragraphs, tables, and block-level content controls).
|
|
3913
3906
|
*
|
|
@@ -3924,4 +3917,4 @@ function proseDocToBlocks(pmDoc, baseContent, styles) {
|
|
|
3924
3917
|
if (baseContent) restoreParagraphPropertySources(blocks, baseContent, linkedSources.targets, linkedSources.sources);
|
|
3925
3918
|
return blocks;
|
|
3926
3919
|
}
|
|
3927
|
-
export { fromProseDoc, marksToTextFormatting, proseDocToBlocks, standaloneTableCellFromProseMirror, standaloneTableRowsFromProseMirror, tableAttrsToFormatting, tableCellAttrsToFormatting, tableRowAttrsToFormatting
|
|
3920
|
+
export { fromProseDoc, marksToTextFormatting, proseDocToBlocks, standaloneTableCellFromProseMirror, standaloneTableRowsFromProseMirror, tableAttrsToFormatting, tableCellAttrsToFormatting, tableRowAttrsToFormatting };
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* Bidirectional conversion between Document (DOCX) and ProseMirror document.
|
|
5
5
|
*/
|
|
6
6
|
import { ProseMirrorDocumentValidationIssue, ValidateProseMirrorDocumentResult, assertValidProseMirrorDocument, formatProseMirrorDocumentIssues, validateProseMirrorDocument } from "../validation.js";
|
|
7
|
-
import { FromProseDocOptions, ProjectionReuse, fromProseDoc, proseDocToBlocks
|
|
7
|
+
import { FromProseDocOptions, ProjectionReuse, fromProseDoc, proseDocToBlocks } from "./fromProseDoc.js";
|
|
8
8
|
import { ToProseDocOptions, createEmptyDoc, headerFooterToProseDoc, toProseDoc } from "./toProseDoc.js";
|
|
9
|
-
export { type FromProseDocOptions, type ProjectionReuse, type ProseMirrorDocumentValidationIssue, type ToProseDocOptions, type ValidateProseMirrorDocumentResult, assertValidProseMirrorDocument, createEmptyDoc, formatProseMirrorDocumentIssues, fromProseDoc, headerFooterToProseDoc, proseDocToBlocks, toProseDoc,
|
|
9
|
+
export { type FromProseDocOptions, type ProjectionReuse, type ProseMirrorDocumentValidationIssue, type ToProseDocOptions, type ValidateProseMirrorDocumentResult, assertValidProseMirrorDocument, createEmptyDoc, formatProseMirrorDocumentIssues, fromProseDoc, headerFooterToProseDoc, proseDocToBlocks, toProseDoc, validateProseMirrorDocument };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { assertValidProseMirrorDocument, formatProseMirrorDocumentIssues, validateProseMirrorDocument } from "../validation.js";
|
|
2
|
-
import { fromProseDoc, proseDocToBlocks
|
|
2
|
+
import { fromProseDoc, proseDocToBlocks } from "./fromProseDoc.js";
|
|
3
3
|
import { createEmptyDoc, headerFooterToProseDoc, toProseDoc } from "./toProseDoc.js";
|
|
4
|
-
export { assertValidProseMirrorDocument, createEmptyDoc, formatProseMirrorDocumentIssues, fromProseDoc, headerFooterToProseDoc, proseDocToBlocks, toProseDoc,
|
|
4
|
+
export { assertValidProseMirrorDocument, createEmptyDoc, formatProseMirrorDocumentIssues, fromProseDoc, headerFooterToProseDoc, proseDocToBlocks, toProseDoc, validateProseMirrorDocument };
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { areTransactionInvariantsEnabled, createTransactionInvariantPlugin } from "../plugins/transactionInvariants.js";
|
|
3
|
-
import { createTextInputPlugin } from "../textInput.js";
|
|
1
|
+
import { createExtensionRuntime } from "../../internal/extensionRuntime.js";
|
|
4
2
|
import { panic } from "better-result";
|
|
5
3
|
import { Schema } from "prosemirror-model";
|
|
6
|
-
import { keymap } from "prosemirror-keymap";
|
|
7
4
|
// src/prosemirror/extensions/ExtensionManager.ts
|
|
8
5
|
/**
|
|
9
6
|
* Extension Manager
|
|
@@ -39,24 +36,9 @@ var ExtensionManager = class {
|
|
|
39
36
|
*/
|
|
40
37
|
initializeRuntime() {
|
|
41
38
|
if (!this.schema) panic("ExtensionManager: buildSchema() must be called before initializeRuntime()");
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const allCommands = {};
|
|
46
|
-
for (const ext of this.extensions) {
|
|
47
|
-
const runtime = ext.onSchemaReady(ctx);
|
|
48
|
-
if (runtime.commands) Object.assign(allCommands, runtime.commands);
|
|
49
|
-
if (runtime.keyboardShortcuts) allKeyboardShortcuts.push(runtime.keyboardShortcuts);
|
|
50
|
-
if (runtime.plugins) allPlugins.push(...runtime.plugins);
|
|
51
|
-
}
|
|
52
|
-
this.plugins = [
|
|
53
|
-
createTextInputPlugin(),
|
|
54
|
-
createNativeNavigationPlugin(),
|
|
55
|
-
...allPlugins,
|
|
56
|
-
...allKeyboardShortcuts.map((shortcuts) => keymap(shortcuts)),
|
|
57
|
-
...areTransactionInvariantsEnabled() ? [createTransactionInvariantPlugin()] : []
|
|
58
|
-
];
|
|
59
|
-
this.commands = allCommands;
|
|
39
|
+
const runtime = createExtensionRuntime(this.extensions, this.schema);
|
|
40
|
+
this.plugins = runtime.plugins;
|
|
41
|
+
this.commands = runtime.commandRegistry;
|
|
60
42
|
}
|
|
61
43
|
/**
|
|
62
44
|
* Get the built schema
|