@prosekit/extensions 0.0.0-next-20230709094459 → 0.0.0-next-20240421132240

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.
Files changed (52) hide show
  1. package/dist/_tsup-dts-rollup.d.ts +889 -0
  2. package/dist/chunk-ASTUC4KT.js +111 -0
  3. package/dist/chunk-DYFRBXUX.js +56 -0
  4. package/dist/list/style.css +18 -13
  5. package/dist/prosekit-extensions-autocomplete.d.ts +3 -0
  6. package/dist/prosekit-extensions-autocomplete.js +194 -0
  7. package/dist/prosekit-extensions-blockquote.d.ts +3 -11
  8. package/dist/prosekit-extensions-blockquote.js +24 -15
  9. package/dist/prosekit-extensions-bold.d.ts +4 -20
  10. package/dist/prosekit-extensions-bold.js +35 -37
  11. package/dist/prosekit-extensions-code-block.d.ts +15 -0
  12. package/dist/prosekit-extensions-code-block.js +214 -0
  13. package/dist/prosekit-extensions-code.d.ts +4 -16
  14. package/dist/prosekit-extensions-code.js +28 -12
  15. package/dist/prosekit-extensions-drop-cursor.d.ts +2 -0
  16. package/dist/prosekit-extensions-drop-cursor.js +9 -0
  17. package/dist/prosekit-extensions-enter-rule.d.ts +5 -0
  18. package/dist/prosekit-extensions-enter-rule.js +8 -0
  19. package/dist/prosekit-extensions-heading.d.ts +6 -15
  20. package/dist/prosekit-extensions-heading.js +75 -41
  21. package/dist/prosekit-extensions-image.d.ts +4 -0
  22. package/dist/prosekit-extensions-image.js +49 -0
  23. package/dist/prosekit-extensions-input-rule.d.ts +3 -0
  24. package/dist/prosekit-extensions-input-rule.js +10 -0
  25. package/dist/prosekit-extensions-italic.d.ts +4 -20
  26. package/dist/prosekit-extensions-italic.js +29 -31
  27. package/dist/prosekit-extensions-link.d.ts +6 -0
  28. package/dist/prosekit-extensions-link.js +102 -0
  29. package/dist/prosekit-extensions-list.d.ts +7 -14
  30. package/dist/prosekit-extensions-list.js +59 -24
  31. package/dist/prosekit-extensions-mention.d.ts +4 -0
  32. package/dist/prosekit-extensions-mention.js +56 -0
  33. package/dist/prosekit-extensions-placeholder.d.ts +2 -23
  34. package/dist/prosekit-extensions-placeholder.js +11 -7
  35. package/dist/prosekit-extensions-readonly.d.ts +1 -0
  36. package/dist/prosekit-extensions-readonly.js +16 -0
  37. package/dist/prosekit-extensions-strike.d.ts +4 -0
  38. package/dist/prosekit-extensions-strike.js +47 -0
  39. package/dist/prosekit-extensions-table.d.ts +7 -0
  40. package/dist/prosekit-extensions-table.js +197 -0
  41. package/dist/prosekit-extensions-underline.d.ts +4 -0
  42. package/dist/prosekit-extensions-underline.js +45 -0
  43. package/dist/prosekit-extensions-virtual-selection.d.ts +1 -0
  44. package/dist/prosekit-extensions-virtual-selection.js +58 -0
  45. package/dist/prosekit-extensions.d.ts +1 -2
  46. package/dist/shiki-import-25BJYIO2.js +5 -0
  47. package/dist/table/style.css +34 -0
  48. package/dist/virtual-selection/style.css +6 -0
  49. package/package.json +119 -13
  50. package/dist/prosekit-extensions-suggestion.d.ts +0 -37
  51. package/dist/prosekit-extensions-suggestion.js +0 -159
  52. package/src/index.ts +0 -1
