smartrte-react 0.3.5 → 1.0.0-beta.2
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/CHANGELOG.md +14 -0
- package/README.md +106 -14
- package/dist/adapters/domChecklistCommandBridge.js +1 -1
- package/dist/adapters/domCommandBridge.d.ts +2 -2
- package/dist/adapters/domCommandBridge.js +2 -2
- package/dist/adapters/domInlineAtomCommandBridge.d.ts +10 -9
- package/dist/adapters/domInlineAtomCommandBridge.js +154 -50
- package/dist/adapters/domInlineImageCommandBridge.d.ts +7 -7
- package/dist/adapters/domInlineImageCommandBridge.js +6 -72
- package/dist/adapters/domMoveCommandBridge.js +1 -1
- package/dist/adapters/domSelectionBridge.d.ts +3 -3
- package/dist/adapters/domSmartDocument.d.ts +4 -4
- package/dist/adapters/domSmartDocument.js +2 -2
- package/dist/adapters/domTableCommandBridge.d.ts +42 -16
- package/dist/adapters/domTableCommandBridge.js +203 -173
- package/dist/adapters/internalFlags.d.ts +0 -8
- package/dist/adapters/internalFlags.js +0 -24
- package/dist/adapters/legacyListShadowComparator.d.ts +1 -1
- package/dist/adapters/legacyListShadowComparator.js +1 -1
- package/dist/adapters/pdfPrint.d.ts +8 -0
- package/dist/adapters/pdfPrint.js +22 -0
- package/dist/adapters/shadowMode.d.ts +3 -3
- package/dist/adapters/shadowMode.js +1 -1
- package/dist/canonicalEditorRuntime.d.ts +53 -1
- package/dist/canonicalEditorRuntime.js +61 -4
- package/dist/capabilityPresets.d.ts +27 -0
- package/dist/capabilityPresets.js +21 -0
- package/dist/collabTransport.d.ts +66 -0
- package/dist/collabTransport.js +1 -0
- package/dist/commentProvider.d.ts +24 -0
- package/dist/commentProvider.js +1 -0
- package/dist/components/CanonicalAuthorityEditor.d.ts +35 -1
- package/dist/components/CanonicalAuthorityEditor.js +1086 -112
- package/dist/components/ClassicEditorAuthority.d.ts +93 -22
- package/dist/components/ClassicEditorAuthority.js +11 -43
- package/dist/components/ColorPickerPopover.d.ts +39 -0
- package/dist/components/ColorPickerPopover.js +285 -0
- package/dist/components/CommentMarkers.d.ts +25 -0
- package/dist/components/CommentMarkers.js +105 -0
- package/dist/components/CommentThreadPanel.d.ts +26 -0
- package/dist/components/CommentThreadPanel.js +47 -0
- package/dist/components/ContextMenu.d.ts +23 -0
- package/dist/components/ContextMenu.js +141 -0
- package/dist/components/FormulaLibraryPopover.d.ts +16 -0
- package/dist/components/FormulaLibraryPopover.js +107 -0
- package/dist/components/LinkEditorPopover.d.ts +3 -1
- package/dist/components/LinkEditorPopover.js +22 -6
- package/dist/components/MediaManager.d.ts +4 -20
- package/dist/components/MediaManager.js +35 -6
- package/dist/components/MediaOverlay.d.ts +36 -0
- package/dist/components/MediaOverlay.js +163 -0
- package/dist/components/SpecialCharacterPopover.d.ts +18 -0
- package/dist/components/SpecialCharacterPopover.js +99 -0
- package/dist/components/StructuralSuggestionMarkers.d.ts +20 -0
- package/dist/components/StructuralSuggestionMarkers.js +56 -0
- package/dist/components/SuggestionPanel.d.ts +26 -0
- package/dist/components/SuggestionPanel.js +33 -0
- package/dist/components/TableBorderPopover.d.ts +59 -0
- package/dist/components/TableBorderPopover.js +147 -0
- package/dist/components/TableResizeHandles.d.ts +25 -0
- package/dist/components/TableResizeHandles.js +301 -0
- package/dist/components/TableSizePickerPopover.d.ts +16 -0
- package/dist/components/TableSizePickerPopover.js +126 -0
- package/dist/components/ToolbarPrimitives.d.ts +129 -0
- package/dist/components/ToolbarPrimitives.js +146 -0
- package/dist/components/VersionHistoryPanel.d.ts +9 -0
- package/dist/components/VersionHistoryPanel.js +157 -0
- package/dist/formulaLibrary.d.ts +31 -0
- package/dist/formulaLibrary.js +90 -0
- package/dist/index.d.ts +22 -24
- package/dist/index.js +14 -11
- package/dist/mediaManagerAdapter.d.ts +12 -0
- package/dist/mediaManagerAdapter.js +34 -0
- package/dist/mediaProvider.d.ts +21 -1
- package/dist/specialCharacters.d.ts +22 -0
- package/dist/specialCharacters.js +86 -0
- package/dist/standalone/classic-editor-embed.js +19 -12
- package/dist/suggestionProvider.d.ts +17 -0
- package/dist/suggestionProvider.js +1 -0
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +150 -20
- package/dist/versionProvider.d.ts +29 -0
- package/dist/versionProvider.js +1 -0
- package/package.json +28 -14
- package/dist/adapters/canonicalInlineCommandBridge.d.ts +0 -15
- package/dist/adapters/canonicalInlineCommandBridge.js +0 -269
- package/dist/adapters/canonicalListCommandBridge.d.ts +0 -26
- package/dist/adapters/canonicalListCommandBridge.js +0 -430
- package/dist/adapters/coreBold.d.ts +0 -5
- package/dist/adapters/coreBold.js +0 -3
- package/dist/adapters/documentFormats.d.ts +0 -26
- package/dist/adapters/documentFormats.js +0 -49
- package/dist/adapters/docxFormat.d.ts +0 -5
- package/dist/adapters/docxFormat.js +0 -272
- package/dist/adapters/domBlockCommandBridge.d.ts +0 -19
- package/dist/adapters/domBlockCommandBridge.js +0 -79
- package/dist/adapters/inlineMarkCoreExecution.d.ts +0 -9
- package/dist/adapters/inlineMarkCoreExecution.js +0 -25
- package/dist/adapters/pdfFormat.d.ts +0 -23
- package/dist/adapters/pdfFormat.js +0 -204
- package/dist/adapters/portableDocxAtoms.d.ts +0 -4
- package/dist/adapters/portableDocxAtoms.js +0 -58
- package/dist/adapters/styledDocxFormat.d.ts +0 -8
- package/dist/adapters/styledDocxFormat.js +0 -190
- package/dist/builtInFormatDefinitions.d.ts +0 -5
- package/dist/builtInFormatDefinitions.js +0 -82
- package/dist/canonicalAuthorityFlag.d.ts +0 -32
- package/dist/canonicalAuthorityFlag.js +0 -49
- package/dist/canonicalClipboardRuntime.d.ts +0 -15
- package/dist/canonicalClipboardRuntime.js +0 -76
- package/dist/components/ClassicEditor.d.ts +0 -76
- package/dist/components/ClassicEditor.js +0 -6729
- package/dist/editorController.d.ts +0 -78
- package/dist/editorController.js +0 -298
- package/dist/formatFidelity.d.ts +0 -14
- package/dist/formatFidelity.js +0 -107
- package/dist/formatRuntime.d.ts +0 -50
- package/dist/formatRuntime.js +0 -20
- package/dist/pluginRuntime.d.ts +0 -68
- package/dist/pluginRuntime.js +0 -78
- package/dist/standalone/editor.js +0 -1068
- package/dist/test-harness/atomShadowComparator.d.ts +0 -14
- package/dist/test-harness/atomShadowComparator.js +0 -63
- package/dist/test-harness/blockShadowComparator.d.ts +0 -30
- package/dist/test-harness/blockShadowComparator.js +0 -140
- package/dist/test-harness/clipboardShadowComparator.d.ts +0 -12
- package/dist/test-harness/clipboardShadowComparator.js +0 -46
- package/dist/test-harness/inlineShadowComparator.d.ts +0 -32
- package/dist/test-harness/inlineShadowComparator.js +0 -152
- package/dist/test-harness/legacyAtomEngine.d.ts +0 -10
- package/dist/test-harness/legacyAtomEngine.js +0 -15
- package/dist/test-harness/legacyBlockEngine.d.ts +0 -31
- package/dist/test-harness/legacyBlockEngine.js +0 -31
- package/dist/test-harness/legacyClipboardEngine.d.ts +0 -14
- package/dist/test-harness/legacyClipboardEngine.js +0 -67
- package/dist/test-harness/legacyInlineEngine.d.ts +0 -19
- package/dist/test-harness/legacyInlineEngine.js +0 -49
- package/dist/test-harness/legacyTableEngine.d.ts +0 -12
- package/dist/test-harness/legacyTableEngine.js +0 -25
- package/dist/test-harness/tableShadowComparator.d.ts +0 -29
- package/dist/test-harness/tableShadowComparator.js +0 -101
package/dist/pluginRuntime.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { createCorePlugins, orderPlugins, } from "smartrte-core";
|
|
2
|
-
const pluginIdByFeature = {
|
|
3
|
-
basicFormatting: "basic-formatting",
|
|
4
|
-
blockType: "block-type",
|
|
5
|
-
alignment: "alignment",
|
|
6
|
-
list: "list",
|
|
7
|
-
checklist: "checklist",
|
|
8
|
-
blockquote: "blockquote",
|
|
9
|
-
codeBlock: "code-block",
|
|
10
|
-
table: "table",
|
|
11
|
-
media: "media",
|
|
12
|
-
formula: "formula",
|
|
13
|
-
move: "move",
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Resolves one authoritative plugin set for both React UI availability and
|
|
17
|
-
* core command execution. Passing `plugins` creates an exact custom runtime;
|
|
18
|
-
* otherwise the standard plugin preset is filtered by `features`.
|
|
19
|
-
*/
|
|
20
|
-
export const createReactEditorPluginRuntime = (options = {}) => {
|
|
21
|
-
const plugins = orderPlugins(options.plugins ? [...options.plugins] : createCorePlugins(options.features));
|
|
22
|
-
const pluginIds = new Set(plugins.map((plugin) => plugin.id));
|
|
23
|
-
const featureIds = new Set(Object.keys(pluginIdByFeature)
|
|
24
|
-
.filter((feature) => pluginIds.has(pluginIdByFeature[feature])));
|
|
25
|
-
const commandIds = new Set(plugins.flatMap((plugin) => Object.keys(plugin.commands || {})));
|
|
26
|
-
const contributionIds = new Set();
|
|
27
|
-
const ordered = (items) => items.map((item, index) => ({ item, index }))
|
|
28
|
-
.sort((left, right) => (left.item.order ?? 0) - (right.item.order ?? 0) || left.index - right.index)
|
|
29
|
-
.map(({ item }) => item);
|
|
30
|
-
const validateContribution = (pluginId, contribution, kind) => {
|
|
31
|
-
if (!contribution.id.trim())
|
|
32
|
-
throw new Error(`Plugin "${pluginId}" has a ${kind} contribution with an empty id.`);
|
|
33
|
-
if (contributionIds.has(contribution.id)) {
|
|
34
|
-
throw new Error(`Duplicate UI contribution id "${contribution.id}".`);
|
|
35
|
-
}
|
|
36
|
-
if (!commandIds.has(contribution.commandId)) {
|
|
37
|
-
throw new Error(`${kind} contribution "${contribution.id}" references missing command "${contribution.commandId}".`);
|
|
38
|
-
}
|
|
39
|
-
contributionIds.add(contribution.id);
|
|
40
|
-
};
|
|
41
|
-
const toolbar = ordered(plugins.flatMap((plugin) => (plugin.react?.toolbar || []).map((contribution) => {
|
|
42
|
-
validateContribution(plugin.id, contribution, "Toolbar");
|
|
43
|
-
return { ...contribution };
|
|
44
|
-
})));
|
|
45
|
-
const shortcuts = ordered(plugins.flatMap((plugin) => (plugin.react?.shortcuts || []).map((contribution) => {
|
|
46
|
-
validateContribution(plugin.id, contribution, "Shortcut");
|
|
47
|
-
if (!contribution.key.trim()) {
|
|
48
|
-
throw new Error(`Shortcut contribution "${contribution.id}" requires a key.`);
|
|
49
|
-
}
|
|
50
|
-
return { ...contribution, key: contribution.key.toLowerCase() };
|
|
51
|
-
})));
|
|
52
|
-
const contextMenu = ordered(plugins.flatMap((plugin) => (plugin.react?.contextMenu || []).map((contribution) => {
|
|
53
|
-
validateContribution(plugin.id, contribution, "Context menu");
|
|
54
|
-
return { ...contribution };
|
|
55
|
-
})));
|
|
56
|
-
const formatIds = new Set();
|
|
57
|
-
const formats = plugins.flatMap((plugin) => (plugin.react?.formats || []).map((format) => {
|
|
58
|
-
if (!format.id.trim())
|
|
59
|
-
throw new Error(`Plugin "${plugin.id}" has a format with an empty id.`);
|
|
60
|
-
if (formatIds.has(format.id))
|
|
61
|
-
throw new Error(`Duplicate plugin format "${format.id}".`);
|
|
62
|
-
formatIds.add(format.id);
|
|
63
|
-
return format;
|
|
64
|
-
}));
|
|
65
|
-
return {
|
|
66
|
-
plugins,
|
|
67
|
-
featureIds,
|
|
68
|
-
toolbar,
|
|
69
|
-
shortcuts,
|
|
70
|
-
contextMenu,
|
|
71
|
-
formats,
|
|
72
|
-
hasFeature: (feature) => featureIds.has(feature),
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
export const matchesPluginShortcut = (event, shortcut) => event.key.toLowerCase() === shortcut.key.toLowerCase() &&
|
|
76
|
-
(shortcut.primary ? event.metaKey || event.ctrlKey : !event.metaKey && !event.ctrlKey) &&
|
|
77
|
-
event.altKey === Boolean(shortcut.alt) &&
|
|
78
|
-
event.shiftKey === Boolean(shortcut.shift);
|