@domternal/core 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -0
- package/dist/index.cjs +398 -86
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +177 -9
- package/dist/index.d.ts +177 -9
- package/dist/index.js +399 -88
- package/dist/index.js.map +1 -1
- package/package.json +12 -14
package/dist/index.d.cts
CHANGED
|
@@ -134,6 +134,16 @@ interface EditorEvents {
|
|
|
134
134
|
notionColorOpen: {
|
|
135
135
|
anchorElement?: HTMLElement | null;
|
|
136
136
|
};
|
|
137
|
+
/**
|
|
138
|
+
* Fired after the document has been marked for printing and before the
|
|
139
|
+
* browser's print dialog opens. Listeners run synchronously: this is the
|
|
140
|
+
* last moment to add page rules or set `document.title`.
|
|
141
|
+
*/
|
|
142
|
+
beforePrint: {
|
|
143
|
+
root: HTMLElement;
|
|
144
|
+
};
|
|
145
|
+
/** Fired once the print dialog is done and the print marks are removed. */
|
|
146
|
+
afterPrint: undefined;
|
|
137
147
|
}
|
|
138
148
|
/**
|
|
139
149
|
* Event names as a type
|
|
@@ -172,6 +182,19 @@ interface AnyExtension {
|
|
|
172
182
|
* - number: Focus at specific position
|
|
173
183
|
*/
|
|
174
184
|
type FocusPosition = boolean | 'start' | 'end' | 'all' | number | null;
|
|
185
|
+
/**
|
|
186
|
+
* The editing experience the editor is assembled for.
|
|
187
|
+
*
|
|
188
|
+
* - 'classic': the default toolbar-driven experience
|
|
189
|
+
* - 'notion': the block-based Notion-style experience; the editor paints
|
|
190
|
+
* `dm-notion-mode` on its `.dm-editor` host, and preset-aware extensions
|
|
191
|
+
* (the bubble menu contexts, the image placement controls) adapt
|
|
192
|
+
*
|
|
193
|
+
* Read the resolved value via `editor.preset`, never this option directly:
|
|
194
|
+
* consumers that predate the option declare Notion mode with the theme
|
|
195
|
+
* class alone, and the getter honors that.
|
|
196
|
+
*/
|
|
197
|
+
type EditorPreset = 'classic' | 'notion';
|
|
175
198
|
/**
|
|
176
199
|
* Configuration options for creating an Editor instance
|
|
177
200
|
*/
|
|
@@ -203,6 +226,15 @@ interface EditorOptions {
|
|
|
203
226
|
* @default true
|
|
204
227
|
*/
|
|
205
228
|
editable?: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Editing experience preset. `'notion'` paints `dm-notion-mode` on the
|
|
231
|
+
* `.dm-editor` host and switches preset-aware extensions to their Notion
|
|
232
|
+
* behavior, so one option replaces setting the class by hand. When omitted,
|
|
233
|
+
* a `dm-notion-mode` class already on the host still counts as Notion;
|
|
234
|
+
* an explicit `'classic'` overrides even that.
|
|
235
|
+
* @default undefined (resolved from the host class, else 'classic')
|
|
236
|
+
*/
|
|
237
|
+
preset?: EditorPreset;
|
|
206
238
|
/**
|
|
207
239
|
* Accessible label for the editor.
|
|
208
240
|
* Sets aria-label on the contenteditable element.
|
|
@@ -481,6 +513,12 @@ interface ToolbarButton {
|
|
|
481
513
|
toolbar?: boolean;
|
|
482
514
|
/** Bubble menu context name. When set, this item is included in the default bubble menu for this context. */
|
|
483
515
|
bubbleMenu?: string;
|
|
516
|
+
/**
|
|
517
|
+
* Keep this button enabled in a read-only editor (view-only actions such
|
|
518
|
+
* as a history panel toggle); by default every button is disabled there.
|
|
519
|
+
* @default false
|
|
520
|
+
*/
|
|
521
|
+
allowReadOnly?: boolean;
|
|
484
522
|
}
|
|
485
523
|
/**
|
|
486
524
|
* A dropdown toolbar item containing multiple buttons.
|
|
@@ -1079,6 +1117,12 @@ declare class Editor extends EventEmitter<EditorEvents> {
|
|
|
1079
1117
|
* True while EditorView's constructor runs; see buildViewDispatch.
|
|
1080
1118
|
*/
|
|
1081
1119
|
private _isViewConstructing;
|
|
1120
|
+
/**
|
|
1121
|
+
* The `.dm-editor` host this editor painted `dm-notion-mode` onto because
|
|
1122
|
+
* of `preset: 'notion'`. Tracked so destroy() removes only a class the
|
|
1123
|
+
* editor itself added, never one the consumer wrote.
|
|
1124
|
+
*/
|
|
1125
|
+
private _presetClassHost;
|
|
1082
1126
|
/**
|
|
1083
1127
|
* Creates a new Editor instance
|
|
1084
1128
|
*
|
|
@@ -1099,6 +1143,26 @@ declare class Editor extends EventEmitter<EditorEvents> {
|
|
|
1099
1143
|
* Checks if the editor is editable
|
|
1100
1144
|
*/
|
|
1101
1145
|
get isEditable(): boolean;
|
|
1146
|
+
/**
|
|
1147
|
+
* The resolved editing-experience preset.
|
|
1148
|
+
*
|
|
1149
|
+
* The `preset` option wins when provided (so an explicit 'classic' can
|
|
1150
|
+
* opt out of everything). Otherwise a `dm-notion-mode` class on or above
|
|
1151
|
+
* the view counts as 'notion': consumers that predate the option declare
|
|
1152
|
+
* Notion mode with the theme class alone, and behavior must follow what
|
|
1153
|
+
* the user actually sees. Resolved on every read, not cached, so a class
|
|
1154
|
+
* toggled at runtime is picked up.
|
|
1155
|
+
*/
|
|
1156
|
+
get preset(): EditorPreset;
|
|
1157
|
+
/**
|
|
1158
|
+
* Paints `dm-notion-mode` on the `.dm-editor` host when the editor was
|
|
1159
|
+
* created with `preset: 'notion'`. Runs during creation, and framework
|
|
1160
|
+
* wrappers call it again after adopting the view's DOM: they construct
|
|
1161
|
+
* the editor in a detached element, so the creation-time run cannot see
|
|
1162
|
+
* the host yet. Idempotent; a no-op for any other preset. Only a class
|
|
1163
|
+
* added here is removed again on destroy.
|
|
1164
|
+
*/
|
|
1165
|
+
adoptPresetClass(): void;
|
|
1102
1166
|
/**
|
|
1103
1167
|
* Checks if the editor content is empty
|
|
1104
1168
|
*/
|
|
@@ -1375,6 +1439,11 @@ interface ExtensionEditor {
|
|
|
1375
1439
|
readonly schema: unknown;
|
|
1376
1440
|
readonly commands: SingleCommands;
|
|
1377
1441
|
readonly isEditable: boolean;
|
|
1442
|
+
/**
|
|
1443
|
+
* Resolved editing-experience preset; see Editor.preset. Optional so
|
|
1444
|
+
* minimal editor mocks keep compiling; treat undefined as 'classic'.
|
|
1445
|
+
*/
|
|
1446
|
+
readonly preset?: EditorPreset;
|
|
1378
1447
|
}
|
|
1379
1448
|
/**
|
|
1380
1449
|
* Any extension type (forward declaration)
|
|
@@ -1743,6 +1812,11 @@ interface NodeEditorContext {
|
|
|
1743
1812
|
nodes: Record<string, NodeType>;
|
|
1744
1813
|
};
|
|
1745
1814
|
readonly commands: Record<string, (...args: unknown[]) => boolean>;
|
|
1815
|
+
/**
|
|
1816
|
+
* Resolved editing-experience preset; see Editor.preset. Optional so
|
|
1817
|
+
* minimal editor mocks keep compiling; treat undefined as 'classic'.
|
|
1818
|
+
*/
|
|
1819
|
+
readonly preset?: EditorPreset;
|
|
1746
1820
|
}
|
|
1747
1821
|
/**
|
|
1748
1822
|
* Context interface for Node config methods.
|
|
@@ -2083,11 +2157,21 @@ interface MarkSchemaProperties {
|
|
|
2083
2157
|
* Marks that this mark excludes (cannot coexist with)
|
|
2084
2158
|
*
|
|
2085
2159
|
* - '_' excludes all marks
|
|
2086
|
-
* - Space-separated mark names exclude
|
|
2160
|
+
* - Space-separated mark names or group names exclude those marks
|
|
2087
2161
|
* - Empty string or undefined means no exclusions
|
|
2088
2162
|
*
|
|
2163
|
+
* Note: mark NAMES listed here must exist in the schema or schema
|
|
2164
|
+
* compilation throws, so extensions meant to work in minimal setups
|
|
2165
|
+
* should exclude by group. The core formatting marks (bold, italic,
|
|
2166
|
+
* underline, strike, code, sub/superscript, textStyle) all declare
|
|
2167
|
+
* group 'formatting', and Code excludes that group: a third-party
|
|
2168
|
+
* formatting mark joins the exclusion by declaring the same group,
|
|
2169
|
+
* while semantic marks (link, comment anchors) stay combinable with
|
|
2170
|
+
* code by staying out of it.
|
|
2171
|
+
*
|
|
2089
2172
|
* @example 'code' - excludes code mark
|
|
2090
2173
|
* @example 'bold italic' - excludes bold and italic
|
|
2174
|
+
* @example 'formatting' - excludes the formatting group
|
|
2091
2175
|
* @example '_' - excludes all other marks
|
|
2092
2176
|
*/
|
|
2093
2177
|
excludes?: string;
|
|
@@ -2098,6 +2182,17 @@ interface MarkSchemaProperties {
|
|
|
2098
2182
|
* @example 'formatting', 'inline'
|
|
2099
2183
|
*/
|
|
2100
2184
|
group?: string;
|
|
2185
|
+
/**
|
|
2186
|
+
* Whether block duplication keeps this mark on the copied content
|
|
2187
|
+
*
|
|
2188
|
+
* Set false for marks that reference identity-bearing external state
|
|
2189
|
+
* (a comment thread anchor, a suggestion id): duplicating such a mark
|
|
2190
|
+
* would make one identity point at two unrelated places, so block
|
|
2191
|
+
* duplicate strips it from the copy instead.
|
|
2192
|
+
*
|
|
2193
|
+
* @default true
|
|
2194
|
+
*/
|
|
2195
|
+
keepOnDuplicate?: boolean;
|
|
2101
2196
|
/**
|
|
2102
2197
|
* Whether this mark can span multiple nodes
|
|
2103
2198
|
*
|
|
@@ -2565,6 +2660,18 @@ interface PositionFloatingOptions {
|
|
|
2565
2660
|
* otherwise cover app chrome above the editor) pass the wrapper here.
|
|
2566
2661
|
*/
|
|
2567
2662
|
boundary?: Element;
|
|
2663
|
+
/**
|
|
2664
|
+
* Shrink-to-fit for vertical placements: writes the available space (px)
|
|
2665
|
+
* to the `--dm-available-height` custom property on the element; the
|
|
2666
|
+
* stylesheet opts in with e.g.
|
|
2667
|
+
* `max-height: min(22rem, var(--dm-available-height, 100vh))` plus
|
|
2668
|
+
* `box-sizing: border-box`. The element stays on the preferred side while
|
|
2669
|
+
* at least `minHeight` px fit there, then flips to the opposite side.
|
|
2670
|
+
*/
|
|
2671
|
+
constrainHeight?: {
|
|
2672
|
+
/** Smallest useful height in px before flipping to the opposite side. */
|
|
2673
|
+
minHeight: number;
|
|
2674
|
+
};
|
|
2568
2675
|
}
|
|
2569
2676
|
/**
|
|
2570
2677
|
* Positions a floating element relative to a reference element or virtual rect,
|
|
@@ -2696,11 +2803,10 @@ declare function refocusEditorAfterCommand(view: {
|
|
|
2696
2803
|
|
|
2697
2804
|
/**
|
|
2698
2805
|
* Default `contexts` map for a bubble menu when the consumer has not
|
|
2699
|
-
* supplied one. Returns a richer item set when the editor
|
|
2700
|
-
*
|
|
2701
|
-
*
|
|
2702
|
-
*
|
|
2703
|
-
* and `textAlign`.
|
|
2806
|
+
* supplied one. Returns a richer item set when the editor resolves to the
|
|
2807
|
+
* Notion preset (the `preset` option, or the `.dm-notion-mode` class the
|
|
2808
|
+
* getter also honors), so the bubble menu mirrors the Notion UX by leading
|
|
2809
|
+
* with `ai` and including `link` and `textAlign`.
|
|
2704
2810
|
*
|
|
2705
2811
|
* Consumers can always override by passing their own `contexts` prop.
|
|
2706
2812
|
*/
|
|
@@ -3745,6 +3851,8 @@ declare class Node<Options = unknown, Storage = unknown> extends Extension<Optio
|
|
|
3745
3851
|
interface ToolbarControllerEditor {
|
|
3746
3852
|
readonly toolbarItems: ToolbarItem[];
|
|
3747
3853
|
readonly storage: Record<string, unknown>;
|
|
3854
|
+
/** Read-only editors disable every button without allowReadOnly. */
|
|
3855
|
+
readonly isEditable: boolean;
|
|
3748
3856
|
isActive(nameOrAttributes: string | {
|
|
3749
3857
|
name: string;
|
|
3750
3858
|
attributes?: Record<string, unknown>;
|
|
@@ -3902,6 +4010,10 @@ interface FloatingMenuGroup {
|
|
|
3902
4010
|
* order of groups. Within each group, items are sorted by `priority`
|
|
3903
4011
|
* descending (higher first, default 100).
|
|
3904
4012
|
*
|
|
4013
|
+
* An item with NO group leads: declining a category marks a primary action,
|
|
4014
|
+
* and insertion order would file it last, since whatever adds one loads after
|
|
4015
|
+
* the extensions defining the categories. Renderers give it no heading.
|
|
4016
|
+
*
|
|
3905
4017
|
* Shared between `FloatingMenuController` (which renders grouped item lists
|
|
3906
4018
|
* for FloatingMenu + framework wrappers) and `createSlashSuggestionRenderer`
|
|
3907
4019
|
* (the popup shown by SlashCommand). Having one implementation keeps visual
|
|
@@ -5741,7 +5853,7 @@ declare const uniqueIDPluginKey: PluginKey<any>;
|
|
|
5741
5853
|
interface UniqueIDOptions {
|
|
5742
5854
|
/**
|
|
5743
5855
|
* Node types that should receive unique IDs.
|
|
5744
|
-
* @default ['paragraph', 'heading', 'blockquote', 'codeBlock', 'bulletList', 'orderedList', 'taskList', 'listItem', 'taskItem', 'image', 'horizontalRule']
|
|
5856
|
+
* @default ['paragraph', 'heading', 'blockquote', 'codeBlock', 'bulletList', 'orderedList', 'taskList', 'listItem', 'taskItem', 'image', 'horizontalRule', 'table']
|
|
5745
5857
|
*/
|
|
5746
5858
|
types: string[];
|
|
5747
5859
|
/**
|
|
@@ -6283,6 +6395,62 @@ declare const NotionColorPicker: Extension<NotionColorPickerOptions, NotionColor
|
|
|
6283
6395
|
|
|
6284
6396
|
declare const ClearFormatting: Extension<unknown, unknown>;
|
|
6285
6397
|
|
|
6398
|
+
/**
|
|
6399
|
+
* Print Extension
|
|
6400
|
+
*
|
|
6401
|
+
* Sends the document to the browser's own print dialog, which is also the
|
|
6402
|
+
* one place a reader can save a PDF that looks exactly like the editor:
|
|
6403
|
+
* the same engine paints both, so floats, columns and fonts survive
|
|
6404
|
+
* untouched. What it cannot do is hand a file back to code, so it
|
|
6405
|
+
* complements a file exporter rather than replacing one.
|
|
6406
|
+
*
|
|
6407
|
+
* The paper styling itself lives in `@domternal/theme` (`_print.scss`) and
|
|
6408
|
+
* applies to the reader's own Ctrl/Cmd+P with no code involved. This
|
|
6409
|
+
* extension adds the two things CSS cannot do on its own: a button, and
|
|
6410
|
+
* isolating the document from the host application's chrome.
|
|
6411
|
+
*
|
|
6412
|
+
* @example
|
|
6413
|
+
* ```ts
|
|
6414
|
+
* import { Print } from '@domternal/core';
|
|
6415
|
+
*
|
|
6416
|
+
* const editor = new Editor({ extensions: [Print] });
|
|
6417
|
+
* editor.commands.printDocument();
|
|
6418
|
+
* ```
|
|
6419
|
+
*/
|
|
6420
|
+
|
|
6421
|
+
interface PrintOptions {
|
|
6422
|
+
/** Show the toolbar button. @default true */
|
|
6423
|
+
toolbar: boolean;
|
|
6424
|
+
/**
|
|
6425
|
+
* Resolve the element to print. Defaults to the editor's `.dm-editor`
|
|
6426
|
+
* wrapper, falling back to the ProseMirror element itself.
|
|
6427
|
+
*/
|
|
6428
|
+
root: ((editor: ExtensionEditor) => HTMLElement | null) | null;
|
|
6429
|
+
/**
|
|
6430
|
+
* Also isolate the document when the reader presses Ctrl/Cmd+P instead of
|
|
6431
|
+
* using the command.
|
|
6432
|
+
*
|
|
6433
|
+
* Off by default, and deliberately: isolating means erasing everything
|
|
6434
|
+
* else on the page. That is obviously right for an app that IS the
|
|
6435
|
+
* editor, and obviously wrong for an article with an editor embedded in
|
|
6436
|
+
* it, and only the host knows which one it is. With it off, a native
|
|
6437
|
+
* print still gets the whole paper stylesheet, just not the erasure.
|
|
6438
|
+
*
|
|
6439
|
+
* @default false
|
|
6440
|
+
*/
|
|
6441
|
+
isolateNativePrint: boolean;
|
|
6442
|
+
}
|
|
6443
|
+
interface PrintStorage {
|
|
6444
|
+
/** Removes the native print listeners; set only when they were attached. */
|
|
6445
|
+
cleanup: (() => void) | null;
|
|
6446
|
+
}
|
|
6447
|
+
declare const Print: Extension<PrintOptions, PrintStorage>;
|
|
6448
|
+
declare module '@domternal/core' {
|
|
6449
|
+
interface RawCommands {
|
|
6450
|
+
printDocument: CommandSpec;
|
|
6451
|
+
}
|
|
6452
|
+
}
|
|
6453
|
+
|
|
6286
6454
|
interface LinkPopoverOptions {
|
|
6287
6455
|
/**
|
|
6288
6456
|
* List of allowed URL protocols (should match Link mark's protocols)
|
|
@@ -6482,6 +6650,6 @@ declare const StarterKit: Extension<StarterKitOptions, unknown>;
|
|
|
6482
6650
|
* @domternal/core
|
|
6483
6651
|
* Framework-agnostic ProseMirror editor engine
|
|
6484
6652
|
*/
|
|
6485
|
-
declare const VERSION = "0.
|
|
6653
|
+
declare const VERSION = "0.15.0";
|
|
6486
6654
|
|
|
6487
|
-
export { type AnyExtension, type AnyExtensionConfig, type AttributeSpec, type AttributeSpecs, type AutolinkPluginOptions, BaseKeymap, type BaseKeymapOptions, BlockColor, type BlockColorOptions, Blockquote, type BlockquoteOptions, Bold, type BoldOptions, BubbleMenu, type BubbleMenuOptions, type BuildCommandPropsOptions, BulletList, type BulletListOptions, type CanChainedCommands, CanChecker, type CanCheckerEditor, type CanCheckerOptions, type CanCommands, ChainBuilder, type ChainBuilderEditor, type ChainBuilderOptions, type ChainFailure, type ChainedCommands, CharacterCount, type CharacterCountOptions, type CharacterCountStorage, type ClearContentOptions, ClearFormatting, Code, CodeBlock, type CodeBlockOptions, type CodeOptions, type Command, type CommandEditor, CommandManager, type CommandManagerEditor, type CommandMap, type CommandProps, type CommandPropsEditor, type CommandSpec, type Content, type ContentErrorProps, type CreateBubbleMenuPluginOptions, type CreateDocumentOptions, type CreateEventProps, type CreateFloatingMenuPluginOptions, DEFAULT_BLOCK_COLORS, DEFAULT_BLOCK_COLOR_TYPES, DEFAULT_HIGHLIGHT_COLORS, DEFAULT_NOTION_COLOR_PALETTE, DEFAULT_TEXT_COLORS, Document$1 as Document, Dropcursor, type DropcursorOptions, Editor, type EditorEventName, type EditorEvents, type EditorInstance, type EditorOptions, EventEmitter, Extension, type ExtensionConfig, ExtensionConfigurationError, type ExtensionEditor, ExtensionManager, type ExtensionManagerEditor, type ExtensionManagerOptions, FLOATING_MENU_META, FLOATING_MENU_NO_FOCUS, type FindChildResult, type FindParentNodeResult, FloatingMenuController, type FloatingMenuGroup, type FloatingMenuItem, type FloatingMenuItemsOverride, type FloatingMenuKeymap, type FloatingMenuOptions, Focus, type FocusEventProps, type FocusOptions, type FocusPosition, FontFamily, type FontFamilyOptions, FontSize, type FontSizeOptions, Gapcursor, type GenerateHTMLOptions, type GenerateJSONOptions, type GenerateTextOptions, type GlobalAttributeSpec, type GlobalAttributes, HardBreak, type HardBreakOptions, Heading, type HeadingOptions, Highlight, type HighlightOptions, History, type HistoryOptions, HorizontalRule, type HorizontalRuleOptions, type IconSet, type InlineStyleOverrides, type InsertAsListItemChildArgs, type InsertAsListItemChildResult, InvisibleChars, type InvisibleCharsOptions, type InvisibleCharsStorage, type IsNodeEmptyOptions, type IsValidUrlOptions, Italic, type ItalicOptions, type JSONAttribute, type JSONContent, type JSONMark, type KeyboardShortcutCommand, LIST_ITEM_TYPE_NAMES, LineHeight, type LineHeightOptions, Link, type LinkAttributes, type LinkClickPluginOptions, type LinkExitPluginOptions, type LinkOptions, type LinkPastePluginOptions, LinkPopover, type LinkPopoverOptions, ListIndent, ListItem, type ListItemCursorContext, type ListItemOptions, ListKeymap, type ListKeymapOptions, Mark, type MarkConfig, type MarkInputRuleOptions, type MarkParseRule, type MarkRange, type MarkRenderHTMLProps, type MountEventProps, Node, type NodeConfig, type NodeInputRuleOptions, type NodeParseRule, type NodeRenderHTMLProps, type NodeViewContext, NotionColorPicker, type NotionColorPickerOptions, type NotionColorPickerStorage, OrderedList, type OrderedListOptions, Paragraph, type ParagraphOptions, Placeholder, type PlaceholderOptions, type PositionFloatingOptions, type Range, type RawCommands, Selection, SelectionDecoration, type SelectionDecorationOptions, type SelectionOptions, type SelectionStorage, type SetContentOptions, type SingleCommands, type SplitListForInsertRange, StarterKit, type StarterKitOptions, Strike, type StrikeOptions, Subscript, type SubscriptOptions, Superscript, type SuperscriptOptions, TaskItem, type TaskItemOptions, TaskList, type TaskListOptions, Text, TextAlign, type TextAlignOptions, TextColor, type TextColorOptions, type TextInputRuleOptions, TextStyle, type TextStyleOptions, type TextblockTypeInputRuleOptions, type ToolbarButton, ToolbarController, type ToolbarControllerEditor, type ToolbarDropdown, type ToolbarGroup, type ToolbarItem, type ToolbarLayoutDropdown, type ToolbarLayoutEntry, type ToolbarSeparator, TrailingNode, type TrailingNodeOptions, type TransactionEventProps, Typography, type TypographyOptions, Underline, type UnderlineOptions, UniqueID, type UniqueIDOptions, VERSION, type WrappingInputRuleOptions, announce, applyInlineStyles, autolinkPlugin, autolinkPluginKey, blur, bubbleMenuPluginKey, buildCommandProps, builtInCommands, callOrReturn, characterCountPluginKey, clearContent, copyThemeClass, createAccumulatingDispatch, createBubbleMenuPlugin, createCanChecker, createChainBuilder, createDocument, createFloatingMenuPlugin, defaultBlockAt, defaultBubbleContexts, defaultFloatingMenuShouldShow, defaultIcons, deleteSelection, findChildren, findListItemAncestorDepth, findParentNode, floatingMenuPluginKey, focus, focusPluginKey, generateHTML, generateJSON, generateText, getListItemCursorContext, getMarkRange, groupFloatingMenuItems, hideFloatingMenu, indentBlockAsListChild, inlineStyles, insertAsListItemChild, insertChildrenZoneSibling, insertContent, insertText, invisibleCharsPluginKey, isDocumentEmpty, isInListItemLabel, isInsideListItem, isNodeEmpty, isValidUrl, lift, liftCurrentListItem, liftEmptyChildrenZoneParagraph, linkClickPlugin, linkClickPluginKey, linkExitPlugin, linkExitPluginKey, linkPastePlugin, linkPastePluginKey, markInputRule, markInputRulePatterns, nodeInputRule, outdentBlockFromListItem, placeholderPluginKey, positionFloating, positionFloatingOnce, refocusEditorAfterCommand, resetAttributes, selectAll, selectNodeBackward, selectionDecorationPluginKey, setBlockType, setContent, setMark, showFloatingMenu, splitListForInsert, stripInlineColorConflicts, textInputRule, textblockTypeInputRule, toggleBlockType, toggleList, toggleMark, toggleWrap, uniqueIDPluginKey, unsetAllMarks, unsetMark, updateAttributes, wrapIn, wrappingInputRule, writeToClipboard };
|
|
6655
|
+
export { type AnyExtension, type AnyExtensionConfig, type AttributeSpec, type AttributeSpecs, type AutolinkPluginOptions, BaseKeymap, type BaseKeymapOptions, BlockColor, type BlockColorOptions, Blockquote, type BlockquoteOptions, Bold, type BoldOptions, BubbleMenu, type BubbleMenuOptions, type BuildCommandPropsOptions, BulletList, type BulletListOptions, type CanChainedCommands, CanChecker, type CanCheckerEditor, type CanCheckerOptions, type CanCommands, ChainBuilder, type ChainBuilderEditor, type ChainBuilderOptions, type ChainFailure, type ChainedCommands, CharacterCount, type CharacterCountOptions, type CharacterCountStorage, type ClearContentOptions, ClearFormatting, Code, CodeBlock, type CodeBlockOptions, type CodeOptions, type Command, type CommandEditor, CommandManager, type CommandManagerEditor, type CommandMap, type CommandProps, type CommandPropsEditor, type CommandSpec, type Content, type ContentErrorProps, type CreateBubbleMenuPluginOptions, type CreateDocumentOptions, type CreateEventProps, type CreateFloatingMenuPluginOptions, DEFAULT_BLOCK_COLORS, DEFAULT_BLOCK_COLOR_TYPES, DEFAULT_HIGHLIGHT_COLORS, DEFAULT_NOTION_COLOR_PALETTE, DEFAULT_TEXT_COLORS, Document$1 as Document, Dropcursor, type DropcursorOptions, Editor, type EditorEventName, type EditorEvents, type EditorInstance, type EditorOptions, type EditorPreset, EventEmitter, Extension, type ExtensionConfig, type ExtensionConfigBase, ExtensionConfigurationError, type ExtensionEditor, ExtensionManager, type ExtensionManagerEditor, type ExtensionManagerOptions, FLOATING_MENU_META, FLOATING_MENU_NO_FOCUS, type FindChildResult, type FindParentNodeResult, FloatingMenuController, type FloatingMenuGroup, type FloatingMenuItem, type FloatingMenuItemsOverride, type FloatingMenuKeymap, type FloatingMenuOptions, Focus, type FocusEventProps, type FocusOptions, type FocusPosition, FontFamily, type FontFamilyOptions, FontSize, type FontSizeOptions, Gapcursor, type GenerateHTMLOptions, type GenerateJSONOptions, type GenerateTextOptions, type GlobalAttributeSpec, type GlobalAttributes, HardBreak, type HardBreakOptions, Heading, type HeadingOptions, Highlight, type HighlightOptions, History, type HistoryOptions, HorizontalRule, type HorizontalRuleOptions, type IconSet, type InlineStyleOverrides, type InsertAsListItemChildArgs, type InsertAsListItemChildResult, InvisibleChars, type InvisibleCharsOptions, type InvisibleCharsStorage, type IsNodeEmptyOptions, type IsValidUrlOptions, Italic, type ItalicOptions, type JSONAttribute, type JSONContent, type JSONMark, type KeyboardShortcutCommand, LIST_ITEM_TYPE_NAMES, LineHeight, type LineHeightOptions, Link, type LinkAttributes, type LinkClickPluginOptions, type LinkExitPluginOptions, type LinkOptions, type LinkPastePluginOptions, LinkPopover, type LinkPopoverOptions, ListIndent, ListItem, type ListItemCursorContext, type ListItemOptions, ListKeymap, type ListKeymapOptions, Mark, type MarkConfig, type MarkInputRuleOptions, type MarkParseRule, type MarkRange, type MarkRenderHTMLProps, type MountEventProps, Node, type NodeConfig, type NodeInputRuleOptions, type NodeParseRule, type NodeRenderHTMLProps, type NodeViewContext, NotionColorPicker, type NotionColorPickerOptions, type NotionColorPickerStorage, OrderedList, type OrderedListOptions, Paragraph, type ParagraphOptions, Placeholder, type PlaceholderOptions, type PositionFloatingOptions, Print, type PrintOptions, type PrintStorage, type Range, type RawCommands, Selection, SelectionDecoration, type SelectionDecorationOptions, type SelectionOptions, type SelectionStorage, type SetContentOptions, type SingleCommands, type SplitListForInsertRange, StarterKit, type StarterKitOptions, Strike, type StrikeOptions, Subscript, type SubscriptOptions, Superscript, type SuperscriptOptions, TaskItem, type TaskItemOptions, TaskList, type TaskListOptions, Text, TextAlign, type TextAlignOptions, TextColor, type TextColorOptions, type TextInputRuleOptions, TextStyle, type TextStyleOptions, type TextblockTypeInputRuleOptions, type ToolbarButton, ToolbarController, type ToolbarControllerEditor, type ToolbarDropdown, type ToolbarGroup, type ToolbarItem, type ToolbarLayoutDropdown, type ToolbarLayoutEntry, type ToolbarSeparator, TrailingNode, type TrailingNodeOptions, type TransactionEventProps, Typography, type TypographyOptions, Underline, type UnderlineOptions, UniqueID, type UniqueIDOptions, VERSION, type WrappingInputRuleOptions, announce, applyInlineStyles, autolinkPlugin, autolinkPluginKey, blur, bubbleMenuPluginKey, buildCommandProps, builtInCommands, callOrReturn, characterCountPluginKey, clearContent, copyThemeClass, createAccumulatingDispatch, createBubbleMenuPlugin, createCanChecker, createChainBuilder, createDocument, createFloatingMenuPlugin, defaultBlockAt, defaultBubbleContexts, defaultFloatingMenuShouldShow, defaultIcons, deleteSelection, findChildren, findListItemAncestorDepth, findParentNode, floatingMenuPluginKey, focus, focusPluginKey, generateHTML, generateJSON, generateText, getListItemCursorContext, getMarkRange, groupFloatingMenuItems, hideFloatingMenu, indentBlockAsListChild, inlineStyles, insertAsListItemChild, insertChildrenZoneSibling, insertContent, insertText, invisibleCharsPluginKey, isDocumentEmpty, isInListItemLabel, isInsideListItem, isNodeEmpty, isValidUrl, lift, liftCurrentListItem, liftEmptyChildrenZoneParagraph, linkClickPlugin, linkClickPluginKey, linkExitPlugin, linkExitPluginKey, linkPastePlugin, linkPastePluginKey, markInputRule, markInputRulePatterns, nodeInputRule, outdentBlockFromListItem, placeholderPluginKey, positionFloating, positionFloatingOnce, refocusEditorAfterCommand, resetAttributes, selectAll, selectNodeBackward, selectionDecorationPluginKey, setBlockType, setContent, setMark, showFloatingMenu, splitListForInsert, stripInlineColorConflicts, textInputRule, textblockTypeInputRule, toggleBlockType, toggleList, toggleMark, toggleWrap, uniqueIDPluginKey, unsetAllMarks, unsetMark, updateAttributes, wrapIn, wrappingInputRule, writeToClipboard };
|
package/dist/index.d.ts
CHANGED
|
@@ -134,6 +134,16 @@ interface EditorEvents {
|
|
|
134
134
|
notionColorOpen: {
|
|
135
135
|
anchorElement?: HTMLElement | null;
|
|
136
136
|
};
|
|
137
|
+
/**
|
|
138
|
+
* Fired after the document has been marked for printing and before the
|
|
139
|
+
* browser's print dialog opens. Listeners run synchronously: this is the
|
|
140
|
+
* last moment to add page rules or set `document.title`.
|
|
141
|
+
*/
|
|
142
|
+
beforePrint: {
|
|
143
|
+
root: HTMLElement;
|
|
144
|
+
};
|
|
145
|
+
/** Fired once the print dialog is done and the print marks are removed. */
|
|
146
|
+
afterPrint: undefined;
|
|
137
147
|
}
|
|
138
148
|
/**
|
|
139
149
|
* Event names as a type
|
|
@@ -172,6 +182,19 @@ interface AnyExtension {
|
|
|
172
182
|
* - number: Focus at specific position
|
|
173
183
|
*/
|
|
174
184
|
type FocusPosition = boolean | 'start' | 'end' | 'all' | number | null;
|
|
185
|
+
/**
|
|
186
|
+
* The editing experience the editor is assembled for.
|
|
187
|
+
*
|
|
188
|
+
* - 'classic': the default toolbar-driven experience
|
|
189
|
+
* - 'notion': the block-based Notion-style experience; the editor paints
|
|
190
|
+
* `dm-notion-mode` on its `.dm-editor` host, and preset-aware extensions
|
|
191
|
+
* (the bubble menu contexts, the image placement controls) adapt
|
|
192
|
+
*
|
|
193
|
+
* Read the resolved value via `editor.preset`, never this option directly:
|
|
194
|
+
* consumers that predate the option declare Notion mode with the theme
|
|
195
|
+
* class alone, and the getter honors that.
|
|
196
|
+
*/
|
|
197
|
+
type EditorPreset = 'classic' | 'notion';
|
|
175
198
|
/**
|
|
176
199
|
* Configuration options for creating an Editor instance
|
|
177
200
|
*/
|
|
@@ -203,6 +226,15 @@ interface EditorOptions {
|
|
|
203
226
|
* @default true
|
|
204
227
|
*/
|
|
205
228
|
editable?: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Editing experience preset. `'notion'` paints `dm-notion-mode` on the
|
|
231
|
+
* `.dm-editor` host and switches preset-aware extensions to their Notion
|
|
232
|
+
* behavior, so one option replaces setting the class by hand. When omitted,
|
|
233
|
+
* a `dm-notion-mode` class already on the host still counts as Notion;
|
|
234
|
+
* an explicit `'classic'` overrides even that.
|
|
235
|
+
* @default undefined (resolved from the host class, else 'classic')
|
|
236
|
+
*/
|
|
237
|
+
preset?: EditorPreset;
|
|
206
238
|
/**
|
|
207
239
|
* Accessible label for the editor.
|
|
208
240
|
* Sets aria-label on the contenteditable element.
|
|
@@ -481,6 +513,12 @@ interface ToolbarButton {
|
|
|
481
513
|
toolbar?: boolean;
|
|
482
514
|
/** Bubble menu context name. When set, this item is included in the default bubble menu for this context. */
|
|
483
515
|
bubbleMenu?: string;
|
|
516
|
+
/**
|
|
517
|
+
* Keep this button enabled in a read-only editor (view-only actions such
|
|
518
|
+
* as a history panel toggle); by default every button is disabled there.
|
|
519
|
+
* @default false
|
|
520
|
+
*/
|
|
521
|
+
allowReadOnly?: boolean;
|
|
484
522
|
}
|
|
485
523
|
/**
|
|
486
524
|
* A dropdown toolbar item containing multiple buttons.
|
|
@@ -1079,6 +1117,12 @@ declare class Editor extends EventEmitter<EditorEvents> {
|
|
|
1079
1117
|
* True while EditorView's constructor runs; see buildViewDispatch.
|
|
1080
1118
|
*/
|
|
1081
1119
|
private _isViewConstructing;
|
|
1120
|
+
/**
|
|
1121
|
+
* The `.dm-editor` host this editor painted `dm-notion-mode` onto because
|
|
1122
|
+
* of `preset: 'notion'`. Tracked so destroy() removes only a class the
|
|
1123
|
+
* editor itself added, never one the consumer wrote.
|
|
1124
|
+
*/
|
|
1125
|
+
private _presetClassHost;
|
|
1082
1126
|
/**
|
|
1083
1127
|
* Creates a new Editor instance
|
|
1084
1128
|
*
|
|
@@ -1099,6 +1143,26 @@ declare class Editor extends EventEmitter<EditorEvents> {
|
|
|
1099
1143
|
* Checks if the editor is editable
|
|
1100
1144
|
*/
|
|
1101
1145
|
get isEditable(): boolean;
|
|
1146
|
+
/**
|
|
1147
|
+
* The resolved editing-experience preset.
|
|
1148
|
+
*
|
|
1149
|
+
* The `preset` option wins when provided (so an explicit 'classic' can
|
|
1150
|
+
* opt out of everything). Otherwise a `dm-notion-mode` class on or above
|
|
1151
|
+
* the view counts as 'notion': consumers that predate the option declare
|
|
1152
|
+
* Notion mode with the theme class alone, and behavior must follow what
|
|
1153
|
+
* the user actually sees. Resolved on every read, not cached, so a class
|
|
1154
|
+
* toggled at runtime is picked up.
|
|
1155
|
+
*/
|
|
1156
|
+
get preset(): EditorPreset;
|
|
1157
|
+
/**
|
|
1158
|
+
* Paints `dm-notion-mode` on the `.dm-editor` host when the editor was
|
|
1159
|
+
* created with `preset: 'notion'`. Runs during creation, and framework
|
|
1160
|
+
* wrappers call it again after adopting the view's DOM: they construct
|
|
1161
|
+
* the editor in a detached element, so the creation-time run cannot see
|
|
1162
|
+
* the host yet. Idempotent; a no-op for any other preset. Only a class
|
|
1163
|
+
* added here is removed again on destroy.
|
|
1164
|
+
*/
|
|
1165
|
+
adoptPresetClass(): void;
|
|
1102
1166
|
/**
|
|
1103
1167
|
* Checks if the editor content is empty
|
|
1104
1168
|
*/
|
|
@@ -1375,6 +1439,11 @@ interface ExtensionEditor {
|
|
|
1375
1439
|
readonly schema: unknown;
|
|
1376
1440
|
readonly commands: SingleCommands;
|
|
1377
1441
|
readonly isEditable: boolean;
|
|
1442
|
+
/**
|
|
1443
|
+
* Resolved editing-experience preset; see Editor.preset. Optional so
|
|
1444
|
+
* minimal editor mocks keep compiling; treat undefined as 'classic'.
|
|
1445
|
+
*/
|
|
1446
|
+
readonly preset?: EditorPreset;
|
|
1378
1447
|
}
|
|
1379
1448
|
/**
|
|
1380
1449
|
* Any extension type (forward declaration)
|
|
@@ -1743,6 +1812,11 @@ interface NodeEditorContext {
|
|
|
1743
1812
|
nodes: Record<string, NodeType>;
|
|
1744
1813
|
};
|
|
1745
1814
|
readonly commands: Record<string, (...args: unknown[]) => boolean>;
|
|
1815
|
+
/**
|
|
1816
|
+
* Resolved editing-experience preset; see Editor.preset. Optional so
|
|
1817
|
+
* minimal editor mocks keep compiling; treat undefined as 'classic'.
|
|
1818
|
+
*/
|
|
1819
|
+
readonly preset?: EditorPreset;
|
|
1746
1820
|
}
|
|
1747
1821
|
/**
|
|
1748
1822
|
* Context interface for Node config methods.
|
|
@@ -2083,11 +2157,21 @@ interface MarkSchemaProperties {
|
|
|
2083
2157
|
* Marks that this mark excludes (cannot coexist with)
|
|
2084
2158
|
*
|
|
2085
2159
|
* - '_' excludes all marks
|
|
2086
|
-
* - Space-separated mark names exclude
|
|
2160
|
+
* - Space-separated mark names or group names exclude those marks
|
|
2087
2161
|
* - Empty string or undefined means no exclusions
|
|
2088
2162
|
*
|
|
2163
|
+
* Note: mark NAMES listed here must exist in the schema or schema
|
|
2164
|
+
* compilation throws, so extensions meant to work in minimal setups
|
|
2165
|
+
* should exclude by group. The core formatting marks (bold, italic,
|
|
2166
|
+
* underline, strike, code, sub/superscript, textStyle) all declare
|
|
2167
|
+
* group 'formatting', and Code excludes that group: a third-party
|
|
2168
|
+
* formatting mark joins the exclusion by declaring the same group,
|
|
2169
|
+
* while semantic marks (link, comment anchors) stay combinable with
|
|
2170
|
+
* code by staying out of it.
|
|
2171
|
+
*
|
|
2089
2172
|
* @example 'code' - excludes code mark
|
|
2090
2173
|
* @example 'bold italic' - excludes bold and italic
|
|
2174
|
+
* @example 'formatting' - excludes the formatting group
|
|
2091
2175
|
* @example '_' - excludes all other marks
|
|
2092
2176
|
*/
|
|
2093
2177
|
excludes?: string;
|
|
@@ -2098,6 +2182,17 @@ interface MarkSchemaProperties {
|
|
|
2098
2182
|
* @example 'formatting', 'inline'
|
|
2099
2183
|
*/
|
|
2100
2184
|
group?: string;
|
|
2185
|
+
/**
|
|
2186
|
+
* Whether block duplication keeps this mark on the copied content
|
|
2187
|
+
*
|
|
2188
|
+
* Set false for marks that reference identity-bearing external state
|
|
2189
|
+
* (a comment thread anchor, a suggestion id): duplicating such a mark
|
|
2190
|
+
* would make one identity point at two unrelated places, so block
|
|
2191
|
+
* duplicate strips it from the copy instead.
|
|
2192
|
+
*
|
|
2193
|
+
* @default true
|
|
2194
|
+
*/
|
|
2195
|
+
keepOnDuplicate?: boolean;
|
|
2101
2196
|
/**
|
|
2102
2197
|
* Whether this mark can span multiple nodes
|
|
2103
2198
|
*
|
|
@@ -2565,6 +2660,18 @@ interface PositionFloatingOptions {
|
|
|
2565
2660
|
* otherwise cover app chrome above the editor) pass the wrapper here.
|
|
2566
2661
|
*/
|
|
2567
2662
|
boundary?: Element;
|
|
2663
|
+
/**
|
|
2664
|
+
* Shrink-to-fit for vertical placements: writes the available space (px)
|
|
2665
|
+
* to the `--dm-available-height` custom property on the element; the
|
|
2666
|
+
* stylesheet opts in with e.g.
|
|
2667
|
+
* `max-height: min(22rem, var(--dm-available-height, 100vh))` plus
|
|
2668
|
+
* `box-sizing: border-box`. The element stays on the preferred side while
|
|
2669
|
+
* at least `minHeight` px fit there, then flips to the opposite side.
|
|
2670
|
+
*/
|
|
2671
|
+
constrainHeight?: {
|
|
2672
|
+
/** Smallest useful height in px before flipping to the opposite side. */
|
|
2673
|
+
minHeight: number;
|
|
2674
|
+
};
|
|
2568
2675
|
}
|
|
2569
2676
|
/**
|
|
2570
2677
|
* Positions a floating element relative to a reference element or virtual rect,
|
|
@@ -2696,11 +2803,10 @@ declare function refocusEditorAfterCommand(view: {
|
|
|
2696
2803
|
|
|
2697
2804
|
/**
|
|
2698
2805
|
* Default `contexts` map for a bubble menu when the consumer has not
|
|
2699
|
-
* supplied one. Returns a richer item set when the editor
|
|
2700
|
-
*
|
|
2701
|
-
*
|
|
2702
|
-
*
|
|
2703
|
-
* and `textAlign`.
|
|
2806
|
+
* supplied one. Returns a richer item set when the editor resolves to the
|
|
2807
|
+
* Notion preset (the `preset` option, or the `.dm-notion-mode` class the
|
|
2808
|
+
* getter also honors), so the bubble menu mirrors the Notion UX by leading
|
|
2809
|
+
* with `ai` and including `link` and `textAlign`.
|
|
2704
2810
|
*
|
|
2705
2811
|
* Consumers can always override by passing their own `contexts` prop.
|
|
2706
2812
|
*/
|
|
@@ -3745,6 +3851,8 @@ declare class Node<Options = unknown, Storage = unknown> extends Extension<Optio
|
|
|
3745
3851
|
interface ToolbarControllerEditor {
|
|
3746
3852
|
readonly toolbarItems: ToolbarItem[];
|
|
3747
3853
|
readonly storage: Record<string, unknown>;
|
|
3854
|
+
/** Read-only editors disable every button without allowReadOnly. */
|
|
3855
|
+
readonly isEditable: boolean;
|
|
3748
3856
|
isActive(nameOrAttributes: string | {
|
|
3749
3857
|
name: string;
|
|
3750
3858
|
attributes?: Record<string, unknown>;
|
|
@@ -3902,6 +4010,10 @@ interface FloatingMenuGroup {
|
|
|
3902
4010
|
* order of groups. Within each group, items are sorted by `priority`
|
|
3903
4011
|
* descending (higher first, default 100).
|
|
3904
4012
|
*
|
|
4013
|
+
* An item with NO group leads: declining a category marks a primary action,
|
|
4014
|
+
* and insertion order would file it last, since whatever adds one loads after
|
|
4015
|
+
* the extensions defining the categories. Renderers give it no heading.
|
|
4016
|
+
*
|
|
3905
4017
|
* Shared between `FloatingMenuController` (which renders grouped item lists
|
|
3906
4018
|
* for FloatingMenu + framework wrappers) and `createSlashSuggestionRenderer`
|
|
3907
4019
|
* (the popup shown by SlashCommand). Having one implementation keeps visual
|
|
@@ -5741,7 +5853,7 @@ declare const uniqueIDPluginKey: PluginKey<any>;
|
|
|
5741
5853
|
interface UniqueIDOptions {
|
|
5742
5854
|
/**
|
|
5743
5855
|
* Node types that should receive unique IDs.
|
|
5744
|
-
* @default ['paragraph', 'heading', 'blockquote', 'codeBlock', 'bulletList', 'orderedList', 'taskList', 'listItem', 'taskItem', 'image', 'horizontalRule']
|
|
5856
|
+
* @default ['paragraph', 'heading', 'blockquote', 'codeBlock', 'bulletList', 'orderedList', 'taskList', 'listItem', 'taskItem', 'image', 'horizontalRule', 'table']
|
|
5745
5857
|
*/
|
|
5746
5858
|
types: string[];
|
|
5747
5859
|
/**
|
|
@@ -6283,6 +6395,62 @@ declare const NotionColorPicker: Extension<NotionColorPickerOptions, NotionColor
|
|
|
6283
6395
|
|
|
6284
6396
|
declare const ClearFormatting: Extension<unknown, unknown>;
|
|
6285
6397
|
|
|
6398
|
+
/**
|
|
6399
|
+
* Print Extension
|
|
6400
|
+
*
|
|
6401
|
+
* Sends the document to the browser's own print dialog, which is also the
|
|
6402
|
+
* one place a reader can save a PDF that looks exactly like the editor:
|
|
6403
|
+
* the same engine paints both, so floats, columns and fonts survive
|
|
6404
|
+
* untouched. What it cannot do is hand a file back to code, so it
|
|
6405
|
+
* complements a file exporter rather than replacing one.
|
|
6406
|
+
*
|
|
6407
|
+
* The paper styling itself lives in `@domternal/theme` (`_print.scss`) and
|
|
6408
|
+
* applies to the reader's own Ctrl/Cmd+P with no code involved. This
|
|
6409
|
+
* extension adds the two things CSS cannot do on its own: a button, and
|
|
6410
|
+
* isolating the document from the host application's chrome.
|
|
6411
|
+
*
|
|
6412
|
+
* @example
|
|
6413
|
+
* ```ts
|
|
6414
|
+
* import { Print } from '@domternal/core';
|
|
6415
|
+
*
|
|
6416
|
+
* const editor = new Editor({ extensions: [Print] });
|
|
6417
|
+
* editor.commands.printDocument();
|
|
6418
|
+
* ```
|
|
6419
|
+
*/
|
|
6420
|
+
|
|
6421
|
+
interface PrintOptions {
|
|
6422
|
+
/** Show the toolbar button. @default true */
|
|
6423
|
+
toolbar: boolean;
|
|
6424
|
+
/**
|
|
6425
|
+
* Resolve the element to print. Defaults to the editor's `.dm-editor`
|
|
6426
|
+
* wrapper, falling back to the ProseMirror element itself.
|
|
6427
|
+
*/
|
|
6428
|
+
root: ((editor: ExtensionEditor) => HTMLElement | null) | null;
|
|
6429
|
+
/**
|
|
6430
|
+
* Also isolate the document when the reader presses Ctrl/Cmd+P instead of
|
|
6431
|
+
* using the command.
|
|
6432
|
+
*
|
|
6433
|
+
* Off by default, and deliberately: isolating means erasing everything
|
|
6434
|
+
* else on the page. That is obviously right for an app that IS the
|
|
6435
|
+
* editor, and obviously wrong for an article with an editor embedded in
|
|
6436
|
+
* it, and only the host knows which one it is. With it off, a native
|
|
6437
|
+
* print still gets the whole paper stylesheet, just not the erasure.
|
|
6438
|
+
*
|
|
6439
|
+
* @default false
|
|
6440
|
+
*/
|
|
6441
|
+
isolateNativePrint: boolean;
|
|
6442
|
+
}
|
|
6443
|
+
interface PrintStorage {
|
|
6444
|
+
/** Removes the native print listeners; set only when they were attached. */
|
|
6445
|
+
cleanup: (() => void) | null;
|
|
6446
|
+
}
|
|
6447
|
+
declare const Print: Extension<PrintOptions, PrintStorage>;
|
|
6448
|
+
declare module '@domternal/core' {
|
|
6449
|
+
interface RawCommands {
|
|
6450
|
+
printDocument: CommandSpec;
|
|
6451
|
+
}
|
|
6452
|
+
}
|
|
6453
|
+
|
|
6286
6454
|
interface LinkPopoverOptions {
|
|
6287
6455
|
/**
|
|
6288
6456
|
* List of allowed URL protocols (should match Link mark's protocols)
|
|
@@ -6482,6 +6650,6 @@ declare const StarterKit: Extension<StarterKitOptions, unknown>;
|
|
|
6482
6650
|
* @domternal/core
|
|
6483
6651
|
* Framework-agnostic ProseMirror editor engine
|
|
6484
6652
|
*/
|
|
6485
|
-
declare const VERSION = "0.
|
|
6653
|
+
declare const VERSION = "0.15.0";
|
|
6486
6654
|
|
|
6487
|
-
export { type AnyExtension, type AnyExtensionConfig, type AttributeSpec, type AttributeSpecs, type AutolinkPluginOptions, BaseKeymap, type BaseKeymapOptions, BlockColor, type BlockColorOptions, Blockquote, type BlockquoteOptions, Bold, type BoldOptions, BubbleMenu, type BubbleMenuOptions, type BuildCommandPropsOptions, BulletList, type BulletListOptions, type CanChainedCommands, CanChecker, type CanCheckerEditor, type CanCheckerOptions, type CanCommands, ChainBuilder, type ChainBuilderEditor, type ChainBuilderOptions, type ChainFailure, type ChainedCommands, CharacterCount, type CharacterCountOptions, type CharacterCountStorage, type ClearContentOptions, ClearFormatting, Code, CodeBlock, type CodeBlockOptions, type CodeOptions, type Command, type CommandEditor, CommandManager, type CommandManagerEditor, type CommandMap, type CommandProps, type CommandPropsEditor, type CommandSpec, type Content, type ContentErrorProps, type CreateBubbleMenuPluginOptions, type CreateDocumentOptions, type CreateEventProps, type CreateFloatingMenuPluginOptions, DEFAULT_BLOCK_COLORS, DEFAULT_BLOCK_COLOR_TYPES, DEFAULT_HIGHLIGHT_COLORS, DEFAULT_NOTION_COLOR_PALETTE, DEFAULT_TEXT_COLORS, Document$1 as Document, Dropcursor, type DropcursorOptions, Editor, type EditorEventName, type EditorEvents, type EditorInstance, type EditorOptions, EventEmitter, Extension, type ExtensionConfig, ExtensionConfigurationError, type ExtensionEditor, ExtensionManager, type ExtensionManagerEditor, type ExtensionManagerOptions, FLOATING_MENU_META, FLOATING_MENU_NO_FOCUS, type FindChildResult, type FindParentNodeResult, FloatingMenuController, type FloatingMenuGroup, type FloatingMenuItem, type FloatingMenuItemsOverride, type FloatingMenuKeymap, type FloatingMenuOptions, Focus, type FocusEventProps, type FocusOptions, type FocusPosition, FontFamily, type FontFamilyOptions, FontSize, type FontSizeOptions, Gapcursor, type GenerateHTMLOptions, type GenerateJSONOptions, type GenerateTextOptions, type GlobalAttributeSpec, type GlobalAttributes, HardBreak, type HardBreakOptions, Heading, type HeadingOptions, Highlight, type HighlightOptions, History, type HistoryOptions, HorizontalRule, type HorizontalRuleOptions, type IconSet, type InlineStyleOverrides, type InsertAsListItemChildArgs, type InsertAsListItemChildResult, InvisibleChars, type InvisibleCharsOptions, type InvisibleCharsStorage, type IsNodeEmptyOptions, type IsValidUrlOptions, Italic, type ItalicOptions, type JSONAttribute, type JSONContent, type JSONMark, type KeyboardShortcutCommand, LIST_ITEM_TYPE_NAMES, LineHeight, type LineHeightOptions, Link, type LinkAttributes, type LinkClickPluginOptions, type LinkExitPluginOptions, type LinkOptions, type LinkPastePluginOptions, LinkPopover, type LinkPopoverOptions, ListIndent, ListItem, type ListItemCursorContext, type ListItemOptions, ListKeymap, type ListKeymapOptions, Mark, type MarkConfig, type MarkInputRuleOptions, type MarkParseRule, type MarkRange, type MarkRenderHTMLProps, type MountEventProps, Node, type NodeConfig, type NodeInputRuleOptions, type NodeParseRule, type NodeRenderHTMLProps, type NodeViewContext, NotionColorPicker, type NotionColorPickerOptions, type NotionColorPickerStorage, OrderedList, type OrderedListOptions, Paragraph, type ParagraphOptions, Placeholder, type PlaceholderOptions, type PositionFloatingOptions, type Range, type RawCommands, Selection, SelectionDecoration, type SelectionDecorationOptions, type SelectionOptions, type SelectionStorage, type SetContentOptions, type SingleCommands, type SplitListForInsertRange, StarterKit, type StarterKitOptions, Strike, type StrikeOptions, Subscript, type SubscriptOptions, Superscript, type SuperscriptOptions, TaskItem, type TaskItemOptions, TaskList, type TaskListOptions, Text, TextAlign, type TextAlignOptions, TextColor, type TextColorOptions, type TextInputRuleOptions, TextStyle, type TextStyleOptions, type TextblockTypeInputRuleOptions, type ToolbarButton, ToolbarController, type ToolbarControllerEditor, type ToolbarDropdown, type ToolbarGroup, type ToolbarItem, type ToolbarLayoutDropdown, type ToolbarLayoutEntry, type ToolbarSeparator, TrailingNode, type TrailingNodeOptions, type TransactionEventProps, Typography, type TypographyOptions, Underline, type UnderlineOptions, UniqueID, type UniqueIDOptions, VERSION, type WrappingInputRuleOptions, announce, applyInlineStyles, autolinkPlugin, autolinkPluginKey, blur, bubbleMenuPluginKey, buildCommandProps, builtInCommands, callOrReturn, characterCountPluginKey, clearContent, copyThemeClass, createAccumulatingDispatch, createBubbleMenuPlugin, createCanChecker, createChainBuilder, createDocument, createFloatingMenuPlugin, defaultBlockAt, defaultBubbleContexts, defaultFloatingMenuShouldShow, defaultIcons, deleteSelection, findChildren, findListItemAncestorDepth, findParentNode, floatingMenuPluginKey, focus, focusPluginKey, generateHTML, generateJSON, generateText, getListItemCursorContext, getMarkRange, groupFloatingMenuItems, hideFloatingMenu, indentBlockAsListChild, inlineStyles, insertAsListItemChild, insertChildrenZoneSibling, insertContent, insertText, invisibleCharsPluginKey, isDocumentEmpty, isInListItemLabel, isInsideListItem, isNodeEmpty, isValidUrl, lift, liftCurrentListItem, liftEmptyChildrenZoneParagraph, linkClickPlugin, linkClickPluginKey, linkExitPlugin, linkExitPluginKey, linkPastePlugin, linkPastePluginKey, markInputRule, markInputRulePatterns, nodeInputRule, outdentBlockFromListItem, placeholderPluginKey, positionFloating, positionFloatingOnce, refocusEditorAfterCommand, resetAttributes, selectAll, selectNodeBackward, selectionDecorationPluginKey, setBlockType, setContent, setMark, showFloatingMenu, splitListForInsert, stripInlineColorConflicts, textInputRule, textblockTypeInputRule, toggleBlockType, toggleList, toggleMark, toggleWrap, uniqueIDPluginKey, unsetAllMarks, unsetMark, updateAttributes, wrapIn, wrappingInputRule, writeToClipboard };
|
|
6655
|
+
export { type AnyExtension, type AnyExtensionConfig, type AttributeSpec, type AttributeSpecs, type AutolinkPluginOptions, BaseKeymap, type BaseKeymapOptions, BlockColor, type BlockColorOptions, Blockquote, type BlockquoteOptions, Bold, type BoldOptions, BubbleMenu, type BubbleMenuOptions, type BuildCommandPropsOptions, BulletList, type BulletListOptions, type CanChainedCommands, CanChecker, type CanCheckerEditor, type CanCheckerOptions, type CanCommands, ChainBuilder, type ChainBuilderEditor, type ChainBuilderOptions, type ChainFailure, type ChainedCommands, CharacterCount, type CharacterCountOptions, type CharacterCountStorage, type ClearContentOptions, ClearFormatting, Code, CodeBlock, type CodeBlockOptions, type CodeOptions, type Command, type CommandEditor, CommandManager, type CommandManagerEditor, type CommandMap, type CommandProps, type CommandPropsEditor, type CommandSpec, type Content, type ContentErrorProps, type CreateBubbleMenuPluginOptions, type CreateDocumentOptions, type CreateEventProps, type CreateFloatingMenuPluginOptions, DEFAULT_BLOCK_COLORS, DEFAULT_BLOCK_COLOR_TYPES, DEFAULT_HIGHLIGHT_COLORS, DEFAULT_NOTION_COLOR_PALETTE, DEFAULT_TEXT_COLORS, Document$1 as Document, Dropcursor, type DropcursorOptions, Editor, type EditorEventName, type EditorEvents, type EditorInstance, type EditorOptions, type EditorPreset, EventEmitter, Extension, type ExtensionConfig, type ExtensionConfigBase, ExtensionConfigurationError, type ExtensionEditor, ExtensionManager, type ExtensionManagerEditor, type ExtensionManagerOptions, FLOATING_MENU_META, FLOATING_MENU_NO_FOCUS, type FindChildResult, type FindParentNodeResult, FloatingMenuController, type FloatingMenuGroup, type FloatingMenuItem, type FloatingMenuItemsOverride, type FloatingMenuKeymap, type FloatingMenuOptions, Focus, type FocusEventProps, type FocusOptions, type FocusPosition, FontFamily, type FontFamilyOptions, FontSize, type FontSizeOptions, Gapcursor, type GenerateHTMLOptions, type GenerateJSONOptions, type GenerateTextOptions, type GlobalAttributeSpec, type GlobalAttributes, HardBreak, type HardBreakOptions, Heading, type HeadingOptions, Highlight, type HighlightOptions, History, type HistoryOptions, HorizontalRule, type HorizontalRuleOptions, type IconSet, type InlineStyleOverrides, type InsertAsListItemChildArgs, type InsertAsListItemChildResult, InvisibleChars, type InvisibleCharsOptions, type InvisibleCharsStorage, type IsNodeEmptyOptions, type IsValidUrlOptions, Italic, type ItalicOptions, type JSONAttribute, type JSONContent, type JSONMark, type KeyboardShortcutCommand, LIST_ITEM_TYPE_NAMES, LineHeight, type LineHeightOptions, Link, type LinkAttributes, type LinkClickPluginOptions, type LinkExitPluginOptions, type LinkOptions, type LinkPastePluginOptions, LinkPopover, type LinkPopoverOptions, ListIndent, ListItem, type ListItemCursorContext, type ListItemOptions, ListKeymap, type ListKeymapOptions, Mark, type MarkConfig, type MarkInputRuleOptions, type MarkParseRule, type MarkRange, type MarkRenderHTMLProps, type MountEventProps, Node, type NodeConfig, type NodeInputRuleOptions, type NodeParseRule, type NodeRenderHTMLProps, type NodeViewContext, NotionColorPicker, type NotionColorPickerOptions, type NotionColorPickerStorage, OrderedList, type OrderedListOptions, Paragraph, type ParagraphOptions, Placeholder, type PlaceholderOptions, type PositionFloatingOptions, Print, type PrintOptions, type PrintStorage, type Range, type RawCommands, Selection, SelectionDecoration, type SelectionDecorationOptions, type SelectionOptions, type SelectionStorage, type SetContentOptions, type SingleCommands, type SplitListForInsertRange, StarterKit, type StarterKitOptions, Strike, type StrikeOptions, Subscript, type SubscriptOptions, Superscript, type SuperscriptOptions, TaskItem, type TaskItemOptions, TaskList, type TaskListOptions, Text, TextAlign, type TextAlignOptions, TextColor, type TextColorOptions, type TextInputRuleOptions, TextStyle, type TextStyleOptions, type TextblockTypeInputRuleOptions, type ToolbarButton, ToolbarController, type ToolbarControllerEditor, type ToolbarDropdown, type ToolbarGroup, type ToolbarItem, type ToolbarLayoutDropdown, type ToolbarLayoutEntry, type ToolbarSeparator, TrailingNode, type TrailingNodeOptions, type TransactionEventProps, Typography, type TypographyOptions, Underline, type UnderlineOptions, UniqueID, type UniqueIDOptions, VERSION, type WrappingInputRuleOptions, announce, applyInlineStyles, autolinkPlugin, autolinkPluginKey, blur, bubbleMenuPluginKey, buildCommandProps, builtInCommands, callOrReturn, characterCountPluginKey, clearContent, copyThemeClass, createAccumulatingDispatch, createBubbleMenuPlugin, createCanChecker, createChainBuilder, createDocument, createFloatingMenuPlugin, defaultBlockAt, defaultBubbleContexts, defaultFloatingMenuShouldShow, defaultIcons, deleteSelection, findChildren, findListItemAncestorDepth, findParentNode, floatingMenuPluginKey, focus, focusPluginKey, generateHTML, generateJSON, generateText, getListItemCursorContext, getMarkRange, groupFloatingMenuItems, hideFloatingMenu, indentBlockAsListChild, inlineStyles, insertAsListItemChild, insertChildrenZoneSibling, insertContent, insertText, invisibleCharsPluginKey, isDocumentEmpty, isInListItemLabel, isInsideListItem, isNodeEmpty, isValidUrl, lift, liftCurrentListItem, liftEmptyChildrenZoneParagraph, linkClickPlugin, linkClickPluginKey, linkExitPlugin, linkExitPluginKey, linkPastePlugin, linkPastePluginKey, markInputRule, markInputRulePatterns, nodeInputRule, outdentBlockFromListItem, placeholderPluginKey, positionFloating, positionFloatingOnce, refocusEditorAfterCommand, resetAttributes, selectAll, selectNodeBackward, selectionDecorationPluginKey, setBlockType, setContent, setMark, showFloatingMenu, splitListForInsert, stripInlineColorConflicts, textInputRule, textblockTypeInputRule, toggleBlockType, toggleList, toggleMark, toggleWrap, uniqueIDPluginKey, unsetAllMarks, unsetMark, updateAttributes, wrapIn, wrappingInputRule, writeToClipboard };
|