@worktile/theia 1.2.11 → 1.2.15

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.
Files changed (59) hide show
  1. package/bundles/worktile-theia.umd.js +230 -135
  2. package/bundles/worktile-theia.umd.js.map +1 -1
  3. package/components/column-resize/column-resize.directive.d.ts +3 -3
  4. package/components/inline-toolbar/inline-toolbar.component.d.ts +3 -1
  5. package/components/inline-toolbar/inline-toolbar.component.scss +6 -5
  6. package/components/toolbar/toolbar.component.d.ts +2 -1
  7. package/constants/default.d.ts +0 -1
  8. package/custom-types.d.ts +2 -0
  9. package/editor.component.d.ts +2 -0
  10. package/esm2015/components/column-resize/column-resize.directive.js +1 -1
  11. package/esm2015/components/inline-toolbar/inline-toolbar.component.js +10 -7
  12. package/esm2015/components/toolbar/toolbar.component.js +7 -6
  13. package/esm2015/components/toolbar-group/toolbar-group.component.js +1 -1
  14. package/esm2015/components/toolbar-item/toolbar-item.component.js +7 -3
  15. package/esm2015/constants/default.js +1 -2
  16. package/esm2015/custom-types.js +1 -1
  17. package/esm2015/editor.component.js +28 -14
  18. package/esm2015/interfaces/editor.js +1 -1
  19. package/esm2015/interfaces/toolbar.js +1 -1
  20. package/esm2015/plugins/deserializers/deserialize-html.plugin.js +12 -4
  21. package/esm2015/plugins/deserializers/deserialize-md.plugin.js +8 -3
  22. package/esm2015/plugins/index.js +14 -2
  23. package/esm2015/plugins/mark/options.js +6 -1
  24. package/esm2015/plugins/paint-format/options.js +4 -1
  25. package/esm2015/plugins/placeholder/placeholder.component.js +21 -14
  26. package/esm2015/plugins/quick-insert/components/quick-insert.component.js +7 -6
  27. package/esm2015/plugins/quick-insert/quick-insert.plugint.js +3 -2
  28. package/esm2015/plugins/soft-break/soft-break.plugin.js +18 -0
  29. package/esm2015/plugins/soft-break/soft-break.types.js +2 -0
  30. package/esm2015/plugins/table/table.plugin.js +34 -55
  31. package/esm2015/plugins/table/table.types.js +1 -1
  32. package/esm2015/plugins/table/utils/normalize-table.js +31 -0
  33. package/esm2015/queries/is-container-type.js +2 -2
  34. package/esm2015/services/context.service.js +10 -2
  35. package/esm2015/transforms/index.js +2 -3
  36. package/esm2015/utils/auto-focus.js +2 -2
  37. package/esm2015/utils/common.js +3 -0
  38. package/esm2015/utils/fragment.js +24 -2
  39. package/esm2015/utils/index.js +2 -1
  40. package/fesm2015/worktile-theia.js +221 -127
  41. package/fesm2015/worktile-theia.js.map +1 -1
  42. package/interfaces/editor.d.ts +2 -0
  43. package/interfaces/toolbar.d.ts +1 -0
  44. package/package.json +1 -1
  45. package/plugins/image/image.component.scss +172 -168
  46. package/plugins/placeholder/placeholder.component.d.ts +4 -2
  47. package/plugins/soft-break/soft-break.plugin.d.ts +4 -0
  48. package/plugins/soft-break/soft-break.types.d.ts +8 -0
  49. package/plugins/table/table.types.d.ts +7 -0
  50. package/plugins/table/utils/normalize-table.d.ts +2 -0
  51. package/services/context.service.d.ts +2 -0
  52. package/styles/editor.scss +3 -3
  53. package/styles/typo.scss +5 -2
  54. package/transforms/index.d.ts +1 -2
  55. package/utils/common.d.ts +2 -0
  56. package/utils/fragment.d.ts +5 -0
  57. package/utils/index.d.ts +1 -0
  58. package/esm2015/transforms/insert-elements.js +0 -22
  59. package/transforms/insert-elements.d.ts +0 -2
@@ -64,7 +64,6 @@ const TAB_SPACE = ' ';
64
64
  const ZERO_WIDTH_CHAR = '\u200B';
65
65
  const CLIPBOARD_FORMAT_KEY = 'x-theia-fragment';
66
66
  const DEFAULT_SCROLL_CONTAINER = '.the-editable-container';
67
- const BLOCK_INSERT_ORIGIN = 'block-insert';
68
67
  const ELEMENT_UNIQUE_ID = 'key';
69
68
  var TheMode;
