@prosekit/extensions 0.5.2 → 0.6.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.
Files changed (33) hide show
  1. package/dist/_tsup-dts-rollup.d.ts +87 -6
  2. package/dist/{chunk-DZAKXWWF.js → chunk-2JYT2MT7.js} +21 -41
  3. package/dist/{chunk-LVMTQOWG.js → chunk-PYT3MOTF.js} +14 -31
  4. package/dist/chunk-ZPEMHYTU.js +140 -0
  5. package/dist/list/style.css +4 -8
  6. package/dist/placeholder/style.css +1 -1
  7. package/dist/prosekit-extensions-autocomplete.js +33 -62
  8. package/dist/prosekit-extensions-blockquote.js +2 -2
  9. package/dist/prosekit-extensions-bold.js +3 -7
  10. package/dist/prosekit-extensions-code-block.js +61 -81
  11. package/dist/prosekit-extensions-code.js +1 -1
  12. package/dist/prosekit-extensions-enter-rule.js +1 -1
  13. package/dist/prosekit-extensions-heading.js +6 -13
  14. package/dist/prosekit-extensions-image.js +5 -14
  15. package/dist/prosekit-extensions-input-rule.js +1 -1
  16. package/dist/prosekit-extensions-italic.js +1 -1
  17. package/dist/prosekit-extensions-link.js +16 -31
  18. package/dist/prosekit-extensions-list.js +2 -4
  19. package/dist/prosekit-extensions-mark-rule.js +1 -1
  20. package/dist/prosekit-extensions-mention.js +4 -6
  21. package/dist/prosekit-extensions-placeholder.js +9 -20
  22. package/dist/prosekit-extensions-readonly.js +1 -1
  23. package/dist/prosekit-extensions-search.d.ts +3 -0
  24. package/dist/prosekit-extensions-search.js +49 -0
  25. package/dist/prosekit-extensions-strike.js +1 -1
  26. package/dist/prosekit-extensions-table.js +30 -68
  27. package/dist/prosekit-extensions-text-align.js +2 -4
  28. package/dist/prosekit-extensions-virtual-selection.js +6 -12
  29. package/dist/search/style.css +13 -0
  30. package/dist/shiki-import-UFUFVKJ2.js +5 -0
  31. package/package.json +19 -7
  32. package/dist/chunk-ZOBSD7ZH.js +0 -189
  33. package/dist/shiki-import-25BJYIO2.js +0 -5
@@ -17,11 +17,9 @@ function defaultCanMatch({ state }) {
17
17
  return state.selection.empty && !isInsideCode(state.selection.$from);
18
18
  }
19
19
  function isInsideCode($pos) {
20
- for (let d = $pos.depth; d > 0; d--) {
21
- if ($pos.node(d).type.spec.code) {
22
- return true;
23
- }
24
- }
20
+ for (let d = $pos.depth; d > 0; d--)
21
+ if ($pos.node(d).type.spec.code)
22
+ return !0;
25
23
  return $pos.marks().some((mark) => mark.type.name === "code");
26
24
  }
