@tiptap/extension-mention 2.6.2 → 3.0.0-next.1
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 +202 -178
- package/dist/index.cjs.map +1 -1
- package/dist/{packages/extension-mention/src/mention.d.ts → index.d.cts} +12 -9
- package/dist/index.d.ts +79 -0
- package/dist/index.js +166 -170
- package/dist/index.js.map +1 -1
- package/package.json +10 -12
- package/dist/index.umd.js +0 -187
- package/dist/index.umd.js.map +0 -1
- package/dist/packages/core/src/CommandManager.d.ts +0 -20
- package/dist/packages/core/src/Editor.d.ts +0 -163
- package/dist/packages/core/src/EventEmitter.d.ts +0 -11
- package/dist/packages/core/src/Extension.d.ts +0 -344
- package/dist/packages/core/src/ExtensionManager.d.ts +0 -55
- package/dist/packages/core/src/InputRule.d.ts +0 -42
- package/dist/packages/core/src/Mark.d.ts +0 -452
- package/dist/packages/core/src/Node.d.ts +0 -612
- package/dist/packages/core/src/NodePos.d.ts +0 -44
- package/dist/packages/core/src/NodeView.d.ts +0 -31
- package/dist/packages/core/src/PasteRule.d.ts +0 -50
- package/dist/packages/core/src/Tracker.d.ts +0 -11
- package/dist/packages/core/src/commands/blur.d.ts +0 -13
- package/dist/packages/core/src/commands/clearContent.d.ts +0 -14
- package/dist/packages/core/src/commands/clearNodes.d.ts +0 -13
- package/dist/packages/core/src/commands/command.d.ts +0 -18
- package/dist/packages/core/src/commands/createParagraphNear.d.ts +0 -13
- package/dist/packages/core/src/commands/cut.d.ts +0 -20
- package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +0 -13
- package/dist/packages/core/src/commands/deleteNode.d.ts +0 -15
- package/dist/packages/core/src/commands/deleteRange.d.ts +0 -14
- package/dist/packages/core/src/commands/deleteSelection.d.ts +0 -13
- package/dist/packages/core/src/commands/enter.d.ts +0 -13
- package/dist/packages/core/src/commands/exitCode.d.ts +0 -13
- package/dist/packages/core/src/commands/extendMarkRange.d.ts +0 -25
- package/dist/packages/core/src/commands/first.d.ts +0 -14
- package/dist/packages/core/src/commands/focus.d.ts +0 -27
- package/dist/packages/core/src/commands/forEach.d.ts +0 -14
- package/dist/packages/core/src/commands/index.d.ts +0 -55
- package/dist/packages/core/src/commands/insertContent.d.ts +0 -34
- package/dist/packages/core/src/commands/insertContentAt.d.ts +0 -47
- package/dist/packages/core/src/commands/join.d.ts +0 -41
- package/dist/packages/core/src/commands/joinItemBackward.d.ts +0 -13
- package/dist/packages/core/src/commands/joinItemForward.d.ts +0 -13
- package/dist/packages/core/src/commands/joinTextblockBackward.d.ts +0 -12
- package/dist/packages/core/src/commands/joinTextblockForward.d.ts +0 -12
- package/dist/packages/core/src/commands/keyboardShortcut.d.ts +0 -14
- package/dist/packages/core/src/commands/lift.d.ts +0 -17
- package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +0 -13
- package/dist/packages/core/src/commands/liftListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/newlineInCode.d.ts +0 -13
- package/dist/packages/core/src/commands/resetAttributes.d.ts +0 -16
- package/dist/packages/core/src/commands/scrollIntoView.d.ts +0 -13
- package/dist/packages/core/src/commands/selectAll.d.ts +0 -13
- package/dist/packages/core/src/commands/selectNodeBackward.d.ts +0 -13
- package/dist/packages/core/src/commands/selectNodeForward.d.ts +0 -13
- package/dist/packages/core/src/commands/selectParentNode.d.ts +0 -13
- package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +0 -13
- package/dist/packages/core/src/commands/selectTextblockStart.d.ts +0 -13
- package/dist/packages/core/src/commands/setContent.d.ts +0 -40
- package/dist/packages/core/src/commands/setMark.d.ts +0 -15
- package/dist/packages/core/src/commands/setMeta.d.ts +0 -16
- package/dist/packages/core/src/commands/setNode.d.ts +0 -16
- package/dist/packages/core/src/commands/setNodeSelection.d.ts +0 -14
- package/dist/packages/core/src/commands/setTextSelection.d.ts +0 -14
- package/dist/packages/core/src/commands/sinkListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/splitBlock.d.ts +0 -17
- package/dist/packages/core/src/commands/splitListItem.d.ts +0 -16
- package/dist/packages/core/src/commands/toggleList.d.ts +0 -18
- package/dist/packages/core/src/commands/toggleMark.d.ts +0 -30
- package/dist/packages/core/src/commands/toggleNode.d.ts +0 -17
- package/dist/packages/core/src/commands/toggleWrap.d.ts +0 -16
- package/dist/packages/core/src/commands/undoInputRule.d.ts +0 -13
- package/dist/packages/core/src/commands/unsetAllMarks.d.ts +0 -13
- package/dist/packages/core/src/commands/unsetMark.d.ts +0 -25
- package/dist/packages/core/src/commands/updateAttributes.d.ts +0 -24
- package/dist/packages/core/src/commands/wrapIn.d.ts +0 -16
- package/dist/packages/core/src/commands/wrapInList.d.ts +0 -16
- package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +0 -5
- package/dist/packages/core/src/extensions/commands.d.ts +0 -3
- package/dist/packages/core/src/extensions/editable.d.ts +0 -2
- package/dist/packages/core/src/extensions/focusEvents.d.ts +0 -2
- package/dist/packages/core/src/extensions/index.d.ts +0 -6
- package/dist/packages/core/src/extensions/keymap.d.ts +0 -2
- package/dist/packages/core/src/extensions/tabindex.d.ts +0 -2
- package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +0 -10
- package/dist/packages/core/src/helpers/createChainableState.d.ts +0 -10
- package/dist/packages/core/src/helpers/createDocument.d.ts +0 -12
- package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +0 -15
- package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +0 -7
- package/dist/packages/core/src/helpers/findChildren.d.ts +0 -9
- package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +0 -10
- package/dist/packages/core/src/helpers/findParentNode.d.ts +0 -16
- package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +0 -17
- package/dist/packages/core/src/helpers/generateHTML.d.ts +0 -8
- package/dist/packages/core/src/helpers/generateJSON.d.ts +0 -8
- package/dist/packages/core/src/helpers/generateText.d.ts +0 -12
- package/dist/packages/core/src/helpers/getAttributes.d.ts +0 -9
- package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +0 -6
- package/dist/packages/core/src/helpers/getChangedRanges.d.ts +0 -11
- package/dist/packages/core/src/helpers/getDebugJSON.d.ts +0 -8
- package/dist/packages/core/src/helpers/getExtensionField.d.ts +0 -9
- package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +0 -2
- package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getMarkRange.d.ts +0 -3
- package/dist/packages/core/src/helpers/getMarkType.d.ts +0 -2
- package/dist/packages/core/src/helpers/getMarksBetween.d.ts +0 -3
- package/dist/packages/core/src/helpers/getNodeAtPosition.d.ts +0 -11
- package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getNodeType.d.ts +0 -2
- package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getSchema.d.ts +0 -4
- package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +0 -10
- package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +0 -8
- package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +0 -8
- package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +0 -9
- package/dist/packages/core/src/helpers/getText.d.ts +0 -15
- package/dist/packages/core/src/helpers/getTextBetween.d.ts +0 -14
- package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +0 -8
- package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +0 -8
- package/dist/packages/core/src/helpers/index.d.ts +0 -50
- package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +0 -9
- package/dist/packages/core/src/helpers/isActive.d.ts +0 -2
- package/dist/packages/core/src/helpers/isAtEndOfNode.d.ts +0 -2
- package/dist/packages/core/src/helpers/isAtStartOfNode.d.ts +0 -2
- package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +0 -2
- package/dist/packages/core/src/helpers/isList.d.ts +0 -2
- package/dist/packages/core/src/helpers/isMarkActive.d.ts +0 -3
- package/dist/packages/core/src/helpers/isNodeActive.d.ts +0 -3
- package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +0 -14
- package/dist/packages/core/src/helpers/isNodeSelection.d.ts +0 -2
- package/dist/packages/core/src/helpers/isTextSelection.d.ts +0 -2
- package/dist/packages/core/src/helpers/posToDOMRect.d.ts +0 -2
- package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +0 -4
- package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +0 -2
- package/dist/packages/core/src/helpers/splitExtensions.d.ts +0 -9
- package/dist/packages/core/src/index.d.ts +0 -24
- package/dist/packages/core/src/inputRules/index.d.ts +0 -5
- package/dist/packages/core/src/inputRules/markInputRule.d.ts +0 -13
- package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +0 -23
- package/dist/packages/core/src/inputRules/textInputRule.d.ts +0 -10
- package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +0 -15
- package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +0 -28
- package/dist/packages/core/src/pasteRules/index.d.ts +0 -3
- package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +0 -13
- package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +0 -14
- package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +0 -10
- package/dist/packages/core/src/style.d.ts +0 -1
- package/dist/packages/core/src/types.d.ts +0 -253
- package/dist/packages/core/src/utilities/callOrReturn.d.ts +0 -9
- package/dist/packages/core/src/utilities/createStyleTag.d.ts +0 -1
- package/dist/packages/core/src/utilities/deleteProps.d.ts +0 -6
- package/dist/packages/core/src/utilities/elementFromString.d.ts +0 -1
- package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +0 -1
- package/dist/packages/core/src/utilities/findDuplicates.d.ts +0 -1
- package/dist/packages/core/src/utilities/fromString.d.ts +0 -1
- package/dist/packages/core/src/utilities/index.d.ts +0 -20
- package/dist/packages/core/src/utilities/isAndroid.d.ts +0 -1
- package/dist/packages/core/src/utilities/isEmptyObject.d.ts +0 -1
- package/dist/packages/core/src/utilities/isFunction.d.ts +0 -1
- package/dist/packages/core/src/utilities/isMacOS.d.ts +0 -1
- package/dist/packages/core/src/utilities/isNumber.d.ts +0 -1
- package/dist/packages/core/src/utilities/isPlainObject.d.ts +0 -1
- package/dist/packages/core/src/utilities/isRegExp.d.ts +0 -1
- package/dist/packages/core/src/utilities/isString.d.ts +0 -1
- package/dist/packages/core/src/utilities/isiOS.d.ts +0 -1
- package/dist/packages/core/src/utilities/mergeAttributes.d.ts +0 -1
- package/dist/packages/core/src/utilities/mergeDeep.d.ts +0 -1
- package/dist/packages/core/src/utilities/minMax.d.ts +0 -1
- package/dist/packages/core/src/utilities/objectIncludes.d.ts +0 -8
- package/dist/packages/core/src/utilities/removeDuplicates.d.ts +0 -8
- package/dist/packages/extension-mention/src/index.d.ts +0 -3
- package/dist/packages/suggestion/src/findSuggestionMatch.d.ts +0 -15
- package/dist/packages/suggestion/src/index.d.ts +0 -4
- package/dist/packages/suggestion/src/suggestion.d.ts +0 -153
package/dist/index.js
CHANGED
|
@@ -1,179 +1,175 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
HTMLAttributes: {},
|
|
19
|
-
renderText({ options, node }) {
|
|
20
|
-
var _a;
|
|
21
|
-
return `${options.suggestion.char}${(_a = node.attrs.label) !== null && _a !== void 0 ? _a : node.attrs.id}`;
|
|
22
|
-
},
|
|
23
|
-
deleteTriggerWithBackspace: false,
|
|
24
|
-
renderHTML({ options, node }) {
|
|
25
|
-
var _a;
|
|
26
|
-
return [
|
|
27
|
-
'span',
|
|
28
|
-
mergeAttributes(this.HTMLAttributes, options.HTMLAttributes),
|
|
29
|
-
`${options.suggestion.char}${(_a = node.attrs.label) !== null && _a !== void 0 ? _a : node.attrs.id}`,
|
|
30
|
-
];
|
|
31
|
-
},
|
|
32
|
-
suggestion: {
|
|
33
|
-
char: '@',
|
|
34
|
-
pluginKey: MentionPluginKey,
|
|
35
|
-
command: ({ editor, range, props }) => {
|
|
36
|
-
var _a, _b;
|
|
37
|
-
// increase range.to by one when the next node is of type "text"
|
|
38
|
-
// and starts with a space character
|
|
39
|
-
const nodeAfter = editor.view.state.selection.$to.nodeAfter;
|
|
40
|
-
const overrideSpace = (_a = nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.text) === null || _a === void 0 ? void 0 : _a.startsWith(' ');
|
|
41
|
-
if (overrideSpace) {
|
|
42
|
-
range.to += 1;
|
|
43
|
-
}
|
|
44
|
-
editor
|
|
45
|
-
.chain()
|
|
46
|
-
.focus()
|
|
47
|
-
.insertContentAt(range, [
|
|
48
|
-
{
|
|
49
|
-
type: this.name,
|
|
50
|
-
attrs: props,
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
type: 'text',
|
|
54
|
-
text: ' ',
|
|
55
|
-
},
|
|
56
|
-
])
|
|
57
|
-
.run();
|
|
58
|
-
(_b = window.getSelection()) === null || _b === void 0 ? void 0 : _b.collapseToEnd();
|
|
59
|
-
},
|
|
60
|
-
allow: ({ state, range }) => {
|
|
61
|
-
const $from = state.doc.resolve(range.from);
|
|
62
|
-
const type = state.schema.nodes[this.name];
|
|
63
|
-
const allow = !!$from.parent.type.contentMatch.matchType(type);
|
|
64
|
-
return allow;
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
},
|
|
69
|
-
group: 'inline',
|
|
70
|
-
inline: true,
|
|
71
|
-
selectable: false,
|
|
72
|
-
atom: true,
|
|
73
|
-
addAttributes() {
|
|
74
|
-
return {
|
|
75
|
-
id: {
|
|
76
|
-
default: null,
|
|
77
|
-
parseHTML: element => element.getAttribute('data-id'),
|
|
78
|
-
renderHTML: attributes => {
|
|
79
|
-
if (!attributes.id) {
|
|
80
|
-
return {};
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
'data-id': attributes.id,
|
|
84
|
-
};
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
label: {
|
|
88
|
-
default: null,
|
|
89
|
-
parseHTML: element => element.getAttribute('data-label'),
|
|
90
|
-
renderHTML: attributes => {
|
|
91
|
-
if (!attributes.label) {
|
|
92
|
-
return {};
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
'data-label': attributes.label,
|
|
96
|
-
};
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
},
|
|
101
|
-
parseHTML() {
|
|
1
|
+
// src/mention.ts
|
|
2
|
+
import { mergeAttributes, Node } from "@tiptap/core";
|
|
3
|
+
import { PluginKey } from "@tiptap/pm/state";
|
|
4
|
+
import Suggestion from "@tiptap/suggestion";
|
|
5
|
+
var MentionPluginKey = new PluginKey("mention");
|
|
6
|
+
var Mention = Node.create({
|
|
7
|
+
name: "mention",
|
|
8
|
+
addOptions() {
|
|
9
|
+
return {
|
|
10
|
+
HTMLAttributes: {},
|
|
11
|
+
renderText({ options, node }) {
|
|
12
|
+
var _a;
|
|
13
|
+
return `${options.suggestion.char}${(_a = node.attrs.label) != null ? _a : node.attrs.id}`;
|
|
14
|
+
},
|
|
15
|
+
deleteTriggerWithBackspace: false,
|
|
16
|
+
renderHTML({ options, node }) {
|
|
17
|
+
var _a;
|
|
102
18
|
return [
|
|
19
|
+
"span",
|
|
20
|
+
mergeAttributes(this.HTMLAttributes, options.HTMLAttributes),
|
|
21
|
+
`${options.suggestion.char}${(_a = node.attrs.label) != null ? _a : node.attrs.id}`
|
|
22
|
+
];
|
|
23
|
+
},
|
|
24
|
+
suggestion: {
|
|
25
|
+
char: "@",
|
|
26
|
+
pluginKey: MentionPluginKey,
|
|
27
|
+
command: ({ editor, range, props }) => {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
const nodeAfter = editor.view.state.selection.$to.nodeAfter;
|
|
30
|
+
const overrideSpace = (_a = nodeAfter == null ? void 0 : nodeAfter.text) == null ? void 0 : _a.startsWith(" ");
|
|
31
|
+
if (overrideSpace) {
|
|
32
|
+
range.to += 1;
|
|
33
|
+
}
|
|
34
|
+
editor.chain().focus().insertContentAt(range, [
|
|
103
35
|
{
|
|
104
|
-
|
|
36
|
+
type: this.name,
|
|
37
|
+
attrs: props
|
|
105
38
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
];
|
|
39
|
+
{
|
|
40
|
+
type: "text",
|
|
41
|
+
text: " "
|
|
42
|
+
}
|
|
43
|
+
]).run();
|
|
44
|
+
(_b = window.getSelection()) == null ? void 0 : _b.collapseToEnd();
|
|
45
|
+
},
|
|
46
|
+
allow: ({ state, range }) => {
|
|
47
|
+
const $from = state.doc.resolve(range.from);
|
|
48
|
+
const type = state.schema.nodes[this.name];
|
|
49
|
+
const allow = !!$from.parent.type.contentMatch.matchType(type);
|
|
50
|
+
return allow;
|
|
119
51
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
group: "inline",
|
|
56
|
+
inline: true,
|
|
57
|
+
selectable: false,
|
|
58
|
+
atom: true,
|
|
59
|
+
addAttributes() {
|
|
60
|
+
return {
|
|
61
|
+
id: {
|
|
62
|
+
default: null,
|
|
63
|
+
parseHTML: (element) => element.getAttribute("data-id"),
|
|
64
|
+
renderHTML: (attributes) => {
|
|
65
|
+
if (!attributes.id) {
|
|
66
|
+
return {};
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
"data-id": attributes.id
|
|
70
|
+
};
|
|
132
71
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
72
|
+
},
|
|
73
|
+
label: {
|
|
74
|
+
default: null,
|
|
75
|
+
parseHTML: (element) => element.getAttribute("data-label"),
|
|
76
|
+
renderHTML: (attributes) => {
|
|
77
|
+
if (!attributes.label) {
|
|
78
|
+
return {};
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
"data-label": attributes.label
|
|
82
|
+
};
|
|
142
83
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
parseHTML() {
|
|
88
|
+
return [
|
|
89
|
+
{
|
|
90
|
+
tag: `span[data-type="${this.name}"]`
|
|
91
|
+
}
|
|
92
|
+
];
|
|
93
|
+
},
|
|
94
|
+
renderHTML({ node, HTMLAttributes }) {
|
|
95
|
+
if (this.options.renderLabel !== void 0) {
|
|
96
|
+
console.warn("renderLabel is deprecated use renderText and renderHTML instead");
|
|
97
|
+
return [
|
|
98
|
+
"span",
|
|
99
|
+
mergeAttributes({ "data-type": this.name }, this.options.HTMLAttributes, HTMLAttributes),
|
|
100
|
+
this.options.renderLabel({
|
|
101
|
+
options: this.options,
|
|
102
|
+
node
|
|
103
|
+
})
|
|
104
|
+
];
|
|
105
|
+
}
|
|
106
|
+
const mergedOptions = { ...this.options };
|
|
107
|
+
mergedOptions.HTMLAttributes = mergeAttributes({ "data-type": this.name }, this.options.HTMLAttributes, HTMLAttributes);
|
|
108
|
+
const html = this.options.renderHTML({
|
|
109
|
+
options: mergedOptions,
|
|
110
|
+
node
|
|
111
|
+
});
|
|
112
|
+
if (typeof html === "string") {
|
|
113
|
+
return [
|
|
114
|
+
"span",
|
|
115
|
+
mergeAttributes({ "data-type": this.name }, this.options.HTMLAttributes, HTMLAttributes),
|
|
116
|
+
html
|
|
117
|
+
];
|
|
118
|
+
}
|
|
119
|
+
return html;
|
|
120
|
+
},
|
|
121
|
+
renderText({ node }) {
|
|
122
|
+
if (this.options.renderLabel !== void 0) {
|
|
123
|
+
console.warn("renderLabel is deprecated use renderText and renderHTML instead");
|
|
124
|
+
return this.options.renderLabel({
|
|
125
|
+
options: this.options,
|
|
126
|
+
node
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return this.options.renderText({
|
|
130
|
+
options: this.options,
|
|
131
|
+
node
|
|
132
|
+
});
|
|
133
|
+
},
|
|
134
|
+
addKeyboardShortcuts() {
|
|
135
|
+
return {
|
|
136
|
+
Backspace: () => this.editor.commands.command(({ tr, state }) => {
|
|
137
|
+
let isMention = false;
|
|
138
|
+
const { selection } = state;
|
|
139
|
+
const { empty, anchor } = selection;
|
|
140
|
+
if (!empty) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
state.doc.nodesBetween(anchor - 1, anchor, (node, pos) => {
|
|
144
|
+
if (node.type.name === this.name) {
|
|
145
|
+
isMention = true;
|
|
146
|
+
tr.insertText(
|
|
147
|
+
this.options.deleteTriggerWithBackspace ? "" : this.options.suggestion.char || "",
|
|
148
|
+
pos,
|
|
149
|
+
pos + node.nodeSize
|
|
150
|
+
);
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
146
153
|
});
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
isMention = true;
|
|
160
|
-
tr.insertText(this.options.deleteTriggerWithBackspace ? '' : this.options.suggestion.char || '', pos, pos + node.nodeSize);
|
|
161
|
-
return false;
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
return isMention;
|
|
165
|
-
}),
|
|
166
|
-
};
|
|
167
|
-
},
|
|
168
|
-
addProseMirrorPlugins() {
|
|
169
|
-
return [
|
|
170
|
-
Suggestion({
|
|
171
|
-
editor: this.editor,
|
|
172
|
-
...this.options.suggestion,
|
|
173
|
-
}),
|
|
174
|
-
];
|
|
175
|
-
},
|
|
154
|
+
return isMention;
|
|
155
|
+
})
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
addProseMirrorPlugins() {
|
|
159
|
+
return [
|
|
160
|
+
Suggestion({
|
|
161
|
+
editor: this.editor,
|
|
162
|
+
...this.options.suggestion
|
|
163
|
+
})
|
|
164
|
+
];
|
|
165
|
+
}
|
|
176
166
|
});
|
|
177
167
|
|
|
178
|
-
|
|
179
|
-
|
|
168
|
+
// src/index.ts
|
|
169
|
+
var src_default = Mention;
|
|
170
|
+
export {
|
|
171
|
+
Mention,
|
|
172
|
+
MentionPluginKey,
|
|
173
|
+
src_default as default
|
|
174
|
+
};
|
|
175
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/mention.ts"],"sourcesContent":["import { mergeAttributes, Node } from '@tiptap/core'\nimport { DOMOutputSpec, Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { PluginKey } from '@tiptap/pm/state'\nimport Suggestion, { SuggestionOptions } from '@tiptap/suggestion'\n\n// See `addAttributes` below\nexport interface MentionNodeAttrs {\n /**\n * The identifier for the selected item that was mentioned, stored as a `data-id`\n * attribute.\n */\n id: string | null;\n /**\n * The label to be rendered by the editor as the displayed text for this mentioned\n * item, if provided. Stored as a `data-label` attribute. See `renderLabel`.\n */\n label?: string | null;\n}\n\nexport type MentionOptions<SuggestionItem = any, Attrs extends Record<string, any> = MentionNodeAttrs> = {\n /**\n * The HTML attributes for a mention node.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>\n\n /**\n * A function to render the label of a mention.\n * @deprecated use renderText and renderHTML instead\n * @param props The render props\n * @returns The label\n * @example ({ options, node }) => `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`\n */\n renderLabel?: (props: { options: MentionOptions<SuggestionItem, Attrs>; node: ProseMirrorNode }) => string\n\n /**\n * A function to render the text of a mention.\n * @param props The render props\n * @returns The text\n * @example ({ options, node }) => `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`\n */\n renderText: (props: { options: MentionOptions<SuggestionItem, Attrs>; node: ProseMirrorNode }) => string\n\n /**\n * A function to render the HTML of a mention.\n * @param props The render props\n * @returns The HTML as a ProseMirror DOM Output Spec\n * @example ({ options, node }) => ['span', { 'data-type': 'mention' }, `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`]\n */\n renderHTML: (props: { options: MentionOptions<SuggestionItem, Attrs>; node: ProseMirrorNode }) => DOMOutputSpec\n\n /**\n * Whether to delete the trigger character with backspace.\n * @default false\n */\n deleteTriggerWithBackspace: boolean\n\n /**\n * The suggestion options.\n * @default {}\n * @example { char: '@', pluginKey: MentionPluginKey, command: ({ editor, range, props }) => { ... } }\n */\n suggestion: Omit<SuggestionOptions<SuggestionItem, Attrs>, 'editor'>\n}\n\n/**\n * The plugin key for the mention plugin.\n * @default 'mention'\n */\nexport const MentionPluginKey = new PluginKey('mention')\n\n/**\n * This extension allows you to insert mentions into the editor.\n * @see https://www.tiptap.dev/api/extensions/mention\n */\nexport const Mention = Node.create<MentionOptions>({\n name: 'mention',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n renderText({ options, node }) {\n return `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`\n },\n deleteTriggerWithBackspace: false,\n renderHTML({ options, node }) {\n return [\n 'span',\n mergeAttributes(this.HTMLAttributes, options.HTMLAttributes),\n `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`,\n ]\n },\n suggestion: {\n char: '@',\n pluginKey: MentionPluginKey,\n command: ({ editor, range, props }) => {\n // increase range.to by one when the next node is of type \"text\"\n // and starts with a space character\n const nodeAfter = editor.view.state.selection.$to.nodeAfter\n const overrideSpace = nodeAfter?.text?.startsWith(' ')\n\n if (overrideSpace) {\n range.to += 1\n }\n\n editor\n .chain()\n .focus()\n .insertContentAt(range, [\n {\n type: this.name,\n attrs: props,\n },\n {\n type: 'text',\n text: ' ',\n },\n ])\n .run()\n\n window.getSelection()?.collapseToEnd()\n },\n allow: ({ state, range }) => {\n const $from = state.doc.resolve(range.from)\n const type = state.schema.nodes[this.name]\n const allow = !!$from.parent.type.contentMatch.matchType(type)\n\n return allow\n },\n },\n }\n },\n\n group: 'inline',\n\n inline: true,\n\n selectable: false,\n\n atom: true,\n\n addAttributes() {\n return {\n id: {\n default: null,\n parseHTML: element => element.getAttribute('data-id'),\n renderHTML: attributes => {\n if (!attributes.id) {\n return {}\n }\n\n return {\n 'data-id': attributes.id,\n }\n },\n },\n\n label: {\n default: null,\n parseHTML: element => element.getAttribute('data-label'),\n renderHTML: attributes => {\n if (!attributes.label) {\n return {}\n }\n\n return {\n 'data-label': attributes.label,\n }\n },\n },\n }\n },\n\n parseHTML() {\n return [\n {\n tag: `span[data-type=\"${this.name}\"]`,\n },\n ]\n },\n\n renderHTML({ node, HTMLAttributes }) {\n if (this.options.renderLabel !== undefined) {\n console.warn('renderLabel is deprecated use renderText and renderHTML instead')\n return [\n 'span',\n mergeAttributes({ 'data-type': this.name }, this.options.HTMLAttributes, HTMLAttributes),\n this.options.renderLabel({\n options: this.options,\n node,\n }),\n ]\n }\n const mergedOptions = { ...this.options }\n\n mergedOptions.HTMLAttributes = mergeAttributes({ 'data-type': this.name }, this.options.HTMLAttributes, HTMLAttributes)\n const html = this.options.renderHTML({\n options: mergedOptions,\n node,\n })\n\n if (typeof html === 'string') {\n return [\n 'span',\n mergeAttributes({ 'data-type': this.name }, this.options.HTMLAttributes, HTMLAttributes),\n html,\n ]\n }\n return html\n },\n\n renderText({ node }) {\n if (this.options.renderLabel !== undefined) {\n console.warn('renderLabel is deprecated use renderText and renderHTML instead')\n return this.options.renderLabel({\n options: this.options,\n node,\n })\n }\n return this.options.renderText({\n options: this.options,\n node,\n })\n },\n\n addKeyboardShortcuts() {\n return {\n Backspace: () => this.editor.commands.command(({ tr, state }) => {\n let isMention = false\n const { selection } = state\n const { empty, anchor } = selection\n\n if (!empty) {\n return false\n }\n\n state.doc.nodesBetween(anchor - 1, anchor, (node, pos) => {\n if (node.type.name === this.name) {\n isMention = true\n tr.insertText(\n this.options.deleteTriggerWithBackspace ? '' : this.options.suggestion.char || '',\n pos,\n pos + node.nodeSize,\n )\n\n return false\n }\n })\n\n return isMention\n }),\n }\n },\n\n addProseMirrorPlugins() {\n return [\n Suggestion({\n editor: this.editor,\n ...this.options.suggestion,\n }),\n ]\n },\n})\n"],"names":[],"mappings":";;;;AAkEA;;;AAGG;MACU,gBAAgB,GAAG,IAAI,SAAS,CAAC,SAAS,EAAC;AAExD;;;AAGG;AACU,MAAA,OAAO,GAAG,IAAI,CAAC,MAAM,CAAiB;AACjD,IAAA,IAAI,EAAE,SAAS;IAEf,UAAU,GAAA;QACR,OAAO;AACL,YAAA,cAAc,EAAE,EAAE;AAClB,YAAA,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAA;;gBAC1B,OAAO,CAAA,EAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAA,EAAG,MAAA,IAAI,CAAC,KAAK,CAAC,KAAK,mCAAI,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAA;aACxE;AACD,YAAA,0BAA0B,EAAE,KAAK;AACjC,YAAA,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAA;;gBAC1B,OAAO;oBACL,MAAM;oBACN,eAAe,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,cAAc,CAAC;AAC5D,oBAAA,CAAA,EAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAA,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AC,CAAC,CAAA;AAEF,gBAAA,OAAO,SAAS,CAAA;AAClB,aAAC,CAAC;SACH,CAAA;KACF;IAED,qBAAqB,GAAA;QACnB,OAAO;AACL,YAAA,UAAU,CAAC;gBACT,MAAM,EAAE,IAAI,CAAC,MAAM;AACnB,gBAAA,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU;aAC3B,CAAC;SACH,CAAA;KACF;AACF,CAAA;;;;"}
|
|
1
|
+
{"version":3,"sources":["../src/mention.ts","../src/index.ts"],"sourcesContent":["import { mergeAttributes, Node } from '@tiptap/core'\nimport { DOMOutputSpec, Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { PluginKey } from '@tiptap/pm/state'\nimport Suggestion, { SuggestionOptions } from '@tiptap/suggestion'\n\n// See `addAttributes` below\nexport interface MentionNodeAttrs {\n /**\n * The identifier for the selected item that was mentioned, stored as a `data-id`\n * attribute.\n */\n id: string | null;\n /**\n * The label to be rendered by the editor as the displayed text for this mentioned\n * item, if provided. Stored as a `data-label` attribute. See `renderLabel`.\n */\n label?: string | null;\n}\n\nexport type MentionOptions<SuggestionItem = any, Attrs extends Record<string, any> = MentionNodeAttrs> = {\n /**\n * The HTML attributes for a mention node.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>\n\n /**\n * A function to render the label of a mention.\n * @deprecated use renderText and renderHTML instead\n * @param props The render props\n * @returns The label\n * @example ({ options, node }) => `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`\n */\n renderLabel?: (props: { options: MentionOptions<SuggestionItem, Attrs>; node: ProseMirrorNode }) => string\n\n /**\n * A function to render the text of a mention.\n * @param props The render props\n * @returns The text\n * @example ({ options, node }) => `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`\n */\n renderText: (props: { options: MentionOptions<SuggestionItem, Attrs>; node: ProseMirrorNode }) => string\n\n /**\n * A function to render the HTML of a mention.\n * @param props The render props\n * @returns The HTML as a ProseMirror DOM Output Spec\n * @example ({ options, node }) => ['span', { 'data-type': 'mention' }, `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`]\n */\n renderHTML: (props: { options: MentionOptions<SuggestionItem, Attrs>; node: ProseMirrorNode }) => DOMOutputSpec\n\n /**\n * Whether to delete the trigger character with backspace.\n * @default false\n */\n deleteTriggerWithBackspace: boolean\n\n /**\n * The suggestion options.\n * @default {}\n * @example { char: '@', pluginKey: MentionPluginKey, command: ({ editor, range, props }) => { ... } }\n */\n suggestion: Omit<SuggestionOptions<SuggestionItem, Attrs>, 'editor'>\n}\n\n/**\n * The plugin key for the mention plugin.\n * @default 'mention'\n */\nexport const MentionPluginKey = new PluginKey('mention')\n\n/**\n * This extension allows you to insert mentions into the editor.\n * @see https://www.tiptap.dev/api/extensions/mention\n */\nexport const Mention = Node.create<MentionOptions>({\n name: 'mention',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n renderText({ options, node }) {\n return `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`\n },\n deleteTriggerWithBackspace: false,\n renderHTML({ options, node }) {\n return [\n 'span',\n mergeAttributes(this.HTMLAttributes, options.HTMLAttributes),\n `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`,\n ]\n },\n suggestion: {\n char: '@',\n pluginKey: MentionPluginKey,\n command: ({ editor, range, props }) => {\n // increase range.to by one when the next node is of type \"text\"\n // and starts with a space character\n const nodeAfter = editor.view.state.selection.$to.nodeAfter\n const overrideSpace = nodeAfter?.text?.startsWith(' ')\n\n if (overrideSpace) {\n range.to += 1\n }\n\n editor\n .chain()\n .focus()\n .insertContentAt(range, [\n {\n type: this.name,\n attrs: props,\n },\n {\n type: 'text',\n text: ' ',\n },\n ])\n .run()\n\n window.getSelection()?.collapseToEnd()\n },\n allow: ({ state, range }) => {\n const $from = state.doc.resolve(range.from)\n const type = state.schema.nodes[this.name]\n const allow = !!$from.parent.type.contentMatch.matchType(type)\n\n return allow\n },\n },\n }\n },\n\n group: 'inline',\n\n inline: true,\n\n selectable: false,\n\n atom: true,\n\n addAttributes() {\n return {\n id: {\n default: null,\n parseHTML: element => element.getAttribute('data-id'),\n renderHTML: attributes => {\n if (!attributes.id) {\n return {}\n }\n\n return {\n 'data-id': attributes.id,\n }\n },\n },\n\n label: {\n default: null,\n parseHTML: element => element.getAttribute('data-label'),\n renderHTML: attributes => {\n if (!attributes.label) {\n return {}\n }\n\n return {\n 'data-label': attributes.label,\n }\n },\n },\n }\n },\n\n parseHTML() {\n return [\n {\n tag: `span[data-type=\"${this.name}\"]`,\n },\n ]\n },\n\n renderHTML({ node, HTMLAttributes }) {\n if (this.options.renderLabel !== undefined) {\n console.warn('renderLabel is deprecated use renderText and renderHTML instead')\n return [\n 'span',\n mergeAttributes({ 'data-type': this.name }, this.options.HTMLAttributes, HTMLAttributes),\n this.options.renderLabel({\n options: this.options,\n node,\n }),\n ]\n }\n const mergedOptions = { ...this.options }\n\n mergedOptions.HTMLAttributes = mergeAttributes({ 'data-type': this.name }, this.options.HTMLAttributes, HTMLAttributes)\n const html = this.options.renderHTML({\n options: mergedOptions,\n node,\n })\n\n if (typeof html === 'string') {\n return [\n 'span',\n mergeAttributes({ 'data-type': this.name }, this.options.HTMLAttributes, HTMLAttributes),\n html,\n ]\n }\n return html\n },\n\n renderText({ node }) {\n if (this.options.renderLabel !== undefined) {\n console.warn('renderLabel is deprecated use renderText and renderHTML instead')\n return this.options.renderLabel({\n options: this.options,\n node,\n })\n }\n return this.options.renderText({\n options: this.options,\n node,\n })\n },\n\n addKeyboardShortcuts() {\n return {\n Backspace: () => this.editor.commands.command(({ tr, state }) => {\n let isMention = false\n const { selection } = state\n const { empty, anchor } = selection\n\n if (!empty) {\n return false\n }\n\n state.doc.nodesBetween(anchor - 1, anchor, (node, pos) => {\n if (node.type.name === this.name) {\n isMention = true\n tr.insertText(\n this.options.deleteTriggerWithBackspace ? '' : this.options.suggestion.char || '',\n pos,\n pos + node.nodeSize,\n )\n\n return false\n }\n })\n\n return isMention\n }),\n }\n },\n\n addProseMirrorPlugins() {\n return [\n Suggestion({\n editor: this.editor,\n ...this.options.suggestion,\n }),\n ]\n },\n})\n","import { Mention } from './mention.js'\n\nexport * from './mention.js'\n\nexport default Mention\n"],"mappings":";AAAA,SAAS,iBAAiB,YAAY;AAEtC,SAAS,iBAAiB;AAC1B,OAAO,gBAAuC;AAmEvC,IAAM,mBAAmB,IAAI,UAAU,SAAS;AAMhD,IAAM,UAAU,KAAK,OAAuB;AAAA,EACjD,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,gBAAgB,CAAC;AAAA,MACjB,WAAW,EAAE,SAAS,KAAK,GAAG;AAlFpC;AAmFQ,eAAO,GAAG,QAAQ,WAAW,IAAI,IAAG,UAAK,MAAM,UAAX,YAAoB,KAAK,MAAM,EAAE;AAAA,MACvE;AAAA,MACA,4BAA4B;AAAA,MAC5B,WAAW,EAAE,SAAS,KAAK,GAAG;AAtFpC;AAuFQ,eAAO;AAAA,UACL;AAAA,UACA,gBAAgB,KAAK,gBAAgB,QAAQ,cAAc;AAAA,UAC3D,GAAG,QAAQ,WAAW,IAAI,IAAG,UAAK,MAAM,UAAX,YAAoB,KAAK,MAAM,EAAE;AAAA,QAChE;AAAA,MACF;AAAA,MACA,YAAY;AAAA,QACV,MAAM;AAAA,QACN,WAAW;AAAA,QACX,SAAS,CAAC,EAAE,QAAQ,OAAO,MAAM,MAAM;AAhG/C;AAmGU,gBAAM,YAAY,OAAO,KAAK,MAAM,UAAU,IAAI;AAClD,gBAAM,iBAAgB,4CAAW,SAAX,mBAAiB,WAAW;AAElD,cAAI,eAAe;AACjB,kBAAM,MAAM;AAAA,UACd;AAEA,iBACG,MAAM,EACN,MAAM,EACN,gBAAgB,OAAO;AAAA,YACtB;AAAA,cACE,MAAM,KAAK;AAAA,cACX,OAAO;AAAA,YACT;AAAA,YACA;AAAA,cACE,MAAM;AAAA,cACN,MAAM;AAAA,YACR;AAAA,UACF,CAAC,EACA,IAAI;AAEP,uBAAO,aAAa,MAApB,mBAAuB;AAAA,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,KAAK;AAAA,YACb;AAEA,mBAAO;AAAA,UACT;AAAA,QACF,CAAC;AAED,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEA,wBAAwB;AACtB,WAAO;AAAA,MACL,WAAW;AAAA,QACT,QAAQ,KAAK;AAAA,QACb,GAAG,KAAK,QAAQ;AAAA,MAClB,CAAC;AAAA,IACH;AAAA,EACF;AACF,CAAC;;;ACnQD,IAAO,cAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/extension-mention",
|
|
3
3
|
"description": "mention extension for tiptap",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0-next.1",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -15,28 +15,27 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"types": "./dist/
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
19
|
"import": "./dist/index.js",
|
|
20
20
|
"require": "./dist/index.cjs"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"main": "dist/index.cjs",
|
|
24
24
|
"module": "dist/index.js",
|
|
25
|
-
"
|
|
26
|
-
"types": "dist/packages/extension-mention/src/index.d.ts",
|
|
25
|
+
"types": "dist/index.d.ts",
|
|
27
26
|
"files": [
|
|
28
27
|
"src",
|
|
29
28
|
"dist"
|
|
30
29
|
],
|
|
31
30
|
"devDependencies": {
|
|
32
|
-
"@tiptap/core": "^
|
|
33
|
-
"@tiptap/pm": "^
|
|
34
|
-
"@tiptap/suggestion": "^
|
|
31
|
+
"@tiptap/core": "^3.0.0-next.1",
|
|
32
|
+
"@tiptap/pm": "^3.0.0-next.1",
|
|
33
|
+
"@tiptap/suggestion": "^3.0.0-next.1"
|
|
35
34
|
},
|
|
36
35
|
"peerDependencies": {
|
|
37
|
-
"@tiptap/core": "^
|
|
38
|
-
"@tiptap/pm": "^
|
|
39
|
-
"@tiptap/suggestion": "^
|
|
36
|
+
"@tiptap/core": "^3.0.0-next.1",
|
|
37
|
+
"@tiptap/pm": "^3.0.0-next.1",
|
|
38
|
+
"@tiptap/suggestion": "^3.0.0-next.1"
|
|
40
39
|
},
|
|
41
40
|
"repository": {
|
|
42
41
|
"type": "git",
|
|
@@ -44,7 +43,6 @@
|
|
|
44
43
|
"directory": "packages/extension-mention"
|
|
45
44
|
},
|
|
46
45
|
"scripts": {
|
|
47
|
-
"
|
|
48
|
-
"build": "npm run clean && rollup -c"
|
|
46
|
+
"build": "tsup"
|
|
49
47
|
}
|
|
50
48
|
}
|
package/dist/index.umd.js
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/core'), require('@tiptap/pm/state'), require('@tiptap/suggestion')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@tiptap/core', '@tiptap/pm/state', '@tiptap/suggestion'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-mention"] = {}, global.core, global.state, global.Suggestion));
|
|
5
|
-
})(this, (function (exports, core, state, Suggestion) { 'use strict';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* The plugin key for the mention plugin.
|
|
9
|
-
* @default 'mention'
|
|
10
|
-
*/
|
|
11
|
-
const MentionPluginKey = new state.PluginKey('mention');
|
|
12
|
-
/**
|
|
13
|
-
* This extension allows you to insert mentions into the editor.
|
|
14
|
-
* @see https://www.tiptap.dev/api/extensions/mention
|
|
15
|
-
*/
|
|
16
|
-
const Mention = core.Node.create({
|
|
17
|
-
name: 'mention',
|
|
18
|
-
addOptions() {
|
|
19
|
-
return {
|
|
20
|
-
HTMLAttributes: {},
|
|
21
|
-
renderText({ options, node }) {
|
|
22
|
-
var _a;
|
|
23
|
-
return `${options.suggestion.char}${(_a = node.attrs.label) !== null && _a !== void 0 ? _a : node.attrs.id}`;
|
|
24
|
-
},
|
|
25
|
-
deleteTriggerWithBackspace: false,
|
|
26
|
-
renderHTML({ options, node }) {
|
|
27
|
-
var _a;
|
|
28
|
-
return [
|
|
29
|
-
'span',
|
|
30
|
-
core.mergeAttributes(this.HTMLAttributes, options.HTMLAttributes),
|
|
31
|
-
`${options.suggestion.char}${(_a = node.attrs.label) !== null && _a !== void 0 ? _a : node.attrs.id}`,
|
|
32
|
-
];
|
|
33
|
-
},
|
|
34
|
-
suggestion: {
|
|
35
|
-
char: '@',
|
|
36
|
-
pluginKey: MentionPluginKey,
|
|
37
|
-
command: ({ editor, range, props }) => {
|
|
38
|
-
var _a, _b;
|
|
39
|
-
// increase range.to by one when the next node is of type "text"
|
|
40
|
-
// and starts with a space character
|
|
41
|
-
const nodeAfter = editor.view.state.selection.$to.nodeAfter;
|
|
42
|
-
const overrideSpace = (_a = nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.text) === null || _a === void 0 ? void 0 : _a.startsWith(' ');
|
|
43
|
-
if (overrideSpace) {
|
|
44
|
-
range.to += 1;
|
|
45
|
-
}
|
|
46
|
-
editor
|
|
47
|
-
.chain()
|
|
48
|
-
.focus()
|
|
49
|
-
.insertContentAt(range, [
|
|
50
|
-
{
|
|
51
|
-
type: this.name,
|
|
52
|
-
attrs: props,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
type: 'text',
|
|
56
|
-
text: ' ',
|
|
57
|
-
},
|
|
58
|
-
])
|
|
59
|
-
.run();
|
|
60
|
-
(_b = window.getSelection()) === null || _b === void 0 ? void 0 : _b.collapseToEnd();
|
|
61
|
-
},
|
|
62
|
-
allow: ({ state, range }) => {
|
|
63
|
-
const $from = state.doc.resolve(range.from);
|
|
64
|
-
const type = state.schema.nodes[this.name];
|
|
65
|
-
const allow = !!$from.parent.type.contentMatch.matchType(type);
|
|
66
|
-
return allow;
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
},
|
|
71
|
-
group: 'inline',
|
|
72
|
-
inline: true,
|
|
73
|
-
selectable: false,
|
|
74
|
-
atom: true,
|
|
75
|
-
addAttributes() {
|
|
76
|
-
return {
|
|
77
|
-
id: {
|
|
78
|
-
default: null,
|
|
79
|
-
parseHTML: element => element.getAttribute('data-id'),
|
|
80
|
-
renderHTML: attributes => {
|
|
81
|
-
if (!attributes.id) {
|
|
82
|
-
return {};
|
|
83
|
-
}
|
|
84
|
-
return {
|
|
85
|
-
'data-id': attributes.id,
|
|
86
|
-
};
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
label: {
|
|
90
|
-
default: null,
|
|
91
|
-
parseHTML: element => element.getAttribute('data-label'),
|
|
92
|
-
renderHTML: attributes => {
|
|
93
|
-
if (!attributes.label) {
|
|
94
|
-
return {};
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
'data-label': attributes.label,
|
|
98
|
-
};
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
},
|
|
103
|
-
parseHTML() {
|
|
104
|
-
return [
|
|
105
|
-
{
|
|
106
|
-
tag: `span[data-type="${this.name}"]`,
|
|
107
|
-
},
|
|
108
|
-
];
|
|
109
|
-
},
|
|
110
|
-
renderHTML({ node, HTMLAttributes }) {
|
|
111
|
-
if (this.options.renderLabel !== undefined) {
|
|
112
|
-
console.warn('renderLabel is deprecated use renderText and renderHTML instead');
|
|
113
|
-
return [
|
|
114
|
-
'span',
|
|
115
|
-
core.mergeAttributes({ 'data-type': this.name }, this.options.HTMLAttributes, HTMLAttributes),
|
|
116
|
-
this.options.renderLabel({
|
|
117
|
-
options: this.options,
|
|
118
|
-
node,
|
|
119
|
-
}),
|
|
120
|
-
];
|
|
121
|
-
}
|
|
122
|
-
const mergedOptions = { ...this.options };
|
|
123
|
-
mergedOptions.HTMLAttributes = core.mergeAttributes({ 'data-type': this.name }, this.options.HTMLAttributes, HTMLAttributes);
|
|
124
|
-
const html = this.options.renderHTML({
|
|
125
|
-
options: mergedOptions,
|
|
126
|
-
node,
|
|
127
|
-
});
|
|
128
|
-
if (typeof html === 'string') {
|
|
129
|
-
return [
|
|
130
|
-
'span',
|
|
131
|
-
core.mergeAttributes({ 'data-type': this.name }, this.options.HTMLAttributes, HTMLAttributes),
|
|
132
|
-
html,
|
|
133
|
-
];
|
|
134
|
-
}
|
|
135
|
-
return html;
|
|
136
|
-
},
|
|
137
|
-
renderText({ node }) {
|
|
138
|
-
if (this.options.renderLabel !== undefined) {
|
|
139
|
-
console.warn('renderLabel is deprecated use renderText and renderHTML instead');
|
|
140
|
-
return this.options.renderLabel({
|
|
141
|
-
options: this.options,
|
|
142
|
-
node,
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
return this.options.renderText({
|
|
146
|
-
options: this.options,
|
|
147
|
-
node,
|
|
148
|
-
});
|
|
149
|
-
},
|
|
150
|
-
addKeyboardShortcuts() {
|
|
151
|
-
return {
|
|
152
|
-
Backspace: () => this.editor.commands.command(({ tr, state }) => {
|
|
153
|
-
let isMention = false;
|
|
154
|
-
const { selection } = state;
|
|
155
|
-
const { empty, anchor } = selection;
|
|
156
|
-
if (!empty) {
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
state.doc.nodesBetween(anchor - 1, anchor, (node, pos) => {
|
|
160
|
-
if (node.type.name === this.name) {
|
|
161
|
-
isMention = true;
|
|
162
|
-
tr.insertText(this.options.deleteTriggerWithBackspace ? '' : this.options.suggestion.char || '', pos, pos + node.nodeSize);
|
|
163
|
-
return false;
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
return isMention;
|
|
167
|
-
}),
|
|
168
|
-
};
|
|
169
|
-
},
|
|
170
|
-
addProseMirrorPlugins() {
|
|
171
|
-
return [
|
|
172
|
-
Suggestion({
|
|
173
|
-
editor: this.editor,
|
|
174
|
-
...this.options.suggestion,
|
|
175
|
-
}),
|
|
176
|
-
];
|
|
177
|
-
},
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
exports.Mention = Mention;
|
|
181
|
-
exports.MentionPluginKey = MentionPluginKey;
|
|
182
|
-
exports.default = Mention;
|
|
183
|
-
|
|
184
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
185
|
-
|
|
186
|
-
}));
|
|
187
|
-
//# sourceMappingURL=index.umd.js.map
|