70
69
  (function (TheMode) {
@@ -1040,7 +1039,10 @@ const extractFragment = (data, deleteKey = ELEMENT_UNIQUE_ID) => {
1040
1039
  const fragment = data.getData(`application/${CLIPBOARD_FORMAT_KEY}`);
1041
1040
  if (fragment) {
1042
1041
  const decoded = decodeURIComponent(window.atob(fragment));
1043
- const nodes = JSON.parse(decoded);
1042
+ let nodes = JSON.parse(decoded);
1043
+ if (!Array.isArray(nodes)) {
1044
+ nodes = [nodes];
1045
+ }
1044
1046
  // delete key to avoid duplicate keys
1045
1047
  if (deleteKey) {
1046
1048
  deleteElementKey(nodes, deleteKey);
@@ -1060,6 +1062,25 @@ function deleteElementKey(nodes, key) {
1060
1062
  });
1061
1063
  return nodes;
1062
1064
  }
1065
+ /**
1066
+ * 删除 text 节点的 颜色/背景色
1067
+ * @param node
1068
+ */
1069
+ function deleteColorAndBackgroundColorOfText(node) {
1070
+ node.children.forEach((child) => {
1071
+ if (Text.isText(child)) {
1072
+ if (child['color']) {
1073
+ delete child['color'];
1074
+ }
1075
+ if (child['background-color']) {
1076
+ delete child['background-color'];
1077
+ }
1078
+ }
1079
+ else {
1080
+ deleteColorAndBackgroundColorOfText(child);
1081
+ }
1082
+ });
1083
+ }
1063
1084
 
1064
1085
  const isAcrossBlocks = (editor, fragment) => {
1065
1086
  const startBlock = getStartBlock(editor, fragment[0]);
@@ -1172,7 +1193,7 @@ const getSelectionMarks = (editor) => {
1172
1193
  return marks;
1173
1194
  };
1174
1195
 
1175
- const isContainer = (editor, value) => Element$1.isElement(value) && editor.isContainer(value);
1196
+ const isContainer = (editor, value) => Element$1.isElement(value) && editor.isContainer && editor.isContainer(value);
1176
1197
 
1177
1198
  const getContainerBlocks = (editor) => {
1178
1199
  const containerNode = Editor.above(editor, {
@@ -1441,26 +1462,6 @@ const setEndSelection = (editor) => {
1441
1462
  AngularEditor.focus(editor);
1442
1463
  };
1443
1464
 
1444
- const insertTheElements = (editor, nodes) => {
1445
- if (Range.isExpanded(editor.selection)) {
1446
- Editor.deleteFragment(editor);
1447
- }
1448
- const isEmptyParagraph$1 = isEmptyParagraph(editor, editor.selection.anchor);
1449
- const parentPath = Path.parent(editor.selection.anchor.path);
1450
- Editor.withoutNormalizing(editor, () => {
1451
- Transforms.insertNodes(editor, nodes);
1452
- if (parentPath.length && isEmptyParagraph$1) {
1453
- Transforms.delete(editor, { at: parentPath });
1454
- const lastPath = parentPath.pop();
1455
- Transforms.select(editor, Editor.end(editor, [...parentPath, lastPath + nodes.length - 1]));
1456
- }
1457
- else {
1458
- const lastPath = parentPath.pop();
1459
- Transforms.select(editor, Editor.end(editor, [...parentPath, lastPath + nodes.length]));
1460
- }
1461
- });
1462
- };
1463
-
1464
1465
  const THE_EDITOR_UUID = new WeakMap();
1465
1466
  const THE_EDITOR_CONVERSION_HINT_REF = new WeakMap();
1466
1467
  const THE_EDITOR_QUICK_TOOLBAR_REF = new WeakMap();
@@ -1525,7 +1526,6 @@ var index = /*#__PURE__*/Object.freeze({
1525
1526
  splitNode: splitNode,
1526
1527
  deleteElement: deleteElement,
1527
1528
  setEndSelection: setEndSelection,
1528
- insertTheElements: insertTheElements,
1529
1529
  closeConversionHint: closeConversionHint,
1530
1530
  handleContinualDeleteBackward: handleContinualDeleteBackward,
1531
1531
  handleContinualInsertBreak: handleContinualInsertBreak
@@ -1956,6 +1956,9 @@ const getToolbarClass = (editor) => {
1956
1956
  return `the-toolbar-${uuid}`;
1957
1957
  };
1958
1958
 
1959
+ const IS_MAC = typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);
1960
+ const CONTROL_KEY = IS_MAC ? '⌘' : 'Ctrl';
1961
+
1959
1962
  const withDeserializeMd = (options) => (editor) => {
1960
1963
  const { insertData, onKeydown } = editor;
1961
1964
  editor.onKeydown = (event) => {
@@ -1991,13 +1994,18 @@ const withDeserializeMd = (options) => (editor) => {
1991
1994
  editor.undo();
1992
1995
  setTimeout(() => {
1993
1996
  Transforms.select(editor, oldRange);
1994
- insertTheElements(editor, fragment);
1997
+ Transforms.insertFragment(editor, fragment);
1995
1998
  AngularEditor.focus(editor);
1996
1999
  });
1997
2000
  return;
1998
2001
  }
2002
+ else {
2003
+ closeConversionHint(editor);
2004
+ }
2005
+ }
2006
+ catch (error) {
2007
+ closeConversionHint(editor);
1999
2008
  }
2000
- catch (error) { }
2001
2009
  }
2002
2010
  },
2003
2011
  origin,
@@ -2232,10 +2240,18 @@ class TheContextService {
2232
2240
  }
2233
2241
  getOptions() {
2234
2242
  if (!this.options.width) {
2235
- this.options.width = this.options.nativeElement.querySelector('.slate-editable-container').firstElementChild.offsetWidth;
2243
+ const firstElementChild = this.getFirstElementChild();
2244
+ this.options.width = firstElementChild.offsetWidth;
2236
2245
  }
2237
2246
  return this.options;
2238
2247
  }
2248
+ getEditableElement() {
2249
+ return this.options.nativeElement.querySelector('.the-editor-typo');
2250
+ }
2251
+ getFirstElementChild() {
2252
+ const editableElement = this.getEditableElement();
2253
+ return editableElement === null || editableElement === void 0 ? void 0 : editableElement.firstElementChild;
2254
+ }
2239
2255
  setUploadFileList(file) {
2240
2256
  this.fileList.push(file);
2241
2257
  }
@@ -5271,6 +5287,7 @@ const MarkOptions = [
5271
5287
  key: MarkTypes.bold,
5272
5288
  icon: 'bold',
5273
5289
  name: '加粗',
5290
+ shortcutKey: `${CONTROL_KEY}+B`,
5274
5291
  execute: editor => MarkEditor.toggleMark(editor, MarkTypes.bold),
5275
5292
  active: editor => MarkEditor.isMarkActive(editor, MarkTypes.bold)
5276
5293
  },
@@ -5278,6 +5295,7 @@ const MarkOptions = [
5278
5295
  key: MarkTypes.italic,
5279
5296
  icon: 'italic',
5280
5297
  name: '斜体',
5298
+ shortcutKey: `${CONTROL_KEY}+I`,
5281
5299
  execute: editor => MarkEditor.toggleMark(editor, MarkTypes.italic),
5282
5300
  active: editor => MarkEditor.isMarkActive(editor, MarkTypes.italic)
5283
5301
  },
@@ -5292,6 +5310,7 @@ const MarkOptions = [
5292
5310
  key: MarkTypes.underline,
5293
5311
  icon: 'underline',
5294
5312
  name: '下划线',
5313
+ shortcutKey: `${CONTROL_KEY}+U`,
5295
5314
  execute: editor => MarkEditor.toggleMark(editor, MarkTypes.underline),
5296
5315
  active: editor => MarkEditor.isMarkActive(editor, MarkTypes.underline)
5297
5316
  },
@@ -5299,6 +5318,7 @@ const MarkOptions = [
5299
5318
  key: MarkTypes.codeLine,
5300
5319
  icon: 'code',
5301
5320
  name: '行内代码',
5321
+ shortcutKey: `${CONTROL_KEY}+E`,
5302
5322
  execute: editor => MarkEditor.toggleMark(editor, MarkTypes.codeLine),
5303
5323
  active: editor => MarkEditor.isMarkActive(editor, MarkTypes.codeLine)
5304
5324
  }
@@ -9763,6 +9783,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
9763
9783
  args: ['cellInner', { static: true }]
9764
9784
  }] } });
9765
9785
 
9786
+ const normalizeTable = (table) => {
9787
+ const normalizedNodes = [];
9788
+ const rowHeight = table.children.length;
9789
+ const columnWidth = table.children[0].children.length;
9790
+ table.children.forEach((row, rowIndex) => {
9791
+ row.children.forEach((cell, columnIndex) => {
9792
+ // case 1
9793
+ if (cell.colspan || cell.rowspan) {
9794
+ const rowspan = cell.rowspan || 1;
9795
+ const colspan = cell.colspan || 1;
9796
+ if (rowspan > rowHeight - rowIndex) {
9797
+ cell.rowspan = rowHeight - rowIndex;
9798
+ }
9799
+ if (colspan > columnWidth - columnIndex) {
9800
+ cell.colspan = columnWidth - columnIndex;
9801
+ }
9802
+ return;
9803
+ }
9804
+ // case 2
9805
+ if (cell.hidden && !normalizedNodes.includes(cell)) {
9806
+ const origin = calcOriginSpan(table, rowIndex, columnIndex);
9807
+ if (!origin) {
9808
+ delete table.children[rowIndex].children[columnIndex].hidden;
9809
+ }
9810
+ }
9811
+ });
9812
+ });
9813
+ return table;
9814
+ };
9815
+
9766
9816
  const withTable = (editor) => {
9767
9817
  const { deleteBackward, deleteForward, onKeydown, setFragmentData, insertData, normalizeNode, isBlockCard, renderElement, deleteCutData, isContainer } = editor;
9768
9818
  editor.deleteBackward = unit => {
@@ -9940,67 +9990,45 @@ const withTable = (editor) => {
9940
9990
  return;
9941
9991
  }
9942
9992
  const { selection } = editor;
9943
- const element = TablePosition.create(opts, editor, selection.anchor.path);
9944
- const tableComponent = ELEMENT_TO_COMPONENT.get(element.table);
9993
+ const tablePosition = TablePosition.create(opts, editor, selection.anchor.path);
9994
+ const tableComponent = ELEMENT_TO_COMPONENT.get(tablePosition.table);
9945
9995
  const cells = tableComponent.tableStore.selectedCells;
9946
- const tableContent = {};
9947
- let contents;
9948
- let cellNode;
9949
- let fragment;
9950
- if (cells.length > 0) {
9951
- const selectNodes = getSelectCellNode(editor, cells);
9952
- const selectedColumnsIndex = tableComponent.tableStore.selectedColumnsIndex || [];
9953
- const selectedRowsIndex = tableComponent.tableStore.selectedRowsIndex || [];
9996
+ let tableFragment = null;
9997
+ if (tableComponent.tableStore.selectedRowsIndex.length > 0) {
9998
+ const rows = tablePosition.table.children.slice(tableComponent.tableStore.selectedRowsIndex[0], tableComponent.tableStore.selectedRowsIndex[tableComponent.tableStore.selectedRowsIndex.length - 1] + 1);
9999
+ tableFragment = Object.assign(Object.assign({}, tablePosition.table), { children: rows });
10000
+ }
10001
+ else if (cells.length > 0) {
10002
+ const tempRows = {};
9954
10003
  for (const cell of cells) {
9955
10004
  const { row, col } = cell;
9956
- const cellPath = [...element.tableEntry[1], row, col];
9957
- cellNode = Node.get(editor, cellPath);
9958
- const cellRange = Editor.range(editor, cellPath);
9959
- const domRange = AngularEditor.toDOMRange(editor, cellRange);
9960
- if (!contents) {
9961
- contents = domRange.cloneContents();
9962
- }
9963
- else {
9964
- contents.append(domRange.cloneContents());
10005
+ const cellPath = [...tablePosition.tableEntry[1], row, col];
10006
+ const cellNode = Node.get(editor, cellPath);
10007
+ if (!tempRows[row]) {
10008
+ tempRows[row] = [];
9965
10009
  }
9966
- if ((selectedColumnsIndex.length === 1 && cellNode.colspan > 1) ||
9967
- (selectedRowsIndex.length === 1 && cellNode.rowspan > 1)) {
9968
- cellNode = Object.assign(Object.assign({}, cellNode), { colspan: selectedColumnsIndex.length === 1 ? null : cellNode.colspan, rowspan: selectedRowsIndex.length === 1 ? null : cellNode.rowspan });
9969
- }
9970
- if (cellNode.hidden) {
9971
- const origin = calcOriginSpan(element.table, row, col);
9972
- const selectedOrigin = origin && selectNodes.filter(item => item.node.key === origin.key);
9973
- if (!selectedOrigin || !selectedOrigin.length) {
9974
- cellNode = Object.assign(Object.assign({}, cellNode), { hidden: null });
9975
- }
9976
- }
9977
- if (!tableContent[row]) {
9978
- tableContent[row] = [];
9979
- }
9980
- tableContent[row].push(cellNode);
10010
+ tempRows[row].push(cellNode);
9981
10011
  }
9982
- const tableFragment = [
10012
+ const rows = Object.values(tempRows).map((item) => {
10013
+ return {
10014
+ type: ElementKinds.tableRow,
10015
+ children: item
10016
+ };
10017
+ });
10018
+ tableFragment =
9983
10019
  {
9984
10020
  type: ElementKinds.table,
9985
- children: Object.values(tableContent).map((item) => {
9986
- return {
9987
- type: ElementKinds.tableRow,
9988
- children: item
9989
- };
9990
- })
9991
- }
9992
- ];
9993
- fragment = tableFragment;
9994
- const stringObj = JSON.stringify(fragment);
10021
+ children: rows
10022
+ };
10023
+ }
10024
+ if (tableFragment) {
10025
+ tableFragment = normalizeTable(_.cloneDeep(tableFragment));
10026
+ tableFragment = [tableFragment];
10027
+ const stringObj = JSON.stringify(tableFragment);
9995
10028
  const encoded = window.btoa(encodeURIComponent(stringObj));
9996
10029
  unit.setData(`application/${CLIPBOARD_FORMAT_KEY}`, encoded);
9997
- const div = document.createElement('div');
9998
- div.appendChild(contents);
9999
- div.setAttribute('hidden', 'true');
10000
- document.body.appendChild(div);
10001
- unit.setData('text/html', div.innerHTML);
10002
- unit.setData('text/plain', getPlainText$1(div));
10003
- document.body.removeChild(div);
10030
+ // unit.setData('text/html', div.innerHTML);
10031
+ unit.setData('text/plain', Node.string(tableFragment));
10004
10032
  return;
10005
10033
  }
10006
10034
  setFragmentData(unit);
@@ -10164,7 +10192,15 @@ const withDeserializeHMTL = (editor) => {
10164
10192
  insertData(data);
10165
10193
  return;
10166
10194
  }
10167
- insertTheElements(editor, fragment);
10195
+ // 识出纯图片并且粘贴板中存在文件则不进行处理, hook 直接右键复制图片的场景,流转到上传图片流程
10196
+ // 后续需要做识别html图片后自动上传处理
10197
+ if (fragment.length === 1 && fragment[0].type === ElementKinds.image && data.files.length > 0) {
10198
+ insertData(data);
10199
+ return;
10200
+ }
10201
+ // 过滤 text 节点的 color/background-color 属性
10202
+ fragment.forEach((node) => deleteColorAndBackgroundColorOfText(node));
10203
+ Transforms.insertFragment(editor, fragment);
10168
10204
  return;
10169
10205
  }
10170
10206
  insertData(data);
@@ -10377,12 +10413,14 @@ const PaintFormatOptions = [
10377
10413
  key: ToolbarActionTypes.undo,
10378
10414
  icon: 'undo',
10379
10415
  name: '撤销',
10416
+ shortcutKey: `${CONTROL_KEY}+Z`,
10380
10417
  execute: (editor) => editor.undo()
10381
10418
  },
10382
10419
  {
10383
10420
  key: ToolbarActionTypes.redo,
10384
10421
  icon: 'redo',
10385
10422
  name: '重做',
10423
+ shortcutKey: `${CONTROL_KEY}+Shift+Z`,
10386
10424
  execute: (editor) => editor.redo()
10387
10425
  },
10388
10426
  {
@@ -10493,7 +10531,8 @@ TheToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0"
10493
10531
  <a
10494
10532
  thyIconNavLink
10495
10533
  [thyIconNavLinkIcon]="item.icon"
10496
- [thyTooltip]="item.name"
10534
+ [thyTooltip]="tooltip"
10535
+ [thyTooltipTemplateContext]="{ name: item.name, shortcutKey: item.shortcutKey }"
10497
10536
  thyTooltipPlacement="top"
10498
10537
  [thyIconNavLinkActive]="active"
10499
10538
  (mousedown)="execute($event)"
@@ -10505,6 +10544,7 @@ TheToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0"
10505
10544
  <span class="quick-toolbar-name">{{ item?.name }}</span>
10506
10545
  </ng-container>
10507
10546
  </ng-template>
10547
+ <ng-template #tooltip let-data> {{ data.name }} {{ data.shortcutKey }} </ng-template>
10508
10548
  <ng-container #toolbarContainer></ng-container>
10509
10549
  `, isInline: true, components: [{ type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
10510
10550
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarItemComponent, decorators: [{
@@ -10516,7 +10556,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10516
10556
  <a
10517
10557
  thyIconNavLink
10518
10558
  [thyIconNavLinkIcon]="item.icon"
10519
- [thyTooltip]="item.name"
10559
+ [thyTooltip]="tooltip"
10560
+ [thyTooltipTemplateContext]="{ name: item.name, shortcutKey: item.shortcutKey }"
10520
10561
  thyTooltipPlacement="top"
10521
10562
  [thyIconNavLinkActive]="active"
10522
10563
  (mousedown)="execute($event)"
@@ -10528,6 +10569,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10528
10569
  <span class="quick-toolbar-name">{{ item?.name }}</span>
10529
10570
  </ng-container>
10530
10571
  </ng-template>
10572
+ <ng-template #tooltip let-data> {{ data.name }} {{ data.shortcutKey }} </ng-template>
10531
10573
  <ng-container #toolbarContainer></ng-container>
10532
10574
  `,
10533
10575
  host: {
@@ -10677,10 +10719,11 @@ const withQuickInsert = (editor) => {
10677
10719
  deleteBackward(unit);
10678
10720
  };
10679
10721
  editor.onChange = () => {
10722
+ var _a;
10680
10723
  onChange();
10681
10724
  if (editor.selection) {
10682
10725
  const editorComponent = editor.injector.get(TheEditorComponent);
10683
- editorComponent.quickInsertInstance.checkStatus();
10726
+ (_a = editorComponent.quickInsertInstance) === null || _a === void 0 ? void 0 : _a.checkStatus();
10684
10727
  const block = Node.ancestor(editor, [editor.selection.anchor.path[0]]);
10685
10728
  if (!isCleanEmptyParagraph(editor) && Node.string(block) !== QUICK_TOOLBAR_HOTKEY) {
10686
10729
  QuickInsertEditor.closeQuickToolbar(editor);
@@ -10690,6 +10733,22 @@ const withQuickInsert = (editor) => {
10690
10733
  return editor;
10691
10734
  };
10692
10735
 
10736
+ const withSoftBreak = (options = { rules: [{ hotkey: 'shift+enter' }] }) => (editor) => {
10737
+ const { onKeydown } = editor;
10738
+ editor.onKeydown = (event) => {
10739
+ const { rules } = options;
10740
+ const entry = getBlockAbove(editor);
10741
+ rules.forEach(({ hotkey, query }) => {
10742
+ if (isHotkey(hotkey, event) && isNodeType(entry, query)) {
10743
+ event.preventDefault();
10744
+ editor.insertText('\n');
10745
+ }
10746
+ });
10747
+ onKeydown(event);
10748
+ };
10749
+ return editor;
10750
+ };
10751
+
10693
10752
  const internalPlugins = [
10694
10753
  withTheHistory,
10695
10754
  withAutoInsertData(),
@@ -10707,6 +10766,17 @@ const internalPlugins = [
10707
10766
  withCode,
10708
10767
  withHeading,
10709
10768
  withMark(),
10769
+ withSoftBreak({
10770
+ rules: [
10771
+ { hotkey: 'shift+enter' },
10772
+ {
10773
+ hotkey: 'enter',
10774
+ query: {
10775
+ allow: [ElementKinds.blockquote]
10776
+ }
10777
+ }
10778
+ ]
10779
+ }),
10710
10780
  withBlockquote,
10711
10781
  withNodeID({ idKey: ELEMENT_UNIQUE_ID, idCreator }),
10712
10782
  withAutoFormat({ rules: autoFormatRules }),
@@ -10715,9 +10785,9 @@ const internalPlugins = [
10715
10785
  withMoveSelection,
10716
10786
  withInsertParagraphNodes(),
10717
10787
  withGetFragment(),
10788
+ withImage,
10718
10789
  withDeserializeHMTL,
10719
10790
  withDeserializeMd(),
10720
- withImage,
10721
10791
  withQuickInsert
10722
10792
  ];
10723
10793
  const internalToolbarItems = [
@@ -10821,8 +10891,8 @@ const autoFocus = (editor, isFocus) => {
10821
10891
  setTimeout(() => {
10822
10892
  if (editor && editor.children.length > 0 && isFocus) {
10823
10893
  HistoryEditor.withoutMerging(editor, () => {
10824
- AngularEditor.focus(editor);
10825
10894
  Transforms.select(editor, Editor.start(editor, [0]));
10895
+ AngularEditor.focus(editor);
10826
10896
  });
10827
10897
  }
10828
10898
  });
@@ -10863,6 +10933,7 @@ class TheToolbarComponent {
10863
10933
  this.ngZone = ngZone;
10864
10934
  this.toolbarGroupComponent = toolbarGroupComponent;
10865
10935
  this.toolbarItems = [];
10936
+ this.containerClass = [];
10866
10937
  this.isMore = true;
10867
10938
  this.components = new Map();
10868
10939
  this.moreGroupMenu = ToolbarMoreGroup;
@@ -10888,9 +10959,8 @@ class TheToolbarComponent {
10888
10959
  }
10889
10960
  }
10890
10961
  setToolbarClass() {
10891
- if (this.editor) {
10892
- const toolbarClass = getToolbarClass(this.editor);
10893
- this.elementRef.nativeElement.classList.add(toolbarClass);
10962
+ if (this.editor && !!this.containerClass.length) {
10963
+ this.elementRef.nativeElement.classList.add(...this.containerClass);
10894
10964
  }
10895
10965
  }
10896
10966
  resizeElement() {
@@ -11060,7 +11130,7 @@ class TheToolbarComponent {
11060
11130
  }
11061
11131
  }
11062
11132
  TheToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarComponent, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: TheToolbarGroupToken }], target: i0.ɵɵFactoryTarget.Component });
11063
- TheToolbarComponent.ɵcmp = i0.ɵɵ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: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: "<thy-icon-nav [style.justifyContent]=\"align\">\n <ng-container #toolbarContainer></ng-container>\n <ng-content></ng-content>\n <ng-template *ngIf=\"afterTemplate\" [ngTemplateOutlet]=\"afterTemplate\"></ng-template>\n</thy-icon-nav>\n", components: [{ type: i2.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
11133
+ TheToolbarComponent.ɵcmp = i0.ɵɵ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: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: "<thy-icon-nav [style.justifyContent]=\"align\">\n <ng-container #toolbarContainer></ng-container>\n <ng-content></ng-content>\n <ng-template *ngIf=\"afterTemplate\" [ngTemplateOutlet]=\"afterTemplate\"></ng-template>\n</thy-icon-nav>\n", components: [{ type: i2.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
11064
11134
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarComponent, decorators: [{
11065
11135
  type: Component,
11066
11136
  args: [{
@@ -11079,6 +11149,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11079
11149
  type: Input
11080
11150
  }], align: [{
11081
11151
  type: Input
11152
+ }], containerClass: [{
11153
+ type: Input
11082
11154
  }], isMore: [{
11083
11155
  type: Input
11084
11156
  }], afterTemplate: [{
@@ -11089,11 +11161,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11089
11161
  }] } });
11090
11162
 
11091
11163
  class TheInlineToolbarComponent {
11092
- constructor(elementRef, scrollDispatcher, cdr, ngZone) {
11164
+ constructor(elementRef, scrollDispatcher, cdr, ngZone, contextService) {
11093
11165
  this.elementRef = elementRef;
11094
11166
  this.scrollDispatcher = scrollDispatcher;
11095
11167
  this.cdr = cdr;
11096
11168
  this.ngZone = ngZone;
11169
+ this.contextService = contextService;
11097
11170
  this.destroy$ = new Subject();
11098
11171
  }
11099
11172
  ngOnInit() {
@@ -11153,7 +11226,8 @@ class TheInlineToolbarComponent {
11153
11226
  boundary = range.startContainer.getBoundingClientRect();
11154
11227
  }
11155
11228
  }
11156
- const editableRect = document.querySelector('.the-editor-typo').getBoundingClientRect();
11229
+ const editableElement = this.contextService.getEditableElement();
11230
+ const editableRect = editableElement.getBoundingClientRect();
11157
11231
  const toolbarHeight = toolbarElement.offsetHeight;
11158
11232
  const toolbarWidth = toolbarElement.offsetWidth;
11159
11233
  const halfOffsetWidth = toolbarWidth / 2;
@@ -11181,14 +11255,14 @@ class TheInlineToolbarComponent {
11181
11255
  this.destroy$.complete();
11182
11256
  }
11183
11257
  }
11184
- 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 });
11258
+ 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 });
11185
11259
  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
11186
11260
  #inlineToolbar
11187
11261
  class="the-inline-toolbar"
11188
11262
  [editor]="editor"
11189
11263
  [toolbarItems]="toolbarItems"
11190
11264
  [isMore]="false"
11191
- ></the-toolbar> `, isInline: true, components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "isMore", "afterTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
11265
+ ></the-toolbar> `, isInline: true, components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
11192
11266
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInlineToolbarComponent, decorators: [{
11193
11267
  type: Component,
11194
11268
  args: [{
@@ -11205,7 +11279,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11205
11279
  },
11206
11280
  changeDetection: ChangeDetectionStrategy.OnPush
11207
11281
  }]
11208
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2$1.ScrollDispatcher }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }]; }, propDecorators: { editor: [{
11282
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2$1.ScrollDispatcher }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: TheContextService }]; }, propDecorators: { editor: [{
11209
11283
  type: Input
11210
11284
  }], toolbarItems: [{
11211
11285
  type: Input
@@ -11229,13 +11303,14 @@ class TheQuickInsertComponent {
11229
11303
  event.stopPropagation();
11230
11304
  }
11231
11305
  checkStatus() {
11232
- var _a;
11233
11306
  const { editor } = this;
11234
11307
  if (isCleanEmptyParagraph(editor)) {
11235
- 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]]);
11236
- const rootNode = AngularEditor.toDOMNode(editor, block);
11237
- this.isHide = false;
11238
- this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
11308
+ setTimeout(() => {
11309
+ var _a;
11310
+ 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]]);
11311
+ const rootNode = AngularEditor.toDOMNode(editor, block);
11312
+ this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
11313
+ });
11239
11314
  return;
11240
11315
  }
11241
11316
  this.isHide = true;
@@ -11284,9 +11359,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11284
11359
  }] } });
