roosterjs 9.3.1 → 9.4.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/dist/rooster-amd-min.js +1 -1
- package/dist/rooster-amd-min.js.map +1 -1
- package/dist/rooster-amd.d.ts +867 -93
- package/dist/rooster-amd.js +623 -329
- package/dist/rooster-amd.js.map +1 -1
- package/dist/rooster-min.js +1 -1
- package/dist/rooster-min.js.map +1 -1
- package/dist/rooster-react-amd.js +54 -54
- package/dist/rooster-react-amd.js.map +1 -1
- package/dist/rooster.d.ts +867 -93
- package/dist/rooster.js +623 -329
- package/dist/rooster.js.map +1 -1
- package/package.json +6 -6
package/dist/rooster.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for roosterjs (Version 9.
|
|
1
|
+
// Type definitions for roosterjs (Version 9.4.1)
|
|
2
2
|
// Generated by dts tool from roosterjs
|
|
3
3
|
// Project: https://github.com/Microsoft/roosterjs
|
|
4
4
|
|
|
@@ -28,6 +28,16 @@ interface ContentModelWithFormat<T extends ContentModelFormatBase> {
|
|
|
28
28
|
format: T;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Represent a content model with format (Readonly)
|
|
33
|
+
*/
|
|
34
|
+
interface ReadonlyContentModelWithFormat<T extends ContentModelFormatBase> {
|
|
35
|
+
/**
|
|
36
|
+
* Format of this model
|
|
37
|
+
*/
|
|
38
|
+
readonly format: Readonly<T>;
|
|
39
|
+
}
|
|
40
|
+
|
|
31
41
|
/**
|
|
32
42
|
* Format of Table
|
|
33
43
|
*/
|
|
@@ -36,12 +46,32 @@ type ContentModelTableFormat = ContentModelBlockFormat & IdFormat & BorderFormat
|
|
|
36
46
|
/**
|
|
37
47
|
* Represents base format of an element that supports dataset and/or metadata
|
|
38
48
|
*/
|
|
39
|
-
|
|
49
|
+
type ContentModelWithDataset<T> = MutableMark & {
|
|
40
50
|
/**
|
|
41
51
|
* dataset of this element
|
|
42
52
|
*/
|
|
43
53
|
dataset: DatasetFormat;
|
|
44
|
-
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Represents base format of an element that supports dataset and/or metadata (Readonly)
|
|
58
|
+
*/
|
|
59
|
+
type ReadonlyContentModelWithDataset<T> = ReadonlyMark & {
|
|
60
|
+
/**
|
|
61
|
+
* dataset of this element
|
|
62
|
+
*/
|
|
63
|
+
readonly dataset: ReadonlyDatasetFormat;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Represents base format of an element that supports dataset and/or metadata (Readonly)
|
|
68
|
+
*/
|
|
69
|
+
type ShallowMutableContentModelWithDataset<T> = ShallowMutableMark & {
|
|
70
|
+
/**
|
|
71
|
+
* dataset of this element
|
|
72
|
+
*/
|
|
73
|
+
dataset: DatasetFormat;
|
|
74
|
+
};
|
|
45
75
|
|
|
46
76
|
/**
|
|
47
77
|
* The format object for a paragraph in Content Model
|
|
@@ -833,6 +863,11 @@ type EntityInfoFormat = {
|
|
|
833
863
|
*/
|
|
834
864
|
type DatasetFormat = Record<string, string>;
|
|
835
865
|
|
|
866
|
+
/**
|
|
867
|
+
* Represents dataset format of Content Model (Readonly)
|
|
868
|
+
*/
|
|
869
|
+
type ReadonlyDatasetFormat = Readonly<Record<string, string>>;
|
|
870
|
+
|
|
836
871
|
/**
|
|
837
872
|
* Format of table that stored as metadata
|
|
838
873
|
*/
|
|
@@ -1377,10 +1412,20 @@ type ExportContentMode = /**
|
|
|
1377
1412
|
*/
|
|
1378
1413
|
type ContentModelBlock = ContentModelFormatContainer | ContentModelListItem | ContentModelGeneralBlock | ContentModelTable | ContentModelParagraph | ContentModelEntity | ContentModelDivider;
|
|
1379
1414
|
|
|
1415
|
+
/**
|
|
1416
|
+
* A union type of Content Model Block (Readonly)
|
|
1417
|
+
*/
|
|
1418
|
+
type ReadonlyContentModelBlock = ReadonlyContentModelFormatContainer | ReadonlyContentModelListItem | ReadonlyContentModelGeneralBlock | ReadonlyContentModelTable | ReadonlyContentModelParagraph | ContentModelEntity | ReadonlyContentModelDivider;
|
|
1419
|
+
|
|
1420
|
+
/**
|
|
1421
|
+
* A union type of Content Model Block (Shallow mutable)
|
|
1422
|
+
*/
|
|
1423
|
+
type ShallowMutableContentModelBlock = ShallowMutableContentModelFormatContainer | ShallowMutableContentModelListItem | ShallowMutableContentModelGeneralBlock | ShallowMutableContentModelTable | ShallowMutableContentModelParagraph | ContentModelEntity | ContentModelDivider;
|
|
1424
|
+
|
|
1380
1425
|
/**
|
|
1381
1426
|
* Content Model of Paragraph
|
|
1382
1427
|
*/
|
|
1383
|
-
interface ContentModelParagraph extends
|
|
1428
|
+
interface ContentModelParagraph extends ContentModelParagraphCommon, ContentModelBlockBase<'Paragraph'> {
|
|
1384
1429
|
/**
|
|
1385
1430
|
* Segments within this paragraph
|
|
1386
1431
|
*/
|
|
@@ -1393,6 +1438,12 @@ interface ContentModelParagraph extends ContentModelBlockWithCache, ContentModel
|
|
|
1393
1438
|
* Decorator info for this paragraph, used by heading and P tags
|
|
1394
1439
|
*/
|
|
1395
1440
|
decorator?: ContentModelParagraphDecorator;
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
/**
|
|
1444
|
+
* Common part of Content Model of Paragraph
|
|
1445
|
+
*/
|
|
1446
|
+
interface ContentModelParagraphCommon {
|
|
1396
1447
|
/**
|
|
1397
1448
|
* Whether this block was created from a block HTML element or just some simple segment between other block elements.
|
|
1398
1449
|
* True means it doesn't have a related block element, false means it was from a block element
|
|
@@ -1400,10 +1451,46 @@ interface ContentModelParagraph extends ContentModelBlockWithCache, ContentModel
|
|
|
1400
1451
|
isImplicit?: boolean;
|
|
1401
1452
|
}
|
|
1402
1453
|
|
|
1454
|
+
/**
|
|
1455
|
+
* Content Model of Paragraph (Readonly)
|
|
1456
|
+
*/
|
|
1457
|
+
interface ReadonlyContentModelParagraph extends ReadonlyContentModelBlockBase<'Paragraph'>, Readonly<ContentModelParagraphCommon> {
|
|
1458
|
+
/**
|
|
1459
|
+
* Segments within this paragraph
|
|
1460
|
+
*/
|
|
1461
|
+
readonly segments: ReadonlyArray<ReadonlyContentModelSegment>;
|
|
1462
|
+
/**
|
|
1463
|
+
* Segment format on this paragraph. This is mostly used for default format
|
|
1464
|
+
*/
|
|
1465
|
+
readonly segmentFormat?: Readonly<ContentModelSegmentFormat>;
|
|
1466
|
+
/**
|
|
1467
|
+
* Decorator info for this paragraph, used by heading and P tags
|
|
1468
|
+
*/
|
|
1469
|
+
readonly decorator?: ReadonlyContentModelParagraphDecorator;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
/**
|
|
1473
|
+
* Content Model of Paragraph (Shallow mutable)
|
|
1474
|
+
*/
|
|
1475
|
+
interface ShallowMutableContentModelParagraph extends ContentModelParagraphCommon, ContentModelBlockBase<'Paragraph'> {
|
|
1476
|
+
/**
|
|
1477
|
+
* Segments within this paragraph
|
|
1478
|
+
*/
|
|
1479
|
+
segments: ShallowMutableContentModelSegment[];
|
|
1480
|
+
/**
|
|
1481
|
+
* Segment format on this paragraph. This is mostly used for default format
|
|
1482
|
+
*/
|
|
1483
|
+
segmentFormat?: ContentModelSegmentFormat;
|
|
1484
|
+
/**
|
|
1485
|
+
* Decorator info for this paragraph, used by heading and P tags
|
|
1486
|
+
*/
|
|
1487
|
+
decorator?: ContentModelParagraphDecorator;
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1403
1490
|
/**
|
|
1404
1491
|
* Content Model of Table
|
|
1405
1492
|
*/
|
|
1406
|
-
interface ContentModelTable extends ContentModelBlockBase<'Table', ContentModelTableFormat>, ContentModelWithDataset<TableMetadataFormat
|
|
1493
|
+
interface ContentModelTable extends ContentModelBlockBase<'Table', ContentModelTableFormat, HTMLTableElement>, ContentModelWithDataset<TableMetadataFormat> {
|
|
1407
1494
|
/**
|
|
1408
1495
|
* Widths of each column
|
|
1409
1496
|
*/
|
|
@@ -1414,10 +1501,44 @@ interface ContentModelTable extends ContentModelBlockBase<'Table', ContentModelT
|
|
|
1414
1501
|
rows: ContentModelTableRow[];
|
|
1415
1502
|
}
|
|
1416
1503
|
|
|
1504
|
+
/**
|
|
1505
|
+
* Content Model of Table (Readonly)
|
|
1506
|
+
*/
|
|
1507
|
+
interface ReadonlyContentModelTable extends ReadonlyContentModelBlockBase<'Table', ContentModelTableFormat, HTMLTableElement>, ReadonlyContentModelWithDataset<TableMetadataFormat> {
|
|
1508
|
+
/**
|
|
1509
|
+
* Widths of each column
|
|
1510
|
+
*/
|
|
1511
|
+
readonly widths: ReadonlyArray<number>;
|
|
1512
|
+
/**
|
|
1513
|
+
* Cells of this table
|
|
1514
|
+
*/
|
|
1515
|
+
readonly rows: ReadonlyArray<ReadonlyContentModelTableRow>;
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
/**
|
|
1519
|
+
* Content Model of Table (Shallow mutable)
|
|
1520
|
+
*/
|
|
1521
|
+
interface ShallowMutableContentModelTable extends ShallowMutableContentModelBlockBase<'Table', ContentModelTableFormat, HTMLTableElement>, ShallowMutableContentModelWithDataset<TableMetadataFormat> {
|
|
1522
|
+
/**
|
|
1523
|
+
* Widths of each column
|
|
1524
|
+
*/
|
|
1525
|
+
widths: number[];
|
|
1526
|
+
/**
|
|
1527
|
+
* Cells of this table
|
|
1528
|
+
*/
|
|
1529
|
+
rows: ShallowMutableContentModelTableRow[];
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1417
1532
|
/**
|
|
1418
1533
|
* Content Model of horizontal divider
|
|
1419
1534
|
*/
|
|
1420
|
-
interface ContentModelDivider extends Selectable,
|
|
1535
|
+
interface ContentModelDivider extends Selectable, ContentModelDividerCommon, ContentModelBlockBase<'Divider', ContentModelDividerFormat> {
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
/**
|
|
1539
|
+
* Common part of Content Model of horizontal divider
|
|
1540
|
+
*/
|
|
1541
|
+
interface ContentModelDividerCommon {
|
|
1421
1542
|
/**
|
|
1422
1543
|
* Tag name of this element, either HR or DIV
|
|
1423
1544
|
*/
|
|
@@ -1428,14 +1549,38 @@ interface ContentModelDivider extends Selectable, ContentModelBlockWithCache, Co
|
|
|
1428
1549
|
size?: string;
|
|
1429
1550
|
}
|
|
1430
1551
|
|
|
1552
|
+
/**
|
|
1553
|
+
* Content Model of horizontal divider (Readonly)
|
|
1554
|
+
*/
|
|
1555
|
+
interface ReadonlyContentModelDivider extends ReadonlySelectable, ReadonlyContentModelBlockBase<'Divider', ContentModelDividerFormat>, Readonly<ContentModelDividerCommon> {
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1431
1558
|
/**
|
|
1432
1559
|
* Base type of a block
|
|
1433
1560
|
*/
|
|
1434
|
-
interface ContentModelBlockBase<T extends ContentModelBlockType, TFormat extends ContentModelBlockFormat = ContentModelBlockFormat> extends ContentModelWithFormat<TFormat> {
|
|
1561
|
+
interface ContentModelBlockBase<T extends ContentModelBlockType, TFormat extends ContentModelBlockFormat = ContentModelBlockFormat, TCacheElement extends HTMLElement = HTMLElement> extends MutableMark, ContentModelBlockBaseCommon<T>, ContentModelWithFormat<TFormat>, ContentModelBlockWithCache<TCacheElement> {
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
/**
|
|
1565
|
+
* Common part of base type of a block
|
|
1566
|
+
*/
|
|
1567
|
+
interface ContentModelBlockBaseCommon<T extends ContentModelBlockType> {
|
|
1435
1568
|
/**
|
|
1436
1569
|
* Type of this block
|
|
1437
1570
|
*/
|
|
1438
|
-
blockType: T;
|
|
1571
|
+
readonly blockType: T;
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
/**
|
|
1575
|
+
* Base type of a block (Readonly)
|
|
1576
|
+
*/
|
|
1577
|
+
interface ReadonlyContentModelBlockBase<T extends ContentModelBlockType, TFormat extends ContentModelBlockFormat = ContentModelBlockFormat, TCacheElement extends HTMLElement = HTMLElement> extends ReadonlyMark, ContentModelBlockBaseCommon<T>, ReadonlyContentModelWithFormat<TFormat>, ContentModelBlockWithCache<TCacheElement> {
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
/**
|
|
1581
|
+
* Base type of a block (Shallow mutable)
|
|
1582
|
+
*/
|
|
1583
|
+
interface ShallowMutableContentModelBlockBase<T extends ContentModelBlockType, TFormat extends ContentModelBlockFormat = ContentModelBlockFormat, TCacheElement extends HTMLElement = HTMLElement> extends ShallowMutableMark, ContentModelBlockBaseCommon<T>, ContentModelWithFormat<TFormat>, ContentModelBlockWithCache<TCacheElement> {
|
|
1439
1584
|
}
|
|
1440
1585
|
|
|
1441
1586
|
/**
|
|
@@ -1451,15 +1596,41 @@ interface ContentModelBlockWithCache<TElement extends HTMLElement = HTMLElement>
|
|
|
1451
1596
|
/**
|
|
1452
1597
|
* Content Model of Table
|
|
1453
1598
|
*/
|
|
1454
|
-
interface ContentModelTableRow extends ContentModelBlockWithCache<HTMLTableRowElement>, ContentModelWithFormat<ContentModelBlockFormat> {
|
|
1599
|
+
interface ContentModelTableRow extends MutableMark, ContentModelTableRowCommon, ContentModelBlockWithCache<HTMLTableRowElement>, ContentModelWithFormat<ContentModelBlockFormat> {
|
|
1600
|
+
/**
|
|
1601
|
+
* Cells of this table
|
|
1602
|
+
*/
|
|
1603
|
+
cells: ContentModelTableCell[];
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
/**
|
|
1607
|
+
* Common part of Content Model of Table
|
|
1608
|
+
*/
|
|
1609
|
+
interface ContentModelTableRowCommon {
|
|
1455
1610
|
/**
|
|
1456
1611
|
* Heights of each row
|
|
1457
1612
|
*/
|
|
1458
1613
|
height: number;
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
/**
|
|
1617
|
+
* Content Model of Table (Readonly)
|
|
1618
|
+
*/
|
|
1619
|
+
interface ReadonlyContentModelTableRow extends ReadonlyMark, Readonly<ContentModelTableRowCommon>, ContentModelBlockWithCache<HTMLTableRowElement>, ReadonlyContentModelWithFormat<ContentModelBlockFormat> {
|
|
1459
1620
|
/**
|
|
1460
1621
|
* Cells of this table
|
|
1461
1622
|
*/
|
|
1462
|
-
cells:
|
|
1623
|
+
readonly cells: ReadonlyArray<ReadonlyContentModelTableCell>;
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
/**
|
|
1627
|
+
* Content Model of Table (Readonly)
|
|
1628
|
+
*/
|
|
1629
|
+
interface ShallowMutableContentModelTableRow extends ShallowMutableMark, ContentModelTableRowCommon, ContentModelBlockWithCache<HTMLTableRowElement>, ContentModelWithFormat<ContentModelBlockFormat> {
|
|
1630
|
+
/**
|
|
1631
|
+
* Cells of this table
|
|
1632
|
+
*/
|
|
1633
|
+
cells: ReadonlyContentModelTableCell[];
|
|
1463
1634
|
}
|
|
1464
1635
|
|
|
1465
1636
|
/**
|
|
@@ -1479,31 +1650,81 @@ interface ContentModelEntity extends ContentModelBlockBase<'Entity', ContentMode
|
|
|
1479
1650
|
/**
|
|
1480
1651
|
* Content Model document entry point
|
|
1481
1652
|
*/
|
|
1482
|
-
interface ContentModelDocument extends ContentModelBlockGroupBase<'Document'>, Partial<ContentModelWithFormat<ContentModelSegmentFormat>> {
|
|
1653
|
+
interface ContentModelDocument extends ContentModelDocumentCommon, ContentModelBlockGroupBase<'Document'>, Partial<ContentModelWithFormat<ContentModelSegmentFormat>> {
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
/**
|
|
1657
|
+
* Common part of Content Model document entry point
|
|
1658
|
+
*/
|
|
1659
|
+
interface ContentModelDocumentCommon {
|
|
1483
1660
|
/**
|
|
1484
1661
|
* Whether the selection in model (if any) is a revert selection (end is before start)
|
|
1485
1662
|
*/
|
|
1486
1663
|
hasRevertedRangeSelection?: boolean;
|
|
1487
1664
|
}
|
|
1488
1665
|
|
|
1666
|
+
/**
|
|
1667
|
+
* Content Model document entry point (Readonly)
|
|
1668
|
+
*/
|
|
1669
|
+
interface ReadonlyContentModelDocument extends Readonly<ContentModelDocumentCommon>, ReadonlyContentModelBlockGroupBase<'Document'>, Partial<ReadonlyContentModelWithFormat<ContentModelSegmentFormat>> {
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
/**
|
|
1673
|
+
* Content Model document entry point (Shallow mutable)
|
|
1674
|
+
*/
|
|
1675
|
+
interface ShallowMutableContentModelDocument extends ContentModelDocumentCommon, ShallowMutableContentModelBlockGroupBase<'Document'>, Partial<ContentModelWithFormat<ContentModelSegmentFormat>> {
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1489
1678
|
/**
|
|
1490
1679
|
* Base type of Content Model Block Group
|
|
1491
1680
|
*/
|
|
1492
|
-
interface ContentModelBlockGroupBase<T extends ContentModelBlockGroupType> {
|
|
1681
|
+
interface ContentModelBlockGroupBase<T extends ContentModelBlockGroupType, TElement extends HTMLElement = HTMLElement> extends MutableMark, ContentModelBlockGroupBaseCommon<T, TElement> {
|
|
1682
|
+
/**
|
|
1683
|
+
* Blocks under this group
|
|
1684
|
+
*/
|
|
1685
|
+
blocks: ContentModelBlock[];
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
/**
|
|
1689
|
+
* Common part of base type of Content Model Block Group
|
|
1690
|
+
*/
|
|
1691
|
+
interface ContentModelBlockGroupBaseCommon<T extends ContentModelBlockGroupType, TElement extends HTMLElement = HTMLElement> extends ContentModelBlockWithCache<TElement> {
|
|
1493
1692
|
/**
|
|
1494
1693
|
* Type of this block group
|
|
1495
1694
|
*/
|
|
1496
|
-
blockGroupType: T;
|
|
1695
|
+
readonly blockGroupType: T;
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
/**
|
|
1699
|
+
* Base type of Content Model Block Group (Readonly)
|
|
1700
|
+
*/
|
|
1701
|
+
interface ReadonlyContentModelBlockGroupBase<T extends ContentModelBlockGroupType, TElement extends HTMLElement = HTMLElement> extends ReadonlyMark, ContentModelBlockGroupBaseCommon<T, TElement> {
|
|
1702
|
+
/**
|
|
1703
|
+
* Blocks under this group
|
|
1704
|
+
*/
|
|
1705
|
+
readonly blocks: ReadonlyArray<ReadonlyContentModelBlock>;
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
/**
|
|
1709
|
+
* Base type of Content Model Block Group (Shallow mutable)
|
|
1710
|
+
*/
|
|
1711
|
+
interface ShallowMutableContentModelBlockGroupBase<T extends ContentModelBlockGroupType, TElement extends HTMLElement = HTMLElement> extends ShallowMutableMark, ContentModelBlockGroupBaseCommon<T, TElement> {
|
|
1497
1712
|
/**
|
|
1498
1713
|
* Blocks under this group
|
|
1499
1714
|
*/
|
|
1500
|
-
blocks:
|
|
1715
|
+
blocks: ReadonlyContentModelBlock[];
|
|
1501
1716
|
}
|
|
1502
1717
|
|
|
1503
1718
|
/**
|
|
1504
1719
|
* Content Model of Format Container
|
|
1505
1720
|
*/
|
|
1506
|
-
interface ContentModelFormatContainer extends
|
|
1721
|
+
interface ContentModelFormatContainer extends ContentModelFormatContainerCommon, ContentModelBlockGroupBase<'FormatContainer'>, ContentModelBlockBase<'BlockGroup', ContentModelFormatContainerFormat, HTMLElement> {
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
/**
|
|
1725
|
+
* Common part of Content Model of Format Container
|
|
1726
|
+
*/
|
|
1727
|
+
interface ContentModelFormatContainerCommon {
|
|
1507
1728
|
/**
|
|
1508
1729
|
* Tag name of this container
|
|
1509
1730
|
*/
|
|
@@ -1515,20 +1736,78 @@ interface ContentModelFormatContainer extends ContentModelBlockWithCache, Conten
|
|
|
1515
1736
|
zeroFontSize?: boolean;
|
|
1516
1737
|
}
|
|
1517
1738
|
|
|
1739
|
+
/**
|
|
1740
|
+
* Content Model of Format Container (Readonly)
|
|
1741
|
+
*/
|
|
1742
|
+
interface ReadonlyContentModelFormatContainer extends Readonly<ContentModelFormatContainerCommon>, ReadonlyContentModelBlockGroupBase<'FormatContainer'>, ReadonlyContentModelBlockBase<'BlockGroup', ContentModelFormatContainerFormat, HTMLElement> {
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
/**
|
|
1746
|
+
* Content Model of Format Container (Shallow mutable)
|
|
1747
|
+
*/
|
|
1748
|
+
interface ShallowMutableContentModelFormatContainer extends ContentModelFormatContainerCommon, ShallowMutableContentModelBlockGroupBase<'FormatContainer'>, ShallowMutableContentModelBlockBase<'BlockGroup', ContentModelFormatContainerFormat, HTMLElement> {
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1518
1751
|
/**
|
|
1519
1752
|
* Content Model for general Block element
|
|
1520
1753
|
*/
|
|
1521
|
-
interface ContentModelGeneralBlock extends Selectable, ContentModelBlockGroupBase<'General'>, ContentModelBlockBase<'BlockGroup', ContentModelBlockFormat & ContentModelSegmentFormat> {
|
|
1754
|
+
interface ContentModelGeneralBlock extends Selectable, ContentModelGeneralBlockCommon, ContentModelBlockGroupBase<'General'>, ContentModelBlockBase<'BlockGroup', ContentModelBlockFormat & ContentModelSegmentFormat> {
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
/**
|
|
1758
|
+
* Common part of Content Model for general Block element
|
|
1759
|
+
*/
|
|
1760
|
+
interface ContentModelGeneralBlockCommon {
|
|
1522
1761
|
/**
|
|
1523
1762
|
* A reference to original HTML node that this model was created from
|
|
1524
1763
|
*/
|
|
1525
1764
|
element: HTMLElement;
|
|
1526
1765
|
}
|
|
1527
1766
|
|
|
1767
|
+
/**
|
|
1768
|
+
* Content Model for general Block element (Readonly)
|
|
1769
|
+
*/
|
|
1770
|
+
interface ReadonlyContentModelGeneralBlock extends ReadonlySelectable, Readonly<ContentModelGeneralBlockCommon>, ReadonlyContentModelBlockGroupBase<'General'>, ReadonlyContentModelBlockBase<'BlockGroup', ContentModelBlockFormat & ContentModelSegmentFormat> {
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
/**
|
|
1774
|
+
* Content Model for general Block element (Shallow mutable)
|
|
1775
|
+
*/
|
|
1776
|
+
interface ShallowMutableContentModelGeneralBlock extends ShallowMutableSelectable, ContentModelGeneralBlockCommon, ShallowMutableContentModelBlockGroupBase<'General'>, ShallowMutableContentModelBlockBase<'BlockGroup', ContentModelBlockFormat & ContentModelSegmentFormat> {
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1528
1779
|
/**
|
|
1529
1780
|
* Content Model of List Item
|
|
1530
1781
|
*/
|
|
1531
|
-
interface ContentModelListItem extends ContentModelBlockGroupBase<'ListItem'>, ContentModelBlockBase<'BlockGroup', ContentModelListItemFormat> {
|
|
1782
|
+
interface ContentModelListItem extends ContentModelBlockGroupBase<'ListItem', HTMLLIElement>, ContentModelBlockBase<'BlockGroup', ContentModelListItemFormat, HTMLLIElement> {
|
|
1783
|
+
/**
|
|
1784
|
+
* Type of this list, either ordered or unordered
|
|
1785
|
+
*/
|
|
1786
|
+
levels: ContentModelListLevel[];
|
|
1787
|
+
/**
|
|
1788
|
+
* A dummy segment to hold format of this list item
|
|
1789
|
+
*/
|
|
1790
|
+
formatHolder: ContentModelSelectionMarker;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
/**
|
|
1794
|
+
* Content Model of List Item (Readonly)
|
|
1795
|
+
*/
|
|
1796
|
+
interface ReadonlyContentModelListItem extends ReadonlyContentModelBlockGroupBase<'ListItem', HTMLLIElement>, ReadonlyContentModelBlockBase<'BlockGroup', ContentModelListItemFormat, HTMLLIElement> {
|
|
1797
|
+
/**
|
|
1798
|
+
* Type of this list, either ordered or unordered
|
|
1799
|
+
*/
|
|
1800
|
+
readonly levels: ReadonlyArray<ReadonlyContentModelListLevel>;
|
|
1801
|
+
/**
|
|
1802
|
+
* A dummy segment to hold format of this list item
|
|
1803
|
+
*/
|
|
1804
|
+
readonly formatHolder: ReadonlyContentModelSelectionMarker;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
/**
|
|
1808
|
+
* Content Model of List Item (Shallow mutable)
|
|
1809
|
+
*/
|
|
1810
|
+
interface ShallowMutableContentModelListItem extends ShallowMutableContentModelBlockGroupBase<'ListItem', HTMLLIElement>, ShallowMutableContentModelBlockBase<'BlockGroup', ContentModelListItemFormat, HTMLLIElement> {
|
|
1532
1811
|
/**
|
|
1533
1812
|
* Type of this list, either ordered or unordered
|
|
1534
1813
|
*/
|
|
@@ -1542,7 +1821,13 @@ interface ContentModelListItem extends ContentModelBlockGroupBase<'ListItem'>, C
|
|
|
1542
1821
|
/**
|
|
1543
1822
|
* Content Model of Table Cell
|
|
1544
1823
|
*/
|
|
1545
|
-
interface ContentModelTableCell extends Selectable, ContentModelBlockGroupBase<'TableCell'>, ContentModelWithFormat<ContentModelTableCellFormat>, ContentModelWithDataset<TableCellMetadataFormat
|
|
1824
|
+
interface ContentModelTableCell extends Selectable, ContentModelTableCellCommon, ContentModelBlockGroupBase<'TableCell', HTMLTableCellElement>, ContentModelWithFormat<ContentModelTableCellFormat>, ContentModelWithDataset<TableCellMetadataFormat> {
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
/**
|
|
1828
|
+
* Common part of Content Model of Table Cell
|
|
1829
|
+
*/
|
|
1830
|
+
interface ContentModelTableCellCommon {
|
|
1546
1831
|
/**
|
|
1547
1832
|
* Whether this cell is spanned from left cell
|
|
1548
1833
|
*/
|
|
@@ -1557,27 +1842,73 @@ interface ContentModelTableCell extends Selectable, ContentModelBlockGroupBase<'
|
|
|
1557
1842
|
isHeader?: boolean;
|
|
1558
1843
|
}
|
|
1559
1844
|
|
|
1845
|
+
/**
|
|
1846
|
+
* Content Model of Table Cell (Readonly)
|
|
1847
|
+
*/
|
|
1848
|
+
interface ReadonlyContentModelTableCell extends ReadonlySelectable, Readonly<ContentModelTableCellCommon>, ReadonlyContentModelBlockGroupBase<'TableCell', HTMLTableCellElement>, ReadonlyContentModelWithFormat<ContentModelTableCellFormat>, ReadonlyContentModelWithDataset<TableCellMetadataFormat> {
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
/**
|
|
1852
|
+
* Content Model of Table Cell (Shallow mutable)
|
|
1853
|
+
*/
|
|
1854
|
+
interface ShallowMutableContentModelTableCell extends ShallowMutableSelectable, ContentModelTableCellCommon, ShallowMutableContentModelBlockGroupBase<'TableCell', HTMLTableCellElement>, ContentModelWithFormat<ContentModelTableCellFormat>, ShallowMutableContentModelWithDataset<TableCellMetadataFormat> {
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1560
1857
|
/**
|
|
1561
1858
|
* The union type of Content Model Block Group
|
|
1562
1859
|
*/
|
|
1563
1860
|
type ContentModelBlockGroup = ContentModelDocument | ContentModelFormatContainer | ContentModelListItem | ContentModelTableCell | ContentModelGeneralBlock;
|
|
1564
1861
|
|
|
1862
|
+
/**
|
|
1863
|
+
* The union type of Content Model Block Group (Readonly)
|
|
1864
|
+
*/
|
|
1865
|
+
type ReadonlyContentModelBlockGroup = ReadonlyContentModelDocument | ReadonlyContentModelFormatContainer | ReadonlyContentModelListItem | ReadonlyContentModelTableCell | ReadonlyContentModelGeneralBlock;
|
|
1866
|
+
|
|
1867
|
+
/**
|
|
1868
|
+
* The union type of Content Model Block Group (Shallow mutable)
|
|
1869
|
+
*/
|
|
1870
|
+
type ShallowMutableContentModelBlockGroup = ShallowMutableContentModelDocument | ShallowMutableContentModelFormatContainer | ShallowMutableContentModelListItem | ShallowMutableContentModelTableCell | ShallowMutableContentModelGeneralBlock;
|
|
1871
|
+
|
|
1565
1872
|
/**
|
|
1566
1873
|
* Content Model of BR
|
|
1567
1874
|
*/
|
|
1568
1875
|
interface ContentModelBr extends ContentModelSegmentBase<'Br'> {
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
/**
|
|
1879
|
+
* Content Model of BR (Readonly)
|
|
1880
|
+
*/
|
|
1881
|
+
interface ReadonlyContentModelBr extends ReadonlyContentModelSegmentBase<'Br'> {
|
|
1569
1882
|
}
|
|
1570
1883
|
|
|
1571
1884
|
/**
|
|
1572
1885
|
* Content Model of general Segment
|
|
1573
1886
|
*/
|
|
1574
1887
|
interface ContentModelGeneralSegment extends ContentModelGeneralBlock, ContentModelSegmentBase<'General', ContentModelBlockFormat & ContentModelSegmentFormat> {
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
/**
|
|
1891
|
+
* Content Model of general Segment (Readonly)
|
|
1892
|
+
*/
|
|
1893
|
+
interface ReadonlyContentModelGeneralSegment extends ReadonlyContentModelGeneralBlock, ReadonlyContentModelSegmentBase<'General', ContentModelBlockFormat & ContentModelSegmentFormat> {
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
/**
|
|
1897
|
+
* Content Model of general Segment (Shallow mutable)
|
|
1898
|
+
*/
|
|
1899
|
+
interface ShallowMutableContentModelGeneralSegment extends ShallowMutableContentModelGeneralBlock, ShallowMutableContentModelSegmentBase<'General', ContentModelBlockFormat & ContentModelSegmentFormat> {
|
|
1575
1900
|
}
|
|
1576
1901
|
|
|
1577
1902
|
/**
|
|
1578
1903
|
* Content Model of IMG
|
|
1579
1904
|
*/
|
|
1580
|
-
interface ContentModelImage extends ContentModelSegmentBase<'Image', ContentModelImageFormat>, ContentModelWithDataset<ImageMetadataFormat> {
|
|
1905
|
+
interface ContentModelImage extends ContentModelImageCommon, ContentModelSegmentBase<'Image', ContentModelImageFormat>, ContentModelWithDataset<ImageMetadataFormat> {
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
/**
|
|
1909
|
+
* Common part of Content Model of IMG
|
|
1910
|
+
*/
|
|
1911
|
+
interface ContentModelImageCommon {
|
|
1581
1912
|
/**
|
|
1582
1913
|
* Image source of this IMG element
|
|
1583
1914
|
*/
|
|
@@ -1596,30 +1927,88 @@ interface ContentModelImage extends ContentModelSegmentBase<'Image', ContentMode
|
|
|
1596
1927
|
isSelectedAsImageSelection?: boolean;
|
|
1597
1928
|
}
|
|
1598
1929
|
|
|
1930
|
+
/**
|
|
1931
|
+
* Content Model of IMG (Readonly)
|
|
1932
|
+
*/
|
|
1933
|
+
interface ReadonlyContentModelImage extends ReadonlyContentModelSegmentBase<'Image', ContentModelImageFormat>, ReadonlyContentModelWithDataset<ImageMetadataFormat>, Readonly<ContentModelImageCommon> {
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1599
1936
|
/**
|
|
1600
1937
|
* Content Model for Text
|
|
1601
1938
|
*/
|
|
1602
|
-
interface ContentModelText extends ContentModelSegmentBase<'Text'> {
|
|
1939
|
+
interface ContentModelText extends ContentModelTextCommon, ContentModelSegmentBase<'Text'> {
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
/**
|
|
1943
|
+
* Common port of Content Model for Text
|
|
1944
|
+
*/
|
|
1945
|
+
interface ContentModelTextCommon {
|
|
1946
|
+
/**
|
|
1947
|
+
* Text content of this segment
|
|
1948
|
+
*/
|
|
1949
|
+
text: string;
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
/**
|
|
1953
|
+
* Content Model for Text (Readonly)
|
|
1954
|
+
*/
|
|
1955
|
+
interface ReadonlyContentModelText extends ReadonlyContentModelSegmentBase<'Text'>, Readonly<ContentModelTextCommon> {
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
/**
|
|
1959
|
+
* Content Model of Selection Marker
|
|
1960
|
+
*/
|
|
1961
|
+
interface ContentModelSelectionMarker extends ContentModelSegmentBase<'SelectionMarker'> {
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
/**
|
|
1965
|
+
* Content Model of Selection Marker (Readonly)
|
|
1966
|
+
*/
|
|
1967
|
+
interface ReadonlyContentModelSelectionMarker extends ReadonlyContentModelSegmentBase<'SelectionMarker'> {
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
/**
|
|
1971
|
+
* Base type of Content Model Segment
|
|
1972
|
+
*/
|
|
1973
|
+
interface ContentModelSegmentBase<T extends ContentModelSegmentType, TFormat extends ContentModelSegmentFormat = ContentModelSegmentFormat> extends MutableMark, Selectable, ContentModelWithFormat<TFormat>, ContentModelSegmentBaseCommon<T> {
|
|
1974
|
+
/**
|
|
1975
|
+
* Hyperlink info
|
|
1976
|
+
*/
|
|
1977
|
+
link?: ContentModelLink;
|
|
1978
|
+
/**
|
|
1979
|
+
* Code info
|
|
1980
|
+
*/
|
|
1981
|
+
code?: ContentModelCode;
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
/**
|
|
1985
|
+
* Common part of base type of Content Model Segment
|
|
1986
|
+
*/
|
|
1987
|
+
interface ContentModelSegmentBaseCommon<T extends ContentModelSegmentType> {
|
|
1603
1988
|
/**
|
|
1604
|
-
*
|
|
1989
|
+
* Type of this segment
|
|
1605
1990
|
*/
|
|
1606
|
-
|
|
1991
|
+
readonly segmentType: T;
|
|
1607
1992
|
}
|
|
1608
1993
|
|
|
1609
1994
|
/**
|
|
1610
|
-
* Content Model
|
|
1995
|
+
* Base type of Content Model Segment (Readonly)
|
|
1611
1996
|
*/
|
|
1612
|
-
interface
|
|
1997
|
+
interface ReadonlyContentModelSegmentBase<T extends ContentModelSegmentType, TFormat extends ContentModelSegmentFormat = ContentModelSegmentFormat> extends ReadonlyMark, ReadonlySelectable, ReadonlyContentModelWithFormat<TFormat>, Readonly<ContentModelSegmentBaseCommon<T>> {
|
|
1998
|
+
/**
|
|
1999
|
+
* Hyperlink info
|
|
2000
|
+
*/
|
|
2001
|
+
readonly link?: ReadonlyContentModelLink;
|
|
2002
|
+
/**
|
|
2003
|
+
* Code info
|
|
2004
|
+
*/
|
|
2005
|
+
readonly code?: ReadonlyContentModelCode;
|
|
1613
2006
|
}
|
|
1614
2007
|
|
|
1615
2008
|
/**
|
|
1616
|
-
* Base type of Content Model Segment
|
|
2009
|
+
* Base type of Content Model Segment (Shallow mutable)
|
|
1617
2010
|
*/
|
|
1618
|
-
interface
|
|
1619
|
-
/**
|
|
1620
|
-
* Type of this segment
|
|
1621
|
-
*/
|
|
1622
|
-
segmentType: T;
|
|
2011
|
+
interface ShallowMutableContentModelSegmentBase<T extends ContentModelSegmentType, TFormat extends ContentModelSegmentFormat = ContentModelSegmentFormat> extends ShallowMutableMark, ShallowMutableSelectable, ContentModelWithFormat<TFormat>, ContentModelSegmentBaseCommon<T> {
|
|
1623
2012
|
/**
|
|
1624
2013
|
* Hyperlink info
|
|
1625
2014
|
*/
|
|
@@ -1635,12 +2024,30 @@ interface ContentModelSegmentBase<T extends ContentModelSegmentType, TFormat ext
|
|
|
1635
2024
|
*/
|
|
1636
2025
|
type ContentModelSegment = ContentModelSelectionMarker | ContentModelText | ContentModelBr | ContentModelGeneralSegment | ContentModelEntity | ContentModelImage;
|
|
1637
2026
|
|
|
2027
|
+
/**
|
|
2028
|
+
* Union type of Content Model Segment (Readonly)
|
|
2029
|
+
*/
|
|
2030
|
+
type ReadonlyContentModelSegment = ReadonlyContentModelSelectionMarker | ReadonlyContentModelText | ReadonlyContentModelBr | ReadonlyContentModelGeneralSegment | ContentModelEntity | ReadonlyContentModelImage;
|
|
2031
|
+
|
|
2032
|
+
/**
|
|
2033
|
+
* Union type of Content Model Segment (Shallow mutable)
|
|
2034
|
+
*/
|
|
2035
|
+
type ShallowMutableContentModelSegment = ContentModelSelectionMarker | ContentModelText | ContentModelBr | ShallowMutableContentModelGeneralSegment | ContentModelEntity | ContentModelImage;
|
|
2036
|
+
|
|
1638
2037
|
/**
|
|
1639
2038
|
* Represent code info of Content Model.
|
|
1640
2039
|
* ContentModelCode is a decorator but not a standalone model type, instead it need to be put inside a ContentModelSegment
|
|
1641
2040
|
* since code is also a kind of segment, with some extra information
|
|
1642
2041
|
*/
|
|
1643
|
-
interface ContentModelCode extends ContentModelWithFormat<ContentModelCodeFormat> {
|
|
2042
|
+
interface ContentModelCode extends MutableMark, ContentModelWithFormat<ContentModelCodeFormat> {
|
|
2043
|
+
}
|
|
2044
|
+
|
|
2045
|
+
/**
|
|
2046
|
+
* Represent code info of Content Model. (Readonly)
|
|
2047
|
+
* ContentModelCode is a decorator but not a standalone model type, instead it need to be put inside a ContentModelSegment
|
|
2048
|
+
* since code is also a kind of segment, with some extra information
|
|
2049
|
+
*/
|
|
2050
|
+
interface ReadonlyContentModelCode extends ReadonlyMark, ReadonlyContentModelWithFormat<ContentModelCodeFormat> {
|
|
1644
2051
|
}
|
|
1645
2052
|
|
|
1646
2053
|
/**
|
|
@@ -1648,7 +2055,15 @@ interface ContentModelCode extends ContentModelWithFormat<ContentModelCodeFormat
|
|
|
1648
2055
|
* ContentModelLink is not a standalone model type, instead it need to be put inside a ContentModelSegment
|
|
1649
2056
|
* since link is also a kind of segment, with some extra information
|
|
1650
2057
|
*/
|
|
1651
|
-
interface ContentModelLink extends ContentModelWithFormat<ContentModelHyperLinkFormat>, ContentModelWithDataset<null> {
|
|
2058
|
+
interface ContentModelLink extends MutableMark, ContentModelWithFormat<ContentModelHyperLinkFormat>, ContentModelWithDataset<null> {
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
/**
|
|
2062
|
+
* Represent link info of Content Model (Readonly).
|
|
2063
|
+
* ContentModelLink is not a standalone model type, instead it need to be put inside a ContentModelSegment
|
|
2064
|
+
* since link is also a kind of segment, with some extra information
|
|
2065
|
+
*/
|
|
2066
|
+
interface ReadonlyContentModelLink extends ReadonlyMark, ReadonlyContentModelWithFormat<ContentModelHyperLinkFormat>, ReadonlyContentModelWithDataset<null> {
|
|
1652
2067
|
}
|
|
1653
2068
|
|
|
1654
2069
|
/**
|
|
@@ -1656,38 +2071,144 @@ interface ContentModelLink extends ContentModelWithFormat<ContentModelHyperLinkF
|
|
|
1656
2071
|
* A decorator of paragraph can represent a heading, or a P tag that act likes a paragraph but with some extra format info
|
|
1657
2072
|
* since heading is also a kind of paragraph, with some extra information
|
|
1658
2073
|
*/
|
|
1659
|
-
interface ContentModelParagraphDecorator extends ContentModelWithFormat<ContentModelSegmentFormat> {
|
|
2074
|
+
interface ContentModelParagraphDecorator extends MutableMark, ContentModelParagraphDecoratorCommon, ContentModelWithFormat<ContentModelSegmentFormat> {
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
/**
|
|
2078
|
+
* Common part of decorator for a paragraph in Content Model
|
|
2079
|
+
*/
|
|
2080
|
+
interface ContentModelParagraphDecoratorCommon {
|
|
1660
2081
|
/**
|
|
1661
2082
|
* Tag name of this paragraph
|
|
1662
2083
|
*/
|
|
1663
2084
|
tagName: string;
|
|
1664
2085
|
}
|
|
1665
2086
|
|
|
2087
|
+
/**
|
|
2088
|
+
* Represent decorator for a paragraph in Content Model (Readonly)
|
|
2089
|
+
* A decorator of paragraph can represent a heading, or a P tag that act likes a paragraph but with some extra format info
|
|
2090
|
+
* since heading is also a kind of paragraph, with some extra information
|
|
2091
|
+
*/
|
|
2092
|
+
interface ReadonlyContentModelParagraphDecorator extends ReadonlyMark, ReadonlyContentModelWithFormat<ContentModelSegmentFormat>, Readonly<ContentModelParagraphDecoratorCommon> {
|
|
2093
|
+
}
|
|
2094
|
+
|
|
1666
2095
|
/**
|
|
1667
2096
|
* Union type for segment decorators
|
|
1668
2097
|
*/
|
|
1669
2098
|
type ContentModelDecorator = ContentModelLink | ContentModelCode | ContentModelListLevel;
|
|
1670
2099
|
|
|
2100
|
+
/**
|
|
2101
|
+
* Union type for segment decorators (Readonly)
|
|
2102
|
+
*/
|
|
2103
|
+
type ReadonlyContentModelDecorator = ReadonlyContentModelLink | ReadonlyContentModelCode | ReadonlyContentModelListLevel;
|
|
2104
|
+
|
|
1671
2105
|
/**
|
|
1672
2106
|
* Content Model of List Level
|
|
1673
2107
|
*/
|
|
1674
|
-
interface ContentModelListLevel extends ContentModelWithFormat<ContentModelListItemLevelFormat>, ContentModelWithDataset<ListMetadataFormat> {
|
|
2108
|
+
interface ContentModelListLevel extends MutableMark, ContentModelBlockWithCache<HTMLOListElement | HTMLUListElement>, ContentModelListLevelCommon, ContentModelWithFormat<ContentModelListItemLevelFormat>, ContentModelWithDataset<ListMetadataFormat> {
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
/**
|
|
2112
|
+
* Common part of Content Model of List Level
|
|
2113
|
+
*/
|
|
2114
|
+
interface ContentModelListLevelCommon {
|
|
1675
2115
|
/**
|
|
1676
2116
|
* Type of a list, order (OL) or unordered (UL)
|
|
1677
2117
|
*/
|
|
1678
2118
|
listType: 'OL' | 'UL';
|
|
1679
2119
|
}
|
|
1680
2120
|
|
|
2121
|
+
/**
|
|
2122
|
+
* Content Model of List Level (Readonly)
|
|
2123
|
+
*/
|
|
2124
|
+
interface ReadonlyContentModelListLevel extends ReadonlyMark, ContentModelBlockWithCache<HTMLOListElement | HTMLUListElement>, ReadonlyContentModelWithFormat<ContentModelListItemLevelFormat>, ReadonlyContentModelWithDataset<ListMetadataFormat>, Readonly<ContentModelListLevelCommon> {
|
|
2125
|
+
}
|
|
2126
|
+
|
|
1681
2127
|
/**
|
|
1682
2128
|
* Represents a selectable Content Model object
|
|
1683
2129
|
*/
|
|
1684
|
-
interface Selectable {
|
|
2130
|
+
interface Selectable extends MutableMark {
|
|
2131
|
+
/**
|
|
2132
|
+
* Whether this model object is selected
|
|
2133
|
+
*/
|
|
2134
|
+
isSelected?: boolean;
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
/**
|
|
2138
|
+
* Represents a selectable Content Model object (Readonly)
|
|
2139
|
+
*/
|
|
2140
|
+
interface ReadonlySelectable extends ReadonlyMark {
|
|
2141
|
+
/**
|
|
2142
|
+
* Whether this model object is selected
|
|
2143
|
+
*/
|
|
2144
|
+
readonly isSelected?: boolean;
|
|
2145
|
+
}
|
|
2146
|
+
|
|
2147
|
+
/**
|
|
2148
|
+
* Represents a selectable Content Model object (Shallow mutable)
|
|
2149
|
+
*/
|
|
2150
|
+
interface ShallowMutableSelectable extends ShallowMutableMark {
|
|
1685
2151
|
/**
|
|
1686
2152
|
* Whether this model object is selected
|
|
1687
2153
|
*/
|
|
1688
2154
|
isSelected?: boolean;
|
|
1689
2155
|
}
|
|
1690
2156
|
|
|
2157
|
+
/**
|
|
2158
|
+
* Mark an object as mutable
|
|
2159
|
+
*/
|
|
2160
|
+
type MutableMark = {
|
|
2161
|
+
/**
|
|
2162
|
+
* The mutable marker to mark an object as mutable. When assign readonly object to a mutable type, compile will fail to build
|
|
2163
|
+
* due to this member does not exist from source type.
|
|
2164
|
+
*/
|
|
2165
|
+
readonly dummy1?: never[];
|
|
2166
|
+
/**
|
|
2167
|
+
* The mutable marker to mark an object as mutable. When assign readonly object to a mutable type, compile will fail to build
|
|
2168
|
+
* due to this member does not exist from source type.
|
|
2169
|
+
*/
|
|
2170
|
+
readonly dummy2?: never[];
|
|
2171
|
+
};
|
|
2172
|
+
|
|
2173
|
+
/**
|
|
2174
|
+
* Mark an object as single level mutable (child models are still readonly)
|
|
2175
|
+
*/
|
|
2176
|
+
type ShallowMutableMark = {
|
|
2177
|
+
/**
|
|
2178
|
+
* The mutable marker to mark an object as mutable. When assign readonly object to a mutable type, compile will fail to build
|
|
2179
|
+
* due to this member does not exist from source type.
|
|
2180
|
+
*/
|
|
2181
|
+
readonly dummy1?: never[];
|
|
2182
|
+
/**
|
|
2183
|
+
* The mutable marker to mark an object as mutable. When assign readonly object to a mutable type, compile will fail to build
|
|
2184
|
+
* due to this member does not exist from source type.
|
|
2185
|
+
* This is used for preventing assigning ShallowMutableMark to MutableMark
|
|
2186
|
+
*/
|
|
2187
|
+
readonly dummy2?: ReadonlyArray<never>;
|
|
2188
|
+
};
|
|
2189
|
+
|
|
2190
|
+
/**
|
|
2191
|
+
* Mark an object as readonly
|
|
2192
|
+
*/
|
|
2193
|
+
type ReadonlyMark = {
|
|
2194
|
+
/**
|
|
2195
|
+
* The mutable marker to mark an object as mutable. When assign readonly object to a mutable type, compile will fail to build
|
|
2196
|
+
* due to this member does not exist from source type.
|
|
2197
|
+
* This is used for preventing assigning ReadonlyMark to ShallowMutableMark or MutableMark
|
|
2198
|
+
*/
|
|
2199
|
+
readonly dummy1?: ReadonlyArray<never>;
|
|
2200
|
+
/**
|
|
2201
|
+
* The mutable marker to mark an object as mutable. When assign readonly object to a mutable type, compile will fail to build
|
|
2202
|
+
* due to this member does not exist from source type.
|
|
2203
|
+
*/
|
|
2204
|
+
readonly dummy2?: ReadonlyArray<never>;
|
|
2205
|
+
};
|
|
2206
|
+
|
|
2207
|
+
/**
|
|
2208
|
+
* Get mutable type from its related readonly type
|
|
2209
|
+
*/
|
|
2210
|
+
type MutableType<T> = T extends ReadonlyContentModelGeneralSegment ? ShallowMutableContentModelGeneralSegment : T extends ReadonlyContentModelSelectionMarker ? ContentModelSelectionMarker : T extends ReadonlyContentModelImage ? ContentModelImage : T extends ContentModelEntity ? ContentModelEntity : T extends ReadonlyContentModelText ? ContentModelText : T extends ReadonlyContentModelBr ? ContentModelBr : T extends ReadonlyContentModelParagraph ? ShallowMutableContentModelParagraph : T extends ReadonlyContentModelTable ? ShallowMutableContentModelTable : T extends ReadonlyContentModelTableRow ? ContentModelTableRow : T extends ReadonlyContentModelTableCell ? ShallowMutableContentModelTableCell : T extends ReadonlyContentModelFormatContainer ? ShallowMutableContentModelFormatContainer : T extends ReadonlyContentModelListItem ? ShallowMutableContentModelListItem : T extends ReadonlyContentModelListLevel ? ContentModelListLevel : T extends ReadonlyContentModelDivider ? ContentModelDivider : T extends ReadonlyContentModelDocument ? ShallowMutableContentModelDocument : T extends ReadonlyContentModelGeneralBlock ? ShallowMutableContentModelGeneralBlock : T extends ReadonlyContentModelParagraphDecorator ? ContentModelParagraphDecorator : T extends ReadonlyContentModelLink ? ContentModelLink : T extends ReadonlyContentModelCode ? ContentModelCode : never;
|
|
2211
|
+
|
|
1691
2212
|
/**
|
|
1692
2213
|
* The union type of 3 selection types
|
|
1693
2214
|
*/
|
|
@@ -1775,15 +2296,15 @@ interface InsertPoint {
|
|
|
1775
2296
|
/**
|
|
1776
2297
|
* The paragraph that contains this insert point
|
|
1777
2298
|
*/
|
|
1778
|
-
paragraph:
|
|
2299
|
+
paragraph: ShallowMutableContentModelParagraph;
|
|
1779
2300
|
/**
|
|
1780
2301
|
* Block group path of this insert point, from direct parent group to the root group
|
|
1781
2302
|
*/
|
|
1782
|
-
path:
|
|
2303
|
+
path: ReadonlyContentModelBlockGroup[];
|
|
1783
2304
|
/**
|
|
1784
2305
|
* Table context of this insert point
|
|
1785
2306
|
*/
|
|
1786
|
-
tableContext?:
|
|
2307
|
+
tableContext?: ReadonlyTableSelectionContext;
|
|
1787
2308
|
}
|
|
1788
2309
|
|
|
1789
2310
|
/**
|
|
@@ -1808,6 +2329,28 @@ interface TableSelectionContext {
|
|
|
1808
2329
|
isWholeTableSelected: boolean;
|
|
1809
2330
|
}
|
|
1810
2331
|
|
|
2332
|
+
/**
|
|
2333
|
+
* Context object for table in a selection (Readonly)
|
|
2334
|
+
*/
|
|
2335
|
+
interface ReadonlyTableSelectionContext {
|
|
2336
|
+
/**
|
|
2337
|
+
* The table that contains the selection
|
|
2338
|
+
*/
|
|
2339
|
+
table: ReadonlyContentModelTable;
|
|
2340
|
+
/**
|
|
2341
|
+
* Row Index of the selected table cell
|
|
2342
|
+
*/
|
|
2343
|
+
rowIndex: number;
|
|
2344
|
+
/**
|
|
2345
|
+
* Column Index of the selected table cell
|
|
2346
|
+
*/
|
|
2347
|
+
colIndex: number;
|
|
2348
|
+
/**
|
|
2349
|
+
* Whether the whole table is selected
|
|
2350
|
+
*/
|
|
2351
|
+
isWholeTableSelected: boolean;
|
|
2352
|
+
}
|
|
2353
|
+
|
|
1811
2354
|
/**
|
|
1812
2355
|
* Coordinates of table selection
|
|
1813
2356
|
*/
|
|
@@ -2941,6 +3484,10 @@ interface EditorOptions {
|
|
|
2941
3484
|
* Color of the border of a selectedImage. Default color: '#DB626C'
|
|
2942
3485
|
*/
|
|
2943
3486
|
imageSelectionBorderColor?: string;
|
|
3487
|
+
/**
|
|
3488
|
+
* Background color of a selected table cell. Default color: '#C6C6C6'
|
|
3489
|
+
*/
|
|
3490
|
+
tableCellSelectionBackgroundColor?: string;
|
|
2944
3491
|
/**
|
|
2945
3492
|
* Initial Content Model
|
|
2946
3493
|
*/
|
|
@@ -3574,6 +4121,18 @@ interface SelectionPluginState {
|
|
|
3574
4121
|
* Color of the border of a selectedImage. Default color: '#DB626C'
|
|
3575
4122
|
*/
|
|
3576
4123
|
imageSelectionBorderColor?: string;
|
|
4124
|
+
/**
|
|
4125
|
+
* Color of the border of a selectedImage in dark mode. Default color: '#DB626C'
|
|
4126
|
+
*/
|
|
4127
|
+
imageSelectionBorderColorDark?: string;
|
|
4128
|
+
/**
|
|
4129
|
+
* Background color of a selected table cell. Default color: '#C6C6C6'
|
|
4130
|
+
*/
|
|
4131
|
+
tableCellSelectionBackgroundColor?: string;
|
|
4132
|
+
/**
|
|
4133
|
+
* Background color of a selected table cell in dark mode. Default color: '#C6C6C6'
|
|
4134
|
+
*/
|
|
4135
|
+
tableCellSelectionBackgroundColorDark?: string;
|
|
3577
4136
|
}
|
|
3578
4137
|
|
|
3579
4138
|
/**
|
|
@@ -4089,11 +4648,11 @@ interface DeleteSelectionContext extends DeleteSelectionResult {
|
|
|
4089
4648
|
/**
|
|
4090
4649
|
* Last paragraph after previous step
|
|
4091
4650
|
*/
|
|
4092
|
-
lastParagraph?:
|
|
4651
|
+
lastParagraph?: ShallowMutableContentModelParagraph;
|
|
4093
4652
|
/**
|
|
4094
4653
|
* Last table context after previous step
|
|
4095
4654
|
*/
|
|
4096
|
-
lastTableContext?:
|
|
4655
|
+
lastTableContext?: ReadonlyTableSelectionContext;
|
|
4097
4656
|
/**
|
|
4098
4657
|
* Format context provided by formatContentModel API
|
|
4099
4658
|
*/
|
|
@@ -4692,6 +5251,16 @@ interface IterateSelectionsOption {
|
|
|
4692
5251
|
includeListFormatHolder?: 'anySegment' | 'allSegments' | 'never';
|
|
4693
5252
|
}
|
|
4694
5253
|
|
|
5254
|
+
/**
|
|
5255
|
+
* The callback function type for iterateSelections (Readonly)
|
|
5256
|
+
* @param path The block group path of current selection
|
|
5257
|
+
* @param tableContext Table context of current selection
|
|
5258
|
+
* @param block Block of current selection
|
|
5259
|
+
* @param segments Segments of current selection
|
|
5260
|
+
* @returns True to stop iterating, otherwise keep going
|
|
5261
|
+
*/
|
|
5262
|
+
type ReadonlyIterateSelectionsCallback = (path: ReadonlyContentModelBlockGroup[], tableContext?: ReadonlyTableSelectionContext, block?: ReadonlyContentModelBlock, segments?: ReadonlyContentModelSegment[]) => void | boolean;
|
|
5263
|
+
|
|
4695
5264
|
/**
|
|
4696
5265
|
* A type map from node type number to its type declaration. This is used by utility function isNodeOfType()
|
|
4697
5266
|
*/
|
|
@@ -4733,7 +5302,7 @@ interface NodeTypeMap {
|
|
|
4733
5302
|
/**
|
|
4734
5303
|
* Retrieve block group type string from a given block group
|
|
4735
5304
|
*/
|
|
4736
|
-
type TypeOfBlockGroup<T extends ContentModelBlockGroup> = T extends ContentModelBlockGroupBase<infer U> ? U : never;
|
|
5305
|
+
type TypeOfBlockGroup<T extends ContentModelBlockGroup | ReadonlyContentModelBlockGroup> = T extends ContentModelBlockGroupBase<infer U> | ReadonlyContentModelBlockGroupBase<infer U> ? U : never;
|
|
4737
5306
|
|
|
4738
5307
|
/**
|
|
4739
5308
|
* Represent a pair of parent block group and child block
|
|
@@ -4753,6 +5322,24 @@ type OperationalBlocks<T extends ContentModelBlockGroup> = {
|
|
|
4753
5322
|
path: ContentModelBlockGroup[];
|
|
4754
5323
|
};
|
|
4755
5324
|
|
|
5325
|
+
/**
|
|
5326
|
+
* Represent a pair of parent block group and child block (Readonly)
|
|
5327
|
+
*/
|
|
5328
|
+
type ReadonlyOperationalBlocks<T extends ReadonlyContentModelBlockGroup> = {
|
|
5329
|
+
/**
|
|
5330
|
+
* The parent block group
|
|
5331
|
+
*/
|
|
5332
|
+
parent: ReadonlyContentModelBlockGroup;
|
|
5333
|
+
/**
|
|
5334
|
+
* The child block
|
|
5335
|
+
*/
|
|
5336
|
+
block: ReadonlyContentModelBlock | T;
|
|
5337
|
+
/**
|
|
5338
|
+
* Selection path of this block
|
|
5339
|
+
*/
|
|
5340
|
+
path: ReadonlyContentModelBlockGroup[];
|
|
5341
|
+
};
|
|
5342
|
+
|
|
4756
5343
|
/**
|
|
4757
5344
|
* Represents a parsed table with its table cells
|
|
4758
5345
|
*/
|
|
@@ -5472,13 +6059,21 @@ function buildSelectionMarker(group: ContentModelBlockGroup, context: DomToModel
|
|
|
5472
6059
|
* @param definition @optional Metadata definition used for verify the metadata object
|
|
5473
6060
|
* @returns The metadata object if any, or null
|
|
5474
6061
|
*/
|
|
5475
|
-
function updateMetadata<T>(model:
|
|
6062
|
+
function updateMetadata<T>(model: ShallowMutableContentModelWithDataset<T>, callback?: (metadata: T | null) => T | null, definition?: Definition<T>): T | null;
|
|
6063
|
+
|
|
6064
|
+
/**
|
|
6065
|
+
* Retrieve metadata from the given model.
|
|
6066
|
+
* @param model The Content Model to retrieve metadata from
|
|
6067
|
+
* @param definition Definition of this metadata type, used for validate the metadata object
|
|
6068
|
+
* @returns Metadata of the model, or null if it does not contain a valid metadata
|
|
6069
|
+
*/
|
|
6070
|
+
function getMetadata<T>(model: ReadonlyContentModelWithDataset<T>, definition?: Definition<T>): T | null;
|
|
5476
6071
|
|
|
5477
6072
|
/**
|
|
5478
6073
|
* Check if the given model has metadata
|
|
5479
6074
|
* @param model The content model to check
|
|
5480
6075
|
*/
|
|
5481
|
-
function hasMetadata<T>(model:
|
|
6076
|
+
function hasMetadata<T>(model: ReadonlyContentModelWithDataset<T> | HTMLElement): boolean;
|
|
5482
6077
|
|
|
5483
6078
|
/**
|
|
5484
6079
|
* Type checker for Node. Return true if it of the specified node type
|
|
@@ -5652,21 +6247,21 @@ function normalizeRect(clientRect: DOMRect): Rect | null;
|
|
|
5652
6247
|
* Create a ContentModelBr model
|
|
5653
6248
|
* @param format @optional The format of this model
|
|
5654
6249
|
*/
|
|
5655
|
-
function createBr(format?: ContentModelSegmentFormat): ContentModelBr;
|
|
6250
|
+
function createBr(format?: Readonly<ContentModelSegmentFormat>): ContentModelBr;
|
|
5656
6251
|
|
|
5657
6252
|
/**
|
|
5658
6253
|
* Create a ContentModelListItem model
|
|
5659
6254
|
* @param levels Existing list levels
|
|
5660
6255
|
* @param format @optional The format of this model
|
|
5661
6256
|
*/
|
|
5662
|
-
function createListItem(levels:
|
|
6257
|
+
function createListItem(levels: ReadonlyArray<ReadonlyContentModelListLevel>, format?: Readonly<ContentModelSegmentFormat>): ContentModelListItem;
|
|
5663
6258
|
|
|
5664
6259
|
/**
|
|
5665
6260
|
* Create a ContentModelFormatContainer model
|
|
5666
6261
|
* @param tag Tag name of this format container, in lower case
|
|
5667
6262
|
* @param format @optional The format of this model
|
|
5668
6263
|
*/
|
|
5669
|
-
function createFormatContainer(tag: Lowercase<string>, format?: ContentModelFormatContainerFormat): ContentModelFormatContainer;
|
|
6264
|
+
function createFormatContainer(tag: Lowercase<string>, format?: Readonly<ContentModelFormatContainerFormat>): ContentModelFormatContainer;
|
|
5670
6265
|
|
|
5671
6266
|
/**
|
|
5672
6267
|
* Create a ContentModelParagraph model
|
|
@@ -5675,20 +6270,20 @@ function createFormatContainer(tag: Lowercase<string>, format?: ContentModelForm
|
|
|
5675
6270
|
* @param segmentFormat @optional Segment format applied to this block
|
|
5676
6271
|
* @param decorator @optional Decorator of this paragraph
|
|
5677
6272
|
*/
|
|
5678
|
-
function createParagraph(isImplicit?: boolean, blockFormat?: ContentModelBlockFormat
|
|
6273
|
+
function createParagraph(isImplicit?: boolean, blockFormat?: Readonly<ContentModelBlockFormat>, segmentFormat?: Readonly<ContentModelSegmentFormat>, decorator?: ReadonlyContentModelParagraphDecorator): ContentModelParagraph;
|
|
5679
6274
|
|
|
5680
6275
|
/**
|
|
5681
6276
|
* Create a ContentModelSelectionMarker model
|
|
5682
6277
|
* @param format @optional The format of this model
|
|
5683
6278
|
*/
|
|
5684
|
-
function createSelectionMarker(format?: ContentModelSegmentFormat): ContentModelSelectionMarker;
|
|
6279
|
+
function createSelectionMarker(format?: Readonly<ContentModelSegmentFormat>): ContentModelSelectionMarker;
|
|
5685
6280
|
|
|
5686
6281
|
/**
|
|
5687
6282
|
* Create a ContentModelTable model
|
|
5688
6283
|
* @param rowCount Count of rows of this table
|
|
5689
6284
|
* @param format @optional The format of this model
|
|
5690
6285
|
*/
|
|
5691
|
-
function createTable(rowCount: number, format?: ContentModelTableFormat): ContentModelTable;
|
|
6286
|
+
function createTable(rowCount: number, format?: Readonly<ContentModelTableFormat>): ContentModelTable;
|
|
5692
6287
|
|
|
5693
6288
|
/**
|
|
5694
6289
|
* Create a ContentModelTableCell model
|
|
@@ -5697,7 +6292,7 @@ function createTable(rowCount: number, format?: ContentModelTableFormat): Conten
|
|
|
5697
6292
|
* @param isHeader @optional Whether this is a header cell @default false
|
|
5698
6293
|
* @param format @optional The format of this model
|
|
5699
6294
|
*/
|
|
5700
|
-
function createTableCell(spanLeftOrColSpan?: boolean | number, spanAboveOrRowSpan?: boolean | number, isHeader?: boolean, format?: ContentModelTableCellFormat
|
|
6295
|
+
function createTableCell(spanLeftOrColSpan?: boolean | number, spanAboveOrRowSpan?: boolean | number, isHeader?: boolean, format?: Readonly<ContentModelTableCellFormat>, dataset?: ReadonlyDatasetFormat): ContentModelTableCell;
|
|
5701
6296
|
|
|
5702
6297
|
/**
|
|
5703
6298
|
* Create a ContentModelText model
|
|
@@ -5706,34 +6301,34 @@ function createTableCell(spanLeftOrColSpan?: boolean | number, spanAboveOrRowSpa
|
|
|
5706
6301
|
* @param link @optional The link decorator
|
|
5707
6302
|
* @param code @option The code decorator
|
|
5708
6303
|
*/
|
|
5709
|
-
function createText(text: string, format?: ContentModelSegmentFormat
|
|
6304
|
+
function createText(text: string, format?: Readonly<ContentModelSegmentFormat>, link?: ReadonlyContentModelLink, code?: ReadonlyContentModelCode): ContentModelText;
|
|
5710
6305
|
|
|
5711
6306
|
/**
|
|
5712
6307
|
* Create a ContentModelImage model
|
|
5713
6308
|
* @param src Image source
|
|
5714
6309
|
* @param format @optional The format of this model
|
|
5715
6310
|
*/
|
|
5716
|
-
function createImage(src: string, format?: ContentModelImageFormat): ContentModelImage;
|
|
6311
|
+
function createImage(src: string, format?: Readonly<ContentModelImageFormat>): ContentModelImage;
|
|
5717
6312
|
|
|
5718
6313
|
/**
|
|
5719
6314
|
* Create a ContentModelDocument model
|
|
5720
6315
|
* @param defaultFormat @optional Default format of this model
|
|
5721
6316
|
*/
|
|
5722
|
-
function createContentModelDocument(defaultFormat?: ContentModelSegmentFormat): ContentModelDocument;
|
|
6317
|
+
function createContentModelDocument(defaultFormat?: Readonly<ContentModelSegmentFormat>): ContentModelDocument;
|
|
5723
6318
|
|
|
5724
6319
|
/**
|
|
5725
6320
|
* Create a ContentModelParagraphDecorator model
|
|
5726
6321
|
* @param tagName Tag name of this decorator
|
|
5727
6322
|
* @param format @optional The format of this model
|
|
5728
6323
|
*/
|
|
5729
|
-
function createParagraphDecorator(tagName: string, format?: ContentModelSegmentFormat): ContentModelParagraphDecorator;
|
|
6324
|
+
function createParagraphDecorator(tagName: string, format?: Readonly<ContentModelSegmentFormat>): ContentModelParagraphDecorator;
|
|
5730
6325
|
|
|
5731
6326
|
/**
|
|
5732
6327
|
* Create a ContentModelGeneralSegment model
|
|
5733
6328
|
* @param element The original DOM element
|
|
5734
6329
|
* @param format @optional The format of this model
|
|
5735
6330
|
*/
|
|
5736
|
-
function createGeneralSegment(element: HTMLElement, format?: ContentModelSegmentFormat): ContentModelGeneralSegment;
|
|
6331
|
+
function createGeneralSegment(element: HTMLElement, format?: Readonly<ContentModelSegmentFormat>): ContentModelGeneralSegment;
|
|
5737
6332
|
|
|
5738
6333
|
/**
|
|
5739
6334
|
* Create a ContentModelGeneralBlock model
|
|
@@ -5749,14 +6344,14 @@ function createGeneralBlock(element: HTMLElement): ContentModelGeneralBlock;
|
|
|
5749
6344
|
* @param type @optional Type of this entity
|
|
5750
6345
|
* @param id @optional Id of this entity
|
|
5751
6346
|
*/
|
|
5752
|
-
function createEntity(wrapper: HTMLElement, isReadonly?: boolean, segmentFormat?: ContentModelSegmentFormat
|
|
6347
|
+
function createEntity(wrapper: HTMLElement, isReadonly?: boolean, segmentFormat?: Readonly<ContentModelSegmentFormat>, type?: string, id?: string): ContentModelEntity;
|
|
5753
6348
|
|
|
5754
6349
|
/**
|
|
5755
6350
|
* Create a ContentModelDivider model
|
|
5756
6351
|
* @param tagName Tag name of this divider. Currently only hr and div are supported
|
|
5757
6352
|
* @param format @optional The format of this model
|
|
5758
6353
|
*/
|
|
5759
|
-
function createDivider(tagName: 'hr' | 'div', format?: ContentModelBlockFormat): ContentModelDivider;
|
|
6354
|
+
function createDivider(tagName: 'hr' | 'div', format?: Readonly<ContentModelBlockFormat>): ContentModelDivider;
|
|
5760
6355
|
|
|
5761
6356
|
/**
|
|
5762
6357
|
* Create a ContentModelListLevel model
|
|
@@ -5764,27 +6359,56 @@ function createDivider(tagName: 'hr' | 'div', format?: ContentModelBlockFormat):
|
|
|
5764
6359
|
* @param format @optional The format of this model
|
|
5765
6360
|
* @param dataset @optional The dataset of this model
|
|
5766
6361
|
*/
|
|
5767
|
-
function createListLevel(listType: 'OL' | 'UL', format?: ContentModelListItemLevelFormat
|
|
6362
|
+
function createListLevel(listType: 'OL' | 'UL', format?: Readonly<ContentModelListItemLevelFormat>, dataset?: ReadonlyDatasetFormat): ContentModelListLevel;
|
|
5768
6363
|
|
|
5769
6364
|
/**
|
|
5770
6365
|
* Create an empty Content Model Document with initial empty line and insert point with default format
|
|
5771
6366
|
* @param format @optional The default format to be applied to this Content Model
|
|
5772
6367
|
*/
|
|
5773
|
-
function createEmptyModel(format?: ContentModelSegmentFormat): ContentModelDocument;
|
|
6368
|
+
function createEmptyModel(format?: Readonly<ContentModelSegmentFormat>): ContentModelDocument;
|
|
6369
|
+
|
|
6370
|
+
/**
|
|
6371
|
+
* Create a ContentModelTableRow model
|
|
6372
|
+
* @param format @optional The format of this model
|
|
6373
|
+
*/
|
|
6374
|
+
function createTableRow(format?: Readonly<ContentModelBlockFormat>, height?: number): ContentModelTableRow;
|
|
6375
|
+
|
|
6376
|
+
/**
|
|
6377
|
+
* Convert a readonly block to mutable block, clear cached element if exist
|
|
6378
|
+
* @param block The block to convert from
|
|
6379
|
+
* @returns The same block object of its related mutable type
|
|
6380
|
+
*/
|
|
6381
|
+
function mutateBlock<T extends ReadonlyContentModelBlockGroup | ReadonlyContentModelBlock>(block: T): MutableType<T>;
|
|
6382
|
+
|
|
6383
|
+
/**
|
|
6384
|
+
* Convert segments of a readonly paragraph to be mutable.
|
|
6385
|
+
* Segments that are not belong to the given paragraph will be skipped
|
|
6386
|
+
* @param paragraph The readonly paragraph to convert from
|
|
6387
|
+
* @param segments The segments to convert from
|
|
6388
|
+
*/
|
|
6389
|
+
function mutateSegments(paragraph: ReadonlyContentModelParagraph, segments: ReadonlyContentModelSegment[]): [ShallowMutableContentModelParagraph, ShallowMutableContentModelSegment[], number[]];
|
|
6390
|
+
|
|
6391
|
+
/**
|
|
6392
|
+
* Convert a readonly segment to be mutable, together with its owner paragraph
|
|
6393
|
+
* If the segment does not belong to the given paragraph, return null for the segment
|
|
6394
|
+
* @param paragraph The readonly paragraph to convert from
|
|
6395
|
+
* @param segment The segment to convert from
|
|
6396
|
+
*/
|
|
6397
|
+
function mutateSegment<T extends ReadonlyContentModelSegment>(paragraph: ReadonlyContentModelParagraph, segment: T, callback?: (segment: MutableType<T>, paragraph: ShallowMutableContentModelParagraph, index: number) => void): [ShallowMutableContentModelParagraph, MutableType<T> | null, number];
|
|
5774
6398
|
|
|
5775
6399
|
/**
|
|
5776
6400
|
* Add a given block to block group
|
|
5777
6401
|
* @param group The block group to add block into
|
|
5778
6402
|
* @param block The block to add
|
|
5779
6403
|
*/
|
|
5780
|
-
function addBlock(group:
|
|
6404
|
+
function addBlock(group: ShallowMutableContentModelBlockGroup, block: ShallowMutableContentModelBlock): void;
|
|
5781
6405
|
|
|
5782
6406
|
/**
|
|
5783
6407
|
* Add a code decorator into segment if any
|
|
5784
6408
|
* @param segment The segment to add decorator to
|
|
5785
6409
|
* @param code The code decorator to add
|
|
5786
6410
|
*/
|
|
5787
|
-
function addCode(segment:
|
|
6411
|
+
function addCode(segment: ShallowMutableContentModelSegment, code: ReadonlyContentModelCode): void;
|
|
5788
6412
|
|
|
5789
6413
|
/**
|
|
5790
6414
|
* Add a new text segment to current paragraph
|
|
@@ -5799,7 +6423,7 @@ function addTextSegment(group: ContentModelBlockGroup, text: string, context: Do
|
|
|
5799
6423
|
* @param paragraph The paragraph to normalize
|
|
5800
6424
|
* Normalize a paragraph. If it is empty, add a BR segment to make sure it can insert content
|
|
5801
6425
|
*/
|
|
5802
|
-
function normalizeParagraph(paragraph:
|
|
6426
|
+
function normalizeParagraph(paragraph: ReadonlyContentModelParagraph): void;
|
|
5803
6427
|
|
|
5804
6428
|
/**
|
|
5805
6429
|
* For a given content model, normalize it to make the model be consistent.
|
|
@@ -5810,7 +6434,7 @@ function normalizeParagraph(paragraph: ContentModelParagraph): void;
|
|
|
5810
6434
|
* - For an empty block, remove it
|
|
5811
6435
|
* @param group The root level block group of content model to normalize
|
|
5812
6436
|
*/
|
|
5813
|
-
function normalizeContentModel(group:
|
|
6437
|
+
function normalizeContentModel(group: ReadonlyContentModelBlockGroup): void;
|
|
5814
6438
|
|
|
5815
6439
|
/**
|
|
5816
6440
|
* Check if the given block group is a general segment
|
|
@@ -5818,12 +6442,24 @@ function normalizeContentModel(group: ContentModelBlockGroup): void;
|
|
|
5818
6442
|
*/
|
|
5819
6443
|
function isGeneralSegment(group: ContentModelBlockGroup | ContentModelGeneralSegment): group is ContentModelGeneralSegment;
|
|
5820
6444
|
|
|
6445
|
+
/**
|
|
6446
|
+
* Check if the given block group is a general segment (Shallow mutable)
|
|
6447
|
+
* @param group The group to check
|
|
6448
|
+
*/
|
|
6449
|
+
function isGeneralSegment(group: ShallowMutableContentModelBlockGroup | ShallowMutableContentModelGeneralSegment): group is ShallowMutableContentModelGeneralSegment;
|
|
6450
|
+
|
|
6451
|
+
/**
|
|
6452
|
+
* Check if the given block group is a general segment (Readonly)
|
|
6453
|
+
* @param group The group to check
|
|
6454
|
+
*/
|
|
6455
|
+
function isGeneralSegment(group: ReadonlyContentModelBlockGroup | ReadonlyContentModelGeneralSegment): group is ReadonlyContentModelGeneralSegment;
|
|
6456
|
+
|
|
5821
6457
|
/**
|
|
5822
6458
|
* Unwrap a given block group, move its child blocks to be under its parent group
|
|
5823
6459
|
* @param parent Parent block group of the unwrapping group
|
|
5824
6460
|
* @param groupToUnwrap The block group to unwrap
|
|
5825
6461
|
*/
|
|
5826
|
-
function unwrapBlock(parent:
|
|
6462
|
+
function unwrapBlock(parent: ReadonlyContentModelBlockGroup | null, groupToUnwrap: ReadonlyContentModelBlockGroup & ReadonlyContentModelBlock): void;
|
|
5827
6463
|
|
|
5828
6464
|
/**
|
|
5829
6465
|
* Add a given segment into a paragraph from its parent group. If the last block of the given group is not paragraph, create a new paragraph.
|
|
@@ -5834,24 +6470,33 @@ function unwrapBlock(parent: ContentModelBlockGroup | null, groupToUnwrap: Conte
|
|
|
5834
6470
|
*/
|
|
5835
6471
|
function addSegment(group: ContentModelBlockGroup, newSegment: ContentModelSegment, blockFormat?: ContentModelBlockFormat, segmentFormat?: ContentModelSegmentFormat): ContentModelParagraph;
|
|
5836
6472
|
|
|
6473
|
+
/**
|
|
6474
|
+
* Add a given segment into a paragraph from its parent group. If the last block of the given group is not paragraph, create a new paragraph. (Shallow mutable)
|
|
6475
|
+
* @param group The parent block group of the paragraph to add segment into
|
|
6476
|
+
* @param newSegment The segment to add
|
|
6477
|
+
* @param blockFormat The block format used for creating a new paragraph when need
|
|
6478
|
+
* @returns The parent paragraph where the segment is added to
|
|
6479
|
+
*/
|
|
6480
|
+
function addSegment(group: ShallowMutableContentModelBlockGroup, newSegment: ContentModelSegment, blockFormat?: ContentModelBlockFormat, segmentFormat?: ContentModelSegmentFormat): ShallowMutableContentModelParagraph;
|
|
6481
|
+
|
|
5837
6482
|
/**
|
|
5838
6483
|
* Get whether the model is empty.
|
|
5839
6484
|
* @returns true if the model is empty.
|
|
5840
6485
|
*/
|
|
5841
|
-
function isEmpty(model:
|
|
6486
|
+
function isEmpty(model: ReadonlyContentModelBlock | ReadonlyContentModelBlockGroup | ReadonlyContentModelSegment): boolean;
|
|
5842
6487
|
|
|
5843
6488
|
/**
|
|
5844
6489
|
* Normalize a given segment, make sure its spaces are correctly represented by space and non-break space
|
|
5845
6490
|
* @param segment The segment to normalize
|
|
5846
6491
|
* @param ignoreTrailingSpaces Whether we should ignore the trailing space of the text segment @default false
|
|
5847
6492
|
*/
|
|
5848
|
-
function normalizeSingleSegment(segment:
|
|
6493
|
+
function normalizeSingleSegment(paragraph: ReadonlyContentModelParagraph, segment: ReadonlyContentModelSegment, ignoreTrailingSpaces?: boolean): void;
|
|
5849
6494
|
|
|
5850
6495
|
/**
|
|
5851
6496
|
* For a given block, if it is a paragraph, set it to be not-implicit
|
|
5852
6497
|
* @param block The block to check
|
|
5853
6498
|
*/
|
|
5854
|
-
function setParagraphNotImplicit(block:
|
|
6499
|
+
function setParagraphNotImplicit(block: ReadonlyContentModelBlock): void;
|
|
5855
6500
|
|
|
5856
6501
|
/**
|
|
5857
6502
|
* Get the list number for a list item according to list style type and its index number
|
|
@@ -6081,13 +6726,20 @@ function cacheGetEventData<T, E extends PluginEvent>(event: E, key: string, gett
|
|
|
6081
6726
|
*/
|
|
6082
6727
|
function isBlockGroupOfType<T extends ContentModelBlockGroup>(input: ContentModelBlock | ContentModelBlockGroup | null | undefined, type: TypeOfBlockGroup<T>): input is T;
|
|
6083
6728
|
|
|
6729
|
+
/**
|
|
6730
|
+
* Check if the given content model block or block group is of the expected block group type (Readonly)
|
|
6731
|
+
* @param input The object to check
|
|
6732
|
+
* @param type The expected type
|
|
6733
|
+
*/
|
|
6734
|
+
function isBlockGroupOfType<T extends ReadonlyContentModelBlockGroup>(input: ReadonlyContentModelBlock | ReadonlyContentModelBlockGroup | null | undefined, type: TypeOfBlockGroup<T>): input is T;
|
|
6735
|
+
|
|
6084
6736
|
/**
|
|
6085
6737
|
* Get index of closest ancestor block group of the expected block group type. If not found, return -1
|
|
6086
6738
|
* @param path The block group path, from the closest one to root
|
|
6087
6739
|
* @param blockGroupTypes The expected block group types
|
|
6088
6740
|
* @param stopTypes @optional Block group types that will cause stop searching
|
|
6089
6741
|
*/
|
|
6090
|
-
function getClosestAncestorBlockGroupIndex<T extends ContentModelBlockGroup>(path:
|
|
6742
|
+
function getClosestAncestorBlockGroupIndex<T extends ContentModelBlockGroup>(path: ReadonlyContentModelBlockGroup[], blockGroupTypes: TypeOfBlockGroup<T>[], stopTypes?: ContentModelBlockGroupType[]): number;
|
|
6091
6743
|
|
|
6092
6744
|
/**
|
|
6093
6745
|
* Iterate all selected elements in a given model
|
|
@@ -6097,18 +6749,38 @@ function getClosestAncestorBlockGroupIndex<T extends ContentModelBlockGroup>(pat
|
|
|
6097
6749
|
*/
|
|
6098
6750
|
function iterateSelections(group: ContentModelBlockGroup, callback: IterateSelectionsCallback, option?: IterateSelectionsOption): void;
|
|
6099
6751
|
|
|
6752
|
+
/**
|
|
6753
|
+
* Iterate all selected elements in a given model (Readonly)
|
|
6754
|
+
* @param group The given Content Model to iterate selection from
|
|
6755
|
+
* @param callback The callback function to access the selected element
|
|
6756
|
+
* @param option Option to determine how to iterate
|
|
6757
|
+
*/
|
|
6758
|
+
function iterateSelections(group: ReadonlyContentModelBlockGroup, callback: ReadonlyIterateSelectionsCallback, option?: IterateSelectionsOption): void;
|
|
6759
|
+
|
|
6100
6760
|
/**
|
|
6101
6761
|
* Get the first selected list item from content model
|
|
6102
6762
|
* @param model The Content Model to get selection from
|
|
6103
6763
|
*/
|
|
6104
6764
|
function getFirstSelectedListItem(model: ContentModelDocument): ContentModelListItem | undefined;
|
|
6105
6765
|
|
|
6766
|
+
/**
|
|
6767
|
+
* Get the first selected list item from content model (Readonly)
|
|
6768
|
+
* @param model The Content Model to get selection from
|
|
6769
|
+
*/
|
|
6770
|
+
function getFirstSelectedListItem(model: ReadonlyContentModelDocument): ReadonlyContentModelListItem | undefined;
|
|
6771
|
+
|
|
6106
6772
|
/**
|
|
6107
6773
|
* Get the first selected table from content model
|
|
6108
6774
|
* @param model The Content Model to get selection from
|
|
6109
6775
|
*/
|
|
6110
6776
|
function getFirstSelectedTable(model: ContentModelDocument): [ContentModelTable | undefined, ContentModelBlockGroup[]];
|
|
6111
6777
|
|
|
6778
|
+
/**
|
|
6779
|
+
* Get the first selected table from content model (Readonly)
|
|
6780
|
+
* @param model The Content Model to get selection from
|
|
6781
|
+
*/
|
|
6782
|
+
function getFirstSelectedTable(model: ReadonlyContentModelDocument): [ReadonlyContentModelTable | undefined, ReadonlyContentModelBlockGroup[]];
|
|
6783
|
+
|
|
6112
6784
|
/**
|
|
6113
6785
|
* Get an array of block group - block pair that is of the expected block group type from selection
|
|
6114
6786
|
* @param group The root block group to search
|
|
@@ -6118,12 +6790,34 @@ function getFirstSelectedTable(model: ContentModelDocument): [ContentModelTable
|
|
|
6118
6790
|
*/
|
|
6119
6791
|
function getOperationalBlocks<T extends ContentModelBlockGroup>(group: ContentModelBlockGroup, blockGroupTypes: TypeOfBlockGroup<T>[], stopTypes: ContentModelBlockGroupType[], deepFirst?: boolean): OperationalBlocks<T>[];
|
|
6120
6792
|
|
|
6793
|
+
/**
|
|
6794
|
+
* Get an array of block group - block pair that is of the expected block group type from selection (Readonly)
|
|
6795
|
+
* @param group The root block group to search
|
|
6796
|
+
* @param blockGroupTypes The expected block group types
|
|
6797
|
+
* @param stopTypes Block group types that will stop searching when hit
|
|
6798
|
+
* @param deepFirst True means search in deep first, otherwise wide first
|
|
6799
|
+
*/
|
|
6800
|
+
function getOperationalBlocks<T extends ReadonlyContentModelBlockGroup>(group: ReadonlyContentModelBlockGroup, blockGroupTypes: TypeOfBlockGroup<T>[], stopTypes: ContentModelBlockGroupType[], deepFirst?: boolean): ReadonlyOperationalBlocks<T>[];
|
|
6801
|
+
|
|
6121
6802
|
/**
|
|
6122
6803
|
* Get any array of selected paragraphs from a content model
|
|
6123
6804
|
* @param model The Content Model to get selection from
|
|
6124
6805
|
*/
|
|
6125
6806
|
function getSelectedParagraphs(model: ContentModelDocument): ContentModelParagraph[];
|
|
6126
6807
|
|
|
6808
|
+
/**
|
|
6809
|
+
* Get any array of selected paragraphs from a content model, return mutable paragraphs
|
|
6810
|
+
* @param model The Content Model to get selection from
|
|
6811
|
+
* @param mutate Set to true to indicate we will mutate the selected paragraphs
|
|
6812
|
+
*/
|
|
6813
|
+
function getSelectedParagraphs(model: ReadonlyContentModelDocument, mutate: true): ShallowMutableContentModelParagraph[];
|
|
6814
|
+
|
|
6815
|
+
/**
|
|
6816
|
+
* Get any array of selected paragraphs from a content model (Readonly)
|
|
6817
|
+
* @param model The Content Model to get selection from
|
|
6818
|
+
*/
|
|
6819
|
+
function getSelectedParagraphs(model: ReadonlyContentModelDocument): ReadonlyContentModelParagraph[];
|
|
6820
|
+
|
|
6127
6821
|
/**
|
|
6128
6822
|
* Get an array of selected segments from a content model
|
|
6129
6823
|
* @param model The Content Model to get selection from
|
|
@@ -6131,36 +6825,77 @@ function getSelectedParagraphs(model: ContentModelDocument): ContentModelParagra
|
|
|
6131
6825
|
*/
|
|
6132
6826
|
function getSelectedSegments(model: ContentModelDocument, includingFormatHolder: boolean): ContentModelSegment[];
|
|
6133
6827
|
|
|
6828
|
+
/**
|
|
6829
|
+
* Get an array of selected segments from a content model, return mutable segments
|
|
6830
|
+
* @param model The Content Model to get selection from
|
|
6831
|
+
* @param includingFormatHolder True means also include format holder as segment from list item
|
|
6832
|
+
* @param mutate Set to true to indicate we will mutate the selected paragraphs
|
|
6833
|
+
*/
|
|
6834
|
+
function getSelectedSegments(model: ReadonlyContentModelDocument, includingFormatHolder: boolean, mutate: true): ShallowMutableContentModelSegment[];
|
|
6835
|
+
|
|
6836
|
+
/**
|
|
6837
|
+
* Get an array of selected segments from a content model (Readonly)
|
|
6838
|
+
* @param model The Content Model to get selection from
|
|
6839
|
+
* @param includingFormatHolder True means also include format holder as segment from list item
|
|
6840
|
+
*/
|
|
6841
|
+
function getSelectedSegments(model: ReadonlyContentModelDocument, includingFormatHolder: boolean): ReadonlyContentModelSegment[];
|
|
6842
|
+
|
|
6134
6843
|
/**
|
|
6135
6844
|
* Get an array of selected parent paragraph and child segment pair
|
|
6136
6845
|
* @param model The Content Model to get selection from
|
|
6137
6846
|
* @param includingFormatHolder True means also include format holder as segment from list item, in that case paragraph will be null
|
|
6847
|
+
* @param includingEntity True to include entity in result as well
|
|
6138
6848
|
*/
|
|
6139
6849
|
function getSelectedSegmentsAndParagraphs(model: ContentModelDocument, includingFormatHolder: boolean, includingEntity?: boolean): [ContentModelSegment, ContentModelParagraph | null, ContentModelBlockGroup[]][];
|
|
6140
6850
|
|
|
6851
|
+
/**
|
|
6852
|
+
* Get an array of selected parent paragraph and child segment pair, return mutable paragraph and segments
|
|
6853
|
+
* @param model The Content Model to get selection from
|
|
6854
|
+
* @param includingFormatHolder True means also include format holder as segment from list item, in that case paragraph will be null
|
|
6855
|
+
* @param includingEntity True to include entity in result as well
|
|
6856
|
+
* @param mutate Set to true to indicate we will mutate the selected paragraphs
|
|
6857
|
+
*/
|
|
6858
|
+
function getSelectedSegmentsAndParagraphs(model: ReadonlyContentModelDocument, includingFormatHolder: boolean, includingEntity: boolean, mutate: true): [
|
|
6859
|
+
ShallowMutableContentModelSegment,
|
|
6860
|
+
ContentModelParagraph | null,
|
|
6861
|
+
ReadonlyContentModelBlockGroup[]
|
|
6862
|
+
][];
|
|
6863
|
+
|
|
6864
|
+
/**
|
|
6865
|
+
* Get an array of selected parent paragraph and child segment pair (Readonly)
|
|
6866
|
+
* @param model The Content Model to get selection from
|
|
6867
|
+
* @param includingFormatHolder True means also include format holder as segment from list item, in that case paragraph will be null
|
|
6868
|
+
* @param includingEntity True to include entity in result as well
|
|
6869
|
+
*/
|
|
6870
|
+
function getSelectedSegmentsAndParagraphs(model: ReadonlyContentModelDocument, includingFormatHolder: boolean, includingEntity?: boolean): [
|
|
6871
|
+
ReadonlyContentModelSegment,
|
|
6872
|
+
ReadonlyContentModelParagraph | null,
|
|
6873
|
+
ReadonlyContentModelBlockGroup[]
|
|
6874
|
+
][];
|
|
6875
|
+
|
|
6141
6876
|
/**
|
|
6142
6877
|
* Get selection coordinates of a table. If there is no selection, return null
|
|
6143
6878
|
* @param table The table model to get selection from
|
|
6144
6879
|
*/
|
|
6145
|
-
function getSelectedCells(table:
|
|
6880
|
+
function getSelectedCells(table: ReadonlyContentModelTable): TableSelectionCoordinates | null;
|
|
6146
6881
|
|
|
6147
6882
|
/**
|
|
6148
6883
|
* Check if there is selection within the given block
|
|
6149
6884
|
* @param block The block to check
|
|
6150
6885
|
*/
|
|
6151
|
-
function hasSelectionInBlock(block:
|
|
6886
|
+
function hasSelectionInBlock(block: ReadonlyContentModelBlock): boolean;
|
|
6152
6887
|
|
|
6153
6888
|
/**
|
|
6154
6889
|
* Check if there is selection within the given segment
|
|
6155
6890
|
* @param segment The segment to check
|
|
6156
6891
|
*/
|
|
6157
|
-
function hasSelectionInSegment(segment:
|
|
6892
|
+
function hasSelectionInSegment(segment: ReadonlyContentModelSegment): boolean;
|
|
6158
6893
|
|
|
6159
6894
|
/**
|
|
6160
6895
|
* Check if there is selection within the given block
|
|
6161
6896
|
* @param block The block to check
|
|
6162
6897
|
*/
|
|
6163
|
-
function hasSelectionInBlockGroup(group:
|
|
6898
|
+
function hasSelectionInBlockGroup(group: ReadonlyContentModelBlockGroup): boolean;
|
|
6164
6899
|
|
|
6165
6900
|
/**
|
|
6166
6901
|
* Set selection into Content Model. If the Content Model already has selection, existing selection will be overwritten by the new one.
|
|
@@ -6168,14 +6903,14 @@ function hasSelectionInBlockGroup(group: ContentModelBlockGroup): boolean;
|
|
|
6168
6903
|
* @param start The start selected element. If not passed, existing selection of content model will be cleared
|
|
6169
6904
|
* @param end The end selected element. If not passed, only the start element will be selected. If passed, all elements between start and end elements will be selected
|
|
6170
6905
|
*/
|
|
6171
|
-
function setSelection(group:
|
|
6906
|
+
function setSelection(group: ReadonlyContentModelBlockGroup, start?: ReadonlySelectable, end?: ReadonlySelectable): void;
|
|
6172
6907
|
|
|
6173
6908
|
/**
|
|
6174
6909
|
* Clone a content model
|
|
6175
6910
|
* @param model The content model to clone
|
|
6176
6911
|
* @param options @optional Options to specify customize the clone behavior
|
|
6177
6912
|
*/
|
|
6178
|
-
function cloneModel(model:
|
|
6913
|
+
function cloneModel(model: ReadonlyContentModelDocument, options?: CloneModelOptions): ContentModelDocument;
|
|
6179
6914
|
|
|
6180
6915
|
/**
|
|
6181
6916
|
* Merge source model into target mode
|
|
@@ -6185,7 +6920,7 @@ function cloneModel(model: ContentModelDocument, options?: CloneModelOptions): C
|
|
|
6185
6920
|
* @param options More options, see MergeModelOption
|
|
6186
6921
|
* @returns Insert point after merge, or null if there is no insert point
|
|
6187
6922
|
*/
|
|
6188
|
-
function mergeModel(target:
|
|
6923
|
+
function mergeModel(target: ReadonlyContentModelDocument, source: ContentModelDocument, context?: FormatContentModelContext, options?: MergeModelOption): InsertPoint | null;
|
|
6189
6924
|
|
|
6190
6925
|
/**
|
|
6191
6926
|
* Delete selected content from Content Model
|
|
@@ -6194,17 +6929,17 @@ function mergeModel(target: ContentModelDocument, source: ContentModelDocument,
|
|
|
6194
6929
|
* @param formatContext @optional A context object provided by formatContentModel API
|
|
6195
6930
|
* @returns A DeleteSelectionResult object to specify the deletion result
|
|
6196
6931
|
*/
|
|
6197
|
-
function deleteSelection(model:
|
|
6932
|
+
function deleteSelection(model: ReadonlyContentModelDocument, additionalSteps?: (DeleteSelectionStep | null)[], formatContext?: FormatContentModelContext): DeleteSelectionResult;
|
|
6198
6933
|
|
|
6199
6934
|
/**
|
|
6200
6935
|
* Delete a content model segment from current selection
|
|
6201
|
-
* @param
|
|
6202
|
-
* @param
|
|
6936
|
+
* @param readonlyParagraph Parent paragraph of the segment to delete
|
|
6937
|
+
* @param readonlySegmentToDelete The segment to delete
|
|
6203
6938
|
* @param context @optional Context object provided by formatContentModel API
|
|
6204
6939
|
* @param direction @optional Whether this is deleting forward or backward. This is only used for deleting entity.
|
|
6205
6940
|
* If not specified, only selected entity will be deleted
|
|
6206
6941
|
*/
|
|
6207
|
-
function deleteSegment(
|
|
6942
|
+
function deleteSegment(readonlyParagraph: ReadonlyContentModelParagraph, readonlySegmentToDelete: ReadonlyContentModelSegment, context?: FormatContentModelContext, direction?: 'forward' | 'backward'): boolean;
|
|
6208
6943
|
|
|
6209
6944
|
/**
|
|
6210
6945
|
* Delete a content model block from current selection
|
|
@@ -6215,7 +6950,7 @@ function deleteSegment(paragraph: ContentModelParagraph, segmentToDelete: Conten
|
|
|
6215
6950
|
* @param direction @optional Whether this is deleting forward or backward. This is only used for deleting entity.
|
|
6216
6951
|
* If not specified, only selected entity will be deleted
|
|
6217
6952
|
*/
|
|
6218
|
-
function deleteBlock(blocks:
|
|
6953
|
+
function deleteBlock(blocks: ReadonlyContentModelBlock[], blockToDelete: ReadonlyContentModelBlock, replacement?: ReadonlyContentModelBlock, context?: FormatContentModelContext, direction?: 'forward' | 'backward'): boolean;
|
|
6219
6954
|
|
|
6220
6955
|
/**
|
|
6221
6956
|
* Apply table format from table metadata and the passed in new format
|
|
@@ -6223,20 +6958,27 @@ function deleteBlock(blocks: ContentModelBlock[], blockToDelete: ContentModelBlo
|
|
|
6223
6958
|
* @param newFormat @optional New format to apply. When passed, this value will be merged into existing metadata format and default format
|
|
6224
6959
|
* @param keepCellShade @optional When pass true, table cells with customized shade color will not be overwritten. @default false
|
|
6225
6960
|
*/
|
|
6226
|
-
function applyTableFormat(table:
|
|
6961
|
+
function applyTableFormat(table: ReadonlyContentModelTable, newFormat?: TableMetadataFormat, keepCellShade?: boolean): void;
|
|
6962
|
+
|
|
6963
|
+
/**
|
|
6964
|
+
* Set the first column format borders for the table as well as header property
|
|
6965
|
+
* @param rows The rows of the table
|
|
6966
|
+
* @param format The table metadata format
|
|
6967
|
+
*/
|
|
6968
|
+
function setFirstColumnFormatBorders(rows: ShallowMutableContentModelTableRow[], format: Partial<TableMetadataFormat>): void;
|
|
6227
6969
|
|
|
6228
6970
|
/**
|
|
6229
6971
|
* Normalize a Content Model table, make sure:
|
|
6230
6972
|
* 1. Fist cells are not spanned
|
|
6231
|
-
* 2.
|
|
6973
|
+
* 2. Only first column and row can have headers
|
|
6232
6974
|
* 3. All cells have content and width
|
|
6233
6975
|
* 4. Table and table row have correct width/height
|
|
6234
6976
|
* 5. Spanned cell has no child blocks
|
|
6235
6977
|
* 6. default format is correctly applied
|
|
6236
|
-
* @param
|
|
6978
|
+
* @param readonlyTable The table to normalize
|
|
6237
6979
|
* @param defaultSegmentFormat @optional Default segment format to apply to cell
|
|
6238
6980
|
*/
|
|
6239
|
-
function normalizeTable(
|
|
6981
|
+
function normalizeTable(readonlyTable: ReadonlyContentModelTable, defaultSegmentFormat?: ContentModelSegmentFormat): void;
|
|
6240
6982
|
|
|
6241
6983
|
/**
|
|
6242
6984
|
* Minimum width for a table cell
|
|
@@ -6250,7 +6992,7 @@ const MIN_ALLOWED_TABLE_CELL_WIDTH: number;
|
|
|
6250
6992
|
* @param isColorOverride @optional When pass true, it means this shade color is not part of table format, so it can be preserved when apply table format
|
|
6251
6993
|
* @param applyToSegments @optional When pass true, we will also apply text color from table cell to its child blocks and segments
|
|
6252
6994
|
*/
|
|
6253
|
-
function setTableCellBackgroundColor(cell:
|
|
6995
|
+
function setTableCellBackgroundColor(cell: ShallowMutableContentModelTableCell, color: string | null | undefined, isColorOverride?: boolean, applyToSegments?: boolean): void;
|
|
6254
6996
|
|
|
6255
6997
|
/**
|
|
6256
6998
|
* Retrieve format state from the given Content Model
|
|
@@ -6258,7 +7000,7 @@ function setTableCellBackgroundColor(cell: ContentModelTableCell, color: string
|
|
|
6258
7000
|
* @param pendingFormat Existing pending format, if any
|
|
6259
7001
|
* @param formatState Existing format state object, used for receiving the result
|
|
6260
7002
|
*/
|
|
6261
|
-
function retrieveModelFormatState(model:
|
|
7003
|
+
function retrieveModelFormatState(model: ReadonlyContentModelDocument, pendingFormat: ContentModelSegmentFormat | null, formatState: ContentModelFormatState): void;
|
|
6262
7004
|
|
|
6263
7005
|
/**
|
|
6264
7006
|
* Gets the list style type that the bullet is part of, using the Constant record
|
|
@@ -6273,7 +7015,7 @@ function getListStyleTypeFromString(listType: 'OL' | 'UL', bullet: string): numb
|
|
|
6273
7015
|
* @param segment The segment to get format from
|
|
6274
7016
|
* @returns
|
|
6275
7017
|
*/
|
|
6276
|
-
function getSegmentTextFormat(segment:
|
|
7018
|
+
function getSegmentTextFormat(segment: ReadonlyContentModelSegment): ContentModelSegmentFormat;
|
|
6277
7019
|
|
|
6278
7020
|
/**
|
|
6279
7021
|
* Update image metadata with a callback
|
|
@@ -6282,26 +7024,50 @@ function getSegmentTextFormat(segment: ContentModelSegment): ContentModelSegment
|
|
|
6282
7024
|
*/
|
|
6283
7025
|
function updateImageMetadata(image: ContentModelImage, callback?: (format: ImageMetadataFormat | null) => ImageMetadataFormat | null): ImageMetadataFormat | null;
|
|
6284
7026
|
|
|
7027
|
+
/**
|
|
7028
|
+
* Get image metadata
|
|
7029
|
+
* @param image The image Content Model
|
|
7030
|
+
*/
|
|
7031
|
+
function getImageMetadata(image: ReadonlyContentModelImage): ImageMetadataFormat | null;
|
|
7032
|
+
|
|
6285
7033
|
/**
|
|
6286
7034
|
* Update table cell metadata with a callback
|
|
6287
7035
|
* @param cell The table cell Content Model
|
|
6288
7036
|
* @param callback The callback function used for updating metadata
|
|
6289
7037
|
*/
|
|
6290
|
-
function updateTableCellMetadata(cell:
|
|
7038
|
+
function updateTableCellMetadata(cell: ShallowMutableContentModelTableCell, callback?: (format: TableCellMetadataFormat | null) => TableCellMetadataFormat | null): TableCellMetadataFormat | null;
|
|
7039
|
+
|
|
7040
|
+
/**
|
|
7041
|
+
* Get table cell metadata
|
|
7042
|
+
* @param cell The table cell Content Model
|
|
7043
|
+
*/
|
|
7044
|
+
function getTableCellMetadata(cell: ReadonlyContentModelTableCell): TableCellMetadataFormat | null;
|
|
6291
7045
|
|
|
6292
7046
|
/**
|
|
6293
7047
|
* Update table metadata with a callback
|
|
6294
7048
|
* @param table The table Content Model
|
|
6295
7049
|
* @param callback The callback function used for updating metadata
|
|
6296
7050
|
*/
|
|
6297
|
-
function updateTableMetadata(table:
|
|
7051
|
+
function updateTableMetadata(table: ShallowMutableContentModelTable, callback?: (format: TableMetadataFormat | null) => TableMetadataFormat | null): TableMetadataFormat | null;
|
|
7052
|
+
|
|
7053
|
+
/**
|
|
7054
|
+
* Get table metadata
|
|
7055
|
+
* @param table The table Content Model
|
|
7056
|
+
*/
|
|
7057
|
+
function getTableMetadata(table: ReadonlyContentModelTable): TableMetadataFormat | null;
|
|
6298
7058
|
|
|
6299
7059
|
/**
|
|
6300
7060
|
* Update list metadata with a callback
|
|
6301
7061
|
* @param list The list Content Model (metadata holder)
|
|
6302
7062
|
* @param callback The callback function used for updating metadata
|
|
6303
7063
|
*/
|
|
6304
|
-
function updateListMetadata(list:
|
|
7064
|
+
function updateListMetadata(list: ShallowMutableContentModelWithDataset<ListMetadataFormat>, callback?: (format: ListMetadataFormat | null) => ListMetadataFormat | null): ListMetadataFormat | null;
|
|
7065
|
+
|
|
7066
|
+
/**
|
|
7067
|
+
* Get list metadata
|
|
7068
|
+
* @param list The list Content Model (metadata holder)
|
|
7069
|
+
*/
|
|
7070
|
+
function getListMetadata(list: ReadonlyContentModelWithDataset<ListMetadataFormat>): ListMetadataFormat | null;
|
|
6305
7071
|
|
|
6306
7072
|
/**
|
|
6307
7073
|
* Metadata definition for List
|
|
@@ -7267,19 +8033,26 @@ function setModelListStyle(model: ContentModelDocument, style: ListMetadataForma
|
|
|
7267
8033
|
function setModelListStartNumber(model: ContentModelDocument, value: number): boolean;
|
|
7268
8034
|
|
|
7269
8035
|
/**
|
|
8036
|
+
* Search for all list items in the same thread as the current list item
|
|
7270
8037
|
* @param model The content model
|
|
7271
8038
|
* @param currentItem The current list item
|
|
7272
|
-
* Search for all list items in the same thread as the current list item
|
|
7273
8039
|
*/
|
|
7274
8040
|
function findListItemsInSameThread(group: ContentModelBlockGroup, currentItem: ContentModelListItem): ContentModelListItem[];
|
|
7275
8041
|
|
|
8042
|
+
/**
|
|
8043
|
+
* Search for all list items in the same thread as the current list item (Readonly)
|
|
8044
|
+
* @param model The content model
|
|
8045
|
+
* @param currentItem The current list item
|
|
8046
|
+
*/
|
|
8047
|
+
function findListItemsInSameThread(group: ReadonlyContentModelBlockGroup, currentItem: ReadonlyContentModelListItem): ReadonlyContentModelListItem[];
|
|
8048
|
+
|
|
7276
8049
|
/**
|
|
7277
8050
|
* @param model The content model to set indentation
|
|
7278
8051
|
* @param indentation The indentation type, 'indent' to indent, 'outdent' to outdent
|
|
7279
8052
|
* @param length The length of indentation in pixel, default value is 40
|
|
7280
8053
|
* Set indentation for selected list items or paragraphs
|
|
7281
8054
|
*/
|
|
7282
|
-
function setModelIndentation(model:
|
|
8055
|
+
function setModelIndentation(model: ReadonlyContentModelDocument, indentation: 'indent' | 'outdent', length?: number, context?: FormatContentModelContext): boolean;
|
|
7283
8056
|
|
|
7284
8057
|
/**
|
|
7285
8058
|
* Try to match a given string with link match rules, return matched link
|
|
@@ -7298,7 +8071,7 @@ function matchLink(url: string): LinkData | null;
|
|
|
7298
8071
|
* @param path Content model path that include the list item
|
|
7299
8072
|
* @returns Announce data of current list item if any, or null
|
|
7300
8073
|
*/
|
|
7301
|
-
function getListAnnounceData(path:
|
|
8074
|
+
function getListAnnounceData(path: ReadonlyContentModelBlockGroup[]): AnnounceData | null;
|
|
7302
8075
|
|
|
7303
8076
|
/**
|
|
7304
8077
|
* TableEdit plugin, provides the ability to resize a table by drag-and-drop
|
|
@@ -7414,6 +8187,7 @@ class EditPlugin implements EditorPlugin {
|
|
|
7414
8187
|
private editor;
|
|
7415
8188
|
private disposer;
|
|
7416
8189
|
private shouldHandleNextInputEvent;
|
|
8190
|
+
private selectionAfterDelete;
|
|
7417
8191
|
/**
|
|
7418
8192
|
* Get name of this plugin
|
|
7419
8193
|
*/
|