@worktile/theia 2.1.12 → 2.2.1

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 (45) hide show
  1. package/bundles/worktile-theia.umd.js +463 -233
  2. package/bundles/worktile-theia.umd.js.map +1 -1
  3. package/components/element/element.component.d.ts +1 -0
  4. package/constants/node-types.d.ts +6 -1
  5. package/custom-types.d.ts +1 -0
  6. package/editor.module.d.ts +44 -44
  7. package/esm2015/components/element/element.component.js +11 -4
  8. package/esm2015/components/text/text.component.js +2 -5
  9. package/esm2015/constants/node-types.js +7 -1
  10. package/esm2015/custom-types.js +1 -1
  11. package/esm2015/editor.component.js +1 -1
  12. package/esm2015/editor.module.js +6 -3
  13. package/esm2015/interfaces/editor.js +1 -1
  14. package/esm2015/plugins/common/block-card.plugin.js +2 -2
  15. package/esm2015/plugins/font-size/font-size.editor.js +2 -2
  16. package/esm2015/plugins/indent/indent.editor.js +81 -0
  17. package/esm2015/plugins/indent/indent.plugin.js +24 -3
  18. package/esm2015/plugins/indent/on-keydown-indent.js +40 -54
  19. package/esm2015/plugins/indent/options.js +26 -0
  20. package/esm2015/plugins/indent/toolbar-item.component.js +115 -0
  21. package/esm2015/plugins/index.js +5 -3
  22. package/esm2015/plugins/inline-code/inline-code.component.js +2 -2
  23. package/esm2015/plugins/list/components/bulleted-list.component.js +11 -14
  24. package/esm2015/plugins/list/components/numbered-list.component.js +12 -15
  25. package/esm2015/plugins/list/list.editor.js +8 -1
  26. package/esm2015/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.js +13 -6
  27. package/esm2015/plugins/todo-item/todo-item.component.js +8 -26
  28. package/esm2015/utils/is-clean-empty-paragraph.js +3 -1
  29. package/fesm2015/worktile-theia.js +441 -228
  30. package/fesm2015/worktile-theia.js.map +1 -1
  31. package/interfaces/editor.d.ts +1 -1
  32. package/package.json +1 -1
  33. package/plugins/indent/indent.editor.d.ts +10 -0
  34. package/plugins/indent/indent.plugin.d.ts +2 -1
  35. package/plugins/indent/on-keydown-indent.d.ts +1 -1
  36. package/plugins/indent/options.d.ts +2 -0
  37. package/plugins/indent/toolbar-item.component.d.ts +36 -0
  38. package/plugins/inline-code/inline-code.component.scss +2 -1
  39. package/plugins/list/components/bulleted-list.component.d.ts +2 -4
  40. package/plugins/list/components/numbered-list.component.d.ts +2 -4
  41. package/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.d.ts +1 -0
  42. package/plugins/todo-item/todo-item.component.d.ts +2 -3
  43. package/plugins/todo-item/todo-item.component.scss +0 -3
  44. package/styles/editor.scss +27 -0
  45. package/styles/typo.scss +0 -5
@@ -410,6 +410,7 @@
410
410
  ElementKinds["link"] = "link";
411
411
  ElementKinds["default"] = "paragraph";
412
412
  ElementKinds["inlineCode"] = "inline-code";
413
+ ElementKinds["indent"] = "indent";
413
414
  })(exports.ElementKinds || (exports.ElementKinds = {}));
414
415
  exports.Alignment = void 0;
415
416
  (function (Alignment) {
@@ -451,6 +452,11 @@
451
452
  exports.FontSizes.fontSize40,
452
453
  exports.FontSizes.fontSize48
453
454
  ];
455
+ exports.Indents = void 0;
456
+ (function (Indents) {
457
+ Indents["indentRight"] = "indent-right";
458
+ Indents["indentLeft"] = "indent-left";
459
+ })(exports.Indents || (exports.Indents = {}));
454
460
  exports.MarkTypes = void 0;
455
461
  (function (MarkTypes) {
456
462
  MarkTypes["bold"] = "bold";
@@ -689,10 +695,7 @@
689
695
  }
690
696
  }
691
697
  var fontSize = this.text[exports.MarkTypes.fontSize];
692
- if (fontSize) {
693
- var attr = "the-" + exports.MarkTypes.fontSize;
694
- this.renderer2.setAttribute(this.elementRef.nativeElement, attr, fontSize);
695
- }
698
+ this.renderer2.setAttribute(this.elementRef.nativeElement, "the-" + exports.MarkTypes.fontSize, fontSize ? fontSize : null);
696
699
  if (this.text[exports.MarkTypes.color]) {
697
700
  this.renderer2.setStyle(this.elementRef.nativeElement, 'color', this.text[exports.MarkTypes.color]);
698
701
  }
@@ -753,10 +756,18 @@
753
756
  function TheDefaultElementComponent() {
754
757
  return _super !== null && _super.apply(this, arguments) || this;
755
758
  }
759
+ Object.defineProperty(TheDefaultElementComponent.prototype, "indent", {
760
+ get: function () {
761
+ var _a;
762
+ return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
763
+ },
764
+ enumerable: false,
765
+ configurable: true
766
+ });
756
767
  return TheDefaultElementComponent;
757
768
  }(TheBaseElementComponent));
758
769
  TheDefaultElementComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheDefaultElementComponent, deps: null, target: i0__namespace.ɵɵFactoryTarget.Component });
759
- TheDefaultElementComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheDefaultElementComponent, selector: "[theDefaultElement]", usesInheritance: true, ngImport: i0__namespace, template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>', isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
770
+ TheDefaultElementComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheDefaultElementComponent, selector: "[theDefaultElement]", host: { properties: { "attr.the-indent": "this.indent" } }, usesInheritance: true, ngImport: i0__namespace, template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>', isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
760
771
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheDefaultElementComponent, decorators: [{
761
772
  type: i0.Component,
762
773
  args: [{
@@ -764,7 +775,10 @@
764
775
  template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>',
765
776
  changeDetection: i0.ChangeDetectionStrategy.OnPush
766
777
  }]
767
- }] });
778
+ }], propDecorators: { indent: [{
779
+ type: i0.HostBinding,
780
+ args: ['attr.the-indent']
781
+ }] } });
768
782
 
769
783
  var TheEditor = Object.assign({}, i1.AngularEditor);
