@domternal/core 0.9.0 → 0.10.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.d.cts CHANGED
@@ -2670,6 +2670,27 @@ declare function copyThemeClass(view: {
2670
2670
  dom: Element;
2671
2671
  }, target: Element): void;
2672
2672
 
2673
+ /**
2674
+ * Return focus to the editor on the next frame after a toolbar / menu command,
2675
+ * UNLESS the command moved focus into a popover input the user is meant to type
2676
+ * into (currently the math LaTeX field).
2677
+ *
2678
+ * The refocus exists so keyboard (Enter / Space) activation of a plain command
2679
+ * button returns the caret to the document and keeps the native `::selection`
2680
+ * highlight. Mouse clicks already keep focus via `mousedown.preventDefault()`.
2681
+ *
2682
+ * A focused element is treated as such a popover when it sits inside a
2683
+ * `[data-dm-editor-ui]` element that is NOT the toolbar / bubble-menu / floating-
2684
+ * menu chrome and is not inside the contenteditable. To opt in, a popover must
2685
+ * render outside those surfaces, carry `data-dm-editor-ui`, and focus itself
2686
+ * synchronously while the opening command dispatches (so `activeElement` reflects
2687
+ * it before this frame runs).
2688
+ */
2689
+ declare function refocusEditorAfterCommand(view: {
2690
+ dom: Element;
2691
+ focus: () => void;
2692
+ }): void;
2693
+
2673
2694
  /**
2674
2695
  * Default `contexts` map for a bubble menu when the consumer has not
2675
2696
  * supplied one. Returns a richer item set when the editor (or any
@@ -6459,4 +6480,4 @@ declare const StarterKit: Extension<StarterKitOptions, unknown>;
6459
6480
  */
6460
6481
  declare const VERSION = "0.1.0";
6461
6482
 
6462
- 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, type DeleteEventProps, Document$1 as Document, type DropEventProps, Dropcursor, type DropcursorOptions, Editor, type EditorEventName, type EditorEvents, type EditorInstance, type EditorOptions, EventEmitter, Extension, type ExtensionConfig, 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, type PasteEventProps, 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, 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, resetAttributes, selectAll, selectNodeBackward, selectionDecorationPluginKey, setBlockType, setContent, setMark, showFloatingMenu, splitListForInsert, stripInlineColorConflicts, textInputRule, textblockTypeInputRule, toggleBlockType, toggleList, toggleMark, toggleWrap, uniqueIDPluginKey, unsetAllMarks, unsetMark, updateAttributes, wrapIn, wrappingInputRule, writeToClipboard };
6483
+ 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, type DeleteEventProps, Document$1 as Document, type DropEventProps, Dropcursor, type DropcursorOptions, Editor, type EditorEventName, type EditorEvents, type EditorInstance, type EditorOptions, EventEmitter, Extension, type ExtensionConfig, 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, type PasteEventProps, 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, 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
@@ -2670,6 +2670,27 @@ declare function copyThemeClass(view: {
2670
2670
  dom: Element;
2671
2671
  }, target: Element): void;
2672
2672
 
2673
+ /**
2674
+ * Return focus to the editor on the next frame after a toolbar / menu command,
2675
+ * UNLESS the command moved focus into a popover input the user is meant to type
2676
+ * into (currently the math LaTeX field).
2677
+ *
2678
+ * The refocus exists so keyboard (Enter / Space) activation of a plain command
2679
+ * button returns the caret to the document and keeps the native `::selection`
2680
+ * highlight. Mouse clicks already keep focus via `mousedown.preventDefault()`.
2681
+ *
2682
+ * A focused element is treated as such a popover when it sits inside a
2683
+ * `[data-dm-editor-ui]` element that is NOT the toolbar / bubble-menu / floating-
2684
+ * menu chrome and is not inside the contenteditable. To opt in, a popover must
2685
+ * render outside those surfaces, carry `data-dm-editor-ui`, and focus itself
2686
+ * synchronously while the opening command dispatches (so `activeElement` reflects
2687
+ * it before this frame runs).
2688
+ */
2689
+ declare function refocusEditorAfterCommand(view: {
2690
+ dom: Element;
2691
+ focus: () => void;
2692
+ }): void;
2693
+
2673
2694
  /**
2674
2695
  * Default `contexts` map for a bubble menu when the consumer has not
2675
2696
  * supplied one. Returns a richer item set when the editor (or any
@@ -6459,4 +6480,4 @@ declare const StarterKit: Extension<StarterKitOptions, unknown>;
6459
6480
  */
