@prosekit/extensions 0.0.0-next-20240724172520 → 0.0.0-next-20240901092634
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/dist/_tsup-dts-rollup.d.ts +520 -129
- package/dist/{chunk-GPSAJOJA.js → chunk-GITDYNLT.js} +0 -3
- package/dist/{chunk-LVMTQOWG.js → chunk-LAQZC3ZM.js} +12 -14
- package/dist/{chunk-OJCMRVEY.js → chunk-RE23OQPF.js} +2 -2
- package/dist/loro/style.css +30 -0
- package/dist/prosekit-extensions-autocomplete.js +3 -2
- package/dist/prosekit-extensions-blockquote.js +2 -2
- package/dist/prosekit-extensions-bold.js +3 -3
- package/dist/prosekit-extensions-code-block.d.ts +4 -0
- package/dist/prosekit-extensions-code-block.js +20 -46
- package/dist/prosekit-extensions-code.js +3 -3
- package/dist/prosekit-extensions-commit.js +9 -6
- package/dist/prosekit-extensions-enter-rule.js +1 -1
- package/dist/prosekit-extensions-gap-cursor.d.ts +1 -0
- package/dist/prosekit-extensions-heading.d.ts +1 -1
- package/dist/prosekit-extensions-heading.js +3 -3
- package/dist/prosekit-extensions-image.js +1 -1
- package/dist/prosekit-extensions-input-rule.js +1 -1
- package/dist/prosekit-extensions-italic.js +3 -3
- package/dist/prosekit-extensions-link.js +5 -5
- package/dist/prosekit-extensions-list.js +3 -3
- package/dist/prosekit-extensions-loro.d.ts +11 -0
- package/dist/prosekit-extensions-loro.js +79 -0
- package/dist/prosekit-extensions-mark-rule.js +1 -1
- package/dist/prosekit-extensions-mention.js +1 -1
- package/dist/prosekit-extensions-placeholder.js +0 -1
- package/dist/prosekit-extensions-strike.js +3 -3
- package/dist/prosekit-extensions-table.d.ts +15 -3
- package/dist/prosekit-extensions-table.js +191 -90
- package/dist/prosekit-extensions-text-align.d.ts +3 -1
- package/dist/prosekit-extensions-text-align.js +2 -2
- package/dist/prosekit-extensions-underline.js +2 -2
- package/dist/prosekit-extensions-yjs.d.ts +14 -0
- package/dist/prosekit-extensions-yjs.js +143 -0
- package/dist/shiki-highlighter-chunk-C5VVQ2TD.js +50 -0
- package/dist/table/style.css +6 -1
- package/dist/yjs/style.css +31 -0
- package/package.json +58 -10
- package/dist/shiki-import-UFUFVKJ2.js +0 -5
@@ -15,11 +15,8 @@ import {
|
|
15
15
|
getMarkType,
|
16
16
|
maybeRun
|
17
17
|
} from "@prosekit/core";
|
18
|
-
import "@prosekit/pm/model";
|
19
|
-
import "@prosekit/pm/state";
|
20
18
|
|
21
19
|
// src/mark-rule/range.ts
|
22
|
-
import "@prosekit/pm/state";
|
23
20
|
function getSpanTextRanges($from, $to) {
|
24
21
|
const nodeRange = $from.blockRange($to);
|
25
22
|
if (!nodeRange) {
|
@@ -14,10 +14,9 @@ import {
|
|
14
14
|
textblockTypeInputRule,
|
15
15
|
wrappingInputRule
|
16
16
|
} from "@prosekit/pm/inputrules";
|
17
|
-
import "@prosekit/pm/model";
|
18
17
|
import "@prosekit/pm/state";
|
19
18
|
function defineInputRule(rule) {
|
20
|
-
return
|
19
|
+
return defineInputRuleFacetPayload(() => rule);
|
21
20
|
}
|
22
21
|
function createMarkInputRule({
|
23
22
|
regex,
|
@@ -62,12 +61,10 @@ function defineTextBlockInputRule({
|
|
62
61
|
type,
|
63
62
|
attrs
|
64
63
|
}) {
|
65
|
-
return
|
66
|
-
(
|
67
|
-
|
68
|
-
|
69
|
-
}
|
70
|
-
]);
|
64
|
+
return defineInputRuleFacetPayload(({ schema }) => {
|
65
|
+
const nodeType = getNodeType(schema, type);
|
66
|
+
return textblockTypeInputRule(regex, nodeType, attrs);
|
67
|
+
});
|
71
68
|
}
|
72
69
|
function defineWrappingInputRule({
|
73
70
|
regex,
|
@@ -75,12 +72,13 @@ function defineWrappingInputRule({
|
|
75
72
|
attrs,
|
76
73
|
join
|
77
74
|
}) {
|
78
|
-
return
|
79
|
-
(
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
75
|
+
return defineInputRuleFacetPayload(({ schema }) => {
|
76
|
+
const nodeType = getNodeType(schema, type);
|
77
|
+
return wrappingInputRule(regex, nodeType, attrs, join);
|
78
|
+
});
|
79
|
+
}
|
80
|
+
function defineInputRuleFacetPayload(input) {
|
81
|
+
return defineFacetPayload(inputRuleFacet, [input]);
|
84
82
|
}
|
85
83
|
var inputRuleFacet = defineFacet({
|
86
84
|
reducer: (inputs) => {
|
@@ -0,0 +1,30 @@
|
|
1
|
+
/* src/loro/style.css */
|
2
|
+
.ProseMirror-loro-cursor:first-child {
|
3
|
+
margin-top: 16px;
|
4
|
+
}
|
5
|
+
.ProseMirror-loro-cursor {
|
6
|
+
position: relative;
|
7
|
+
margin-left: -1px;
|
8
|
+
margin-right: -1px;
|
9
|
+
border-left: 1px solid black;
|
10
|
+
border-right: 1px solid black;
|
11
|
+
border-color: orange;
|
12
|
+
word-break: normal;
|
13
|
+
pointer-events: none;
|
14
|
+
}
|
15
|
+
.ProseMirror-loro-cursor > div {
|
16
|
+
position: absolute;
|
17
|
+
top: -1.05em;
|
18
|
+
left: -1px;
|
19
|
+
font-size: 13px;
|
20
|
+
background-color: rgb(250, 129, 0);
|
21
|
+
font-family: serif;
|
22
|
+
font-style: normal;
|
23
|
+
font-weight: normal;
|
24
|
+
line-height: normal;
|
25
|
+
user-select: none;
|
26
|
+
color: white;
|
27
|
+
padding-left: 2px;
|
28
|
+
padding-right: 2px;
|
29
|
+
white-space: nowrap;
|
30
|
+
}
|
@@ -11,8 +11,9 @@ import { Plugin } from "@prosekit/pm/state";
|
|
11
11
|
import { Decoration, DecorationSet } from "@prosekit/pm/view";
|
12
12
|
|
13
13
|
// src/autocomplete/helpers.ts
|
14
|
-
import
|
15
|
-
|
14
|
+
import {
|
15
|
+
PluginKey
|
16
|
+
} from "@prosekit/pm/state";
|
16
17
|
function defaultCanMatch({ state }) {
|
17
18
|
return state.selection.empty && !isInsideCode(state.selection.$from);
|
18
19
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
defineWrappingInputRule
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-LAQZC3ZM.js";
|
4
4
|
|
5
5
|
// src/blockquote/index.ts
|
6
6
|
import {
|
@@ -26,7 +26,7 @@ function defineBlockquoteInputRule() {
|
|
26
26
|
});
|
27
27
|
}
|
28
28
|
function defineBlockquote() {
|
29
|
-
return union(
|
29
|
+
return union(defineBlockquoteSpec(), defineBlockquoteInputRule());
|
30
30
|
}
|
31
31
|
export {
|
32
32
|
defineBlockquote,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
defineMarkInputRule
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-LAQZC3ZM.js";
|
4
4
|
|
5
5
|
// src/bold/index.ts
|
6
6
|
import {
|
@@ -55,12 +55,12 @@ function defineBoldInputRule() {
|
|
55
55
|
});
|
56
56
|
}
|
57
57
|
function defineBold() {
|
58
|
-
return union(
|
58
|
+
return union(
|
59
59
|
defineBoldSpec(),
|
60
60
|
defineBoldCommands(),
|
61
61
|
defineBoldKeymap(),
|
62
62
|
defineBoldInputRule()
|
63
|
-
|
63
|
+
);
|
64
64
|
}
|
65
65
|
export {
|
66
66
|
defineBold,
|
@@ -1,11 +1,15 @@
|
|
1
1
|
export { defineCodeBlock_alias_1 as defineCodeBlock } from './_tsup-dts-rollup';
|
2
|
+
export { CodeBlockExtension_alias_1 as CodeBlockExtension } from './_tsup-dts-rollup';
|
2
3
|
export { defineCodeBlockCommands_alias_1 as defineCodeBlockCommands } from './_tsup-dts-rollup';
|
4
|
+
export { CodeBlockCommandsExtension_alias_1 as CodeBlockCommandsExtension } from './_tsup-dts-rollup';
|
3
5
|
export { defineCodeBlockHighlight_alias_1 as defineCodeBlockHighlight } from './_tsup-dts-rollup';
|
6
|
+
export { CodeBlockHighlightOptions_alias_1 as CodeBlockHighlightOptions } from './_tsup-dts-rollup';
|
4
7
|
export { HighlightParser_alias_1 as HighlightParser } from './_tsup-dts-rollup';
|
5
8
|
export { defineCodeBlockEnterRule_alias_1 as defineCodeBlockEnterRule } from './_tsup-dts-rollup';
|
6
9
|
export { defineCodeBlockInputRule_alias_1 as defineCodeBlockInputRule } from './_tsup-dts-rollup';
|
7
10
|
export { defineCodeBlockShiki_alias_1 as defineCodeBlockShiki } from './_tsup-dts-rollup';
|
8
11
|
export { defineCodeBlockSpec_alias_1 as defineCodeBlockSpec } from './_tsup-dts-rollup';
|
12
|
+
export { CodeBlockSpecExtension_alias_1 as CodeBlockSpecExtension } from './_tsup-dts-rollup';
|
9
13
|
export { CodeBlockAttrs_alias_1 as CodeBlockAttrs } from './_tsup-dts-rollup';
|
10
14
|
export { shikiBundledLanguagesInfo } from './_tsup-dts-rollup';
|
11
15
|
export { shikiBundledThemesInfo } from './_tsup-dts-rollup';
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import {
|
2
2
|
defineTextBlockEnterRule
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-RE23OQPF.js";
|
4
4
|
import {
|
5
5
|
defineTextBlockInputRule
|
6
|
-
} from "./chunk-
|
6
|
+
} from "./chunk-LAQZC3ZM.js";
|
7
7
|
|
8
8
|
// src/code-block/code-block.ts
|
9
9
|
import { union } from "@prosekit/core";
|
@@ -118,13 +118,13 @@ function defineCodeBlockSpec() {
|
|
118
118
|
|
119
119
|
// src/code-block/code-block.ts
|
120
120
|
function defineCodeBlock() {
|
121
|
-
return union(
|
121
|
+
return union(
|
122
122
|
defineCodeBlockSpec(),
|
123
123
|
defineCodeBlockInputRule(),
|
124
124
|
defineCodeBlockEnterRule(),
|
125
125
|
defineCodeBlockKeymap(),
|
126
126
|
defineCodeBlockCommands()
|
127
|
-
|
127
|
+
);
|
128
128
|
}
|
129
129
|
|
130
130
|
// src/code-block/code-block-highlight.ts
|
@@ -142,59 +142,33 @@ function defineCodeBlockHighlight({
|
|
142
142
|
import { createParser } from "prosemirror-highlight/shiki";
|
143
143
|
|
144
144
|
// src/code-block/shiki-highlighter.ts
|
145
|
-
var
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
const { getSingletonHighlighter } = await import("./shiki-import-UFUFVKJ2.js");
|
150
|
-
if (!highlighter) {
|
151
|
-
highlighter = await getSingletonHighlighter(options);
|
152
|
-
}
|
153
|
-
}
|
154
|
-
async function loadLanguages(langs) {
|
155
|
-
for (const lang of langs) {
|
156
|
-
if (!highlighter) break;
|
157
|
-
await highlighter.loadLanguage(lang);
|
158
|
-
loadedLangs.add(lang);
|
159
|
-
}
|
145
|
+
var loaded;
|
146
|
+
async function load() {
|
147
|
+
const { createOrGetHighlighter: createOrGetHighlighter2 } = await import("./shiki-highlighter-chunk-C5VVQ2TD.js");
|
148
|
+
loaded = createOrGetHighlighter2;
|
160
149
|
}
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
await highlighter.loadTheme(theme);
|
165
|
-
loadedThemes.add(theme);
|
166
|
-
}
|
167
|
-
}
|
168
|
-
function prepareHighlighter(options) {
|
169
|
-
if (!highlighter) {
|
170
|
-
return { promise: createHighlighter(options) };
|
171
|
-
}
|
172
|
-
const langs = options.langs.filter((lang) => !loadedLangs.has(lang));
|
173
|
-
if (langs.length > 0) {
|
174
|
-
return { promise: loadLanguages(langs) };
|
175
|
-
}
|
176
|
-
const themes = options.themes.filter((theme) => !loadedThemes.has(theme));
|
177
|
-
if (themes.length > 0) {
|
178
|
-
return { promise: loadThemes(themes) };
|
150
|
+
function createOrGetHighlighter(options) {
|
151
|
+
if (!loaded) {
|
152
|
+
return { promise: load() };
|
179
153
|
}
|
180
|
-
return
|
154
|
+
return loaded(options);
|
181
155
|
}
|
182
156
|
|
183
157
|
// src/code-block/shiki-parser.ts
|
184
158
|
function createLazyParser(highlighterOptions) {
|
185
159
|
let parser;
|
186
|
-
|
160
|
+
createOrGetHighlighter(highlighterOptions);
|
187
161
|
return function lazyParser(options) {
|
188
162
|
const language = options.language || "";
|
189
|
-
const { highlighter
|
190
|
-
|
191
|
-
|
163
|
+
const { highlighter, promise } = createOrGetHighlighter({
|
164
|
+
...highlighterOptions,
|
165
|
+
langs: [language]
|
192
166
|
});
|
193
|
-
if (!
|
167
|
+
if (!highlighter) {
|
194
168
|
return promise;
|
195
169
|
}
|
196
170
|
if (!parser) {
|
197
|
-
parser = createParser(
|
171
|
+
parser = createParser(highlighter, {
|
198
172
|
theme: highlighterOptions.themes[0]
|
199
173
|
});
|
200
174
|
}
|
@@ -206,9 +180,9 @@ function createLazyParser(highlighterOptions) {
|
|
206
180
|
function defineCodeBlockShiki({
|
207
181
|
themes = ["one-dark-pro"],
|
208
182
|
langs = ["text"],
|
209
|
-
|
183
|
+
...rest
|
210
184
|
} = {}) {
|
211
|
-
const parser = createLazyParser({ themes, langs,
|
185
|
+
const parser = createLazyParser({ themes, langs, ...rest });
|
212
186
|
return defineCodeBlockHighlight({ parser });
|
213
187
|
}
|
214
188
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
defineMarkInputRule
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-LAQZC3ZM.js";
|
4
4
|
|
5
5
|
// src/code/index.ts
|
6
6
|
import {
|
@@ -37,12 +37,12 @@ function defineCodeInputRule() {
|
|
37
37
|
});
|
38
38
|
}
|
39
39
|
function defineCode() {
|
40
|
-
return union(
|
40
|
+
return union(
|
41
41
|
defineCodeSpec(),
|
42
42
|
defineCodeCommands(),
|
43
43
|
defineCodeKeymap(),
|
44
44
|
defineCodeInputRule()
|
45
|
-
|
45
|
+
);
|
46
46
|
}
|
47
47
|
export {
|
48
48
|
defineCode,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// src/commit/index.ts
|
2
2
|
import {
|
3
|
-
|
3
|
+
collectChildren,
|
4
4
|
defineDefaultState,
|
5
5
|
definePlugin,
|
6
6
|
jsonFromNode,
|
@@ -11,7 +11,10 @@ import {
|
|
11
11
|
Fragment,
|
12
12
|
Slice
|
13
13
|
} from "@prosekit/pm/model";
|
14
|
-
import {
|
14
|
+
import {
|
15
|
+
PluginKey,
|
16
|
+
ProseMirrorPlugin
|
17
|
+
} from "@prosekit/pm/state";
|
15
18
|
import { Step } from "@prosekit/pm/transform";
|
16
19
|
import { Decoration, DecorationSet } from "@prosekit/pm/view";
|
17
20
|
import { ChangeSet } from "prosemirror-changeset";
|
@@ -48,7 +51,7 @@ function decorateDeletionSlice(slice) {
|
|
48
51
|
];
|
49
52
|
}
|
50
53
|
if (openStart > 0 && content.childCount >= 2) {
|
51
|
-
const nodes =
|
54
|
+
const nodes = collectChildren(content);
|
52
55
|
const head = Fragment.from(nodes.slice(0, 1));
|
53
56
|
const body = Fragment.from(nodes.slice(1));
|
54
57
|
return [
|
@@ -57,7 +60,7 @@ function decorateDeletionSlice(slice) {
|
|
57
60
|
];
|
58
61
|
}
|
59
62
|
if (openEnd > 0 && content.childCount >= 2) {
|
60
|
-
const nodes =
|
63
|
+
const nodes = collectChildren(content);
|
61
64
|
const body = Fragment.from(nodes.slice(0, -1));
|
62
65
|
const tail = Fragment.from(nodes.slice(-1));
|
63
66
|
return [
|
@@ -134,10 +137,10 @@ function defineCommitDecoration(commit) {
|
|
134
137
|
});
|
135
138
|
}
|
136
139
|
function defineCommitViewer(commit) {
|
137
|
-
return union(
|
140
|
+
return union(
|
138
141
|
defineDefaultState({ defaultDoc: commit.doc }),
|
139
142
|
defineCommitDecoration(commit)
|
140
|
-
|
143
|
+
);
|
141
144
|
}
|
142
145
|
var CommitRecorder = class {
|
143
146
|
constructor() {
|
@@ -4,6 +4,6 @@ export { defineHeadingCommands_alias_1 as defineHeadingCommands } from './_tsup-
|
|
4
4
|
export { defineHeadingInputRule } from './_tsup-dts-rollup';
|
5
5
|
export { defineHeadingKeymap } from './_tsup-dts-rollup';
|
6
6
|
export { defineHeadingSpec } from './_tsup-dts-rollup';
|
7
|
+
export { HeadingAttrs } from './_tsup-dts-rollup';
|
7
8
|
export { HeadingCommandsExtension_alias_1 as HeadingCommandsExtension } from './_tsup-dts-rollup';
|
8
9
|
export { HeadingSpecExtension } from './_tsup-dts-rollup';
|
9
|
-
export { HeadingAttrs } from './_tsup-dts-rollup';
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
defineTextBlockInputRule
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-LAQZC3ZM.js";
|
4
4
|
|
5
5
|
// src/heading/index.ts
|
6
6
|
import { union } from "@prosekit/core";
|
@@ -94,12 +94,12 @@ function defineHeadingSpec() {
|
|
94
94
|
|
95
95
|
// src/heading/index.ts
|
96
96
|
function defineHeading() {
|
97
|
-
return union(
|
97
|
+
return union(
|
98
98
|
defineHeadingSpec(),
|
99
99
|
defineHeadingInputRule(),
|
100
100
|
defineHeadingKeymap(),
|
101
101
|
defineHeadingCommands()
|
102
|
-
|
102
|
+
);
|
103
103
|
}
|
104
104
|
export {
|
105
105
|
defineHeading,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
defineMarkInputRule
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-LAQZC3ZM.js";
|
4
4
|
|
5
5
|
// src/italic/index.ts
|
6
6
|
import {
|
@@ -45,12 +45,12 @@ function defineItalicInputRule() {
|
|
45
45
|
});
|
46
46
|
}
|
47
47
|
function defineItalic() {
|
48
|
-
return union(
|
48
|
+
return union(
|
49
49
|
defineItalicSpec(),
|
50
50
|
defineItalicCommands(),
|
51
51
|
defineItalicKeymap(),
|
52
52
|
defineItalicInputRule()
|
53
|
-
|
53
|
+
);
|
54
54
|
}
|
55
55
|
export {
|
56
56
|
defineItalic,
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import {
|
2
2
|
defineMarkRule
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-GITDYNLT.js";
|
4
4
|
import {
|
5
5
|
defineEnterRule
|
6
|
-
} from "./chunk-
|
6
|
+
} from "./chunk-RE23OQPF.js";
|
7
7
|
import {
|
8
8
|
defineInputRule
|
9
|
-
} from "./chunk-
|
9
|
+
} from "./chunk-LAQZC3ZM.js";
|
10
10
|
|
11
11
|
// src/link/index.ts
|
12
12
|
import {
|
@@ -98,12 +98,12 @@ function defineLinkMarkRule() {
|
|
98
98
|
});
|
99
99
|
}
|
100
100
|
function defineLink() {
|
101
|
-
return union(
|
101
|
+
return union(
|
102
102
|
defineLinkSpec(),
|
103
103
|
defineLinkCommands(),
|
104
104
|
defineLinkInputRule(),
|
105
105
|
defineLinkEnterRule()
|
106
|
-
|
106
|
+
);
|
107
107
|
}
|
108
108
|
export {
|
109
109
|
defineLink,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
defineInputRule
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-LAQZC3ZM.js";
|
4
4
|
|
5
5
|
// src/list/index.ts
|
6
6
|
import { union as union2 } from "@prosekit/core";
|
@@ -94,13 +94,13 @@ function defineListSpec() {
|
|
94
94
|
// src/list/index.ts
|
95
95
|
import { ListDOMSerializer } from "prosemirror-flat-list";
|
96
96
|
function defineList() {
|
97
|
-
return union2(
|
97
|
+
return union2(
|
98
98
|
defineListSpec(),
|
99
99
|
defineListPlugins(),
|
100
100
|
defineListKeymap(),
|
101
101
|
defineListInputRules(),
|
102
102
|
defineListCommands()
|
103
|
-
|
103
|
+
);
|
104
104
|
}
|
105
105
|
export {
|
106
106
|
ListDOMSerializer,
|
@@ -0,0 +1,11 @@
|
|
1
|
+
export { defineLoro } from './_tsup-dts-rollup';
|
2
|
+
export { LoroOptions } from './_tsup-dts-rollup';
|
3
|
+
export { LoroExtension } from './_tsup-dts-rollup';
|
4
|
+
export { defineLoroCommands_alias_1 as defineLoroCommands } from './_tsup-dts-rollup';
|
5
|
+
export { defineLoroCursorPlugin_alias_1 as defineLoroCursorPlugin } from './_tsup-dts-rollup';
|
6
|
+
export { defineLoroKeymap } from './_tsup-dts-rollup';
|
7
|
+
export { defineLoroSyncPlugin } from './_tsup-dts-rollup';
|
8
|
+
export { defineLoroUndoPlugin } from './_tsup-dts-rollup';
|
9
|
+
export { LoroCursorOptions_alias_1 as LoroCursorOptions } from './_tsup-dts-rollup';
|
10
|
+
export { LoroSyncPluginProps } from './_tsup-dts-rollup';
|
11
|
+
export { LoroUndoPluginProps } from './_tsup-dts-rollup';
|
@@ -0,0 +1,79 @@
|
|
1
|
+
// src/loro/index.ts
|
2
|
+
import {
|
3
|
+
Priority,
|
4
|
+
union,
|
5
|
+
withPriority
|
6
|
+
} from "@prosekit/core";
|
7
|
+
|
8
|
+
// src/loro/commands.ts
|
9
|
+
import { defineCommands } from "@prosekit/core";
|
10
|
+
import { redo, undo } from "loro-prosemirror";
|
11
|
+
var commands = {
|
12
|
+
undo: () => undo,
|
13
|
+
redo: () => redo
|
14
|
+
};
|
15
|
+
function defineLoroCommands() {
|
16
|
+
return defineCommands(commands);
|
17
|
+
}
|
18
|
+
|
19
|
+
// src/loro/cursor-plugin.ts
|
20
|
+
import { definePlugin } from "@prosekit/core";
|
21
|
+
import { LoroCursorPlugin } from "loro-prosemirror";
|
22
|
+
function defineLoroCursorPlugin(options) {
|
23
|
+
const { awareness, ...rest } = options;
|
24
|
+
return definePlugin(LoroCursorPlugin(awareness, rest));
|
25
|
+
}
|
26
|
+
|
27
|
+
// src/loro/keymap.ts
|
28
|
+
import {
|
29
|
+
defineKeymap,
|
30
|
+
isApple
|
31
|
+
} from "@prosekit/core";
|
32
|
+
import { redo as redo2, undo as undo2 } from "loro-prosemirror";
|
33
|
+
var keymap = {
|
34
|
+
"Mod-z": undo2,
|
35
|
+
"Shift-Mod-z": redo2
|
36
|
+
};
|
37
|
+
if (!isApple) {
|
38
|
+
keymap["Mod-y"] = redo2;
|
39
|
+
}
|
40
|
+
function defineLoroKeymap() {
|
41
|
+
return defineKeymap(keymap);
|
42
|
+
}
|
43
|
+
|
44
|
+
// src/loro/sync-plugin.ts
|
45
|
+
import { definePlugin as definePlugin2 } from "@prosekit/core";
|
46
|
+
import { LoroSyncPlugin } from "loro-prosemirror";
|
47
|
+
function defineLoroSyncPlugin(options) {
|
48
|
+
return definePlugin2(LoroSyncPlugin(options));
|
49
|
+
}
|
50
|
+
|
51
|
+
// src/loro/undo-plugin.ts
|
52
|
+
import { definePlugin as definePlugin3 } from "@prosekit/core";
|
53
|
+
import { LoroUndoPlugin } from "loro-prosemirror";
|
54
|
+
function defineLoroUndoPlugin(options) {
|
55
|
+
return definePlugin3(LoroUndoPlugin(options));
|
56
|
+
}
|
57
|
+
|
58
|
+
// src/loro/index.ts
|
59
|
+
function defineLoro(options) {
|
60
|
+
const { doc, awareness, sync, undo: undo3, cursor } = options;
|
61
|
+
return withPriority(
|
62
|
+
union([
|
63
|
+
defineLoroKeymap(),
|
64
|
+
defineLoroCommands(),
|
65
|
+
defineLoroCursorPlugin({ ...cursor, awareness }),
|
66
|
+
defineLoroUndoPlugin({ ...undo3, doc }),
|
67
|
+
defineLoroSyncPlugin({ ...sync, doc })
|
68
|
+
]),
|
69
|
+
Priority.high
|
70
|
+
);
|
71
|
+
}
|
72
|
+
export {
|
73
|
+
defineLoro,
|
74
|
+
defineLoroCommands,
|
75
|
+
defineLoroCursorPlugin,
|
76
|
+
defineLoroKeymap,
|
77
|
+
defineLoroSyncPlugin,
|
78
|
+
defineLoroUndoPlugin
|
79
|
+
};
|
@@ -1,6 +1,5 @@
|
|
1
1
|
// src/placeholder/index.ts
|
2
2
|
import { definePlugin, isInCodeBlock } from "@prosekit/core";
|
3
|
-
import "@prosekit/pm/model";
|
4
3
|
import { Plugin, PluginKey } from "@prosekit/pm/state";
|
5
4
|
import { Decoration, DecorationSet } from "@prosekit/pm/view";
|
6
5
|
function definePlaceholder(options) {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
defineMarkInputRule
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-LAQZC3ZM.js";
|
4
4
|
|
5
5
|
// src/strike/index.ts
|
6
6
|
import {
|
@@ -44,12 +44,12 @@ function defineStrikeInputRule() {
|
|
44
44
|
});
|
45
45
|
}
|
46
46
|
function defineStrike() {
|
47
|
-
return union(
|
47
|
+
return union(
|
48
48
|
defineStrikeSpec(),
|
49
49
|
defineStrikeCommands(),
|
50
50
|
defineStrikeKeymap(),
|
51
51
|
defineStrikeInputRule()
|
52
|
-
|
52
|
+
);
|
53
53
|
}
|
54
54
|
export {
|
55
55
|
defineStrike,
|