770
784
  exports.TheDataMode = void 0;
@@ -2080,6 +2094,13 @@
2080
2094
  slate.Transforms.setNodes(editor, { type: exports.ElementKinds.paragraph, checked: undefined }, // todo remove checked
2081
2095
  { at: path });
2082
2096
  }
2097
+ else if (slate.Element.isElement(node) && node.type === exports.ElementKinds.paragraph) {
2098
+ var textIndent = node.textIndent;
2099
+ if (textIndent) {
2100
+ slate.Transforms.setNodes(editor, { textIndent: undefined }, // remove textIndent
2101
+ { at: path });
2102
+ }
2103
+ }
2083
2104
  if (slate.Node.parent(editor, path).type !== exports.ElementKinds.listItem) {
2084
2105
  slate.Transforms.wrapNodes(editor, { type: exports.ElementKinds.listItem, children: [] }, {
2085
2106
  at: path,
@@ -2484,12 +2505,14 @@
2484
2505
  var align = 'align';
2485
2506
  var hasTextIndent = block[textIndent];
2486
2507
  var hasAlign = block[align];
2508
+ var hasIndent = block[exports.ElementKinds.indent];
2487
2509
  if (slate.Node.string(block) === '' &&
2488
2510
  slate.Element.isElement(block) &&
2489
2511
  block.type === exports.ElementKinds.paragraph &&
2490
2512
  block.children.length === 1 &&
2491
2513
  slate.Text.isText(block.children[0]) &&
2492
2514
  !slate.Editor.isVoid(editor, block) &&
2515
+ !hasIndent &&
2493
2516
  !hasTextIndent &&
2494
2517
  !hasAlign) {
2495
2518
  return true;
@@ -3134,86 +3157,6 @@
3134
3157
  return editor;
3135
3158
  };
3136
3159
 
3137
- var onKeydownIndent = function (editor, event, kinds) {
3138
- var selection = editor.selection;
3139
- if (event.key === 'Tab') {
3140
- event.preventDefault();
3141
- var isExpanded = slate.Range.isExpanded(selection);
3142
- var nodes = Array.from(slate.Editor.nodes(editor, {
3143
- mode: 'highest',
3144
- match: indentNodeMatch(kinds)
3145
- }));
3146
- var startBlock = nodes[0];
3147
- if (startBlock && (isExpanded || slate.Editor.isStart(editor, selection.anchor, [startBlock[1][0]]))) {
3148
- if (!editor.isVoid(startBlock[0])) {
3149
- if (event.shiftKey) {
3150
- return cancelTextIntent(editor, startBlock[0], kinds);
3151
- }
3152
- var textIndent = startBlock[0].textIndent;
3153
- textIndent = textIndent ? textIndent : 0;
3154
- textIndent += 2;
3155
- if (textIndent < 50) {
3156
- slate.Transforms.setNodes(editor, { textIndent: textIndent }, {
3157
- mode: 'highest',
3158
- match: indentNodeMatch(kinds)
3159
- });
3160
- return true;
3161
- }
3162
- }
3163
- }
3164
- else {
3165
- editor.insertText(TAB_SPACE);
3166
- return true;
3167
- }
3168
- }
3169
- if (selection && slate.Range.isCollapsed(selection) && event.key === 'Backspace') {
3170
- var nodes = Array.from(slate.Editor.nodes(editor, {
3171
- mode: 'highest',
3172
- match: indentNodeMatch(kinds)
3173
- }));
3174
- var startBlock = nodes[0];
3175
- if (startBlock && slate.Editor.isStart(editor, selection.anchor, [startBlock[1][0]])) {
3176
- return cancelTextIntent(editor, startBlock[0], kinds);
3177
- }
3178
- }
3179
- return false;
3180
- };
3181
- var indentNodeMatch = function (kinds) { return function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }; };
3182
- function cancelTextIntent(editor, anchorBlock, kinds) {
3183
- var textIndent = anchorBlock.textIndent;
3184
- if (textIndent > 2) {
3185
- // prevent deleteBackward function
3186
- event.preventDefault();
3187
- textIndent -= 2;
3188
- slate.Transforms.setNodes(editor, { textIndent: textIndent }, {
3189
- mode: 'highest',
3190
- match: indentNodeMatch(kinds)
3191
- });
3192
- return true;
3193
- }
3194
- if (textIndent === 2) {
3195
- // prevent deleteBackward function
3196
- event.preventDefault();
3197
- slate.Transforms.setNodes(editor, { textIndent: null }, {
3198
- mode: 'highest',
3199
- match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
3200
- });
3201
- return true;
3202
- }
3203
- return false;
3204
- }
3205
-
3206
- var withIndent = function (kinds) { return function (editor) {
3207
- var onKeydown = editor.onKeydown;
3208
- editor.onKeydown = function (event) {
3209
- var isContinue = !onKeydownIndent(editor, event, kinds);
3210
- if (isContinue) {
3211
- onKeydown(event);
3212
- }
3213
- };
3214
- return editor;
3215
- }; };
3216
-
3217
3160
  var isList = function (n) {
3218
3161
  return __spreadArray([], __read(LIST_BLOCK_TYPES)).includes(n.type);
3219
3162
  };
@@ -3783,58 +3726,12 @@
3783
3726
  }
3784
3727
  }
3785
3728
 
