@prosekit/extensions 0.7.21 → 0.7.23
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 +18 -4
- package/dist/{chunk-4WHSS2ZE.js → chunk-6UYLCVBX.js} +2 -2
- package/dist/chunk-KNFGQ3MV.js +308 -0
- package/dist/prosekit-extensions-autocomplete.js +7 -2
- package/dist/prosekit-extensions-blockquote.js +12 -4
- package/dist/prosekit-extensions-bold.js +14 -4
- package/dist/prosekit-extensions-code-block.js +21 -8
- package/dist/prosekit-extensions-code.js +14 -4
- package/dist/prosekit-extensions-commit.js +8 -5
- package/dist/prosekit-extensions-drop-cursor.d.ts +2 -2
- package/dist/prosekit-extensions-drop-cursor.js +3 -1
- package/dist/prosekit-extensions-enter-rule.js +1 -1
- package/dist/prosekit-extensions-file.d.ts +5 -5
- package/dist/prosekit-extensions-file.js +23 -23
- package/dist/prosekit-extensions-gap-cursor.js +3 -1
- package/dist/prosekit-extensions-heading.js +7 -3
- package/dist/prosekit-extensions-horizontal-rule.js +18 -5
- package/dist/prosekit-extensions-image.js +10 -3
- package/dist/prosekit-extensions-italic.js +14 -4
- package/dist/prosekit-extensions-link.js +2 -2
- package/dist/prosekit-extensions-list.js +21 -9
- package/dist/prosekit-extensions-loro.d.ts +4 -4
- package/dist/prosekit-extensions-loro.js +33 -13
- package/dist/prosekit-extensions-mark-rule.js +1 -1
- package/dist/prosekit-extensions-mod-click-prevention.js +8 -2
- package/dist/prosekit-extensions-placeholder.js +27 -8
- package/dist/prosekit-extensions-readonly.js +4 -1
- package/dist/prosekit-extensions-search.js +6 -3
- package/dist/prosekit-extensions-strike.js +2 -2
- package/dist/prosekit-extensions-table.d.ts +1 -0
- package/dist/prosekit-extensions-table.js +17 -276
- package/dist/prosekit-extensions-virtual-selection.js +7 -2
- package/dist/prosekit-extensions-yjs.js +12 -6
- package/package.json +13 -13
- package/dist/{chunk-RE23OQPF.js → chunk-TWEOBBYZ.js} +1 -1
@@ -1319,7 +1319,14 @@ export declare function findCellPos(doc: ProseMirrorNode, pos: number): Resolved
|
|
1319
1319
|
*/
|
1320
1320
|
export declare function findCellRange(selection: Selection_2, anchorHit?: number, headHit?: number): [ResolvedPos, ResolvedPos] | undefined;
|
1321
1321
|
|
1322
|
-
|
1322
|
+
/**
|
1323
|
+
* Find the closest table node.
|
1324
|
+
*
|
1325
|
+
* @internal
|
1326
|
+
*/
|
1327
|
+
declare function findTable($pos: ResolvedPos): FindParentNodeResult | undefined;
|
1328
|
+
export { findTable }
|
1329
|
+
export { findTable as findTable_alias_1 }
|
1323
1330
|
|
1324
1331
|
export { GapCursor }
|
1325
1332
|
|
@@ -1785,12 +1792,19 @@ export declare interface PlaceholderOptions {
|
|
1785
1792
|
placeholder: string | ((state: EditorState) => string);
|
1786
1793
|
/**
|
1787
1794
|
* By default, the placeholder text will be shown whenever the current text
|
1788
|
-
* cursor is in an empty text node
|
1789
|
-
*
|
1795
|
+
* cursor is in an empty text node and it's not inside a code block or a
|
1796
|
+
* table node.
|
1797
|
+
*
|
1798
|
+
* If you only want to show the placeholder when the whole doc is empty, you
|
1799
|
+
* can set this option to 'doc'.
|
1800
|
+
*
|
1801
|
+
* You can also pass a function that receives the current editor state and
|
1802
|
+
* returns a boolean value to determine whether the placeholder should be
|
1803
|
+
* shown.
|
1790
1804
|
*
|
1791
1805
|
* @default 'block'
|
1792
1806
|
*/
|
1793
|
-
strategy?: 'doc' | 'block';
|
1807
|
+
strategy?: 'doc' | 'block' | ((state: EditorState) => boolean);
|
1794
1808
|
}
|
1795
1809
|
|
1796
1810
|
export declare const pluginKey: PluginKey<PredictionPluginState>;
|
@@ -0,0 +1,308 @@
|
|
1
|
+
// src/table/table.ts
|
2
|
+
import {
|
3
|
+
union
|
4
|
+
} from "@prosekit/core";
|
5
|
+
|
6
|
+
// src/table/table-commands.ts
|
7
|
+
import {
|
8
|
+
defaultBlockAt,
|
9
|
+
defineCommands,
|
10
|
+
getNodeType,
|
11
|
+
insertNode
|
12
|
+
} from "@prosekit/core";
|
13
|
+
import {
|
14
|
+
TextSelection
|
15
|
+
} from "@prosekit/pm/state";
|
16
|
+
import {
|
17
|
+
addColumnAfter,
|
18
|
+
addColumnBefore,
|
19
|
+
addRowAfter,
|
20
|
+
addRowBefore,
|
21
|
+
CellSelection as CellSelection2,
|
22
|
+
deleteCellSelection,
|
23
|
+
deleteColumn,
|
24
|
+
deleteRow,
|
25
|
+
deleteTable,
|
26
|
+
mergeCells,
|
27
|
+
splitCell,
|
28
|
+
TableMap
|
29
|
+
} from "prosemirror-tables";
|
30
|
+
|
31
|
+
// src/table/table-utils.ts
|
32
|
+
import {
|
33
|
+
findParentNode
|
34
|
+
} from "@prosekit/core";
|
35
|
+
import {
|
36
|
+
cellAround,
|
37
|
+
cellNear,
|
38
|
+
CellSelection,
|
39
|
+
inSameTable
|
40
|
+
} from "prosemirror-tables";
|
41
|
+
function isCellSelection(value) {
|
42
|
+
return value instanceof CellSelection;
|
43
|
+
}
|
44
|
+
function findTable($pos) {
|
45
|
+
return findParentNode((node) => node.type.spec.tableRole === "table", $pos);
|
46
|
+
}
|
47
|
+
function findCellRange(selection, anchorHit, headHit) {
|
48
|
+
var _a, _b;
|
49
|
+
if (anchorHit == null && headHit == null && isCellSelection(selection)) {
|
50
|
+
return [selection.$anchorCell, selection.$headCell];
|
51
|
+
}
|
52
|
+
const anchor = (_a = anchorHit != null ? anchorHit : headHit) != null ? _a : selection.anchor;
|
53
|
+
const head = (_b = headHit != null ? headHit : anchorHit) != null ? _b : selection.head;
|
54
|
+
const doc = selection.$head.doc;
|
55
|
+
const $anchorCell = findCellPos(doc, anchor);
|
56
|
+
const $headCell = findCellPos(doc, head);
|
57
|
+
if ($anchorCell && $headCell && inSameTable($anchorCell, $headCell)) {
|
58
|
+
return [$anchorCell, $headCell];
|
59
|
+
}
|
60
|
+
}
|
61
|
+
function findCellPos(doc, pos) {
|
62
|
+
const $pos = doc.resolve(pos);
|
63
|
+
return cellAround($pos) || cellNear($pos);
|
64
|
+
}
|
65
|
+
|
66
|
+
// src/table/table-commands.ts
|
67
|
+
function createEmptyTable(schema, row, col, header) {
|
68
|
+
const tableType = getNodeType(schema, "table");
|
69
|
+
const tableRowType = getNodeType(schema, "tableRow");
|
70
|
+
const tableCellType = getNodeType(schema, "tableCell");
|
71
|
+
const tableHeaderCellType = getNodeType(schema, "tableHeaderCell");
|
72
|
+
if (header) {
|
73
|
+
const headerCell = tableHeaderCellType.createAndFill();
|
74
|
+
const headerCells = repeat(headerCell, col);
|
75
|
+
const headerRow = tableRowType.createAndFill(null, headerCells);
|
76
|
+
const bodyCell = tableCellType.createAndFill();
|
77
|
+
const bodyCells = repeat(bodyCell, col);
|
78
|
+
const bodyRow = tableRowType.createAndFill(null, bodyCells);
|
79
|
+
const bodyRows = repeat(bodyRow, row - 1);
|
80
|
+
return tableType.createAndFill(null, [headerRow, ...bodyRows]);
|
81
|
+
} else {
|
82
|
+
const bodyCell = tableCellType.createAndFill();
|
83
|
+
const bodyCells = repeat(bodyCell, col);
|
84
|
+
const bodyRow = tableRowType.createAndFill(null, bodyCells);
|
85
|
+
const bodyRows = repeat(bodyRow, row);
|
86
|
+
return tableType.createAndFill(null, bodyRows);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
function repeat(node, length) {
|
90
|
+
return Array(length).fill(node);
|
91
|
+
}
|
92
|
+
function insertTable(options) {
|
93
|
+
return (state, dispatch, view) => {
|
94
|
+
const { row, col, header } = options;
|
95
|
+
const table = createEmptyTable(state.schema, row, col, header);
|
96
|
+
return insertNode({ node: table })(state, dispatch, view);
|
97
|
+
};
|
98
|
+
}
|
99
|
+
var exitTable = (state, dispatch) => {
|
100
|
+
const { $head, $anchor } = state.selection;
|
101
|
+
if (!$head.sameParent($anchor)) {
|
102
|
+
return false;
|
103
|
+
}
|
104
|
+
let tableStart = -1;
|
105
|
+
let tableDepth = -1;
|
106
|
+
for (let depth = $head.depth; depth >= 0; depth--) {
|
107
|
+
const node2 = $head.node(depth);
|
108
|
+
if (node2.type.spec.tableRole === "table") {
|
109
|
+
tableStart = $head.before(depth);
|
110
|
+
tableDepth = depth;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
if (tableStart < 0 || tableDepth <= 0) {
|
114
|
+
return false;
|
115
|
+
}
|
116
|
+
const above = $head.node(tableDepth - 1);
|
117
|
+
const after = $head.indexAfter(tableDepth - 1);
|
118
|
+
const type = defaultBlockAt(above.contentMatchAt(after));
|
119
|
+
const node = type == null ? void 0 : type.createAndFill();
|
120
|
+
if (!type || !node || !above.canReplaceWith(after, after, type)) {
|
121
|
+
return false;
|
122
|
+
}
|
123
|
+
if (dispatch) {
|
124
|
+
const pos = $head.after(tableDepth);
|
125
|
+
const tr = state.tr.replaceWith(pos, pos, node);
|
126
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(pos), 1));
|
127
|
+
dispatch(tr.scrollIntoView());
|
128
|
+
}
|
129
|
+
return true;
|
130
|
+
};
|
131
|
+
function selectTableColumn(options) {
|
132
|
+
return (state, dispatch) => {
|
133
|
+
const range = findCellRange(state.selection, options == null ? void 0 : options.anchor, options == null ? void 0 : options.head);
|
134
|
+
if (!range) {
|
135
|
+
return false;
|
136
|
+
}
|
137
|
+
if (dispatch) {
|
138
|
+
const [$anchorCell, $headCell] = range;
|
139
|
+
const selection = CellSelection2.colSelection($anchorCell, $headCell);
|
140
|
+
dispatch(state.tr.setSelection(selection));
|
141
|
+
}
|
142
|
+
return true;
|
143
|
+
};
|
144
|
+
}
|
145
|
+
function selectTableRow(options) {
|
146
|
+
return (state, dispatch) => {
|
147
|
+
const range = findCellRange(state.selection, options == null ? void 0 : options.anchor, options == null ? void 0 : options.head);
|
148
|
+
if (!range) {
|
149
|
+
return false;
|
150
|
+
}
|
151
|
+
if (dispatch) {
|
152
|
+
const [$anchorCell, $headCell] = range;
|
153
|
+
const selection = CellSelection2.rowSelection($anchorCell, $headCell);
|
154
|
+
dispatch(state.tr.setSelection(selection));
|
155
|
+
}
|
156
|
+
return true;
|
157
|
+
};
|
158
|
+
}
|
159
|
+
function selectTableCell(options) {
|
160
|
+
return (state, dispatch) => {
|
161
|
+
var _a;
|
162
|
+
const $cellPos = findCellPos(
|
163
|
+
state.doc,
|
164
|
+
(_a = options == null ? void 0 : options.pos) != null ? _a : state.selection.anchor
|
165
|
+
);
|
166
|
+
if (!$cellPos) {
|
167
|
+
return false;
|
168
|
+
}
|
169
|
+
if (dispatch) {
|
170
|
+
const selection = new CellSelection2($cellPos);
|
171
|
+
dispatch(state.tr.setSelection(selection));
|
172
|
+
}
|
173
|
+
return true;
|
174
|
+
};
|
175
|
+
}
|
176
|
+
function selectTable(options) {
|
177
|
+
return (state, dispatch) => {
|
178
|
+
const $pos = (options == null ? void 0 : options.pos) ? state.doc.resolve(options.pos) : state.selection.$anchor;
|
179
|
+
const table = findTable($pos);
|
180
|
+
if (!table) {
|
181
|
+
return false;
|
182
|
+
}
|
183
|
+
const map = TableMap.get(table.node);
|
184
|
+
if (map.map.length === 0) {
|
185
|
+
return false;
|
186
|
+
}
|
187
|
+
if (dispatch) {
|
188
|
+
let tr = state.tr;
|
189
|
+
const firstCellPosInTable = map.map[0];
|
190
|
+
const lastCellPosInTable = map.map[map.map.length - 1];
|
191
|
+
const firstCellPos = table.pos + firstCellPosInTable + 1;
|
192
|
+
const lastCellPos = table.pos + lastCellPosInTable + 1;
|
193
|
+
const $firstCellPos = tr.doc.resolve(firstCellPos);
|
194
|
+
const $lastCellPos = tr.doc.resolve(lastCellPos);
|
195
|
+
const selection = new CellSelection2($firstCellPos, $lastCellPos);
|
196
|
+
tr = tr.setSelection(selection);
|
197
|
+
dispatch == null ? void 0 : dispatch(tr);
|
198
|
+
}
|
199
|
+
return true;
|
200
|
+
};
|
201
|
+
}
|
202
|
+
function defineTableCommands() {
|
203
|
+
return defineCommands({
|
204
|
+
insertTable,
|
205
|
+
exitTable: () => exitTable,
|
206
|
+
selectTable,
|
207
|
+
selectTableCell,
|
208
|
+
selectTableColumn,
|
209
|
+
selectTableRow,
|
210
|
+
addTableColumnBefore: () => addColumnBefore,
|
211
|
+
addTableColumnAfter: () => addColumnAfter,
|
212
|
+
addTableRowAbove: () => addRowBefore,
|
213
|
+
addTableRowBelow: () => addRowAfter,
|
214
|
+
deleteTable: () => deleteTable,
|
215
|
+
deleteTableColumn: () => deleteColumn,
|
216
|
+
deleteTableRow: () => deleteRow,
|
217
|
+
deleteCellSelection: () => deleteCellSelection,
|
218
|
+
mergeTableCells: () => mergeCells,
|
219
|
+
splitTableCell: () => splitCell
|
220
|
+
});
|
221
|
+
}
|
222
|
+
|
223
|
+
// src/table/table-plugins.ts
|
224
|
+
import {
|
225
|
+
definePlugin
|
226
|
+
} from "@prosekit/core";
|
227
|
+
import {
|
228
|
+
columnResizing,
|
229
|
+
tableEditing
|
230
|
+
} from "prosemirror-tables";
|
231
|
+
function defineTablePlugins() {
|
232
|
+
return definePlugin([tableEditing(), columnResizing()]);
|
233
|
+
}
|
234
|
+
|
235
|
+
// src/table/table-spec.ts
|
236
|
+
import {
|
237
|
+
defineNodeSpec
|
238
|
+
} from "@prosekit/core";
|
239
|
+
import { tableNodes } from "prosemirror-tables";
|
240
|
+
var cellContent = "block+";
|
241
|
+
var cellAttrs = {
|
242
|
+
colspan: { default: 1 },
|
243
|
+
rowspan: { default: 1 },
|
244
|
+
colwidth: { default: null }
|
245
|
+
};
|
246
|
+
var specs = tableNodes({
|
247
|
+
tableGroup: "block",
|
248
|
+
cellContent,
|
249
|
+
cellAttributes: {}
|
250
|
+
});
|
251
|
+
function defineTableSpec() {
|
252
|
+
return defineNodeSpec({
|
253
|
+
...specs["table"],
|
254
|
+
content: "tableRow+",
|
255
|
+
name: "table"
|
256
|
+
});
|
257
|
+
}
|
258
|
+
function defineTableRowSpec() {
|
259
|
+
return defineNodeSpec({
|
260
|
+
...specs["table_row"],
|
261
|
+
content: "(tableCell | tableHeaderCell)*",
|
262
|
+
name: "tableRow"
|
263
|
+
});
|
264
|
+
}
|
265
|
+
function defineTableCellSpec() {
|
266
|
+
return defineNodeSpec({
|
267
|
+
...specs["table_cell"],
|
268
|
+
name: "tableCell",
|
269
|
+
attrs: cellAttrs
|
270
|
+
});
|
271
|
+
}
|
272
|
+
function defineTableHeaderCellSpec() {
|
273
|
+
return defineNodeSpec({
|
274
|
+
...specs["table_header"],
|
275
|
+
name: "tableHeaderCell",
|
276
|
+
attrs: cellAttrs
|
277
|
+
});
|
278
|
+
}
|
279
|
+
|
280
|
+
// src/table/table.ts
|
281
|
+
function defineTable() {
|
282
|
+
return union(
|
283
|
+
defineTableSpec(),
|
284
|
+
defineTableRowSpec(),
|
285
|
+
defineTableCellSpec(),
|
286
|
+
defineTableHeaderCellSpec(),
|
287
|
+
defineTablePlugins(),
|
288
|
+
defineTableCommands()
|
289
|
+
);
|
290
|
+
}
|
291
|
+
|
292
|
+
export {
|
293
|
+
isCellSelection,
|
294
|
+
findTable,
|
295
|
+
insertTable,
|
296
|
+
exitTable,
|
297
|
+
selectTableColumn,
|
298
|
+
selectTableRow,
|
299
|
+
selectTableCell,
|
300
|
+
selectTable,
|
301
|
+
defineTableCommands,
|
302
|
+
defineTablePlugins,
|
303
|
+
defineTableSpec,
|
304
|
+
defineTableRowSpec,
|
305
|
+
defineTableCellSpec,
|
306
|
+
defineTableHeaderCellSpec,
|
307
|
+
defineTable
|
308
|
+
};
|
@@ -7,8 +7,13 @@ import {
|
|
7
7
|
|
8
8
|
// src/autocomplete/autocomplete-plugin.ts
|
9
9
|
import { OBJECT_REPLACEMENT_CHARACTER } from "@prosekit/core";
|
10
|
-
import {
|
11
|
-
|
10
|
+
import {
|
11
|
+
Plugin
|
12
|
+
} from "@prosekit/pm/state";
|
13
|
+
import {
|
14
|
+
Decoration,
|
15
|
+
DecorationSet
|
16
|
+
} from "@prosekit/pm/view";
|
12
17
|
|
13
18
|
// src/autocomplete/autocomplete-helpers.ts
|
14
19
|
import {
|
@@ -3,7 +3,9 @@ import {
|
|
3
3
|
} from "./chunk-LAQZC3ZM.js";
|
4
4
|
|
5
5
|
// src/blockquote/blockquote.ts
|
6
|
-
import {
|
6
|
+
import {
|
7
|
+
union
|
8
|
+
} from "@prosekit/core";
|
7
9
|
|
8
10
|
// src/blockquote/blockquote-commands.ts
|
9
11
|
import {
|
@@ -35,7 +37,11 @@ function defineBlockquoteInputRule() {
|
|
35
37
|
}
|
36
38
|
|
37
39
|
// src/blockquote/blockquote-keymap.ts
|
38
|
-
import {
|
40
|
+
import {
|
41
|
+
defineKeymap,
|
42
|
+
isAtBlockStart,
|
43
|
+
toggleWrap as toggleWrap2
|
44
|
+
} from "@prosekit/core";
|
39
45
|
import { joinBackward } from "@prosekit/pm/commands";
|
40
46
|
function toggleBlockquoteKeybinding() {
|
41
47
|
return toggleWrap2({ type: "blockquote" });
|
@@ -52,12 +58,14 @@ function backspaceUnsetBlockquote() {
|
|
52
58
|
function defineBlockquoteKeymap() {
|
53
59
|
return defineKeymap({
|
54
60
|
"mod-shift-b": toggleBlockquoteKeybinding(),
|
55
|
-
Backspace: backspaceUnsetBlockquote()
|
61
|
+
"Backspace": backspaceUnsetBlockquote()
|
56
62
|
});
|
57
63
|
}
|
58
64
|
|
59
65
|
// src/blockquote/blockquote-spec.ts
|
60
|
-
import {
|
66
|
+
import {
|
67
|
+
defineNodeSpec
|
68
|
+
} from "@prosekit/core";
|
61
69
|
function defineBlockquoteSpec() {
|
62
70
|
return defineNodeSpec({
|
63
71
|
name: "blockquote",
|
@@ -3,10 +3,15 @@ import {
|
|
3
3
|
} from "./chunk-LAQZC3ZM.js";
|
4
4
|
|
5
5
|
// src/bold/bold.ts
|
6
|
-
import {
|
6
|
+
import {
|
7
|
+
union
|
8
|
+
} from "@prosekit/core";
|
7
9
|
|
8
10
|
// src/bold/bold-commands.ts
|
9
|
-
import {
|
11
|
+
import {
|
12
|
+
defineCommands,
|
13
|
+
toggleMark
|
14
|
+
} from "@prosekit/core";
|
10
15
|
function defineBoldCommands() {
|
11
16
|
return defineCommands({
|
12
17
|
toggleBold: () => toggleMark({ type: "bold" })
|
@@ -23,7 +28,10 @@ function defineBoldInputRule() {
|
|
23
28
|
}
|
24
29
|
|
25
30
|
// src/bold/bold-keymap.ts
|
26
|
-
import {
|
31
|
+
import {
|
32
|
+
defineKeymap,
|
33
|
+
toggleMark as toggleMark2
|
34
|
+
} from "@prosekit/core";
|
27
35
|
function defineBoldKeymap() {
|
28
36
|
return defineKeymap({
|
29
37
|
"Mod-b": toggleMark2({ type: "bold" })
|
@@ -31,7 +39,9 @@ function defineBoldKeymap() {
|
|
31
39
|
}
|
32
40
|
|
33
41
|
// src/bold/bold-spec.ts
|
34
|
-
import {
|
42
|
+
import {
|
43
|
+
defineMarkSpec
|
44
|
+
} from "@prosekit/core";
|
35
45
|
function defineBoldSpec() {
|
36
46
|
return defineMarkSpec({
|
37
47
|
name: "bold",
|
@@ -1,12 +1,14 @@
|
|
1
1
|
import {
|
2
2
|
defineTextBlockEnterRule
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-TWEOBBYZ.js";
|
4
4
|
import {
|
5
5
|
defineTextBlockInputRule
|
6
6
|
} from "./chunk-LAQZC3ZM.js";
|
7
7
|
|
8
8
|
// src/code-block/code-block.ts
|
9
|
-
import {
|
9
|
+
import {
|
10
|
+
union
|
11
|
+
} from "@prosekit/core";
|
10
12
|
|
11
13
|
// src/code-block/code-block-commands.ts
|
12
14
|
import {
|
@@ -53,8 +55,13 @@ function getAttrs(match) {
|
|
53
55
|
}
|
54
56
|
|
55
57
|
// src/code-block/code-block-keymap.ts
|
56
|
-
import {
|
57
|
-
|
58
|
+
import {
|
59
|
+
defaultBlockAt,
|
60
|
+
defineKeymap
|
61
|
+
} from "@prosekit/core";
|
62
|
+
import {
|
63
|
+
TextSelection
|
64
|
+
} from "@prosekit/pm/state";
|
58
65
|
function defineCodeBlockKeymap() {
|
59
66
|
return defineKeymap({
|
60
67
|
Enter: existCodeBlock
|
@@ -90,7 +97,9 @@ var existCodeBlock = (state, dispatch) => {
|
|
90
97
|
};
|
91
98
|
|
92
99
|
// src/code-block/code-block-spec.ts
|
93
|
-
import {
|
100
|
+
import {
|
101
|
+
defineNodeSpec
|
102
|
+
} from "@prosekit/core";
|
94
103
|
function defineCodeBlockSpec() {
|
95
104
|
return defineNodeSpec({
|
96
105
|
name: "codeBlock",
|
@@ -128,13 +137,17 @@ function defineCodeBlock() {
|
|
128
137
|
}
|
129
138
|
|
130
139
|
// src/code-block/code-block-highlight.ts
|
131
|
-
import {
|
132
|
-
|
140
|
+
import {
|
141
|
+
definePlugin
|
142
|
+
} from "@prosekit/core";
|
143
|
+
import {
|
144
|
+
createHighlightPlugin
|
145
|
+
} from "prosemirror-highlight";
|
133
146
|
function defineCodeBlockHighlight({
|
134
147
|
parser
|
135
148
|
}) {
|
136
149
|
return definePlugin(
|
137
|
-
createHighlightPlugin({ parser
|
150
|
+
createHighlightPlugin({ parser })
|
138
151
|
);
|
139
152
|
}
|
140
153
|
|
@@ -3,10 +3,15 @@ import {
|
|
3
3
|
} from "./chunk-LAQZC3ZM.js";
|
4
4
|
|
5
5
|
// src/code/code.ts
|
6
|
-
import {
|
6
|
+
import {
|
7
|
+
union
|
8
|
+
} from "@prosekit/core";
|
7
9
|
|
8
10
|
// src/code/code-commands.ts
|
9
|
-
import {
|
11
|
+
import {
|
12
|
+
defineCommands,
|
13
|
+
toggleMark
|
14
|
+
} from "@prosekit/core";
|
10
15
|
function defineCodeCommands() {
|
11
16
|
return defineCommands({
|
12
17
|
toggleCode: () => toggleMark({ type: "code" })
|
@@ -23,7 +28,10 @@ function defineCodeInputRule() {
|
|
23
28
|
}
|
24
29
|
|
25
30
|
// src/code/code-keymap.ts
|
26
|
-
import {
|
31
|
+
import {
|
32
|
+
defineKeymap,
|
33
|
+
toggleMark as toggleMark2
|
34
|
+
} from "@prosekit/core";
|
27
35
|
function defineCodeKeymap() {
|
28
36
|
return defineKeymap({
|
29
37
|
"Mod-e": toggleMark2({ type: "code" })
|
@@ -31,7 +39,9 @@ function defineCodeKeymap() {
|
|
31
39
|
}
|
32
40
|
|
33
41
|
// src/code/code-spec.ts
|
34
|
-
import {
|
42
|
+
import {
|
43
|
+
defineMarkSpec
|
44
|
+
} from "@prosekit/core";
|
35
45
|
function defineCodeSpec() {
|
36
46
|
return defineMarkSpec({
|
37
47
|
name: "code",
|
@@ -16,8 +16,13 @@ import {
|
|
16
16
|
ProseMirrorPlugin
|
17
17
|
} from "@prosekit/pm/state";
|
18
18
|
import { Step } from "@prosekit/pm/transform";
|
19
|
-
import {
|
20
|
-
|
19
|
+
import {
|
20
|
+
Decoration,
|
21
|
+
DecorationSet
|
22
|
+
} from "@prosekit/pm/view";
|
23
|
+
import {
|
24
|
+
ChangeSet
|
25
|
+
} from "prosemirror-changeset";
|
21
26
|
function getChanges(doc, parent, steps) {
|
22
27
|
const initSet = ChangeSet.create(parent);
|
23
28
|
const currSet = initSet.addSteps(
|
@@ -108,9 +113,7 @@ function decorateChange(prev, change) {
|
|
108
113
|
}
|
109
114
|
function decorateCommit(doc, parent, steps) {
|
110
115
|
const changes = getChanges(doc, parent, steps);
|
111
|
-
const decorations = changes.flatMap(
|
112
|
-
(change) => decorateChange(parent, change)
|
113
|
-
);
|
116
|
+
const decorations = changes.flatMap((change) => decorateChange(parent, change));
|
114
117
|
return DecorationSet.create(doc, decorations);
|
115
118
|
}
|
116
119
|
function defineCommitDecoration(commit) {
|
@@ -1,3 +1,3 @@
|
|
1
|
-
export { DropCursorOptions_alias_1 as DropCursorOptions } from './_tsup-dts-rollup.js';
|
2
|
-
export { DropCursorExtension_alias_1 as DropCursorExtension } from './_tsup-dts-rollup.js';
|
3
1
|
export { defineDropCursor_alias_1 as defineDropCursor } from './_tsup-dts-rollup.js';
|
2
|
+
export { DropCursorExtension_alias_1 as DropCursorExtension } from './_tsup-dts-rollup.js';
|
3
|
+
export { DropCursorOptions_alias_1 as DropCursorOptions } from './_tsup-dts-rollup.js';
|
@@ -1,5 +1,7 @@
|
|
1
1
|
// src/drop-cursor/drop-cursor.ts
|
2
|
-
import {
|
2
|
+
import {
|
3
|
+
definePlugin
|
4
|
+
} from "@prosekit/core";
|
3
5
|
import { dropCursor } from "prosemirror-dropcursor";
|
4
6
|
function defineDropCursor(options) {
|
5
7
|
return definePlugin(() => dropCursor(options));
|
@@ -1,8 +1,8 @@
|
|
1
|
-
export { defineFilePasteHandler_alias_1 as defineFilePasteHandler } from './_tsup-dts-rollup.js';
|
2
|
-
export { FilePasteHandlerOptions_alias_1 as FilePasteHandlerOptions } from './_tsup-dts-rollup.js';
|
3
1
|
export { defineFileDropHandler_alias_1 as defineFileDropHandler } from './_tsup-dts-rollup.js';
|
4
2
|
export { FileDropHandlerOptions_alias_1 as FileDropHandlerOptions } from './_tsup-dts-rollup.js';
|
5
|
-
export {
|
6
|
-
export {
|
7
|
-
export { Uploader_alias_1 as Uploader } from './_tsup-dts-rollup.js';
|
3
|
+
export { defineFilePasteHandler_alias_1 as defineFilePasteHandler } from './_tsup-dts-rollup.js';
|
4
|
+
export { FilePasteHandlerOptions_alias_1 as FilePasteHandlerOptions } from './_tsup-dts-rollup.js';
|
8
5
|
export { UploadTask_alias_1 as UploadTask } from './_tsup-dts-rollup.js';
|
6
|
+
export { Uploader_alias_1 as Uploader } from './_tsup-dts-rollup.js';
|
7
|
+
export { UploaderOptions_alias_1 as UploaderOptions } from './_tsup-dts-rollup.js';
|
8
|
+
export { UploadProgress_alias_1 as UploadProgress } from './_tsup-dts-rollup.js';
|