@arbidocs/coedit 0.4.120 → 0.4.122
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/commands.cjs +222 -12
- package/dist/commands.cjs.map +1 -1
- package/dist/commands.d.cts +82 -5
- package/dist/commands.d.ts +82 -5
- package/dist/commands.js +217 -13
- package/dist/commands.js.map +1 -1
- package/dist/encoding.d.cts +2 -0
- package/dist/encoding.d.ts +2 -0
- package/dist/hocuspocus.cjs +27 -0
- package/dist/hocuspocus.cjs.map +1 -1
- package/dist/hocuspocus.js +27 -0
- package/dist/hocuspocus.js.map +1 -1
- package/dist/index.cjs +27 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -1
- package/dist/{port-ip7WByvH.d.cts → port-BbN5OZHx.d.cts} +24 -1
- package/dist/{port-ip7WByvH.d.ts → port-BbN5OZHx.d.ts} +24 -1
- package/dist/server.cjs +65 -2
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +65 -2
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -745,6 +745,10 @@ var NodeRegistry = class {
|
|
|
745
745
|
get(id) {
|
|
746
746
|
return this.entries.get(id);
|
|
747
747
|
}
|
|
748
|
+
/** Whether the id names a node, one inside a paragraph that is not open yet included. */
|
|
749
|
+
has(id) {
|
|
750
|
+
return (this.entries.get(id) ?? this.resolveInsideParagraph(id)) !== void 0;
|
|
751
|
+
}
|
|
748
752
|
require(id) {
|
|
749
753
|
let entry = this.entries.get(id) ?? this.resolveInsideParagraph(id);
|
|
750
754
|
if (!entry) throw new RegistryError(`journal names unknown node ${id}`);
|
|
@@ -1145,8 +1149,31 @@ function moveNode(registry, id, destinationId, destinationIndex) {
|
|
|
1145
1149
|
const destination = childrenOf(asLiveElement(destinationEntry.live, destinationId));
|
|
1146
1150
|
destination.insert(destinationIndex, [registry.toLive(copy)]);
|
|
1147
1151
|
}
|
|
1152
|
+
function renameNode(registry, id, qname) {
|
|
1153
|
+
const entry = registry.require(id);
|
|
1154
|
+
if ("plain" in entry) {
|
|
1155
|
+
const el = entry.plain;
|
|
1156
|
+
if (el.type !== "element") return false;
|
|
1157
|
+
el.ns = qname.namespaceUri;
|
|
1158
|
+
el.local = qname.localName;
|
|
1159
|
+
if (qname.prefix === void 0) delete el.prefix;
|
|
1160
|
+
else el.prefix = qname.prefix;
|
|
1161
|
+
registry.touch(el);
|
|
1162
|
+
return true;
|
|
1163
|
+
}
|
|
1164
|
+
const live = entry.live;
|
|
1165
|
+
if (live instanceof Y3__namespace.Text || isRichParagraph(live)) return false;
|
|
1166
|
+
if (live.get("ns") !== qname.namespaceUri) live.set("ns", qname.namespaceUri);
|
|
1167
|
+
if (live.get("local") !== qname.localName) live.set("local", qname.localName);
|
|
1168
|
+
if (qname.prefix === void 0) {
|
|
1169
|
+
if (live.has("prefix")) live.delete("prefix");
|
|
1170
|
+
} else if (live.get("prefix") !== qname.prefix) live.set("prefix", qname.prefix);
|
|
1171
|
+
return true;
|
|
1172
|
+
}
|
|
1148
1173
|
function putNode(registry, effect) {
|
|
1149
1174
|
const d = effect.descriptor;
|
|
1175
|
+
if (d.kind !== "textValue" && registry.has(d.logicalId) && renameNode(registry, d.logicalId, d.qname))
|
|
1176
|
+
return;
|
|
1150
1177
|
if (d.kind === "textValue") {
|
|
1151
1178
|
registry.registerPlain({ type: "text", id: d.logicalId, value: "" });
|
|
1152
1179
|
return;
|