3786
- var ElementStylePipe = /** @class */ (function () {
3787
- function ElementStylePipe() {
3788
- }
3789
- ElementStylePipe.prototype.transform = function (element, align) {
3790
- var style = {};
3791
- if (element.align || align) {
3792
- style.textAlign = element.align || align || exports.Alignment.left;
3793
- }
3794
- if (element.textIndent) {
3795
- style.textIndent = element.textIndent + 'em';
3796
- }
3797
- return style;
3798
- };
3799
- return ElementStylePipe;
3800
- }());
3801
- ElementStylePipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
3802
- ElementStylePipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, name: "elementStyle" });
3803
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, decorators: [{
3804
- type: i0.Pipe,
3805
- args: [{
3806
- name: 'elementStyle'
3807
- }]
3808
- }] });
3809
- var ElementClassPipe = /** @class */ (function () {
3810
- function ElementClassPipe() {
3811
- }
3812
- ElementClassPipe.prototype.transform = function (element) {
3813
- var classStr = '';
3814
- var prefix = 'indent';
3815
- if (element.textIndent) {
3816
- classStr += prefix + "-" + element.textIndent;
3817
- }
3818
- return classStr;
3819
- };
3820
- return ElementClassPipe;
3821
- }());
3822
- ElementClassPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
3823
- ElementClassPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, name: "elementClass" });
3824
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, decorators: [{
3825
- type: i0.Pipe,
3826
- args: [{
3827
- name: 'elementClass'
3828
- }]
3829
- }] });
3830
-
3831
3729
  var TheNumberedListComponent = /** @class */ (function (_super) {
3832
3730
  __extends(TheNumberedListComponent, _super);
3833
- function TheNumberedListComponent(elementRef, cdr, elementClassPipe) {
3731
+ function TheNumberedListComponent(elementRef, cdr) {
3834
3732
  var _this = _super.call(this, elementRef, cdr) || this;
3835
3733
  _this.elementRef = elementRef;
3836
3734
  _this.cdr = cdr;
3837
- _this.elementClassPipe = elementClassPipe;
3838
3735
  return _this;
3839
3736
  }
3840
3737
  Object.defineProperty(TheNumberedListComponent.prototype, "start", {
@@ -3844,9 +3741,10 @@
3844
3741
  enumerable: false,
3845
3742
  configurable: true
3846
3743
  });
3847
- Object.defineProperty(TheNumberedListComponent.prototype, "class", {
3744
+ Object.defineProperty(TheNumberedListComponent.prototype, "level", {
3848
3745
  get: function () {
3849
- return this.elementClassPipe.transform(this.element);
3746
+ var _a;
3747
+ return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
3850
3748
  },
3851
3749
  enumerable: false,
3852
3750
  configurable: true
@@ -3859,35 +3757,34 @@
3859
3757
  };
3860
3758
  return TheNumberedListComponent;
3861
3759
  }(TheBaseElementComponent));
3862
- TheNumberedListComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheNumberedListComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: ElementClassPipe }], target: i0__namespace.ɵɵFactoryTarget.Component });
3863
- TheNumberedListComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheNumberedListComponent, selector: "ol[theOl]", host: { properties: { "attr.start": "this.start", "class": "this.class" } }, providers: [ElementClassPipe], usesInheritance: true, ngImport: i0__namespace, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
3760
+ TheNumberedListComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheNumberedListComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
3761
+ TheNumberedListComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheNumberedListComponent, selector: "ol[theOl]", host: { properties: { "attr.start": "this.start", "attr.the-level": "this.level" } }, usesInheritance: true, ngImport: i0__namespace, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
3864
3762
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheNumberedListComponent, decorators: [{
3865
3763
  type: i0.Component,
3866
3764
  args: [{
3867
3765
  selector: 'ol[theOl]',
3868
- template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>",
3869
- providers: [ElementClassPipe]
3766
+ template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>"
3870
3767
  }]
3871
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: ElementClassPipe }]; }, propDecorators: { start: [{
3768
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { start: [{
3872
3769
  type: i0.HostBinding,
3873
3770
  args: ['attr.start']
3874
- }], class: [{
3771
+ }], level: [{
3875
3772
  type: i0.HostBinding,
3876
- args: ['class']
3773
+ args: ['attr.the-level']
3877
3774
  }] } });
3878
3775
 
3879
3776
  var TheBulletedListComponent = /** @class */ (function (_super) {
3880
3777
  __extends(TheBulletedListComponent, _super);
3881
- function TheBulletedListComponent(elementRef, cdr, elementClassPipe) {
3778
+ function TheBulletedListComponent(elementRef, cdr) {
3882
3779
  var _this = _super.call(this, elementRef, cdr) || this;
3883
3780
  _this.elementRef = elementRef;
3884
3781
  _this.cdr = cdr;
3885
- _this.elementClassPipe = elementClassPipe;
3886
3782
  return _this;
3887
3783
  }
3888
- Object.defineProperty(TheBulletedListComponent.prototype, "class", {
3784
+ Object.defineProperty(TheBulletedListComponent.prototype, "level", {
3889
3785
  get: function () {
3890
- return this.elementClassPipe.transform(this.element);
3786
+ var _a;
3787
+ return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
3891
3788
  },
3892
3789
  enumerable: false,
3893
3790
  configurable: true
@@ -3900,18 +3797,17 @@
3900
3797
  };
3901
3798
  return TheBulletedListComponent;
3902
3799
  }(TheBaseElementComponent));
3903
- TheBulletedListComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheBulletedListComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: ElementClassPipe }], target: i0__namespace.ɵɵFactoryTarget.Component });
3904
- TheBulletedListComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheBulletedListComponent, selector: "ul[theUl]", host: { properties: { "class": "this.class" } }, providers: [ElementClassPipe], usesInheritance: true, ngImport: i0__namespace, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
3800
+ TheBulletedListComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheBulletedListComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
3801
+ TheBulletedListComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheBulletedListComponent, selector: "ul[theUl]", host: { properties: { "attr.the-level": "this.level" } }, usesInheritance: true, ngImport: i0__namespace, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
3905
3802
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheBulletedListComponent, decorators: [{
3906
3803
  type: i0.Component,
3907
3804
  args: [{
3908
3805
  selector: 'ul[theUl]',
3909
- template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>",
3910
- providers: [ElementClassPipe]
3806
+ template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>"
3911
3807
  }]
3912
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: ElementClassPipe }]; }, propDecorators: { class: [{
3808
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { level: [{
3913
3809
  type: i0.HostBinding,
3914
- args: ['class']
3810
+ args: ['attr.the-level']
3915
3811
  }] } });
3916
3812
 
3917
3813
  var TheListItemComponent = /** @class */ (function (_super) {
@@ -4244,52 +4140,6 @@
4244
4140
  };
4245
4141
  };
4246
4142
 
4247
- /** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
4248
- function coercePixelsFromCssValue(cssValue) {
4249
- var match = cssValue.match(/(\d+)px/);
4250
- if (match) {
4251
- return Number(match[1]);
4252
- }
4253
- }
4254
- function getElementWidth(element) {
4255
- // Optimization: Check style.width first as we probably set it already before reading
4256
- // offsetWidth which triggers layout.
4257
- return coercePixelsFromCssValue(element.style.width) || element.offsetWidth;
4258
- }
4259
- function getElementHeight(element) {
4260
- return Math.round(element.getBoundingClientRect().height);
4261
- }
4262
- function getColsTotalWidth(cols) {
4263
- return cols.reduce(function (total, col) {
4264
- return total + getElementWidth(col);
4265
- }, 0);
4266
- }
4267
- function getRowsTotalHeight(rows) {
4268
- return rows.reduce(function (total, row) {
4269
- return total + getElementHeight(row);
4270
- }, 0);
4271
- }
4272
- function useElementStyle(el, element) {
4273
- if (element.align) {
4274
- el.style.textAlign = element.align || exports.Alignment.left;
4275
- }
4276
- if (element.textIndent) {
4277
- el.style.textIndent = element.textIndent + 'em';
4278
- }
4279
- if (element.verticalAlign) {
4280
- el.style.verticalAlign = element.verticalAlign;
4281
- }
4282
- }
4283
- function getElementClassByPrefix(el, prefix) {
4284
- var matchClass = null;
4285
- el.classList.forEach(function (value, key) {
4286
- if (value.includes(prefix)) {
4287
- matchClass = value;
4288
- }
4289
- });
4290
- return matchClass;
4291
- }
4292
-
4293
4143
  var TheTodoItemComponent = /** @class */ (function (_super) {
4294
4144
  __extends(TheTodoItemComponent, _super);
4295
4145
  function TheTodoItemComponent(elementRef, cdr) {
@@ -4299,15 +4149,16 @@
4299
4149
  _this.checkItemClass = true;
4300
4150
  return _this;
4301
4151
  }
4302
- TheTodoItemComponent.prototype.onContextChange = function () {
4303
- _super.prototype.onContextChange.call(this);
4304
- if (this.initialized) {
4305
- this.useIndentClass(this.elementRef.nativeElement, this.element);
4306
- }
4307
- };
4152
+ Object.defineProperty(TheTodoItemComponent.prototype, "level", {
4153
+ get: function () {
4154
+ var _a;
4155
+ return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
4156
+ },
4157
+ enumerable: false,
4158
+ configurable: true
4159
+ });
4308
4160
  TheTodoItemComponent.prototype.ngOnInit = function () {
4309
4161
  _super.prototype.ngOnInit.call(this);
4310
- this.useIndentClass(this.elementRef.nativeElement, this.element);
4311
4162
  };
4312
4163
  TheTodoItemComponent.prototype.onCheck = function (checked) {
4313
4164
  if (this.readonly) {
@@ -4315,27 +4166,10 @@
4315
4166
  }
4316
4167
  setNode(this.editor, { checked: checked }, this.element);
4317
4168
  };
4318
- TheTodoItemComponent.prototype.useIndentClass = function (el, element) {
4319
- var prefix = 'indent';
4320
- if (element.textIndent) {
4321
- var oldClass = getElementClassByPrefix(el, prefix);
4322
- if (oldClass) {
4323
- el.classList.remove(oldClass);
4324
- }
4325
- var newClassName = prefix + "-" + element.textIndent;
4326
- el.classList.add(newClassName);
4327
- }
4328
- else {
4329
- var oldClass = getElementClassByPrefix(el, prefix);
4330
- if (oldClass) {
4331
- el.classList.remove(oldClass);
4332
- }
4333
- }
4334
- };
4335
4169
  return TheTodoItemComponent;
4336
4170
  }(TheBaseElementComponent));
4337
4171
  TheTodoItemComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheTodoItemComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
4338
- TheTodoItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheTodoItemComponent, selector: "div[theTodoItem]", host: { properties: { "class.the-check-item": "this.checkItemClass" } }, usesInheritance: true, ngImport: i0__namespace, template: "\n <span contenteditable=\"false\" class=\"todo-item-status\">\n <input #checkbox type=\"checkbox\" [checked]=\"element.checked\" (click)=\"onCheck(checkbox.checked)\" />\n </span>\n <slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n ", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
4172
+ TheTodoItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheTodoItemComponent, selector: "div[theTodoItem]", host: { properties: { "class.the-check-item": "this.checkItemClass", "attr.the-level": "this.level" } }, usesInheritance: true, ngImport: i0__namespace, template: "\n <span contenteditable=\"false\" class=\"todo-item-status\">\n <input #checkbox type=\"checkbox\" [checked]=\"element.checked\" (click)=\"onCheck(checkbox.checked)\" />\n </span>\n <slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n ", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
4339
4173
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheTodoItemComponent, decorators: [{
4340
4174
  type: i0.Component,
4341
4175
  args: [{
@@ -4345,6 +4179,9 @@
4345
4179
  }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { checkItemClass: [{
4346
4180
  type: i0.HostBinding,
4347
4181
  args: ['class.the-check-item']
4182
+ }], level: [{
4183
+ type: i0.HostBinding,
4184
+ args: ['attr.the-level']
4348
4185
  }] } });
4349
4186
 
4350
4187
  var withTodoItem = function (editor) {
@@ -4983,7 +4820,7 @@
4983
4820
  return;
4984
4821
  }
4985
4822
  // → + right-block-card
4986
- if ((isMoveForward && !isCardLeftCursor)) {
4823
+ if (isMoveForward && !isCardLeftCursor) {
4987
4824
  nativeEvent.preventDefault();
4988
4825
  var _c = __read(i1.AngularEditor.toSlateCardEntry(editor, anchorNode), 2), path = _c[1];
4989
4826
  var nextPath = slate.Path.next(path);
@@ -8702,6 +8539,52 @@
8702
8539
  type: i0.Injectable
8703
8540
  }], ctorParameters: function () { return []; } });
