@domternal/core 0.13.0 → 0.14.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/dist/index.cjs +123 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -3
- package/dist/index.d.ts +23 -3
- package/dist/index.js +124 -40
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -481,6 +481,12 @@ interface ToolbarButton {
|
|
|
481
481
|
toolbar?: boolean;
|
|
482
482
|
/** Bubble menu context name. When set, this item is included in the default bubble menu for this context. */
|
|
483
483
|
bubbleMenu?: string;
|
|
484
|
+
/**
|
|
485
|
+
* Keep this button enabled in a read-only editor (view-only actions such
|
|
486
|
+
* as a history panel toggle); by default every button is disabled there.
|
|
487
|
+
* @default false
|
|
488
|
+
*/
|
|
489
|
+
allowReadOnly?: boolean;
|
|
484
490
|
}
|
|
485
491
|
/**
|
|
486
492
|
* A dropdown toolbar item containing multiple buttons.
|
|
@@ -2565,6 +2571,18 @@ interface PositionFloatingOptions {
|
|
|
2565
2571
|
* otherwise cover app chrome above the editor) pass the wrapper here.
|
|
2566
2572
|
*/
|
|
2567
2573
|
boundary?: Element;
|
|
2574
|
+
/**
|
|
2575
|
+
* Shrink-to-fit for vertical placements: writes the available space (px)
|
|
2576
|
+
* to the `--dm-available-height` custom property on the element; the
|
|
2577
|
+
* stylesheet opts in with e.g.
|
|
2578
|
+
* `max-height: min(22rem, var(--dm-available-height, 100vh))` plus
|
|
2579
|
+
* `box-sizing: border-box`. The element stays on the preferred side while
|
|
2580
|
+
* at least `minHeight` px fit there, then flips to the opposite side.
|
|
2581
|
+
*/
|
|
2582
|
+
constrainHeight?: {
|
|
2583
|
+
/** Smallest useful height in px before flipping to the opposite side. */
|
|
2584
|
+
minHeight: number;
|
|
2585
|
+
};
|
|
2568
2586
|
}
|
|
2569
2587
|
/**
|
|
2570
2588
|
* Positions a floating element relative to a reference element or virtual rect,
|
|
@@ -3745,6 +3763,8 @@ declare class Node<Options = unknown, Storage = unknown> extends Extension<Optio
|
|
|
3745
3763
|
interface ToolbarControllerEditor {
|
|
3746
3764
|
readonly toolbarItems: ToolbarItem[];
|
|
3747
3765
|
readonly storage: Record<string, unknown>;
|
|
3766
|
+
/** Read-only editors disable every button without allowReadOnly. */
|
|
3767
|
+
readonly isEditable: boolean;
|
|
3748
3768
|
isActive(nameOrAttributes: string | {
|
|
3749
3769
|
name: string;
|
|
3750
3770
|
attributes?: Record<string, unknown>;
|
|
@@ -5741,7 +5761,7 @@ declare const uniqueIDPluginKey: PluginKey<any>;
|
|
|
5741
5761
|
interface UniqueIDOptions {
|
|
5742
5762
|
/**
|
|
5743
5763
|
* Node types that should receive unique IDs.
|
|
5744
|
-
* @default ['paragraph', 'heading', 'blockquote', 'codeBlock', 'bulletList', 'orderedList', 'taskList', 'listItem', 'taskItem', 'image', 'horizontalRule']
|
|
5764
|
+
* @default ['paragraph', 'heading', 'blockquote', 'codeBlock', 'bulletList', 'orderedList', 'taskList', 'listItem', 'taskItem', 'image', 'horizontalRule', 'table']
|
|
5745
5765
|
*/
|
|
5746
5766
|
types: string[];
|
|
5747
5767
|
/**
|
|
@@ -6482,6 +6502,6 @@ declare const StarterKit: Extension<StarterKitOptions, unknown>;
|
|
|
6482
6502
|
* @domternal/core
|
|
6483
6503
|
* Framework-agnostic ProseMirror editor engine
|
|
6484
6504
|
*/
|
|
6485
|
-
declare const VERSION = "0.
|
|
6505
|
+
declare const VERSION = "0.14.0";
|
|
6486
6506
|
|
|
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 };
|
|
6507
|
+
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, 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, 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
|
@@ -481,6 +481,12 @@ interface ToolbarButton {
|
|
|
481
481
|
toolbar?: boolean;
|
|
482
482
|
/** Bubble menu context name. When set, this item is included in the default bubble menu for this context. */
|
|
483
483
|
bubbleMenu?: string;
|
|
484
|
+
/**
|
|
485
|
+
* Keep this button enabled in a read-only editor (view-only actions such
|
|
486
|
+
* as a history panel toggle); by default every button is disabled there.
|
|
487
|
+
* @default false
|
|
488
|
+
*/
|
|
489
|
+
allowReadOnly?: boolean;
|
|
484
490
|
}
|
|
485
491
|
/**
|
|
486
492
|
* A dropdown toolbar item containing multiple buttons.
|
|
@@ -2565,6 +2571,18 @@ interface PositionFloatingOptions {
|
|
|
2565
2571
|
* otherwise cover app chrome above the editor) pass the wrapper here.
|
|
2566
2572
|
*/
|
|
2567
2573
|
boundary?: Element;
|
|
2574
|
+
/**
|
|
2575
|
+
* Shrink-to-fit for vertical placements: writes the available space (px)
|
|
2576
|
+
* to the `--dm-available-height` custom property on the element; the
|
|
2577
|
+
* stylesheet opts in with e.g.
|
|
2578
|
+
* `max-height: min(22rem, var(--dm-available-height, 100vh))` plus
|
|
2579
|
+
* `box-sizing: border-box`. The element stays on the preferred side while
|
|
2580
|
+
* at least `minHeight` px fit there, then flips to the opposite side.
|
|
2581
|
+
*/
|
|
2582
|
+
constrainHeight?: {
|
|
2583
|
+
/** Smallest useful height in px before flipping to the opposite side. */
|
|
2584
|
+
minHeight: number;
|
|
2585
|
+
};
|
|
2568
2586
|
}
|
|
2569
2587
|
/**
|
|
2570
2588
|
* Positions a floating element relative to a reference element or virtual rect,
|
|
@@ -3745,6 +3763,8 @@ declare class Node<Options = unknown, Storage = unknown> extends Extension<Optio
|
|
|
3745
3763
|
interface ToolbarControllerEditor {
|
|
3746
3764
|
readonly toolbarItems: ToolbarItem[];
|
|
3747
3765
|
readonly storage: Record<string, unknown>;
|
|
3766
|
+
/** Read-only editors disable every button without allowReadOnly. */
|
|
3767
|
+
readonly isEditable: boolean;
|
|
3748
3768
|
isActive(nameOrAttributes: string | {
|
|
3749
3769
|
name: string;
|
|
3750
3770
|
attributes?: Record<string, unknown>;
|
|
@@ -5741,7 +5761,7 @@ declare const uniqueIDPluginKey: PluginKey<any>;
|
|
|
5741
5761
|
interface UniqueIDOptions {
|
|
5742
5762
|
/**
|
|
5743
5763
|
* Node types that should receive unique IDs.
|
|
5744
|
-
* @default ['paragraph', 'heading', 'blockquote', 'codeBlock', 'bulletList', 'orderedList', 'taskList', 'listItem', 'taskItem', 'image', 'horizontalRule']
|
|
5764
|
+
* @default ['paragraph', 'heading', 'blockquote', 'codeBlock', 'bulletList', 'orderedList', 'taskList', 'listItem', 'taskItem', 'image', 'horizontalRule', 'table']
|
|
5745
5765
|
*/
|
|
5746
5766
|
types: string[];
|
|
5747
5767
|
/**
|
|
@@ -6482,6 +6502,6 @@ declare const StarterKit: Extension<StarterKitOptions, unknown>;
|
|
|
6482
6502
|
* @domternal/core
|
|
6483
6503
|
* Framework-agnostic ProseMirror editor engine
|
|
6484
6504
|
*/
|
|
6485
|
-
declare const VERSION = "0.
|
|
6505
|
+
declare const VERSION = "0.14.0";
|
|
6486
6506
|
|
|
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 };
|
|
6507
|
+
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, 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, 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.js
CHANGED
|
@@ -7,7 +7,7 @@ import { splitBlock, chainCommands, newlineInCode, createParagraphNear, liftEmpt
|
|
|
7
7
|
import { InputRule } from '@domternal/pm/inputrules';
|
|
8
8
|
import { canJoin, canSplit, findWrapping, liftTarget } from '@domternal/pm/transform';
|
|
9
9
|
import { liftListItem, sinkListItem, splitListItem, wrapRangeInList } from '@domternal/pm/schema-list';
|
|
10
|
-
import {
|
|
10
|
+
import { autoUpdate, hide, offset, size, flip, shift, computePosition } from '@floating-ui/dom';
|
|
11
11
|
import { find } from 'linkifyjs';
|
|
12
12
|
import { history, redo, undo } from '@domternal/pm/history';
|
|
13
13
|
import { dropCursor } from '@domternal/pm/dropcursor';
|
|
@@ -4065,16 +4065,50 @@ var Editor = class _Editor extends EventEmitter {
|
|
|
4065
4065
|
return super.emit(event, ...args);
|
|
4066
4066
|
}
|
|
4067
4067
|
};
|
|
4068
|
-
|
|
4069
|
-
|
|
4068
|
+
var OPPOSITE_SIDE = {
|
|
4069
|
+
top: "bottom",
|
|
4070
|
+
bottom: "top",
|
|
4071
|
+
left: "right",
|
|
4072
|
+
right: "left"
|
|
4073
|
+
};
|
|
4074
|
+
function oppositePlacement(placement) {
|
|
4075
|
+
const [side = "", alignment] = placement.split("-");
|
|
4076
|
+
const opposite = OPPOSITE_SIDE[side] ?? side;
|
|
4077
|
+
return alignment ? `${opposite}-${alignment}` : opposite;
|
|
4078
|
+
}
|
|
4079
|
+
function buildMiddleware(options, placementOpt) {
|
|
4070
4080
|
const paddingOpt = options?.padding ?? 10;
|
|
4071
4081
|
const overflowOpts = options?.boundary ? { padding: paddingOpt, boundary: options.boundary } : { padding: paddingOpt };
|
|
4072
|
-
const
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4082
|
+
const constrain = options?.constrainHeight;
|
|
4083
|
+
const middleware = [offset(options?.offsetValue ?? 4)];
|
|
4084
|
+
if (constrain) {
|
|
4085
|
+
middleware.push(
|
|
4086
|
+
size({
|
|
4087
|
+
...overflowOpts,
|
|
4088
|
+
apply({ availableHeight, elements }) {
|
|
4089
|
+
elements.floating.style.setProperty(
|
|
4090
|
+
"--dm-available-height",
|
|
4091
|
+
`${String(Math.max(constrain.minHeight, Math.floor(availableHeight)))}px`
|
|
4092
|
+
);
|
|
4093
|
+
}
|
|
4094
|
+
})
|
|
4095
|
+
);
|
|
4096
|
+
middleware.push(
|
|
4097
|
+
flip({
|
|
4098
|
+
...overflowOpts,
|
|
4099
|
+
crossAxis: false,
|
|
4100
|
+
fallbackPlacements: [oppositePlacement(placementOpt)]
|
|
4101
|
+
})
|
|
4102
|
+
);
|
|
4103
|
+
} else {
|
|
4104
|
+
middleware.push(flip(overflowOpts));
|
|
4105
|
+
}
|
|
4106
|
+
middleware.push(shift(overflowOpts));
|
|
4107
|
+
return middleware;
|
|
4108
|
+
}
|
|
4109
|
+
function positionFloating(reference, floating, options) {
|
|
4110
|
+
const placementOpt = options?.placement ?? "bottom";
|
|
4111
|
+
const middleware = [...buildMiddleware(options, placementOpt), hide()];
|
|
4078
4112
|
const update = () => {
|
|
4079
4113
|
void computePosition(
|
|
4080
4114
|
reference,
|
|
@@ -4102,13 +4136,7 @@ function positionFloating(reference, floating, options) {
|
|
|
4102
4136
|
}
|
|
4103
4137
|
function positionFloatingOnce(reference, floating, options) {
|
|
4104
4138
|
const placementOpt = options?.placement ?? "bottom";
|
|
4105
|
-
const
|
|
4106
|
-
const overflowOpts = options?.boundary ? { padding: paddingOpt, boundary: options.boundary } : { padding: paddingOpt };
|
|
4107
|
-
const middleware = [
|
|
4108
|
-
offset(options?.offsetValue ?? 4),
|
|
4109
|
-
flip(overflowOpts),
|
|
4110
|
-
shift(overflowOpts)
|
|
4111
|
-
];
|
|
4139
|
+
const middleware = buildMiddleware(options, placementOpt);
|
|
4112
4140
|
const update = () => {
|
|
4113
4141
|
void computePosition(
|
|
4114
4142
|
reference,
|
|
@@ -4700,6 +4728,7 @@ var ToolbarController = class _ToolbarController {
|
|
|
4700
4728
|
* Executes a toolbar button's command.
|
|
4701
4729
|
*/
|
|
4702
4730
|
executeCommand(item) {
|
|
4731
|
+
if (!this.editor.isEditable && item.allowReadOnly !== true) return;
|
|
4703
4732
|
_ToolbarController.executeItem(this.editor, item);
|
|
4704
4733
|
this.updateActiveStates();
|
|
4705
4734
|
}
|
|
@@ -4942,16 +4971,20 @@ var ToolbarController = class _ToolbarController {
|
|
|
4942
4971
|
checkButtonDisabled(item, canProxy) {
|
|
4943
4972
|
const wasDisabled = this._disabledMap.get(item.name) ?? false;
|
|
4944
4973
|
let nowDisabled = false;
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4974
|
+
if (!this.editor.isEditable && item.allowReadOnly !== true) {
|
|
4975
|
+
nowDisabled = true;
|
|
4976
|
+
} else {
|
|
4977
|
+
try {
|
|
4978
|
+
if (item.emitEvent) {
|
|
4979
|
+
nowDisabled = this.editor.isActive("codeBlock");
|
|
4980
|
+
} else if (canProxy) {
|
|
4981
|
+
const canCmd = canProxy[item.command];
|
|
4982
|
+
if (canCmd) {
|
|
4983
|
+
nowDisabled = item.commandArgs?.length ? !canCmd(...item.commandArgs) : !canCmd();
|
|
4984
|
+
}
|
|
4952
4985
|
}
|
|
4986
|
+
} catch {
|
|
4953
4987
|
}
|
|
4954
|
-
} catch {
|
|
4955
4988
|
}
|
|
4956
4989
|
if (wasDisabled !== nowDisabled) {
|
|
4957
4990
|
this._disabledMap.set(item.name, nowDisabled);
|
|
@@ -5363,6 +5396,7 @@ function createFloatingMenuPlugin(options) {
|
|
|
5363
5396
|
};
|
|
5364
5397
|
hideMenu();
|
|
5365
5398
|
const isVisibleNow = (view) => {
|
|
5399
|
+
if (!editor.isEditable) return false;
|
|
5366
5400
|
const wantsShow = shouldShow({ editor, view, state: view.state });
|
|
5367
5401
|
if (!requireExplicitTrigger) return wantsShow;
|
|
5368
5402
|
const triggered = pluginKey.getState(view.state)?.triggered ?? false;
|
|
@@ -5742,7 +5776,8 @@ var Heading = Node2.create({
|
|
|
5742
5776
|
key: new PluginKey("headingKeydownFix"),
|
|
5743
5777
|
props: {
|
|
5744
5778
|
handleDOMEvents: {
|
|
5745
|
-
keydown(
|
|
5779
|
+
keydown(view, event) {
|
|
5780
|
+
if (!view.editable) return false;
|
|
5746
5781
|
if (!event.altKey || !(event.metaKey || event.ctrlKey)) return false;
|
|
5747
5782
|
const level = codeToLevel[event.code];
|
|
5748
5783
|
if (level === void 0) return false;
|
|
@@ -8821,7 +8856,13 @@ var UniqueID = Extension.create({
|
|
|
8821
8856
|
"listItem",
|
|
8822
8857
|
"taskItem",
|
|
8823
8858
|
"image",
|
|
8824
|
-
"horizontalRule"
|
|
8859
|
+
"horizontalRule",
|
|
8860
|
+
// Listed even though it lives in a separate package, exactly as
|
|
8861
|
+
// `image` already is: a global attribute only installs on types the
|
|
8862
|
+
// schema actually has, so naming it is inert when the table extension
|
|
8863
|
+
// is not loaded. Without it a table is the one block the block menu
|
|
8864
|
+
// cannot Copy link, and the one an id-anchored feature cannot address.
|
|
8865
|
+
"table"
|
|
8825
8866
|
],
|
|
8826
8867
|
attributeName: "id",
|
|
8827
8868
|
generateID: generateUUID,
|
|
@@ -8849,7 +8890,8 @@ var UniqueID = Extension.create({
|
|
|
8849
8890
|
addProseMirrorPlugins() {
|
|
8850
8891
|
const { types, attributeName, generateID, filterDuplicates } = this.options;
|
|
8851
8892
|
const editor = this.editor;
|
|
8852
|
-
const transformPastedSlice = (slice) => {
|
|
8893
|
+
const transformPastedSlice = (slice, view) => {
|
|
8894
|
+
if (view?.dragging?.move === true) return slice;
|
|
8853
8895
|
const existingIDs = /* @__PURE__ */ new Set();
|
|
8854
8896
|
editor?.state.doc.descendants((node) => {
|
|
8855
8897
|
const id = node.attrs[attributeName];
|
|
@@ -8883,7 +8925,36 @@ var UniqueID = Extension.create({
|
|
|
8883
8925
|
slice.openEnd
|
|
8884
8926
|
);
|
|
8885
8927
|
};
|
|
8886
|
-
const
|
|
8928
|
+
const incumbentPositions = (oldDoc, mapPos) => {
|
|
8929
|
+
const incumbents = /* @__PURE__ */ new Map();
|
|
8930
|
+
oldDoc.descendants((node, pos) => {
|
|
8931
|
+
if (!types.includes(node.type.name)) return;
|
|
8932
|
+
const id = node.attrs[attributeName];
|
|
8933
|
+
if (id && !incumbents.has(id)) incumbents.set(id, mapPos(pos));
|
|
8934
|
+
});
|
|
8935
|
+
return incumbents;
|
|
8936
|
+
};
|
|
8937
|
+
const assignMissingIDs = (doc, tr, incumbents) => {
|
|
8938
|
+
const winners = /* @__PURE__ */ new Map();
|
|
8939
|
+
if (incumbents && incumbents.size > 0) {
|
|
8940
|
+
const occurrences = /* @__PURE__ */ new Map();
|
|
8941
|
+
doc.descendants((node, pos) => {
|
|
8942
|
+
if (!types.includes(node.type.name)) return;
|
|
8943
|
+
const id = node.attrs[attributeName];
|
|
8944
|
+
if (!id) return;
|
|
8945
|
+
const list = occurrences.get(id);
|
|
8946
|
+
if (list) list.push(pos);
|
|
8947
|
+
else occurrences.set(id, [pos]);
|
|
8948
|
+
});
|
|
8949
|
+
for (const [id, positions] of occurrences) {
|
|
8950
|
+
if (positions.length < 2) continue;
|
|
8951
|
+
const incumbentPos = incumbents.get(id);
|
|
8952
|
+
winners.set(
|
|
8953
|
+
id,
|
|
8954
|
+
incumbentPos !== void 0 && positions.includes(incumbentPos) ? incumbentPos : positions[0]
|
|
8955
|
+
);
|
|
8956
|
+
}
|
|
8957
|
+
}
|
|
8887
8958
|
const seen = /* @__PURE__ */ new Set();
|
|
8888
8959
|
doc.descendants((node, pos) => {
|
|
8889
8960
|
if (!types.includes(node.type.name)) return;
|
|
@@ -8898,7 +8969,9 @@ var UniqueID = Extension.create({
|
|
|
8898
8969
|
});
|
|
8899
8970
|
return;
|
|
8900
8971
|
}
|
|
8901
|
-
|
|
8972
|
+
const winner = winners.get(existingID);
|
|
8973
|
+
const yieldsToWinner = winner !== void 0 && winner !== pos;
|
|
8974
|
+
if (seen.has(existingID) || yieldsToWinner) {
|
|
8902
8975
|
let id = generateID();
|
|
8903
8976
|
while (seen.has(id)) id = generateID();
|
|
8904
8977
|
seen.add(id);
|
|
@@ -8920,6 +8993,7 @@ var UniqueID = Extension.create({
|
|
|
8920
8993
|
const tr = editorView.state.tr;
|
|
8921
8994
|
assignMissingIDs(editorView.state.doc, tr);
|
|
8922
8995
|
if (tr.docChanged) {
|
|
8996
|
+
tr.setMeta("addToHistory", false);
|
|
8923
8997
|
editorView.dispatch(tr);
|
|
8924
8998
|
}
|
|
8925
8999
|
}, 0);
|
|
@@ -8930,12 +9004,18 @@ var UniqueID = Extension.create({
|
|
|
8930
9004
|
};
|
|
8931
9005
|
},
|
|
8932
9006
|
// Ensure new nodes get IDs
|
|
8933
|
-
appendTransaction(transactions,
|
|
9007
|
+
appendTransaction(transactions, oldState, newState) {
|
|
8934
9008
|
const docChanged = transactions.some((tr2) => tr2.docChanged);
|
|
8935
9009
|
if (!docChanged) return null;
|
|
9010
|
+
const mapForward = (pos) => transactions.reduce((p, transaction) => transaction.mapping.map(p), pos);
|
|
8936
9011
|
const tr = newState.tr;
|
|
8937
|
-
assignMissingIDs(newState.doc, tr);
|
|
8938
|
-
|
|
9012
|
+
assignMissingIDs(newState.doc, tr, incumbentPositions(oldState.doc, mapForward));
|
|
9013
|
+
if (!tr.docChanged) return null;
|
|
9014
|
+
const ridesAlongWithAnEdit = transactions.some(
|
|
9015
|
+
(transaction) => transaction.docChanged && transaction.getMeta("addToHistory") !== false
|
|
9016
|
+
);
|
|
9017
|
+
if (!ridesAlongWithAnEdit) tr.setMeta("addToHistory", false);
|
|
9018
|
+
return tr;
|
|
8939
9019
|
},
|
|
8940
9020
|
// Handle paste - filter duplicates
|
|
8941
9021
|
props: filterDuplicates ? {
|
|
@@ -9904,14 +9984,14 @@ var FontSize = Extension.create({
|
|
|
9904
9984
|
addToolbarItems() {
|
|
9905
9985
|
if (this.options.fontSizes.length === 0) return [];
|
|
9906
9986
|
const sizes = this.options.fontSizes;
|
|
9907
|
-
const items = sizes.map((
|
|
9987
|
+
const items = sizes.map((size2, i) => ({
|
|
9908
9988
|
type: "button",
|
|
9909
|
-
name: `fontSize-${
|
|
9989
|
+
name: `fontSize-${size2}`,
|
|
9910
9990
|
command: "setFontSize",
|
|
9911
|
-
commandArgs: [
|
|
9912
|
-
isActive: { name: "textStyle", attributes: { fontSize:
|
|
9991
|
+
commandArgs: [size2],
|
|
9992
|
+
isActive: { name: "textStyle", attributes: { fontSize: size2 } },
|
|
9913
9993
|
icon: "textSize",
|
|
9914
|
-
label:
|
|
9994
|
+
label: size2,
|
|
9915
9995
|
priority: 200 - i
|
|
9916
9996
|
}));
|
|
9917
9997
|
if (this.options.showReset) {
|
|
@@ -10375,7 +10455,7 @@ function createBubbleMenuPlugin(options) {
|
|
|
10375
10455
|
if (from !== prevValue.from || to !== prevValue.to) {
|
|
10376
10456
|
suppressed = false;
|
|
10377
10457
|
}
|
|
10378
|
-
const visible = !suppressed && !selection.empty && shouldShow({
|
|
10458
|
+
const visible = !suppressed && !selection.empty && editor.isEditable && shouldShow({
|
|
10379
10459
|
editor,
|
|
10380
10460
|
view: editor.view,
|
|
10381
10461
|
state: newState,
|
|
@@ -10415,7 +10495,7 @@ function createBubbleMenuPlugin(options) {
|
|
|
10415
10495
|
if (mouseDown) return;
|
|
10416
10496
|
const { selection } = editor.view.state;
|
|
10417
10497
|
const { from, to } = selection;
|
|
10418
|
-
const show = !selection.empty && shouldShow({
|
|
10498
|
+
const show = !selection.empty && editor.isEditable && shouldShow({
|
|
10419
10499
|
editor,
|
|
10420
10500
|
view: editor.view,
|
|
10421
10501
|
state: editor.view.state,
|
|
@@ -10451,6 +10531,10 @@ function createBubbleMenuPlugin(options) {
|
|
|
10451
10531
|
return {
|
|
10452
10532
|
update: (view, prevState) => {
|
|
10453
10533
|
if (view.composing) return;
|
|
10534
|
+
if (!view.editable) {
|
|
10535
|
+
hideMenu();
|
|
10536
|
+
return;
|
|
10537
|
+
}
|
|
10454
10538
|
const state = pluginKey.getState(view.state);
|
|
10455
10539
|
const prevPluginState = pluginKey.getState(prevState);
|
|
10456
10540
|
if (state?.visible === prevPluginState?.visible && state?.from === prevPluginState?.from && state?.to === prevPluginState?.to && !(state?.visible && view.state.doc !== prevState.doc)) {
|
|
@@ -10583,7 +10667,7 @@ var StarterKit = Extension.create({
|
|
|
10583
10667
|
});
|
|
10584
10668
|
|
|
10585
10669
|
// src/index.ts
|
|
10586
|
-
var VERSION = "0.
|
|
10670
|
+
var VERSION = "0.14.0";
|
|
10587
10671
|
|
|
10588
10672
|
export { BaseKeymap, BlockColor, Blockquote, Bold, BubbleMenu, BulletList, CanChecker, ChainBuilder, CharacterCount, ClearFormatting, Code, CodeBlock, CommandManager, DEFAULT_BLOCK_COLORS, DEFAULT_BLOCK_COLOR_TYPES, DEFAULT_HIGHLIGHT_COLORS, DEFAULT_NOTION_COLOR_PALETTE, DEFAULT_TEXT_COLORS, Document, Dropcursor, Editor, EventEmitter, Extension, ExtensionConfigurationError, ExtensionManager, FLOATING_MENU_META, FLOATING_MENU_NO_FOCUS, FloatingMenuController, Focus, FontFamily, FontSize, Gapcursor, HardBreak, Heading, Highlight, History, HorizontalRule, InvisibleChars, Italic, LIST_ITEM_TYPE_NAMES, LineHeight, Link, LinkPopover, ListIndent, ListItem, ListKeymap, Mark, Node2 as Node, NotionColorPicker, OrderedList, Paragraph, Placeholder, Selection5 as Selection, SelectionDecoration, StarterKit, Strike, Subscript, Superscript, TaskItem, TaskList, Text, TextAlign, TextColor, TextStyle, ToolbarController, TrailingNode, Typography, Underline, UniqueID, VERSION, 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 };
|
|
10589
10673
|
//# sourceMappingURL=index.js.map
|