@arbidocs/coedit 0.4.120 → 0.4.121
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/encoding.d.cts
CHANGED
|
@@ -57,6 +57,8 @@ declare class NodeRegistry {
|
|
|
57
57
|
dropPart(partName: string): void;
|
|
58
58
|
private index;
|
|
59
59
|
get(id: string): RegistryEntry | undefined;
|
|
60
|
+
/** Whether the id names a node, one inside a paragraph that is not open yet included. */
|
|
61
|
+
has(id: string): boolean;
|
|
60
62
|
require(id: string): RegistryEntry;
|
|
61
63
|
/** An id inside a paragraph that is not open yet: open the paragraph it belongs to. */
|
|
62
64
|
private resolveInsideParagraph;
|
package/dist/encoding.d.ts
CHANGED
|
@@ -57,6 +57,8 @@ declare class NodeRegistry {
|
|
|
57
57
|
dropPart(partName: string): void;
|
|
58
58
|
private index;
|
|
59
59
|
get(id: string): RegistryEntry | undefined;
|
|
60
|
+
/** Whether the id names a node, one inside a paragraph that is not open yet included. */
|
|
61
|
+
has(id: string): boolean;
|
|
60
62
|
require(id: string): RegistryEntry;
|
|
61
63
|
/** An id inside a paragraph that is not open yet: open the paragraph it belongs to. */
|
|
62
64
|
private resolveInsideParagraph;
|
package/dist/hocuspocus.cjs
CHANGED
|
@@ -750,6 +750,10 @@ var NodeRegistry = class {
|
|
|
750
750
|
get(id) {
|
|
751
751
|
return this.entries.get(id);
|
|
752
752
|
}
|
|
753
|
+
/** Whether the id names a node, one inside a paragraph that is not open yet included. */
|
|
754
|
+
has(id) {
|
|
755
|
+
return (this.entries.get(id) ?? this.resolveInsideParagraph(id)) !== void 0;
|
|
756
|
+
}
|
|
753
757
|
require(id) {
|
|
754
758
|
let entry = this.entries.get(id) ?? this.resolveInsideParagraph(id);
|
|
755
759
|
if (!entry) throw new RegistryError(`journal names unknown node ${id}`);
|
|
@@ -1150,8 +1154,31 @@ function moveNode(registry, id, destinationId, destinationIndex) {
|
|
|
1150
1154
|
const destination = childrenOf(asLiveElement(destinationEntry.live, destinationId));
|
|
1151
1155
|
destination.insert(destinationIndex, [registry.toLive(copy)]);
|
|
1152
1156
|
}
|
|
1157
|
+
function renameNode(registry, id, qname) {
|
|
1158
|
+
const entry = registry.require(id);
|
|
1159
|
+
if ("plain" in entry) {
|
|
1160
|
+
const el = entry.plain;
|
|
1161
|
+
if (el.type !== "element") return false;
|
|
1162
|
+
el.ns = qname.namespaceUri;
|
|
1163
|
+
el.local = qname.localName;
|
|
1164
|
+
if (qname.prefix === void 0) delete el.prefix;
|
|
1165
|
+
else el.prefix = qname.prefix;
|
|
1166
|
+
registry.touch(el);
|
|
1167
|
+
return true;
|
|
1168
|
+
}
|
|
1169
|
+
const live = entry.live;
|
|
1170
|
+
if (live instanceof Y3__namespace.Text || isRichParagraph(live)) return false;
|
|
1171
|
+
if (live.get("ns") !== qname.namespaceUri) live.set("ns", qname.namespaceUri);
|
|
1172
|
+
if (live.get("local") !== qname.localName) live.set("local", qname.localName);
|
|
1173
|
+
if (qname.prefix === void 0) {
|
|
1174
|
+
if (live.has("prefix")) live.delete("prefix");
|
|
1175
|
+
} else if (live.get("prefix") !== qname.prefix) live.set("prefix", qname.prefix);
|
|
1176
|
+
return true;
|
|
1177
|
+
}
|
|
1153
1178
|
function putNode(registry, effect) {
|
|
1154
1179
|
const d = effect.descriptor;
|
|
1180
|
+
if (d.kind !== "textValue" && registry.has(d.logicalId) && renameNode(registry, d.logicalId, d.qname))
|
|
1181
|
+
return;
|
|
1155
1182
|
if (d.kind === "textValue") {
|
|
1156
1183
|
registry.registerPlain({ type: "text", id: d.logicalId, value: "" });
|
|
1157
1184
|
return;
|