@prosekit/core 0.5.0 → 0.5.1
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/prosekit-core.js +13 -7
- package/package.json +5 -5
package/dist/prosekit-core.js
CHANGED
@@ -1091,7 +1091,11 @@ var EditorInstance = class {
|
|
1091
1091
|
return this.cachedState;
|
1092
1092
|
}
|
1093
1093
|
updateExtension(extension, add) {
|
1094
|
-
var _a, _b, _c, _d
|
1094
|
+
var _a, _b, _c, _d;
|
1095
|
+
const view = this.view;
|
1096
|
+
if (!view || view.isDestroyed) {
|
1097
|
+
return;
|
1098
|
+
}
|
1095
1099
|
const tree = extension.getTree();
|
1096
1100
|
const payload = tree.getRootOutput();
|
1097
1101
|
if (payload == null ? void 0 : payload.schema) {
|
@@ -1101,14 +1105,13 @@ var EditorInstance = class {
|
|
1101
1105
|
throw new ProseKitError("View cannot be changed");
|
1102
1106
|
}
|
1103
1107
|
const oldPayload = this.tree.getRootOutput();
|
1104
|
-
const oldPlugins = [...(
|
1108
|
+
const oldPlugins = [...(_b = (_a = view.state) == null ? void 0 : _a.plugins) != null ? _b : []];
|
1105
1109
|
this.tree = add ? unionFacetNode(this.tree, tree) : subtractFacetNode(this.tree, tree);
|
1106
1110
|
const newPayload = this.tree.getRootOutput();
|
1107
|
-
const newPlugins = [...(
|
1111
|
+
const newPlugins = [...(_d = (_c = newPayload == null ? void 0 : newPayload.state) == null ? void 0 : _c.plugins) != null ? _d : []];
|
1108
1112
|
if (!deepEquals(oldPlugins, newPlugins)) {
|
1109
|
-
|
1110
|
-
|
1111
|
-
this.view.updateState(state);
|
1113
|
+
const state = view.state.reconfigure({ plugins: newPlugins });
|
1114
|
+
view.updateState(state);
|
1112
1115
|
}
|
1113
1116
|
if ((newPayload == null ? void 0 : newPayload.commands) && !deepEquals(oldPayload == null ? void 0 : oldPayload.commands, newPayload == null ? void 0 : newPayload.commands)) {
|
1114
1117
|
const commands = newPayload.commands;
|
@@ -1134,6 +1137,9 @@ var EditorInstance = class {
|
|
1134
1137
|
this.view.destroy();
|
1135
1138
|
this.view = null;
|
1136
1139
|
}
|
1140
|
+
get mounted() {
|
1141
|
+
return !!this.view && !this.view.isDestroyed;
|
1142
|
+
}
|
1137
1143
|
get assertView() {
|
1138
1144
|
if (!this.view) {
|
1139
1145
|
throw new ProseKitError("Editor is not mounted");
|
@@ -1200,7 +1206,7 @@ var Editor = class _Editor {
|
|
1200
1206
|
* Whether the editor is mounted.
|
1201
1207
|
*/
|
1202
1208
|
get mounted() {
|
1203
|
-
return
|
1209
|
+
return this.instance.mounted;
|
1204
1210
|
}
|
1205
1211
|
/**
|
1206
1212
|
* The editor view.
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/core",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.5.
|
4
|
+
"version": "0.5.1",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -35,16 +35,16 @@
|
|
35
35
|
"dist"
|
36
36
|
],
|
37
37
|
"dependencies": {
|
38
|
-
"@prosekit/pm": "^0.1.
|
38
|
+
"@prosekit/pm": "^0.1.4",
|
39
39
|
"clsx": "^2.1.1",
|
40
40
|
"orderedmap": "^2.1.1",
|
41
|
-
"type-fest": "^4.18.
|
41
|
+
"type-fest": "^4.18.2"
|
42
42
|
},
|
43
43
|
"devDependencies": {
|
44
|
-
"@prosekit/dev": "*",
|
45
44
|
"tsup": "^8.0.2",
|
46
45
|
"typescript": "^5.4.5",
|
47
|
-
"vitest": "^1.6.0"
|
46
|
+
"vitest": "^1.6.0",
|
47
|
+
"@prosekit/dev": "0.0.0"
|
48
48
|
},
|
49
49
|
"scripts": {
|
50
50
|
"build:tsup": "tsup",
|