@tiptap/core 3.20.6 → 3.22.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 +21 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -3
- package/dist/index.d.ts +22 -3
- package/dist/index.js +19 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/htmlEntities.test.ts +55 -0
- package/src/commands/extendMarkRange.ts +3 -2
- package/src/extensions/delete.ts +2 -1
- package/src/helpers/getMarkRange.ts +7 -2
- package/src/lib/ResizableNodeView.ts +1 -1
- package/src/utilities/htmlEntities.ts +26 -0
- package/src/utilities/index.ts +1 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transaction, EditorState, Plugin, Selection, NodeSelection, TextSelection, PluginKey } from '@tiptap/pm/state';
|
|
2
2
|
import { Node as Node$1, MarkType as MarkType$1, MarkSpec, Mark as Mark$1, DOMOutputSpec, NodeType as NodeType$1, NodeSpec, Slice, ParseOptions, Fragment as Fragment$1, Schema, ContentMatch, ResolvedPos, ParseRule } from '@tiptap/pm/model';
|
|
3
|
-
import { NodeViewConstructor, NodeView as NodeView$1, MarkViewConstructor, MarkView as MarkView$1, EditorProps, EditorView,
|
|
3
|
+
import { NodeViewConstructor, NodeView as NodeView$1, MarkViewConstructor, MarkView as MarkView$1, EditorProps, EditorView, Decoration, DecorationAttrs, ViewMutationRecord, DecorationSource } from '@tiptap/pm/view';
|
|
4
4
|
import { Transform, Mappable, MapResult } from '@tiptap/pm/transform';
|
|
5
5
|
|
|
6
6
|
type StringKeyOf<T> = Extract<keyof T, string>;
|
|
@@ -2622,7 +2622,8 @@ declare module '@tiptap/core' {
|
|
|
2622
2622
|
/**
|
|
2623
2623
|
* Extends the text selection to the current mark by type or name.
|
|
2624
2624
|
* @param typeOrName The type or name of the mark.
|
|
2625
|
-
* @param attributes The attributes
|
|
2625
|
+
* @param attributes The attributes to match against.
|
|
2626
|
+
* If not provided, only the first mark at the position will be matched.
|
|
2626
2627
|
* @example editor.commands.extendMarkRange('bold')
|
|
2627
2628
|
* @example editor.commands.extendMarkRange('mention', { userId: "1" })
|
|
2628
2629
|
*/
|
|
@@ -4480,6 +4481,24 @@ declare function findDuplicates<T>(items: T[]): T[];
|
|
|
4480
4481
|
|
|
4481
4482
|
declare function fromString(value: any): any;
|
|
4482
4483
|
|
|
4484
|
+
/**
|
|
4485
|
+
* Decode common HTML entities in text content so they display as literal
|
|
4486
|
+
* characters inside the editor. The decode order matters: `&` must be
|
|
4487
|
+
* decoded **last** so that doubly-encoded sequences like `&lt;` first
|
|
4488
|
+
* survive the `<` pass and then correctly become `<` (not `<`).
|
|
4489
|
+
*/
|
|
4490
|
+
declare function decodeHtmlEntities(text: string): string;
|
|
4491
|
+
/**
|
|
4492
|
+
* Encode HTML special characters so they roundtrip safely through markdown.
|
|
4493
|
+
* `&` is encoded **first** to avoid double-encoding the ampersand in other
|
|
4494
|
+
* entities (e.g. `<` → `<`, not `&lt;`).
|
|
4495
|
+
*
|
|
4496
|
+
* Note: `"` is intentionally NOT encoded here because double quotes are
|
|
4497
|
+
* ordinary characters in markdown and do not need escaping. The decode
|
|
4498
|
+
* function still handles `"` because the markdown tokenizer may emit it.
|
|
4499
|
+
*/
|
|
4500
|
+
declare function encodeHtmlEntities(text: string): string;
|
|
4501
|
+
|
|
4483
4502
|
declare function isAndroid(): boolean;
|
|
4484
4503
|
|
|
4485
4504
|
declare function isEmptyObject(value?: {}): boolean;
|
|
@@ -4951,4 +4970,4 @@ interface Commands<ReturnType = any> {
|
|
|
4951
4970
|
interface Storage {
|
|
4952
4971
|
}
|
|
4953
4972
|
|
|
4954
|
-
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, defaultBlockAt, deleteCurrentNode, deleteNode, deleteProps, deleteRange, deleteSelection, elementFromString, 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transaction, EditorState, Plugin, Selection, NodeSelection, TextSelection, PluginKey } from '@tiptap/pm/state';
|
|
2
2
|
import { Node as Node$1, MarkType as MarkType$1, MarkSpec, Mark as Mark$1, DOMOutputSpec, NodeType as NodeType$1, NodeSpec, Slice, ParseOptions, Fragment as Fragment$1, Schema, ContentMatch, ResolvedPos, ParseRule } from '@tiptap/pm/model';
|
|
3
|
-
import { NodeViewConstructor, NodeView as NodeView$1, MarkViewConstructor, MarkView as MarkView$1, EditorProps, EditorView,
|
|
3
|
+
import { NodeViewConstructor, NodeView as NodeView$1, MarkViewConstructor, MarkView as MarkView$1, EditorProps, EditorView, Decoration, DecorationAttrs, ViewMutationRecord, DecorationSource } from '@tiptap/pm/view';
|
|
4
4
|
import { Transform, Mappable, MapResult } from '@tiptap/pm/transform';
|
|
5
5
|
|
|
6
6
|
type StringKeyOf<T> = Extract<keyof T, string>;
|
|
@@ -2622,7 +2622,8 @@ declare module '@tiptap/core' {
|
|
|
2622
2622
|
/**
|
|
2623
2623
|
* Extends the text selection to the current mark by type or name.
|
|
2624
2624
|
* @param typeOrName The type or name of the mark.
|
|
2625
|
-
* @param attributes The attributes
|
|
2625
|
+
* @param attributes The attributes to match against.
|
|
2626
|
+
* If not provided, only the first mark at the position will be matched.
|
|
2626
2627
|
* @example editor.commands.extendMarkRange('bold')
|
|
2627
2628
|
* @example editor.commands.extendMarkRange('mention', { userId: "1" })
|
|
2628
2629
|
*/
|
|
@@ -4480,6 +4481,24 @@ declare function findDuplicates<T>(items: T[]): T[];
|
|
|
4480
4481
|
|
|
4481
4482
|
declare function fromString(value: any): any;
|
|
4482
4483
|
|
|
4484
|
+
/**
|
|
4485
|
+
* Decode common HTML entities in text content so they display as literal
|
|
4486
|
+
* characters inside the editor. The decode order matters: `&` must be
|
|
4487
|
+
* decoded **last** so that doubly-encoded sequences like `&lt;` first
|
|
4488
|
+
* survive the `<` pass and then correctly become `<` (not `<`).
|
|
4489
|
+
*/
|
|
4490
|
+
declare function decodeHtmlEntities(text: string): string;
|
|
4491
|
+
/**
|
|
4492
|
+
* Encode HTML special characters so they roundtrip safely through markdown.
|
|
4493
|
+
* `&` is encoded **first** to avoid double-encoding the ampersand in other
|
|
4494
|
+
* entities (e.g. `<` → `<`, not `&lt;`).
|
|
4495
|
+
*
|
|
4496
|
+
* Note: `"` is intentionally NOT encoded here because double quotes are
|
|
4497
|
+
* ordinary characters in markdown and do not need escaping. The decode
|
|
4498
|
+
* function still handles `"` because the markdown tokenizer may emit it.
|
|
4499
|
+
*/
|
|
4500
|
+
declare function encodeHtmlEntities(text: string): string;
|
|
4501
|
+
|
|
4483
4502
|
declare function isAndroid(): boolean;
|
|
4484
4503
|
|
|
4485
4504
|
declare function isEmptyObject(value?: {}): boolean;
|
|
@@ -4951,4 +4970,4 @@ interface Commands<ReturnType = any> {
|
|
|
4951
4970
|
interface Storage {
|
|
4952
4971
|
}
|
|
4953
4972
|
|
|
4954
|
-
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, defaultBlockAt, deleteCurrentNode, deleteNode, deleteProps, deleteRange, deleteSelection, elementFromString, 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -397,7 +397,6 @@ function isMarkInSet(marks, type, attributes = {}) {
|
|
|
397
397
|
return !!findMarkInSet(marks, type, attributes);
|
|
398
398
|
}
|
|
399
399
|
function getMarkRange($pos, type, attributes) {
|
|
400
|
-
var _a;
|
|
401
400
|
if (!$pos || !type) {
|
|
402
401
|
return;
|
|
403
402
|
}
|
|
@@ -408,7 +407,12 @@ function getMarkRange($pos, type, attributes) {
|
|
|
408
407
|
if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) {
|
|
409
408
|
return;
|
|
410
409
|
}
|
|
411
|
-
|
|
410
|
+
if (!attributes) {
|
|
411
|
+
const firstMark = start.node.marks.find((mark2) => mark2.type === type);
|
|
412
|
+
if (firstMark) {
|
|
413
|
+
attributes = firstMark.attrs;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
412
416
|
const mark = findMarkInSet([...start.node.marks], type, attributes);
|
|
413
417
|
if (!mark) {
|
|
414
418
|
return;
|
|
@@ -443,7 +447,7 @@ function getMarkType(nameOrType, schema) {
|
|
|
443
447
|
}
|
|
444
448
|
|
|
445
449
|
// src/commands/extendMarkRange.ts
|
|
446
|
-
var extendMarkRange = (typeOrName, attributes
|
|
450
|
+
var extendMarkRange = (typeOrName, attributes) => ({ tr, state, dispatch }) => {
|
|
447
451
|
const type = getMarkType(typeOrName, state.schema);
|
|
448
452
|
const { doc, selection } = tr;
|
|
449
453
|
const { $from, from, to } = selection;
|
|
@@ -4017,7 +4021,7 @@ var Delete = Extension.create({
|
|
|
4017
4021
|
const newEnd = mapping.slice(index).map(step.to);
|
|
4018
4022
|
const oldStart = mapping.invert().map(newStart, -1);
|
|
4019
4023
|
const oldEnd = mapping.invert().map(newEnd);
|
|
4020
|
-
const foundBeforeMark = (_a3 = nextTransaction.doc.nodeAt(newStart - 1)) == null ? void 0 : _a3.marks.some((mark) => mark.eq(step.mark));
|
|
4024
|
+
const foundBeforeMark = newStart > 0 ? (_a3 = nextTransaction.doc.nodeAt(newStart - 1)) == null ? void 0 : _a3.marks.some((mark) => mark.eq(step.mark)) : false;
|
|
4021
4025
|
const foundAfterMark = (_b3 = nextTransaction.doc.nodeAt(newEnd)) == null ? void 0 : _b3.marks.some((mark) => mark.eq(step.mark));
|
|
4022
4026
|
this.editor.emit("delete", {
|
|
4023
4027
|
type: "mark",
|
|
@@ -5591,7 +5595,7 @@ var ResizableNodeView = class {
|
|
|
5591
5595
|
const element = document.createElement("div");
|
|
5592
5596
|
element.dataset.resizeContainer = "";
|
|
5593
5597
|
element.dataset.node = this.node.type.name;
|
|
5594
|
-
element.style.display = "flex";
|
|
5598
|
+
element.style.display = this.node.type.isInline ? "inline-flex" : "flex";
|
|
5595
5599
|
if (this.classNames.container) {
|
|
5596
5600
|
element.className = this.classNames.container;
|
|
5597
5601
|
}
|
|
@@ -5942,6 +5946,14 @@ function escapeForRegEx(string) {
|
|
|
5942
5946
|
return string.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
5943
5947
|
}
|
|
5944
5948
|
|
|
5949
|
+
// src/utilities/htmlEntities.ts
|
|
5950
|
+
function decodeHtmlEntities(text) {
|
|
5951
|
+
return text.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/&/g, "&");
|
|
5952
|
+
}
|
|
5953
|
+
function encodeHtmlEntities(text) {
|
|
5954
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
5955
|
+
}
|
|
5956
|
+
|
|
5945
5957
|
// src/utilities/isFirefox.ts
|
|
5946
5958
|
function isFirefox() {
|
|
5947
5959
|
return typeof navigator !== "undefined" ? /Firefox/.test(navigator.userAgent) : false;
|
|
@@ -6898,9 +6910,11 @@ export {
|
|
|
6898
6910
|
createMappablePosition,
|
|
6899
6911
|
createNodeFromContent,
|
|
6900
6912
|
createStyleTag,
|
|
6913
|
+
decodeHtmlEntities,
|
|
6901
6914
|
defaultBlockAt,
|
|
6902
6915
|
deleteProps,
|
|
6903
6916
|
elementFromString,
|
|
6917
|
+
encodeHtmlEntities,
|
|
6904
6918
|
escapeForRegEx,
|
|
6905
6919
|
extensions_exports as extensions,
|
|
6906
6920
|
findChildren,
|