8704
8541
 
8542
+ /** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
8543
+ function coercePixelsFromCssValue(cssValue) {
8544
+ var match = cssValue.match(/(\d+)px/);
8545
+ if (match) {
8546
+ return Number(match[1]);
8547
+ }
8548
+ }
8549
+ function getElementWidth(element) {
8550
+ // Optimization: Check style.width first as we probably set it already before reading
8551
+ // offsetWidth which triggers layout.
8552
+ return coercePixelsFromCssValue(element.style.width) || element.offsetWidth;
8553
+ }
8554
+ function getElementHeight(element) {
8555
+ return Math.round(element.getBoundingClientRect().height);
8556
+ }
8557
+ function getColsTotalWidth(cols) {
8558
+ return cols.reduce(function (total, col) {
8559
+ return total + getElementWidth(col);
8560
+ }, 0);
8561
+ }
8562
+ function getRowsTotalHeight(rows) {
8563
+ return rows.reduce(function (total, row) {
8564
+ return total + getElementHeight(row);
8565
+ }, 0);
8566
+ }
8567
+ function useElementStyle(el, element) {
8568
+ if (element.align) {
8569
+ el.style.textAlign = element.align || exports.Alignment.left;
8570
+ }
8571
+ if (element.textIndent) {
8572
+ el.style.textIndent = element.textIndent + 'em';
8573
+ }
8574
+ if (element.verticalAlign) {
8575
+ el.style.verticalAlign = element.verticalAlign;
8576
+ }
8577
+ }
8578
+ function getElementClassByPrefix(el, prefix) {
8579
+ var matchClass = null;
8580
+ el.classList.forEach(function (value, key) {
8581
+ if (value.includes(prefix)) {
8582
+ matchClass = value;
8583
+ }
8584
+ });
8585
+ return matchClass;
8586
+ }
8587
+
8705
8588
  function splitCell(editor) {
8706
8589
  var opts = new TableOptions$1();
8707
8590
  var anchor = editor.selection.anchor;
@@ -11870,14 +11753,17 @@
11870
11753
  }
11871
11754
  TheQuickToolbarComponent.prototype.handleMouseDown = function (event) {
11872
11755
  if (!this.elementRef.nativeElement.contains(event.target)) {
11873
- this.popoverRef.close();
11756
+ QuickInsertEditor.closeQuickToolbar(this.editor);
11874
11757
  }
11875
11758
  else {
11876
11759
  event.preventDefault();
11877
11760
  }
11878
11761
  };
11879
11762
  TheQuickToolbarComponent.prototype.handleEnter = function () {
11880
- this.popoverRef.close();
11763
+ QuickInsertEditor.closeQuickToolbar(this.editor);
11764
+ };
11765
+ TheQuickToolbarComponent.prototype.handleEsc = function () {
11766
+ QuickInsertEditor.closeQuickToolbar(this.editor);
11881
11767
  };
11882
11768
  TheQuickToolbarComponent.prototype.ngOnInit = function () {
11883
11769
  this.editorElement = i1.AngularEditor.toDOMNode(this.editor, this.editor);
@@ -11894,7 +11780,7 @@
11894
11780
  };
11895
11781
  TheQuickToolbarComponent.prototype.removeHotKey = function () {
11896
11782
  var node = slate.Node.get(this.editor, this.editor.selection.anchor.path);
11897
- if (node && slate.Text.equals({ text: QUICK_TOOLBAR_HOTKEY }, node)) {
11783
+ if (node && QUICK_TOOLBAR_HOTKEY === node.text) {
11898
11784
  slate.Editor.deleteBackward(this.editor);
11899
11785
  }
11900
11786
  };
@@ -11904,7 +11790,7 @@
11904
11790
  return TheQuickToolbarComponent;
11905
11791
  }(core.mixinUnsubscribe(core.MixinBase)));
11906
11792
  TheQuickToolbarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheQuickToolbarComponent, deps: [{ token: i1__namespace$3.ThyPopoverRef }, { token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
11907
- TheQuickToolbarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", 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__namespace, 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__namespace$2.ThySelectionListComponent, selector: "thy-selection-list,[thy-selection-list]", inputs: ["thyMultiple", "thyBindKeyEventContainer", "thyScrollContainer", "thyBeforeKeydown", "thyUniqueKey", "thyCompareWith", "thyLayout", "thyAutoActiveFirstItem", "thySize", "thySpaceKeyEnabled"], outputs: ["thySelectionChange"] }, { type: i5__namespace$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__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
11793
+ TheQuickToolbarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheQuickToolbarComponent, selector: "the-quick-toolbar", inputs: { editor: "editor", quickToolbarItems: "quickToolbarItems" }, host: { listeners: { "document: mousedown": "handleMouseDown($event)", "document: keydown.enter": "handleEnter()", "document: keydown.escape": "handleEsc()" } }, usesInheritance: true, ngImport: i0__namespace, 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__namespace$2.ThySelectionListComponent, selector: "thy-selection-list,[thy-selection-list]", inputs: ["thyMultiple", "thyBindKeyEventContainer", "thyScrollContainer", "thyBeforeKeydown", "thyUniqueKey", "thyCompareWith", "thyLayout", "thyAutoActiveFirstItem", "thySize", "thySpaceKeyEnabled"], outputs: ["thySelectionChange"] }, { type: i5__namespace$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__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
11908
11794
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheQuickToolbarComponent, decorators: [{
11909
11795
  type: i0.Component,
11910
11796
  args: [{
@@ -11921,6 +11807,9 @@
11921
11807
  }], handleEnter: [{
11922
11808
  type: i0.HostListener,
11923
11809
  args: ['document: keydown.enter']
11810
+ }], handleEsc: [{
11811
+ type: i0.HostListener,
11812
+ args: ['document: keydown.escape']
11924
11813
  }] } });
11925
11814
 
11926
11815
  var OperationTypes = ['insert_text', 'remove_node', 'merge_node'];
@@ -12039,7 +11928,7 @@
12039
11928
  return;
12040
11929
  }
12041
11930
  // unset fontSize
12042
- if (isDefaultFontSize && Number(defaultFontSize) === fontSizeMark) {
11931
+ if (isDefaultFontSize) {
12043
11932
  FontSizeEditor.unsetFontSize(editor, size);
12044
11933
  return;
12045
11934
  }
@@ -12139,7 +12028,7 @@
12139
12028
  var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
12140
12029
  // Put this at the start and end of an inline component to work around this Chromium bug:
12141
12030
  // https://bugs.chromium.org/p/chromium/issues/detail?id=1249405
12142
- _this.inlineChromiumBugfix = '$' + String.fromCodePoint(160);
12031
+ _this.inlineChromiumBugfix = String.fromCodePoint(160);
12143
12032
  return _this;
12144
12033
  }
12145
12034
  return TheInlineCodeComponent;
@@ -12195,6 +12084,300 @@
12195
12084
  return editor;
12196
12085
  };
12197
12086
 
12087
+ var TheIndentToolbarComponent = /** @class */ (function (_super) {
12088
+ __extends(TheIndentToolbarComponent, _super);
12089
+ function TheIndentToolbarComponent(elementRef, thyPopover, viewContainerRef, overlay) {
12090
+ var _this = _super.call(this) || this;
12091
+ _this.elementRef = elementRef;
12092
+ _this.thyPopover = thyPopover;
12093
+ _this.viewContainerRef = viewContainerRef;
12094
+ _this.overlay = overlay;
12095
+ _this.mode = exports.DropdownMode.text;
12096
+ _this.dropdownMode = exports.DropdownMode;
12097
+ _this.disabled = false;
12098
+ return _this;
12099
+ }
12100
+ Object.defineProperty(TheIndentToolbarComponent.prototype, "isOpen", {
12101
+ get: function () {
12102
+ return this.dropdownPopoverRef && this.dropdownPopoverRef.getOverlayRef() && this.dropdownPopoverRef.getOverlayRef().hasAttached();
12103
+ },
12104
+ enumerable: false,
12105
+ configurable: true
12106
+ });
12107
+ TheIndentToolbarComponent.prototype.toggleDropdown = function (event) {
12108
+ var _a;
12109
+ _super.prototype.execute.call(this, event);
12110
+ if (((_a = this.editor) === null || _a === void 0 ? void 0 : _a.disabled) || this.disabled) {
12111
+ return;
12112
+ }
12113
+ this.openDropdownPopover();
12114
+ };
12115
+ TheIndentToolbarComponent.prototype.handleDocumentMouseDown = function (event) {
12116
+ if (!this.elementRef.nativeElement.contains(event.target)) {
12117
+ this.closeDropdownPopover();
12118
+ }
12119
+ };
12120
+ Object.defineProperty(TheIndentToolbarComponent.prototype, "disabledState", {
12121
+ get: function () {
12122
+ return this.disabled;
12123
+ },
12124
+ enumerable: false,
12125
+ configurable: true
12126
+ });
12127
+ TheIndentToolbarComponent.prototype.ngOnInit = function () {
12128
+ var _a;
12129
+ if (!this.activeMenu) {
12130
+ this.activeMenu = this.menus[0];
12131
+ }
12132
+ if (this.toolbarItem) {
12133
+ this.elementRef.nativeElement.classList.add("" + ((_a = this.toolbarItem) === null || _a === void 0 ? void 0 : _a.key));
12134
+ }
12135
+ };
12136
+ TheIndentToolbarComponent.prototype.statusChange = function (editor) {
12137
+ var _a, _b;
12138
+ this.disabled = ((_a = this.toolbarItem) === null || _a === void 0 ? void 0 : _a.disable) ? (_b = this.toolbarItem) === null || _b === void 0 ? void 0 : _b.disable(editor) : false;
12139
+ };
12140
+ TheIndentToolbarComponent.prototype.itemMousedown = function (event, item) {
12141
+ _super.prototype.execute.call(this, event);
12142
+ this.closeDropdownPopover();
12143
+ if (item === null || item === void 0 ? void 0 : item.execute) {
12144
+ item === null || item === void 0 ? void 0 : item.execute(this.editor);
12145
+ }
12146
+ };
12147
+ TheIndentToolbarComponent.prototype.openDropdownPopover = function () {
12148
+ var _a;
12149
+ this.dropdownPopoverRef = this.thyPopover.open(this.dropdownTemplate, {
12150
+ origin: this.elementRef,
12151
+ panelClass: ['the-toolbar-dropdown-popover', (_a = this.toolbarItem) === null || _a === void 0 ? void 0 : _a.key],
12152
+ placement: 'bottomLeft',
12153
+ insideClosable: false,
12154
+ backdropClosable: true,
12155
+ hasBackdrop: false,
12156
+ offset: 10,
12157
+ viewContainerRef: this.viewContainerRef,
12158
+ scrollStrategy: this.overlay.scrollStrategies.reposition()
12159
+ });
12160
+ };
12161
+ TheIndentToolbarComponent.prototype.closeDropdownPopover = function () {
12162
+ var _a;
12163
+ if (this.dropdownPopoverRef) {
12164
+ (_a = this.dropdownPopoverRef) === null || _a === void 0 ? void 0 : _a.close();
12165
+ }
12166
+ };
12167
+ return TheIndentToolbarComponent;
12168
+ }(TheToolbarBaseItemComponent));
12169
+ TheIndentToolbarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheIndentToolbarComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i1__namespace$3.ThyPopover }, { token: i0__namespace.ViewContainerRef }, { token: i2__namespace.Overlay }], target: i0__namespace.ɵɵFactoryTarget.Component });
12170
+ TheIndentToolbarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheIndentToolbarComponent, selector: "the-indent-toolbar-item", inputs: { toolbarItem: "toolbarItem", menus: "menus", mode: "mode", item: "item" }, host: { listeners: { "mousedown": "toggleDropdown($event)", "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class.disabled": "this.disabledState" }, classAttribute: "the-toolbar-dropdown-container" }, viewQueries: [{ propertyName: "dropdownTemplate", first: true, predicate: ["dropdownTemplate"], descendants: true, static: true }], usesInheritance: true, ngImport: i0__namespace, template: "<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\n<ng-template #dropdownTemplate>\n <thy-action-menu class=\"dropdown-menu\">\n <ng-container *ngFor=\"let menu of menus\">\n <a thyActionMenuItem href=\"javascript:;\" (mousedown)=\"itemMousedown($event, menu)\">\n <span 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: i3__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5__namespace$2.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }], directives: [{ type: i5__namespace$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5__namespace$2.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5__namespace$2.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5__namespace$2.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
12171
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheIndentToolbarComponent, decorators: [{
12172
+ type: i0.Component,
12173
+ args: [{
12174
+ selector: 'the-indent-toolbar-item',
12175
+ templateUrl: './toolbar-item.component.html',
12176
+ host: {
12177
+ class: 'the-toolbar-dropdown-container'
12178
+ }
12179
+ }]
12180
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i1__namespace$3.ThyPopover }, { type: i0__namespace.ViewContainerRef }, { type: i2__namespace.Overlay }]; }, propDecorators: { toolbarItem: [{
12181
+ type: i0.Input
12182
+ }], menus: [{
12183
+ type: i0.Input
12184
+ }], mode: [{
12185
+ type: i0.Input
12186
+ }], item: [{
12187
+ type: i0.Input
12188
+ }], dropdownTemplate: [{
12189
+ type: i0.ViewChild,
12190
+ args: ['dropdownTemplate', { static: true }]
12191
+ }], toggleDropdown: [{
12192
+ type: i0.HostListener,
12193
+ args: ['mousedown', ['$event']]
12194
+ }], handleDocumentMouseDown: [{
12195
+ type: i0.HostListener,
12196
+ args: ['document: mousedown', ['$event']]
12197
+ }], disabledState: [{
12198
+ type: i0.HostBinding,
12199
+ args: ['class.disabled']
12200
+ }] } });
12201
+
12202
+ var MaxIndent = 13;
12203
+ var includesIndentTypes = __spreadArray([
12204
+ exports.ElementKinds.checkItem,
12205
+ exports.ElementKinds.numberedList,
12206
+ exports.ElementKinds.bulletedList,
12207
+ exports.ElementKinds.paragraph
12208
+ ], __read(HEADING_TYPES));
12209
+ var IndentEditor = {
12210
+ setIndent: function (editor) {
12211
+ var nodes = Array.from(slate.Editor.nodes(editor, {
12212
+ mode: 'highest',
12213
+ match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
12214
+ }));
12215
+ var _a = __read(nodes, 1), startBlock = _a[0];
12216
+ if (startBlock) {
12217
+ var _b = __read(startBlock, 1), indent = _b[0].indent;
12218
+ indent = indent ? indent : 0;
12219
+ indent += 1;
12220
+ if (indent <= MaxIndent) {
12221
+ slate.Transforms.setNodes(editor, { indent: indent }, {
12222
+ mode: 'highest',
12223
+ match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
12224
+ });
12225
+ }
12226
+ }
12227
+ },
12228
+ cancelIndent: function (editor) {
12229
+ var nodes = Array.from(slate.Editor.nodes(editor, {
12230
+ mode: 'highest',
12231
+ match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
12232
+ }));
12233
+ var _a = __read(nodes, 1), startBlock = _a[0];
12234
+ if (startBlock) {
12235
+ var _b = __read(startBlock, 1), indent = _b[0].indent;
12236
+ indent = indent === 1 ? null : (indent -= 1);
12237
+ slate.Transforms.setNodes(editor, { indent: indent }, {
12238
+ mode: 'highest',
12239
+ match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
12240
+ });
12241
+ }
12242
+ },
12243
+ setTextIndent: function (editor, kinds, textIndent) {
12244
+ slate.Transforms.setNodes(editor, { textIndent: textIndent }, {
12245
+ mode: 'highest',
12246
+ match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
12247
+ });
12248
+ },
12249
+ cancelTextIntent: function (editor, event, anchorBlock, kinds) {
12250
+ var textIndent = anchorBlock.textIndent, indent = anchorBlock.indent;
12251
+ if (indent) {
12252
+ event.preventDefault();
12253
+ IndentEditor.cancelIndent(editor);
12254
+ return true;
12255
+ }
12256
+ if (!indent && textIndent > 2) {
12257
+ event.preventDefault();
12258
+ textIndent -= 2;
12259
+ IndentEditor.setTextIndent(editor, kinds, textIndent);
12260
+ return true;
12261
+ }
12262
+ if (!indent && textIndent === 2) {
12263
+ event.preventDefault();
12264
+ IndentEditor.setTextIndent(editor, kinds, null);
12265
+ return true;
12266
+ }
12267
+ return false;
12268
+ },
12269
+ isDisabled: function (editor) {
12270
+ if (editor.selection) {
12271
+ var disableGroup = HEADING_TYPES;
12272
+ var anchorBlock$1 = anchorBlock(editor);
12273
+ return anchorBlock$1 && disableGroup.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
12274
+ }
12275
+ return false;
12276
+ }
12277
+ };
12278
+
12279
+ var IndentOptions = [
12280
+ {
12281
+ key: exports.ElementKinds.indent,
12282
+ includes: [exports.Indents.indentRight, exports.Indents.indentLeft],
12283
+ iconComponent: TheIndentToolbarComponent,
12284
+ disable: function (editor) { return IndentEditor.isDisabled(editor); }
12285
+ },
12286
+ {
12287
+ key: exports.Indents.indentRight,
12288
+ name: '增加缩进',
12289
+ icon: 'float-left',
12290
+ execute: function (editor) { return IndentEditor.setIndent(editor); }
12291
+ },
12292
+ {
12293
+ key: exports.Indents.indentLeft,
12294
+ name: '减少缩进',
12295
+ icon: 'float-right',
12296
+ type: exports.ToolbarItemType.toolDropdown,
12297
+ execute: function (editor) { return IndentEditor.cancelIndent(editor); }
12298
+ }
12299
+ ];
12300
+
12301
+ var onKeydownTextIndent = function (editor, event, kinds) {
12302
+ var selection = editor.selection;
12303
+ var isExpanded = slate.Range.isExpanded(selection);
12304
+ var nodes = Array.from(slate.Editor.nodes(editor, {
12305
+ mode: 'highest',
12306
+ match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
12307
+ }));
12308
+ var _a = __read(nodes, 1), startBlock = _a[0];
12309
+ if (!startBlock) {
12310
+ return false;
12311
+ }
12312
+ var _b = __read(startBlock, 2), block = _b[0], path = _b[1];
12313
+ var currentPath = [path[0]];
12314
+ var isStart = slate.Editor.isStart(editor, selection.anchor, currentPath);
12315
+ var textIndentDisable = [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList, exports.ElementKinds.checkItem];
12316
+ if (isHotkey__default["default"]('Tab', event)) {
12317
+ event.preventDefault();
12318
+ if (startBlock && (isExpanded || isStart)) {
12319
+ if (!editor.isVoid(block)) {
12320
+ var textIndent = block.textIndent, type = block.type;
12321
+ // do not apply first-line indentation for lists
12322
+ if (!textIndent && !textIndentDisable.includes(type)) {
12323
+ IndentEditor.setTextIndent(editor, kinds, 2);
12324
+ return true;
12325
+ }
12326
+ else {
12327
+ IndentEditor.setIndent(editor);
12328
+ return true;
12329
+ }
12330
+ }
12331
+ }
12332
+ else {
12333
+ editor.insertText(TAB_SPACE);
12334
+ return true;
12335
+ }
12336
+ }
12337
+ if (isHotkey__default["default"]('shift+Tab', event)) {
12338
+ if (startBlock && (isExpanded || isStart)) {
12339
+ if (!editor.isVoid(block)) {
12340
+ return IndentEditor.cancelTextIntent(editor, event, block, kinds);
12341
+ }
12342
+ }
12343
+ }
12344
+ if (selection && slate.Range.isCollapsed(selection) && i1.hotkeys.isDeleteBackward(event)) {
12345
+ if (startBlock && isStart) {
12346
+ return IndentEditor.cancelTextIntent(editor, event, block, kinds);
12347
+ }
12348
+ }
12349
+ return false;
12350
+ };
12351
+
12352
+ var withIndent = function (kinds) { return function (editor) {
12353
+ var onKeydown = editor.onKeydown;
12354
+ editor.onKeydown = function (event) {
12355
+ var HOTKEYS = {
12356
+ 'mod+]': exports.Indents.indentRight,
12357
+ 'mod+[': exports.Indents.indentLeft
12358
+ };
12359
+ for (var hotkey in HOTKEYS) {
12360
+ if (isHotkey__default["default"](hotkey, event)) {
12361
+ event.preventDefault();
12362
+ var mark = HOTKEYS[hotkey];
12363
+ switch (mark) {
12364
+ case exports.Indents.indentRight:
12365
+ IndentEditor.setIndent(editor);
12366
+ break;
12367
+ case exports.Indents.indentLeft:
12368
+ IndentEditor.cancelIndent(editor);
12369
+ break;
12370
+ }
12371
+ }
12372
+ }
12373
+ var isContinue = !onKeydownTextIndent(editor, event, kinds);
12374
+ if (isContinue) {
12375
+ onKeydown(event);
12376
+ }
12377
+ };
12378
+ return editor;
12379
+ }; };
12380
+
12198
12381
  var internalPlugins = [
12199
12382
  withTheHistory,
12200
12383
  withAutoInsertData(),
@@ -12237,7 +12420,7 @@
12237
12420
  withQuickInsert,
12238
12421
  withInlineCode
12239
12422
  ];
