@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
|
@@ -1040,7 +1040,10 @@ const extractFragment = (data, deleteKey = ELEMENT_UNIQUE_ID) => {
|
|
|
1040
1040
|
const fragment = data.getData(`application/${CLIPBOARD_FORMAT_KEY}`);
|
|
1041
1041
|
if (fragment) {
|
|
1042
1042
|
const decoded = decodeURIComponent(window.atob(fragment));
|
|
1043
|
-
|
|
1043
|
+
let nodes = JSON.parse(decoded);
|
|
1044
|
+
if (!Array.isArray(nodes)) {
|
|
1045
|
+
nodes = [nodes];
|
|
1046
|
+
}
|
|
1044
1047
|
// delete key to avoid duplicate keys
|
|
1045
1048
|
if (deleteKey) {
|
|
1046
1049
|
deleteElementKey(nodes, deleteKey);
|
|
@@ -2230,10 +2233,18 @@ class TheContextService {
|
|
|
2230
2233
|
}
|
|
2231
2234
|
getOptions() {
|
|
2232
2235
|
if (!this.options.width) {
|
|
2233
|
-
|
|
2236
|
+
const firstElementChild = this.getFirstElementChild();
|
|
2237
|
+
this.options.width = firstElementChild.offsetWidth;
|
|
2234
2238
|
}
|
|
2235
2239
|
return this.options;
|
|
2236
2240
|
}
|
|
2241
|
+
getEditableElement() {
|
|
2242
|
+
return this.options.nativeElement.querySelector('.the-editor-typo');
|
|
2243
|
+
}
|
|
2244
|
+
getFirstElementChild() {
|
|
2245
|
+
const editableElement = this.getEditableElement();
|
|
2246
|
+
return editableElement === null || editableElement === void 0 ? void 0 : editableElement.firstElementChild;
|
|
2247
|
+
}
|
|
2237
2248
|
setUploadFileList(file) {
|
|
2238
2249
|
this.fileList.push(file);
|
|
2239
2250
|
}
|
|
@@ -9761,6 +9772,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
|
|
|
9761
9772
|
args: ['cellInner', { static: true }]
|
|
9762
9773
|
}] } });
|
|
9763
9774
|
|
|
9775
|
+
const normalizeTable = (table) => {
|
|
9776
|
+
const normalizedNodes = [];
|
|
9777
|
+
const rowHeight = table.children.length;
|
|
9778
|
+
const columnWidth = table.children[0].children.length;
|
|
9779
|
+
table.children.forEach((row, rowIndex) => {
|
|
9780
|
+
row.children.forEach((cell, columnIndex) => {
|
|
9781
|
+
// case 1
|
|
9782
|
+
if (cell.colspan || cell.rowspan) {
|
|
9783
|
+
const rowspan = cell.rowspan || 1;
|
|
9784
|
+
const colspan = cell.colspan || 1;
|
|
9785
|
+
if (rowspan > rowHeight - rowIndex) {
|
|
9786
|
+
cell.rowspan = rowHeight - rowIndex;
|
|
9787
|
+
}
|
|
9788
|
+
if (colspan > columnWidth - columnIndex) {
|
|
9789
|
+
cell.colspan = columnWidth - columnIndex;
|
|
9790
|
+
}
|
|
9791
|
+
return;
|
|
9792
|
+
}
|
|
9793
|
+
// case 2
|
|
9794
|
+
if (cell.hidden && !normalizedNodes.includes(cell)) {
|
|
9795
|
+
const origin = calcOriginSpan(table, rowIndex, columnIndex);
|
|
9796
|
+
if (!origin) {
|
|
9797
|
+
delete table.children[rowIndex].children[columnIndex].hidden;
|
|
9798
|
+
}
|
|
9799
|
+
}
|
|
9800
|
+
});
|
|
9801
|
+
});
|
|
9802
|
+
return table;
|
|
9803
|
+
};
|
|
9804
|
+
|
|
9764
9805
|
const withTable = (editor) => {
|
|
9765
9806
|
const { deleteBackward, deleteForward, onKeydown, setFragmentData, insertData, normalizeNode, isBlockCard, renderElement, deleteCutData, isContainer } = editor;
|
|
9766
9807
|
editor.deleteBackward = unit => {
|
|
@@ -9938,67 +9979,45 @@ const withTable = (editor) => {
|
|
|
9938
9979
|
return;
|
|
9939
9980
|
}
|
|
9940
9981
|
const { selection } = editor;
|
|
9941
|
-
const
|
|
9942
|
-
const tableComponent = ELEMENT_TO_COMPONENT.get(
|
|
9982
|
+
const tablePosition = TablePosition.create(opts, editor, selection.anchor.path);
|
|
9983
|
+
const tableComponent = ELEMENT_TO_COMPONENT.get(tablePosition.table);
|
|
9943
9984
|
const cells = tableComponent.tableStore.selectedCells;
|
|
9944
|
-
|
|
9945
|
-
|
|
9946
|
-
|
|
9947
|
-
|
|
9948
|
-
|
|
9949
|
-
|
|
9950
|
-
const
|
|
9951
|
-
const selectedRowsIndex = tableComponent.tableStore.selectedRowsIndex || [];
|
|
9985
|
+
let tableFragment = null;
|
|
9986
|
+
if (tableComponent.tableStore.selectedRowsIndex.length > 0) {
|
|
9987
|
+
const rows = tablePosition.table.children.slice(tableComponent.tableStore.selectedRowsIndex[0], tableComponent.tableStore.selectedRowsIndex[tableComponent.tableStore.selectedRowsIndex.length - 1] + 1);
|
|
9988
|
+
tableFragment = Object.assign(Object.assign({}, tablePosition.table), { children: rows });
|
|
9989
|
+
}
|
|
9990
|
+
else if (cells.length > 0) {
|
|
9991
|
+
const tempRows = {};
|
|
9952
9992
|
for (const cell of cells) {
|
|
9953
9993
|
const { row, col } = cell;
|
|
9954
|
-
const cellPath = [...
|
|
9955
|
-
cellNode = Node.get(editor, cellPath);
|
|
9956
|
-
|
|
9957
|
-
|
|
9958
|
-
if (!contents) {
|
|
9959
|
-
contents = domRange.cloneContents();
|
|
9960
|
-
}
|
|
9961
|
-
else {
|
|
9962
|
-
contents.append(domRange.cloneContents());
|
|
9994
|
+
const cellPath = [...tablePosition.tableEntry[1], row, col];
|
|
9995
|
+
const cellNode = Node.get(editor, cellPath);
|
|
9996
|
+
if (!tempRows[row]) {
|
|
9997
|
+
tempRows[row] = [];
|
|
9963
9998
|
}
|
|
9964
|
-
|
|
9965
|
-
(selectedRowsIndex.length === 1 && cellNode.rowspan > 1)) {
|
|
9966
|
-
cellNode = Object.assign(Object.assign({}, cellNode), { colspan: selectedColumnsIndex.length === 1 ? null : cellNode.colspan, rowspan: selectedRowsIndex.length === 1 ? null : cellNode.rowspan });
|
|
9967
|
-
}
|
|
9968
|
-
if (cellNode.hidden) {
|
|
9969
|
-
const origin = calcOriginSpan(element.table, row, col);
|
|
9970
|
-
const selectedOrigin = origin && selectNodes.filter(item => item.node.key === origin.key);
|
|
9971
|
-
if (!selectedOrigin || !selectedOrigin.length) {
|
|
9972
|
-
cellNode = Object.assign(Object.assign({}, cellNode), { hidden: null });
|
|
9973
|
-
}
|
|
9974
|
-
}
|
|
9975
|
-
if (!tableContent[row]) {
|
|
9976
|
-
tableContent[row] = [];
|
|
9977
|
-
}
|
|
9978
|
-
tableContent[row].push(cellNode);
|
|
9999
|
+
tempRows[row].push(cellNode);
|
|
9979
10000
|
}
|
|
9980
|
-
const
|
|
10001
|
+
const rows = Object.values(tempRows).map((item) => {
|
|
10002
|
+
return {
|
|
10003
|
+
type: ElementKinds.tableRow,
|
|
10004
|
+
children: item
|
|
10005
|
+
};
|
|
10006
|
+
});
|
|
10007
|
+
tableFragment =
|
|
9981
10008
|
{
|
|
9982
10009
|
type: ElementKinds.table,
|
|
9983
|
-
children:
|
|
9984
|
-
|
|
9985
|
-
|
|
9986
|
-
|
|
9987
|
-
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
];
|
|
9991
|
-
fragment = tableFragment;
|
|
9992
|
-
const stringObj = JSON.stringify(fragment);
|
|
10010
|
+
children: rows
|
|
10011
|
+
};
|
|
10012
|
+
}
|
|
10013
|
+
if (tableFragment) {
|
|
10014
|
+
tableFragment = normalizeTable(_.cloneDeep(tableFragment));
|
|
10015
|
+
tableFragment = [tableFragment];
|
|
10016
|
+
const stringObj = JSON.stringify(tableFragment);
|
|
9993
10017
|
const encoded = window.btoa(encodeURIComponent(stringObj));
|
|
9994
10018
|
unit.setData(`application/${CLIPBOARD_FORMAT_KEY}`, encoded);
|
|
9995
|
-
|
|
9996
|
-
|
|
9997
|
-
div.setAttribute('hidden', 'true');
|
|
9998
|
-
document.body.appendChild(div);
|
|
9999
|
-
unit.setData('text/html', div.innerHTML);
|
|
10000
|
-
unit.setData('text/plain', getPlainText$1(div));
|
|
10001
|
-
document.body.removeChild(div);
|
|
10019
|
+
// unit.setData('text/html', div.innerHTML);
|
|
10020
|
+
unit.setData('text/plain', Node.string(tableFragment));
|
|
10002
10021
|
return;
|
|
10003
10022
|
}
|
|
10004
10023
|
setFragmentData(unit);
|
|
@@ -10822,8 +10841,8 @@ const autoFocus = (editor, isFocus) => {
|
|
|
10822
10841
|
setTimeout(() => {
|
|
10823
10842
|
if (editor && editor.children.length > 0 && isFocus) {
|
|
10824
10843
|
HistoryEditor.withoutMerging(editor, () => {
|
|
10825
|
-
AngularEditor.focus(editor);
|
|
10826
10844
|
Transforms.select(editor, Editor.start(editor, [0]));
|
|
10845
|
+
AngularEditor.focus(editor);
|
|
10827
10846
|
});
|
|
10828
10847
|
}
|
|
10829
10848
|
});
|
|
@@ -11092,11 +11111,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
|
|
|
11092
11111
|
}] } });
|
|
11093
11112
|
|
|
11094
11113
|
class TheInlineToolbarComponent {
|
|
11095
|
-
constructor(elementRef, scrollDispatcher, cdr, ngZone) {
|
|
11114
|
+
constructor(elementRef, scrollDispatcher, cdr, ngZone, contextService) {
|
|
11096
11115
|
this.elementRef = elementRef;
|
|
11097
11116
|
this.scrollDispatcher = scrollDispatcher;
|
|
11098
11117
|
this.cdr = cdr;
|
|
11099
11118
|
this.ngZone = ngZone;
|
|
11119
|
+
this.contextService = contextService;
|
|
11100
11120
|
this.destroy$ = new Subject();
|
|
11101
11121
|
}
|
|
11102
11122
|
ngOnInit() {
|
|
@@ -11156,7 +11176,8 @@ class TheInlineToolbarComponent {
|
|
|
11156
11176
|
boundary = range.startContainer.getBoundingClientRect();
|
|
11157
11177
|
}
|
|
11158
11178
|
}
|
|
11159
|
-
const
|
|
11179
|
+
const editableElement = this.contextService.getEditableElement();
|
|
11180
|
+
const editableRect = editableElement.getBoundingClientRect();
|
|
11160
11181
|
const toolbarHeight = toolbarElement.offsetHeight;
|
|
11161
11182
|
const toolbarWidth = toolbarElement.offsetWidth;
|
|
11162
11183
|
const halfOffsetWidth = toolbarWidth / 2;
|
|
@@ -11184,7 +11205,7 @@ class TheInlineToolbarComponent {
|
|
|
11184
11205
|
this.destroy$.complete();
|
|
11185
11206
|
}
|
|
11186
11207
|
}
|
|
11187
|
-
TheInlineToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInlineToolbarComponent, deps: [{ token: i0.ElementRef }, { token: i2$1.ScrollDispatcher }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
11208
|
+
TheInlineToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInlineToolbarComponent, deps: [{ token: i0.ElementRef }, { token: i2$1.ScrollDispatcher }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: TheContextService }], target: i0.ɵɵFactoryTarget.Component });
|
|
11188
11209
|
TheInlineToolbarComponent.ɵcmp = i0.ɵɵ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, template: `<the-toolbar
|
|
11189
11210
|
#inlineToolbar
|
|
11190
11211
|
class="the-inline-toolbar"
|
|
@@ -11208,7 +11229,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
|
|
|
11208
11229
|
},
|
|
11209
11230
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
11210
11231
|
}]
|
|
11211
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2$1.ScrollDispatcher }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }]; }, propDecorators: { editor: [{
|
|
11232
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2$1.ScrollDispatcher }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: TheContextService }]; }, propDecorators: { editor: [{
|
|
11212
11233
|
type: Input
|
|
11213
11234
|
}], toolbarItems: [{
|
|
11214
11235
|
type: Input
|
|
@@ -11232,13 +11253,14 @@ class TheQuickInsertComponent {
|
|
|
11232
11253
|
event.stopPropagation();
|
|
11233
11254
|
}
|
|
11234
11255
|
checkStatus() {
|
|
11235
|
-
var _a;
|
|
11236
11256
|
const { editor } = this;
|
|
11237
11257
|
if (isCleanEmptyParagraph(editor)) {
|
|
11238
|
-
|
|
11239
|
-
|
|
11240
|
-
|
|
11241
|
-
|
|
11258
|
+
setTimeout(() => {
|
|
11259
|
+
var _a;
|
|
11260
|
+
const block = Node.ancestor(editor, [(_a = editor === null || editor === void 0 ? void 0 : editor.selection) === null || _a === void 0 ? void 0 : _a.anchor.path[0]]);
|
|
11261
|
+
const rootNode = AngularEditor.toDOMNode(editor, block);
|
|
11262
|
+
this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
|
|
11263
|
+
});
|
|
11242
11264
|
return;
|
|
11243
11265
|
}
|
|
11244
11266
|
this.isHide = true;
|
|
@@ -11287,9 +11309,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
|
|
|
11287
11309
|
}] } });
|
|
11288
11310
|
|
|
11289
11311
|
class ThePlaceholderComponent {
|
|
11290
|
-
constructor(renderer, elementRef) {
|
|
11312
|
+
constructor(renderer, elementRef, contextService) {
|
|
11291
11313
|
this.renderer = renderer;
|
|
11292
11314
|
this.elementRef = elementRef;
|
|
11315
|
+
this.contextService = contextService;
|
|
11293
11316
|
this.isHide = true;
|
|
11294
11317
|
}
|
|
11295
11318
|
handleCompositionStart() {
|
|
@@ -11304,19 +11327,20 @@ class ThePlaceholderComponent {
|
|
|
11304
11327
|
}
|
|
11305
11328
|
}
|
|
11306
11329
|
checkStatus() {
|
|
11307
|
-
var _a, _b;
|
|
11308
11330
|
const { editor } = this;
|
|
11309
11331
|
// empty content and no selection processing
|
|
11310
|
-
if (!
|
|
11311
|
-
|
|
11312
|
-
const
|
|
11313
|
-
|
|
11332
|
+
if (!editor.selection && isEmptyContent(editor.children)) {
|
|
11333
|
+
const firstElementChild = this.contextService.getFirstElementChild();
|
|
11334
|
+
const offsetTop = firstElementChild.offsetTop;
|
|
11335
|
+
const offsetLeft = firstElementChild.offsetLeft;
|
|
11336
|
+
this.updatePosition(offsetLeft, offsetTop);
|
|
11314
11337
|
return;
|
|
11315
11338
|
}
|
|
11316
11339
|
if (isCleanEmptyParagraph(editor)) {
|
|
11317
|
-
const block = Node.ancestor(editor, [(_b = editor === null || editor === void 0 ? void 0 : editor.selection) === null || _b === void 0 ? void 0 : _b.anchor.path[0]]);
|
|
11318
|
-
const rootNode = AngularEditor.toDOMNode(editor, block);
|
|
11319
11340
|
setTimeout(() => {
|
|
11341
|
+
var _a;
|
|
11342
|
+
const block = Node.ancestor(editor, [(_a = editor === null || editor === void 0 ? void 0 : editor.selection) === null || _a === void 0 ? void 0 : _a.anchor.path[0]]);
|
|
11343
|
+
const rootNode = AngularEditor.toDOMNode(editor, block);
|
|
11320
11344
|
this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
|
|
11321
11345
|
});
|
|
11322
11346
|
return;
|
|
@@ -11332,21 +11356,21 @@ class ThePlaceholderComponent {
|
|
|
11332
11356
|
this.isHide = true;
|
|
11333
11357
|
}
|
|
11334
11358
|
}
|
|
11335
|
-
ThePlaceholderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: ThePlaceholderComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
11336
|
-
ThePlaceholderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: { editor: "editor",
|
|
11359
|
+
ThePlaceholderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: ThePlaceholderComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: TheContextService }], target: i0.ɵɵFactoryTarget.Component });
|
|
11360
|
+
ThePlaceholderComponent.ɵcmp = i0.ɵɵ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, template: `{{ placeholder }}`, isInline: true });
|
|
11337
11361
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: ThePlaceholderComponent, decorators: [{
|
|
11338
11362
|
type: Component,
|
|
11339
11363
|
args: [{
|
|
11340
11364
|
selector: 'div[thePlaceholder]',
|
|
11341
|
-
template: `{{
|
|
11365
|
+
template: `{{ placeholder }}`,
|
|
11342
11366
|
host: {
|
|
11343
11367
|
class: 'the-placeholder',
|
|
11344
11368
|
'[class.hide]': 'isHide'
|
|
11345
11369
|
}
|
|
11346
11370
|
}]
|
|
11347
|
-
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { editor: [{
|
|
11371
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: TheContextService }]; }, propDecorators: { editor: [{
|
|
11348
11372
|
type: Input
|
|
11349
|
-
}],
|
|
11373
|
+
}], placeholder: [{
|
|
11350
11374
|
type: Input
|
|
11351
11375
|
}], handleCompositionStart: [{
|
|
11352
11376
|
type: HostListener,
|
|
@@ -11519,6 +11543,12 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
11519
11543
|
this.onSlaCompositionEnd = (event) => { };
|
|
11520
11544
|
this.onSlaDragStart = (event) => { };
|
|
11521
11545
|
this.onSlaDragOver = (event) => { };
|
|
11546
|
+
this.onDrop = (event) => {
|
|
11547
|
+
event.stopPropagation();
|
|
11548
|
+
this.theOnDOMEvent.emit({
|
|
11549
|
+
nativeEvent: event
|
|
11550
|
+
});
|
|
11551
|
+
};
|
|
11522
11552
|
}
|
|
11523
11553
|
get theGlobalToolbarInstance() {
|
|
11524
11554
|
return this.theGlobalToolbar ? this.theGlobalToolbar : this.globalToolbarInstance;
|
|
@@ -11536,15 +11566,18 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
11536
11566
|
this.onErrorHandler();
|
|
11537
11567
|
}
|
|
11538
11568
|
ngOnChanges(changes) {
|
|
11539
|
-
var _a, _b, _c;
|
|
11569
|
+
var _a, _b, _c, _d, _e;
|
|
11540
11570
|
const options = changes.theOptions;
|
|
11541
11571
|
if (options) {
|
|
11542
11572
|
this.initializeOptions();
|
|
11543
11573
|
}
|
|
11574
|
+
if (((_a = options.currentValue) === null || _a === void 0 ? void 0 : _a.readonly) !== ((_b = options.previousValue) === null || _b === void 0 ? void 0 : _b.readonly)) {
|
|
11575
|
+
this.applyAutoFocus();
|
|
11576
|
+
}
|
|
11544
11577
|
if (changes['theDecorate']) {
|
|
11545
11578
|
this.generateDecorate();
|
|
11546
11579
|
}
|
|
11547
|
-
if (((
|
|
11580
|
+
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))) {
|
|
11548
11581
|
Transforms.deselect(this.editor);
|
|
11549
11582
|
}
|
|
11550
11583
|
}
|
|
@@ -11577,9 +11610,9 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
11577
11610
|
}
|
|
11578
11611
|
}
|
|
11579
11612
|
applyAutoFocus() {
|
|
11580
|
-
var _a, _b, _c
|
|
11581
|
-
if (((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.
|
|
11582
|
-
autoFocus(this.editor, (
|
|
11613
|
+
var _a, _b, _c;
|
|
11614
|
+
if (!((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled) && !((_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.readonly)) {
|
|
11615
|
+
autoFocus(this.editor, (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.autoFocus);
|
|
11583
11616
|
}
|
|
11584
11617
|
}
|
|
11585
11618
|
toolbarCalculate() {
|
|
@@ -11611,14 +11644,14 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
11611
11644
|
this.onTouchedCallback = fn;
|
|
11612
11645
|
}
|
|
11613
11646
|
valueChange(value) {
|
|
11614
|
-
var _a, _b, _c, _d, _e;
|
|
11647
|
+
var _a, _b, _c, _d, _e, _f;
|
|
11615
11648
|
(_a = this.theGlobalToolbarInstance) === null || _a === void 0 ? void 0 : _a.statusChange(this.editor);
|
|
11616
11649
|
(_b = this.quickInsertInstance) === null || _b === void 0 ? void 0 : _b.checkStatus();
|
|
11617
|
-
this.placeholderInstance.checkStatus();
|
|
11650
|
+
(_c = this.placeholderInstance) === null || _c === void 0 ? void 0 : _c.checkStatus();
|
|
11618
11651
|
// auto scroll view
|
|
11619
|
-
const scrollContainer = (
|
|
11620
|
-
const maxHeight = (
|
|
11621
|
-
if (!((
|
|
11652
|
+
const scrollContainer = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.scrollContainer;
|
|
11653
|
+
const maxHeight = (_e = this.theOptions) === null || _e === void 0 ? void 0 : _e.maxHeight;
|
|
11654
|
+
if (!((_f = this.theOptions) === null || _f === void 0 ? void 0 : _f.readonly) && (scrollContainer || maxHeight)) {
|
|
11622
11655
|
const container = maxHeight ? DEFAULT_SCROLL_CONTAINER : scrollContainer;
|
|
11623
11656
|
this.autoScrollView(this.editor, container);
|
|
11624
11657
|
}
|
|
@@ -11743,7 +11776,7 @@ TheEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
|
|
|
11743
11776
|
useExisting: forwardRef(() => TheEditorComponent),
|
|
11744
11777
|
multi: true
|
|
11745
11778
|
}
|
|
11746
|
-
], 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, 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\" [
|
|
11779
|
+
], 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, 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.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.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
11747
11780
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheEditorComponent, decorators: [{
|
|
11748
11781
|
type: Component,
|
|
11749
11782
|
args: [{
|