smartrte-react 1.0.0-beta.1 → 1.0.0-beta.10
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 +45 -0
- package/README.md +99 -0
- package/dist/canonicalEditorRuntime.d.ts +12 -0
- package/dist/canonicalEditorRuntime.js +2 -1
- package/dist/components/CanonicalAuthorityEditor.d.ts +22 -1
- package/dist/components/CanonicalAuthorityEditor.js +271 -57
- package/dist/components/ColorPickerPopover.js +3 -1
- package/dist/components/MediaDetailsPopover.d.ts +35 -0
- package/dist/components/MediaDetailsPopover.js +136 -0
- package/dist/components/MediaManager.js +5 -5
- package/dist/components/MediaOverlay.d.ts +12 -21
- package/dist/components/MediaOverlay.js +129 -64
- package/dist/components/TableBorderPopover.js +3 -1
- package/dist/components/TableResizeHandles.js +22 -0
- package/dist/components/ToolbarPrimitives.d.ts +32 -0
- package/dist/components/ToolbarPrimitives.js +95 -4
- package/dist/components/fixedPositioning.d.ts +25 -0
- package/dist/components/fixedPositioning.js +42 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -0
- package/dist/standalone/classic-editor-embed.js +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +90 -33
- package/dist/toolbarTools.d.ts +95 -0
- package/dist/toolbarTools.js +17 -0
- package/package.json +2 -2
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A named, per-tool toolbar-visibility toggle - "developers should be able
|
|
3
|
+
* to hide tools they don't want their users to see" (e.g. Version History,
|
|
4
|
+
* Review, Video, Audio), without wrapping/overriding the component or
|
|
5
|
+
* patching it with CSS. This is a UI-visibility layer, distinct from and
|
|
6
|
+
* composed with (never replacing) two existing, deeper mechanisms:
|
|
7
|
+
*
|
|
8
|
+
* - `EditorCapabilityPreset` (capabilityPresets.ts) controls real document
|
|
9
|
+
* *capability* - which plugins the schema itself is built with (today,
|
|
10
|
+
* only `table`). Excluding a plugin there already, correctly, hides its
|
|
11
|
+
* toolbar entry (`tablesEnabled`) - this file does not duplicate that.
|
|
12
|
+
* - Provider presence (`mediaProvider`, `versionProvider`, `commentProvider`,
|
|
13
|
+
* `suggestionProvider`) already gates whether a feature can function at
|
|
14
|
+
* all. `tools` never turns a tool ON when its required provider is
|
|
15
|
+
* absent - see `resolveToolbarTools`'s own doc comment.
|
|
16
|
+
*
|
|
17
|
+
* `tools` is for the remaining, larger set of toolbar entries that have no
|
|
18
|
+
* other on/off mechanism at all today (Bold, Italic, Video, Audio, Special
|
|
19
|
+
* characters, Version history, ...) - a host that wants to hide any of
|
|
20
|
+
* these previously had no supported way to do so.
|
|
21
|
+
*
|
|
22
|
+
* Deliberately NOT covered by individual keys (scoping decision, not an
|
|
23
|
+
* oversight): purely contextual actions that only ever act on something
|
|
24
|
+
* already selected - block move/indent, list-item indent/move/restart
|
|
25
|
+
* numbering, table row/column/cell operations, and the selected-media
|
|
26
|
+
* edit/resize/delete actions. None of these have independent product
|
|
27
|
+
* meaning (there is no real case for "let people insert a table but hide
|
|
28
|
+
* its 'Add row' action") - they stay governed solely by their owning
|
|
29
|
+
* top-level tool (`insertTable`, `bulletedList`/`numberedList`/`checklist`,
|
|
30
|
+
* `link`, `image`/`video`/`audio`).
|
|
31
|
+
*/
|
|
32
|
+
export interface ToolbarTools {
|
|
33
|
+
bold: boolean;
|
|
34
|
+
italic: boolean;
|
|
35
|
+
underline: boolean;
|
|
36
|
+
strikethrough: boolean;
|
|
37
|
+
code: boolean;
|
|
38
|
+
superscript: boolean;
|
|
39
|
+
subscript: boolean;
|
|
40
|
+
textColor: boolean;
|
|
41
|
+
backgroundColor: boolean;
|
|
42
|
+
fontSize: boolean;
|
|
43
|
+
fontFamily: boolean;
|
|
44
|
+
/** The Paragraph/Heading 1-6/Code block <select>. */
|
|
45
|
+
blockType: boolean;
|
|
46
|
+
alignLeft: boolean;
|
|
47
|
+
alignCenter: boolean;
|
|
48
|
+
alignRight: boolean;
|
|
49
|
+
alignJustify: boolean;
|
|
50
|
+
/** The line-spacing dropdown (1/1.15/1.5/2/2.5 presets plus a custom value). */
|
|
51
|
+
lineHeight: boolean;
|
|
52
|
+
quote: boolean;
|
|
53
|
+
bulletedList: boolean;
|
|
54
|
+
numberedList: boolean;
|
|
55
|
+
checklist: boolean;
|
|
56
|
+
/** The named multi-level marker preset picker (decimal/alpha/roman/outline/bullet-glyph) - independent of the plain list-type toggles above. */
|
|
57
|
+
listPreset: boolean;
|
|
58
|
+
link: boolean;
|
|
59
|
+
removeLink: boolean;
|
|
60
|
+
/** Requires `mediaProvider` to actually render - see resolveToolbarTools. */
|
|
61
|
+
image: boolean;
|
|
62
|
+
/** Requires `mediaProvider` to actually render - see resolveToolbarTools. */
|
|
63
|
+
video: boolean;
|
|
64
|
+
/** Requires `mediaProvider` to actually render - see resolveToolbarTools. */
|
|
65
|
+
audio: boolean;
|
|
66
|
+
insertFormula: boolean;
|
|
67
|
+
specialCharacters: boolean;
|
|
68
|
+
/** Inserts a `divider` atom (a horizontal rule) - see docs/bugs/ for the toolbar-tools feature this was added alongside. */
|
|
69
|
+
horizontalLine: boolean;
|
|
70
|
+
/** Inserts a `page_break` atom - a print/export pagination marker, distinct from `horizontalLine`. */
|
|
71
|
+
pageBreak: boolean;
|
|
72
|
+
/** Requires the schema to actually have the table plugin (EditorCapabilityPreset) - see resolveToolbarTools. */
|
|
73
|
+
insertTable: boolean;
|
|
74
|
+
import: boolean;
|
|
75
|
+
saveAsHtml: boolean;
|
|
76
|
+
saveAsMarkdown: boolean;
|
|
77
|
+
saveAsWord: boolean;
|
|
78
|
+
saveAsPdf: boolean;
|
|
79
|
+
saveAsSmartRte: boolean;
|
|
80
|
+
/** Requires `versionProvider` to actually render. */
|
|
81
|
+
versionHistory: boolean;
|
|
82
|
+
/** Bundles "Add comment" and the Comments panel toggle - requires `commentProvider` to actually render. */
|
|
83
|
+
comments: boolean;
|
|
84
|
+
/** Bundles Suggest insertion/deletion/removal, the Suggestions panel toggle, and "Show edits" (track changes) - requires `suggestionProvider` to actually render. */
|
|
85
|
+
suggestions: boolean;
|
|
86
|
+
undo: boolean;
|
|
87
|
+
redo: boolean;
|
|
88
|
+
}
|
|
89
|
+
/** Every tool defaults to visible - an existing consumer who never passes `tools` sees 100% unchanged behavior. */
|
|
90
|
+
export declare const DEFAULT_TOOLBAR_TOOLS: ToolbarTools;
|
|
91
|
+
/**
|
|
92
|
+
* Merges a host's partial `tools` override onto the all-enabled default -
|
|
93
|
+
* a host only ever needs to name the tools they want OFF.
|
|
94
|
+
*/
|
|
95
|
+
export declare const resolveToolbarTools: (tools?: Partial<ToolbarTools>) => ToolbarTools;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Every tool defaults to visible - an existing consumer who never passes `tools` sees 100% unchanged behavior. */
|
|
2
|
+
export const DEFAULT_TOOLBAR_TOOLS = {
|
|
3
|
+
bold: true, italic: true, underline: true, strikethrough: true, code: true,
|
|
4
|
+
superscript: true, subscript: true, textColor: true, backgroundColor: true, fontSize: true, fontFamily: true,
|
|
5
|
+
blockType: true, alignLeft: true, alignCenter: true, alignRight: true, alignJustify: true, lineHeight: true, quote: true,
|
|
6
|
+
bulletedList: true, numberedList: true, checklist: true, listPreset: true,
|
|
7
|
+
link: true, removeLink: true, image: true, video: true, audio: true, insertFormula: true, specialCharacters: true,
|
|
8
|
+
horizontalLine: true, pageBreak: true, insertTable: true,
|
|
9
|
+
import: true, saveAsHtml: true, saveAsMarkdown: true, saveAsWord: true, saveAsPdf: true, saveAsSmartRte: true,
|
|
10
|
+
versionHistory: true, comments: true, suggestions: true,
|
|
11
|
+
undo: true, redo: true,
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Merges a host's partial `tools` override onto the all-enabled default -
|
|
15
|
+
* a host only ever needs to name the tools they want OFF.
|
|
16
|
+
*/
|
|
17
|
+
export const resolveToolbarTools = (tools) => ({ ...DEFAULT_TOOLBAR_TOOLS, ...tools });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smartrte-react",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
4
|
"description": "A powerful, feature-rich Rich Text Editor for React with support for tables, mathematical formulas (LaTeX/KaTeX), and media management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"lucide-react": "^1.35.0",
|
|
85
85
|
"mammoth": "^1.11.0",
|
|
86
86
|
"pdfjs-dist": "^5.4.530",
|
|
87
|
-
"smartrte-core": "^1.0.0-beta.
|
|
87
|
+
"smartrte-core": "^1.0.0-beta.5"
|
|
88
88
|
},
|
|
89
89
|
"scripts": {
|
|
90
90
|
"build": "rm -rf dist && tsc -p tsconfig.json",
|