@worktile/theia 1.2.15 → 2.0.0

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.
@@ -2,7 +2,11 @@ import { Editor } from 'slate';
2
2
  import { ElementKinds } from '../constants/node-types';
3
3
  import { getAnchorBlockEntry } from './get-anchor-block-entry';
4
4
  export const isEmptyParagraph = (editor, at) => {
5
- const [block] = getAnchorBlockEntry(editor, at);
5
+ const entry = getAnchorBlockEntry(editor, at);
6
+ if (!entry) {
7
+ return false;
8
+ }
9
+ const [block] = entry;
6
10
  return Editor.isEmpty(editor, block) && block.type === ElementKinds.paragraph;
7
11
  };
8
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXMtZW1wdHktcGFyYWdyYXBoLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcGFja2FnZXMvc3JjL3F1ZXJpZXMvaXMtZW1wdHktcGFyYWdyYXBoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQWUsTUFBTSxPQUFPLENBQUM7QUFDNUMsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ3ZELE9BQU8sRUFBRSxtQkFBbUIsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBRS9ELE1BQU0sQ0FBQyxNQUFNLGdCQUFnQixHQUFHLENBQUMsTUFBYyxFQUFFLEVBQWlCLEVBQUUsRUFBRTtJQUNsRSxNQUFNLENBQUMsS0FBSyxDQUFDLEdBQUcsbUJBQW1CLENBQUMsTUFBTSxFQUFFLEVBQUUsQ0FBQyxDQUFDO0lBQ2hELE9BQU8sTUFBTSxDQUFDLE9BQU8sQ0FBQyxNQUFNLEVBQUUsS0FBSyxDQUFDLElBQUksS0FBSyxDQUFDLElBQUksS0FBSyxZQUFZLENBQUMsU0FBUyxDQUF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ENT, NODE_TO_INDEX, IS_SAFARI, hotkeys, getPlainText as getPlainText$1, hasBlockCard, isCardLeft, FAKE_RIGHT_BLOCK_CARD_OFFSET, ELEMENT_TO_COMPONENT, EDITOR_TO_ELEMENT, isComponentType, withAngular, SlateModule } from 'slate-angular';
9
9
  import { mixinUnsubscribe, MixinBase } from 'ngx-tethys/core';
10
10
  import isHotkey from 'is-hotkey';
11
- import { Element as Element$1, Editor, Range, Node, Span, Path, Text, Point, Transforms, createEditor } from 'slate';
11
+ import { Element as Element$1, Editor, Range, Node, Span, Path, Text, Point, Transforms, Operation, createEditor } from 'slate';
12
12
  import { HistoryEditor, withHistory } from 'slate-history';
13
13
  import { __rest, __awaiter } from 'tslib';
14
14
  import * as _lodash from 'lodash';
@@ -499,7 +499,11 @@ const getAnchorBlockEntry = (editor, at) => {
499
499
  };
500
500
 
501
501
  const isEmptyParagraph = (editor, at) => {
502
- const [block] = getAnchorBlockEntry(editor, at);
502
+ const entry = getAnchorBlockEntry(editor, at);
503
+ if (!entry) {
504
+ return false;
505
+ }
506
+ const [block] = entry;
503
507
  return Editor.isEmpty(editor, block) && block.type === ElementKinds.paragraph;
504
508
  };
505
509
 
@@ -1144,7 +1148,7 @@ const isEmptyContent = (children) => {
1144
1148
  }