11285
11360
 
11286
11361
  class ThePlaceholderComponent {
11287
- constructor(renderer, elementRef) {
11362
+ constructor(renderer, elementRef, contextService) {
11288
11363
  this.renderer = renderer;
11289
11364
  this.elementRef = elementRef;
11365
+ this.contextService = contextService;
11290
11366
  this.isHide = true;
11291
11367
  }
11292
11368
  handleCompositionStart() {
@@ -11301,20 +11377,25 @@ class ThePlaceholderComponent {
11301
11377
  }
11302
11378
  }
11303
11379
  checkStatus() {
11304
- var _a, _b, _c;
11380
+ var _a, _b;
11305
11381
  const { editor } = this;
11382
+ const isEmptyShow = typeof ((_a = this.options) === null || _a === void 0 ? void 0 : _a.isEmptyShowPlaceholder) === 'undefined' ? true : this.options.isEmptyShowPlaceholder;
11383
+ const isMustShow = (_b = this.options) === null || _b === void 0 ? void 0 : _b.isMustShowPlaceholder;
11306
11384
  // empty content and no selection processing
11307
- if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.autoFocus) && !(editor === null || editor === void 0 ? void 0 : editor.selection) && isEmptyContent(editor.children)) {
11308
- // normal top is 28, but margin-top: -41px is set when maxHeight is set, so top is 69
11309
- const firstTop = ((_b = this.options) === null || _b === void 0 ? void 0 : _b.maxHeight) ? 69 : 28;
11310
- this.updatePosition(30, firstTop);
11385
+ if (isEmptyShow && isEmptyContent(editor.children)) {
11386
+ const firstElementChild = this.contextService.getFirstElementChild();
11387
+ const offsetTop = firstElementChild.offsetTop;
11388
+ const offsetLeft = firstElementChild.offsetLeft;
11389
+ this.updatePosition(offsetLeft, offsetTop);
11311
11390
  return;
11312
11391
  }
11313
- if (isCleanEmptyParagraph(editor)) {
11314
- const block = Node.ancestor(editor, [(_c = editor === null || editor === void 0 ? void 0 : editor.selection) === null || _c === void 0 ? void 0 : _c.anchor.path[0]]);
11315
- const rootNode = AngularEditor.toDOMNode(editor, block);
11316
- this.isHide = false;
11317
- this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
11392
+ if (isMustShow && isCleanEmptyParagraph(editor)) {
11393
+ setTimeout(() => {
11394
+ var _a;
11395
+ 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]]);
11396
+ const rootNode = AngularEditor.toDOMNode(editor, block);
11397
+ this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
11398
+ });
11318
11399
  return;
11319
11400
  }