@@ -0,0 +1,45 @@
1
+ // src/underline/index.ts
2
+ import {
3
+ defineCommands,
4
+ defineKeymap,
5
+ defineMarkSpec,
6
+ union,
7
+ toggleMark
8
+ } from "@prosekit/core";
9
+ function defineUnderlineSpec() {
10
+ return defineMarkSpec({
11
+ name: "underline",
12
+ parseDOM: [
13
+ { tag: "u" },
14
+ { tag: "underline" },
15
+ { style: "text-decoration=underline" },
16
+ { style: "text-decoration-line=underline" }
17
+ ],
18
+ toDOM() {
19
+ return ["u", 0];
20
+ }
21
+ });
22
+ }
23
+ function defineUnderlineCommands() {
24
+ return defineCommands({
25
+ toggleUnderline: () => toggleMark({ type: "underline" })
26
+ });
27
+ }
28
+ function defineUnderlineKeymap() {
29
+ return defineKeymap({
30
+ "Mod-u": toggleMark({ type: "underline" })
31
+ });
32
+ }
33
+ function defineUnderline() {
34
+ return union([
35
+ defineUnderlineSpec(),
36
+ defineUnderlineCommands(),
37
+ defineUnderlineKeymap()
38
+ ]);
39
+ }
40
+ export {
41
+ defineUnderline,
42
+ defineUnderlineCommands,
43
+ defineUnderlineKeymap,
44
+ defineUnderlineSpec
45
+ };
@@ -0,0 +1 @@
1
+ export { defineVirtualSelection } from './_tsup-dts-rollup';
@@ -0,0 +1,58 @@
1
+ // src/virtual-selection/index.ts
2
+ import { definePlugin } from "@prosekit/core";
3
+ import {
4
+ PluginKey,
5
+ ProseMirrorPlugin
6
+ } from "@prosekit/pm/state";
7
+ import { Decoration, DecorationSet } from "@prosekit/pm/view";
8
+ function defineVirtualSelection() {
9
+ return definePlugin(virtualSelectionPlugin);
10
+ }
11
+ var key = new PluginKey("prosekit-virtual-selection");
12
+ function getFocusMeta(tr) {
13
+ return tr.getMeta(key);
14
+ }
15
+ function setFocusMeta(tr, value) {
16
+ return tr.setMeta(key, value);
17
+ }
18
+ function getFocusState(state) {
19
+ return key.getState(state);
20
+ }
21
+ var virtualSelectionPlugin = new ProseMirrorPlugin({
22
+ key,
23
+ state: {
24
+ init: () => false,
25
+ apply: (tr, value) => {
26
+ var _a;
27
+ return (_a = getFocusMeta(tr)) != null ? _a : value;
28
+ }
29
+ },
30
+ props: {
31
+ handleDOMEvents: {
32
+ focus: (view) => {
33
+ view.dispatch(setFocusMeta(view.state.tr, false));
34
+ },
35
+ blur: (view) => {
36
+ const { dom, root } = view;
37
+ const activeElement = root.activeElement;
38
+ if (activeElement === dom)
39
+ return;
40
+ view.dispatch(setFocusMeta(view.state.tr, true));
41
+ }
42
+ },
43
+ decorations: (state) => {
44
+ const { selection, doc } = state;
45
+ if (selection.empty || !getFocusState(state)) {
46
+ return null;
47
+ }
48
+ return DecorationSet.create(doc, [
49
+ Decoration.inline(selection.from, selection.to, {
50
+ class: "prosekit-virtual-selection"
51
+ })
52
+ ]);
53
+ }
54
+ }
55
+ });
56
+ export {
57
+ defineVirtualSelection
58
+ };
@@ -1,2 +1 @@
1
-
2
- export { }
1
+ export {};
@@ -0,0 +1,5 @@
1
+ // src/code-block/shiki-import.ts
2
+ import { getHighlighter } from "shiki/bundle/full";
3
+ export {
4
+ getHighlighter
5
+ };
@@ -0,0 +1,34 @@
1
+ /* src/table/style.css */
2
+ .ProseMirror .tableWrapper {
3
+ overflow-x: auto;
4
+ }
5
+ .ProseMirror table {
6
+ border-collapse: collapse;
7
+ table-layout: fixed;
8
+ width: 100%;
9
+ overflow: hidden;
10
+ }
11
+ .ProseMirror td,
12
+ .ProseMirror th {
13
+ vertical-align: top;
14
+ box-sizing: border-box;
15
+ position: relative;
16
+ border-width: 1px;
17
+ }
18
+ .ProseMirror .column-resize-handle {
19
+ position: absolute;
20
+ right: -2px;
21
+ top: 0;
22
+ bottom: 0;
23
+ width: 4px;
24
+ z-index: 20;
25
+ background-color: HighlightText;
26
+ pointer-events: none;
27
+ }
28
+ .ProseMirror.resize-cursor {
29
+ cursor: ew-resize;
30
+ cursor: col-resize;
31
+ }
32
+ .ProseMirror .selectedCell {
33
+ background-color: Highlight;
34
+ }
@@ -0,0 +1,6 @@
1
+ /* src/virtual-selection/style.css */
2
+ .prosekit-virtual-selection {
3
+ background-color: Highlight;
4
+ box-shadow: 0 0 0 3px Highlight;
5
+ border-radius: 2px;
6
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/extensions",
3
3
  "type": "module",
4
- "version": "0.0.0-next-20230709094459",
4
+ "version": "0.0.0-next-20240421132240",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -30,6 +30,11 @@
30
30
  "import": "./dist/prosekit-extensions.js",
31
31
  "default": "./dist/prosekit-extensions.js"
32
32
  },
