platejs 54.0.0-beta.2 → 54.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/THIRD_PARTY_NOTICES.md +56 -0
- package/dist/{AIChatRequestContext-BMVWhfPV.d.ts → AIChatRequestContext-DrUahdTc.d.ts} +2 -2
- package/dist/{BaseSuggestionPlugin-DBl3fqnm.d.ts → BaseSuggestionPlugin-_7Ka6nY3.d.ts} +7 -3
- package/dist/{PlateStatic-DhNv2ejp.d.ts → PlateStatic-D3Cb-QwH.d.ts} +7 -7
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/react/AIChatPlugin.js +113 -78
- package/dist/ai/react/CopilotPlugin.js +1 -1
- package/dist/ai/react/index.d.ts +23 -16
- package/dist/authored/index.d.ts +4 -4
- package/dist/code-block/codemirror/createCodeMirrorAdapter.js +12 -9
- package/dist/code-block/codemirror/index.d.ts +1 -1
- package/dist/{combobox-DkBGgyd3.d.ts → combobox-Dr0OYZIE.d.ts} +2 -2
- package/dist/{comparison-types-CYnJ35qU.d.ts → comparison-types-DdwE6mYq-BogsHoUO.d.ts} +10 -2
- package/dist/compiler/index.d.ts +2 -2
- package/dist/{core-BJG8l_mk.d.ts → core-BqR-fEDp.d.ts} +493 -116
- package/dist/diff/index.d.ts +2 -2
- package/dist/docs/ai.md +4 -3
- package/dist/docs/api/core/plate-components.md +0 -19
- package/dist/docs/api/core/plate-controller.md +5 -3
- package/dist/docs/api/core/plate-plugin.md +3 -0
- package/dist/docs/api/core/plate-store.md +3 -3
- package/dist/docs/api/core.md +45 -5
- package/dist/docs/api/dom.md +11 -4
- package/dist/docs/api/editor-transforms.md +2 -1
- package/dist/docs/api/react-hooks.md +45 -13
- package/dist/docs/authored-changes.md +9 -4
- package/dist/docs/basic-blocks.md +42 -29
- package/dist/docs/block-placeholder.md +4 -2
- package/dist/docs/blockquote.md +5 -3
- package/dist/docs/board.md +118 -10
- package/dist/docs/code-block.md +47 -0
- package/dist/docs/comment.md +2 -2
- package/dist/docs/discussion.md +1 -1
- package/dist/docs/document-model.md +15 -3
- package/dist/docs/docx.md +1 -1
- package/dist/docs/dom-coverage.md +5 -0
- package/dist/docs/editor.md +50 -4
- package/dist/docs/examples/editable-voids.md +2 -3
- package/dist/docs/external-text.md +2 -0
- package/dist/docs/field.md +370 -0
- package/dist/docs/find.md +9 -6
- package/dist/docs/form.md +2 -0
- package/dist/docs/heading.md +6 -0
- package/dist/docs/installation/manual.md +0 -4
- package/dist/docs/link.md +3 -3
- package/dist/docs/llms.txt +4 -2
- package/dist/docs/markdown.md +270 -14
- package/dist/docs/plugin-components.md +13 -10
- package/dist/docs/plugin-input-rules.md +66 -15
- package/dist/docs/prompt-editor.md +205 -0
- package/dist/docs/roots.md +8 -6
- package/dist/docs/rtl.md +6 -4
- package/dist/docs/selection.md +7 -4
- package/dist/docs/suggestion.md +1 -1
- package/dist/docs/toolbar.md +26 -30
- package/dist/docs/upload.md +106 -17
- package/dist/docx/export/index.d.ts +3 -3
- package/dist/docx/export/lib/docxStaticComponents.js +12 -2
- package/dist/docx/export/lib/exportDocx.js +46 -17
- package/dist/docx/export/lib/internal/xml-builder.js +11 -16
- package/dist/docx/export/lib/reviewPart.js +1 -1
- package/dist/docx/export/lib/reviewProjection.js +52 -10
- package/dist/docx/import/index.d.ts +4 -4
- package/dist/docx/paste/index.d.ts +4 -4
- package/dist/dom/index.d.ts +1 -6
- package/dist/dom/plite-dom.internal.js +2 -2
- package/dist/excalidraw/index.d.ts +3 -2
- package/dist/excalidraw/react/index.d.ts +3 -2
- package/dist/facade.js +2 -2
- package/dist/features/basic-nodes/lib/BaseBlockPlugins.js +13 -5
- package/dist/features/basic-nodes/lib/BaseHeadingPlugins.js +32 -10
- package/dist/features/board/index.d.ts +2 -2
- package/dist/features/board/lib/BaseBoardPlugin.js +14 -1
- package/dist/features/board/lib/boardStroke.internal.js +13 -1
- package/dist/features/board/lib/boardTypes.internal.js +16 -0
- package/dist/features/callout/index.d.ts +3 -2
- package/dist/features/code-block/lib/BaseCodeBlockPlugin.js +14 -5
- package/dist/features/combobox/index.d.ts +2 -2
- package/dist/features/comments/BaseCommentsPlugin.js +33 -17
- package/dist/features/comments/index.d.ts +1 -1
- package/dist/features/date/index.d.ts +3 -2
- package/dist/features/details/index.d.ts +3 -2
- package/dist/features/details/lib/BaseDetailsPlugin.js +25 -12
- package/dist/features/field/index.d.ts +2 -0
- package/dist/features/field/index.js +4 -0
- package/dist/features/field/lib/BaseFieldPlugin.js +360 -0
- package/dist/features/field/lib/applyFieldValues.js +188 -0
- package/dist/features/field/lib/fieldRules.internal.js +204 -0
- package/dist/features/find/index.d.ts +3 -2
- package/dist/features/footnote/index.d.ts +1 -1
- package/dist/features/ink/index.d.ts +1 -1
- package/dist/features/ink/lib/BaseInkPlugin.js +126 -103
- package/dist/features/ink/lib/inkCodec.internal.js +130 -0
- package/dist/features/ink/lib/inkGone.internal.js +229 -48
- package/dist/features/ink/lib/inkPlaces.internal.js +534 -64
- package/dist/features/layout/index.d.ts +1 -1
- package/dist/features/link/lib/BaseLinkPlugin.js +6 -4
- package/dist/features/lint/index.d.ts +3 -2
- package/dist/features/media/index.d.ts +2 -2
- package/dist/features/media/index.js +2 -2
- package/dist/features/media/lib/media/parseMediaUrl.js +11 -1
- package/dist/features/media/lib/media-embed/BaseMediaEmbedPlugin.js +206 -4
- package/dist/features/mention/index.d.ts +5 -4
- package/dist/features/suggestion/index.d.ts +1 -1
- package/dist/features/table/index.d.ts +1 -1
- package/dist/features/table/lib/BaseTablePlugin.js +64 -15
- package/dist/features/table/lib/internal/selection.js +4 -2
- package/dist/features/toc/index.d.ts +1 -1
- package/dist/features/upload/index.d.ts +2 -2
- package/dist/features/upload/lib/BaseUploadPlugin.js +464 -250
- package/dist/history/index.d.ts +2 -2
- package/dist/html/index.d.ts +3 -3
- package/dist/html/server/index.d.ts +1 -1
- package/dist/{htmlTypes-DjeFG3P8.d.ts → htmlTypes-eT2ZGDAj.d.ts} +2 -31
- package/dist/hyperscript/index.d.ts +1 -1
- package/dist/{index-DzD6BIFJ.d.ts → index-B33E1CRJ.d.ts} +295 -6
- package/dist/{index-Cl77E9yr.d.ts → index-B7moSod7.d.ts} +2 -2
- package/dist/{index-hsC_sOn2.d.ts → index-B8-5Sr7I.d.ts} +35 -5
- package/dist/{index-BiQerPJS.d.ts → index-B8QJDAmG.d.ts} +2 -2
- package/dist/{index-BBKGrsG3.d.ts → index-BTx5oK7k.d.ts} +1 -1
- package/dist/{index-iaZOhA76.d.ts → index-BWPcE4ac-Cto_IsNs.d.ts} +7 -1
- package/dist/{index-BU6k1Aev.d.ts → index-BXjLmx1n-CXk17buG.d.ts} +4781 -4584
- package/dist/{index-kLKMc-pI.d.ts → index-BXwU9QH6.d.ts} +2 -2
- package/dist/{index-DTgaSxKr.d.ts → index-BkwR-5hH.d.ts} +40 -4
- package/dist/{index-Bq3sdm3S.d.ts → index-BsV2McRr.d.ts} +5 -4
- package/dist/index-C9Fu-P4E.d.ts +773 -0
- package/dist/{index-D5W-p9bS.d.ts → index-Ca48r1ng.d.ts} +49 -4
- package/dist/{index-CcZbqPqk.d.ts → index-Cob_iBdu.d.ts} +116 -41
- package/dist/{index-Bxfvicyy.d.ts → index-CpY7Xnxw.d.ts} +4 -3
- package/dist/{index-BkR7-GLI.d.ts → index-DNQXzU-X.d.ts} +2 -2
- package/dist/{index-D1CFXA-i.d.ts → index-DPowErHa.d.ts} +471 -141
- package/dist/{index-DaM37gF6.d.ts → index-DShbzec2.d.ts} +38 -23
- package/dist/{index-DC_MNGyu.d.ts → index-DYdObeFQ.d.ts} +3 -3
- package/dist/{index-Bc2Yg_2j.d.ts → index-Dq3Jlj8O-BJ6NxZm0.d.ts} +2 -2
- package/dist/{index-CT7miqQN.d.ts → index-DwWQVwQt.d.ts} +29 -11
- package/dist/{index-xdmCBvlT.d.ts → index-JWgwL5l3.d.ts} +5 -2
- package/dist/{index-DLA2DUR2.d.ts → index-M781pyx9.d.ts} +4 -3
- package/dist/{index-DdIRduDG.d.ts → index-d7io3MzC.d.ts} +3 -2
- package/dist/index.d.ts +4 -4
- package/dist/{react/internal → internal}/penStroke.internal.js +1 -1
- package/dist/internal/plugin/OverridePlugin.js +101 -119
- package/dist/internal/plugin/collectPlateNodeMappings.js +5 -1
- package/dist/internal/plugin/pastedUploadFiles.js +4 -0
- package/dist/internal/plugin/resolvePlugin.js +1 -1
- package/dist/internal/plugin/resolvePlugins.js +3 -0
- package/dist/internal/plugin/uploadDrafts.js +6 -0
- package/dist/internal/utils/mergePlugins.js +1 -0
- package/dist/lib/plugins/element-id/ElementIdPlugin.js +14 -18
- package/dist/lib/plugins/html/HtmlPlugin.js +9 -0
- package/dist/lib/plugins/html/htmlSafety.js +1 -1
- package/dist/lib/plugins/input-rules/InputRulesPlugin.js +77 -28
- package/dist/lib/plugins/input-rules/inputRuleVeto.internal.js +16 -0
- package/dist/markdown/index.d.ts +2 -2
- package/dist/markdown/index.js +3 -1
- package/dist/markdown/lib/MarkdownPlugin.js +14 -11
- package/dist/markdown/lib/RawHtmlPlugin.js +26 -0
- package/dist/markdown/lib/deserializer/mdastToSlate.js +12 -2
- package/dist/markdown/lib/internal/markdownConversion.js +776 -74
- package/dist/markdown/lib/internal/markdownDiagnostics.js +18 -7
- package/dist/markdown/lib/internal/markdownFootnoteWriter.js +35 -0
- package/dist/markdown/lib/internal/markdownFrontmatter.js +102 -0
- package/dist/markdown/lib/internal/markdownIntrinsics.js +125 -43
- package/dist/markdown/lib/internal/markdownLine.js +5 -3
- package/dist/markdown/lib/internal/markdownMappings.js +19 -7
- package/dist/markdown/lib/internal/markdownOpenTail.js +381 -0
- package/dist/markdown/lib/internal/markdownRawHtml.js +353 -0
- package/dist/markdown/lib/internal/markdownSegments.js +57 -48
- package/dist/markdown/lib/internal/markdownTags.js +29 -9
- package/dist/markdown/lib/serializer/convertNodesSerialize.js +10 -8
- package/dist/markdown/lib/serializer/convertPhrasingSerialize.js +226 -0
- package/dist/markdown/lib/serializer/listToMdastTree.js +2 -0
- package/dist/math/index.d.ts +3 -2
- package/dist/math/react/index.d.ts +4 -3
- package/dist/migrations/index.d.ts +3 -3
- package/dist/migrations/migratePlateV54.js +4 -6
- package/dist/migrations/migratePlateV54RetiredMarks.internal.js +23 -8
- package/dist/migrations/migratePlateV54Suggestions.internal.js +2 -2
- package/dist/migrations/v53-manifest.internal.js +4 -0
- package/dist/pagination/index.d.ts +1 -1
- package/dist/pagination/react/index.d.ts +4 -4
- package/dist/react/components/EditorContentView.internal.js +42 -23
- package/dist/react/components/EditorProvider.js +5 -5
- package/dist/react/components/Plate.js +102 -128
- package/dist/react/components/PlateContainer.js +40 -32
- package/dist/react/components/PlateController.js +28 -16
- package/dist/react/components/PlateRoot.internal.js +3 -2
- package/dist/react/core.js +4 -4
- package/dist/react/features/board/BoardSurface.js +116 -87
- package/dist/react/features/board/boardClipboard.internal.js +15 -5
- package/dist/react/features/board/boardExport.internal.js +470 -0
- package/dist/react/features/board/boardGesture.internal.js +6 -3
- package/dist/react/features/board/boardIndex.internal.js +7 -18
- package/dist/react/features/board/boardPictureStyles.internal.js +415 -0
- package/dist/react/features/board/boardPictures.internal.js +19 -13
- package/dist/react/features/board/boardView.internal.js +190 -50
- package/dist/react/features/board/boardVoice.internal.js +10 -11
- package/dist/react/features/board/index.d.ts +108 -18
- package/dist/react/features/callout/index.d.ts +3 -2
- package/dist/react/features/combobox/index.d.ts +8 -8
- package/dist/react/features/comments/index.d.ts +6 -5
- package/dist/react/features/date/index.d.ts +4 -3
- package/dist/react/features/details/index.d.ts +4 -3
- package/dist/react/features/field/FieldPlugin.js +35 -0
- package/dist/react/features/field/index.d.ts +315 -0
- package/dist/react/features/field/index.js +2 -0
- package/dist/react/features/footnote/index.d.ts +7 -6
- package/dist/react/features/format-painter/index.d.ts +4 -3
- package/dist/react/features/ink/InkContent.js +313 -0
- package/dist/react/features/ink/index.d.ts +57 -33
- package/dist/react/features/ink/index.js +2 -2
- package/dist/react/features/ink/inkCapture.internal.js +39 -17
- package/dist/react/features/ink/inkInput.internal.js +1 -1
- package/dist/react/features/ink/inkLayout.internal.js +6 -3
- package/dist/react/features/ink/inkPaint.internal.js +78 -2
- package/dist/react/features/ink/inkPlacement.internal.js +332 -104
- package/dist/react/features/ink/inkWatch.internal.js +7 -5
- package/dist/react/features/layout/index.d.ts +5 -4
- package/dist/react/features/media/index.d.ts +5 -4
- package/dist/react/features/mention/index.d.ts +6 -5
- package/dist/react/features/resizable/Resizable.js +4 -6
- package/dist/react/features/resizable/index.d.ts +5 -5
- package/dist/react/features/suggestion/index.d.ts +6 -5
- package/dist/react/features/table/TablePlugin.js +4 -11
- package/dist/react/features/table/index.d.ts +10 -8
- package/dist/react/features/table/useTableResize.js +10 -1
- package/dist/react/features/toc/index.d.ts +2 -2
- package/dist/react/features/upload/index.d.ts +11 -6
- package/dist/react/index.d.ts +6 -6
- package/dist/react/index.js +4 -4
- package/dist/react/internal/plate-context.js +434 -188
- package/dist/react/plite-react.js +2 -2
- package/dist/react/plugins/navigation-feedback/NavigationFeedbackPlugin.js +12 -10
- package/dist/react/stores/plate/useEditor.js +32 -14
- package/dist/react/stores/plate/useEditorHistory.js +55 -0
- package/dist/react/stores/plate/useEditorSelector.js +79 -21
- package/dist/react/utils/BlockPlaceholderPlugin.js +5 -2
- package/dist/react/utils/pipeRenderElement.internal.js +1 -1
- package/dist/react/utils/pluginRenderElement.internal.js +1 -1
- package/dist/react/virtualized.d.ts +4 -4
- package/dist/{source-CNKy99Th.d.ts → source-BGohy8vH.d.ts} +4 -4
- package/dist/static/index.d.ts +18 -18
- package/dist/static/internal/renderStaticHtmlWithOverrides.js +2 -2
- package/dist/static/internal/staticPresentation.js +4 -4
- package/dist/static/internal/writeStaticSelectionClipboardData.js +7 -2
- package/dist/tabbable/index.d.ts +1 -1
- package/dist/tabbable/react/index.d.ts +3 -3
- package/dist/testing/index.d.ts +3 -3
- package/dist/yjs/index.d.ts +1 -1
- package/dist/yjs/react/index.d.ts +6 -6
- package/package.json +20 -2
- package/dist/markdown/lib/serializer/convertTextsSerialize.js +0 -163
- package/dist/react/components/EditorSelectionView.js +0 -40
- package/dist/react/features/ink/InkLayer.js +0 -218
- package/dist/react/internal/createPlateTargetScope.js +0 -62
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { getPlateNodeMappingContributions } from "../../../internal/plugin/collectPlateNodeMappings.js";
|
|
1
2
|
import { BaseParagraphPlugin } from "../../../lib/plugins/paragraph/BaseParagraphPlugin.js";
|
|
2
3
|
import { projectPlateFormatDocument } from "../../../lib/editor/withPlite.js";
|
|
3
4
|
import { DocumentChange, ElementApi } from "../../../core.js";
|
|
4
5
|
import { BaseBlockquotePlugin } from "../../../features/basic-nodes/lib/BaseBlockPlugins.js";
|
|
5
6
|
import { renderStaticHtmlWithOverrides } from "../../../static/internal/renderStaticHtmlWithOverrides.js";
|
|
6
|
-
import { AuthoredPlugin } from "../../../authored/AuthoredPlugin.js";
|
|
7
7
|
import { projectAuthoredRange } from "../../../authored/index.js";
|
|
8
8
|
import { throwIfDocxAborted } from "../../internal/abort.js";
|
|
9
9
|
import { acquireDocxSource, docxSourceSchemaMatches } from "../../internal/source.js";
|
|
@@ -42,7 +42,7 @@ const mapCommentRanges = (comments, project) => Object.freeze(comments.map((comm
|
|
|
42
42
|
const captureExport = (editor, options, comments) => {
|
|
43
43
|
const snapshot = captureExportSnapshot(editor, options.projection);
|
|
44
44
|
if (options.projection === "review") {
|
|
45
|
-
const review = createReviewProjection(snapshot.stored
|
|
45
|
+
const review = createReviewProjection(editor, snapshot.stored);
|
|
46
46
|
return Object.freeze({
|
|
47
47
|
comments,
|
|
48
48
|
diagnostics: Object.freeze([]),
|
|
@@ -86,6 +86,27 @@ const nativeOnlyDiagnostics = (document) => {
|
|
|
86
86
|
});
|
|
87
87
|
return diagnostics;
|
|
88
88
|
};
|
|
89
|
+
const docxTextFormatsOf = (editor) => getPlateNodeMappingContributions(editor, "docx").map(({ declaration, owner, targetPlugin, targetType }) => {
|
|
90
|
+
if (typeof declaration.dropped !== "string" || typeof declaration.text !== "function" || targetType === null) throw new Error(`DOCX node mapping "${owner}" must define dropped and text for an element.`);
|
|
91
|
+
return {
|
|
92
|
+
dropped: declaration.dropped,
|
|
93
|
+
plugin: targetPlugin,
|
|
94
|
+
text: declaration.text,
|
|
95
|
+
type: targetType
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
const countElements = (nodes, type) => nodes.reduce((count, node) => ElementApi.isElement(node) ? count + (node.type === type ? 1 : 0) + countElements(node.children, type) : count, 0);
|
|
99
|
+
const textFormatDiagnostics = (textFormats, document) => textFormats.flatMap(({ dropped, plugin, type }) => {
|
|
100
|
+
const count = countElements(document.children, type);
|
|
101
|
+
return count > 0 ? [{
|
|
102
|
+
code: "property-dropped",
|
|
103
|
+
count,
|
|
104
|
+
feature: plugin,
|
|
105
|
+
impact: "lossy",
|
|
106
|
+
message: dropped,
|
|
107
|
+
severity: "warning"
|
|
108
|
+
}] : [];
|
|
109
|
+
});
|
|
89
110
|
const isNumberedOrTask = (node) => node.listType === "numbered" || node.listType === "task";
|
|
90
111
|
const canShareListWithOtherKind = (node) => node.listType !== "bulleted" || typeof node.listId === "string";
|
|
91
112
|
const listDiagnostics = (document) => {
|
|
@@ -178,7 +199,7 @@ const quoteDiagnostics = (editor, children, commentId) => {
|
|
|
178
199
|
visit(children, []);
|
|
179
200
|
return diagnostics;
|
|
180
201
|
};
|
|
181
|
-
const renderDocxHtml = async (editor, document, story, { component, fontFamily, presentation, signal }) => {
|
|
202
|
+
const renderDocxHtml = async (editor, document, story, textFormats, { component, fontFamily, presentation, signal }) => {
|
|
182
203
|
const rendered = await renderStaticHtmlWithOverrides(editor, {
|
|
183
204
|
component,
|
|
184
205
|
document,
|
|
@@ -187,7 +208,7 @@ const renderDocxHtml = async (editor, document, story, { component, fontFamily,
|
|
|
187
208
|
padding: "0",
|
|
188
209
|
...fontFamily ? { fontFamily } : {}
|
|
189
210
|
} }
|
|
190
|
-
}, docxStaticOverrides(story));
|
|
211
|
+
}, docxStaticOverrides(story, textFormats));
|
|
191
212
|
throwIfDocxAborted(signal);
|
|
192
213
|
return rendered;
|
|
193
214
|
};
|
|
@@ -243,6 +264,17 @@ const resolveSourceExport = (editor, capture, options, comments) => {
|
|
|
243
264
|
});
|
|
244
265
|
};
|
|
245
266
|
const isContentLoss = (diagnostic) => diagnostic.code === "missing-static-presentation" || diagnostic.code === "resource-omitted" || diagnostic.code === "unsupported-content" && diagnostic.action === "dropped" || diagnostic.code === "lossy-content" && diagnostic.feature !== "document-metadata" && diagnostic.feature !== "list-marker" && diagnostic.feature !== "list-start" && diagnostic.feature !== "named-root" && diagnostic.feature !== "quote-structure";
|
|
267
|
+
const rejectedLoss = (diagnostics, options) => {
|
|
268
|
+
if ((options.lossPolicy ?? "reject") !== "reject") return null;
|
|
269
|
+
const policyDiagnostics = diagnostics.map((diagnostic) => diagnostic.severity === "warning" && isContentLoss(diagnostic) ? Object.freeze({
|
|
270
|
+
...diagnostic,
|
|
271
|
+
severity: "error"
|
|
272
|
+
}) : diagnostic);
|
|
273
|
+
return policyDiagnostics.some(({ severity }) => severity === "error") ? Object.freeze({
|
|
274
|
+
diagnostics: Object.freeze(policyDiagnostics),
|
|
275
|
+
ok: false
|
|
276
|
+
}) : null;
|
|
277
|
+
};
|
|
246
278
|
const generateDocx = async (html, options) => {
|
|
247
279
|
try {
|
|
248
280
|
const blob = await exportHtmlToDocx(html, options);
|
|
@@ -270,15 +302,20 @@ async function exportDocx(editor, options) {
|
|
|
270
302
|
const nativeOnly = nativeOnlyDiagnostics(snapshot.stored);
|
|
271
303
|
if (sourceResolution.kind === "exact") {
|
|
272
304
|
throwIfDocxAborted(options.signal);
|
|
305
|
+
const exactDiagnostics = [...nativeOnly, ...capture.review?.diagnostics ?? []];
|
|
306
|
+
const rejected = rejectedLoss(exactDiagnostics, options);
|
|
307
|
+
if (rejected) return rejected;
|
|
273
308
|
return Object.freeze({
|
|
274
309
|
blob: sourceResolution.lease.blob,
|
|
275
|
-
diagnostics: Object.freeze(
|
|
310
|
+
diagnostics: Object.freeze(exactDiagnostics),
|
|
276
311
|
ok: true
|
|
277
312
|
});
|
|
278
313
|
}
|
|
314
|
+
const textFormats = docxTextFormatsOf(editor);
|
|
279
315
|
const diagnostics = [
|
|
280
316
|
...sourceResolution.diagnostics,
|
|
281
317
|
...nativeOnly,
|
|
318
|
+
...textFormatDiagnostics(textFormats, capture.document),
|
|
282
319
|
...listDiagnostics(capture.document),
|
|
283
320
|
...quoteDiagnostics(editor, capture.document.children),
|
|
284
321
|
...capture.comments.flatMap(({ body, id, target }) => target ? quoteDiagnostics(editor, body, id) : []),
|
|
@@ -286,9 +323,9 @@ async function exportDocx(editor, options) {
|
|
|
286
323
|
...capture.diagnostics
|
|
287
324
|
];
|
|
288
325
|
try {
|
|
289
|
-
const [main, commentRenders] = await Promise.all([renderDocxHtml(editor, capture.document, "body", options), Promise.all(capture.comments.map(async ({ body, id }) => ({
|
|
326
|
+
const [main, commentRenders] = await Promise.all([renderDocxHtml(editor, capture.document, "body", textFormats, options), Promise.all(capture.comments.map(async ({ body, id }) => ({
|
|
290
327
|
id,
|
|
291
|
-
...await renderDocxHtml(editor, { children: body }, `comment:${id}`, options)
|
|
328
|
+
...await renderDocxHtml(editor, { children: body }, `comment:${id}`, textFormats, options)
|
|
292
329
|
})))]);
|
|
293
330
|
throwIfDocxAborted(options.signal);
|
|
294
331
|
const anchored = anchorDocxComments(main.data, capture.comments);
|
|
@@ -322,16 +359,8 @@ async function exportDocx(editor, options) {
|
|
|
322
359
|
diagnostics: Object.freeze([...diagnostics, outputFailure]),
|
|
323
360
|
ok: false
|
|
324
361
|
});
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
...diagnostic,
|
|
328
|
-
severity: "error"
|
|
329
|
-
}) : diagnostic);
|
|
330
|
-
if (policyDiagnostics.some(({ severity }) => severity === "error")) return Object.freeze({
|
|
331
|
-
diagnostics: Object.freeze(policyDiagnostics),
|
|
332
|
-
ok: false
|
|
333
|
-
});
|
|
334
|
-
}
|
|
362
|
+
const rejected = rejectedLoss(diagnostics, options);
|
|
363
|
+
if (rejected) return rejected;
|
|
335
364
|
return Object.freeze({
|
|
336
365
|
blob,
|
|
337
366
|
diagnostics: Object.freeze(diagnostics),
|
|
@@ -1611,18 +1611,19 @@ const buildTable = async (vNode, attributes, docxDocumentInstance, renderBlocks)
|
|
|
1611
1611
|
const tablePropertiesFragment = buildTableProperties(modifiedAttributes);
|
|
1612
1612
|
tableFragment.import(tablePropertiesFragment);
|
|
1613
1613
|
const rowSpanMap = /* @__PURE__ */ new Map();
|
|
1614
|
+
let hasGrid = false;
|
|
1615
|
+
const importGrid = (tableGridFragment) => {
|
|
1616
|
+
if (hasGrid) return;
|
|
1617
|
+
hasGrid = true;
|
|
1618
|
+
tableFragment.import(tableGridFragment);
|
|
1619
|
+
};
|
|
1614
1620
|
if (vNodeHasChildren(vNode)) for (let index = 0; index < (vNode.children || []).length; index++) {
|
|
1615
1621
|
const childVNode = (vNode.children || [])[index];
|
|
1616
|
-
if (childVNode.tagName === "colgroup")
|
|
1617
|
-
|
|
1618
|
-
tableFragment.import(tableGridFragment);
|
|
1619
|
-
} else if (childVNode.tagName === "thead") for (let iteratorIndex = 0; iteratorIndex < (childVNode.children || []).length; iteratorIndex++) {
|
|
1622
|
+
if (childVNode.tagName === "colgroup") importGrid(buildTableGrid(childVNode, modifiedAttributes));
|
|
1623
|
+
else if (childVNode.tagName === "thead") for (let iteratorIndex = 0; iteratorIndex < (childVNode.children || []).length; iteratorIndex++) {
|
|
1620
1624
|
const grandChildVNode = (childVNode.children || [])[iteratorIndex];
|
|
1621
1625
|
if (grandChildVNode.tagName === "tr") {
|
|
1622
|
-
if (iteratorIndex === 0)
|
|
1623
|
-
const tableGridFragment = buildTableGridFromTableRow(grandChildVNode, modifiedAttributes);
|
|
1624
|
-
tableFragment.import(tableGridFragment);
|
|
1625
|
-
}
|
|
1626
|
+
if (iteratorIndex === 0) importGrid(buildTableGridFromTableRow(grandChildVNode, modifiedAttributes));
|
|
1626
1627
|
const tableRowFragment = await buildTableRow(grandChildVNode, modifiedAttributes, rowSpanMap, docxDocumentInstance, renderBlocks);
|
|
1627
1628
|
tableFragment.import(tableRowFragment);
|
|
1628
1629
|
}
|
|
@@ -1630,19 +1631,13 @@ const buildTable = async (vNode, attributes, docxDocumentInstance, renderBlocks)
|
|
|
1630
1631
|
else if (childVNode.tagName === "tbody") for (let iteratorIndex = 0; iteratorIndex < (childVNode.children || []).length; iteratorIndex++) {
|
|
1631
1632
|
const grandChildVNode = (childVNode.children || [])[iteratorIndex];
|
|
1632
1633
|
if (grandChildVNode.tagName === "tr") {
|
|
1633
|
-
if (iteratorIndex === 0)
|
|
1634
|
-
const tableGridFragment = buildTableGridFromTableRow(grandChildVNode, modifiedAttributes);
|
|
1635
|
-
tableFragment.import(tableGridFragment);
|
|
1636
|
-
}
|
|
1634
|
+
if (iteratorIndex === 0) importGrid(buildTableGridFromTableRow(grandChildVNode, modifiedAttributes));
|
|
1637
1635
|
const tableRowFragment = await buildTableRow(grandChildVNode, modifiedAttributes, rowSpanMap, docxDocumentInstance, renderBlocks);
|
|
1638
1636
|
tableFragment.import(tableRowFragment);
|
|
1639
1637
|
}
|
|
1640
1638
|
}
|
|
1641
1639
|
else if (childVNode.tagName === "tr") {
|
|
1642
|
-
if (index === 0)
|
|
1643
|
-
const tableGridFragment = buildTableGridFromTableRow(childVNode, modifiedAttributes);
|
|
1644
|
-
tableFragment.import(tableGridFragment);
|
|
1645
|
-
}
|
|
1640
|
+
if (index === 0) importGrid(buildTableGridFromTableRow(childVNode, modifiedAttributes));
|
|
1646
1641
|
const tableRowFragment = await buildTableRow(childVNode, modifiedAttributes, rowSpanMap, docxDocumentInstance, renderBlocks);
|
|
1647
1642
|
tableFragment.import(tableRowFragment);
|
|
1648
1643
|
}
|
|
@@ -133,7 +133,7 @@ const writeRun = (marker, review) => {
|
|
|
133
133
|
}
|
|
134
134
|
outer = wrap(outer, revisionElement(document, "del", review.deletion));
|
|
135
135
|
}
|
|
136
|
-
for (const insertion of review.
|
|
136
|
+
for (const insertion of review.insertionsOuterFirst.toReversed()) outer = wrap(outer, revisionElement(document, "ins", insertion));
|
|
137
137
|
};
|
|
138
138
|
const bookmarkElements = (document, id, name) => {
|
|
139
139
|
const start = wordElement(document, "bookmarkStart");
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ElementApi } from "../../../core.js";
|
|
2
|
+
import { AuthoredPlugin } from "../../../authored/AuthoredPlugin.js";
|
|
3
|
+
import { BaseTablePlugin } from "../../../features/table/lib/BaseTablePlugin.js";
|
|
2
4
|
import { parseDocxHtml } from "../../internal/domParser.js";
|
|
3
5
|
//#region src/docx/export/lib/reviewProjection.tsx
|
|
4
6
|
/** Prefix of the tokens that mark where a bound block starts and ends. */
|
|
@@ -9,7 +11,34 @@ const holdsMarks = (node) => "authored" in node || ElementApi.isElement(node) &&
|
|
|
9
11
|
* Read the review marks of a stored document as Word revisions. Paths are the
|
|
10
12
|
* stored document's, so ranges into it need no mapping.
|
|
11
13
|
*/
|
|
12
|
-
const createReviewProjection = (
|
|
14
|
+
const createReviewProjection = (editor, stored) => {
|
|
15
|
+
const reviewOf = (node) => editor.plugin(AuthoredPlugin).read.reviewOf(node);
|
|
16
|
+
const tablePlugin = editor.plugin(BaseTablePlugin);
|
|
17
|
+
const { schema } = editor.read;
|
|
18
|
+
const isInlineVoid = (node) => schema.isVoid(node) && schema.isInline(node);
|
|
19
|
+
const gridRoleOf = (node) => {
|
|
20
|
+
const structure = schema.element(node.type)?.structure;
|
|
21
|
+
return structure?.kind === "grid" ? structure.role : null;
|
|
22
|
+
};
|
|
23
|
+
const marksOf = (node) => "authored" in node && node.authored ? reviewOf(node).marks : [];
|
|
24
|
+
const isPlacement = ({ kind }) => kind === "insert" || kind === "delete";
|
|
25
|
+
const placementOf = ({ at, change, inc, kind }) => JSON.stringify([
|
|
26
|
+
kind,
|
|
27
|
+
change,
|
|
28
|
+
inc ?? at
|
|
29
|
+
]);
|
|
30
|
+
const partsOf = (node) => node.children.flatMap((child) => {
|
|
31
|
+
if (!ElementApi.isElement(child)) return [];
|
|
32
|
+
const role = gridRoleOf(child);
|
|
33
|
+
if (role === "cell") return [child];
|
|
34
|
+
if (role === "row") return [child, ...partsOf(child)];
|
|
35
|
+
return role === null ? partsOf(child) : [];
|
|
36
|
+
});
|
|
37
|
+
const holdsGridChange = (table) => {
|
|
38
|
+
const wholeTableChanges = new Set(marksOf(table).filter(isPlacement).map(placementOf));
|
|
39
|
+
return [table, ...partsOf(table)].some((element) => marksOf(element).some((mark) => isPlacement(mark) ? !wholeTableChanges.has(placementOf(mark)) : mark.kind === "format"));
|
|
40
|
+
};
|
|
41
|
+
const diagnostics = [];
|
|
13
42
|
const revisionIds = /* @__PURE__ */ new Map();
|
|
14
43
|
const runs = /* @__PURE__ */ new Map();
|
|
15
44
|
const structures = /* @__PURE__ */ new Map();
|
|
@@ -31,34 +60,46 @@ const createReviewProjection = (stored, reviewOf) => {
|
|
|
31
60
|
const { authored, ...plain } = node;
|
|
32
61
|
const review = authored ? reviewOf(node) : null;
|
|
33
62
|
const marks = review?.marks ?? [];
|
|
34
|
-
|
|
63
|
+
const isText = !ElementApi.isElement(node);
|
|
64
|
+
if (isText || isInlineVoid(node)) {
|
|
35
65
|
const insertions = marks.filter(({ kind }) => kind === "insert");
|
|
36
66
|
const deletion = marks.find(({ kind }) => kind === "delete");
|
|
37
|
-
const format = marks.find(({ kind }) => kind === "format");
|
|
38
|
-
if (insertions.length > 0 || deletion || format) runs.set(renderKey("text", root, key), {
|
|
67
|
+
const format = isText ? marks.find(({ kind }) => kind === "format") : void 0;
|
|
68
|
+
if (insertions.length > 0 || deletion || format) runs.set(renderKey(isText ? "text" : "element", root, key), {
|
|
39
69
|
deletion: deletion ? revisionOf(deletion) : null,
|
|
40
70
|
format: format && review ? {
|
|
41
71
|
...revisionOf(format),
|
|
42
72
|
previous: review.accepted
|
|
43
73
|
} : null,
|
|
44
|
-
|
|
74
|
+
insertionsOuterFirst: insertions.map(revisionOf)
|
|
45
75
|
});
|
|
46
|
-
return plain;
|
|
47
76
|
}
|
|
77
|
+
if (!ElementApi.isElement(node)) return plain;
|
|
78
|
+
if (root === "main" && gridRoleOf(node) === "grid" && holdsGridChange(node)) diagnostics.push({
|
|
79
|
+
code: "lossy-content",
|
|
80
|
+
feature: "authored-review",
|
|
81
|
+
message: `The table at ${path.join(".")} holds a pending row, column or table format change that Word's revisions cannot carry, so deciding it in Word gives a different table.`,
|
|
82
|
+
path,
|
|
83
|
+
root,
|
|
84
|
+
severity: "warning"
|
|
85
|
+
});
|
|
48
86
|
const structure = marks.find((mark) => mark.kind !== "insert" && mark.kind !== "delete" && mark.kind !== "joined");
|
|
49
87
|
if (structure) structures.set(renderKey("element", root, key), revisionOf(structure));
|
|
88
|
+
const shownWidths = tablePlugin.installed && node.type === tablePlugin.schema.type && marks.some((mark) => mark.kind === "format" && mark.key === "columnWidths") ? { columnWidths: tablePlugin.api.columnWidths(node) } : {};
|
|
50
89
|
return {
|
|
51
90
|
...plain,
|
|
91
|
+
...shownWidths,
|
|
52
92
|
children: build(node.children, root, path)
|
|
53
93
|
};
|
|
54
94
|
});
|
|
55
95
|
const rootValue = (nodes) => nodes.filter((node) => ElementApi.isElement(node));
|
|
56
96
|
const roots = Object.fromEntries(Object.entries(stored.roots ?? {}).map(([root, nodes]) => [root, rootValue(build(nodes, root, []))]));
|
|
97
|
+
const children = rootValue(build(stored.children, "main", []));
|
|
57
98
|
return Object.freeze({
|
|
58
99
|
bound: stored.children.flatMap((node, index) => holdsMarks(node) ? [index] : []),
|
|
59
|
-
diagnostics: Object.freeze(
|
|
100
|
+
diagnostics: Object.freeze(diagnostics),
|
|
60
101
|
document: Object.freeze({
|
|
61
|
-
children
|
|
102
|
+
children,
|
|
62
103
|
...Object.keys(roots).length > 0 ? { roots } : {}
|
|
63
104
|
}),
|
|
64
105
|
runs,
|
|
@@ -72,6 +113,7 @@ const setStructureAttributes = (element, revision) => {
|
|
|
72
113
|
element.setAttribute("data-editor-author-id", revision.author);
|
|
73
114
|
if (revision.at > 0) element.setAttribute("data-editor-created-at", new Date(revision.at).toISOString());
|
|
74
115
|
};
|
|
116
|
+
const MISSING_ELEMENT_HOST = "A configured static element renderer omitted its Plate path attributes.";
|
|
75
117
|
const missingHost = (feature, key, message) => {
|
|
76
118
|
const [, root, path] = key.split(":");
|
|
77
119
|
return {
|
|
@@ -106,7 +148,7 @@ const applyReviewProjection = (html, projection) => {
|
|
|
106
148
|
for (const [key, run] of projection.runs) {
|
|
107
149
|
const host = hosts.get(key);
|
|
108
150
|
if (!host) {
|
|
109
|
-
diagnostics.push(missingHost("review-text-wrapper", key, "A configured static text renderer omitted its Plate path attributes."));
|
|
151
|
+
diagnostics.push(key.startsWith("text:") ? missingHost("review-text-wrapper", key, "A configured static text renderer omitted its Plate path attributes.") : missingHost("review-structure-wrapper", key, MISSING_ELEMENT_HOST));
|
|
110
152
|
continue;
|
|
111
153
|
}
|
|
112
154
|
const wrapper = document.createElement("span");
|
|
@@ -118,7 +160,7 @@ const applyReviewProjection = (html, projection) => {
|
|
|
118
160
|
for (const [key, structure] of projection.structures) {
|
|
119
161
|
const host = hosts.get(key);
|
|
120
162
|
if (!host) {
|
|
121
|
-
diagnostics.push(missingHost("review-structure-wrapper", key,
|
|
163
|
+
diagnostics.push(missingHost("review-structure-wrapper", key, MISSING_ELEMENT_HOST));
|
|
122
164
|
continue;
|
|
123
165
|
}
|
|
124
166
|
setStructureAttributes(host, structure);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { h as EditorApplicationSchema } from "../../htmlTypes-
|
|
3
|
-
import "../../core-
|
|
4
|
-
import { a as DocxImportLimits, i as DocxErrorDiagnostic, n as DocxComment, o as DocxSourceLocation, r as DocxDiagnostic, s as DocxWarningDiagnostic, t as DocxSource } from "../../source-
|
|
1
|
+
import { Fo as PluginReference, Tt as EditorDocumentValue, su as Value } from "../../index-BXjLmx1n-CXk17buG.js";
|
|
2
|
+
import { h as EditorApplicationSchema } from "../../htmlTypes-eT2ZGDAj.js";
|
|
3
|
+
import "../../core-BqR-fEDp.js";
|
|
4
|
+
import { a as DocxImportLimits, i as DocxErrorDiagnostic, n as DocxComment, o as DocxSourceLocation, r as DocxDiagnostic, s as DocxWarningDiagnostic, t as DocxSource } from "../../source-BGohy8vH.js";
|
|
5
5
|
type DocxImportOptions<TRetainSource extends boolean = false> = Readonly<{
|
|
6
6
|
limits?: Partial<DocxImportLimits>;
|
|
7
7
|
lossPolicy?: 'allow' | 'reject';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as HtmlEditorSerializeOptions, d as HtmlSerializeResult, f as HtmlSliceParseResult, i as HtmlEditorParseOptions, r as HtmlDocumentParseResult } from "../../htmlTypes-
|
|
3
|
-
import {
|
|
4
|
-
import "../../index-
|
|
1
|
+
import { su as Value } from "../../index-BXjLmx1n-CXk17buG.js";
|
|
2
|
+
import { a as HtmlEditorSerializeOptions, d as HtmlSerializeResult, f as HtmlSliceParseResult, i as HtmlEditorParseOptions, r as HtmlDocumentParseResult } from "../../htmlTypes-eT2ZGDAj.js";
|
|
3
|
+
import { Co as PluginReference, _ as BasePlugin, xo as PluginDependency } from "../../core-BqR-fEDp.js";
|
|
4
|
+
import "../../index-DYdObeFQ.js";
|
|
5
5
|
/** Normalizes Word clipboard payloads before the installed HTML parser runs. */
|
|
6
6
|
declare const WordPastePlugin: BasePlugin<Readonly<{
|
|
7
7
|
readonly dependencies: readonly [PluginReference<"html"> & PluginDependency<Readonly<{
|
package/dist/dom/index.d.ts
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/**
|
|
3
|
-
* Returns whether an event, node, window, or document belongs to an Apple
|
|
4
|
-
* platform, where `mod` is Command.
|
|
5
|
-
*/
|
|
6
|
-
declare const usesAppleDOMHotkeys: (event: unknown) => boolean;
|
|
1
|
+
import { A as DataTransferSnapshot, B as domCommands, C as DOMVisualPointOptions, D as DataTransferFormat, E as DataTransferEncodeContext, F as KeyboardEventLike, H as usesAppleDOMHotkeys, I as ScrollIntoViewOptions, L as ScrollIntoViewTarget, M as HotkeyMatchOptions, N as HotkeyPlatform, O as DataTransferFormatPhase, P as HotkeySpec, R as ariaKeyShortcuts, S as DOMVisualPoint, T as DataTransferDiagnostic, U as writeDataTransferFragment, V as isHotkey, _ as DOMRange, b as DOMStaticRange, f as DOMElement, g as DOMPoint, i as DOMClipboardApi, k as DataTransferSchemaClaim, n as ClipboardSliceWrite, p as DOMNode, r as DOMApi, t as ClipboardSliceRead, v as DOMResolutionError, w as DataTransferDecodeContext, x as DOMText, y as DOMSelection, z as dataTransferFormats } from "../index-DShbzec2.js";
|
|
7
2
|
export { type ClipboardSliceRead, type ClipboardSliceWrite, type DOMApi, type DOMClipboardApi, type DOMElement, type DOMNode, type DOMPoint, type DOMRange, DOMResolutionError, type DOMSelection, type DOMStaticRange, type DOMText, type DOMVisualPoint, type DOMVisualPointOptions, type DataTransferDecodeContext, type DataTransferDiagnostic, type DataTransferEncodeContext, type DataTransferFormat, type DataTransferFormatPhase, type DataTransferSchemaClaim, type DataTransferSnapshot, type HotkeyMatchOptions, type HotkeyPlatform, type HotkeySpec, type KeyboardEventLike, type ScrollIntoViewOptions, type ScrollIntoViewTarget, ariaKeyShortcuts, dataTransferFormats, domCommands, isHotkey, usesAppleDOMHotkeys, writeDataTransferFragment };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { createCompiledHotkeyMatcher, dataTransferFormats, dom, domCommands, getEditorDOMRoot, getSelection, isGeckoDOMHost, isHotkey, readDOMSelectionRange, usesAppleDOMHotkeys, writeDOMSelection } from "plitejs/dom";
|
|
2
|
-
export { createCompiledHotkeyMatcher, dataTransferFormats, dom, domCommands, getEditorDOMRoot, getSelection, isGeckoDOMHost, isHotkey, readDOMSelectionRange, usesAppleDOMHotkeys, writeDOMSelection };
|
|
1
|
+
import { cleanDOMClipboardContents, createCompiledHotkeyMatcher, dataTransferFormats, dom, domCommands, getEditorDOMRoot, getSelection, isGeckoDOMHost, isHotkey, readDOMSelectionRange, usesAppleDOMHotkeys, writeDOMSelection } from "plitejs/dom";
|
|
2
|
+
export { cleanDOMClipboardContents, createCompiledHotkeyMatcher, dataTransferFormats, dom, domCommands, getEditorDOMRoot, getSelection, isGeckoDOMHost, isHotkey, readDOMSelectionRange, usesAppleDOMHotkeys, writeDOMSelection };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { Ht as EditorJsonValue, ji as ElementOf, ts as PropertyJsonDescriptor } from "../index-BXjLmx1n-CXk17buG.js";
|
|
2
|
+
import "../htmlTypes-eT2ZGDAj.js";
|
|
3
|
+
import { _ as BasePlugin } from "../core-BqR-fEDp.js";
|
|
3
4
|
type ExcalidrawElementData = {
|
|
4
5
|
elements: readonly EditorJsonValue[];
|
|
5
6
|
files?: Readonly<Record<string, EditorJsonValue>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { Ht as EditorJsonValue, ts as PropertyJsonDescriptor } from "../../index-BXjLmx1n-CXk17buG.js";
|
|
2
|
+
import "../../htmlTypes-eT2ZGDAj.js";
|
|
3
|
+
import { At as Plugin } from "../../index-DPowErHa.js";
|
|
3
4
|
import { ExcalidrawImperativeAPI } from "@excalidraw/excalidraw/types";
|
|
4
5
|
declare const ExcalidrawPlugin: Plugin<Readonly<{}> & Readonly<{
|
|
5
6
|
name: "excalidraw";
|
package/dist/facade.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ContentSlice, DocumentChange, EditorSchemaValidationError, ElementApi, NodeApi, PathApi, PointApi, RangeApi, SelectionApi, TextApi, createEditor, defineEditorSchema, definePlugin as defineRuntimePlugin, definePluginPoint, editorCommands, editorReads, getEditorRuntimeOwner, locateAt, property, readEditorSelection, schema, target, transfer, txLocate, txSelection } from "plitejs";
|
|
2
|
-
import { EDITOR_DOCUMENT_FIELDS as EDITOR_DOCUMENT_FIELDS$1, MAIN_ROOT_KEY, afterActiveTransactionEnds, assertDetachedSelectionSupported, assertEditorDocumentContainers, attachTransactionSpecAfterCommit, canPlaceBlocksAtPath, completePersistedDocumentFields, configureAuthoredView, containsCompleteEditorSchema, createDetachedEditorSchema as createDetachedEditorSchema$1, createEditorOwner, fitSlicePlacements, getActiveEditorTransaction, getActiveEditorUpdateId, getAuthoredUpdateView, getCaretOwner, getCompiledEditorSchema as getCompiledEditorSchema$1, getCompiledEditorSchemaFromApi, getCompiledPropertyCandidates, getDocumentValueNode, getEditorAuthoredDocumentCapability as getEditorAuthoredDocumentCapability$1, getEditorCommitNode, getEditorCommitSnapshot, getEditorDocumentShapeIssueMessage, getEditorRuntimeRootKeys, getEditorUpdateRoot, getInstalledPlugin, getPluginContributions, getReaderRange, getSchemaElementSourceReference, getSelectionDOMRange, getSnapshotVersion, getTextSearchScope, getViewAuthor, holdsCaret, isAuthorId, isDocumentView, isEnvelopeInput as isEnvelopeInput$1, isPlugin as isRuntimePlugin, landNodePropertiesAt, mapDetachedSelectionThroughChange, mapSemanticUpdateMethodArguments, markRootViewUsed, normalizeSetValues, notifyObservers, placeElementAt, preserveCompiledSchemaPropertyIdentity, projectEditorView, readAuthoredView, readDocumentRange, readDocumentRecord as readDocumentRecord$1, readPersistedEnvelope as readPersistedEnvelope$1, readRootViewUse, readStoredEditorDocument, registerEditorTransactionGuard, rejectEditorRecord, repairEditorValue, reportEditorLifecycleError as reportEditorLifecycleError$1, runEditorObserver, sameResult, scheduleAfterCommitNotification, setEditorStateViewTransform, setEditorTransactionViewTransform, setSelectionAsView, shouldMergeNodesRemovePrevNode, snapshotEditorJsonValue, subscribeEditorViewState,
|
|
3
|
-
export { ContentSlice, DocumentChange, EDITOR_DOCUMENT_FIELDS$1 as EDITOR_DOCUMENT_FIELDS, EditorSchemaValidationError, ElementApi, MAIN_ROOT_KEY, NodeApi, PathApi, PointApi, RangeApi, SelectionApi, TextApi, afterActiveTransactionEnds, assertDetachedSelectionSupported, assertEditorDocumentContainers, attachTransactionSpecAfterCommit, canPlaceBlocksAtPath, completePersistedDocumentFields, configureAuthoredView, containsCompleteEditorSchema, createDetachedEditorSchema$1 as createDetachedEditorSchema, createEditor, createEditorOwner, defineEditorSchema, definePluginPoint, defineRuntimePlugin, editorCommands, editorReads, fitSlicePlacements, getActiveEditorTransaction, getActiveEditorUpdateId, getAuthoredUpdateView, getCaretOwner, getCompiledEditorSchema$1 as getCompiledEditorSchema, getCompiledEditorSchemaFromApi, getCompiledPropertyCandidates, getDocumentValueNode, getEditorAuthoredDocumentCapability$1 as getEditorAuthoredDocumentCapability, getEditorCommitNode, getEditorCommitSnapshot, getEditorDocumentShapeIssueMessage, getEditorRuntimeOwner, getEditorRuntimeRootKeys, getEditorUpdateRoot, getInstalledPlugin, getPluginContributions, getReaderRange, getSchemaElementSourceReference, getSelectionDOMRange, getSnapshotVersion, getTextSearchScope, getViewAuthor, holdsCaret, isAuthorId, isDocumentView, isEnvelopeInput$1 as isEnvelopeInput, isRuntimePlugin, landNodePropertiesAt, locateAt, mapDetachedSelectionThroughChange, mapSemanticUpdateMethodArguments, markRootViewUsed, normalizeSetValues, notifyObservers, placeElementAt, preserveCompiledSchemaPropertyIdentity, projectEditorView, property, readAuthoredView, readDocumentRange, readDocumentRecord$1 as readDocumentRecord, readEditorSelection, readPersistedEnvelope$1 as readPersistedEnvelope, readRootViewUse, readStoredEditorDocument, registerEditorTransactionGuard, rejectEditorRecord, repairEditorValue, reportEditorLifecycleError$1 as reportEditorLifecycleError, runEditorObserver, sameResult, scheduleAfterCommitNotification, schema, setEditorStateViewTransform, setEditorTransactionViewTransform, setSelectionAsView, shouldMergeNodesRemovePrevNode, snapshotEditorJsonValue, subscribeEditorViewState,
|
|
2
|
+
import { EDITOR_DOCUMENT_FIELDS as EDITOR_DOCUMENT_FIELDS$1, EditorRefusalError, MAIN_ROOT_KEY, afterActiveTransactionEnds, assertDetachedSelectionSupported, assertEditorDocumentContainers, attachTransactionSpecAfterCommit, canPlaceBlocksAtPath, canonicalRecordJson, claimsHistoryReplay, completePersistedDocumentFields, configureAuthoredView, containsCompleteEditorSchema, createAuthoredEditorView, createDetachedEditorSchema as createDetachedEditorSchema$1, createEditorOwner, fitSlicePlacements, getActiveCommandEditor, getActiveEditorTransaction, getActiveEditorUpdateId, getActiveEditorUpdateTags, getAuthoredUpdateView, getCaretOwner, getCarriedCaretEditor, getCompiledEditorSchema as getCompiledEditorSchema$1, getCompiledEditorSchemaFromApi, getCompiledPropertyCandidates, getDocumentValueNode, getEditorAuthoredDocumentCapability as getEditorAuthoredDocumentCapability$1, getEditorCommitNode, getEditorCommitSnapshot, getEditorCommitValue, getEditorDocumentShapeIssueMessage, getEditorRuntimeRootKeys, getEditorUpdateRoot, getInstalledPlugin, getPluginContributions, getReaderRange, getRecordSetVersion, getSchemaElementSourceReference, getSelectionDOMRange, getSnapshotVersion, getTextSearchScope, getValueRecords, getViewAuthor, getViewPresentation as getViewPresentation$1, holdsCaret, isAuthorId, isDocumentView, isEditorPublishingCommit, isEnvelopeInput as isEnvelopeInput$1, isPlugin as isRuntimePlugin, landNodePropertiesAt, mapDetachedSelectionThroughChange, mapSemanticUpdateMethodArguments, markRootViewUsed, normalizeSetValues, notifyObservers, placeElementAt, preserveCompiledSchemaPropertyIdentity, projectEditorView, readAuthoredView, readCaretViewIn, readDocumentRange, readDocumentRecord as readDocumentRecord$1, readEditorCommitHistoryEntry, readElementById, readElementPropertyWrites, readPersistedEnvelope as readPersistedEnvelope$1, readRecord, readRootEntries, readRootViewUse, readShownDocument, readShownPreview, readShownRecords, readShownViewUse, readStoredEditorDocument, readViewPage, recordSetChanges, recordSetIds, registerEditorTransactionGuard, rejectEditorRecord, repairEditorValue, reportEditorLifecycleError as reportEditorLifecycleError$1, runEditorObserver, sameResult, scheduleAfterCommitNotification, setEditorStateViewTransform, setEditorTransactionViewTransform, setSelectionAsView, shouldMergeNodesRemovePrevNode, snapshotEditorJsonValue, subscribeCaretTarget, subscribeEditorViewState, subscribeShownViewUse, txStored, vetoesWrite, withDocumentViewRead, withEditorUpdateRootScope, withMountedPresentation, withStoredAuthoredRead, withTransactionSpecDraftRead } from "plitejs/internal";
|
|
3
|
+
export { ContentSlice, DocumentChange, EDITOR_DOCUMENT_FIELDS$1 as EDITOR_DOCUMENT_FIELDS, EditorRefusalError, EditorSchemaValidationError, ElementApi, MAIN_ROOT_KEY, NodeApi, PathApi, PointApi, RangeApi, SelectionApi, TextApi, afterActiveTransactionEnds, assertDetachedSelectionSupported, assertEditorDocumentContainers, attachTransactionSpecAfterCommit, canPlaceBlocksAtPath, canonicalRecordJson, claimsHistoryReplay, completePersistedDocumentFields, configureAuthoredView, containsCompleteEditorSchema, createAuthoredEditorView, createDetachedEditorSchema$1 as createDetachedEditorSchema, createEditor, createEditorOwner, defineEditorSchema, definePluginPoint, defineRuntimePlugin, editorCommands, editorReads, fitSlicePlacements, getActiveCommandEditor, getActiveEditorTransaction, getActiveEditorUpdateId, getActiveEditorUpdateTags, getAuthoredUpdateView, getCaretOwner, getCarriedCaretEditor, getCompiledEditorSchema$1 as getCompiledEditorSchema, getCompiledEditorSchemaFromApi, getCompiledPropertyCandidates, getDocumentValueNode, getEditorAuthoredDocumentCapability$1 as getEditorAuthoredDocumentCapability, getEditorCommitNode, getEditorCommitSnapshot, getEditorCommitValue, getEditorDocumentShapeIssueMessage, getEditorRuntimeOwner, getEditorRuntimeRootKeys, getEditorUpdateRoot, getInstalledPlugin, getPluginContributions, getReaderRange, getRecordSetVersion, getSchemaElementSourceReference, getSelectionDOMRange, getSnapshotVersion, getTextSearchScope, getValueRecords, getViewAuthor, getViewPresentation$1 as getViewPresentation, holdsCaret, isAuthorId, isDocumentView, isEditorPublishingCommit, isEnvelopeInput$1 as isEnvelopeInput, isRuntimePlugin, landNodePropertiesAt, locateAt, mapDetachedSelectionThroughChange, mapSemanticUpdateMethodArguments, markRootViewUsed, normalizeSetValues, notifyObservers, placeElementAt, preserveCompiledSchemaPropertyIdentity, projectEditorView, property, readAuthoredView, readCaretViewIn, readDocumentRange, readDocumentRecord$1 as readDocumentRecord, readEditorCommitHistoryEntry, readEditorSelection, readElementById, readElementPropertyWrites, readPersistedEnvelope$1 as readPersistedEnvelope, readRecord, readRootEntries, readRootViewUse, readShownDocument, readShownPreview, readShownRecords, readShownViewUse, readStoredEditorDocument, readViewPage, recordSetChanges, recordSetIds, registerEditorTransactionGuard, rejectEditorRecord, repairEditorValue, reportEditorLifecycleError$1 as reportEditorLifecycleError, runEditorObserver, sameResult, scheduleAfterCommitNotification, schema, setEditorStateViewTransform, setEditorTransactionViewTransform, setSelectionAsView, shouldMergeNodesRemovePrevNode, snapshotEditorJsonValue, subscribeCaretTarget, subscribeEditorViewState, subscribeShownViewUse, target, transfer, txLocate, txSelection, txStored, vetoesWrite, withDocumentViewRead, withEditorUpdateRootScope, withMountedPresentation, withStoredAuthoredRead, withTransactionSpecDraftRead };
|
|
@@ -104,16 +104,24 @@ const BaseBlockquotePlugin = definePlugin(PLUGINS.blockquote, {
|
|
|
104
104
|
shortcuts: { untab: { keys: "shift+tab" } },
|
|
105
105
|
update: ({ editor, plugin, tx, schema: { type } }) => ({
|
|
106
106
|
wrap: txLocate(locateAt(0), ({ at } = {}) => {
|
|
107
|
-
|
|
107
|
+
const runs = [];
|
|
108
|
+
for (const [node, path] of tx.nodes.blocks({ at })) {
|
|
108
109
|
if (node.type === type || tx.nodes.above({
|
|
109
110
|
at: path,
|
|
110
111
|
type: plugin
|
|
111
112
|
})) continue;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
const run = runs.at(-1);
|
|
114
|
+
const last = run?.at(-1);
|
|
115
|
+
if (run && last && PathApi.equals(PathApi.next(last), path)) run.push(path);
|
|
116
|
+
else runs.push([path]);
|
|
116
117
|
}
|
|
118
|
+
for (const run of runs.toReversed()) tx.nodes.wrap({
|
|
119
|
+
children: [],
|
|
120
|
+
type
|
|
121
|
+
}, {
|
|
122
|
+
at: PathApi.parent(run[0]),
|
|
123
|
+
match: (_node, path) => run.some((member) => PathApi.equals(member, path))
|
|
124
|
+
});
|
|
117
125
|
}),
|
|
118
126
|
toggle: () => tx.blocks.toggle({ type }, { wrap: true }),
|
|
119
127
|
untab: () => {
|
|
@@ -6,6 +6,10 @@ import { PLUGINS } from "../../../utils/plate-keys.js";
|
|
|
6
6
|
import { property, schema, txLocate } from "../../../core.js";
|
|
7
7
|
//#region src/features/basic-nodes/lib/BaseHeadingPlugins.ts
|
|
8
8
|
const isHeadingLevel = (value) => typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= 6;
|
|
9
|
+
const levelProps = (level, type, detailsTitleType) => (node) => node.type === detailsTitleType ? { level } : {
|
|
10
|
+
level,
|
|
11
|
+
type
|
|
12
|
+
};
|
|
9
13
|
const rules = {
|
|
10
14
|
break: { splitReset: true },
|
|
11
15
|
delete: {
|
|
@@ -60,21 +64,39 @@ const BaseHeadingPlugin = definePlugin(PLUGINS.heading, {
|
|
|
60
64
|
}
|
|
61
65
|
}),
|
|
62
66
|
rules,
|
|
63
|
-
read: ({ editor, schema: { type } }) =>
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
read: ({ editor, schema: { type }, state }) => {
|
|
68
|
+
const detailsTitleType = () => {
|
|
69
|
+
const summary = getCompiledPlatePlugin(editor, PLUGINS.detailsSummary);
|
|
70
|
+
return summary ? editor.plugin(summary).schema.type : void 0;
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
level: (node) => (node.type === type || node.type === detailsTitleType()) && isHeadingLevel(node.level) ? node.level : void 0,
|
|
74
|
+
/**
|
|
75
|
+
* Whether `setLevel(level)` can apply: the schema lets every selected
|
|
76
|
+
* block take the level where it sits.
|
|
77
|
+
*/
|
|
78
|
+
canSetLevel: (level) => {
|
|
79
|
+
const blocks = state.nodes.blocks();
|
|
80
|
+
const props = levelProps(level, type, detailsTitleType());
|
|
81
|
+
const root = state.view.root();
|
|
82
|
+
return blocks.length > 0 && blocks.every(([node, path]) => state.schema.canPlace([{
|
|
83
|
+
...node,
|
|
84
|
+
...props(node)
|
|
85
|
+
}], {
|
|
86
|
+
at: path,
|
|
87
|
+
replace: true,
|
|
88
|
+
root
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
68
93
|
}).extend(({ read }) => ({ update: ({ editor, tx, schema: { type } }) => {
|
|
69
94
|
const summary = getCompiledPlatePlugin(editor, PLUGINS.detailsSummary);
|
|
70
|
-
const
|
|
95
|
+
const detailsTitleType = summary ? editor.plugin(summary).schema.type : void 0;
|
|
71
96
|
const setLevel = txLocate(false, (level) => {
|
|
72
97
|
const blocks = tx.nodes.blocks();
|
|
73
98
|
if (blocks.length === 0) return false;
|
|
74
|
-
return blocks.every(([node]) => read.level(node) === level) || tx.blocks.set((
|
|
75
|
-
level,
|
|
76
|
-
type
|
|
77
|
-
});
|
|
99
|
+
return blocks.every(([node]) => read.level(node) === level) || tx.blocks.set(levelProps(level, type, detailsTitleType));
|
|
78
100
|
});
|
|
79
101
|
return {
|
|
80
102
|
setLevel,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { BaseBoardArrowPlugin, BaseBoardFramePlugin, BaseBoardGeoPlugin, BaseBoardImagePlugin, BaseBoardNotePlugin, BaseBoardPlugin, BaseBoardStrokePlugin, type BoardArrowAnchor, BoardArrowElement, type BoardArrowEnd, BoardArrowEndInput, type BoardArrowEnds, type BoardArrowEntry, type BoardArrowSide, BoardDefinition, BoardElement, BoardFrameElement, type BoardFrameEntry, type BoardFramePlace, BoardGeo, BoardGeoElement, BoardImageElement, type BoardMemberEntry, BoardNoteElement, type BoardPlace, type BoardRestackDirection, type BoardShapeEntry, type BoardShapePlace, type BoardSize, BoardStrokeElement, defineBoardShape };
|
|
1
|
+
import { A as BoardShapeEntry, C as BoardArrowEnd, D as BoardArrowEntry, F as BoardPlace, I as BoardRestackDirection, M as BoardShapePlace, O as BoardFrameEntry, R as BoardSize, S as BoardArrowAnchor, T as BoardArrowSide, _ as BaseBoardFramePlugin, a as BoardElement, b as BoardArrowElement, d as BoardNoteElement, f as BaseBoardImagePlugin, g as BoardGeoElement, h as BoardGeo, i as BoardDefinition, j as BoardFramePlace, k as BoardMemberEntry, m as BaseBoardGeoPlugin, n as BoardStrokeElement, p as BoardImageElement, r as BaseBoardPlugin, s as BoardStrokePath, t as BaseBoardStrokePlugin, u as BaseBoardNotePlugin, v as BoardFrameElement, w as BoardArrowEnds, x as BoardArrowEndInput, y as BaseBoardArrowPlugin, z as defineBoardShape } from "../../index-Ca48r1ng.js";
|
|
2
|
+
export { BaseBoardArrowPlugin, BaseBoardFramePlugin, BaseBoardGeoPlugin, BaseBoardImagePlugin, BaseBoardNotePlugin, BaseBoardPlugin, BaseBoardStrokePlugin, type BoardArrowAnchor, BoardArrowElement, type BoardArrowEnd, BoardArrowEndInput, type BoardArrowEnds, type BoardArrowEntry, type BoardArrowSide, BoardDefinition, BoardElement, BoardFrameElement, type BoardFrameEntry, type BoardFramePlace, BoardGeo, BoardGeoElement, BoardImageElement, type BoardMemberEntry, BoardNoteElement, type BoardPlace, type BoardRestackDirection, type BoardShapeEntry, type BoardShapePlace, type BoardSize, BoardStrokeElement, type BoardStrokePath, defineBoardShape };
|
|
@@ -13,10 +13,12 @@ import { BaseBoardFramePlugin } from "./BaseBoardFramePlugin.js";
|
|
|
13
13
|
import { BaseBoardGeoPlugin } from "./BaseBoardGeoPlugin.js";
|
|
14
14
|
import { BaseBoardImagePlugin } from "./BaseBoardImagePlugin.js";
|
|
15
15
|
import { BaseBoardNotePlugin } from "./BaseBoardNotePlugin.js";
|
|
16
|
+
import { boardStrokePath, boardStrokePointsOf } from "./boardStroke.internal.js";
|
|
16
17
|
import { BaseBoardStrokePlugin } from "./BaseBoardStrokePlugin.js";
|
|
17
18
|
import { moveShapesTo, paintKeyOf, paintOrder, placeShapeCopies, shapeIdOf, withCarriedRootSlots, withCutSlotsLoose, withFreshRootShapeIds, withSourcePaintOrder } from "./boardCopy.internal.js";
|
|
18
19
|
import { BOARD_ARROW_ATTRIBUTES, BOARD_FRAME_ATTRIBUTES, BOARD_SHAPE_ATTRIBUTES, BOARD_STROKE_ATTRIBUTES, decodeBoardArrowAttributes, decodeBoardFrameAttributes, decodeBoardShapeAttributes, decodeBoardStrokeAttributes, encodeBoardArrowAttributes, encodeBoardFrameAttributes, encodeBoardShapeAttributes, encodeBoardStrokeAttributes } from "./boardHtml.internal.js";
|
|
19
20
|
import { flooredSizeKeepingRatio, keepsBoardRatio } from "./boardRatio.internal.js";
|
|
21
|
+
import { boardTypesOf } from "./boardTypes.internal.js";
|
|
20
22
|
import { nanoid } from "nanoid";
|
|
21
23
|
//#region src/features/board/lib/BaseBoardPlugin.ts
|
|
22
24
|
/**
|
|
@@ -166,6 +168,7 @@ const BaseBoardPlugin = definePlugin("board", {
|
|
|
166
168
|
}))],
|
|
167
169
|
read: ({ state }) => {
|
|
168
170
|
const members = boardMembersOf(state, properties);
|
|
171
|
+
const types = boardTypesOf(editor);
|
|
169
172
|
return {
|
|
170
173
|
/**
|
|
171
174
|
* Where the arrow `id` draws its two ends, or null when `id` names
|
|
@@ -192,7 +195,17 @@ const BaseBoardPlugin = definePlugin("board", {
|
|
|
192
195
|
}) });
|
|
193
196
|
},
|
|
194
197
|
/** The members of the board block `board`, in stored order. */
|
|
195
|
-
shapes: (board) => boardShapesOf(state, members, board)
|
|
198
|
+
shapes: (board) => boardShapesOf(state, members, board),
|
|
199
|
+
/**
|
|
200
|
+
* Where the pen line `id` draws its outline within its box, the
|
|
201
|
+
* path the live board draws, or null when `id` names no pen line.
|
|
202
|
+
*/
|
|
203
|
+
strokePath: (id) => {
|
|
204
|
+
const entry = members.member(id);
|
|
205
|
+
if (entry?.kind !== "shape") return null;
|
|
206
|
+
const points = boardStrokePointsOf(entry, types.stroke());
|
|
207
|
+
return points ? boardStrokePath(points, entry.size) : null;
|
|
208
|
+
}
|
|
196
209
|
};
|
|
197
210
|
}
|
|
198
211
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { strokeOutline } from "../../../internal/penStroke.internal.js";
|
|
1
2
|
//#region src/features/board/lib/boardStroke.internal.ts
|
|
2
3
|
const BOARD_STROKE_TYPE = "boardStroke";
|
|
3
4
|
/** How much thinner perfect-freehand draws a pen line as its pressure falls. */
|
|
@@ -29,5 +30,16 @@ const boardInkIn = (points, box) => {
|
|
|
29
30
|
]);
|
|
30
31
|
return ink;
|
|
31
32
|
};
|
|
33
|
+
const boardStrokePointsOf = (entry, strokeType) => entry.node.type === strokeType && Array.isArray(entry.node.points) ? entry.node.points : void 0;
|
|
34
|
+
const boardStrokePath = (points, { height, width }) => ({
|
|
35
|
+
height,
|
|
36
|
+
path: strokeOutline(boardInkIn(points, {
|
|
37
|
+
height,
|
|
38
|
+
width,
|
|
39
|
+
x: 0,
|
|
40
|
+
y: 0
|
|
41
|
+
}), BOARD_PEN, true),
|
|
42
|
+
width
|
|
43
|
+
});
|
|
32
44
|
//#endregion
|
|
33
|
-
export { BOARD_PEN, BOARD_STROKE_REACH, BOARD_STROKE_THINNING, BOARD_STROKE_TYPE, boardInkIn, boardStrokeRadius, isBoardStrokePoints };
|
|
45
|
+
export { BOARD_PEN, BOARD_STROKE_REACH, BOARD_STROKE_THINNING, BOARD_STROKE_TYPE, boardInkIn, boardStrokePath, boardStrokePointsOf, boardStrokeRadius, isBoardStrokePoints };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseBoardGeoPlugin } from "./BaseBoardGeoPlugin.js";
|
|
2
|
+
import { BaseBoardNotePlugin } from "./BaseBoardNotePlugin.js";
|
|
3
|
+
import { BaseBoardStrokePlugin } from "./BaseBoardStrokePlugin.js";
|
|
4
|
+
//#region src/features/board/lib/boardTypes.internal.ts
|
|
5
|
+
const boardTypesOf = (editor) => {
|
|
6
|
+
const geo = editor.plugin(BaseBoardGeoPlugin);
|
|
7
|
+
const note = editor.plugin(BaseBoardNotePlugin);
|
|
8
|
+
const stroke = editor.plugin(BaseBoardStrokePlugin);
|
|
9
|
+
return {
|
|
10
|
+
geo: () => geo.installed ? geo.schema.type : void 0,
|
|
11
|
+
note: () => note.installed ? note.schema.type : void 0,
|
|
12
|
+
stroke: () => stroke.installed ? stroke.schema.type : void 0
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { boardTypesOf };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { Ht as EditorJsonValue, fs as PropertyValueOptions, ji as ElementOf, ss as PropertyStringDescriptor } from "../../index-BXjLmx1n-CXk17buG.js";
|
|
2
|
+
import "../../htmlTypes-eT2ZGDAj.js";
|
|
3
|
+
import { _ as BasePlugin } from "../../core-BqR-fEDp.js";
|
|
3
4
|
declare const BaseCalloutPlugin: BasePlugin<Readonly<{
|
|
4
5
|
formats: true;
|
|
5
6
|
rules: true;
|