6460
6481
  declare const VERSION = "0.1.0";
6461
6482
 
6462
- 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, type DeleteEventProps, Document$1 as Document, type DropEventProps, Dropcursor, type DropcursorOptions, Editor, type EditorEventName, type EditorEvents, type EditorInstance, type EditorOptions, EventEmitter, Extension, type ExtensionConfig, 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, type PasteEventProps, 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, 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, resetAttributes, selectAll, selectNodeBackward, selectionDecorationPluginKey, setBlockType, setContent, setMark, showFloatingMenu, splitListForInsert, stripInlineColorConflicts, textInputRule, textblockTypeInputRule, toggleBlockType, toggleList, toggleMark, toggleWrap, uniqueIDPluginKey, unsetAllMarks, unsetMark, updateAttributes, wrapIn, wrappingInputRule, writeToClipboard };
6483
+ 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, type DeleteEventProps, Document$1 as Document, type DropEventProps, Dropcursor, type DropcursorOptions, Editor, type EditorEventName, type EditorEvents, type EditorInstance, type EditorOptions, EventEmitter, Extension, type ExtensionConfig, 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, type PasteEventProps, 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, 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
@@ -1017,6 +1017,27 @@ var deleteSelection = () => ({ tr, dispatch }) => {
1017
1017
  dispatch(tr);
1018
1018
  return true;
1019
1019
  };
1020
+ var LIST_WRAPPER_TYPES = /* @__PURE__ */ new Set(["bulletList", "orderedList", "taskList"]);
1021
+ function isEmptyPlaceholderList(node) {
1022
+ if (!LIST_WRAPPER_TYPES.has(node.type.name) || node.childCount !== 1) return false;
1023
+ const item = node.child(0);
1024
+ return item.childCount === 1 && item.child(0).type.name === "paragraph" && item.child(0).content.size === 0;
1025
+ }
1026
+ function stripFitterArtifacts(node) {
1027
+ if (!node.isBlock || node.isLeaf) return node;
1028
+ const children = [];
1029
+ node.forEach((child) => children.push(stripFitterArtifacts(child)));
1030
+ const kept = [];
1031
+ children.forEach((cur, i) => {
1032
+ const next = children[i + 1];
1033
+ if (isEmptyPlaceholderList(cur) && next && LIST_WRAPPER_TYPES.has(next.type.name) && next.type !== cur.type) {
1034
+ return;
1035
+ }
1036
+ kept.push(cur);
1037
+ });
1038
+ const unchanged = kept.length === node.childCount && kept.every((c, i) => c === node.child(i));
1039
+ return unchanged ? node : node.copy(Fragment.fromArray(kept));
1040
+ }
1020
1041
  function isJSONContent(content) {
1021
1042
  return typeof content === "object" && content !== null && "type" in content && typeof content.type === "string";
1022
1043
  }
@@ -1039,7 +1060,7 @@ function parseHTMLContent(html, schema, options) {
1039
1060
  const element = document.createElement("div");
1040
1061
  element.innerHTML = html;
1041
1062
  const parser = DOMParser.fromSchema(schema);
1042
- return parser.parse(element, options?.parseOptions);
1063
+ return stripFitterArtifacts(parser.parse(element, options?.parseOptions));
1043
1064
  }
1044
1065
  function createDocument(content, schema, options) {
1045
1066
  if (content === null || content === void 0 || content === "") {
@@ -4112,6 +4133,21 @@ function copyThemeClass(view, target) {
4112
4133
  });
4113
4134
  }
