@tiptap/core 3.0.0-beta.24 → 3.0.0-beta.26
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/{chunk-PR4QN5HX.js → chunk-G3PMV62Z.js} +2 -9
- package/dist/dist-GJ4HMHO4.js +15184 -0
- package/dist/dist-GJ4HMHO4.js.map +1 -0
- package/dist/index.cjs +14522 -53157
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -5
- package/dist/index.d.ts +12 -5
- package/dist/index.js +55 -8
- package/dist/index.js.map +1 -1
- package/package.json +4 -5
- package/src/Editor.ts +7 -7
- package/src/ExtensionManager.ts +4 -1
- package/src/MarkView.ts +56 -0
- package/src/types.ts +4 -2
- package/dist/chunk-GRT2MR5L.js +0 -59
- package/dist/chunk-GRT2MR5L.js.map +0 -1
- package/dist/chunk-TH7LERQR.js +0 -34
- package/dist/chunk-TH7LERQR.js.map +0 -1
- package/dist/chunk-UNIMJOD2.js +0 -1010
- package/dist/chunk-UNIMJOD2.js.map +0 -1
- package/dist/esm-7BF7U2WM.js +0 -47055
- package/dist/esm-7BF7U2WM.js.map +0 -1
- package/dist/json-diff-main-ASELUCBE.js +0 -4742
- package/dist/json-diff-main-ASELUCBE.js.map +0 -1
- package/dist/json-diff-worker-ET432FKY.js +0 -398
- package/dist/json-diff-worker-ET432FKY.js.map +0 -1
- /package/dist/{chunk-PR4QN5HX.js.map → chunk-G3PMV62Z.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1175,7 +1175,7 @@ interface EditorOptions {
|
|
|
1175
1175
|
/**
|
|
1176
1176
|
* Enable a lazy-loaded Prosemirror DevTools integration.
|
|
1177
1177
|
*
|
|
1178
|
-
* Requires having the `prosemirror-dev-
|
|
1178
|
+
* Requires having the `prosemirror-dev-toolkit` npm package installed.
|
|
1179
1179
|
* @type boolean
|
|
1180
1180
|
* @default false
|
|
1181
1181
|
* @example
|
|
@@ -1448,8 +1448,9 @@ interface MarkViewRendererProps {
|
|
|
1448
1448
|
* The HTML attributes that should be added to the mark's DOM element.
|
|
1449
1449
|
*/
|
|
1450
1450
|
HTMLAttributes: Record<string, any>;
|
|
1451
|
+
updateAttributes: (attrs: Record<string, any>) => void;
|
|
1451
1452
|
}
|
|
1452
|
-
type MarkViewRenderer = (props:
|
|
1453
|
+
type MarkViewRenderer<Props = MarkViewRendererProps> = (props: Props) => MarkView$1;
|
|
1453
1454
|
interface MarkViewRendererOptions {
|
|
1454
1455
|
ignoreMutation: ((props: {
|
|
1455
1456
|
mutation: ViewMutationRecord;
|
|
@@ -2931,14 +2932,14 @@ declare class Editor extends EventEmitter<EditorEvents> {
|
|
|
2931
2932
|
/**
|
|
2932
2933
|
* Applies ProseMirror dev tools to the editor instance if enabled and running in a browser environment.
|
|
2933
2934
|
*
|
|
2934
|
-
* This method dynamically imports the `prosemirror-dev-
|
|
2935
|
+
* This method dynamically imports the `prosemirror-dev-toolkit` package and applies it to the current
|
|
2935
2936
|
* editor view. If the dev tools are not installed, a warning is logged to the console.
|
|
2936
2937
|
*
|
|
2937
2938
|
* @private
|
|
2938
2939
|
* @remarks
|
|
2939
2940
|
* - Dev tools are only applied if `this.options.enableDevTools` is `true` and the code is running in a browser.
|
|
2940
2941
|
* - If the editor view is not available, the dev tools are not applied.
|
|
2941
|
-
* - If the `prosemirror-dev-
|
|
2942
|
+
* - If the `prosemirror-dev-toolkit` package is missing, a warning is shown in the console.
|
|
2942
2943
|
*
|
|
2943
2944
|
* @returns {void}
|
|
2944
2945
|
*/
|
|
@@ -3205,6 +3206,7 @@ declare function Fragment(props: {
|
|
|
3205
3206
|
}): JSXRenderer[];
|
|
3206
3207
|
declare const h: JSXRenderer;
|
|
3207
3208
|
|
|
3209
|
+
declare function updateMarkViewAttributes(checkMark: Mark$1, editor: Editor, attrs?: Record<string, any>): void;
|
|
3208
3210
|
declare class MarkView<Component, Options extends MarkViewRendererOptions = MarkViewRendererOptions> {
|
|
3209
3211
|
component: Component;
|
|
3210
3212
|
editor: Editor;
|
|
@@ -3214,6 +3216,11 @@ declare class MarkView<Component, Options extends MarkViewRendererOptions = Mark
|
|
|
3214
3216
|
constructor(component: Component, props: MarkViewProps, options?: Partial<Options>);
|
|
3215
3217
|
get dom(): HTMLElement;
|
|
3216
3218
|
get contentDOM(): HTMLElement | null;
|
|
3219
|
+
/**
|
|
3220
|
+
* Update the attributes of the mark in the document.
|
|
3221
|
+
* @param attrs The attributes to update.
|
|
3222
|
+
*/
|
|
3223
|
+
updateAttributes(attrs: Record<string, any>, checkMark?: Mark$1): void;
|
|
3217
3224
|
ignoreMutation(mutation: ViewMutationRecord): boolean;
|
|
3218
3225
|
}
|
|
3219
3226
|
|
|
@@ -3377,4 +3384,4 @@ interface Commands<ReturnType = any> {
|
|
|
3377
3384
|
interface Storage {
|
|
3378
3385
|
}
|
|
3379
3386
|
|
|
3380
|
-
export { type AnyCommands, type AnyConfig, type AnyExtension, type Attribute, type Attributes$1 as Attributes, 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 DocumentType, Editor, type EditorEvents, type EditorOptions, type EnableRules, type ExtendedRegExpMatchArray, Extension, type ExtensionAttribute, type ExtensionConfig, type Extensions, type FocusPosition, Fragment, type GlobalAttributes, type HTMLContent, InputRule, type InputRuleFinder, type InputRuleMatch, type JSONContent, type KeyboardShortcutCommand, type KeysWithTypeOf, Mark, type MarkConfig, type MarkRange, type MarkType, MarkView, type MarkViewProps, type MarkViewRenderer, type MarkViewRendererOptions, type MarkViewRendererProps, 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, PasteRule, type PasteRuleFinder, type PasteRuleMatch, type PickValue, type Predicate, type Primitive, type Range, type RawCommands, type RemoveThis, type SingleCommands, type Storage, type TextSerializer, type TextType, type TiptapEditorHTMLElement, Tracker, type TrackerResult, type UnionCommands, type UnionToIntersection, type ValuesOf, callOrReturn, canInsertNode, combineTransactionSteps, createChainableState, createDocument, h as createElement, createNodeFromContent, createStyleTag, defaultBlockAt, deleteProps, elementFromString, escapeForRegEx, index as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, flattenExtensions, 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, h, injectExtensionAttributesToParseRule, inputRulesPlugin, isActive, isAndroid, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isString, isTextSelection, isiOS, markInputRule, markPasteRule, mergeAttributes, mergeDeep, minMax, nodeInputRule, nodePasteRule, objectIncludes, pasteRulesPlugin, posToDOMRect, removeDuplicates, resolveExtensions, resolveFocusPosition, rewriteUnknownContent, selectionToInsertionEnd, sortExtensions, splitExtensions, textInputRule, textPasteRule, textblockTypeInputRule, wrappingInputRule };
|
|
3387
|
+
export { type AnyCommands, type AnyConfig, type AnyExtension, type Attribute, type Attributes$1 as Attributes, 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 DocumentType, Editor, type EditorEvents, type EditorOptions, type EnableRules, type ExtendedRegExpMatchArray, Extension, type ExtensionAttribute, type ExtensionConfig, type Extensions, type FocusPosition, Fragment, type GlobalAttributes, type HTMLContent, InputRule, type InputRuleFinder, type InputRuleMatch, type JSONContent, type KeyboardShortcutCommand, type KeysWithTypeOf, Mark, type MarkConfig, type MarkRange, type MarkType, MarkView, type MarkViewProps, type MarkViewRenderer, type MarkViewRendererOptions, type MarkViewRendererProps, 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, PasteRule, type PasteRuleFinder, type PasteRuleMatch, type PickValue, type Predicate, type Primitive, type Range, type RawCommands, type RemoveThis, type SingleCommands, type Storage, type TextSerializer, type TextType, type TiptapEditorHTMLElement, Tracker, type TrackerResult, type UnionCommands, type UnionToIntersection, type ValuesOf, callOrReturn, canInsertNode, combineTransactionSteps, createChainableState, createDocument, h as createElement, createNodeFromContent, createStyleTag, defaultBlockAt, deleteProps, elementFromString, escapeForRegEx, index as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, flattenExtensions, 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, h, injectExtensionAttributesToParseRule, inputRulesPlugin, isActive, isAndroid, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isString, isTextSelection, isiOS, markInputRule, markPasteRule, mergeAttributes, mergeDeep, minMax, nodeInputRule, nodePasteRule, objectIncludes, pasteRulesPlugin, posToDOMRect, removeDuplicates, resolveExtensions, resolveFocusPosition, rewriteUnknownContent, selectionToInsertionEnd, sortExtensions, splitExtensions, textInputRule, textPasteRule, textblockTypeInputRule, updateMarkViewAttributes, wrappingInputRule };
|
package/dist/index.d.ts
CHANGED
|
@@ -1175,7 +1175,7 @@ interface EditorOptions {
|
|
|
1175
1175
|
/**
|
|
1176
1176
|
* Enable a lazy-loaded Prosemirror DevTools integration.
|
|
1177
1177
|
*
|
|
1178
|
-
* Requires having the `prosemirror-dev-
|
|
1178
|
+
* Requires having the `prosemirror-dev-toolkit` npm package installed.
|
|
1179
1179
|
* @type boolean
|
|
1180
1180
|
* @default false
|
|
1181
1181
|
* @example
|
|
@@ -1448,8 +1448,9 @@ interface MarkViewRendererProps {
|
|
|
1448
1448
|
* The HTML attributes that should be added to the mark's DOM element.
|
|
1449
1449
|
*/
|
|
1450
1450
|
HTMLAttributes: Record<string, any>;
|
|
1451
|
+
updateAttributes: (attrs: Record<string, any>) => void;
|
|
1451
1452
|
}
|
|
1452
|
-
type MarkViewRenderer = (props:
|
|
1453
|
+
type MarkViewRenderer<Props = MarkViewRendererProps> = (props: Props) => MarkView$1;
|
|
1453
1454
|
interface MarkViewRendererOptions {
|
|
1454
1455
|
ignoreMutation: ((props: {
|
|
1455
1456
|
mutation: ViewMutationRecord;
|
|
@@ -2931,14 +2932,14 @@ declare class Editor extends EventEmitter<EditorEvents> {
|
|
|
2931
2932
|
/**
|
|
2932
2933
|
* Applies ProseMirror dev tools to the editor instance if enabled and running in a browser environment.
|
|
2933
2934
|
*
|
|
2934
|
-
* This method dynamically imports the `prosemirror-dev-
|
|
2935
|
+
* This method dynamically imports the `prosemirror-dev-toolkit` package and applies it to the current
|
|
2935
2936
|
* editor view. If the dev tools are not installed, a warning is logged to the console.
|
|
2936
2937
|
*
|
|
2937
2938
|
* @private
|
|
2938
2939
|
* @remarks
|
|
2939
2940
|
* - Dev tools are only applied if `this.options.enableDevTools` is `true` and the code is running in a browser.
|
|
2940
2941
|
* - If the editor view is not available, the dev tools are not applied.
|
|
2941
|
-
* - If the `prosemirror-dev-
|
|
2942
|
+
* - If the `prosemirror-dev-toolkit` package is missing, a warning is shown in the console.
|
|
2942
2943
|
*
|
|
2943
2944
|
* @returns {void}
|
|
2944
2945
|
*/
|
|
@@ -3205,6 +3206,7 @@ declare function Fragment(props: {
|
|
|
3205
3206
|
}): JSXRenderer[];
|
|
3206
3207
|
declare const h: JSXRenderer;
|
|
3207
3208
|
|
|
3209
|
+
declare function updateMarkViewAttributes(checkMark: Mark$1, editor: Editor, attrs?: Record<string, any>): void;
|
|
3208
3210
|
declare class MarkView<Component, Options extends MarkViewRendererOptions = MarkViewRendererOptions> {
|
|
3209
3211
|
component: Component;
|
|
3210
3212
|
editor: Editor;
|
|
@@ -3214,6 +3216,11 @@ declare class MarkView<Component, Options extends MarkViewRendererOptions = Mark
|
|
|
3214
3216
|
constructor(component: Component, props: MarkViewProps, options?: Partial<Options>);
|
|
3215
3217
|
get dom(): HTMLElement;
|
|
3216
3218
|
get contentDOM(): HTMLElement | null;
|
|
3219
|
+
/**
|
|
3220
|
+
* Update the attributes of the mark in the document.
|
|
3221
|
+
* @param attrs The attributes to update.
|
|
3222
|
+
*/
|
|
3223
|
+
updateAttributes(attrs: Record<string, any>, checkMark?: Mark$1): void;
|
|
3217
3224
|
ignoreMutation(mutation: ViewMutationRecord): boolean;
|
|
3218
3225
|
}
|
|
3219
3226
|
|
|
@@ -3377,4 +3384,4 @@ interface Commands<ReturnType = any> {
|
|
|
3377
3384
|
interface Storage {
|
|
3378
3385
|
}
|
|
3379
3386
|
|
|
3380
|
-
export { type AnyCommands, type AnyConfig, type AnyExtension, type Attribute, type Attributes$1 as Attributes, 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 DocumentType, Editor, type EditorEvents, type EditorOptions, type EnableRules, type ExtendedRegExpMatchArray, Extension, type ExtensionAttribute, type ExtensionConfig, type Extensions, type FocusPosition, Fragment, type GlobalAttributes, type HTMLContent, InputRule, type InputRuleFinder, type InputRuleMatch, type JSONContent, type KeyboardShortcutCommand, type KeysWithTypeOf, Mark, type MarkConfig, type MarkRange, type MarkType, MarkView, type MarkViewProps, type MarkViewRenderer, type MarkViewRendererOptions, type MarkViewRendererProps, 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, PasteRule, type PasteRuleFinder, type PasteRuleMatch, type PickValue, type Predicate, type Primitive, type Range, type RawCommands, type RemoveThis, type SingleCommands, type Storage, type TextSerializer, type TextType, type TiptapEditorHTMLElement, Tracker, type TrackerResult, type UnionCommands, type UnionToIntersection, type ValuesOf, callOrReturn, canInsertNode, combineTransactionSteps, createChainableState, createDocument, h as createElement, createNodeFromContent, createStyleTag, defaultBlockAt, deleteProps, elementFromString, escapeForRegEx, index as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, flattenExtensions, 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, h, injectExtensionAttributesToParseRule, inputRulesPlugin, isActive, isAndroid, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isString, isTextSelection, isiOS, markInputRule, markPasteRule, mergeAttributes, mergeDeep, minMax, nodeInputRule, nodePasteRule, objectIncludes, pasteRulesPlugin, posToDOMRect, removeDuplicates, resolveExtensions, resolveFocusPosition, rewriteUnknownContent, selectionToInsertionEnd, sortExtensions, splitExtensions, textInputRule, textPasteRule, textblockTypeInputRule, wrappingInputRule };
|
|
3387
|
+
export { type AnyCommands, type AnyConfig, type AnyExtension, type Attribute, type Attributes$1 as Attributes, 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 DocumentType, Editor, type EditorEvents, type EditorOptions, type EnableRules, type ExtendedRegExpMatchArray, Extension, type ExtensionAttribute, type ExtensionConfig, type Extensions, type FocusPosition, Fragment, type GlobalAttributes, type HTMLContent, InputRule, type InputRuleFinder, type InputRuleMatch, type JSONContent, type KeyboardShortcutCommand, type KeysWithTypeOf, Mark, type MarkConfig, type MarkRange, type MarkType, MarkView, type MarkViewProps, type MarkViewRenderer, type MarkViewRendererOptions, type MarkViewRendererProps, 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, PasteRule, type PasteRuleFinder, type PasteRuleMatch, type PickValue, type Predicate, type Primitive, type Range, type RawCommands, type RemoveThis, type SingleCommands, type Storage, type TextSerializer, type TextType, type TiptapEditorHTMLElement, Tracker, type TrackerResult, type UnionCommands, type UnionToIntersection, type ValuesOf, callOrReturn, canInsertNode, combineTransactionSteps, createChainableState, createDocument, h as createElement, createNodeFromContent, createStyleTag, defaultBlockAt, deleteProps, elementFromString, escapeForRegEx, index as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, flattenExtensions, 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, h, injectExtensionAttributesToParseRule, inputRulesPlugin, isActive, isAndroid, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isString, isTextSelection, isiOS, markInputRule, markPasteRule, mergeAttributes, mergeDeep, minMax, nodeInputRule, nodePasteRule, objectIncludes, pasteRulesPlugin, posToDOMRect, removeDuplicates, resolveExtensions, resolveFocusPosition, rewriteUnknownContent, selectionToInsertionEnd, sortExtensions, splitExtensions, textInputRule, textPasteRule, textblockTypeInputRule, updateMarkViewAttributes, wrappingInputRule };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-G3PMV62Z.js";
|
|
4
4
|
|
|
5
5
|
// src/helpers/createChainableState.ts
|
|
6
6
|
function createChainableState(config) {
|
|
@@ -2269,7 +2269,10 @@ var ExtensionManager = class {
|
|
|
2269
2269
|
// tiptap-specific
|
|
2270
2270
|
editor,
|
|
2271
2271
|
extension,
|
|
2272
|
-
HTMLAttributes
|
|
2272
|
+
HTMLAttributes,
|
|
2273
|
+
updateAttributes: (attrs) => {
|
|
2274
|
+
updateMarkViewAttributes(mark, editor, attrs);
|
|
2275
|
+
}
|
|
2273
2276
|
});
|
|
2274
2277
|
};
|
|
2275
2278
|
return [extension.name, markView];
|
|
@@ -4387,14 +4390,14 @@ var Editor = class extends EventEmitter {
|
|
|
4387
4390
|
/**
|
|
4388
4391
|
* Applies ProseMirror dev tools to the editor instance if enabled and running in a browser environment.
|
|
4389
4392
|
*
|
|
4390
|
-
* This method dynamically imports the `prosemirror-dev-
|
|
4393
|
+
* This method dynamically imports the `prosemirror-dev-toolkit` package and applies it to the current
|
|
4391
4394
|
* editor view. If the dev tools are not installed, a warning is logged to the console.
|
|
4392
4395
|
*
|
|
4393
4396
|
* @private
|
|
4394
4397
|
* @remarks
|
|
4395
4398
|
* - Dev tools are only applied if `this.options.enableDevTools` is `true` and the code is running in a browser.
|
|
4396
4399
|
* - If the editor view is not available, the dev tools are not applied.
|
|
4397
|
-
* - If the `prosemirror-dev-
|
|
4400
|
+
* - If the `prosemirror-dev-toolkit` package is missing, a warning is shown in the console.
|
|
4398
4401
|
*
|
|
4399
4402
|
* @returns {void}
|
|
4400
4403
|
*/
|
|
@@ -4402,14 +4405,14 @@ var Editor = class extends EventEmitter {
|
|
|
4402
4405
|
if (typeof window === "undefined" || !this.options.enableDevTools) {
|
|
4403
4406
|
return;
|
|
4404
4407
|
}
|
|
4405
|
-
import("./
|
|
4408
|
+
import("./dist-GJ4HMHO4.js").then(({ applyDevTools }) => {
|
|
4406
4409
|
if (!this.editorView) {
|
|
4407
4410
|
return;
|
|
4408
4411
|
}
|
|
4409
|
-
|
|
4412
|
+
applyDevTools(this.editorView);
|
|
4410
4413
|
}).catch(() => {
|
|
4411
|
-
console.warn("[Tiptap warning]: Devtools are enabled but `prosemirror-dev-
|
|
4412
|
-
console.warn("Install 'prosemirror-dev-
|
|
4414
|
+
console.warn("[Tiptap warning]: Devtools are enabled but `prosemirror-dev-toolkit` is not installed.");
|
|
4415
|
+
console.warn("Install 'prosemirror-dev-toolkit' as a dev dependency to use the dev tools.");
|
|
4413
4416
|
});
|
|
4414
4417
|
}
|
|
4415
4418
|
/**
|
|
@@ -5027,6 +5030,42 @@ function isString(value) {
|
|
|
5027
5030
|
}
|
|
5028
5031
|
|
|
5029
5032
|
// src/MarkView.ts
|
|
5033
|
+
function updateMarkViewAttributes(checkMark, editor, attrs = {}) {
|
|
5034
|
+
const { state } = editor;
|
|
5035
|
+
const { doc, tr } = state;
|
|
5036
|
+
const thisMark = checkMark;
|
|
5037
|
+
doc.descendants((node, pos) => {
|
|
5038
|
+
const from = tr.mapping.map(pos);
|
|
5039
|
+
const to = tr.mapping.map(pos) + node.nodeSize;
|
|
5040
|
+
let foundMark = null;
|
|
5041
|
+
node.marks.forEach((mark) => {
|
|
5042
|
+
if (mark !== thisMark) {
|
|
5043
|
+
return false;
|
|
5044
|
+
}
|
|
5045
|
+
foundMark = mark;
|
|
5046
|
+
});
|
|
5047
|
+
if (!foundMark) {
|
|
5048
|
+
return;
|
|
5049
|
+
}
|
|
5050
|
+
let needsUpdate = false;
|
|
5051
|
+
Object.keys(attrs).forEach((k) => {
|
|
5052
|
+
if (attrs[k] !== foundMark.attrs[k]) {
|
|
5053
|
+
needsUpdate = true;
|
|
5054
|
+
}
|
|
5055
|
+
});
|
|
5056
|
+
if (needsUpdate) {
|
|
5057
|
+
const updatedMark = checkMark.type.create({
|
|
5058
|
+
...checkMark.attrs,
|
|
5059
|
+
...attrs
|
|
5060
|
+
});
|
|
5061
|
+
tr.removeMark(from, to, checkMark.type);
|
|
5062
|
+
tr.addMark(from, to, updatedMark);
|
|
5063
|
+
}
|
|
5064
|
+
});
|
|
5065
|
+
if (tr.docChanged) {
|
|
5066
|
+
editor.view.dispatch(tr);
|
|
5067
|
+
}
|
|
5068
|
+
}
|
|
5030
5069
|
var MarkView = class {
|
|
5031
5070
|
constructor(component, props, options) {
|
|
5032
5071
|
this.component = component;
|
|
@@ -5041,6 +5080,13 @@ var MarkView = class {
|
|
|
5041
5080
|
get contentDOM() {
|
|
5042
5081
|
return null;
|
|
5043
5082
|
}
|
|
5083
|
+
/**
|
|
5084
|
+
* Update the attributes of the mark in the document.
|
|
5085
|
+
* @param attrs The attributes to update.
|
|
5086
|
+
*/
|
|
5087
|
+
updateAttributes(attrs, checkMark) {
|
|
5088
|
+
updateMarkViewAttributes(checkMark || this.mark, this.editor, attrs);
|
|
5089
|
+
}
|
|
5044
5090
|
ignoreMutation(mutation) {
|
|
5045
5091
|
if (!this.dom || !this.contentDOM) {
|
|
5046
5092
|
return true;
|
|
@@ -5480,6 +5526,7 @@ export {
|
|
|
5480
5526
|
textInputRule,
|
|
5481
5527
|
textPasteRule,
|
|
5482
5528
|
textblockTypeInputRule,
|
|
5529
|
+
updateMarkViewAttributes,
|
|
5483
5530
|
wrappingInputRule
|
|
5484
5531
|
};
|
|
5485
5532
|
//# sourceMappingURL=index.js.map
|