@tiptap/suggestion 2.11.6 → 3.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/suggestion.ts CHANGED
@@ -1,6 +1,8 @@
1
- import { Editor, Range } from '@tiptap/core'
2
- import { EditorState, Plugin, PluginKey } from '@tiptap/pm/state'
3
- import { Decoration, DecorationSet, EditorView } from '@tiptap/pm/view'
1
+ import type { Editor, Range } from '@tiptap/core'
2
+ import type { EditorState } from '@tiptap/pm/state'
3
+ import { Plugin, PluginKey } from '@tiptap/pm/state'
4
+ import type { EditorView } from '@tiptap/pm/view'
5
+ import { Decoration, DecorationSet } from '@tiptap/pm/view'
4
6
 
5
7
  import { findSuggestionMatch as defaultFindSuggestionMatch } from './findSuggestionMatch.js'
6
8
 
@@ -29,7 +31,7 @@ export interface SuggestionOptions<I = any, TSelected = any> {
29
31
  * Allow spaces in the suggestion query. Not compatible with `allowToIncludeChar`. Will be disabled if `allowToIncludeChar` is set to `true`.
30
32
  * @default false
31
33
  * @example true
32
- */
34
+ */
33
35
  allowSpaces?: boolean
34
36
 
35
37
  /**
@@ -92,12 +94,12 @@ export interface SuggestionOptions<I = any, TSelected = any> {
92
94
  * @returns An object with render functions.
93
95
  */
94
96
  render?: () => {
95
- onBeforeStart?: (props: SuggestionProps<I, TSelected>) => void;
96
- onStart?: (props: SuggestionProps<I, TSelected>) => void;
97
- onBeforeUpdate?: (props: SuggestionProps<I, TSelected>) => void;
98
- onUpdate?: (props: SuggestionProps<I, TSelected>) => void;
99
- onExit?: (props: SuggestionProps<I, TSelected>) => void;
100
- onKeyDown?: (props: SuggestionKeyDownProps) => boolean;
97
+ onBeforeStart?: (props: SuggestionProps<I, TSelected>) => void
98
+ onStart?: (props: SuggestionProps<I, TSelected>) => void
99
+ onBeforeUpdate?: (props: SuggestionProps<I, TSelected>) => void
100
+ onUpdate?: (props: SuggestionProps<I, TSelected>) => void
101
+ onExit?: (props: SuggestionProps<I, TSelected>) => void
102
+ onKeyDown?: (props: SuggestionKeyDownProps) => boolean
101
103
  }
102
104
 
103
105
  /**
@@ -105,7 +107,7 @@ export interface SuggestionOptions<I = any, TSelected = any> {
105
107
  * @param props The props object.
106
108
  * @returns {boolean}
107
109
  */
108
- allow?: (props: { editor: Editor; state: EditorState; range: Range, isActive?: boolean }) => boolean
110
+ allow?: (props: { editor: Editor; state: EditorState; range: Range; isActive?: boolean }) => boolean
109
111
  findSuggestionMatch?: typeof defaultFindSuggestionMatch
110
112
  }
111
113
 
@@ -212,9 +214,7 @@ export function Suggestion<I = any, TSelected = any>({
212
214
  }
213
215
 
214
216
  const state = handleExit && !handleStart ? prev : next
215
- const decorationNode = view.dom.querySelector(
216
- `[data-decoration-id="${state.decorationId}"]`,
217
- )
217
+ const decorationNode = view.dom.querySelector(`[data-decoration-id="${state.decorationId}"]`)
218
218
 
219
219
  props = {
220
220
  editor,
@@ -230,18 +230,16 @@ export function Suggestion<I = any, TSelected = any>({
230
230
  })
231
231
  },
232
232
  decorationNode,
233
- // virtual node for popper.js or tippy.js
233
+ // virtual node for positioning
234
234
  // this can be used for building popups without a DOM node
235
235
  clientRect: decorationNode
236
236
  ? () => {
237
- // because of `items` can be asynchrounous we’ll search for the current decoration node
237
+ // because of `items` can be asynchrounous we’ll search for the current decoration node
238
238
  const { decorationId } = this.key?.getState(editor.state) // eslint-disable-line
239
- const currentDecorationNode = view.dom.querySelector(
240
- `[data-decoration-id="${decorationId}"]`,
241
- )
239
+ const currentDecorationNode = view.dom.querySelector(`[data-decoration-id="${decorationId}"]`)
242
240
 
243
- return currentDecorationNode?.getBoundingClientRect() || null
244
- }
241
+ return currentDecorationNode?.getBoundingClientRect() || null
242
+ }
245
243
  : null,
