@worktile/theia 2.3.3 → 2.4.2
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/bundles/worktile-theia.umd.js +1087 -997
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/components/column-resize/column-resize.directive.d.ts +2 -2
- package/components/column-resize/column-resize.scss +6 -0
- package/components/column-resize/event-dispatcher.d.ts +7 -1
- package/components/column-resize/resize-ref.d.ts +3 -0
- package/constants/auto-format-rules.d.ts +1 -1
- package/constants/default.d.ts +0 -1
- package/custom-types.d.ts +2 -1
- package/editor.module.d.ts +45 -43
- package/esm2015/components/column-resize/column-resize.directive.js +26 -33
- package/esm2015/components/column-resize/event-dispatcher.js +8 -1
- package/esm2015/components/column-resize/overlay-handle.component.js +3 -3
- package/esm2015/components/column-resize/resize-ref.js +4 -1
- package/esm2015/constants/auto-format-rules.js +3 -2
- package/esm2015/constants/default.js +1 -1
- package/esm2015/custom-types.js +1 -1
- package/esm2015/editor.component.js +3 -2
- package/esm2015/editor.module.js +7 -6
- package/esm2015/interfaces/auto-format.js +1 -1
- package/esm2015/interfaces/editor.js +1 -1
- package/esm2015/plugins/autoformat/autoformat.plugin.js +23 -6
- package/esm2015/plugins/index.js +2 -3
- package/esm2015/plugins/inline-code/inline-code.component.js +7 -7
- package/esm2015/plugins/link/link.component.js +11 -24
- package/esm2015/plugins/link/link.plugin.js +3 -4
- package/esm2015/plugins/table/components/insert-mark/insert-mark.component.js +7 -2
- package/esm2015/plugins/table/components/table.component.js +10 -4
- package/esm2015/plugins/table/components/td/td.component.js +59 -37
- package/esm2015/plugins/table/components/toolbar/table-options.component.js +90 -0
- package/esm2015/plugins/table/components/toolbar/table-toolbar.component.js +26 -7
- package/esm2015/plugins/table/table.service.js +2 -2
- package/esm2015/plugins/table/table.store.js +13 -3
- package/esm2015/plugins/table/table.types.js +1 -1
- package/esm2015/plugins/todo-item/todo-item.component.js +3 -3
- package/esm2015/services/table-contextmenu.service.js +1 -1
- package/esm2015/utils/dom.js +2 -42
- package/fesm2015/worktile-theia.js +1039 -927
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/auto-format.d.ts +1 -0
- package/interfaces/editor.d.ts +3 -0
- package/package.json +1 -1
- package/plugins/autoformat/autoformat.plugin.d.ts +1 -2
- package/plugins/link/link.component.d.ts +2 -8
- package/plugins/link/link.component.scss +0 -2
- package/plugins/table/components/table.component.scss +142 -105
- package/plugins/table/components/td/td.component.d.ts +3 -2
- package/plugins/table/components/toolbar/table-options.component.d.ts +20 -0
- package/plugins/table/components/toolbar/table-toolbar.component.d.ts +4 -2
- package/plugins/table/table.store.d.ts +3 -1
- package/plugins/table/table.types.d.ts +10 -0
- package/styles/editor.scss +6 -1
- package/utils/dom.d.ts +1 -5
|
@@ -2,33 +2,33 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { InjectionToken, Component, ChangeDetectionStrategy, HostBinding, Input, HostListener, ViewContainerRef, ChangeDetectorRef, Injectable, Inject, ViewChild, Directive, ElementRef, TemplateRef, Pipe, EventEmitter, forwardRef, Output, NgModule } from '@angular/core';
|
|
3
3
|
import * as i10 from '@angular/common';
|
|
4
4
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
5
|
-
import * as i4
|
|
5
|
+
import * as i4 from '@angular/forms';
|
|
6
6
|
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
7
7
|
import * as i1 from 'slate-angular';
|
|
8
|
-
import { BaseTextComponent, BaseElementComponent, AngularEditor, NODE_TO_PARENT, NODE_TO_INDEX,
|
|
8
|
+
import { BaseTextComponent, BaseElementComponent, AngularEditor, NODE_TO_PARENT, NODE_TO_INDEX, IS_SAFARI, hotkeys, getPlainText as getPlainText$1, hasBlockCard, isCardLeft, FAKE_RIGHT_BLOCK_CARD_OFFSET, ELEMENT_TO_COMPONENT, EDITOR_TO_ELEMENT, isComponentType, withAngular, SlateModule } from 'slate-angular';
|
|
9
9
|
import { mixinUnsubscribe, MixinBase } from 'ngx-tethys/core';
|
|
10
10
|
import isHotkey, { isKeyHotkey } from 'is-hotkey';
|
|
11
|
-
import { Element as Element$1,
|
|
11
|
+
import { Transforms, Text, Range, Editor, Element as Element$1, Node, Span, Path, Point, Operation, createEditor } from 'slate';
|
|
12
12
|
import { HistoryEditor, withHistory } from 'slate-history';
|
|
13
|
-
import { __rest, __awaiter } from 'tslib';
|
|
14
|
-
import * as _lodash from 'lodash';
|
|
15
13
|
import marked from 'marked';
|
|
16
14
|
import { TheiaConverter } from '@atinc/selene';
|
|
17
15
|
import * as i1$3 from 'ngx-tethys/popover';
|
|
18
16
|
import { ThyPopover } from 'ngx-tethys/popover';
|
|
17
|
+
import { __rest, __awaiter } from 'tslib';
|
|
18
|
+
import * as _lodash from 'lodash';
|
|
19
19
|
import * as i2 from '@angular/cdk/overlay';
|
|
20
20
|
import { Overlay, OverlayModule } from '@angular/cdk/overlay';
|
|
21
21
|
import * as i1$1 from 'ngx-tethys/alert';
|
|
22
22
|
import { ThyAlertModule } from 'ngx-tethys/alert';
|
|
23
|
-
import { map, takeUntil, take, delay, startWith, distinctUntilChanged, skip, share, filter,
|
|
23
|
+
import { map, takeUntil, take, delay, startWith, distinctUntilChanged, skip, share, filter, mapTo, debounceTime, pairwise } from 'rxjs/operators';
|
|
24
24
|
import { ThyUploadStatus } from 'ngx-tethys/uploader';
|
|
25
25
|
import { fromEvent, timer, Subject, combineLatest, Observable, BehaviorSubject, merge, ReplaySubject } from 'rxjs';
|
|
26
26
|
import * as i1$2 from '@angular/platform-browser';
|
|
27
27
|
import * as i6 from 'ngx-tethys/progress';
|
|
28
28
|
import { ThyProgressModule } from 'ngx-tethys/progress';
|
|
29
|
-
import * as
|
|
29
|
+
import * as i3 from 'ngx-tethys/icon';
|
|
30
30
|
import { ThyIconModule } from 'ngx-tethys/icon';
|
|
31
|
-
import * as i3 from 'ngx-tethys/nav';
|
|
31
|
+
import * as i3$1 from 'ngx-tethys/nav';
|
|
32
32
|
import { ThyNavModule } from 'ngx-tethys/nav';
|
|
33
33
|
import * as i5 from 'ngx-tethys/tooltip';
|
|
34
34
|
import { ThyTooltipModule } from 'ngx-tethys/tooltip';
|
|
@@ -38,7 +38,7 @@ import * as i8 from 'ng-codemirror';
|
|
|
38
38
|
import { CodeMirrorComponent, CodemirrorModule } from 'ng-codemirror';
|
|
39
39
|
import * as i1$4 from 'ngx-tethys/notify';
|
|
40
40
|
import { ThyNotifyModule } from 'ngx-tethys/notify';
|
|
41
|
-
import * as
|
|
41
|
+
import * as i2$1 from 'ngx-tethys/action-menu';
|
|
42
42
|
import { ThyActionMenuModule } from 'ngx-tethys/action-menu';
|
|
43
43
|
import * as i6$1 from 'ngx-tethys/switch';
|
|
44
44
|
import { ThySwitchModule } from 'ngx-tethys/switch';
|
|
@@ -47,14 +47,14 @@ import { ThyResizableModule } from 'ngx-tethys/resizable';
|
|
|
47
47
|
import isUrl from 'is-url';
|
|
48
48
|
import * as i1$5 from 'ngx-tethys/button';
|
|
49
49
|
import { ThyButtonModule } from 'ngx-tethys/button';
|
|
50
|
-
import * as i2$
|
|
50
|
+
import * as i2$2 from 'ngx-tethys/form';
|
|
51
51
|
import { ThyFormModule } from 'ngx-tethys/form';
|
|
52
|
-
import * as i5$
|
|
52
|
+
import * as i5$2 from 'ngx-tethys/shared';
|
|
53
53
|
import { ThySharedModule } from 'ngx-tethys/shared';
|
|
54
54
|
import * as i1$6 from 'ngx-tethys';
|
|
55
55
|
import { coerceCssPixelValue } from '@angular/cdk/coercion';
|
|
56
56
|
import { PortalInjector, ComponentPortal } from '@angular/cdk/portal';
|
|
57
|
-
import * as i2$
|
|
57
|
+
import * as i2$3 from 'ngx-tethys/list';
|
|
58
58
|
import { ThyListModule } from 'ngx-tethys/list';
|
|
59
59
|
import { ThyAutocompleteModule } from 'ngx-tethys/autocomplete';
|
|
60
60
|
import { ThyAvatarModule } from 'ngx-tethys/avatar';
|
|
@@ -522,6 +522,61 @@ function idCreator(length = 5) {
|
|
|
522
522
|
return key;
|
|
523
523
|
}
|
|
524
524
|
|
|
525
|
+
const UNDOING = new WeakMap();
|
|
526
|
+
const REDOING = new WeakMap();
|
|
527
|
+
const withTheHistory = (editor) => {
|
|
528
|
+
const { undo, redo } = editor;
|
|
529
|
+
editor.undo = () => {
|
|
530
|
+
UNDOING.set(editor, true);
|
|
531
|
+
undo();
|
|
532
|
+
UNDOING.set(editor, false);
|
|
533
|
+
};
|
|
534
|
+
editor.redo = () => {
|
|
535
|
+
REDOING.set(editor, true);
|
|
536
|
+
redo();
|
|
537
|
+
REDOING.set(editor, false);
|
|
538
|
+
};
|
|
539
|
+
return editor;
|
|
540
|
+
};
|
|
541
|
+
const TheHistoryEditor = {
|
|
542
|
+
isUndoing(editor) {
|
|
543
|
+
return UNDOING.get(editor);
|
|
544
|
+
},
|
|
545
|
+
isRedoing(editor) {
|
|
546
|
+
return REDOING.get(editor);
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
const setMarks = (editor, marks, at) => {
|
|
551
|
+
Transforms.setNodes(editor, marks, {
|
|
552
|
+
at,
|
|
553
|
+
match: Text.isText,
|
|
554
|
+
split: true
|
|
555
|
+
});
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
const clearMarks = (editor) => {
|
|
559
|
+
const { selection } = editor;
|
|
560
|
+
if (!selection) {
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
if (Range.isCollapsed(selection)) {
|
|
564
|
+
const marks = Editor.marks(editor);
|
|
565
|
+
for (const key in marks) {
|
|
566
|
+
Editor.removeMark(editor, key);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
else {
|
|
570
|
+
const unsetMarks = {};
|
|
571
|
+
MarkProps.forEach(key => {
|
|
572
|
+
unsetMarks[key] = null;
|
|
573
|
+
});
|
|
574
|
+
setMarks(editor, unsetMarks);
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
const insertElement = (editor, element) => editor.insertElement(element);
|
|
579
|
+
|
|
525
580
|
const isAncestor = (node) => Element$1.isElement(node) || Editor.isEditor(node);
|
|
526
581
|
|
|
527
582
|
const getLastChild$1 = (node, level) => {
|
|
@@ -1321,36 +1376,6 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1321
1376
|
someNode: someNode
|
|
1322
1377
|
});
|
|
1323
1378
|
|
|
1324
|
-
const setMarks = (editor, marks, at) => {
|
|
1325
|
-
Transforms.setNodes(editor, marks, {
|
|
1326
|
-
at,
|
|
1327
|
-
match: Text.isText,
|
|
1328
|
-
split: true
|
|
1329
|
-
});
|
|
1330
|
-
};
|
|
1331
|
-
|
|
1332
|
-
const clearMarks = (editor) => {
|
|
1333
|
-
const { selection } = editor;
|
|
1334
|
-
if (!selection) {
|
|
1335
|
-
return;
|
|
1336
|
-
}
|
|
1337
|
-
if (Range.isCollapsed(selection)) {
|
|
1338
|
-
const marks = Editor.marks(editor);
|
|
1339
|
-
for (const key in marks) {
|
|
1340
|
-
Editor.removeMark(editor, key);
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
else {
|
|
1344
|
-
const unsetMarks = {};
|
|
1345
|
-
MarkProps.forEach(key => {
|
|
1346
|
-
unsetMarks[key] = null;
|
|
1347
|
-
});
|
|
1348
|
-
setMarks(editor, unsetMarks);
|
|
1349
|
-
}
|
|
1350
|
-
};
|
|
1351
|
-
|
|
1352
|
-
const insertElement = (editor, element) => editor.insertElement(element);
|
|
1353
|
-
|
|
1354
1379
|
const insertElementNext = (editor, node) => {
|
|
1355
1380
|
if (Range.isExpanded(editor.selection)) {
|
|
1356
1381
|
Editor.deleteFragment(editor);
|
|
@@ -1586,673 +1611,214 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
1586
1611
|
handleContinualInsertBreak: handleContinualInsertBreak
|
|
1587
1612
|
});
|
|
1588
1613
|
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
const ListEditor = {
|
|
1594
|
-
isList(editor, element, type) {
|
|
1595
|
-
return Editor.isBlock(editor, element) && element.type === type;
|
|
1596
|
-
},
|
|
1597
|
-
toggleList(editor, type, startIndex) {
|
|
1598
|
-
if (!editor.selection) {
|
|
1599
|
-
return;
|
|
1600
|
-
}
|
|
1601
|
-
if (!startIndex) {
|
|
1602
|
-
startIndex = 1;
|
|
1603
|
-
}
|
|
1604
|
-
const types = [ElementKinds.bulletedList, ElementKinds.numberedList];
|
|
1605
|
-
Editor.withoutNormalizing(editor, () => {
|
|
1606
|
-
const [...listItems] = Editor.nodes(editor, {
|
|
1607
|
-
match: node => Element$1.isElement(node) && node.type === ElementKinds.listItem,
|
|
1608
|
-
mode: 'lowest'
|
|
1609
|
-
});
|
|
1610
|
-
const firstListItemPath = listItems.length && listItems[0][1];
|
|
1611
|
-
const activeListPath = listItems.length && Path.parent(firstListItemPath);
|
|
1612
|
-
const activeListNode = listItems.length && Node.get(editor, activeListPath);
|
|
1613
|
-
// 同级且类型相同:unwrap
|
|
1614
|
-
const isLowestActive = listItems.length &&
|
|
1615
|
-
listItems.every(([, path]) => activeListNode.type === type && (Path.isSibling(firstListItemPath, path) || Path.equals(firstListItemPath, path)));
|
|
1616
|
-
if (isLowestActive) {
|
|
1617
|
-
const upListItem = Path.parent(activeListPath);
|
|
1618
|
-
Transforms.unwrapNodes(editor, {
|
|
1619
|
-
at: editor.selection,
|
|
1620
|
-
match: node => node === activeListNode,
|
|
1621
|
-
split: true,
|
|
1622
|
-
mode: 'lowest'
|
|
1623
|
-
});
|
|
1624
|
-
if (upListItem && Node.get(editor, upListItem).type === ElementKinds.listItem) {
|
|
1625
|
-
Transforms.moveNodes(editor, {
|
|
1626
|
-
at: editor.selection,
|
|
1627
|
-
to: Path.next(upListItem),
|
|
1628
|
-
match: node => Element$1.isElement(node) && node.type === ElementKinds.listItem
|
|
1629
|
-
});
|
|
1630
|
-
}
|
|
1631
|
-
else {
|
|
1632
|
-
Transforms.unwrapNodes(editor, {
|
|
1633
|
-
match: node => Element$1.isElement(node) && node.type === ElementKinds.listItem
|
|
1634
|
-
});
|
|
1635
|
-
}
|
|
1636
|
-
return;
|
|
1637
|
-
}
|
|
1638
|
-
// 跨级、同级且类型不同
|
|
1639
|
-
if (activeListNode && types.includes(activeListNode.type)) {
|
|
1640
|
-
Transforms.setNodes(editor, { type }, { match: node => Element$1.isElement(node) && node.type !== type && types.includes(node.type) });
|
|
1641
|
-
return;
|
|
1642
|
-
}
|
|
1643
|
-
// wrap
|
|
1644
|
-
this.buildListItem(editor);
|
|
1645
|
-
// Todo: types
|
|
1646
|
-
Transforms.wrapNodes(editor, { type, children: [], start: startIndex }, {
|
|
1647
|
-
at: editor.selection,
|
|
1648
|
-
match: node => Element$1.isElement(node) && node.type === ElementKinds.listItem
|
|
1649
|
-
});
|
|
1650
|
-
});
|
|
1651
|
-
},
|
|
1652
|
-
unwrapList(editor) {
|
|
1653
|
-
Editor.withoutNormalizing(editor, () => {
|
|
1654
|
-
unwrapNodesByType(editor, [ElementKinds.bulletedList, ElementKinds.numberedList], { split: true, mode: 'all' });
|
|
1655
|
-
unwrapNodesByType(editor, [ElementKinds.listItem], { split: true, mode: 'all' });
|
|
1656
|
-
});
|
|
1657
|
-
},
|
|
1658
|
-
wrapList(editor, type) {
|
|
1659
|
-
Editor.withoutNormalizing(editor, () => {
|
|
1660
|
-
const listItem = {
|
|
1661
|
-
type: ElementKinds.listItem,
|
|
1662
|
-
children: []
|
|
1663
|
-
};
|
|
1664
|
-
const list = {
|
|
1665
|
-
type,
|
|
1666
|
-
children: []
|
|
1667
|
-
};
|
|
1668
|
-
Transforms.wrapNodes(editor, list, { split: true });
|
|
1669
|
-
Transforms.wrapNodes(editor, listItem, { split: true });
|
|
1670
|
-
});
|
|
1671
|
-
},
|
|
1672
|
-
isActive(editor, type) {
|
|
1673
|
-
const [match] = getNodesByType(editor, type);
|
|
1674
|
-
return !!match;
|
|
1675
|
-
},
|
|
1676
|
-
getActiveList(editor) {
|
|
1677
|
-
const [match] = getNodesByType(editor, LIST_BLOCK_TYPES);
|
|
1678
|
-
return match;
|
|
1679
|
-
},
|
|
1680
|
-
buildListItem(editor) {
|
|
1681
|
-
const nodes = Editor.nodes(editor, {
|
|
1682
|
-
match: node => Editor.isBlock(editor, node),
|
|
1683
|
-
mode: 'lowest'
|
|
1684
|
-
});
|
|
1685
|
-
for (const [node, path] of nodes) {
|
|
1686
|
-
if (!Editor.isVoid(editor, node) && Element$1.isElement(node) && node.type !== ElementKinds.paragraph) {
|
|
1687
|
-
Transforms.setNodes(editor, { type: ElementKinds.paragraph, checked: undefined }, // todo remove checked
|
|
1688
|
-
{ at: path });
|
|
1689
|
-
}
|
|
1690
|
-
else if (Element$1.isElement(node) && node.type === ElementKinds.paragraph) {
|
|
1691
|
-
let { textIndent } = node;
|
|
1692
|
-
if (textIndent) {
|
|
1693
|
-
Transforms.setNodes(editor, { textIndent: undefined, indent: undefined }, // remove indent
|
|
1694
|
-
{ at: path });
|
|
1695
|
-
}
|
|
1696
|
-
}
|
|
1697
|
-
if (Node.parent(editor, path).type !== ElementKinds.listItem) {
|
|
1698
|
-
Transforms.wrapNodes(editor, { type: ElementKinds.listItem, children: [] }, {
|
|
1699
|
-
at: path,
|
|
1700
|
-
split: true
|
|
1701
|
-
});
|
|
1702
|
-
}
|
|
1703
|
-
}
|
|
1704
|
-
},
|
|
1705
|
-
buildInsertDataChildren(node) {
|
|
1706
|
-
const { children } = node;
|
|
1707
|
-
const listItem = children[0];
|
|
1708
|
-
if (isNodeTypeList(node) && Element$1.isElement(listItem) && listItem.children[0].type === ElementKinds.paragraph) {
|
|
1709
|
-
return node;
|
|
1710
|
-
}
|
|
1711
|
-
return this.buildInsertDataChildren(listItem);
|
|
1614
|
+
class TheConversionHintComponent {
|
|
1615
|
+
constructor() {
|
|
1616
|
+
this.duration = 10000;
|
|
1617
|
+
this.pauseOnHover = true;
|
|
1712
1618
|
}
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
isActive(editor) {
|
|
1717
|
-
const [match] = getNodesByType(editor, ElementKinds.checkItem);
|
|
1718
|
-
return !!match;
|
|
1719
|
-
},
|
|
1720
|
-
insertTodoItem(editor) {
|
|
1721
|
-
if (!editor.selection) {
|
|
1722
|
-
return;
|
|
1723
|
-
}
|
|
1724
|
-
const isActive = this.isActive(editor);
|
|
1725
|
-
const isNumberedList = ListEditor.isActive(editor, ElementKinds.numberedList);
|
|
1726
|
-
const isBulletedList = ListEditor.isActive(editor, ElementKinds.bulletedList);
|
|
1727
|
-
if (isActive) {
|
|
1728
|
-
Transforms.setNodes(editor, {
|
|
1729
|
-
type: ElementKinds.paragraph
|
|
1730
|
-
});
|
|
1619
|
+
mouseenter() {
|
|
1620
|
+
if (this.pauseOnHover) {
|
|
1621
|
+
this.clearCloseTimer();
|
|
1731
1622
|
}
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
Transforms.setNodes(editor, {
|
|
1737
|
-
type: ElementKinds.checkItem
|
|
1738
|
-
});
|
|
1623
|
+
}
|
|
1624
|
+
mouseleave() {
|
|
1625
|
+
if (this.pauseOnHover) {
|
|
1626
|
+
this.creatCloseTimer();
|
|
1739
1627
|
}
|
|
1740
1628
|
}
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
const BlockquoteEditor = {
|
|
1744
|
-
toggleBlockquote(editor) {
|
|
1745
|
-
if (!isParagraph(editor)) {
|
|
1746
|
-
Transforms.insertNodes(editor, {
|
|
1747
|
-
type: ElementKinds.paragraph,
|
|
1748
|
-
mode: 'text',
|
|
1749
|
-
children: [
|
|
1750
|
-
{
|
|
1751
|
-
text: ''
|
|
1752
|
-
}
|
|
1753
|
-
]
|
|
1754
|
-
});
|
|
1755
|
-
}
|
|
1756
|
-
const isActive = isBlockActive(editor, ElementKinds.blockquote);
|
|
1757
|
-
if (!isActive) {
|
|
1758
|
-
Transforms.wrapNodes(editor, { type: ElementKinds.blockquote, children: [] }, {
|
|
1759
|
-
mode: 'lowest'
|
|
1760
|
-
});
|
|
1761
|
-
}
|
|
1762
|
-
else {
|
|
1763
|
-
Transforms.unwrapNodes(editor, { match: n => Element$1.isElement(n) && n.type === ElementKinds.blockquote });
|
|
1764
|
-
}
|
|
1629
|
+
ngOnInit() {
|
|
1630
|
+
this.creatCloseTimer();
|
|
1765
1631
|
}
|
|
1766
|
-
|
|
1632
|
+
ngOnDestroy() {
|
|
1633
|
+
this.clearCloseTimer();
|
|
1634
|
+
}
|
|
1635
|
+
creatCloseTimer() {
|
|
1636
|
+
this.closeTimer = setInterval(() => {
|
|
1637
|
+
clearInterval(this.closeTimer);
|
|
1638
|
+
closeConversionHint(this.editor);
|
|
1639
|
+
}, this.duration);
|
|
1640
|
+
}
|
|
1641
|
+
clearCloseTimer() {
|
|
1642
|
+
clearInterval(this.closeTimer);
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
TheConversionHintComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheConversionHintComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1646
|
+
TheConversionHintComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheConversionHintComponent, selector: "the-conversion-hint", inputs: { editor: "editor", conversion: "conversion" }, host: { listeners: { "mouseenter": "mouseenter()", "mouseleave": "mouseleave()" }, classAttribute: "the-conversion-hint" }, ngImport: i0, template: "<ng-container>\n <thy-alert\n thyType=\"primary-weak\"\n thyIcon=\"info-circle-fill\"\n thyCloseable=\"true\"\n thyMessage=\"\u68C0\u6D4B\u5230\u7C98\u8D34\u5185\u5BB9\u7B26\u5408Markdown\u8BED\u6CD5\"\n >\n <ng-template #operation>\n <a href=\"javascript:;\" thyAlertActionItem (click)=\"conversion()\">\n \u7ACB\u5373\u8F6C\u6362\n </a>\n </ng-template>\n </thy-alert>\n</ng-container>\n", components: [{ type: i1$1.ThyAlertComponent, selector: "thy-alert", inputs: ["thyType", "thyMessage", "thyIcon", "thyCloseable"] }], directives: [{ type: i1$1.ThyAlertActionItemDirective, selector: "[thyAlertActionItem]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1647
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheConversionHintComponent, decorators: [{
|
|
1648
|
+
type: Component,
|
|
1649
|
+
args: [{
|
|
1650
|
+
selector: 'the-conversion-hint',
|
|
1651
|
+
templateUrl: 'conversion-hint.component.html',
|
|
1652
|
+
host: {
|
|
1653
|
+
class: 'the-conversion-hint'
|
|
1654
|
+
},
|
|
1655
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
1656
|
+
}]
|
|
1657
|
+
}], propDecorators: { editor: [{
|
|
1658
|
+
type: Input
|
|
1659
|
+
}], conversion: [{
|
|
1660
|
+
type: Input
|
|
1661
|
+
}], mouseenter: [{
|
|
1662
|
+
type: HostListener,
|
|
1663
|
+
args: ['mouseenter']
|
|
1664
|
+
}], mouseleave: [{
|
|
1665
|
+
type: HostListener,
|
|
1666
|
+
args: ['mouseleave']
|
|
1667
|
+
}] } });
|
|
1767
1668
|
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
const selectNode = Node.get(fragment, []);
|
|
1781
|
-
const selectText = Node.string(selectNode);
|
|
1782
|
-
InlineCodeEditor.wrapInlineCode(editor, selectText);
|
|
1783
|
-
}
|
|
1784
|
-
},
|
|
1785
|
-
wrapInlineCode(editor, text = '') {
|
|
1786
|
-
if (InlineCodeEditor.isInlineCodeActive(editor)) {
|
|
1787
|
-
InlineCodeEditor.unwrapInlineCode(editor);
|
|
1788
|
-
}
|
|
1789
|
-
const { selection } = editor;
|
|
1790
|
-
const isCollapsed = selection && Range.isCollapsed(selection);
|
|
1791
|
-
const inlineCode = {
|
|
1792
|
-
type: ElementKinds.inlineCode,
|
|
1793
|
-
children: isCollapsed ? [{ text: text ? text : ZERO_WIDTH_CHAR }] : []
|
|
1669
|
+
function plainToTheia(text) {
|
|
1670
|
+
if (typeof text !== 'string') {
|
|
1671
|
+
return text;
|
|
1672
|
+
}
|
|
1673
|
+
return text.split('\n').map(i => {
|
|
1674
|
+
return {
|
|
1675
|
+
type: ElementKinds.paragraph,
|
|
1676
|
+
children: [
|
|
1677
|
+
{
|
|
1678
|
+
text: i
|
|
1679
|
+
}
|
|
1680
|
+
]
|
|
1794
1681
|
};
|
|
1795
|
-
|
|
1796
|
-
|
|
1682
|
+
});
|
|
1683
|
+
}
|
|
1684
|
+
function htmlToTheia(value) {
|
|
1685
|
+
if (typeof value === 'string') {
|
|
1686
|
+
const htmlDom = new DOMParser().parseFromString(value, 'text/html');
|
|
1687
|
+
return TheiaConverter.convertToTheia(Array.from(htmlDom.body.children));
|
|
1688
|
+
}
|
|
1689
|
+
return value;
|
|
1690
|
+
}
|
|
1691
|
+
function dataDeserialize(mode, value) {
|
|
1692
|
+
if (!value) {
|
|
1693
|
+
return [createEmptyParagraph()];
|
|
1694
|
+
}
|
|
1695
|
+
if (mode === TheDataMode.html) {
|
|
1696
|
+
if (typeof value !== 'string') {
|
|
1697
|
+
return value;
|
|
1797
1698
|
}
|
|
1798
|
-
|
|
1799
|
-
|
|
1699
|
+
if (/<[^>]+>/.test(value)) {
|
|
1700
|
+
return htmlToTheia(value);
|
|
1800
1701
|
}
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
at: path ? path : (_a = editor.selection) === null || _a === void 0 ? void 0 : _a.anchor.path,
|
|
1809
|
-
match: n => Element$1.isElement(n) && n.type === ElementKinds.inlineCode
|
|
1810
|
-
});
|
|
1811
|
-
return !!inlineCode;
|
|
1702
|
+
return plainToTheia(value);
|
|
1703
|
+
}
|
|
1704
|
+
return value || [createEmptyParagraph()];
|
|
1705
|
+
}
|
|
1706
|
+
function dataSerializing(mode, value) {
|
|
1707
|
+
if (mode === TheDataMode.html) {
|
|
1708
|
+
return TheiaConverter.convertToHtml(value);
|
|
1812
1709
|
}
|
|
1710
|
+
return value;
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
const getEditorUUID = (editor) => {
|
|
1714
|
+
return THE_EDITOR_UUID.get(editor);
|
|
1715
|
+
};
|
|
1716
|
+
const setEditorUUID = (editor, uuid) => {
|
|
1717
|
+
THE_EDITOR_UUID.set(editor, uuid);
|
|
1813
1718
|
};
|
|
1814
1719
|
|
|
1815
|
-
const
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1720
|
+
const getToolbarClass = (editor) => {
|
|
1721
|
+
const uuid = getEditorUUID(editor);
|
|
1722
|
+
return `the-toolbar-${uuid}`;
|
|
1723
|
+
};
|
|
1724
|
+
|
|
1725
|
+
const IS_MAC = typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);
|
|
1726
|
+
const CONTROL_KEY = IS_MAC ? '⌘' : 'Ctrl';
|
|
1727
|
+
|
|
1728
|
+
/**
|
|
1729
|
+
* whether the current node is a clean paragraph
|
|
1730
|
+
* @param editor
|
|
1731
|
+
* @param text
|
|
1732
|
+
* @returns boolean
|
|
1733
|
+
*/
|
|
1734
|
+
const isCleanEmptyParagraph = (editor) => {
|
|
1735
|
+
const isCollapsedCursor = TheEditor.isFocused(editor) && editor.selection && Range.isCollapsed(editor.selection);
|
|
1736
|
+
if (!isCollapsedCursor) {
|
|
1737
|
+
return false;
|
|
1738
|
+
}
|
|
1739
|
+
const block = Node.ancestor(editor, [editor.selection.anchor.path[0]]);
|
|
1740
|
+
const textIndent = 'textIndent';
|
|
1741
|
+
const align = 'align';
|
|
1742
|
+
const hasTextIndent = block[textIndent];
|
|
1743
|
+
const alignValue = block[align];
|
|
1744
|
+
const hasIndent = block[ElementKinds.indent];
|
|
1745
|
+
if (Node.string(block) === '' &&
|
|
1746
|
+
Element$1.isElement(block) &&
|
|
1747
|
+
block.type === ElementKinds.paragraph &&
|
|
1748
|
+
block.children.length === 1 &&
|
|
1749
|
+
Text.isText(block.children[0]) &&
|
|
1750
|
+
!Editor.isVoid(editor, block) &&
|
|
1751
|
+
!hasIndent &&
|
|
1752
|
+
!hasTextIndent &&
|
|
1753
|
+
(!alignValue || alignValue === Alignment.left)) {
|
|
1754
|
+
return true;
|
|
1843
1755
|
}
|
|
1756
|
+
return false;
|
|
1844
1757
|
};
|
|
1845
1758
|
|
|
1846
|
-
const
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
}
|
|
1860
|
-
},
|
|
1861
|
-
{
|
|
1862
|
-
type: ElementKinds.heading_3,
|
|
1863
|
-
markup: '###',
|
|
1864
|
-
format: (editor) => {
|
|
1865
|
-
HeadingEditor.setHeading(editor, ElementKinds.heading_3);
|
|
1866
|
-
}
|
|
1867
|
-
},
|
|
1868
|
-
{
|
|
1869
|
-
type: ElementKinds.heading_4,
|
|
1870
|
-
markup: '####',
|
|
1871
|
-
format: (editor) => {
|
|
1872
|
-
HeadingEditor.setHeading(editor, ElementKinds.heading_4);
|
|
1873
|
-
}
|
|
1874
|
-
},
|
|
1875
|
-
{
|
|
1876
|
-
type: ElementKinds.heading_5,
|
|
1877
|
-
markup: '#####',
|
|
1878
|
-
format: (editor) => {
|
|
1879
|
-
HeadingEditor.setHeading(editor, ElementKinds.heading_5);
|
|
1759
|
+
const mergeElementOptions = (elementOptions) => {
|
|
1760
|
+
elementOptions = elementOptions.filter(item => item.inValidChildrenTypes.length > 0);
|
|
1761
|
+
const combinationData = [...DefaultElementOptions, ...elementOptions];
|
|
1762
|
+
const dataInfo = {};
|
|
1763
|
+
combinationData.forEach(item => {
|
|
1764
|
+
const { type, inValidChildrenTypes, isIndivisible, isSecondaryContainer } = item;
|
|
1765
|
+
if (!dataInfo[type]) {
|
|
1766
|
+
dataInfo[type] = {
|
|
1767
|
+
type,
|
|
1768
|
+
inValidChildrenTypes,
|
|
1769
|
+
isIndivisible,
|
|
1770
|
+
isSecondaryContainer
|
|
1771
|
+
};
|
|
1880
1772
|
}
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
markup: '######',
|
|
1885
|
-
format: (editor) => {
|
|
1886
|
-
HeadingEditor.setHeading(editor, ElementKinds.heading_6);
|
|
1887
|
-
}
|
|
1888
|
-
},
|
|
1889
|
-
{
|
|
1890
|
-
type: ElementKinds.blockquote,
|
|
1891
|
-
markup: ['>'],
|
|
1892
|
-
format: (editor) => {
|
|
1893
|
-
BlockquoteEditor.toggleBlockquote(editor);
|
|
1894
|
-
}
|
|
1895
|
-
},
|
|
1896
|
-
{
|
|
1897
|
-
type: MarkTypes.bold,
|
|
1898
|
-
between: ['**', '**'],
|
|
1899
|
-
mode: 'inline',
|
|
1900
|
-
insertTrigger: true
|
|
1901
|
-
},
|
|
1902
|
-
{
|
|
1903
|
-
type: MarkTypes.bold,
|
|
1904
|
-
between: ['__', '__'],
|
|
1905
|
-
mode: 'inline',
|
|
1906
|
-
insertTrigger: true
|
|
1907
|
-
},
|
|
1908
|
-
{
|
|
1909
|
-
type: MarkTypes.italic,
|
|
1910
|
-
between: ['*', '*'],
|
|
1911
|
-
mode: 'inline',
|
|
1912
|
-
insertTrigger: true
|
|
1913
|
-
},
|
|
1914
|
-
{
|
|
1915
|
-
type: MarkTypes.italic,
|
|
1916
|
-
between: ['_', '_'],
|
|
1917
|
-
mode: 'inline',
|
|
1918
|
-
insertTrigger: true
|
|
1919
|
-
},
|
|
1920
|
-
{
|
|
1921
|
-
type: ElementKinds.inlineCode,
|
|
1922
|
-
between: ['`', '`'],
|
|
1923
|
-
mode: 'inline',
|
|
1924
|
-
format: (editor, text) => {
|
|
1925
|
-
InlineCodeEditor.toggleInlineCode(editor, text);
|
|
1926
|
-
Transforms.select(editor, Editor.after(editor, editor.selection));
|
|
1927
|
-
}
|
|
1928
|
-
},
|
|
1929
|
-
{
|
|
1930
|
-
type: MarkTypes.strike,
|
|
1931
|
-
between: ['~~', '~~'],
|
|
1932
|
-
mode: 'inline',
|
|
1933
|
-
insertTrigger: true
|
|
1934
|
-
},
|
|
1935
|
-
{
|
|
1936
|
-
type: ElementKinds.code,
|
|
1937
|
-
markup: '```',
|
|
1938
|
-
insertTrigger: true
|
|
1939
|
-
},
|
|
1940
|
-
{
|
|
1941
|
-
type: ElementKinds.listItem,
|
|
1942
|
-
markup: [],
|
|
1943
|
-
match: (editor) => {
|
|
1944
|
-
return isParagraph(editor) ? ['*', '-', '+'] : [];
|
|
1945
|
-
},
|
|
1946
|
-
format: (editor) => {
|
|
1947
|
-
ListEditor.toggleList(editor, ElementKinds.bulletedList);
|
|
1948
|
-
}
|
|
1949
|
-
},
|
|
1950
|
-
{
|
|
1951
|
-
type: ElementKinds.listItem,
|
|
1952
|
-
markup: [],
|
|
1953
|
-
match: (editor, textFromBlockStart) => {
|
|
1954
|
-
return isParagraph(editor) && /^-?\d+(\.|\))$/.test(textFromBlockStart) ? [textFromBlockStart] : [];
|
|
1955
|
-
},
|
|
1956
|
-
format: (editor, markup) => {
|
|
1957
|
-
let startIndex = 1;
|
|
1958
|
-
if (markup) {
|
|
1959
|
-
startIndex = markup[0].split('.')[0];
|
|
1960
|
-
if (startIndex === 0) {
|
|
1961
|
-
startIndex = 1;
|
|
1962
|
-
}
|
|
1963
|
-
}
|
|
1964
|
-
ListEditor.toggleList(editor, ElementKinds.numberedList, startIndex);
|
|
1965
|
-
}
|
|
1966
|
-
},
|
|
1967
|
-
{
|
|
1968
|
-
type: ElementKinds.checkItem,
|
|
1969
|
-
markup: [],
|
|
1970
|
-
match: (editor) => {
|
|
1971
|
-
return isParagraph(editor) ? ['[]'] : [];
|
|
1972
|
-
},
|
|
1973
|
-
format: (editor) => {
|
|
1974
|
-
TodoItemEditor.insertTodoItem(editor);
|
|
1975
|
-
}
|
|
1976
|
-
},
|
|
1977
|
-
{
|
|
1978
|
-
type: ElementKinds.hr,
|
|
1979
|
-
markup: '---',
|
|
1980
|
-
insertTrigger: true
|
|
1981
|
-
}
|
|
1982
|
-
];
|
|
1983
|
-
|
|
1984
|
-
const UNDOING = new WeakMap();
|
|
1985
|
-
const REDOING = new WeakMap();
|
|
1986
|
-
const withTheHistory = (editor) => {
|
|
1987
|
-
const { undo, redo } = editor;
|
|
1988
|
-
editor.undo = () => {
|
|
1989
|
-
UNDOING.set(editor, true);
|
|
1990
|
-
undo();
|
|
1991
|
-
UNDOING.set(editor, false);
|
|
1992
|
-
};
|
|
1993
|
-
editor.redo = () => {
|
|
1994
|
-
REDOING.set(editor, true);
|
|
1995
|
-
redo();
|
|
1996
|
-
REDOING.set(editor, false);
|
|
1997
|
-
};
|
|
1998
|
-
return editor;
|
|
1999
|
-
};
|
|
2000
|
-
const TheHistoryEditor = {
|
|
2001
|
-
isUndoing(editor) {
|
|
2002
|
-
return UNDOING.get(editor);
|
|
2003
|
-
},
|
|
2004
|
-
isRedoing(editor) {
|
|
2005
|
-
return REDOING.get(editor);
|
|
2006
|
-
}
|
|
1773
|
+
dataInfo[type].inValidChildrenTypes = Array.from(new Set([...inValidChildrenTypes, ...dataInfo[type].inValidChildrenTypes]));
|
|
1774
|
+
});
|
|
1775
|
+
return dataInfo;
|
|
2007
1776
|
};
|
|
2008
1777
|
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
mouseenter() {
|
|
2015
|
-
if (this.pauseOnHover) {
|
|
2016
|
-
this.clearCloseTimer();
|
|
2017
|
-
}
|
|
2018
|
-
}
|
|
2019
|
-
mouseleave() {
|
|
2020
|
-
if (this.pauseOnHover) {
|
|
2021
|
-
this.creatCloseTimer();
|
|
2022
|
-
}
|
|
2023
|
-
}
|
|
2024
|
-
ngOnInit() {
|
|
2025
|
-
this.creatCloseTimer();
|
|
2026
|
-
}
|
|
2027
|
-
ngOnDestroy() {
|
|
2028
|
-
this.clearCloseTimer();
|
|
2029
|
-
}
|
|
2030
|
-
creatCloseTimer() {
|
|
2031
|
-
this.closeTimer = setInterval(() => {
|
|
2032
|
-
clearInterval(this.closeTimer);
|
|
2033
|
-
closeConversionHint(this.editor);
|
|
2034
|
-
}, this.duration);
|
|
2035
|
-
}
|
|
2036
|
-
clearCloseTimer() {
|
|
2037
|
-
clearInterval(this.closeTimer);
|
|
1778
|
+
/** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
|
|
1779
|
+
function coercePixelsFromCssValue(cssValue) {
|
|
1780
|
+
const match = cssValue.match(/(\d+(\.\d+)?)px/);
|
|
1781
|
+
if (match) {
|
|
1782
|
+
return Number(match[1]);
|
|
2038
1783
|
}
|
|
2039
1784
|
}
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
args: [{
|
|
2045
|
-
selector: 'the-conversion-hint',
|
|
2046
|
-
templateUrl: 'conversion-hint.component.html',
|
|
2047
|
-
host: {
|
|
2048
|
-
class: 'the-conversion-hint'
|
|
2049
|
-
},
|
|
2050
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
2051
|
-
}]
|
|
2052
|
-
}], propDecorators: { editor: [{
|
|
2053
|
-
type: Input
|
|
2054
|
-
}], conversion: [{
|
|
2055
|
-
type: Input
|
|
2056
|
-
}], mouseenter: [{
|
|
2057
|
-
type: HostListener,
|
|
2058
|
-
args: ['mouseenter']
|
|
2059
|
-
}], mouseleave: [{
|
|
2060
|
-
type: HostListener,
|
|
2061
|
-
args: ['mouseleave']
|
|
2062
|
-
}] } });
|
|
2063
|
-
|
|
2064
|
-
function plainToTheia(text) {
|
|
2065
|
-
if (typeof text !== 'string') {
|
|
2066
|
-
return text;
|
|
2067
|
-
}
|
|
2068
|
-
return text.split('\n').map(i => {
|
|
2069
|
-
return {
|
|
2070
|
-
type: ElementKinds.paragraph,
|
|
2071
|
-
children: [
|
|
2072
|
-
{
|
|
2073
|
-
text: i
|
|
2074
|
-
}
|
|
2075
|
-
]
|
|
2076
|
-
};
|
|
2077
|
-
});
|
|
1785
|
+
function getElementWidth(element) {
|
|
1786
|
+
// Optimization: Check style.width first as we probably set it already before reading
|
|
1787
|
+
// offsetWidth which triggers layout.
|
|
1788
|
+
return coercePixelsFromCssValue(element.style.width) || element.offsetWidth;
|
|
2078
1789
|
}
|
|
2079
|
-
function
|
|
2080
|
-
|
|
2081
|
-
const htmlDom = new DOMParser().parseFromString(value, 'text/html');
|
|
2082
|
-
return TheiaConverter.convertToTheia(Array.from(htmlDom.body.children));
|
|
2083
|
-
}
|
|
2084
|
-
return value;
|
|
1790
|
+
function getElementHeight(element) {
|
|
1791
|
+
return element.getBoundingClientRect().height;
|
|
2085
1792
|
}
|
|
2086
|
-
function
|
|
2087
|
-
|
|
2088
|
-
return
|
|
1793
|
+
function getColsTotalWidth(cols) {
|
|
1794
|
+
return cols.reduce((total, col) => {
|
|
1795
|
+
return total + getElementWidth(col);
|
|
1796
|
+
}, 0);
|
|
1797
|
+
}
|
|
1798
|
+
function getRowsTotalHeight(rows) {
|
|
1799
|
+
return rows.reduce((total, row) => {
|
|
1800
|
+
return total + getElementHeight(row);
|
|
1801
|
+
}, 0);
|
|
1802
|
+
}
|
|
1803
|
+
function useElementStyle(el, element) {
|
|
1804
|
+
if (element.align) {
|
|
1805
|
+
el.style.textAlign = element.align || Alignment.left;
|
|
2089
1806
|
}
|
|
2090
|
-
if (
|
|
2091
|
-
|
|
2092
|
-
return value;
|
|
2093
|
-
}
|
|
2094
|
-
if (/<[^>]+>/.test(value)) {
|
|
2095
|
-
return htmlToTheia(value);
|
|
2096
|
-
}
|
|
2097
|
-
return plainToTheia(value);
|
|
1807
|
+
if (element.textIndent) {
|
|
1808
|
+
el.style.textIndent = element.textIndent + 'em';
|
|
2098
1809
|
}
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
function dataSerializing(mode, value) {
|
|
2102
|
-
if (mode === TheDataMode.html) {
|
|
2103
|
-
return TheiaConverter.convertToHtml(value);
|
|
1810
|
+
if (element.verticalAlign) {
|
|
1811
|
+
el.style.verticalAlign = element.verticalAlign;
|
|
2104
1812
|
}
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
const getToolbarClass = (editor) => {
|
|
2116
|
-
const uuid = getEditorUUID(editor);
|
|
2117
|
-
return `the-toolbar-${uuid}`;
|
|
2118
|
-
};
|
|
2119
|
-
|
|
2120
|
-
const IS_MAC = typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);
|
|
2121
|
-
const CONTROL_KEY = IS_MAC ? '⌘' : 'Ctrl';
|
|
2122
|
-
|
|
2123
|
-
/**
|
|
2124
|
-
* whether the current node is a clean paragraph
|
|
2125
|
-
* @param editor
|
|
2126
|
-
* @param text
|
|
2127
|
-
* @returns boolean
|
|
2128
|
-
*/
|
|
2129
|
-
const isCleanEmptyParagraph = (editor) => {
|
|
2130
|
-
const isCollapsedCursor = TheEditor.isFocused(editor) && editor.selection && Range.isCollapsed(editor.selection);
|
|
2131
|
-
if (!isCollapsedCursor) {
|
|
2132
|
-
return false;
|
|
2133
|
-
}
|
|
2134
|
-
const block = Node.ancestor(editor, [editor.selection.anchor.path[0]]);
|
|
2135
|
-
const textIndent = 'textIndent';
|
|
2136
|
-
const align = 'align';
|
|
2137
|
-
const hasTextIndent = block[textIndent];
|
|
2138
|
-
const alignValue = block[align];
|
|
2139
|
-
const hasIndent = block[ElementKinds.indent];
|
|
2140
|
-
if (Node.string(block) === '' &&
|
|
2141
|
-
Element$1.isElement(block) &&
|
|
2142
|
-
block.type === ElementKinds.paragraph &&
|
|
2143
|
-
block.children.length === 1 &&
|
|
2144
|
-
Text.isText(block.children[0]) &&
|
|
2145
|
-
!Editor.isVoid(editor, block) &&
|
|
2146
|
-
!hasIndent &&
|
|
2147
|
-
!hasTextIndent &&
|
|
2148
|
-
(!alignValue || alignValue === Alignment.left)) {
|
|
2149
|
-
return true;
|
|
2150
|
-
}
|
|
2151
|
-
return false;
|
|
2152
|
-
};
|
|
2153
|
-
|
|
2154
|
-
const mergeElementOptions = (elementOptions) => {
|
|
2155
|
-
elementOptions = elementOptions.filter(item => item.inValidChildrenTypes.length > 0);
|
|
2156
|
-
const combinationData = [...DefaultElementOptions, ...elementOptions];
|
|
2157
|
-
const dataInfo = {};
|
|
2158
|
-
combinationData.forEach(item => {
|
|
2159
|
-
const { type, inValidChildrenTypes, isIndivisible, isSecondaryContainer } = item;
|
|
2160
|
-
if (!dataInfo[type]) {
|
|
2161
|
-
dataInfo[type] = {
|
|
2162
|
-
type,
|
|
2163
|
-
inValidChildrenTypes,
|
|
2164
|
-
isIndivisible,
|
|
2165
|
-
isSecondaryContainer
|
|
2166
|
-
};
|
|
2167
|
-
}
|
|
2168
|
-
dataInfo[type].inValidChildrenTypes = Array.from(new Set([...inValidChildrenTypes, ...dataInfo[type].inValidChildrenTypes]));
|
|
2169
|
-
});
|
|
2170
|
-
return dataInfo;
|
|
2171
|
-
};
|
|
2172
|
-
|
|
2173
|
-
/** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
|
|
2174
|
-
function coercePixelsFromCssValue(cssValue) {
|
|
2175
|
-
const match = cssValue.match(/(\d+(\.\d+)?)px/);
|
|
2176
|
-
if (match) {
|
|
2177
|
-
return Number(match[1]);
|
|
2178
|
-
}
|
|
2179
|
-
}
|
|
2180
|
-
function getElementWidth(element) {
|
|
2181
|
-
// Optimization: Check style.width first as we probably set it already before reading
|
|
2182
|
-
// offsetWidth which triggers layout.
|
|
2183
|
-
return coercePixelsFromCssValue(element.style.width) || element.offsetWidth;
|
|
2184
|
-
}
|
|
2185
|
-
function getElementHeight(element) {
|
|
2186
|
-
return Math.round(element.getBoundingClientRect().height);
|
|
2187
|
-
}
|
|
2188
|
-
function getColsTotalWidth(cols) {
|
|
2189
|
-
return cols.reduce((total, col) => {
|
|
2190
|
-
return total + getElementWidth(col);
|
|
2191
|
-
}, 0);
|
|
2192
|
-
}
|
|
2193
|
-
function getRowsTotalHeight(rows) {
|
|
2194
|
-
return rows.reduce((total, row) => {
|
|
2195
|
-
return total + getElementHeight(row);
|
|
2196
|
-
}, 0);
|
|
2197
|
-
}
|
|
2198
|
-
function useElementStyle(el, element) {
|
|
2199
|
-
if (element.align) {
|
|
2200
|
-
el.style.textAlign = element.align || Alignment.left;
|
|
2201
|
-
}
|
|
2202
|
-
if (element.textIndent) {
|
|
2203
|
-
el.style.textIndent = element.textIndent + 'em';
|
|
2204
|
-
}
|
|
2205
|
-
if (element.verticalAlign) {
|
|
2206
|
-
el.style.verticalAlign = element.verticalAlign;
|
|
2207
|
-
}
|
|
2208
|
-
}
|
|
2209
|
-
function getElementClassByPrefix(el, prefix) {
|
|
2210
|
-
let matchClass = null;
|
|
2211
|
-
el.classList.forEach((value, key) => {
|
|
2212
|
-
if (value.includes(prefix)) {
|
|
2213
|
-
matchClass = value;
|
|
2214
|
-
}
|
|
2215
|
-
});
|
|
2216
|
-
return matchClass;
|
|
2217
|
-
}
|
|
2218
|
-
function findRelativeElementByPoint(editor, x, y, mode) {
|
|
2219
|
-
const editableElement = EDITOR_TO_ELEMENT.get(editor);
|
|
2220
|
-
const rectEditable = editableElement.getBoundingClientRect();
|
|
2221
|
-
if (x > rectEditable.x && x < rectEditable.x + rectEditable.width) {
|
|
2222
|
-
let { paddingLeft } = window.getComputedStyle(editableElement, null);
|
|
2223
|
-
const paddingLeftPixels = coercePixelsFromCssValue(paddingLeft);
|
|
2224
|
-
const startX = rectEditable.left + paddingLeftPixels;
|
|
2225
|
-
let relativeElement = document.elementFromPoint(mode === 'highest' ? startX : x, y);
|
|
2226
|
-
return relativeElement;
|
|
2227
|
-
}
|
|
2228
|
-
return null;
|
|
2229
|
-
}
|
|
2230
|
-
function findNodeEntryByPoint(editor, x, y, mode) {
|
|
2231
|
-
const editableElement = EDITOR_TO_ELEMENT.get(editor);
|
|
2232
|
-
let rootElement = null;
|
|
2233
|
-
let relativeElement = findRelativeElementByPoint(editor, x, y, mode);
|
|
2234
|
-
// 获取最顶层的DOM
|
|
2235
|
-
if (mode === 'highest') {
|
|
2236
|
-
while (relativeElement && editableElement.contains(relativeElement)) {
|
|
2237
|
-
relativeElement = relativeElement.closest('[data-slate-node="element"]');
|
|
2238
|
-
if (relativeElement) {
|
|
2239
|
-
rootElement = relativeElement;
|
|
2240
|
-
relativeElement = relativeElement.parentElement;
|
|
2241
|
-
}
|
|
2242
|
-
}
|
|
2243
|
-
}
|
|
2244
|
-
if (!mode) {
|
|
2245
|
-
if (relativeElement && editableElement.contains(relativeElement)) {
|
|
2246
|
-
relativeElement = relativeElement.closest('[data-slate-node="element"]');
|
|
2247
|
-
rootElement = relativeElement;
|
|
2248
|
-
}
|
|
2249
|
-
}
|
|
2250
|
-
if (rootElement) {
|
|
2251
|
-
const node = AngularEditor.toSlateNode(editor, rootElement);
|
|
2252
|
-
const path = AngularEditor.findPath(editor, node);
|
|
2253
|
-
return [node, path];
|
|
2254
|
-
}
|
|
2255
|
-
return null;
|
|
1813
|
+
}
|
|
1814
|
+
function getElementClassByPrefix(el, prefix) {
|
|
1815
|
+
let matchClass = null;
|
|
1816
|
+
el.classList.forEach((value, key) => {
|
|
1817
|
+
if (value.includes(prefix)) {
|
|
1818
|
+
matchClass = value;
|
|
1819
|
+
}
|
|
1820
|
+
});
|
|
1821
|
+
return matchClass;
|
|
2256
1822
|
}
|
|
2257
1823
|
|
|
2258
1824
|
const withDeserializeMd = (options) => (editor) => {
|
|
@@ -2968,7 +2534,7 @@ class TheImageComponent extends TheBaseElementComponent {
|
|
|
2968
2534
|
}
|
|
2969
2535
|
}
|
|
2970
2536
|
TheImageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheImageComponent, deps: [{ token: i0.ElementRef }, { token: i1$2.DomSanitizer }, { token: THE_UPLOAD_SERVICE_TOKEN }, { token: i0.ChangeDetectorRef }, { token: TheContextService }, { token: i1$3.ThyPopover }, { token: i2.Overlay }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2971
|
-
TheImageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheImageComponent, selector: "the-image, [theImage]", viewQueries: [{ propertyName: "imageContent", first: true, predicate: ["imageContent"], descendants: true }, { propertyName: "img", first: true, predicate: ["img"], descendants: true }, { propertyName: "layoutToolbar", first: true, predicate: ["layoutToolbar"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n\n<div class=\"image-container\" contenteditable=\"false\" [style.textAlign]=\"imageEntry.align\">\n <div\n #imageContent\n *ngIf=\"imageEntry.thumbUrl\"\n class=\"image-content\"\n [class.pointer]=\"!selection\"\n [ngStyle]=\"{\n 'width.px':\n imageEntry?.layout && imageEntry?.width > layoutDefaultWidth && !imageEntry?.reSized\n ? layoutDefaultWidth\n : imageEntry.width,\n 'height.px': imageEntry.height\n }\"\n >\n <img #img class=\"main-image\" [src]=\"imageEntry.thumbUrl\" [alt]=\"imageEntry.name\" />\n <div *ngIf=\"selection\" class=\"image-profile\" [class.outline]=\"selection\">\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right bottom\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left bottom\"></span>\n </div>\n <div *ngIf=\"uploading\" class=\"uploading\">\n <div class=\"uploading-percentage\">\n <thy-progress thyType=\"primary\" [thyValue]=\"percentage\" thySize=\"sm\"></thy-progress>\n <thy-icon (click)=\"cancelUpload($event)\" thyIconName=\"close-circle-bold-fill\" thyIconLegging=\"true\"></thy-icon>\n </div>\n </div>\n <div *ngIf=\"!uploading\" class=\"layer\" (mousedown)=\"preview($event)\" [class.readonly]=\"readonly\"></div>\n </div>\n <div *ngIf=\"!imageEntry.thumbUrl\" class=\"image-loading\" contenteditable=\"false\">\n <thy-icon thyIconName=\"image\"></thy-icon>\n </div>\n</div>\n\n<ng-template #layoutToolbar>\n <div class=\"the-block-toolbar-popover\" contenteditable=\"false\">\n <thy-icon-nav>\n <ng-container *ngFor=\"let item of layoutOptions\">\n <a\n *ngIf=\"item.key !== 'split'\"\n href=\"javascript:;\"\n thyIconNavLink\n [ngClass]=\"{ 'remove-link': item.key === 'remove' }\"\n [thyIconNavLinkIcon]=\"item.icon\"\n [thyTooltip]=\"item.name\"\n [thyIconNavLinkActive]=\"layoutActive(item.key)\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"item?.handle($event, item.key)\"\n ></a>\n <nav-split-line *ngIf=\"item.key === 'split'\"></nav-split-line>\n </ng-container>\n </thy-icon-nav>\n </div>\n</ng-template>\n", components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i6.ThyProgressComponent, selector: "thy-progress", inputs: ["thyType", "thySize", "thyValue", "thyMax", "thyTips"] }, { type:
|
|
2537
|
+
TheImageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheImageComponent, selector: "the-image, [theImage]", viewQueries: [{ propertyName: "imageContent", first: true, predicate: ["imageContent"], descendants: true }, { propertyName: "img", first: true, predicate: ["img"], descendants: true }, { propertyName: "layoutToolbar", first: true, predicate: ["layoutToolbar"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n\n<div class=\"image-container\" contenteditable=\"false\" [style.textAlign]=\"imageEntry.align\">\n <div\n #imageContent\n *ngIf=\"imageEntry.thumbUrl\"\n class=\"image-content\"\n [class.pointer]=\"!selection\"\n [ngStyle]=\"{\n 'width.px':\n imageEntry?.layout && imageEntry?.width > layoutDefaultWidth && !imageEntry?.reSized\n ? layoutDefaultWidth\n : imageEntry.width,\n 'height.px': imageEntry.height\n }\"\n >\n <img #img class=\"main-image\" [src]=\"imageEntry.thumbUrl\" [alt]=\"imageEntry.name\" />\n <div *ngIf=\"selection\" class=\"image-profile\" [class.outline]=\"selection\">\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right bottom\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left bottom\"></span>\n </div>\n <div *ngIf=\"uploading\" class=\"uploading\">\n <div class=\"uploading-percentage\">\n <thy-progress thyType=\"primary\" [thyValue]=\"percentage\" thySize=\"sm\"></thy-progress>\n <thy-icon (click)=\"cancelUpload($event)\" thyIconName=\"close-circle-bold-fill\" thyIconLegging=\"true\"></thy-icon>\n </div>\n </div>\n <div *ngIf=\"!uploading\" class=\"layer\" (mousedown)=\"preview($event)\" [class.readonly]=\"readonly\"></div>\n </div>\n <div *ngIf=\"!imageEntry.thumbUrl\" class=\"image-loading\" contenteditable=\"false\">\n <thy-icon thyIconName=\"image\"></thy-icon>\n </div>\n</div>\n\n<ng-template #layoutToolbar>\n <div class=\"the-block-toolbar-popover\" contenteditable=\"false\">\n <thy-icon-nav>\n <ng-container *ngFor=\"let item of layoutOptions\">\n <a\n *ngIf=\"item.key !== 'split'\"\n href=\"javascript:;\"\n thyIconNavLink\n [ngClass]=\"{ 'remove-link': item.key === 'remove' }\"\n [thyIconNavLinkIcon]=\"item.icon\"\n [thyTooltip]=\"item.name\"\n [thyIconNavLinkActive]=\"layoutActive(item.key)\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"item?.handle($event, item.key)\"\n ></a>\n <nav-split-line *ngIf=\"item.key === 'split'\"></nav-split-line>\n </ng-container>\n </thy-icon-nav>\n </div>\n</ng-template>\n", components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i6.ThyProgressComponent, selector: "thy-progress", inputs: ["thyType", "thySize", "thyValue", "thyMax", "thyTips"] }, { type: i3.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i3$1.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: i3$1.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }], directives: [{ type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
|
|
2972
2538
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheImageComponent, decorators: [{
|
|
2973
2539
|
type: Component,
|
|
2974
2540
|
args: [{
|
|
@@ -3092,6 +2658,10 @@ const hasStableListItem = (listItemNode) => {
|
|
|
3092
2658
|
return listItemNode.children.length === 1 && type === ElementKinds.paragraph;
|
|
3093
2659
|
};
|
|
3094
2660
|
|
|
2661
|
+
const isNodeTypeList = (n) => {
|
|
2662
|
+
return [ElementKinds.bulletedList, ElementKinds.numberedList].includes(n.type);
|
|
2663
|
+
};
|
|
2664
|
+
|
|
3095
2665
|
/**
|
|
3096
2666
|
* list 中 是否是单个listItem,且listItem没有子列表
|
|
3097
2667
|
*/
|
|
@@ -3987,7 +3557,7 @@ TheTodoItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
|
|
|
3987
3557
|
<span contenteditable="false" class="todo-item-status">
|
|
3988
3558
|
<input #checkbox type="checkbox" [checked]="element.checked" (click)="onCheck(checkbox.checked)" />
|
|
3989
3559
|
</span>
|
|
3990
|
-
<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>
|
|
3560
|
+
<span><slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children></span>
|
|
3991
3561
|
`, isInline: true, components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
3992
3562
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheTodoItemComponent, decorators: [{
|
|
3993
3563
|
type: Component,
|
|
@@ -3997,7 +3567,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
3997
3567
|
<span contenteditable="false" class="todo-item-status">
|
|
3998
3568
|
<input #checkbox type="checkbox" [checked]="element.checked" (click)="onCheck(checkbox.checked)" />
|
|
3999
3569
|
</span>
|
|
4000
|
-
<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>
|
|
3570
|
+
<span><slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children></span>
|
|
4001
3571
|
`
|
|
4002
3572
|
}]
|
|
4003
3573
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { checkItemClass: [{
|
|
@@ -4243,126 +3813,523 @@ const withNodeID = ({ idKey = 'id', idCreator = () => Date.now(), filterText = t
|
|
|
4243
3813
|
});
|
|
4244
3814
|
return apply(Object.assign(Object.assign({}, operation), { node }));
|
|
4245
3815
|
}
|
|
4246
|
-
if (operation.type === 'split_node' && (!filterText || operation.properties.type)) {
|
|
4247
|
-
let id = operation.properties[idKey];
|
|
4248
|
-
if (editor.removedIDs.has(id)) {
|
|
4249
|
-
editor.removedIDs.delete(id);
|
|
4250
|
-
}
|
|
4251
|
-
else {
|
|
4252
|
-
id = idCreator();
|
|
3816
|
+
if (operation.type === 'split_node' && (!filterText || operation.properties.type)) {
|
|
3817
|
+
let id = operation.properties[idKey];
|
|
3818
|
+
if (editor.removedIDs.has(id)) {
|
|
3819
|
+
editor.removedIDs.delete(id);
|
|
3820
|
+
}
|
|
3821
|
+
else {
|
|
3822
|
+
id = idCreator();
|
|
3823
|
+
}
|
|
3824
|
+
return apply(Object.assign(Object.assign({}, operation), { properties: Object.assign(Object.assign({}, operation.properties), { [idKey]: id }) }));
|
|
3825
|
+
}
|
|
3826
|
+
if (operation.type === 'merge_node' && (!filterText || operation.properties.type)) {
|
|
3827
|
+
editor.removedIDs.add(operation.properties[idKey]);
|
|
3828
|
+
}
|
|
3829
|
+
return apply(operation);
|
|
3830
|
+
};
|
|
3831
|
+
editor.getFragment = () => {
|
|
3832
|
+
const fragment = _.cloneDeep(getFragment());
|
|
3833
|
+
return deleteElementKey(fragment, idKey);
|
|
3834
|
+
};
|
|
3835
|
+
return editor;
|
|
3836
|
+
};
|
|
3837
|
+
|
|
3838
|
+
const autoFormatBlock = (editor, type, at, { preFormat, format }, markups) => {
|
|
3839
|
+
Transforms.delete(editor, { at });
|
|
3840
|
+
if (preFormat) {
|
|
3841
|
+
preFormat(editor);
|
|
3842
|
+
}
|
|
3843
|
+
if (!format) {
|
|
3844
|
+
Transforms.setNodes(editor, { type }, { match: n => Editor.isBlock(editor, n) });
|
|
3845
|
+
}
|
|
3846
|
+
else {
|
|
3847
|
+
format(editor, markups);
|
|
3848
|
+
}
|
|
3849
|
+
};
|
|
3850
|
+
|
|
3851
|
+
const autoFormatInline = (editor, { type, between, markup, ignoreTrim, format }) => {
|
|
3852
|
+
const selection = editor.selection;
|
|
3853
|
+
const startMarkup = between ? between[0] : markup;
|
|
3854
|
+
const endMarkup = between ? between[1] : '';
|
|
3855
|
+
let endMarkupPointBefore = selection.anchor;
|
|
3856
|
+
if (endMarkup) {
|
|
3857
|
+
endMarkupPointBefore = getPointBefore(editor, selection, {
|
|
3858
|
+
matchString: endMarkup
|
|
3859
|
+
});
|
|
3860
|
+
if (!endMarkupPointBefore) {
|
|
3861
|
+
return false;
|
|
3862
|
+
}
|
|
3863
|
+
}
|
|
3864
|
+
const startMarkupPointAfter = getPointBefore(editor, endMarkupPointBefore, {
|
|
3865
|
+
matchString: startMarkup,
|
|
3866
|
+
skipInvalid: true,
|
|
3867
|
+
afterMatch: true
|
|
3868
|
+
});
|
|
3869
|
+
if (!startMarkupPointAfter) {
|
|
3870
|
+
return false;
|
|
3871
|
+
}
|
|
3872
|
+
// found
|
|
3873
|
+
const markupRange = {
|
|
3874
|
+
anchor: startMarkupPointAfter,
|
|
3875
|
+
focus: endMarkupPointBefore
|
|
3876
|
+
};
|
|
3877
|
+
if (!ignoreTrim) {
|
|
3878
|
+
const markupText = getText(editor, markupRange);
|
|
3879
|
+
if (markupText.trim() !== markupText) {
|
|
3880
|
+
return false;
|
|
3881
|
+
}
|
|
3882
|
+
}
|
|
3883
|
+
// delete end markup
|
|
3884
|
+
if (endMarkup) {
|
|
3885
|
+
endMarkupPointBefore = getPointBefore(editor, selection, {
|
|
3886
|
+
matchString: endMarkup
|
|
3887
|
+
});
|
|
3888
|
+
Transforms.delete(editor, {
|
|
3889
|
+
at: {
|
|
3890
|
+
anchor: endMarkupPointBefore,
|
|
3891
|
+
focus: selection.anchor
|
|
3892
|
+
}
|
|
3893
|
+
});
|
|
3894
|
+
}
|
|
3895
|
+
const startMarkupPointBefore = getPointBefore(editor, selection, {
|
|
3896
|
+
matchString: startMarkup,
|
|
3897
|
+
skipInvalid: true
|
|
3898
|
+
});
|
|
3899
|
+
if (format) {
|
|
3900
|
+
const markupText = getText(editor, markupRange);
|
|
3901
|
+
format(editor, markupText);
|
|
3902
|
+
// delete start to end selection
|
|
3903
|
+
Transforms.delete(editor, {
|
|
3904
|
+
at: {
|
|
3905
|
+
anchor: startMarkupPointBefore,
|
|
3906
|
+
focus: selection.anchor
|
|
3907
|
+
}
|
|
3908
|
+
});
|
|
3909
|
+
}
|
|
3910
|
+
else {
|
|
3911
|
+
// add mark to the text between the markups
|
|
3912
|
+
Transforms.select(editor, markupRange);
|
|
3913
|
+
editor.addMark(type, true);
|
|
3914
|
+
Transforms.collapse(editor, { edge: 'end' });
|
|
3915
|
+
editor.removeMark(type, false);
|
|
3916
|
+
// delete start markup
|
|
3917
|
+
Transforms.delete(editor, {
|
|
3918
|
+
at: {
|
|
3919
|
+
anchor: startMarkupPointBefore,
|
|
3920
|
+
focus: startMarkupPointAfter
|
|
3921
|
+
}
|
|
3922
|
+
});
|
|
3923
|
+
}
|
|
3924
|
+
return true;
|
|
3925
|
+
};
|
|
3926
|
+
|
|
3927
|
+
const ListEditor = {
|
|
3928
|
+
isList(editor, element, type) {
|
|
3929
|
+
return Editor.isBlock(editor, element) && element.type === type;
|
|
3930
|
+
},
|
|
3931
|
+
toggleList(editor, type, startIndex) {
|
|
3932
|
+
if (!editor.selection) {
|
|
3933
|
+
return;
|
|
3934
|
+
}
|
|
3935
|
+
if (!startIndex) {
|
|
3936
|
+
startIndex = 1;
|
|
3937
|
+
}
|
|
3938
|
+
const types = [ElementKinds.bulletedList, ElementKinds.numberedList];
|
|
3939
|
+
Editor.withoutNormalizing(editor, () => {
|
|
3940
|
+
const [...listItems] = Editor.nodes(editor, {
|
|
3941
|
+
match: node => Element$1.isElement(node) && node.type === ElementKinds.listItem,
|
|
3942
|
+
mode: 'lowest'
|
|
3943
|
+
});
|
|
3944
|
+
const firstListItemPath = listItems.length && listItems[0][1];
|
|
3945
|
+
const activeListPath = listItems.length && Path.parent(firstListItemPath);
|
|
3946
|
+
const activeListNode = listItems.length && Node.get(editor, activeListPath);
|
|
3947
|
+
// 同级且类型相同:unwrap
|
|
3948
|
+
const isLowestActive = listItems.length &&
|
|
3949
|
+
listItems.every(([, path]) => activeListNode.type === type && (Path.isSibling(firstListItemPath, path) || Path.equals(firstListItemPath, path)));
|
|
3950
|
+
if (isLowestActive) {
|
|
3951
|
+
const upListItem = Path.parent(activeListPath);
|
|
3952
|
+
Transforms.unwrapNodes(editor, {
|
|
3953
|
+
at: editor.selection,
|
|
3954
|
+
match: node => node === activeListNode,
|
|
3955
|
+
split: true,
|
|
3956
|
+
mode: 'lowest'
|
|
3957
|
+
});
|
|
3958
|
+
if (upListItem && Node.get(editor, upListItem).type === ElementKinds.listItem) {
|
|
3959
|
+
Transforms.moveNodes(editor, {
|
|
3960
|
+
at: editor.selection,
|
|
3961
|
+
to: Path.next(upListItem),
|
|
3962
|
+
match: node => Element$1.isElement(node) && node.type === ElementKinds.listItem
|
|
3963
|
+
});
|
|
3964
|
+
}
|
|
3965
|
+
else {
|
|
3966
|
+
Transforms.unwrapNodes(editor, {
|
|
3967
|
+
match: node => Element$1.isElement(node) && node.type === ElementKinds.listItem
|
|
3968
|
+
});
|
|
3969
|
+
}
|
|
3970
|
+
return;
|
|
3971
|
+
}
|
|
3972
|
+
// 跨级、同级且类型不同
|
|
3973
|
+
if (activeListNode && types.includes(activeListNode.type)) {
|
|
3974
|
+
Transforms.setNodes(editor, { type }, { match: node => Element$1.isElement(node) && node.type !== type && types.includes(node.type) });
|
|
3975
|
+
return;
|
|
3976
|
+
}
|
|
3977
|
+
// wrap
|
|
3978
|
+
this.buildListItem(editor);
|
|
3979
|
+
// Todo: types
|
|
3980
|
+
Transforms.wrapNodes(editor, { type, children: [], start: startIndex }, {
|
|
3981
|
+
at: editor.selection,
|
|
3982
|
+
match: node => Element$1.isElement(node) && node.type === ElementKinds.listItem
|
|
3983
|
+
});
|
|
3984
|
+
});
|
|
3985
|
+
},
|
|
3986
|
+
unwrapList(editor) {
|
|
3987
|
+
Editor.withoutNormalizing(editor, () => {
|
|
3988
|
+
unwrapNodesByType(editor, [ElementKinds.bulletedList, ElementKinds.numberedList], { split: true, mode: 'all' });
|
|
3989
|
+
unwrapNodesByType(editor, [ElementKinds.listItem], { split: true, mode: 'all' });
|
|
3990
|
+
});
|
|
3991
|
+
},
|
|
3992
|
+
wrapList(editor, type) {
|
|
3993
|
+
Editor.withoutNormalizing(editor, () => {
|
|
3994
|
+
const listItem = {
|
|
3995
|
+
type: ElementKinds.listItem,
|
|
3996
|
+
children: []
|
|
3997
|
+
};
|
|
3998
|
+
const list = {
|
|
3999
|
+
type,
|
|
4000
|
+
children: []
|
|
4001
|
+
};
|
|
4002
|
+
Transforms.wrapNodes(editor, list, { split: true });
|
|
4003
|
+
Transforms.wrapNodes(editor, listItem, { split: true });
|
|
4004
|
+
});
|
|
4005
|
+
},
|
|
4006
|
+
isActive(editor, type) {
|
|
4007
|
+
const [match] = getNodesByType(editor, type);
|
|
4008
|
+
return !!match;
|
|
4009
|
+
},
|
|
4010
|
+
getActiveList(editor) {
|
|
4011
|
+
const [match] = getNodesByType(editor, LIST_BLOCK_TYPES);
|
|
4012
|
+
return match;
|
|
4013
|
+
},
|
|
4014
|
+
buildListItem(editor) {
|
|
4015
|
+
const nodes = Editor.nodes(editor, {
|
|
4016
|
+
match: node => Editor.isBlock(editor, node),
|
|
4017
|
+
mode: 'lowest'
|
|
4018
|
+
});
|
|
4019
|
+
for (const [node, path] of nodes) {
|
|
4020
|
+
if (!Editor.isVoid(editor, node) && Element$1.isElement(node) && node.type !== ElementKinds.paragraph) {
|
|
4021
|
+
Transforms.setNodes(editor, { type: ElementKinds.paragraph, checked: undefined }, // todo remove checked
|
|
4022
|
+
{ at: path });
|
|
4023
|
+
}
|
|
4024
|
+
else if (Element$1.isElement(node) && node.type === ElementKinds.paragraph) {
|
|
4025
|
+
let { textIndent } = node;
|
|
4026
|
+
if (textIndent) {
|
|
4027
|
+
Transforms.setNodes(editor, { textIndent: undefined, indent: undefined }, // remove indent
|
|
4028
|
+
{ at: path });
|
|
4029
|
+
}
|
|
4030
|
+
}
|
|
4031
|
+
if (Node.parent(editor, path).type !== ElementKinds.listItem) {
|
|
4032
|
+
Transforms.wrapNodes(editor, { type: ElementKinds.listItem, children: [] }, {
|
|
4033
|
+
at: path,
|
|
4034
|
+
split: true
|
|
4035
|
+
});
|
|
4036
|
+
}
|
|
4037
|
+
}
|
|
4038
|
+
},
|
|
4039
|
+
buildInsertDataChildren(node) {
|
|
4040
|
+
const { children } = node;
|
|
4041
|
+
const listItem = children[0];
|
|
4042
|
+
if (isNodeTypeList(node) && Element$1.isElement(listItem) && listItem.children[0].type === ElementKinds.paragraph) {
|
|
4043
|
+
return node;
|
|
4044
|
+
}
|
|
4045
|
+
return this.buildInsertDataChildren(listItem);
|
|
4046
|
+
}
|
|
4047
|
+
};
|
|
4048
|
+
|
|
4049
|
+
const TodoItemEditor = {
|
|
4050
|
+
isActive(editor) {
|
|
4051
|
+
const [match] = getNodesByType(editor, ElementKinds.checkItem);
|
|
4052
|
+
return !!match;
|
|
4053
|
+
},
|
|
4054
|
+
insertTodoItem(editor) {
|
|
4055
|
+
if (!editor.selection) {
|
|
4056
|
+
return;
|
|
4057
|
+
}
|
|
4058
|
+
const isActive = this.isActive(editor);
|
|
4059
|
+
const isNumberedList = ListEditor.isActive(editor, ElementKinds.numberedList);
|
|
4060
|
+
const isBulletedList = ListEditor.isActive(editor, ElementKinds.bulletedList);
|
|
4061
|
+
if (isActive) {
|
|
4062
|
+
Transforms.setNodes(editor, {
|
|
4063
|
+
type: ElementKinds.paragraph
|
|
4064
|
+
});
|
|
4065
|
+
}
|
|
4066
|
+
else {
|
|
4067
|
+
if (isNumberedList || isBulletedList) {
|
|
4068
|
+
ListEditor.unwrapList(editor);
|
|
4069
|
+
}
|
|
4070
|
+
Transforms.setNodes(editor, {
|
|
4071
|
+
type: ElementKinds.checkItem
|
|
4072
|
+
});
|
|
4073
|
+
}
|
|
4074
|
+
}
|
|
4075
|
+
};
|
|
4076
|
+
|
|
4077
|
+
const BlockquoteEditor = {
|
|
4078
|
+
toggleBlockquote(editor) {
|
|
4079
|
+
if (!isParagraph(editor)) {
|
|
4080
|
+
Transforms.insertNodes(editor, {
|
|
4081
|
+
type: ElementKinds.paragraph,
|
|
4082
|
+
mode: 'text',
|
|
4083
|
+
children: [
|
|
4084
|
+
{
|
|
4085
|
+
text: ''
|
|
4086
|
+
}
|
|
4087
|
+
]
|
|
4088
|
+
});
|
|
4089
|
+
}
|
|
4090
|
+
const isActive = isBlockActive(editor, ElementKinds.blockquote);
|
|
4091
|
+
if (!isActive) {
|
|
4092
|
+
Transforms.wrapNodes(editor, { type: ElementKinds.blockquote, children: [] }, {
|
|
4093
|
+
mode: 'lowest'
|
|
4094
|
+
});
|
|
4095
|
+
}
|
|
4096
|
+
else {
|
|
4097
|
+
Transforms.unwrapNodes(editor, { match: n => Element$1.isElement(n) && n.type === ElementKinds.blockquote });
|
|
4098
|
+
}
|
|
4099
|
+
}
|
|
4100
|
+
};
|
|
4101
|
+
|
|
4102
|
+
const InlineCodeEditor = {
|
|
4103
|
+
toggleInlineCode(editor, text) {
|
|
4104
|
+
const isActive = InlineCodeEditor.isInlineCodeActive(editor);
|
|
4105
|
+
if (isActive) {
|
|
4106
|
+
InlineCodeEditor.unwrapInlineCode(editor);
|
|
4107
|
+
return;
|
|
4108
|
+
}
|
|
4109
|
+
if (Range.isCollapsed(editor.selection)) {
|
|
4110
|
+
InlineCodeEditor.wrapInlineCode(editor, text);
|
|
4111
|
+
}
|
|
4112
|
+
else {
|
|
4113
|
+
const fragment = Node.fragment(editor, editor.selection)[0];
|
|
4114
|
+
const selectNode = Node.get(fragment, []);
|
|
4115
|
+
const selectText = Node.string(selectNode);
|
|
4116
|
+
InlineCodeEditor.wrapInlineCode(editor, selectText);
|
|
4117
|
+
}
|
|
4118
|
+
},
|
|
4119
|
+
wrapInlineCode(editor, text = '') {
|
|
4120
|
+
if (InlineCodeEditor.isInlineCodeActive(editor)) {
|
|
4121
|
+
InlineCodeEditor.unwrapInlineCode(editor);
|
|
4122
|
+
}
|
|
4123
|
+
const { selection } = editor;
|
|
4124
|
+
const isCollapsed = selection && Range.isCollapsed(selection);
|
|
4125
|
+
const inlineCode = {
|
|
4126
|
+
type: ElementKinds.inlineCode,
|
|
4127
|
+
children: isCollapsed ? [{ text: text ? text : ZERO_WIDTH_CHAR }] : []
|
|
4128
|
+
};
|
|
4129
|
+
if (isCollapsed) {
|
|
4130
|
+
Transforms.insertNodes(editor, inlineCode);
|
|
4131
|
+
}
|
|
4132
|
+
else {
|
|
4133
|
+
Transforms.wrapNodes(editor, inlineCode, { split: true });
|
|
4134
|
+
}
|
|
4135
|
+
},
|
|
4136
|
+
unwrapInlineCode(editor) {
|
|
4137
|
+
Transforms.unwrapNodes(editor, { match: n => Element$1.isElement(n) && n.type === ElementKinds.inlineCode });
|
|
4138
|
+
},
|
|
4139
|
+
isInlineCodeActive(editor, path) {
|
|
4140
|
+
var _a;
|
|
4141
|
+
const [inlineCode] = Editor.nodes(editor, {
|
|
4142
|
+
at: path ? path : (_a = editor.selection) === null || _a === void 0 ? void 0 : _a.anchor.path,
|
|
4143
|
+
match: n => Element$1.isElement(n) && n.type === ElementKinds.inlineCode
|
|
4144
|
+
});
|
|
4145
|
+
return !!inlineCode;
|
|
4146
|
+
}
|
|
4147
|
+
};
|
|
4148
|
+
|
|
4149
|
+
const HeadingEditor = {
|
|
4150
|
+
setHeading(editor, heading) {
|
|
4151
|
+
Editor.withoutNormalizing(editor, () => {
|
|
4152
|
+
const types = [ElementKinds.bulletedList, ElementKinds.numberedList, ElementKinds.listItem];
|
|
4153
|
+
Transforms.unwrapNodes(editor, {
|
|
4154
|
+
at: editor.selection,
|
|
4155
|
+
match: n => Element$1.isElement(n) && types.includes(n.type),
|
|
4156
|
+
mode: 'all',
|
|
4157
|
+
split: true
|
|
4158
|
+
});
|
|
4159
|
+
Transforms.setNodes(editor, { type: heading });
|
|
4160
|
+
const entry = anchorBlockEntry(editor);
|
|
4161
|
+
const unMarks = {
|
|
4162
|
+
[MarkTypes.fontSize]: null
|
|
4163
|
+
};
|
|
4164
|
+
if (entry) {
|
|
4165
|
+
setMarks(editor, unMarks, entry[1]);
|
|
4166
|
+
return;
|
|
4167
|
+
}
|
|
4168
|
+
setMarks(editor, unMarks, editor.selection);
|
|
4169
|
+
});
|
|
4170
|
+
},
|
|
4171
|
+
isHeadingActive(editor, heading) {
|
|
4172
|
+
const [match] = Editor.nodes(editor, {
|
|
4173
|
+
match: n => Element$1.isElement(n) && n.type === heading,
|
|
4174
|
+
universal: true
|
|
4175
|
+
});
|
|
4176
|
+
return !!match;
|
|
4177
|
+
}
|
|
4178
|
+
};
|
|
4179
|
+
|
|
4180
|
+
const defaultAutoFormatRules = [
|
|
4181
|
+
{
|
|
4182
|
+
type: ElementKinds.heading_1,
|
|
4183
|
+
markup: '#',
|
|
4184
|
+
format: (editor) => {
|
|
4185
|
+
HeadingEditor.setHeading(editor, ElementKinds.heading_1);
|
|
4186
|
+
}
|
|
4187
|
+
},
|
|
4188
|
+
{
|
|
4189
|
+
type: ElementKinds.heading_2,
|
|
4190
|
+
markup: '##',
|
|
4191
|
+
format: (editor) => {
|
|
4192
|
+
HeadingEditor.setHeading(editor, ElementKinds.heading_2);
|
|
4193
|
+
}
|
|
4194
|
+
},
|
|
4195
|
+
{
|
|
4196
|
+
type: ElementKinds.heading_3,
|
|
4197
|
+
markup: '###',
|
|
4198
|
+
format: (editor) => {
|
|
4199
|
+
HeadingEditor.setHeading(editor, ElementKinds.heading_3);
|
|
4200
|
+
}
|
|
4201
|
+
},
|
|
4202
|
+
{
|
|
4203
|
+
type: ElementKinds.heading_4,
|
|
4204
|
+
markup: '####',
|
|
4205
|
+
format: (editor) => {
|
|
4206
|
+
HeadingEditor.setHeading(editor, ElementKinds.heading_4);
|
|
4207
|
+
}
|
|
4208
|
+
},
|
|
4209
|
+
{
|
|
4210
|
+
type: ElementKinds.heading_5,
|
|
4211
|
+
markup: '#####',
|
|
4212
|
+
format: (editor) => {
|
|
4213
|
+
HeadingEditor.setHeading(editor, ElementKinds.heading_5);
|
|
4214
|
+
}
|
|
4215
|
+
},
|
|
4216
|
+
{
|
|
4217
|
+
type: ElementKinds.heading_6,
|
|
4218
|
+
markup: '######',
|
|
4219
|
+
format: (editor) => {
|
|
4220
|
+
HeadingEditor.setHeading(editor, ElementKinds.heading_6);
|
|
4221
|
+
}
|
|
4222
|
+
},
|
|
4223
|
+
{
|
|
4224
|
+
type: ElementKinds.blockquote,
|
|
4225
|
+
markup: ['>'],
|
|
4226
|
+
format: (editor) => {
|
|
4227
|
+
BlockquoteEditor.toggleBlockquote(editor);
|
|
4228
|
+
}
|
|
4229
|
+
},
|
|
4230
|
+
{
|
|
4231
|
+
type: MarkTypes.bold,
|
|
4232
|
+
between: ['**', '**'],
|
|
4233
|
+
mode: 'inline',
|
|
4234
|
+
insertTrigger: true
|
|
4235
|
+
},
|
|
4236
|
+
{
|
|
4237
|
+
type: MarkTypes.bold,
|
|
4238
|
+
between: ['__', '__'],
|
|
4239
|
+
mode: 'inline',
|
|
4240
|
+
insertTrigger: true
|
|
4241
|
+
},
|
|
4242
|
+
{
|
|
4243
|
+
type: MarkTypes.italic,
|
|
4244
|
+
between: ['*', '*'],
|
|
4245
|
+
mode: 'inline',
|
|
4246
|
+
insertTrigger: true
|
|
4247
|
+
},
|
|
4248
|
+
{
|
|
4249
|
+
type: MarkTypes.italic,
|
|
4250
|
+
between: ['_', '_'],
|
|
4251
|
+
mode: 'inline',
|
|
4252
|
+
insertTrigger: true
|
|
4253
|
+
},
|
|
4254
|
+
{
|
|
4255
|
+
type: ElementKinds.inlineCode,
|
|
4256
|
+
between: ['`', '`'],
|
|
4257
|
+
mode: 'inline',
|
|
4258
|
+
format: (editor, text) => {
|
|
4259
|
+
InlineCodeEditor.toggleInlineCode(editor, text);
|
|
4260
|
+
Transforms.select(editor, Editor.after(editor, editor.selection));
|
|
4261
|
+
}
|
|
4262
|
+
},
|
|
4263
|
+
{
|
|
4264
|
+
type: MarkTypes.strike,
|
|
4265
|
+
between: ['~~', '~~'],
|
|
4266
|
+
mode: 'inline',
|
|
4267
|
+
insertTrigger: true
|
|
4268
|
+
},
|
|
4269
|
+
{
|
|
4270
|
+
type: ElementKinds.code,
|
|
4271
|
+
markup: '```',
|
|
4272
|
+
insertTrigger: true
|
|
4273
|
+
},
|
|
4274
|
+
{
|
|
4275
|
+
type: ElementKinds.listItem,
|
|
4276
|
+
markup: [],
|
|
4277
|
+
match: (editor) => {
|
|
4278
|
+
return isParagraph(editor) ? ['*', '-', '+'] : [];
|
|
4279
|
+
},
|
|
4280
|
+
format: (editor) => {
|
|
4281
|
+
ListEditor.toggleList(editor, ElementKinds.bulletedList);
|
|
4282
|
+
}
|
|
4283
|
+
},
|
|
4284
|
+
{
|
|
4285
|
+
type: ElementKinds.listItem,
|
|
4286
|
+
key: ElementKinds.numberedList,
|
|
4287
|
+
markup: [],
|
|
4288
|
+
match: (editor, textFromBlockStart) => {
|
|
4289
|
+
return isParagraph(editor) && /^-?\d+(\.|\))$/.test(textFromBlockStart) ? [textFromBlockStart] : [];
|
|
4290
|
+
},
|
|
4291
|
+
format: (editor, markup) => {
|
|
4292
|
+
let startIndex = 1;
|
|
4293
|
+
if (markup) {
|
|
4294
|
+
startIndex = markup[0].split('.')[0];
|
|
4295
|
+
if (startIndex === 0) {
|
|
4296
|
+
startIndex = 1;
|
|
4297
|
+
}
|
|
4253
4298
|
}
|
|
4254
|
-
|
|
4255
|
-
}
|
|
4256
|
-
if (operation.type === 'merge_node' && (!filterText || operation.properties.type)) {
|
|
4257
|
-
editor.removedIDs.add(operation.properties[idKey]);
|
|
4258
|
-
}
|
|
4259
|
-
return apply(operation);
|
|
4260
|
-
};
|
|
4261
|
-
editor.getFragment = () => {
|
|
4262
|
-
const fragment = _.cloneDeep(getFragment());
|
|
4263
|
-
return deleteElementKey(fragment, idKey);
|
|
4264
|
-
};
|
|
4265
|
-
return editor;
|
|
4266
|
-
};
|
|
4267
|
-
|
|
4268
|
-
const autoFormatBlock = (editor, type, at, { preFormat, format }, markups) => {
|
|
4269
|
-
Transforms.delete(editor, { at });
|
|
4270
|
-
if (preFormat) {
|
|
4271
|
-
preFormat(editor);
|
|
4272
|
-
}
|
|
4273
|
-
if (!format) {
|
|
4274
|
-
Transforms.setNodes(editor, { type }, { match: n => Editor.isBlock(editor, n) });
|
|
4275
|
-
}
|
|
4276
|
-
else {
|
|
4277
|
-
format(editor, markups);
|
|
4278
|
-
}
|
|
4279
|
-
};
|
|
4280
|
-
|
|
4281
|
-
const autoFormatInline = (editor, { type, between, markup, ignoreTrim, format }) => {
|
|
4282
|
-
const selection = editor.selection;
|
|
4283
|
-
const startMarkup = between ? between[0] : markup;
|
|
4284
|
-
const endMarkup = between ? between[1] : '';
|
|
4285
|
-
let endMarkupPointBefore = selection.anchor;
|
|
4286
|
-
if (endMarkup) {
|
|
4287
|
-
endMarkupPointBefore = getPointBefore(editor, selection, {
|
|
4288
|
-
matchString: endMarkup
|
|
4289
|
-
});
|
|
4290
|
-
if (!endMarkupPointBefore) {
|
|
4291
|
-
return false;
|
|
4299
|
+
ListEditor.toggleList(editor, ElementKinds.numberedList, startIndex);
|
|
4292
4300
|
}
|
|
4293
|
-
}
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
// found
|
|
4303
|
-
const markupRange = {
|
|
4304
|
-
anchor: startMarkupPointAfter,
|
|
4305
|
-
focus: endMarkupPointBefore
|
|
4306
|
-
};
|
|
4307
|
-
if (!ignoreTrim) {
|
|
4308
|
-
const markupText = getText(editor, markupRange);
|
|
4309
|
-
if (markupText.trim() !== markupText) {
|
|
4310
|
-
return false;
|
|
4301
|
+
},
|
|
4302
|
+
{
|
|
4303
|
+
type: ElementKinds.checkItem,
|
|
4304
|
+
markup: [],
|
|
4305
|
+
match: (editor) => {
|
|
4306
|
+
return isParagraph(editor) ? ['[]'] : [];
|
|
4307
|
+
},
|
|
4308
|
+
format: (editor) => {
|
|
4309
|
+
TodoItemEditor.insertTodoItem(editor);
|
|
4311
4310
|
}
|
|
4311
|
+
},
|
|
4312
|
+
{
|
|
4313
|
+
type: ElementKinds.hr,
|
|
4314
|
+
markup: '---',
|
|
4315
|
+
insertTrigger: true
|
|
4312
4316
|
}
|
|
4313
|
-
|
|
4314
|
-
if (endMarkup) {
|
|
4315
|
-
endMarkupPointBefore = getPointBefore(editor, selection, {
|
|
4316
|
-
matchString: endMarkup
|
|
4317
|
-
});
|
|
4318
|
-
Transforms.delete(editor, {
|
|
4319
|
-
at: {
|
|
4320
|
-
anchor: endMarkupPointBefore,
|
|
4321
|
-
focus: selection.anchor
|
|
4322
|
-
}
|
|
4323
|
-
});
|
|
4324
|
-
}
|
|
4325
|
-
const startMarkupPointBefore = getPointBefore(editor, selection, {
|
|
4326
|
-
matchString: startMarkup,
|
|
4327
|
-
skipInvalid: true
|
|
4328
|
-
});
|
|
4329
|
-
if (format) {
|
|
4330
|
-
const markupText = getText(editor, markupRange);
|
|
4331
|
-
format(editor, markupText);
|
|
4332
|
-
// delete start to end selection
|
|
4333
|
-
Transforms.delete(editor, {
|
|
4334
|
-
at: {
|
|
4335
|
-
anchor: startMarkupPointBefore,
|
|
4336
|
-
focus: selection.anchor
|
|
4337
|
-
}
|
|
4338
|
-
});
|
|
4339
|
-
}
|
|
4340
|
-
else {
|
|
4341
|
-
// add mark to the text between the markups
|
|
4342
|
-
Transforms.select(editor, markupRange);
|
|
4343
|
-
editor.addMark(type, true);
|
|
4344
|
-
Transforms.collapse(editor, { edge: 'end' });
|
|
4345
|
-
editor.removeMark(type, false);
|
|
4346
|
-
// delete start markup
|
|
4347
|
-
Transforms.delete(editor, {
|
|
4348
|
-
at: {
|
|
4349
|
-
anchor: startMarkupPointBefore,
|
|
4350
|
-
focus: startMarkupPointAfter
|
|
4351
|
-
}
|
|
4352
|
-
});
|
|
4353
|
-
}
|
|
4354
|
-
return true;
|
|
4355
|
-
};
|
|
4317
|
+
];
|
|
4356
4318
|
|
|
4357
|
-
const withAutoFormat = (
|
|
4319
|
+
const withAutoFormat = () => (editor) => {
|
|
4358
4320
|
const { insertText } = editor;
|
|
4359
4321
|
editor.insertText = text => {
|
|
4360
|
-
var _a;
|
|
4322
|
+
var _a, _b;
|
|
4323
|
+
let autoFormatRules = defaultAutoFormatRules;
|
|
4324
|
+
if ((_a = editor.extraAutoFormatRules) === null || _a === void 0 ? void 0 : _a.length) {
|
|
4325
|
+
const extraRules = mergAutoFormateRules(editor.extraAutoFormatRules);
|
|
4326
|
+
autoFormatRules = Object.values(extraRules);
|
|
4327
|
+
}
|
|
4361
4328
|
if (!isCollapsed(editor.selection)) {
|
|
4362
4329
|
return insertText(text);
|
|
4363
4330
|
}
|
|
4364
|
-
for (let
|
|
4365
|
-
const { query } =
|
|
4331
|
+
for (let _c of autoFormatRules) {
|
|
4332
|
+
const { query } = _c, rule = __rest(_c, ["query"]);
|
|
4366
4333
|
const { trigger = ' ', mode = 'block', type, markup, preFormat, format, match, between, ignoreTrim, insertTrigger, allowSameTypeAbove = false, triggerAtBlockStart = true } = rule;
|
|
4367
4334
|
if (query && !query(editor, rule))
|
|
4368
4335
|
continue;
|
|
@@ -4397,7 +4364,7 @@ const withAutoFormat = ({ rules }) => (editor) => {
|
|
|
4397
4364
|
});
|
|
4398
4365
|
if (!markupRange)
|
|
4399
4366
|
continue;
|
|
4400
|
-
const blockAbovePath = (
|
|
4367
|
+
const blockAbovePath = (_b = getBlockAbove(editor)) === null || _b === void 0 ? void 0 : _b[1];
|
|
4401
4368
|
if (!blockAbovePath)
|
|
4402
4369
|
continue;
|
|
4403
4370
|
// If the markup is not at the start, insert break before autoformatting.
|
|
@@ -4434,6 +4401,17 @@ const withAutoFormat = ({ rules }) => (editor) => {
|
|
|
4434
4401
|
};
|
|
4435
4402
|
return editor;
|
|
4436
4403
|
};
|
|
4404
|
+
const mergAutoFormateRules = (extraAutoFormatRules) => {
|
|
4405
|
+
const combinationData = [...defaultAutoFormatRules, ...extraAutoFormatRules];
|
|
4406
|
+
const dataInfo = {};
|
|
4407
|
+
combinationData.forEach(item => {
|
|
4408
|
+
if (!dataInfo[item.type + item.key]) {
|
|
4409
|
+
dataInfo[item.type + item.key] = Object.assign({}, item);
|
|
4410
|
+
}
|
|
4411
|
+
dataInfo[item.type + item.key] = Object.assign(Object.assign({}, dataInfo[item.type + item.key]), item);
|
|
4412
|
+
});
|
|
4413
|
+
return dataInfo;
|
|
4414
|
+
};
|
|
4437
4415
|
|
|
4438
4416
|
const withTransforms = () => (editor) => {
|
|
4439
4417
|
const e = editor;
|
|
@@ -6190,7 +6168,7 @@ class TheColorSelectComponent {
|
|
|
6190
6168
|
}
|
|
6191
6169
|
}
|
|
6192
6170
|
TheColorSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheColorSelectComponent, deps: [{ token: i1$3.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
6193
|
-
TheColorSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheColorSelectComponent, selector: "the-color-select", inputs: { selectedColor: "selectedColor", selectAction: "selectAction", showCustom: "showCustom", colors: "colors", option: "option" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)", "mousedown": "handleMouseDown($event)", "keydown": "handleKeydown($event)" } }, ngImport: i0, template: "<div class=\"color-container\">\n <div class=\"colors\">\n <div *ngFor=\"let row of selectColors; let rowIndex = index\">\n <span\n class=\"color-item\"\n *ngFor=\"let _color of row.rowValue; let i = index\"\n [ngClass]=\"_color.classMaps\"\n (mousedown)=\"_selectColor($event, _color.value)\"\n >\n <span [ngStyle]=\"{ background: _color.value }\">\n <thy-icon thyIconName=\"check\" [ngStyle]=\"{ color: row.tickColor }\"></thy-icon>\n </span>\n </span>\n </div>\n </div>\n <div *ngIf=\"option.showCustom\" class=\"select-color\">\n <span class=\"color\" [ngStyle]=\"{ background: selectedColor }\"></span>\n #\n <input\n thyInput\n maxlength=\"6\"\n (keydown.enter)=\"customInputColorEnter($event)\"\n onkeyup=\"value=value.replace(/[^0-9A-Fa-f]/g,'')\"\n class=\"value\"\n [(ngModel)]=\"customColor\"\n (ngModelChange)=\"colorChange(false)\"\n />\n </div>\n</div>\n", components: [{ type:
|
|
6171
|
+
TheColorSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheColorSelectComponent, selector: "the-color-select", inputs: { selectedColor: "selectedColor", selectAction: "selectAction", showCustom: "showCustom", colors: "colors", option: "option" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)", "mousedown": "handleMouseDown($event)", "keydown": "handleKeydown($event)" } }, ngImport: i0, template: "<div class=\"color-container\">\n <div class=\"colors\">\n <div *ngFor=\"let row of selectColors; let rowIndex = index\">\n <span\n class=\"color-item\"\n *ngFor=\"let _color of row.rowValue; let i = index\"\n [ngClass]=\"_color.classMaps\"\n (mousedown)=\"_selectColor($event, _color.value)\"\n >\n <span [ngStyle]=\"{ background: _color.value }\">\n <thy-icon thyIconName=\"check\" [ngStyle]=\"{ color: row.tickColor }\"></thy-icon>\n </span>\n </span>\n </div>\n </div>\n <div *ngIf=\"option.showCustom\" class=\"select-color\">\n <span class=\"color\" [ngStyle]=\"{ background: selectedColor }\"></span>\n #\n <input\n thyInput\n maxlength=\"6\"\n (keydown.enter)=\"customInputColorEnter($event)\"\n onkeyup=\"value=value.replace(/[^0-9A-Fa-f]/g,'')\"\n class=\"value\"\n [(ngModel)]=\"customColor\"\n (ngModelChange)=\"colorChange(false)\"\n />\n </div>\n</div>\n", components: [{ type: i3.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5$1.ThyInputDirective, selector: "[thyInput]", inputs: ["thySize", "thyAutocomplete"] }, { type: i4.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6194
6172
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheColorSelectComponent, decorators: [{
|
|
6195
6173
|
type: Component,
|
|
6196
6174
|
args: [{
|
|
@@ -6404,7 +6382,7 @@ TheColorToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12
|
|
|
6404
6382
|
thyIconName="caret-down"
|
|
6405
6383
|
></thy-icon>
|
|
6406
6384
|
</a>
|
|
6407
|
-
`, isInline: true, components: [{ type: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type:
|
|
6385
|
+
`, isInline: true, components: [{ type: i3$1.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i3.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i5.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
6408
6386
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheColorToolbarItemComponent, decorators: [{
|
|
6409
6387
|
type: Component,
|
|
6410
6388
|
args: [{
|
|
@@ -6680,7 +6658,7 @@ class TheToolbarDropdownComponent extends TheToolbarBaseItemComponent {
|
|
|
6680
6658
|
}
|
|
6681
6659
|
}
|
|
6682
6660
|
TheToolbarDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheToolbarDropdownComponent, deps: [{ token: i0.ElementRef }, { token: i1$3.ThyPopover }, { token: i0.ViewContainerRef }, { token: i2.Overlay }], target: i0.ɵɵFactoryTarget.Component });
|
|
6683
|
-
TheToolbarDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: { toolbarItem: "toolbarItem", menus: "menus", mode: "mode", item: "item", itemMousedownHandle: "itemMousedownHandle" }, host: { listeners: { "mousedown": "toggleDropdown($event)", "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class.disabled": "this.disabledState" }, classAttribute: "the-toolbar-dropdown-container" }, viewQueries: [{ propertyName: "iconModeTemplate", first: true, predicate: ["iconModeTemplate"], descendants: true, static: true }, { propertyName: "textModeTemplate", first: true, predicate: ["textModeTemplate"], descendants: true, static: true }, { propertyName: "dropdownTemplate", first: true, predicate: ["dropdownTemplate"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n\n<ng-template #iconModeTemplate>\n <a thyIconNavLink class=\"icon-mode link-with-down\" [thyTooltip]=\"activeMenu?.name\" thyTooltipPlacement=\"top\">\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n </a>\n</ng-template>\n\n<ng-template #textModeTemplate>\n <a thyIconNavLink class=\"text-mode\" [thyTooltip]=\"activeMenu?.name\" thyTooltipPlacement=\"top\">\n <span class=\"show-text\">{{ activeMenu?.name }}</span>\n <thy-icon class=\"text-caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n </a>\n</ng-template>\n\n<ng-template #dropdownTemplate>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let menu of menus\">\n <a\n *ngIf=\"menu.key !== 'split'\"\n thyActionMenuItem\n href=\"javascript:;\"\n [thyActionMenuItemActive]=\"menu.key === activeMenu.key\"\n (mousedown)=\"itemMousedown($event, menu)\"\n [ngStyle]=\"menu?.styles\"\n >\n <span *ngIf=\"menu.icon && mode === dropdownMode.icon\" thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu.icon\"></thy-icon>\n </span>\n <span *ngIf=\"menu.name\" thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n <thy-action-menu-divider *ngIf=\"menu.key === 'split'\"></thy-action-menu-divider>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type:
|
|
6661
|
+
TheToolbarDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: { toolbarItem: "toolbarItem", menus: "menus", mode: "mode", item: "item", itemMousedownHandle: "itemMousedownHandle" }, host: { listeners: { "mousedown": "toggleDropdown($event)", "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class.disabled": "this.disabledState" }, classAttribute: "the-toolbar-dropdown-container" }, viewQueries: [{ propertyName: "iconModeTemplate", first: true, predicate: ["iconModeTemplate"], descendants: true, static: true }, { propertyName: "textModeTemplate", first: true, predicate: ["textModeTemplate"], descendants: true, static: true }, { propertyName: "dropdownTemplate", first: true, predicate: ["dropdownTemplate"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n\n<ng-template #iconModeTemplate>\n <a thyIconNavLink class=\"icon-mode link-with-down\" [thyTooltip]=\"activeMenu?.name\" thyTooltipPlacement=\"top\">\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n </a>\n</ng-template>\n\n<ng-template #textModeTemplate>\n <a thyIconNavLink class=\"text-mode\" [thyTooltip]=\"activeMenu?.name\" thyTooltipPlacement=\"top\">\n <span class=\"show-text\">{{ activeMenu?.name }}</span>\n <thy-icon class=\"text-caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n </a>\n</ng-template>\n\n<ng-template #dropdownTemplate>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let menu of menus\">\n <a\n *ngIf=\"menu.key !== 'split'\"\n thyActionMenuItem\n href=\"javascript:;\"\n [thyActionMenuItemActive]=\"menu.key === activeMenu.key\"\n (mousedown)=\"itemMousedown($event, menu)\"\n [ngStyle]=\"menu?.styles\"\n >\n <span *ngIf=\"menu.icon && mode === dropdownMode.icon\" thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu.icon\"></thy-icon>\n </span>\n <span *ngIf=\"menu.name\" thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n <thy-action-menu-divider *ngIf=\"menu.key === 'split'\"></thy-action-menu-divider>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i3$1.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i3.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i2$1.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }, { type: i2$1.ThyActionMenuDividerComponent, selector: "thy-action-menu-divider", inputs: ["thyTitle", "thyType"] }], directives: [{ type: i10.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i5.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i2$1.ThyActionMenuItemActiveDirective, selector: "[thyActionMenuItemActive]", inputs: ["thyActionMenuItemActive"] }, { type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i2$1.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i2$1.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
|
|
6684
6662
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheToolbarDropdownComponent, decorators: [{
|
|
6685
6663
|
type: Component,
|
|
6686
6664
|
args: [{
|
|
@@ -6922,7 +6900,7 @@ class TheCodeComponent extends TheBaseElementComponent {
|
|
|
6922
6900
|
}
|
|
6923
6901
|
}
|
|
6924
6902
|
TheCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheCodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$4.ThyNotifyService }, { token: TheContextService }, { token: i0.NgZone }, { token: THE_CODE_MODE_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
|
|
6925
|
-
TheCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheCodeComponent, selector: "div[theCode]", viewQueries: [{ propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: CodeMirrorComponent }], usesInheritance: true, ngImport: i0, template: "<div contenteditable=\"false\" class=\"the-code-block-operation\" *ngIf=\"isCollapsed && codemirror && !options.readOnly\">\n <thy-icon-nav>\n <the-toolbar-dropdown [menus]=\"menus\" [item]=\"actives\" [itemMousedownHandle]=\"onChangeLangulage\"> </the-toolbar-dropdown>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"copy\"\n thyTooltip=\"\u590D\u5236\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onCopy($event)\"\n ></a>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"trash\"\n thyTooltip=\"\u5220\u9664\"\n class=\"remove-link\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onDelete($event)\"\n ></a>\n <nav-split-line [mode]=\"ToolbarItemMode.vertical\"></nav-split-line>\n <span class=\"auto-wrap d-flex align-items-center\">\n <span>\u81EA\u52A8\u6362\u884C</span>\n <thy-switch\n class=\"auto-wrap-btn d-flex\"\n [(ngModel)]=\"options.lineWrapping\"\n (ngModelChange)=\"onChangeWrap($event)\"\n thySize=\"sm\"\n ></thy-switch>\n </span>\n </thy-icon-nav>\n</div>\n\n<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n\n<!-- \u53EA\u8BFB\u6A21\u5F0F\u4E0BCodeMirror-sizer\u9AD8\u5EA6\u6BD4\u7F16\u8F91\u6A21\u5F0F\u4E0B\u591A2px\uFF0C\u8BBE\u7F6EthyMinHeight\u4E3A46px\u9632\u6B62\u62D6\u62FD\u5230\u6700\u5C0F\u9AD8\u5EA6\u65F6\u53EA\u8BFB\u6A21\u5F0F\u4E0B\u51FA\u73B0\u6EDA\u52A8\u6761 -->\n<div\n thyResizable\n [thyMinHeight]=\"46\"\n [thyBounds]=\"resizeBounds\"\n [style.height.px]=\"resizeHeight\"\n (thyResize)=\"onResize($event)\"\n (thyResizeEnd)=\"onEndResize()\"\n class=\"resize-code-container\"\n [ngClass]=\"{ focus: isCollapsed, readonly: options.readOnly, active: isHightLight && isCollapsed }\"\n>\n <ng-codemirror\n *ngIf=\"startRenderCodemirror\"\n #codemirror\n contenteditable=\"false\"\n class=\"ng-codemirror-wrapper\"\n [ngStyle]=\"{ maxHeight: maxHeight > 0 ? maxHeight + 'px' : 'auto' }\"\n [options]=\"options\"\n [ngModel]=\"code\"\n [delayRefreshTime]=\"300\"\n (ngModelChange)=\"codeChange($event)\"\n (focusChange)=\"focusChange($event)\"\n [autoMaxHeight]=\"maxHeight\"\n >\n </ng-codemirror>\n <thy-resize-handle thyDirection=\"bottom\" class=\"code-resize-icon\" *ngIf=\"isCollapsed && !options.readOnly\"></thy-resize-handle>\n</div>\n", components: [{ type: i3.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: ["toolbarItem", "menus", "mode", "item", "itemMousedownHandle"] }, { type: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }, { type: i6$1.ThySwitchComponent, selector: "thy-switch", inputs: ["thyType", "thySize", "thyDisabled"], outputs: ["thyChange"] }, { type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i8.CodeMirrorComponent, selector: "ng-codemirror, [ngCodeMirror]", inputs: ["autoMaxHeight", "delayRefreshTime", "options"], outputs: ["focusChange"] }, { type: i9.ThyResizeHandleComponent, selector: "thy-resize-handle, [thy-resize-handle]", inputs: ["thyDirection"], outputs: ["thyMouseDown"], exportAs: ["thyResizeHandle"] }], directives: [{ type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i4
|
|
6903
|
+
TheCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheCodeComponent, selector: "div[theCode]", viewQueries: [{ propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: CodeMirrorComponent }], usesInheritance: true, ngImport: i0, template: "<div contenteditable=\"false\" class=\"the-code-block-operation\" *ngIf=\"isCollapsed && codemirror && !options.readOnly\">\n <thy-icon-nav>\n <the-toolbar-dropdown [menus]=\"menus\" [item]=\"actives\" [itemMousedownHandle]=\"onChangeLangulage\"> </the-toolbar-dropdown>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"copy\"\n thyTooltip=\"\u590D\u5236\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onCopy($event)\"\n ></a>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"trash\"\n thyTooltip=\"\u5220\u9664\"\n class=\"remove-link\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onDelete($event)\"\n ></a>\n <nav-split-line [mode]=\"ToolbarItemMode.vertical\"></nav-split-line>\n <span class=\"auto-wrap d-flex align-items-center\">\n <span>\u81EA\u52A8\u6362\u884C</span>\n <thy-switch\n class=\"auto-wrap-btn d-flex\"\n [(ngModel)]=\"options.lineWrapping\"\n (ngModelChange)=\"onChangeWrap($event)\"\n thySize=\"sm\"\n ></thy-switch>\n </span>\n </thy-icon-nav>\n</div>\n\n<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n\n<!-- \u53EA\u8BFB\u6A21\u5F0F\u4E0BCodeMirror-sizer\u9AD8\u5EA6\u6BD4\u7F16\u8F91\u6A21\u5F0F\u4E0B\u591A2px\uFF0C\u8BBE\u7F6EthyMinHeight\u4E3A46px\u9632\u6B62\u62D6\u62FD\u5230\u6700\u5C0F\u9AD8\u5EA6\u65F6\u53EA\u8BFB\u6A21\u5F0F\u4E0B\u51FA\u73B0\u6EDA\u52A8\u6761 -->\n<div\n thyResizable\n [thyMinHeight]=\"46\"\n [thyBounds]=\"resizeBounds\"\n [style.height.px]=\"resizeHeight\"\n (thyResize)=\"onResize($event)\"\n (thyResizeEnd)=\"onEndResize()\"\n class=\"resize-code-container\"\n [ngClass]=\"{ focus: isCollapsed, readonly: options.readOnly, active: isHightLight && isCollapsed }\"\n>\n <ng-codemirror\n *ngIf=\"startRenderCodemirror\"\n #codemirror\n contenteditable=\"false\"\n class=\"ng-codemirror-wrapper\"\n [ngStyle]=\"{ maxHeight: maxHeight > 0 ? maxHeight + 'px' : 'auto' }\"\n [options]=\"options\"\n [ngModel]=\"code\"\n [delayRefreshTime]=\"300\"\n (ngModelChange)=\"codeChange($event)\"\n (focusChange)=\"focusChange($event)\"\n [autoMaxHeight]=\"maxHeight\"\n >\n </ng-codemirror>\n <thy-resize-handle thyDirection=\"bottom\" class=\"code-resize-icon\" *ngIf=\"isCollapsed && !options.readOnly\"></thy-resize-handle>\n</div>\n", components: [{ type: i3$1.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: ["toolbarItem", "menus", "mode", "item", "itemMousedownHandle"] }, { type: i3$1.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }, { type: i6$1.ThySwitchComponent, selector: "thy-switch", inputs: ["thyType", "thySize", "thyDisabled"], outputs: ["thyChange"] }, { type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i8.CodeMirrorComponent, selector: "ng-codemirror, [ngCodeMirror]", inputs: ["autoMaxHeight", "delayRefreshTime", "options"], outputs: ["focusChange"] }, { type: i9.ThyResizeHandleComponent, selector: "thy-resize-handle, [thy-resize-handle]", inputs: ["thyDirection"], outputs: ["thyMouseDown"], exportAs: ["thyResizeHandle"] }], directives: [{ type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i9.ThyResizableDirective, selector: "[thyResizable]", inputs: ["thyBounds", "thyMaxHeight", "thyMaxWidth", "thyMinHeight", "thyMinWidth", "thyGridColumnCount", "thyMaxColumn", "thyMinColumn", "thyLockAspectRatio", "thyPreview", "thyDisabled"], outputs: ["thyResize", "thyResizeEnd", "thyResizeStart"] }, { type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6926
6904
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheCodeComponent, decorators: [{
|
|
6927
6905
|
type: Component,
|
|
6928
6906
|
args: [{
|
|
@@ -7146,7 +7124,7 @@ class TheLinkEditComponent {
|
|
|
7146
7124
|
}
|
|
7147
7125
|
}
|
|
7148
7126
|
TheLinkEditComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheLinkEditComponent, deps: [{ token: i1$3.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
7149
|
-
TheLinkEditComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheLinkEditComponent, selector: "the-link-edit", inputs: { tag: "tag", node: "node", link: "link", text: "text", originSelection: "originSelection" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class": "this.className" } }, ngImport: i0, template: "<form\n thyForm\n #linkForm=\"thyForm\"\n [thyFormValidatorConfig]=\"validatorConfig\"\n name=\"linkForm\"\n>\n <thy-form-group thyLabelText=\"\u6587\u672C\">\n <input\n thyInput\n placeholder=\"\u8BF7\u8F93\u5165\u6587\u672C\"\n required\n name=\"text\"\n [(ngModel)]=\"text\"\n thyAutofocus\n type=\"text\"\n />\n </thy-form-group>\n <thy-form-group thyLabelText=\"\u94FE\u63A5\">\n <input\n name=\"link\"\n thyInput\n placeholder=\"\u8BF7\u8F93\u5165\u94FE\u63A5\"\n required\n type=\"text\"\n #linkControl=\"ngModel\"\n [(ngModel)]=\"link\"\n />\n </thy-form-group>\n <thy-form-group-footer>\n <div class=\"btn-pair\">\n <button\n thyButton=\"link-secondary\"\n thySize=\"sm\"\n (click)=\"closePopover()\"\n >\u53D6\u6D88</button>\n <button\n thyButton=\"primary-square\"\n thySize=\"sm\"\n (thyFormSubmit)=\"applyLink(linkForm)\"\n >\u5E94\u7528</button>\n </div>\n </thy-form-group-footer>\n</form>\n", components: [{ type: i2$
|
|
7127
|
+
TheLinkEditComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheLinkEditComponent, selector: "the-link-edit", inputs: { tag: "tag", node: "node", link: "link", text: "text", originSelection: "originSelection" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class": "this.className" } }, ngImport: i0, template: "<form\n thyForm\n #linkForm=\"thyForm\"\n [thyFormValidatorConfig]=\"validatorConfig\"\n name=\"linkForm\"\n>\n <thy-form-group thyLabelText=\"\u6587\u672C\">\n <input\n thyInput\n placeholder=\"\u8BF7\u8F93\u5165\u6587\u672C\"\n required\n name=\"text\"\n [(ngModel)]=\"text\"\n thyAutofocus\n type=\"text\"\n />\n </thy-form-group>\n <thy-form-group thyLabelText=\"\u94FE\u63A5\">\n <input\n name=\"link\"\n thyInput\n placeholder=\"\u8BF7\u8F93\u5165\u94FE\u63A5\"\n required\n type=\"text\"\n #linkControl=\"ngModel\"\n [(ngModel)]=\"link\"\n />\n </thy-form-group>\n <thy-form-group-footer>\n <div class=\"btn-pair\">\n <button\n thyButton=\"link-secondary\"\n thySize=\"sm\"\n (click)=\"closePopover()\"\n >\u53D6\u6D88</button>\n <button\n thyButton=\"primary-square\"\n thySize=\"sm\"\n (thyFormSubmit)=\"applyLink(linkForm)\"\n >\u5E94\u7528</button>\n </div>\n </thy-form-group-footer>\n</form>\n", components: [{ type: i2$2.ThyFormGroupComponent, selector: "thy-form-group", inputs: ["thyLabelText", "thyLabelTextTranslateKey", "thyLabelRequired", "thyLabelPaddingTopClear", "thyFeedbackIcon", "thyTipsMode", "thyTips", "thyTipsTranslateKey", "thyRowFill"] }, { type: i2$2.ThyFormGroupFooterComponent, selector: "thy-form-group-footer", inputs: ["thyAlign"] }, { type: i1$5.ThyButtonComponent, selector: "thy-button,[thy-button],[thyButton]", inputs: ["thyButton", "thyType", "thyLoading", "thyLoadingText", "thySize", "thyIcon", "thySquare", "thyBlock"] }], directives: [{ type: i4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2$2.ThyFormDirective, selector: "[thyForm],[thy-form]", inputs: ["thyLayout", "thyEnterKeyMode", "thyFormValidatorConfig"], exportAs: ["thyForm"] }, { type: i5$2.ThyAutofocusDirective, selector: "input[thyAutofocus],textarea[thyAutofocus]", inputs: ["thyAutoSelect", "thyAutofocus"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5$1.ThyInputDirective, selector: "[thyInput]", inputs: ["thySize", "thyAutocomplete"] }, { type: i4.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i2$2.ThyFormSubmitDirective, selector: "[thyFormSubmit],[thy-form-submit]", outputs: ["thyFormSubmit"] }] });
|
|
7150
7128
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheLinkEditComponent, decorators: [{
|
|
7151
7129
|
type: Component,
|
|
7152
7130
|
args: [{
|
|
@@ -7172,14 +7150,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
7172
7150
|
}] } });
|
|
7173
7151
|
|
|
7174
7152
|
class TheBaseLinkComponent extends TheBaseElementComponent {
|
|
7175
|
-
constructor(elementRef, cdr, thyPopover, overlay, viewContainerRef
|
|
7153
|
+
constructor(elementRef, cdr, thyPopover, overlay, viewContainerRef) {
|
|
7176
7154
|
super(elementRef, cdr);
|
|
7177
7155
|
this.elementRef = elementRef;
|
|
7178
7156
|
this.cdr = cdr;
|
|
7179
7157
|
this.thyPopover = thyPopover;
|
|
7180
7158
|
this.overlay = overlay;
|
|
7181
7159
|
this.viewContainerRef = viewContainerRef;
|
|
7182
|
-
this.thyClickDispatcher = thyClickDispatcher;
|
|
7183
7160
|
this.beforeContextChange = (value) => {
|
|
7184
7161
|
if (this.thyPopoverEditRef && this.thyPopoverEditRef.componentInstance) {
|
|
7185
7162
|
let { originText } = this.thyPopoverEditRef.componentInstance;
|
|
@@ -7288,7 +7265,7 @@ class TheBaseLinkComponent extends TheBaseElementComponent {
|
|
|
7288
7265
|
this.close(LinkCloseTypes.destroy);
|
|
7289
7266
|
}
|
|
7290
7267
|
}
|
|
7291
|
-
TheBaseLinkComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheBaseLinkComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$3.ThyPopover }, { token: i2.Overlay }, { token: i0.ViewContainerRef }
|
|
7268
|
+
TheBaseLinkComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheBaseLinkComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$3.ThyPopover }, { token: i2.Overlay }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
7292
7269
|
TheBaseLinkComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheBaseLinkComponent, selector: "[TheBaseLinkComponent]", host: { listeners: { "click": "mousedownHandle($event)" } }, usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
7293
7270
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheBaseLinkComponent, decorators: [{
|
|
7294
7271
|
type: Component,
|
|
@@ -7296,7 +7273,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
7296
7273
|
selector: '[TheBaseLinkComponent]',
|
|
7297
7274
|
template: ''
|
|
7298
7275
|
}]
|
|
7299
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$3.ThyPopover }, { type: i2.Overlay }, { type: i0.ViewContainerRef }
|
|
7276
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$3.ThyPopover }, { type: i2.Overlay }, { type: i0.ViewContainerRef }]; }, propDecorators: { mousedownHandle: [{
|
|
7300
7277
|
type: HostListener,
|
|
7301
7278
|
args: ['click', ['$event']]
|
|
7302
7279
|
}] } });
|
|
@@ -7309,27 +7286,16 @@ class TheLinkComponent extends TheBaseLinkComponent {
|
|
|
7309
7286
|
}
|
|
7310
7287
|
}
|
|
7311
7288
|
TheLinkComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheLinkComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
7312
|
-
TheLinkComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheLinkComponent, selector: "
|
|
7313
|
-
<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>
|
|
7314
|
-
<span contenteditable="false"
|
|
7289
|
+
TheLinkComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheLinkComponent, selector: "a[theLink]", host: { attributes: { "target": "_blank" }, properties: { "attr.href": "element.url" } }, usesInheritance: true, ngImport: i0, template: ` <span contenteditable="false" class="the-break-char">{{ inlineChromiumBugfix }}</span>
|
|
7290
|
+
<span><slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children></span>
|
|
7291
|
+
<span contenteditable="false" class="the-break-char">{{ inlineChromiumBugfix }}</span>`, isInline: true, components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
7315
7292
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheLinkComponent, decorators: [{
|
|
7316
|
-
type: Component,
|
|
7317
|
-
args: [{
|
|
7318
|
-
selector: 'span[theLink]',
|
|
7319
|
-
template: ` <span contenteditable="false" style="font-size: 0;">{{ inlineChromiumBugfix }}</span>
|
|
7320
|
-
<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>
|
|
7321
|
-
<span contenteditable="false" style="font-size: 0;">{{ inlineChromiumBugfix }}</span>`
|
|
7322
|
-
}]
|
|
7323
|
-
}] });
|
|
7324
|
-
class TheReadonlyLinkComponent extends TheBaseLinkComponent {
|
|
7325
|
-
}
|
|
7326
|
-
TheReadonlyLinkComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheReadonlyLinkComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
7327
|
-
TheReadonlyLinkComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheReadonlyLinkComponent, selector: "a[theLink]", host: { attributes: { "target": "_blank" }, properties: { "attr.href": "element.url" } }, usesInheritance: true, ngImport: i0, template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>`, isInline: true, components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
7328
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheReadonlyLinkComponent, decorators: [{
|
|
7329
7293
|
type: Component,
|
|
7330
7294
|
args: [{
|
|
7331
7295
|
selector: 'a[theLink]',
|
|
7332
|
-
template:
|
|
7296
|
+
template: ` <span contenteditable="false" class="the-break-char">{{ inlineChromiumBugfix }}</span>
|
|
7297
|
+
<span><slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children></span>
|
|
7298
|
+
<span contenteditable="false" class="the-break-char">{{ inlineChromiumBugfix }}</span>`,
|
|
7333
7299
|
host: {
|
|
7334
7300
|
'[attr.href]': 'element.url',
|
|
7335
7301
|
target: '_blank'
|
|
@@ -7380,7 +7346,7 @@ const withLink = (editor) => {
|
|
|
7380
7346
|
};
|
|
7381
7347
|
editor.renderElement = (element) => {
|
|
7382
7348
|
if (element.type === ElementKinds.link) {
|
|
7383
|
-
return
|
|
7349
|
+
return TheLinkComponent;
|
|
7384
7350
|
}
|
|
7385
7351
|
return renderElement(element);
|
|
7386
7352
|
};
|
|
@@ -7492,7 +7458,7 @@ TheTableToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12
|
|
|
7492
7458
|
<thy-icon [thyIconName]="item.icon"></thy-icon>
|
|
7493
7459
|
<thy-icon class="link-down-icon font-size-sm text-desc table-down-icon" thyIconName="caret-down"> </thy-icon>
|
|
7494
7460
|
</a>
|
|
7495
|
-
`, isInline: true, components: [{ type: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type:
|
|
7461
|
+
`, isInline: true, components: [{ type: i3$1.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i3.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i5.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
|
|
7496
7462
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheTableToolbarItemComponent, decorators: [{
|
|
7497
7463
|
type: Component,
|
|
7498
7464
|
args: [{
|
|
@@ -7559,6 +7525,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
7559
7525
|
type: Injectable
|
|
7560
7526
|
}] });
|
|
7561
7527
|
|
|
7528
|
+
var Position;
|
|
7529
|
+
(function (Position) {
|
|
7530
|
+
Position["top"] = "top";
|
|
7531
|
+
Position["right"] = "right";
|
|
7532
|
+
Position["bottom"] = "bottom";
|
|
7533
|
+
Position["left"] = "left";
|
|
7534
|
+
})(Position || (Position = {}));
|
|
7562
7535
|
class HoveredCellInfo {
|
|
7563
7536
|
}
|
|
7564
7537
|
class TableCellEventDispatcher {
|
|
@@ -7723,11 +7696,15 @@ class TableStore {
|
|
|
7723
7696
|
get dangerousCells() {
|
|
7724
7697
|
return this.dangerousCells$.getValue();
|
|
7725
7698
|
}
|
|
7726
|
-
|
|
7699
|
+
getTableEntry(editor) {
|
|
7727
7700
|
const { selection } = editor;
|
|
7728
7701
|
const { anchor: { path } } = selection;
|
|
7729
7702
|
const opts = new TableOptions$1();
|
|
7730
|
-
return TablePosition.create(opts, editor, path).tableEntry
|
|
7703
|
+
return TablePosition.create(opts, editor, path).tableEntry;
|
|
7704
|
+
}
|
|
7705
|
+
getTablePath(editor) {
|
|
7706
|
+
const tableEntry = this.getTableEntry(editor);
|
|
7707
|
+
return tableEntry[1];
|
|
7731
7708
|
}
|
|
7732
7709
|
getTablePosition(editor) {
|
|
7733
7710
|
const { selection } = editor;
|
|
@@ -7988,6 +7965,7 @@ class TableStore {
|
|
|
7988
7965
|
}
|
|
7989
7966
|
focusCell(editor, path) {
|
|
7990
7967
|
const at = Editor.start(editor, path);
|
|
7968
|
+
TheEditor.focus(this.editor);
|
|
7991
7969
|
Transforms.select(editor, at);
|
|
7992
7970
|
}
|
|
7993
7971
|
dangerousCellsChange() {
|
|
@@ -8101,6 +8079,10 @@ class TableStore {
|
|
|
8101
8079
|
mergeCell(editor) {
|
|
8102
8080
|
mergeCell(editor, this.selectedCells);
|
|
8103
8081
|
}
|
|
8082
|
+
setTableOptions(editor, options) {
|
|
8083
|
+
const tablePath = this.getTablePath(this.editor);
|
|
8084
|
+
Transforms.setNodes(editor, { options }, { at: tablePath });
|
|
8085
|
+
}
|
|
8104
8086
|
removeDangerousColumns() {
|
|
8105
8087
|
const { dangerousColumnsIndex, isSelectedTable } = this;
|
|
8106
8088
|
if (isSelectedTable) {
|
|
@@ -8203,10 +8185,95 @@ function setCellMenuInvisibility(editor, menuList, selectedCells, isActiveSelect
|
|
|
8203
8185
|
});
|
|
8204
8186
|
}
|
|
8205
8187
|
|
|
8188
|
+
class TheTableOptionsComponent {
|
|
8189
|
+
constructor(popoverRef) {
|
|
8190
|
+
this.popoverRef = popoverRef;
|
|
8191
|
+
this.tableDropdownList = [
|
|
8192
|
+
// {
|
|
8193
|
+
// name: '表头行',
|
|
8194
|
+
// key: 'headerRow'
|
|
8195
|
+
// },
|
|
8196
|
+
// {
|
|
8197
|
+
// name: '表头列',
|
|
8198
|
+
// key: 'headerColumn'
|
|
8199
|
+
// },
|
|
8200
|
+
{
|
|
8201
|
+
name: '序号列',
|
|
8202
|
+
key: 'numberedColumn'
|
|
8203
|
+
}
|
|
8204
|
+
];
|
|
8205
|
+
}
|
|
8206
|
+
get table() {
|
|
8207
|
+
return this.tableStore && this.tableStore.getTableEntry(this.editor)[0];
|
|
8208
|
+
}
|
|
8209
|
+
handleDocumentMouseDown(event) {
|
|
8210
|
+
if (this.popoverRef && !document.querySelector('.table-options-pannel').contains(event.target)) {
|
|
8211
|
+
this.popoverRef.close();
|
|
8212
|
+
}
|
|
8213
|
+
}
|
|
8214
|
+
ngOnInit() {
|
|
8215
|
+
this.setColumnOptions();
|
|
8216
|
+
}
|
|
8217
|
+
setColumnOptions() {
|
|
8218
|
+
this.tableDropdownList.forEach(item => {
|
|
8219
|
+
item.isActive = (this.table.options && this.table.options[item.key]) || false;
|
|
8220
|
+
});
|
|
8221
|
+
}
|
|
8222
|
+
setTableOptions(event, option) {
|
|
8223
|
+
event.preventDefault();
|
|
8224
|
+
event.stopPropagation();
|
|
8225
|
+
const currentOption = this.tableDropdownList.find(item => item.key === option.key);
|
|
8226
|
+
currentOption.isActive = !option.isActive;
|
|
8227
|
+
const tableOption = {};
|
|
8228
|
+
tableOption[option.key] = currentOption.isActive || null;
|
|
8229
|
+
this.tableStore.setTableOptions(this.editor, Object.assign(Object.assign({}, this.table.options), tableOption));
|
|
8230
|
+
this.popoverRef.close();
|
|
8231
|
+
}
|
|
8232
|
+
}
|
|
8233
|
+
TheTableOptionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheTableOptionsComponent, deps: [{ token: i1$6.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
8234
|
+
TheTableOptionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheTableOptionsComponent, selector: "the-table-options", inputs: { tableStore: "tableStore", editor: "editor" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)" } }, ngImport: i0, template: `
|
|
8235
|
+
<thy-action-menu class="table-drop-menu">
|
|
8236
|
+
<ng-container *ngFor="let option of tableDropdownList">
|
|
8237
|
+
<a thyActionMenuItem href="javascript:;" (mousedown)="setTableOptions($event, option)">
|
|
8238
|
+
<span thyActionMenuItemName>{{ option.name }}</span>
|
|
8239
|
+
<span thyActionMenuItemExtendIcon class="text-primary" *ngIf="option.isActive">
|
|
8240
|
+
<thy-icon thyIconName="check"></thy-icon>
|
|
8241
|
+
</span>
|
|
8242
|
+
</a>
|
|
8243
|
+
</ng-container>
|
|
8244
|
+
</thy-action-menu>
|
|
8245
|
+
`, isInline: true, components: [{ type: i2$1.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }, { type: i3.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i2$1.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }, { type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.ThyActionMenuItemExtendIconDirective, selector: "[thyActionMenuItemExtendIcon]" }] });
|
|
8246
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheTableOptionsComponent, decorators: [{
|
|
8247
|
+
type: Component,
|
|
8248
|
+
args: [{
|
|
8249
|
+
selector: 'the-table-options',
|
|
8250
|
+
template: `
|
|
8251
|
+
<thy-action-menu class="table-drop-menu">
|
|
8252
|
+
<ng-container *ngFor="let option of tableDropdownList">
|
|
8253
|
+
<a thyActionMenuItem href="javascript:;" (mousedown)="setTableOptions($event, option)">
|
|
8254
|
+
<span thyActionMenuItemName>{{ option.name }}</span>
|
|
8255
|
+
<span thyActionMenuItemExtendIcon class="text-primary" *ngIf="option.isActive">
|
|
8256
|
+
<thy-icon thyIconName="check"></thy-icon>
|
|
8257
|
+
</span>
|
|
8258
|
+
</a>
|
|
8259
|
+
</ng-container>
|
|
8260
|
+
</thy-action-menu>
|
|
8261
|
+
`
|
|
8262
|
+
}]
|
|
8263
|
+
}], ctorParameters: function () { return [{ type: i1$6.ThyPopoverRef }]; }, propDecorators: { tableStore: [{
|
|
8264
|
+
type: Input
|
|
8265
|
+
}], editor: [{
|
|
8266
|
+
type: Input
|
|
8267
|
+
}], handleDocumentMouseDown: [{
|
|
8268
|
+
type: HostListener,
|
|
8269
|
+
args: ['document: mousedown', ['$event']]
|
|
8270
|
+
}] } });
|
|
8271
|
+
|
|
8206
8272
|
class TheTableToolbarComponent {
|
|
8207
|
-
constructor(ngZone, colorSelectService, popoverRef) {
|
|
8273
|
+
constructor(ngZone, colorSelectService, thyPopover, popoverRef) {
|
|
8208
8274
|
this.ngZone = ngZone;
|
|
8209
8275
|
this.colorSelectService = colorSelectService;
|
|
8276
|
+
this.thyPopover = thyPopover;
|
|
8210
8277
|
this.popoverRef = popoverRef;
|
|
8211
8278
|
this.cellMenuList = [
|
|
8212
8279
|
{
|
|
@@ -8311,16 +8378,32 @@ class TheTableToolbarComponent {
|
|
|
8311
8378
|
});
|
|
8312
8379
|
});
|
|
8313
8380
|
}
|
|
8381
|
+
openTableOptionMenu(event) {
|
|
8382
|
+
event.preventDefault();
|
|
8383
|
+
event.stopPropagation();
|
|
8384
|
+
this.thyPopover.open(TheTableOptionsComponent, {
|
|
8385
|
+
origin: event.currentTarget,
|
|
8386
|
+
initialState: {
|
|
8387
|
+
tableStore: this.tableStore,
|
|
8388
|
+
editor: this.editor
|
|
8389
|
+
},
|
|
8390
|
+
insideClosable: false,
|
|
8391
|
+
hasBackdrop: false,
|
|
8392
|
+
placement: 'bottomLeft',
|
|
8393
|
+
originActiveClass: 'table-options-active',
|
|
8394
|
+
panelClass: 'table-options-pannel'
|
|
8395
|
+
});
|
|
8396
|
+
}
|
|
8314
8397
|
}
|
|
8315
|
-
TheTableToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheTableToolbarComponent, deps: [{ token: i0.NgZone }, { token: TheColorSelectService }, { token: i1$3.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
8316
|
-
TheTableToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheTableToolbarComponent, selector: "the-table-toolbar", inputs: { tableStore: "tableStore", isActiveSelect: "isActiveSelect" }, ngImport: i0, template: "<thy-icon-nav>\n <ng-container *ngFor=\"let item of cellMenuList\">\n <a href=\"javascript:;\" thyIconNavLink *ngIf=\"!item.invisibility\" [thyTooltip]=\"item.name\" (mousedown)=\"item.actionHandle()\">\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </a>\n </ng-container>\n <nav-split-line *ngIf=\"!isActiveSelect && isShowSplitLine\"></nav-split-line>\n <a href=\"javascript:;\" thyIconNavLink thyTooltip=\"\u5355\u5143\u683C\u80CC\u666F\" (mousedown)=\"openSelectColor($event)\">\n <thy-icon thyIconName=\"background-tt\" thyIconType=\"twotone\" [thyTwotoneColor]=\"selectedColor\"></thy-icon>\n </a>\n <nav-split-line *ngIf=\"deleteIcon\"></nav-split-line>\n <a\n *ngIf=\"deleteIcon\"\n href=\"javascript:;\"\n thyIconNavLink\n [thyTooltip]=\"iconName\"\n class=\"danger\"\n [thyIconNavLinkIcon]=\"deleteIcon\"\n (mousedown)=\"onDelete($event)\"\n (mouseenter)=\"onEnterDelete($event)\"\n (mouseleave)=\"onLeaveDelete($event)\"\n ></a>\n</thy-icon-nav>\n", components: [{ type: i3.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type:
|
|
8398
|
+
TheTableToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheTableToolbarComponent, deps: [{ token: i0.NgZone }, { token: TheColorSelectService }, { token: i1$3.ThyPopover }, { token: i1$3.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
8399
|
+
TheTableToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheTableToolbarComponent, selector: "the-table-toolbar", inputs: { tableStore: "tableStore", isActiveSelect: "isActiveSelect" }, ngImport: i0, template: "<thy-icon-nav>\n <ng-container *ngFor=\"let item of cellMenuList\">\n <a href=\"javascript:;\" thyIconNavLink *ngIf=\"!item.invisibility\" [thyTooltip]=\"item.name\" (mousedown)=\"item.actionHandle()\">\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </a>\n </ng-container>\n <nav-split-line *ngIf=\"!isActiveSelect && isShowSplitLine\"></nav-split-line>\n <a href=\"javascript:;\" thyIconNavLink thyTooltip=\"\u5355\u5143\u683C\u80CC\u666F\" (mousedown)=\"openSelectColor($event)\">\n <thy-icon thyIconName=\"background-tt\" thyIconType=\"twotone\" [thyTwotoneColor]=\"selectedColor\"></thy-icon>\n </a>\n <nav-split-line *ngIf=\"tableStore.isSelectedTable\"></nav-split-line>\n <button\n thyButton=\"default\"\n *ngIf=\"tableStore.isSelectedTable\"\n class=\"mr-2\"\n thySize=\"md\"\n class=\"table-options\"\n (mousedown)=\"openTableOptionMenu($event)\"\n >\n <span>\u8868\u683C\u9009\u9879</span>\n <thy-icon thyIconName=\"caret-down\"></thy-icon>\n </button>\n <nav-split-line *ngIf=\"deleteIcon\"></nav-split-line>\n <a\n *ngIf=\"deleteIcon\"\n href=\"javascript:;\"\n thyIconNavLink\n [thyTooltip]=\"iconName\"\n class=\"danger\"\n [thyIconNavLinkIcon]=\"deleteIcon\"\n (mousedown)=\"onDelete($event)\"\n (mouseenter)=\"onEnterDelete($event)\"\n (mouseleave)=\"onLeaveDelete($event)\"\n ></a>\n</thy-icon-nav>\n", components: [{ type: i3$1.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: i3$1.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i3.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }, { type: i1$5.ThyButtonComponent, selector: "thy-button,[thy-button],[thyButton]", inputs: ["thyButton", "thyType", "thyLoading", "thyLoadingText", "thySize", "thyIcon", "thySquare", "thyBlock"] }], directives: [{ type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
|
|
8317
8400
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheTableToolbarComponent, decorators: [{
|
|
8318
8401
|
type: Component,
|
|
8319
8402
|
args: [{
|
|
8320
8403
|
selector: 'the-table-toolbar',
|
|
8321
8404
|
templateUrl: 'table-toolbar.component.html'
|
|
8322
8405
|
}]
|
|
8323
|
-
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: TheColorSelectService }, { type: i1$3.ThyPopoverRef }]; }, propDecorators: { tableStore: [{
|
|
8406
|
+
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: TheColorSelectService }, { type: i1$3.ThyPopover }, { type: i1$3.ThyPopoverRef }]; }, propDecorators: { tableStore: [{
|
|
8324
8407
|
type: Input
|
|
8325
8408
|
}], isActiveSelect: [{
|
|
8326
8409
|
type: Input
|
|
@@ -8376,7 +8459,7 @@ class TheContextMenuComponent {
|
|
|
8376
8459
|
ngOnInit() { }
|
|
8377
8460
|
}
|
|
8378
8461
|
TheContextMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheContextMenuComponent, deps: [{ token: i0.ElementRef }, { token: i1$3.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
8379
|
-
TheContextMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheContextMenuComponent, selector: "the-contextmenu", inputs: { menuEntities: "menuEntities", actionHandle: "actionHandle", activeHandle: "activeHandle", deactiveHandle: "deactiveHandle" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)", "mousedown": "handleMouseDown($event)" }, properties: { "class.the-overlay-menu-wrap": "this.wrap" } }, ngImport: i0, template: "<thy-action-menu>\n <ng-container *ngFor=\"let menuItem of menuEntities\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n *ngIf=\"!menuItem.invisibility\"\n (mousedown)=\"itemMousedown($event, menuItem)\"\n (mouseenter)=\"itemMouseenter($event, menuItem)\"\n (mouseleave)=\"itemMouseleave($event, menuItem)\"\n >\n <span thyActionMenuItemIcon>\n <thy-icon\n *ngIf=\"menuItem.backgroundColor; else elseIcon\"\n [thyIconName]=\"menuItem.icon\"\n thyIconType=\"twotone\"\n [thyTwotoneColor]=\"menuItem.backgroundColor\"\n ></thy-icon>\n <ng-template #elseIcon>\n <thy-icon [thyIconName]=\"menuItem.icon\"></thy-icon>\n </ng-template>\n </span>\n <span thyActionMenuItemName>{{ menuItem.name }}</span>\n <span *ngIf=\"menuItem.extendIcon\" thyActionMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ menuItem.extendIcon }}\"></thy-icon>\n </span>\n </a>\n <thy-action-menu-divider *ngIf=\"menuItem.divider\"></thy-action-menu-divider>\n </ng-container>\n</thy-action-menu>\n", components: [{ type:
|
|
8462
|
+
TheContextMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheContextMenuComponent, selector: "the-contextmenu", inputs: { menuEntities: "menuEntities", actionHandle: "actionHandle", activeHandle: "activeHandle", deactiveHandle: "deactiveHandle" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)", "mousedown": "handleMouseDown($event)" }, properties: { "class.the-overlay-menu-wrap": "this.wrap" } }, ngImport: i0, template: "<thy-action-menu>\n <ng-container *ngFor=\"let menuItem of menuEntities\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n *ngIf=\"!menuItem.invisibility\"\n (mousedown)=\"itemMousedown($event, menuItem)\"\n (mouseenter)=\"itemMouseenter($event, menuItem)\"\n (mouseleave)=\"itemMouseleave($event, menuItem)\"\n >\n <span thyActionMenuItemIcon>\n <thy-icon\n *ngIf=\"menuItem.backgroundColor; else elseIcon\"\n [thyIconName]=\"menuItem.icon\"\n thyIconType=\"twotone\"\n [thyTwotoneColor]=\"menuItem.backgroundColor\"\n ></thy-icon>\n <ng-template #elseIcon>\n <thy-icon [thyIconName]=\"menuItem.icon\"></thy-icon>\n </ng-template>\n </span>\n <span thyActionMenuItemName>{{ menuItem.name }}</span>\n <span *ngIf=\"menuItem.extendIcon\" thyActionMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ menuItem.extendIcon }}\"></thy-icon>\n </span>\n </a>\n <thy-action-menu-divider *ngIf=\"menuItem.divider\"></thy-action-menu-divider>\n </ng-container>\n</thy-action-menu>\n", components: [{ type: i2$1.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }, { type: i3.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i2$1.ThyActionMenuDividerComponent, selector: "thy-action-menu-divider", inputs: ["thyTitle", "thyType"] }], directives: [{ type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i2$1.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i2$1.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }, { type: i2$1.ThyActionMenuItemExtendIconDirective, selector: "[thyActionMenuItemExtendIcon]" }] });
|
|
8380
8463
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheContextMenuComponent, decorators: [{
|
|
8381
8464
|
type: Component,
|
|
8382
8465
|
args: [{
|
|
@@ -8632,7 +8715,7 @@ class TableService {
|
|
|
8632
8715
|
return tableElement.querySelector('.the-table-corner-controls');
|
|
8633
8716
|
}
|
|
8634
8717
|
if (selectedColumnsIndex.length > 0 && row === 0) {
|
|
8635
|
-
return tableElement.querySelectorAll('.the-table-col-controls
|
|
8718
|
+
return tableElement.querySelectorAll('.the-table-col-controls')[col];
|
|
8636
8719
|
}
|
|
8637
8720
|
if (selectedRowsIndex.length > 0 && col === 0) {
|
|
8638
8721
|
return tableElement.querySelectorAll('.the-table-row-controls-button-wrap')[row];
|
|
@@ -8736,8 +8819,13 @@ class TheInsertMarkComponent {
|
|
|
8736
8819
|
const tableWrapper = tableComponent.tableWrapper.nativeElement;
|
|
8737
8820
|
const tableElement = tableComponent.theTableElement.nativeElement;
|
|
8738
8821
|
let result = 0;
|
|
8822
|
+
const rowControl = tableComponent.nativeElement.querySelector('.the-table-row-controls');
|
|
8823
|
+
let rowControlWidth = 11;
|
|
8824
|
+
if (rowControl) {
|
|
8825
|
+
rowControlWidth = rowControl.getBoundingClientRect().width;
|
|
8826
|
+
}
|
|
8739
8827
|
if (this.type === 'row') {
|
|
8740
|
-
result = tableWrapper.offsetWidth +
|
|
8828
|
+
result = tableWrapper.offsetWidth + rowControlWidth;
|
|
8741
8829
|
}
|
|
8742
8830
|
else {
|
|
8743
8831
|
result = tableElement.offsetHeight - 1;
|
|
@@ -8786,41 +8874,23 @@ class TheColumnResizeDirective {
|
|
|
8786
8874
|
_listenForCellEdgeHoverEvents() {
|
|
8787
8875
|
this.ngZone.runOutsideAngular(() => {
|
|
8788
8876
|
const element = this.elementRef.nativeElement;
|
|
8789
|
-
let previous = { x: 0, y: 0 };
|
|
8790
8877
|
fromEvent(element, 'mousemove') // mouseover to mousemove 增加灵敏性
|
|
8791
|
-
.pipe(
|
|
8792
|
-
map(event => {
|
|
8878
|
+
.pipe(map(event => {
|
|
8793
8879
|
if (!this.theTableComponent.isCollapsed) {
|
|
8794
8880
|
return null;
|
|
8795
8881
|
}
|
|
8796
8882
|
const cell = event.target.closest(SLA_TABLE_CELL_SELECTOR);
|
|
8797
|
-
|
|
8798
|
-
let position;
|
|
8883
|
+
const positions = [Position.top, Position.right, Position.bottom, Position.left];
|
|
8799
8884
|
if (cell) {
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
if (Math.abs(deltaY) > Math.abs(deltaX) && deltaY !== 0) {
|
|
8810
|
-
this.isXAxis = false;
|
|
8811
|
-
const centerCellY = rectCell.y + rectCell.height / 2;
|
|
8812
|
-
position = event.y > centerCellY ? 'top' : 'bottom';
|
|
8813
|
-
}
|
|
8814
|
-
hoveredInfo = {
|
|
8815
|
-
cell,
|
|
8816
|
-
position
|
|
8817
|
-
};
|
|
8818
|
-
}
|
|
8819
|
-
previous = {
|
|
8820
|
-
x: event.clientX,
|
|
8821
|
-
y: event.clientY
|
|
8822
|
-
};
|
|
8823
|
-
return position ? hoveredInfo : null;
|
|
8885
|
+
const rectCell = cell.getBoundingClientRect();
|
|
8886
|
+
const topOffset = event.clientY - rectCell.y;
|
|
8887
|
+
const rightOffset = rectCell.right - event.clientX;
|
|
8888
|
+
const bottomOffset = rectCell.bottom - event.clientY;
|
|
8889
|
+
const leftOffset = event.clientX - rectCell.x;
|
|
8890
|
+
const positionOffsets = [topOffset, rightOffset, bottomOffset, leftOffset];
|
|
8891
|
+
const minIndex = positionOffsets.indexOf(Math.min(...positionOffsets));
|
|
8892
|
+
this.position = positions[minIndex];
|
|
8893
|
+
return { cell, position: this.position };
|
|
8824
8894
|
}
|
|
8825
8895
|
return null;
|
|
8826
8896
|
}), takeUntil(this.destroyed))
|
|
@@ -8834,12 +8904,22 @@ class TheColumnResizeDirective {
|
|
|
8834
8904
|
}
|
|
8835
8905
|
_listenStartDrag() {
|
|
8836
8906
|
this.resizeNotifier.resizeStarted.pipe(takeUntil(this.destroyed)).subscribe(() => {
|
|
8837
|
-
this.
|
|
8907
|
+
if (this.position === Position.left || this.position === Position.right) {
|
|
8908
|
+
this.theTableComponent.initializeColumns();
|
|
8909
|
+
}
|
|
8910
|
+
else {
|
|
8911
|
+
this.theTableComponent.initializeRows();
|
|
8912
|
+
}
|
|
8838
8913
|
});
|
|
8839
8914
|
}
|
|
8840
8915
|
_listenEndDrag() {
|
|
8841
8916
|
this.resizeNotifier.resizeCompleted.pipe(takeUntil(this.destroyed)).subscribe(() => {
|
|
8842
|
-
this.
|
|
8917
|
+
if (this.position === Position.left || this.position === Position.right) {
|
|
8918
|
+
this.theTableComponent.transformColumnsWidth();
|
|
8919
|
+
}
|
|
8920
|
+
else {
|
|
8921
|
+
this.theTableComponent.transformRowHeight();
|
|
8922
|
+
}
|
|
8843
8923
|
});
|
|
8844
8924
|
}
|
|
8845
8925
|
ngOnDestroy() {
|
|
@@ -8960,7 +9040,8 @@ class TheTableComponent extends TheBaseElementComponent {
|
|
|
8960
9040
|
});
|
|
8961
9041
|
}
|
|
8962
9042
|
useRowControls() {
|
|
8963
|
-
|
|
9043
|
+
var _a;
|
|
9044
|
+
if (this.selection || ((_a = this.element.options) === null || _a === void 0 ? void 0 : _a.numberedColumn)) {
|
|
8964
9045
|
this.rowControls = this.calculateRowControls();
|
|
8965
9046
|
this.cdr.markForCheck();
|
|
8966
9047
|
}
|
|
@@ -9149,8 +9230,13 @@ class TheTableComponent extends TheBaseElementComponent {
|
|
|
9149
9230
|
setNode(this.editor, { columns }, this.element);
|
|
9150
9231
|
}
|
|
9151
9232
|
onRowMouseDown(event, index) {
|
|
9233
|
+
if (this.readonly)
|
|
9234
|
+
return;
|
|
9152
9235
|
event.stopPropagation();
|
|
9153
|
-
|
|
9236
|
+
if (!this.isInTable) {
|
|
9237
|
+
const path = TheEditor.findPath(this.editor, this.element);
|
|
9238
|
+
Transforms.select(this.editor, path);
|
|
9239
|
+
}
|
|
9154
9240
|
this.tableStore.selectRow(this.editor, index);
|
|
9155
9241
|
this.tableService.openToolbar(event.target, true);
|
|
9156
9242
|
}
|
|
@@ -9229,7 +9315,7 @@ TheTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
|
|
|
9229
9315
|
provide: TheTableToken,
|
|
9230
9316
|
useExisting: TheTableComponent
|
|
9231
9317
|
}
|
|
9232
|
-
], viewQueries: [{ propertyName: "tableWrapper", first: true, predicate: ["tableWrapper"], descendants: true, read: ElementRef, static: true }, { propertyName: "theTableElement", first: true, predicate: ["theTable"], descendants: true, read: ElementRef, static: true }, { propertyName: "tbodyElement", first: true, predicate: ["tbody"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<div\n class=\"the-table-container\"\n theColumnResize\n [ngClass]=\"{\n 'the-table-with-controls': isInTable,\n 'the-table-selection-hide': tableStore.isCellSelecting || tableStore.isRightClicking\n }\"\n>\n <div
|
|
9318
|
+
], viewQueries: [{ propertyName: "tableWrapper", first: true, predicate: ["tableWrapper"], descendants: true, read: ElementRef, static: true }, { propertyName: "theTableElement", first: true, predicate: ["theTable"], descendants: true, read: ElementRef, static: true }, { propertyName: "tbodyElement", first: true, predicate: ["tbody"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<div\n class=\"the-table-container\"\n theColumnResize\n [ngClass]=\"{\n 'the-table-with-controls': isInTable,\n 'the-numbered-column-container': element?.options?.numberedColumn,\n 'the-table-selection-hide': tableStore.isCellSelecting || tableStore.isRightClicking\n }\"\n>\n <div\n class=\"the-table-row-controls-wrapper\"\n [ngClass]=\"{\n 'the-table-focus': isInTable\n }\"\n >\n <div\n class=\"the-table-corner-controls\"\n [ngClass]=\"{\n visible: !readonly && isInTable,\n active: isSelectedAllCell,\n dangerous: tableStore.isSelectedTable && tableStore.dangerousCells.length > 0\n }\"\n >\n <div class=\"the-table-corner-button\" (mousedown)=\"onSelectTable($event)\"></div>\n <div class=\"the-table-corner-controls-insert-row-marker\">\n <the-table-insert-mark type=\"row\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n <div class=\"the-table-corner-controls-insert-column-marker\">\n <the-table-insert-mark type=\"column\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n </div>\n <div class=\"the-table-row-controls\">\n <div class=\"the-table-row-controls-inner\">\n <div\n class=\"the-table-row-controls-button-wrap\"\n *ngFor=\"let control of rowControls; let i = index; trackBy: trackByFnRowCotrols\"\n [ngClass]=\"{\n active: tableStore.selectedRowsIndex.includes(control.rowIndex),\n dangerous: tableStore.dangerousRowsIndex.includes(control.rowIndex) && tableStore.dangerousCells.length > 0\n }\"\n >\n <ng-container *ngIf=\"!readonly && isInTable && !element?.options?.numberedColumn\">\n <button\n (mousedown)=\"onRowMouseDown($event, control.rowIndex)\"\n type=\"button\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n class=\"the-table-row-controls-button the-table-controls-button\"\n ></button>\n </ng-container>\n <ng-container *ngIf=\"element?.options?.numberedColumn\">\n <div\n [contentEditable]=\"false\"\n contenteditable=\"false\"\n (mousedown)=\"onRowMouseDown($event, control.rowIndex)\"\n class=\"the-table-numbered-controls-button\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n >\n <p class=\"row-number d-flex align-items-center\">{{ i + 1 }}</p>\n </div>\n </ng-container>\n <the-table-insert-mark type=\"row\" [at]=\"control.rowIndex + 1\" [tableStore]=\"tableStore\"> </the-table-insert-mark>\n </div>\n </div>\n </div>\n </div>\n <div class=\"the-table-wrapper\" #tableWrapper [ngClass]=\"{ 'the-table-numbered': element?.options?.numberedColumn }\">\n <table class=\"the-table\" #theTable [ngClass]=\"{ 'the-table-with-controls': isInTable }\">\n <colgroup *ngIf=\"columns\">\n <col *ngFor=\"let col of columns\" [ngStyle]=\"{ width: col.width + 'px' }\" />\n </colgroup>\n <thead>\n <tr class=\"the-table-col-controls-wrapper\">\n <th\n class=\"the-table-col-controls\"\n [ngClass]=\"{\n active: tableStore.selectedColumnsIndex.includes(i),\n dangerous: tableStore.dangerousColumnsIndex.includes(i) && tableStore.dangerousCells.length > 0\n }\"\n (mousedown)=\"onColMouseDown($event, i)\"\n *ngFor=\"let control of colControls; let i = index; trackBy: trackByFnColCotrols\"\n >\n <the-table-insert-mark *ngIf=\"isInTable\" type=\"column\" [at]=\"i + 1\" [tableStore]=\"tableStore\">\n </the-table-insert-mark>\n </th>\n </tr>\n </thead>\n <tbody #tbody>\n <slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"> </slate-children>\n </tbody>\n </table>\n </div>\n</div>\n", components: [{ type: TheInsertMarkComponent, selector: "the-table-insert-mark", inputs: ["type", "at", "tableStore"] }, { type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], directives: [{ type: TheColumnResizeDirective, selector: "div[theColumnResize]" }, { type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
9233
9319
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheTableComponent, decorators: [{
|
|
9234
9320
|
type: Component,
|
|
9235
9321
|
args: [{
|
|
@@ -9523,6 +9609,9 @@ class ResizeRef {
|
|
|
9523
9609
|
setDirection(direction) {
|
|
9524
9610
|
this.direction = direction;
|
|
9525
9611
|
}
|
|
9612
|
+
setPosition(position) {
|
|
9613
|
+
this.position = position;
|
|
9614
|
+
}
|
|
9526
9615
|
}
|
|
9527
9616
|
|
|
9528
9617
|
class TheColumnResizeOverlayHandleComponent {
|
|
@@ -9546,7 +9635,7 @@ class TheColumnResizeOverlayHandleComponent {
|
|
|
9546
9635
|
fromEvent(this.elementRef.nativeElement, 'mouseenter')
|
|
9547
9636
|
.pipe(takeUntilDestroyed, mapTo(this.resizeRef.origin.nativeElement))
|
|
9548
9637
|
.subscribe(cell => {
|
|
9549
|
-
this.eventDispatcher.tableCellHovered.next({ cell });
|
|
9638
|
+
this.eventDispatcher.tableCellHovered.next({ cell, position: this.resizeRef.position });
|
|
9550
9639
|
this.resizeRef.updateSizeAndOffset();
|
|
9551
9640
|
});
|
|
9552
9641
|
fromEvent(this.elementRef.nativeElement, 'mousedown')
|
|
@@ -9600,7 +9689,7 @@ class TheColumnResizeOverlayHandleComponent {
|
|
|
9600
9689
|
});
|
|
9601
9690
|
}
|
|
9602
9691
|
updateResizeActive(active) {
|
|
9603
|
-
this.eventDispatcher.overlayHandleActiveForCell.next(active ? { cell: this.resizeRef.origin.nativeElement } : null);
|
|
9692
|
+
this.eventDispatcher.overlayHandleActiveForCell.next(active ? { cell: this.resizeRef.origin.nativeElement, position: this.resizeRef.position } : null);
|
|
9604
9693
|
}
|
|
9605
9694
|
_isXAxis() {
|
|
9606
9695
|
return this.resizeRef.direction === 'X';
|
|
@@ -9682,13 +9771,13 @@ const OVERLAY_INIT_SIZE = 16;
|
|
|
9682
9771
|
const POSITION_MAP = {
|
|
9683
9772
|
top: {
|
|
9684
9773
|
originX: 'start',
|
|
9685
|
-
originY: '
|
|
9774
|
+
originY: 'top',
|
|
9686
9775
|
overlayX: 'start',
|
|
9687
9776
|
overlayY: 'center'
|
|
9688
9777
|
},
|
|
9689
9778
|
bottom: {
|
|
9690
9779
|
originX: 'start',
|
|
9691
|
-
originY: '
|
|
9780
|
+
originY: 'bottom',
|
|
9692
9781
|
overlayX: 'start',
|
|
9693
9782
|
overlayY: 'center'
|
|
9694
9783
|
},
|
|
@@ -9734,7 +9823,9 @@ class TheTdComponent extends TheBaseElementComponent {
|
|
|
9734
9823
|
return this.tableComponent.resizeNotifier;
|
|
9735
9824
|
}
|
|
9736
9825
|
get theTableWrapperWidth() {
|
|
9737
|
-
|
|
9826
|
+
const tableContainer = this.tableComponent.nativeElement.firstChild;
|
|
9827
|
+
const paddingLeft = coercePixelsFromCssValue(window.getComputedStyle(tableContainer)['paddingLeft']);
|
|
9828
|
+
return this.tableComponent.theTableWrapperWidth - paddingLeft;
|
|
9738
9829
|
}
|
|
9739
9830
|
get tableElement() {
|
|
9740
9831
|
return this.tableComponent.theTableElement.nativeElement;
|
|
@@ -9750,7 +9841,14 @@ class TheTdComponent extends TheBaseElementComponent {
|
|
|
9750
9841
|
return this.tableComponent.tableWrapper.nativeElement.scrollLeft;
|
|
9751
9842
|
}
|
|
9752
9843
|
get isXAxisHover() {
|
|
9753
|
-
return [
|
|
9844
|
+
return [Position.left, Position.right].includes(this.hoverdDirection);
|
|
9845
|
+
}
|
|
9846
|
+
get rowResizeClass() {
|
|
9847
|
+
var _a;
|
|
9848
|
+
return [
|
|
9849
|
+
'the-row-resize-handle-panel',
|
|
9850
|
+
this.tablePosition.table && ((_a = this.tablePosition.table.options) === null || _a === void 0 ? void 0 : _a.numberedColumn) ? 'the-numbered-resize-handle-panel' : ''
|
|
9851
|
+
];
|
|
9754
9852
|
}
|
|
9755
9853
|
get cellInnerNativeElement() {
|
|
9756
9854
|
return this.cellInner.nativeElement;
|
|
@@ -9960,20 +10058,27 @@ class TheTdComponent extends TheBaseElementComponent {
|
|
|
9960
10058
|
const element = this.elementRef.nativeElement;
|
|
9961
10059
|
this.eventDispatcher
|
|
9962
10060
|
.resizeOverlayVisibleForTableCell(element)
|
|
9963
|
-
.pipe(takeUntil(this.destroy$)
|
|
10061
|
+
.pipe(takeUntil(this.destroy$), map(value => {
|
|
10062
|
+
// 禁止第一列左侧
|
|
10063
|
+
if (value && value.position === Position.left && this.tablePosition.getColumnIndex() === 0) {
|
|
10064
|
+
return null;
|
|
10065
|
+
}
|
|
10066
|
+
// 禁止第一行顶部
|
|
10067
|
+
if (value && value.position === Position.top && this.tablePosition.getRowIndex() === 0) {
|
|
10068
|
+
return null;
|
|
10069
|
+
}
|
|
10070
|
+
return value;
|
|
10071
|
+
}))
|
|
9964
10072
|
.subscribe(hoveredCellInfo => {
|
|
9965
10073
|
if (hoveredCellInfo && hoveredCellInfo.position) {
|
|
9966
10074
|
this.hoverdDirection = hoveredCellInfo.position;
|
|
9967
10075
|
}
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
return;
|
|
9971
|
-
}
|
|
9972
|
-
if (!this.isXAxisHover && this.hoverdDirection === 'bottom' && this.tablePosition.getRowIndex() === 0) {
|
|
9973
|
-
return;
|
|
10076
|
+
else {
|
|
10077
|
+
this.hoverdDirection = null;
|
|
9974
10078
|
}
|
|
9975
10079
|
if (hoveredCellInfo) {
|
|
9976
|
-
|
|
10080
|
+
this.hoverdDirection = hoveredCellInfo.position;
|
|
10081
|
+
if (!this.overlayRef || !this.overlayRef.hasAttached()) {
|
|
9977
10082
|
this.overlayRef = this._createOverlayForHandle();
|
|
9978
10083
|
this._showHandleOverlay();
|
|
9979
10084
|
}
|
|
@@ -9984,7 +10089,6 @@ class TheTdComponent extends TheBaseElementComponent {
|
|
|
9984
10089
|
}
|
|
9985
10090
|
else if (this.overlayRef) {
|
|
9986
10091
|
this.overlayRef.detach();
|
|
9987
|
-
this.overlayRef = null;
|
|
9988
10092
|
}
|
|
9989
10093
|
});
|
|
9990
10094
|
}
|
|
@@ -9995,21 +10099,23 @@ class TheTdComponent extends TheBaseElementComponent {
|
|
|
9995
10099
|
.subscribe(({ deltaSize, previousSize, completeImmediately }) => {
|
|
9996
10100
|
const { top, left, height, width } = this.elementRef.nativeElement.getBoundingClientRect();
|
|
9997
10101
|
const { clientY, clientX } = event;
|
|
9998
|
-
let
|
|
10102
|
+
let isPreventApplySize = false;
|
|
10103
|
+
// 向下,或者向右移动(deltaSize > 0),鼠标位置不在当前单元格拖拽线上,阻止应用拖拽尺寸
|
|
9999
10104
|
if (this.isXAxisHover) {
|
|
10000
|
-
const cellWidth = this.hoverdDirection ===
|
|
10001
|
-
|
|
10105
|
+
const cellWidth = this.hoverdDirection === Position.left ? 0 : width;
|
|
10106
|
+
isPreventApplySize = deltaSize > 0 && left + cellWidth - clientX > 0;
|
|
10002
10107
|
}
|
|
10003
10108
|
else {
|
|
10004
|
-
const cellHeight = this.hoverdDirection ===
|
|
10005
|
-
|
|
10109
|
+
const cellHeight = this.hoverdDirection === Position.top ? 0 : height;
|
|
10110
|
+
isPreventApplySize = deltaSize > 0 && top + cellHeight - clientY > 0;
|
|
10006
10111
|
}
|
|
10007
|
-
if (
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
|
|
10112
|
+
if (isPreventApplySize) {
|
|
10113
|
+
return;
|
|
10114
|
+
}
|
|
10115
|
+
this.elementRef.nativeElement.classList.add(OVERLAY_ACTIVE_CLASS);
|
|
10116
|
+
this.applySize(deltaSize, previousSize);
|
|
10117
|
+
if (completeImmediately) {
|
|
10118
|
+
this._completeResizeOperation();
|
|
10013
10119
|
}
|
|
10014
10120
|
});
|
|
10015
10121
|
merge(this.resizeNotifier.resizeCanceled, this.resizeNotifier.resizeCompleted)
|
|
@@ -10034,7 +10140,6 @@ class TheTdComponent extends TheBaseElementComponent {
|
|
|
10034
10140
|
this.resizeRef = new ResizeRef(this.elementRef, this.overlayRef, this.tableOptions.minWidthPx, this.tableOptions.maxWidthPx, this.tableOptions.minHeightPx, this.tableOptions.maxHeightPx, () => {
|
|
10035
10141
|
this.updateOverlayHandleSizeAndOffset();
|
|
10036
10142
|
});
|
|
10037
|
-
this.resizeRef.setDirection(this.isXAxisHover ? 'X' : 'Y');
|
|
10038
10143
|
customTokens.set(ResizeRef, this.resizeRef);
|
|
10039
10144
|
customTokens.set(TableCellEventDispatcher, this.eventDispatcher);
|
|
10040
10145
|
customTokens.set(ColumnResizeNotifierSource, this.resizeNotifier);
|
|
@@ -10047,9 +10152,11 @@ class TheTdComponent extends TheBaseElementComponent {
|
|
|
10047
10152
|
}
|
|
10048
10153
|
updateOverlayHandleSizeAndOffset() {
|
|
10049
10154
|
var _a, _b;
|
|
10050
|
-
(_a = this.overlayRef) === null || _a === void 0 ? void 0 : _a.removePanelClass(['the-column-resize-handle-panel',
|
|
10155
|
+
(_a = this.overlayRef) === null || _a === void 0 ? void 0 : _a.removePanelClass(['the-column-resize-handle-panel', ...this.rowResizeClass]);
|
|
10051
10156
|
this.isXAxisHover ? this.updateOverlayHandleColumnSize() : this.updateOverlayHandleRowSize();
|
|
10052
10157
|
(_b = this.overlayRef) === null || _b === void 0 ? void 0 : _b.updatePositionStrategy(this.createPositionStrategy());
|
|
10158
|
+
this.resizeRef.setDirection(this.isXAxisHover ? 'X' : 'Y');
|
|
10159
|
+
this.resizeRef.setPosition(this.hoverdDirection);
|
|
10053
10160
|
}
|
|
10054
10161
|
updateOverlayHandleColumnSize() {
|
|
10055
10162
|
let height = 0;
|
|
@@ -10064,8 +10171,14 @@ class TheTdComponent extends TheBaseElementComponent {
|
|
|
10064
10171
|
this.overlayRef.updateSize({ height, width: OVERLAY_INIT_SIZE });
|
|
10065
10172
|
}
|
|
10066
10173
|
updateOverlayHandleRowSize() {
|
|
10067
|
-
const
|
|
10068
|
-
|
|
10174
|
+
const tableElement = this.tableComponent.nativeElement;
|
|
10175
|
+
const rowControl = tableElement.querySelector('.the-table-row-controls');
|
|
10176
|
+
let rowControlWidth = 11;
|
|
10177
|
+
if (rowControl) {
|
|
10178
|
+
rowControlWidth = rowControl.getBoundingClientRect().width;
|
|
10179
|
+
}
|
|
10180
|
+
const width = this.tableComponent.tableWrapper.nativeElement.offsetWidth + rowControlWidth;
|
|
10181
|
+
this.overlayRef.addPanelClass(this.rowResizeClass);
|
|
10069
10182
|
this.overlayRef.updateSize({ width, height: OVERLAY_INIT_SIZE });
|
|
10070
10183
|
}
|
|
10071
10184
|
applySize(deltaSize, previousSize) {
|
|
@@ -10091,7 +10204,7 @@ class TheTdComponent extends TheBaseElementComponent {
|
|
|
10091
10204
|
}
|
|
10092
10205
|
: {
|
|
10093
10206
|
height: OVERLAY_INIT_SIZE + 'px',
|
|
10094
|
-
panelClass:
|
|
10207
|
+
panelClass: this.rowResizeClass
|
|
10095
10208
|
};
|
|
10096
10209
|
return this.overlay.create(Object.assign({
|
|
10097
10210
|
// Always position the overlay based on left-indexed coordinates.
|
|
@@ -10223,15 +10336,13 @@ class TheTdComponent extends TheBaseElementComponent {
|
|
|
10223
10336
|
this.resizingStore.storeTableHeight(rows);
|
|
10224
10337
|
this.resizingStore.initDirection(deltaY, this.isXAxisHover);
|
|
10225
10338
|
let rowIndex = this.elementRef.nativeElement.parentElement.rowIndex - 1; // subtract thead's tr
|
|
10226
|
-
if (this.hoverdDirection ===
|
|
10339
|
+
if (this.hoverdDirection === Position.top) {
|
|
10227
10340
|
rowIndex = rowIndex - 1;
|
|
10228
10341
|
}
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
rowIndex = rowIndex + cellRowpsan - 1;
|
|
10232
|
-
}
|
|
10342
|
+
const rowSpan = this.elementRef.nativeElement.rowSpan;
|
|
10343
|
+
const bottomRowIndex = rowIndex + (rowSpan - 1) + 1;
|
|
10233
10344
|
if (deltaY > 0) {
|
|
10234
|
-
this.applyBottomRows(rows, deltaY,
|
|
10345
|
+
this.applyBottomRows(rows, deltaY, bottomRowIndex);
|
|
10235
10346
|
if (this.resizingStore.isRestoring(deltaY, this.isXAxisHover)) {
|
|
10236
10347
|
deltaY = this.resizingStore.restoreTopRows(deltaY);
|
|
10237
10348
|
}
|
|
@@ -10874,7 +10985,7 @@ class TheVerticalToolbarItemComponent extends TheToolbarBaseItemComponent {
|
|
|
10874
10985
|
}
|
|
10875
10986
|
}
|
|
10876
10987
|
TheVerticalToolbarItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheVerticalToolbarItemComponent, deps: [{ token: i0.ElementRef }, { token: i1$6.ThyPopover }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
10877
|
-
TheVerticalToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheVerticalToolbarItemComponent, selector: "the-toolbar-vertical-align-item", inputs: { item: "item", menus: "menus", editor: "editor", toolbarItem: "toolbarItem" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class.hide": "!active" }, classAttribute: "the-toolbar-dropdown-container verticalAlign" }, viewQueries: [{ propertyName: "template", first: true, predicate: ["VerticalAlignItems"], descendants: true, read: TemplateRef, static: true }], usesInheritance: true, ngImport: i0, template: "<a\n thyIconNavLink\n class=\"icon-mode link-with-down\"\n [thyTooltip]=\"toolbarItem?.name\"\n [thyIconNavLinkActive]=\"isOpened\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"execute($event)\"\n>\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n</a>\n\n<ng-template #VerticalAlignItems>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let menu of toolbarItem?.includes\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n [thyActionMenuItemActive]=\"menu.key === activeMenu?.key\"\n (mousedown)=\"itemMousedown($event, menu)\"\n >\n <span *ngIf=\"menu.icon\" thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu?.icon\"></thy-icon>\n </span>\n <span thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type:
|
|
10988
|
+
TheVerticalToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheVerticalToolbarItemComponent, selector: "the-toolbar-vertical-align-item", inputs: { item: "item", menus: "menus", editor: "editor", toolbarItem: "toolbarItem" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class.hide": "!active" }, classAttribute: "the-toolbar-dropdown-container verticalAlign" }, viewQueries: [{ propertyName: "template", first: true, predicate: ["VerticalAlignItems"], descendants: true, read: TemplateRef, static: true }], usesInheritance: true, ngImport: i0, template: "<a\n thyIconNavLink\n class=\"icon-mode link-with-down\"\n [thyTooltip]=\"toolbarItem?.name\"\n [thyIconNavLinkActive]=\"isOpened\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"execute($event)\"\n>\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n</a>\n\n<ng-template #VerticalAlignItems>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let menu of toolbarItem?.includes\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n [thyActionMenuItemActive]=\"menu.key === activeMenu?.key\"\n (mousedown)=\"itemMousedown($event, menu)\"\n >\n <span *ngIf=\"menu.icon\" thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu?.icon\"></thy-icon>\n </span>\n <span thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i3$1.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i3.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i2$1.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }], directives: [{ type: i5.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i2$1.ThyActionMenuItemActiveDirective, selector: "[thyActionMenuItemActive]", inputs: ["thyActionMenuItemActive"] }, { type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i2$1.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
|
|
10878
10989
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheVerticalToolbarItemComponent, decorators: [{
|
|
10879
10990
|
type: Component,
|
|
10880
10991
|
args: [{
|
|
@@ -11109,7 +11220,7 @@ TheToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0"
|
|
|
11109
11220
|
</ng-template>
|
|
11110
11221
|
<ng-template #tooltip let-data> {{ data.name }} {{ data.shortcutKey }} </ng-template>
|
|
11111
11222
|
<ng-container #toolbarContainer></ng-container>
|
|
11112
|
-
`, isInline: true, components: [{ type: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type:
|
|
11223
|
+
`, isInline: true, components: [{ type: i3$1.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i3.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
|
|
11113
11224
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheToolbarItemComponent, decorators: [{
|
|
11114
11225
|
type: Component,
|
|
11115
11226
|
args: [{
|
|
@@ -11202,7 +11313,7 @@ class TheQuickToolbarComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
11202
11313
|
}
|
|
11203
11314
|
}
|
|
11204
11315
|
TheQuickToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheQuickToolbarComponent, deps: [{ token: i1$3.ThyPopoverRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
11205
|
-
TheQuickToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheQuickToolbarComponent, selector: "the-quick-toolbar", inputs: { editor: "editor", quickToolbarItems: "quickToolbarItems" }, host: { listeners: { "document: mousedown": "handleMouseDown($event)", "document: keydown.enter": "handleEnter()", "document: keydown.escape": "handleEsc()" } }, usesInheritance: true, ngImport: i0, template: "<thy-selection-list\n class=\"the-quick-toolbar\"\n [thyBindKeyEventContainer]=\"editorElement\"\n (thySelectionChange)=\"selectionChange($event)\"\n [thyMultiple]=\"false\"\n>\n <ng-container *ngFor=\"let item of quickToolbarItems\">\n <ng-container *ngIf=\"item.key !== ToolbarActionTypes.split; else splitLine\">\n <thy-list-option [thyValue]=\"item?.key\" (mousedown)=\"stopPropagation($event)\">\n <the-toolbar-item [editor]=\"editor\" [item]=\"item\" [itemMode]=\"ToolbarItemMode.vertical\"></the-toolbar-item>\n </thy-list-option>\n </ng-container>\n </ng-container>\n</thy-selection-list>\n\n<ng-template #splitLine>\n <nav-split-line [mode]=\"ToolbarItemMode.horizontal\"></nav-split-line>\n</ng-template>\n", components: [{ type: i2$
|
|
11316
|
+
TheQuickToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheQuickToolbarComponent, selector: "the-quick-toolbar", inputs: { editor: "editor", quickToolbarItems: "quickToolbarItems" }, host: { listeners: { "document: mousedown": "handleMouseDown($event)", "document: keydown.enter": "handleEnter()", "document: keydown.escape": "handleEsc()" } }, usesInheritance: true, ngImport: i0, template: "<thy-selection-list\n class=\"the-quick-toolbar\"\n [thyBindKeyEventContainer]=\"editorElement\"\n (thySelectionChange)=\"selectionChange($event)\"\n [thyMultiple]=\"false\"\n>\n <ng-container *ngFor=\"let item of quickToolbarItems\">\n <ng-container *ngIf=\"item.key !== ToolbarActionTypes.split; else splitLine\">\n <thy-list-option [thyValue]=\"item?.key\" (mousedown)=\"stopPropagation($event)\">\n <the-toolbar-item [editor]=\"editor\" [item]=\"item\" [itemMode]=\"ToolbarItemMode.vertical\"></the-toolbar-item>\n </thy-list-option>\n </ng-container>\n </ng-container>\n</thy-selection-list>\n\n<ng-template #splitLine>\n <nav-split-line [mode]=\"ToolbarItemMode.horizontal\"></nav-split-line>\n</ng-template>\n", components: [{ type: i2$3.ThySelectionListComponent, selector: "thy-selection-list,[thy-selection-list]", inputs: ["thyMultiple", "thyBindKeyEventContainer", "thyScrollContainer", "thyBeforeKeydown", "thyUniqueKey", "thyCompareWith", "thyLayout", "thyAutoActiveFirstItem", "thySize", "thySpaceKeyEnabled"], outputs: ["thySelectionChange"] }, { type: i5$2.ThyListOptionComponent, selector: "thy-list-option,[thy-list-option]", inputs: ["id", "thyValue", "thyDisabled"] }, { type: TheToolbarItemComponent, selector: "the-toolbar-item", inputs: ["editor", "item", "itemMode"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }], directives: [{ type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
11206
11317
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheQuickToolbarComponent, decorators: [{
|
|
11207
11318
|
type: Component,
|
|
11208
11319
|
args: [{
|
|
@@ -11440,16 +11551,16 @@ class TheInlineCodeComponent extends TheBaseElementComponent {
|
|
|
11440
11551
|
}
|
|
11441
11552
|
}
|
|
11442
11553
|
TheInlineCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheInlineCodeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
11443
|
-
TheInlineCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheInlineCodeComponent, selector: "span[theInlineCode]", usesInheritance: true, ngImport: i0, template: `<span contenteditable="false"
|
|
11444
|
-
<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>
|
|
11445
|
-
<span contenteditable="false"
|
|
11554
|
+
TheInlineCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheInlineCodeComponent, selector: "span[theInlineCode]", usesInheritance: true, ngImport: i0, template: `<span contenteditable="false" class="the-break-char">{{ inlineChromiumBugfix }}</span>
|
|
11555
|
+
<span><slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children></span>
|
|
11556
|
+
<span contenteditable="false" class="the-break-char">{{ inlineChromiumBugfix }}</span>`, isInline: true, components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
11446
11557
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheInlineCodeComponent, decorators: [{
|
|
11447
11558
|
type: Component,
|
|
11448
11559
|
args: [{
|
|
11449
11560
|
selector: 'span[theInlineCode]',
|
|
11450
|
-
template: `<span contenteditable="false"
|
|
11451
|
-
<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>
|
|
11452
|
-
<span contenteditable="false"
|
|
11561
|
+
template: `<span contenteditable="false" class="the-break-char">{{ inlineChromiumBugfix }}</span>
|
|
11562
|
+
<span><slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children></span>
|
|
11563
|
+
<span contenteditable="false" class="the-break-char">{{ inlineChromiumBugfix }}</span>`
|
|
11453
11564
|
}]
|
|
11454
11565
|
}] });
|
|
11455
11566
|
|
|
@@ -11566,7 +11677,7 @@ class TheIndentToolbarComponent extends TheToolbarBaseItemComponent {
|
|
|
11566
11677
|
}
|
|
11567
11678
|
}
|
|
11568
11679
|
TheIndentToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheIndentToolbarComponent, deps: [{ token: i0.ElementRef }, { token: i1$3.ThyPopover }, { token: i0.ViewContainerRef }, { token: i2.Overlay }], target: i0.ɵɵFactoryTarget.Component });
|
|
11569
|
-
TheIndentToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheIndentToolbarComponent, selector: "the-indent-toolbar-item", inputs: { toolbarItem: "toolbarItem", menus: "menus", mode: "mode", item: "item" }, host: { listeners: { "mousedown": "toggleDropdown($event)", "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class.disabled": "this.disabledState" }, classAttribute: "the-toolbar-dropdown-container" }, viewQueries: [{ propertyName: "dropdownTemplate", first: true, predicate: ["dropdownTemplate"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<a thyIconNavLink class=\"icon-mode link-with-down\" [thyTooltip]=\"activeMenu?.name\" thyTooltipPlacement=\"top\">\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n</a>\n\n<ng-template #dropdownTemplate>\n <thy-action-menu class=\"dropdown-menu\">\n <ng-container *ngFor=\"let menu of menus\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n [thyTooltip]=\"tooltip\"\n [thyTooltipTemplateContext]=\"{ name: menu.name, shortcutKey: menu.shortcutKey }\"\n thyTooltipPlacement=\"right\"\n (mousedown)=\"itemMousedown($event, menu)\"\n >\n <span thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu.icon\"></thy-icon>\n </span>\n <span thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n\n<ng-template #tooltip let-data>{{ data?.shortcutKey }}</ng-template>\n", components: [{ type: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type:
|
|
11680
|
+
TheIndentToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheIndentToolbarComponent, selector: "the-indent-toolbar-item", inputs: { toolbarItem: "toolbarItem", menus: "menus", mode: "mode", item: "item" }, host: { listeners: { "mousedown": "toggleDropdown($event)", "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class.disabled": "this.disabledState" }, classAttribute: "the-toolbar-dropdown-container" }, viewQueries: [{ propertyName: "dropdownTemplate", first: true, predicate: ["dropdownTemplate"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<a thyIconNavLink class=\"icon-mode link-with-down\" [thyTooltip]=\"activeMenu?.name\" thyTooltipPlacement=\"top\">\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n</a>\n\n<ng-template #dropdownTemplate>\n <thy-action-menu class=\"dropdown-menu\">\n <ng-container *ngFor=\"let menu of menus\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n [thyTooltip]=\"tooltip\"\n [thyTooltipTemplateContext]=\"{ name: menu.name, shortcutKey: menu.shortcutKey }\"\n thyTooltipPlacement=\"right\"\n (mousedown)=\"itemMousedown($event, menu)\"\n >\n <span thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu.icon\"></thy-icon>\n </span>\n <span thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n\n<ng-template #tooltip let-data>{{ data?.shortcutKey }}</ng-template>\n", components: [{ type: i3$1.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i3.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i2$1.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }], directives: [{ type: i5.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i2$1.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i2$1.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
|
|
11570
11681
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheIndentToolbarComponent, decorators: [{
|
|
11571
11682
|
type: Component,
|
|
11572
11683
|
args: [{
|
|
@@ -11797,7 +11908,7 @@ const internalPlugins = [
|
|
|
11797
11908
|
}),
|
|
11798
11909
|
withBlockquote,
|
|
11799
11910
|
withNodeID({ idKey: ELEMENT_UNIQUE_ID, idCreator }),
|
|
11800
|
-
withAutoFormat(
|
|
11911
|
+
withAutoFormat(),
|
|
11801
11912
|
withTransforms(),
|
|
11802
11913
|
withTrailingNode({ type: ElementKinds.paragraph, level: 0 }),
|
|
11803
11914
|
withMoveSelection,
|
|
@@ -12171,7 +12282,7 @@ class TheToolbarComponent {
|
|
|
12171
12282
|
}
|
|
12172
12283
|
}
|
|
12173
12284
|
TheToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheToolbarComponent, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: TheToolbarGroupToken }], target: i0.ɵɵFactoryTarget.Component });
|
|
12174
|
-
TheToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheToolbarComponent, selector: "the-toolbar", inputs: { editor: "editor", toolbarItems: "toolbarItems", align: "align", containerClass: "containerClass", isMore: "isMore", afterTemplate: "afterTemplate" }, host: { classAttribute: "the-toolbar-container" }, viewQueries: [{ propertyName: "toolbarContainer", first: true, predicate: ["toolbarContainer"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: "<thy-icon-nav [style.justifyContent]=\"align\">\n <ng-container #toolbarContainer></ng-container>\n <ng-content></ng-content>\n <ng-template *ngIf=\"afterTemplate\" [ngTemplateOutlet]=\"afterTemplate\"></ng-template>\n</thy-icon-nav>\n", components: [{ type: i3.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }], directives: [{ type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
|
12285
|
+
TheToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheToolbarComponent, selector: "the-toolbar", inputs: { editor: "editor", toolbarItems: "toolbarItems", align: "align", containerClass: "containerClass", isMore: "isMore", afterTemplate: "afterTemplate" }, host: { classAttribute: "the-toolbar-container" }, viewQueries: [{ propertyName: "toolbarContainer", first: true, predicate: ["toolbarContainer"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: "<thy-icon-nav [style.justifyContent]=\"align\">\n <ng-container #toolbarContainer></ng-container>\n <ng-content></ng-content>\n <ng-template *ngIf=\"afterTemplate\" [ngTemplateOutlet]=\"afterTemplate\"></ng-template>\n</thy-icon-nav>\n", components: [{ type: i3$1.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }], directives: [{ type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
|
12175
12286
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheToolbarComponent, decorators: [{
|
|
12176
12287
|
type: Component,
|
|
12177
12288
|
args: [{
|
|
@@ -12393,7 +12504,7 @@ class TheQuickInsertComponent {
|
|
|
12393
12504
|
}
|
|
12394
12505
|
}
|
|
12395
12506
|
TheQuickInsertComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheQuickInsertComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
12396
|
-
TheQuickInsertComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: { editor: "editor", quickToolbarItems: "quickToolbarItems", isVisible: "isVisible" }, host: { listeners: { "mousedown": "handleMousedownNativeElement($event)" }, properties: { "class.hide": "isHide" }, classAttribute: "the-quick-insert" }, viewQueries: [{ propertyName: "iconElement", first: true, predicate: ["iconElement"], descendants: true, read: ElementRef }], ngImport: i0, template: "<thy-icon\n #iconElement\n [thyIconName]=\"displayIconName\"\n class=\"quick-insert-icon text-desc font-size-xlg\"\n (mouseenter)=\"mouseEnter($event)\"\n (mouseleave)=\"mouseLeave($event)\"\n (mousedown)=\"handleClick($event)\"\n></thy-icon>\n", components: [{ type:
|
|
12507
|
+
TheQuickInsertComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: { editor: "editor", quickToolbarItems: "quickToolbarItems", isVisible: "isVisible" }, host: { listeners: { "mousedown": "handleMousedownNativeElement($event)" }, properties: { "class.hide": "isHide" }, classAttribute: "the-quick-insert" }, viewQueries: [{ propertyName: "iconElement", first: true, predicate: ["iconElement"], descendants: true, read: ElementRef }], ngImport: i0, template: "<thy-icon\n #iconElement\n [thyIconName]=\"displayIconName\"\n class=\"quick-insert-icon text-desc font-size-xlg\"\n (mouseenter)=\"mouseEnter($event)\"\n (mouseleave)=\"mouseLeave($event)\"\n (mousedown)=\"handleClick($event)\"\n></thy-icon>\n", components: [{ type: i3.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }] });
|
|
12397
12508
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheQuickInsertComponent, decorators: [{
|
|
12398
12509
|
type: Component,
|
|
12399
12510
|
args: [{
|
|
@@ -12662,11 +12773,12 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
12662
12773
|
super.ngOnDestroy();
|
|
12663
12774
|
}
|
|
12664
12775
|
initialize() {
|
|
12665
|
-
var _a, _b;
|
|
12776
|
+
var _a, _b, _c;
|
|
12666
12777
|
this.editor = withTheEditor(this.thePlugins, withHistory(withAngular(createEditor(), CLIPBOARD_FORMAT_KEY)));
|
|
12667
12778
|
this.generateDecorate();
|
|
12668
12779
|
this.editor.disabled = (_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled;
|
|
12669
12780
|
this.editor.extraElementOptions = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.extraElementOptions;
|
|
12781
|
+
this.editor.extraAutoFormatRules = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.extraAutoFormatRules;
|
|
12670
12782
|
setEditorUUID(this.editor, idCreator());
|
|
12671
12783
|
this.theContextService.initialize({
|
|
12672
12784
|
theOptions: this.theOptions,
|
|
@@ -12876,7 +12988,7 @@ TheEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
|
|
|
12876
12988
|
useExisting: forwardRef(() => TheEditorComponent),
|
|
12877
12989
|
multi: true
|
|
12878
12990
|
}
|
|
12879
|
-
], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "quickInsertInstance", first: true, predicate: ["quickInsert"], descendants: true, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"theOptions?.toolbar?.align\"\n></the-toolbar>\n\n<div\n class=\"the-editable-container\"\n [ngClass]=\"{\n 'the-editor-disabled': theOptions?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n (ngModelChange)=\"valueChange($event)\"\n [decorate]=\"decorate\"\n [placeholder]=\"theOptions?.placeholder\"\n [placeholderDecorate]=\"theOptions?.placeholderDecorate ? theOptions?.placeholderDecorate : null\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [readonly]=\"theOptions?.readonly || theOptions?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [beforeInput]=\"onSlaBeforeInput\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [isStrictDecorate]=\"false\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [drop]=\"onDrop\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n <the-inline-toolbar\n *ngIf=\"!theOptions?.readonly && theOptions?.inlineToobarVisible\"\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.inline\"\n ></the-inline-toolbar>\n <div\n #quickInsert\n theQuickInsert\n [editor]=\"editor\"\n [quickToolbarItems]=\"quickToolbarItems\"\n [isVisible]=\"theOptions?.quickInsertVisible\"\n ></div>\n <the-template #templateInstance></the-template>\n</div>\n", components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }, { type: i1.SlateEditableComponent, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "placeholderDecorate", "isStrictDecorate", "trackBy", "readonly", "placeholder", "beforeInput", "blur", "click", "compositionEnd", "compositionStart", "copy", "cut", "dragOver", "dragStart", "dragEnd", "drop", "focus", "keydown", "paste", "spellCheck", "autoCorrect", "autoCapitalize"] }, { type: TheInlineToolbarComponent, selector: "the-inline-toolbar", inputs: ["editor", "toolbarItems"] }, { type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: ["editor", "quickToolbarItems", "isVisible"] }, { type: TheTemplateComponent, selector: "the-template,[theTemplate]" }], directives: [{ type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4
|
|
12991
|
+
], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "quickInsertInstance", first: true, predicate: ["quickInsert"], descendants: true, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"theOptions?.toolbar?.align\"\n></the-toolbar>\n\n<div\n class=\"the-editable-container\"\n [ngClass]=\"{\n 'the-editor-disabled': theOptions?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n (ngModelChange)=\"valueChange($event)\"\n [decorate]=\"decorate\"\n [placeholder]=\"theOptions?.placeholder\"\n [placeholderDecorate]=\"theOptions?.placeholderDecorate ? theOptions?.placeholderDecorate : null\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [readonly]=\"theOptions?.readonly || theOptions?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [beforeInput]=\"onSlaBeforeInput\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [isStrictDecorate]=\"false\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [drop]=\"onDrop\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n <the-inline-toolbar\n *ngIf=\"!theOptions?.readonly && theOptions?.inlineToobarVisible\"\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.inline\"\n ></the-inline-toolbar>\n <div\n #quickInsert\n theQuickInsert\n [editor]=\"editor\"\n [quickToolbarItems]=\"quickToolbarItems\"\n [isVisible]=\"theOptions?.quickInsertVisible\"\n ></div>\n <the-template #templateInstance></the-template>\n</div>\n", components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }, { type: i1.SlateEditableComponent, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "placeholderDecorate", "isStrictDecorate", "trackBy", "readonly", "placeholder", "beforeInput", "blur", "click", "compositionEnd", "compositionStart", "copy", "cut", "dragOver", "dragStart", "dragEnd", "drop", "focus", "keydown", "paste", "spellCheck", "autoCorrect", "autoCapitalize"] }, { type: TheInlineToolbarComponent, selector: "the-inline-toolbar", inputs: ["editor", "toolbarItems"] }, { type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: ["editor", "quickToolbarItems", "isVisible"] }, { type: TheTemplateComponent, selector: "the-template,[theTemplate]" }], directives: [{ type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
12880
12992
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheEditorComponent, decorators: [{
|
|
12881
12993
|
type: Component,
|
|
12882
12994
|
args: [{
|
|
@@ -13038,7 +13150,7 @@ class TheToolbarGroupComponent {
|
|
|
13038
13150
|
}
|
|
13039
13151
|
}
|
|
13040
13152
|
TheToolbarGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheToolbarGroupComponent, deps: [{ token: i0.ElementRef }, { token: i1$3.ThyPopover }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
13041
|
-
TheToolbarGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheToolbarGroupComponent, selector: "the-toolbar-group", inputs: { menus: "menus", item: "item" }, host: { listeners: { "mousedown": "mousedownHandler($event)", "click": "clickHandle($event)" }, classAttribute: "the-toolbar-group" }, viewQueries: [{ propertyName: "groupTemplate", first: true, predicate: ["groupTemplate"], descendants: true, read: TemplateRef, static: true }], ngImport: i0, template: "<a thyIconNavLink [thyIconNavLinkIcon]=\"item.icon\" [thyTooltip]=\"item?.name\" thyTooltipPlacement=\"top\" [thyIconNavLinkActive]=\"active\"></a>\n\n<ng-template #groupTemplate>\n <the-toolbar class=\"group\" [editor]=\"editor\" [toolbarItems]=\"menus\" [isMore]=\"false\"></the-toolbar>\n</ng-template>\n", components: [{ type: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }], directives: [{ type: i5.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
|
|
13153
|
+
TheToolbarGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheToolbarGroupComponent, selector: "the-toolbar-group", inputs: { menus: "menus", item: "item" }, host: { listeners: { "mousedown": "mousedownHandler($event)", "click": "clickHandle($event)" }, classAttribute: "the-toolbar-group" }, viewQueries: [{ propertyName: "groupTemplate", first: true, predicate: ["groupTemplate"], descendants: true, read: TemplateRef, static: true }], ngImport: i0, template: "<a thyIconNavLink [thyIconNavLinkIcon]=\"item.icon\" [thyTooltip]=\"item?.name\" thyTooltipPlacement=\"top\" [thyIconNavLinkActive]=\"active\"></a>\n\n<ng-template #groupTemplate>\n <the-toolbar class=\"group\" [editor]=\"editor\" [toolbarItems]=\"menus\" [isMore]=\"false\"></the-toolbar>\n</ng-template>\n", components: [{ type: i3$1.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }], directives: [{ type: i5.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
|
|
13042
13154
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheToolbarGroupComponent, decorators: [{
|
|
13043
13155
|
type: Component,
|
|
13044
13156
|
args: [{
|
|
@@ -13101,7 +13213,8 @@ const COMPONENTS = [
|
|
|
13101
13213
|
TheTableToolbarItemComponent,
|
|
13102
13214
|
TheConversionHintComponent,
|
|
13103
13215
|
TheVerticalToolbarItemComponent,
|
|
13104
|
-
TheIndentToolbarComponent
|
|
13216
|
+
TheIndentToolbarComponent,
|
|
13217
|
+
TheTableOptionsComponent
|
|
13105
13218
|
];
|
|
13106
13219
|
const PLUGIN_COMPONENTS = [
|
|
13107
13220
|
TheImageComponent,
|
|
@@ -13114,7 +13227,6 @@ const PLUGIN_COMPONENTS = [
|
|
|
13114
13227
|
TheNumberedListComponent,
|
|
13115
13228
|
TheCodeComponent,
|
|
13116
13229
|
TheLinkComponent,
|
|
13117
|
-
TheReadonlyLinkComponent,
|
|
13118
13230
|
TheLinkEditComponent,
|
|
13119
13231
|
TheLinkHoverComponent,
|
|
13120
13232
|
TheTableToolbarComponent,
|
|
@@ -13145,7 +13257,8 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
|
|
|
13145
13257
|
TheTableToolbarItemComponent,
|
|
13146
13258
|
TheConversionHintComponent,
|
|
13147
13259
|
TheVerticalToolbarItemComponent,
|
|
13148
|
-
TheIndentToolbarComponent,
|
|
13260
|
+
TheIndentToolbarComponent,
|
|
13261
|
+
TheTableOptionsComponent, TheImageComponent,
|
|
13149
13262
|
TheTemplateComponent,
|
|
13150
13263
|
TheHrComponent,
|
|
13151
13264
|
TheBlockquoteComponent,
|
|
@@ -13155,7 +13268,6 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
|
|
|
13155
13268
|
TheNumberedListComponent,
|
|
13156
13269
|
TheCodeComponent,
|
|
13157
13270
|
TheLinkComponent,
|
|
13158
|
-
TheReadonlyLinkComponent,
|
|
13159
13271
|
TheLinkEditComponent,
|
|
13160
13272
|
TheLinkHoverComponent,
|
|
13161
13273
|
TheTableToolbarComponent,
|
|
@@ -13211,5 +13323,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
13211
13323
|
* Generated bundle index. Do not edit.
|
|
13212
13324
|
*/
|
|
13213
13325
|
|
|
13214
|
-
export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeadingEditor, HrEditor, IS_MAC, ImageEditor, Indents, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LayoutTypes, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, QUICK_TOOLBAR_HOTKEY, QuickInsertEditor, STANDARD_HEADING_TYPES, TAB_SPACE, THE_CODE_MODE_PROVIDER, THE_CODE_MODE_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_QUICK_TOOLBAR_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheCodeConfig, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheMode, index$1 as TheQueries, TheToolbarBaseItemComponent, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemMode, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, coercePixelsFromCssValue, createEmptyParagraph, dataDeserialize, dataSerializing,
|
|
13326
|
+
export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeadingEditor, HrEditor, IS_MAC, ImageEditor, Indents, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LayoutTypes, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, QUICK_TOOLBAR_HOTKEY, QuickInsertEditor, STANDARD_HEADING_TYPES, TAB_SPACE, THE_CODE_MODE_PROVIDER, THE_CODE_MODE_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_QUICK_TOOLBAR_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheCodeConfig, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheMode, index$1 as TheQueries, TheToolbarBaseItemComponent, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemMode, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, coercePixelsFromCssValue, createEmptyParagraph, dataDeserialize, dataSerializing, getColsTotalWidth, getElementClassByPrefix, getElementHeight, getElementWidth, getRowsTotalHeight, getToolbarClass, htmlToTheia, inValidTypes, isCleanEmptyParagraph, mergeElementOptions, plainToTheia, toolbarCompose, useElementStyle, withTheEditor };
|
|
13215
13327
|
//# sourceMappingURL=worktile-theia.js.map
|