@arbidocs/coedit 0.5.134 → 0.5.136

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.
@@ -1,5 +1,5 @@
1
- import { g as DocParagraph, l as ListItemInfo, k as LevelOf, R as ReferencesPort, a as CrossReferenceTarget, h as DocPoint, O as OoxmlNodeLike, b as DefinitionsPort, j as DocumentNumbering } from './port-BbN5OZHx.cjs';
2
- export { B as BROKEN_CROSS_REFERENCE_STYLE, C as CROSS_REFERENCE_STYLE, D as DEFINED_TERM_STYLE, c as DocField, d as DocLink, e as DocMark, f as DocNote, i as DocRevision, F as FIELD_ATOM, L as LevelInfo, N as NumberingSource, W as WATCHED_STYLES, m as documentNumbering, n as engineLength, o as engineOffset, p as filterTargets, q as listTargets, r as paragraphNumber, s as readParagraphs, t as styleNames } from './port-BbN5OZHx.cjs';
1
+ import { g as DocParagraph, l as ListItemInfo, k as LevelOf, R as ReferencesPort, a as CrossReferenceTarget, h as DocPoint, O as OoxmlNodeLike, b as DefinitionsPort, j as DocumentNumbering } from './port-DXBNxZYw.cjs';
2
+ export { B as BROKEN_CROSS_REFERENCE_STYLE, C as CROSS_REFERENCE_STYLE, D as DEFINED_TERM_STYLE, c as DocField, d as DocLink, e as DocMark, f as DocNote, i as DocRevision, F as FIELD_ATOM, L as LevelInfo, N as NumberingSource, W as WATCHED_STYLES, m as documentNumbering, n as engineLength, o as engineOffset, p as filterTargets, q as listTargets, r as paragraphNumber, s as readParagraphs, t as styleNames } from './port-DXBNxZYw.cjs';
3
3
  import { OoxmlProperty, TabStopWrite, TreeDocOp } from '@docx-editor.dev/core/store';
4
4
  import { ParsedDefinition, DefinitionText } from './ooxml.cjs';
5
5
  export { DEFINITION_BOOKMARK_PREFIX, W_NAMESPACES, compareTerms, definitionBookmark, definitionIdOfBookmark, documentXml, docxPackage, esc, hyperlinkRelationship, parseDefinition, stylesXml, termKey } from './ooxml.cjs';
@@ -1,5 +1,5 @@
1
- import { g as DocParagraph, l as ListItemInfo, k as LevelOf, R as ReferencesPort, a as CrossReferenceTarget, h as DocPoint, O as OoxmlNodeLike, b as DefinitionsPort, j as DocumentNumbering } from './port-BbN5OZHx.js';
2
- export { B as BROKEN_CROSS_REFERENCE_STYLE, C as CROSS_REFERENCE_STYLE, D as DEFINED_TERM_STYLE, c as DocField, d as DocLink, e as DocMark, f as DocNote, i as DocRevision, F as FIELD_ATOM, L as LevelInfo, N as NumberingSource, W as WATCHED_STYLES, m as documentNumbering, n as engineLength, o as engineOffset, p as filterTargets, q as listTargets, r as paragraphNumber, s as readParagraphs, t as styleNames } from './port-BbN5OZHx.js';
1
+ import { g as DocParagraph, l as ListItemInfo, k as LevelOf, R as ReferencesPort, a as CrossReferenceTarget, h as DocPoint, O as OoxmlNodeLike, b as DefinitionsPort, j as DocumentNumbering } from './port-DXBNxZYw.js';
2
+ export { B as BROKEN_CROSS_REFERENCE_STYLE, C as CROSS_REFERENCE_STYLE, D as DEFINED_TERM_STYLE, c as DocField, d as DocLink, e as DocMark, f as DocNote, i as DocRevision, F as FIELD_ATOM, L as LevelInfo, N as NumberingSource, W as WATCHED_STYLES, m as documentNumbering, n as engineLength, o as engineOffset, p as filterTargets, q as listTargets, r as paragraphNumber, s as readParagraphs, t as styleNames } from './port-DXBNxZYw.js';
3
3
  import { OoxmlProperty, TabStopWrite, TreeDocOp } from '@docx-editor.dev/core/store';
4
4
  import { ParsedDefinition, DefinitionText } from './ooxml.js';
5
5
  export { DEFINITION_BOOKMARK_PREFIX, W_NAMESPACES, compareTerms, definitionBookmark, definitionIdOfBookmark, documentXml, docxPackage, esc, hyperlinkRelationship, parseDefinition, stylesXml, termKey } from './ooxml.js';
package/dist/commands.js CHANGED
@@ -1161,7 +1161,13 @@ var headingStyle = (paragraphs) => paragraphs.find((p) => p.topLevel && p.headin
1161
1161
  function insertParagraphs(port, index, body, count, keep) {
1162
1162
  const before = port.paragraphs();
1163
1163
  const kept = keep ? before.findIndex((p) => p.id === keep.paragraphId) : -1;
1164
- if (index < before.length) {
1164
+ const separateParagraph = index > 0 && index < before.length;
1165
+ if (separateParagraph) {
1166
+ const previous = before[index - 1];
1167
+ port.setCaret({ paragraphId: previous.id, offset: engineLength(previous) });
1168
+ port.splitParagraph();
1169
+ port.setCaret({ paragraphId: port.paragraphs()[index].id, offset: 0 });
1170
+ } else if (index < before.length) {
1165
1171
  port.setCaret({ paragraphId: before[index].id, offset: 0 });
1166
1172
  } else {
1167
1173
  const last = before[before.length - 1];
@@ -1171,6 +1177,17 @@ function insertParagraphs(port, index, body, count, keep) {
1171
1177
  port.setCaret({ paragraphId: opened[opened.length - 1].id, offset: 0 });
1172
1178
  }
1173
1179
  if (!port.paste(body, "", true)) throw new Error("The definition could not be added.");
1180
+ if (separateParagraph) {
1181
+ const inserted = port.paragraphs();
1182
+ const last = inserted[index + count - 1];
1183
+ const empty = inserted[index + count];
1184
+ if (port.joinEmptyParagraph) port.joinEmptyParagraph(last.id, empty.id);
1185
+ else
1186
+ port.deleteRange(
1187
+ { paragraphId: last.id, offset: engineLength(last) },
1188
+ { paragraphId: empty.id, offset: 0 }
1189
+ );
1190
+ }
1174
1191
  if (!keep || kept < 0) return keep;
1175
1192
  const after = port.paragraphs();
1176
1193
  const moved = index <= kept ? kept + count : kept;