246
244
  }
247
245
 
@@ -338,9 +336,15 @@ export function Suggestion<I = any, TSelected = any>({
338
336
  const decorationId = `id_${Math.floor(Math.random() * 0xffffffff)}`
339
337
 
340
338
  // If we found a match, update the current state to show it
341
- if (match && allow({
342
- editor, state, range: match.range, isActive: prev.active,
343
- })) {
339
+ if (
340
+ match &&
341
+ allow({
342
+ editor,
343
+ state,
344
+ range: match.range,
345
+ isActive: prev.active,
346
+ })
347
+ ) {
344
348
  next.active = true
345
349
  next.decorationId = prev.decorationId ? prev.decorationId : decorationId
346
350
  next.range = match.range
@@ -1,17 +0,0 @@
1
- import { Range } from '@tiptap/core';
2
- import { ResolvedPos } from '@tiptap/pm/model';
3
- export interface Trigger {
4
- char: string;
5
- allowSpaces: boolean;
6
- allowToIncludeChar: boolean;
7
- allowedPrefixes: string[] | null;
8
- startOfLine: boolean;
9
- $position: ResolvedPos;
10
- }
11
- export type SuggestionMatch = {
12
- range: Range;
13
- query: string;
14
- text: string;
15
- } | null;
16
- export declare function findSuggestionMatch(config: Trigger): SuggestionMatch;
17
- //# sourceMappingURL=findSuggestionMatch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"findSuggestionMatch.d.ts","sourceRoot":"","sources":["../src/findSuggestionMatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,OAAO,CAAA;IACpB,kBAAkB,EAAE,OAAO,CAAA;IAC3B,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAChC,WAAW,EAAE,OAAO,CAAA;IACpB,SAAS,EAAE,WAAW,CAAA;CACvB;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,KAAK,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,IAAI,CAAA;AAER,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,eAAe,CA6DpE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,cAAc,0BAA0B,CAAA;AACxC,cAAc,iBAAiB,CAAA;AAE/B,eAAe,UAAU,CAAA"}
package/dist/index.umd.js DELETED
@@ -1,249 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/pm/state'), require('@tiptap/pm/view'), require('@tiptap/core')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@tiptap/pm/state', '@tiptap/pm/view', '@tiptap/core'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/suggestion"] = {}, global.state, global.view, global.core));
5
- })(this, (function (exports, state, view, core) { 'use strict';
6
-
7
- function findSuggestionMatch(config) {
8
- var _a;
9
- const { char, allowSpaces: allowSpacesOption, allowToIncludeChar, allowedPrefixes, startOfLine, $position, } = config;
10
- const allowSpaces = allowSpacesOption && !allowToIncludeChar;
11
- const escapedChar = core.escapeForRegEx(char);
12
- const suffix = new RegExp(`\\s${escapedChar}$`);
13
- const prefix = startOfLine ? '^' : '';
14
- const finalEscapedChar = allowToIncludeChar ? '' : escapedChar;
15
- const regexp = allowSpaces
16
- ? new RegExp(`${prefix}${escapedChar}.*?(?=\\s${finalEscapedChar}|$)`, 'gm')
17
- : new RegExp(`${prefix}(?:^)?${escapedChar}[^\\s${finalEscapedChar}]*`, 'gm');
18
- const text = ((_a = $position.nodeBefore) === null || _a === void 0 ? void 0 : _a.isText) && $position.nodeBefore.text;
19
- if (!text) {
20
- return null;
21
- }
22
- const textFrom = $position.pos - text.length;
23
- const match = Array.from(text.matchAll(regexp)).pop();
24
- if (!match || match.input === undefined || match.index === undefined) {
25
- return null;
26
- }
27
- // JavaScript doesn't have lookbehinds. This hacks a check that first character
28
- // is a space or the start of the line
29
- const matchPrefix = match.input.slice(Math.max(0, match.index - 1), match.index);
30
- const matchPrefixIsAllowed = new RegExp(`^[${allowedPrefixes === null || allowedPrefixes === void 0 ? void 0 : allowedPrefixes.join('')}\0]?$`).test(matchPrefix);
31
- if (allowedPrefixes !== null && !matchPrefixIsAllowed) {
32
- return null;
33
- }
34
- // The absolute position of the match in the document
35
- const from = textFrom + match.index;
36
- let to = from + match[0].length;
37
- // Edge case handling; if spaces are allowed and we're directly in between
38
- // two triggers
39
- if (allowSpaces && suffix.test(text.slice(to - 1, to + 1))) {
40
- match[0] += ' ';
41
- to += 1;
42
- }
43
- // If the $position is located within the matched substring, return that range
44
- if (from < $position.pos && to >= $position.pos) {
45
- return {
46
- range: {
47
- from,
48
- to,
49
- },
50
- query: match[0].slice(char.length),
51
- text: match[0],
52
- };
53
- }
54
- return null;
55
- }
56
-
57
- const SuggestionPluginKey = new state.PluginKey('suggestion');
58
- /**
59
- * This utility allows you to create suggestions.
60
- * @see https://tiptap.dev/api/utilities/suggestion
61
- */
62
- function Suggestion({ pluginKey = SuggestionPluginKey, editor, char = '@', allowSpaces = false, allowToIncludeChar = false, allowedPrefixes = [' '], startOfLine = false, decorationTag = 'span', decorationClass = 'suggestion', command = () => null, items = () => [], render = () => ({}), allow = () => true, findSuggestionMatch: findSuggestionMatch$1 = findSuggestionMatch, }) {
63
- let props;
64
- const renderer = render === null || render === void 0 ? void 0 : render();
65
- const plugin = new state.Plugin({
66
- key: pluginKey,
67
- view() {
68
- return {
69
- update: async (view, prevState) => {
70
- var _a, _b, _c, _d, _e, _f, _g;
71
- const prev = (_a = this.key) === null || _a === void 0 ? void 0 : _a.getState(prevState);
72
- const next = (_b = this.key) === null || _b === void 0 ? void 0 : _b.getState(view.state);
73
- // See how the state changed
74
- const moved = prev.active && next.active && prev.range.from !== next.range.from;
75
- const started = !prev.active && next.active;
76
- const stopped = prev.active && !next.active;
77
- const changed = !started && !stopped && prev.query !== next.query;
78
- const handleStart = started || (moved && changed);
79
- const handleChange = changed || moved;
80
- const handleExit = stopped || (moved && changed);
81
- // Cancel when suggestion isn't active
82
- if (!handleStart && !handleChange && !handleExit) {
83
- return;
84
- }
85
- const state = handleExit && !handleStart ? prev : next;
86
- const decorationNode = view.dom.querySelector(`[data-decoration-id="${state.decorationId}"]`);
87
- props = {
88
- editor,
89
- range: state.range,
90
- query: state.query,
91
- text: state.text,
92
- items: [],
93
- command: commandProps => {
94
- return command({
95
- editor,
96
- range: state.range,
97
- props: commandProps,
98
- });
99
- },
100
- decorationNode,
101
- // virtual node for popper.js or tippy.js
102
- // this can be used for building popups without a DOM node
103
- clientRect: decorationNode
104
- ? () => {
105
- var _a;
106
- // because of `items` can be asynchrounous we’ll search for the current decoration node
107
- const { decorationId } = (_a = this.key) === null || _a === void 0 ? void 0 : _a.getState(editor.state); // eslint-disable-line
108
- const currentDecorationNode = view.dom.querySelector(`[data-decoration-id="${decorationId}"]`);
109
- return (currentDecorationNode === null || currentDecorationNode === void 0 ? void 0 : currentDecorationNode.getBoundingClientRect()) || null;
110
- }
111
- : null,
112
- };
113
- if (handleStart) {
114
- (_c = renderer === null || renderer === void 0 ? void 0 : renderer.onBeforeStart) === null || _c === void 0 ? void 0 : _c.call(renderer, props);
115
- }
116
- if (handleChange) {
117
- (_d = renderer === null || renderer === void 0 ? void 0 : renderer.onBeforeUpdate) === null || _d === void 0 ? void 0 : _d.call(renderer, props);
118
- }
119
- if (handleChange || handleStart) {
120
- props.items = await items({
121
- editor,
122
- query: state.query,
123
- });
124
- }
125
- if (handleExit) {
126
- (_e = renderer === null || renderer === void 0 ? void 0 : renderer.onExit) === null || _e === void 0 ? void 0 : _e.call(renderer, props);
127
- }
128
- if (handleChange) {
129
- (_f = renderer === null || renderer === void 0 ? void 0 : renderer.onUpdate) === null || _f === void 0 ? void 0 : _f.call(renderer, props);
130
- }
131
- if (handleStart) {
132
- (_g = renderer === null || renderer === void 0 ? void 0 : renderer.onStart) === null || _g === void 0 ? void 0 : _g.call(renderer, props);
133
- }
134
- },
135
- destroy: () => {
136
- var _a;
137
- if (!props) {
138
- return;
139
- }
140
- (_a = renderer === null || renderer === void 0 ? void 0 : renderer.onExit) === null || _a === void 0 ? void 0 : _a.call(renderer, props);
141
- },
142
- };
143
- },
144
- state: {
145
- // Initialize the plugin's internal state.
146
- init() {
147
- const state = {
148
- active: false,
149
- range: {
150
- from: 0,
151
- to: 0,
152
- },
153
- query: null,
154
- text: null,
155
- composing: false,
156
- };
157
- return state;
158
- },
159
- // Apply changes to the plugin state from a view transaction.
160
- apply(transaction, prev, _oldState, state) {
161
- const { isEditable } = editor;
162
- const { composing } = editor.view;
163
- const { selection } = transaction;
164
- const { empty, from } = selection;
165
- const next = { ...prev };
166
- next.composing = composing;
167
- // We can only be suggesting if the view is editable, and:
168
- // * there is no selection, or
169
- // * a composition is active (see: https://github.com/ueberdosis/tiptap/issues/1449)
170
- if (isEditable && (empty || editor.view.composing)) {
171
- // Reset active state if we just left the previous suggestion range
172
- if ((from < prev.range.from || from > prev.range.to) && !composing && !prev.composing) {
173
- next.active = false;
174
- }
175
- // Try to match against where our cursor currently is
176
- const match = findSuggestionMatch$1({
177
- char,
178
- allowSpaces,
179
- allowToIncludeChar,
180
- allowedPrefixes,
181
- startOfLine,
182
- $position: selection.$from,
183
- });
184
- const decorationId = `id_${Math.floor(Math.random() * 0xffffffff)}`;
185
- // If we found a match, update the current state to show it
186
- if (match && allow({
187
- editor, state, range: match.range, isActive: prev.active,
188
- })) {
189
- next.active = true;
190
- next.decorationId = prev.decorationId ? prev.decorationId : decorationId;
191
- next.range = match.range;
192
- next.query = match.query;
193
- next.text = match.text;
194
- }
195
- else {
196
- next.active = false;
197
- }
198
- }
199
- else {
200
- next.active = false;
201
- }
202
- // Make sure to empty the range if suggestion is inactive
203
- if (!next.active) {
204
- next.decorationId = null;
205
- next.range = { from: 0, to: 0 };
206
- next.query = null;
207
- next.text = null;
208
- }
209
- return next;
210
- },
211
- },
212
- props: {
213
- // Call the keydown hook if suggestion is active.
214
- handleKeyDown(view, event) {
215
- var _a;
216
- const { active, range } = plugin.getState(view.state);
217
- if (!active) {
218
- return false;
219
- }
220
- return ((_a = renderer === null || renderer === void 0 ? void 0 : renderer.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(renderer, { view, event, range })) || false;
221
- },
222
- // Setup decorator on the currently active suggestion.
223
- decorations(state) {
224
- const { active, range, decorationId } = plugin.getState(state);
225
- if (!active) {
226
- return null;
227
- }
228
- return view.DecorationSet.create(state.doc, [
229
- view.Decoration.inline(range.from, range.to, {
230
- nodeName: decorationTag,
231
- class: decorationClass,
232
- 'data-decoration-id': decorationId,
233
- }),
234
- ]);
235
- },
236
- },
237
- });
238
- return plugin;
239
- }
240
-
241
- exports.Suggestion = Suggestion;
242
- exports.SuggestionPluginKey = SuggestionPluginKey;
243
- exports.default = Suggestion;
244
- exports.findSuggestionMatch = findSuggestionMatch;
245
-
246
- Object.defineProperty(exports, '__esModule', { value: true });
247
-
248
- }));
249
- //# sourceMappingURL=index.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/findSuggestionMatch.ts","../src/suggestion.ts"],"sourcesContent":["import { escapeForRegEx, Range } from '@tiptap/core'\nimport { ResolvedPos } from '@tiptap/pm/model'\n\nexport interface Trigger {\n char: string\n allowSpaces: boolean\n allowToIncludeChar: boolean\n allowedPrefixes: string[] | null\n startOfLine: boolean\n $position: ResolvedPos\n}\n\nexport type SuggestionMatch = {\n range: Range\n query: string\n text: string\n} | null\n\nexport function findSuggestionMatch(config: Trigger): SuggestionMatch {\n const {\n char, allowSpaces: allowSpacesOption, allowToIncludeChar, allowedPrefixes, startOfLine, $position,\n } = config\n\n const allowSpaces = allowSpacesOption && !allowToIncludeChar\n\n const escapedChar = escapeForRegEx(char)\n const suffix = new RegExp(`\\\\s${escapedChar}$`)\n const prefix = startOfLine ? '^' : ''\n const finalEscapedChar = allowToIncludeChar ? '' : escapedChar\n const regexp = allowSpaces\n ? new RegExp(`${prefix}${escapedChar}.*?(?=\\\\s${finalEscapedChar}|$)`, 'gm')\n : new RegExp(`${prefix}(?:^)?${escapedChar}[^\\\\s${finalEscapedChar}]*`, 'gm')\n\n const text = $position.nodeBefore?.isText && $position.nodeBefore.text\n\n if (!text) {\n return null\n }\n\n const textFrom = $position.pos - text.length\n const match = Array.from(text.matchAll(regexp)).pop()\n\n if (!match || match.input === undefined || match.index === undefined) {\n return null\n }\n\n // JavaScript doesn't have lookbehinds. This hacks a check that first character\n // is a space or the start of the line\n const matchPrefix = match.input.slice(Math.max(0, match.index - 1), match.index)\n const matchPrefixIsAllowed = new RegExp(`^[${allowedPrefixes?.join('')}\\0]?$`).test(matchPrefix)\n\n if (allowedPrefixes !== null && !matchPrefixIsAllowed) {\n return null\n }\n\n // The absolute position of the match in the document\n const from = textFrom + match.index\n let to = from + match[0].length\n\n // Edge case handling; if spaces are allowed and we're directly in between\n // two triggers\n if (allowSpaces && suffix.test(text.slice(to - 1, to + 1))) {\n match[0] += ' '\n to += 1\n }\n\n // If the $position is located within the matched substring, return that range\n if (from < $position.pos && to >= $position.pos) {\n return {\n range: {\n from,\n to,\n },\n query: match[0].slice(char.length),\n text: match[0],\n }\n }\n\n return null\n}\n","import { Editor, Range } from '@tiptap/core'\nimport { EditorState, Plugin, PluginKey } from '@tiptap/pm/state'\nimport { Decoration, DecorationSet, EditorView } from '@tiptap/pm/view'\n\nimport { findSuggestionMatch as defaultFindSuggestionMatch } from './findSuggestionMatch.js'\n\nexport interface SuggestionOptions<I = any, TSelected = any> {\n /**\n * The plugin key for the suggestion plugin.\n * @default 'suggestion'\n * @example 'mention'\n */\n pluginKey?: PluginKey\n\n /**\n * The editor instance.\n * @default null\n */\n editor: Editor\n\n /**\n * The character that triggers the suggestion.\n * @default '@'\n * @example '#'\n */\n char?: string\n\n /**\n * Allow spaces in the suggestion query. Not compatible with `allowToIncludeChar`. Will be disabled if `allowToIncludeChar` is set to `true`.\n * @default false\n * @example true\n */\n allowSpaces?: boolean\n\n /**\n * Allow the character to be included in the suggestion query. Not compatible with `allowSpaces`.\n * @default false\n */\n allowToIncludeChar?: boolean\n\n /**\n * Allow prefixes in the suggestion query.\n * @default [' ']\n * @example [' ', '@']\n */\n allowedPrefixes?: string[] | null\n\n /**\n * Only match suggestions at the start of the line.\n * @default false\n * @example true\n */\n startOfLine?: boolean\n\n /**\n * The tag name of the decoration node.\n * @default 'span'\n * @example 'div'\n */\n decorationTag?: string\n\n /**\n * The class name of the decoration node.\n * @default 'suggestion'\n * @example 'mention'\n */\n decorationClass?: string\n\n /**\n * A function that is called when a suggestion is selected.\n * @param props The props object.\n * @param props.editor The editor instance.\n * @param props.range The range of the suggestion.\n * @param props.props The props of the selected suggestion.\n * @returns void\n * @example ({ editor, range, props }) => { props.command(props.props) }\n */\n command?: (props: { editor: Editor; range: Range; props: TSelected }) => void\n\n /**\n * A function that returns the suggestion items in form of an array.\n * @param props The props object.\n * @param props.editor The editor instance.\n * @param props.query The current suggestion query.\n * @returns An array of suggestion items.\n * @example ({ editor, query }) => [{ id: 1, label: 'John Doe' }]\n */\n items?: (props: { query: string; editor: Editor }) => I[] | Promise<I[]>\n\n /**\n * The render function for the suggestion.\n * @returns An object with render functions.\n */\n render?: () => {\n onBeforeStart?: (props: SuggestionProps<I, TSelected>) => void;\n onStart?: (props: SuggestionProps<I, TSelected>) => void;\n onBeforeUpdate?: (props: SuggestionProps<I, TSelected>) => void;\n onUpdate?: (props: SuggestionProps<I, TSelected>) => void;\n onExit?: (props: SuggestionProps<I, TSelected>) => void;\n onKeyDown?: (props: SuggestionKeyDownProps) => boolean;\n }\n\n /**\n * A function that returns a boolean to indicate if the suggestion should be active.\n * @param props The props object.\n * @returns {boolean}\n */\n allow?: (props: { editor: Editor; state: EditorState; range: Range, isActive?: boolean }) => boolean\n findSuggestionMatch?: typeof defaultFindSuggestionMatch\n}\n\nexport interface SuggestionProps<I = any, TSelected = any> {\n /**\n * The editor instance.\n */\n editor: Editor\n\n /**\n * The range of the suggestion.\n */\n range: Range\n\n /**\n * The current suggestion query.\n */\n query: string\n\n /**\n * The current suggestion text.\n */\n text: string\n\n /**\n * The suggestion items array.\n */\n items: I[]\n\n /**\n * A function that is called when a suggestion is selected.\n * @param props The props object.\n * @returns void\n */\n command: (props: TSelected) => void\n\n /**\n * The decoration node HTML element\n * @default null\n */\n decorationNode: Element | null\n\n /**\n * The function that returns the client rect\n * @default null\n * @example () => new DOMRect(0, 0, 0, 0)\n */\n clientRect?: (() => DOMRect | null) | null\n}\n\nexport interface SuggestionKeyDownProps {\n view: EditorView\n event: KeyboardEvent\n range: Range\n}\n\nexport const SuggestionPluginKey = new PluginKey('suggestion')\n\n/**\n * This utility allows you to create suggestions.\n * @see https://tiptap.dev/api/utilities/suggestion\n */\nexport function Suggestion<I = any, TSelected = any>({\n pluginKey = SuggestionPluginKey,\n editor,\n char = '@',\n allowSpaces = false,\n allowToIncludeChar = false,\n allowedPrefixes = [' '],\n startOfLine = false,\n decorationTag = 'span',\n decorationClass = 'suggestion',\n command = () => null,\n items = () => [],\n render = () => ({}),\n allow = () => true,\n findSuggestionMatch = defaultFindSuggestionMatch,\n}: SuggestionOptions<I, TSelected>) {\n let props: SuggestionProps<I, TSelected> | undefined\n const renderer = render?.()\n\n const plugin: Plugin<any> = new Plugin({\n key: pluginKey,\n\n view() {\n return {\n update: async (view, prevState) => {\n const prev = this.key?.getState(prevState)\n const next = this.key?.getState(view.state)\n\n // See how the state changed\n const moved = prev.active && next.active && prev.range.from !== next.range.from\n const started = !prev.active && next.active\n const stopped = prev.active && !next.active\n const changed = !started && !stopped && prev.query !== next.query\n\n const handleStart = started || (moved && changed)\n const handleChange = changed || moved\n const handleExit = stopped || (moved && changed)\n\n // Cancel when suggestion isn't active\n if (!handleStart && !handleChange && !handleExit) {\n return\n }\n\n const state = handleExit && !handleStart ? prev : next\n const decorationNode = view.dom.querySelector(\n `[data-decoration-id=\"${state.decorationId}\"]`,\n )\n\n props = {\n editor,\n range: state.range,\n query: state.query,\n text: state.text,\n items: [],\n command: commandProps => {\n return command({\n editor,\n range: state.range,\n props: commandProps,\n })\n },\n decorationNode,\n // virtual node for popper.js or tippy.js\n // this can be used for building popups without a DOM node\n clientRect: decorationNode\n ? () => {\n // because of `items` can be asynchrounous we’ll search for the current decoration node\n const { decorationId } = this.key?.getState(editor.state) // eslint-disable-line\n const currentDecorationNode = view.dom.querySelector(\n `[data-decoration-id=\"${decorationId}\"]`,\n )\n\n return currentDecorationNode?.getBoundingClientRect() || null\n }\n : null,\n }\n\n if (handleStart) {\n renderer?.onBeforeStart?.(props)\n }\n\n if (handleChange) {\n renderer?.onBeforeUpdate?.(props)\n }\n\n if (handleChange || handleStart) {\n props.items = await items({\n editor,\n query: state.query,\n })\n }\n\n if (handleExit) {\n renderer?.onExit?.(props)\n }\n\n if (handleChange) {\n renderer?.onUpdate?.(props)\n }\n\n if (handleStart) {\n renderer?.onStart?.(props)\n }\n },\n\n destroy: () => {\n if (!props) {\n return\n }\n\n renderer?.onExit?.(props)\n },\n }\n },\n\n state: {\n // Initialize the plugin's internal state.\n init() {\n const state: {\n active: boolean\n range: Range\n query: null | string\n text: null | string\n composing: boolean\n decorationId?: string | null\n } = {\n active: false,\n range: {\n from: 0,\n to: 0,\n },\n query: null,\n text: null,\n composing: false,\n }\n\n return state\n },\n\n // Apply changes to the plugin state from a view transaction.\n apply(transaction, prev, _oldState, state) {\n const { isEditable } = editor\n const { composing } = editor.view\n const { selection } = transaction\n const { empty, from } = selection\n const next = { ...prev }\n\n next.composing = composing\n\n // We can only be suggesting if the view is editable, and:\n // * there is no selection, or\n // * a composition is active (see: https://github.com/ueberdosis/tiptap/issues/1449)\n if (isEditable && (empty || editor.view.composing)) {\n // Reset active state if we just left the previous suggestion range\n if ((from < prev.range.from || from > prev.range.to) && !composing && !prev.composing) {\n next.active = false\n }\n\n // Try to match against where our cursor currently is\n const match = findSuggestionMatch({\n char,\n allowSpaces,\n allowToIncludeChar,\n allowedPrefixes,\n startOfLine,\n $position: selection.$from,\n })\n const decorationId = `id_${Math.floor(Math.random() * 0xffffffff)}`\n\n // If we found a match, update the current state to show it\n if (match && allow({\n editor, state, range: match.range, isActive: prev.active,\n })) {\n next.active = true\n next.decorationId = prev.decorationId ? prev.decorationId : decorationId\n next.range = match.range\n next.query = match.query\n next.text = match.text\n } else {\n next.active = false\n }\n } else {\n next.active = false\n }\n\n // Make sure to empty the range if suggestion is inactive\n if (!next.active) {\n next.decorationId = null\n next.range = { from: 0, to: 0 }\n next.query = null\n next.text = null\n }\n\n return next\n },\n },\n\n props: {\n // Call the keydown hook if suggestion is active.\n handleKeyDown(view, event) {\n const { active, range } = plugin.getState(view.state)\n\n if (!active) {\n return false\n }\n\n return renderer?.onKeyDown?.({ view, event, range }) || false\n },\n\n // Setup decorator on the currently active suggestion.\n decorations(state) {\n const { active, range, decorationId } = plugin.getState(state)\n\n if (!active) {\n return null\n }\n\n return DecorationSet.create(state.doc, [\n Decoration.inline(range.from, range.to, {\n nodeName: decorationTag,\n class: decorationClass,\n 'data-decoration-id': decorationId,\n }),\n ])\n },\n },\n })\n\n return plugin\n}\n"],"names":["escapeForRegEx","PluginKey","findSuggestionMatch","defaultFindSuggestionMatch","Plugin","DecorationSet","Decoration"],"mappings":";;;;;;EAkBM,SAAU,mBAAmB,CAAC,MAAe,EAAA;;EACjD,IAAA,MAAM,EACJ,IAAI,EAAE,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,GAClG,GAAG,MAAM;EAEV,IAAA,MAAM,WAAW,GAAG,iBAAiB,IAAI,CAAC,kBAAkB;EAE5D,IAAA,MAAM,WAAW,GAAGA,mBAAc,CAAC,IAAI,CAAC;MACxC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,CAAM,GAAA,EAAA,WAAW,CAAG,CAAA,CAAA,CAAC;MAC/C,MAAM,MAAM,GAAG,WAAW,GAAG,GAAG,GAAG,EAAE;MACrC,MAAM,gBAAgB,GAAG,kBAAkB,GAAG,EAAE,GAAG,WAAW;MAC9D,MAAM,MAAM,GAAG;EACb,UAAE,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