@worktile/theia 1.2.10 → 1.2.14
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 +208 -134
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/components/column-resize/column-resize.directive.d.ts +3 -3
- package/components/inline-toolbar/inline-toolbar.component.d.ts +4 -2
- package/components/inline-toolbar/inline-toolbar.component.scss +6 -5
- package/components/toolbar/toolbar.component.d.ts +2 -1
- package/custom-types.d.ts +2 -0
- package/editor.component.d.ts +2 -0
- package/esm2015/components/column-resize/column-resize.directive.js +1 -1
- package/esm2015/components/inline-toolbar/inline-toolbar.component.js +27 -11
- package/esm2015/components/toolbar/toolbar.component.js +7 -6
- package/esm2015/components/toolbar-group/toolbar-group.component.js +1 -1
- package/esm2015/custom-types.js +1 -1
- package/esm2015/editor.component.js +28 -14
- package/esm2015/interfaces/editor.js +1 -1
- package/esm2015/plugins/deserializers/deserialize-html.plugin.js +12 -4
- package/esm2015/plugins/deserializers/deserialize-md.plugin.js +2 -2
- package/esm2015/plugins/index.js +2 -2
- package/esm2015/plugins/placeholder/placeholder.component.js +21 -14
- package/esm2015/plugins/quick-insert/components/quick-insert.component.js +7 -6
- package/esm2015/plugins/quick-insert/quick-insert.plugint.js +3 -2
- package/esm2015/plugins/table/table.plugin.js +34 -55
- package/esm2015/plugins/table/table.types.js +1 -1
- package/esm2015/plugins/table/utils/normalize-table.js +31 -0
- package/esm2015/queries/is-container-type.js +2 -2
- package/esm2015/services/context.service.js +10 -2
- package/esm2015/transforms/index.js +2 -3
- package/esm2015/utils/auto-focus.js +2 -2
- package/esm2015/utils/fragment.js +24 -2
- package/fesm2015/worktile-theia.js +188 -125
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/editor.d.ts +2 -0
- package/package.json +1 -1
- package/plugins/placeholder/placeholder.component.d.ts +4 -2
- package/plugins/table/table.types.d.ts +7 -0
- package/plugins/table/utils/normalize-table.d.ts +2 -0
- package/services/context.service.d.ts +2 -0
- package/styles/editor.scss +3 -3
- package/transforms/index.d.ts +1 -2
- package/utils/fragment.d.ts +5 -0
- package/esm2015/transforms/insert-elements.js +0 -22
- package/transforms/insert-elements.d.ts +0 -2
|
@@ -1421,6 +1421,9 @@
|
|
|
1421
1421
|
if (fragment) {
|
|
1422
1422
|
var decoded = decodeURIComponent(window.atob(fragment));
|
|
1423
1423
|
var nodes = JSON.parse(decoded);
|
|
1424
|
+
if (!Array.isArray(nodes)) {
|
|
1425
|
+
nodes = [nodes];
|
|
1426
|
+
}
|
|
1424
1427
|
// delete key to avoid duplicate keys
|
|
1425
1428
|
if (deleteKey) {
|
|
1426
1429
|
deleteElementKey(nodes, deleteKey);
|
|
@@ -1440,6 +1443,25 @@
|
|
|
1440
1443
|
});
|
|
1441
1444
|
return nodes;
|
|
1442
1445
|
}
|
|
1446
|
+
/**
|
|
1447
|
+
* 删除 text 节点的 颜色/背景色
|
|
1448
|
+
* @param node
|
|
1449
|
+
*/
|
|
1450
|
+
function deleteColorAndBackgroundColorOfText(node) {
|
|
1451
|
+
node.children.forEach(function (child) {
|
|
1452
|
+
if (slate.Text.isText(child)) {
|
|
1453
|
+
if (child['color']) {
|
|
1454
|
+
delete child['color'];
|
|
1455
|
+
}
|
|
1456
|
+
if (child['background-color']) {
|
|
1457
|
+
delete child['background-color'];
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
else {
|
|
1461
|
+
deleteColorAndBackgroundColorOfText(child);
|
|
1462
|
+
}
|
|
1463
|
+
});
|
|
1464
|
+
}
|
|
1443
1465
|
|
|
1444
1466
|
var isAcrossBlocks = function (editor, fragment) {
|
|
1445
1467
|
var startBlock = getStartBlock(editor, fragment[0]);
|
|
@@ -1569,7 +1591,7 @@
|
|
|
1569
1591
|
return marks;
|
|
1570
1592
|
};
|
|
1571
1593
|
|
|
1572
|
-
var isContainer = function (editor, value) { return slate.Element.isElement(value) && editor.isContainer(value); };
|
|
1594
|
+
var isContainer = function (editor, value) { return slate.Element.isElement(value) && editor.isContainer && editor.isContainer(value); };
|
|
1573
1595
|
|
|
1574
1596
|
var getContainerBlocks = function (editor) {
|
|
1575
1597
|
var containerNode = slate.Editor.above(editor, {
|
|
@@ -1845,26 +1867,6 @@
|
|
|
1845
1867
|
i1.AngularEditor.focus(editor);
|
|
1846
1868
|
};
|
|
1847
1869
|
|
|
1848
|
-
var insertTheElements = function (editor, nodes) {
|
|
1849
|
-
if (slate.Range.isExpanded(editor.selection)) {
|
|
1850
|
-
slate.Editor.deleteFragment(editor);
|
|
1851
|
-
}
|
|
1852
|
-
var isEmptyParagraph$1 = isEmptyParagraph(editor, editor.selection.anchor);
|
|
1853
|
-
var parentPath = slate.Path.parent(editor.selection.anchor.path);
|
|
1854
|
-
slate.Editor.withoutNormalizing(editor, function () {
|
|
1855
|
-
slate.Transforms.insertNodes(editor, nodes);
|
|
1856
|
-
if (parentPath.length && isEmptyParagraph$1) {
|
|
1857
|
-
slate.Transforms.delete(editor, { at: parentPath });
|
|
1858
|
-
var lastPath = parentPath.pop();
|
|
1859
|
-
slate.Transforms.select(editor, slate.Editor.end(editor, __spreadArray(__spreadArray([], __read(parentPath)), [lastPath + nodes.length - 1])));
|
|
1860
|
-
}
|
|
1861
|
-
else {
|
|
1862
|
-
var lastPath = parentPath.pop();
|
|
1863
|
-
slate.Transforms.select(editor, slate.Editor.end(editor, __spreadArray(__spreadArray([], __read(parentPath)), [lastPath + nodes.length])));
|
|
1864
|
-
}
|
|
1865
|
-
});
|
|
1866
|
-
};
|
|
1867
|
-
|
|
1868
1870
|
var THE_EDITOR_UUID = new WeakMap();
|
|
1869
1871
|
var THE_EDITOR_CONVERSION_HINT_REF = new WeakMap();
|
|
1870
1872
|
var THE_EDITOR_QUICK_TOOLBAR_REF = new WeakMap();
|
|
@@ -1929,7 +1931,6 @@
|
|
|
1929
1931
|
splitNode: splitNode,
|
|
1930
1932
|
deleteElement: deleteElement,
|
|
1931
1933
|
setEndSelection: setEndSelection,
|
|
1932
|
-
insertTheElements: insertTheElements,
|
|
1933
1934
|
closeConversionHint: closeConversionHint,
|
|
1934
1935
|
handleContinualDeleteBackward: handleContinualDeleteBackward,
|
|
1935
1936
|
handleContinualInsertBreak: handleContinualInsertBreak
|
|
@@ -2412,7 +2413,7 @@
|
|
|
2412
2413
|
editor.undo();
|
|
2413
2414
|
setTimeout(function () {
|
|
2414
2415
|
slate.Transforms.select(editor, oldRange);
|
|
2415
|
-
|
|
2416
|
+
slate.Transforms.insertFragment(editor, fragment_1);
|
|
2416
2417
|
i1.AngularEditor.focus(editor);
|
|
2417
2418
|
});
|
|
2418
2419
|
return;
|
|
@@ -2654,10 +2655,18 @@
|
|
|
2654
2655
|
};
|
|
2655
2656
|
TheContextService.prototype.getOptions = function () {
|
|
2656
2657
|
if (!this.options.width) {
|
|
2657
|
-
|
|
2658
|
+
var firstElementChild = this.getFirstElementChild();
|
|
2659
|
+
this.options.width = firstElementChild.offsetWidth;
|
|
2658
2660
|
}
|
|
2659
2661
|
return this.options;
|
|
2660
2662
|
};
|
|
2663
|
+
TheContextService.prototype.getEditableElement = function () {
|
|
2664
|
+
return this.options.nativeElement.querySelector('.the-editor-typo');
|
|
2665
|
+
};
|
|
2666
|
+
TheContextService.prototype.getFirstElementChild = function () {
|
|
2667
|
+
var editableElement = this.getEditableElement();
|
|
2668
|
+
return editableElement === null || editableElement === void 0 ? void 0 : editableElement.firstElementChild;
|
|
2669
|
+
};
|
|
2661
2670
|
TheContextService.prototype.setUploadFileList = function (file) {
|
|
2662
2671
|
this.fileList.push(file);
|
|
2663
2672
|
};
|
|
@@ -10601,6 +10610,36 @@
|
|
|
10601
10610
|
args: ['cellInner', { static: true }]
|
|
10602
10611
|
}] } });
|
|
10603
10612
|
|
|
10613
|
+
var normalizeTable = function (table) {
|
|
10614
|
+
var normalizedNodes = [];
|
|
10615
|
+
var rowHeight = table.children.length;
|
|
10616
|
+
var columnWidth = table.children[0].children.length;
|
|
10617
|
+
table.children.forEach(function (row, rowIndex) {
|
|
10618
|
+
row.children.forEach(function (cell, columnIndex) {
|
|
10619
|
+
// case 1
|
|
10620
|
+
if (cell.colspan || cell.rowspan) {
|
|
10621
|
+
var rowspan = cell.rowspan || 1;
|
|
10622
|
+
var colspan = cell.colspan || 1;
|
|
10623
|
+
if (rowspan > rowHeight - rowIndex) {
|
|
10624
|
+
cell.rowspan = rowHeight - rowIndex;
|
|
10625
|
+
}
|
|
10626
|
+
if (colspan > columnWidth - columnIndex) {
|
|
10627
|
+
cell.colspan = columnWidth - columnIndex;
|
|
10628
|
+
}
|
|
10629
|
+
return;
|
|
10630
|
+
}
|
|
10631
|
+
// case 2
|
|
10632
|
+
if (cell.hidden && !normalizedNodes.includes(cell)) {
|
|
10633
|
+
var origin = calcOriginSpan(table, rowIndex, columnIndex);
|
|
10634
|
+
if (!origin) {
|
|
10635
|
+
delete table.children[rowIndex].children[columnIndex].hidden;
|
|
10636
|
+
}
|
|
10637
|
+
}
|
|
10638
|
+
});
|
|
10639
|
+
});
|
|
10640
|
+
return table;
|
|
10641
|
+
};
|
|
10642
|
+
|
|
10604
10643
|
var withTable = function (editor) {
|
|
10605
10644
|
var deleteBackward = editor.deleteBackward, deleteForward = editor.deleteForward, onKeydown = editor.onKeydown, setFragmentData = editor.setFragmentData, insertData = editor.insertData, normalizeNode = editor.normalizeNode, isBlockCard = editor.isBlockCard, renderElement = editor.renderElement, deleteCutData = editor.deleteCutData, isContainer = editor.isContainer;
|
|
10606
10645
|
editor.deleteBackward = function (unit) {
|
|
@@ -10779,49 +10818,26 @@
|
|
|
10779
10818
|
return;
|
|
10780
10819
|
}
|
|
10781
10820
|
var selection = editor.selection;
|
|
10782
|
-
var
|
|
10783
|
-
var tableComponent = i1.ELEMENT_TO_COMPONENT.get(
|
|
10821
|
+
var tablePosition = TablePosition.create(opts, editor, selection.anchor.path);
|
|
10822
|
+
var tableComponent = i1.ELEMENT_TO_COMPONENT.get(tablePosition.table);
|
|
10784
10823
|
var cells = tableComponent.tableStore.selectedCells;
|
|
10785
|
-
var
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
var
|
|
10792
|
-
var selectedRowsIndex = tableComponent.tableStore.selectedRowsIndex || [];
|
|
10793
|
-
var _loop_1 = function (cell) {
|
|
10794
|
-
var row = cell.row, col = cell.col;
|
|
10795
|
-
var cellPath = __spreadArray(__spreadArray([], __read(element.tableEntry[1])), [row, col]);
|
|
10796
|
-
cellNode = slate.Node.get(editor, cellPath);
|
|
10797
|
-
var cellRange = slate.Editor.range(editor, cellPath);
|
|
10798
|
-
var domRange = i1.AngularEditor.toDOMRange(editor, cellRange);
|
|
10799
|
-
if (!contents) {
|
|
10800
|
-
contents = domRange.cloneContents();
|
|
10801
|
-
}
|
|
10802
|
-
else {
|
|
10803
|
-
contents.append(domRange.cloneContents());
|
|
10804
|
-
}
|
|
10805
|
-
if ((selectedColumnsIndex.length === 1 && cellNode.colspan > 1) ||
|
|
10806
|
-
(selectedRowsIndex.length === 1 && cellNode.rowspan > 1)) {
|
|
10807
|
-
cellNode = Object.assign(Object.assign({}, cellNode), { colspan: selectedColumnsIndex.length === 1 ? null : cellNode.colspan, rowspan: selectedRowsIndex.length === 1 ? null : cellNode.rowspan });
|
|
10808
|
-
}
|
|
10809
|
-
if (cellNode.hidden) {
|
|
10810
|
-
var origin_1 = calcOriginSpan(element.table, row, col);
|
|
10811
|
-
var selectedOrigin = origin_1 && selectNodes.filter(function (item) { return item.node.key === origin_1.key; });
|
|
10812
|
-
if (!selectedOrigin || !selectedOrigin.length) {
|
|
10813
|
-
cellNode = Object.assign(Object.assign({}, cellNode), { hidden: null });
|
|
10814
|
-
}
|
|
10815
|
-
}
|
|
10816
|
-
if (!tableContent[row]) {
|
|
10817
|
-
tableContent[row] = [];
|
|
10818
|
-
}
|
|
10819
|
-
tableContent[row].push(cellNode);
|
|
10820
|
-
};
|
|
10824
|
+
var tableFragment = null;
|
|
10825
|
+
if (tableComponent.tableStore.selectedRowsIndex.length > 0) {
|
|
10826
|
+
var rows = tablePosition.table.children.slice(tableComponent.tableStore.selectedRowsIndex[0], tableComponent.tableStore.selectedRowsIndex[tableComponent.tableStore.selectedRowsIndex.length - 1] + 1);
|
|
10827
|
+
tableFragment = Object.assign(Object.assign({}, tablePosition.table), { children: rows });
|
|
10828
|
+
}
|
|
10829
|
+
else if (cells.length > 0) {
|
|
10830
|
+
var tempRows = {};
|
|
10821
10831
|
try {
|
|
10822
10832
|
for (var cells_1 = __values(cells), cells_1_1 = cells_1.next(); !cells_1_1.done; cells_1_1 = cells_1.next()) {
|
|
10823
10833
|
var cell = cells_1_1.value;
|
|
10824
|
-
|
|
10834
|
+
var row = cell.row, col = cell.col;
|
|
10835
|
+
var cellPath = __spreadArray(__spreadArray([], __read(tablePosition.tableEntry[1])), [row, col]);
|
|
10836
|
+
var cellNode = slate.Node.get(editor, cellPath);
|
|
10837
|
+
if (!tempRows[row]) {
|
|
10838
|
+
tempRows[row] = [];
|
|
10839
|
+
}
|
|
10840
|
+
tempRows[row].push(cellNode);
|
|
10825
10841
|
}
|
|
10826
10842
|
}
|
|
10827
10843
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -10831,28 +10847,26 @@
|
|
|
10831
10847
|
}
|
|
10832
10848
|
finally { if (e_1) throw e_1.error; }
|
|
10833
10849
|
}
|
|
10834
|
-
var
|
|
10850
|
+
var rows = Object.values(tempRows).map(function (item) {
|
|
10851
|
+
return {
|
|
10852
|
+
type: exports.ElementKinds.tableRow,
|
|
10853
|
+
children: item
|
|
10854
|
+
};
|
|
10855
|
+
});
|
|
10856
|
+
tableFragment =
|
|
10835
10857
|
{
|
|
10836
10858
|
type: exports.ElementKinds.table,
|
|
10837
|
-
children:
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
];
|
|
10845
|
-
fragment = tableFragment;
|
|
10846
|
-
var stringObj = JSON.stringify(fragment);
|
|
10859
|
+
children: rows
|
|
10860
|
+
};
|
|
10861
|
+
}
|
|
10862
|
+
if (tableFragment) {
|
|
10863
|
+
tableFragment = normalizeTable(_.cloneDeep(tableFragment));
|
|
10864
|
+
tableFragment = [tableFragment];
|
|
10865
|
+
var stringObj = JSON.stringify(tableFragment);
|
|
10847
10866
|
var encoded = window.btoa(encodeURIComponent(stringObj));
|
|
10848
10867
|
unit.setData("application/" + CLIPBOARD_FORMAT_KEY, encoded);
|
|
10849
|
-
|
|
10850
|
-
|
|
10851
|
-
div.setAttribute('hidden', 'true');
|
|
10852
|
-
document.body.appendChild(div);
|
|
10853
|
-
unit.setData('text/html', div.innerHTML);
|
|
10854
|
-
unit.setData('text/plain', i1.getPlainText(div));
|
|
10855
|
-
document.body.removeChild(div);
|
|
10868
|
+
// unit.setData('text/html', div.innerHTML);
|
|
10869
|
+
unit.setData('text/plain', slate.Node.string(tableFragment));
|
|
10856
10870
|
return;
|
|
10857
10871
|
}
|
|
10858
10872
|
setFragmentData(unit);
|
|
@@ -11020,7 +11034,15 @@
|
|
|
11020
11034
|
insertData(data);
|
|
11021
11035
|
return;
|
|
11022
11036
|
}
|
|
11023
|
-
|
|
11037
|
+
// 识出纯图片并且粘贴板中存在文件则不进行处理, hook 直接右键复制图片的场景,流转到上传图片流程
|
|
11038
|
+
// 后续需要做识别html图片后自动上传处理
|
|
11039
|
+
if (fragment.length === 1 && fragment[0].type === exports.ElementKinds.image && data.files.length > 0) {
|
|
11040
|
+
insertData(data);
|
|
11041
|
+
return;
|
|
11042
|
+
}
|
|
11043
|
+
// 过滤 text 节点的 color/background-color 属性
|
|
11044
|
+
fragment.forEach(function (node) { return deleteColorAndBackgroundColorOfText(node); });
|
|
11045
|
+
slate.Transforms.insertFragment(editor, fragment);
|
|
11024
11046
|
return;
|
|
11025
11047
|
}
|
|
11026
11048
|
insertData(data);
|
|
@@ -11535,10 +11557,11 @@
|
|
|
11535
11557
|
deleteBackward(unit);
|
|
11536
11558
|
};
|
|
11537
11559
|
editor.onChange = function () {
|
|
11560
|
+
var _a;
|
|
11538
11561
|
onChange();
|
|
11539
11562
|
if (editor.selection) {
|
|
11540
11563
|
var editorComponent = editor.injector.get(TheEditorComponent);
|
|
11541
|
-
editorComponent.quickInsertInstance.checkStatus();
|
|
11564
|
+
(_a = editorComponent.quickInsertInstance) === null || _a === void 0 ? void 0 : _a.checkStatus();
|
|
11542
11565
|
var block = slate.Node.ancestor(editor, [editor.selection.anchor.path[0]]);
|
|
11543
11566
|
if (!isCleanEmptyParagraph(editor) && slate.Node.string(block) !== QUICK_TOOLBAR_HOTKEY) {
|
|
11544
11567
|
QuickInsertEditor.closeQuickToolbar(editor);
|
|
@@ -11573,9 +11596,9 @@
|
|
|
11573
11596
|
withMoveSelection,
|
|
11574
11597
|
withInsertParagraphNodes(),
|
|
11575
11598
|
withGetFragment(),
|
|
11599
|
+
withImage,
|
|
11576
11600
|
withDeserializeHMTL,
|
|
11577
11601
|
withDeserializeMd(),
|
|
11578
|
-
withImage,
|
|
11579
11602
|
withQuickInsert
|
|
11580
11603
|
];
|
|
11581
11604
|
var internalToolbarItems = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(AlignOptions)), __read(MarkOptions)), __read(ColorOptions)), __read(HeadingOptions)), __read(TodoItemOptions)), __read(ListOptions)), __read(ImageOptions)), __read(HrOptions)), __read(BlockquoteOptions)), __read(CodeOptions)), __read(LinkOptions)), __read(TableOptions)), __read(VerticalAlignOptions)), __read(PaintFormatOptions));
|
|
@@ -11672,8 +11695,8 @@
|
|
|
11672
11695
|
setTimeout(function () {
|
|
11673
11696
|
if (editor && editor.children.length > 0 && isFocus) {
|
|
11674
11697
|
slateHistory.HistoryEditor.withoutMerging(editor, function () {
|
|
11675
|
-
i1.AngularEditor.focus(editor);
|
|
11676
11698
|
slate.Transforms.select(editor, slate.Editor.start(editor, [0]));
|
|
11699
|
+
i1.AngularEditor.focus(editor);
|
|
11677
11700
|
});
|
|
11678
11701
|
}
|
|
11679
11702
|
});
|
|
@@ -11714,6 +11737,7 @@
|
|
|
11714
11737
|
this.ngZone = ngZone;
|
|
11715
11738
|
this.toolbarGroupComponent = toolbarGroupComponent;
|
|
11716
11739
|
this.toolbarItems = [];
|
|
11740
|
+
this.containerClass = [];
|
|
11717
11741
|
this.isMore = true;
|
|
11718
11742
|
this.components = new Map();
|
|
11719
11743
|
this.moreGroupMenu = ToolbarMoreGroup;
|
|
@@ -11739,9 +11763,9 @@
|
|
|
11739
11763
|
}
|
|
11740
11764
|
};
|
|
11741
11765
|
TheToolbarComponent.prototype.setToolbarClass = function () {
|
|
11742
|
-
|
|
11743
|
-
|
|
11744
|
-
this.elementRef.nativeElement.classList.add(
|
|
11766
|
+
var _a;
|
|
11767
|
+
if (this.editor && !!this.containerClass.length) {
|
|
11768
|
+
(_a = this.elementRef.nativeElement.classList).add.apply(_a, __spreadArray([], __read(this.containerClass)));
|
|
11745
11769
|
}
|
|
11746
11770
|
};
|
|
11747
11771
|
TheToolbarComponent.prototype.resizeElement = function () {
|
|
@@ -11969,7 +11993,7 @@
|
|
|
11969
11993
|
return TheToolbarComponent;
|
|
11970
11994
|
}());
|
|
11971
11995
|
TheToolbarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheToolbarComponent, deps: [{ token: i0__namespace.ComponentFactoryResolver }, { token: i0__namespace.ElementRef }, { token: i0__namespace.NgZone }, { token: TheToolbarGroupToken }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
11972
|
-
TheToolbarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarComponent, selector: "the-toolbar", inputs: { editor: "editor", toolbarItems: "toolbarItems", align: "align", isMore: "isMore", afterTemplate: "afterTemplate" }, host: { classAttribute: "the-toolbar-container" }, viewQueries: [{ propertyName: "toolbarContainer", first: true, predicate: ["toolbarContainer"], descendants: true, read: i0.ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0__namespace, 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: i2__namespace.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
|
11996
|
+
TheToolbarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", 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: i0.ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0__namespace, 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: i2__namespace.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
|
11973
11997
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheToolbarComponent, decorators: [{
|
|
11974
11998
|
type: i0.Component,
|
|
11975
11999
|
args: [{
|
|
@@ -11990,6 +12014,8 @@
|
|
|
11990
12014
|
type: i0.Input
|
|
11991
12015
|
}], align: [{
|
|
11992
12016
|
type: i0.Input
|
|
12017
|
+
}], containerClass: [{
|
|
12018
|
+
type: i0.Input
|
|
11993
12019
|
}], isMore: [{
|
|
11994
12020
|
type: i0.Input
|
|
11995
12021
|
}], afterTemplate: [{
|
|
@@ -12000,11 +12026,12 @@
|
|
|
12000
12026
|
}] } });
|
|
12001
12027
|
|
|
12002
12028
|
var TheInlineToolbarComponent = /** @class */ (function () {
|
|
12003
|
-
function TheInlineToolbarComponent(elementRef, scrollDispatcher, cdr, ngZone) {
|
|
12029
|
+
function TheInlineToolbarComponent(elementRef, scrollDispatcher, cdr, ngZone, contextService) {
|
|
12004
12030
|
this.elementRef = elementRef;
|
|
12005
12031
|
this.scrollDispatcher = scrollDispatcher;
|
|
12006
12032
|
this.cdr = cdr;
|
|
12007
12033
|
this.ngZone = ngZone;
|
|
12034
|
+
this.contextService = contextService;
|
|
12008
12035
|
this.destroy$ = new rxjs.Subject();
|
|
12009
12036
|
}
|
|
12010
12037
|
TheInlineToolbarComponent.prototype.ngOnInit = function () {
|
|
@@ -12039,7 +12066,10 @@
|
|
|
12039
12066
|
}
|
|
12040
12067
|
var editor = this.editor;
|
|
12041
12068
|
var selection = editor.selection;
|
|
12042
|
-
if (!selection ||
|
|
12069
|
+
if (!selection ||
|
|
12070
|
+
!i1.AngularEditor.isFocused(editor) ||
|
|
12071
|
+
slate.Range.isCollapsed(selection) ||
|
|
12072
|
+
slate.Editor.string(editor, selection) === '') {
|
|
12043
12073
|
inlineToolbar.removeAttribute('style');
|
|
12044
12074
|
return;
|
|
12045
12075
|
}
|
|
@@ -12053,6 +12083,7 @@
|
|
|
12053
12083
|
}
|
|
12054
12084
|
};
|
|
12055
12085
|
TheInlineToolbarComponent.prototype.updatePosition = function (toolbarElement, range) {
|
|
12086
|
+
var e_1, _b;
|
|
12056
12087
|
var boundary = range.getBoundingClientRect();
|
|
12057
12088
|
if (!boundary || (boundary.height === 0 && boundary.width === 0 && range.startContainer === range.endContainer)) {
|
|
12058
12089
|
if (range.startContainer.nodeType === 1 && range.startContainer.querySelector('img')) {
|
|
@@ -12062,17 +12093,38 @@
|
|
|
12062
12093
|
boundary = range.startContainer.getBoundingClientRect();
|
|
12063
12094
|
}
|
|
12064
12095
|
}
|
|
12096
|
+
var editableElement = this.contextService.getEditableElement();
|
|
12097
|
+
var editableRect = editableElement.getBoundingClientRect();
|
|
12065
12098
|
var toolbarHeight = toolbarElement.offsetHeight;
|
|
12066
12099
|
var toolbarWidth = toolbarElement.offsetWidth;
|
|
12067
12100
|
var halfOffsetWidth = toolbarWidth / 2;
|
|
12068
12101
|
var defaultLeft = -halfOffsetWidth;
|
|
12102
|
+
var offsetLeft = boundary.left - editableRect.left;
|
|
12103
|
+
var isTopLeft = offsetLeft - 30 > halfOffsetWidth; // 30: editable padding left
|
|
12104
|
+
var isTopRight = editableRect.width - offsetLeft - boundary.width / 2 < halfOffsetWidth;
|
|
12069
12105
|
var positions = {};
|
|
12070
12106
|
positions.top = boundary.top - toolbarHeight;
|
|
12071
|
-
positions.left = boundary.left + boundary.width / 2 + defaultLeft;
|
|
12072
12107
|
positions.right = 'initial';
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
|
|
12108
|
+
positions.left = boundary.left;
|
|
12109
|
+
if (isTopLeft) {
|
|
12110
|
+
positions.left = boundary.left + boundary.width / 2 + defaultLeft;
|
|
12111
|
+
}
|
|
12112
|
+
if (isTopRight) {
|
|
12113
|
+
positions.left = boundary.right - toolbarWidth;
|
|
12114
|
+
}
|
|
12115
|
+
try {
|
|
12116
|
+
for (var _c = __values(Object.keys(positions)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
12117
|
+
var key = _d.value;
|
|
12118
|
+
toolbarElement.style[key] = positions[key] + (isNaN(positions[key]) ? '' : 'px');
|
|
12119
|
+
}
|
|
12120
|
+
}
|
|
12121
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
12122
|
+
finally {
|
|
12123
|
+
try {
|
|
12124
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
12125
|
+
}
|
|
12126
|
+
finally { if (e_1) throw e_1.error; }
|
|
12127
|
+
}
|
|
12076
12128
|
toolbarElement.style.opacity = '1';
|
|
12077
12129
|
};
|
|
12078
12130
|
TheInlineToolbarComponent.prototype.ngOnDestroy = function () {
|
|
@@ -12081,8 +12133,8 @@
|
|
|
12081
12133
|
};
|
|
12082
12134
|
return TheInlineToolbarComponent;
|
|
12083
12135
|
}());
|
|
12084
|
-
TheInlineToolbarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheInlineToolbarComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i2__namespace$1.ScrollDispatcher }, { token: i0__namespace.ChangeDetectorRef }, { token: i0__namespace.NgZone }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
12085
|
-
TheInlineToolbarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheInlineToolbarComponent, selector: "the-inline-toolbar", inputs: { editor: "editor", toolbarItems: "toolbarItems" }, host: { properties: { "class.hide": "toolbarItems.length === 0" } }, viewQueries: [{ propertyName: "inlineToolbar", first: true, predicate: ["inlineToolbar"], descendants: true }], ngImport: i0__namespace, template: "<the-toolbar\n #inlineToolbar\n class=\"the-inline-toolbar\"\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarItems\"\n [isMore]=\"false\"\n ></the-toolbar> ", isInline: true, components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "isMore", "afterTemplate"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
12136
|
+
TheInlineToolbarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheInlineToolbarComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i2__namespace$1.ScrollDispatcher }, { token: i0__namespace.ChangeDetectorRef }, { token: i0__namespace.NgZone }, { token: TheContextService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
12137
|
+
TheInlineToolbarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheInlineToolbarComponent, selector: "the-inline-toolbar", inputs: { editor: "editor", toolbarItems: "toolbarItems" }, host: { properties: { "class.hide": "toolbarItems.length === 0" } }, viewQueries: [{ propertyName: "inlineToolbar", first: true, predicate: ["inlineToolbar"], descendants: true }], ngImport: i0__namespace, template: "<the-toolbar\n #inlineToolbar\n class=\"the-inline-toolbar\"\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarItems\"\n [isMore]=\"false\"\n ></the-toolbar> ", isInline: true, components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
12086
12138
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheInlineToolbarComponent, decorators: [{
|
|
12087
12139
|
type: i0.Component,
|
|
12088
12140
|
args: [{
|
|
@@ -12093,7 +12145,7 @@
|
|
|
12093
12145
|
},
|
|
12094
12146
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
12095
12147
|
}]
|
|
12096
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i2__namespace$1.ScrollDispatcher }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }]; }, propDecorators: { editor: [{
|
|
12148
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i2__namespace$1.ScrollDispatcher }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }, { type: TheContextService }]; }, propDecorators: { editor: [{
|
|
12097
12149
|
type: i0.Input
|
|
12098
12150
|
}], toolbarItems: [{
|
|
12099
12151
|
type: i0.Input
|
|
@@ -12117,13 +12169,15 @@
|
|
|
12117
12169
|
event.stopPropagation();
|
|
12118
12170
|
};
|
|
12119
12171
|
TheQuickInsertComponent.prototype.checkStatus = function () {
|
|
12120
|
-
var
|
|
12172
|
+
var _this = this;
|
|
12121
12173
|
var editor = this.editor;
|
|
12122
12174
|
if (isCleanEmptyParagraph(editor)) {
|
|
12123
|
-
|
|
12124
|
-
|
|
12125
|
-
|
|
12126
|
-
|
|
12175
|
+
setTimeout(function () {
|
|
12176
|
+
var _a;
|
|
12177
|
+
var block = slate.Node.ancestor(editor, [(_a = editor === null || editor === void 0 ? void 0 : editor.selection) === null || _a === void 0 ? void 0 : _a.anchor.path[0]]);
|
|
12178
|
+
var rootNode = i1.AngularEditor.toDOMNode(editor, block);
|
|
12179
|
+
_this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
|
|
12180
|
+
});
|
|
12127
12181
|
return;
|
|
12128
12182
|
}
|
|
12129
12183
|
this.isHide = true;
|
|
@@ -12173,9 +12227,10 @@
|
|
|
12173
12227
|
}] } });
|
|
12174
12228
|
|
|
12175
12229
|
var ThePlaceholderComponent = /** @class */ (function () {
|
|
12176
|
-
function ThePlaceholderComponent(renderer, elementRef) {
|
|
12230
|
+
function ThePlaceholderComponent(renderer, elementRef, contextService) {
|
|
12177
12231
|
this.renderer = renderer;
|
|
12178
12232
|
this.elementRef = elementRef;
|
|
12233
|
+
this.contextService = contextService;
|
|
12179
12234
|
this.isHide = true;
|
|
12180
12235
|
}
|
|
12181
12236
|
ThePlaceholderComponent.prototype.handleCompositionStart = function () {
|
|
@@ -12190,20 +12245,26 @@
|
|
|
12190
12245
|
}
|
|
12191
12246
|
};
|
|
12192
12247
|
ThePlaceholderComponent.prototype.checkStatus = function () {
|
|
12193
|
-
var
|
|
12248
|
+
var _this = this;
|
|
12249
|
+
var _a, _b;
|
|
12194
12250
|
var editor = this.editor;
|
|
12251
|
+
var isEmptyShow = typeof ((_a = this.options) === null || _a === void 0 ? void 0 : _a.isEmptyShowPlaceholder) === 'undefined' ? true : this.options.isEmptyShowPlaceholder;
|
|
12252
|
+
var isMustShow = (_b = this.options) === null || _b === void 0 ? void 0 : _b.isMustShowPlaceholder;
|
|
12195
12253
|
// empty content and no selection processing
|
|
12196
|
-
if (
|
|
12197
|
-
|
|
12198
|
-
var
|
|
12199
|
-
|
|
12254
|
+
if (isEmptyShow && isEmptyContent(editor.children)) {
|
|
12255
|
+
var firstElementChild = this.contextService.getFirstElementChild();
|
|
12256
|
+
var offsetTop = firstElementChild.offsetTop;
|
|
12257
|
+
var offsetLeft = firstElementChild.offsetLeft;
|
|
12258
|
+
this.updatePosition(offsetLeft, offsetTop);
|
|
12200
12259
|
return;
|
|
12201
12260
|
}
|
|
12202
|
-
if (isCleanEmptyParagraph(editor)) {
|
|
12203
|
-
|
|
12204
|
-
|
|
12205
|
-
|
|
12206
|
-
|
|
12261
|
+
if (isMustShow && isCleanEmptyParagraph(editor)) {
|
|
12262
|
+
setTimeout(function () {
|
|
12263
|
+
var _a;
|
|
12264
|
+
var block = slate.Node.ancestor(editor, [(_a = editor === null || editor === void 0 ? void 0 : editor.selection) === null || _a === void 0 ? void 0 : _a.anchor.path[0]]);
|
|
12265
|
+
var rootNode = i1.AngularEditor.toDOMNode(editor, block);
|
|
12266
|
+
_this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
|
|
12267
|
+
});
|
|
12207
12268
|
return;
|
|
12208
12269
|
}
|
|
12209
12270
|
this.isHide = true;
|
|
@@ -12218,7 +12279,7 @@
|
|
|
12218
12279
|
};
|
|
12219
12280
|
return ThePlaceholderComponent;
|
|
12220
12281
|
}());
|
|
12221
|
-
ThePlaceholderComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: ThePlaceholderComponent, deps: [{ token: i0__namespace.Renderer2 }, { token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
12282
|
+
ThePlaceholderComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: ThePlaceholderComponent, deps: [{ token: i0__namespace.Renderer2 }, { token: i0__namespace.ElementRef }, { token: TheContextService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
12222
12283
|
ThePlaceholderComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: { editor: "editor", options: "options" }, host: { listeners: { "document:compositionstart": "handleCompositionStart()", "document:compositionend": "handleCompositionEnd($event)" }, properties: { "class.hide": "isHide" }, classAttribute: "the-placeholder" }, ngImport: i0__namespace, template: "{{ options?.placeholder }}", isInline: true });
|
|
12223
12284
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: ThePlaceholderComponent, decorators: [{
|
|
12224
12285
|
type: i0.Component,
|
|
@@ -12230,7 +12291,7 @@
|
|
|
12230
12291
|
'[class.hide]': 'isHide'
|
|
12231
12292
|
}
|
|
12232
12293
|
}]
|
|
12233
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.Renderer2 }, { type: i0__namespace.ElementRef }]; }, propDecorators: { editor: [{
|
|
12294
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.Renderer2 }, { type: i0__namespace.ElementRef }, { type: TheContextService }]; }, propDecorators: { editor: [{
|
|
12234
12295
|
type: i0.Input
|
|
12235
12296
|
}], options: [{
|
|
12236
12297
|
type: i0.Input
|
|
@@ -12408,6 +12469,12 @@
|
|
|
12408
12469
|
_this.onSlaCompositionEnd = function (event) { };
|
|
12409
12470
|
_this.onSlaDragStart = function (event) { };
|
|
12410
12471
|
_this.onSlaDragOver = function (event) { };
|
|
12472
|
+
_this.onDrop = function (event) {
|
|
12473
|
+
event.stopPropagation();
|
|
12474
|
+
_this.theOnDOMEvent.emit({
|
|
12475
|
+
nativeEvent: event
|
|
12476
|
+
});
|
|
12477
|
+
};
|
|
12411
12478
|
return _this;
|
|
12412
12479
|
}
|
|
12413
12480
|
Object.defineProperty(TheEditorComponent.prototype, "theGlobalToolbarInstance", {
|
|
@@ -12438,15 +12505,18 @@
|
|
|
12438
12505
|
this.onErrorHandler();
|
|
12439
12506
|
};
|
|
12440
12507
|
TheEditorComponent.prototype.ngOnChanges = function (changes) {
|
|
12441
|
-
var _a, _b, _c;
|
|
12508
|
+
var _a, _b, _c, _d, _e;
|
|
12442
12509
|
var options = changes.theOptions;
|
|
12443
12510
|
if (options) {
|
|
12444
12511
|
this.initializeOptions();
|
|
12445
12512
|
}
|
|
12513
|
+
if (options && ((_a = options.currentValue) === null || _a === void 0 ? void 0 : _a.readonly) !== ((_b = options.previousValue) === null || _b === void 0 ? void 0 : _b.readonly)) {
|
|
12514
|
+
this.applyAutoFocus();
|
|
12515
|
+
}
|
|
12446
12516
|
if (changes['theDecorate']) {
|
|
12447
12517
|
this.generateDecorate();
|
|
12448
12518
|
}
|
|
12449
|
-
if (((
|
|
12519
|
+
if (((_c = this.editor) === null || _c === void 0 ? void 0 : _c.selection) && (((_d = options === null || options === void 0 ? void 0 : options.currentValue) === null || _d === void 0 ? void 0 : _d.readonly) || ((_e = options === null || options === void 0 ? void 0 : options.currentValue) === null || _e === void 0 ? void 0 : _e.disabled))) {
|
|
12450
12520
|
slate.Transforms.deselect(this.editor);
|
|
12451
12521
|
}
|
|
12452
12522
|
};
|
|
@@ -12464,7 +12534,9 @@
|
|
|
12464
12534
|
this.theContextService.initialize({ nativeElement: this.elementRef.nativeElement, viewContainerRef: this.viewContainerRef });
|
|
12465
12535
|
this.toolbarCalculate();
|
|
12466
12536
|
setTimeout(function () {
|
|
12537
|
+
var _a;
|
|
12467
12538
|
_this.theEditorCreated.emit(_this.editor);
|
|
12539
|
+
(_a = _this.placeholderInstance) === null || _a === void 0 ? void 0 : _a.checkStatus();
|
|
12468
12540
|
_this.applyAutoFocus();
|
|
12469
12541
|
});
|
|
12470
12542
|
};
|
|
@@ -12480,9 +12552,9 @@
|
|
|
12480
12552
|
}
|
|
12481
12553
|
};
|
|
12482
12554
|
TheEditorComponent.prototype.applyAutoFocus = function () {
|
|
12483
|
-
var _a, _b, _c
|
|
12484
|
-
if (((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.
|
|
12485
|
-
autoFocus(this.editor, (
|
|
12555
|
+
var _a, _b, _c;
|
|
12556
|
+
if (!((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled) && !((_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.readonly)) {
|
|
12557
|
+
autoFocus(this.editor, (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.autoFocus);
|
|
12486
12558
|
}
|
|
12487
12559
|
};
|
|
12488
12560
|
TheEditorComponent.prototype.toolbarCalculate = function () {
|
|
@@ -12490,10 +12562,12 @@
|
|
|
12490
12562
|
var toolbar = (_a = this === null || this === void 0 ? void 0 : this.theOptions) === null || _a === void 0 ? void 0 : _a.toolbar;
|
|
12491
12563
|
var toolbarItems = toolbarCompose(toolbar === null || toolbar === void 0 ? void 0 : toolbar.toolbarItems);
|
|
12492
12564
|
var toolbarOption = this.toolbarService.initialize(toolbarItems, toolbar === null || toolbar === void 0 ? void 0 : toolbar.global, toolbar === null || toolbar === void 0 ? void 0 : toolbar.inline, toolbar === null || toolbar === void 0 ? void 0 : toolbar.quick);
|
|
12565
|
+
this.globalToolbarClass = ['the-global-toolbar', getToolbarClass(this.editor)];
|
|
12493
12566
|
this.toolbarEntity = toolbarOption.toolbarEntity;
|
|
12494
12567
|
if (this.theGlobalToolbar) {
|
|
12495
12568
|
this.theGlobalToolbarInstance.editor = this.editor;
|
|
12496
12569
|
this.theGlobalToolbarInstance.toolbarItems = toolbarOption.toolbarEntity.global;
|
|
12570
|
+
this.theGlobalToolbarInstance.containerClass = this.globalToolbarClass;
|
|
12497
12571
|
this.theGlobalToolbarInstance.align = toolbar === null || toolbar === void 0 ? void 0 : toolbar.align;
|
|
12498
12572
|
this.theGlobalToolbarInstance.setToolbarClass();
|
|
12499
12573
|
this.theGlobalToolbarInstance.renderToolbarView();
|
|
@@ -12512,14 +12586,14 @@
|
|
|
12512
12586
|
this.onTouchedCallback = fn;
|
|
12513
12587
|
};
|
|
12514
12588
|
TheEditorComponent.prototype.valueChange = function (value) {
|
|
12515
|
-
var _a, _b, _c, _d;
|
|
12589
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12516
12590
|
(_a = this.theGlobalToolbarInstance) === null || _a === void 0 ? void 0 : _a.statusChange(this.editor);
|
|
12517
|
-
this.quickInsertInstance.checkStatus();
|
|
12518
|
-
this.placeholderInstance.checkStatus();
|
|
12591
|
+
(_b = this.quickInsertInstance) === null || _b === void 0 ? void 0 : _b.checkStatus();
|
|
12592
|
+
(_c = this.placeholderInstance) === null || _c === void 0 ? void 0 : _c.checkStatus();
|
|
12519
12593
|
// auto scroll view
|
|
12520
|
-
var scrollContainer = (
|
|
12521
|
-
var maxHeight = (
|
|
12522
|
-
if (!((
|
|
12594
|
+
var scrollContainer = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.scrollContainer;
|
|
12595
|
+
var maxHeight = (_e = this.theOptions) === null || _e === void 0 ? void 0 : _e.maxHeight;
|
|
12596
|
+
if (!((_f = this.theOptions) === null || _f === void 0 ? void 0 : _f.readonly) && (scrollContainer || maxHeight)) {
|
|
12523
12597
|
var container = maxHeight ? DEFAULT_SCROLL_CONTAINER : scrollContainer;
|
|
12524
12598
|
this.autoScrollView(this.editor, container);
|
|
12525
12599
|
}
|
|
@@ -12595,18 +12669,18 @@
|
|
|
12595
12669
|
}
|
|
12596
12670
|
};
|
|
12597
12671
|
TheEditorComponent.prototype.handleSelectAll = function () {
|
|
12598
|
-
var
|
|
12672
|
+
var _g;
|
|
12599
12673
|
var node;
|
|
12600
12674
|
if (!this.editor.selection) {
|
|
12601
12675
|
setEndSelection(this.editor);
|
|
12602
12676
|
}
|
|
12603
|
-
var
|
|
12677
|
+
var _h = __read(slate.Range.edges(this.editor.selection), 2), start = _h[0], end = _h[1];
|
|
12604
12678
|
var selectionRange = slate.Editor.range(this.editor, start, end);
|
|
12605
12679
|
var containerBlocks = getContainerBlocks(this.editor);
|
|
12606
12680
|
for (var i = 0; i < containerBlocks.length; i++) {
|
|
12607
|
-
|
|
12681
|
+
_g = __read(getNodesByType(this.editor, containerBlocks[i]), 1), node = _g[0];
|
|
12608
12682
|
if (node) {
|
|
12609
|
-
var
|
|
12683
|
+
var _j = __read(node, 2), path = _j[1];
|
|
12610
12684
|
var isStartParent = slate.Path.equals(path, start.path.slice(0, path.length));
|
|
12611
12685
|
var isEndParent = slate.Path.equals(path, end.path.slice(0, path.length));
|
|
12612
12686
|
if (isStartParent && isEndParent) {
|
|
@@ -12649,7 +12723,7 @@
|
|
|
12649
12723
|
useExisting: i0.forwardRef(function () { return TheEditorComponent; }),
|
|
12650
12724
|
multi: true
|
|
12651
12725
|
}
|
|
12652
|
-
], 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 }, { propertyName: "placeholderInstance", first: true, predicate: ["placeholder"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, 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 [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 [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 (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n <the-inline-toolbar *ngIf=\"!theOptions
|
|
12726
|
+
], 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 }, { propertyName: "placeholderInstance", first: true, predicate: ["placeholder"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, 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 [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 *ngIf=\"!theOptions?.readonly\" [editor]=\"editor\" [toolbarItems]=\"toolbarEntity.inline\"></the-inline-toolbar>\n <div #quickInsert theQuickInsert [editor]=\"editor\" [quickToolbarItems]=\"quickToolbarItems\"></div>\n <div #placeholder thePlaceholder [editor]=\"editor\" [options]=\"theOptions\"></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__namespace.SlateEditableComponent, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "isStrictDecorate", "trackBy", "readonly", "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"] }, { type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: ["editor", "options"] }, { type: TheTemplateComponent, selector: "the-template,[theTemplate]" }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4__namespace$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4__namespace$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
12653
12727
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheEditorComponent, decorators: [{
|
|
12654
12728
|
type: i0.Component,
|
|
12655
12729
|
args: [{
|
|
@@ -12694,7 +12768,7 @@
|
|
|
12694
12768
|
args: ['globalToolbar']
|
|
12695
12769
|
}], quickInsertInstance: [{
|
|
12696
12770
|
type: i0.ViewChild,
|
|
12697
|
-
args: ['quickInsert']
|
|
12771
|
+
args: ['quickInsert', { static: true }]
|
|
12698
12772
|
}], placeholderInstance: [{
|
|
12699
12773
|
type: i0.ViewChild,
|
|
12700
12774
|
args: ['placeholder']
|
|
@@ -12830,7 +12904,7 @@
|
|
|
12830
12904
|
return TheToolbarGroupComponent;
|
|
12831
12905
|
}());
|
|
12832
12906
|
TheToolbarGroupComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheToolbarGroupComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i1__namespace$3.ThyPopover }, { token: i0__namespace.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
12833
|
-
TheToolbarGroupComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", 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: i0.TemplateRef, static: true }], ngImport: i0__namespace, 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: i2__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "isMore", "afterTemplate"] }], directives: [{ type: i7__namespace.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
|
|
12907
|
+
TheToolbarGroupComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", 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: i0.TemplateRef, static: true }], ngImport: i0__namespace, 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: i2__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }], directives: [{ type: i7__namespace.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
|
|
12834
12908
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheToolbarGroupComponent, decorators: [{
|
|
12835
12909
|
type: i0.Component,
|
|
12836
12910
|
args: [{
|