11320
11401
  this.isHide = true;
@@ -11328,7 +11409,7 @@ class ThePlaceholderComponent {
11328
11409
  this.isHide = true;
11329
11410
  }
11330
11411
  }
11331
- 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 });
11412
+ 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 });
11332
11413
  ThePlaceholderComponent.ɵcmp = i0.ɵɵ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, template: `{{ options?.placeholder }}`, isInline: true });
11333
11414
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: ThePlaceholderComponent, decorators: [{
11334
11415
  type: Component,
@@ -11340,7 +11421,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11340
11421
  '[class.hide]': 'isHide'
11341
11422
  }
11342
11423
  }]
11343
- }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { editor: [{
11424
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: TheContextService }]; }, propDecorators: { editor: [{
11344
11425
  type: Input
11345
11426
  }], options: [{
11346
11427
  type: Input
@@ -11515,6 +11596,12 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
11515
11596
  this.onSlaCompositionEnd = (event) => { };
11516
11597
  this.onSlaDragStart = (event) => { };
11517
11598
  this.onSlaDragOver = (event) => { };
11599
+ this.onDrop = (event) => {
11600
+ event.stopPropagation();
11601
+ this.theOnDOMEvent.emit({
11602
+ nativeEvent: event
11603
+ });
11604
+ };
11518
11605
  }
11519
11606
  get theGlobalToolbarInstance() {
11520
11607
  return this.theGlobalToolbar ? this.theGlobalToolbar : this.globalToolbarInstance;
@@ -11532,15 +11619,18 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
11532
11619
  this.onErrorHandler();
11533
11620
  }
11534
11621
  ngOnChanges(changes) {
11535
- var _a, _b, _c;
11622
+ var _a, _b, _c, _d, _e;
11536
11623
  const options = changes.theOptions;
11537
11624
  if (options) {
11538
11625
  this.initializeOptions();
11539
11626
  }
11627
+ if (options && ((_a = options.currentValue) === null || _a === void 0 ? void 0 : _a.readonly) !== ((_b = options.previousValue) === null || _b === void 0 ? void 0 : _b.readonly)) {
11628
+ this.applyAutoFocus();
11629
+ }
11540
11630
  if (changes['theDecorate']) {
11541
11631
  this.generateDecorate();
11542
11632
  }
11543
- if (((_a = this.editor) === null || _a === void 0 ? void 0 : _a.selection) && (((_b = options === null || options === void 0 ? void 0 : options.currentValue) === null || _b === void 0 ? void 0 : _b.readonly) || ((_c = options === null || options === void 0 ? void 0 : options.currentValue) === null || _c === void 0 ? void 0 : _c.disabled))) {
11633
+ 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))) {
11544
11634
  Transforms.deselect(this.editor);
11545
11635
  }
11546
11636
  }