12240
- var internalToolbarItems = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(AlignOptions)), __read(MarkOptions)), __read(ColorOptions)), __read(HeadingOptions)), __read(FontSizeOptions)), __read(TodoItemOptions)), __read(ListOptions)), __read(ImageOptions)), __read(HrOptions)), __read(BlockquoteOptions)), __read(CodeOptions)), __read(LinkOptions)), __read(TableOptions)), __read(VerticalAlignOptions)), __read(PaintFormatOptions)), __read(InlineCodeOptions));
12423
+ var internalToolbarItems = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(AlignOptions)), __read(MarkOptions)), __read(ColorOptions)), __read(HeadingOptions)), __read(FontSizeOptions)), __read(TodoItemOptions)), __read(ListOptions)), __read(ImageOptions)), __read(HrOptions)), __read(BlockquoteOptions)), __read(CodeOptions)), __read(LinkOptions)), __read(TableOptions)), __read(VerticalAlignOptions)), __read(PaintFormatOptions)), __read(InlineCodeOptions)), __read(IndentOptions));
12241
12424
  var toolbarCompose = function (toolbarItems) {
12242
12425
  if (toolbarItems === void 0) { toolbarItems = []; }
12243
12426
  return __spreadArray(__spreadArray([], __read(internalToolbarItems)), __read(toolbarItems));
@@ -12884,6 +13067,51 @@
12884
13067
  args: ['mousedown', ['$event']]
12885
13068
  }] } });
