@tiptap/core 3.22.0 → 3.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +126 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +86 -6
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/NodeView.ts +10 -1
- package/src/commands/toggleList.ts +69 -7
- package/src/pasteRules/markPasteRule.ts +10 -1
- package/src/utilities/index.ts +1 -0
- package/src/utilities/nodeViewPositionRegistry.ts +70 -0
package/dist/index.d.cts
CHANGED
|
@@ -4947,6 +4947,18 @@ declare function mergeDeep(target: Record<string, any>, source: Record<string, a
|
|
|
4947
4947
|
|
|
4948
4948
|
declare function minMax(value?: number, min?: number, max?: number): number;
|
|
4949
4949
|
|
|
4950
|
+
/**
|
|
4951
|
+
* Register a callback to be called (via a shared rAF) after every editor
|
|
4952
|
+
* update transaction. If this is the first registration for the given editor,
|
|
4953
|
+
* a new registry entry and a single `editor.on('update')` listener are created.
|
|
4954
|
+
*/
|
|
4955
|
+
declare function schedulePositionCheck(editor: Editor, callback: () => void): void;
|
|
4956
|
+
/**
|
|
4957
|
+
* Unregister a previously registered callback. When the last callback for an
|
|
4958
|
+
* editor is removed, the shared listener and any pending rAF are also cleaned up.
|
|
4959
|
+
*/
|
|
4960
|
+
declare function cancelPositionCheck(editor: Editor, callback: () => void): void;
|
|
4961
|
+
|
|
4950
4962
|
/**
|
|
4951
4963
|
* Check if object1 includes object2
|
|
4952
4964
|
* @param object1 Object
|
|
@@ -4970,4 +4982,4 @@ interface Commands<ReturnType = any> {
|
|
|
4970
4982
|
interface Storage {
|
|
4971
4983
|
}
|
|
4972
4984
|
|
|
4973
|
-
export { type AllowedAttribute, type AnyCommands, type AnyConfig, type AnyExtension, type AtomBlockMarkdownSpecOptions, type Attribute, type Attributes$1 as Attributes, type BlockMarkdownSpecOptions, type BlockParserConfig, type CanCommands, type ChainedCommands, type ChangedRange, type Command, CommandManager, type CommandProps, type CommandSpec, type Commands, type Content, type CreateNodeFromContentOptions, type DOMNode, type DOMOutputSpecArray$1 as DOMOutputSpecArray, type DecorationType, type DecorationWithType, type Diff, type Dispatch, type DispatchTransactionProps, type DocumentType, Editor, type EditorEvents, type EditorOptions, type EnableRules, Extendable, type ExtendableConfig, type ExtendedRegExpMatchArray, Extension, type ExtensionAttribute, type ExtensionConfig, type Extensions, type FocusPosition, Fragment, type FullMarkdownHelpers, type GetUpdatedPositionResult, type GlobalAttributes, type HTMLContent, type InlineMarkdownSpecOptions, InputRule, type InputRuleFinder, type InputRuleMatch, type InsertContentAtOptions, type InsertContentOptions, type JSONContent, type KeyboardShortcutCommand, type KeysWithTypeOf, MappablePosition, Mark, type MarkConfig, type MarkRange, type MarkType, MarkView, type MarkViewProps, type MarkViewRenderer, type MarkViewRendererOptions, type MarkViewRendererProps, type MarkdownExtensionSpec, type MarkdownHelpers, type MarkdownLexerConfiguration, type MarkdownParseHelpers, type MarkdownParseResult, type MarkdownRendererHelpers, type MarkdownToken, type MarkdownTokenizer, type MaybeReturnType, type MaybeThisParameterType, Node, type NodeConfig, NodePos, type NodeRange, type NodeType, NodeView, type NodeViewProps, type NodeViewRenderer, type NodeViewRendererOptions, type NodeViewRendererProps, type NodeWithPos, type Overwrite, type ParentConfig, type ParsedBlock, PasteRule, type PasteRuleFinder, type PasteRuleMatch, type PickValue, type Predicate, type Primitive, type Range, type RawCommands, type RemoveThis, type RenderContext, type ResizableNodeDimensions, ResizableNodeView, type ResizableNodeViewDirection, type ResizableNodeViewOptions, ResizableNodeview, type SetContentOptions, type SingleCommands, type Storage, type TextSerializer, type TextType, type TiptapEditorHTMLElement, Tracker, type TrackerResult, type UnionCommands, type UnionToIntersection, type Utils, type ValuesOf, blur, callOrReturn, canInsertNode, clearContent, clearNodes, combineTransactionSteps, command, index$2 as commands, createAtomBlockMarkdownSpec, createBlockMarkdownSpec, createChainableState, createDocument, h as createElement, createInlineMarkdownSpec, createMappablePosition, createNodeFromContent, createParagraphNear, createStyleTag, cut, decodeHtmlEntities, defaultBlockAt, deleteCurrentNode, deleteNode, deleteProps, deleteRange, deleteSelection, elementFromString, encodeHtmlEntities, enter, escapeForRegEx, exitCode, extendMarkRange, index$1 as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, first, flattenExtensions, focus, forEach, fromString, generateHTML, generateJSON, generateText, getAttributes, getAttributesFromExtensions, getChangedRanges, getDebugJSON, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAtPosition, getNodeAttributes, getNodeType, getRenderedAttributes, getSchema, getSchemaByResolvedExtensions, getSchemaTypeByName, getSchemaTypeNameByName, getSplittedAttributes, getText, getTextBetween, getTextContentFromNodes, getTextSerializersFromSchema, getUpdatedPosition, h, injectExtensionAttributesToParseRule, inputRulesPlugin, insertContent, insertContentAt, isActive, isAndroid, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFirefox, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isSafari, isString, isTextSelection, isiOS, joinBackward, joinDown, joinForward, joinItemBackward, joinItemForward, joinTextblockBackward, joinTextblockForward, joinUp, keyboardShortcut, lift, liftEmptyBlock, liftListItem, markInputRule, markPasteRule, index as markdown, mergeAttributes, mergeDeep, minMax, newlineInCode, nodeInputRule, nodePasteRule, objectIncludes, parseAttributes, parseIndentedBlocks, pasteRulesPlugin, posToDOMRect, removeDuplicates, renderNestedMarkdownContent, resetAttributes, resolveExtensions, resolveFocusPosition, rewriteUnknownContent, scrollIntoView, selectAll, selectNodeBackward, selectNodeForward, selectParentNode, selectTextblockEnd, selectTextblockStart, selectionToInsertionEnd, serializeAttributes, setContent, setMark, setMeta, setNode, setNodeSelection, setTextDirection, setTextSelection, sinkListItem, sortExtensions, splitBlock, splitExtensions, splitListItem, textInputRule, textPasteRule, textblockTypeInputRule, toggleList, toggleMark, toggleNode, toggleWrap, undoInputRule, unsetAllMarks, unsetMark, unsetTextDirection, updateAttributes, updateMarkViewAttributes, wrapIn, wrapInList, wrappingInputRule };
|
|
4985
|
+
export { type AllowedAttribute, type AnyCommands, type AnyConfig, type AnyExtension, type AtomBlockMarkdownSpecOptions, type Attribute, type Attributes$1 as Attributes, type BlockMarkdownSpecOptions, type BlockParserConfig, type CanCommands, type ChainedCommands, type ChangedRange, type Command, CommandManager, type CommandProps, type CommandSpec, type Commands, type Content, type CreateNodeFromContentOptions, type DOMNode, type DOMOutputSpecArray$1 as DOMOutputSpecArray, type DecorationType, type DecorationWithType, type Diff, type Dispatch, type DispatchTransactionProps, type DocumentType, Editor, type EditorEvents, type EditorOptions, type EnableRules, Extendable, type ExtendableConfig, type ExtendedRegExpMatchArray, Extension, type ExtensionAttribute, type ExtensionConfig, type Extensions, type FocusPosition, Fragment, type FullMarkdownHelpers, type GetUpdatedPositionResult, type GlobalAttributes, type HTMLContent, type InlineMarkdownSpecOptions, InputRule, type InputRuleFinder, type InputRuleMatch, type InsertContentAtOptions, type InsertContentOptions, type JSONContent, type KeyboardShortcutCommand, type KeysWithTypeOf, MappablePosition, Mark, type MarkConfig, type MarkRange, type MarkType, MarkView, type MarkViewProps, type MarkViewRenderer, type MarkViewRendererOptions, type MarkViewRendererProps, type MarkdownExtensionSpec, type MarkdownHelpers, type MarkdownLexerConfiguration, type MarkdownParseHelpers, type MarkdownParseResult, type MarkdownRendererHelpers, type MarkdownToken, type MarkdownTokenizer, type MaybeReturnType, type MaybeThisParameterType, Node, type NodeConfig, NodePos, type NodeRange, type NodeType, NodeView, type NodeViewProps, type NodeViewRenderer, type NodeViewRendererOptions, type NodeViewRendererProps, type NodeWithPos, type Overwrite, type ParentConfig, type ParsedBlock, PasteRule, type PasteRuleFinder, type PasteRuleMatch, type PickValue, type Predicate, type Primitive, type Range, type RawCommands, type RemoveThis, type RenderContext, type ResizableNodeDimensions, ResizableNodeView, type ResizableNodeViewDirection, type ResizableNodeViewOptions, ResizableNodeview, type SetContentOptions, type SingleCommands, type Storage, type TextSerializer, type TextType, type TiptapEditorHTMLElement, Tracker, type TrackerResult, type UnionCommands, type UnionToIntersection, type Utils, type ValuesOf, blur, callOrReturn, canInsertNode, cancelPositionCheck, clearContent, clearNodes, combineTransactionSteps, command, index$2 as commands, createAtomBlockMarkdownSpec, createBlockMarkdownSpec, createChainableState, createDocument, h as createElement, createInlineMarkdownSpec, createMappablePosition, createNodeFromContent, createParagraphNear, createStyleTag, cut, decodeHtmlEntities, defaultBlockAt, deleteCurrentNode, deleteNode, deleteProps, deleteRange, deleteSelection, elementFromString, encodeHtmlEntities, enter, escapeForRegEx, exitCode, extendMarkRange, index$1 as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, first, flattenExtensions, focus, forEach, fromString, generateHTML, generateJSON, generateText, getAttributes, getAttributesFromExtensions, getChangedRanges, getDebugJSON, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAtPosition, getNodeAttributes, getNodeType, getRenderedAttributes, getSchema, getSchemaByResolvedExtensions, getSchemaTypeByName, getSchemaTypeNameByName, getSplittedAttributes, getText, getTextBetween, getTextContentFromNodes, getTextSerializersFromSchema, getUpdatedPosition, h, injectExtensionAttributesToParseRule, inputRulesPlugin, insertContent, insertContentAt, isActive, isAndroid, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFirefox, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isSafari, isString, isTextSelection, isiOS, joinBackward, joinDown, joinForward, joinItemBackward, joinItemForward, joinTextblockBackward, joinTextblockForward, joinUp, keyboardShortcut, lift, liftEmptyBlock, liftListItem, markInputRule, markPasteRule, index as markdown, mergeAttributes, mergeDeep, minMax, newlineInCode, nodeInputRule, nodePasteRule, objectIncludes, parseAttributes, parseIndentedBlocks, pasteRulesPlugin, posToDOMRect, removeDuplicates, renderNestedMarkdownContent, resetAttributes, resolveExtensions, resolveFocusPosition, rewriteUnknownContent, schedulePositionCheck, scrollIntoView, selectAll, selectNodeBackward, selectNodeForward, selectParentNode, selectTextblockEnd, selectTextblockStart, selectionToInsertionEnd, serializeAttributes, setContent, setMark, setMeta, setNode, setNodeSelection, setTextDirection, setTextSelection, sinkListItem, sortExtensions, splitBlock, splitExtensions, splitListItem, textInputRule, textPasteRule, textblockTypeInputRule, toggleList, toggleMark, toggleNode, toggleWrap, undoInputRule, unsetAllMarks, unsetMark, unsetTextDirection, updateAttributes, updateMarkViewAttributes, wrapIn, wrapInList, wrappingInputRule };
|
package/dist/index.d.ts
CHANGED
|
@@ -4947,6 +4947,18 @@ declare function mergeDeep(target: Record<string, any>, source: Record<string, a
|
|
|
4947
4947
|
|
|
4948
4948
|
declare function minMax(value?: number, min?: number, max?: number): number;
|
|
4949
4949
|
|
|
4950
|
+
/**
|
|
4951
|
+
* Register a callback to be called (via a shared rAF) after every editor
|
|
4952
|
+
* update transaction. If this is the first registration for the given editor,
|
|
4953
|
+
* a new registry entry and a single `editor.on('update')` listener are created.
|
|
4954
|
+
*/
|
|
4955
|
+
declare function schedulePositionCheck(editor: Editor, callback: () => void): void;
|
|
4956
|
+
/**
|
|
4957
|
+
* Unregister a previously registered callback. When the last callback for an
|
|
4958
|
+
* editor is removed, the shared listener and any pending rAF are also cleaned up.
|
|
4959
|
+
*/
|
|
4960
|
+
declare function cancelPositionCheck(editor: Editor, callback: () => void): void;
|
|
4961
|
+
|
|
4950
4962
|
/**
|
|
4951
4963
|
* Check if object1 includes object2
|
|
4952
4964
|
* @param object1 Object
|
|
@@ -4970,4 +4982,4 @@ interface Commands<ReturnType = any> {
|
|
|
4970
4982
|
interface Storage {
|
|
4971
4983
|
}
|
|
4972
4984
|
|
|
4973
|
-
export { type AllowedAttribute, type AnyCommands, type AnyConfig, type AnyExtension, type AtomBlockMarkdownSpecOptions, type Attribute, type Attributes$1 as Attributes, type BlockMarkdownSpecOptions, type BlockParserConfig, type CanCommands, type ChainedCommands, type ChangedRange, type Command, CommandManager, type CommandProps, type CommandSpec, type Commands, type Content, type CreateNodeFromContentOptions, type DOMNode, type DOMOutputSpecArray$1 as DOMOutputSpecArray, type DecorationType, type DecorationWithType, type Diff, type Dispatch, type DispatchTransactionProps, type DocumentType, Editor, type EditorEvents, type EditorOptions, type EnableRules, Extendable, type ExtendableConfig, type ExtendedRegExpMatchArray, Extension, type ExtensionAttribute, type ExtensionConfig, type Extensions, type FocusPosition, Fragment, type FullMarkdownHelpers, type GetUpdatedPositionResult, type GlobalAttributes, type HTMLContent, type InlineMarkdownSpecOptions, InputRule, type InputRuleFinder, type InputRuleMatch, type InsertContentAtOptions, type InsertContentOptions, type JSONContent, type KeyboardShortcutCommand, type KeysWithTypeOf, MappablePosition, Mark, type MarkConfig, type MarkRange, type MarkType, MarkView, type MarkViewProps, type MarkViewRenderer, type MarkViewRendererOptions, type MarkViewRendererProps, type MarkdownExtensionSpec, type MarkdownHelpers, type MarkdownLexerConfiguration, type MarkdownParseHelpers, type MarkdownParseResult, type MarkdownRendererHelpers, type MarkdownToken, type MarkdownTokenizer, type MaybeReturnType, type MaybeThisParameterType, Node, type NodeConfig, NodePos, type NodeRange, type NodeType, NodeView, type NodeViewProps, type NodeViewRenderer, type NodeViewRendererOptions, type NodeViewRendererProps, type NodeWithPos, type Overwrite, type ParentConfig, type ParsedBlock, PasteRule, type PasteRuleFinder, type PasteRuleMatch, type PickValue, type Predicate, type Primitive, type Range, type RawCommands, type RemoveThis, type RenderContext, type ResizableNodeDimensions, ResizableNodeView, type ResizableNodeViewDirection, type ResizableNodeViewOptions, ResizableNodeview, type SetContentOptions, type SingleCommands, type Storage, type TextSerializer, type TextType, type TiptapEditorHTMLElement, Tracker, type TrackerResult, type UnionCommands, type UnionToIntersection, type Utils, type ValuesOf, blur, callOrReturn, canInsertNode, clearContent, clearNodes, combineTransactionSteps, command, index$2 as commands, createAtomBlockMarkdownSpec, createBlockMarkdownSpec, createChainableState, createDocument, h as createElement, createInlineMarkdownSpec, createMappablePosition, createNodeFromContent, createParagraphNear, createStyleTag, cut, decodeHtmlEntities, defaultBlockAt, deleteCurrentNode, deleteNode, deleteProps, deleteRange, deleteSelection, elementFromString, encodeHtmlEntities, enter, escapeForRegEx, exitCode, extendMarkRange, index$1 as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, first, flattenExtensions, focus, forEach, fromString, generateHTML, generateJSON, generateText, getAttributes, getAttributesFromExtensions, getChangedRanges, getDebugJSON, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAtPosition, getNodeAttributes, getNodeType, getRenderedAttributes, getSchema, getSchemaByResolvedExtensions, getSchemaTypeByName, getSchemaTypeNameByName, getSplittedAttributes, getText, getTextBetween, getTextContentFromNodes, getTextSerializersFromSchema, getUpdatedPosition, h, injectExtensionAttributesToParseRule, inputRulesPlugin, insertContent, insertContentAt, isActive, isAndroid, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFirefox, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isSafari, isString, isTextSelection, isiOS, joinBackward, joinDown, joinForward, joinItemBackward, joinItemForward, joinTextblockBackward, joinTextblockForward, joinUp, keyboardShortcut, lift, liftEmptyBlock, liftListItem, markInputRule, markPasteRule, index as markdown, mergeAttributes, mergeDeep, minMax, newlineInCode, nodeInputRule, nodePasteRule, objectIncludes, parseAttributes, parseIndentedBlocks, pasteRulesPlugin, posToDOMRect, removeDuplicates, renderNestedMarkdownContent, resetAttributes, resolveExtensions, resolveFocusPosition, rewriteUnknownContent, scrollIntoView, selectAll, selectNodeBackward, selectNodeForward, selectParentNode, selectTextblockEnd, selectTextblockStart, selectionToInsertionEnd, serializeAttributes, setContent, setMark, setMeta, setNode, setNodeSelection, setTextDirection, setTextSelection, sinkListItem, sortExtensions, splitBlock, splitExtensions, splitListItem, textInputRule, textPasteRule, textblockTypeInputRule, toggleList, toggleMark, toggleNode, toggleWrap, undoInputRule, unsetAllMarks, unsetMark, unsetTextDirection, updateAttributes, updateMarkViewAttributes, wrapIn, wrapInList, wrappingInputRule };
|
|
4985
|
+
export { type AllowedAttribute, type AnyCommands, type AnyConfig, type AnyExtension, type AtomBlockMarkdownSpecOptions, type Attribute, type Attributes$1 as Attributes, type BlockMarkdownSpecOptions, type BlockParserConfig, type CanCommands, type ChainedCommands, type ChangedRange, type Command, CommandManager, type CommandProps, type CommandSpec, type Commands, type Content, type CreateNodeFromContentOptions, type DOMNode, type DOMOutputSpecArray$1 as DOMOutputSpecArray, type DecorationType, type DecorationWithType, type Diff, type Dispatch, type DispatchTransactionProps, type DocumentType, Editor, type EditorEvents, type EditorOptions, type EnableRules, Extendable, type ExtendableConfig, type ExtendedRegExpMatchArray, Extension, type ExtensionAttribute, type ExtensionConfig, type Extensions, type FocusPosition, Fragment, type FullMarkdownHelpers, type GetUpdatedPositionResult, type GlobalAttributes, type HTMLContent, type InlineMarkdownSpecOptions, InputRule, type InputRuleFinder, type InputRuleMatch, type InsertContentAtOptions, type InsertContentOptions, type JSONContent, type KeyboardShortcutCommand, type KeysWithTypeOf, MappablePosition, Mark, type MarkConfig, type MarkRange, type MarkType, MarkView, type MarkViewProps, type MarkViewRenderer, type MarkViewRendererOptions, type MarkViewRendererProps, type MarkdownExtensionSpec, type MarkdownHelpers, type MarkdownLexerConfiguration, type MarkdownParseHelpers, type MarkdownParseResult, type MarkdownRendererHelpers, type MarkdownToken, type MarkdownTokenizer, type MaybeReturnType, type MaybeThisParameterType, Node, type NodeConfig, NodePos, type NodeRange, type NodeType, NodeView, type NodeViewProps, type NodeViewRenderer, type NodeViewRendererOptions, type NodeViewRendererProps, type NodeWithPos, type Overwrite, type ParentConfig, type ParsedBlock, PasteRule, type PasteRuleFinder, type PasteRuleMatch, type PickValue, type Predicate, type Primitive, type Range, type RawCommands, type RemoveThis, type RenderContext, type ResizableNodeDimensions, ResizableNodeView, type ResizableNodeViewDirection, type ResizableNodeViewOptions, ResizableNodeview, type SetContentOptions, type SingleCommands, type Storage, type TextSerializer, type TextType, type TiptapEditorHTMLElement, Tracker, type TrackerResult, type UnionCommands, type UnionToIntersection, type Utils, type ValuesOf, blur, callOrReturn, canInsertNode, cancelPositionCheck, clearContent, clearNodes, combineTransactionSteps, command, index$2 as commands, createAtomBlockMarkdownSpec, createBlockMarkdownSpec, createChainableState, createDocument, h as createElement, createInlineMarkdownSpec, createMappablePosition, createNodeFromContent, createParagraphNear, createStyleTag, cut, decodeHtmlEntities, defaultBlockAt, deleteCurrentNode, deleteNode, deleteProps, deleteRange, deleteSelection, elementFromString, encodeHtmlEntities, enter, escapeForRegEx, exitCode, extendMarkRange, index$1 as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, first, flattenExtensions, focus, forEach, fromString, generateHTML, generateJSON, generateText, getAttributes, getAttributesFromExtensions, getChangedRanges, getDebugJSON, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAtPosition, getNodeAttributes, getNodeType, getRenderedAttributes, getSchema, getSchemaByResolvedExtensions, getSchemaTypeByName, getSchemaTypeNameByName, getSplittedAttributes, getText, getTextBetween, getTextContentFromNodes, getTextSerializersFromSchema, getUpdatedPosition, h, injectExtensionAttributesToParseRule, inputRulesPlugin, insertContent, insertContentAt, isActive, isAndroid, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFirefox, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isSafari, isString, isTextSelection, isiOS, joinBackward, joinDown, joinForward, joinItemBackward, joinItemForward, joinTextblockBackward, joinTextblockForward, joinUp, keyboardShortcut, lift, liftEmptyBlock, liftListItem, markInputRule, markPasteRule, index as markdown, mergeAttributes, mergeDeep, minMax, newlineInCode, nodeInputRule, nodePasteRule, objectIncludes, parseAttributes, parseIndentedBlocks, pasteRulesPlugin, posToDOMRect, removeDuplicates, renderNestedMarkdownContent, resetAttributes, resolveExtensions, resolveFocusPosition, rewriteUnknownContent, schedulePositionCheck, scrollIntoView, selectAll, selectNodeBackward, selectNodeForward, selectParentNode, selectTextblockEnd, selectTextblockStart, selectionToInsertionEnd, serializeAttributes, setContent, setMark, setMeta, setNode, setNodeSelection, setTextDirection, setTextSelection, sinkListItem, sortExtensions, splitBlock, splitExtensions, splitListItem, textInputRule, textPasteRule, textblockTypeInputRule, toggleList, toggleMark, toggleNode, toggleWrap, undoInputRule, unsetAllMarks, unsetMark, unsetTextDirection, updateAttributes, updateMarkViewAttributes, wrapIn, wrapInList, wrappingInputRule };
|
package/dist/index.js
CHANGED
|
@@ -2656,6 +2656,7 @@ var splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch,
|
|
|
2656
2656
|
};
|
|
2657
2657
|
|
|
2658
2658
|
// src/commands/toggleList.ts
|
|
2659
|
+
import { TextSelection as TextSelection8 } from "@tiptap/pm/state";
|
|
2659
2660
|
import { canJoin } from "@tiptap/pm/transform";
|
|
2660
2661
|
var joinListBackwards = (tr, listType) => {
|
|
2661
2662
|
const list = findParentNode((node) => node.type === listType)(tr.selection);
|
|
@@ -2691,6 +2692,16 @@ var joinListForwards = (tr, listType) => {
|
|
|
2691
2692
|
tr.join(after);
|
|
2692
2693
|
return true;
|
|
2693
2694
|
};
|
|
2695
|
+
function createInnerSelectionForWholeDocList(tr) {
|
|
2696
|
+
const doc = tr.doc;
|
|
2697
|
+
const list = doc.firstChild;
|
|
2698
|
+
if (!list) {
|
|
2699
|
+
return null;
|
|
2700
|
+
}
|
|
2701
|
+
const from = 1;
|
|
2702
|
+
const to = list.nodeSize - 1;
|
|
2703
|
+
return TextSelection8.create(doc, from, to);
|
|
2704
|
+
}
|
|
2694
2705
|
var toggleList = (listTypeOrName, itemTypeOrName, keepMarks, attributes = {}) => ({ editor, tr, state, dispatch, chain, commands, can }) => {
|
|
2695
2706
|
const { extensions, splittableMarks } = editor.extensionManager;
|
|
2696
2707
|
const listType = getNodeType(listTypeOrName, state.schema);
|
|
@@ -2703,13 +2714,37 @@ var toggleList = (listTypeOrName, itemTypeOrName, keepMarks, attributes = {}) =>
|
|
|
2703
2714
|
return false;
|
|
2704
2715
|
}
|
|
2705
2716
|
const parentList = findParentNode((node) => isList(node.type.name, extensions))(selection);
|
|
2706
|
-
|
|
2707
|
-
|
|
2717
|
+
const isAllSelection = selection.from === 0 && selection.to === state.doc.content.size;
|
|
2718
|
+
const topLevelNodes = state.doc.content.content;
|
|
2719
|
+
const soleTopLevelNode = topLevelNodes.length === 1 ? topLevelNodes[0] : null;
|
|
2720
|
+
const allSelectionList = isAllSelection && soleTopLevelNode && isList(soleTopLevelNode.type.name, extensions) ? {
|
|
2721
|
+
node: soleTopLevelNode,
|
|
2722
|
+
pos: 0,
|
|
2723
|
+
depth: 0
|
|
2724
|
+
} : null;
|
|
2725
|
+
const currentList = parentList != null ? parentList : allSelectionList;
|
|
2726
|
+
const isInsideExistingList = !!parentList && range.depth >= 1 && range.depth - parentList.depth <= 1;
|
|
2727
|
+
const hasWholeDocSelectedList = !!allSelectionList;
|
|
2728
|
+
if ((isInsideExistingList || hasWholeDocSelectedList) && currentList) {
|
|
2729
|
+
if (currentList.node.type === listType) {
|
|
2730
|
+
if (isAllSelection && hasWholeDocSelectedList) {
|
|
2731
|
+
return chain().command(({ tr: trx, dispatch: disp }) => {
|
|
2732
|
+
const nextSelection = createInnerSelectionForWholeDocList(trx);
|
|
2733
|
+
if (!nextSelection) {
|
|
2734
|
+
return false;
|
|
2735
|
+
}
|
|
2736
|
+
trx.setSelection(nextSelection);
|
|
2737
|
+
if (disp) {
|
|
2738
|
+
disp(trx);
|
|
2739
|
+
}
|
|
2740
|
+
return true;
|
|
2741
|
+
}).liftListItem(itemType).run();
|
|
2742
|
+
}
|
|
2708
2743
|
return commands.liftListItem(itemType);
|
|
2709
2744
|
}
|
|
2710
|
-
if (isList(
|
|
2745
|
+
if (isList(currentList.node.type.name, extensions) && listType.validContent(currentList.node.content)) {
|
|
2711
2746
|
return chain().command(() => {
|
|
2712
|
-
tr.setNodeMarkup(
|
|
2747
|
+
tr.setNodeMarkup(currentList.pos, listType);
|
|
2713
2748
|
return true;
|
|
2714
2749
|
}).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
|
|
2715
2750
|
}
|
|
@@ -6457,6 +6492,45 @@ ${indentedChild}`;
|
|
|
6457
6492
|
return output;
|
|
6458
6493
|
}
|
|
6459
6494
|
|
|
6495
|
+
// src/utilities/nodeViewPositionRegistry.ts
|
|
6496
|
+
var positionUpdateRegistries = /* @__PURE__ */ new WeakMap();
|
|
6497
|
+
function schedulePositionCheck(editor, callback) {
|
|
6498
|
+
let registry = positionUpdateRegistries.get(editor);
|
|
6499
|
+
if (!registry) {
|
|
6500
|
+
const newRegistry = {
|
|
6501
|
+
callbacks: /* @__PURE__ */ new Set(),
|
|
6502
|
+
rafId: null,
|
|
6503
|
+
handler: () => {
|
|
6504
|
+
if (newRegistry.rafId !== null) {
|
|
6505
|
+
cancelAnimationFrame(newRegistry.rafId);
|
|
6506
|
+
}
|
|
6507
|
+
newRegistry.rafId = requestAnimationFrame(() => {
|
|
6508
|
+
newRegistry.rafId = null;
|
|
6509
|
+
newRegistry.callbacks.forEach((cb) => cb());
|
|
6510
|
+
});
|
|
6511
|
+
}
|
|
6512
|
+
};
|
|
6513
|
+
positionUpdateRegistries.set(editor, newRegistry);
|
|
6514
|
+
editor.on("update", newRegistry.handler);
|
|
6515
|
+
registry = newRegistry;
|
|
6516
|
+
}
|
|
6517
|
+
registry.callbacks.add(callback);
|
|
6518
|
+
}
|
|
6519
|
+
function cancelPositionCheck(editor, callback) {
|
|
6520
|
+
const registry = positionUpdateRegistries.get(editor);
|
|
6521
|
+
if (!registry) {
|
|
6522
|
+
return;
|
|
6523
|
+
}
|
|
6524
|
+
registry.callbacks.delete(callback);
|
|
6525
|
+
if (registry.callbacks.size === 0) {
|
|
6526
|
+
if (registry.rafId !== null) {
|
|
6527
|
+
cancelAnimationFrame(registry.rafId);
|
|
6528
|
+
}
|
|
6529
|
+
editor.off("update", registry.handler);
|
|
6530
|
+
positionUpdateRegistries.delete(editor);
|
|
6531
|
+
}
|
|
6532
|
+
}
|
|
6533
|
+
|
|
6460
6534
|
// src/MarkView.ts
|
|
6461
6535
|
function updateMarkViewAttributes(checkMark, editor, attrs = {}) {
|
|
6462
6536
|
const { state } = editor;
|
|
@@ -6663,6 +6737,7 @@ var NodeView = class {
|
|
|
6663
6737
|
return false;
|
|
6664
6738
|
}
|
|
6665
6739
|
const isDragEvent = event.type.startsWith("drag");
|
|
6740
|
+
const isDragOverEnterEvent = event.type === "dragover" || event.type === "dragenter";
|
|
6666
6741
|
const isDropEvent = event.type === "drop";
|
|
6667
6742
|
const isInput = ["INPUT", "BUTTON", "SELECT", "TEXTAREA"].includes(target.tagName) || target.isContentEditable;
|
|
6668
6743
|
if (isInput && !isDropEvent && !isDragEvent) {
|
|
@@ -6711,7 +6786,7 @@ var NodeView = class {
|
|
|
6711
6786
|
);
|
|
6712
6787
|
}
|
|
6713
6788
|
}
|
|
6714
|
-
if (isDragging || isDropEvent || isCopyEvent || isPasteEvent || isCutEvent || isClickEvent && isSelectable) {
|
|
6789
|
+
if (isDragging || isDragOverEnterEvent || isDropEvent || isCopyEvent || isPasteEvent || isCutEvent || isClickEvent && isSelectable) {
|
|
6715
6790
|
return false;
|
|
6716
6791
|
}
|
|
6717
6792
|
return true;
|
|
@@ -6809,7 +6884,10 @@ function markPasteRule(config) {
|
|
|
6809
6884
|
}
|
|
6810
6885
|
markEnd = range.from + startSpaces + captureGroup.length;
|
|
6811
6886
|
tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));
|
|
6812
|
-
|
|
6887
|
+
const isMatchAtEndOfText = match.index !== void 0 && match.input !== void 0 && match.index + match[0].length >= match.input.length;
|
|
6888
|
+
if (!isMatchAtEndOfText) {
|
|
6889
|
+
tr.removeStoredMark(config.type);
|
|
6890
|
+
}
|
|
6813
6891
|
}
|
|
6814
6892
|
}
|
|
6815
6893
|
});
|
|
@@ -6899,6 +6977,7 @@ export {
|
|
|
6899
6977
|
Tracker,
|
|
6900
6978
|
callOrReturn,
|
|
6901
6979
|
canInsertNode,
|
|
6980
|
+
cancelPositionCheck,
|
|
6902
6981
|
combineTransactionSteps,
|
|
6903
6982
|
commands_exports as commands,
|
|
6904
6983
|
createAtomBlockMarkdownSpec,
|
|
@@ -6993,6 +7072,7 @@ export {
|
|
|
6993
7072
|
resolveExtensions,
|
|
6994
7073
|
resolveFocusPosition,
|
|
6995
7074
|
rewriteUnknownContent,
|
|
7075
|
+
schedulePositionCheck,
|
|
6996
7076
|
selectionToInsertionEnd,
|
|
6997
7077
|
serializeAttributes,
|
|
6998
7078
|
sortExtensions,
|