@@ -11557,7 +11647,9 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
11557
11647
  this.theContextService.initialize({ nativeElement: this.elementRef.nativeElement, viewContainerRef: this.viewContainerRef });
11558
11648
  this.toolbarCalculate();
11559
11649
  setTimeout(() => {
11650
+ var _a;
11560
11651
  this.theEditorCreated.emit(this.editor);
11652
+ (_a = this.placeholderInstance) === null || _a === void 0 ? void 0 : _a.checkStatus();
11561
11653
  this.applyAutoFocus();
11562
11654
  });
11563
11655
  }
@@ -11573,9 +11665,9 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
11573
11665
  }
11574
11666
  }
11575
11667
  applyAutoFocus() {
11576
- var _a, _b, _c, _d;
11577
- if (((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.autoFocus) && !((_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.readonly) && !((_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.disabled)) {
11578
- autoFocus(this.editor, (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.autoFocus);
11668
+ var _a, _b, _c;
11669
+ if (!((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled) && !((_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.readonly)) {
11670
+ autoFocus(this.editor, (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.autoFocus);
11579
11671
  }
11580
11672
  }
11581
11673
  toolbarCalculate() {
@@ -11583,10 +11675,12 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
11583
11675
  const toolbar = (_a = this === null || this === void 0 ? void 0 : this.theOptions) === null || _a === void 0 ? void 0 : _a.toolbar;
11584
11676
  const toolbarItems = toolbarCompose(toolbar === null || toolbar === void 0 ? void 0 : toolbar.toolbarItems);
11585
11677
  const 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);
11678
+ this.globalToolbarClass = ['the-global-toolbar', getToolbarClass(this.editor)];
11586
11679
  this.toolbarEntity = toolbarOption.toolbarEntity;
11587
11680
  if (this.theGlobalToolbar) {
11588
11681
  this.theGlobalToolbarInstance.editor = this.editor;
11589
11682
  this.theGlobalToolbarInstance.toolbarItems = toolbarOption.toolbarEntity.global;
11683
+ this.theGlobalToolbarInstance.containerClass = this.globalToolbarClass;
11590
11684
  this.theGlobalToolbarInstance.align = toolbar === null || toolbar === void 0 ? void 0 : toolbar.align;
11591
11685
  this.theGlobalToolbarInstance.setToolbarClass();
11592
11686
  this.theGlobalToolbarInstance.renderToolbarView();
@@ -11605,14 +11699,14 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
11605
11699
  this.onTouchedCallback = fn;
11606
11700
  }
11607
11701
  valueChange(value) {
11608
- var _a, _b, _c, _d;
11702
+ var _a, _b, _c, _d, _e, _f;
11609
11703
  (_a = this.theGlobalToolbarInstance) === null || _a === void 0 ? void 0 : _a.statusChange(this.editor);
11610
- this.quickInsertInstance.checkStatus();
11611
- this.placeholderInstance.checkStatus();
11704
+ (_b = this.quickInsertInstance) === null || _b === void 0 ? void 0 : _b.checkStatus();
11705
+ (_c = this.placeholderInstance) === null || _c === void 0 ? void 0 : _c.checkStatus();
11612
11706
  // auto scroll view
11613
- const scrollContainer = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.scrollContainer;
11614
- const maxHeight = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.maxHeight;
11615
- if (!((_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.readonly) && (scrollContainer || maxHeight)) {
11707
+ const scrollContainer = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.scrollContainer;
11708
+ const maxHeight = (_e = this.theOptions) === null || _e === void 0 ? void 0 : _e.maxHeight;
11709
+ if (!((_f = this.theOptions) === null || _f === void 0 ? void 0 : _f.readonly) && (scrollContainer || maxHeight)) {
11616
11710
  const container = maxHeight ? DEFAULT_SCROLL_CONTAINER : scrollContainer;
11617
11711
  this.autoScrollView(this.editor, container);
11618
11712
  }
@@ -11737,7 +11831,7 @@ TheEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
11737
11831
  useExisting: forwardRef(() => TheEditorComponent),
11738
11832
  multi: true
11739
11833
  }
11740
- ], 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, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n class=\"the-global-toolbar\"\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.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", "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"] }] });
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"] }] });
11741
11835
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheEditorComponent, decorators: [{
11742
11836
  type: Component,
11743
11837
  args: [{
@@ -11782,7 +11876,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11782
11876
  args: ['globalToolbar']
11783
11877
  }], quickInsertInstance: [{
11784
11878
  type: ViewChild,
11785
- args: ['quickInsert']
11879
+ args: ['quickInsert', { static: true }]
11786
11880
  }], placeholderInstance: [{
11787
11881
  type: ViewChild,
11788
11882
  args: ['placeholder']
@@ -11901,7 +11995,7 @@ class TheToolbarGroupComponent {
11901
11995
  }
11902
11996
  }
11903
11997
  TheToolbarGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarGroupComponent, deps: [{ token: i0.ElementRef }, { token: i1$3.ThyPopover }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
11904
- TheToolbarGroupComponent.ɵcmp = i0.ɵɵ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: TemplateRef, static: true }], ngImport: i0, template: "<a thyIconNavLink [thyIconNavLinkIcon]=\"item.icon\" [thyTooltip]=\"item?.name\" thyTooltipPlacement=\"top\" [thyIconNavLinkActive]=\"active\"></a>\n\n<ng-template #groupTemplate>\n <the-toolbar class=\"group\" [editor]=\"editor\" [toolbarItems]=\"menus\" [isMore]=\"false\"></the-toolbar>\n</ng-template>\n", components: [{ type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "isMore", "afterTemplate"] }], directives: [{ type: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
11998
+ TheToolbarGroupComponent.ɵcmp = i0.ɵɵ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: TemplateRef, static: true }], ngImport: i0, template: "<a thyIconNavLink [thyIconNavLinkIcon]=\"item.icon\" [thyTooltip]=\"item?.name\" thyTooltipPlacement=\"top\" [thyIconNavLinkActive]=\"active\"></a>\n\n<ng-template #groupTemplate>\n <the-toolbar class=\"group\" [editor]=\"editor\" [toolbarItems]=\"menus\" [isMore]=\"false\"></the-toolbar>\n</ng-template>\n", components: [{ type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }], directives: [{ type: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
11905
11999
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarGroupComponent, decorators: [{
11906
12000
  type: Component,
11907
12001
  args: [{
@@ -12068,5 +12162,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
12068
12162
  * Generated bundle index. Do not edit.
12069
12163
  */
12070
12164
 
12071
- export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BLOCK_INSERT_ORIGIN, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, HEADING_TYPES, HeadingEditor, HrEditor, ImageEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, QUICK_TOOLBAR_HOTKEY, QuickInsertEditor, STANDARD_HEADING_TYPES, TAB_SPACE, THE_CODE_MODE_PROVIDER, THE_CODE_MODE_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_QUICK_TOOLBAR_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheCodeMode, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheMode, index$1 as TheQueries, TheToolbarBaseItemComponent, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemMode, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, createEmptyParagraph, dataDeserialize, dataSerializing, getToolbarClass, htmlToTheia, inValidTypes, plainToTheia, toolbarCompose, withTheEditor };
12165
+ export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, HEADING_TYPES, HeadingEditor, HrEditor, IS_MAC, ImageEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, QUICK_TOOLBAR_HOTKEY, QuickInsertEditor, STANDARD_HEADING_TYPES, TAB_SPACE, THE_CODE_MODE_PROVIDER, THE_CODE_MODE_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_QUICK_TOOLBAR_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheCodeMode, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheMode, index$1 as TheQueries, TheToolbarBaseItemComponent, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemMode, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, createEmptyParagraph, dataDeserialize, dataSerializing, getToolbarClass, htmlToTheia, inValidTypes, plainToTheia, toolbarCompose, withTheEditor };
12072
12166
  //# sourceMappingURL=worktile-theia.js.map