@univerjs/docs 1.0.0-rc.0 → 1.0.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/lib/cjs/facade.js +66 -20
- package/lib/cjs/index.js +347 -64
- package/lib/es/facade.js +66 -20
- package/lib/es/index.js +349 -66
- package/lib/facade.js +66 -20
- package/lib/index.js +349 -66
- package/lib/types/commands/mutations/core-editing.mutation.d.ts +2 -0
- package/lib/types/commands/mutations/doc-structure-mutation-validation.d.ts +2 -1
- package/lib/types/facade/f-document-section.d.ts +28 -0
- package/lib/types/facade/f-document-text-range.d.ts +4 -0
- package/lib/types/facade/f-document.d.ts +29 -13
- package/lib/types/facade/f-univer.d.ts +2 -2
- package/lib/types/layout-worker/config/config.d.ts +8 -0
- package/lib/types/layout-worker/font-loader.d.ts +26 -0
- package/lib/types/layout-worker/index.d.ts +5 -2
- package/lib/types/layout-worker/protocol.d.ts +2 -0
- package/lib/types/layout-worker/worker.d.ts +3 -1
- package/lib/types/plugin.d.ts +1 -0
- package/lib/types/services/doc-layout-executor.service.d.ts +6 -0
- package/lib/types/services/doc-state-change-manager.service.d.ts +2 -0
- package/lib/types/services/doc-state-emit.service.d.ts +1 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +2 -2
- package/package.json +7 -7
package/lib/cjs/facade.js
CHANGED
|
@@ -304,7 +304,7 @@ function stripBlockTokens(text) {
|
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
//#endregion
|
|
307
|
-
//#region \0@oxc-project+runtime@0.
|
|
307
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
|
|
308
308
|
function __decorateParam(paramIndex, decorator) {
|
|
309
309
|
return function(target, key) {
|
|
310
310
|
decorator(target, key, paramIndex);
|
|
@@ -312,7 +312,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
//#endregion
|
|
315
|
-
//#region \0@oxc-project+runtime@0.
|
|
315
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
|
|
316
316
|
function __decorate(decorators, target, key, desc) {
|
|
317
317
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
318
318
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -421,6 +421,8 @@ let FDocumentTextRange = class FDocumentTextRange extends _univerjs_core_facade.
|
|
|
421
421
|
* Existing text-run splitting, merging, and normalization are handled by
|
|
422
422
|
* the document mutation pipeline.
|
|
423
423
|
* `style.fs` is a font size in points (pt), not CSS pixels.
|
|
424
|
+
* @param {ITextStyle} style Text-style properties to merge into the range.
|
|
425
|
+
* @returns {boolean} Whether the style update succeeded; `false` for an empty range.
|
|
424
426
|
* @example
|
|
425
427
|
* ```ts
|
|
426
428
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -441,6 +443,8 @@ let FDocumentTextRange = class FDocumentTextRange extends _univerjs_core_facade.
|
|
|
441
443
|
}
|
|
442
444
|
/**
|
|
443
445
|
* Replaces the range with plain text while preserving document mutation semantics.
|
|
446
|
+
* @param {string} text Replacement plain text. An empty string deletes the range.
|
|
447
|
+
* @returns {boolean} Whether the replacement succeeded.
|
|
444
448
|
* @example
|
|
445
449
|
* ```ts
|
|
446
450
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -1000,6 +1004,10 @@ let FDocumentSection = class FDocumentSection {
|
|
|
1000
1004
|
* Sets equal or explicitly sized columns for this traditional section.
|
|
1001
1005
|
* Use `columnCount = 1` to restore normal single-column layout.
|
|
1002
1006
|
* `gap` and `widths` are in 96-DPI layout pixels.
|
|
1007
|
+
* @param {number} columnCount Positive integer column count.
|
|
1008
|
+
* @param {IFDocumentSectionColumnOptions} [options] Column widths, gap (default 18 pixels), and separator (default none).
|
|
1009
|
+
* @returns {boolean} Whether the section update succeeded.
|
|
1010
|
+
* @throws {RangeError} If column dimensions or the separator are invalid, or columns exceed the available width.
|
|
1003
1011
|
* @example
|
|
1004
1012
|
* ```ts
|
|
1005
1013
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -1025,6 +1033,10 @@ let FDocumentSection = class FDocumentSection {
|
|
|
1025
1033
|
}
|
|
1026
1034
|
/**
|
|
1027
1035
|
* Sets explicit OOXML-compatible column width and trailing-space values in 96-DPI layout pixels.
|
|
1036
|
+
* @param {ISectionColumnProperties[]} columns Explicit widths and trailing spaces; an empty array restores a single column.
|
|
1037
|
+
* @param {ColumnSeparatorType} [separator] Column separator style. Defaults to `ColumnSeparatorType.NONE`.
|
|
1038
|
+
* @returns {boolean} Whether the section update succeeded.
|
|
1039
|
+
* @throws {RangeError} If column dimensions or the separator are invalid, or columns exceed the available width.
|
|
1028
1040
|
* @example
|
|
1029
1041
|
* ```ts
|
|
1030
1042
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -1191,6 +1203,8 @@ let FDocumentSection = class FDocumentSection {
|
|
|
1191
1203
|
}
|
|
1192
1204
|
/**
|
|
1193
1205
|
* Ensures a header segment linked specifically to this section.
|
|
1206
|
+
* @param {SectionHeaderFooterVariant} [variant] The `'default'`, `'first'`, or `'even'` variant. Defaults to `'default'`.
|
|
1207
|
+
* @returns {string} The existing or newly created section-specific segment ID.
|
|
1194
1208
|
* @example
|
|
1195
1209
|
* ```ts
|
|
1196
1210
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -1207,6 +1221,8 @@ let FDocumentSection = class FDocumentSection {
|
|
|
1207
1221
|
}
|
|
1208
1222
|
/**
|
|
1209
1223
|
* Ensures a footer segment linked specifically to this section.
|
|
1224
|
+
* @param {SectionHeaderFooterVariant} [variant] The `'default'`, `'first'`, or `'even'` variant. Defaults to `'default'`.
|
|
1225
|
+
* @returns {string} The existing or newly created section-specific segment ID.
|
|
1210
1226
|
* @example
|
|
1211
1227
|
* ```ts
|
|
1212
1228
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -1223,6 +1239,8 @@ let FDocumentSection = class FDocumentSection {
|
|
|
1223
1239
|
}
|
|
1224
1240
|
/**
|
|
1225
1241
|
* Returns the effective header id after resolving links to previous sections.
|
|
1242
|
+
* @param {SectionHeaderFooterVariant} [variant] The `'default'`, `'first'`, or `'even'` variant. Defaults to `'default'`.
|
|
1243
|
+
* @returns {string | null} The effective segment ID, or `null` if no segment is available.
|
|
1226
1244
|
* @example
|
|
1227
1245
|
* ```ts
|
|
1228
1246
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -1234,6 +1252,8 @@ let FDocumentSection = class FDocumentSection {
|
|
|
1234
1252
|
}
|
|
1235
1253
|
/**
|
|
1236
1254
|
* Returns the effective footer id after resolving links to previous sections.
|
|
1255
|
+
* @param {SectionHeaderFooterVariant} [variant] The `'default'`, `'first'`, or `'even'` variant. Defaults to `'default'`.
|
|
1256
|
+
* @returns {string | null} The effective segment ID, or `null` if no segment is available.
|
|
1237
1257
|
* @example
|
|
1238
1258
|
* ```ts
|
|
1239
1259
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -1245,6 +1265,8 @@ let FDocumentSection = class FDocumentSection {
|
|
|
1245
1265
|
}
|
|
1246
1266
|
/**
|
|
1247
1267
|
* Whether this header variant inherits the previous section's reference.
|
|
1268
|
+
* @param {SectionHeaderFooterVariant} [variant] The `'default'`, `'first'`, or `'even'` variant. Defaults to `'default'`.
|
|
1269
|
+
* @returns {boolean} Whether this variant inherits from the previous section.
|
|
1248
1270
|
* @example
|
|
1249
1271
|
* ```ts
|
|
1250
1272
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -1256,6 +1278,8 @@ let FDocumentSection = class FDocumentSection {
|
|
|
1256
1278
|
}
|
|
1257
1279
|
/**
|
|
1258
1280
|
* Whether this footer variant inherits the previous section's reference.
|
|
1281
|
+
* @param {SectionHeaderFooterVariant} [variant] The `'default'`, `'first'`, or `'even'` variant. Defaults to `'default'`.
|
|
1282
|
+
* @returns {boolean} Whether this variant inherits from the previous section.
|
|
1259
1283
|
* @example
|
|
1260
1284
|
* ```ts
|
|
1261
1285
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -1267,6 +1291,9 @@ let FDocumentSection = class FDocumentSection {
|
|
|
1267
1291
|
}
|
|
1268
1292
|
/**
|
|
1269
1293
|
* Links or unlinks this header variant. Unlinking clones the inherited header.
|
|
1294
|
+
* @param {boolean} linkedToPrevious Whether to inherit the previous section's header/footer.
|
|
1295
|
+
* @param {SectionHeaderFooterVariant} [variant] The `'default'`, `'first'`, or `'even'` variant. Defaults to `'default'`.
|
|
1296
|
+
* @returns {boolean} Whether the link update succeeded.
|
|
1270
1297
|
* @example
|
|
1271
1298
|
* ```ts
|
|
1272
1299
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -1280,6 +1307,9 @@ let FDocumentSection = class FDocumentSection {
|
|
|
1280
1307
|
}
|
|
1281
1308
|
/**
|
|
1282
1309
|
* Links or unlinks this footer variant. Unlinking clones the inherited footer.
|
|
1310
|
+
* @param {boolean} linkedToPrevious Whether to inherit the previous section's header/footer.
|
|
1311
|
+
* @param {SectionHeaderFooterVariant} [variant] The `'default'`, `'first'`, or `'even'` variant. Defaults to `'default'`.
|
|
1312
|
+
* @returns {boolean} Whether the link update succeeded.
|
|
1283
1313
|
* @example
|
|
1284
1314
|
* ```ts
|
|
1285
1315
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -1294,6 +1324,8 @@ let FDocumentSection = class FDocumentSection {
|
|
|
1294
1324
|
/**
|
|
1295
1325
|
* Updates header/footer switches and margins on this section break.
|
|
1296
1326
|
* `marginHeader` and `marginFooter` are in 96-DPI layout pixels.
|
|
1327
|
+
* @param {IHeaderFooterProps} options Header/footer switches and margins to update. Omitted properties are preserved.
|
|
1328
|
+
* @returns {boolean} Whether the update command succeeded.
|
|
1297
1329
|
* @example
|
|
1298
1330
|
* ```ts
|
|
1299
1331
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -1373,7 +1405,8 @@ let FDocumentSection = class FDocumentSection {
|
|
|
1373
1405
|
}
|
|
1374
1406
|
_getHeaderFooterReference(kind, variant) {
|
|
1375
1407
|
const { index } = this._resolve();
|
|
1376
|
-
|
|
1408
|
+
const snapshot = this._document.getDocumentDataModel().getSnapshot();
|
|
1409
|
+
return (0, _univerjs_core.resolveSectionHeaderFooterReference)(snapshot.documentStyle, (0, _univerjs_docs.getTopLevelSectionBreaks)(this._document.getBody()), index, (0, _univerjs_core.getSectionHeaderFooterReferenceKey)(kind, variant));
|
|
1377
1410
|
}
|
|
1378
1411
|
_describeHeaderFooterReference(kind, variant) {
|
|
1379
1412
|
const reference = this._getHeaderFooterReference(kind, variant);
|
|
@@ -1421,7 +1454,7 @@ let FDocumentSection = class FDocumentSection {
|
|
|
1421
1454
|
FDocumentSection = __decorate([__decorateParam(2, _univerjs_core.ICommandService), __decorateParam(3, _univerjs_core.IPermissionService)], FDocumentSection);
|
|
1422
1455
|
|
|
1423
1456
|
//#endregion
|
|
1424
|
-
//#region \0@oxc-project+runtime@0.
|
|
1457
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
|
|
1425
1458
|
function _typeof(o) {
|
|
1426
1459
|
"@babel/helpers - typeof";
|
|
1427
1460
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -1432,7 +1465,7 @@ function _typeof(o) {
|
|
|
1432
1465
|
}
|
|
1433
1466
|
|
|
1434
1467
|
//#endregion
|
|
1435
|
-
//#region \0@oxc-project+runtime@0.
|
|
1468
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
|
|
1436
1469
|
function toPrimitive(t, r) {
|
|
1437
1470
|
if ("object" != _typeof(t) || !t) return t;
|
|
1438
1471
|
var e = t[Symbol.toPrimitive];
|
|
@@ -1445,14 +1478,14 @@ function toPrimitive(t, r) {
|
|
|
1445
1478
|
}
|
|
1446
1479
|
|
|
1447
1480
|
//#endregion
|
|
1448
|
-
//#region \0@oxc-project+runtime@0.
|
|
1481
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
|
|
1449
1482
|
function toPropertyKey(t) {
|
|
1450
1483
|
var i = toPrimitive(t, "string");
|
|
1451
1484
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
1452
1485
|
}
|
|
1453
1486
|
|
|
1454
1487
|
//#endregion
|
|
1455
|
-
//#region \0@oxc-project+runtime@0.
|
|
1488
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
|
|
1456
1489
|
function _defineProperty(e, r, t) {
|
|
1457
1490
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
1458
1491
|
value: t,
|
|
@@ -1478,7 +1511,7 @@ let FDocument = class FDocument extends _univerjs_core_facade.FBaseInitialable {
|
|
|
1478
1511
|
}
|
|
1479
1512
|
/**
|
|
1480
1513
|
* Get the document data model of the document.
|
|
1481
|
-
* @param {string} segmentId The segment id used to get the header/footer data model. Defaults to an empty string for the document data model of the document.
|
|
1514
|
+
* @param {string} [segmentId] The segment id used to get the header/footer data model. Defaults to an empty string for the document data model of the document.
|
|
1482
1515
|
* @returns {DocumentDataModel} The document data model.
|
|
1483
1516
|
* @example
|
|
1484
1517
|
* ```typescript
|
|
@@ -1520,7 +1553,7 @@ let FDocument = class FDocument extends _univerjs_core_facade.FBaseInitialable {
|
|
|
1520
1553
|
* Get the document body or header/footer body by the segment id.
|
|
1521
1554
|
* The main body has an empty segment id.
|
|
1522
1555
|
* The header and footer body have their respective segment ids.
|
|
1523
|
-
* @param {string} segmentId The segment id of the body. Defaults to an empty string for the main body.
|
|
1556
|
+
* @param {string} [segmentId] The segment id of the body. Defaults to an empty string for the main body.
|
|
1524
1557
|
* @returns {IDocumentBody} The document body.
|
|
1525
1558
|
* @example
|
|
1526
1559
|
* ```typescript
|
|
@@ -1537,6 +1570,7 @@ let FDocument = class FDocument extends _univerjs_core_facade.FBaseInitialable {
|
|
|
1537
1570
|
if (!body) throw new Error(segmentId === "" ? "Body is not found in the document." : `Body is not found in the segment: ${segmentId}`);
|
|
1538
1571
|
return body;
|
|
1539
1572
|
}
|
|
1573
|
+
/** Releases this facade's resources. Use `univerAPI.disposeUnit()` to unload the owning unit. */
|
|
1540
1574
|
dispose() {
|
|
1541
1575
|
super.dispose();
|
|
1542
1576
|
}
|
|
@@ -1727,7 +1761,7 @@ let FDocument = class FDocument extends _univerjs_core_facade.FBaseInitialable {
|
|
|
1727
1761
|
}
|
|
1728
1762
|
/**
|
|
1729
1763
|
* Ensure the page header segment exists and return its segment id.
|
|
1730
|
-
* @param {number} pageIndex The zero-based page index. Defaults to the first page.
|
|
1764
|
+
* @param {number} [pageIndex] The zero-based page index. Defaults to the first page.
|
|
1731
1765
|
* @returns {string} The header segment id.
|
|
1732
1766
|
* @example
|
|
1733
1767
|
* ```ts
|
|
@@ -1741,7 +1775,7 @@ let FDocument = class FDocument extends _univerjs_core_facade.FBaseInitialable {
|
|
|
1741
1775
|
}
|
|
1742
1776
|
/**
|
|
1743
1777
|
* Ensure the page footer segment exists and return its segment id.
|
|
1744
|
-
* @param {number} pageIndex The zero-based page index. Defaults to the first page.
|
|
1778
|
+
* @param {number} [pageIndex] The zero-based page index. Defaults to the first page.
|
|
1745
1779
|
* @returns {string} The footer segment id.
|
|
1746
1780
|
* @example
|
|
1747
1781
|
* ```ts
|
|
@@ -1757,7 +1791,7 @@ let FDocument = class FDocument extends _univerjs_core_facade.FBaseInitialable {
|
|
|
1757
1791
|
* Insert plain text at a document body offset.
|
|
1758
1792
|
* @param {number} index The zero-based insertion offset.
|
|
1759
1793
|
* @param {string} text The plain text to insert.
|
|
1760
|
-
* @param {string} segmentId The segment id of the body. Defaults to an empty string for the main body.
|
|
1794
|
+
* @param {string} [segmentId] The segment id of the body. Defaults to an empty string for the main body.
|
|
1761
1795
|
* @returns {boolean} `true` if the edit was applied.
|
|
1762
1796
|
* @example
|
|
1763
1797
|
* ```ts
|
|
@@ -1798,6 +1832,8 @@ let FDocument = class FDocument extends _univerjs_core_facade.FBaseInitialable {
|
|
|
1798
1832
|
* Traditional and Unspecified documents keep the legacy header/footer
|
|
1799
1833
|
* behavior. Modern documents reject this API. `marginHeader` and
|
|
1800
1834
|
* `marginFooter` use 96-DPI layout pixels.
|
|
1835
|
+
* @param {IHeaderFooterProps} options Header/footer switches and margins to update. Omitted properties are preserved.
|
|
1836
|
+
* @returns {boolean} Whether the update command succeeded.
|
|
1801
1837
|
* @example
|
|
1802
1838
|
* ```ts
|
|
1803
1839
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -1821,7 +1857,7 @@ let FDocument = class FDocument extends _univerjs_core_facade.FBaseInitialable {
|
|
|
1821
1857
|
* The end offset is exclusive, and offsets are scoped to the selected body segment.
|
|
1822
1858
|
* @param {number} startOffset The inclusive start offset.
|
|
1823
1859
|
* @param {number} endOffset The exclusive end offset.
|
|
1824
|
-
* @param {string} segmentId The header/footer segment id, or an empty string for the main body.
|
|
1860
|
+
* @param {string} [segmentId] The header/footer segment id, or an empty string for the main body.
|
|
1825
1861
|
* @returns {FDocumentTextRange} A fixed text-range facade.
|
|
1826
1862
|
* @example
|
|
1827
1863
|
* ```ts
|
|
@@ -1849,6 +1885,8 @@ let FDocument = class FDocument extends _univerjs_core_facade.FBaseInitialable {
|
|
|
1849
1885
|
}
|
|
1850
1886
|
/**
|
|
1851
1887
|
* Returns a traditional section by zero-based index, or `null` in modern documents.
|
|
1888
|
+
* @param {number} index Zero-based section index.
|
|
1889
|
+
* @returns {FDocumentSection | null} The matching section, or `null` if none exists or the document is not Traditional.
|
|
1852
1890
|
* @example
|
|
1853
1891
|
* ```ts
|
|
1854
1892
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -1861,6 +1899,8 @@ let FDocument = class FDocument extends _univerjs_core_facade.FBaseInitialable {
|
|
|
1861
1899
|
}
|
|
1862
1900
|
/**
|
|
1863
1901
|
* Returns the traditional section containing a data-stream offset, or `null` in modern documents.
|
|
1902
|
+
* @param {number} offset Zero-based data-stream offset in the main document body.
|
|
1903
|
+
* @returns {FDocumentSection | null} The matching section, or `null` if none exists or the document is not Traditional.
|
|
1864
1904
|
* @example
|
|
1865
1905
|
* ```ts
|
|
1866
1906
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -1945,6 +1985,8 @@ let FDocument = class FDocument extends _univerjs_core_facade.FBaseInitialable {
|
|
|
1945
1985
|
* In a single-column section, the traditional renderer advances to the next physical page.
|
|
1946
1986
|
* Modern documents must use ColumnGroup. Unspecified documents must resolve
|
|
1947
1987
|
* their flavor first. Both throw `DocsSectionUnsupportedDocumentFlavorError`.
|
|
1988
|
+
* @param {number} offset Zero-based data-stream offset at which to insert the column break.
|
|
1989
|
+
* @returns {boolean} Whether the insertion succeeded.
|
|
1948
1990
|
* @example
|
|
1949
1991
|
* ```ts
|
|
1950
1992
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -1968,6 +2010,10 @@ let FDocument = class FDocument extends _univerjs_core_facade.FBaseInitialable {
|
|
|
1968
2010
|
* Inserts a horizontal rule using the existing paragraph `borderBottom` mechanism.
|
|
1969
2011
|
* The returned paragraph can be inspected or removed with normal paragraph APIs.
|
|
1970
2012
|
* Border width and padding are in points (pt).
|
|
2013
|
+
* @param {number} offset Zero-based insertion offset in the selected body segment.
|
|
2014
|
+
* @param {IParagraphBorder} [border] Bottom border appearance. Defaults to a solid gray 1 pt line with 5 pt padding.
|
|
2015
|
+
* @param {string} [segmentId] Header/footer segment ID, or an empty string for the main body (default).
|
|
2016
|
+
* @returns {FDocumentParagraph | null} The inserted paragraph, or `null` if insertion fails.
|
|
1971
2017
|
* @example
|
|
1972
2018
|
* ```ts
|
|
1973
2019
|
* const fDocument = univerAPI.getActiveDocument();
|
|
@@ -1998,7 +2044,7 @@ let FDocument = class FDocument extends _univerjs_core_facade.FBaseInitialable {
|
|
|
1998
2044
|
}
|
|
1999
2045
|
/**
|
|
2000
2046
|
* Get all paragraphs in the document body or header/footer body by the segment id.
|
|
2001
|
-
* @param {string} segmentId The segment id of the body. Defaults to an empty string for the main body.
|
|
2047
|
+
* @param {string} [segmentId] The segment id of the body. Defaults to an empty string for the main body.
|
|
2002
2048
|
* @returns {FDocumentParagraph[]} An array of paragraph facade instances.
|
|
2003
2049
|
* @example
|
|
2004
2050
|
* ```ts
|
|
@@ -2018,7 +2064,7 @@ let FDocument = class FDocument extends _univerjs_core_facade.FBaseInitialable {
|
|
|
2018
2064
|
/**
|
|
2019
2065
|
* Get a paragraph by its paragraph id and segment id.
|
|
2020
2066
|
* @param {string} paragraphId The paragraph id.
|
|
2021
|
-
* @param {string} segmentId The segment id of the body. Defaults to an empty string for the main body.
|
|
2067
|
+
* @param {string} [segmentId] The segment id of the body. Defaults to an empty string for the main body.
|
|
2022
2068
|
* @returns {FDocumentParagraph | null} The paragraph facade instance, or `null` if the paragraph is not found.
|
|
2023
2069
|
* @example
|
|
2024
2070
|
* ```ts
|
|
@@ -2039,7 +2085,7 @@ let FDocument = class FDocument extends _univerjs_core_facade.FBaseInitialable {
|
|
|
2039
2085
|
/**
|
|
2040
2086
|
* Find a paragraph by its text content and segment id.
|
|
2041
2087
|
* @param {string} text The text content to search for.
|
|
2042
|
-
* @param {string} segmentId The segment id of the body. Defaults to an empty string for the main body.
|
|
2088
|
+
* @param {string} [segmentId] The segment id of the body. Defaults to an empty string for the main body.
|
|
2043
2089
|
* @returns {FDocumentParagraph | null} The paragraph facade instance, or `null` if the paragraph is not found.
|
|
2044
2090
|
* @example
|
|
2045
2091
|
* ```ts
|
|
@@ -2087,8 +2133,8 @@ let FDocument = class FDocument extends _univerjs_core_facade.FBaseInitialable {
|
|
|
2087
2133
|
/**
|
|
2088
2134
|
* Insert a plain-text paragraph before the paragraph at the given paragraph index.
|
|
2089
2135
|
* @param {number} index The zero-based paragraph insertion index.
|
|
2090
|
-
* @param {string} text The paragraph text. Defaults to an empty paragraph.
|
|
2091
|
-
* @param {string} segmentId The segment id of the body. Defaults to an empty string for the main body.
|
|
2136
|
+
* @param {string} [text] The paragraph text. Defaults to an empty paragraph.
|
|
2137
|
+
* @param {string} [segmentId] The segment id of the body. Defaults to an empty string for the main body.
|
|
2092
2138
|
* @returns {FDocumentParagraph} The inserted paragraph facade instance.
|
|
2093
2139
|
* @example
|
|
2094
2140
|
* ```ts
|
|
@@ -2115,8 +2161,8 @@ let FDocument = class FDocument extends _univerjs_core_facade.FBaseInitialable {
|
|
|
2115
2161
|
}
|
|
2116
2162
|
/**
|
|
2117
2163
|
* Append a plain-text paragraph at the end of the body.
|
|
2118
|
-
* @param {string} text The paragraph text. Defaults to an empty paragraph.
|
|
2119
|
-
* @param {string} segmentId The segment id of the body. Defaults to an empty string for the main body.
|
|
2164
|
+
* @param {string} [text] The paragraph text. Defaults to an empty paragraph.
|
|
2165
|
+
* @param {string} [segmentId] The segment id of the body. Defaults to an empty string for the main body.
|
|
2120
2166
|
* @returns {FDocumentParagraph} The appended paragraph wrapper.
|
|
2121
2167
|
* @example
|
|
2122
2168
|
* ```ts
|