@worktile/theia 1.2.12 → 1.2.13
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 +128 -97
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/components/inline-toolbar/inline-toolbar.component.d.ts +3 -1
- package/editor.component.d.ts +1 -0
- package/esm2015/components/inline-toolbar/inline-toolbar.component.js +10 -7
- package/esm2015/editor.component.js +21 -12
- package/esm2015/plugins/placeholder/placeholder.component.js +17 -14
- package/esm2015/plugins/quick-insert/components/quick-insert.component.js +7 -6
- package/esm2015/plugins/table/table.plugin.js +34 -55
- package/esm2015/plugins/table/utils/normalize-table.js +31 -0
- package/esm2015/services/context.service.js +10 -2
- package/esm2015/utils/auto-focus.js +2 -2
- package/esm2015/utils/fragment.js +5 -2
- package/fesm2015/worktile-theia.js +121 -88
- package/fesm2015/worktile-theia.js.map +1 -1
- package/package.json +1 -1
- package/plugins/placeholder/placeholder.component.d.ts +5 -4
- package/plugins/table/utils/normalize-table.d.ts +2 -0
- package/services/context.service.d.ts +2 -0
- package/styles/editor.scss +3 -3
|
@@ -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);
|
|
@@ -2652,10 +2655,18 @@
|
|
|
2652
2655
|
};
|
|
2653
2656
|
TheContextService.prototype.getOptions = function () {
|
|
2654
2657
|
if (!this.options.width) {
|
|
2655
|
-
|
|
2658
|
+
var firstElementChild = this.getFirstElementChild();
|
|
2659
|
+
this.options.width = firstElementChild.offsetWidth;
|
|
2656
2660
|
}
|
|
2657
2661
|
return this.options;
|
|
2658
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
|
+
};
|
|
2659
2670
|
TheContextService.prototype.setUploadFileList = function (file) {
|
|
2660
2671
|
this.fileList.push(file);
|
|
2661
2672
|
};
|
|
@@ -10599,6 +10610,36 @@
|
|
|
10599
10610
|
args: ['cellInner', { static: true }]
|
|
10600
10611
|
}] } });
|
|
10601
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
|
+
|
|
10602
10643
|
var withTable = function (editor) {
|
|
10603
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;
|
|
10604
10645
|
editor.deleteBackward = function (unit) {
|
|
@@ -10777,49 +10818,26 @@
|
|
|
10777
10818
|
return;
|
|
10778
10819
|
}
|
|
10779
10820
|
var selection = editor.selection;
|
|
10780
|
-
var
|
|
10781
|
-
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);
|
|
10782
10823
|
var cells = tableComponent.tableStore.selectedCells;
|
|
10783
|
-
var
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
var
|
|
10790
|
-
var selectedRowsIndex = tableComponent.tableStore.selectedRowsIndex || [];
|
|
10791
|
-
var _loop_1 = function (cell) {
|
|
10792
|
-
var row = cell.row, col = cell.col;
|
|
10793
|
-
var cellPath = __spreadArray(__spreadArray([], __read(element.tableEntry[1])), [row, col]);
|
|
10794
|
-
cellNode = slate.Node.get(editor, cellPath);
|
|
10795
|
-
var cellRange = slate.Editor.range(editor, cellPath);
|
|
10796
|
-
var domRange = i1.AngularEditor.toDOMRange(editor, cellRange);
|
|
10797
|
-
if (!contents) {
|
|
10798
|
-
contents = domRange.cloneContents();
|
|
10799
|
-
}
|
|
10800
|
-
else {
|
|
10801
|
-
contents.append(domRange.cloneContents());
|
|
10802
|
-
}
|
|
10803
|
-
if ((selectedColumnsIndex.length === 1 && cellNode.colspan > 1) ||
|
|
10804
|
-
(selectedRowsIndex.length === 1 && cellNode.rowspan > 1)) {
|
|
10805
|
-
cellNode = Object.assign(Object.assign({}, cellNode), { colspan: selectedColumnsIndex.length === 1 ? null : cellNode.colspan, rowspan: selectedRowsIndex.length === 1 ? null : cellNode.rowspan });
|
|
10806
|
-
}
|
|
10807
|
-
if (cellNode.hidden) {
|
|
10808
|
-
var origin_1 = calcOriginSpan(element.table, row, col);
|
|
10809
|
-
var selectedOrigin = origin_1 && selectNodes.filter(function (item) { return item.node.key === origin_1.key; });
|
|
10810
|
-
if (!selectedOrigin || !selectedOrigin.length) {
|
|
10811
|
-
cellNode = Object.assign(Object.assign({}, cellNode), { hidden: null });
|
|
10812
|
-
}
|
|
10813
|
-
}
|
|
10814
|
-
if (!tableContent[row]) {
|
|
10815
|
-
tableContent[row] = [];
|
|
10816
|
-
}
|
|
10817
|
-
tableContent[row].push(cellNode);
|
|
10818
|
-
};
|
|
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 = {};
|
|
10819
10831
|
try {
|
|
10820
10832
|
for (var cells_1 = __values(cells), cells_1_1 = cells_1.next(); !cells_1_1.done; cells_1_1 = cells_1.next()) {
|
|
10821
10833
|
var cell = cells_1_1.value;
|
|
10822
|
-
|
|
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);
|
|
10823
10841
|
}
|
|
10824
10842
|
}
|
|
10825
10843
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -10829,28 +10847,26 @@
|
|
|
10829
10847
|
}
|
|
10830
10848
|
finally { if (e_1) throw e_1.error; }
|
|
10831
10849
|
}
|
|
10832
|
-
var
|
|
10850
|
+
var rows = Object.values(tempRows).map(function (item) {
|
|
10851
|
+
return {
|
|
10852
|
+
type: exports.ElementKinds.tableRow,
|
|
10853
|
+
children: item
|
|
10854
|
+
};
|
|
10855
|
+
});
|
|
10856
|
+
tableFragment =
|
|
10833
10857
|
{
|
|
10834
10858
|
type: exports.ElementKinds.table,
|
|
10835
|
-
children:
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
];
|
|
10843
|
-
fragment = tableFragment;
|
|
10844
|
-
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);
|
|
10845
10866
|
var encoded = window.btoa(encodeURIComponent(stringObj));
|
|
10846
10867
|
unit.setData("application/" + CLIPBOARD_FORMAT_KEY, encoded);
|
|
10847
|
-
|
|
10848
|
-
|
|
10849
|
-
div.setAttribute('hidden', 'true');
|
|
10850
|
-
document.body.appendChild(div);
|
|
10851
|
-
unit.setData('text/html', div.innerHTML);
|
|
10852
|
-
unit.setData('text/plain', i1.getPlainText(div));
|
|
10853
|
-
document.body.removeChild(div);
|
|
10868
|
+
// unit.setData('text/html', div.innerHTML);
|
|
10869
|
+
unit.setData('text/plain', slate.Node.string(tableFragment));
|
|
10854
10870
|
return;
|
|
10855
10871
|
}
|
|
10856
10872
|
setFragmentData(unit);
|
|
@@ -11673,8 +11689,8 @@
|
|
|
11673
11689
|
setTimeout(function () {
|
|
11674
11690
|
if (editor && editor.children.length > 0 && isFocus) {
|
|
11675
11691
|
slateHistory.HistoryEditor.withoutMerging(editor, function () {
|
|
11676
|
-
i1.AngularEditor.focus(editor);
|
|
11677
11692
|
slate.Transforms.select(editor, slate.Editor.start(editor, [0]));
|
|
11693
|
+
i1.AngularEditor.focus(editor);
|
|
11678
11694
|
});
|
|
11679
11695
|
}
|
|
11680
11696
|
});
|
|
@@ -12004,11 +12020,12 @@
|
|
|
12004
12020
|
}] } });
|
|
12005
12021
|
|
|
12006
12022
|
var TheInlineToolbarComponent = /** @class */ (function () {
|
|
12007
|
-
function TheInlineToolbarComponent(elementRef, scrollDispatcher, cdr, ngZone) {
|
|
12023
|
+
function TheInlineToolbarComponent(elementRef, scrollDispatcher, cdr, ngZone, contextService) {
|
|
12008
12024
|
this.elementRef = elementRef;
|
|
12009
12025
|
this.scrollDispatcher = scrollDispatcher;
|
|
12010
12026
|
this.cdr = cdr;
|
|
12011
12027
|
this.ngZone = ngZone;
|
|
12028
|
+
this.contextService = contextService;
|
|
12012
12029
|
this.destroy$ = new rxjs.Subject();
|
|
12013
12030
|
}
|
|
12014
12031
|
TheInlineToolbarComponent.prototype.ngOnInit = function () {
|
|
@@ -12070,7 +12087,8 @@
|
|
|
12070
12087
|
boundary = range.startContainer.getBoundingClientRect();
|
|
12071
12088
|
}
|
|
12072
12089
|
}
|
|
12073
|
-
var
|
|
12090
|
+
var editableElement = this.contextService.getEditableElement();
|
|
12091
|
+
var editableRect = editableElement.getBoundingClientRect();
|
|
12074
12092
|
var toolbarHeight = toolbarElement.offsetHeight;
|
|
12075
12093
|
var toolbarWidth = toolbarElement.offsetWidth;
|
|
12076
12094
|
var halfOffsetWidth = toolbarWidth / 2;
|
|
@@ -12109,7 +12127,7 @@
|
|
|
12109
12127
|
};
|
|
12110
12128
|
return TheInlineToolbarComponent;
|
|
12111
12129
|
}());
|
|
12112
|
-
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 });
|
|
12130
|
+
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 });
|
|
12113
12131
|
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 });
|
|
12114
12132
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheInlineToolbarComponent, decorators: [{
|
|
12115
12133
|
type: i0.Component,
|
|
@@ -12121,7 +12139,7 @@
|
|
|
12121
12139
|
},
|
|
12122
12140
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
12123
12141
|
}]
|
|
12124
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i2__namespace$1.ScrollDispatcher }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }]; }, propDecorators: { editor: [{
|
|
12142
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i2__namespace$1.ScrollDispatcher }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }, { type: TheContextService }]; }, propDecorators: { editor: [{
|
|
12125
12143
|
type: i0.Input
|
|
12126
12144
|
}], toolbarItems: [{
|
|
12127
12145
|
type: i0.Input
|
|
@@ -12145,13 +12163,15 @@
|
|
|
12145
12163
|
event.stopPropagation();
|
|
12146
12164
|
};
|
|
12147
12165
|
TheQuickInsertComponent.prototype.checkStatus = function () {
|
|
12148
|
-
var
|
|
12166
|
+
var _this = this;
|
|
12149
12167
|
var editor = this.editor;
|
|
12150
12168
|
if (isCleanEmptyParagraph(editor)) {
|
|
12151
|
-
|
|
12152
|
-
|
|
12153
|
-
|
|
12154
|
-
|
|
12169
|
+
setTimeout(function () {
|
|
12170
|
+
var _a;
|
|
12171
|
+
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]]);
|
|
12172
|
+
var rootNode = i1.AngularEditor.toDOMNode(editor, block);
|
|
12173
|
+
_this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
|
|
12174
|
+
});
|
|
12155
12175
|
return;
|
|
12156
12176
|
}
|
|
12157
12177
|
this.isHide = true;
|
|
@@ -12201,9 +12221,10 @@
|
|
|
12201
12221
|
}] } });
|
|
12202
12222
|
|
|
12203
12223
|
var ThePlaceholderComponent = /** @class */ (function () {
|
|
12204
|
-
function ThePlaceholderComponent(renderer, elementRef) {
|
|
12224
|
+
function ThePlaceholderComponent(renderer, elementRef, contextService) {
|
|
12205
12225
|
this.renderer = renderer;
|
|
12206
12226
|
this.elementRef = elementRef;
|
|
12227
|
+
this.contextService = contextService;
|
|
12207
12228
|
this.isHide = true;
|
|
12208
12229
|
}
|
|
12209
12230
|
ThePlaceholderComponent.prototype.handleCompositionStart = function () {
|
|
@@ -12219,20 +12240,21 @@
|
|
|
12219
12240
|
};
|
|
12220
12241
|
ThePlaceholderComponent.prototype.checkStatus = function () {
|
|
12221
12242
|
var _this = this;
|
|
12222
|
-
var _a, _b;
|
|
12223
12243
|
var editor = this.editor;
|
|
12224
12244
|
// empty content and no selection processing
|
|
12225
|
-
if (!
|
|
12226
|
-
|
|
12227
|
-
var
|
|
12228
|
-
|
|
12245
|
+
if (!editor.selection && isEmptyContent(editor.children)) {
|
|
12246
|
+
var firstElementChild = this.contextService.getFirstElementChild();
|
|
12247
|
+
var offsetTop = firstElementChild.offsetTop;
|
|
12248
|
+
var offsetLeft = firstElementChild.offsetLeft;
|
|
12249
|
+
this.updatePosition(offsetLeft, offsetTop);
|
|
12229
12250
|
return;
|
|
12230
12251
|
}
|
|
12231
12252
|
if (isCleanEmptyParagraph(editor)) {
|
|
12232
|
-
var block = slate.Node.ancestor(editor, [(_b = editor === null || editor === void 0 ? void 0 : editor.selection) === null || _b === void 0 ? void 0 : _b.anchor.path[0]]);
|
|
12233
|
-
var rootNode_1 = i1.AngularEditor.toDOMNode(editor, block);
|
|
12234
12253
|
setTimeout(function () {
|
|
12235
|
-
|
|
12254
|
+
var _a;
|
|
12255
|
+
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]]);
|
|
12256
|
+
var rootNode = i1.AngularEditor.toDOMNode(editor, block);
|
|
12257
|
+
_this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
|
|
12236
12258
|
});
|
|
12237
12259
|
return;
|
|
12238
12260
|
}
|
|
@@ -12248,21 +12270,21 @@
|
|
|
12248
12270
|
};
|
|
12249
12271
|
return ThePlaceholderComponent;
|
|
12250
12272
|
}());
|
|
12251
|
-
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 });
|
|
12252
|
-
ThePlaceholderComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: { editor: "editor",
|
|
12273
|
+
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 });
|
|
12274
|
+
ThePlaceholderComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: { editor: "editor", placeholder: "placeholder" }, host: { listeners: { "document:compositionstart": "handleCompositionStart()", "document:compositionend": "handleCompositionEnd($event)" }, properties: { "class.hide": "isHide" }, classAttribute: "the-placeholder" }, ngImport: i0__namespace, template: "{{ placeholder }}", isInline: true });
|
|
12253
12275
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: ThePlaceholderComponent, decorators: [{
|
|
12254
12276
|
type: i0.Component,
|
|
12255
12277
|
args: [{
|
|
12256
12278
|
selector: 'div[thePlaceholder]',
|
|
12257
|
-
template: "{{
|
|
12279
|
+
template: "{{ placeholder }}",
|
|
12258
12280
|
host: {
|
|
12259
12281
|
class: 'the-placeholder',
|
|
12260
12282
|
'[class.hide]': 'isHide'
|
|
12261
12283
|
}
|
|
12262
12284
|
}]
|
|
12263
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.Renderer2 }, { type: i0__namespace.ElementRef }]; }, propDecorators: { editor: [{
|
|
12285
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.Renderer2 }, { type: i0__namespace.ElementRef }, { type: TheContextService }]; }, propDecorators: { editor: [{
|
|
12264
12286
|
type: i0.Input
|
|
12265
|
-
}],
|
|
12287
|
+
}], placeholder: [{
|
|
12266
12288
|
type: i0.Input
|
|
12267
12289
|
}], handleCompositionStart: [{
|
|
12268
12290
|
type: i0.HostListener,
|
|
@@ -12438,6 +12460,12 @@
|
|
|
12438
12460
|
_this.onSlaCompositionEnd = function (event) { };
|
|
12439
12461
|
_this.onSlaDragStart = function (event) { };
|
|
12440
12462
|
_this.onSlaDragOver = function (event) { };
|
|
12463
|
+
_this.onDrop = function (event) {
|
|
12464
|
+
event.stopPropagation();
|
|
12465
|
+
_this.theOnDOMEvent.emit({
|
|
12466
|
+
nativeEvent: event
|
|
12467
|
+
});
|
|
12468
|
+
};
|
|
12441
12469
|
return _this;
|
|
12442
12470
|
}
|
|
12443
12471
|
Object.defineProperty(TheEditorComponent.prototype, "theGlobalToolbarInstance", {
|
|
@@ -12468,15 +12496,18 @@
|
|
|
12468
12496
|
this.onErrorHandler();
|
|
12469
12497
|
};
|
|
12470
12498
|
TheEditorComponent.prototype.ngOnChanges = function (changes) {
|
|
12471
|
-
var _a, _b, _c;
|
|
12499
|
+
var _a, _b, _c, _d, _e;
|
|
12472
12500
|
var options = changes.theOptions;
|
|
12473
12501
|
if (options) {
|
|
12474
12502
|
this.initializeOptions();
|
|
12475
12503
|
}
|
|
12504
|
+
if (((_a = options.currentValue) === null || _a === void 0 ? void 0 : _a.readonly) !== ((_b = options.previousValue) === null || _b === void 0 ? void 0 : _b.readonly)) {
|
|
12505
|
+
this.applyAutoFocus();
|
|
12506
|
+
}
|
|
12476
12507
|
if (changes['theDecorate']) {
|
|
12477
12508
|
this.generateDecorate();
|
|
12478
12509
|
}
|
|
12479
|
-
if (((
|
|
12510
|
+
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))) {
|
|
12480
12511
|
slate.Transforms.deselect(this.editor);
|
|
12481
12512
|
}
|
|
12482
12513
|
};
|
|
@@ -12510,9 +12541,9 @@
|
|
|
12510
12541
|
}
|
|
12511
12542
|
};
|
|
12512
12543
|
TheEditorComponent.prototype.applyAutoFocus = function () {
|
|
12513
|
-
var _a, _b, _c
|
|
12514
|
-
if (((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.
|
|
12515
|
-
autoFocus(this.editor, (
|
|
12544
|
+
var _a, _b, _c;
|
|
12545
|
+
if (!((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled) && !((_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.readonly)) {
|
|
12546
|
+
autoFocus(this.editor, (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.autoFocus);
|
|
12516
12547
|
}
|
|
12517
12548
|
};
|
|
12518
12549
|
TheEditorComponent.prototype.toolbarCalculate = function () {
|
|
@@ -12544,14 +12575,14 @@
|
|
|
12544
12575
|
this.onTouchedCallback = fn;
|
|
12545
12576
|
};
|
|
12546
12577
|
TheEditorComponent.prototype.valueChange = function (value) {
|
|
12547
|
-
var _a, _b, _c, _d, _e;
|
|
12578
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12548
12579
|
(_a = this.theGlobalToolbarInstance) === null || _a === void 0 ? void 0 : _a.statusChange(this.editor);
|
|
12549
12580
|
(_b = this.quickInsertInstance) === null || _b === void 0 ? void 0 : _b.checkStatus();
|
|
12550
|
-
this.placeholderInstance.checkStatus();
|
|
12581
|
+
(_c = this.placeholderInstance) === null || _c === void 0 ? void 0 : _c.checkStatus();
|
|
12551
12582
|
// auto scroll view
|
|
12552
|
-
var scrollContainer = (
|
|
12553
|
-
var maxHeight = (
|
|
12554
|
-
if (!((
|
|
12583
|
+
var scrollContainer = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.scrollContainer;
|
|
12584
|
+
var maxHeight = (_e = this.theOptions) === null || _e === void 0 ? void 0 : _e.maxHeight;
|
|
12585
|
+
if (!((_f = this.theOptions) === null || _f === void 0 ? void 0 : _f.readonly) && (scrollContainer || maxHeight)) {
|
|
12555
12586
|
var container = maxHeight ? DEFAULT_SCROLL_CONTAINER : scrollContainer;
|
|
12556
12587
|
this.autoScrollView(this.editor, container);
|
|
12557
12588
|
}
|
|
@@ -12627,18 +12658,18 @@
|
|
|
12627
12658
|
}
|
|
12628
12659
|
};
|
|
12629
12660
|
TheEditorComponent.prototype.handleSelectAll = function () {
|
|
12630
|
-
var
|
|
12661
|
+
var _g;
|
|
12631
12662
|
var node;
|
|
12632
12663
|
if (!this.editor.selection) {
|
|
12633
12664
|
setEndSelection(this.editor);
|
|
12634
12665
|
}
|
|
12635
|
-
var
|
|
12666
|
+
var _h = __read(slate.Range.edges(this.editor.selection), 2), start = _h[0], end = _h[1];
|
|
12636
12667
|
var selectionRange = slate.Editor.range(this.editor, start, end);
|
|
12637
12668
|
var containerBlocks = getContainerBlocks(this.editor);
|
|
12638
12669
|
for (var i = 0; i < containerBlocks.length; i++) {
|
|
12639
|
-
|
|
12670
|
+
_g = __read(getNodesByType(this.editor, containerBlocks[i]), 1), node = _g[0];
|
|
12640
12671
|
if (node) {
|
|
12641
|
-
var
|
|
12672
|
+
var _j = __read(node, 2), path = _j[1];
|
|
12642
12673
|
var isStartParent = slate.Path.equals(path, start.path.slice(0, path.length));
|
|
12643
12674
|
var isEndParent = slate.Path.equals(path, end.path.slice(0, path.length));
|
|
12644
12675
|
if (isStartParent && isEndParent) {
|
|
@@ -12681,7 +12712,7 @@
|
|
|
12681
12712
|
useExisting: i0.forwardRef(function () { return TheEditorComponent; }),
|
|
12682
12713
|
multi: true
|
|
12683
12714
|
}
|
|
12684
|
-
], 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 (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\" [
|
|
12715
|
+
], 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\" [placeholder]=\"theOptions?.placeholder\"></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", "placeholder"] }, { 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"] }] });
|
|
12685
12716
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheEditorComponent, decorators: [{
|
|
12686
12717
|
type: i0.Component,
|
|
12687
12718
|
args: [{
|