@worktile/theia 1.2.6 → 1.2.10

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 (186) hide show
  1. package/bundles/worktile-theia.umd.js +1151 -478
  2. package/bundles/worktile-theia.umd.js.map +1 -1
  3. package/components/inline-toolbar/inline-toolbar.component.d.ts +24 -0
  4. package/components/inline-toolbar/inline-toolbar.component.scss +18 -0
  5. package/components/nav-split-line/nav-split-line.component.d.ts +6 -1
  6. package/components/toolbar-dropdown/toolbar-dropdown.component.scss +3 -0
  7. package/components/toolbar-item/toolbar-item.component.d.ts +14 -5
  8. package/constants/code.d.ts +7 -7
  9. package/constants/default.d.ts +1 -1
  10. package/constants/node-types.d.ts +8 -8
  11. package/constants/toolbar.d.ts +6 -2
  12. package/custom-types.d.ts +5 -1
  13. package/editor.component.d.ts +6 -4
  14. package/editor.module.d.ts +59 -52
  15. package/esm2015/components/color-select/color-select.component.js +3 -2
  16. package/esm2015/components/conversion-hint/conversion-hint.component.js +2 -2
  17. package/esm2015/components/inline-toolbar/inline-toolbar.component.js +123 -0
  18. package/esm2015/components/nav-split-line/nav-split-line.component.js +26 -5
  19. package/esm2015/components/toolbar/toolbar.component.js +7 -9
  20. package/esm2015/components/toolbar-base-item/toolbar-base-item.component.js +4 -3
  21. package/esm2015/components/toolbar-dropdown/toolbar-dropdown.component.js +1 -1
  22. package/esm2015/components/toolbar-item/toolbar-item.component.js +70 -24
  23. package/esm2015/constants/auto-format-rules.js +2 -2
  24. package/esm2015/constants/code.js +7 -7
  25. package/esm2015/constants/default.js +2 -2
  26. package/esm2015/constants/node-types.js +1 -2
  27. package/esm2015/constants/toolbar.js +38 -5
  28. package/esm2015/custom-types.js +1 -1
  29. package/esm2015/editor.component.js +26 -21
  30. package/esm2015/editor.module.js +20 -8
  31. package/esm2015/interfaces/editor.js +2 -4
  32. package/esm2015/interfaces/toolbar.js +1 -1
  33. package/esm2015/interfaces/valid-children-types.js +8 -2
  34. package/esm2015/plugins/align/align.editor.js +5 -2
  35. package/esm2015/plugins/align/align.plugin.js +2 -2
  36. package/esm2015/plugins/autoformat/autoformat.plugin.js +2 -2
  37. package/esm2015/plugins/autoformat/transforms/auto-format-inline.js +2 -2
  38. package/esm2015/plugins/blockquote/blockquote.editor.js +2 -2
  39. package/esm2015/plugins/blockquote/blockquote.plugin.js +11 -29
  40. package/esm2015/plugins/blockquote/options.js +2 -2
  41. package/esm2015/plugins/code/code.component.js +14 -9
  42. package/esm2015/plugins/code/code.editor.js +2 -2
  43. package/esm2015/plugins/code/options.js +2 -2
  44. package/esm2015/plugins/color/color.editor.js +4 -1
  45. package/esm2015/plugins/common/auto-insert-data..js +4 -5
  46. package/esm2015/plugins/common/block-card.plugin.js +8 -4
  47. package/esm2015/plugins/common/get-fragment.plugin.js +5 -5
  48. package/esm2015/plugins/common/move-selection.plugin.js +2 -2
  49. package/esm2015/plugins/common/remove-empty.plugin.js +2 -2
  50. package/esm2015/plugins/common/remove-void.plugin.js +2 -2
  51. package/esm2015/plugins/common/reset-type.plugin.js +2 -2
  52. package/esm2015/plugins/deserializers/deserialize-html.plugin.js +9 -2
  53. package/esm2015/plugins/deserializers/deserialize-md.plugin.js +2 -2
  54. package/esm2015/plugins/heading/heading.plugin.js +2 -2
  55. package/esm2015/plugins/heading/options.js +2 -2
  56. package/esm2015/plugins/hr/hr.editor.js +2 -2
  57. package/esm2015/plugins/hr/options.js +2 -2
  58. package/esm2015/plugins/image/image.component.js +10 -10
  59. package/esm2015/plugins/image/image.editor.js +10 -4
  60. package/esm2015/plugins/image/image.plugin.js +1 -2
  61. package/esm2015/plugins/indent/indent.plugin.js +1 -1
  62. package/esm2015/plugins/indent/on-keydown-indent.js +1 -1
  63. package/esm2015/plugins/index.js +9 -5
  64. package/esm2015/plugins/link/edit/link-edit.component.js +3 -2
  65. package/esm2015/plugins/link/link.plugin.js +7 -2
  66. package/esm2015/plugins/list/list.editor.js +3 -3
  67. package/esm2015/plugins/list/list.plugin.js +11 -11
  68. package/esm2015/plugins/list/normalizers/normalize-no.js +3 -3
  69. package/esm2015/plugins/list/on-key-down-list.js +2 -2
  70. package/esm2015/plugins/list/queries/get-list-item-entry.js +2 -2
  71. package/esm2015/plugins/list/queries/get-start-list-item.js +9 -2
  72. package/esm2015/plugins/list/queries/is-in-list.js +2 -2
  73. package/esm2015/plugins/list/queries/is-node-type-list.js +1 -1
  74. package/esm2015/plugins/list/queries/is-selection-at-list-item-start.js +2 -2
  75. package/esm2015/plugins/list/queries/is-selection-in-same-list-item.js +17 -0
  76. package/esm2015/plugins/list/transforms/insert-list-data.js +2 -2
  77. package/esm2015/plugins/list/transforms/insert-list-item.js +2 -2
  78. package/esm2015/plugins/list/transforms/move-list-item-sublist-items-to-list-item-sublist.js +2 -2
  79. package/esm2015/plugins/list/transforms/move-list-item-sublist-items-to-list.js +2 -2
  80. package/esm2015/plugins/list/transforms/move-list-item-up.js +2 -2
  81. package/esm2015/plugins/list/transforms/unwrap-list.js +2 -2
  82. package/esm2015/plugins/mark/mark.editor.js +6 -2
  83. package/esm2015/plugins/node-id/node-id.plugin.js +9 -4
  84. package/esm2015/plugins/normalizers/insert-paragraph-nodes.js +2 -2
  85. package/esm2015/plugins/normalizers/trailing-node.plugin.js +2 -2
  86. package/esm2015/plugins/paint-format/options.js +54 -0
  87. package/esm2015/plugins/paint-format/paint-format.editor.js +67 -0
  88. package/esm2015/plugins/placeholder/placeholder.component.js +75 -0
  89. package/esm2015/plugins/public-api.js +2 -1
  90. package/esm2015/plugins/quick-insert/components/quick-insert.component.js +76 -0
  91. package/esm2015/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.js +75 -0
  92. package/esm2015/plugins/quick-insert/quick-insert.editor.js +61 -0
  93. package/esm2015/plugins/quick-insert/quick-insert.plugint.js +37 -0
  94. package/esm2015/plugins/table/components/row/row.component.js +3 -1
  95. package/esm2015/plugins/table/components/table.component.js +11 -7
  96. package/esm2015/plugins/table/components/td/td.component.js +2 -1
  97. package/esm2015/plugins/table/components/toolbar/table-toolbar.component.js +5 -4
  98. package/esm2015/plugins/table/table.editor.js +3 -3
  99. package/esm2015/plugins/table/table.plugin.js +8 -7
  100. package/esm2015/plugins/table/toolbar-item.component.js +3 -3
  101. package/esm2015/plugins/table/transforms/insert-table.js +3 -3
  102. package/esm2015/plugins/table/utils/calc-anchor-position.js +6 -5
  103. package/esm2015/plugins/table/utils/merge-cell.js +3 -3
  104. package/esm2015/plugins/table/utils/split-cell.js +3 -3
  105. package/esm2015/plugins/todo-item/todo-item.component.js +2 -2
  106. package/esm2015/plugins/todo-item/todo-item.editor.js +2 -2
  107. package/esm2015/plugins/todo-item/todo-item.plugin.js +2 -2
  108. package/esm2015/plugins/vertical-align/toolbar-item.component.js +12 -4
  109. package/esm2015/public-api.js +4 -3
  110. package/esm2015/queries/get-container-blocks.js +3 -3
  111. package/esm2015/queries/get-selection-nodes-by-type.js +1 -1
  112. package/esm2015/queries/index.js +2 -58
  113. package/esm2015/queries/is-block-active.js +1 -1
  114. package/esm2015/queries/is-include-types.js +1 -1
  115. package/esm2015/services/context.service.js +9 -2
  116. package/esm2015/services/toolbar.service.js +5 -5
  117. package/esm2015/transforms/apply-deep-to-nodes.js +2 -2
  118. package/esm2015/transforms/delete-element.js +2 -2
  119. package/esm2015/transforms/handle-continual-delete-backward.js +18 -0
  120. package/esm2015/transforms/handle-continual-insert-break.js +23 -0
  121. package/esm2015/transforms/index.js +4 -20
  122. package/esm2015/transforms/insert-element-next.js +2 -2
  123. package/esm2015/transforms/insert-elements.js +2 -2
  124. package/esm2015/transforms/move-children.js +2 -2
  125. package/esm2015/transforms/on-keydown-reset-block-type.js +2 -2
  126. package/esm2015/transforms/set-node.js +2 -2
  127. package/esm2015/transforms/split-node.js +2 -2
  128. package/esm2015/transforms/un-wrap.js +1 -1
  129. package/esm2015/utils/auto-focus.js +2 -2
  130. package/esm2015/utils/fragment.js +3 -3
  131. package/esm2015/utils/is-clean-empty-paragraph.js +32 -0
  132. package/esm2015/utils/weak-maps.js +2 -1
  133. package/fesm2015/worktile-theia.js +1195 -534
  134. package/fesm2015/worktile-theia.js.map +1 -1
  135. package/interfaces/editor.d.ts +1 -96
  136. package/interfaces/toolbar.d.ts +3 -2
  137. package/interfaces/valid-children-types.d.ts +4 -4
  138. package/package.json +1 -1
  139. package/plugins/code/code.component.d.ts +3 -2
  140. package/plugins/color/color.editor.d.ts +1 -1
  141. package/plugins/common/get-fragment.plugin.d.ts +2 -2
  142. package/plugins/image/image.component.d.ts +1 -0
  143. package/plugins/image/image.component.scss +11 -1
  144. package/plugins/indent/indent.plugin.d.ts +2 -2
  145. package/plugins/indent/on-keydown-indent.d.ts +2 -2
  146. package/plugins/list/queries/get-start-list-item.d.ts +8 -2
  147. package/plugins/list/queries/is-selection-in-same-list-item.d.ts +5 -0
  148. package/plugins/mark/mark.editor.d.ts +1 -1
  149. package/plugins/normalizers/insert-paragraph-nodes.d.ts +2 -2
  150. package/plugins/normalizers/trailing-node.plugin.d.ts +2 -2
  151. package/plugins/paint-format/options.d.ts +2 -0
  152. package/plugins/paint-format/paint-format.editor.d.ts +7 -0
  153. package/{components → plugins}/placeholder/placeholder.component.d.ts +5 -6
  154. package/{components → plugins}/placeholder/placeholder.component.scss +0 -0
  155. package/plugins/public-api.d.ts +1 -0
  156. package/plugins/quick-insert/components/quick-insert.component.d.ts +25 -0
  157. package/plugins/quick-insert/components/quick-insert.component.scss +21 -0
  158. package/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.d.ts +29 -0
  159. package/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.scss +21 -0
  160. package/plugins/quick-insert/quick-insert.editor.d.ts +8 -0
  161. package/plugins/quick-insert/quick-insert.plugint.d.ts +2 -0
  162. package/plugins/table/components/table.component.d.ts +1 -0
  163. package/plugins/table/components/table.component.scss +1 -1
  164. package/plugins/table/toolbar-item.component.d.ts +1 -2
  165. package/plugins/table/utils/split-cell.d.ts +1 -2
  166. package/plugins/todo-item/todo-item.component.scss +0 -6
  167. package/plugins/vertical-align/toolbar-item.component.d.ts +1 -0
  168. package/public-api.d.ts +3 -2
  169. package/queries/get-container-blocks.d.ts +2 -2
  170. package/queries/get-selection-nodes-by-type.d.ts +2 -2
  171. package/queries/index.d.ts +55 -73
  172. package/queries/is-block-active.d.ts +2 -2
  173. package/queries/is-include-types.d.ts +2 -2
  174. package/services/context.service.d.ts +9 -0
  175. package/services/toolbar.service.d.ts +1 -1
  176. package/styles/editor.scss +41 -15
  177. package/styles/index.scss +5 -2
  178. package/styles/typo.scss +4 -2
  179. package/transforms/handle-continual-delete-backward.d.ts +3 -0
  180. package/transforms/handle-continual-insert-break.d.ts +3 -0
  181. package/transforms/index.d.ts +20 -27
  182. package/transforms/split-node.d.ts +2 -2
  183. package/transforms/un-wrap.d.ts +2 -2
  184. package/utils/is-clean-empty-paragraph.d.ts +8 -0
  185. package/utils/weak-maps.d.ts +1 -0
  186. package/esm2015/components/placeholder/placeholder.component.js +0 -88
@@ -5,7 +5,7 @@ import { DOCUMENT, CommonModule } from '@angular/common';
5
5
  import * as i4$2 from '@angular/forms';
6
6
  import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
7
7
  import * as i1 from 'slate-angular';