12886
13069
 
13070
+ var ElementStylePipe = /** @class */ (function () {
13071
+ function ElementStylePipe() {
13072
+ }
13073
+ ElementStylePipe.prototype.transform = function (element, align) {
13074
+ var style = {};
13075
+ if (element.align || align) {
13076
+ style.textAlign = element.align || align || exports.Alignment.left;
13077
+ }
13078
+ if (element.textIndent) {
13079
+ style.textIndent = element.textIndent + 'em';
13080
+ }
13081
+ return style;
13082
+ };
13083
+ return ElementStylePipe;
13084
+ }());
13085
+ ElementStylePipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
13086
+ ElementStylePipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, name: "elementStyle" });
13087
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, decorators: [{
13088
+ type: i0.Pipe,
13089
+ args: [{
13090
+ name: 'elementStyle'
13091
+ }]
13092
+ }] });
13093
+ var ElementClassPipe = /** @class */ (function () {
13094
+ function ElementClassPipe() {
13095
+ }
13096
+ ElementClassPipe.prototype.transform = function (element) {
13097
+ var classStr = '';
13098
+ var prefix = 'indent';
13099
+ if (element.textIndent) {
13100
+ classStr += prefix + "-" + element.textIndent;
13101
+ }
13102
+ return classStr;
13103
+ };
13104
+ return ElementClassPipe;
13105
+ }());
13106
+ ElementClassPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
13107
+ ElementClassPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, name: "elementClass" });
13108
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, decorators: [{
13109
+ type: i0.Pipe,
13110
+ args: [{
13111
+ name: 'elementClass'
13112
+ }]
13113
+ }] });
13114
+
12887
13115
  var TheTemplateComponent = /** @class */ (function () {
12888
13116
  function TheTemplateComponent() {
12889
13117
  var _this = this;
@@ -13558,7 +13786,8 @@
13558
13786
  TheTableSelectComponent,
13559
13787
  TheTableToolbarItemComponent,
13560
13788
  TheConversionHintComponent,
13561
- TheVerticalToolbarItemComponent
13789
+ TheVerticalToolbarItemComponent,
13790
+ TheIndentToolbarComponent
13562
13791
  ];
13563
13792
  var PLUGIN_COMPONENTS = [
13564
13793
  TheImageComponent,
@@ -13604,7 +13833,8 @@
13604
13833
  TheTableSelectComponent,
13605
13834
  TheTableToolbarItemComponent,
13606
13835
  TheConversionHintComponent,
13607
- TheVerticalToolbarItemComponent, TheImageComponent,
13836
+ TheVerticalToolbarItemComponent,
13837
+ TheIndentToolbarComponent, TheImageComponent,
13608
13838
  TheTemplateComponent,
13609
13839
  TheHrComponent,
13610
13840
  TheBlockquoteComponent,