33
+ "./autocomplete": {
34
+ "types": "./dist/prosekit-extensions-autocomplete.d.ts",
35
+ "import": "./dist/prosekit-extensions-autocomplete.js",
36
+ "default": "./dist/prosekit-extensions-autocomplete.js"
37
+ },
33
38
  "./blockquote": {
34
39
  "types": "./dist/prosekit-extensions-blockquote.d.ts",
35
40
  "import": "./dist/prosekit-extensions-blockquote.js",
@@ -45,16 +50,46 @@
45
50
  "import": "./dist/prosekit-extensions-code.js",
46
51
  "default": "./dist/prosekit-extensions-code.js"
47
52
  },
53
+ "./code-block": {
54
+ "types": "./dist/prosekit-extensions-code-block.d.ts",
55
+ "import": "./dist/prosekit-extensions-code-block.js",
56
+ "default": "./dist/prosekit-extensions-code-block.js"
57
+ },
58
+ "./drop-cursor": {
59
+ "types": "./dist/prosekit-extensions-drop-cursor.d.ts",
60
+ "import": "./dist/prosekit-extensions-drop-cursor.js",
61
+ "default": "./dist/prosekit-extensions-drop-cursor.js"
62
+ },
63
+ "./enter-rule": {
64
+ "types": "./dist/prosekit-extensions-enter-rule.d.ts",
65
+ "import": "./dist/prosekit-extensions-enter-rule.js",
66
+ "default": "./dist/prosekit-extensions-enter-rule.js"
67
+ },
48
68
  "./heading": {
49
69
  "types": "./dist/prosekit-extensions-heading.d.ts",
50
70
  "import": "./dist/prosekit-extensions-heading.js",
51
71
  "default": "./dist/prosekit-extensions-heading.js"
52
72
  },
73
+ "./image": {
74
+ "types": "./dist/prosekit-extensions-image.d.ts",
75
+ "import": "./dist/prosekit-extensions-image.js",
76
+ "default": "./dist/prosekit-extensions-image.js"
77
+ },
78
+ "./input-rule": {
79
+ "types": "./dist/prosekit-extensions-input-rule.d.ts",
80
+ "import": "./dist/prosekit-extensions-input-rule.js",
81
+ "default": "./dist/prosekit-extensions-input-rule.js"
82
+ },
53
83
  "./italic": {
54
84
  "types": "./dist/prosekit-extensions-italic.d.ts",
55
85
  "import": "./dist/prosekit-extensions-italic.js",
56
86
  "default": "./dist/prosekit-extensions-italic.js"
57
87
  },