8
- import { BaseTextComponent, BaseElementComponent, NODE_TO_PARENT, NODE_TO_INDEX, AngularEditor, IS_SAFARI, hotkeys, getPlainText as getPlainText$1, hasBlockCard, isCardLeft, ELEMENT_TO_COMPONENT, withAngular, SlateModule } from 'slate-angular';
8
+ import { BaseTextComponent, BaseElementComponent, AngularEditor, NODE_TO_PARENT, 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
11
  import { Element as Element$1, Editor, Range, Node, Span, Path, Text, Point, Transforms, createEditor } from 'slate';
@@ -32,31 +32,32 @@ import * as i5 from 'ngx-tethys/input';
32
32
  import { ThyInputModule } from 'ngx-tethys/input';
33
33
  import * as i2 from 'ngx-tethys/nav';
34
34
  import { ThyNavModule } from 'ngx-tethys/nav';
35
- import * as i5$1 from 'ngx-tethys/tooltip';
35
+ import * as i7 from 'ngx-tethys/tooltip';
36
36
  import { ThyTooltipModule } from 'ngx-tethys/tooltip';
37
- import * as i5$3 from 'ng-codemirror';
37
+ import * as i5$2 from 'ng-codemirror';
38
38
  import { CodeMirrorComponent, CodemirrorModule } from 'ng-codemirror';
39
39
  import * as i1$4 from 'ngx-tethys/notify';
40
40
  import { ThyNotifyModule } from 'ngx-tethys/notify';
41
- import * as i5$2 from 'ngx-tethys/action-menu';
41
+ import * as i5$1 from 'ngx-tethys/action-menu';
42
42
  import { ThyActionMenuModule } from 'ngx-tethys/action-menu';
43
43
  import isUrl from 'is-url';
44
44
  import * as i1$5 from 'ngx-tethys/button';
45
45
  import { ThyButtonModule } from 'ngx-tethys/button';
46
46
  import * as i2$2 from 'ngx-tethys/form';
47
47
  import { ThyFormModule } from 'ngx-tethys/form';
48
- import * as i5$4 from 'ngx-tethys/shared';
48
+ import * as i5$3 from 'ngx-tethys/shared';
49
49
  import { ThySharedModule } from 'ngx-tethys/shared';
50
50
  import * as i1$6 from 'ngx-tethys';
51
51
  import { coerceCssPixelValue } from '@angular/cdk/coercion';
52
52
  import { PortalInjector, ComponentPortal } from '@angular/cdk/portal';
53
+ import * as i2$3 from 'ngx-tethys/list';
54
+ import { ThyListModule } from 'ngx-tethys/list';
53
55
  import { ThyAutocompleteModule } from 'ngx-tethys/autocomplete';
54
56
  import { ThyAvatarModule } from 'ngx-tethys/avatar';
55
- import { ThyListModule } from 'ngx-tethys/list';
56
57
  import { ThySelectModule } from 'ngx-tethys/select';
57
58
 
58
59
  const PICTURE_ACCEPTED_UPLOAD_MIME = ['image/png', 'image/jpeg', 'image/gif', 'image/bmp'];
59
- const PICTURE_ACCEPTED_UPLOAD_SIZE = 10;
60
+ const PICTURE_ACCEPTED_UPLOAD_SIZE = 20;
60
61
  const A_TAG_REL_ATTR = 'noopener noreferrer nofollow external ugc';
61
62
  const LINK_DEFAULT_TEXT = '链接';
62
63
  const TAB_SPACE = ' ';
@@ -121,7 +122,6 @@ var MarkTypes;
121
122
  var ToolbarActionTypes;
122
123
  (function (ToolbarActionTypes) {
123
124
  ToolbarActionTypes["split"] = "split";
124
- ToolbarActionTypes["save"] = "save";
125
125
  ToolbarActionTypes["undo"] = "undo";
126
126
  ToolbarActionTypes["redo"] = "redo";
127
127
  ToolbarActionTypes["paintformat"] = "paintformat";
@@ -163,12 +163,17 @@ const VOID_BLOCK_TYPES = [ElementKinds.image, ElementKinds.hr];
163
163
  const BLOCK_DELETEBACKWARD_TYPES = [ElementKinds.tableCell];
164
164
 
165
165
  const TheToolbarGroupToken = new InjectionToken('the-toolbar-group-token');
166
- const BLOCK_TOOLBAR_HOTKEY = '/';
166
+ const QUICK_TOOLBAR_HOTKEY = '/';
167
167
  var DropdownMode;
168
168
  (function (DropdownMode) {
169
169
  DropdownMode["icon"] = "icon-mode";
170
170
  DropdownMode["text"] = "text-mode";
171
171
  })(DropdownMode || (DropdownMode = {}));
172
+ var ToolbarItemMode;
173
+ (function (ToolbarItemMode) {
174
+ ToolbarItemMode[ToolbarItemMode["horizontal"] = 0] = "horizontal";
175
+ ToolbarItemMode[ToolbarItemMode["vertical"] = 1] = "vertical";
176
+ })(ToolbarItemMode || (ToolbarItemMode = {}));
172
177
  const DefaultGlobalToolbarDefinition = [
173
178
  ElementKinds.headingList,
174
179
  ToolbarActionTypes.split,
@@ -185,15 +190,43 @@ const DefaultGlobalToolbarDefinition = [
185
190
  ToolbarActionTypes.split,
186
191
  ElementKinds.numberedList,
187
192
  ElementKinds.bulletedList,
193
+ ElementKinds.checkItem,
194
+ ToolbarActionTypes.split,
195
+ ElementKinds.link,
196
+ ElementKinds.image,
197
+ ElementKinds.table,
198
+ ElementKinds.blockquote,
199
+ ElementKinds.code
200
+ ];
201
+ const DefaultInlineToolbarDefinition = [
202
+ ToolbarActionTypes.clean,
203
+ ToolbarActionTypes.split,
204
+ MarkTypes.bold,
205
+ MarkTypes.italic,
206
+ MarkTypes.underline,
207
+ MarkTypes.strike,
208
+ MarkTypes.codeLine,
209
+ MarkTypes.color,
210
+ MarkTypes.backgroundColor,
211
+ ToolbarActionTypes.split,
212
+ ToolbarActionTypes.alignType,
213
+ ToolbarActionTypes.split,
214
+ ElementKinds.link
215
+ ];
216
+ const DefaultQuickToolbarDefinition = [
217
+ ...STANDARD_HEADING_TYPES,
218
+ ToolbarActionTypes.split,
219
+ ElementKinds.numberedList,
220
+ ElementKinds.bulletedList,
221
+ ElementKinds.checkItem,
188
222
  ToolbarActionTypes.split,
189
223
  ElementKinds.link,
190
224
  ElementKinds.image,
191
225
  ElementKinds.table,
192
226
  ElementKinds.blockquote,
227
+ ElementKinds.hr,
193
228
  ElementKinds.code
194
229
  ];
195
- const DefaultInlineToolbarDefinition = [];
196
- const DefaultBlockToolbarDefinition = [ElementKinds.image];
197
230
  const ToolbarMoreGroup = {
198
231
  key: 'more',
199
232
  icon: 'more'
@@ -273,17 +306,17 @@ const CODE_MODES = [
273
306
  value: 'htmlmixed'
274
307
  }
275
308
  ];
276
- const EditorMode = {
309
+ const CodeMode = {
277
310
  default: 'default',
278
311
  print: 'print'
279
312
  };
280
- class TheEditorConfig {
313
+ class TheCodeMode {
281
314
  }
282
- const THE_EDITOR_CONFIG_TOKEN = new InjectionToken('the-editor-config');
283
- const THE_EDITOR_CONFIG_PROVIDER = {
284
- provide: THE_EDITOR_CONFIG_TOKEN,
315
+ const THE_CODE_MODE_TOKEN = new InjectionToken('the-code-mode');
316
+ const THE_CODE_MODE_PROVIDER = {
317
+ provide: THE_CODE_MODE_TOKEN,
285
318
  useValue: {
286
- mode: EditorMode.default
319
+ mode: CodeMode.default
287
320
  }
288
321
  };
289
322
  const CODEMIRROR_PADDING_TOP = 10;
@@ -370,6 +403,72 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
370
403
  }]
371
404
  }] });
372
405
 
406
+ const TheEditor = Object.assign({}, AngularEditor);
407
+ var TheDataMode;
408
+ (function (TheDataMode) {
409
+ TheDataMode["json"] = "json";
410
+ TheDataMode["html"] = "html";
411
+ })(TheDataMode || (TheDataMode = {}));
412
+
413
+ var ToolbarItemType;
414
+ (function (ToolbarItemType) {
415
+ ToolbarItemType["default"] = "default";
416
+ ToolbarItemType["toolDropdown"] = "tool-dropdown";
417
+ })(ToolbarItemType || (ToolbarItemType = {}));
418
+ var ToolbarAlignment;
419
+ (function (ToolbarAlignment) {
420
+ ToolbarAlignment["left"] = "start";
421
+ ToolbarAlignment["center"] = "center";
422
+ ToolbarAlignment["right"] = "end";
423
+ })(ToolbarAlignment || (ToolbarAlignment = {}));
424
+
425
+ const THE_UPLOAD_SERVICE_TOKEN = new InjectionToken('THE_UPLOAD_SERVICE_TOKEN');
426
+
427
+ const inValidTypes = [
428
+ ElementKinds.table,
429
+ ElementKinds.tableCell,
430
+ ElementKinds.blockquote,
431
+ ElementKinds.hr,
432
+ ElementKinds.code
433
+ ];
434
+ const DefaultElementOptions = [
435
+ {
436
+ type: ElementKinds.bulletedList,
437
+ inValidChildrenTypes: [...inValidTypes, ...HEADING_TYPES]
438
+ },
439
+ {
440
+ type: ElementKinds.numberedList,
441
+ inValidChildrenTypes: [...inValidTypes, ...HEADING_TYPES]
442
+ },
443
+ {
444
+ type: ElementKinds.listItem,
445
+ inValidChildrenTypes: [...inValidTypes, ...HEADING_TYPES]
446
+ },
447
+ {
448
+ type: ElementKinds.blockquote,
449
+ inValidChildrenTypes: inValidTypes
450
+ },
451
+ {
452
+ type: ElementKinds.table,
453
+ inValidChildrenTypes: [ElementKinds.table]
454
+ },
455
+ {
456
+ type: ElementKinds.tableCell,
457
+ inValidChildrenTypes: [ElementKinds.table, ElementKinds.tableCell]
458
+ }
459
+ ];
460
+
461
+ function idCreator(length = 5) {
462
+ // remove numeral
463
+ const $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz'; /****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
464
+ const maxPosition = $chars.length;
465
+ let key = '';
466
+ for (let i = 0; i < length; i++) {
467
+ key += $chars.charAt(Math.floor(Math.random() * maxPosition));
468
+ }
469
+ return key;
470
+ }
471
+
373
472
  const isAncestor = (node) => Element$1.isElement(node) || Editor.isEditor(node);
374
473
 
375
474
  const getLastChild$1 = (node, level) => {
@@ -937,7 +1036,7 @@ const getEndBlock = (editor, fragment) => {
937
1036
  }
938
1037
  return fragment;
939
1038
  };
940
- const extractFragment = (data, deleteKey) => {
1039
+ const extractFragment = (data, deleteKey = ELEMENT_UNIQUE_ID) => {
941
1040
  const fragment = data.getData(`application/${CLIPBOARD_FORMAT_KEY}`);
942
1041
  if (fragment) {
943
1042
  const decoded = decodeURIComponent(window.atob(fragment));
@@ -1078,69 +1177,70 @@ const isContainer = (editor, value) => Element$1.isElement(value) && editor.isCo
1078
1177
  const getContainerBlocks = (editor) => {
1079
1178
  const containerNode = Editor.above(editor, {
1080
1179
  match: (node) => {
1081
- return Element$1.isElement(node) && TheEditor.isContainer(editor, node) && !CONTAINER_BLOCKS.includes(node.type);
1180
+ return Element$1.isElement(node) && isContainer(editor, node) && !CONTAINER_BLOCKS.includes(node.type);
1082
1181
  }
1083
1182
  });
1084
1183
  return !containerNode ? CONTAINER_BLOCKS : [...CONTAINER_BLOCKS, containerNode[0].type];
1085
1184
  };
1086
1185
 
1087
- const TheQueries = {
1088
- getLastNode,
1089
- getAnchorBlockEntry,
1090
- getAboveByType,
1091
- getNodes,
1092
- getNodesByType,
1093
- getBlockAbove,
1094
- getPreviousPath,
1095
- getNode,
1096
- getParent,
1097
- getLastChild,
1098
- getLastChildPath,
1099
- getNextSiblingNodes,
1100
- getAbove,
1101
- getChildren,
1102
- getPointBefore,
1103
- getSelectionNodesByType,
1104
- getText,
1105
- getPointFromLocation,
1106
- getRangeFromBlockStart,
1107
- getRangeBefore,
1108
- getBlockCardCenterCursor,
1109
- getBlockCardAbove,
1110
- getPlainText,
1111
- getSelectionMarks,
1112
- getContainerBlocks,
1113
- isAncestor,
1114
- isCollapsed,
1115
- isEmptyParagraph,
1116
- isParagraph,
1117
- isBlockActive,
1118
- isIncludeTypes,
1119
- isAncestorEmpty,
1120
- isBlockAboveEmpty,
1121
- isNodeTypeIn,
1122
- isFirstChild,
1123
- isPointAtRoot,
1124
- isRangeAtRoot,
1125
- isBlockTextEmptyAfterSelection,
1126
- isStart,
1127
- isRangeAcrossBlocks,
1128
- isDescendant,
1129
- isNodeType,
1130
- isAcrossBlocks,
1131
- isBlockCardCursor,
1132
- isEmptyContent,
1133
- isEmptyParagraphByPath,
1134
- isContainer,
1135
- anchorBlock,
1136
- anchorBlockEntry,
1137
- anchorInlineEntry,
1138
- anchorInline,
1139
- findPath,
1140
- findNode,
1141
- findDescendant,
1142
- someNode
1143
- };
1186
+ var index$1 = /*#__PURE__*/Object.freeze({
1187
+ __proto__: null,
1188
+ getLastNode: getLastNode,
1189
+ getAnchorBlockEntry: getAnchorBlockEntry,
1190
+ getAboveByType: getAboveByType,
1191
+ getNodes: getNodes,
1192
+ getNodesByType: getNodesByType,
1193
+ getBlockAbove: getBlockAbove,
1194
+ getPreviousPath: getPreviousPath,
1195
+ getNode: getNode,
1196
+ getParent: getParent,
1197
+ getLastChild: getLastChild,
1198
+ getLastChildPath: getLastChildPath,
1199
+ getNextSiblingNodes: getNextSiblingNodes,
1200
+ getAbove: getAbove,
1201
+ getChildren: getChildren,
1202
+ getPointBefore: getPointBefore,
1203
+ getSelectionNodesByType: getSelectionNodesByType,
1204
+ getText: getText,
1205
+ getPointFromLocation: getPointFromLocation,
1206
+ getRangeFromBlockStart: getRangeFromBlockStart,
1207
+ getRangeBefore: getRangeBefore,
1208
+ getBlockCardCenterCursor: getBlockCardCenterCursor,
1209
+ getBlockCardAbove: getBlockCardAbove,
1210
+ getPlainText: getPlainText,
1211
+ getSelectionMarks: getSelectionMarks,
1212
+ getContainerBlocks: getContainerBlocks,
1213
+ isAncestor: isAncestor,
1214
+ isCollapsed: isCollapsed,
1215
+ isEmptyParagraph: isEmptyParagraph,
1216
+ isParagraph: isParagraph,
1217
+ isBlockActive: isBlockActive,
1218
+ isIncludeTypes: isIncludeTypes,
1219
+ isAncestorEmpty: isAncestorEmpty,
1220
+ isBlockAboveEmpty: isBlockAboveEmpty,
1221
+ isNodeTypeIn: isNodeTypeIn,
1222
+ isFirstChild: isFirstChild,
1223
+ isPointAtRoot: isPointAtRoot,
1224
+ isRangeAtRoot: isRangeAtRoot,
1225
+ isBlockTextEmptyAfterSelection: isBlockTextEmptyAfterSelection,
1226
+ isStart: isStart,
1227
+ isRangeAcrossBlocks: isRangeAcrossBlocks,
1228
+ isDescendant: isDescendant,
1229
+ isNodeType: isNodeType,
1230
+ isAcrossBlocks: isAcrossBlocks,
1231
+ isBlockCardCursor: isBlockCardCursor,
1232
+ isEmptyContent: isEmptyContent,
1233
+ isEmptyParagraphByPath: isEmptyParagraphByPath,
1234
+ isContainer: isContainer,
1235
+ anchorBlock: anchorBlock,
1236
+ anchorBlockEntry: anchorBlockEntry,
1237
+ anchorInlineEntry: anchorInlineEntry,
1238
+ anchorInline: anchorInline,
1239
+ findPath: findPath,
1240
+ findNode: findNode,
1241
+ findDescendant: findDescendant,
1242
+ someNode: someNode
1243
+ });
1144
1244
 
1145
1245
  const setMarks = (editor, marks, at) => {
1146
1246
  Transforms.setNodes(editor, marks, {
@@ -1176,8 +1276,8 @@ const insertElementNext = (editor, node) => {
1176
1276
  if (Range.isExpanded(editor.selection)) {
1177
1277
  Editor.deleteFragment(editor);
1178
1278
  }
1179
- const anchorBlockPath = TheQueries.anchorBlockEntry(editor)[1];
1180
- const isEmpty = TheQueries.isEmptyParagraph(editor);
1279
+ const anchorBlockPath = anchorBlockEntry(editor)[1];
1280
+ const isEmpty = isEmptyParagraph(editor);
1181
1281
  const nextPath = Path.next([anchorBlockPath[0]]);
1182
1282
  Transforms.insertNodes(editor, node, { at: nextPath });
1183
1283
  if (isEmpty && anchorBlockPath.length === 1) {
@@ -1190,7 +1290,7 @@ const insertElementNext = (editor, node) => {
1190
1290
  };
1191
1291
 
1192
1292
  const setNode = (editor, props, origin) => {
1193
- Transforms.setNodes(editor, props, { at: TheQueries.findPath(editor, origin) });
1293
+ Transforms.setNodes(editor, props, { at: findPath(editor, origin) });
1194
1294
  };
1195
1295
 
1196
1296
  /**
@@ -1208,7 +1308,7 @@ const onKeyDownResetBlockType = ({ rules }) => (event, editor) => {
1208
1308
  if (editor.selection && isCollapsed(editor.selection)) {
1209
1309
  rules.forEach(({ types, defaultType, hotkey, predicate, onReset }) => {
1210
1310
  if (!event || (hotkey && isHotkey(hotkey, event))) {
1211
- if (predicate(editor) && TheQueries.isNodeTypeIn(editor, types)) {
1311
+ if (predicate(editor) && isNodeTypeIn(editor, types)) {
1212
1312
  if (event !== null) {
1213
1313
  event.preventDefault();
1214
1314
  }
@@ -1233,7 +1333,7 @@ const moveChildren = (editor, { at, to, match, start = 0 }) => {
1233
1333
  return moved;
1234
1334
  for (let i = parentNode.children.length - 1; i >= start; i--) {
1235
1335
  const childPath = [...parentPath, i];
1236
- const childNode = TheQueries.getNode(editor, childPath);
1336
+ const childNode = getNode(editor, childPath);
1237
1337
  if (!match || (childNode && match([childNode, childPath]))) {
1238
1338
  Transforms.moveNodes(editor, { at: childPath, to });
1239
1339
  moved++;
@@ -1242,17 +1342,6 @@ const moveChildren = (editor, { at, to, match, start = 0 }) => {
1242
1342
  return moved;
1243
1343
  };
1244
1344
 
1245
- function idCreator(length = 5) {
1246
- // remove numeral
1247
- const $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz'; /****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
1248
- const maxPosition = $chars.length;
1249
- let key = '';
1250
- for (let i = 0; i < length; i++) {
1251
- key += $chars.charAt(Math.floor(Math.random() * maxPosition));
1252
- }
1253
- return key;
1254
- }
1255
-
1256
1345
  const createEmptyParagraph = () => {
1257
1346
  return {
1258
1347
  type: ElementKinds.paragraph,
@@ -1274,7 +1363,7 @@ const insertParagraph = (editor, at) => {
1274
1363
  */
1275
1364
  const applyDeepToNodes = ({ node, source, apply, query }) => {
1276
1365
  const entry = [node, []];
1277
- if (TheQueries.isNodeType(entry, query)) {
1366
+ if (isNodeType(entry, query)) {
1278
1367
  if (source instanceof Function) {
1279
1368
  apply(node, source());
1280
1369
  }
@@ -1282,7 +1371,7 @@ const applyDeepToNodes = ({ node, source, apply, query }) => {
1282
1371
  apply(node, source);
1283
1372
  }
1284
1373
  }
1285
- if (!TheQueries.isAncestor(node)) {
1374
+ if (!isAncestor(node)) {
1286
1375
  return;
1287
1376
  }
1288
1377
  node.children.forEach((child) => {
@@ -1309,7 +1398,7 @@ const unWrap = (editor, kind) => {
1309
1398
 
1310
1399
  const splitNode = (editor, indivisibleTypes) => {
1311
1400
  const { selection } = editor;
1312
- const indivisibleType = indivisibleTypes && indivisibleTypes.find(item => TheQueries.getAboveByType(editor, item, { mode: 'highest' }));
1401
+ const indivisibleType = indivisibleTypes && indivisibleTypes.find(item => getAboveByType(editor, item, { mode: 'highest' }));
1313
1402
  let splitPath;
1314
1403
  if (!indivisibleType) {
1315
1404
  Transforms.splitNodes(editor, {
@@ -1324,7 +1413,7 @@ const splitNode = (editor, indivisibleTypes) => {
1324
1413
  mode: 'highest',
1325
1414
  match: (data) => {
1326
1415
  if (data.type && !indivisibleTypes.includes(data.type)) {
1327
- const [node] = TheQueries.getNodesByType(editor, data.type, { at: selection });
1416
+ const [node] = getNodesByType(editor, data.type, { at: selection });
1328
1417
  const parentNode = Editor.parent(editor, node[1]);
1329
1418
  if (indivisibleTypes.includes(parentNode[0].type)) {
1330
1419
  splitPath = node[1];
@@ -1338,7 +1427,7 @@ const splitNode = (editor, indivisibleTypes) => {
1338
1427
  };
1339
1428
 
1340
1429
  const deleteElement = (editor, element) => {
1341
- const at = TheQueries.findPath(editor, element);
1430
+ const at = findPath(editor, element);
1342
1431
  Transforms.insertNodes(editor, createEmptyParagraph(), { at });
1343
1432
  AngularEditor.focus(editor);
1344
1433
  Transforms.select(editor, at);
@@ -1356,11 +1445,11 @@ const insertTheElements = (editor, nodes) => {
1356
1445
  if (Range.isExpanded(editor.selection)) {
1357
1446
  Editor.deleteFragment(editor);
1358
1447
  }
1359
- const isEmptyParagraph = TheQueries.isEmptyParagraph(editor, editor.selection.anchor);
1448
+ const isEmptyParagraph$1 = isEmptyParagraph(editor, editor.selection.anchor);
1360
1449
  const parentPath = Path.parent(editor.selection.anchor.path);
1361
1450
  Editor.withoutNormalizing(editor, () => {
1362
1451
  Transforms.insertNodes(editor, nodes);
1363
- if (parentPath.length && isEmptyParagraph) {
1452
+ if (parentPath.length && isEmptyParagraph$1) {
1364
1453
  Transforms.delete(editor, { at: parentPath });
1365
1454
  const lastPath = parentPath.pop();
1366
1455
  Transforms.select(editor, Editor.end(editor, [...parentPath, lastPath + nodes.length - 1]));
@@ -1374,6 +1463,7 @@ const insertTheElements = (editor, nodes) => {
1374
1463
 
1375
1464
  const THE_EDITOR_UUID = new WeakMap();
1376
1465
  const THE_EDITOR_CONVERSION_HINT_REF = new WeakMap();
1466
+ const THE_EDITOR_QUICK_TOOLBAR_REF = new WeakMap();
1377
1467
 
1378
1468
  const closeConversionHint = (editor) => {
1379
1469
  const hintRef = THE_EDITOR_CONVERSION_HINT_REF.get(editor);
@@ -1382,74 +1472,64 @@ const closeConversionHint = (editor) => {
1382
1472
  }
1383
1473
  };
1384
1474
 
1385
- const TheTransforms = {
1386
- setMarks,
1387
- clearMarks,
1388
- insertElement,
1389
- insertElementNext,
1390
- insertParagraph,
1391
- setNode,
1392
- unwrapNodesByType,
1393
- onKeyDownResetBlockType,
1394
- moveChildren,
1395
- applyDeepToNodes,
1396
- mergeDeepToNodes,
1397
- unWrap,
1398
- splitNode,
1399
- deleteElement,
1400
- setEndSelection,
1401
- insertTheElements,
1402
- closeConversionHint
1403
- };
1404
-
1405
- const TheEditor = Object.assign(Object.assign(Object.assign({}, AngularEditor), TheQueries), TheTransforms);
1406
- var TheDataMode;
1407
- (function (TheDataMode) {
1408
- TheDataMode["json"] = "json";
1409
- TheDataMode["html"] = "html";
1410
- })(TheDataMode || (TheDataMode = {}));
1411
-
1412
- var ToolbarItemType;
1413
- (function (ToolbarItemType) {
1414
- ToolbarItemType["default"] = "default";
1415
- ToolbarItemType["toolDropdown"] = "tool-dropdown";
1416
- })(ToolbarItemType || (ToolbarItemType = {}));
1417
- var ToolbarAlignment;
1418
- (function (ToolbarAlignment) {
1419
- ToolbarAlignment["left"] = "start";
1420
- ToolbarAlignment["center"] = "center";
1421
- ToolbarAlignment["right"] = "end";
1422
- })(ToolbarAlignment || (ToolbarAlignment = {}));
1423
-
1424
- const THE_UPLOAD_SERVICE_TOKEN = new InjectionToken('THE_UPLOAD_SERVICE_TOKEN');
1475
+ function handleContinualDeleteBackward(editor, aboveResult, type) {
1476
+ const highestBlock = aboveResult[0];
1477
+ const lowestBlock = anchorBlock(editor);
1478
+ const wrapBlockType = highestBlock.type;
1479
+ if (lowestBlock && Editor.isStart(editor, editor.selection.anchor, aboveResult[1])) {
1480
+ if (wrapBlockType === type) {
1481
+ if (highestBlock.children[0] === lowestBlock) {
1482
+ unWrap(editor, wrapBlockType);
1483
+ return true;
1484
+ }
1485
+ }
1486
+ }
1487
+ return false;
1488
+ }
1425
1489
 
1426
- const inValidTypes = [ElementKinds.table, ElementKinds.tableCell, ElementKinds.blockquote, ElementKinds.hr, ElementKinds.code];
1427
- const DefaultElementOptions = [
1428
- {
1429
- type: ElementKinds.bulletedList,
1430
- inValidChildrenTypes: [...inValidTypes, ...HEADING_TYPES]
1431
- },
1432
- {
1433
- type: ElementKinds.numberedList,
1434
- inValidChildrenTypes: [...inValidTypes, ...HEADING_TYPES]
1435
- },
1436
- {
1437
- type: ElementKinds.listItem,
1438
- inValidChildrenTypes: [...inValidTypes, ...HEADING_TYPES]
1439
- },
1440
- {
1441
- type: ElementKinds.blockquote,
1442
- inValidChildrenTypes: inValidTypes
1443
- },
1444
- {
1445
- type: ElementKinds.table,
1446
- inValidChildrenTypes: [ElementKinds.table]
1447
- },
1448
- {
1449
- type: ElementKinds.tableCell,
1450
- inValidChildrenTypes: [ElementKinds.table, ElementKinds.tableCell]
1490
+ function handleContinualInsertBreak(editor, lowestBlock, type) {
1491
+ const isEmpty = Editor.isEmpty(editor, lowestBlock);
1492
+ const isEnd = Editor.isEnd(editor, editor.selection.anchor, editor.selection.focus.path);
1493
+ const aboveResult = Editor.above(editor, {
1494
+ match: n => Editor.isBlock(editor, n) && n.type === type
1495
+ });
1496
+ if (isEnd) {
1497
+ editor.marks = {};
1498
+ }
1499
+ if (aboveResult && aboveResult[0] && isEnd && isEmpty) {
1500
+ const wrapBlock = aboveResult[0];
1501
+ if (wrapBlock.type === type) {
1502
+ if (wrapBlock.children[wrapBlock.children.length - 1] === lowestBlock) {
1503
+ unWrap(editor, wrapBlock.type);
1504
+ return true;
1505
+ }
1506
+ }
1451
1507
  }
1452
- ];
1508
+ return false;
1509
+ }
1510
+
1511
+ var index = /*#__PURE__*/Object.freeze({
1512
+ __proto__: null,
1513
+ setMarks: setMarks,
1514
+ clearMarks: clearMarks,
1515
+ insertElement: insertElement,
1516
+ insertElementNext: insertElementNext,
1517
+ insertParagraph: insertParagraph,
1518
+ setNode: setNode,
1519
+ unwrapNodesByType: unwrapNodesByType,
1520
+ onKeyDownResetBlockType: onKeyDownResetBlockType,
1521
+ moveChildren: moveChildren,
1522
+ applyDeepToNodes: applyDeepToNodes,
1523
+ mergeDeepToNodes: mergeDeepToNodes,
1524
+ unWrap: unWrap,
1525
+ splitNode: splitNode,
1526
+ deleteElement: deleteElement,
1527
+ setEndSelection: setEndSelection,
1528
+ insertTheElements: insertTheElements,
1529
+ closeConversionHint: closeConversionHint,
1530
+ handleContinualDeleteBackward: handleContinualDeleteBackward,
1531
+ handleContinualInsertBreak: handleContinualInsertBreak
1532
+ });
1453
1533
 
1454
1534
  const isNodeTypeList = (n) => {
1455
1535
  return [ElementKinds.bulletedList, ElementKinds.numberedList].includes(n.type);
@@ -1516,8 +1596,8 @@ const ListEditor = {
1516
1596
  },
1517
1597
  unwrapList(editor) {
1518
1598
  Editor.withoutNormalizing(editor, () => {
1519
- TheTransforms.unwrapNodesByType(editor, [ElementKinds.bulletedList, ElementKinds.numberedList], { split: true, mode: 'all' });
1520
- TheTransforms.unwrapNodesByType(editor, [ElementKinds.listItem], { split: true, mode: 'all' });
1599
+ unwrapNodesByType(editor, [ElementKinds.bulletedList, ElementKinds.numberedList], { split: true, mode: 'all' });
1600
+ unwrapNodesByType(editor, [ElementKinds.listItem], { split: true, mode: 'all' });
1521
1601
  });
1522
1602
  },
1523
1603
  wrapList(editor, type) {
@@ -1535,11 +1615,11 @@ const ListEditor = {
1535
1615
  });
1536
1616
  },
1537
1617
  isActive(editor, type) {
1538
- const [match] = TheQueries.getNodesByType(editor, type);
1618
+ const [match] = getNodesByType(editor, type);
1539
1619
  return !!match;
1540
1620
  },
1541
1621
  getActiveList(editor) {
1542
- const [match] = TheQueries.getNodesByType(editor, LIST_BLOCK_TYPES);
1622
+ const [match] = getNodesByType(editor, LIST_BLOCK_TYPES);
1543
1623
  return match;
1544
1624
  },
1545
1625
  buildListItem(editor) {
@@ -1572,7 +1652,7 @@ const ListEditor = {
1572
1652
 
1573
1653
  const TodoItemEditor = {
1574
1654
  isActive(editor) {
1575
- const [match] = TheQueries.getNodesByType(editor, ElementKinds.checkItem);
1655
+ const [match] = getNodesByType(editor, ElementKinds.checkItem);
1576
1656
  return !!match;
1577
1657
  },
1578
1658
  insertTodoItem(editor) {
@@ -1600,7 +1680,7 @@ const TodoItemEditor = {
1600
1680
 
1601
1681
  const BlockquoteEditor = {
1602
1682
  toggleBlockquote(editor) {
1603
- if (!TheQueries.isParagraph(editor)) {
1683
+ if (!isParagraph(editor)) {
1604
1684
  Transforms.insertNodes(editor, {
1605
1685
  type: ElementKinds.paragraph,
1606
1686
  mode: 'text',
@@ -1611,7 +1691,7 @@ const BlockquoteEditor = {
1611
1691
  ]
1612
1692
  });
1613
1693
  }
1614
- const isActive = TheQueries.isBlockActive(editor, ElementKinds.blockquote);
1694
+ const isActive = isBlockActive(editor, ElementKinds.blockquote);
1615
1695
  if (!isActive) {
1616
1696
  Transforms.wrapNodes(editor, { type: ElementKinds.blockquote, children: [] }, {
1617
1697
  mode: 'lowest'
@@ -1700,7 +1780,7 @@ const autoFormatRules = [
1700
1780
  type: ElementKinds.listItem,
1701
1781
  markup: [],
1702
1782
  match: (editor) => {
1703
- return TheQueries.isParagraph(editor) ? ['*', '-', '+'] : [];
1783
+ return isParagraph(editor) ? ['*', '-', '+'] : [];
1704
1784
  },
1705
1785
  format: (editor) => {
1706
1786
  ListEditor.toggleList(editor, ElementKinds.bulletedList);
@@ -1710,7 +1790,7 @@ const autoFormatRules = [
1710
1790
  type: ElementKinds.listItem,
1711
1791
  markup: [],
1712
1792
  match: (editor, textFromBlockStart) => {
1713
- return TheQueries.isParagraph(editor) && /^-?\d+(\.|\))$/.test(textFromBlockStart) ? [textFromBlockStart] : [];
1793
+ return isParagraph(editor) && /^-?\d+(\.|\))$/.test(textFromBlockStart) ? [textFromBlockStart] : [];
1714
1794
  },
1715
1795
  format: (editor, markup) => {
1716
1796
  let startIndex = 1;
@@ -1727,7 +1807,7 @@ const autoFormatRules = [
1727
1807
  type: ElementKinds.checkItem,
1728
1808
  markup: [],
1729
1809
  match: (editor) => {
1730
- return TheQueries.isParagraph(editor) ? ['[]'] : [];
1810
+ return isParagraph(editor) ? ['[]'] : [];
1731
1811
  },
1732
1812
  format: (editor) => {
1733
1813
  TodoItemEditor.insertTodoItem(editor);
@@ -1789,7 +1869,7 @@ class TheConversionHintComponent {
1789
1869
  creatCloseTimer() {
1790
1870
  this.closeTimer = setInterval(() => {
1791
1871
  clearInterval(this.closeTimer);
1792
- TheTransforms.closeConversionHint(this.editor);
1872
+ closeConversionHint(this.editor);
1793
1873
  }, this.duration);
1794
1874
  }
1795
1875
  clearCloseTimer() {
@@ -1879,7 +1959,7 @@ const getToolbarClass = (editor) => {
1879
1959
  const withDeserializeMd = (options) => (editor) => {
1880
1960
  const { insertData, onKeydown } = editor;
1881
1961
  editor.onKeydown = (event) => {
1882
- TheTransforms.closeConversionHint(editor);
1962
+ closeConversionHint(editor);
1883
1963
  onKeydown(event);
1884
1964
  };
1885
1965
  editor.insertData = (data) => {
@@ -1889,7 +1969,7 @@ const withDeserializeMd = (options) => (editor) => {
1889
1969
  const plainFragment = data.getData('text/plain');
1890
1970
  const slateFragment = data.getData(`application/${CLIPBOARD_FORMAT_KEY}`);
1891
1971
  const oldRange = editor.selection;
1892
- TheTransforms.closeConversionHint(editor);
1972
+ closeConversionHint(editor);
1893
1973
  if (plainFragment && isMarkdownStynx(plainFragment) && !slateFragment) {
1894
1974
  setTimeout(() => {
1895
1975
  const overlay = editor.injector.get(Overlay);
@@ -1907,11 +1987,11 @@ const withDeserializeMd = (options) => (editor) => {
1907
1987
  const htmlDom = new DOMParser().parseFromString(html, 'text/html');
1908
1988
  const fragment = TheiaConverter.convertToTheia(Array.from(htmlDom.body.children));
1909
1989
  if (!isUnformatted(fragment)) {
1910
- TheTransforms.closeConversionHint(editor);
1990
+ closeConversionHint(editor);
1911
1991
  editor.undo();
1912
1992
  setTimeout(() => {
1913
1993
  Transforms.select(editor, oldRange);
1914
- TheTransforms.insertTheElements(editor, fragment);
1994
+ insertTheElements(editor, fragment);
1915
1995
  AngularEditor.focus(editor);
1916
1996
  });
1917
1997
  return;
@@ -1989,13 +2069,13 @@ const withAutoInsertData = (validChildren) => (editor) => {
1989
2069
  allElementOptions = Object.values(extraInfo);
1990
2070
  }
1991
2071
  const indivisibleTypes = allElementOptions.filter(item => item.isIndivisible).map(item => item.type);
1992
- const fragment = extractFragment(data, ELEMENT_UNIQUE_ID);
2072
+ const fragment = extractFragment(data);
1993
2073
  if (fragment) {
1994
- if (TheQueries.isAcrossBlocks(editor, fragment) || Editor.isVoid(editor, fragment[0])) {
2074
+ if (isAcrossBlocks(editor, fragment) || Editor.isVoid(editor, fragment[0])) {
1995
2075
  const { selection } = editor;
1996
2076
  const [start] = Editor.edges(editor, selection);
1997
2077
  // query whether there is a node to be verified
1998
- const tryVerifyNode = allElementOptions.find(item => TheQueries.getAboveByType(editor, item.type, { at: start, mode: 'lowest' }));
2078
+ const tryVerifyNode = allElementOptions.find(item => getAboveByType(editor, item.type, { at: start, mode: 'lowest' }));
1999
2079
  if (tryVerifyNode) {
2000
2080
  // is exist invalid element type in fragment
2001
2081
  const invalidIndex = fragment.findIndex(item => tryVerifyNode.inValidChildrenTypes.includes(item.type));
@@ -2009,7 +2089,7 @@ const withAutoInsertData = (validChildren) => (editor) => {
2009
2089
  });
2010
2090
  }
2011
2091
  // split node
2012
- const path = TheTransforms.splitNode(editor, indivisibleTypes);
2092
+ const path = splitNode(editor, indivisibleTypes);
2013
2093
  Transforms.insertNodes(editor, invalidFragmentData, {
2014
2094
  at: Path.next(path)
2015
2095
  });
@@ -2018,10 +2098,10 @@ const withAutoInsertData = (validChildren) => (editor) => {
2018
2098
  }
2019
2099
  }
2020
2100
  Editor.withoutNormalizing(editor, () => {
2021
- const isEmptyParagraph = TheQueries.isEmptyParagraph(editor, editor.selection.anchor);
2101
+ const isEmptyParagraph$1 = isEmptyParagraph(editor, editor.selection.anchor);
2022
2102
  const emptyPath = Path.parent(editor.selection.anchor.path);
2023
2103
  Transforms.insertNodes(editor, fragment);
2024
- if (isEmptyParagraph) {
2104
+ if (isEmptyParagraph$1) {
2025
2105
  Transforms.delete(editor, { at: emptyPath });
2026
2106
  const lastPath = emptyPath.pop();
2027
2107
  Transforms.select(editor, [...emptyPath, lastPath + fragment.length - 1]);
@@ -2062,16 +2142,16 @@ const withRemoveEmpty = (editor) => {
2062
2142
  const { deleteBackward, deleteForward } = editor;
2063
2143
  editor.deleteBackward = unit => {
2064
2144
  const { selection } = editor;
2065
- const anchorBlock = TheQueries.anchorBlock(editor);
2066
- if (!anchorBlock) {
2145
+ const anchorBlock$1 = anchorBlock(editor);
2146
+ if (!anchorBlock$1) {
2067
2147
  deleteBackward(unit);
2068
2148
  return;
2069
2149
  }
2070
2150
  // delete empty paragraphs or empty headings, the default operation is to delete before the void node
2071
2151
  const parentPath = Path.parent(editor.selection.anchor.path);
2072
- const isEmptyHeading = HEADING_TYPES.includes(anchorBlock.type) && Editor.isEmpty(editor, anchorBlock);
2073
- const isEmptyParagraph = TheQueries.isEmptyParagraph(editor, editor.selection.anchor);
2074
- if ((isEmptyParagraph || isEmptyHeading) &&
2152
+ const isEmptyHeading = HEADING_TYPES.includes(anchorBlock$1.type) && Editor.isEmpty(editor, anchorBlock$1);
2153
+ const isEmptyParagraph$1 = isEmptyParagraph(editor, editor.selection.anchor);
2154
+ if ((isEmptyParagraph$1 || isEmptyHeading) &&
2075
2155
  parentPath[parentPath.length - 1] > 0 &&
2076
2156
  Editor.isVoid(editor, Node.get(editor, Path.previous(parentPath)))) {
2077
2157
  Transforms.delete(editor, { at: editor.selection.anchor.path.slice(0, editor.selection.anchor.path.length - 1) });
@@ -2092,10 +2172,10 @@ const withRemoveEmpty = (editor) => {
2092
2172
  deleteBackward(unit);
2093
2173
  };
2094
2174
  editor.deleteForward = unit => {
2095
- const anchorBlockEntry = TheQueries.anchorBlockEntry(editor);
2096
- if (anchorBlockEntry &&
2097
- TheQueries.isAncestorEmpty(editor, anchorBlockEntry[0]) &&
2098
- TheQueries.getNode(editor, Path.next(anchorBlockEntry[1]))) {
2175
+ const anchorBlockEntry$1 = anchorBlockEntry(editor);
2176
+ if (anchorBlockEntry$1 &&
2177
+ isAncestorEmpty(editor, anchorBlockEntry$1[0]) &&
2178
+ getNode(editor, Path.next(anchorBlockEntry$1[1]))) {
2099
2179
  const pathRef = Editor.pathRef(editor, Path.parent(editor.selection.anchor.path));
2100
2180
  HistoryEditor.withoutMerging(editor, () => {
2101
2181
  Transforms.move(editor);
@@ -2113,7 +2193,7 @@ const withResetType = (editor) => {
2113
2193
  editor.onKeydown = (event) => {
2114
2194
  const { selection } = editor;
2115
2195
  if (IS_SAFARI && selection && Range.isCollapsed(selection) && hotkeys.isDeleteBackward(event)) {
2116
- const blockEntry = TheQueries.getAboveByType(editor, BLOCK_DELETEBACKWARD_TYPES);
2196
+ const blockEntry = getAboveByType(editor, BLOCK_DELETEBACKWARD_TYPES);
2117
2197
  if (blockEntry && blockEntry[0]) {
2118
2198
  const isStart = Editor.isStart(editor, selection.anchor, blockEntry[1]);
2119
2199
  if (isStart) {
@@ -2136,6 +2216,7 @@ const withResetType = (editor) => {
2136
2216
  class TheContextService {
2137
2217
  constructor(ngZone) {
2138
2218
  this.ngZone = ngZone;
2219
+ this.fileList = [];
2139
2220
  this.paintFormatStatus = {
2140
2221
  isActive: false,
2141
2222
  marks: {}
@@ -2151,10 +2232,16 @@ class TheContextService {
2151
2232
  }
2152
2233
  getOptions() {
2153
2234
  if (!this.options.width) {
2154
- this.options.width = this.options.nativeElement.querySelector('.slate-editable-container').offsetWidth - 30;
2235
+ this.options.width = this.options.nativeElement.querySelector('.slate-editable-container').firstElementChild.offsetWidth;
2155
2236
  }
2156
2237
  return this.options;
2157
2238
  }
2239
+ setUploadFileList(file) {
2240
+ this.fileList.push(file);
2241
+ }
2242
+ removeUploadImage(file) {
2243
+ this.fileList.splice(this.fileList.findIndex(item => item.file === file), 1);
2244
+ }
2158
2245
  }
2159
2246
  TheContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheContextService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
2160
2247
  TheContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheContextService });
@@ -2177,7 +2264,6 @@ class TheImageComponent extends TheBaseElementComponent {
2177
2264
  this.beforeContextChange = (value) => {
2178
2265
  if (value.element !== this.element && value.element.thumbUrl) {
2179
2266
  this.imageEntry = {
2180
- file: undefined,
2181
2267
  name: value.element.name,
2182
2268
  width: value.element.width,
2183
2269
  height: value.element.height,
@@ -2189,8 +2275,10 @@ class TheImageComponent extends TheBaseElementComponent {
2189
2275
  };
2190
2276
  }
2191
2277
  ngOnInit() {
2192
- if (this.element.file instanceof File) {
2193
- this.uploadImage(this.element.file);
2278
+ var _a;
2279
+ this.file = (_a = this.theContextService.fileList.find(item => item.url === this.element.url)) === null || _a === void 0 ? void 0 : _a.file;
2280
+ if (this.file && this.file instanceof File) {
2281
+ this.uploadImage(this.file);
2194
2282
  }
2195
2283
  super.ngOnInit();
2196
2284
  }
@@ -2203,7 +2291,7 @@ class TheImageComponent extends TheBaseElementComponent {
2203
2291
  this.mouseUpSubscription = this.theContextService.onMouseUp$.subscribe(e => this.endDrag(e));
2204
2292
  this.uploadingSubscription = this.imageUploaderService
2205
2293
  .getUploadingItems$()
2206
- .pipe(map(fileUploadingItem => this.element.file && fileUploadingItem.find(item => item.file === this.element.file)))
2294
+ .pipe(map(fileUploadingItem => this.file && fileUploadingItem.find(item => item.file === this.file)))
2207
2295
  .subscribe(uploadingItem => {
2208
2296
  if (!uploadingItem || !uploadingItem.result) {
2209
2297
  return;
@@ -2234,10 +2322,9 @@ class TheImageComponent extends TheBaseElementComponent {
2234
2322
  height: this.imageEntry.height,
2235
2323
  thumbUrl,
2236
2324
  originUrl,
2237
- align: this.imageEntry.align || Alignment.center,
2238
- file: undefined
2325
+ align: this.imageEntry.align || Alignment.center
2239
2326
  };
2240
- HistoryEditor.withoutSaving(this.editor, () => Transforms.setNodes(this.editor, Object.assign({ type: ElementKinds.image, voids: true }, imageInfo), { at: path }));
2327
+ HistoryEditor.withoutSaving(this.editor, () => Transforms.setNodes(this.editor, Object.assign({ type: ElementKinds.image, url: null }, imageInfo), { at: path }));
2241
2328
  });
2242
2329
  }
2243
2330
  resolveImageSize(imageFile, maxSize) {
@@ -2318,7 +2405,7 @@ class TheImageComponent extends TheBaseElementComponent {
2318
2405
  if (this.dragable) {
2319
2406
  this.dragable = false;
2320
2407
  this.mouseMoveSubscription.unsubscribe();
2321
- Transforms.setNodes(this.editor, Object.assign({ type: ElementKinds.image, voids: true }, this.imageEntry), { at: this.selection });
2408
+ Transforms.setNodes(this.editor, Object.assign({ type: ElementKinds.image }, this.imageEntry), { at: this.selection });
2322
2409
  }
2323
2410
  }
2324
2411
  cancelUpload(event) {
@@ -2332,7 +2419,7 @@ class TheImageComponent extends TheBaseElementComponent {
2332
2419
  }
2333
2420
  }
2334
2421
  TheImageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheImageComponent, deps: [{ token: i0.ElementRef }, { token: i1$2.DomSanitizer }, { token: THE_UPLOAD_SERVICE_TOKEN }, { token: i0.ChangeDetectorRef }, { token: TheContextService }], target: i0.ɵɵFactoryTarget.Component });
2335
- TheImageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheImageComponent, selector: "the-image, [theImage]", viewQueries: [{ propertyName: "imageContent", first: true, predicate: ["imageContent"], descendants: true }, { propertyName: "img", first: true, predicate: ["img"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n<div class=\"image-container\" contenteditable=\"false\" [style.textAlign]=\"imageEntry.align || 'center'\">\n <div\n #imageContent\n *ngIf=\"imageEntry.thumbUrl\"\n class=\"image-content\"\n [class.pointer]=\"!selection\"\n [ngStyle]=\"{ width: imageEntry.width + 'px', height: imageEntry.height + 'px' }\"\n >\n <img #img class=\"main-image\" [src]=\"imageEntry.thumbUrl\" [alt]=\"imageEntry.name\" />\n <div *ngIf=\"selection\" class=\"image-profile\" [class.outline]=\"selection\">\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right bottom\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left bottom\"></span>\n </div>\n <div *ngIf=\"uploading\" class=\"uploading\">\n <div class=\"uploading-percentage\">\n <thy-progress thyType=\"primary\" [thyValue]=\"percentage\" thySize=\"sm\"></thy-progress>\n <thy-icon (click)=\"cancelUpload($event)\" thyIconName=\"close-circle-bold-fill\" thyIconLegging=\"true\"></thy-icon>\n </div>\n </div>\n <div *ngIf=\"!uploading\" class=\"layer\" (mousedown)=\"preview($event)\" [class.readonly]=\"readonly\"></div>\n </div>\n</div>\n", components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i4.ThyProgressComponent, selector: "thy-progress", inputs: ["thyType", "thyTips", "thyValue", "thySize", "thyMax"] }, { 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: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
2422
+ TheImageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheImageComponent, selector: "the-image, [theImage]", viewQueries: [{ propertyName: "imageContent", first: true, predicate: ["imageContent"], descendants: true }, { propertyName: "img", first: true, predicate: ["img"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n<div class=\"image-container\" contenteditable=\"false\" [style.textAlign]=\"imageEntry.align || 'center'\">\n <div\n #imageContent\n *ngIf=\"imageEntry.thumbUrl\"\n class=\"image-content\"\n [class.pointer]=\"!selection\"\n [ngStyle]=\"{ width: imageEntry.width + 'px', height: imageEntry.height + 'px' }\"\n >\n <img #img class=\"main-image\" [src]=\"imageEntry.thumbUrl\" [alt]=\"imageEntry.name\" />\n <div *ngIf=\"selection\" class=\"image-profile\" [class.outline]=\"selection\">\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right bottom\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left bottom\"></span>\n </div>\n <div *ngIf=\"uploading\" class=\"uploading\">\n <div class=\"uploading-percentage\">\n <thy-progress thyType=\"primary\" [thyValue]=\"percentage\" thySize=\"sm\"></thy-progress>\n <thy-icon (click)=\"cancelUpload($event)\" thyIconName=\"close-circle-bold-fill\" thyIconLegging=\"true\"></thy-icon>\n </div>\n </div>\n <div *ngIf=\"!uploading\" class=\"layer\" (mousedown)=\"preview($event)\" [class.readonly]=\"readonly\"></div>\n </div>\n <div *ngIf=\"!imageEntry.thumbUrl\" class=\"image-loading\" contenteditable=\"false\">\n <thy-icon thyIconName=\"image\"></thy-icon>\n </div>\n</div>\n", components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i4.ThyProgressComponent, selector: "thy-progress", inputs: ["thyType", "thyTips", "thyValue", "thySize", "thyMax"] }, { 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: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
2336
2423
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheImageComponent, decorators: [{
2337
2424
  type: Component,
2338
2425
  args: [{
@@ -2361,19 +2448,24 @@ const ImageEditor = {
2361
2448
  inputFile.click();
2362
2449
  },
2363
2450
  insertImages(editor, imageFiles) {
2451
+ const contextService = editor.injector.get(TheContextService);
2364
2452
  const imageNodes = [];
2365
2453
  const text = { text: '' };
2366
2454
  for (const image of imageFiles) {
2367
2455
  const verify = ImageEditor.verifyImage(editor, image);
2368
2456
  if (verify) {
2369
2457
  const url = URL.createObjectURL(image);
2370
- imageNodes.push({ type: ElementKinds.image, url, file: image, children: [text] });
2458
+ contextService.setUploadFileList({
2459
+ url,
2460
+ file: image
2461
+ });
2462
+ imageNodes.push({ type: ElementKinds.image, url, children: [text] });
2371
2463
  }
2372
2464
  }
2373
2465
  if (imageNodes.length > 0) {
2374
2466
  const at = editor.selection;
2375
2467
  Transforms.insertNodes(editor, imageNodes, { at });
2376
- if (TheQueries.isCollapsed(editor.selection) && TheQueries.isEmptyParagraph(editor)) {
2468
+ if (isCollapsed(editor.selection) && isEmptyParagraph(editor)) {
2377
2469
  Transforms.removeNodes(editor, { at });
2378
2470
  Transforms.select(editor, at);
2379
2471
  }
@@ -2396,7 +2488,7 @@ const ImageEditor = {
2396
2488
  },
2397
2489
  isImageActive(editor) {
2398
2490
  const [match] = Editor.nodes(editor, {
2399
- match: n => Element$1.isElement(n) && n.type === 'image',
2491
+ match: n => Element$1.isElement(n) && n.type === ElementKinds.image,
2400
2492
  universal: true
2401
2493
  });
2402
2494
  return !!match;
@@ -2409,7 +2501,6 @@ const withImage = (editor) => {
2409
2501
  return element.type === ElementKinds.image || isVoid(element);
2410
2502
  };
2411
2503
  editor.insertData = (data) => {
2412
- // TODO:: 底层有点问题,粘贴多张图片时只能识别一张
2413
2504
  if (data.files.length) {
2414
2505
  const imageFiles = [];
2415
2506
  for (const file of data.files) {
@@ -2523,7 +2614,7 @@ const isList = (n) => {
2523
2614
  };
2524
2615
 
2525
2616
  const isInList = (editor, at = editor.selection) => {
2526
- return TheQueries.isNodeTypeIn(editor, [ElementKinds.numberedList, ElementKinds.bulletedList], { at });
2617
+ return isNodeTypeIn(editor, [ElementKinds.numberedList, ElementKinds.bulletedList], { at });
2527
2618
  };
2528
2619
 
2529
2620
  /**
@@ -2538,13 +2629,19 @@ const getListTypes = () => {
2538
2629
  return [ElementKinds.bulletedList, ElementKinds.numberedList];
2539
2630
  };
2540
2631
 
2632
+ /**
2633
+ * 获取 List 中 ListItems,过滤掉空列表嵌套
2634
+ * @param node
2635
+ * @param initialValue
2636
+ * @returns
2637
+ */
2541
2638
  const getStartListItem = (node, initialValue) => {
2542
2639
  if (!initialValue) {
2543
2640
  initialValue = [];
2544
2641
  }
2545
2642
  if (node) {
2546
2643
  return node.reduce((result, current) => {
2547
- if (current.type == ElementKinds.listItem && current.children[0].type === ElementKinds.default) {
2644
+ if ((current.type === ElementKinds.listItem && !getListTypes().includes(current.children[0].type))) {
2548
2645
  result.push(current);
2549
2646
  }
2550
2647
  else {
@@ -2592,18 +2689,18 @@ const isSingleListItem = (list) => {
2592
2689
  * 如果at(默认= selection)位于ul> li> p中,则返回li和ul节点条目。
2593
2690
  */
2594
2691
  const getListItemEntry = (editor, { at = editor.selection } = {}) => {
2595
- if (at && TheQueries.isNodeTypeIn(editor, ElementKinds.listItem, { at })) {
2596
- const selectionParent = TheQueries.getParent(editor, at);
2692
+ if (at && isNodeTypeIn(editor, ElementKinds.listItem, { at })) {
2693
+ const selectionParent = getParent(editor, at);
2597
2694
  if (!selectionParent)
2598
2695
  return;
2599
2696
  const [, paragraphPath] = selectionParent;
2600
- const listItem = TheQueries.getAboveByType(editor, ElementKinds.listItem, { at }) || TheQueries.getParent(editor, paragraphPath);
2697
+ const listItem = getAboveByType(editor, ElementKinds.listItem, { at }) || getParent(editor, paragraphPath);
2601
2698
  if (!listItem)
2602
2699
  return;
2603
2700
  const [listItemNode, listItemPath] = listItem;
2604
2701
  if (listItemNode.type !== ElementKinds.listItem)
2605
2702
  return;
2606
- const list = TheQueries.getParent(editor, listItemPath);
2703
+ const list = getParent(editor, listItemPath);
2607
2704
  if (!list || !isList(list[0]))
2608
2705
  return;
2609
2706
  return {
@@ -2617,9 +2714,9 @@ const getListItemEntry = (editor, { at = editor.selection } = {}) => {
2617
2714
  * Is the selection focus at the start of its parent block.
2618
2715
  */
2619
2716
  const isSelectionAtListItemStart = (editor) => {
2620
- const listItemEntry = TheQueries.getAboveByType(editor, [ElementKinds.listItem]);
2717
+ const listItemEntry = getAboveByType(editor, [ElementKinds.listItem]);
2621
2718
  if (listItemEntry) {
2622
- return TheQueries.isStart(editor, editor.selection.focus, listItemEntry[1]);
2719
+ return isStart(editor, editor.selection.focus, listItemEntry[1]);
2623
2720
  }
2624
2721
  return false;
2625
2722
  };
@@ -2628,7 +2725,7 @@ const insertListData = (editor, { fromList, toListItemEntry }) => {
2628
2725
  const { children } = fromList;
2629
2726
  const [toListItem, toListItemPath] = toListItemEntry;
2630
2727
  const nextListItemPath = Path.next(toListItemPath);
2631
- const toListItemIsEmptyParagraph = TheQueries.isEmptyParagraph(editor, editor.selection.anchor);
2728
+ const toListItemIsEmptyParagraph = isEmptyParagraph(editor, editor.selection.anchor);
2632
2729
  const hasSubList = hasListInListItem(toListItem);
2633
2730
  let selectPath = [...toListItemPath];
2634
2731
  const liIndex = selectPath.pop();
@@ -2699,7 +2796,7 @@ const insertListData = (editor, { fromList, toListItemEntry }) => {
2699
2796
  const moveListItemUp = (editor, { list, listItem }, options) => {
2700
2797
  const [listNode, listPath] = list;
2701
2798
  const [, listItemPath] = listItem;
2702
- const listParentEntry = TheQueries.getParent(editor, listPath);
2799
+ const listParentEntry = getParent(editor, listPath);
2703
2800
  if (!listParentEntry)
2704
2801
  return;
2705
2802
  const [listParentNode, listParentPath] = listParentEntry;
@@ -2748,8 +2845,8 @@ const moveListItemUp = (editor, { list, listItem }, options) => {
2748
2845
  type: ElementKinds.listItem,
2749
2846
  children: []
2750
2847
  }, { at: nextPath });
2751
- const moveStartPath = TheQueries.findPath(editor, behindNode[0]);
2752
- const moveEndPath = TheQueries.findPath(editor, behindNode[behindNode.length - 1]);
2848
+ const moveStartPath = findPath(editor, behindNode[0]);
2849
+ const moveEndPath = findPath(editor, behindNode[behindNode.length - 1]);
2753
2850
  const moveRange = Editor.range(editor, moveStartPath, moveEndPath);
2754
2851
  Transforms.moveNodes(editor, {
2755
2852
  at: moveRange,
@@ -2771,8 +2868,8 @@ const moveListItemUp = (editor, { list, listItem }, options) => {
2771
2868
  * Insert list item if selection in li>p.
2772
2869
  */
2773
2870
  const insertListItem = (editor) => {
2774
- if (editor.selection && !TheQueries.isRangeAtRoot(editor.selection)) {
2775
- const paragraphEntry = TheQueries.getAboveByType(editor, ElementKinds.paragraph);
2871
+ if (editor.selection && !isRangeAtRoot(editor.selection)) {
2872
+ const paragraphEntry = getAboveByType(editor, ElementKinds.paragraph);
2776
2873
  if (!paragraphEntry) {
2777
2874
  return;
2778
2875
  }
@@ -2784,7 +2881,7 @@ const insertListItem = (editor) => {
2784
2881
  if (!Range.isCollapsed(editor.selection)) {
2785
2882
  Transforms.delete(editor);
2786
2883
  }
2787
- const isEnd = TheQueries.isBlockTextEmptyAfterSelection(editor);
2884
+ const isEnd = isBlockTextEmptyAfterSelection(editor);
2788
2885
  const nextNodePath = Path.next(paragraphPath);
2789
2886
  const nextListItemPath = Path.next(listItemPath);
2790
2887
  const nextEnd = Editor.end(editor, listItemPath);
@@ -2819,7 +2916,7 @@ const insertListItem = (editor) => {
2819
2916
  /**
2820
2917
  * If there is a list in the list item, move it to the next list item
2821
2918
  */
2822
- if (TheQueries.getNode(editor, nextNodePath)) {
2919
+ if (getNode(editor, nextNodePath)) {
2823
2920
  Transforms.moveNodes(editor, {
2824
2921
  at: Editor.range(editor, nextNodePath, nextEnd),
2825
2922
  to: nextListItemPath.concat(1),
@@ -2835,8 +2932,8 @@ const insertListItem = (editor) => {
2835
2932
 
2836
2933
  const unwrapList = (editor) => {
2837
2934
  Editor.withoutNormalizing(editor, () => {
2838
- TheTransforms.unwrapNodesByType(editor, ElementKinds.listItem);
2839
- TheTransforms.unwrapNodesByType(editor, [ElementKinds.bulletedList, ElementKinds.numberedList], { split: true });
2935
+ unwrapNodesByType(editor, ElementKinds.listItem);
2936
+ unwrapNodesByType(editor, [ElementKinds.bulletedList, ElementKinds.numberedList], { split: true });
2840
2937
  });
2841
2938
  };
2842
2939
 
@@ -2865,7 +2962,7 @@ const moveListItemSublistItemsToListItemSublist = (editor, { fromListItem, toLis
2865
2962
  const toListItemSublist = getListItemSublist(toListItem, options);
2866
2963
  let to;
2867
2964
  if (!toListItemSublist) {
2868
- const fromList = TheQueries.getParent(editor, fromListItemPath);
2965
+ const fromList = getParent(editor, fromListItemPath);
2869
2966
  if (!fromList)
2870
2967
  return 0;
2871
2968
  const [fromListNode] = fromList;
@@ -2879,7 +2976,7 @@ const moveListItemSublistItemsToListItemSublist = (editor, { fromListItem, toLis
2879
2976
  to = toListItemSublistPath.concat([0]);
2880
2977
  }
2881
2978
  else {
2882
- to = Path.next(TheQueries.getLastChildPath(toListItemSublist));
2979
+ to = Path.next(getLastChildPath(toListItemSublist));
2883
2980
  }
2884
2981
  const moved = moveChildren(editor, {
2885
2982
  at: Path.previous(fromListItemSublistPath),
@@ -2916,9 +3013,9 @@ const normalizeNo = (editor, nodeEntry) => {
2916
3013
  * 如果为同类型list,则把nextList children移动到当前list的尾部, 并删除nextList
2917
3014
  */
2918
3015
  const nextPath = Path.next(listPath);
2919
- const nextNode = TheQueries.getNode(editor, nextPath);
3016
+ const nextNode = getNode(editor, nextPath);
2920
3017
  if (nextNode && Element$1.isElement(nextNode) && Element$1.isElement(listNode) && nextNode.type === listNode.type) {
2921
- TheTransforms.moveChildren(editor, {
3018
+ moveChildren(editor, {
2922
3019
  at: [nextNode, nextPath],
2923
3020
  to: listPath.concat(listNode.children.length)
2924
3021
  });
@@ -2930,11 +3027,11 @@ const normalizeNo = (editor, nodeEntry) => {
2930
3027
  * 获取prevList判断是否为同类型list
2931
3028
  * 如果为同类型list,则把当前list children移动到prevList的尾部, 并删除当前List
2932
3029
  */
2933
- const currentListNode = TheQueries.getNode(editor, listPath);
3030
+ const currentListNode = getNode(editor, listPath);
2934
3031
  const prevPath = Path.previous(listPath);
2935
- const prevNode = TheQueries.getNode(editor, prevPath);
3032
+ const prevNode = getNode(editor, prevPath);
2936
3033
  if (prevNode && Element$1.isElement(prevNode) && Element$1.isElement(currentListNode) && prevNode.type === currentListNode.type) {
2937
- TheTransforms.moveChildren(editor, {
3034
+ moveChildren(editor, {
2938
3035
  at: [currentListNode, listPath],
2939
3036
  to: prevPath.concat(prevNode.children.length)
2940
3037
  });
@@ -2981,7 +3078,7 @@ const getListNormalizer = (editor, { validLiChildrenTypes }) => {
2981
3078
  * 将 fromListItem 子列表的列表项移到 toList
2982
3079
  */
2983
3080
  const moveListItemSublistItemsToList = (editor, { fromListItem, toList, location }) => {
2984
- const fromListItemSublist = TheQueries.findDescendant(editor, {
3081
+ const fromListItemSublist = findDescendant(editor, {
2985
3082
  at: fromListItem[1],
2986
3083
  match: {
2987
3084
  type: getListTypes()
@@ -2990,7 +3087,7 @@ const moveListItemSublistItemsToList = (editor, { fromListItem, toList, location
2990
3087
  if (!fromListItemSublist)
2991
3088
  return 0;
2992
3089
  const [, fromListItemSublistPath] = fromListItemSublist;
2993
- const lastChildPath = TheQueries.getLastChildPath(toList);
3090
+ const lastChildPath = getLastChildPath(toList);
2994
3091
  let moved;
2995
3092
  Editor.withoutNormalizing(editor, () => {
2996
3093
  moved = moveChildren(editor, {
@@ -3060,7 +3157,7 @@ function onKeyDownList(e, editor) {
3060
3157
  }
3061
3158
  // move down with tab
3062
3159
  const tab = !e.shiftKey;
3063
- if (tab && !TheQueries.isFirstChild(listItemPath)) {
3160
+ if (tab && !isFirstChild(listItemPath)) {
3064
3161
  moveListItemDown(editor, { list, listItem });
3065
3162
  return true;
3066
3163
  }
@@ -3198,6 +3295,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
3198
3295
  }]
3199
3296
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; } });
3200
3297
 
3298
+ /**
3299
+ * Is the selection in same li
3300
+ */
3301
+ const isSelectionInSameListItem = (editor) => {
3302
+ const { selection } = editor;
3303
+ if (!selection) {
3304
+ return false;
3305
+ }
3306
+ const [start, end] = Range.edges(selection);
3307
+ const startListItemEntry = getAboveByType(editor, ElementKinds.listItem, { at: start.path });
3308
+ const endListItemEntry = getAboveByType(editor, ElementKinds.listItem, { at: end.path });
3309
+ return startListItemEntry && endListItemEntry && Path.equals(startListItemEntry[1], endListItemEntry[1]);
3310
+ };
3311
+
3201
3312
  const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
3202
3313
  const { insertBreak, deleteBackward, onKeydown, insertData, setFragmentData, renderElement } = editor;
3203
3314
  const resetBlockTypesListRule = {
@@ -3206,7 +3317,7 @@ const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
3206
3317
  onReset: (_editor) => unwrapList(_editor)
3207
3318
  };
3208
3319
  editor.insertBreak = () => {
3209
- const node = TheQueries.anchorBlock(editor);
3320
+ const node = anchorBlock(editor);
3210
3321
  if (!node) {
3211
3322
  insertBreak();
3212
3323
  return;
@@ -3247,14 +3358,14 @@ const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
3247
3358
  }
3248
3359
  }
3249
3360
  // 如果选择的listItem为空则将其向上移动
3250
- if (isStart && TheQueries.isBlockAboveEmpty(editor)) {
3361
+ if (isStart && isBlockAboveEmpty(editor)) {
3251
3362
  moved = moveListItemUp(editor, { list, listItem });
3252
3363
  if (moved)
3253
3364
  return;
3254
3365
  }
3255
- const didReset = TheTransforms.onKeyDownResetBlockType({
3366
+ const didReset = onKeyDownResetBlockType({
3256
3367
  rules: [
3257
- Object.assign(Object.assign({}, resetBlockTypesListRule), { predicate: () => !moved && isStart && TheQueries.isBlockAboveEmpty(editor) })
3368
+ Object.assign(Object.assign({}, resetBlockTypesListRule), { predicate: () => !moved && isStart && isBlockAboveEmpty(editor) })
3258
3369
  ]
3259
3370
  })(null, editor);
3260
3371
  if (didReset) {
@@ -3280,15 +3391,14 @@ const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
3280
3391
  const fragmentElement = fragmentData[0];
3281
3392
  if (getListTypes().includes(fragmentElement.type)) {
3282
3393
  const startNodes = getStartListItem([fragmentElement.children[0]]);
3283
- // 复制列表中的图片时startNodes长度为零
3284
- if (startNodes.length === 0) {
3285
- setFragmentData(unit);
3286
- return;
3287
- }
3288
3394
  const children = startNodes.concat(fragmentElement.children.slice(1));
3289
- const fragmentNodes = [
3395
+ let fragmentNodes = [
3290
3396
  Object.assign(Object.assign({}, fragmentElement), { children })
3291
3397
  ];
3398
+ if (isSelectionInSameListItem(editor)) {
3399
+ // 仅仅复制列表中的内容
3400
+ fragmentNodes = children[0].children;
3401
+ }
3292
3402
  const fragment = fragmentNodes.concat(fragmentData.slice(1));
3293
3403
  const domRange = AngularEditor.toDOMRange(editor, selection);
3294
3404
  const contents = domRange.cloneContents();
@@ -3313,17 +3423,17 @@ const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
3313
3423
  const { list, listItem } = res;
3314
3424
  const [, listPath] = list;
3315
3425
  const [listItemNode, listItemPath] = listItem;
3316
- const previousListItemPath = TheQueries.getPreviousPath(listItemPath);
3426
+ const previousListItemPath = getPreviousPath(listItemPath);
3317
3427
  if (previousListItemPath) {
3318
3428
  const beforePoint = Editor.before(editor, listItemPath);
3319
3429
  const parentPath = Path.parent(beforePoint.path);
3320
3430
  const parentNode = Node.get(editor, parentPath);
3321
3431
  if (Editor.isVoid(editor, parentNode)) {
3322
3432
  Editor.withoutNormalizing(editor, () => {
3323
- TheTransforms.unwrapNodesByType(editor, [ElementKinds.bulletedList, ElementKinds.numberedList], {
3433
+ unwrapNodesByType(editor, [ElementKinds.bulletedList, ElementKinds.numberedList], {
3324
3434
  split: true
3325
3435
  });
3326
- TheTransforms.unwrapNodesByType(editor, ElementKinds.listItem);
3436
+ unwrapNodesByType(editor, ElementKinds.listItem);
3327
3437
  });
3328
3438
  return;
3329
3439
  }
@@ -3347,7 +3457,7 @@ const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
3347
3457
  const beforePoint = Editor.before(editor, listItemPath);
3348
3458
  const startPoint = Editor.start(editor, listItemPath);
3349
3459
  const endPoint = Editor.end(editor, listItemPath);
3350
- const isInFirstChild = !isListNested(editor, listPath) && TheQueries.isFirstChild(listItemPath);
3460
+ const isInFirstChild = !isListNested(editor, listPath) && isFirstChild(listItemPath);
3351
3461
  const to = isInFirstChild ? listPath : Path.next(Path.parent(beforePoint.path));
3352
3462
  // TODO: types
3353
3463
  Transforms.moveNodes(editor, {
@@ -3363,7 +3473,7 @@ const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
3363
3473
  return;
3364
3474
  }
3365
3475
  // deprecated
3366
- if (!isListNested(editor, listPath) && TheQueries.isFirstChild(listItemPath)) {
3476
+ if (!isListNested(editor, listPath) && isFirstChild(listItemPath)) {
3367
3477
  unwrapList(editor);
3368
3478
  return;
3369
3479
  }
@@ -3372,7 +3482,7 @@ const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
3372
3482
  };
3373
3483
  editor.insertData = (data) => {
3374
3484
  const text = data.getData('text/plain');
3375
- const fragment = extractFragment(data, ELEMENT_UNIQUE_ID);
3485
+ const fragment = extractFragment(data);
3376
3486
  const aboveEntry = Editor.above(editor, {
3377
3487
  match: n => Editor.isBlock(editor, n) && n.type === ElementKinds.listItem
3378
3488
  });
@@ -3478,7 +3588,7 @@ class TheTodoItemComponent extends TheBaseElementComponent {
3478
3588
  if (this.readonly) {
3479
3589
  return false;
3480
3590
  }
3481
- TheTransforms.setNode(this.editor, { checked }, this.element);
3591
+ setNode(this.editor, { checked }, this.element);
3482
3592
  }
3483
3593
  useIndentClass(el, element) {
3484
3594
  const prefix = 'indent';
@@ -3531,7 +3641,7 @@ const withTodoItem = (editor) => {
3531
3641
  });
3532
3642
  if (match) {
3533
3643
  const [, path] = match;
3534
- const block = TheQueries.anchorBlock(editor);
3644
+ const block = anchorBlock(editor);
3535
3645
  if (block && Editor.isStart(editor, selection.anchor, path) && Editor.isEmpty(editor, block)) {
3536
3646
  Transforms.setNodes(editor, {
3537
3647
  type: ElementKinds.default,
@@ -3544,8 +3654,8 @@ const withTodoItem = (editor) => {
3544
3654
  }
3545
3655
  }
3546
3656
  insertBreak();
3547
- const anchorBlock = TheQueries.anchorBlock(editor);
3548
- if (anchorBlock && anchorBlock.type === ElementKinds.checkItem) {
3657
+ const anchorBlock$1 = anchorBlock(editor);
3658
+ if (anchorBlock$1 && anchorBlock$1.type === ElementKinds.checkItem) {
3549
3659
  Transforms.setNodes(editor, { checked: false });
3550
3660
  }
3551
3661
  };
@@ -3635,7 +3745,7 @@ const withAlign = (editor) => {
3635
3745
  const { deleteBackward } = editor;
3636
3746
  editor.deleteBackward = unit => {
3637
3747
  const { anchor } = editor.selection;
3638
- const node = TheQueries.anchorBlock(editor);
3748
+ const node = anchorBlock(editor);
3639
3749
  const isVoid = Editor.isVoid(editor, node);
3640
3750
  const alignTypes = [Alignment.center, Alignment.right];
3641
3751
  const startLine = Editor.start(editor, anchor.path);
@@ -3654,7 +3764,7 @@ const withHeading = (editor) => {
3654
3764
  const { insertBreak } = editor;
3655
3765
  editor.insertBreak = () => {
3656
3766
  const { selection } = editor;
3657
- const anchorBlock = TheQueries.getAnchorBlockEntry(editor);
3767
+ const anchorBlock = getAnchorBlockEntry(editor);
3658
3768
  if (anchorBlock && Range.isCollapsed(selection) && anchorBlock[0].type.startsWith('heading')) {
3659
3769
  if (Editor.isStart(editor, selection.anchor, anchorBlock[1])) {
3660
3770
  insertBreak();
@@ -3726,14 +3836,14 @@ const withMark = () => (editor) => {
3726
3836
 
3727
3837
  const withNodeID = ({ idKey = 'id', idCreator = () => Date.now(), filterText = true, filter = () => true } = {}) => (e) => {
3728
3838
  const editor = e;
3729
- const { apply } = editor;
3839
+ const { apply, getFragment } = editor;
3730
3840
  const idPropsCreator = () => ({ [idKey]: idCreator() });
3731
3841
  editor.removedIDs = new Set();
3732
3842
  editor.apply = (operation) => {
3733
3843
  if (operation.type === 'insert_node') {
3734
3844
  const newFilter = (entry) => {
3735
3845
  const [_node] = entry;
3736
- return filter(entry) && filterText ? Element$1.isElement(_node) : TheQueries.isDescendant(_node);
3846
+ return filter(entry) && filterText ? Element$1.isElement(_node) : isDescendant(_node);
3737
3847
  };
3738
3848
  // fix can not find path by orign node
3739
3849
  let node = operation.node;
@@ -3741,7 +3851,7 @@ const withNodeID = ({ idKey = 'id', idCreator = () => Date.now(), filterText = t
3741
3851
  node = _.cloneDeep(node);
3742
3852
  }
3743
3853
  // it will not overwrite ids once it's set as it's read-only
3744
- TheTransforms.mergeDeepToNodes({
3854
+ mergeDeepToNodes({
3745
3855
  node,
3746
3856
  source: idPropsCreator,
3747
3857
  query: {
@@ -3765,6 +3875,10 @@ const withNodeID = ({ idKey = 'id', idCreator = () => Date.now(), filterText = t
3765
3875
  }
3766
3876
  return apply(operation);
3767
3877
  };
3878
+ editor.getFragment = () => {
3879
+ const fragment = _.cloneDeep(getFragment());
3880
+ return deleteElementKey(fragment, idKey);
3881
+ };
3768
3882
  return editor;
3769
3883
  };
3770
3884
 
@@ -3787,14 +3901,14 @@ const autoFormatInline = (editor, { type, between, markup, ignoreTrim }) => {
3787
3901
  const endMarkup = between ? between[1] : '';
3788
3902
  let endMarkupPointBefore = selection.anchor;
3789
3903
  if (endMarkup) {
3790
- endMarkupPointBefore = TheQueries.getPointBefore(editor, selection, {
3904
+ endMarkupPointBefore = getPointBefore(editor, selection, {
3791
3905
  matchString: endMarkup
3792
3906
  });
3793
3907
  if (!endMarkupPointBefore) {
3794
3908
  return false;
3795
3909
  }
3796
3910
  }
3797
- const startMarkupPointAfter = TheQueries.getPointBefore(editor, endMarkupPointBefore, {
3911
+ const startMarkupPointAfter = getPointBefore(editor, endMarkupPointBefore, {
3798
3912
  matchString: startMarkup,
3799
3913
  skipInvalid: true,
3800
3914
  afterMatch: true
@@ -3808,14 +3922,14 @@ const autoFormatInline = (editor, { type, between, markup, ignoreTrim }) => {
3808
3922
  focus: endMarkupPointBefore
3809
3923
  };
3810
3924
  if (!ignoreTrim) {
3811
- const markupText = TheQueries.getText(editor, markupRange);
3925
+ const markupText = getText(editor, markupRange);
3812
3926
  if (markupText.trim() !== markupText) {
3813
3927
  return false;
3814
3928
  }
3815
3929
  }
3816
3930
  // delete end markup
3817
3931
  if (endMarkup) {
3818
- endMarkupPointBefore = TheQueries.getPointBefore(editor, selection, {
3932
+ endMarkupPointBefore = getPointBefore(editor, selection, {
3819
3933
  matchString: endMarkup
3820
3934
  });
3821
3935
  Transforms.delete(editor, {
@@ -3831,7 +3945,7 @@ const autoFormatInline = (editor, { type, between, markup, ignoreTrim }) => {
3831
3945
  Transforms.collapse(editor, { edge: 'end' });
3832
3946
  editor.removeMark(type, false);
3833
3947
  // delete start markup
3834
- const startMarkupPointBefore = TheQueries.getPointBefore(editor, selection, {
3948
+ const startMarkupPointBefore = getPointBefore(editor, selection, {
3835
3949
  matchString: startMarkup,
3836
3950
  skipInvalid: true
3837
3951
  });
@@ -3848,7 +3962,7 @@ const withAutoFormat = ({ rules }) => (editor) => {
3848
3962
  const { insertText } = editor;
3849
3963
  editor.insertText = text => {
3850
3964
  var _a;
3851
- if (!TheQueries.isCollapsed(editor.selection)) {
3965
+ if (!isCollapsed(editor.selection)) {
3852
3966
  return insertText(text);
3853
3967
  }
3854
3968
  for (let _b of rules) {
@@ -3865,15 +3979,15 @@ const withAutoFormat = ({ rules }) => (editor) => {
3865
3979
  let markups = castArray(markup);
3866
3980
  let markupRange;
3867
3981
  if (triggerAtBlockStart) {
3868
- markupRange = TheQueries.getRangeFromBlockStart(editor);
3982
+ markupRange = getRangeFromBlockStart(editor);
3869
3983
  // Don't autoformat if there is void nodes.
3870
- const hasVoidNode = TheQueries.someNode(editor, {
3984
+ const hasVoidNode = someNode(editor, {
3871
3985
  at: markupRange,
3872
3986
  match: n => Editor.isVoid(editor, n)
3873
3987
  });
3874
3988
  if (hasVoidNode)
3875
3989
  continue;
3876
- const textFromBlockStart = TheQueries.getText(editor, markupRange);
3990
+ const textFromBlockStart = getText(editor, markupRange);
3877
3991
  if (match) {
3878
3992
  markups = match(editor, textFromBlockStart);
3879
3993
  }
@@ -3881,13 +3995,13 @@ const withAutoFormat = ({ rules }) => (editor) => {
3881
3995
  continue;
3882
3996
  }
3883
3997
  else {
3884
- markupRange = TheQueries.getRangeBefore(editor, editor.selection, {
3998
+ markupRange = getRangeBefore(editor, editor.selection, {
3885
3999
  matchString: markup,
3886
4000
  skipInvalid: true
3887
4001
  });
3888
4002
  if (!markupRange)
3889
4003
  continue;
3890
- const blockAbovePath = (_a = TheQueries.getBlockAbove(editor)) === null || _a === void 0 ? void 0 : _a[1];
4004
+ const blockAbovePath = (_a = getBlockAbove(editor)) === null || _a === void 0 ? void 0 : _a[1];
3891
4005
  if (!blockAbovePath)
3892
4006
  continue;
3893
4007
  // If the markup is not at the start, insert break before autoformatting.
@@ -3897,7 +4011,7 @@ const withAutoFormat = ({ rules }) => (editor) => {
3897
4011
  }
3898
4012
  if (!allowSameTypeAbove) {
3899
4013
  // Don't autoformat if already in a block of the same type.
3900
- const isBelowSameBlockType = TheQueries.someNode(editor, { match: { type } });
4014
+ const isBelowSameBlockType = someNode(editor, { match: { type } });
3901
4015
  if (isBelowSameBlockType)
3902
4016
  continue;
3903
4017
  }
@@ -3941,9 +4055,9 @@ const withTrailingNode = (_a = {}) => {
3941
4055
  const { normalizeNode } = editor;
3942
4056
  editor.normalizeNode = ([currentNode, currentPath]) => {
3943
4057
  if (!currentPath.length) {
3944
- const entry = TheQueries.getLastNode(editor, level);
4058
+ const entry = getLastNode(editor, level);
3945
4059
  const [lastNode, lastPath] = entry;
3946
- if (Element$1.isElement(lastNode) && lastNode.type !== type && TheQueries.isNodeType(entry, query)) {
4060
+ if (Element$1.isElement(lastNode) && lastNode.type !== type && isNodeType(entry, query)) {
3947
4061
  editor.insertNodes({
3948
4062
  type,
3949
4063
  children: [{ text: '' }]
@@ -3965,7 +4079,7 @@ const withBlockCard = (editor) => {
3965
4079
  const isLeftCursor = isCardLeft(anchorNode);
3966
4080
  const cardEntry = AngularEditor.toSlateCardEntry(editor, anchorNode);
3967
4081
  const cursorRootPath = cardEntry[1];
3968
- TheTransforms.insertParagraph(editor, isLeftCursor ? cursorRootPath : Path.next(cursorRootPath));
4082
+ insertParagraph(editor, isLeftCursor ? cursorRootPath : Path.next(cursorRootPath));
3969
4083
  if (!isLeftCursor) {
3970
4084
  Transforms.select(editor, Path.next(cursorRootPath));
3971
4085
  }
@@ -3985,7 +4099,7 @@ const withBlockCard = (editor) => {
3985
4099
  if (!previousPath) {
3986
4100
  return;
3987
4101
  }
3988
- if (previousPath && TheQueries.isEmptyParagraphByPath(editor, previousPath)) {
4102
+ if (previousPath && isEmptyParagraphByPath(editor, previousPath)) {
3989
4103
  Transforms.removeNodes(editor, {
3990
4104
  at: previousPath
3991
4105
  });
@@ -3997,18 +4111,22 @@ const withBlockCard = (editor) => {
3997
4111
  return;
3998
4112
  }
3999
4113
  else {
4000
- TheTransforms.insertParagraph(editor, cursorRootPath);
4114
+ insertParagraph(editor, cursorRootPath);
4001
4115
  Transforms.select(editor, cursorRootPath);
4002
4116
  Transforms.removeNodes(editor, { at: Path.next(cursorRootPath) });
4003
4117
  return;
4004
4118
  }
4005
4119
  }
4006
- const blockCard = TheQueries.getBlockCardAbove(editor);
4120
+ const blockCard = getBlockCardAbove(editor);
4007
4121
  const beforePoint = Editor.before(editor, editor.selection.anchor);
4008
- const beforeBlockCard = TheQueries.getBlockCardAbove(editor, { at: beforePoint });
4122
+ const beforeBlockCard = getBlockCardAbove(editor, { at: beforePoint });
4009
4123
  if (!blockCard && beforeBlockCard) {
4010
- if (TheQueries.isBlockAboveEmpty(editor)) {
4124
+ if (isBlockAboveEmpty(editor)) {
4011
4125
  const [node, path] = Editor.parent(editor, editor.selection.anchor.path);
4126
+ HistoryEditor.withoutMerging(editor, () => {
4127
+ const rightCursor = { path: beforeBlockCard[1], offset: FAKE_RIGHT_BLOCK_CARD_OFFSET };
4128
+ Transforms.select(editor, { anchor: rightCursor, focus: rightCursor });
4129
+ });
4012
4130
  Transforms.delete(editor, { at: path });
4013
4131
  return;
4014
4132
  }
@@ -4027,7 +4145,7 @@ const withBlockCard = (editor) => {
4027
4145
  const cardEntry = AngularEditor.toSlateCardEntry(editor, anchorNode);
4028
4146
  const cursorRootPath = cardEntry[1];
4029
4147
  if (isLeftCursor) {
4030
- TheTransforms.insertParagraph(editor, cursorRootPath);
4148
+ insertParagraph(editor, cursorRootPath);
4031
4149
  Transforms.select(editor, cursorRootPath);
4032
4150
  Transforms.removeNodes(editor, { at: Path.next(cursorRootPath) });
4033
4151
  return;
@@ -4040,11 +4158,11 @@ const withBlockCard = (editor) => {
4040
4158
  return;
4041
4159
  }
4042
4160
  }
4043
- const blockCard = TheQueries.getBlockCardAbove(editor);
4161
+ const blockCard = getBlockCardAbove(editor);
4044
4162
  const afterPoint = Editor.after(editor, editor.selection.anchor);
4045
- const afterBlockCard = TheQueries.getBlockCardAbove(editor, { at: afterPoint });
4163
+ const afterBlockCard = getBlockCardAbove(editor, { at: afterPoint });
4046
4164
  if (!blockCard && afterBlockCard) {
4047
- if (TheQueries.isBlockAboveEmpty(editor)) {
4165
+ if (isBlockAboveEmpty(editor)) {
4048
4166
  HistoryEditor.withoutMerging(editor, () => {
4049
4167
  const leftCursor = { path: afterBlockCard[1], offset: -1 };
4050
4168
  Transforms.select(editor, { anchor: leftCursor, focus: leftCursor });
@@ -4066,7 +4184,7 @@ const withBlockCard = (editor) => {
4066
4184
  const isMoveUp = hotkeys.isMoveUp(nativeEvent);
4067
4185
  const isMoveDown = hotkeys.isMoveDown(nativeEvent);
4068
4186
  const isCollapsed = selection && Range.isCollapsed(selection);
4069
- const anchorEntry = TheQueries.anchorBlockEntry(editor);
4187
+ const anchorEntry = anchorBlockEntry(editor);
4070
4188
  // block card cursor
4071
4189
  if (anchorNode && hasBlockCard(domSelection)) {
4072
4190
  const isCardLeftCursor = isCardLeft(anchorNode);
@@ -4207,7 +4325,7 @@ const withMoveSelection = (editor) => {
4207
4325
  // fix deleteBackward on the start of inline block
4208
4326
  // deleteBackward logic bug
4209
4327
  if (inlineBlockEntry && !Editor.isVoid(editor, inlineBlockEntry[0]) && selection.anchor.offset === 0) {
4210
- const beforePoint = TheQueries.getPointBefore(editor, selection.focus);
4328
+ const beforePoint = getPointBefore(editor, selection.focus);
4211
4329
  Transforms.select(editor, beforePoint);
4212
4330
  }
4213
4331
  deleteBackward(unit);
@@ -4219,11 +4337,11 @@ const withGetFragment = (elementKinds = []) => (editor) => {
4219
4337
  const { getFragment } = editor;
4220
4338
  editor.getFragment = () => {
4221
4339
  const { selection } = editor;
4222
- const containerBlocks = [...elementKinds, ...TheQueries.getContainerBlocks(editor)];
4340
+ const containerBlocks = [...elementKinds, ...getContainerBlocks(editor)];
4223
4341
  if (selection && selection.anchor.path[0] === selection.focus.path[0]) {
4224
- const fragmentData = Node.fragment(editor, selection);
4225
- const nodes = TheQueries.getSelectionNodesByType(editor, fragmentData, containerBlocks);
4226
- return nodes && Element$1.isElement(nodes) ? nodes.children : getFragment();
4342
+ const fragmentData = getFragment();
4343
+ const nodes = getSelectionNodesByType(editor, fragmentData, containerBlocks);
4344
+ return nodes && Element$1.isElement(nodes) ? nodes.children : fragmentData;
4227
4345
  }
4228
4346
  return getFragment();
4229
4347
  };
@@ -4780,7 +4898,7 @@ function insertTable(opts, editor, columns = 3, rows = 3, getCellContent) {
4780
4898
  }
4781
4899
  // Create the table node
4782
4900
  const table = createTable(opts, columns, rows, getCellContent);
4783
- TheEditor.insertElement(editor, table);
4901
+ insertElement(editor, table);
4784
4902
  }
4785
4903
 
4786
4904
  /**
@@ -5096,7 +5214,7 @@ const TableEditor = {
5096
5214
  MarkProps.forEach(key => {
5097
5215
  unsetMarks[key] = null;
5098
5216
  });
5099
- TheEditor.setMarks(editor, unsetMarks, cellRange);
5217
+ setMarks(editor, unsetMarks, cellRange);
5100
5218
  });
5101
5219
  },
5102
5220
  handleSelectedCells(editor, handle) {
@@ -5123,7 +5241,11 @@ const TableEditor = {
5123
5241
 
5124
5242
  const MarkEditor = {
5125
5243
  isMarkActive(editor, format) {
5126
- const node = Node.get(editor, editor.selection.anchor.path);
5244
+ var _a, _b;
5245
+ if (!(editor === null || editor === void 0 ? void 0 : editor.selection)) {
5246
+ return;
5247
+ }
5248
+ const node = Node.get(editor, (_b = (_a = editor === null || editor === void 0 ? void 0 : editor.selection) === null || _a === void 0 ? void 0 : _a.anchor) === null || _b === void 0 ? void 0 : _b.path);
5127
5249
  if (!Text.isText(node)) {
5128
5250
  return false;
5129
5251
  }
@@ -5211,7 +5333,7 @@ const ImageOptions = [
5211
5333
 
5212
5334
  const HrEditor = {
5213
5335
  insertHr(editor) {
5214
- TheTransforms.insertElement(editor, { type: ElementKinds.hr, children: [{ text: '' }] });
5336
+ insertElement(editor, { type: ElementKinds.hr, children: [{ text: '' }] });
5215
5337
  }
5216
5338
  };
5217
5339
 
@@ -5220,7 +5342,7 @@ const HrOptions = [
5220
5342
  key: ElementKinds.hr,
5221
5343
  icon: 'horizontal-line',
5222
5344
  name: '分割线',
5223
- active: editor => TheQueries.isBlockActive(editor, ElementKinds.hr),
5345
+ active: editor => isBlockActive(editor, ElementKinds.hr),
5224
5346
  execute: editor => HrEditor.insertHr(editor)
5225
5347
  }
5226
5348
  ];
@@ -5259,7 +5381,7 @@ const HeadingOptions = [
5259
5381
  name: '正文',
5260
5382
  styles: { height: '40px' },
5261
5383
  execute: editor => Transforms.setNodes(editor, { type: ElementKinds.paragraph }),
5262
- active: editor => TheQueries.isParagraph(editor)
5384
+ active: editor => isParagraph(editor)
5263
5385
  },
5264
5386
  {
5265
5387
  key: ElementKinds.heading_1,
@@ -5300,18 +5422,21 @@ const BlockquoteOptions = [
5300
5422
  key: ElementKinds.blockquote,
5301
5423
  icon: 'blockquote',
5302
5424
  name: '引用',
5303
- active: editor => TheQueries.isBlockActive(editor, ElementKinds.blockquote),
5425
+ active: editor => isBlockActive(editor, ElementKinds.blockquote),
5304
5426
  execute: editor => BlockquoteEditor.toggleBlockquote(editor)
5305
5427
  }
5306
5428
  ];
5307
5429
 
5308
5430
  const AlignEditor = {
5309
5431
  isActive(editor, alignment) {
5432
+ if (!(editor === null || editor === void 0 ? void 0 : editor.selection)) {
5433
+ return;
5434
+ }
5310
5435
  const tableCellAlign = TableEditor.isAlignActive(editor, alignment);
5311
5436
  if (tableCellAlign !== null) {
5312
5437
  return tableCellAlign;
5313
5438
  }
5314
- const blockElement = TheQueries.anchorBlock(editor);
5439
+ const blockElement = anchorBlock(editor);
5315
5440
  if (blockElement) {
5316
5441
  const { align } = blockElement;
5317
5442
  if (!align && alignment === Alignment.left) {
@@ -5401,39 +5526,21 @@ const withBlockquote = (editor) => {
5401
5526
  if (!aboveResult) {
5402
5527
  return deleteBackward(unit);
5403
5528
  }
5404
- const highestBlock = aboveResult[0];
5405
- const lowestBlock = TheQueries.anchorBlock(editor);
5406
- const wrapBlockType = highestBlock.type;
5407
- if (lowestBlock && Editor.isStart(editor, editor.selection.anchor, aboveResult[1])) {
5408
- if (wrapBlockType === ElementKinds.blockquote) {
5409
- if (highestBlock.children[0] === lowestBlock) {
5410
- return TheTransforms.unWrap(editor, wrapBlockType);
5411
- }
5412
- }
5529
+ const hasHandled = handleContinualDeleteBackward(editor, aboveResult, ElementKinds.blockquote);
5530
+ if (hasHandled) {
5531
+ return;
5413
5532
  }
5414
- deleteBackward(unit);
5533
+ return deleteBackward(unit);
5415
5534
  };
5416
5535
  editor.insertBreak = () => {
5417
- const lowestBlock = TheQueries.anchorBlock(editor);
5536
+ const lowestBlock = anchorBlock(editor);
5418
5537
  if (!lowestBlock) {
5419
5538
  insertBreak();
5420
5539
  return;
5421
5540
  }
5422
- const isEmpty = Editor.isEmpty(editor, lowestBlock);
5423
- const isEnd = Editor.isEnd(editor, editor.selection.anchor, editor.selection.focus.path);
5424
- const aboveResult = Editor.above(editor, {
5425
- match: n => Editor.isBlock(editor, n) && n.type === ElementKinds.blockquote
5426
- });
5427
- if (isEnd) {
5428
- editor.marks = {};
5429
- }
5430
- if (aboveResult && aboveResult[0] && isEnd && isEmpty) {
5431
- const wrapBlock = aboveResult[0];
5432
- if (wrapBlock.type === ElementKinds.blockquote) {
5433
- if (wrapBlock.children[wrapBlock.children.length - 1] === lowestBlock) {
5434
- return TheTransforms.unWrap(editor, wrapBlock.type);
5435
- }
5436
- }
5541
+ const hasHandled = handleContinualInsertBreak(editor, lowestBlock, ElementKinds.blockquote);
5542
+ if (hasHandled) {
5543
+ return;
5437
5544
  }
5438
5545
  const voidEntry = Editor.above(editor, {
5439
5546
  match: n => Editor.isBlock(editor, n) && Editor.isVoid(editor, n)
@@ -5442,7 +5549,7 @@ const withBlockquote = (editor) => {
5442
5549
  Transforms.insertNodes(editor, createEmptyParagraph());
5443
5550
  return;
5444
5551
  }
5445
- insertBreak();
5552
+ return insertBreak();
5446
5553
  };
5447
5554
  editor.isContainer = (element) => {
5448
5555
  return element.type === ElementKinds.blockquote ? true : isContainer(element);
@@ -5558,6 +5665,7 @@ class TheColorSelectComponent {
5558
5665
  }
5559
5666
  }
5560
5667
  _selectColor(event, color) {
5668
+ event.preventDefault();
5561
5669
  event.stopPropagation();
5562
5670
  if (this.option.specialColor && color === this.option.specialColor) {
5563
5671
  color = '';
@@ -5588,7 +5696,7 @@ class TheColorSelectComponent {
5588
5696
  }
5589
5697
  }
5590
5698
  TheColorSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheColorSelectComponent, deps: [{ token: i1$3.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component });
5591
- TheColorSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheColorSelectComponent, selector: "the-color-select", inputs: { selectedColor: "selectedColor", selectAction: "selectAction", showCustom: "showCustom", colors: "colors", option: "option" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)", "mousedown": "handleMouseDown($event)", "keydown": "handleKeydown($event)" } }, ngImport: i0, template: "<div class=\"color-container\">\n <div class=\"colors\">\n <div *ngFor=\"let row of selectColors; let rowIndex = index\">\n <span\n class=\"color-item\"\n *ngFor=\"let _color of row.rowValue; let i = index\"\n [ngClass]=\"_color.classMaps\"\n (mousedown)=\"_selectColor($event, _color.value)\"\n >\n <span [ngStyle]=\"{ background: _color.value }\">\n <thy-icon\n thyIconName=\"check\"\n [ngStyle]=\"{ color: row.tickColor }\"\n ></thy-icon>\n </span>\n </span>\n </div>\n </div>\n <div\n *ngIf=\"option.showCustom\"\n class=\"select-color\"\n >\n <span\n class=\"color\"\n [ngStyle]=\"{ background: selectedColor }\"\n ></span>\n #\n <input\n thyInput\n maxlength=\"6\"\n (keydown.enter)=\"customInputColorEnter($event)\"\n onkeyup=\"value=value.replace(/[^0-9A-Fa-f]/g,'')\"\n class=\"value\"\n [(ngModel)]=\"customColor\"\n (ngModelChange)=\"colorChange(false)\"\n />\n </div>\n</div>\n", components: [{ type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5.ThyInputDirective, selector: "[thyInput]", inputs: ["thySize", "thyAutocomplete"] }, { type: i4$2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
5699
+ TheColorSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheColorSelectComponent, selector: "the-color-select", inputs: { selectedColor: "selectedColor", selectAction: "selectAction", showCustom: "showCustom", colors: "colors", option: "option" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)", "mousedown": "handleMouseDown($event)", "keydown": "handleKeydown($event)" } }, ngImport: i0, template: "<div class=\"color-container\">\n <div class=\"colors\">\n <div *ngFor=\"let row of selectColors; let rowIndex = index\">\n <span\n class=\"color-item\"\n *ngFor=\"let _color of row.rowValue; let i = index\"\n [ngClass]=\"_color.classMaps\"\n (mousedown)=\"_selectColor($event, _color.value)\"\n >\n <span [ngStyle]=\"{ background: _color.value }\">\n <thy-icon thyIconName=\"check\" [ngStyle]=\"{ color: row.tickColor }\"></thy-icon>\n </span>\n </span>\n </div>\n </div>\n <div *ngIf=\"option.showCustom\" class=\"select-color\">\n <span class=\"color\" [ngStyle]=\"{ background: selectedColor }\"></span>\n #\n <input\n thyInput\n maxlength=\"6\"\n (keydown.enter)=\"customInputColorEnter($event)\"\n onkeyup=\"value=value.replace(/[^0-9A-Fa-f]/g,'')\"\n class=\"value\"\n [(ngModel)]=\"customColor\"\n (ngModelChange)=\"colorChange(false)\"\n />\n </div>\n</div>\n", components: [{ type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5.ThyInputDirective, selector: "[thyInput]", inputs: ["thySize", "thyAutocomplete"] }, { type: i4$2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
5592
5700
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheColorSelectComponent, decorators: [{
5593
5701
  type: Component,
5594
5702
  args: [{
@@ -5665,6 +5773,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
5665
5773
  const ColorEditor = {
5666
5774
  getActiveColor(editor, type) {
5667
5775
  var _a;
5776
+ if (!(editor === null || editor === void 0 ? void 0 : editor.selection)) {
5777
+ return;
5778
+ }
5668
5779
  const node = Node.get(editor, (_a = editor.selection) === null || _a === void 0 ? void 0 : _a.anchor.path);
5669
5780
  if (!Text.isText(node)) {
5670
5781
  return undefined;
@@ -5701,10 +5812,11 @@ const ColorEditor = {
5701
5812
 
5702
5813
  class TheToolbarBaseItemComponent {
5703
5814
  execute(event) {
5815
+ var _a;
5704
5816
  event.preventDefault();
5705
5817
  event.stopPropagation();
5706
- if (!this.itemMousedownHandle && !this.editor.selection) {
5707
- const lastNode = TheQueries.getLastNode(this.editor, 1);
5818
+ if (!this.itemMousedownHandle && !((_a = this.editor) === null || _a === void 0 ? void 0 : _a.selection)) {
5819
+ const lastNode = getLastNode(this.editor, 1);
5708
5820
  const end = Editor.end(this.editor, lastNode[1]);
5709
5821
  Transforms.select(this.editor, end);
5710
5822
  AngularEditor.focus(this.editor);
@@ -5798,7 +5910,7 @@ TheColorToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12
5798
5910
  thyIconName="caret-down"
5799
5911
  ></thy-icon>
5800
5912
  </a>
5801
- `, 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.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i5$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
5913
+ `, 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.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
5802
5914
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheColorToolbarItemComponent, decorators: [{
5803
5915
  type: Component,
5804
5916
  args: [{
@@ -5856,7 +5968,7 @@ const ColorOptions = [
5856
5968
  const withRemoveVoid = (editor) => {
5857
5969
  const { deleteBackward, deleteForward, onKeydown } = editor;
5858
5970
  const deleteBlockVoid = (e) => {
5859
- const aboveEntry = TheQueries.getAbove(e);
5971
+ const aboveEntry = getAbove(e);
5860
5972
  const canDelete = aboveEntry && Editor.isBlock(e, aboveEntry[0]) && Editor.isVoid(e, aboveEntry[0]);
5861
5973
  if (canDelete) {
5862
5974
  Transforms.insertNodes(e, createEmptyParagraph(), { at: Path.next(aboveEntry[1]) });
@@ -5872,7 +5984,7 @@ const withRemoveVoid = (editor) => {
5872
5984
  deleteBackward(unit);
5873
5985
  };
5874
5986
  editor.onKeydown = event => {
5875
- const aboveEntry = TheQueries.getAbove(editor);
5987
+ const aboveEntry = getAbove(editor);
5876
5988
  if (aboveEntry && Editor.isVoid(editor, aboveEntry[0]) && Editor.isInline(editor, aboveEntry[0])) {
5877
5989
  if (hotkeys.isDeleteBackward(event) || hotkeys.isDeleteForward(event)) {
5878
5990
  event.preventDefault();
@@ -5954,7 +6066,7 @@ const CodeEditor = {
5954
6066
  language: DEFAULT_LANGUAGE.value,
5955
6067
  children: [{ text: '' }]
5956
6068
  };
5957
- TheTransforms.insertElement(editor, codeElement);
6069
+ insertElement(editor, codeElement);
5958
6070
  }
5959
6071
  }
5960
6072
  };
@@ -5964,7 +6076,7 @@ const CodeOptions = [
5964
6076
  key: ElementKinds.code,
5965
6077
  icon: 'code-syntax',
5966
6078
  name: '代码块',
5967
- active: editor => TheQueries.isBlockActive(editor, ElementKinds.code),
6079
+ active: editor => isBlockActive(editor, ElementKinds.code),
5968
6080
  execute: editor => CodeEditor.insertCode(editor)
5969
6081
  }
5970
6082
  ];
@@ -6074,7 +6186,7 @@ class TheToolbarDropdownComponent extends TheToolbarBaseItemComponent {
6074
6186
  }
6075
6187
  }
6076
6188
  TheToolbarDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarDropdownComponent, deps: [{ token: i0.ElementRef }, { token: i1$3.ThyPopover }, { token: i0.ViewContainerRef }, { token: i2$1.Overlay }], target: i0.ɵɵFactoryTarget.Component });
6077
- TheToolbarDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: { toolbarItem: "toolbarItem", menus: "menus", mode: "mode", item: "item", itemMousedownHandle: "itemMousedownHandle" }, host: { listeners: { "mousedown": "toggleDropdown($event)", "document: mousedown": "handleDocumentMouseDown($event)" }, classAttribute: "the-toolbar-dropdown-container" }, viewQueries: [{ propertyName: "iconModeTemplate", first: true, predicate: ["iconModeTemplate"], descendants: true, static: true }, { propertyName: "textModeTemplate", first: true, predicate: ["textModeTemplate"], descendants: true, static: true }, { propertyName: "dropdownTemplate", first: true, predicate: ["dropdownTemplate"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n\n<ng-template #iconModeTemplate>\n <a thyIconNavLink class=\"icon-mode link-with-down\" [thyTooltip]=\"activeMenu?.name\" thyTooltipPlacement=\"top\">\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n </a>\n</ng-template>\n\n<ng-template #textModeTemplate>\n <a thyIconNavLink class=\"text-mode\" [thyTooltip]=\"activeMenu?.name\" thyTooltipPlacement=\"top\">\n <span class=\"show-text\">{{ activeMenu?.name }}</span>\n <thy-icon class=\"text-caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n </a>\n</ng-template>\n\n<ng-template #dropdownTemplate>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let menu of menus\">\n <a\n *ngIf=\"menu.key !== 'split'\"\n thyActionMenuItem\n href=\"javascript:;\"\n [thyActionMenuItemActive]=\"menu.key === activeMenu.key\"\n (mousedown)=\"itemMousedown($event, menu)\"\n [ngStyle]=\"menu?.styles\"\n >\n <span *ngIf=\"menu.icon && mode === dropdownMode.icon\" thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu.icon\"></thy-icon>\n </span>\n <span *ngIf=\"menu.name\" thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n <thy-action-menu-divider *ngIf=\"menu.key === 'split'\"></thy-action-menu-divider>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5$2.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }, { type: i5$2.ThyActionMenuDividerComponent, selector: "thy-action-menu-divider", inputs: ["thyTitle", "thyType"] }], directives: [{ type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i5$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$2.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5$2.ThyActionMenuItemActiveDirective, selector: "[thyActionMenuItemActive]", inputs: ["thyActionMenuItemActive"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i5$2.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5$2.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
6189
+ TheToolbarDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: { toolbarItem: "toolbarItem", menus: "menus", mode: "mode", item: "item", itemMousedownHandle: "itemMousedownHandle" }, host: { listeners: { "mousedown": "toggleDropdown($event)", "document: mousedown": "handleDocumentMouseDown($event)" }, classAttribute: "the-toolbar-dropdown-container" }, viewQueries: [{ propertyName: "iconModeTemplate", first: true, predicate: ["iconModeTemplate"], descendants: true, static: true }, { propertyName: "textModeTemplate", first: true, predicate: ["textModeTemplate"], descendants: true, static: true }, { propertyName: "dropdownTemplate", first: true, predicate: ["dropdownTemplate"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n\n<ng-template #iconModeTemplate>\n <a thyIconNavLink class=\"icon-mode link-with-down\" [thyTooltip]=\"activeMenu?.name\" thyTooltipPlacement=\"top\">\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n </a>\n</ng-template>\n\n<ng-template #textModeTemplate>\n <a thyIconNavLink class=\"text-mode\" [thyTooltip]=\"activeMenu?.name\" thyTooltipPlacement=\"top\">\n <span class=\"show-text\">{{ activeMenu?.name }}</span>\n <thy-icon class=\"text-caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n </a>\n</ng-template>\n\n<ng-template #dropdownTemplate>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let menu of menus\">\n <a\n *ngIf=\"menu.key !== 'split'\"\n thyActionMenuItem\n href=\"javascript:;\"\n [thyActionMenuItemActive]=\"menu.key === activeMenu.key\"\n (mousedown)=\"itemMousedown($event, menu)\"\n [ngStyle]=\"menu?.styles\"\n >\n <span *ngIf=\"menu.icon && mode === dropdownMode.icon\" thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu.icon\"></thy-icon>\n </span>\n <span *ngIf=\"menu.name\" thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n <thy-action-menu-divider *ngIf=\"menu.key === 'split'\"></thy-action-menu-divider>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5$1.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }, { type: i5$1.ThyActionMenuDividerComponent, selector: "thy-action-menu-divider", inputs: ["thyTitle", "thyType"] }], directives: [{ type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5$1.ThyActionMenuItemActiveDirective, selector: "[thyActionMenuItemActive]", inputs: ["thyActionMenuItemActive"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i5$1.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5$1.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
6078
6190
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarDropdownComponent, decorators: [{
6079
6191
  type: Component,
6080
6192
  args: [{
@@ -6112,15 +6224,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
6112
6224
  }] } });
6113
6225
 
6114
6226
  class TheCodeComponent extends TheBaseElementComponent {
6115
- constructor(elementRef, cdr, thyNotifyService, ngZone) {
6227
+ constructor(elementRef, cdr, thyNotifyService, ngZone, mode) {
6116
6228
  super(elementRef, cdr);
6117
6229
  this.elementRef = elementRef;
6118
6230
  this.cdr = cdr;
6119
6231
  this.thyNotifyService = thyNotifyService;
6120
6232
  this.ngZone = ngZone;
6233
+ this.mode = mode;
6121
6234
  this.startRenderCodemirror = false;
6122
6235
  this.dropdownMode = DropdownMode;
6123
- this.maxHeight = 350 - CODEMIRROR_PADDING_TOP * 2;
6236
+ this.maxHeight = this.mode === CodeMode.default ? 350 - CODEMIRROR_PADDING_TOP * 2 : 0;
6124
6237
  this.codeMirrorFocused = false;
6125
6238
  this.menus = CODE_MODES.map(item => {
6126
6239
  return { key: item.value, name: item.showName };
@@ -6131,7 +6244,7 @@ class TheCodeComponent extends TheBaseElementComponent {
6131
6244
  readOnly: false,
6132
6245
  autofocus: false,
6133
6246
  lineWiseCopyCut: true,
6134
- lineWrapping: false,
6247
+ lineWrapping: this.mode === CodeMode.default ? false : true,
6135
6248
  cursorBlinkRate: 500
6136
6249
  };
6137
6250
  this.actives = this.menus[0];
@@ -6200,7 +6313,7 @@ class TheCodeComponent extends TheBaseElementComponent {
6200
6313
  }
6201
6314
  onDelete(event) {
6202
6315
  event.preventDefault();
6203
- TheTransforms.deleteElement(this.editor, this.element);
6316
+ deleteElement(this.editor, this.element);
6204
6317
  }
6205
6318
  onCopy(event) {
6206
6319
  event.preventDefault();
@@ -6229,8 +6342,8 @@ class TheCodeComponent extends TheBaseElementComponent {
6229
6342
  this.options = Object.assign(Object.assign({}, this.options), { readOnly: this.readonly, cursorBlinkRate: this.readonly ? -1 : 500 });
6230
6343
  }
6231
6344
  }
6232
- TheCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheCodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$4.ThyNotifyService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
6233
- TheCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheCodeComponent, selector: "div[theCode]", viewQueries: [{ propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: CodeMirrorComponent }], usesInheritance: true, ngImport: i0, template: "<div contenteditable=\"false\" class=\"the-block-operation\" *ngIf=\"codeMirrorFocused && !options.readOnly\">\n <thy-icon-nav>\n <the-toolbar-dropdown [menus]=\"menus\" [item]=\"actives\" [itemMousedownHandle]=\"onChangeLangulage\"></the-toolbar-dropdown>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"copy\"\n thyTooltip=\"\u590D\u5236\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onCopy($event)\"\n ></a>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"trash\"\n thyTooltip=\"\u5220\u9664\"\n class=\"remove-link\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onDelete($event)\"\n ></a>\n </thy-icon-nav>\n</div>\n\n<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n<ng-codemirror\n *ngIf=\"startRenderCodemirror\"\n #codemirror\n contenteditable=\"false\"\n class=\"ng-codemirror-wrapper\"\n [ngStyle]=\"{ maxHeight: maxHeight > 0 ? maxHeight + 'px' : 'auto' }\"\n [options]=\"options\"\n [ngModel]=\"code\"\n [delayRefreshTime]=\"300\"\n (ngModelChange)=\"codeChange($event)\"\n (focusChange)=\"focusChange($event)\"\n [autoMaxHeight]=\"maxHeight\"\n></ng-codemirror>\n", components: [{ type: i2.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: ["toolbarItem", "menus", "mode", "item", "itemMousedownHandle"] }, { type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i5$3.CodeMirrorComponent, selector: "ng-codemirror, [ngCodeMirror]", inputs: ["autoMaxHeight", "delayRefreshTime", "options"], outputs: ["focusChange"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
6345
+ TheCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheCodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$4.ThyNotifyService }, { token: i0.NgZone }, { token: THE_CODE_MODE_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
6346
+ TheCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheCodeComponent, selector: "div[theCode]", viewQueries: [{ propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: CodeMirrorComponent }], usesInheritance: true, ngImport: i0, template: "<div contenteditable=\"false\" class=\"the-block-operation\" *ngIf=\"codeMirrorFocused && !options.readOnly\">\n <thy-icon-nav>\n <the-toolbar-dropdown [menus]=\"menus\" [item]=\"actives\" [itemMousedownHandle]=\"onChangeLangulage\"></the-toolbar-dropdown>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"copy\"\n thyTooltip=\"\u590D\u5236\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onCopy($event)\"\n ></a>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"trash\"\n thyTooltip=\"\u5220\u9664\"\n class=\"remove-link\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onDelete($event)\"\n ></a>\n </thy-icon-nav>\n</div>\n\n<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n<ng-codemirror\n *ngIf=\"startRenderCodemirror\"\n #codemirror\n contenteditable=\"false\"\n class=\"ng-codemirror-wrapper\"\n [ngStyle]=\"{ maxHeight: maxHeight > 0 ? maxHeight + 'px' : 'auto' }\"\n [options]=\"options\"\n [ngModel]=\"code\"\n [delayRefreshTime]=\"300\"\n (ngModelChange)=\"codeChange($event)\"\n (focusChange)=\"focusChange($event)\"\n [autoMaxHeight]=\"maxHeight\"\n></ng-codemirror>\n", components: [{ type: i2.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: ["toolbarItem", "menus", "mode", "item", "itemMousedownHandle"] }, { type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i5$2.CodeMirrorComponent, selector: "ng-codemirror, [ngCodeMirror]", inputs: ["autoMaxHeight", "delayRefreshTime", "options"], outputs: ["focusChange"] }], 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"] }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
6234
6347
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheCodeComponent, decorators: [{
6235
6348
  type: Component,
6236
6349
  args: [{
@@ -6238,7 +6351,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
6238
6351
  templateUrl: './code.component.html',
6239
6352
  changeDetection: ChangeDetectionStrategy.OnPush
6240
6353
  }]
6241
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$4.ThyNotifyService }, { type: i0.NgZone }]; }, propDecorators: { codemirror: [{
6354
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$4.ThyNotifyService }, { type: i0.NgZone }, { type: CodeMode, decorators: [{
6355
+ type: Inject,
6356
+ args: [THE_CODE_MODE_TOKEN]
6357
+ }] }]; }, propDecorators: { codemirror: [{
6242
6358
  type: ViewChild,
6243
6359
  args: ['codemirror', { read: CodeMirrorComponent, static: false }]
6244
6360
  }] } });
@@ -6432,7 +6548,7 @@ class TheLinkEditComponent {
6432
6548
  applyLink(form) {
6433
6549
  const link = this.link.trim();
6434
6550
  if (this.linkRegExp(link)) {
6435
- const linkPath = TheEditor.findPath(this.editor, this.node);
6551
+ const linkPath = findPath(this.editor, this.node);
6436
6552
  if (this.originLink !== link) {
6437
6553
  Transforms.setNodes(this.editor, { url: link }, { at: linkPath });
6438
6554
  }
@@ -6451,7 +6567,7 @@ class TheLinkEditComponent {
6451
6567
  }
6452
6568
  }
6453
6569
  TheLinkEditComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheLinkEditComponent, deps: [{ token: i1$3.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component });
6454
- TheLinkEditComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheLinkEditComponent, selector: "the-link-edit", inputs: { tag: "tag", node: "node", link: "link", text: "text", originSelection: "originSelection" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class": "this.className" } }, ngImport: i0, template: "<form\n thyForm\n #linkForm=\"thyForm\"\n [thyFormValidatorConfig]=\"validatorConfig\"\n name=\"linkForm\"\n>\n <thy-form-group thyLabelText=\"\u6587\u672C\">\n <input\n thyInput\n placeholder=\"\u8BF7\u8F93\u5165\u6587\u672C\"\n required\n name=\"text\"\n [(ngModel)]=\"text\"\n thyAutofocus\n type=\"text\"\n />\n </thy-form-group>\n <thy-form-group thyLabelText=\"\u94FE\u63A5\">\n <input\n name=\"link\"\n thyInput\n placeholder=\"\u8BF7\u8F93\u5165\u94FE\u63A5\"\n required\n type=\"text\"\n #linkControl=\"ngModel\"\n [(ngModel)]=\"link\"\n />\n </thy-form-group>\n <thy-form-group-footer>\n <div class=\"btn-pair\">\n <button\n thyButton=\"link-secondary\"\n thySize=\"sm\"\n (click)=\"closePopover()\"\n >\u53D6\u6D88</button>\n <button\n thyButton=\"primary-square\"\n thySize=\"sm\"\n (thyFormSubmit)=\"applyLink(linkForm)\"\n >\u5E94\u7528</button>\n </div>\n </thy-form-group-footer>\n</form>\n", components: [{ type: i2$2.ThyFormGroupComponent, selector: "thy-form-group", inputs: ["thyLabelText", "thyLabelTextTranslateKey", "thyLabelRequired", "thyLabelPaddingTopClear", "thyFeedbackIcon", "thyTips", "thyTipsTranslateKey", "thyRowFill"] }, { type: i2$2.ThyFormGroupFooterComponent, selector: "thy-form-group-footer", inputs: ["thyAlign"] }, { type: i1$5.ThyButtonComponent, selector: "thy-button,[thy-button],[thyButton]", inputs: ["thyButton", "thyType", "thyLoading", "thyLoadingText", "thySize", "thyIcon", "thySquare", "thyBlock"] }], directives: [{ type: i4$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i4$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2$2.ThyFormDirective, selector: "[thyForm],[thy-form]", inputs: ["thyLayout", "thyEnterKeyMode", "thyFormValidatorConfig"], exportAs: ["thyForm"] }, { type: i5$4.ThyAutofocusDirective, selector: "input[thyAutofocus],textarea[thyAutofocus]", inputs: ["thyAutoSelect", "thyAutofocus"] }, { type: i4$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5.ThyInputDirective, selector: "[thyInput]", inputs: ["thySize", "thyAutocomplete"] }, { type: i4$2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { 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"] }, { type: i2$2.ThyFormSubmitDirective, selector: "[thyFormSubmit],[thy-form-submit]", outputs: ["thyFormSubmit"] }] });
6570
+ TheLinkEditComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheLinkEditComponent, selector: "the-link-edit", inputs: { tag: "tag", node: "node", link: "link", text: "text", originSelection: "originSelection" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class": "this.className" } }, ngImport: i0, template: "<form\n thyForm\n #linkForm=\"thyForm\"\n [thyFormValidatorConfig]=\"validatorConfig\"\n name=\"linkForm\"\n>\n <thy-form-group thyLabelText=\"\u6587\u672C\">\n <input\n thyInput\n placeholder=\"\u8BF7\u8F93\u5165\u6587\u672C\"\n required\n name=\"text\"\n [(ngModel)]=\"text\"\n thyAutofocus\n type=\"text\"\n />\n </thy-form-group>\n <thy-form-group thyLabelText=\"\u94FE\u63A5\">\n <input\n name=\"link\"\n thyInput\n placeholder=\"\u8BF7\u8F93\u5165\u94FE\u63A5\"\n required\n type=\"text\"\n #linkControl=\"ngModel\"\n [(ngModel)]=\"link\"\n />\n </thy-form-group>\n <thy-form-group-footer>\n <div class=\"btn-pair\">\n <button\n thyButton=\"link-secondary\"\n thySize=\"sm\"\n (click)=\"closePopover()\"\n >\u53D6\u6D88</button>\n <button\n thyButton=\"primary-square\"\n thySize=\"sm\"\n (thyFormSubmit)=\"applyLink(linkForm)\"\n >\u5E94\u7528</button>\n </div>\n </thy-form-group-footer>\n</form>\n", components: [{ type: i2$2.ThyFormGroupComponent, selector: "thy-form-group", inputs: ["thyLabelText", "thyLabelTextTranslateKey", "thyLabelRequired", "thyLabelPaddingTopClear", "thyFeedbackIcon", "thyTips", "thyTipsTranslateKey", "thyRowFill"] }, { type: i2$2.ThyFormGroupFooterComponent, selector: "thy-form-group-footer", inputs: ["thyAlign"] }, { type: i1$5.ThyButtonComponent, selector: "thy-button,[thy-button],[thyButton]", inputs: ["thyButton", "thyType", "thyLoading", "thyLoadingText", "thySize", "thyIcon", "thySquare", "thyBlock"] }], directives: [{ type: i4$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i4$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2$2.ThyFormDirective, selector: "[thyForm],[thy-form]", inputs: ["thyLayout", "thyEnterKeyMode", "thyFormValidatorConfig"], exportAs: ["thyForm"] }, { type: i5$3.ThyAutofocusDirective, selector: "input[thyAutofocus],textarea[thyAutofocus]", inputs: ["thyAutoSelect", "thyAutofocus"] }, { type: i4$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5.ThyInputDirective, selector: "[thyInput]", inputs: ["thySize", "thyAutocomplete"] }, { type: i4$2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { 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"] }, { type: i2$2.ThyFormSubmitDirective, selector: "[thyFormSubmit],[thy-form-submit]", outputs: ["thyFormSubmit"] }] });
6455
6571
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheLinkEditComponent, decorators: [{
6456
6572
  type: Component,
6457
6573
  args: [{
@@ -6654,6 +6770,7 @@ const withLink = (editor) => {
6654
6770
  editor.insertText = text => {
6655
6771
  if (text && isUrl(text)) {
6656
6772
  LinkEditor.wrapLink(editor, text, text);
6773
+ Transforms.move(editor, { distance: 1, unit: "offset" });
6657
6774
  }
6658
6775
  else {
6659
6776
  insertText(text);
@@ -6661,8 +6778,10 @@ const withLink = (editor) => {
6661
6778
  };
6662
6779
  editor.insertData = data => {
6663
6780
  const text = data.getData('text/plain');
6664
- if (text && isUrl(text)) {
6781
+ const fragment = data.getData(`application/${CLIPBOARD_FORMAT_KEY}`);
6782
+ if (text && isUrl(text) && !fragment) {
6665
6783
  LinkEditor.wrapLink(editor, text, text);
6784
+ Transforms.move(editor, { distance: 1, unit: "offset" });
6666
6785
  }
6667
6786
  else {
6668
6787
  insertData(data);
@@ -6745,9 +6864,9 @@ class TheTableToolbarItemComponent extends TheToolbarBaseItemComponent {
6745
6864
  return;
6746
6865
  }
6747
6866
  const type = this.item.key;
6748
- this.toggleTableSelect(event, type);
6867
+ this.toggleTableSelect(event);
6749
6868
  }
6750
- toggleTableSelect(event, type, optionsParam) {
6869
+ toggleTableSelect(event, optionsParam) {
6751
6870
  if (this.isOpenTableSelect) {
6752
6871
  this.tableSelectRef.close();
6753
6872
  return;
@@ -6782,7 +6901,7 @@ TheTableToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12
6782
6901
  <thy-icon [thyIconName]="item.icon"></thy-icon>
6783
6902
  <thy-icon class="link-down-icon font-size-sm text-desc table-down-icon" thyIconName="caret-down"> </thy-icon>
6784
6903
  </a>
6785
- `, 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: i5$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
6904
+ `, 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: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
6786
6905
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheTableToolbarItemComponent, decorators: [{
6787
6906
  type: Component,
6788
6907
  args: [{
@@ -6954,7 +7073,7 @@ function mergeCell(editor, selectedCells) {
6954
7073
  selectCellNodes.forEach((cell, index) => {
6955
7074
  const { row, node } = cell;
6956
7075
  if (node) {
6957
- const cellPath = TheEditor.findPath(editor, node);
7076
+ const cellPath = findPath(editor, node);
6958
7077
  if (index === 0) {
6959
7078
  leftTopCellPath = cellPath;
6960
7079
  }
@@ -7472,7 +7591,7 @@ function resetTableCell(editor, table, cell, cellRow, cellCol) {
7472
7591
  table.children.map((row, rowIndex) => {
7473
7592
  row.children.map((col, colIndex) => {
7474
7593
  if (rowIndex >= cellRow && rowIndex <= rowSpanIndex && colIndex >= cellCol && colIndex <= colSpanIndex) {
7475
- const path = TheEditor.findPath(editor, col);
7594
+ const path = findPath(editor, col);
7476
7595
  Transforms.setNodes(editor, { colspan: null, rowspan: null, hidden: null }, { at: path });
7477
7596
  }
7478
7597
  });
@@ -7493,6 +7612,40 @@ function setCellMenuInvisibility(editor, menuList, selectedCells, isActiveSelect
7493
7612
  });
7494
7613
  }
7495
7614
 
7615
+ class NavSplitLineComponent {
7616
+ constructor() {
7617
+ this.mode = ToolbarItemMode.vertical;
7618
+ this.theNavSplitLine = true;
7619
+ }
7620
+ get horizontal() {
7621
+ return this.mode === ToolbarItemMode.horizontal;
7622
+ }
7623
+ get vertical() {
7624
+ return this.mode === ToolbarItemMode.vertical;
7625
+ }
7626
+ ngOnInit() { }
7627
+ }
7628
+ NavSplitLineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: NavSplitLineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
7629
+ NavSplitLineComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: NavSplitLineComponent, selector: "nav-split-line", inputs: { mode: "mode" }, host: { properties: { "class.the-nav-split-line": "this.theNavSplitLine", "class.horizontal": "this.horizontal", "class.vertical": "this.vertical" } }, ngImport: i0, template: '', isInline: true });
7630
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: NavSplitLineComponent, decorators: [{
7631
+ type: Component,
7632
+ args: [{
7633
+ selector: 'nav-split-line',
7634
+ template: ''
7635
+ }]
7636
+ }], ctorParameters: function () { return []; }, propDecorators: { mode: [{
7637
+ type: Input
7638
+ }], theNavSplitLine: [{
7639
+ type: HostBinding,
7640
+ args: ['class.the-nav-split-line']
7641
+ }], horizontal: [{
7642
+ type: HostBinding,
7643
+ args: ['class.horizontal']
7644
+ }], vertical: [{
7645
+ type: HostBinding,
7646
+ args: ['class.vertical']
7647
+ }] } });
7648
+
7496
7649
  class TheTableToolbarComponent {
7497
7650
  constructor(ngZone, colorSelectService, popoverRef) {
7498
7651
  this.ngZone = ngZone;
@@ -7603,7 +7756,7 @@ class TheTableToolbarComponent {
7603
7756
  }
7604
7757
  }
7605
7758
  TheTableToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheTableToolbarComponent, deps: [{ token: i0.NgZone }, { token: TheColorSelectService }, { token: i1$3.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component });
7606
- TheTableToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheTableToolbarComponent, selector: "the-table-toolbar", inputs: { tableStore: "tableStore", isActiveSelect: "isActiveSelect" }, ngImport: i0, template: "<thy-icon-nav>\n <ng-container *ngFor=\"let item of cellMenuList\">\n <a href=\"javascript:;\" thyIconNavLink *ngIf=\"!item.invisibility\" [thyTooltip]=\"item.name\"\n (mousedown)=\"item.actionHandle()\">\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </a>\n </ng-container>\n <span class=\"nav-split-line\" *ngIf=\"!isActiveSelect && isShowSplitLine\"></span>\n <a href=\"javascript:;\" thyIconNavLink thyTooltip=\"\u5355\u5143\u683C\u80CC\u666F\" (mousedown)=\"openSelectColor($event)\">\n <thy-icon thyIconName=\"background-tt\" thyIconType=\"twotone\" [thyTwotoneColor]=\"selectedColor\"></thy-icon>\n </a>\n <span class=\"nav-split-line\" *ngIf=\"deleteIcon\"></span>\n <a *ngIf=\"deleteIcon\" href=\"javascript:;\" thyIconNavLink [thyTooltip]=\"iconName\" class=\"danger\"\n [thyIconNavLinkIcon]=\"deleteIcon\" (mousedown)=\"onDelete($event)\" (mouseenter)=\"onEnterDelete($event)\"\n (mouseleave)=\"onLeaveDelete($event)\"></a>\n</thy-icon-nav>", components: [{ type: i2.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { 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.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
7759
+ TheTableToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheTableToolbarComponent, selector: "the-table-toolbar", inputs: { tableStore: "tableStore", isActiveSelect: "isActiveSelect" }, ngImport: i0, template: "<thy-icon-nav>\n <ng-container *ngFor=\"let item of cellMenuList\">\n <a href=\"javascript:;\" thyIconNavLink *ngIf=\"!item.invisibility\" [thyTooltip]=\"item.name\" (mousedown)=\"item.actionHandle()\">\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </a>\n </ng-container>\n <nav-split-line *ngIf=\"!isActiveSelect && isShowSplitLine\"></nav-split-line>\n <a href=\"javascript:;\" thyIconNavLink thyTooltip=\"\u5355\u5143\u683C\u80CC\u666F\" (mousedown)=\"openSelectColor($event)\">\n <thy-icon thyIconName=\"background-tt\" thyIconType=\"twotone\" [thyTwotoneColor]=\"selectedColor\"></thy-icon>\n </a>\n <nav-split-line *ngIf=\"deleteIcon\"></nav-split-line>\n <a\n *ngIf=\"deleteIcon\"\n href=\"javascript:;\"\n thyIconNavLink\n [thyTooltip]=\"iconName\"\n class=\"danger\"\n [thyIconNavLinkIcon]=\"deleteIcon\"\n (mousedown)=\"onDelete($event)\"\n (mouseenter)=\"onEnterDelete($event)\"\n (mouseleave)=\"onLeaveDelete($event)\"\n ></a>\n</thy-icon-nav>\n", components: [{ type: i2.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }], directives: [{ type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { 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"] }] });
7607
7760
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheTableToolbarComponent, decorators: [{
7608
7761
  type: Component,
7609
7762
  args: [{
@@ -7666,7 +7819,7 @@ class TheContextMenuComponent {
7666
7819
  ngOnInit() { }
7667
7820
  }
7668
7821
  TheContextMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheContextMenuComponent, deps: [{ token: i0.ElementRef }, { token: i1$3.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component });
7669
- TheContextMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheContextMenuComponent, selector: "the-contextmenu", inputs: { menuEntities: "menuEntities", actionHandle: "actionHandle", activeHandle: "activeHandle", deactiveHandle: "deactiveHandle" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)", "mousedown": "handleMouseDown($event)" }, properties: { "class.the-overlay-menu-wrap": "this.wrap" } }, ngImport: i0, template: "<thy-action-menu>\n <ng-container *ngFor=\"let menuItem of menuEntities\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n *ngIf=\"!menuItem.invisibility\"\n (mousedown)=\"itemMousedown($event, menuItem)\"\n (mouseenter)=\"itemMouseenter($event, menuItem)\"\n (mouseleave)=\"itemMouseleave($event, menuItem)\"\n >\n <span thyActionMenuItemIcon>\n <thy-icon\n *ngIf=\"menuItem.backgroundColor; else elseIcon\"\n [thyIconName]=\"menuItem.icon\"\n thyIconType=\"twotone\"\n [thyTwotoneColor]=\"menuItem.backgroundColor\"\n ></thy-icon>\n <ng-template #elseIcon>\n <thy-icon [thyIconName]=\"menuItem.icon\"></thy-icon>\n </ng-template>\n </span>\n <span thyActionMenuItemName>{{ menuItem.name }}</span>\n <span *ngIf=\"menuItem.extendIcon\" thyActionMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ menuItem.extendIcon }}\"></thy-icon>\n </span>\n </a>\n <thy-action-menu-divider *ngIf=\"menuItem.divider\"></thy-action-menu-divider>\n </ng-container>\n</thy-action-menu>\n", components: [{ type: i5$2.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5$2.ThyActionMenuDividerComponent, selector: "thy-action-menu-divider", inputs: ["thyTitle", "thyType"] }], directives: [{ type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$2.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5$2.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5$2.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }, { type: i5$2.ThyActionMenuItemExtendIconDirective, selector: "[thyActionMenuItemExtendIcon]" }] });
7822
+ TheContextMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheContextMenuComponent, selector: "the-contextmenu", inputs: { menuEntities: "menuEntities", actionHandle: "actionHandle", activeHandle: "activeHandle", deactiveHandle: "deactiveHandle" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)", "mousedown": "handleMouseDown($event)" }, properties: { "class.the-overlay-menu-wrap": "this.wrap" } }, ngImport: i0, template: "<thy-action-menu>\n <ng-container *ngFor=\"let menuItem of menuEntities\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n *ngIf=\"!menuItem.invisibility\"\n (mousedown)=\"itemMousedown($event, menuItem)\"\n (mouseenter)=\"itemMouseenter($event, menuItem)\"\n (mouseleave)=\"itemMouseleave($event, menuItem)\"\n >\n <span thyActionMenuItemIcon>\n <thy-icon\n *ngIf=\"menuItem.backgroundColor; else elseIcon\"\n [thyIconName]=\"menuItem.icon\"\n thyIconType=\"twotone\"\n [thyTwotoneColor]=\"menuItem.backgroundColor\"\n ></thy-icon>\n <ng-template #elseIcon>\n <thy-icon [thyIconName]=\"menuItem.icon\"></thy-icon>\n </ng-template>\n </span>\n <span thyActionMenuItemName>{{ menuItem.name }}</span>\n <span *ngIf=\"menuItem.extendIcon\" thyActionMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ menuItem.extendIcon }}\"></thy-icon>\n </span>\n </a>\n <thy-action-menu-divider *ngIf=\"menuItem.divider\"></thy-action-menu-divider>\n </ng-container>\n</thy-action-menu>\n", components: [{ type: i5$1.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5$1.ThyActionMenuDividerComponent, selector: "thy-action-menu-divider", inputs: ["thyTitle", "thyType"] }], directives: [{ type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5$1.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5$1.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }, { type: i5$1.ThyActionMenuItemExtendIconDirective, selector: "[thyActionMenuItemExtendIcon]" }] });
7670
7823
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheContextMenuComponent, decorators: [{
7671
7824
  type: Component,
7672
7825
  args: [{
@@ -8038,7 +8191,7 @@ class TheInsertMarkComponent {
8038
8191
  ngOnDestroy() { }
8039
8192
  }
8040
8193
  TheInsertMarkComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInsertMarkComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
8041
- TheInsertMarkComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheInsertMarkComponent, selector: "the-table-insert-mark", inputs: { type: "type", at: "at", tableStore: "tableStore" }, ngImport: i0, template: "<div\n [thyTooltip]=\"!disabled && tooltipContent\"\n class=\"the-table-controls-insert-wrapper\"\n [ngClass]=\"{ disabled: disabled }\"\n contenteditable=\"false\"\n (mousedown)=\"onMouseDown($event)\"\n (mouseenter)=\"onMouseEnter($event)\"\n (mouseleave)=\"onMouseLeave($event)\"\n>\n <div\n class=\"the-table-controls-insert-line\"\n *ngIf=\"dotWrapperHovered\"\n [attr.data-dot-type]=\"type\"\n [ngStyle]=\"{ height: type === 'column' && insertLength, width: type === 'row' && insertLength }\"\n ></div>\n</div>\n", directives: [{ type: i5$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
8194
+ TheInsertMarkComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheInsertMarkComponent, selector: "the-table-insert-mark", inputs: { type: "type", at: "at", tableStore: "tableStore" }, ngImport: i0, template: "<div\n [thyTooltip]=\"!disabled && tooltipContent\"\n class=\"the-table-controls-insert-wrapper\"\n [ngClass]=\"{ disabled: disabled }\"\n contenteditable=\"false\"\n (mousedown)=\"onMouseDown($event)\"\n (mouseenter)=\"onMouseEnter($event)\"\n (mouseleave)=\"onMouseLeave($event)\"\n>\n <div\n class=\"the-table-controls-insert-line\"\n *ngIf=\"dotWrapperHovered\"\n [attr.data-dot-type]=\"type\"\n [ngStyle]=\"{ height: type === 'column' && insertLength, width: type === 'row' && insertLength }\"\n ></div>\n</div>\n", directives: [{ type: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
8042
8195
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInsertMarkComponent, decorators: [{
8043
8196
  type: Component,
8044
8197
  args: [{
@@ -8252,9 +8405,12 @@ class TheTableComponent extends TheBaseElementComponent {
8252
8405
  useRowControls() {
8253
8406
  if (this.selection) {
8254
8407
  this.rowControls = this.calculateRowControls();
8255
- this.cdr.detectChanges();
8408
+ this.cdr.markForCheck();
8256
8409
  }
8257
8410
  }
8411
+ detectChanges() {
8412
+ this.cdr.detectChanges();
8413
+ }
8258
8414
  calculateMinRowSpanCellForRows() {
8259
8415
  const table = this.element;
8260
8416
  const cells = table.children.map((row, index) => {
@@ -8408,23 +8564,23 @@ class TheTableComponent extends TheBaseElementComponent {
8408
8564
  const columns = tr.children.map(cell => {
8409
8565
  return { width: Math.round(tableWidth / tr.children.length) - tr.children.length };
8410
8566
  });
8411
- TheEditor.setNode(this.editor, { columns }, this.element);
8567
+ setNode(this.editor, { columns }, this.element);
8412
8568
  }
8413
8569
  }
8414
8570
  initializeRows() {
8415
8571
  this.element.children.map(row => {
8416
8572
  if (!row.height) {
8417
8573
  const element = TheEditor.toDOMNode(this.editor, row);
8418
- TheEditor.setNode(this.editor, { height: getElementHeight(element) }, row);
8574
+ setNode(this.editor, { height: getElementHeight(element) }, row);
8419
8575
  }
8420
8576
  });
8421
8577
  }
8422
8578
  transformRowHeight() {
8423
8579
  const rowElements = this.nativeElement.querySelector('tbody').children;
8424
8580
  if (rowElements) {
8425
- [...rowElements].map((row, index) => {
8581
+ [...rowElements].map((row, index$1) => {
8426
8582
  const height = getElementHeight(row);
8427
- TheEditor.setNode(this.editor, { height }, this.element.children[index]);
8583
+ setNode(this.editor, { height }, this.element.children[index$1]);
8428
8584
  });
8429
8585
  }
8430
8586
  }
@@ -8433,7 +8589,7 @@ class TheTableComponent extends TheBaseElementComponent {
8433
8589
  const columns = cols.map(col => {
8434
8590
  return { width: getElementWidth(col) };
8435
8591
  });
8436
- TheEditor.setNode(this.editor, { columns }, this.element);
8592
+ setNode(this.editor, { columns }, this.element);
8437
8593
  }
8438
8594
  onRowMouseDown(event, index) {
8439
8595
  event.stopPropagation();
@@ -8516,7 +8672,7 @@ TheTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
8516
8672
  provide: TheTableToken,
8517
8673
  useExisting: TheTableComponent
8518
8674
  }
8519
- ], viewQueries: [{ propertyName: "tableWrapper", first: true, predicate: ["tableWrapper"], descendants: true, read: ElementRef, static: true }, { propertyName: "theTableElement", first: true, predicate: ["theTable"], descendants: true, read: ElementRef, static: true }, { propertyName: "tbodyElement", first: true, predicate: ["tbody"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<div\n class=\"the-table-container\"\n theColumnResize\n [ngClass]=\"{\n 'the-table-with-controls': isInTable,\n 'the-table-selection-hide': tableStore.isCellSelecting || tableStore.isRightClicking\n }\"\n>\n <div class=\"the-table-row-controls-wrapper\" *ngIf=\"!readonly\">\n <div>\n <div\n class=\"the-table-corner-controls\"\n [ngClass]=\"{ active: isSelectedAllCell, dangerous: tableStore.isSelectedTable && tableStore.dangerousCells.length > 0 }\"\n >\n <button type=\"button\" class=\"the-table-corner-button\" (mousedown)=\"onSelectTable($event)\"></button>\n <div class=\"the-table-corner-controls-insert-row-marker\">\n <the-table-insert-mark type=\"row\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n <div class=\"the-table-corner-controls-insert-column-marker\">\n <the-table-insert-mark type=\"column\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n </div>\n <div class=\"the-table-row-controls\">\n <div class=\"the-table-row-controls-inner\">\n <div\n class=\"the-table-row-controls-button-wrap\"\n *ngFor=\"let control of rowControls; let i = index; trackBy: trackByFnRowCotrols\"\n [ngClass]=\"{\n active: tableStore.selectedRowsIndex.includes(control.rowIndex),\n dangerous: tableStore.dangerousRowsIndex.includes(control.rowIndex) && tableStore.dangerousCells.length > 0\n }\"\n >\n <button\n (mousedown)=\"onRowMouseDown($event, control.rowIndex)\"\n type=\"button\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n class=\"the-table-row-controls-button the-table-controls-button\"\n ></button>\n <the-table-insert-mark type=\"row\" [at]=\"control.rowIndex + 1\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"the-table-wrapper\" #tableWrapper>\n <table class=\"the-table\" #theTable [ngClass]=\"{ 'the-table-with-controls': isInTable }\">\n <colgroup *ngIf=\"columns\">\n <col *ngFor=\"let col of columns\" [ngStyle]=\"{ width: col.width + 'px' }\" />\n </colgroup>\n <thead>\n <tr class=\"the-table-col-controls-wrapper\">\n <th\n class=\"the-table-col-controls\"\n (mousedown)=\"onColMouseDown($event, i)\"\n *ngFor=\"let control of colControls; let i = index; trackBy: trackByFnColCotrols\"\n >\n <the-table-insert-mark\n *ngIf=\"isInTable\"\n type=\"column\"\n [at]=\"i + 1\"\n [tableStore]=\"tableStore\"\n ></the-table-insert-mark>\n <div\n class=\"the-table-col-controls-inner\"\n [ngClass]=\"{\n active: tableStore.selectedColumnsIndex.includes(i),\n dangerous: tableStore.dangerousColumnsIndex.includes(i) && tableStore.dangerousCells.length > 0\n }\"\n ></div>\n </th>\n </tr>\n </thead>\n <tbody #tbody>\n <slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"> </slate-children>\n </tbody>\n </table>\n </div>\n</div>\n", components: [{ type: TheInsertMarkComponent, selector: "the-table-insert-mark", inputs: ["type", "at", "tableStore"] }, { type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], directives: [{ type: TheColumnResizeDirective, selector: "div[theColumnResize]" }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
8675
+ ], viewQueries: [{ propertyName: "tableWrapper", first: true, predicate: ["tableWrapper"], descendants: true, read: ElementRef, static: true }, { propertyName: "theTableElement", first: true, predicate: ["theTable"], descendants: true, read: ElementRef, static: true }, { propertyName: "tbodyElement", first: true, predicate: ["tbody"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<div\n class=\"the-table-container\"\n theColumnResize\n [ngClass]=\"{\n 'the-table-with-controls': isInTable,\n 'the-table-selection-hide': tableStore.isCellSelecting || tableStore.isRightClicking\n }\"\n>\n <div class=\"the-table-row-controls-wrapper\" *ngIf=\"!readonly && isInTable\">\n <div>\n <div\n class=\"the-table-corner-controls\"\n [ngClass]=\"{ active: isSelectedAllCell, dangerous: tableStore.isSelectedTable && tableStore.dangerousCells.length > 0 }\"\n >\n <button type=\"button\" class=\"the-table-corner-button\" (mousedown)=\"onSelectTable($event)\"></button>\n <div class=\"the-table-corner-controls-insert-row-marker\">\n <the-table-insert-mark type=\"row\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n <div class=\"the-table-corner-controls-insert-column-marker\">\n <the-table-insert-mark type=\"column\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n </div>\n <div class=\"the-table-row-controls\">\n <div class=\"the-table-row-controls-inner\">\n <div\n class=\"the-table-row-controls-button-wrap\"\n *ngFor=\"let control of rowControls; let i = index; trackBy: trackByFnRowCotrols\"\n [ngClass]=\"{\n active: tableStore.selectedRowsIndex.includes(control.rowIndex),\n dangerous: tableStore.dangerousRowsIndex.includes(control.rowIndex) && tableStore.dangerousCells.length > 0\n }\"\n >\n <button\n (mousedown)=\"onRowMouseDown($event, control.rowIndex)\"\n type=\"button\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n class=\"the-table-row-controls-button the-table-controls-button\"\n ></button>\n <the-table-insert-mark type=\"row\" [at]=\"control.rowIndex + 1\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"the-table-wrapper\" #tableWrapper>\n <table class=\"the-table\" #theTable [ngClass]=\"{ 'the-table-with-controls': isInTable }\">\n <colgroup *ngIf=\"columns\">\n <col *ngFor=\"let col of columns\" [ngStyle]=\"{ width: col.width + 'px' }\" />\n </colgroup>\n <thead>\n <tr class=\"the-table-col-controls-wrapper\">\n <th\n class=\"the-table-col-controls\"\n (mousedown)=\"onColMouseDown($event, i)\"\n *ngFor=\"let control of colControls; let i = index; trackBy: trackByFnColCotrols\"\n >\n <the-table-insert-mark\n *ngIf=\"isInTable\"\n type=\"column\"\n [at]=\"i + 1\"\n [tableStore]=\"tableStore\"\n ></the-table-insert-mark>\n <div\n class=\"the-table-col-controls-inner\"\n [ngClass]=\"{\n active: tableStore.selectedColumnsIndex.includes(i),\n dangerous: tableStore.dangerousColumnsIndex.includes(i) && tableStore.dangerousCells.length > 0\n }\"\n ></div>\n </th>\n </tr>\n </thead>\n <tbody #tbody>\n <slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"> </slate-children>\n </tbody>\n </table>\n </div>\n</div>\n", components: [{ type: TheInsertMarkComponent, selector: "the-table-insert-mark", inputs: ["type", "at", "tableStore"] }, { type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], directives: [{ type: TheColumnResizeDirective, selector: "div[theColumnResize]" }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
8520
8676
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheTableComponent, decorators: [{
8521
8677
  type: Component,
8522
8678
  args: [{
@@ -8575,9 +8731,9 @@ function clearTableNode(opts, editor, isTopToBot) {
8575
8731
  function calculateAnchorPositionInCell(editor) {
8576
8732
  let isFirstLine = false;
8577
8733
  let isLastLine = false;
8578
- const anchorBlock = TheEditor.anchorBlock(editor);
8579
- const anchorBlockPath = TheEditor.findPath(editor, anchorBlock);
8580
- const anchorBlockDom = TheEditor.toDOMNode(editor, anchorBlock);
8734
+ const anchorBlock$1 = anchorBlock(editor);
8735
+ const anchorBlockPath = findPath(editor, anchorBlock$1);
8736
+ const anchorBlockDom = AngularEditor.toDOMNode(editor, anchorBlock$1);
8581
8737
  const valueRangeRect = anchorBlockDom.getBoundingClientRect();
8582
8738
  const anchorBlockHeight = window.getComputedStyle(anchorBlockDom).lineHeight;
8583
8739
  const nativeSelection = window.getSelection();
@@ -8600,11 +8756,13 @@ class TheTableRowComponent extends TheBaseElementComponent {
8600
8756
  super.onContextChange();
8601
8757
  if (this.initialized) {
8602
8758
  this.useBackground();
8759
+ this.useHeight();
8603
8760
  }
8604
8761
  }
8605
8762
  ngOnInit() {
8606
8763
  super.ngOnInit();
8607
8764
  this.useBackground();
8765
+ this.useHeight();
8608
8766
  }
8609
8767
  useBackground() {
8610
8768
  if (this.element.header && !this.backgroundColor) {
@@ -9349,6 +9507,7 @@ class TheTdComponent extends TheBaseElementComponent {
9349
9507
  this.applyRowSize(deltaSize);
9350
9508
  }
9351
9509
  this.tableComponent.useRowControls();
9510
+ this.tableComponent.detectChanges();
9352
9511
  this.updateOverlayHandleSizeAndOffset();
9353
9512
  }
9354
9513
  _createOverlayForHandle() {
@@ -9620,8 +9779,8 @@ const withTable = (editor) => {
9620
9779
  if (startBlockPath.length <= startPosition.cellEntry[1].length + 1 &&
9621
9780
  startBlockPath.pop() === 0 &&
9622
9781
  selection.anchor.offset === 0 &&
9623
- TheEditor.isStart(editor, selection.anchor, startBlockPath) &&
9624
- !Editor.isVoid(editor, TheEditor.anchorBlock(editor))) {
9782
+ isStart(editor, selection.anchor, startBlockPath) &&
9783
+ !Editor.isVoid(editor, anchorBlock(editor))) {
9625
9784
  return;
9626
9785
  }
9627
9786
  deleteBackward(unit);
@@ -9661,11 +9820,11 @@ const withTable = (editor) => {
9661
9820
  const { isFirstLine, isLastLine } = calculateAnchorPositionInCell(editor);
9662
9821
  startPath.pop();
9663
9822
  endPath.pop();
9664
- if ((TheEditor.anchorBlockEntry(editor)[1].toString() !== startPath.toString() || !isFirstLine) && isMoveUp) {
9823
+ if ((anchorBlockEntry(editor)[1].toString() !== startPath.toString() || !isFirstLine) && isMoveUp) {
9665
9824
  onKeydown(event);
9666
9825
  return;
9667
9826
  }
9668
- if ((TheEditor.anchorBlockEntry(editor)[1].toString() !== endPath.toString() || !isLastLine) && isMoveDown) {
9827
+ if ((anchorBlockEntry(editor)[1].toString() !== endPath.toString() || !isLastLine) && isMoveDown) {
9669
9828
  onKeydown(event);
9670
9829
  return;
9671
9830
  }
@@ -9847,7 +10006,7 @@ const withTable = (editor) => {
9847
10006
  setFragmentData(unit);
9848
10007
  };
9849
10008
  editor.insertData = data => {
9850
- const fragment = extractFragment(data, ELEMENT_UNIQUE_ID);
10009
+ const fragment = extractFragment(data);
9851
10010
  if (fragment) {
9852
10011
  const opts = new TableOptions$1();
9853
10012
  const { selection } = editor;
@@ -9979,7 +10138,7 @@ const withInsertParagraphNodes = (types = []) => (editor) => {
9979
10138
  editor.normalizeNode = ([currentNode, currentPath]) => {
9980
10139
  if (Text.isText(currentNode) && currentPath.length) {
9981
10140
  const [node] = Editor.parent(editor, currentPath);
9982
- const containerBlocks = [...types, ...TheQueries.getContainerBlocks(editor)];
10141
+ const containerBlocks = [...types, ...getContainerBlocks(editor)];
9983
10142
  if (Element$1.isElement(node) && containerBlocks.includes(node.type)) {
9984
10143
  const paragraph = createEmptyParagraph();
9985
10144
  paragraph.children[0].text = currentNode.text;
@@ -10000,7 +10159,12 @@ const withDeserializeHMTL = (editor) => {
10000
10159
  if (html && !slateFragment) {
10001
10160
  const htmlDom = new DOMParser().parseFromString(html, 'text/html');
10002
10161
  const fragment = TheiaConverter.convertToTheia(Array.from(htmlDom.body.children));
10003
- TheTransforms.insertTheElements(editor, fragment);
10162
+ // 无法识别HTML内容时后退一下:识别纯文本
10163
+ if (fragment.length === 1 && Editor.isEmpty(editor, fragment[0]) && fragment[0].type === ElementKinds.paragraph) {
10164
+ insertData(data);
10165
+ return;
10166
+ }
10167
+ insertTheElements(editor, fragment);
10004
10168
  return;
10005
10169
  }
10006
10170
  insertData(data);
@@ -10035,6 +10199,11 @@ class TheVerticalToolbarItemComponent extends TheToolbarBaseItemComponent {
10035
10199
  get isOpened() {
10036
10200
  return this.dropdownPopoverRef && this.dropdownPopoverRef.getOverlayRef() && this.dropdownPopoverRef.getOverlayRef().hasAttached();
10037
10201
  }
10202
+ handleDocumentMouseDown(event) {
10203
+ if (!this.elementRef.nativeElement.contains(event.target)) {
10204
+ this.close();
10205
+ }
10206
+ }
10038
10207
  ngOnInit() { }
10039
10208
  statusChange(editor) {
10040
10209
  var _a, _b;
@@ -10074,7 +10243,7 @@ class TheVerticalToolbarItemComponent extends TheToolbarBaseItemComponent {
10074
10243
  offset: 10,
10075
10244
  viewContainerRef: this.viewContainerRef,
10076
10245
  insideClosable: false,
10077
- backdropClosable: true,
10246
+ backdropClosable: false,
10078
10247
  hasBackdrop: false
10079
10248
  });
10080
10249
  }
@@ -10085,7 +10254,7 @@ class TheVerticalToolbarItemComponent extends TheToolbarBaseItemComponent {
10085
10254
  }
10086
10255
  }
10087
10256
  TheVerticalToolbarItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheVerticalToolbarItemComponent, deps: [{ token: i0.ElementRef }, { token: i1$6.ThyPopover }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
10088
- TheVerticalToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheVerticalToolbarItemComponent, selector: "the-toolbar-vertical-align-item", inputs: { item: "item", menus: "menus", editor: "editor", toolbarItem: "toolbarItem" }, host: { properties: { "class.hide": "!active" }, classAttribute: "the-toolbar-dropdown-container verticalAlign" }, viewQueries: [{ propertyName: "template", first: true, predicate: ["VerticalAlignItems"], descendants: true, read: TemplateRef, static: true }], usesInheritance: true, ngImport: i0, template: "<a\n thyIconNavLink\n class=\"icon-mode link-with-down\"\n [thyTooltip]=\"toolbarItem?.name\"\n [thyIconNavLinkActive]=\"isOpened\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"execute($event)\"\n>\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n</a>\n\n<ng-template #VerticalAlignItems>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let menu of toolbarItem?.includes\">\n <a thyActionMenuItem href=\"javascript:;\" (mousedown)=\"itemMousedown($event, menu)\" [ngStyle]=\"menu?.styles\">\n <span *ngIf=\"menu.icon\" thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu?.icon\"></thy-icon>\n </span>\n <span thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5$2.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }], directives: [{ type: i5$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5$2.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$2.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5$2.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
10257
+ TheVerticalToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheVerticalToolbarItemComponent, selector: "the-toolbar-vertical-align-item", inputs: { item: "item", menus: "menus", editor: "editor", toolbarItem: "toolbarItem" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class.hide": "!active" }, classAttribute: "the-toolbar-dropdown-container verticalAlign" }, viewQueries: [{ propertyName: "template", first: true, predicate: ["VerticalAlignItems"], descendants: true, read: TemplateRef, static: true }], usesInheritance: true, ngImport: i0, template: "<a\n thyIconNavLink\n class=\"icon-mode link-with-down\"\n [thyTooltip]=\"toolbarItem?.name\"\n [thyIconNavLinkActive]=\"isOpened\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"execute($event)\"\n>\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n</a>\n\n<ng-template #VerticalAlignItems>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let menu of toolbarItem?.includes\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n [thyActionMenuItemActive]=\"menu.key === activeMenu?.key\"\n [ngStyle]=\"menu?.styles\"\n (mousedown)=\"itemMousedown($event, menu)\"\n >\n <span *ngIf=\"menu.icon\" thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu?.icon\"></thy-icon>\n </span>\n <span thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5$1.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }], directives: [{ type: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5$1.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5$1.ThyActionMenuItemActiveDirective, selector: "[thyActionMenuItemActive]", inputs: ["thyActionMenuItemActive"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5$1.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
10089
10258
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheVerticalToolbarItemComponent, decorators: [{
10090
10259
  type: Component,
10091
10260
  args: [{
@@ -10107,6 +10276,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10107
10276
  }], template: [{
10108
10277
  type: ViewChild,
10109
10278
  args: ['VerticalAlignItems', { read: TemplateRef, static: true }]
10279
+ }], handleDocumentMouseDown: [{
10280
+ type: HostListener,
10281
+ args: ['document: mousedown', ['$event']]
10110
10282
  }] } });
10111
10283
 
10112
10284
  const VerticalAlignOptions = [
@@ -10142,25 +10314,401 @@ const VerticalAlignOptions = [
10142
10314
  }
10143
10315
  ];
10144
10316
 
10145
- const internalPlugins = [
10146
- withTheHistory,
10147
- withAutoInsertData(),
10148
- withRemoveEmpty,
10149
- withRemoveVoid,
10150
- withResetType,
10151
- withImage,
10152
- withIndent([ElementKinds.checkItem, ElementKinds.numberedList, ElementKinds.bulletedList, ElementKinds.paragraph, ...HEADING_TYPES]),
10153
- withList({ validLiChildrenTypes: [ElementKinds.image] }),
10154
- withLink,
10155
- withTable,
10156
- withTodoItem,
10157
- withHr,
10158
- withAlign,
10159
- withCode,
10160
- withHeading,
10161
- withMark(),
10162
- withBlockquote,
10163
- withNodeID({ idKey: ELEMENT_UNIQUE_ID, idCreator }),
10317
+ const PaintFormatEditor = {
10318
+ formatBrush(editor) {
10319
+ const contextService = editor.injector.get(TheContextService);
10320
+ const obj = {};
10321
+ for (const key of MarkProps) {
10322
+ const k = contextService.paintFormatStatus.marks[key];
10323
+ obj[key] = k || null;
10324
+ }
10325
+ const block = anchorBlock(editor);
10326
+ if (block && Range.isCollapsed(editor.selection)) {
10327
+ // TODO:: 在撤销时有bug, 临时使用withoutSaving处理
10328
+ HistoryEditor.withoutSaving(editor, () => {
10329
+ const path = TheEditor.findPath(editor, block);
10330
+ setMarks(editor, obj, path);
10331
+ });
10332
+ }
10333
+ else {
10334
+ setMarks(editor, obj);
10335
+ }
10336
+ PaintFormatEditor.cancelFormatBrushStatus(editor);
10337
+ },
10338
+ isActive(editor) {
10339
+ const contextService = editor.injector.get(TheContextService);
10340
+ const res = contextService.paintFormatStatus.isActive;
10341
+ return res;
10342
+ },
10343
+ enableFormatBrush(editor) {
10344
+ const contextService = editor.injector.get(TheContextService);
10345
+ if (contextService.paintFormatStatus.isActive) {
10346
+ return PaintFormatEditor.cancelFormatBrushStatus(editor);
10347
+ }
10348
+ contextService.paintFormatStatus = {
10349
+ isActive: true,
10350
+ marks: getSelectionMarks(editor)
10351
+ };
10352
+ const element = EDITOR_TO_ELEMENT.get(editor);
10353
+ element.classList.add('pointer-paint');
10354
+ contextService.onMouseUp$
10355
+ .pipe(skip(1), filter(event => element.contains(event.target)), take(1))
10356
+ .subscribe((event) => {
10357
+ if (contextService.paintFormatStatus.isActive) {
10358
+ PaintFormatEditor.formatBrush(editor);
10359
+ }
10360
+ });
10361
+ editor.onChange();
10362
+ },
10363
+ cancelFormatBrushStatus(editor) {
10364
+ const contextService = editor.injector.get(TheContextService);
10365
+ contextService.paintFormatStatus = {
10366
+ isActive: false,
10367
+ marks: {}
10368
+ };
10369
+ const element = EDITOR_TO_ELEMENT.get(editor);
10370
+ element.classList.remove('pointer-paint');
10371
+ editor.onChange();
10372
+ }
10373
+ };
10374
+
10375
+ const PaintFormatOptions = [
10376
+ {
10377
+ key: ToolbarActionTypes.undo,
10378
+ icon: 'undo',
10379
+ name: '撤销',
10380
+ execute: (editor) => editor.undo()
10381
+ },
10382
+ {
10383
+ key: ToolbarActionTypes.redo,
10384
+ icon: 'redo',
10385
+ name: '重做',
10386
+ execute: (editor) => editor.redo()
10387
+ },
10388
+ {
10389
+ key: ToolbarActionTypes.paintformat,
10390
+ icon: 'paintformat',
10391
+ name: '格式刷',
10392
+ execute: PaintFormatEditor.enableFormatBrush,
10393
+ active: PaintFormatEditor.isActive
10394
+ },
10395
+ {
10396
+ key: ToolbarActionTypes.clean,
10397
+ icon: 'clean',
10398
+ name: '清除格式',
10399
+ execute: (editor) => {
10400
+ const { selection } = editor;
10401
+ if (!selection) {
10402
+ return;
10403
+ }
10404
+ if (TableEditor.clearMark(editor)) {
10405
+ return;
10406
+ }
10407
+ if (Range.isCollapsed(selection)) {
10408
+ const marks = Editor.marks(editor);
10409
+ for (const key of Object.keys(marks)) {
10410
+ Editor.removeMark(editor, key);
10411
+ }
10412
+ }
10413
+ else {
10414
+ const unsetMarks = {};
10415
+ MarkProps.forEach(key => {
10416
+ unsetMarks[key] = null;
10417
+ });
10418
+ setMarks(editor, unsetMarks);
10419
+ }
10420
+ }
10421
+ }
10422
+ ];
10423
+
10424
+ /**
10425
+ * whether the current node is a clean paragraph
10426
+ * @param editor
10427
+ * @param text
10428
+ * @returns boolean
10429
+ */
10430
+ const isCleanEmptyParagraph = (editor) => {
10431
+ const isCollapsedCursor = TheEditor.isFocused(editor) && editor.selection && Range.isCollapsed(editor.selection);
10432
+ if (!isCollapsedCursor) {
10433
+ return false;
10434
+ }
10435
+ const block = Node.ancestor(editor, [editor.selection.anchor.path[0]]);
10436
+ const textIndent = 'textIndent';
10437
+ const align = 'align';
10438
+ const hasTextIndent = block[textIndent];
10439
+ const hasAlign = block[align];
10440
+ if (Node.string(block) === '' &&
10441
+ Element$1.isElement(block) &&
10442
+ block.type === ElementKinds.paragraph &&
10443
+ block.children.length === 1 &&
10444
+ Text.isText(block.children[0]) &&
10445
+ !Editor.isVoid(editor, block) &&
10446
+ !hasTextIndent &&
10447
+ !hasAlign) {
10448
+ return true;
10449
+ }
10450
+ return false;
10451
+ };
10452
+
10453
+ class TheToolbarItemComponent extends TheToolbarBaseItemComponent {
10454
+ constructor(ngZone, cfr) {
10455
+ super();
10456
+ this.ngZone = ngZone;
10457
+ this.cfr = cfr;
10458
+ this.itemMode = ToolbarItemMode.horizontal;
10459
+ this.ToolbarItemMode = ToolbarItemMode;
10460
+ this.active = false;
10461
+ }
10462
+ ngOnInit() {
10463
+ var _a, _b;
10464
+ if (((_a = this.item) === null || _a === void 0 ? void 0 : _a.quickItemComponent) && isComponentType((_b = this.item) === null || _b === void 0 ? void 0 : _b.quickItemComponent)) {
10465
+ this.renderToolbarItem();
10466
+ }
10467
+ }
10468
+ statusChange(editor) {
10469
+ var _a, _b;
10470
+ this.active = ((_a = this.item) === null || _a === void 0 ? void 0 : _a.active) ? (_b = this.item) === null || _b === void 0 ? void 0 : _b.active(editor) : false;
10471
+ }
10472
+ execute(event) {
10473
+ var _a, _b, _c;
10474
+ super.execute(event);
10475
+ if (!((_a = this.item) === null || _a === void 0 ? void 0 : _a.execute) || ((_b = this.editor) === null || _b === void 0 ? void 0 : _b.disabled)) {
10476
+ return;
10477
+ }
10478
+ (_c = this.item) === null || _c === void 0 ? void 0 : _c.execute(this.editor);
10479
+ }
10480
+ renderToolbarItem() {
10481
+ this.ngZone.run(() => {
10482
+ const toolbarItemFactory = this.cfr.resolveComponentFactory(this.item.quickItemComponent);
10483
+ const tollbarItemRef = this.toolbarContainer.createComponent(toolbarItemFactory);
10484
+ tollbarItemRef.instance.editor = this.editor;
10485
+ tollbarItemRef.instance.item = this.item;
10486
+ tollbarItemRef.instance.itemMode = ToolbarItemMode.vertical;
10487
+ });
10488
+ }
10489
+ }
10490
+ TheToolbarItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarItemComponent, deps: [{ token: i0.NgZone }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component });
10491
+ TheToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarItemComponent, selector: "the-toolbar-item", inputs: { item: "item", editor: "editor", itemMode: "itemMode" }, host: { classAttribute: "the-toolbar-item" }, viewQueries: [{ propertyName: "toolbarContainer", first: true, predicate: ["toolbarContainer"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0, template: `
10492
+ <ng-container *ngIf="itemMode === ToolbarItemMode.horizontal; else selectionItem">
10493
+ <a
10494
+ thyIconNavLink
10495
+ [thyIconNavLinkIcon]="item.icon"
10496
+ [thyTooltip]="item.name"
10497
+ thyTooltipPlacement="top"
10498
+ [thyIconNavLinkActive]="active"
10499
+ (mousedown)="execute($event)"
10500
+ ></a>
10501
+ </ng-container>
10502
+ <ng-template #selectionItem>
10503
+ <ng-container *ngIf="!item?.quickItemComponent">
10504
+ <thy-icon [thyIconName]="item?.icon" [thyIconRotate]="0" class="quick-toolbar-icon"></thy-icon>
10505
+ <span class="quick-toolbar-name">{{ item?.name }}</span>
10506
+ </ng-container>
10507
+ </ng-template>
10508
+ <ng-container #toolbarContainer></ng-container>
10509
+ `, 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
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarItemComponent, decorators: [{
10511
+ type: Component,
10512
+ args: [{
10513
+ selector: 'the-toolbar-item',
10514
+ template: `
10515
+ <ng-container *ngIf="itemMode === ToolbarItemMode.horizontal; else selectionItem">
10516
+ <a
10517
+ thyIconNavLink
10518
+ [thyIconNavLinkIcon]="item.icon"
10519
+ [thyTooltip]="item.name"
10520
+ thyTooltipPlacement="top"
10521
+ [thyIconNavLinkActive]="active"
10522
+ (mousedown)="execute($event)"
10523
+ ></a>
10524
+ </ng-container>
10525
+ <ng-template #selectionItem>
10526
+ <ng-container *ngIf="!item?.quickItemComponent">
10527
+ <thy-icon [thyIconName]="item?.icon" [thyIconRotate]="0" class="quick-toolbar-icon"></thy-icon>
10528
+ <span class="quick-toolbar-name">{{ item?.name }}</span>
10529
+ </ng-container>
10530
+ </ng-template>
10531
+ <ng-container #toolbarContainer></ng-container>
10532
+ `,
10533
+ host: {
10534
+ class: 'the-toolbar-item'
10535
+ }
10536
+ }]
10537
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.ComponentFactoryResolver }]; }, propDecorators: { item: [{
10538
+ type: Input
10539
+ }], editor: [{
10540
+ type: Input
10541
+ }], itemMode: [{
10542
+ type: Input
10543
+ }], toolbarContainer: [{
10544
+ type: ViewChild,
10545
+ args: ['toolbarContainer', { read: ViewContainerRef, static: true }]
10546
+ }] } });
10547
+
10548
+ class TheQuickToolbarComponent extends mixinUnsubscribe(MixinBase) {
10549
+ constructor(popoverRef, elementRef) {
10550
+ super();
10551
+ this.popoverRef = popoverRef;
10552
+ this.elementRef = elementRef;
10553
+ this.ToolbarItemMode = ToolbarItemMode;
10554
+ this.ToolbarActionTypes = ToolbarActionTypes;
10555
+ }
10556
+ handleMouseDown(event) {
10557
+ if (!this.elementRef.nativeElement.contains(event.target)) {
10558
+ this.popoverRef.close();
10559
+ }
10560
+ else {
10561
+ event.preventDefault();
10562
+ }
10563
+ }
10564
+ handleEnter() {
10565
+ this.popoverRef.close();
10566
+ }
10567
+ ngOnInit() {
10568
+ this.editorElement = AngularEditor.toDOMNode(this.editor, this.editor);
10569
+ }
10570
+ stopPropagation(event) {
10571
+ event.preventDefault();
10572
+ }
10573
+ selectionChange(event) {
10574
+ this.removeHotKey();
10575
+ const toolbarItem = this.quickToolbarItems.find(item => item.key === event.value);
10576
+ if (toolbarItem === null || toolbarItem === void 0 ? void 0 : toolbarItem.execute) {
10577
+ toolbarItem.execute(this.editor);
10578
+ }
10579
+ }
10580
+ removeHotKey() {
10581
+ const node = Node.get(this.editor, this.editor.selection.anchor.path);
10582
+ if (node && Text.equals({ text: QUICK_TOOLBAR_HOTKEY }, node)) {
10583
+ Editor.deleteBackward(this.editor);
10584
+ }
10585
+ }
10586
+ ngOnDestroy() {
10587
+ super.ngOnDestroy();
10588
+ }
10589
+ }
10590
+ TheQuickToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheQuickToolbarComponent, deps: [{ token: i1$3.ThyPopoverRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
10591
+ TheQuickToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheQuickToolbarComponent, selector: "the-quick-toolbar", inputs: { editor: "editor", quickToolbarItems: "quickToolbarItems" }, host: { listeners: { "document: mousedown": "handleMouseDown($event)", "document: keydown.enter": "handleEnter()" } }, usesInheritance: true, ngImport: i0, template: "<thy-selection-list\n class=\"the-quick-toolbar\"\n [thyBindKeyEventContainer]=\"editorElement\"\n (thySelectionChange)=\"selectionChange($event)\"\n [thyMultiple]=\"false\"\n>\n <ng-container *ngFor=\"let item of quickToolbarItems\">\n <ng-container *ngIf=\"item.key !== ToolbarActionTypes.split; else splitLine\">\n <thy-list-option [thyValue]=\"item?.key\" (mousedown)=\"stopPropagation($event)\">\n <the-toolbar-item [editor]=\"editor\" [item]=\"item\" [itemMode]=\"ToolbarItemMode.vertical\"></the-toolbar-item>\n </thy-list-option>\n </ng-container>\n </ng-container>\n</thy-selection-list>\n\n<ng-template #splitLine>\n <nav-split-line [mode]=\"ToolbarItemMode.horizontal\"></nav-split-line>\n</ng-template>\n", components: [{ type: i2$3.ThySelectionListComponent, selector: "thy-selection-list,[thy-selection-list]", inputs: ["thyMultiple", "thyBindKeyEventContainer", "thyScrollContainer", "thyBeforeKeydown", "thyUniqueKey", "thyCompareWith", "thyLayout", "thyAutoActiveFirstItem", "thySize", "thySpaceKeyEnabled"], outputs: ["thySelectionChange"] }, { type: i5$3.ThyListOptionComponent, selector: "thy-list-option,[thy-list-option]", inputs: ["id", "thyValue", "thyDisabled"] }, { type: TheToolbarItemComponent, selector: "the-toolbar-item", inputs: ["item", "editor", "itemMode"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }], directives: [{ type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
10592
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheQuickToolbarComponent, decorators: [{
10593
+ type: Component,
10594
+ args: [{
10595
+ selector: 'the-quick-toolbar',
10596
+ templateUrl: 'quick-toolbar.component.html'
10597
+ }]
10598
+ }], ctorParameters: function () { return [{ type: i1$3.ThyPopoverRef }, { type: i0.ElementRef }]; }, propDecorators: { editor: [{
10599
+ type: Input
10600
+ }], quickToolbarItems: [{
10601
+ type: Input
10602
+ }], handleMouseDown: [{
10603
+ type: HostListener,
10604
+ args: ['document: mousedown', ['$event']]
10605
+ }], handleEnter: [{
10606
+ type: HostListener,
10607
+ args: ['document: keydown.enter']
10608
+ }] } });
10609
+
10610
+ const OperationTypes = ['insert_text', 'remove_node', 'merge_node'];
10611
+ const QuickInsertEditor = {
10612
+ openQuickToolbar(editor, toolbarItems, origin) {
10613
+ const overlay = editor.injector.get(Overlay);
10614
+ const viewContainerRef = editor.injector.get(ViewContainerRef);
10615
+ const thyPopover = editor.injector.get(ThyPopover);
10616
+ const quickToolbarRef = thyPopover.open(TheQuickToolbarComponent, {
10617
+ initialState: {
10618
+ editor,
10619
+ quickToolbarItems: toolbarItems
10620
+ },
10621
+ origin,
10622
+ viewContainerRef: viewContainerRef,
10623
+ backdropClosable: true,
10624
+ placement: 'bottomLeft',
10625
+ offset: 4,
10626
+ hasBackdrop: false,
10627
+ insideClosable: true,
10628
+ panelClass: 'the-quick-toolbar-container',
10629
+ scrollStrategy: overlay.scrollStrategies.reposition(),
10630
+ manualClosure: true
10631
+ });
10632
+ THE_EDITOR_QUICK_TOOLBAR_REF.set(editor, quickToolbarRef);
10633
+ },
10634
+ closeQuickToolbar(editor) {
10635
+ const quickToolbarRef = THE_EDITOR_QUICK_TOOLBAR_REF.get(editor);
10636
+ if (quickToolbarRef) {
10637
+ quickToolbarRef.close();
10638
+ THE_EDITOR_QUICK_TOOLBAR_REF.set(editor, null);
10639
+ }
10640
+ },
10641
+ isOpenToolbar(editor, opTypes = OperationTypes) {
10642
+ const isCollapsedCursor = TheEditor.isFocused(editor) && editor.selection && Range.isCollapsed(editor.selection);
10643
+ if (!isCollapsedCursor) {
10644
+ return false;
10645
+ }
10646
+ const block = Node.ancestor(editor, [editor.selection.anchor.path[0]]);
10647
+ const { undos } = editor.history;
10648
+ const lastBatch = undos[undos.length - 1];
10649
+ const lastOp = lastBatch && lastBatch[lastBatch.length - 1];
10650
+ if (lastOp &&
10651
+ block.children.length === 1 &&
10652
+ block.type === ElementKinds.paragraph &&
10653
+ Node.string(block) === QUICK_TOOLBAR_HOTKEY &&
10654
+ opTypes.includes(lastOp.type) &&
10655
+ (lastOp.text === QUICK_TOOLBAR_HOTKEY || lastOp.text === undefined)) {
10656
+ return true;
10657
+ }
10658
+ return false;
10659
+ }
10660
+ };
10661
+
10662
+ const withQuickInsert = (editor) => {
10663
+ const { onKeydown, deleteBackward, onChange } = editor;
10664
+ editor.onKeydown = (event) => {
10665
+ if (event.key === QUICK_TOOLBAR_HOTKEY && isCleanEmptyParagraph(editor)) {
10666
+ const rootNode = AngularEditor.toDOMNode(editor, Node.ancestor(editor, [editor.selection.anchor.path[0]]));
10667
+ const theEditorComponent = editor.injector.get(TheEditorComponent);
10668
+ const quickToolbars = theEditorComponent.quickToolbarItems;
10669
+ QuickInsertEditor.openQuickToolbar(editor, quickToolbars, rootNode);
10670
+ }
10671
+ onKeydown(event);
10672
+ };
10673
+ editor.deleteBackward = unit => {
10674
+ if (!QuickInsertEditor.isOpenToolbar(editor, ['remove_text'])) {
10675
+ QuickInsertEditor.closeQuickToolbar(editor);
10676
+ }
10677
+ deleteBackward(unit);
10678
+ };
10679
+ editor.onChange = () => {
10680
+ onChange();
10681
+ if (editor.selection) {
10682
+ const editorComponent = editor.injector.get(TheEditorComponent);
10683
+ editorComponent.quickInsertInstance.checkStatus();
10684
+ const block = Node.ancestor(editor, [editor.selection.anchor.path[0]]);
10685
+ if (!isCleanEmptyParagraph(editor) && Node.string(block) !== QUICK_TOOLBAR_HOTKEY) {
10686
+ QuickInsertEditor.closeQuickToolbar(editor);
10687
+ }
10688
+ }
10689
+ };
10690
+ return editor;
10691
+ };
10692
+
10693
+ const internalPlugins = [
10694
+ withTheHistory,
10695
+ withAutoInsertData(),
10696
+ withRemoveEmpty,
10697
+ withRemoveVoid,
10698
+ withBlockCard,
10699
+ withResetType,
10700
+ withIndent([ElementKinds.checkItem, ElementKinds.numberedList, ElementKinds.bulletedList, ElementKinds.paragraph, ...HEADING_TYPES]),
10701
+ withList({ validLiChildrenTypes: [ElementKinds.image] }),
10702
+ withLink,
10703
+ withTable,
10704
+ withTodoItem,
10705
+ withHr,
10706
+ withAlign,
10707
+ withCode,
10708
+ withHeading,
10709
+ withMark(),
10710
+ withBlockquote,
10711
+ withNodeID({ idKey: ELEMENT_UNIQUE_ID, idCreator }),
10164
10712
  withAutoFormat({ rules: autoFormatRules }),
10165
10713
  withTransforms(),
10166
10714
  withTrailingNode({ type: ElementKinds.paragraph, level: 0 }),
@@ -10169,7 +10717,8 @@ const internalPlugins = [
10169
10717
  withGetFragment(),
10170
10718
  withDeserializeHMTL,
10171
10719
  withDeserializeMd(),
10172
- withBlockCard // should in the front of list、resettype、todo、deserialize-html
10720
+ withImage,
10721
+ withQuickInsert
10173
10722
  ];
10174
10723
  const internalToolbarItems = [
10175
10724
  ...AlignOptions,
@@ -10184,7 +10733,8 @@ const internalToolbarItems = [
10184
10733
  ...CodeOptions,
10185
10734
  ...LinkOptions,
10186
10735
  ...TableOptions,
10187
- ...VerticalAlignOptions
10736
+ ...VerticalAlignOptions,
10737
+ ...PaintFormatOptions
10188
10738
  ];
10189
10739
  const toolbarCompose = (toolbarItems = []) => {
10190
10740
  return [...internalToolbarItems, ...toolbarItems];
@@ -10193,7 +10743,7 @@ const withTheEditor = (plugins, editor) => {
10193
10743
  const e = editor;
10194
10744
  e.renderElement = (element) => null;
10195
10745
  e.renderLeaf = (text) => null;
10196
- e.insertElement = (element) => TheTransforms.insertElementNext(e, element);
10746
+ e.insertElement = (element) => insertElementNext(e, element);
10197
10747
  e.isContainer = (value) => false;
10198
10748
  e.extraElementOptions = [];
10199
10749
  e.disabled = false;
@@ -10223,11 +10773,11 @@ const shortcuts = (editor, event) => {
10223
10773
  };
10224
10774
 
10225
10775
  class TheToolbarService {
10226
- initialize(toolbarItems, global = DefaultGlobalToolbarDefinition, inline = DefaultInlineToolbarDefinition, block = DefaultBlockToolbarDefinition) {
10776
+ initialize(toolbarItems, global = DefaultGlobalToolbarDefinition, inline = DefaultInlineToolbarDefinition, quick = DefaultQuickToolbarDefinition) {
10227
10777
  const toolbarDefinition = {
10228
10778
  global,
10229
- block,
10230
- inline
10779
+ inline,
10780
+ quick
10231
10781
  };
10232
10782
  const toolbarOperations = new Map();
10233
10783
  toolbarItems.forEach(i => toolbarOperations.set(i.key, i));
@@ -10269,7 +10819,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10269
10819
 
10270
10820
  const autoFocus = (editor, isFocus) => {
10271
10821
  setTimeout(() => {
10272
- if (editor && isFocus) {
10822
+ if (editor && editor.children.length > 0 && isFocus) {
10273
10823
  HistoryEditor.withoutMerging(editor, () => {
10274
10824
  AngularEditor.focus(editor);
10275
10825
  Transforms.select(editor, Editor.start(editor, [0]));
@@ -10306,73 +10856,6 @@ const autoScrollViewHandle = (editor, scrollContainer) => {
10306
10856
  previousHeight = currentHeight;
10307
10857
  };
10308
10858
 
10309
- class TheToolbarItemComponent extends TheToolbarBaseItemComponent {
10310
- constructor() {
10311
- super();
10312
- this.active = false;
10313
- }
10314
- statusChange(editor) {
10315
- var _a, _b;
10316
- this.active = ((_a = this.item) === null || _a === void 0 ? void 0 : _a.active) ? (_b = this.item) === null || _b === void 0 ? void 0 : _b.active(editor) : false;
10317
- }
10318
- execute(event) {
10319
- var _a, _b, _c;
10320
- super.execute(event);
10321
- if (!((_a = this.item) === null || _a === void 0 ? void 0 : _a.execute) || ((_b = this.editor) === null || _b === void 0 ? void 0 : _b.disabled)) {
10322
- return;
10323
- }
10324
- (_c = this.item) === null || _c === void 0 ? void 0 : _c.execute(this.editor);
10325
- }
10326
- }
10327
- TheToolbarItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
10328
- TheToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarItemComponent, selector: "the-toolbar-item", inputs: { item: "item", editor: "editor" }, host: { classAttribute: "the-toolbar-item" }, usesInheritance: true, ngImport: i0, template: `
10329
- <a
10330
- thyIconNavLink
10331
- [thyIconNavLinkIcon]="item.icon"
10332
- [thyTooltip]="item.name"
10333
- thyTooltipPlacement="top"
10334
- [thyIconNavLinkActive]="active"
10335
- (mousedown)="execute($event)"
10336
- ></a>
10337
- `, isInline: true, components: [{ type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }], directives: [{ type: i5$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
10338
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarItemComponent, decorators: [{
10339
- type: Component,
10340
- args: [{
10341
- selector: 'the-toolbar-item',
10342
- template: `
10343
- <a
10344
- thyIconNavLink
10345
- [thyIconNavLinkIcon]="item.icon"
10346
- [thyTooltip]="item.name"
10347
- thyTooltipPlacement="top"
10348
- [thyIconNavLinkActive]="active"
10349
- (mousedown)="execute($event)"
10350
- ></a>
10351
- `,
10352
- host: {
10353
- class: 'the-toolbar-item'
10354
- }
10355
- }]
10356
- }], ctorParameters: function () { return []; }, propDecorators: { item: [{
10357
- type: Input
10358
- }], editor: [{
10359
- type: Input
10360
- }] } });
10361
-
10362
- class NavSplitLineComponent {
10363
- constructor() { }
10364
- ngOnInit() { }
10365
- }
10366
- NavSplitLineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: NavSplitLineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
10367
- NavSplitLineComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: NavSplitLineComponent, selector: "nav-split-line", ngImport: i0, template: '', isInline: true });
10368
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: NavSplitLineComponent, decorators: [{
10369
- type: Component,
10370
- args: [{
10371
- selector: 'nav-split-line',
10372
- template: ''
10373
- }]
10374
- }], ctorParameters: function () { return []; } });
10375
-
10376
10859
  class TheToolbarComponent {
10377
10860
  constructor(cfr, elementRef, ngZone, toolbarGroupComponent) {
10378
10861
  this.cfr = cfr;
@@ -10425,14 +10908,12 @@ class TheToolbarComponent {
10425
10908
  this.resizeObserver.observe(editableElement);
10426
10909
  }
10427
10910
  statusChange(editor) {
10428
- if (editor === null || editor === void 0 ? void 0 : editor.selection) {
10429
- const toolbarItems = [...this.toolbarItems, this.moreGroupMenu];
10430
- for (const item of toolbarItems) {
10431
- if (item.key !== ToolbarActionTypes.split) {
10432
- const itemComponent = this.components.get(item.key);
10433
- if (itemComponent) {
10434
- itemComponent.instance.statusChange(editor);
10435
- }
10911
+ const toolbarItems = [...this.toolbarItems, this.moreGroupMenu];
10912
+ for (const item of toolbarItems) {
10913
+ if (item.key !== ToolbarActionTypes.split) {
10914
+ const itemComponent = this.components.get(item.key);
10915
+ if (itemComponent) {
10916
+ itemComponent.instance.statusChange(editor);
10436
10917
  }
10437
10918
  }
10438
10919
  }
@@ -10607,52 +11088,223 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10607
11088
  args: ['toolbarContainer', { read: ViewContainerRef, static: true }]
10608
11089
  }] } });
10609
11090
 
11091
+ class TheInlineToolbarComponent {
11092
+ constructor(elementRef, scrollDispatcher, cdr, ngZone) {
11093
+ this.elementRef = elementRef;
11094
+ this.scrollDispatcher = scrollDispatcher;
11095
+ this.cdr = cdr;
11096
+ this.ngZone = ngZone;
11097
+ this.destroy$ = new Subject();
11098
+ }
11099
+ ngOnInit() {
11100
+ this.scrollDispatcher
11101
+ .scrolled()
11102
+ .pipe(takeUntil(this.destroy$))
11103
+ .subscribe(() => {
11104
+ this.updateInlineToolbar();
11105
+ this.cdr.detectChanges();
11106
+ });
11107
+ this.ngZone.runOutsideAngular(() => {
11108
+ merge(fromEvent(document, 'mouseup').pipe(filter((e) => e.button !== 2)), fromEvent(document, 'keyup').pipe(filter((e) => !e.shiftKey)))
11109
+ .pipe(debounceTime(200), takeUntil(this.destroy$))
11110
+ .subscribe(() => {
11111
+ var _a;
11112
+ this.updateInlineToolbar();
11113
+ (_a = this.inlineToolbar) === null || _a === void 0 ? void 0 : _a.statusChange(this.editor);
11114
+ this.cdr.detectChanges();
11115
+ });
11116
+ });
11117
+ }
11118
+ updateInlineToolbar() {
11119
+ const inlineToolbar = this.elementRef.nativeElement.firstElementChild;
11120
+ if (!this.editor.selection) {
11121
+ inlineToolbar.removeAttribute('style');
11122
+ return;
11123
+ }
11124
+ const anchorBlock$1 = anchorBlock(this.editor);
11125
+ if (!inlineToolbar || !anchorBlock$1) {
11126
+ return;
11127
+ }
11128
+ const { editor } = this;
11129
+ const { selection } = editor;
11130
+ if (!selection || !AngularEditor.isFocused(editor) || Range.isCollapsed(selection) || Editor.string(editor, selection) === '') {
11131
+ inlineToolbar.removeAttribute('style');
11132
+ return;
11133
+ }
11134
+ if (!THE_INLINE_TOOLBAR_TYPES.includes(anchorBlock$1.type)) {
11135
+ return;
11136
+ }
11137
+ const native = window.getSelection();
11138
+ if (native.type !== 'None') {
11139
+ const range = native.getRangeAt(0);
11140
+ this.updatePosition(inlineToolbar, range);
11141
+ }
11142
+ }
11143
+ updatePosition(toolbarElement, range) {
11144
+ let boundary = range.getBoundingClientRect();
11145
+ if (!boundary || (boundary.height === 0 && boundary.width === 0 && range.startContainer === range.endContainer)) {
11146
+ if (range.startContainer.nodeType === 1 && range.startContainer.querySelector('img')) {
11147
+ boundary = range.startContainer.querySelector('img').getBoundingClientRect();
11148
+ }
11149
+ else {
11150
+ boundary = range.startContainer.getBoundingClientRect();
11151
+ }
11152
+ }
11153
+ const toolbarHeight = toolbarElement.offsetHeight;
11154
+ const toolbarWidth = toolbarElement.offsetWidth;
11155
+ const halfOffsetWidth = toolbarWidth / 2;
11156
+ const defaultLeft = -halfOffsetWidth;
11157
+ const positions = {};
11158
+ positions.top = boundary.top - toolbarHeight;
11159
+ positions.left = boundary.left + boundary.width / 2 + defaultLeft;
11160
+ positions.right = 'initial';
11161
+ ['top', 'left', 'right'].forEach(key => {
11162
+ toolbarElement.style[key] = positions[key] + (isNaN(positions[key]) ? '' : 'px');
11163
+ });
11164
+ toolbarElement.style.opacity = '1';
11165
+ }
11166
+ ngOnDestroy() {
11167
+ this.destroy$.next();
11168
+ this.destroy$.complete();
11169
+ }
11170
+ }
11171
+ 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 });
11172
+ 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
11173
+ #inlineToolbar
11174
+ class="the-inline-toolbar"
11175
+ [editor]="editor"
11176
+ [toolbarItems]="toolbarItems"
11177
+ [isMore]="false"
11178
+ ></the-toolbar> `, isInline: true, components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "isMore", "afterTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
11179
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInlineToolbarComponent, decorators: [{
11180
+ type: Component,
11181
+ args: [{
11182
+ selector: 'the-inline-toolbar',
11183
+ template: `<the-toolbar
11184
+ #inlineToolbar
11185
+ class="the-inline-toolbar"
11186
+ [editor]="editor"
11187
+ [toolbarItems]="toolbarItems"
11188
+ [isMore]="false"
11189
+ ></the-toolbar> `,
11190
+ host: {
11191
+ '[class.hide]': 'toolbarItems.length === 0'
11192
+ },
11193
+ changeDetection: ChangeDetectionStrategy.OnPush
11194
+ }]
11195
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2$1.ScrollDispatcher }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }]; }, propDecorators: { editor: [{
11196
+ type: Input
11197
+ }], toolbarItems: [{
11198
+ type: Input
11199
+ }], inlineToolbar: [{
11200
+ type: ViewChild,
11201
+ args: ['inlineToolbar']
11202
+ }] } });
11203
+
11204
+ class TheQuickInsertComponent {
11205
+ constructor(renderer, elementRef, cdr) {
11206
+ this.renderer = renderer;
11207
+ this.elementRef = elementRef;
11208
+ this.cdr = cdr;
11209
+ this.isHide = true;
11210
+ this.defaultIconName = 'plus-circle-thin';
11211
+ this.iconNameFill = 'plus-circle-thin-fill';
11212
+ this.displayIconName = this.defaultIconName;
11213
+ }
11214
+ handleMousedownNativeElement(event) {
11215
+ event.preventDefault();
11216
+ event.stopPropagation();
11217
+ }
11218
+ checkStatus() {
11219
+ var _a;
11220
+ const { editor } = this;
11221
+ if (isCleanEmptyParagraph(editor)) {
11222
+ 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]]);
11223
+ const rootNode = AngularEditor.toDOMNode(editor, block);
11224
+ this.isHide = false;
11225
+ this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
11226
+ return;
11227
+ }
11228
+ this.isHide = true;
11229
+ }
11230
+ updatePosition(left, top) {
11231
+ this.isHide = false;
11232
+ this.renderer.setStyle(this.elementRef.nativeElement, 'top', `${top}px`);
11233
+ this.renderer.setStyle(this.elementRef.nativeElement, 'left', `${left}px`);
11234
+ }
11235
+ mouseEnter(event) {
11236
+ this.displayIconName = this.iconNameFill;
11237
+ this.cdr.markForCheck();
11238
+ }
11239
+ mouseLeave(event) {
11240
+ this.displayIconName = this.defaultIconName;
11241
+ this.cdr.markForCheck();
11242
+ }
11243
+ handleClick(event) {
11244
+ event.stopPropagation();
11245
+ event.preventDefault();
11246
+ QuickInsertEditor.openQuickToolbar(this.editor, this.quickToolbarItems, this.iconElement.nativeElement);
11247
+ }
11248
+ }
11249
+ TheQuickInsertComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheQuickInsertComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
11250
+ TheQuickInsertComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: { editor: "editor", quickToolbarItems: "quickToolbarItems" }, host: { listeners: { "mousedown": "handleMousedownNativeElement($event)" }, properties: { "class.hide": "isHide" }, classAttribute: "the-quick-insert" }, viewQueries: [{ propertyName: "iconElement", first: true, predicate: ["iconElement"], descendants: true, read: ElementRef }], ngImport: i0, template: "<thy-icon\n #iconElement\n [thyIconName]=\"displayIconName\"\n class=\"quick-insert-icon text-desc font-size-xlg\"\n (mouseenter)=\"mouseEnter($event)\"\n (mouseleave)=\"mouseLeave($event)\"\n (mousedown)=\"handleClick($event)\"\n></thy-icon>\n", components: [{ type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }] });
11251
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheQuickInsertComponent, decorators: [{
11252
+ type: Component,
11253
+ args: [{
11254
+ selector: '[theQuickInsert]',
11255
+ templateUrl: './quick-insert.component.html',
11256
+ host: {
11257
+ class: 'the-quick-insert',
11258
+ '[class.hide]': 'isHide'
11259
+ }
11260
+ }]
11261
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { editor: [{
11262
+ type: Input
11263
+ }], quickToolbarItems: [{
11264
+ type: Input
11265
+ }], iconElement: [{
11266
+ type: ViewChild,
11267
+ args: ['iconElement', { read: ElementRef, static: false }]
11268
+ }], handleMousedownNativeElement: [{
11269
+ type: HostListener,
11270
+ args: ['mousedown', ['$event']]
11271
+ }] } });
11272
+
10610
11273
  class ThePlaceholderComponent {
10611
11274
  constructor(renderer, elementRef) {
10612
11275
  this.renderer = renderer;
10613
11276
  this.elementRef = elementRef;
10614
11277
  this.isHide = true;
10615
11278
  }
10616
- get selection() {
10617
- return this.editor.selection;
10618
- }
10619
11279
  handleCompositionStart() {
10620
- this.hide();
11280
+ var _a;
11281
+ if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.selection) {
11282
+ this.hide();
11283
+ }
10621
11284
  }
10622
11285
  handleCompositionEnd(event) {
10623
11286
  if (!event.data) {
10624
11287
  this.checkStatus();
10625
11288
  }
10626
11289
  }
10627
- checkStatus(value) {
11290
+ checkStatus() {
11291
+ var _a, _b, _c;
10628
11292
  const { editor } = this;
10629
- const children = value ? value : editor.children;
10630
11293
  // empty content and no selection processing
10631
- if (this.autoFocus && !this.selection && TheQueries.isEmptyContent(children)) {
10632
- this.updatePosition(30, 51);
10633
- this.isHide = false;
11294
+ if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.autoFocus) && !(editor === null || editor === void 0 ? void 0 : editor.selection) && isEmptyContent(editor.children)) {
11295
+ // normal top is 28, but margin-top: -41px is set when maxHeight is set, so top is 69
11296
+ const firstTop = ((_b = this.options) === null || _b === void 0 ? void 0 : _b.maxHeight) ? 69 : 28;
11297
+ this.updatePosition(30, firstTop);
10634
11298
  return;
10635
11299
  }
10636
- if (AngularEditor.isFocused(editor) && this.selection && Range.isCollapsed(this.selection)) {
10637
- const block = Node.ancestor(editor, [this.selection.anchor.path[0]]);
10638
- const textIndent = 'textIndent';
10639
- const align = 'align';
10640
- const hasTextIndent = block[textIndent];
10641
- const hasAlign = block[align];
10642
- if (Node.string(block) === '' &&
10643
- Element$1.isElement(block) &&
10644
- block.type === ElementKinds.paragraph &&
10645
- block.children.length === 1 &&
10646
- Text.isText(block.children[0]) &&
10647
- !Editor.isVoid(editor, block) &&
10648
- !hasTextIndent &&
10649
- !hasAlign) {
10650
- const rootNode = AngularEditor.toDOMNode(this.editor, block);
10651
- this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
10652
- return;
10653
- }
11300
+ if (isCleanEmptyParagraph(editor)) {
11301
+ 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]]);
11302
+ const rootNode = AngularEditor.toDOMNode(editor, block);
11303
+ this.isHide = false;
11304
+ this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
11305
+ return;
10654
11306
  }
10655
- this.hide();
11307
+ this.isHide = true;
10656
11308
  }
10657
11309
  updatePosition(left, top) {
10658
11310
  this.isHide = false;
@@ -10664,12 +11316,12 @@ class ThePlaceholderComponent {
10664
11316
  }
10665
11317
  }
10666
11318
  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 });
10667
- ThePlaceholderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: { editor: "editor", autoFocus: "autoFocus", placeholder: "placeholder" }, host: { listeners: { "document:compositionstart": "handleCompositionStart()", "document:compositionend": "handleCompositionEnd($event)" }, properties: { "class.hide": "isHide" }, classAttribute: "the-placeholder" }, ngImport: i0, template: `{{ placeholder }}`, isInline: true });
11319
+ 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 });
10668
11320
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: ThePlaceholderComponent, decorators: [{
10669
11321
  type: Component,
10670
11322
  args: [{
10671
11323
  selector: 'div[thePlaceholder]',
10672
- template: `{{ placeholder }}`,
11324
+ template: `{{ options?.placeholder }}`,
10673
11325
  host: {
10674
11326
  class: 'the-placeholder',
10675
11327
  '[class.hide]': 'isHide'
@@ -10677,9 +11329,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10677
11329
  }]
10678
11330
  }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { editor: [{
10679
11331
  type: Input
10680
- }], autoFocus: [{
10681
- type: Input
10682
- }], placeholder: [{
11332
+ }], options: [{
10683
11333
  type: Input
10684
11334
  }], handleCompositionStart: [{
10685
11335
  type: HostListener,
@@ -10762,7 +11412,6 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10762
11412
  this.theOnDOMEvent = new EventEmitter();
10763
11413
  this.theEditorCreated = new EventEmitter();
10764
11414
  this._plugins = [];
10765
- this.globalToolbarItems = [];
10766
11415
  this.autoScrollView = _.debounce(function (editor, scrollContainer) {
10767
11416
  return autoScrollViewHandle(editor, scrollContainer);
10768
11417
  }, 80);
@@ -10853,9 +11502,6 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10853
11502
  this.onSlaCompositionEnd = (event) => { };
10854
11503
  this.onSlaDragStart = (event) => { };
10855
11504
  this.onSlaDragOver = (event) => { };
10856
- this.trackBy = (element) => {
10857
- return element.key;
10858
- };
10859
11505
  }
10860
11506
  get theGlobalToolbarInstance() {
10861
11507
  return this.theGlobalToolbar ? this.theGlobalToolbar : this.globalToolbarInstance;
@@ -10864,6 +11510,10 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10864
11510
  var _a, _b;
10865
11511
  return ((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.maxHeight) ? `${(_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.maxHeight}px` : null;
10866
11512
  }
11513
+ get quickToolbarItems() {
11514
+ var _a;
11515
+ return (_a = this.toolbarEntity) === null || _a === void 0 ? void 0 : _a.quick;
11516
+ }
10867
11517
  ngOnInit() {
10868
11518
  this.initialize();
10869
11519
  this.onErrorHandler();
@@ -10919,8 +11569,8 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10919
11569
  var _a;
10920
11570
  const toolbar = (_a = this === null || this === void 0 ? void 0 : this.theOptions) === null || _a === void 0 ? void 0 : _a.toolbar;
10921
11571
  const toolbarItems = toolbarCompose(toolbar === null || toolbar === void 0 ? void 0 : toolbar.toolbarItems);
10922
- const toolbarOption = this.toolbarService.initialize(toolbarItems, toolbar === null || toolbar === void 0 ? void 0 : toolbar.global, toolbar === null || toolbar === void 0 ? void 0 : toolbar.block, toolbar === null || toolbar === void 0 ? void 0 : toolbar.inline);
10923
- this.globalToolbarItems = toolbarOption.toolbarEntity.global;
11572
+ 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);
11573
+ this.toolbarEntity = toolbarOption.toolbarEntity;
10924
11574
  if (this.theGlobalToolbar) {
10925
11575
  this.theGlobalToolbarInstance.editor = this.editor;
10926
11576
  this.theGlobalToolbarInstance.toolbarItems = toolbarOption.toolbarEntity.global;
@@ -10930,11 +11580,10 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10930
11580
  }
10931
11581
  }
10932
11582
  writeValue(value) {
10933
- var _a, _b;
11583
+ var _a;
10934
11584
  const data = dataDeserialize((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.mode, value);
10935
11585
  // data-deserialize
10936
11586
  this.editorValue = data;
10937
- (_b = this.placeholderInstance) === null || _b === void 0 ? void 0 : _b.checkStatus(data);
10938
11587
  }
10939
11588
  registerOnChange(fn) {
10940
11589
  this.onChangeCallback = fn;
@@ -10943,13 +11592,14 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10943
11592
  this.onTouchedCallback = fn;
10944
11593
  }
10945
11594
  valueChange(value) {
10946
- var _a, _b, _c, _d, _e;
11595
+ var _a, _b, _c, _d;
10947
11596
  (_a = this.theGlobalToolbarInstance) === null || _a === void 0 ? void 0 : _a.statusChange(this.editor);
10948
- (_b = this.placeholderInstance) === null || _b === void 0 ? void 0 : _b.checkStatus();
11597
+ this.quickInsertInstance.checkStatus();
11598
+ this.placeholderInstance.checkStatus();
10949
11599
  // auto scroll view
10950
- const scrollContainer = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.scrollContainer;
10951
- const maxHeight = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.maxHeight;
10952
- if (!((_e = this.theOptions) === null || _e === void 0 ? void 0 : _e.readonly) && (scrollContainer || maxHeight)) {
11600
+ const scrollContainer = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.scrollContainer;
11601
+ const maxHeight = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.maxHeight;
11602
+ if (!((_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.readonly) && (scrollContainer || maxHeight)) {
10953
11603
  const container = maxHeight ? DEFAULT_SCROLL_CONTAINER : scrollContainer;
10954
11604
  this.autoScrollView(this.editor, container);
10955
11605
  }
@@ -11012,7 +11662,7 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
11012
11662
  const blockCardEntry = AngularEditor.toSlateCardEntry(this.editor, relativeBlockCardElement.firstElementChild);
11013
11663
  if (blockCardEntry && blockCardEntry[1]) {
11014
11664
  const rootNodePath = blockCardEntry[1].slice(0, 1);
11015
- const rootNode = TheQueries.getNode(this.editor, rootNodePath);
11665
+ const rootNode = getNode(this.editor, rootNodePath);
11016
11666
  if (this.editor.isBlockCard(rootNode)) {
11017
11667
  event.preventDefault();
11018
11668
  AngularEditor.moveBlockCard(this.editor, rootNode, { direction: event.x < centerX ? 'left' : 'right' });
@@ -11024,13 +11674,13 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
11024
11674
  handleSelectAll() {
11025
11675
  let node;
11026
11676
  if (!this.editor.selection) {
11027
- TheTransforms.setEndSelection(this.editor);
11677
+ setEndSelection(this.editor);
11028
11678
  }
11029
11679
  const [start, end] = Range.edges(this.editor.selection);
11030
11680
  const selectionRange = Editor.range(this.editor, start, end);
11031
- const containerBlocks = TheQueries.getContainerBlocks(this.editor);
11681
+ const containerBlocks = getContainerBlocks(this.editor);
11032
11682
  for (let i = 0; i < containerBlocks.length; i++) {
11033
- [node] = TheQueries.getNodesByType(this.editor, containerBlocks[i]);
11683
+ [node] = getNodesByType(this.editor, containerBlocks[i]);
11034
11684
  if (node) {
11035
11685
  const [, path] = node;
11036
11686
  const isStartParent = Path.equals(path, start.path.slice(0, path.length));
@@ -11074,7 +11724,7 @@ TheEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
11074
11724
  useExisting: forwardRef(() => TheEditorComponent),
11075
11725
  multi: true
11076
11726
  }
11077
- ], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], 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 [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"globalToolbarItems\"\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 }\"\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 [trackBy]=\"trackBy\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n <div\n *ngIf=\"theOptions?.placeholder\"\n #placeholder\n thePlaceholder\n [editor]=\"editor\"\n [autoFocus]=\"theOptions?.placeholder?.autoFocus\"\n [placeholder]=\"theOptions?.placeholder\"\n ></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: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: ["editor", "autoFocus", "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"] }] });
11727
+ ], 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 [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"] }] });
11078
11728
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheEditorComponent, decorators: [{
11079
11729
  type: Component,
11080
11730
  args: [{
@@ -11117,6 +11767,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11117
11767
  }], globalToolbarInstance: [{
11118
11768
  type: ViewChild,
11119
11769
  args: ['globalToolbar']
11770
+ }], quickInsertInstance: [{
11771
+ type: ViewChild,
11772
+ args: ['quickInsert']
11120
11773
  }], placeholderInstance: [{
11121
11774
  type: ViewChild,
11122
11775
  args: ['placeholder']
@@ -11235,7 +11888,7 @@ class TheToolbarGroupComponent {
11235
11888
  }
11236
11889
  }
11237
11890
  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 });
11238
- 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: i5$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
11891
+ 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"] }] });
11239
11892
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarGroupComponent, decorators: [{
11240
11893
  type: Component,
11241
11894
  args: [{
@@ -11282,10 +11935,12 @@ const COMPONENTS = [
11282
11935
  TheToolbarDropdownComponent,
11283
11936
  TheToolbarGroupComponent,
11284
11937
  TheToolbarItemComponent,
11938
+ TheInlineToolbarComponent,
11285
11939
  NavSplitLineComponent,
11286
11940
  TheTextComponent,
11287
11941
  TheDefaultElementComponent,
11288
- ThePlaceholderComponent,
11942
+ TheQuickInsertComponent,
11943
+ TheQuickToolbarComponent,
11289
11944
  TheColorSelectComponent,
11290
11945
  TheColorToolbarItemComponent,
11291
11946
  TheContextMenuComponent,
@@ -11312,7 +11967,8 @@ const PLUGIN_COMPONENTS = [
11312
11967
  TheTableToolbarComponent,
11313
11968
  TheTableComponent,
11314
11969
  TheTableRowComponent,
11315
- TheTdComponent
11970
+ TheTdComponent,
11971
+ ThePlaceholderComponent
11316
11972
  ];
11317
11973
  const PIPES = [ElementStylePipe, ElementClassPipe];
11318
11974
  class TheEditorModule {
@@ -11322,10 +11978,12 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
11322
11978
  TheToolbarDropdownComponent,
11323
11979
  TheToolbarGroupComponent,
11324
11980
  TheToolbarItemComponent,
11981
+ TheInlineToolbarComponent,
11325
11982
  NavSplitLineComponent,
11326
11983
  TheTextComponent,
11327
11984
  TheDefaultElementComponent,
11328
- ThePlaceholderComponent,
11985
+ TheQuickInsertComponent,
11986
+ TheQuickToolbarComponent,
11329
11987
  TheColorSelectComponent,
11330
11988
  TheColorToolbarItemComponent,
11331
11989
  TheContextMenuComponent,
@@ -11349,7 +12007,8 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
11349
12007
  TheTableToolbarComponent,
11350
12008
  TheTableComponent,
11351
12009
  TheTableRowComponent,
11352
- TheTdComponent], imports: [CommonModule, SlateModule, FormsModule, ThyIconModule,
12010
+ TheTdComponent,
12011
+ ThePlaceholderComponent], imports: [CommonModule, SlateModule, FormsModule, ThyIconModule,
11353
12012
  ThyAvatarModule,
11354
12013
  ThyNavModule,
11355
12014
  ThyFormModule,
@@ -11368,7 +12027,8 @@ TheEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version
11368
12027
  {
11369
12028
  provide: TheToolbarGroupToken,
11370
12029
  useValue: TheToolbarGroupComponent
11371
- }
12030
+ },
12031
+ THE_CODE_MODE_PROVIDER
11372
12032
  ], imports: [[CommonModule, SlateModule, FormsModule, ...TETHYS, CodemirrorModule, TheColumnSizeModule]] });
11373
12033
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheEditorModule, decorators: [{
11374
12034
  type: NgModule,
@@ -11381,7 +12041,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11381
12041
  {
11382
12042
  provide: TheToolbarGroupToken,
11383
12043
  useValue: TheToolbarGroupComponent
11384
- }
12044
+ },
12045
+ THE_CODE_MODE_PROVIDER
11385
12046
  ]
11386
12047
  }]
11387
12048
  }] });
@@ -11394,5 +12055,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11394
12055
  * Generated bundle index. Do not edit.
11395
12056
  */
11396
12057
 
11397
- export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BLOCK_INSERT_ORIGIN, BLOCK_TOOLBAR_HOTKEY, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CodeEditor, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultBlockToolbarDefinition, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, EditorMode, 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, STANDARD_HEADING_TYPES, TAB_SPACE, THE_EDITOR_CONFIG_PROVIDER, THE_EDITOR_CONFIG_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorConfig, TheEditorModule, TheImageComponent, TheMode, TheQueries, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, createEmptyParagraph, dataDeserialize, dataSerializing, getToolbarClass, htmlToTheia, inValidTypes, plainToTheia, toolbarCompose, withTheEditor };
12058
+ 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 };
11398
12059
  //# sourceMappingURL=worktile-theia.js.map