4114
4135
 
4136
+ // src/utils/refocusEditorAfterCommand.ts
4137
+ function refocusEditorAfterCommand(view) {
4138
+ requestAnimationFrame(() => {
4139
+ const ae = document.activeElement;
4140
+ if (!ae) {
4141
+ view.focus();
4142
+ return;
4143
+ }
4144
+ if (ae.closest("[data-dm-editor-ui]") && !ae.closest(".dm-toolbar") && !ae.closest(".dm-bubble-menu") && !ae.closest(".dm-floating-menu") && !view.dom.contains(ae)) {
4145
+ return;
4146
+ }
4147
+ view.focus();
4148
+ });
4149
+ }
4150
+
4115
4151
  // src/utils/defaultBubbleContexts.ts
4116
4152
  var NOTION_MODE_CLASS = "dm-notion-mode";
4117
4153
  var NOTION_TEXT_CONTEXT = Object.freeze([
@@ -4120,6 +4156,7 @@ var NOTION_TEXT_CONTEXT = Object.freeze([
4120
4156
  "underline",
4121
4157
  "strike",
4122
4158
  "code",
4159
+ "mathInline",
4123
4160
  "|",
4124
4161
  "link",
4125
4162
  "|",
@@ -4131,6 +4168,7 @@ var STANDARD_TEXT_CONTEXT = Object.freeze([
4131
4168
  "underline",
4132
4169
  "strike",
4133
4170
  "code",
4171
+ "mathInline",
4134
4172
  "|",
4135
4173
  "link"
4136
4174
  ]);
@@ -4142,12 +4180,12 @@ function defaultBubbleContexts(editor) {
4142
4180
 
4143
4181
  // src/utils/insertAsListItemChild.ts
4144
4182
  var LIST_ITEM_TYPES3 = /* @__PURE__ */ new Set(["listItem", "taskItem"]);
4145
- var LIST_WRAPPER_TYPES = /* @__PURE__ */ new Set(["bulletList", "orderedList", "taskList"]);
4183
+ var LIST_WRAPPER_TYPES2 = /* @__PURE__ */ new Set(["bulletList", "orderedList", "taskList"]);
4146
4184
  function insertAsListItemChild(args) {
4147
4185
  const { tr, wrapperPos, targetItemPos, blockNode, sourceRange, childIndex } = args;
4148
4186
  if (wrapperPos < 0 || wrapperPos >= tr.doc.content.size) return { ok: false };
4149
4187
  const wrapper = tr.doc.nodeAt(wrapperPos);
4150
- if (!wrapper || !LIST_WRAPPER_TYPES.has(wrapper.type.name)) return { ok: false };
4188
+ if (!wrapper || !LIST_WRAPPER_TYPES2.has(wrapper.type.name)) return { ok: false };
4151
4189
  if (wrapper.childCount === 0) return { ok: false };
4152
4190
  let targetItem;
4153
4191
  let targetItemStart;
@@ -5367,6 +5405,9 @@ var defaultIcons = {
5367
5405
  highlighterCircle: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M201.54,54.46A104,104,0,0,0,54.46,201.54,104,104,0,0,0,201.54,54.46ZM96,210V152h64v58a88.33,88.33,0,0,1-64,0Zm48-74H112V100.94l32-16Zm46.22,54.22A88.09,88.09,0,0,1,176,201.77V152a16,16,0,0,0-16-16V72a8,8,0,0,0-11.58-7.16l-48,24A8,8,0,0,0,96,96v40a16,16,0,0,0-16,16v49.77a88,88,0,1,1,110.22-11.55Z"/></svg>',
5368
5406
  textSubscript: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M248,208a8,8,0,0,1-8,8H192a8,8,0,0,1-6.4-12.8l43.17-57.56a16,16,0,1,0-27.86-15,8,8,0,0,1-15.09-5.34,32.18,32.18,0,0,1,4.63-8.59,32,32,0,0,1,51.11,38.52L208,200h32A8,8,0,0,1,248,208ZM149.24,50a8,8,0,0,0-11.29.81L92,103.78l-45.95-53A8,8,0,0,0,34,61.24L81.41,116,34,170.76a8,8,0,0,0,12.1,10.48l46-53,45.95,53a8,8,0,1,0,12.1-10.48L102.59,116l47.46-54.76A8,8,0,0,0,149.24,50Z"/></svg>',
5369
5407
  textSuperscript: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M248,144a8,8,0,0,1-8,8H192a8,8,0,0,1-6.4-12.8l43.17-57.55a16,16,0,1,0-27.86-15,8,8,0,0,1-15.09-5.33,32,32,0,1,1,55.74,29.92L208,136h32A8,8,0,0,1,248,144ZM149.24,74a8,8,0,0,0-11.29.8L92,127.79l-45.95-53A8,8,0,0,0,34,85.24L81.41,140,34,194.76a8,8,0,0,0,12.1,10.48l46-53,45.95,53a8,8,0,1,0,12.1-10.48L102.59,140l47.46-54.76A8,8,0,0,0,149.24,74Z"/></svg>',
5408
+ // --- Math ---
5409
+ sigma: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="none" stroke="currentColor" stroke-width="18" stroke-linecap="round" stroke-linejoin="round"><path d="M196 56H64l64 72-64 72h132"/></svg>',
5410
+ radical: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="none" stroke="currentColor" stroke-width="18" stroke-linecap="round" stroke-linejoin="round"><path d="M24 150 L66 200 L118 56 L236 56 M150 98 L204 156 M204 98 L150 156"/></svg>',
5370
5411
  link: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,88.23a54.43,54.43,0,0,1-16,37L189.25,160a54.27,54.27,0,0,1-38.63,16h-.05A54.63,54.63,0,0,1,96,119.84a8,8,0,0,1,16,.45A38.62,38.62,0,0,0,150.58,160h0a38.39,38.39,0,0,0,27.31-11.31l34.75-34.75a38.63,38.63,0,0,0-54.63-54.63l-11,11A8,8,0,0,1,135.7,59l11-11A54.65,54.65,0,0,1,224,48,54.86,54.86,0,0,1,240,88.23ZM109,185.66l-11,11A38.41,38.41,0,0,1,70.6,208h0a38.63,38.63,0,0,1-27.29-65.94L78,107.31A38.63,38.63,0,0,1,144,135.71a8,8,0,0,0,16,.45A54.86,54.86,0,0,0,144,96a54.65,54.65,0,0,0-77.27,0L32,130.75A54.62,54.62,0,0,0,70.56,224h0a54.28,54.28,0,0,0,38.64-16l11-11A8,8,0,0,0,109,185.66Z"/></svg>',
5371
5412
  // --- Format: Block ---
5372
5413
  paragraph: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208,40H96a64,64,0,0,0,0,128h40v40a8,8,0,0,0,16,0V56h24V208a8,8,0,0,0,16,0V56h16a8,8,0,0,0,0-16ZM136,152H96a48,48,0,0,1,0-96h40Z"/></svg>',
@@ -5928,6 +5969,50 @@ var CodeBlock = Node2.create({
5928
5969
  ];
5929
5970
  }
5930
5971
  });
5972
+ var LIST_ITEM_TYPES4 = /* @__PURE__ */ new Set(["listItem", "taskItem"]);
5973
+ function liftCrossTypeListItem(state, dispatch) {
5974
+ const { $from } = state.selection;
5975
+ if (!state.selection.empty) return false;
5976
+ let itemDepth = -1;
5977
+ for (let d = $from.depth; d > 0; d--) {
5978
+ if (LIST_ITEM_TYPES4.has($from.node(d).type.name)) {
5979
+ itemDepth = d;
5980
+ break;
5981
+ }
5982
+ }
5983
+ if (itemDepth < 4) return false;
5984
+ const item = $from.node(itemDepth);
5985
+ const wrapper = $from.node(itemDepth - 1);
5986
+ const parentItem = $from.node(itemDepth - 2);
5987
+ if (!LIST_ITEM_TYPES4.has(parentItem.type.name)) return false;
5988
+ if (parentItem.type === item.type) return false;
5989
+ const parentWrapper = $from.node(itemDepth - 3);
5990
+ const grandParent = $from.node(itemDepth - 4);
5991
+ const gpIndex = $from.index(itemDepth - 4);
5992
+ if (!grandParent.canReplaceWith(gpIndex + 1, gpIndex + 1, wrapper.type)) return false;
5993
+ if (!dispatch) return true;
5994
+ const onlyChild = wrapper.childCount === 1;
5995
+ const removeFrom = onlyChild ? $from.before(itemDepth - 1) : $from.before(itemDepth);
5996
+ const removeTo = onlyChild ? $from.after(itemDepth - 1) : $from.after(itemDepth);
5997
+ const parentIsLast = $from.index(itemDepth - 3) === parentWrapper.childCount - 1;
5998
+ const tr = state.tr;
5999
+ tr.delete(removeFrom, removeTo);
6000
+ const newList = wrapper.type.create(wrapper.attrs, item);
6001
+ if (parentIsLast) {
6002
+ const insertAt = tr.mapping.map($from.after(itemDepth - 3));
6003
+ tr.insert(insertAt, newList);
6004
+ tr.setSelection(Selection.near(tr.doc.resolve(insertAt + 2)));
6005
+ } else {
6006
+ const splitAt = tr.mapping.map($from.after(itemDepth - 2));
6007
+ tr.split(splitAt, 1);
6008
+ tr.insert(splitAt + 1, newList);
6009
+ tr.setSelection(Selection.near(tr.doc.resolve(splitAt + 2)));
6010
+ }
6011
+ dispatch(tr.scrollIntoView());
6012
+ return true;
6013
+ }
6014
+
6015
+ // src/extensions/ListKeymap.ts
5931
6016
  var LIST_GROUP_TYPES = /* @__PURE__ */ new Set(["bulletList", "orderedList", "taskList"]);
5932
6017
  function getListItemContext(editor, listItemName) {
5933
6018
  const { state, view } = editor;
@@ -5969,6 +6054,7 @@ var ListKeymap = Extension.create({
5969
6054
  if (!this.editor) return false;
5970
6055
  const ctx = getListItemContext(this.editor, this.options.listItem);
5971
6056
  if (!ctx) return false;
6057
+ if (liftCrossTypeListItem(ctx.state, ctx.view.dispatch)) return true;
5972
6058
  return liftListItem(ctx.listItemType)(ctx.state, ctx.view.dispatch);
5973
6059
  },
5974
6060
  // Backspace at start of list item to lift
@@ -6022,6 +6108,7 @@ var ListKeymap = Extension.create({
6022
6108
  if (firstChild?.isTextblock) {
6023
6109
  const posInListItem = $from.pos - $from.start(listItemDepth);
6024
6110
  if (posInListItem <= 1) {
6111
+ if (liftCrossTypeListItem(state, view.dispatch)) return true;
6025
6112
  return liftListItem(listItemType)(state, view.dispatch);
6026
6113
  }
6027
6114
  }
@@ -6068,7 +6155,22 @@ var ListItem = Node2.create({
6068
6155
  if (splitBlock(state, view.dispatch)) return true;
6069
6156
  }
6070
6157
  }
6071
- if (splitListItem(this.nodeType)(state, view.dispatch)) return true;
6158
+ const item = $from.node(-1);
6159
+ const hasChildren = item.childCount > 1;
6160
+ const atEnd = $from.parentOffset === $from.parent.content.size;
6161
+ const labelEmpty = $from.parent.content.size === 0;
6162
+ if (!ctx?.isInChildrenZone && hasChildren && atEnd && !labelEmpty) {
6163
+ const newItem = this.nodeType.createAndFill();
6164
+ if (newItem) {
6165
+ const insertAt = $from.after($from.depth - 1);
6166
+ const tr = state.tr.insert(insertAt, newItem);
6167
+ tr.setSelection(Selection.near(tr.doc.resolve(insertAt + 2)));
6168
+ view.dispatch(tr.scrollIntoView());
6169
+ return true;
6170
+ }
6171
+ }
6172
+ const skipSplit = !ctx?.isInChildrenZone && labelEmpty && hasChildren;
6173
+ if (!skipSplit && splitListItem(this.nodeType)(state, view.dispatch)) return true;
6072
6174
  const listDepth = $from.depth - 2;
6073
6175
  const taskItemType = state.schema.nodes["taskItem"];
6074
6176
  if ($from.parent.content.size === 0 && listDepth > 0 && taskItemType && $from.node(listDepth - 1).type === taskItemType) {
@@ -6077,9 +6179,9 @@ var ListItem = Node2.create({
6077
6179
  tr.delete($from.before(delDepth), $from.after(delDepth));
6078
6180
  const taskItemDepth = listDepth - 1;
6079
6181
  const end = tr.mapping.map($from.after(taskItemDepth));
6080
- const item = taskItemType.createAndFill();
6081
- if (item) {
6082
- tr.insert(end, item);
6182
+ const item2 = taskItemType.createAndFill();
6183
+ if (item2) {
6184
+ tr.insert(end, item2);
6083
6185
  tr.setSelection(Selection.near(tr.doc.resolve(end + 2)));
6084
6186
  view.dispatch(tr.scrollIntoView());
6085
6187
  return true;
@@ -6208,16 +6310,20 @@ var OrderedList = Node2.create({
6208
6310
  return {
6209
6311
  start: {
6210
6312
  default: 1,
6313
+ // Clamp to a finite integer >= 1. Without this, a malformed
6314
+ // `start="abc"` parses to NaN; `JSON.stringify(NaN)` is `null`, so
6315
+ // getJSON() serializes `start: null` and a save/load cycle
6316
+ // permanently dirties the document (reloads as `<ol start="null">`).
6211
6317
  parseHTML: (element) => {
6212
- const start = element.getAttribute("start");
6213
- return start ? parseInt(start, 10) : 1;
6318
+ const n = parseInt(element.getAttribute("start") ?? "", 10);
6319
+ return Number.isFinite(n) && n >= 1 ? Math.floor(n) : 1;
6214
6320
  },
6215
6321
  renderHTML: (attributes) => {
6216
6322
  const start = attributes["start"];
6217
- if (start === 1) {
6323
+ if (!Number.isFinite(start) || start <= 1) {
6218
6324
  return {};
6219
6325
  }
6220
- return { start: String(start) };
6326
+ return { start: String(Math.floor(start)) };
6221
6327
  }
6222
6328
  }
6223
6329
  };
@@ -6296,8 +6402,8 @@ var OrderedList = Node2.create({
6296
6402
  guard: notInsideList,
6297
6403
  joinForward: true,
6298
6404
  getAttributes: (match) => {
6299
- const num = match[1];
6300
- return { start: num ? parseInt(num, 10) : 1 };
6405
+ const n = parseInt(match[1] ?? "", 10);
6406
+ return { start: Number.isFinite(n) && n >= 1 ? Math.floor(n) : 1 };
6301
6407
  }
6302
6408
  })
6303
6409
  ];
@@ -6569,7 +6675,10 @@ var TaskItem = Node2.create({
6569
6675
  keepOnSplit: false,
6570
6676
  parseHTML: (element) => {
6571
6677
  const dataChecked = element.getAttribute("data-checked");
6572
- return dataChecked === "true" || dataChecked === "";
6678
+ if (dataChecked !== null) {
6679
+ return dataChecked.toLowerCase() === "true" || dataChecked === "";
6680
+ }
6681
+ return element.querySelector('input[type="checkbox"]')?.hasAttribute("checked") ?? false;
6573
6682
  },
6574
6683
  renderHTML: (attributes) => ({
6575
6684
  "data-checked": attributes["checked"] ? "true" : "false"
@@ -6582,6 +6691,14 @@ var TaskItem = Node2.create({
6582
6691
  {
6583
6692
  tag: `li[data-type="${this.name}"]`,
6584
6693
  priority: 51
6694
+ },
6695
+ // GFM / markdown task lists: `<li class="task-list-item">` carries no
6696
+ // data-type. Priority 51 keeps it ahead of the generic `li` (listItem,
6697
+ // 50); class-scoped so it never swallows ordinary bullet items. The
6698
+ // `checked` attribute is derived from the descendant `<input>` above.
6699
+ {
6700
+ tag: "li.task-list-item",
6701
+ priority: 51
6585
6702
  }
6586
6703
  ];
6587
6704
  },
@@ -6667,7 +6784,22 @@ var TaskItem = Node2.create({
6667
6784
  return true;
6668
6785
  }
6669
6786
  }
6670
- if (splitListItem(this.nodeType, { checked: false })(state, view.dispatch)) return true;
6787
+ const item = $from.node(-1);
6788
+ const hasChildren = item.childCount > 1;
6789
+ const labelEmpty = $from.parent.content.size === 0;
6790
+ const atEnd = $from.parentOffset === $from.parent.content.size;
6791
+ if (!ctx?.isInChildrenZone && hasChildren && atEnd && !labelEmpty) {
6792
+ const newItem = this.nodeType.createAndFill({ checked: false });
6793
+ if (newItem) {
6794
+ const insertAt = $from.after($from.depth - 1);
6795
+ const tr = state.tr.insert(insertAt, newItem);
6796
+ tr.setSelection(Selection.near(tr.doc.resolve(insertAt + 2)));
6797
+ view.dispatch(tr.scrollIntoView());
6798
+ return true;
6799
+ }
6800
+ }
6801
+ const skipSplit = !ctx?.isInChildrenZone && labelEmpty && hasChildren;
6802
+ if (!skipSplit && splitListItem(this.nodeType, { checked: false })(state, view.dispatch)) return true;
6671
6803
  if ($from.parent.content.size === 0) {
6672
6804
  const listItemType = state.schema.nodes["listItem"];
6673
6805
  if (listItemType) {
@@ -6714,9 +6846,11 @@ var TaskItem = Node2.create({
6714
6846
  },
6715
6847
  "Shift-Tab": () => {
6716
6848
  if (!this.editor || !this.nodeType) return false;
6717
- const { $from } = this.editor.state.selection;
6849
+ const { state, view } = this.editor;
6850
+ const { $from } = state.selection;
6718
6851
  if ($from.depth < 1 || $from.node(-1).type !== this.nodeType) return false;
6719
- return liftListItem(this.nodeType)(this.editor.state, this.editor.view.dispatch);
6852
+ if (liftCrossTypeListItem(state, view.dispatch)) return true;
6853
+ return liftListItem(this.nodeType)(state, view.dispatch);
6720
6854
  },
6721
6855
  Backspace: () => {
6722
6856
  if (!this.editor || !this.nodeType) return false;
@@ -6738,6 +6872,7 @@ var TaskItem = Node2.create({
6738
6872
  }
6739
6873
  if (taskItemDepth === -1) return false;
6740
6874
  if ($from.index(taskItemDepth) !== 0) return false;
6875
+ if (liftCrossTypeListItem(state, view.dispatch)) return true;
6741
6876
  return liftListItem(this.nodeType)(state, view.dispatch);
6742
6877
  },
6743
6878
  "Mod-Enter": () => {
@@ -6764,6 +6899,13 @@ var TaskList = Node2.create({
6764
6899
  tag: `ul[data-type="${this.name}"]`,
6765
6900
  priority: 51
6766
6901
  // Higher priority than regular bulletList
6902
+ },
6903
+ // GFM / markdown task lists: `<ul class="contains-task-list">`. Priority
6904
+ // 51 keeps it ahead of the generic `ul` (bulletList, 50); class-scoped so
6905
+ // it only matches real GFM task-list containers, not ordinary bullets.
6906
+ {
6907
+ tag: "ul.contains-task-list",
6908
+ priority: 51
6767
6909
  }
6768
6910
  ];
6769
6911
  },
@@ -8024,12 +8166,12 @@ var Placeholder = Extension.create({
8024
8166
  ];
8025
8167
  }
8026
8168
  });
8027
- var LIST_ITEM_TYPES4 = /* @__PURE__ */ new Set(["listItem", "taskItem"]);
8028
- var LIST_WRAPPER_TYPES2 = /* @__PURE__ */ new Set(["bulletList", "orderedList", "taskList"]);
8169
+ var LIST_ITEM_TYPES5 = /* @__PURE__ */ new Set(["listItem", "taskItem"]);
8170
+ var LIST_WRAPPER_TYPES3 = /* @__PURE__ */ new Set(["bulletList", "orderedList", "taskList"]);
8029
8171
  function isCursorInsideListItem(state) {
8030
8172
  const { $from } = state.selection;
8031
8173
  for (let d = $from.depth; d > 0; d--) {
8032
- if (LIST_ITEM_TYPES4.has($from.node(d).type.name)) return true;
8174
+ if (LIST_ITEM_TYPES5.has($from.node(d).type.name)) return true;
8033
8175
  }
8034
8176
  return false;
8035
8177
  }
@@ -8060,7 +8202,7 @@ function indentBlockAsListChild(state, dispatch) {
8060
8202
  }
8061
8203
  if (blockIndex === 0) return false;
8062
8204
  const prevSibling = state.doc.child(blockIndex - 1);
8063
- if (!LIST_WRAPPER_TYPES2.has(prevSibling.type.name)) return false;
8205
+ if (!LIST_WRAPPER_TYPES3.has(prevSibling.type.name)) return false;
8064
8206
  let wrapperPos = 0;
8065
8207
  for (let i = 0; i < blockIndex - 1; i++) {
8066
8208
  wrapperPos += state.doc.child(i).nodeSize;
@@ -8084,7 +8226,7 @@ function outdentBlockFromListItem(state, dispatch) {
8084
8226
  const { $from } = selection;
8085
8227
  let listItemDepth = -1;
8086
8228
  for (let d = $from.depth; d > 0; d--) {
8087
- if (LIST_ITEM_TYPES4.has($from.node(d).type.name)) {
8229
+ if (LIST_ITEM_TYPES5.has($from.node(d).type.name)) {
8088
8230
  listItemDepth = d;
8089
8231
  break;
8090
8232
  }
@@ -8864,7 +9006,7 @@ var BlockColor = Extension.create({
8864
9006
  };
8865
9007
  }
8866
9008
  });
8867
- var Selection4 = Extension.create({
9009
+ var Selection5 = Extension.create({
8868
9010
  name: "selection",
8869
9011
  addStorage() {
8870
9012
  return {
@@ -10363,6 +10505,6 @@ var StarterKit = Extension.create({
10363
10505
  // src/index.ts
10364
10506
  var VERSION = "0.1.0";
10365
10507
 
10366
- 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, 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, Selection4 as Selection, SelectionDecoration, StarterKit, Strike, Subscript, Superscript, TaskItem, TaskList, Text, TextAlign, TextColor, TextStyle, ToolbarController, TrailingNode, Typography, Underline, UniqueID, VERSION, 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, resetAttributes, selectAll, selectNodeBackward, selectionDecorationPluginKey, setBlockType, setContent, setMark, showFloatingMenu, splitListForInsert, stripInlineColorConflicts, textInputRule, textblockTypeInputRule, toggleBlockType, toggleList, toggleMark, toggleWrap, uniqueIDPluginKey, unsetAllMarks, unsetMark, updateAttributes, wrapIn, wrappingInputRule, writeToClipboard };
10508
+ 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, 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, 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 };
10367
10509
  //# sourceMappingURL=index.js.map
10368
10510
  //# sourceMappingURL=index.js.map