@prosekit/extensions 0.0.0-next-20240427202431 → 0.0.0-next-20240427204211
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.
@@ -415,10 +415,19 @@ expandLink: [];
|
|
415
415
|
};
|
416
416
|
}>;
|
417
417
|
|
418
|
+
/**
|
419
|
+
* Apply link marks after typing Enter.
|
420
|
+
*/
|
418
421
|
export declare function defineLinkEnterRule(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
419
422
|
|
423
|
+
/**
|
424
|
+
* Apply link marks after pressing Space.
|
425
|
+
*/
|
420
426
|
export declare function defineLinkInputRule(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
421
427
|
|
428
|
+
/**
|
429
|
+
* Apply and remove link marks to the text during typing.
|
430
|
+
*/
|
422
431
|
export declare function defineLinkMarkRule(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
423
432
|
|
424
433
|
export declare function defineLinkSpec(): Extension< {
|
@@ -812,9 +821,11 @@ export declare function insertTable({ row, col, header, }: {
|
|
812
821
|
header: boolean;
|
813
822
|
}): Command;
|
814
823
|
|
815
|
-
export declare const
|
824
|
+
export declare const LINK_ENTER_RE: RegExp;
|
825
|
+
|
826
|
+
export declare const LINK_INPUT_RE: RegExp;
|
816
827
|
|
817
|
-
export declare const
|
828
|
+
export declare const LINK_MARK_RE: RegExp;
|
818
829
|
|
819
830
|
/**
|
820
831
|
* @public
|
@@ -27,10 +27,12 @@ var LINK_RE_BASE_PATTERN = (
|
|
27
27
|
"((?:(?:(?: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*)?)"
|
28
28
|
);
|
29
29
|
var LINK_STOP_PATTERN = "(?:\\.|\\,|\\;\\!)?";
|
30
|
-
var
|
31
|
-
var
|
32
|
-
var
|
33
|
-
var
|
30
|
+
var LINK_ENTER_PATTERN = LINK_RE_BASE_PATTERN + LINK_STOP_PATTERN + "$";
|
31
|
+
var LINK_INPUT_PATTERN = LINK_RE_BASE_PATTERN + LINK_STOP_PATTERN + "\\s$";
|
32
|
+
var LINK_MARK_PATTERN = LINK_RE_BASE_PATTERN + LINK_STOP_PATTERN;
|
33
|
+
var LINK_ENTER_RE = new RegExp(LINK_ENTER_PATTERN, "gi");
|
34
|
+
var LINK_INPUT_RE = new RegExp(LINK_INPUT_PATTERN, "gi");
|
35
|
+
var LINK_MARK_RE = new RegExp(LINK_MARK_PATTERN, "gi");
|
34
36
|
|
35
37
|
// src/link/index.ts
|
36
38
|
function defineLinkSpec() {
|
@@ -66,7 +68,7 @@ function defineLinkCommands() {
|
|
66
68
|
}
|
67
69
|
function defineLinkInputRule() {
|
68
70
|
return defineInputRule(
|
69
|
-
new InputRule(
|
71
|
+
new InputRule(LINK_INPUT_RE, (state, match, from) => {
|
70
72
|
const href = match[1];
|
71
73
|
if (!href)
|
72
74
|
return null;
|
@@ -77,7 +79,7 @@ function defineLinkInputRule() {
|
|
77
79
|
}
|
78
80
|
function defineLinkEnterRule() {
|
79
81
|
return defineEnterRule({
|
80
|
-
regex:
|
82
|
+
regex: LINK_ENTER_RE,
|
81
83
|
handler: ({ state, from, match }) => {
|
82
84
|
const href = match[1];
|
83
85
|
if (!href)
|
@@ -90,7 +92,7 @@ function defineLinkEnterRule() {
|
|
90
92
|
}
|
91
93
|
function defineLinkMarkRule() {
|
92
94
|
return defineMarkRule({
|
93
|
-
regex:
|
95
|
+
regex: LINK_MARK_RE,
|
94
96
|
type: "link",
|
95
97
|
attrs: (match) => ({ href: match[1] })
|
96
98
|
});
|
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-
|
4
|
+
"version": "0.0.0-next-20240427204211",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -152,8 +152,8 @@
|
|
152
152
|
"dist"
|
153
153
|
],
|
154
154
|
"dependencies": {
|
155
|
-
"@prosekit/core": "0.0.0-next-
|
156
|
-
"@prosekit/pm": "0.0.0-next-
|
155
|
+
"@prosekit/core": "0.0.0-next-20240427204211",
|
156
|
+
"@prosekit/pm": "0.0.0-next-20240427204211",
|
157
157
|
"prosemirror-dropcursor": "^1.8.1",
|
158
158
|
"prosemirror-flat-list": "^0.5.0",
|
159
159
|
"prosemirror-highlight": "^0.5.0",
|