@worktile/theia 2.1.4 → 2.1.5

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 (54) hide show
  1. package/bundles/worktile-theia.umd.js +287 -58
  2. package/bundles/worktile-theia.umd.js.map +1 -1
  3. package/components/toolbar/toolbar.component.d.ts +1 -3
  4. package/constants/default.d.ts +1 -0
  5. package/constants/node-types.d.ts +4 -3
  6. package/custom-types.d.ts +4 -1
  7. package/editor.module.d.ts +24 -23
  8. package/esm2015/components/inline-toolbar/inline-toolbar.component.js +1 -1
  9. package/esm2015/components/toolbar/toolbar.component.js +7 -6
  10. package/esm2015/components/toolbar-group/toolbar-group.component.js +1 -1
  11. package/esm2015/constants/auto-format-rules.js +8 -3
  12. package/esm2015/constants/default.js +2 -1
  13. package/esm2015/constants/node-types.js +5 -4
  14. package/esm2015/constants/toolbar.js +5 -5
  15. package/esm2015/custom-types.js +1 -1
  16. package/esm2015/editor.component.js +10 -6
  17. package/esm2015/editor.module.js +6 -3
  18. package/esm2015/interfaces/auto-format.js +1 -1
  19. package/esm2015/interfaces/element.js +1 -1
  20. package/esm2015/plugins/autoformat/autoformat.plugin.js +2 -1
  21. package/esm2015/plugins/autoformat/transforms/auto-format-inline.js +27 -14
  22. package/esm2015/plugins/code/code.component.js +26 -10
  23. package/esm2015/plugins/font-size/font-size.editor.js +35 -1
  24. package/esm2015/plugins/index.js +7 -3
  25. package/esm2015/plugins/inline-code/inline-code.component.js +27 -0
  26. package/esm2015/plugins/inline-code/inline-code.editor.js +45 -0
  27. package/esm2015/plugins/inline-code/inline-code.plugin.js +46 -0
  28. package/esm2015/plugins/inline-code/options.js +14 -0
  29. package/esm2015/plugins/link/link.component.js +4 -2
  30. package/esm2015/plugins/list/components/list-item.component.js +29 -3
  31. package/esm2015/plugins/mark/options.js +1 -9
  32. package/esm2015/services/context.service.js +9 -1
  33. package/esm2015/shortcuts/mark.js +10 -4
  34. package/fesm2015/worktile-theia.js +283 -60
  35. package/fesm2015/worktile-theia.js.map +1 -1
  36. package/interfaces/auto-format.d.ts +1 -1
  37. package/interfaces/element.d.ts +1 -1
  38. package/package.json +1 -1
  39. package/plugins/autoformat/transforms/auto-format-inline.d.ts +3 -1
  40. package/plugins/code/code.component.d.ts +6 -3
  41. package/plugins/code/code.component.scss +16 -0
  42. package/plugins/font-size/font-size.editor.d.ts +2 -0
  43. package/plugins/inline-code/inline-code.component.d.ts +14 -0
  44. package/plugins/inline-code/inline-code.component.scss +13 -0
  45. package/plugins/inline-code/inline-code.editor.d.ts +7 -0
  46. package/plugins/inline-code/inline-code.plugin.d.ts +2 -0
  47. package/plugins/inline-code/options.d.ts +2 -0
  48. package/plugins/list/components/list-item.component.d.ts +4 -1
  49. package/queries/get-container-blocks.d.ts +1 -1
  50. package/queries/get-selection-marks.d.ts +1 -1
  51. package/services/context.service.d.ts +5 -1
  52. package/styles/editor.scss +18 -4
  53. package/styles/index.scss +1 -0
  54. package/transforms/set-marks.d.ts +1 -1
@@ -20,7 +20,7 @@ import * as i2 from '@angular/cdk/overlay';
20
20
  import { Overlay, OverlayModule } from '@angular/cdk/overlay';
21
21
  import * as i1$1 from 'ngx-tethys/alert';
22
22
  import { ThyAlertModule } from 'ngx-tethys/alert';
23
- import { map, take, delay, startWith, distinctUntilChanged, skip, share, filter, throttleTime, takeUntil, mapTo, debounceTime, pairwise } from 'rxjs/operators';
23
+ import { map, takeUntil, take, delay, startWith, distinctUntilChanged, skip, share, filter, throttleTime, mapTo, debounceTime, pairwise } from 'rxjs/operators';
24
24
  import { ThyUploadStatus } from 'ngx-tethys/uploader';
25
25
  import * as i1$2 from '@angular/platform-browser';
26
26
  import { fromEvent, timer, Subject, combineLatest, Observable, BehaviorSubject, merge, ReplaySubject } from 'rxjs';
@@ -68,6 +68,7 @@ const TAB_SPACE = ' ';
68
68
  const CLIPBOARD_FORMAT_KEY = 'x-theia-fragment';
69
69
  const DEFAULT_SCROLL_CONTAINER = '.the-editable-container';
70
70
  const ELEMENT_UNIQUE_ID = 'key';
71
+ const ZERO_WIDTH_CHAR = '\u200B';
71
72
  var TheMode;
72
73
  (function (TheMode) {
73
74
  TheMode["fullMode"] = "full";
@@ -98,6 +99,7 @@ var ElementKinds;
98
99
  ElementKinds["hr"] = "hr";
99
100
  ElementKinds["link"] = "link";
100
101
  ElementKinds["default"] = "paragraph";
102
+ ElementKinds["inlineCode"] = "inline-code";
101
103
  })(ElementKinds || (ElementKinds = {}));
102
104
  var Alignment;
103
105
  (function (Alignment) {
@@ -147,8 +149,8 @@ var MarkTypes;
147
149
  MarkTypes["strike"] = "strike";
148
150
  MarkTypes["color"] = "color";
149
151
  MarkTypes["backgroundColor"] = "background-color";
150
- MarkTypes["codeLine"] = "code-line";
151
152
  MarkTypes["fontSize"] = "font-size";
153
+ MarkTypes["codeLine"] = "code-line";
152
154
  })(MarkTypes || (MarkTypes = {}));
