@arbidocs/coedit 0.5.135 → 0.5.137
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 +18 -1
- package/dist/commands.cjs.map +1 -1
- package/dist/commands.d.cts +2 -2
- package/dist/commands.d.ts +2 -2
- package/dist/commands.js +18 -1
- package/dist/commands.js.map +1 -1
- package/dist/{port-BbN5OZHx.d.cts → port-DXBNxZYw.d.cts} +2 -0
- package/dist/{port-BbN5OZHx.d.ts → port-DXBNxZYw.d.ts} +2 -0
- package/dist/server.cjs +16 -0
- 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 +16 -0
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
package/dist/commands.cjs
CHANGED
|
@@ -1163,7 +1163,13 @@ var headingStyle = (paragraphs) => paragraphs.find((p) => p.topLevel && p.headin
|
|
|
1163
1163
|
function insertParagraphs(port, index, body, count, keep) {
|
|
1164
1164
|
const before = port.paragraphs();
|
|
1165
1165
|
const kept = keep ? before.findIndex((p) => p.id === keep.paragraphId) : -1;
|
|
1166
|
-
|
|
1166
|
+
const separateParagraph = index > 0 && index < before.length;
|
|
1167
|
+
if (separateParagraph) {
|
|
1168
|
+
const previous = before[index - 1];
|
|
1169
|
+
port.setCaret({ paragraphId: previous.id, offset: engineLength(previous) });
|
|
1170
|
+
port.splitParagraph();
|
|
1171
|
+
port.setCaret({ paragraphId: port.paragraphs()[index].id, offset: 0 });
|
|
1172
|
+
} else if (index < before.length) {
|
|
1167
1173
|
port.setCaret({ paragraphId: before[index].id, offset: 0 });
|
|
1168
1174
|
} else {
|
|
1169
1175
|
const last = before[before.length - 1];
|
|
@@ -1173,6 +1179,17 @@ function insertParagraphs(port, index, body, count, keep) {
|
|
|
1173
1179
|
port.setCaret({ paragraphId: opened[opened.length - 1].id, offset: 0 });
|
|
1174
1180
|
}
|
|
1175
1181
|
if (!port.paste(body, "", true)) throw new Error("The definition could not be added.");
|
|
1182
|
+
if (separateParagraph) {
|
|
1183
|
+
const inserted = port.paragraphs();
|
|
1184
|
+
const last = inserted[index + count - 1];
|
|
1185
|
+
const empty = inserted[index + count];
|
|
1186
|
+
if (port.joinEmptyParagraph) port.joinEmptyParagraph(last.id, empty.id);
|
|
1187
|
+
else
|
|
1188
|
+
port.deleteRange(
|
|
1189
|
+
{ paragraphId: last.id, offset: engineLength(last) },
|
|
1190
|
+
{ paragraphId: empty.id, offset: 0 }
|
|
1191
|
+
);
|
|
1192
|
+
}
|
|
1176
1193
|
if (!keep || kept < 0) return keep;
|
|
1177
1194
|
const after = port.paragraphs();
|
|
1178
1195
|
const moved = index <= kept ? kept + count : kept;
|