88
+ "./link": {
89
+ "types": "./dist/prosekit-extensions-link.d.ts",
90
+ "import": "./dist/prosekit-extensions-link.js",
91
+ "default": "./dist/prosekit-extensions-link.js"
92
+ },
58
93
  "./list": {
59
94
  "types": "./dist/prosekit-extensions-list.d.ts",
60
95
  "import": "./dist/prosekit-extensions-list.js",
@@ -63,6 +98,11 @@
63
98
  "./list/style.css": {
64
99
  "default": "./dist/list/style.css"
65
100
  },
101
+ "./mention": {
102
+ "types": "./dist/prosekit-extensions-mention.d.ts",
103
+ "import": "./dist/prosekit-extensions-mention.js",
104
+ "default": "./dist/prosekit-extensions-mention.js"
105
+ },
66
106
  "./placeholder": {
67
107
  "types": "./dist/prosekit-extensions-placeholder.d.ts",
68
108
  "import": "./dist/prosekit-extensions-placeholder.js",
@@ -71,25 +111,55 @@
71
111
  "./placeholder/style.css": {
72
112
  "default": "./dist/placeholder/style.css"
73
113
  },
74
- "./suggestion": {
75
- "types": "./dist/prosekit-extensions-suggestion.d.ts",
76
- "import": "./dist/prosekit-extensions-suggestion.js",
77
- "default": "./dist/prosekit-extensions-suggestion.js"
114
+ "./readonly": {
115
+ "types": "./dist/prosekit-extensions-readonly.d.ts",
116
+ "import": "./dist/prosekit-extensions-readonly.js",
117
+ "default": "./dist/prosekit-extensions-readonly.js"
118
+ },
119
+ "./strike": {
120
+ "types": "./dist/prosekit-extensions-strike.d.ts",
121
+ "import": "./dist/prosekit-extensions-strike.js",
122
+ "default": "./dist/prosekit-extensions-strike.js"
123
+ },
124
+ "./table": {
125
+ "types": "./dist/prosekit-extensions-table.d.ts",
126
+ "import": "./dist/prosekit-extensions-table.js",
127
+ "default": "./dist/prosekit-extensions-table.js"
128
+ },
129
+ "./table/style.css": {
130
+ "default": "./dist/table/style.css"
131
+ },
132
+ "./underline": {
133
+ "types": "./dist/prosekit-extensions-underline.d.ts",
134
+ "import": "./dist/prosekit-extensions-underline.js",
135
+ "default": "./dist/prosekit-extensions-underline.js"
136
+ },
137
+ "./virtual-selection": {
138
+ "types": "./dist/prosekit-extensions-virtual-selection.d.ts",
139
+ "import": "./dist/prosekit-extensions-virtual-selection.js",
140
+ "default": "./dist/prosekit-extensions-virtual-selection.js"
141
+ },
142
+ "./virtual-selection/style.css": {
143
+ "default": "./dist/virtual-selection/style.css"
78
144
  }
79
145
  },
80
146
  "files": [
81
147
  "dist"
82
148
  ],
83
149
  "dependencies": {
84
- "@prosekit/core": "0.0.0-next-20230709094459",
85
- "@prosekit/pm": "0.0.0-next-20230709094459",
86
- "prosemirror-flat-list": "^0.3.15"
150
+ "@prosekit/core": "0.0.0-next-20240421132240",
151
+ "@prosekit/pm": "0.0.0-next-20240421132240",
152
+ "prosemirror-dropcursor": "^1.8.1",
153
+ "prosemirror-flat-list": "^0.5.0",
154
+ "prosemirror-highlight": "^0.5.0",
155
+ "prosemirror-tables": "^1.3.7",
156
+ "shiki": "^1.3.0"
87
157
  },
88
158
  "devDependencies": {
89
159
  "@prosekit/dev": "*",
90
- "tsup": "^7.1.0",
91
- "typescript": "^5.1.6",
92
- "vitest": "^0.33.0"
160
+ "tsup": "^8.0.2",
161
+ "typescript": "^5.4.5",
162
+ "vitest": "^1.5.0"
93
163
  },
94
164
  "scripts": {
95
165
  "build:tsup": "tsup",
@@ -101,6 +171,9 @@
101
171
  ".": [
102
172
  "./dist/prosekit-extensions.d.ts"
103
173
  ],
174
+ "autocomplete": [
175
+ "./dist/prosekit-extensions-autocomplete.d.ts"
176
+ ],
104
177
  "blockquote": [
105
178
  "./dist/prosekit-extensions-blockquote.d.ts"
106
179
  ],
@@ -110,20 +183,53 @@
110
183
  "code": [
111
184
  "./dist/prosekit-extensions-code.d.ts"
112
185
  ],
186
+ "code-block": [
187
+ "./dist/prosekit-extensions-code-block.d.ts"
188
+ ],
189
+ "drop-cursor": [
190
+ "./dist/prosekit-extensions-drop-cursor.d.ts"
191
+ ],
192
+ "enter-rule": [
193
+ "./dist/prosekit-extensions-enter-rule.d.ts"
194
+ ],
113
195
  "heading": [
114
196
  "./dist/prosekit-extensions-heading.d.ts"
115
197
  ],
198
+ "image": [
199
+ "./dist/prosekit-extensions-image.d.ts"
200
+ ],
201
+ "input-rule": [
202
+ "./dist/prosekit-extensions-input-rule.d.ts"
203
+ ],
116
204
  "italic": [
117
205
  "./dist/prosekit-extensions-italic.d.ts"
118
206
  ],
207
+ "link": [
208
+ "./dist/prosekit-extensions-link.d.ts"
209
+ ],
119
210
  "list": [
120
211
  "./dist/prosekit-extensions-list.d.ts"
121
212
  ],
213
+ "mention": [
214
+ "./dist/prosekit-extensions-mention.d.ts"
215
+ ],
122
216
  "placeholder": [
123
217
  "./dist/prosekit-extensions-placeholder.d.ts"
124
218
  ],
125
- "suggestion": [
126
- "./dist/prosekit-extensions-suggestion.d.ts"
219
+ "readonly": [
220
+ "./dist/prosekit-extensions-readonly.d.ts"
221
+ ],
222
+ "strike": [
223
+ "./dist/prosekit-extensions-strike.d.ts"
224
+ ],
225
+ "table": [
226
+ "./dist/prosekit-extensions-table.d.ts"
227
+ ],
228
+ "underline": [
229
+ "./dist/prosekit-extensions-underline.d.ts"
230
+ ],
231
+ "virtual-selection": [
232
+ "./dist/prosekit-extensions-virtual-selection.d.ts"
127
233
  ]
128
234
  }
129
235
  }
@@ -1,37 +0,0 @@
1
- import * as _prosekit_core from '@prosekit/core';
2
- import { EditorState } from '@prosekit/pm/state';
3
-
4
- interface PredictionRule {
5
- match: RegExp;
6
- matchAfter?: RegExp;
7
- }
8
- /**
9
- * @returns Return a Transaction object if you want to append a transaction to current state (using )
10
- */
11
- type MatchHandler = (options: {
12
- rule: PredictionRule;
13
- match: RegExpMatchArray;
14
- matchAfter: RegExpMatchArray | null;
15
- state: EditorState;
16
- dismiss: VoidFunction;
17
- deleteMatch: VoidFunction;
18
- }) => void;
19
- interface SuggestionOptions {
20
- rules: PredictionRule[];
21
- onMatch: MatchHandler;
22
- onDeactivate: VoidFunction;
23
- /**
24
- * You can pass this function if you want to skip the matching in some cases.
25
- * By default, the plugin will only run the matching if the current selection
26
- * is empty, and the selection is not inside a
27
- * [code](https://prosemirror.net/docs/ref/#model.NodeSpec.code) node nor
28
- * inside a mark with the name as `code`.
29
- */
30
- isValid?: (options: {
31
- state: EditorState;
32
- }) => boolean;
33
- }
34
-
35
- declare function addSuggestion(options: SuggestionOptions): _prosekit_core.Extension<_prosekit_core.ExtensionTyping<string, string, _prosekit_core.CommandArgs>>;
36
-
37
- export { PredictionRule, SuggestionOptions, addSuggestion };
@@ -1,159 +0,0 @@
1
- // src/suggestion/index.ts
2
- import { addPlugin } from "@prosekit/core";
3
-
4
- // src/suggestion/plugin.ts
5
- import { ProseKitError } from "@prosekit/core";
6
- import { Plugin, PluginKey } from "@prosekit/pm/state";
7
- import { Decoration, DecorationSet } from "@prosekit/pm/view";
8
-
9
- // src/suggestion/is-valid.ts
10
- function defaultIsValid({ state }) {
11
- return state.selection.empty && !isInsideCode(state.selection.$from);
12
- }
13
- function isInsideCode($pos) {
14
- for (let d = $pos.depth; d > 0; d--) {
15
- if ($pos.node(d).type.spec.code) {
16
- return true;
17
- }
18
- }
19
- return $pos.marks().some((mark) => mark.type.name === "code");
20
- }
21
-
22
- // src/suggestion/plugin.ts
23
- var pluginKey = new PluginKey("prosemirror-prediction");
24
- function getPluginState(state) {
25
- return pluginKey.getState(state);
26
- }
27
- function getTrMeta(tr) {
28
- return tr.getMeta(pluginKey);
29
- }
30
- function setTrMeta(tr, meta) {
31
- return tr.setMeta(pluginKey, meta);
32
- }
33
- function createPredictionPlugin(options) {
34
- if (options.rules.length === 0) {
35
- throw new ProseKitError(
36
- "You can't create a prediction plugin without rules"
37
- );
38
- }
39
- const { onMatch, onDeactivate, isValid = defaultIsValid } = options;
40
- return new Plugin({
41
- key: pluginKey,
42
- state: {
43
- init: () => {
44
- return { active: false, ignore: null, matching: null };
45
- },
46
- apply: (tr, prevValue, oldState, newState) => {
47
- var _a;
48
- const meta = getTrMeta(tr);
49
- if (!tr.docChanged && oldState.selection.eq(newState.selection) && !meta) {
50
- return prevValue;
51
- }
52
- if (meta) {
53
- return meta;
54
- }
55
- if (!isValid({ state: newState })) {
56
- return { active: false, ignore: null, matching: null };
57
- }
58
- const nextValue = calcPluginState(newState, options.rules);
59
- if (nextValue.active && prevValue.ignore != null && ((_a = nextValue.matching) == null ? void 0 : _a.from) === prevValue.ignore) {
60
- return prevValue;
61
- }
62
- return nextValue;
63
- }
64
- },
65
- view: () => ({
66
- update: (view, prevState) => {
67
- const prevPluginState = getPluginState(prevState);
68
- const currPluginState = getPluginState(view.state);
69
- if ((currPluginState == null ? void 0 : currPluginState.active) && currPluginState.matching && currPluginState.matching.from !== currPluginState.ignore) {
70
- const { from, to } = currPluginState.matching;
71
- const dismiss = () => {
72
- view.dispatch(
73
- setTrMeta(view.state.tr, {
74
- active: false,
75
- ignore: from,
76
- matching: null
77
- })
78
- );
79
- };
80
- const textContent = view.state.doc.textBetween(from, to, "\uFFFC");
81
- const deleteMatch = () => {
82
- if (view.state.doc.textBetween(from, to, "\uFFFC") === textContent) {
83
- view.dispatch(view.state.tr.delete(from, to));
84
- }
85
- };
86
- onMatch({
87
- rule: currPluginState.matching.rule,
88
- match: currPluginState.matching.match,
89
- matchAfter: currPluginState.matching.matchAfter,
90
- state: view.state,
91
- dismiss,
92
- deleteMatch
93
- });
94
- } else if (prevPluginState == null ? void 0 : prevPluginState.active) {
95
- onDeactivate();
96
- }
97
- }
98
- }),
99
- props: {
100
- decorations: (state) => {
101
- const pluginState = getPluginState(state);
102
- if ((pluginState == null ? void 0 : pluginState.active) && pluginState.matching) {
103
- const { from, to } = pluginState.matching;
104
- const deco = Decoration.inline(from, to, {
105
- class: "prosemirror-prediction-match"
106
- });
107
- return DecorationSet.create(state.doc, [deco]);
108
- }
109
- return null;
110
- }
111
- }
112
- });
113
- }
114
- function calcPluginState(state, rules) {
115
- const { $anchor } = state.selection;
116
- const matchAfter = rules.some((rule) => rule.matchAfter);
117
- const parentOffset = $anchor.parentOffset;
118
- const textBefore = $anchor.parent.textBetween(
119
- Math.max(0, parentOffset - MAX_MATCH),
120
- parentOffset,
121
- null,
122
- "\uFFFC"
123
- );
124
- const textAfter = matchAfter ? $anchor.parent.textBetween(
125
- parentOffset,
126
- Math.min(parentOffset + MAX_MATCH, $anchor.parent.content.size),
127
- null
128
- ) : "";
129
- for (const rule of rules) {
130
- const match = textBefore.match(rule.match);
131
- const matchAfter2 = rule.matchAfter ? textAfter.match(rule.matchAfter) : null;
132
- if (match && match.index != null) {
133
- const from = $anchor.pos - textBefore.length + match.index;
134
- const to = $anchor.pos + (matchAfter2 ? matchAfter2[0].length : 0);
135
- return {
136
- active: true,
137
- ignore: null,
138
- matching: {
139
- rule,
140
- from,
141
- to,
142
- match,
143
- matchAfter: matchAfter2
144
- }
145
- };
146
- }
147
- }
148
- return { active: false };
149
- }
150
- var MAX_MATCH = 200;
151
-
152
- // src/suggestion/index.ts
153
- function addSuggestion(options) {
154
- const plugin = createPredictionPlugin(options);
155
- return addPlugin({ plugins: [plugin] });
156
- }
157
- export {
158
- addSuggestion
159
- };
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export {}