1145
1149
  if (children && children.length === 1) {
1146
1150
  const firstNode = children[0];
1147
- if (firstNode.type === ElementKinds.default && !Node.string(firstNode)) {
1151
+ if (firstNode.type === ElementKinds.default && firstNode.children.length === 1 && !Node.string(firstNode)) {
1148
1152
  return true;
1149
1153
  }
1150
1154
  }
@@ -4204,20 +4208,66 @@ const withBlockCard = (editor) => {
4204
4208
  // block card cursor
4205
4209
  if (anchorNode && hasBlockCard(domSelection)) {
4206
4210
  const isCardLeftCursor = isCardLeft(anchorNode);
4207
- // + left-block-card 或者 → + right-block-card
4208
- if ((isMoveDown && isCardLeftCursor) || (isMoveForward && !isCardLeftCursor)) {
4211
+ if (isMoveUp) {
4212
+ const [, path] = AngularEditor.toSlateCardEntry(editor, anchorNode);
4213
+ const previousPath = Path.hasPrevious(path) && Path.previous(path);
4214
+ const previousNode = previousPath && getNode(editor, previousPath);
4215
+ if (previousNode && editor.isBlockCard(previousNode)) {
4216
+ AngularEditor.moveBlockCard(editor, previousNode, { direction: isCardLeftCursor ? 'left' : 'right' });
4217
+ }
4218
+ else {
4219
+ const before = Editor.before(editor, path);
4220
+ if (before) {
4221
+ Transforms.select(editor, before);
4222
+ }
4223
+ }
4224
+ nativeEvent.preventDefault();
4225
+ return;
4226
+ }
4227
+ if (isMoveDown) {
4228
+ const [, path] = AngularEditor.toSlateCardEntry(editor, anchorNode);
4229
+ const nextPath = Path.next(path);
4230
+ const nextNode = getNode(editor, nextPath);
4231
+ if (nextNode && editor.isBlockCard(nextNode)) {
4232
+ AngularEditor.moveBlockCard(editor, nextNode, { direction: isCardLeftCursor ? 'left' : 'right' });
4233
+ }
4234
+ else {
4235
+ const after = Editor.after(editor, path);
4236
+ if (after) {
4237
+ Transforms.select(editor, Editor.after(editor, path));
4238
+ }
4239
+ }
4240
+ nativeEvent.preventDefault();
4241
+ return;
4242
+ }
4243
+ // → + right-block-card
4244
+ if ((isMoveForward && !isCardLeftCursor)) {
4209
4245
  nativeEvent.preventDefault();
4210
4246
  const [, path] = AngularEditor.toSlateCardEntry(editor, anchorNode);
4247
+ const nextPath = Path.next(path);
4248
+ const nextNode = getNode(editor, nextPath);
4249
+ if (nextNode && editor.isBlockCard(nextNode)) {
4250
+ event.preventDefault();
4251
+ AngularEditor.moveBlockCard(editor, nextNode, { direction: 'left' });
4252
+ return;
4253
+ }
4211
4254
  const after = Editor.after(editor, path);
4212
4255
  if (after) {
4213
4256
  Transforms.select(editor, Editor.after(editor, path));
4214
4257
  }
4215
4258
  return;
4216
4259
  }
4217
- // ↑ + right-block-card 或者 ← + left-block-card
4218
- if ((isMoveUp && !isCardLeftCursor) || (isMoveBackward && isCardLeftCursor)) {
4260
+ // ← + left-block-card
4261
+ if (isMoveBackward && isCardLeftCursor) {
4219
4262
  nativeEvent.preventDefault();
4220
4263
  const [, path] = AngularEditor.toSlateCardEntry(editor, anchorNode);
4264
+ const previousPath = Path.hasPrevious(path) && Path.previous(path);
4265
+ const previousNode = previousPath && getNode(editor, previousPath);
4266
+ if (previousNode && editor.isBlockCard(previousNode)) {
4267
+ event.preventDefault();
4268
+ AngularEditor.moveBlockCard(editor, previousNode, { direction: 'right' });
4269
+ return;
4270
+ }
4221
4271
  const before = Editor.before(editor, path);
4222
4272
  if (before) {
4223
4273
  Transforms.select(editor, before);
@@ -4599,11 +4649,14 @@ class TablePosition {
4599
4649
  columnIndex++;
4600
4650
  nextCell = this.table.children[rowIndex].children[columnIndex];
4601
4651
  }
4602
- else {
4652
+ else if (rowIndex + 1 < this.getHeight()) {
4603
4653
  columnIndex = 0;
4604
4654
  rowIndex++;
4605
4655
  nextCell = this.table.children[rowIndex].children[columnIndex];
4606
4656
  }
4657
+ else {
4658
+ nextCell = null;
4659
+ }
4607
4660
  }
4608
4661
  return nextCell;
4609
4662
  }
@@ -4754,7 +4807,7 @@ function calcSpanForColumn(table, targetIndex) {
4754
4807
  return rowspans.some(rowspan => isInside(rowspan, rowIndx, targetIndex));
4755
4808
  });
4756
4809
  }
4757
- function calcOriginSpan(table, targetRowIndex, targetColumnIndex) {
4810
+ function getOriginCell(table, targetRowIndex, targetColumnIndex) {
4758
4811
  for (let rowIndex = 0; rowIndex <= targetRowIndex; rowIndex++) {
4759
4812
  const row = table.children[rowIndex];
4760
4813
  const originCell = row.children
@@ -5252,6 +5305,13 @@ const TableEditor = {
5252
5305
  isActiveHeader(editor) {
5253
5306
  const [tableRowEntry] = Editor.nodes(editor, { match: (n) => n.type === ElementKinds.tableRow });
5254
5307
  return tableRowEntry && tableRowEntry[0] && tableRowEntry[0].header;
5308
+ },
5309
+ selectOriginCell(editor, table, rowIndex, columnIndex, isStart) {
5310
+ const origin = getOriginCell(table, rowIndex, columnIndex);
5311
+ if (origin) {
5312
+ const path = AngularEditor.findPath(editor, origin);
5313
+ Transforms.select(editor, isStart ? Editor.start(editor, path) : Editor.end(editor, path));
5314
+ }
5255
5315
  }
5256
5316
  };
5257
5317
 
@@ -6286,6 +6346,9 @@ class TheCodeComponent extends TheBaseElementComponent {
6286
6346
  if (this.options.mode !== this.element.language) {
6287
6347
  this.useMode();
6288
6348
  }
6349
+ if (!this.readonly && this.isCollapsed) {
6350
+ this.initializeCodemirrorFocus();
6351
+ }
6289
6352
  }
6290
6353
  }
6291
6354
  ngOnInit() {
@@ -9803,7 +9866,7 @@ const normalizeTable = (table) => {
9803
9866
  }
9804
9867
  // case 2
9805
9868
  if (cell.hidden && !normalizedNodes.includes(cell)) {
9806
- const origin = calcOriginSpan(table, rowIndex, columnIndex);
9869
+ const origin = getOriginCell(table, rowIndex, columnIndex);
9807
9870
  if (!origin) {
9808
9871
  delete table.children[rowIndex].children[columnIndex].hidden;
9809
9872
  }
@@ -9814,7 +9877,7 @@ const normalizeTable = (table) => {
9814
9877
  };
9815
9878
 
9816
9879
  const withTable = (editor) => {
9817
- const { deleteBackward, deleteForward, onKeydown, setFragmentData, insertData, normalizeNode, isBlockCard, renderElement, deleteCutData, isContainer } = editor;
9880
+ const { deleteBackward, deleteForward, onKeydown, setFragmentData, insertData, normalizeNode, isBlockCard, renderElement, deleteCutData, isContainer, onChange } = editor;
9818
9881
  editor.deleteBackward = unit => {
9819
9882
  const opts = new TableOptions$1();
9820
9883
  if (!isSelectionInTable(opts, editor)) {
@@ -9885,13 +9948,11 @@ const withTable = (editor) => {
9885
9948
  const aboveCell = aboveRow && aboveRow.children[startPosition.getColumnIndex()];
9886
9949
  if (aboveCell) {
9887
9950
  if (aboveCell.hidden) {
9888
- const originSpan = calcOriginSpan(endPosition.table, startPosition.getRowIndex() - 1, startPosition.getColumnIndex());
9889
- if (originSpan) {
9890
- at = Editor.start(editor, TheEditor.findPath(editor, originSpan));
9891
- }
9951
+ TableEditor.selectOriginCell(editor, startPosition.table, startPosition.getRowIndex() - 1, startPosition.getColumnIndex(), false);
9952
+ return;
9892
9953
  }
9893
9954
  else {
9894
- at = Editor.start(editor, TheEditor.findPath(editor, aboveCell));
9955
+ at = Editor.end(editor, TheEditor.findPath(editor, aboveCell));
9895
9956
  }
9896
9957
  }
9897
9958
  else {
@@ -9920,10 +9981,8 @@ const withTable = (editor) => {
9920
9981
  const belowCell = belowRow && belowRow.children[startPosition.getColumnIndex()];
9921
9982
  if (belowCell) {
9922
9983
  if (belowCell.hidden) {
9923
- const originSpan = calcOriginSpan(endPosition.table, belowRowIndex, startPosition.getColumnIndex());
9924
- if (originSpan) {
9925
- at = Editor.start(editor, TheEditor.findPath(editor, originSpan));
9926
- }
9984
+ TableEditor.selectOriginCell(editor, startPosition.table, startPosition.getRowIndex() + 1, startPosition.getColumnIndex(), true);
9985
+ return;
9927
9986
  }
9928
9987
  else {
9929
9988
  at = Editor.start(editor, TheEditor.findPath(editor, belowCell));
@@ -9942,18 +10001,27 @@ const withTable = (editor) => {
9942
10001
  const beforePoint = Editor.before(editor, editor.selection);
9943
10002
  const beforePosition = beforePoint && TablePosition.create(opts, editor, beforePoint.path);
9944
10003
  if (beforePosition && beforePosition.cell && beforePosition.cell.hidden) {
10004
+ event.preventDefault();
9945
10005
  const at = Editor.end(editor, TheEditor.findPath(editor, beforePosition.findPrevious()));
9946
10006
  Transforms.select(editor, at);
9947
- event.preventDefault();
9948
10007
  }
9949
10008
  }
9950
10009
  if (isMoveForward) {
9951
10010
  const afterPoint = Editor.after(editor, editor.selection);
9952
10011
  const afterPosition = afterPoint && TablePosition.create(opts, editor, afterPoint.path);
9953
10012
  if (afterPosition.cell && afterPosition.cell.hidden) {
9954
- const at = Editor.start(editor, TheEditor.findPath(editor, afterPosition.findNext()));
9955
- Transforms.select(editor, at);
9956
10013
  event.preventDefault();
10014
+ const nextCell = afterPosition.findNext();
10015
+ if (nextCell) {
10016
+ const at = Editor.start(editor, TheEditor.findPath(editor, afterPosition.findNext()));
10017
+ Transforms.select(editor, at);
10018
+ event.preventDefault();
10019
+ }
10020
+ else {
10021
+ AngularEditor.moveBlockCard(editor, startPosition.tableEntry[0], { direction: 'right' });
10022
+ event.preventDefault();
10023
+ }
10024
+ return;
9957
10025
  }
9958
10026
  }
9959
10027
  // Prevent deleting cells in the table
@@ -10023,12 +10091,12 @@ const withTable = (editor) => {
10023
10091
  }
10024
10092
  if (tableFragment) {
10025
10093
  tableFragment = normalizeTable(_.cloneDeep(tableFragment));
10094
+ const plainText = Node.string(tableFragment);
10026
10095
  tableFragment = [tableFragment];
10027
10096
  const stringObj = JSON.stringify(tableFragment);
10028
10097
  const encoded = window.btoa(encodeURIComponent(stringObj));
10029
10098
  unit.setData(`application/${CLIPBOARD_FORMAT_KEY}`, encoded);
10030
- // unit.setData('text/html', div.innerHTML);
10031
- unit.setData('text/plain', Node.string(tableFragment));
10099
+ unit.setData('text/plain', plainText);
10032
10100
  return;
10033
10101
  }
10034
10102
  setFragmentData(unit);
@@ -10053,7 +10121,7 @@ const withTable = (editor) => {
10053
10121
  for (let j = selectColIndex; j <= lastColIndex; j++) {
10054
10122
  const row = tablePosition.table.children[i];
10055
10123
  if (row && row.children[j]) {
10056
- const originCell = calcOriginSpan(tablePosition.table, i, j);
10124
+ const originCell = getOriginCell(tablePosition.table, i, j);
10057
10125
  if (originCell && (originCell.colspan || originCell.rowspan)) {
10058
10126
  const path = TheEditor.findPath(editor, originCell).slice(-2);
10059
10127
  resetTableCell(editor, tablePosition.table, originCell, path[0], path[1]);
@@ -10111,6 +10179,21 @@ const withTable = (editor) => {
10111
10179
  Transforms.setNodes(editor, { columns }, { at: entry[1] });
10112
10180
  }
10113
10181
  }
10182
+ // adjust selection when selection is in hidden cell
10183
+ if (Element$1.isElement(entry[0]) && entry[0].type === ElementKinds.tableCell && entry[0].hidden) {
10184
+ if (editor.selection && Range.isCollapsed(editor.selection) && Path.isAncestor(entry[1], editor.selection.anchor.path)) {
10185
+ setTimeout(() => {
10186
+ const opts = new TableOptions$1();
10187
+ const tablePosition = TablePosition.create(opts, editor, editor.selection.anchor.path);
10188
+ const origin = getOriginCell(tablePosition.table, tablePosition.getRowIndex(), tablePosition.getColumnIndex());
10189
+ if (origin) {
10190
+ const path = AngularEditor.findPath(editor, origin);
10191
+ Transforms.select(editor, Editor.end(editor, path));
10192
+ }
10193
+ }, 0);
10194
+ return;
10195
+ }
10196
+ }
10114
10197
  normalizeNode(entry);
10115
10198
  };
10116
10199
  editor.isBlockCard = (element) => {
@@ -10158,6 +10241,20 @@ const withTable = (editor) => {
10158
10241
  editor.isContainer = (element) => {
10159
10242
  return element.type === ElementKinds.tableCell ? true : isContainer(element);
10160
10243
  };
10244
+ editor.onChange = () => {
10245
+ onChange();
10246
+ // adujst selection when selection is in hidden cell
10247
+ // just hook set_selection
10248
+ const isCollapsed = editor.selection && Range.isCollapsed(editor.selection);
10249
+ const isSelectionOperation = editor.operations.every(op => Operation.isSelectionOperation(op));
10250
+ if (isCollapsed && isSelectionOperation) {
10251
+ const opts = new TableOptions$1();
10252
+ const tablePosition = TablePosition.create(opts, editor, editor.selection.anchor.path);
10253
+ if (tablePosition.isInTable() && tablePosition.cell.hidden) {
10254
+ TableEditor.selectOriginCell(editor, tablePosition.table, tablePosition.getRowIndex(), tablePosition.getColumnIndex(), false);
10255
+ }
10256
+ }
10257
+ };
10161
10258
  return editor;
10162
10259
  };
10163
10260
 
@@ -11377,12 +11474,13 @@ class ThePlaceholderComponent {
11377
11474
  }
11378
11475
  }
11379
11476
  checkStatus() {
11380
- var _a, _b;
11477
+ var _a, _b, _c;
11381
11478
  const { editor } = this;
11382
11479
  const isEmptyShow = typeof ((_a = this.options) === null || _a === void 0 ? void 0 : _a.isEmptyShowPlaceholder) === 'undefined' ? true : this.options.isEmptyShowPlaceholder;
11383
11480
  const isMustShow = (_b = this.options) === null || _b === void 0 ? void 0 : _b.isMustShowPlaceholder;
11481
+ const isReadonly = (_c = this.options) === null || _c === void 0 ? void 0 : _c.readonly;
11384
11482
  // empty content and no selection processing
11385
- if (isEmptyShow && isEmptyContent(editor.children)) {
11483
+ if (!isReadonly && isEmptyShow && isEmptyContent(editor.children)) {
11386
11484
  const firstElementChild = this.contextService.getFirstElementChild();
11387
11485
  const offsetTop = firstElementChild.offsetTop;
11388
11486
  const offsetLeft = firstElementChild.offsetLeft;
@@ -11831,7 +11929,7 @@ TheEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
11831
11929
  useExisting: forwardRef(() => TheEditorComponent),
11832
11930
  multi: true
11833
11931
  }
11834
- ], 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\" [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.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.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"] }] });
11932
+ ], 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\" [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.SlateEditableComponent, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "placeholderDecorate", "isStrictDecorate", "trackBy", "readonly", "placeholder", "beforeInput", "blur", "click", "compositionEnd", "compositionStart", "copy", "cut", "dragOver", "dragStart", "dragEnd", "drop", "focus", "keydown", "paste", "spellCheck", "autoCorrect", "autoCapitalize"] }, { type: TheInlineToolbarComponent, selector: "the-inline-toolbar", inputs: ["editor", "toolbarItems"] }, { type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: ["editor", "quickToolbarItems"] }, { type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: ["editor", "options"] }, { 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"] }] });
11835
11933
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheEditorComponent, decorators: [{
11836
11934
  type: Component,
11837
11935
  args: [{