27
25
  function getPluginState(state) {
@@ -44,55 +42,39 @@ function createAutocompletePlugin({
44
42
  return new Plugin({
45
43
  key: pluginKey,
46
44
  state: {
47
- init: () => {
48
- return { active: false, ignore: null, matching: null };
49
- },
45
+ init: () => ({ active: !1, ignore: null, matching: null }),
50
46
  apply: (tr, prevValue, oldState, newState) => {
51
47
  var _a;
52
- const meta = getTrMeta(tr);
53
- if (!tr.docChanged && oldState.selection.eq(newState.selection) && !meta) {
48
+ let meta = getTrMeta(tr);
49
+ if (!tr.docChanged && oldState.selection.eq(newState.selection) && !meta)
54
50
  return prevValue;
55
- }
56
- if (meta) {
51
+ if (meta)
57
52
  return meta;
58
- }
59
- const nextValue = calcPluginState(newState, getRules());
60
- if (nextValue.active && prevValue.ignore != null && ((_a = nextValue.matching) == null ? void 0 : _a.from) === prevValue.ignore) {
61
- return prevValue;
62
- }
63
- return nextValue;
53
+ let nextValue = calcPluginState(newState, getRules());
54
+ return nextValue.active && prevValue.ignore != null && ((_a = nextValue.matching) == null ? void 0 : _a.from) === prevValue.ignore ? prevValue : nextValue;
64
55
  }
65
56
  },
66
57
  view: () => ({
67
58
  update: (view, prevState) => {
68
59
  var _a, _b, _c;
69
- const prevValue = getPluginState(prevState);
70
- const currValue = getPluginState(view.state);
71
- if ((prevValue == null ? void 0 : prevValue.active) && prevValue.matching && prevValue.matching.rule !== ((_a = currValue == null ? void 0 : currValue.matching) == null ? void 0 : _a.rule)) {
72
- (_c = (_b = prevValue.matching.rule).onLeave) == null ? void 0 : _c.call(_b);
73
- }
74
- if ((currValue == null ? void 0 : currValue.active) && currValue.matching && currValue.matching.from !== currValue.ignore) {
75
- const { from, to, match, rule } = currValue.matching;
76
- const textContent = view.state.doc.textBetween(
60
+ let prevValue = getPluginState(prevState), currValue = getPluginState(view.state);
61
+ if (prevValue != null && prevValue.active && prevValue.matching && prevValue.matching.rule !== ((_a = currValue == null ? void 0 : currValue.matching) == null ? void 0 : _a.rule) && ((_c = (_b = prevValue.matching.rule).onLeave) == null || _c.call(_b)), currValue != null && currValue.active && currValue.matching && currValue.matching.from !== currValue.ignore) {
62
+ let { from, to, match, rule } = currValue.matching, textContent = view.state.doc.textBetween(
77
63
  from,
78
64
  to,
79
65
  null,
80
66
  OBJECT_REPLACEMENT_CHARACTER
81
- );
82
- const deleteMatch = () => {
83
- if (view.state.doc.textBetween(
67
+ ), deleteMatch = () => {
68
+ view.state.doc.textBetween(
84
69
  from,
85
70
  to,
86
71
  null,
87
72
  OBJECT_REPLACEMENT_CHARACTER
88
- ) === textContent) {
89
- view.dispatch(view.state.tr.delete(from, to));
90
- }
91
- };
92
- const ignoreMatch = () => {
73
+ ) === textContent && view.dispatch(view.state.tr.delete(from, to));
74
+ }, ignoreMatch = () => {
93
75
  view.dispatch(
94
76
  setTrMeta(view.state.tr, {
95
- active: false,
77
+ active: !1,
96
78
  ignore: from,
97
79
  matching: null
98
80
  })
@@ -111,10 +93,9 @@ function createAutocompletePlugin({
111
93
  }),
112
94
  props: {
113
95
  decorations: (state) => {
114
- const pluginState = getPluginState(state);
115
- if ((pluginState == null ? void 0 : pluginState.active) && pluginState.matching) {
116
- const { from, to } = pluginState.matching;
117
- const deco = Decoration.inline(from, to, {
96
+ let pluginState = getPluginState(state);
97
+ if (pluginState != null && pluginState.active && pluginState.matching) {
98
+ let { from, to } = pluginState.matching, deco = Decoration.inline(from, to, {
118
99
  class: "prosemirror-prediction-match"
119
100
  });
120
101
  return DecorationSet.create(state.doc, [deco]);
@@ -126,26 +107,22 @@ function createAutocompletePlugin({
126
107
  }
127
108
  var MAX_MATCH = 200;
128
109
  function calcPluginState(state, rules) {
129
- const $pos = state.selection.$from;
130
- const parentOffset = $pos.parentOffset;
131
- const textBefore = $pos.parent.textBetween(
110
+ let $pos = state.selection.$from, parentOffset = $pos.parentOffset, textBefore = $pos.parent.textBetween(
132
111
  Math.max(0, parentOffset - MAX_MATCH),
133
112
  parentOffset,
134
113
  null,
135
114
  OBJECT_REPLACEMENT_CHARACTER
136
115
  );
137
- for (const rule of rules) {
138
- if (!rule.canMatch({ state })) {
116
+ for (let rule of rules) {
117
+ if (!rule.canMatch({ state }))
139
118
  continue;
140
- }
141
119
  rule.regex.lastIndex = 0;
142
- const match = rule.regex.exec(textBefore);
143
- if (!match) {
120
+ let match = rule.regex.exec(textBefore);
121
+ if (!match)
144
122
  continue;
145
- }
146
- const from = $pos.pos - textBefore.length + match.index;
123
+ let from = $pos.pos - textBefore.length + match.index;
147
124
  return {
148
- active: true,
125
+ active: !0,
149
126
  ignore: null,
150
127
  matching: {
151
128
  rule,
@@ -155,17 +132,14 @@ function calcPluginState(state, rules) {
155
132
  }
156
133
  };
157
134
  }
158
- return { active: false, ignore: null, matching: null };
135
+ return { active: !1, ignore: null, matching: null };
159
136
  }
160
137
 
161
138
  // src/autocomplete/rule.ts
162
139
  var AutocompleteRule = class {
163
140
  constructor(options) {
164
141
  var _a;
165
- this.regex = options.regex;
166
- this.onMatch = options.onEnter;
167
- this.onLeave = options.onLeave;
168
- this.canMatch = (_a = options.canMatch) != null ? _a : defaultCanMatch;
142
+ this.regex = options.regex, this.onMatch = options.onEnter, this.onLeave = options.onLeave, this.canMatch = (_a = options.canMatch) != null ? _a : defaultCanMatch;
169
143
  }
170
144
  };
171
145
 
@@ -175,16 +149,13 @@ function defineAutocomplete(rule) {
175
149
  }
176
150
  var autocompleteFacet = defineFacet({
177
151
  reduce: () => {
178
- let rules = [];
179
- const getRules = () => rules;
180
- const plugin = createAutocompletePlugin({ getRules });
181
- return function reducer(inputs) {
182
- rules = inputs;
183
- return plugin;
152
+ let rules = [], plugin = createAutocompletePlugin({ getRules: () => rules });
153
+ return function(inputs) {
154
+ return rules = inputs, plugin;
184
155
  };
185
156
  },
186
157
  parent: pluginFacet,
187
- singleton: true
158
+ singleton: !0
188
159
  });
189
160
  export {
190
161
  AutocompleteRule,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  defineWrappingInputRule
3
- } from "./chunk-LVMTQOWG.js";
3
+ } from "./chunk-PYT3MOTF.js";
4
4
 
5
5
  // src/blockquote/index.ts
6
6
  import { defineNodeSpec, union } from "@prosekit/core";
@@ -9,7 +9,7 @@ function defineBlockquoteSpec() {
9
9
  name: "blockquote",
10
10
  content: "block+",
11
11
  group: "block",
12
- defining: true,
12
+ defining: !0,
13
13
  parseDOM: [{ tag: "blockquote" }],
14
14
  toDOM() {
15
15
  return ["blockquote", 0];
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  defineMarkInputRule
3
- } from "./chunk-LVMTQOWG.js";
3
+ } from "./chunk-PYT3MOTF.js";
4
4
 
5
5
  // src/bold/index.ts
6
6
  import {
@@ -21,16 +21,12 @@ function defineBoldSpec() {
21
21
  // tags with a font-weight normal.
22
22
  {
23
23
  tag: "b",
24
- getAttrs: (node) => {
25
- return typeof node !== "string" && node.style.fontWeight !== "normal" && null;
26
- }
24
+ getAttrs: (node) => typeof node != "string" && node.style.fontWeight !== "normal" && null
27
25
  },
28
26
  { style: "font-weight=400", clearMark: (m) => m.type.name == "strong" },
29
27
  {
30
28
  style: "font-weight",
31
- getAttrs: (value) => {
32
- return typeof value === "string" && /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null;
33
- }
29
+ getAttrs: (value) => typeof value == "string" && /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null
34
30
  }
35
31
  ],
36
32
  toDOM() {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  defineTextBlockInputRule
3
- } from "./chunk-LVMTQOWG.js";
3
+ } from "./chunk-PYT3MOTF.js";
4
4
  import {
5
5
  defineTextBlockEnterRule
6
- } from "./chunk-DZAKXWWF.js";
6
+ } from "./chunk-2JYT2MT7.js";
7
7
 
8
8
  // src/code-block/code-block.ts
9
9
  import { union } from "@prosekit/core";
@@ -18,18 +18,10 @@ import {
18
18
  } from "@prosekit/core";
19
19
  function defineCodeBlockCommands() {
20
20
  return defineCommands({
21
- setCodeBlock: (attrs) => {
22
- return setBlockType({ type: "codeBlock", attrs });
23
- },
24
- insertCodeBlock: (attrs) => {
25
- return insertNode({ type: "codeBlock", attrs });
26
- },
27
- toggleCodeBlock: (attrs) => {
28
- return toggleNode({ type: "codeBlock", attrs });
29
- },
30
- setCodeBlockAttrs: (attrs) => {
31
- return setNodeAttrs({ type: "codeBlock", attrs });
32
- }
21
+ setCodeBlock: (attrs) => setBlockType({ type: "codeBlock", attrs }),
22
+ insertCodeBlock: (attrs) => insertNode({ type: "codeBlock", attrs }),
23
+ toggleCodeBlock: (attrs) => toggleNode({ type: "codeBlock", attrs }),
24
+ setCodeBlockAttrs: (attrs) => setNodeAttrs({ type: "codeBlock", attrs })
33
25
  });
34
26
  }
35
27
 
@@ -61,32 +53,24 @@ function defineCodeBlockKeymap() {
61
53
  });
62
54
  }
63
55
  var existCodeBlock = (state, dispatch) => {
64
- if (!state.selection.empty) {
65
- return false;
66
- }
67
- const { $head } = state.selection;
68
- const parent = $head.parent;
69
- if (parent.isTextblock && parent.type.spec.code && $head.parentOffset === parent.content.size && parent.textContent.endsWith("\n\n")) {
70
- const grandParent = $head.node(-1);
71
- const insertIndex = $head.indexAfter(-1);
72
- const type = defaultBlockAt(grandParent.contentMatchAt(insertIndex));
73
- if (!type || !grandParent.canReplaceWith(insertIndex, insertIndex, type)) {
74
- return false;
75
- }
56
+ if (!state.selection.empty)
57
+ return !1;
58
+ let { $head } = state.selection, parent = $head.parent;
59
+ if (parent.isTextblock && parent.type.spec.code && $head.parentOffset === parent.content.size && parent.textContent.endsWith(`
60
+
61
+ `)) {
62
+ let grandParent = $head.node(-1), insertIndex = $head.indexAfter(-1), type = defaultBlockAt(grandParent.contentMatchAt(insertIndex));
63
+ if (!type || !grandParent.canReplaceWith(insertIndex, insertIndex, type))
64
+ return !1;
76
65
  if (dispatch) {
77
- const { tr } = state;
66
+ let { tr } = state;
78
67
  tr.delete($head.pos - 2, $head.pos);
79
- const pos = tr.selection.$head.after();
80
- const node = type.createAndFill();
81
- if (node) {
82
- tr.replaceWith(pos, pos, node);
83
- tr.setSelection(TextSelection.near(tr.doc.resolve(pos), 1));
84
- dispatch(tr.scrollIntoView());
85
- }
68
+ let pos = tr.selection.$head.after(), node = type.createAndFill();
69
+ node && (tr.replaceWith(pos, pos, node), tr.setSelection(TextSelection.near(tr.doc.resolve(pos), 1)), dispatch(tr.scrollIntoView()));
86
70
  }
87
- return true;
71
+ return !0;
88
72
  }
89
- return false;
73
+ return !1;
90
74
  };
91
75
 
92
76
  // src/code-block/code-block-spec.ts
@@ -96,8 +80,8 @@ function defineCodeBlockSpec() {
96
80
  name: "codeBlock",
97
81
  content: "text*",
98
82
  group: "block",
99
- code: true,
100
- defining: true,
83
+ code: !0,
84
+ defining: !0,
101
85
  marks: "",
102
86
  attrs: { language: { default: "" } },
103
87
  parseDOM: [
@@ -110,8 +94,7 @@ function defineCodeBlockSpec() {
110
94
  }
111
95
  ],
112
96
  toDOM(node) {
113
- const attrs = node.attrs;
114
- return ["pre", { "data-language": attrs.language }, ["code", 0]];
97
+ return ["pre", { "data-language": node.attrs.language }, ["code", 0]];
115
98
  }
116
99
  });
117
100
  }
@@ -140,49 +123,46 @@ function defineCodeBlockHighlight({
140
123
 
141
124
  // src/code-block/shiki-parser.ts
142
125
  import { createParser } from "prosemirror-highlight/shiki";
143
- function createHighlighterLoader() {
144
- let highlighterPromise;
145
- let highlighter;
146
- const loadLangs = /* @__PURE__ */ new Set();
147
- return function highlighterLoader(lang, options) {
148
- if (!highlighterPromise) {
149
- highlighterPromise = import("./shiki-import-25BJYIO2.js").then(({ getHighlighter }) => {
150
- return getHighlighter(options);
151
- }).then((h) => {
152
- highlighter = h;
153
- });
154
- return { promise: highlighterPromise };
155
- }
156
- if (!highlighter) {
157
- return { promise: highlighterPromise };
158
- }
159
- if (!loadLangs.has(lang)) {
160
- const promise = highlighter.loadLanguage(lang).then(() => {
161
- loadLangs.add(lang);
162
- }).catch((error) => {
163
- console.warn(`Failed to load language '${lang}'`, error);
164
- });
165
- return { promise };
166
- }
167
- return { highlighter };
168
- };
126
+
127
+ // src/code-block/shiki-highlighter.ts
128
+ var highlighter, loadedLangs = /* @__PURE__ */ new Set(), loadedThemes = /* @__PURE__ */ new Set();
129
+ async function createHighlighter(options) {
130
+ let { getSingletonHighlighter } = await import("./shiki-import-UFUFVKJ2.js");
131
+ highlighter || (highlighter = await getSingletonHighlighter(options));
169
132
  }
133
+ async function loadLanguages(langs) {
134
+ for (let lang of langs) {
135
+ if (!highlighter) break;
136
+ await highlighter.loadLanguage(lang), loadedLangs.add(lang);
137
+ }
138
+ }
139
+ async function loadThemes(themes) {
140
+ for (let theme of themes) {
141
+ if (!highlighter) break;
142
+ await highlighter.loadTheme(theme), loadedThemes.add(theme);
143
+ }
144
+ }
145
+ function prepareHighlighter(options) {
146
+ if (!highlighter)
147
+ return { promise: createHighlighter(options) };
148
+ let langs = options.langs.filter((lang) => !loadedLangs.has(lang));
149
+ if (langs.length > 0)
150
+ return { promise: loadLanguages(langs) };
151
+ let themes = options.themes.filter((theme) => !loadedThemes.has(theme));
152
+ return themes.length > 0 ? { promise: loadThemes(themes) } : { highlighter };
153
+ }
154
+
155
+ // src/code-block/shiki-parser.ts
170
156
  function createLazyParser(highlighterOptions) {
171
157
  let parser;
172
- const highlighterLoader = createHighlighterLoader();
173
- return function lazyParser(options) {
174
- const language = options.language || "";
175
- const { highlighter, promise } = highlighterLoader(
176
- language,
177
- highlighterOptions
178
- );
179
- if (!highlighter) {
180
- return promise || [];
181
- }
182
- if (!parser) {
183
- parser = createParser(highlighter);
184
- }
185
- return parser(options);
158
+ return prepareHighlighter(highlighterOptions), function(options) {
159
+ let language = options.language || "", { highlighter: highlighter2, promise } = prepareHighlighter({
160
+ langs: [language],
161
+ themes: highlighterOptions.themes
162
+ });
163
+ return highlighter2 ? (parser || (parser = createParser(highlighter2, {
164
+ theme: highlighterOptions.themes[0]
165
+ })), parser(options)) : promise;
186
166
  };
187
167
  }
188
168
 
@@ -192,7 +172,7 @@ function defineCodeBlockShiki({
192
172
  langs = ["text"],
193
173
  langAlias = {}
194
174
  } = {}) {
195
- const parser = createLazyParser({ themes, langs, langAlias });
175
+ let parser = createLazyParser({ themes, langs, langAlias });
196
176
  return defineCodeBlockHighlight({ parser });
197
177
  }
198
178
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  defineMarkInputRule
3
- } from "./chunk-LVMTQOWG.js";
3
+ } from "./chunk-PYT3MOTF.js";
4
4
 
5
5
  // src/code/index.ts
6
6
  import {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  defineEnterRule,
3
3
  defineTextBlockEnterRule
4
- } from "./chunk-DZAKXWWF.js";
4
+ } from "./chunk-2JYT2MT7.js";
5
5
  export {
6
6
  defineEnterRule,
7
7
  defineTextBlockEnterRule
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  defineTextBlockInputRule
3
- } from "./chunk-LVMTQOWG.js";
3
+ } from "./chunk-PYT3MOTF.js";
4
4
 
5
5
  // src/heading/index.ts
6
6
  import {
@@ -19,7 +19,7 @@ function defineHeadingSpec() {
19
19
  attrs: { level: { default: 1 } },
20
20
  content: "inline*",
21
21
  group: "block",
22
- defining: true,
22
+ defining: !0,
23
23
  parseDOM: [
24
24
  { tag: "h1", attrs: { level: 1 } },
25
25
  { tag: "h2", attrs: { level: 2 } },
@@ -52,22 +52,15 @@ function defineHeadingInputRule() {
52
52
  type: "heading",
53
53
  attrs: (match) => {
54
54
  var _a, _b;
55
- const level = (_b = (_a = match[1]) == null ? void 0 : _a.length) != null ? _b : 1;
56
- return { level };
55
+ return { level: (_b = (_a = match[1]) == null ? void 0 : _a.length) != null ? _b : 1 };
57
56
  }
58
57
  });
59
58
  }
60
59
  function defineHeadingCommands() {
61
60
  return defineCommands({
62
- setHeading: (attrs) => {
63
- return setBlockType({ type: "heading", attrs });
64
- },
65
- insertHeading: (attrs) => {
66
- return insertNode({ type: "heading", attrs });
67
- },
68
- toggleHeading: (attrs) => {
69
- return toggleNode({ type: "heading", attrs });
70
- }
61
+ setHeading: (attrs) => setBlockType({ type: "heading", attrs }),
62
+ insertHeading: (attrs) => insertNode({ type: "heading", attrs }),
63
+ toggleHeading: (attrs) => toggleNode({ type: "heading", attrs })
71
64
  });
72
65
  }
73
66
  function defineHeading() {
@@ -12,31 +12,22 @@ function defineImageSpec() {
12
12
  src: { default: null }
13
13
  },
14
14
  group: "block",
15
- defining: true,
16
- draggable: true,
15
+ defining: !0,
16
+ draggable: !0,
17
17
  parseDOM: [
18
18
  {
19
19
  tag: "img[src]",
20
- getAttrs: (element) => {
21
- if (typeof element === "string") {
22
- return { src: null };
23
- }
24
- const src = element.getAttribute("src") || null;
25
- return { src };
26
- }
20
+ getAttrs: (element) => typeof element == "string" ? { src: null } : { src: element.getAttribute("src") || null }
27
21
  }
28
22
  ],
29
23
  toDOM(node) {
30
- const attrs = node.attrs;
31
- return ["img", attrs];
24
+ return ["img", node.attrs];
32
25
  }
33
26
  });
34
27
  }
35
28
  function defineImageCommands() {
36
29
  return defineCommands({
37
- insertImage: (attrs) => {
38
- return insertNode({ type: "image", attrs });
39
- }
30
+ insertImage: (attrs) => insertNode({ type: "image", attrs })
40
31
  });
41
32
  }
42
33
  function defineImage() {
@@ -4,7 +4,7 @@ import {
4
4
  defineMarkInputRule,
5
5
  defineTextBlockInputRule,
6
6
  defineWrappingInputRule
7
- } from "./chunk-LVMTQOWG.js";
7
+ } from "./chunk-PYT3MOTF.js";
8
8
  export {
9
9
  createMarkInputRule,
10
10
  defineInputRule,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  defineMarkInputRule
3
- } from "./chunk-LVMTQOWG.js";
3
+ } from "./chunk-PYT3MOTF.js";
4
4
 
5
5
  // src/italic/index.ts
6
6
  import {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  defineMarkRule
3
- } from "./chunk-ZOBSD7ZH.js";
3
+ } from "./chunk-ZPEMHYTU.js";
4
4
  import {
5
5
  defineInputRule
6
- } from "./chunk-LVMTQOWG.js";
6
+ } from "./chunk-PYT3MOTF.js";
7
7
  import {
8
8
  defineEnterRule
9
- } from "./chunk-DZAKXWWF.js";
9
+ } from "./chunk-2JYT2MT7.js";
10
10
 
11
11
  // src/link/index.ts
12
12
  import {
@@ -21,41 +21,29 @@ import {
21
21
  import { InputRule } from "@prosekit/pm/inputrules";
22
22
 
23
23
  // src/link/link-regex.ts
24
- var TLD_RE_PATTERN = "a(?:a(?:a|rp)|b(?:arth|b(?:ott|vie)?|c|le|ogado|udhabi)|c(?:ademy|c(?:enture|ountants?)|o|tor)?|d(?:s|ult)?|e(?:g|ro|tna)?|f(?:l|rica)?|g(?:akhan|ency)?|i(?:g|r(?:bus|force|tel))?|kdn|l(?:faromeo|i(?:baba|pay)|l(?:finanz|state|y)|s(?:ace|tom))?|m(?:azon|e(?:rican(?:express|family)|x)|fam|ica|sterdam)?|n(?:alytics|droid|quan|z)|ol?|p(?:artments|p(?:le)?)|q(?:uarelle)?|r(?:a(?:b|mco)|chi|my|pa|te?)?|s(?:da|ia|sociates)?|t(?:hleta|torney)?|u(?:ction|di(?:ble|o)?|spost|t(?:hor|os?))?|vianca|ws?|xa?|z(?:ure)?)|b(?:a(?:by|idu|n(?:a(?:mex|narepublic)|d|k)|r(?:c(?:elona|lay(?:card|s))|efoot|gains)?|s(?:eball|ketball)|uhaus|yern)?|b(?:c|t|va)?|c[gn]|d|e(?:a(?:ts|uty)|er|ntley|rlin|st(?:buy)?|t)?|f|g|h(?:arti)?|i(?:ble|d|ke|ngo?|o|z)?|j|l(?:ack(?:friday)?|o(?:ckbuster|g|omberg)|ue)|m[sw]?|n(?:pparibas)?|o(?:ats|ehringer|fa|m|nd|o(?:k(?:ing)?)?|s(?:ch|t(?:ik|on))|t|utique|x)?|r(?:adesco|idgestone|o(?:adway|ker|ther)|ussels)?|s|t|u(?:ild(?:ers)?|siness|y|zz)|v|w|y|zh?)|c(?:a(?:b|fe|l(?:l|vinklein)?|m(?:era|p)?|non|p(?:etown|ital(?:one)?)|r(?:avan|ds|e(?:ers?)?|s)?|s(?:a|e|h|ino)|t(?:ering|holic)?)?|b(?:a|n|re|s)|c|d|e(?:nter|o|rn)|f[ad]?|g|h(?:a(?:n(?:el|nel)|rity|se|t)|eap|intai|r(?:istmas|ome)|urch)?|i(?:priani|rcle|sco|t(?:adel|ic?|y(?:eats)?))?|k|l(?:aims|eaning|i(?:ck|ni(?:c|que))|o(?:thing|ud)|ub(?:med)?)?|m|n|o(?:ach|des|ffee|l(?:lege|ogne)|m(?:cast|m(?:bank|unity)|p(?:a(?:ny|re)|uter)|sec)?|n(?:dos|s(?:truction|ulting)|t(?:act|ractors))|o(?:king(?:channel)?|l|p)|rsica|u(?:ntry|pons?|rses))?|pa|r(?:edit(?:card|union)?|icket|own|s|uises?)?|u(?:isinella)?|v|w|x|y(?:mru|ou)?|z)|d(?:a(?:bur|d|nce|t(?:a|e|ing|sun)|y)|clk|ds|e(?:al(?:er|s)?|gree|l(?:ivery|l|oitte|ta)|mocrat|nt(?:al|ist)|si(?:gn)?|v)?|hl|i(?:amonds|et|gital|rect(?:ory)?|s(?:co(?:unt|ver)|h)|y)|j|k|m|np|o(?:c(?:s|tor)|g|mains|t|wnload)?|rive|tv|u(?:bai|nlop|pont|rban)|v(?:ag|r)|z)|e(?:a(?:rth|t)|co?|d(?:eka|u(?:cation)?)|e|g|m(?:ail|erck)|n(?:ergy|gineer(?:ing)?|terprises)|pson|quipment|r(?:icsson|ni)?|s(?:q|tate)?|t(?:isalat)?|u(?:rovision|s)?|vents|x(?:change|p(?:ert|osed|ress)|traspace))|f(?:a(?:ge|i(?:l|rwinds|th)|mily|ns?|rm(?:ers)?|s(?:hion|t))|e(?:dex|edback|rr(?:ari|ero))|i(?:at|d(?:elity|o)|lm|na(?:l|nc(?:e|ial))|r(?:e(?:stone)?|mdale)|sh(?:ing)?|t(?:ness)?)?|j|k|l(?:i(?:ckr|ghts|r)|o(?:rist|wers)|y)|m|o(?:o(?:d(?:network)?|tball)?|r(?:d|ex|sale|um)|undation|x)?|r(?:e(?:e|senius)|l|o(?:gans|nt(?:door|ier)))?|tr|u(?:jitsu|nd?|rniture|tbol)|yi)|g(?:a(?:l(?:l(?:ery|o|up))?|mes?|p|rden|y)?|b(?:iz)?|dn?|e(?:a|nt(?:ing)?|orge)?|f|g(?:ee)?|h|i(?:fts?|v(?:es|ing))?|l(?:ass|e|ob(?:al|o))?|m(?:ail|bh|o|x)?|n|o(?:daddy|l(?:d(?:point)?|f)|o(?:dyear|g(?:le)?)?|p|t|v)|p|q|r(?:a(?:inger|phics|tis)|een|ipe|o(?:cery|up))?|s|t|u(?:ardian|cci|ge|i(?:de|tars)|ru)?|w|y)|h(?:a(?:ir|mburg|ngout|us)|bo|dfc(?:bank)?|e(?:alth(?:care)?|l(?:p|sinki)|r(?:e|mes))|gtv|i(?:phop|samitsu|tachi|v)|kt?|m|n|o(?:ckey|l(?:dings|iday)|me(?:depot|goods|s(?:ense)?)|nda|rse|s(?:pital|t(?:ing)?)|t(?:el(?:es|s)|mail)?|use|w)|r|sbc|t|u(?:ghes)?|y(?:att|undai))|i(?:bm|c(?:bc|e|u)|d|e(?:ee)?|fm|kano|l|m(?:amat|db|mo(?:bilien)?)?|n(?:c|dustries|f(?:initi|o)|g|k|s(?:titute|ur(?:ance|e))|t(?:ernational|uit)?|vestments)?|o|piranga|q|r(?:ish)?|s(?:maili|t(?:anbul)?)?|t(?:au|v)?)|j(?:a(?:guar|va)|cb|e(?:ep|tzt|welry)?|io|ll|mp?|nj|o(?:b(?:s|urg)|t|y)?|p(?:morgan|rs)?|u(?:egos|niper))|k(?:aufen|ddi|e(?:rry(?:hotels|logistics|properties))?|fh|g|h|i(?:a|ds|m|nd(?:er|le)|tchen|wi)?|m|n|o(?:eln|matsu|sher)|p(?:mg|n)?|r(?:d|ed)?|uokgroup|w|y(?:oto)?|z)|l(?:a(?:caixa|m(?:borghini|er)|n(?:c(?:aster|ia)|d(?:rover)?|xess)|salle|t(?:ino|robe)?|w(?:yer)?)?|b|c|ds|e(?:ase|clerc|frak|g(?:al|o)|xus)|gbt|i(?:dl|fe(?:insurance|style)?|ghting|ke|lly|m(?:ited|o)|n(?:coln|de|k)|psy|v(?:e|ing))?|k|l[cp]|o(?:ans?|c(?:ker|us)|l|ndon|tt[eo]|ve)|pl(?:financial)?|r|s|t(?:da?)?|u(?:ndbeck|x(?:e|ury))?|v|y)|m(?:a(?:cys|drid|i(?:f|son)|keup|n(?:agement|go)?|p|r(?:ket(?:ing|s)?|riott|shalls)|serati|ttel)?|ba|c(?:kinsey)?|d|e(?:d(?:ia)?|et|lbourne|m(?:e|orial)|nu?|rckmsd)?|g|h|i(?:ami|crosoft|l|n[it]|t(?:subishi)?)|k|l[bs]?|ma?|n|o(?:bi(?:le)?|da|e|i|m|n(?:ash|ey|ster)|r(?:mon|tgage)|scow|to(?:rcycles)?|v(?:ie)?)?|p|q|r|sd?|t[nr]?|u(?:s(?:eum|ic)|tual)?|v|w|x|y|z)|n(?:a(?:b|goya|me|tura|vy)?|ba|c|e(?:c|t(?:bank|flix|work)?|ustar|ws?|x(?:t(?:direct)?|us))?|fl?|go?|hk|i(?:co|k(?:e|on)|nja|ssa[ny])?|l|o(?:kia|rt(?:hwesternmutual|on)|w(?:ruz|tv)?)?|p|r[aw]?|tt|u|yc|z)|o(?:b(?:i|server)|ffice|kinawa|l(?:ayan(?:group)?|dnavy|lo)|m(?:ega)?|n(?:e|g|l(?:ine)?)|oo|pen|r(?:a(?:cle|nge)|g(?:anic)?|igins)|saka|t(?:suka|t)|vh)|p(?:a(?:ge|nasonic|r(?:is|s|t(?:ners|s|y))|ssagens|y)?|ccw|et?|f(?:izer)?|g|h(?:armacy|d|ilips|o(?:ne|to(?:graphy|s)?)|ysio)?|i(?:c(?:s|t(?:et|ures))|d|n[gk]?|oneer|zza)|k|l(?:a(?:ce|y(?:station)?)|u(?:mbing|s))?|m|nc?|o(?:hl|ker|litie|rn|st)|r(?:a(?:merica|xi)|ess|ime|o(?:d(?:uctions)?|f|gressive|mo|pert(?:ies|y)|tection)?|u(?:dential)?)?|s|t|ub|wc?|y)|q(?:a|pon|ue(?:bec|st))|r(?:a(?:cing|dio)|e(?:a(?:d|l(?:estate|t(?:or|y)))|cipes|d(?:stone|umbrella)?|hab|i(?:sen?|t)|liance|n(?:t(?:als)?)?|p(?:air|ort|ublican)|st(?:aurant)?|views?|xroth)?|i(?:c(?:h(?:ardli)?|oh)|l|o|p)|o(?:c(?:her|ks)|deo|gers|om)?|s(?:vp)?|u(?:gby|hr|n)?|we?|yukyu)|s(?:a(?:arland|fe(?:ty)?|kura|l(?:e|on)|ms(?:club|ung)|n(?:dvik(?:coromant)?|ofi)|p|rl|s|ve|xo)?|b[is]?|c(?:a|b|h(?:aeffler|midt|o(?:larships|ol)|ule|warz)|ience|ot)?|d|e(?:a(?:rch|t)|cur(?:e|ity)|ek|lect|ner|rvices|ven|w|xy?)?|fr|g|h(?:a(?:ngrila|rp|w)|ell|i(?:a|ksha)|o(?:es|p(?:ping)?|uji|w(?:time)?))?|i(?:lk|n(?:a|gles)|te)?|j|k(?:in?|y(?:pe)?)?|l(?:ing)?|m(?:art|ile)?|n(?:cf)?|o(?:c(?:cer|ial)|ft(?:bank|ware)|hu|l(?:ar|utions)|n[gy]|y)?|p(?:a(?:ce)?|o(?:rt|t))|rl?|s|t(?:a(?:da|ples|r|te(?:bank|farm))|c(?:group)?|o(?:ckholm|r(?:age|e))|ream|ud(?:io|y)|yle)?|u(?:cks|pp(?:l(?:ies|y)|ort)|r(?:f|gery)|zuki)?|v|w(?:atch|iss)|x|y(?:dney|stems)?|z)|t(?:a(?:b|ipei|lk|obao|rget|t(?:a(?:motors|r)|too)|xi?)|ci?|dk?|e(?:am|ch(?:nology)?|l|masek|nnis|va)|f|g|h(?:d|eat(?:er|re))?|i(?:aa|ckets|enda|ffany|ps|r(?:es|ol))|j(?:maxx|x)?|k(?:maxx)?|l|m(?:all)?|n|o(?:day|kyo|ols|p|ray|shiba|tal|urs|wn|y(?:ota|s))?|r(?:a(?:d(?:e|ing)|ining|vel(?:channel|ers(?:insurance)?)?)|ust|v)?|t|u(?:be|i|nes|shu)|vs?|w|z)|u(?:a|b(?:ank|s)|g|k|n(?:i(?:com|versity)|o)|ol|ps|s|y|z)|v(?:a(?:cations|n(?:a|guard))?|c|e(?:gas|ntures|r(?:isign|sicherung)|t)?|g|i(?:ajes|deo|g|king|llas|n|p|rgin|s(?:a|ion)|v[ao])?|laanderen|n|o(?:dka|l(?:kswagen|vo)|t(?:e|ing|o)|yage)|u(?:elos)?)|w(?:a(?:l(?:es|mart|ter)|ng(?:gou)?|tch(?:es)?)|e(?:ather(?:channel)?|b(?:cam|er|site)|d(?:ding)?|i(?:bo|r))|f|hoswho|i(?:en|ki|lliamhill|n(?:dows|e|ners)?)|me|o(?:lterskluwer|odside|r(?:ks?|ld)|w)|s|t[cf])|x(?:box|erox|finity|i(?:huan|n)|xx|yz)|y(?:a(?:chts|hoo|maxun|ndex)|e|o(?:dobashi|ga|kohama|u(?:tube)?)|t|un)|z(?:a(?:ppos|ra)?|ero|ip|m|one|uerich|w)";
25
- var PUNCTUATION_CHAR_PATTERN = "\\.\\,\\;\\!\\?";
26
- var STOP_CHAR_PATTERN = "[" + PUNCTUATION_CHAR_PATTERN + "]";
27
- var END_CHAR_PATTERN = "[^\\s" + PUNCTUATION_CHAR_PATTERN + "]";
28
- var LINK_RE_BASE_PATTERN = (
24
+ var TLD_RE_PATTERN = "a(?:a(?:a|rp)|b(?:arth|b(?:ott|vie)?|c|le|ogado|udhabi)|c(?:ademy|c(?:enture|ountants?)|o|tor)?|d(?:s|ult)?|e(?:g|ro|tna)?|f(?:l|rica)?|g(?:akhan|ency)?|i(?:g|r(?:bus|force|tel))?|kdn|l(?:faromeo|i(?:baba|pay)|l(?:finanz|state|y)|s(?:ace|tom))?|m(?:azon|e(?:rican(?:express|family)|x)|fam|ica|sterdam)?|n(?:alytics|droid|quan|z)|ol?|p(?:artments|p(?:le)?)|q(?:uarelle)?|r(?:a(?:b|mco)|chi|my|pa|te?)?|s(?:da|ia|sociates)?|t(?:hleta|torney)?|u(?:ction|di(?:ble|o)?|spost|t(?:hor|os?))?|vianca|ws?|xa?|z(?:ure)?)|b(?:a(?:by|idu|n(?:a(?:mex|narepublic)|d|k)|r(?:c(?:elona|lay(?:card|s))|efoot|gains)?|s(?:eball|ketball)|uhaus|yern)?|b(?:c|t|va)?|c[gn]|d|e(?:a(?:ts|uty)|er|ntley|rlin|st(?:buy)?|t)?|f|g|h(?:arti)?|i(?:ble|d|ke|ngo?|o|z)?|j|l(?:ack(?:friday)?|o(?:ckbuster|g|omberg)|ue)|m[sw]?|n(?:pparibas)?|o(?:ats|ehringer|fa|m|nd|o(?:k(?:ing)?)?|s(?:ch|t(?:ik|on))|t|utique|x)?|r(?:adesco|idgestone|o(?:adway|ker|ther)|ussels)?|s|t|u(?:ild(?:ers)?|siness|y|zz)|v|w|y|zh?)|c(?:a(?:b|fe|l(?:l|vinklein)?|m(?:era|p)?|non|p(?:etown|ital(?:one)?)|r(?:avan|ds|e(?:ers?)?|s)?|s(?:a|e|h|ino)|t(?:ering|holic)?)?|b(?:a|n|re|s)|c|d|e(?:nter|o|rn)|f[ad]?|g|h(?:a(?:n(?:el|nel)|rity|se|t)|eap|intai|r(?:istmas|ome)|urch)?|i(?:priani|rcle|sco|t(?:adel|ic?|y(?:eats)?))?|k|l(?:aims|eaning|i(?:ck|ni(?:c|que))|o(?:thing|ud)|ub(?:med)?)?|m|n|o(?:ach|des|ffee|l(?:lege|ogne)|m(?:cast|m(?:bank|unity)|p(?:a(?:ny|re)|uter)|sec)?|n(?:dos|s(?:truction|ulting)|t(?:act|ractors))|o(?:king(?:channel)?|l|p)|rsica|u(?:ntry|pons?|rses))?|pa|r(?:edit(?:card|union)?|icket|own|s|uises?)?|u(?:isinella)?|v|w|x|y(?:mru|ou)?|z)|d(?:a(?:bur|d|nce|t(?:a|e|ing|sun)|y)|clk|ds|e(?:al(?:er|s)?|gree|l(?:ivery|l|oitte|ta)|mocrat|nt(?:al|ist)|si(?:gn)?|v)?|hl|i(?:amonds|et|gital|rect(?:ory)?|s(?:co(?:unt|ver)|h)|y)|j|k|m|np|o(?:c(?:s|tor)|g|mains|t|wnload)?|rive|tv|u(?:bai|nlop|pont|rban)|v(?:ag|r)|z)|e(?:a(?:rth|t)|co?|d(?:eka|u(?:cation)?)|e|g|m(?:ail|erck)|n(?:ergy|gineer(?:ing)?|terprises)|pson|quipment|r(?:icsson|ni)?|s(?:q|tate)?|t(?:isalat)?|u(?:rovision|s)?|vents|x(?:change|p(?:ert|osed|ress)|traspace))|f(?:a(?:ge|i(?:l|rwinds|th)|mily|ns?|rm(?:ers)?|s(?:hion|t))|e(?:dex|edback|rr(?:ari|ero))|i(?:at|d(?:elity|o)|lm|na(?:l|nc(?:e|ial))|r(?:e(?:stone)?|mdale)|sh(?:ing)?|t(?:ness)?)?|j|k|l(?:i(?:ckr|ghts|r)|o(?:rist|wers)|y)|m|o(?:o(?:d(?:network)?|tball)?|r(?:d|ex|sale|um)|undation|x)?|r(?:e(?:e|senius)|l|o(?:gans|nt(?:door|ier)))?|tr|u(?:jitsu|nd?|rniture|tbol)|yi)|g(?:a(?:l(?:l(?:ery|o|up))?|mes?|p|rden|y)?|b(?:iz)?|dn?|e(?:a|nt(?:ing)?|orge)?|f|g(?:ee)?|h|i(?:fts?|v(?:es|ing))?|l(?:ass|e|ob(?:al|o))?|m(?:ail|bh|o|x)?|n|o(?:daddy|l(?:d(?:point)?|f)|o(?:dyear|g(?:le)?)?|p|t|v)|p|q|r(?:a(?:inger|phics|tis)|een|ipe|o(?:cery|up))?|s|t|u(?:ardian|cci|ge|i(?:de|tars)|ru)?|w|y)|h(?:a(?:ir|mburg|ngout|us)|bo|dfc(?:bank)?|e(?:alth(?:care)?|l(?:p|sinki)|r(?:e|mes))|gtv|i(?:phop|samitsu|tachi|v)|kt?|m|n|o(?:ckey|l(?:dings|iday)|me(?:depot|goods|s(?:ense)?)|nda|rse|s(?:pital|t(?:ing)?)|t(?:el(?:es|s)|mail)?|use|w)|r|sbc|t|u(?:ghes)?|y(?:att|undai))|i(?:bm|c(?:bc|e|u)|d|e(?:ee)?|fm|kano|l|m(?:amat|db|mo(?:bilien)?)?|n(?:c|dustries|f(?:initi|o)|g|k|s(?:titute|ur(?:ance|e))|t(?:ernational|uit)?|vestments)?|o|piranga|q|r(?:ish)?|s(?:maili|t(?:anbul)?)?|t(?:au|v)?)|j(?:a(?:guar|va)|cb|e(?:ep|tzt|welry)?|io|ll|mp?|nj|o(?:b(?:s|urg)|t|y)?|p(?:morgan|rs)?|u(?:egos|niper))|k(?:aufen|ddi|e(?:rry(?:hotels|logistics|properties))?|fh|g|h|i(?:a|ds|m|nd(?:er|le)|tchen|wi)?|m|n|o(?:eln|matsu|sher)|p(?:mg|n)?|r(?:d|ed)?|uokgroup|w|y(?:oto)?|z)|l(?:a(?:caixa|m(?:borghini|er)|n(?:c(?:aster|ia)|d(?:rover)?|xess)|salle|t(?:ino|robe)?|w(?:yer)?)?|b|c|ds|e(?:ase|clerc|frak|g(?:al|o)|xus)|gbt|i(?:dl|fe(?:insurance|style)?|ghting|ke|lly|m(?:ited|o)|n(?:coln|de|k)|psy|v(?:e|ing))?|k|l[cp]|o(?:ans?|c(?:ker|us)|l|ndon|tt[eo]|ve)|pl(?:financial)?|r|s|t(?:da?)?|u(?:ndbeck|x(?:e|ury))?|v|y)|m(?:a(?:cys|drid|i(?:f|son)|keup|n(?:agement|go)?|p|r(?:ket(?:ing|s)?|riott|shalls)|serati|ttel)?|ba|c(?:kinsey)?|d|e(?:d(?:ia)?|et|lbourne|m(?:e|orial)|nu?|rckmsd)?|g|h|i(?:ami|crosoft|l|n[it]|t(?:subishi)?)|k|l[bs]?|ma?|n|o(?:bi(?:le)?|da|e|i|m|n(?:ash|ey|ster)|r(?:mon|tgage)|scow|to(?:rcycles)?|v(?:ie)?)?|p|q|r|sd?|t[nr]?|u(?:s(?:eum|ic)|tual)?|v|w|x|y|z)|n(?:a(?:b|goya|me|tura|vy)?|ba|c|e(?:c|t(?:bank|flix|work)?|ustar|ws?|x(?:t(?:direct)?|us))?|fl?|go?|hk|i(?:co|k(?:e|on)|nja|ssa[ny])?|l|o(?:kia|rt(?:hwesternmutual|on)|w(?:ruz|tv)?)?|p|r[aw]?|tt|u|yc|z)|o(?:b(?:i|server)|ffice|kinawa|l(?:ayan(?:group)?|dnavy|lo)|m(?:ega)?|n(?:e|g|l(?:ine)?)|oo|pen|r(?:a(?:cle|nge)|g(?:anic)?|igins)|saka|t(?:suka|t)|vh)|p(?:a(?:ge|nasonic|r(?:is|s|t(?:ners|s|y))|ssagens|y)?|ccw|et?|f(?:izer)?|g|h(?:armacy|d|ilips|o(?:ne|to(?:graphy|s)?)|ysio)?|i(?:c(?:s|t(?:et|ures))|d|n[gk]?|oneer|zza)|k|l(?:a(?:ce|y(?:station)?)|u(?:mbing|s))?|m|nc?|o(?:hl|ker|litie|rn|st)|r(?:a(?:merica|xi)|ess|ime|o(?:d(?:uctions)?|f|gressive|mo|pert(?:ies|y)|tection)?|u(?:dential)?)?|s|t|ub|wc?|y)|q(?:a|pon|ue(?:bec|st))|r(?:a(?:cing|dio)|e(?:a(?:d|l(?:estate|t(?:or|y)))|cipes|d(?:stone|umbrella)?|hab|i(?:sen?|t)|liance|n(?:t(?:als)?)?|p(?:air|ort|ublican)|st(?:aurant)?|views?|xroth)?|i(?:c(?:h(?:ardli)?|oh)|l|o|p)|o(?:c(?:her|ks)|deo|gers|om)?|s(?:vp)?|u(?:gby|hr|n)?|we?|yukyu)|s(?:a(?:arland|fe(?:ty)?|kura|l(?:e|on)|ms(?:club|ung)|n(?:dvik(?:coromant)?|ofi)|p|rl|s|ve|xo)?|b[is]?|c(?:a|b|h(?:aeffler|midt|o(?:larships|ol)|ule|warz)|ience|ot)?|d|e(?:a(?:rch|t)|cur(?:e|ity)|ek|lect|ner|rvices|ven|w|xy?)?|fr|g|h(?:a(?:ngrila|rp|w)|ell|i(?:a|ksha)|o(?:es|p(?:ping)?|uji|w(?:time)?))?|i(?:lk|n(?:a|gles)|te)?|j|k(?:in?|y(?:pe)?)?|l(?:ing)?|m(?:art|ile)?|n(?:cf)?|o(?:c(?:cer|ial)|ft(?:bank|ware)|hu|l(?:ar|utions)|n[gy]|y)?|p(?:a(?:ce)?|o(?:rt|t))|rl?|s|t(?:a(?:da|ples|r|te(?:bank|farm))|c(?:group)?|o(?:ckholm|r(?:age|e))|ream|ud(?:io|y)|yle)?|u(?:cks|pp(?:l(?:ies|y)|ort)|r(?:f|gery)|zuki)?|v|w(?:atch|iss)|x|y(?:dney|stems)?|z)|t(?:a(?:b|ipei|lk|obao|rget|t(?:a(?:motors|r)|too)|xi?)|ci?|dk?|e(?:am|ch(?:nology)?|l|masek|nnis|va)|f|g|h(?:d|eat(?:er|re))?|i(?:aa|ckets|enda|ffany|ps|r(?:es|ol))|j(?:maxx|x)?|k(?:maxx)?|l|m(?:all)?|n|o(?:day|kyo|ols|p|ray|shiba|tal|urs|wn|y(?:ota|s))?|r(?:a(?:d(?:e|ing)|ining|vel(?:channel|ers(?:insurance)?)?)|ust|v)?|t|u(?:be|i|nes|shu)|vs?|w|z)|u(?:a|b(?:ank|s)|g|k|n(?:i(?:com|versity)|o)|ol|ps|s|y|z)|v(?:a(?:cations|n(?:a|guard))?|c|e(?:gas|ntures|r(?:isign|sicherung)|t)?|g|i(?:ajes|deo|g|king|llas|n|p|rgin|s(?:a|ion)|v[ao])?|laanderen|n|o(?:dka|l(?:kswagen|vo)|t(?:e|ing|o)|yage)|u(?:elos)?)|w(?:a(?:l(?:es|mart|ter)|ng(?:gou)?|tch(?:es)?)|e(?:ather(?:channel)?|b(?:cam|er|site)|d(?:ding)?|i(?:bo|r))|f|hoswho|i(?:en|ki|lliamhill|n(?:dows|e|ners)?)|me|o(?:lterskluwer|odside|r(?:ks?|ld)|w)|s|t[cf])|x(?:box|erox|finity|i(?:huan|n)|xx|yz)|y(?:a(?:chts|hoo|maxun|ndex)|e|o(?:dobashi|ga|kohama|u(?:tube)?)|t|un)|z(?:a(?:ppos|ra)?|ero|ip|m|one|uerich|w)", PUNCTUATION_CHAR_PATTERN = "\\.\\,\\;\\!\\?", STOP_CHAR_PATTERN = "[" + PUNCTUATION_CHAR_PATTERN + "]", END_CHAR_PATTERN = "[^\\s" + PUNCTUATION_CHAR_PATTERN + "]", LINK_RE_BASE_PATTERN = (
29
25
  // start of the link group
30
26
  "((?:(?:(?:https?:)?\\/\\/)?(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:" + TLD_RE_PATTERN + "))(?::\\d{2,5})?(?:/(?:\\S*" + END_CHAR_PATTERN + ")?)?(?:\\?(?:\\S*" + END_CHAR_PATTERN + "))?(?:\\#(?:\\S*" + END_CHAR_PATTERN + ")?)?)"
31
- );
32
- var LINK_ENTER_PATTERN = LINK_RE_BASE_PATTERN + STOP_CHAR_PATTERN + "?$";
33
- var LINK_INPUT_PATTERN = LINK_RE_BASE_PATTERN + STOP_CHAR_PATTERN + "?\\s$";
34
- var LINK_MARK_PATTERN = LINK_RE_BASE_PATTERN + "(?=" + STOP_CHAR_PATTERN + "|\\s|$)";
35
- var LINK_ENTER_RE = new RegExp(LINK_ENTER_PATTERN, "gi");
36
- var LINK_INPUT_RE = new RegExp(LINK_INPUT_PATTERN, "gi");
37
- var LINK_MARK_RE = new RegExp(LINK_MARK_PATTERN, "gi");
27
+ ), LINK_ENTER_PATTERN = LINK_RE_BASE_PATTERN + STOP_CHAR_PATTERN + "?$", LINK_INPUT_PATTERN = LINK_RE_BASE_PATTERN + STOP_CHAR_PATTERN + "?\\s$", LINK_MARK_PATTERN = LINK_RE_BASE_PATTERN + "(?=" + STOP_CHAR_PATTERN + "|\\s|$)", LINK_ENTER_RE = new RegExp(LINK_ENTER_PATTERN, "gi"), LINK_INPUT_RE = new RegExp(LINK_INPUT_PATTERN, "gi"), LINK_MARK_RE = new RegExp(LINK_MARK_PATTERN, "gi");
38
28
 
39
29
  // src/link/index.ts
40
30
  function defineLinkSpec() {
41
31
  return defineMarkSpec({
42
32
  name: "link",
43
- inclusive: false,
33
+ inclusive: !1,
44
34
  parseDOM: [
45
35
  {
46
36
  tag: "a[href]",
47
- getAttrs: (dom) => {
48
- return {
49
- href: dom.getAttribute("href")
50
- };
51
- }
37
+ getAttrs: (dom) => ({
38
+ href: dom.getAttribute("href")
39
+ })
52
40
  }
53
41
  ],
54
42
  attrs: {
55
43
  href: {}
56
44
  },
57
45
  toDOM(node) {
58
- const { href } = node.attrs;
46
+ let { href } = node.attrs;
59
47
  return ["a", { href }, 0];
60
48
  }
61
49
  });
@@ -71,10 +59,9 @@ function defineLinkCommands() {
71
59
  function defineLinkInputRule() {
72
60
  return defineInputRule(
73
61
  new InputRule(LINK_INPUT_RE, (state, match, from) => {
74
- const href = match[1];
75
- if (!href)
76
- return null;
77
- const mark = state.schema.marks.link.create({ href });
62
+ let href = match[1];
63
+ if (!href) return null;
64
+ let mark = state.schema.marks.link.create({ href });
78
65
  return state.tr.addMark(from, from + href.length, mark).insertText(" ");
79
66
  })
80
67
  );
@@ -83,11 +70,9 @@ function defineLinkEnterRule() {
83
70
  return defineEnterRule({
84
71
  regex: LINK_ENTER_RE,
85
72
  handler: ({ state, from, match }) => {
86
- const href = match[1];
87
- if (!href)
88
- return null;
89
- const mark = state.schema.marks.link.create({ href });
90
- const tr = state.tr.addMark(from, from + href.length, mark);
73
+ let href = match[1];
74
+ if (!href) return null;
75
+ let mark = state.schema.marks.link.create({ href }), tr = state.tr.addMark(from, from + href.length, mark);
91
76
  return tr.docChanged ? tr : null;
92
77
  }
93
78
  });