@tiptap/suggestion 2.0.0-beta.21 → 2.0.0-beta.211
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/README.md +6 -6
- package/dist/index.cjs +235 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +235 -0
- package/package.json +38 -12
- package/src/findSuggestionMatch.ts +24 -27
- package/src/suggestion.ts +118 -59
- package/CHANGELOG.md +0 -264
- package/LICENSE.md +0 -21
- package/dist/packages/suggestion/src/findSuggestionMatch.d.ts +0 -14
- package/dist/packages/suggestion/src/index.d.ts +0 -4
- package/dist/packages/suggestion/src/suggestion.d.ts +0 -43
- package/dist/tiptap-suggestion.bundle.umd.min.js +0 -2
- package/dist/tiptap-suggestion.bundle.umd.min.js.map +0 -1
- package/dist/tiptap-suggestion.cjs.js +0 -197
- package/dist/tiptap-suggestion.cjs.js.map +0 -1
- package/dist/tiptap-suggestion.esm.js +0 -192
- package/dist/tiptap-suggestion.esm.js.map +0 -1
- package/dist/tiptap-suggestion.umd.js +0 -200
- package/dist/tiptap-suggestion.umd.js.map +0 -1
|
@@ -1,59 +1,56 @@
|
|
|
1
|
-
import { Range } from '@tiptap/core'
|
|
2
|
-
import { ResolvedPos } from '
|
|
1
|
+
import { escapeForRegEx, Range } from '@tiptap/core'
|
|
2
|
+
import { ResolvedPos } from '@tiptap/pm/model'
|
|
3
3
|
|
|
4
4
|
export interface Trigger {
|
|
5
|
-
char: string
|
|
6
|
-
allowSpaces: boolean
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
char: string
|
|
6
|
+
allowSpaces: boolean
|
|
7
|
+
allowedPrefixes: string[] | null
|
|
8
|
+
startOfLine: boolean
|
|
9
|
+
$position: ResolvedPos
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export type SuggestionMatch = {
|
|
12
|
-
range: Range
|
|
13
|
-
query: string
|
|
14
|
-
text: string
|
|
13
|
+
range: Range
|
|
14
|
+
query: string
|
|
15
|
+
text: string
|
|
15
16
|
} | null
|
|
16
17
|
|
|
17
18
|
export function findSuggestionMatch(config: Trigger): SuggestionMatch {
|
|
18
19
|
const {
|
|
19
|
-
char,
|
|
20
|
-
allowSpaces,
|
|
21
|
-
startOfLine,
|
|
22
|
-
$position,
|
|
20
|
+
char, allowSpaces, allowedPrefixes, startOfLine, $position,
|
|
23
21
|
} = config
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
if ($position.depth <= 0) {
|
|
27
|
-
return null
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Matching expressions used for later
|
|
31
|
-
const escapedChar = `\\${char}`
|
|
23
|
+
const escapedChar = escapeForRegEx(char)
|
|
32
24
|
const suffix = new RegExp(`\\s${escapedChar}$`)
|
|
33
25
|
const prefix = startOfLine ? '^' : ''
|
|
34
26
|
const regexp = allowSpaces
|
|
35
27
|
? new RegExp(`${prefix}${escapedChar}.*?(?=\\s${escapedChar}|$)`, 'gm')
|
|
36
28
|
: new RegExp(`${prefix}(?:^)?${escapedChar}[^\\s${escapedChar}]*`, 'gm')
|
|
37
29
|
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
const text = $position.nodeBefore?.isText && $position.nodeBefore.text
|
|
31
|
+
|
|
32
|
+
if (!text) {
|
|
33
|
+
return null
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const textFrom = $position.pos - text.length
|
|
41
37
|
const match = Array.from(text.matchAll(regexp)).pop()
|
|
42
38
|
|
|
43
39
|
if (!match || match.input === undefined || match.index === undefined) {
|
|
44
40
|
return null
|
|
45
41
|
}
|
|
46
42
|
|
|
47
|
-
// JavaScript doesn't have lookbehinds
|
|
48
|
-
// or the line
|
|
43
|
+
// JavaScript doesn't have lookbehinds. This hacks a check that first character
|
|
44
|
+
// is a space or the start of the line
|
|
49
45
|
const matchPrefix = match.input.slice(Math.max(0, match.index - 1), match.index)
|
|
46
|
+
const matchPrefixIsAllowed = new RegExp(`^[${allowedPrefixes?.join('')}\0]?$`).test(matchPrefix)
|
|
50
47
|
|
|
51
|
-
if (
|
|
48
|
+
if (allowedPrefixes !== null && !matchPrefixIsAllowed) {
|
|
52
49
|
return null
|
|
53
50
|
}
|
|
54
51
|
|
|
55
52
|
// The absolute position of the match in the document
|
|
56
|
-
const from =
|
|
53
|
+
const from = textFrom + match.index
|
|
57
54
|
let to = from + match[0].length
|
|
58
55
|
|
|
59
56
|
// Edge case handling; if spaces are allowed and we're directly in between
|
package/src/suggestion.ts
CHANGED
|
@@ -1,54 +1,56 @@
|
|
|
1
1
|
import { Editor, Range } from '@tiptap/core'
|
|
2
|
-
import { Plugin, PluginKey } from '
|
|
3
|
-
import { Decoration, DecorationSet, EditorView } from '
|
|
2
|
+
import { EditorState, Plugin, PluginKey } from '@tiptap/pm/state'
|
|
3
|
+
import { Decoration, DecorationSet, EditorView } from '@tiptap/pm/view'
|
|
4
|
+
|
|
4
5
|
import { findSuggestionMatch } from './findSuggestionMatch'
|
|
5
6
|
|
|
6
|
-
export interface SuggestionOptions {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}) => void,
|
|
18
|
-
items?: (query: string) => any[],
|
|
7
|
+
export interface SuggestionOptions<I = any> {
|
|
8
|
+
pluginKey?: PluginKey
|
|
9
|
+
editor: Editor
|
|
10
|
+
char?: string
|
|
11
|
+
allowSpaces?: boolean
|
|
12
|
+
allowedPrefixes?: string[] | null
|
|
13
|
+
startOfLine?: boolean
|
|
14
|
+
decorationTag?: string
|
|
15
|
+
decorationClass?: string
|
|
16
|
+
command?: (props: { editor: Editor; range: Range; props: I }) => void
|
|
17
|
+
items?: (props: { query: string; editor: Editor }) => I[] | Promise<I[]>
|
|
19
18
|
render?: () => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}) => boolean,
|
|
19
|
+
onBeforeStart?: (props: SuggestionProps<I>) => void
|
|
20
|
+
onStart?: (props: SuggestionProps<I>) => void
|
|
21
|
+
onBeforeUpdate?: (props: SuggestionProps<I>) => void
|
|
22
|
+
onUpdate?: (props: SuggestionProps<I>) => void
|
|
23
|
+
onExit?: (props: SuggestionProps<I>) => void
|
|
24
|
+
onKeyDown?: (props: SuggestionKeyDownProps) => boolean
|
|
25
|
+
}
|
|
26
|
+
allow?: (props: { editor: Editor; state: EditorState; range: Range }) => boolean
|
|
29
27
|
}
|
|
30
28
|
|
|
31
|
-
export interface SuggestionProps {
|
|
32
|
-
editor: Editor
|
|
33
|
-
range: Range
|
|
34
|
-
query: string
|
|
35
|
-
text: string
|
|
36
|
-
items:
|
|
37
|
-
command: (props:
|
|
38
|
-
decorationNode: Element | null
|
|
39
|
-
clientRect
|
|
29
|
+
export interface SuggestionProps<I = any> {
|
|
30
|
+
editor: Editor
|
|
31
|
+
range: Range
|
|
32
|
+
query: string
|
|
33
|
+
text: string
|
|
34
|
+
items: I[]
|
|
35
|
+
command: (props: I) => void
|
|
36
|
+
decorationNode: Element | null
|
|
37
|
+
clientRect?: (() => DOMRect | null) | null
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
export interface SuggestionKeyDownProps {
|
|
43
|
-
view: EditorView
|
|
44
|
-
event: KeyboardEvent
|
|
45
|
-
range: Range
|
|
41
|
+
view: EditorView
|
|
42
|
+
event: KeyboardEvent
|
|
43
|
+
range: Range
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
export
|
|
46
|
+
export const SuggestionPluginKey = new PluginKey('suggestion')
|
|
47
|
+
|
|
48
|
+
export function Suggestion<I = any>({
|
|
49
|
+
pluginKey = SuggestionPluginKey,
|
|
49
50
|
editor,
|
|
50
51
|
char = '@',
|
|
51
52
|
allowSpaces = false,
|
|
53
|
+
allowedPrefixes = [' '],
|
|
52
54
|
startOfLine = false,
|
|
53
55
|
decorationTag = 'span',
|
|
54
56
|
decorationClass = 'suggestion',
|
|
@@ -56,12 +58,12 @@ export function Suggestion({
|
|
|
56
58
|
items = () => [],
|
|
57
59
|
render = () => ({}),
|
|
58
60
|
allow = () => true,
|
|
59
|
-
}: SuggestionOptions) {
|
|
60
|
-
|
|
61
|
+
}: SuggestionOptions<I>) {
|
|
62
|
+
let props: SuggestionProps<I> | undefined
|
|
61
63
|
const renderer = render?.()
|
|
62
64
|
|
|
63
|
-
|
|
64
|
-
key:
|
|
65
|
+
const plugin: Plugin<any> = new Plugin({
|
|
66
|
+
key: pluginKey,
|
|
65
67
|
|
|
66
68
|
view() {
|
|
67
69
|
return {
|
|
@@ -83,16 +85,17 @@ export function Suggestion({
|
|
|
83
85
|
return
|
|
84
86
|
}
|
|
85
87
|
|
|
86
|
-
const state = handleExit ? prev : next
|
|
87
|
-
const decorationNode =
|
|
88
|
-
|
|
88
|
+
const state = handleExit && !handleStart ? prev : next
|
|
89
|
+
const decorationNode = view.dom.querySelector(
|
|
90
|
+
`[data-decoration-id="${state.decorationId}"]`,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
props = {
|
|
89
94
|
editor,
|
|
90
95
|
range: state.range,
|
|
91
96
|
query: state.query,
|
|
92
97
|
text: state.text,
|
|
93
|
-
items:
|
|
94
|
-
? await items(state.query)
|
|
95
|
-
: [],
|
|
98
|
+
items: [],
|
|
96
99
|
command: commandProps => {
|
|
97
100
|
command({
|
|
98
101
|
editor,
|
|
@@ -103,7 +106,32 @@ export function Suggestion({
|
|
|
103
106
|
decorationNode,
|
|
104
107
|
// virtual node for popper.js or tippy.js
|
|
105
108
|
// this can be used for building popups without a DOM node
|
|
106
|
-
clientRect:
|
|
109
|
+
clientRect: decorationNode
|
|
110
|
+
? () => {
|
|
111
|
+
// because of `items` can be asynchrounous we’ll search for the current decoration node
|
|
112
|
+
const { decorationId } = this.key?.getState(editor.state) // eslint-disable-line
|
|
113
|
+
const currentDecorationNode = view.dom.querySelector(
|
|
114
|
+
`[data-decoration-id="${decorationId}"]`,
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
return currentDecorationNode?.getBoundingClientRect() || null
|
|
118
|
+
}
|
|
119
|
+
: null,
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (handleStart) {
|
|
123
|
+
renderer?.onBeforeStart?.(props)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (handleChange) {
|
|
127
|
+
renderer?.onBeforeUpdate?.(props)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (handleChange || handleStart) {
|
|
131
|
+
props.items = await items({
|
|
132
|
+
editor,
|
|
133
|
+
query: state.query,
|
|
134
|
+
})
|
|
107
135
|
}
|
|
108
136
|
|
|
109
137
|
if (handleExit) {
|
|
@@ -118,29 +146,57 @@ export function Suggestion({
|
|
|
118
146
|
renderer?.onStart?.(props)
|
|
119
147
|
}
|
|
120
148
|
},
|
|
149
|
+
|
|
150
|
+
destroy: () => {
|
|
151
|
+
if (!props) {
|
|
152
|
+
return
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
renderer?.onExit?.(props)
|
|
156
|
+
},
|
|
121
157
|
}
|
|
122
158
|
},
|
|
123
159
|
|
|
124
160
|
state: {
|
|
125
161
|
// Initialize the plugin's internal state.
|
|
126
162
|
init() {
|
|
127
|
-
|
|
163
|
+
const state: {
|
|
164
|
+
active: boolean
|
|
165
|
+
range: Range
|
|
166
|
+
query: null | string
|
|
167
|
+
text: null | string
|
|
168
|
+
composing: boolean
|
|
169
|
+
decorationId?: string | null
|
|
170
|
+
} = {
|
|
128
171
|
active: false,
|
|
129
|
-
range: {
|
|
172
|
+
range: {
|
|
173
|
+
from: 0,
|
|
174
|
+
to: 0,
|
|
175
|
+
},
|
|
130
176
|
query: null,
|
|
131
177
|
text: null,
|
|
178
|
+
composing: false,
|
|
132
179
|
}
|
|
180
|
+
|
|
181
|
+
return state
|
|
133
182
|
},
|
|
134
183
|
|
|
135
184
|
// Apply changes to the plugin state from a view transaction.
|
|
136
|
-
apply(transaction, prev) {
|
|
185
|
+
apply(transaction, prev, oldState, state) {
|
|
186
|
+
const { isEditable } = editor
|
|
187
|
+
const { composing } = editor.view
|
|
137
188
|
const { selection } = transaction
|
|
189
|
+
const { empty, from } = selection
|
|
138
190
|
const next = { ...prev }
|
|
139
191
|
|
|
140
|
-
|
|
141
|
-
|
|
192
|
+
next.composing = composing
|
|
193
|
+
|
|
194
|
+
// We can only be suggesting if the view is editable, and:
|
|
195
|
+
// * there is no selection, or
|
|
196
|
+
// * a composition is active (see: https://github.com/ueberdosis/tiptap/issues/1449)
|
|
197
|
+
if (isEditable && (empty || editor.view.composing)) {
|
|
142
198
|
// Reset active state if we just left the previous suggestion range
|
|
143
|
-
if (
|
|
199
|
+
if ((from < prev.range.from || from > prev.range.to) && !composing && !prev.composing) {
|
|
144
200
|
next.active = false
|
|
145
201
|
}
|
|
146
202
|
|
|
@@ -148,13 +204,14 @@ export function Suggestion({
|
|
|
148
204
|
const match = findSuggestionMatch({
|
|
149
205
|
char,
|
|
150
206
|
allowSpaces,
|
|
207
|
+
allowedPrefixes,
|
|
151
208
|
startOfLine,
|
|
152
209
|
$position: selection.$from,
|
|
153
210
|
})
|
|
154
|
-
const decorationId = `id_${Math.floor(Math.random() *
|
|
211
|
+
const decorationId = `id_${Math.floor(Math.random() * 0xffffffff)}`
|
|
155
212
|
|
|
156
213
|
// If we found a match, update the current state to show it
|
|
157
|
-
if (match && allow({ editor, range: match.range })) {
|
|
214
|
+
if (match && allow({ editor, state, range: match.range })) {
|
|
158
215
|
next.active = true
|
|
159
216
|
next.decorationId = prev.decorationId ? prev.decorationId : decorationId
|
|
160
217
|
next.range = match.range
|
|
@@ -170,7 +227,7 @@ export function Suggestion({
|
|
|
170
227
|
// Make sure to empty the range if suggestion is inactive
|
|
171
228
|
if (!next.active) {
|
|
172
229
|
next.decorationId = null
|
|
173
|
-
next.range = {}
|
|
230
|
+
next.range = { from: 0, to: 0 }
|
|
174
231
|
next.query = null
|
|
175
232
|
next.text = null
|
|
176
233
|
}
|
|
@@ -182,7 +239,7 @@ export function Suggestion({
|
|
|
182
239
|
props: {
|
|
183
240
|
// Call the keydown hook if suggestion is active.
|
|
184
241
|
handleKeyDown(view, event) {
|
|
185
|
-
const { active, range } =
|
|
242
|
+
const { active, range } = plugin.getState(view.state)
|
|
186
243
|
|
|
187
244
|
if (!active) {
|
|
188
245
|
return false
|
|
@@ -193,7 +250,7 @@ export function Suggestion({
|
|
|
193
250
|
|
|
194
251
|
// Setup decorator on the currently active suggestion.
|
|
195
252
|
decorations(state) {
|
|
196
|
-
const { active, range, decorationId } =
|
|
253
|
+
const { active, range, decorationId } = plugin.getState(state)
|
|
197
254
|
|
|
198
255
|
if (!active) {
|
|
199
256
|
return null
|
|
@@ -209,4 +266,6 @@ export function Suggestion({
|
|
|
209
266
|
},
|
|
210
267
|
},
|
|
211
268
|
})
|
|
269
|
+
|
|
270
|
+
return plugin
|
|
212
271
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
# [2.0.0-beta.21](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.20...@tiptap/suggestion@2.0.0-beta.21) (2021-04-08)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# [2.0.0-beta.20](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.19...@tiptap/suggestion@2.0.0-beta.20) (2021-04-07)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# [2.0.0-beta.19](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.18...@tiptap/suggestion@2.0.0-beta.19) (2021-04-07)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# [2.0.0-beta.18](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.17...@tiptap/suggestion@2.0.0-beta.18) (2021-04-07)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
# [2.0.0-beta.17](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.16...@tiptap/suggestion@2.0.0-beta.17) (2021-04-07)
|
|
39
|
-
|
|
40
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# [2.0.0-beta.16](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.15...@tiptap/suggestion@2.0.0-beta.16) (2021-04-07)
|
|
47
|
-
|
|
48
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
# [2.0.0-beta.15](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.14...@tiptap/suggestion@2.0.0-beta.15) (2021-04-06)
|
|
55
|
-
|
|
56
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
# [2.0.0-beta.14](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.13...@tiptap/suggestion@2.0.0-beta.14) (2021-04-04)
|
|
63
|
-
|
|
64
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
# [2.0.0-beta.13](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.12...@tiptap/suggestion@2.0.0-beta.13) (2021-04-02)
|
|
71
|
-
|
|
72
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
# [2.0.0-beta.12](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.11...@tiptap/suggestion@2.0.0-beta.12) (2021-04-01)
|
|
79
|
-
|
|
80
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
# [2.0.0-beta.11](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.10...@tiptap/suggestion@2.0.0-beta.11) (2021-04-01)
|
|
87
|
-
|
|
88
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
# [2.0.0-beta.10](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.9...@tiptap/suggestion@2.0.0-beta.10) (2021-03-31)
|
|
95
|
-
|
|
96
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
# [2.0.0-beta.9](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.8...@tiptap/suggestion@2.0.0-beta.9) (2021-03-28)
|
|
103
|
-
|
|
104
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
# [2.0.0-beta.8](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.7...@tiptap/suggestion@2.0.0-beta.8) (2021-03-28)
|
|
111
|
-
|
|
112
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
# [2.0.0-beta.7](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.6...@tiptap/suggestion@2.0.0-beta.7) (2021-03-28)
|
|
119
|
-
|
|
120
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
# [2.0.0-beta.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.5...@tiptap/suggestion@2.0.0-beta.6) (2021-03-24)
|
|
127
|
-
|
|
128
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
# [2.0.0-beta.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.4...@tiptap/suggestion@2.0.0-beta.5) (2021-03-18)
|
|
135
|
-
|
|
136
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
# [2.0.0-beta.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.3...@tiptap/suggestion@2.0.0-beta.4) (2021-03-18)
|
|
143
|
-
|
|
144
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.2...@tiptap/suggestion@2.0.0-beta.3) (2021-03-16)
|
|
151
|
-
|
|
152
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-beta.1...@tiptap/suggestion@2.0.0-beta.2) (2021-03-09)
|
|
159
|
-
|
|
160
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-alpha.12...@tiptap/suggestion@2.0.0-beta.1) (2021-03-05)
|
|
167
|
-
|
|
168
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
# [2.0.0-alpha.12](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-alpha.11...@tiptap/suggestion@2.0.0-alpha.12) (2021-02-28)
|
|
175
|
-
|
|
176
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
# [2.0.0-alpha.11](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-alpha.10...@tiptap/suggestion@2.0.0-alpha.11) (2021-02-26)
|
|
183
|
-
|
|
184
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
# [2.0.0-alpha.10](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-alpha.9...@tiptap/suggestion@2.0.0-alpha.10) (2021-02-26)
|
|
191
|
-
|
|
192
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
# [2.0.0-alpha.9](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-alpha.8...@tiptap/suggestion@2.0.0-alpha.9) (2021-02-18)
|
|
199
|
-
|
|
200
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
# [2.0.0-alpha.8](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-alpha.7...@tiptap/suggestion@2.0.0-alpha.8) (2021-02-16)
|
|
207
|
-
|
|
208
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
# [2.0.0-alpha.7](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-alpha.6...@tiptap/suggestion@2.0.0-alpha.7) (2021-02-16)
|
|
215
|
-
|
|
216
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
# [2.0.0-alpha.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-alpha.5...@tiptap/suggestion@2.0.0-alpha.6) (2021-02-07)
|
|
223
|
-
|
|
224
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
# [2.0.0-alpha.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-alpha.4...@tiptap/suggestion@2.0.0-alpha.5) (2021-02-05)
|
|
231
|
-
|
|
232
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
# [2.0.0-alpha.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-alpha.3...@tiptap/suggestion@2.0.0-alpha.4) (2021-01-29)
|
|
239
|
-
|
|
240
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
# [2.0.0-alpha.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-alpha.2...@tiptap/suggestion@2.0.0-alpha.3) (2021-01-29)
|
|
247
|
-
|
|
248
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
# [2.0.0-alpha.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-alpha.1...@tiptap/suggestion@2.0.0-alpha.2) (2021-01-28)
|
|
255
|
-
|
|
256
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
# 2.0.0-alpha.1 (2021-01-28)
|
|
263
|
-
|
|
264
|
-
**Note:** Version bump only for package @tiptap/suggestion
|
package/LICENSE.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020, überdosis GbR
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Range } from '@tiptap/core';
|
|
2
|
-
import { ResolvedPos } from 'prosemirror-model';
|
|
3
|
-
export interface Trigger {
|
|
4
|
-
char: string;
|
|
5
|
-
allowSpaces: boolean;
|
|
6
|
-
startOfLine: boolean;
|
|
7
|
-
$position: ResolvedPos;
|
|
8
|
-
}
|
|
9
|
-
export declare type SuggestionMatch = {
|
|
10
|
-
range: Range;
|
|
11
|
-
query: string;
|
|
12
|
-
text: string;
|
|
13
|
-
} | null;
|
|
14
|
-
export declare function findSuggestionMatch(config: Trigger): SuggestionMatch;
|