@prosekit/core 0.7.13 → 0.7.14
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.
@@ -16,6 +16,7 @@ import type { IsEqual } from 'type-fest';
|
|
16
16
|
import { Mark } from '@prosekit/pm/model';
|
17
17
|
import type { MarkSpec } from '@prosekit/pm/model';
|
18
18
|
import type { MarkType } from '@prosekit/pm/model';
|
19
|
+
import type { MarkViewConstructor } from '@prosekit/pm/view';
|
19
20
|
import type { Node as Node_2 } from '@prosekit/pm/model';
|
20
21
|
import { NodeSelection } from '@prosekit/pm/state';
|
21
22
|
import type { NodeSpec } from '@prosekit/pm/model';
|
@@ -218,7 +219,7 @@ export { BaseKeymapExtension as BaseKeymapExtension_alias_1 }
|
|
218
219
|
/**
|
219
220
|
* Some basic props for custom node views.
|
220
221
|
*
|
221
|
-
* @
|
222
|
+
* @deprecated - This is no longer needed. Use `CoreNodeViewUserOptions` from `@prosemirror-adapter/core` instead.
|
222
223
|
*/
|
223
224
|
declare interface BaseNodeViewOptions {
|
224
225
|
/**
|
@@ -657,6 +658,24 @@ declare function defineMarkSpec<Mark extends string, Attrs extends AnyAttrs = An
|
|
657
658
|
export { defineMarkSpec }
|
658
659
|
export { defineMarkSpec as defineMarkSpec_alias_1 }
|
659
660
|
|
661
|
+
declare function defineMarkView(options: MarkViewOptions): Extension;
|
662
|
+
export { defineMarkView }
|
663
|
+
export { defineMarkView as defineMarkView_alias_1 }
|
664
|
+
|
665
|
+
/**
|
666
|
+
* @internal
|
667
|
+
*/
|
668
|
+
declare function defineMarkViewComponent<T>(options: MarkViewComponentOptions<T>): Extension;
|
669
|
+
export { defineMarkViewComponent }
|
670
|
+
export { defineMarkViewComponent as defineMarkViewComponent_alias_1 }
|
671
|
+
|
672
|
+
/**
|
673
|
+
* @internal
|
674
|
+
*/
|
675
|
+
declare function defineMarkViewFactory<T>(options: MarkViewFactoryOptions<T>): Extension;
|
676
|
+
export { defineMarkViewFactory }
|
677
|
+
export { defineMarkViewFactory as defineMarkViewFactory_alias_1 }
|
678
|
+
|
660
679
|
/**
|
661
680
|
* Registers a event handler that is called when the editor view is mounted.
|
662
681
|
*
|
@@ -1921,6 +1940,34 @@ declare interface MarkTyping {
|
|
1921
1940
|
export { MarkTyping }
|
1922
1941
|
export { MarkTyping as MarkTyping_alias_1 }
|
1923
1942
|
|
1943
|
+
/**
|
1944
|
+
* @internal
|
1945
|
+
*/
|
1946
|
+
declare type MarkViewComponentOptions<T> = {
|
1947
|
+
group: string;
|
1948
|
+
name: string;
|
1949
|
+
args: T;
|
1950
|
+
};
|
1951
|
+
export { MarkViewComponentOptions }
|
1952
|
+
export { MarkViewComponentOptions as MarkViewComponentOptions_alias_1 }
|
1953
|
+
|
1954
|
+
/**
|
1955
|
+
* @internal
|
1956
|
+
*/
|
1957
|
+
declare type MarkViewFactoryOptions<T> = {
|
1958
|
+
group: string;
|
1959
|
+
factory: (args: T) => MarkViewConstructor;
|
1960
|
+
};
|
1961
|
+
export { MarkViewFactoryOptions }
|
1962
|
+
export { MarkViewFactoryOptions as MarkViewFactoryOptions_alias_1 }
|
1963
|
+
|
1964
|
+
declare interface MarkViewOptions {
|
1965
|
+
name: string;
|
1966
|
+
constructor: MarkViewConstructor;
|
1967
|
+
}
|
1968
|
+
export { MarkViewOptions }
|
1969
|
+
export { MarkViewOptions as MarkViewOptions_alias_1 }
|
1970
|
+
|
1924
1971
|
/**
|
1925
1972
|
* @internal
|
1926
1973
|
*/
|
@@ -2150,7 +2197,6 @@ export { OBJECT_REPLACEMENT_CHARACTER as OBJECT_REPLACEMENT_CHARACTER_alias_1 }
|
|
2150
2197
|
* type MyObject = { a: 1; b: 'B' }
|
2151
2198
|
* type MyEntries = ObjectEntries<MyObject>
|
2152
2199
|
* // ^ ["a", 1] | ["b", "B"]
|
2153
|
-
*
|
2154
2200
|
*/
|
2155
2201
|
export declare type ObjectEntries<T extends Record<string, any>> = {
|
2156
2202
|
[K in keyof T]: [K, T[K]];
|
@@ -91,7 +91,12 @@ function defineFacet(options) {
|
|
91
91
|
}
|
92
92
|
|
93
93
|
// src/utils/type-assertion.ts
|
94
|
-
import {
|
94
|
+
import {
|
95
|
+
Fragment,
|
96
|
+
Mark,
|
97
|
+
ProseMirrorNode,
|
98
|
+
Slice
|
99
|
+
} from "@prosekit/pm/model";
|
95
100
|
import {
|
96
101
|
AllSelection,
|
97
102
|
NodeSelection,
|
@@ -127,7 +132,9 @@ function isNotNullish(value) {
|
|
127
132
|
}
|
128
133
|
|
129
134
|
// src/facets/schema.ts
|
130
|
-
import {
|
135
|
+
import {
|
136
|
+
Schema
|
137
|
+
} from "@prosekit/pm/model";
|
131
138
|
|
132
139
|
// src/facets/root.ts
|
133
140
|
function rootReducer(inputs) {
|
@@ -466,7 +473,9 @@ function htmlFromJSON(json, options) {
|
|
466
473
|
}
|
467
474
|
|
468
475
|
// src/extensions/default-state.ts
|
469
|
-
import {
|
476
|
+
import {
|
477
|
+
Selection as Selection3
|
478
|
+
} from "@prosekit/pm/state";
|
470
479
|
|
471
480
|
// src/facets/state.ts
|
472
481
|
var stateFacet = defineFacet({
|
@@ -669,7 +678,9 @@ function union(...exts) {
|
|
669
678
|
import {
|
670
679
|
EditorState as EditorState2
|
671
680
|
} from "@prosekit/pm/state";
|
672
|
-
import {
|
681
|
+
import {
|
682
|
+
EditorView
|
683
|
+
} from "@prosekit/pm/view";
|
673
684
|
|
674
685
|
// src/utils/deep-equals.ts
|
675
686
|
import OrderedMap from "orderedmap";
|
@@ -723,10 +734,7 @@ function isNodeActive(state, type, attrs) {
|
|
723
734
|
|
724
735
|
// src/editor/action.ts
|
725
736
|
function createNodeActions(schema, getState, createNode = defaultCreateNode) {
|
726
|
-
return mapValues(
|
727
|
-
schema.nodes,
|
728
|
-
(type) => createNodeAction(type, getState, createNode)
|
729
|
-
);
|
737
|
+
return mapValues(schema.nodes, (type) => createNodeAction(type, getState, createNode));
|
730
738
|
}
|
731
739
|
function createNodeAction(type, getState, createNode) {
|
732
740
|
const action = (...args) => buildNode(type, args, createNode);
|
@@ -737,10 +745,7 @@ function createNodeAction(type, getState, createNode) {
|
|
737
745
|
return action;
|
738
746
|
}
|
739
747
|
function createMarkActions(schema, getState, applyMark = defaultApplyMark) {
|
740
|
-
return mapValues(
|
741
|
-
schema.marks,
|
742
|
-
(type) => createMarkAction(type, getState, applyMark)
|
743
|
-
);
|
748
|
+
return mapValues(schema.marks, (type) => createMarkAction(type, getState, applyMark));
|
744
749
|
}
|
745
750
|
function createMarkAction(type, getState, applyMark) {
|
746
751
|
const action = (...args) => buildMark(type, args, applyMark);
|
package/dist/prosekit-core.d.ts
CHANGED
@@ -31,8 +31,8 @@ export { MarkBuilder } from './_tsup-dts-rollup.js';
|
|
31
31
|
export { NodeAction } from './_tsup-dts-rollup.js';
|
32
32
|
export { NodeBuilder } from './_tsup-dts-rollup.js';
|
33
33
|
export { NodeChild } from './_tsup-dts-rollup.js';
|
34
|
-
export { Editor } from './_tsup-dts-rollup.js';
|
35
34
|
export { createEditor } from './_tsup-dts-rollup.js';
|
35
|
+
export { Editor } from './_tsup-dts-rollup.js';
|
36
36
|
export { EditorOptions } from './_tsup-dts-rollup.js';
|
37
37
|
export { union } from './_tsup-dts-rollup.js';
|
38
38
|
export { withPriority } from './_tsup-dts-rollup.js';
|
@@ -61,11 +61,13 @@ export { defineScrollToSelectionHandler } from './_tsup-dts-rollup.js';
|
|
61
61
|
export { defineTextInputHandler } from './_tsup-dts-rollup.js';
|
62
62
|
export { defineTripleClickHandler } from './_tsup-dts-rollup.js';
|
63
63
|
export { defineTripleClickOnHandler } from './_tsup-dts-rollup.js';
|
64
|
+
export { editorEventFacet } from './_tsup-dts-rollup.js';
|
64
65
|
export { ClickHandler } from './_tsup-dts-rollup.js';
|
65
66
|
export { ClickOnHandler } from './_tsup-dts-rollup.js';
|
66
67
|
export { DoubleClickHandler } from './_tsup-dts-rollup.js';
|
67
68
|
export { DoubleClickOnHandler } from './_tsup-dts-rollup.js';
|
68
69
|
export { DropHandler } from './_tsup-dts-rollup.js';
|
70
|
+
export { EditorEventPayload } from './_tsup-dts-rollup.js';
|
69
71
|
export { KeyDownHandler } from './_tsup-dts-rollup.js';
|
70
72
|
export { KeyPressHandler } from './_tsup-dts-rollup.js';
|
71
73
|
export { PasteHandler } from './_tsup-dts-rollup.js';
|
@@ -73,8 +75,6 @@ export { ScrollToSelectionHandler } from './_tsup-dts-rollup.js';
|
|
73
75
|
export { TextInputHandler } from './_tsup-dts-rollup.js';
|
74
76
|
export { TripleClickHandler } from './_tsup-dts-rollup.js';
|
75
77
|
export { TripleClickOnHandler } from './_tsup-dts-rollup.js';
|
76
|
-
export { editorEventFacet } from './_tsup-dts-rollup.js';
|
77
|
-
export { EditorEventPayload } from './_tsup-dts-rollup.js';
|
78
78
|
export { defineFocusChangeHandler } from './_tsup-dts-rollup.js';
|
79
79
|
export { FocusChangeHandler } from './_tsup-dts-rollup.js';
|
80
80
|
export { defineMountHandler } from './_tsup-dts-rollup.js';
|
@@ -96,6 +96,12 @@ export { defineMarkAttr } from './_tsup-dts-rollup.js';
|
|
96
96
|
export { defineMarkSpec } from './_tsup-dts-rollup.js';
|
97
97
|
export { MarkAttrOptions } from './_tsup-dts-rollup.js';
|
98
98
|
export { MarkSpecOptions } from './_tsup-dts-rollup.js';
|
99
|
+
export { defineMarkView } from './_tsup-dts-rollup.js';
|
100
|
+
export { MarkViewOptions } from './_tsup-dts-rollup.js';
|
101
|
+
export { defineMarkViewComponent } from './_tsup-dts-rollup.js';
|
102
|
+
export { defineMarkViewFactory } from './_tsup-dts-rollup.js';
|
103
|
+
export { MarkViewComponentOptions } from './_tsup-dts-rollup.js';
|
104
|
+
export { MarkViewFactoryOptions } from './_tsup-dts-rollup.js';
|
99
105
|
export { defineNodeAttr } from './_tsup-dts-rollup.js';
|
100
106
|
export { defineNodeSpec } from './_tsup-dts-rollup.js';
|
101
107
|
export { NodeAttrOptions } from './_tsup-dts-rollup.js';
|
package/dist/prosekit-core.js
CHANGED
@@ -39,7 +39,7 @@ import {
|
|
39
39
|
stateFromJSON,
|
40
40
|
toReversed,
|
41
41
|
union
|
42
|
-
} from "./chunk-
|
42
|
+
} from "./chunk-6DIFWJEG.js";
|
43
43
|
|
44
44
|
// src/commands/add-mark.ts
|
45
45
|
function addMark(options) {
|
@@ -57,7 +57,9 @@ function addMark(options) {
|
|
57
57
|
}
|
58
58
|
|
59
59
|
// src/commands/expand-mark.ts
|
60
|
-
import {
|
60
|
+
import {
|
61
|
+
TextSelection
|
62
|
+
} from "@prosekit/pm/state";
|
61
63
|
function expandMark(options) {
|
62
64
|
return (state, dispatch) => {
|
63
65
|
const markType = getMarkType(state.schema, options.type);
|
@@ -110,7 +112,9 @@ function expandMarkAfter($pos, predicate) {
|
|
110
112
|
}
|
111
113
|
|
112
114
|
// src/commands/insert-default-block.ts
|
113
|
-
import {
|
115
|
+
import {
|
116
|
+
TextSelection as TextSelection2
|
117
|
+
} from "@prosekit/pm/state";
|
114
118
|
|
115
119
|
// src/utils/default-block-at.ts
|
116
120
|
function defaultBlockAt(match) {
|
@@ -148,7 +152,9 @@ function insertDefaultBlock(options) {
|
|
148
152
|
import { insertPoint } from "@prosekit/pm/transform";
|
149
153
|
|
150
154
|
// src/utils/set-selection-around.ts
|
151
|
-
import {
|
155
|
+
import {
|
156
|
+
TextSelection as TextSelection3
|
157
|
+
} from "@prosekit/pm/state";
|
152
158
|
function setSelectionAround(tr, pos) {
|
153
159
|
const docSize = tr.doc.content.size;
|
154
160
|
const $pos = tr.doc.resolve(pos > docSize ? docSize : pos < 0 ? 0 : pos);
|
@@ -379,7 +385,10 @@ function toggleWrap(options) {
|
|
379
385
|
}
|
380
386
|
|
381
387
|
// src/commands/unset-block-type.ts
|
382
|
-
import {
|
388
|
+
import {
|
389
|
+
Fragment,
|
390
|
+
Slice
|
391
|
+
} from "@prosekit/pm/model";
|
383
392
|
import { ReplaceAroundStep } from "@prosekit/pm/transform";
|
384
393
|
function unsetBlockType(options) {
|
385
394
|
return (state, dispatch) => {
|
@@ -450,7 +459,9 @@ function insertText({ text, from, to }) {
|
|
450
459
|
}
|
451
460
|
|
452
461
|
// src/commands/select-all.ts
|
453
|
-
import {
|
462
|
+
import {
|
463
|
+
AllSelection
|
464
|
+
} from "@prosekit/pm/state";
|
454
465
|
function selectAll() {
|
455
466
|
return (state, dispatch) => {
|
456
467
|
dispatch == null ? void 0 : dispatch(state.tr.setSelection(new AllSelection(state.doc)));
|
@@ -692,9 +703,7 @@ var nodeSpecFacet = defineFacet({
|
|
692
703
|
spec.toDOM = wrapOutputSpecAttrs(spec.toDOM, attrs);
|
693
704
|
}
|
694
705
|
if (spec.parseDOM) {
|
695
|
-
spec.parseDOM = spec.parseDOM.map(
|
696
|
-
(rule) => wrapTagParseRuleAttrs(rule, attrs)
|
697
|
-
);
|
706
|
+
spec.parseDOM = spec.parseDOM.map((rule) => wrapTagParseRuleAttrs(rule, attrs));
|
698
707
|
}
|
699
708
|
specs = specs.update(type, spec);
|
700
709
|
}
|
@@ -720,7 +729,9 @@ import {
|
|
720
729
|
} from "@prosekit/pm/state";
|
721
730
|
|
722
731
|
// src/extensions/plugin.ts
|
723
|
-
import {
|
732
|
+
import {
|
733
|
+
Plugin
|
734
|
+
} from "@prosekit/pm/state";
|
724
735
|
function definePlugin(plugin) {
|
725
736
|
if (plugin instanceof Plugin || Array.isArray(plugin) && plugin.every((p) => p instanceof Plugin)) {
|
726
737
|
return definePluginPayload(() => plugin);
|
@@ -825,7 +836,10 @@ function defineDocChangeHandler(handler) {
|
|
825
836
|
}
|
826
837
|
|
827
838
|
// src/extensions/events/dom-event.ts
|
828
|
-
import {
|
839
|
+
import {
|
840
|
+
PluginKey as PluginKey2,
|
841
|
+
ProseMirrorPlugin as ProseMirrorPlugin2
|
842
|
+
} from "@prosekit/pm/state";
|
829
843
|
|
830
844
|
// src/utils/combine-event-handlers.ts
|
831
845
|
function combineEventHandlers() {
|
@@ -900,7 +914,10 @@ var domEventFacet = defineFacet(
|
|
900
914
|
);
|
901
915
|
|
902
916
|
// src/extensions/events/editor-event.ts
|
903
|
-
import {
|
917
|
+
import {
|
918
|
+
PluginKey as PluginKey3,
|
919
|
+
ProseMirrorPlugin as ProseMirrorPlugin3
|
920
|
+
} from "@prosekit/pm/state";
|
904
921
|
function defineEventFacetPayload(payload) {
|
905
922
|
return defineFacetPayload(editorEventFacet, [payload]);
|
906
923
|
}
|
@@ -1011,7 +1028,11 @@ function defineFocusChangeHandler(handler) {
|
|
1011
1028
|
}
|
1012
1029
|
|
1013
1030
|
// src/extensions/history.ts
|
1014
|
-
import {
|
1031
|
+
import {
|
1032
|
+
history,
|
1033
|
+
redo,
|
1034
|
+
undo
|
1035
|
+
} from "@prosekit/pm/history";
|
1015
1036
|
|
1016
1037
|
// src/utils/env.ts
|
1017
1038
|
var isApple = typeof navigator !== "undefined" ? /Mac|iP(hone|[ao]d)/.test(navigator.platform) : false;
|
@@ -1019,7 +1040,10 @@ var isApple = typeof navigator !== "undefined" ? /Mac|iP(hone|[ao]d)/.test(navig
|
|
1019
1040
|
// src/extensions/keymap.ts
|
1020
1041
|
import { chainCommands } from "@prosekit/pm/commands";
|
1021
1042
|
import { keydownHandler } from "@prosekit/pm/keymap";
|
1022
|
-
import {
|
1043
|
+
import {
|
1044
|
+
Plugin as Plugin2,
|
1045
|
+
PluginKey as PluginKey4
|
1046
|
+
} from "@prosekit/pm/state";
|
1023
1047
|
import mapValues from "just-map-values";
|
1024
1048
|
function defineKeymap(keymap2) {
|
1025
1049
|
return defineFacetPayload(keymapFacet, [keymap2]);
|
@@ -1163,9 +1187,7 @@ var markSpecFacet = defineFacet({
|
|
1163
1187
|
spec.toDOM = wrapOutputSpecAttrs(spec.toDOM, attrs);
|
1164
1188
|
}
|
1165
1189
|
if (spec.parseDOM) {
|
1166
|
-
spec.parseDOM = spec.parseDOM.map(
|
1167
|
-
(rule) => wrapParseRuleAttrs(rule, attrs)
|
1168
|
-
);
|
1190
|
+
spec.parseDOM = spec.parseDOM.map((rule) => wrapParseRuleAttrs(rule, attrs));
|
1169
1191
|
}
|
1170
1192
|
specs = specs.update(type, spec);
|
1171
1193
|
}
|
@@ -1181,8 +1203,72 @@ function wrapParseRuleAttrs(rule, attrs) {
|
|
1181
1203
|
return rule;
|
1182
1204
|
}
|
1183
1205
|
|
1206
|
+
// src/extensions/mark-view.ts
|
1207
|
+
import {
|
1208
|
+
PluginKey as PluginKey5,
|
1209
|
+
ProseMirrorPlugin as ProseMirrorPlugin4
|
1210
|
+
} from "@prosekit/pm/state";
|
1211
|
+
function defineMarkView(options) {
|
1212
|
+
return defineFacetPayload(markViewFacet, [options]);
|
1213
|
+
}
|
1214
|
+
var markViewFacet = defineFacet({
|
1215
|
+
reducer: (inputs) => {
|
1216
|
+
const markViews = {};
|
1217
|
+
for (const input of inputs) {
|
1218
|
+
if (!markViews[input.name]) {
|
1219
|
+
markViews[input.name] = input.constructor;
|
1220
|
+
}
|
1221
|
+
}
|
1222
|
+
return () => [
|
1223
|
+
new ProseMirrorPlugin4({
|
1224
|
+
key: new PluginKey5("prosekit-mark-view"),
|
1225
|
+
props: { markViews }
|
1226
|
+
})
|
1227
|
+
];
|
1228
|
+
},
|
1229
|
+
parent: pluginFacet
|
1230
|
+
});
|
1231
|
+
|
1232
|
+
// src/extensions/mark-view-effect.ts
|
1233
|
+
import {
|
1234
|
+
PluginKey as PluginKey6,
|
1235
|
+
ProseMirrorPlugin as ProseMirrorPlugin5
|
1236
|
+
} from "@prosekit/pm/state";
|
1237
|
+
function defineMarkViewFactory(options) {
|
1238
|
+
const input = [options, null];
|
1239
|
+
return defineFacetPayload(markViewFactoryFacet, [input]);
|
1240
|
+
}
|
1241
|
+
function defineMarkViewComponent(options) {
|
1242
|
+
const input = [null, options];
|
1243
|
+
return defineFacetPayload(markViewFactoryFacet, [input]);
|
1244
|
+
}
|
1245
|
+
var isServer = typeof window === "undefined";
|
1246
|
+
var markViewFactoryFacet = defineFacet({
|
1247
|
+
reducer: (inputs) => {
|
1248
|
+
if (isServer) return [];
|
1249
|
+
const markViews = {};
|
1250
|
+
const factories = inputs.map((x) => x[0]).filter(isNotNullish);
|
1251
|
+
const options = inputs.map((x) => x[1]).filter(isNotNullish);
|
1252
|
+
for (const { group, name, args } of options) {
|
1253
|
+
const factory = factories.find((factory2) => factory2.group === group);
|
1254
|
+
if (!factory) continue;
|
1255
|
+
markViews[name] = factory.factory(args);
|
1256
|
+
}
|
1257
|
+
return () => [
|
1258
|
+
new ProseMirrorPlugin5({
|
1259
|
+
key: new PluginKey6("prosekit-mark-view-effect"),
|
1260
|
+
props: { markViews }
|
1261
|
+
})
|
1262
|
+
];
|
1263
|
+
},
|
1264
|
+
parent: pluginFacet
|
1265
|
+
});
|
1266
|
+
|
1184
1267
|
// src/extensions/node-view.ts
|
1185
|
-
import {
|
1268
|
+
import {
|
1269
|
+
PluginKey as PluginKey7,
|
1270
|
+
ProseMirrorPlugin as ProseMirrorPlugin6
|
1271
|
+
} from "@prosekit/pm/state";
|
1186
1272
|
function defineNodeView(options) {
|
1187
1273
|
return defineFacetPayload(nodeViewFacet, [options]);
|
1188
1274
|
}
|
@@ -1195,8 +1281,8 @@ var nodeViewFacet = defineFacet({
|
|
1195
1281
|
}
|
1196
1282
|
}
|
1197
1283
|
return () => [
|
1198
|
-
new
|
1199
|
-
key: new
|
1284
|
+
new ProseMirrorPlugin6({
|
1285
|
+
key: new PluginKey7("prosekit-node-view"),
|
1200
1286
|
props: { nodeViews }
|
1201
1287
|
})
|
1202
1288
|
];
|
@@ -1205,7 +1291,10 @@ var nodeViewFacet = defineFacet({
|
|
1205
1291
|
});
|
1206
1292
|
|
1207
1293
|
// src/extensions/node-view-effect.ts
|
1208
|
-
import {
|
1294
|
+
import {
|
1295
|
+
PluginKey as PluginKey8,
|
1296
|
+
ProseMirrorPlugin as ProseMirrorPlugin7
|
1297
|
+
} from "@prosekit/pm/state";
|
1209
1298
|
function defineNodeViewFactory(options) {
|
1210
1299
|
const input = [options, null];
|
1211
1300
|
return defineFacetPayload(nodeViewFactoryFacet, [input]);
|
@@ -1214,10 +1303,10 @@ function defineNodeViewComponent(options) {
|
|
1214
1303
|
const input = [null, options];
|
1215
1304
|
return defineFacetPayload(nodeViewFactoryFacet, [input]);
|
1216
1305
|
}
|
1217
|
-
var
|
1306
|
+
var isServer2 = typeof window === "undefined";
|
1218
1307
|
var nodeViewFactoryFacet = defineFacet({
|
1219
1308
|
reducer: (inputs) => {
|
1220
|
-
if (
|
1309
|
+
if (isServer2) return [];
|
1221
1310
|
const nodeViews = {};
|
1222
1311
|
const factories = inputs.map((x) => x[0]).filter(isNotNullish);
|
1223
1312
|
const options = inputs.map((x) => x[1]).filter(isNotNullish);
|
@@ -1227,8 +1316,8 @@ var nodeViewFactoryFacet = defineFacet({
|
|
1227
1316
|
nodeViews[name] = factory.factory(args);
|
1228
1317
|
}
|
1229
1318
|
return () => [
|
1230
|
-
new
|
1231
|
-
key: new
|
1319
|
+
new ProseMirrorPlugin7({
|
1320
|
+
key: new PluginKey8("prosekit-node-view-effect"),
|
1232
1321
|
props: { nodeViews }
|
1233
1322
|
})
|
1234
1323
|
];
|
@@ -1294,7 +1383,10 @@ function collectChildren(parent) {
|
|
1294
1383
|
}
|
1295
1384
|
|
1296
1385
|
// src/utils/collect-nodes.ts
|
1297
|
-
import {
|
1386
|
+
import {
|
1387
|
+
ProseMirrorFragment,
|
1388
|
+
ProseMirrorNode
|
1389
|
+
} from "@prosekit/pm/model";
|
1298
1390
|
function collectNodes(content) {
|
1299
1391
|
if (Array.isArray(content)) {
|
1300
1392
|
return content.flatMap(collectNodes);
|
@@ -1332,8 +1424,9 @@ function getId() {
|
|
1332
1424
|
// src/utils/is-at-block-start.ts
|
1333
1425
|
function isAtBlockStart(state, view) {
|
1334
1426
|
const { $cursor } = state.selection;
|
1335
|
-
if (!$cursor || (view ? !view.endOfTextblock("backward", state) : $cursor.parentOffset > 0))
|
1427
|
+
if (!$cursor || (view ? !view.endOfTextblock("backward", state) : $cursor.parentOffset > 0)) {
|
1336
1428
|
return null;
|
1429
|
+
}
|
1337
1430
|
return $cursor;
|
1338
1431
|
}
|
1339
1432
|
|
@@ -1399,6 +1492,9 @@ export {
|
|
1399
1492
|
defineKeymap,
|
1400
1493
|
defineMarkAttr,
|
1401
1494
|
defineMarkSpec,
|
1495
|
+
defineMarkView,
|
1496
|
+
defineMarkViewComponent,
|
1497
|
+
defineMarkViewFactory,
|
1402
1498
|
defineMountHandler,
|
1403
1499
|
defineNodeAttr,
|
1404
1500
|
defineNodeSpec,
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/core",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.7.
|
4
|
+
"version": "0.7.14",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -45,14 +45,14 @@
|
|
45
45
|
"just-map-values": "^3.2.0",
|
46
46
|
"orderedmap": "^2.1.1",
|
47
47
|
"prosemirror-splittable": "^0.1.1",
|
48
|
-
"type-fest": "^4.
|
48
|
+
"type-fest": "^4.30.2",
|
49
49
|
"@prosekit/pm": "^0.1.9"
|
50
50
|
},
|
51
51
|
"devDependencies": {
|
52
|
-
"@vitest/browser": "^2.1.
|
52
|
+
"@vitest/browser": "^2.1.8",
|
53
53
|
"tsup": "^8.3.5",
|
54
|
-
"typescript": "
|
55
|
-
"vitest": "^2.1.
|
54
|
+
"typescript": "~5.6.3",
|
55
|
+
"vitest": "^2.1.8",
|
56
56
|
"@prosekit/dev": "0.0.0"
|
57
57
|
},
|
58
58
|
"scripts": {
|