platejs 54.0.0-beta.2 → 54.0.0-beta.3
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-DY104TqL.d.ts} +2 -2
- package/dist/{BaseSuggestionPlugin-DBl3fqnm.d.ts → BaseSuggestionPlugin-Deo6n6Fs.d.ts} +7 -3
- package/dist/{PlateStatic-DhNv2ejp.d.ts → PlateStatic-CJX5bKuv.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-DAOYWuvC.d.ts} +2 -2
- package/dist/{comparison-types-CYnJ35qU.d.ts → comparison-types-Dt-unJZY-DCddmbSD.d.ts} +10 -2
- package/dist/compiler/index.d.ts +2 -2
- package/dist/{core-BJG8l_mk.d.ts → core-ClHasORr.d.ts} +433 -95
- 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 +4 -2
- package/dist/docs/api/core/plate-plugin.md +3 -0
- package/dist/docs/api/core/plate-store.md +3 -3
- package/dist/docs/api/dom.md +14 -4
- package/dist/docs/api/editor-transforms.md +2 -1
- package/dist/docs/api/react-hooks.md +25 -11
- package/dist/docs/authored-changes.md +5 -2
- package/dist/docs/basic-blocks.md +42 -29
- package/dist/docs/blockquote.md +5 -3
- package/dist/docs/board.md +63 -8
- package/dist/docs/code-block.md +47 -0
- package/dist/docs/discussion.md +1 -1
- package/dist/docs/docx.md +1 -1
- package/dist/docs/dom-coverage.md +5 -0
- 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 +176 -8
- package/dist/docs/plugin-components.md +13 -10
- package/dist/docs/plugin-input-rules.md +4 -12
- 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 +29 -5
- package/dist/docx/export/lib/reviewPart.js +1 -1
- package/dist/docx/export/lib/reviewProjection.js +10 -8
- 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/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 +10 -10
- package/dist/features/field/index.d.ts +2 -0
- package/dist/features/field/index.js +2 -0
- package/dist/features/field/lib/BaseFieldPlugin.js +414 -0
- package/dist/features/field/lib/fieldRules.internal.js +42 -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 +533 -62
- 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 +1 -1
- package/dist/features/media/lib/media/parseMediaUrl.js +11 -1
- package/dist/features/media/lib/media-embed/BaseMediaEmbedPlugin.js +6 -2
- 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 +14 -8
- 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-cg_cWsaN.d.ts} +2 -31
- package/dist/hyperscript/index.d.ts +1 -1
- package/dist/{index-D1CFXA-i.d.ts → index-8WO2vI0U.d.ts} +475 -143
- package/dist/{index-DaM37gF6.d.ts → index-B5mYEawV.d.ts} +37 -21
- package/dist/{index-Bq3sdm3S.d.ts → index-BZWFoUXt.d.ts} +5 -4
- package/dist/{index-DdIRduDG.d.ts → index-C0POz7rg.d.ts} +3 -2
- package/dist/{index-Bxfvicyy.d.ts → index-C1_JIhL4.d.ts} +4 -3
- package/dist/{index-DC_MNGyu.d.ts → index-C35V_hj0.d.ts} +3 -3
- package/dist/{index-kLKMc-pI.d.ts → index-C6ql9pKw.d.ts} +2 -2
- package/dist/{index-hsC_sOn2.d.ts → index-C9DiGDVj.d.ts} +35 -5
- package/dist/{index-DTgaSxKr.d.ts → index-CLsEe3LY.d.ts} +40 -4
- package/dist/{index-CT7miqQN.d.ts → index-CdOLsPaW.d.ts} +29 -9
- package/dist/{index-DLA2DUR2.d.ts → index-CktYvOgk.d.ts} +4 -3
- package/dist/{index-BBKGrsG3.d.ts → index-Cmuluh6f.d.ts} +1 -1
- package/dist/{index-BiQerPJS.d.ts → index-CzLwBZpY.d.ts} +2 -2
- package/dist/{index-DzD6BIFJ.d.ts → index-D3-2iM1b.d.ts} +7 -5
- package/dist/{index-Cl77E9yr.d.ts → index-DKOFvteF.d.ts} +2 -2
- package/dist/{index-iaZOhA76.d.ts → index-DPWyk3lG-DOYwohXO.d.ts} +1 -1
- package/dist/index-DQnjqtQa.d.ts +678 -0
- package/dist/{index-CcZbqPqk.d.ts → index-Do9pj1GK.d.ts} +73 -39
- package/dist/{index-BU6k1Aev.d.ts → index-DpltOCot-A2b3p3Eb.d.ts} +4735 -4586
- package/dist/{index-Bc2Yg_2j.d.ts → index-HPYawTae-BCUQLEWF.d.ts} +2 -2
- package/dist/{index-BkR7-GLI.d.ts → index-baQOK89E.d.ts} +2 -2
- package/dist/{index-D5W-p9bS.d.ts → index-oIJAZxc2.d.ts} +49 -4
- package/dist/{index-xdmCBvlT.d.ts → index-r7yb77Wy.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 +8 -2
- 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 +5 -15
- package/dist/lib/plugins/input-rules/inputRuleVeto.internal.js +16 -0
- package/dist/markdown/index.d.ts +2 -2
- package/dist/markdown/index.js +2 -1
- package/dist/markdown/lib/MarkdownPlugin.js +16 -9
- package/dist/markdown/lib/RawHtmlPlugin.js +24 -0
- package/dist/markdown/lib/deserializer/mdastToSlate.js +12 -2
- package/dist/markdown/lib/internal/markdownConversion.js +773 -74
- package/dist/markdown/lib/internal/markdownDiagnostics.js +18 -7
- 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 +314 -0
- package/dist/markdown/lib/internal/markdownSegments.js +57 -48
- package/dist/markdown/lib/internal/markdownTags.js +22 -8
- 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/pagination/index.d.ts +1 -1
- package/dist/pagination/react/index.d.ts +4 -4
- package/dist/react/components/EditorContentView.internal.js +17 -8
- package/dist/react/components/EditorProvider.js +5 -5
- package/dist/react/components/Plate.js +103 -122
- 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/boardGesture.internal.js +6 -3
- package/dist/react/features/board/boardIndex.internal.js +7 -18
- package/dist/react/features/board/boardPictures.internal.js +19 -13
- package/dist/react/features/board/boardView.internal.js +184 -49
- package/dist/react/features/board/boardVoice.internal.js +10 -11
- package/dist/react/features/board/index.d.ts +64 -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 +34 -0
- package/dist/react/features/field/index.d.ts +312 -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 -29
- 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 +331 -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 +8 -7
- 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 +425 -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 +66 -21
- 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-aUwpNnAw.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
|
@@ -95,6 +95,15 @@ const parseYoutubeId = (url) => {
|
|
|
95
95
|
const pathId = getSegmentAfter(segments, "embed") ?? getSegmentAfter(segments, "v") ?? getSegmentAfter(segments, "vi") ?? getSegmentAfter(segments, "videos") ?? getSegmentAfter(segments, "shorts") ?? getSegmentAfter(segments, "live");
|
|
96
96
|
return isYoutubeId(pathId) ? pathId : void 0;
|
|
97
97
|
};
|
|
98
|
+
const youtubeTimeRegex = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s?)?$/;
|
|
99
|
+
const parseYoutubeStart = (url) => {
|
|
100
|
+
const value = url.searchParams.get("t") ?? url.searchParams.get("start") ?? new URLSearchParams(url.hash.slice(1)).get("t");
|
|
101
|
+
const match = value ? youtubeTimeRegex.exec(value) : null;
|
|
102
|
+
if (!match) return void 0;
|
|
103
|
+
const [, hours = "0", minutes = "0", seconds = "0"] = match;
|
|
104
|
+
const start = Number(hours) * 3600 + Number(minutes) * 60 + Number(seconds);
|
|
105
|
+
return start > 0 ? start : void 0;
|
|
106
|
+
};
|
|
98
107
|
const parseVimeoId = (url) => {
|
|
99
108
|
const host = url.hostname.toLowerCase();
|
|
100
109
|
if (host !== "vimeo.com" && !host.endsWith(".vimeo.com") && host !== "vimeopro.com" && !host.endsWith(".vimeopro.com")) return;
|
|
@@ -137,7 +146,8 @@ const parseVideoUrl = (url) => {
|
|
|
137
146
|
for (const provider of VIDEO_PROVIDER_VALUES) {
|
|
138
147
|
const id = parsers[provider](parsedUrl);
|
|
139
148
|
if (!id) continue;
|
|
140
|
-
const
|
|
149
|
+
const start = provider === "youtube" ? parseYoutubeStart(parsedUrl) : void 0;
|
|
150
|
+
const embedUrl = `${providerUrls[provider]}${id}${start ? `?start=${start}` : ""}`;
|
|
141
151
|
return {
|
|
142
152
|
id,
|
|
143
153
|
provider,
|
|
@@ -23,8 +23,10 @@ const initialState = {
|
|
|
23
23
|
transformUrl: parseIframeUrl
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* Embeds third-party media. Links to YouTube, Vimeo, Dailymotion, Youku and
|
|
27
|
+
* Coub videos are stored as each provider's player URL, and X (Twitter) post
|
|
28
|
+
* links as the post URL. Any other URL is stored as `transformUrl` returns it;
|
|
29
|
+
* the default takes the `src` out of a pasted `<iframe>` snippet.
|
|
28
30
|
*/
|
|
29
31
|
const BaseMediaEmbedPlugin = definePlugin(PLUGINS.mediaEmbed, {
|
|
30
32
|
schema: { element: schema.element.textBlock({
|
|
@@ -85,6 +87,8 @@ const BaseMediaEmbedPlugin = definePlugin(PLUGINS.mediaEmbed, {
|
|
|
85
87
|
children: [{
|
|
86
88
|
attributes: {
|
|
87
89
|
allowfullscreen: true,
|
|
90
|
+
referrerpolicy: "strict-origin-when-cross-origin",
|
|
91
|
+
sandbox: "allow-scripts allow-same-origin allow-presentation",
|
|
88
92
|
src: url,
|
|
89
93
|
title: "Embedded media"
|
|
90
94
|
},
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import "../../
|
|
1
|
+
import { eu as TxDeclaredMethod, is as PropertyStringDescriptor, ki as ElementOf, ls as PropertyValueOptions } from "../../index-DpltOCot-A2b3p3Eb.js";
|
|
2
|
+
import "../../htmlTypes-cg_cWsaN.js";
|
|
3
|
+
import { Ga as DefinitionOf, _ as BasePlugin, _t as NodeInsertOptions } from "../../core-ClHasORr.js";
|
|
4
|
+
import { n as ComboboxState, t as ComboboxEditor } from "../../combobox-DAOYWuvC.js";
|
|
5
|
+
import "../../index-Cmuluh6f.js";
|
|
5
6
|
declare const isNonBlankRef: (value: unknown) => value is string;
|
|
6
7
|
type TMentionItemBase<TRef = string> = {
|
|
7
8
|
label: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as BaseSuggestionPlugin } from "../../BaseSuggestionPlugin-
|
|
1
|
+
import { t as BaseSuggestionPlugin } from "../../BaseSuggestionPlugin-Deo6n6Fs.js";
|
|
2
2
|
/** How many palette slots the copied suggestion kit paints. */
|
|
3
3
|
declare const SUGGESTION_COLOR_COUNT = 7;
|
|
4
4
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as TableSelectionBounds, C as TableResize, D as TableResolvedCellBorders, E as TableResolvedCellBorder, O as TableRowHeightOptions, S as TableNodeTarget, T as TableResizeTarget, _ as TableCellInfo, a as TableDefinition, b as TableColumnWidthOptions, c as TableRowElement, d as TableAxisInsertOptions, f as TableBorderState, g as TableCellBorders, h as TableCellBorder, i as TableCellElement, j as TableTargetOptions, k as TableSelection, m as TableBorderTarget, n as BaseTablePlugin, o as TableElement, p as TableBorderStates, r as BaseTableRowPlugin, s as TablePluginState, t as BaseTableCellPlugin, u as BorderDirection, v as TableCellTarget, w as TableResizeOptions, x as TableCreateOptions, y as TableColumnResize } from "../../index-
|
|
1
|
+
import { A as TableSelectionBounds, C as TableResize, D as TableResolvedCellBorders, E as TableResolvedCellBorder, O as TableRowHeightOptions, S as TableNodeTarget, T as TableResizeTarget, _ as TableCellInfo, a as TableDefinition, b as TableColumnWidthOptions, c as TableRowElement, d as TableAxisInsertOptions, f as TableBorderState, g as TableCellBorders, h as TableCellBorder, i as TableCellElement, j as TableTargetOptions, k as TableSelection, m as TableBorderTarget, n as BaseTablePlugin, o as TableElement, p as TableBorderStates, r as BaseTableRowPlugin, s as TablePluginState, t as BaseTableCellPlugin, u as BorderDirection, v as TableCellTarget, w as TableResizeOptions, x as TableCreateOptions, y as TableColumnResize } from "../../index-r7yb77Wy.js";
|
|
2
2
|
export { BaseTableCellPlugin, BaseTablePlugin, BaseTableRowPlugin, BorderDirection, TableAxisInsertOptions, TableBorderState, TableBorderStates, TableBorderTarget, TableCellBorder, TableCellBorders, TableCellElement, TableCellInfo, TableCellTarget, TableColumnResize, TableColumnWidthOptions, TableCreateOptions, TableDefinition, TableElement, TableNodeTarget, TablePluginState, TableResize, TableResizeOptions, TableResizeTarget, TableResolvedCellBorder, TableResolvedCellBorders, TableRowElement, TableRowHeightOptions, TableSelection, TableSelectionBounds, TableTargetOptions };
|
|
@@ -1260,7 +1260,7 @@ const BaseTablePlugin = definePlugin(PLUGINS.table, {
|
|
|
1260
1260
|
cellTypes: [context.editor.plugin(BaseTableCellPlugin).schema.type],
|
|
1261
1261
|
tableType: context.schema.type
|
|
1262
1262
|
});
|
|
1263
|
-
if (!view
|
|
1263
|
+
if (!view?.selectsCells) return false;
|
|
1264
1264
|
return state.transaction((tx) => {
|
|
1265
1265
|
const cellPaths = view.cellEntries.map(([, path]) => path);
|
|
1266
1266
|
view.cellEntries.forEach(([, path]) => {
|
|
@@ -1297,13 +1297,16 @@ const BaseTablePlugin = definePlugin(PLUGINS.table, {
|
|
|
1297
1297
|
tableType: context.schema.type
|
|
1298
1298
|
});
|
|
1299
1299
|
if (prepared === null) {
|
|
1300
|
-
if (view.
|
|
1300
|
+
if (!view.selectsCells) return next();
|
|
1301
1301
|
let fitted = false;
|
|
1302
1302
|
const transaction = state.transaction(() => {
|
|
1303
|
-
fitted = fitSlicePlacements(context.editor, slice, {
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1303
|
+
fitted = fitSlicePlacements(context.editor, slice, {
|
|
1304
|
+
copies: "each",
|
|
1305
|
+
placements: view.cellEntries.map(([, path]) => ({
|
|
1306
|
+
at: path,
|
|
1307
|
+
content: slice.content
|
|
1308
|
+
}))
|
|
1309
|
+
});
|
|
1307
1310
|
});
|
|
1308
1311
|
return fitted ? transaction : rejectTablePaste({
|
|
1309
1312
|
kind: "invalid-source",
|
|
@@ -1340,7 +1343,10 @@ const BaseTablePlugin = definePlugin(PLUGINS.table, {
|
|
|
1340
1343
|
kind: "plan",
|
|
1341
1344
|
operations: plan.operations
|
|
1342
1345
|
});
|
|
1343
|
-
for (const group of plan.placementGroups) if (!fitSlicePlacements(context.editor, group.source, {
|
|
1346
|
+
for (const group of plan.placementGroups) if (!fitSlicePlacements(context.editor, group.source, {
|
|
1347
|
+
copies: "tile",
|
|
1348
|
+
placements: group.placements
|
|
1349
|
+
})) {
|
|
1344
1350
|
fitted = false;
|
|
1345
1351
|
return;
|
|
1346
1352
|
}
|
|
@@ -1370,7 +1376,7 @@ const BaseTablePlugin = definePlugin(PLUGINS.table, {
|
|
|
1370
1376
|
cellTypes: [context.editor.plugin(BaseTableCellPlugin).schema.type],
|
|
1371
1377
|
tableType: context.schema.type
|
|
1372
1378
|
});
|
|
1373
|
-
if (!view
|
|
1379
|
+
if (!view?.selectsCells) return next();
|
|
1374
1380
|
const focusPath = view.tablePath.concat(view.focus.path);
|
|
1375
1381
|
const focus = state.points.start(focusPath);
|
|
1376
1382
|
const transaction = state.transaction((tx) => {
|
|
@@ -100,7 +100,7 @@ const readTableSelection = (state, { at, cellTypes, expansion = "span-closure",
|
|
|
100
100
|
const snapshot = state.runtime.snapshot();
|
|
101
101
|
const currentSelection = state.selection();
|
|
102
102
|
const cacheKey = !isTransactionState(state) && at === void 0 ? `${tableType}\u0000${expansion}\u0000${cellTypes.join("\0")}\u0000${JSON.stringify(currentSelection)}\u0000${state.view.root() ?? ""}` : null;
|
|
103
|
-
const cached = cacheKey ? selectionViewCache.get(
|
|
103
|
+
const cached = cacheKey ? selectionViewCache.get(snapshot) : void 0;
|
|
104
104
|
if (cached?.key === cacheKey && cached.version === snapshot.version) {
|
|
105
105
|
cacheHitCount += 1;
|
|
106
106
|
return cached.view;
|
|
@@ -108,7 +108,7 @@ const readTableSelection = (state, { at, cellTypes, expansion = "span-closure",
|
|
|
108
108
|
compileCount += 1;
|
|
109
109
|
const isCell = (node) => ElementApi.isElement(node) && cellTypes.some((cellType) => cellType === node.type);
|
|
110
110
|
const publish = (view) => {
|
|
111
|
-
if (cacheKey) selectionViewCache.set(
|
|
111
|
+
if (cacheKey) selectionViewCache.set(snapshot, Object.freeze({
|
|
112
112
|
key: cacheKey,
|
|
113
113
|
version: snapshot.version,
|
|
114
114
|
view
|
|
@@ -180,6 +180,7 @@ const readTableSelection = (state, { at, cellTypes, expansion = "span-closure",
|
|
|
180
180
|
hasCellKey: (key) => cellKeySet.has(key),
|
|
181
181
|
...root === void 0 ? {} : { root },
|
|
182
182
|
selection: location,
|
|
183
|
+
selectsCells: anchors.length > 1 || location.paths.every((path) => path.length <= tablePath.length + 2),
|
|
183
184
|
table,
|
|
184
185
|
tableKey: keyAt(tablePath),
|
|
185
186
|
tablePath,
|
|
@@ -239,6 +240,7 @@ const readTableSelection = (state, { at, cellTypes, expansion = "span-closure",
|
|
|
239
240
|
hasCellKey: (key) => cellKeySet.has(key),
|
|
240
241
|
...root === void 0 ? {} : { root },
|
|
241
242
|
selection,
|
|
243
|
+
selectsCells: anchors.length > 1,
|
|
242
244
|
table,
|
|
243
245
|
tableKey: keyAt(tablePath),
|
|
244
246
|
tablePath,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as readTocHeadings, n as Heading, r as TocDefinition, t as BaseTocPlugin } from "../../index-
|
|
1
|
+
import { i as readTocHeadings, n as Heading, r as TocDefinition, t as BaseTocPlugin } from "../../index-C6ql9pKw.js";
|
|
2
2
|
export { BaseTocPlugin, Heading, TocDefinition, readTocHeadings };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { BaseUploadPlugin, UPLOAD_FILE_TYPES, UPLOAD_KINDS, UploadAdmissionError, UploadClient, UploadElement, UploadFailure, UploadFileType, UploadKind, UploadPluginState, UploadRule, UploadRules, UploadSubmitOptions, UploadTask, UploadTaskState };
|
|
1
|
+
import { _ as UploadTask, a as UploadAdmissionError, c as UploadElement, d as UploadKind, f as UploadPluginState, g as UploadSubmitOptions, h as UploadRules, i as UploadAdmission, l as UploadFailure, m as UploadRule, n as UPLOAD_FILE_TYPES, o as UploadAdmitOptions, p as UploadRefusal, r as UPLOAD_KINDS, s as UploadClient, t as BaseUploadPlugin, u as UploadFileType, v as UploadTaskState } from "../../index-CLsEe3LY.js";
|
|
2
|
+
export { BaseUploadPlugin, UPLOAD_FILE_TYPES, UPLOAD_KINDS, UploadAdmission, UploadAdmissionError, UploadAdmitOptions, UploadClient, UploadElement, UploadFailure, UploadFileType, UploadKind, UploadPluginState, UploadRefusal, UploadRule, UploadRules, UploadSubmitOptions, UploadTask, UploadTaskState };
|