153
155
  var ToolbarActionTypes;
154
156
  (function (ToolbarActionTypes) {
@@ -173,12 +175,12 @@ var ToolbarActionTypes;
173
175
  const MarkProps = [
174
176
  MarkTypes.backgroundColor,
175
177
  MarkTypes.bold,
176
- MarkTypes.codeLine,
177
178
  MarkTypes.color,
178
179
  MarkTypes.italic,
179
180
  MarkTypes.strike,
180
181
  MarkTypes.underline,
181
- MarkTypes.fontSize
182
+ MarkTypes.fontSize,
183
+ MarkTypes.codeLine
182
184
  ];
183
185
  const THE_INLINE_TOOLBAR_TYPES = [ElementKinds.default, ElementKinds.listItem, ElementKinds.checkItem];
184
186
  const STANDARD_HEADING_TYPES = [
@@ -214,7 +216,7 @@ const DefaultGlobalToolbarDefinition = [
214
216
  MarkTypes.italic,
215
217
  MarkTypes.underline,
216
218
  MarkTypes.strike,
217
- MarkTypes.codeLine,
219
+ ElementKinds.inlineCode,
218
220
  MarkTypes.color,
219
221
  MarkTypes.backgroundColor,
220
222
  ToolbarActionTypes.split,
@@ -223,7 +225,7 @@ const DefaultGlobalToolbarDefinition = [
223
225
  ToolbarActionTypes.split,
224
226
  ElementKinds.numberedList,
225
227
  ElementKinds.bulletedList,
226
- ElementKinds.checkItem,
228
+ // ElementKinds.checkItem,
227
229
  ToolbarActionTypes.split,
228
230
  ElementKinds.link,
229
231
  ElementKinds.image,
@@ -238,7 +240,7 @@ const DefaultInlineToolbarDefinition = [
238
240
  MarkTypes.italic,
239
241
  MarkTypes.underline,
240
242
  MarkTypes.strike,
241
- MarkTypes.codeLine,
243
+ ElementKinds.inlineCode,
242
244
  MarkTypes.color,
243
245
  MarkTypes.backgroundColor,
244
246
  ToolbarActionTypes.split,
@@ -251,7 +253,7 @@ const DefaultQuickToolbarDefinition = [
251
253
  ToolbarActionTypes.split,
252
254
  ElementKinds.numberedList,
253
255
  ElementKinds.bulletedList,
254
- ElementKinds.checkItem,
256
+ // ElementKinds.checkItem,
255
257
  ToolbarActionTypes.split,
256
258
  ElementKinds.link,
257
259
  ElementKinds.image,
@@ -1746,6 +1748,49 @@ const BlockquoteEditor = {
1746
1748
  }
1747
1749
  };
1748
1750
 
1751
+ const InlineCodeEditor = {
1752
+ toggleInlineCode(editor, text) {
1753
+ const isActive = InlineCodeEditor.isInlineCodeActive(editor);
1754
+ if (isActive) {
1755
+ InlineCodeEditor.unwrapInlineCode(editor);
1756
+ return;
1757
+ }
1758
+ if (Range.isCollapsed(editor.selection)) {
1759
+ InlineCodeEditor.wrapInlineCode(editor, text);
1760
+ }
1761
+ else {
1762
+ const fragment = Node.fragment(editor, editor.selection)[0];
1763
+ const selectNode = Node.get(fragment, []);
1764
+ const selectText = Node.string(selectNode);
1765
+ InlineCodeEditor.wrapInlineCode(editor, selectText);
1766
+ }
1767
+ },
1768
+ wrapInlineCode(editor, text = '') {
1769
+ if (InlineCodeEditor.isInlineCodeActive(editor)) {
1770
+ InlineCodeEditor.unwrapInlineCode(editor);
1771
+ }
1772
+ const { selection } = editor;
1773
+ const isCollapsed = selection && Range.isCollapsed(selection);
1774
+ const inlineCode = {
1775
+ type: ElementKinds.inlineCode,
1776
+ children: isCollapsed ? [{ text: text ? text : ZERO_WIDTH_CHAR }] : []
1777
+ };
1778
+ if (isCollapsed) {
1779
+ Transforms.insertNodes(editor, inlineCode);
1780
+ }
1781
+ else {
1782
+ Transforms.wrapNodes(editor, inlineCode, { split: true });
1783
+ }
1784
+ },
1785
+ unwrapInlineCode(editor) {
1786
+ Transforms.unwrapNodes(editor, { match: n => Element$1.isElement(n) && n.type === ElementKinds.inlineCode });
1787
+ },
1788
+ isInlineCodeActive(editor) {
1789
+ const [inlineCode] = Editor.nodes(editor, { match: n => Element$1.isElement(n) && n.type === ElementKinds.inlineCode });
1790
+ return !!inlineCode;
1791
+ }
1792
+ };
1793
+
1749
1794
  const autoFormatRules = [
1750
1795
  {
1751
1796
  type: ElementKinds.heading_1,
@@ -1803,10 +1848,13 @@ const autoFormatRules = [
1803
1848
  insertTrigger: true
1804
1849
  },
1805
1850
  {
1806
- type: MarkTypes.codeLine,
1851
+ type: ElementKinds.inlineCode,
1807
1852
  between: ['`', '`'],
1808
1853
  mode: 'inline',
1809
- insertTrigger: true
1854
+ format: (editor, text) => {
1855
+ InlineCodeEditor.toggleInlineCode(editor, text);
1856
+ Transforms.select(editor, Editor.after(editor, editor.selection));
1857
+ }
1810
1858
  },
1811
1859
  {
1812
1860
  type: MarkTypes.strike,
@@ -2288,6 +2336,13 @@ class TheContextService {
2288
2336
  }
2289
2337
  return this.options;
2290
2338
  }
2339
+ getTheOptions() {
2340
+ return this.options.theOptions;
2341
+ }
2342
+ getDefaultFontSize() {
2343
+ var _a;
2344
+ return ((_a = this.options.theOptions) === null || _a === void 0 ? void 0 : _a.fontSize) || FontSizes.fontSize14;
2345
+ }
2291
2346
  getEditableElement() {
2292
2347
  return this.options.nativeElement.querySelector('.the-editor-typo');
2293
2348
  }
@@ -3342,12 +3397,13 @@ class TheListItemComponent extends TheBaseElementComponent {
3342
3397
  }
3343
3398
  onContextChange() {
3344
3399
  super.onContextChange();
3345
- this.applyFontSize();
3400
+ this.addFontSize();
3401
+ this.addMultiDigit();
3346
3402
  }
3347
3403
  ngOnDestroy() {
3348
3404
  super.ngOnDestroy();
3349
3405
  }
3350
- applyFontSize() {
3406
+ addFontSize() {
3351
3407
  var _a, _b;
3352
3408
  let firstText;
3353
3409
  for (const entry of Node.descendants(this.element)) {
@@ -3382,6 +3438,30 @@ class TheListItemComponent extends TheBaseElementComponent {
3382
3438
  this.fontSizeClass = null;
3383
3439
  }
3384
3440
  }
3441
+ getStart() {
3442
+ const parent = this.elementRef.nativeElement.closest('.slate-element-numbered-list');
3443
+ const start = (parent === null || parent === void 0 ? void 0 : parent.getAttribute('start')) || 1;
3444
+ return Number(start);
3445
+ }
3446
+ getLiIndex() {
3447
+ const path = findPath(this.editor, this.element);
3448
+ const index = path[path.length - 1];
3449
+ return index || 0;
3450
+ }
3451
+ addMultiDigit() {
3452
+ const start = this.getStart();
3453
+ const index = this.getLiIndex();
3454
+ const multiDigit = 'data-multi-digit';
3455
+ // start number + index
3456
+ // when it is greater than 9, it is a multi-digit serial number
3457
+ // exclude Font size >= 20
3458
+ if (start + index > 9) {
3459
+ this.elementRef.nativeElement.setAttribute(multiDigit, true);
3460
+ }
3461
+ else {
3462
+ this.elementRef.nativeElement.removeAttribute(multiDigit);
3463
+ }
3464
+ }
3385
3465
  }
3386
3466
  TheListItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheListItemComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3387
3467
  TheListItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheListItemComponent, selector: "li[theLi]", usesInheritance: true, ngImport: i0, template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>`, isInline: true, components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
@@ -3999,7 +4079,7 @@ const autoFormatBlock = (editor, type, at, { preFormat, format }, markups) => {
3999
4079
  }
4000
4080
  };
4001
4081
 
4002
- const autoFormatInline = (editor, { type, between, markup, ignoreTrim }) => {
4082
+ const autoFormatInline = (editor, { type, between, markup, ignoreTrim, format }) => {
4003
4083
  const selection = editor.selection;
4004
4084
  const startMarkup = between ? between[0] : markup;
4005
4085
  const endMarkup = between ? between[1] : '';
@@ -4043,22 +4123,35 @@ const autoFormatInline = (editor, { type, between, markup, ignoreTrim }) => {
4043
4123
  }
4044
4124
  });
4045
4125
  }
4046
- // add mark to the text between the markups
4047
- Transforms.select(editor, markupRange);
4048
- editor.addMark(type, true);
4049
- Transforms.collapse(editor, { edge: 'end' });
4050
- editor.removeMark(type, false);
4051
- // delete start markup
4052
4126
  const startMarkupPointBefore = getPointBefore(editor, selection, {
4053
4127
  matchString: startMarkup,
4054
4128
  skipInvalid: true
4055
4129
  });
4056
- Transforms.delete(editor, {
4057
- at: {
4058
- anchor: startMarkupPointBefore,
4059
- focus: startMarkupPointAfter
4060
- }
4061
- });
4130
+ if (format) {
4131
+ const markupText = getText(editor, markupRange);
4132
+ format(editor, markupText);
4133
+ // delete start to end selection
4134
+ Transforms.delete(editor, {
4135
+ at: {
4136
+ anchor: startMarkupPointBefore,
4137
+ focus: selection.anchor
4138
+ }
4139
+ });
4140
+ }
4141
+ else {
4142
+ // add mark to the text between the markups
4143
+ Transforms.select(editor, markupRange);
4144
+ editor.addMark(type, true);
4145
+ Transforms.collapse(editor, { edge: 'end' });
4146
+ editor.removeMark(type, false);
4147
+ // delete start markup
4148
+ Transforms.delete(editor, {
4149
+ at: {
4150
+ anchor: startMarkupPointBefore,
4151
+ focus: startMarkupPointAfter
4152
+ }
4153
+ });
4154
+ }
4062
4155
  return true;
4063
4156
  };
4064
4157
 
@@ -4131,6 +4224,7 @@ const withAutoFormat = ({ rules }) => (editor) => {
4131
4224
  type,
4132
4225
  between,
4133
4226
  ignoreTrim,
4227
+ format,
4134
4228
  markup: Array.isArray(markup) ? markup[0] : markup
4135
4229
  })) {
4136
4230
  return valid();
@@ -5457,14 +5551,6 @@ const MarkOptions = [
5457
5551
  shortcutKey: `${CONTROL_KEY}+U`,
5458
5552
  execute: editor => MarkEditor.toggleMark(editor, MarkTypes.underline),
5459
5553
  active: editor => MarkEditor.isMarkActive(editor, MarkTypes.underline)
5460
- },
5461
- {
5462
- key: MarkTypes.codeLine,
5463
- icon: 'code',
5464
- name: '行内代码',
5465
- shortcutKey: `${CONTROL_KEY}+E`,
5466
- execute: editor => MarkEditor.toggleMark(editor, MarkTypes.codeLine),
5467
- active: editor => MarkEditor.isMarkActive(editor, MarkTypes.codeLine)
5468
5554
  }
5469
5555
  ];
5470
5556
 
@@ -6450,8 +6536,9 @@ class TheCodeComponent extends TheBaseElementComponent {
6450
6536
  this.menus = CODE_MODES.map(item => {
6451
6537
  return { key: item.value, name: item.showName };
6452
6538
  });
6539
+ this.destroy$ = new Subject();
6453
6540
  this.ToolbarItemMode = ToolbarItemMode;
6454
- this.isFocusCode = false;
6541
+ this.isHightLight = false;
6455
6542
  this.resizeHeight = null;
6456
6543
  this.options = {
6457
6544
  mode: this.menus[0].key,
@@ -6488,13 +6575,21 @@ class TheCodeComponent extends TheBaseElementComponent {
6488
6575
  if (this.resizeHeight !== this.element.height) {
6489
6576
  this.useHeight();
6490
6577
  }
6491
- if (!this.isCollapsed) {
6492
- this.isFocusCode = false;
6493
- }
6494
6578
  }
6495
6579
  }
6496
6580
  ngOnInit() {
6497
6581
  super.ngOnInit();
6582
+ this.ngZone.runOutsideAngular(() => {
6583
+ fromEvent(this.nativeElement, 'mousedown')
6584
+ .pipe(takeUntil(this.destroy$))
6585
+ .subscribe(event => {
6586
+ event.stopPropagation();
6587
+ const isBlockOperation = this.isCollapsed &&
6588
+ this.nativeElement.querySelector('.the-code-block-operation').contains(event.target);
6589
+ const isCodemirror = this.nativeElement.querySelector('.ng-codemirror').contains(event.target);
6590
+ this.isHightLight = !isCodemirror && !isBlockOperation;
6591
+ });
6592
+ });
6498
6593
  this.elementRef.nativeElement.classList.add('the-code-container');
6499
6594
  }
6500
6595
  ngAfterViewInit() {
@@ -6536,11 +6631,11 @@ class TheCodeComponent extends TheBaseElementComponent {
6536
6631
  }
6537
6632
  }
6538
6633
  codeChange($event) {
6634
+ this.isHightLight = false;
6539
6635
  CodeEditor.setCodeAttribute(this.editor, this.element, { content: $event });
6540
6636
  }
6541
6637
  onDelete(event) {
6542
6638
  event.preventDefault();
6543
- this.isFocusCode = false;
6544
6639
  deleteElement(this.editor, this.element);
6545
6640
  }
6546
6641
  onCopy(event) {
@@ -6558,8 +6653,9 @@ class TheCodeComponent extends TheBaseElementComponent {
6558
6653
  AngularEditor.deselect(this.editor);
6559
6654
  }
6560
6655
  focusChange(codeMirrorFocused) {
6561
- if (codeMirrorFocused)
6562
- this.isFocusCode = codeMirrorFocused;
6656
+ if (codeMirrorFocused) {
6657
+ this.isHightLight = false;
6658
+ }
6563
6659
  }
6564
6660
  useMode() {
6565
6661
  this.options = Object.assign(Object.assign({}, this.options), { mode: this.element.language });
@@ -6586,12 +6682,17 @@ class TheCodeComponent extends TheBaseElementComponent {
6586
6682
  CodeEditor.setCodeAttribute(this.editor, this.element, { height: this.resizeHeight });
6587
6683
  }
6588
6684
  onChangeWrap(value) {
6685
+ this.isHightLight = false;
6589
6686
  this.options = Object.assign(Object.assign({}, this.options), { lineWrapping: value || false });
6590
6687
  CodeEditor.setCodeAttribute(this.editor, this.element, { autoWrap: value ? value : null });
6591
6688
  }
6689
+ ngOnDestroy() {
6690
+ this.destroy$.next();
6691
+ this.destroy$.complete();
6692
+ }
6592
6693
  }
6593
6694
  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: TheContextService }, { token: i0.NgZone }, { token: THE_CODE_MODE_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
6594
- 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-code-block-operation\" *ngIf=\"isFocusCode && !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 <nav-split-line [mode]=\"ToolbarItemMode.vertical\"></nav-split-line>\n <span class=\"auto-wrap d-flex align-items-center\">\n <span>\u81EA\u52A8\u6362\u884C</span>\n <thy-switch\n class=\"auto-wrap-btn d-flex\"\n [(ngModel)]=\"options.lineWrapping\"\n (ngModelChange)=\"onChangeWrap($event)\"\n thySize=\"sm\"\n ></thy-switch>\n </span>\n </thy-icon-nav>\n</div>\n\n<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n\n<!-- \u53EA\u8BFB\u6A21\u5F0F\u4E0BCodeMirror-sizer\u9AD8\u5EA6\u6BD4\u7F16\u8F91\u6A21\u5F0F\u4E0B\u591A2px\uFF0C\u8BBE\u7F6EthyMinHeight\u4E3A46px\u9632\u6B62\u62D6\u62FD\u5230\u6700\u5C0F\u9AD8\u5EA6\u65F6\u53EA\u8BFB\u6A21\u5F0F\u4E0B\u51FA\u73B0\u6EDA\u52A8\u6761 -->\n<div\n thyResizable\n [thyMinHeight]=\"46\"\n [thyBounds]=\"resizeBounds\"\n [style.height.px]=\"resizeHeight\"\n (thyResize)=\"onResize($event)\"\n (thyResizeEnd)=\"onEndResize()\"\n class=\"resize-code-container\"\n>\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 >\n </ng-codemirror>\n <thy-resize-handle thyDirection=\"bottom\" class=\"code-resize-icon\" *ngIf=\"isFocusCode && !options.readOnly\"></thy-resize-handle>\n</div>\n", components: [{ type: i3.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: ["toolbarItem", "menus", "mode", "item", "itemMousedownHandle"] }, { type: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }, { type: i6$1.ThySwitchComponent, selector: "thy-switch", inputs: ["thyType", "thySize", "thyDisabled"], outputs: ["thyChange"] }, { type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i8.CodeMirrorComponent, selector: "ng-codemirror, [ngCodeMirror]", inputs: ["autoMaxHeight", "delayRefreshTime", "options"], outputs: ["focusChange"] }, { type: i9.ThyResizeHandleComponent, selector: "thy-resize-handle, [thy-resize-handle]", inputs: ["thyDirection"], outputs: ["thyMouseDown"], exportAs: ["thyResizeHandle"] }], 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: 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: i9.ThyResizableDirective, selector: "[thyResizable]", inputs: ["thyBounds", "thyMaxHeight", "thyMaxWidth", "thyMinHeight", "thyMinWidth", "thyGridColumnCount", "thyMaxColumn", "thyMinColumn", "thyLockAspectRatio", "thyPreview", "thyDisabled"], outputs: ["thyResize", "thyResizeEnd", "thyResizeStart"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
6695
+ 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-code-block-operation\" *ngIf=\"isCollapsed && codemirror && !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 <nav-split-line [mode]=\"ToolbarItemMode.vertical\"></nav-split-line>\n <span class=\"auto-wrap d-flex align-items-center\">\n <span>\u81EA\u52A8\u6362\u884C</span>\n <thy-switch\n class=\"auto-wrap-btn d-flex\"\n [(ngModel)]=\"options.lineWrapping\"\n (ngModelChange)=\"onChangeWrap($event)\"\n thySize=\"sm\"\n ></thy-switch>\n </span>\n </thy-icon-nav>\n</div>\n\n<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n\n<!-- \u53EA\u8BFB\u6A21\u5F0F\u4E0BCodeMirror-sizer\u9AD8\u5EA6\u6BD4\u7F16\u8F91\u6A21\u5F0F\u4E0B\u591A2px\uFF0C\u8BBE\u7F6EthyMinHeight\u4E3A46px\u9632\u6B62\u62D6\u62FD\u5230\u6700\u5C0F\u9AD8\u5EA6\u65F6\u53EA\u8BFB\u6A21\u5F0F\u4E0B\u51FA\u73B0\u6EDA\u52A8\u6761 -->\n<div\n thyResizable\n [thyMinHeight]=\"46\"\n [thyBounds]=\"resizeBounds\"\n [style.height.px]=\"resizeHeight\"\n (thyResize)=\"onResize($event)\"\n (thyResizeEnd)=\"onEndResize()\"\n class=\"resize-code-container\"\n [ngClass]=\"{ focus: isCollapsed, readonly: options.readOnly, active: isHightLight && isCollapsed }\"\n>\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 >\n </ng-codemirror>\n <thy-resize-handle thyDirection=\"bottom\" class=\"code-resize-icon\" *ngIf=\"isCollapsed && !options.readOnly\"></thy-resize-handle>\n</div>\n", components: [{ type: i3.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: ["toolbarItem", "menus", "mode", "item", "itemMousedownHandle"] }, { type: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }, { type: i6$1.ThySwitchComponent, selector: "thy-switch", inputs: ["thyType", "thySize", "thyDisabled"], outputs: ["thyChange"] }, { type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i8.CodeMirrorComponent, selector: "ng-codemirror, [ngCodeMirror]", inputs: ["autoMaxHeight", "delayRefreshTime", "options"], outputs: ["focusChange"] }, { type: i9.ThyResizeHandleComponent, selector: "thy-resize-handle, [thy-resize-handle]", inputs: ["thyDirection"], outputs: ["thyMouseDown"], exportAs: ["thyResizeHandle"] }], 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: 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: i9.ThyResizableDirective, selector: "[thyResizable]", inputs: ["thyBounds", "thyMaxHeight", "thyMaxWidth", "thyMinHeight", "thyMinWidth", "thyGridColumnCount", "thyMaxColumn", "thyMinColumn", "thyLockAspectRatio", "thyPreview", "thyDisabled"], outputs: ["thyResize", "thyResizeEnd", "thyResizeStart"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
6595
6696
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheCodeComponent, decorators: [{
6596
6697
  type: Component,
6597
6698
  args: [{
@@ -6873,7 +6974,9 @@ class TheBaseLinkComponent extends TheBaseElementComponent {
6873
6974
  }
6874
6975
  }
6875
6976
  mousedownHandle(event) {
6876
- this.openLinkHover();
6977
+ if (!this.readonly && !this.editor.disabled) {
6978
+ this.openLinkHover();
6979
+ }
6877
6980
  }
6878
6981
  openLinkEdit(tag) {
6879
6982
  if (this.linkHoverOpened) {
@@ -10993,11 +11096,43 @@ const withSoftBreak = (options = { rules: [{ hotkey: 'shift+enter' }] }) => (edi
10993
11096
 
10994
11097
  const FontSizeEditor = {
10995
11098
  setFontSize(editor, size) {
11099
+ const contextService = editor.injector.get(TheContextService);
11100
+ const defaultFontSize = contextService.getDefaultFontSize();
11101
+ const marks = getSelectionMarks(editor);
11102
+ const fontSizeMark = marks[MarkTypes.fontSize];
11103
+ const isDefaultFontSize = size === defaultFontSize;
11104
+ if (!fontSizeMark && isDefaultFontSize) {
11105
+ return;
11106
+ }
11107
+ // unset fontSize
11108
+ if (FontSizeEditor.unsetFontSize(editor, size, fontSizeMark, isDefaultFontSize)) {
11109
+ return;
11110
+ }
11111
+ FontSizeEditor.setFontSizeMark(editor, size);
11112
+ },
11113
+ setFontSizeMark(editor, size) {
11114
+ // set Table selectedCells fontSize
10996
11115
  if (TableEditor.toggleMark(editor, false, MarkTypes.fontSize, Number(size))) {
10997
11116
  return;
10998
11117
  }
11118
+ // set paragraph text fontSize
10999
11119
  Editor.addMark(editor, MarkTypes.fontSize, Number(size));
11000
11120
  },
11121
+ unsetFontSize(editor, size, fontSizeMark, isDefaultFontSize) {
11122
+ const isTable = TableEditor.isActive(editor);
11123
+ if (fontSizeMark && isDefaultFontSize) {
11124
+ // unset Table selectedCells fontSize
11125
+ if (isTable && TableEditor.toggleMark(editor, true, MarkTypes.fontSize, Number(size))) {
11126
+ return true;
11127
+ }
11128
+ // unset paragraph text fontSize
11129
+ setMarks(editor, {
11130
+ [MarkTypes.fontSize]: null
11131
+ }, editor.selection);
11132
+ return true;
11133
+ }
11134
+ return false;
11135
+ },
11001
11136
  isFontSizeActive(editor, size) {
11002
11137
  if (editor.selection) {
11003
11138
  const anchorBlock$1 = anchorBlock(editor);
@@ -11056,6 +11191,81 @@ const FontSizeOptions = [
11056
11191
  ...sizeOptions()
11057
11192
  ];
11058
11193
 
11194
+ const InlineCodeOptions = [
11195
+ {
11196
+ key: ElementKinds.inlineCode,
11197
+ icon: 'code',
11198
+ name: '行内代码',
11199
+ shortcutKey: `${CONTROL_KEY}+E`,
11200
+ execute: editor => InlineCodeEditor.toggleInlineCode(editor),
11201
+ active: editor => InlineCodeEditor.isInlineCodeActive(editor)
11202
+ }
11203
+ ];
11204
+
11205
+ class TheInlineCodeComponent extends TheBaseElementComponent {
11206
+ constructor(elementRef, cdr) {
11207
+ super(elementRef, cdr);
11208
+ this.elementRef = elementRef;
11209
+ this.cdr = cdr;
11210
+ }
11211
+ ngOnInit() {
11212
+ super.ngOnInit();
11213
+ }
11214
+ ngOnDestroy() {
11215
+ super.ngOnDestroy();
11216
+ }
11217
+ }
11218
+ TheInlineCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInlineCodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
11219
+ TheInlineCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheInlineCodeComponent, selector: "span[theInlineCode]", usesInheritance: true, ngImport: i0, template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>', isInline: true, components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
11220
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInlineCodeComponent, decorators: [{
11221
+ type: Component,
11222
+ args: [{
11223
+ selector: 'span[theInlineCode]',
11224
+ template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>'
11225
+ }]
11226
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; } });
11227
+
11228
+ const withInlineCode = (editor) => {
11229
+ const { isInline, renderElement, insertText } = editor;
11230
+ editor.isInline = (element) => {
11231
+ return element.type === ElementKinds.inlineCode ? true : isInline(element);
11232
+ };
11233
+ editor.renderElement = (element) => {
11234
+ if (element.type === ElementKinds.inlineCode) {
11235
+ return TheInlineCodeComponent;
11236
+ }
11237
+ return renderElement(element);
11238
+ };
11239
+ editor.insertText = text => {
11240
+ if (text && InlineCodeEditor.isInlineCodeActive(editor)) {
11241
+ let selection = editor.selection;
11242
+ const currentNodeText = Editor.string(editor, editor.selection.anchor.path);
11243
+ insertText(text);
11244
+ if (currentNodeText == ZERO_WIDTH_CHAR) {
11245
+ const inlineCodePath = Editor.path(editor, editor.selection);
11246
+ let range = {
11247
+ anchor: Editor.before(editor, selection.anchor),
11248
+ focus: selection.anchor
11249
+ };
11250
+ if (Editor.isStart(editor, selection.anchor, inlineCodePath)) {
11251
+ range = {
11252
+ anchor: editor.selection.anchor,
11253
+ focus: Editor.after(editor, editor.selection)
11254
+ };
11255
+ }
11256
+ Transforms.delete(editor, {
11257
+ at: range
11258
+ });
11259
+ }
11260
+ }
11261
+ else {
11262
+ insertText(text);
11263
+ }
11264
+ };
11265
+ editor = withRemoveEmptyNodes({ type: ElementKinds.inlineCode })(editor);
11266
+ return editor;
11267
+ };
11268
+
11059
11269
  const internalPlugins = [
11060
11270
  withTheHistory,
11061
11271
  withAutoInsertData(),
@@ -11095,7 +11305,8 @@ const internalPlugins = [
11095
11305
  withImage,
11096
11306
  withDeserializeHMTL,
11097
11307
  withDeserializeMd(),
11098
- withQuickInsert
11308
+ withQuickInsert,
11309
+ withInlineCode
11099
11310
  ];
11100
11311
  const internalToolbarItems = [
11101
11312
  ...AlignOptions,
@@ -11112,7 +11323,8 @@ const internalToolbarItems = [
11112
11323
  ...LinkOptions,
11113
11324
  ...TableOptions,
11114
11325
  ...VerticalAlignOptions,
11115
- ...PaintFormatOptions
11326
+ ...PaintFormatOptions,
11327
+ ...InlineCodeOptions
11116
11328
  ];
11117
11329
  const toolbarCompose = (toolbarItems = []) => {
11118
11330
  return [...internalToolbarItems, ...toolbarItems];
@@ -11134,14 +11346,19 @@ const HOTKEYS = {
11134
11346
  'mod+b': MarkTypes.bold,
11135
11347
  'mod+i': MarkTypes.italic,
11136
11348
  'mod+u': MarkTypes.underline,
11137
- 'mod+e': MarkTypes.codeLine
11349
+ 'mod+e': ElementKinds.inlineCode
11138
11350
  };
11139
11351
  const markShortcuts = (editor, event) => {
11140
11352
  for (const hotkey in HOTKEYS) {
11141
11353
  if (isHotkey(hotkey, event)) {
11142
11354
  event.preventDefault();
11143
11355
  const mark = HOTKEYS[hotkey];
11144
- MarkEditor.toggleMark(editor, mark);
11356
+ if (mark === ElementKinds.inlineCode) {
11357
+ InlineCodeEditor.toggleInlineCode(editor);
11358
+ }
11359
+ else {
11360
+ MarkEditor.toggleMark(editor, mark);
11361
+ }
11145
11362
  }
11146
11363
  }
11147
11364
  };
@@ -11441,14 +11658,16 @@ class TheToolbarComponent {
11441
11658
  var _a;
11442
11659
  let dropdownKey = item === null || item === void 0 ? void 0 : item.dropdownItemKey;
11443
11660
  // modify the fontsize option externally
11444
- if (item.key === MarkTypes.fontSize && this.fontSize) {
11445
- dropdownKey = this.fontSize;
11661
+ const contextService = this.editor.injector.get(TheContextService);
11662
+ const fontSize = contextService.getDefaultFontSize();
11663
+ if (item.key === MarkTypes.fontSize && fontSize) {
11664
+ dropdownKey = fontSize;
11446
11665
  }
11447
11666
  return (_a = item === null || item === void 0 ? void 0 : item.includes) === null || _a === void 0 ? void 0 : _a.find((item) => item.key === dropdownKey);
11448
11667
  }
11449
11668
  }
11450
11669
  TheToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarComponent, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: TheToolbarGroupToken }], target: i0.ɵɵFactoryTarget.Component });
11451
- TheToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarComponent, selector: "the-toolbar", inputs: { editor: "editor", toolbarItems: "toolbarItems", align: "align", fontSize: "fontSize", containerClass: "containerClass", isMore: "isMore", afterTemplate: "afterTemplate" }, host: { classAttribute: "the-toolbar-container" }, viewQueries: [{ propertyName: "toolbarContainer", first: true, predicate: ["toolbarContainer"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: "<thy-icon-nav [style.justifyContent]=\"align\">\n <ng-container #toolbarContainer></ng-container>\n <ng-content></ng-content>\n <ng-template *ngIf=\"afterTemplate\" [ngTemplateOutlet]=\"afterTemplate\"></ng-template>\n</thy-icon-nav>\n", components: [{ type: i3.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
11670
+ TheToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarComponent, selector: "the-toolbar", inputs: { editor: "editor", toolbarItems: "toolbarItems", align: "align", containerClass: "containerClass", isMore: "isMore", afterTemplate: "afterTemplate" }, host: { classAttribute: "the-toolbar-container" }, viewQueries: [{ propertyName: "toolbarContainer", first: true, predicate: ["toolbarContainer"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: "<thy-icon-nav [style.justifyContent]=\"align\">\n <ng-container #toolbarContainer></ng-container>\n <ng-content></ng-content>\n <ng-template *ngIf=\"afterTemplate\" [ngTemplateOutlet]=\"afterTemplate\"></ng-template>\n</thy-icon-nav>\n", components: [{ type: i3.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
11452
11671
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarComponent, decorators: [{
11453
11672
  type: Component,
11454
11673
  args: [{
@@ -11467,8 +11686,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11467
11686
  type: Input
11468
11687
  }], align: [{
11469
11688
  type: Input
11470
- }], fontSize: [{
11471
- type: Input
11472
11689
  }], containerClass: [{
11473
11690
  type: Input
11474
11691
  }], isMore: [{
@@ -11582,7 +11799,7 @@ TheInlineToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.
11582
11799
  [editor]="editor"
11583
11800
  [toolbarItems]="toolbarItems"
11584
11801
  [isMore]="false"
11585
- ></the-toolbar> `, isInline: true, components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "fontSize", "containerClass", "isMore", "afterTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
11802
+ ></the-toolbar> `, isInline: true, components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
11586
11803
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInlineToolbarComponent, decorators: [{
11587
11804
  type: Component,
11588
11805
  args: [{
@@ -11965,7 +12182,11 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
11965
12182
  this.editor.disabled = (_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled;
11966
12183
  this.editor.extraElementOptions = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.extraElementOptions;
11967
12184
  setEditorUUID(this.editor, idCreator());
11968
- this.theContextService.initialize({ nativeElement: this.elementRef.nativeElement, viewContainerRef: this.viewContainerRef });
12185
+ this.theContextService.initialize({
12186
+ theOptions: this.theOptions,
12187
+ nativeElement: this.elementRef.nativeElement,
12188
+ viewContainerRef: this.viewContainerRef
12189
+ });
11969
12190
  this.toolbarCalculate();
11970
12191
  setTimeout(() => {
11971
12192
  var _a;
@@ -11992,7 +12213,7 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
11992
12213
  }
11993
12214
  }
11994
12215
  toolbarCalculate() {
11995
- var _a, _b;
12216
+ var _a;
11996
12217
  const toolbar = (_a = this === null || this === void 0 ? void 0 : this.theOptions) === null || _a === void 0 ? void 0 : _a.toolbar;
11997
12218
  const toolbarItems = toolbarCompose(toolbar === null || toolbar === void 0 ? void 0 : toolbar.toolbarItems);
11998
12219
  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);
@@ -12003,7 +12224,6 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
12003
12224
  this.theGlobalToolbarInstance.toolbarItems = toolbarOption.toolbarEntity.global;
12004
12225
  this.theGlobalToolbarInstance.containerClass = this.globalToolbarClass;
12005
12226
  this.theGlobalToolbarInstance.align = toolbar === null || toolbar === void 0 ? void 0 : toolbar.align;
12006
- this.theGlobalToolbarInstance.fontSize = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.fontSize;
12007
12227
  this.theGlobalToolbarInstance.setToolbarClass();
12008
12228
  this.theGlobalToolbarInstance.renderToolbarView();
12009
12229
  }
@@ -12153,12 +12373,13 @@ TheEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
12153
12373
  useExisting: forwardRef(() => TheEditorComponent),
12154
12374
  multi: true
12155
12375
  }
12156
- ], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "quickInsertInstance", first: true, predicate: ["quickInsert"], descendants: true, static: true }, { propertyName: "placeholderInstance", first: true, predicate: ["placeholder"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"theOptions?.toolbar?.align\"\n [fontSize]=\"theOptions?.fontSize\"\n></the-toolbar>\n\n<div\n class=\"the-editable-container\"\n [ngClass]=\"{\n 'the-editor-disabled': theOptions?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n (ngModelChange)=\"valueChange($event)\"\n [decorate]=\"decorate\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [readonly]=\"theOptions?.readonly || theOptions?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [beforeInput]=\"onSlaBeforeInput\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [isStrictDecorate]=\"false\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [drop]=\"onDrop\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n <the-inline-toolbar *ngIf=\"!theOptions?.readonly\" [editor]=\"editor\" [toolbarItems]=\"toolbarEntity.inline\"></the-inline-toolbar>\n <div #quickInsert theQuickInsert [editor]=\"editor\" [quickToolbarItems]=\"quickToolbarItems\"></div>\n <div #placeholder thePlaceholder [editor]=\"editor\" [options]=\"theOptions\"></div>\n <the-template #templateInstance></the-template>\n</div>\n", components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "fontSize", "containerClass", "isMore", "afterTemplate"] }, { type: i1.SlateEditableComponent, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "placeholderDecorate", "isStrictDecorate", "trackBy", "readonly", "placeholder", "beforeInput", "blur", "click", "compositionEnd", "compositionStart", "copy", "cut", "dragOver", "dragStart", "dragEnd", "drop", "focus", "keydown", "paste", "spellCheck", "autoCorrect", "autoCapitalize"] }, { type: TheInlineToolbarComponent, selector: "the-inline-toolbar", inputs: ["editor", "toolbarItems"] }, { type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: ["editor", "quickToolbarItems"] }, { type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: ["editor", "options"] }, { type: TheTemplateComponent, selector: "the-template,[theTemplate]" }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
12376
+ ], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "quickInsertInstance", first: true, predicate: ["quickInsert"], descendants: true, static: true }, { propertyName: "placeholderInstance", first: true, predicate: ["placeholder"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"theOptions?.toolbar?.align\"\n></the-toolbar>\n\n<div\n class=\"the-editable-container\"\n [ngClass]=\"{\n 'the-editor-disabled': theOptions?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n (ngModelChange)=\"valueChange($event)\"\n [decorate]=\"decorate\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [readonly]=\"theOptions?.readonly || theOptions?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [beforeInput]=\"onSlaBeforeInput\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [isStrictDecorate]=\"false\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [drop]=\"onDrop\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n <the-inline-toolbar *ngIf=\"!theOptions?.readonly\" [editor]=\"editor\" [toolbarItems]=\"toolbarEntity.inline\"></the-inline-toolbar>\n <div #quickInsert theQuickInsert [editor]=\"editor\" [quickToolbarItems]=\"quickToolbarItems\"></div>\n <div #placeholder thePlaceholder [editor]=\"editor\" [options]=\"theOptions\"></div>\n <the-template #templateInstance></the-template>\n</div>\n", components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }, { type: i1.SlateEditableComponent, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "placeholderDecorate", "isStrictDecorate", "trackBy", "readonly", "placeholder", "beforeInput", "blur", "click", "compositionEnd", "compositionStart", "copy", "cut", "dragOver", "dragStart", "dragEnd", "drop", "focus", "keydown", "paste", "spellCheck", "autoCorrect", "autoCapitalize"] }, { type: TheInlineToolbarComponent, selector: "the-inline-toolbar", inputs: ["editor", "toolbarItems"] }, { type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: ["editor", "quickToolbarItems"] }, { type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: ["editor", "options"] }, { type: TheTemplateComponent, selector: "the-template,[theTemplate]" }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
12157
12377
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheEditorComponent, decorators: [{
12158
12378
  type: Component,
12159
12379
  args: [{
12160
12380
  selector: 'the-editor, theEditor',
12161
12381
  templateUrl: 'editor.component.html',
12382
+ changeDetection: ChangeDetectionStrategy.OnPush,
12162
12383
  providers: [
12163
12384
  TheToolbarService,
12164
12385
  TheContextService,
@@ -12317,7 +12538,7 @@ class TheToolbarGroupComponent {
12317
12538
  }
12318
12539
  }
12319
12540
  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 });
12320
- 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: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "fontSize", "containerClass", "isMore", "afterTemplate"] }], directives: [{ type: i5$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
12541
+ 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: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }], directives: [{ type: i5$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
12321
12542
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarGroupComponent, decorators: [{
12322
12543
  type: Component,
12323
12544
  args: [{
@@ -12399,7 +12620,8 @@ const PLUGIN_COMPONENTS = [
12399
12620
  TheTableComponent,
12400
12621
  TheTableRowComponent,
12401
12622
  TheTdComponent,
12402
- ThePlaceholderComponent
12623
+ ThePlaceholderComponent,
12624
+ TheInlineCodeComponent
12403
12625
  ];
12404
12626
  const PIPES = [ElementStylePipe, ElementClassPipe];
12405
12627
  class TheEditorModule {
@@ -12439,7 +12661,8 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
12439
12661
  TheTableComponent,
12440
12662
  TheTableRowComponent,
12441
12663
  TheTdComponent,
12442
- ThePlaceholderComponent], imports: [CommonModule, SlateModule, FormsModule, ThyIconModule,
12664
+ ThePlaceholderComponent,
12665
+ TheInlineCodeComponent], imports: [CommonModule, SlateModule, FormsModule, ThyIconModule,
12443
12666
  ThyAvatarModule,
12444
12667
  ThyNavModule,
12445
12668
  ThyFormModule,
@@ -12488,5 +12711,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
12488
12711
  * Generated bundle index. Do not edit.
12489
12712
  */
12490
12713
 
12491
- export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeadingEditor, HrEditor, IS_MAC, ImageEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, QUICK_TOOLBAR_HOTKEY, QuickInsertEditor, STANDARD_HEADING_TYPES, TAB_SPACE, THE_CODE_MODE_PROVIDER, THE_CODE_MODE_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_QUICK_TOOLBAR_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheCodeConfig, 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, createEmptyParagraph, dataDeserialize, dataSerializing, getToolbarClass, htmlToTheia, inValidTypes, plainToTheia, toolbarCompose, withTheEditor };
12714
+ export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeadingEditor, HrEditor, IS_MAC, ImageEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, QUICK_TOOLBAR_HOTKEY, QuickInsertEditor, STANDARD_HEADING_TYPES, TAB_SPACE, THE_CODE_MODE_PROVIDER, THE_CODE_MODE_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_QUICK_TOOLBAR_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheCodeConfig, 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 };
12492
12715
  //# sourceMappingURL=worktile-theia.js.map