@tiptap/core 3.0.0-beta.25 → 3.0.0-beta.27
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 +189 -15388
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -33
- package/dist/index.d.ts +9 -33
- package/dist/index.js +53 -40
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
- package/src/Editor.ts +0 -43
- package/src/ExtensionManager.ts +4 -1
- package/src/MarkView.ts +56 -0
- package/src/types.ts +3 -13
- package/dist/chunk-G3PMV62Z.js +0 -36
- package/dist/chunk-G3PMV62Z.js.map +0 -1
- package/dist/dist-GJ4HMHO4.js +0 -15184
- package/dist/dist-GJ4HMHO4.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1172,18 +1172,6 @@ interface EditorOptions {
|
|
|
1172
1172
|
* @default false
|
|
1173
1173
|
*/
|
|
1174
1174
|
emitContentError: boolean;
|
|
1175
|
-
/**
|
|
1176
|
-
* Enable a lazy-loaded Prosemirror DevTools integration.
|
|
1177
|
-
*
|
|
1178
|
-
* Requires having the `prosemirror-dev-toolkit` npm package installed.
|
|
1179
|
-
* @type boolean
|
|
1180
|
-
* @default false
|
|
1181
|
-
* @example
|
|
1182
|
-
* ```js
|
|
1183
|
-
* enableDevTools: true
|
|
1184
|
-
* ```
|
|
1185
|
-
*/
|
|
1186
|
-
enableDevTools: boolean;
|
|
1187
1175
|
/**
|
|
1188
1176
|
* Called before the editor is constructed.
|
|
1189
1177
|
*/
|
|
@@ -1448,8 +1436,9 @@ interface MarkViewRendererProps {
|
|
|
1448
1436
|
* The HTML attributes that should be added to the mark's DOM element.
|
|
1449
1437
|
*/
|
|
1450
1438
|
HTMLAttributes: Record<string, any>;
|
|
1439
|
+
updateAttributes: (attrs: Record<string, any>) => void;
|
|
1451
1440
|
}
|
|
1452
|
-
type MarkViewRenderer = (props:
|
|
1441
|
+
type MarkViewRenderer<Props = MarkViewRendererProps> = (props: Props) => MarkView$1;
|
|
1453
1442
|
interface MarkViewRendererOptions {
|
|
1454
1443
|
ignoreMutation: ((props: {
|
|
1455
1444
|
mutation: ViewMutationRecord;
|
|
@@ -2924,25 +2913,6 @@ declare class Editor extends EventEmitter<EditorEvents> {
|
|
|
2924
2913
|
* Remove the editor from the DOM, but still allow remounting at a different point in time
|
|
2925
2914
|
*/
|
|
2926
2915
|
unmount(): void;
|
|
2927
|
-
/**
|
|
2928
|
-
*
|
|
2929
|
-
* @returns
|
|
2930
|
-
*/
|
|
2931
|
-
/**
|
|
2932
|
-
* Applies ProseMirror dev tools to the editor instance if enabled and running in a browser environment.
|
|
2933
|
-
*
|
|
2934
|
-
* This method dynamically imports the `prosemirror-dev-toolkit` package and applies it to the current
|
|
2935
|
-
* editor view. If the dev tools are not installed, a warning is logged to the console.
|
|
2936
|
-
*
|
|
2937
|
-
* @private
|
|
2938
|
-
* @remarks
|
|
2939
|
-
* - Dev tools are only applied if `this.options.enableDevTools` is `true` and the code is running in a browser.
|
|
2940
|
-
* - If the editor view is not available, the dev tools are not applied.
|
|
2941
|
-
* - If the `prosemirror-dev-toolkit` package is missing, a warning is shown in the console.
|
|
2942
|
-
*
|
|
2943
|
-
* @returns {void}
|
|
2944
|
-
*/
|
|
2945
|
-
private applyDevTools;
|
|
2946
2916
|
/**
|
|
2947
2917
|
* Returns the editor storage.
|
|
2948
2918
|
*/
|
|
@@ -3205,6 +3175,7 @@ declare function Fragment(props: {
|
|
|
3205
3175
|
}): JSXRenderer[];
|
|
3206
3176
|
declare const h: JSXRenderer;
|
|
3207
3177
|
|
|
3178
|
+
declare function updateMarkViewAttributes(checkMark: Mark$1, editor: Editor, attrs?: Record<string, any>): void;
|
|
3208
3179
|
declare class MarkView<Component, Options extends MarkViewRendererOptions = MarkViewRendererOptions> {
|
|
3209
3180
|
component: Component;
|
|
3210
3181
|
editor: Editor;
|
|
@@ -3214,6 +3185,11 @@ declare class MarkView<Component, Options extends MarkViewRendererOptions = Mark
|
|
|
3214
3185
|
constructor(component: Component, props: MarkViewProps, options?: Partial<Options>);
|
|
3215
3186
|
get dom(): HTMLElement;
|
|
3216
3187
|
get contentDOM(): HTMLElement | null;
|
|
3188
|
+
/**
|
|
3189
|
+
* Update the attributes of the mark in the document.
|
|
3190
|
+
* @param attrs The attributes to update.
|
|
3191
|
+
*/
|
|
3192
|
+
updateAttributes(attrs: Record<string, any>, checkMark?: Mark$1): void;
|
|
3217
3193
|
ignoreMutation(mutation: ViewMutationRecord): boolean;
|
|
3218
3194
|
}
|
|
3219
3195
|
|
|
@@ -3377,4 +3353,4 @@ interface Commands<ReturnType = any> {
|
|
|
3377
3353
|
interface Storage {
|
|
3378
3354
|
}
|
|
3379
3355
|
|
|
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 };
|
|
3356
|
+
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
|
@@ -1172,18 +1172,6 @@ interface EditorOptions {
|
|
|
1172
1172
|
* @default false
|
|
1173
1173
|
*/
|
|
1174
1174
|
emitContentError: boolean;
|
|
1175
|
-
/**
|
|
1176
|
-
* Enable a lazy-loaded Prosemirror DevTools integration.
|
|
1177
|
-
*
|
|
1178
|
-
* Requires having the `prosemirror-dev-toolkit` npm package installed.
|
|
1179
|
-
* @type boolean
|
|
1180
|
-
* @default false
|
|
1181
|
-
* @example
|
|
1182
|
-
* ```js
|
|
1183
|
-
* enableDevTools: true
|
|
1184
|
-
* ```
|
|
1185
|
-
*/
|
|
1186
|
-
enableDevTools: boolean;
|
|
1187
1175
|
/**
|
|
1188
1176
|
* Called before the editor is constructed.
|
|
1189
1177
|
*/
|
|
@@ -1448,8 +1436,9 @@ interface MarkViewRendererProps {
|
|
|
1448
1436
|
* The HTML attributes that should be added to the mark's DOM element.
|
|
1449
1437
|
*/
|
|
1450
1438
|
HTMLAttributes: Record<string, any>;
|
|
1439
|
+
updateAttributes: (attrs: Record<string, any>) => void;
|
|
1451
1440
|
}
|
|
1452
|
-
type MarkViewRenderer = (props:
|
|
1441
|
+
type MarkViewRenderer<Props = MarkViewRendererProps> = (props: Props) => MarkView$1;
|
|
1453
1442
|
interface MarkViewRendererOptions {
|
|
1454
1443
|
ignoreMutation: ((props: {
|
|
1455
1444
|
mutation: ViewMutationRecord;
|
|
@@ -2924,25 +2913,6 @@ declare class Editor extends EventEmitter<EditorEvents> {
|
|
|
2924
2913
|
* Remove the editor from the DOM, but still allow remounting at a different point in time
|
|
2925
2914
|
*/
|
|
2926
2915
|
unmount(): void;
|
|
2927
|
-
/**
|
|
2928
|
-
*
|
|
2929
|
-
* @returns
|
|
2930
|
-
*/
|
|
2931
|
-
/**
|
|
2932
|
-
* Applies ProseMirror dev tools to the editor instance if enabled and running in a browser environment.
|
|
2933
|
-
*
|
|
2934
|
-
* This method dynamically imports the `prosemirror-dev-toolkit` package and applies it to the current
|
|
2935
|
-
* editor view. If the dev tools are not installed, a warning is logged to the console.
|
|
2936
|
-
*
|
|
2937
|
-
* @private
|
|
2938
|
-
* @remarks
|
|
2939
|
-
* - Dev tools are only applied if `this.options.enableDevTools` is `true` and the code is running in a browser.
|
|
2940
|
-
* - If the editor view is not available, the dev tools are not applied.
|
|
2941
|
-
* - If the `prosemirror-dev-toolkit` package is missing, a warning is shown in the console.
|
|
2942
|
-
*
|
|
2943
|
-
* @returns {void}
|
|
2944
|
-
*/
|
|
2945
|
-
private applyDevTools;
|
|
2946
2916
|
/**
|
|
2947
2917
|
* Returns the editor storage.
|
|
2948
2918
|
*/
|
|
@@ -3205,6 +3175,7 @@ declare function Fragment(props: {
|
|
|
3205
3175
|
}): JSXRenderer[];
|
|
3206
3176
|
declare const h: JSXRenderer;
|
|
3207
3177
|
|
|
3178
|
+
declare function updateMarkViewAttributes(checkMark: Mark$1, editor: Editor, attrs?: Record<string, any>): void;
|
|
3208
3179
|
declare class MarkView<Component, Options extends MarkViewRendererOptions = MarkViewRendererOptions> {
|
|
3209
3180
|
component: Component;
|
|
3210
3181
|
editor: Editor;
|
|
@@ -3214,6 +3185,11 @@ declare class MarkView<Component, Options extends MarkViewRendererOptions = Mark
|
|
|
3214
3185
|
constructor(component: Component, props: MarkViewProps, options?: Partial<Options>);
|
|
3215
3186
|
get dom(): HTMLElement;
|
|
3216
3187
|
get contentDOM(): HTMLElement | null;
|
|
3188
|
+
/**
|
|
3189
|
+
* Update the attributes of the mark in the document.
|
|
3190
|
+
* @param attrs The attributes to update.
|
|
3191
|
+
*/
|
|
3192
|
+
updateAttributes(attrs: Record<string, any>, checkMark?: Mark$1): void;
|
|
3217
3193
|
ignoreMutation(mutation: ViewMutationRecord): boolean;
|
|
3218
3194
|
}
|
|
3219
3195
|
|
|
@@ -3377,4 +3353,4 @@ interface Commands<ReturnType = any> {
|
|
|
3377
3353
|
interface Storage {
|
|
3378
3354
|
}
|
|
3379
3355
|
|
|
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 };
|
|
3356
|
+
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,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
4
6
|
|
|
5
7
|
// src/helpers/createChainableState.ts
|
|
6
8
|
function createChainableState(config) {
|
|
@@ -2269,7 +2271,10 @@ var ExtensionManager = class {
|
|
|
2269
2271
|
// tiptap-specific
|
|
2270
2272
|
editor,
|
|
2271
2273
|
extension,
|
|
2272
|
-
HTMLAttributes
|
|
2274
|
+
HTMLAttributes,
|
|
2275
|
+
updateAttributes: (attrs) => {
|
|
2276
|
+
updateMarkViewAttributes(mark, editor, attrs);
|
|
2277
|
+
}
|
|
2273
2278
|
});
|
|
2274
2279
|
};
|
|
2275
2280
|
return [extension.name, markView];
|
|
@@ -4297,7 +4302,6 @@ var Editor = class extends EventEmitter {
|
|
|
4297
4302
|
enablePasteRules: true,
|
|
4298
4303
|
enableCoreExtensions: true,
|
|
4299
4304
|
enableContentCheck: false,
|
|
4300
|
-
enableDevTools: false,
|
|
4301
4305
|
emitContentError: false,
|
|
4302
4306
|
onBeforeCreate: () => null,
|
|
4303
4307
|
onCreate: () => null,
|
|
@@ -4380,38 +4384,6 @@ var Editor = class extends EventEmitter {
|
|
|
4380
4384
|
(_a = this.css) == null ? void 0 : _a.remove();
|
|
4381
4385
|
this.css = null;
|
|
4382
4386
|
}
|
|
4383
|
-
/**
|
|
4384
|
-
*
|
|
4385
|
-
* @returns
|
|
4386
|
-
*/
|
|
4387
|
-
/**
|
|
4388
|
-
* Applies ProseMirror dev tools to the editor instance if enabled and running in a browser environment.
|
|
4389
|
-
*
|
|
4390
|
-
* This method dynamically imports the `prosemirror-dev-toolkit` package and applies it to the current
|
|
4391
|
-
* editor view. If the dev tools are not installed, a warning is logged to the console.
|
|
4392
|
-
*
|
|
4393
|
-
* @private
|
|
4394
|
-
* @remarks
|
|
4395
|
-
* - Dev tools are only applied if `this.options.enableDevTools` is `true` and the code is running in a browser.
|
|
4396
|
-
* - If the editor view is not available, the dev tools are not applied.
|
|
4397
|
-
* - If the `prosemirror-dev-toolkit` package is missing, a warning is shown in the console.
|
|
4398
|
-
*
|
|
4399
|
-
* @returns {void}
|
|
4400
|
-
*/
|
|
4401
|
-
applyDevTools() {
|
|
4402
|
-
if (typeof window === "undefined" || !this.options.enableDevTools) {
|
|
4403
|
-
return;
|
|
4404
|
-
}
|
|
4405
|
-
import("./dist-GJ4HMHO4.js").then(({ applyDevTools }) => {
|
|
4406
|
-
if (!this.editorView) {
|
|
4407
|
-
return;
|
|
4408
|
-
}
|
|
4409
|
-
applyDevTools(this.editorView);
|
|
4410
|
-
}).catch(() => {
|
|
4411
|
-
console.warn("[Tiptap warning]: Devtools are enabled but `prosemirror-dev-toolkit` is not installed.");
|
|
4412
|
-
console.warn("Install 'prosemirror-dev-toolkit' as a dev dependency to use the dev tools.");
|
|
4413
|
-
});
|
|
4414
|
-
}
|
|
4415
4387
|
/**
|
|
4416
4388
|
* Returns the editor storage.
|
|
4417
4389
|
*/
|
|
@@ -4649,9 +4621,6 @@ var Editor = class extends EventEmitter {
|
|
|
4649
4621
|
dispatchTransaction: this.dispatchTransaction.bind(this),
|
|
4650
4622
|
state: this.editorState
|
|
4651
4623
|
});
|
|
4652
|
-
if (this.options.enableDevTools) {
|
|
4653
|
-
this.applyDevTools();
|
|
4654
|
-
}
|
|
4655
4624
|
const newState = this.state.reconfigure({
|
|
4656
4625
|
plugins: this.extensionManager.plugins
|
|
4657
4626
|
});
|
|
@@ -5027,6 +4996,42 @@ function isString(value) {
|
|
|
5027
4996
|
}
|
|
5028
4997
|
|
|
5029
4998
|
// src/MarkView.ts
|
|
4999
|
+
function updateMarkViewAttributes(checkMark, editor, attrs = {}) {
|
|
5000
|
+
const { state } = editor;
|
|
5001
|
+
const { doc, tr } = state;
|
|
5002
|
+
const thisMark = checkMark;
|
|
5003
|
+
doc.descendants((node, pos) => {
|
|
5004
|
+
const from = tr.mapping.map(pos);
|
|
5005
|
+
const to = tr.mapping.map(pos) + node.nodeSize;
|
|
5006
|
+
let foundMark = null;
|
|
5007
|
+
node.marks.forEach((mark) => {
|
|
5008
|
+
if (mark !== thisMark) {
|
|
5009
|
+
return false;
|
|
5010
|
+
}
|
|
5011
|
+
foundMark = mark;
|
|
5012
|
+
});
|
|
5013
|
+
if (!foundMark) {
|
|
5014
|
+
return;
|
|
5015
|
+
}
|
|
5016
|
+
let needsUpdate = false;
|
|
5017
|
+
Object.keys(attrs).forEach((k) => {
|
|
5018
|
+
if (attrs[k] !== foundMark.attrs[k]) {
|
|
5019
|
+
needsUpdate = true;
|
|
5020
|
+
}
|
|
5021
|
+
});
|
|
5022
|
+
if (needsUpdate) {
|
|
5023
|
+
const updatedMark = checkMark.type.create({
|
|
5024
|
+
...checkMark.attrs,
|
|
5025
|
+
...attrs
|
|
5026
|
+
});
|
|
5027
|
+
tr.removeMark(from, to, checkMark.type);
|
|
5028
|
+
tr.addMark(from, to, updatedMark);
|
|
5029
|
+
}
|
|
5030
|
+
});
|
|
5031
|
+
if (tr.docChanged) {
|
|
5032
|
+
editor.view.dispatch(tr);
|
|
5033
|
+
}
|
|
5034
|
+
}
|
|
5030
5035
|
var MarkView = class {
|
|
5031
5036
|
constructor(component, props, options) {
|
|
5032
5037
|
this.component = component;
|
|
@@ -5041,6 +5046,13 @@ var MarkView = class {
|
|
|
5041
5046
|
get contentDOM() {
|
|
5042
5047
|
return null;
|
|
5043
5048
|
}
|
|
5049
|
+
/**
|
|
5050
|
+
* Update the attributes of the mark in the document.
|
|
5051
|
+
* @param attrs The attributes to update.
|
|
5052
|
+
*/
|
|
5053
|
+
updateAttributes(attrs, checkMark) {
|
|
5054
|
+
updateMarkViewAttributes(checkMark || this.mark, this.editor, attrs);
|
|
5055
|
+
}
|
|
5044
5056
|
ignoreMutation(mutation) {
|
|
5045
5057
|
if (!this.dom || !this.contentDOM) {
|
|
5046
5058
|
return true;
|
|
@@ -5480,6 +5492,7 @@ export {
|
|
|
5480
5492
|
textInputRule,
|
|
5481
5493
|
textPasteRule,
|
|
5482
5494
|
textblockTypeInputRule,
|
|
5495
|
+
updateMarkViewAttributes,
|
|
5483
5496
|
wrappingInputRule
|
|
5484
5497
|
};
|
|
5485
5498
|
//# sourceMappingURL=index.js.map
|