@worktile/theia 2.4.2 → 2.4.3

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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('slate-angular'), require('ngx-tethys/core'), require('is-hotkey'), require('slate'), require('slate-history'), require('marked'), require('@atinc/selene'), require('ngx-tethys/popover'), require('lodash'), require('@angular/cdk/overlay'), require('ngx-tethys/alert'), require('rxjs/operators'), require('ngx-tethys/uploader'), require('rxjs'), require('@angular/platform-browser'), require('ngx-tethys/progress'), require('ngx-tethys/icon'), require('ngx-tethys/nav'), require('ngx-tethys/tooltip'), require('ngx-tethys/input'), require('ng-codemirror'), require('ngx-tethys/notify'), require('ngx-tethys/action-menu'), require('ngx-tethys/switch'), require('ngx-tethys/resizable'), require('is-url'), require('ngx-tethys/button'), require('ngx-tethys/form'), require('ngx-tethys/shared'), require('ngx-tethys'), require('@angular/cdk/coercion'), require('@angular/cdk/portal'), require('ngx-tethys/list'), require('ngx-tethys/autocomplete'), require('ngx-tethys/avatar'), require('ngx-tethys/select')) :
3
3
  typeof define === 'function' && define.amd ? define('@worktile/theia', ['exports', '@angular/core', '@angular/common', '@angular/forms', 'slate-angular', 'ngx-tethys/core', 'is-hotkey', 'slate', 'slate-history', 'marked', '@atinc/selene', 'ngx-tethys/popover', 'lodash', '@angular/cdk/overlay', 'ngx-tethys/alert', 'rxjs/operators', 'ngx-tethys/uploader', 'rxjs', '@angular/platform-browser', 'ngx-tethys/progress', 'ngx-tethys/icon', 'ngx-tethys/nav', 'ngx-tethys/tooltip', 'ngx-tethys/input', 'ng-codemirror', 'ngx-tethys/notify', 'ngx-tethys/action-menu', 'ngx-tethys/switch', 'ngx-tethys/resizable', 'is-url', 'ngx-tethys/button', 'ngx-tethys/form', 'ngx-tethys/shared', 'ngx-tethys', '@angular/cdk/coercion', '@angular/cdk/portal', 'ngx-tethys/list', 'ngx-tethys/autocomplete', 'ngx-tethys/avatar', 'ngx-tethys/select'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.worktile = global.worktile || {}, global.worktile.theia = {}), global.ng.core, global.ng.common, global.ng.forms, global.i1, global.core, global.isHotkey, global.slate, global.slateHistory, global.marked, global.selene, global.i1$2, global._lodash, global.ng.cdk.overlay, global.i1$1, global.rxjs.operators, global.uploader, global.rxjs, global.ng.platformBrowser, global.i6, global.i3, global.i3$1, global.i5, global.i5$1, global.i8, global.i1$4, global.i2$1, global.i6$1, global.i9, global.isUrl, global.i1$5, global.i2$2, global.i5$2, global.i1$6, global.ng.cdk.coercion, global.ng.cdk.portal, global.i2$3, global.autocomplete, global.avatar, global.select));
5
- })(this, (function (exports, i0, i10, i4, i1, core, isHotkey, slate, slateHistory, marked, selene, i1$2, _lodash, i2, i1$1, operators, uploader, rxjs, i1$3, i6, i3, i3$1, i5, i5$1, i8, i1$4, i2$1, i6$1, i9, isUrl, i1$5, i2$2, i5$2, i1$6, coercion, portal, i2$3, autocomplete, avatar, select) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.worktile = global.worktile || {}, global.worktile.theia = {}), global.ng.core, global.ng.common, global.ng.forms, global.i1, global.core, global.isHotkey, global.slate, global.slateHistory, global.marked, global.selene, global.i1$2, global._lodash, global.ng.cdk.overlay, global.i1$1, global.rxjs.operators, global.uploader, global.rxjs, global.ng.platformBrowser, global.i6, global.i3, global.i3$1, global.i5, global.i5$1, global.i8, global.i1$4, global.i2$1, global.i6$1, global.i9, global.isUrl, global.i1$5, global.i2$2, global.i5$2, global.i1$6, global.ng.cdk.coercion, global.ng.cdk.portal, global.i1$7, global.autocomplete, global.avatar, global.select));
5
+ })(this, (function (exports, i0, i10, i4, i1, core, isHotkey, slate, slateHistory, marked, selene, i1$2, _lodash, i2, i1$1, operators, uploader, rxjs, i1$3, i6, i3, i3$1, i5, i5$1, i8, i1$4, i2$1, i6$1, i9, isUrl, i1$5, i2$2, i5$2, i1$6, coercion, portal, i1$7, autocomplete, avatar, select) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -50,7 +50,7 @@
50
50
  var i2__namespace$2 = /*#__PURE__*/_interopNamespace(i2$2);
51
51
  var i5__namespace$2 = /*#__PURE__*/_interopNamespace(i5$2);
52
52
  var i1__namespace$6 = /*#__PURE__*/_interopNamespace(i1$6);
53
- var i2__namespace$3 = /*#__PURE__*/_interopNamespace(i2$3);
53
+ var i1__namespace$7 = /*#__PURE__*/_interopNamespace(i1$7);
54
54
 
55
55
  /*! *****************************************************************************
56
56
  Copyright (c) Microsoft Corporation.
@@ -1995,6 +1995,40 @@
1995
1995
  return false;
1996
1996
  }
1997
1997
 
1998
+ var insertElementNode = function (editor, node) {
1999
+ if (slate.Range.isExpanded(editor.selection)) {
2000
+ slate.Editor.deleteFragment(editor);
2001
+ }
2002
+ var isBlockCardCursor$1 = isBlockCardCursor(editor);
2003
+ var containerBlocks = getContainerBlocks(editor);
2004
+ var isContainer = isNodeTypeIn(editor, containerBlocks, { at: editor.selection });
2005
+ var _a = __read(anchorBlockEntry(editor), 2), anchorBlock = _a[0], anchorBlockPath = _a[1];
2006
+ var isEmpty = slate.Editor.isEmpty(editor, anchorBlock);
2007
+ if (isContainer && !isBlockCardCursor$1) {
2008
+ var _b = __read(slate.Editor.above(editor, {
2009
+ match: function (n) { return slate.Editor.isBlock(editor, n) && containerBlocks.includes(n.type); },
2010
+ at: editor.selection
2011
+ }), 2), containerPath_1 = _b[1];
2012
+ slate.Editor.withoutNormalizing(editor, function () {
2013
+ var containerPathFirstPath = anchorBlockPath.slice(0, containerPath_1.length + 1);
2014
+ slate.Transforms.insertNodes(editor, node, { at: slate.Path.next(containerPathFirstPath), select: true });
2015
+ if (isEmpty) {
2016
+ slate.Transforms.removeNodes(editor, { at: anchorBlockPath });
2017
+ }
2018
+ });
2019
+ return;
2020
+ }
2021
+ var nextPath = slate.Path.next([anchorBlockPath[0]]);
2022
+ slate.Transforms.insertNodes(editor, node, { at: nextPath });
2023
+ if (isEmpty && anchorBlockPath.length === 1) {
2024
+ slate.Transforms.delete(editor, { at: anchorBlockPath });
2025
+ slate.Transforms.select(editor, slate.Editor.start(editor, anchorBlockPath));
2026
+ }
2027
+ else {
2028
+ slate.Transforms.select(editor, slate.Editor.start(editor, nextPath));
2029
+ }
2030
+ };
2031
+
1998
2032
  var index = /*#__PURE__*/Object.freeze({
1999
2033
  __proto__: null,
2000
2034
  setMarks: setMarks,
@@ -2014,7 +2048,8 @@
2014
2048
  setEndSelection: setEndSelection,
2015
2049
  closeConversionHint: closeConversionHint,
2016
2050
  handleContinualDeleteBackward: handleContinualDeleteBackward,
2017
- handleContinualInsertBreak: handleContinualInsertBreak
2051
+ handleContinualInsertBreak: handleContinualInsertBreak,
2052
+ insertElementNode: insertElementNode
2018
2053
  });
2019
2054
 
2020
2055
  var TheConversionHintComponent = /** @class */ (function () {
@@ -12118,27 +12153,27 @@
12118
12153
 
12119
12154
  var TheQuickToolbarComponent = /** @class */ (function (_super) {
12120
12155
  __extends(TheQuickToolbarComponent, _super);
12121
- function TheQuickToolbarComponent(popoverRef, elementRef) {
12156
+ function TheQuickToolbarComponent(elementRef, cdr) {
12122
12157
  var _this = _super.call(this) || this;
12123
- _this.popoverRef = popoverRef;
12124
12158
  _this.elementRef = elementRef;
12159
+ _this.cdr = cdr;
12125
12160
  _this.ToolbarItemMode = exports.ToolbarItemMode;
12126
12161
  _this.ToolbarActionTypes = exports.ToolbarActionTypes;
12127
12162
  return _this;
12128
12163
  }
12129
12164
  TheQuickToolbarComponent.prototype.handleMouseDown = function (event) {
12130
12165
  if (!this.elementRef.nativeElement.contains(event.target)) {
12131
- QuickInsertEditor.closeQuickToolbar(this.editor);
12166
+ QuickInsertEditor.closeQuickInsertToolbar(this.editor);
12132
12167
  }
12133
12168
  else {
12134
12169
  event.preventDefault();
12135
12170
  }
12136
12171
  };
12137
12172
  TheQuickToolbarComponent.prototype.handleEnter = function () {
12138
- QuickInsertEditor.closeQuickToolbar(this.editor);
12173
+ QuickInsertEditor.closeQuickInsertToolbar(this.editor);
12139
12174
  };
12140
12175
  TheQuickToolbarComponent.prototype.handleEsc = function () {
12141
- QuickInsertEditor.closeQuickToolbar(this.editor);
12176
+ QuickInsertEditor.closeQuickInsertToolbar(this.editor);
12142
12177
  };
12143
12178
  TheQuickToolbarComponent.prototype.ngOnInit = function () {
12144
12179
  this.editorElement = i1.AngularEditor.toDOMNode(this.editor, this.editor);
@@ -12164,15 +12199,15 @@
12164
12199
  };
12165
12200
  return TheQuickToolbarComponent;
12166
12201
  }(core.mixinUnsubscribe(core.MixinBase)));
12167
- 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 });
12168
- 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$3.ThySelectionListComponent, selector: "thy-selection-list,[thy-selection-list]", inputs: ["thyMultiple", "thyBindKeyEventContainer", "thyScrollContainer", "thyBeforeKeydown", "thyUniqueKey", "thyCompareWith", "thyLayout", "thyAutoActiveFirstItem", "thySize", "thySpaceKeyEnabled"], outputs: ["thySelectionChange"] }, { type: i5__namespace$2.ThyListOptionComponent, selector: "thy-list-option,[thy-list-option]", inputs: ["id", "thyValue", "thyDisabled"] }, { type: TheToolbarItemComponent, selector: "the-toolbar-item", inputs: ["editor", "item", "itemMode"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }], directives: [{ type: i10__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
12202
+ TheQuickToolbarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheQuickToolbarComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
12203
+ 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: i1__namespace$7.ThySelectionListComponent, selector: "thy-selection-list,[thy-selection-list]", inputs: ["thyMultiple", "thyBindKeyEventContainer", "thyScrollContainer", "thyBeforeKeydown", "thyUniqueKey", "thyCompareWith", "thyLayout", "thyAutoActiveFirstItem", "thySize", "thySpaceKeyEnabled"], outputs: ["thySelectionChange"] }, { type: i5__namespace$2.ThyListOptionComponent, selector: "thy-list-option,[thy-list-option]", inputs: ["id", "thyValue", "thyDisabled"] }, { type: TheToolbarItemComponent, selector: "the-toolbar-item", inputs: ["editor", "item", "itemMode"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }], directives: [{ type: i10__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
12169
12204
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheQuickToolbarComponent, decorators: [{
12170
12205
  type: i0.Component,
12171
12206
  args: [{
12172
12207
  selector: 'the-quick-toolbar',
12173
12208
  templateUrl: 'quick-toolbar.component.html'
12174
12209
  }]
12175
- }], ctorParameters: function () { return [{ type: i1__namespace$3.ThyPopoverRef }, { type: i0__namespace.ElementRef }]; }, propDecorators: { editor: [{
12210
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { editor: [{
12176
12211
  type: i0.Input
12177
12212
  }], quickToolbarItems: [{
12178
12213
  type: i0.Input
@@ -12187,16 +12222,22 @@
12187
12222
  args: ['document: keydown.escape']
12188
12223
  }] } });
12189
12224
 
12190
- var OperationTypes = ['insert_text', 'remove_node', 'merge_node'];
12191
12225
  var QuickInsertEditor = {
12192
- openQuickToolbar: function (editor, toolbarItems, origin) {
12226
+ openQuickInsertToolbar: function (editor, quickToolbarItems, origin) {
12227
+ if (QuickInsertEditor.isOpenedToolbar(editor)) {
12228
+ return;
12229
+ }
12230
+ if (!origin) {
12231
+ var rootNode = i1.AngularEditor.toDOMNode(editor, slate.Node.ancestor(editor, [editor.selection.anchor.path[0]]));
12232
+ origin = rootNode.querySelector('[data-slate-leaf="true"]');
12233
+ }
12193
12234
  var overlay = editor.injector.get(i2.Overlay);
12194
12235
  var viewContainerRef = editor.injector.get(i0.ViewContainerRef);
12195
12236
  var thyPopover = editor.injector.get(i1$2.ThyPopover);
12196
12237
  var quickToolbarRef = thyPopover.open(TheQuickToolbarComponent, {
12197
12238
  initialState: {
12198
12239
  editor: editor,
12199
- quickToolbarItems: toolbarItems
12240
+ quickToolbarItems: quickToolbarItems
12200
12241
  },
12201
12242
  origin: origin,
12202
12243
  viewContainerRef: viewContainerRef,
@@ -12209,53 +12250,34 @@
12209
12250
  scrollStrategy: overlay.scrollStrategies.reposition(),
12210
12251
  manualClosure: true
12211
12252
  });
12253
+ quickToolbarRef.componentInstance.cdr.markForCheck();
12212
12254
  THE_EDITOR_QUICK_TOOLBAR_REF.set(editor, quickToolbarRef);
12213
12255
  },
12214
- closeQuickToolbar: function (editor) {
12256
+ closeQuickInsertToolbar: function (editor) {
12215
12257
  var quickToolbarRef = THE_EDITOR_QUICK_TOOLBAR_REF.get(editor);
12216
12258
  if (quickToolbarRef) {
12217
12259
  quickToolbarRef.close();
12218
12260
  THE_EDITOR_QUICK_TOOLBAR_REF.set(editor, null);
12219
12261
  }
12220
12262
  },
12221
- isOpenToolbar: function (editor, opTypes) {
12222
- if (opTypes === void 0) { opTypes = OperationTypes; }
12223
- var isCollapsedCursor = TheEditor.isFocused(editor) && editor.selection && slate.Range.isCollapsed(editor.selection);
12224
- if (!isCollapsedCursor) {
12225
- return false;
12226
- }
12227
- var block = slate.Node.ancestor(editor, [editor.selection.anchor.path[0]]);
12228
- var undos = editor.history.undos;
12229
- var lastBatch = undos[undos.length - 1];
12230
- var lastOp = lastBatch && lastBatch[lastBatch.length - 1];
12231
- if (lastOp &&
12232
- block.children.length === 1 &&
12233
- block.type === exports.ElementKinds.paragraph &&
12234
- slate.Node.string(block) === QUICK_TOOLBAR_HOTKEY &&
12235
- opTypes.includes(lastOp.type) &&
12236
- (lastOp.text === QUICK_TOOLBAR_HOTKEY || lastOp.text === undefined)) {
12237
- return true;
12238
- }
12239
- return false;
12263
+ isOpenedToolbar: function (editor) {
12264
+ var quickToolbarRef = THE_EDITOR_QUICK_TOOLBAR_REF.get(editor);
12265
+ return !!quickToolbarRef;
12240
12266
  }
12241
12267
  };
12242
12268
 
12243
12269
  var withQuickInsert = function (editor) {
12244
12270
  var onKeydown = editor.onKeydown, deleteBackward = editor.deleteBackward, onChange = editor.onChange;
12271
+ var presseingQuickInsertHotkey = false;
12245
12272
  editor.onKeydown = function (event) {
12246
12273
  if (event.key === QUICK_TOOLBAR_HOTKEY && isCleanEmptyParagraph(editor)) {
12247
- var rootNode = i1.AngularEditor.toDOMNode(editor, slate.Node.ancestor(editor, [editor.selection.anchor.path[0]]));
12248
- var theEditorComponent = editor.injector.get(TheEditorComponent);
12249
- var quickToolbars = theEditorComponent.quickToolbarItems;
12250
- var leafElement = rootNode.querySelector('[data-slate-leaf="true"]');
12251
- var origin = leafElement || rootNode;
12252
- QuickInsertEditor.openQuickToolbar(editor, quickToolbars, origin);
12274
+ presseingQuickInsertHotkey = true;
12253
12275
  }
12254
12276
  onKeydown(event);
12255
12277
  };
12256
12278
  editor.deleteBackward = function (unit) {
12257
- if (!QuickInsertEditor.isOpenToolbar(editor, ['remove_text'])) {
12258
- QuickInsertEditor.closeQuickToolbar(editor);
12279
+ if (QuickInsertEditor.isOpenedToolbar(editor)) {
12280
+ QuickInsertEditor.closeQuickInsertToolbar(editor);
12259
12281
  }
12260
12282
  deleteBackward(unit);
12261
12283
  };
@@ -12263,11 +12285,17 @@
12263
12285
  var _a;
12264
12286
  onChange();
12265
12287
  if (editor.selection) {
12288
+ var block = slate.Node.get(editor, [editor.selection.anchor.path[0]]);
12289
+ // quick insert plus
12266
12290
  var editorComponent = editor.injector.get(TheEditorComponent);
12267
12291
  (_a = editorComponent.quickInsertInstance) === null || _a === void 0 ? void 0 : _a.checkStatus();
12268
- var block = slate.Node.ancestor(editor, [editor.selection.anchor.path[0]]);
12269
- if (!isCleanEmptyParagraph(editor) && slate.Node.string(block) !== QUICK_TOOLBAR_HOTKEY) {
12270
- QuickInsertEditor.closeQuickToolbar(editor);
12292
+ if (presseingQuickInsertHotkey && slate.Node.string(block) === QUICK_TOOLBAR_HOTKEY) {
12293
+ QuickInsertEditor.openQuickInsertToolbar(editor, editorComponent.quickToolbarItems);
12294
+ presseingQuickInsertHotkey = false;
12295
+ return;
12296
+ }
12297
+ if (QuickInsertEditor.isOpenedToolbar(editor) && !isCleanEmptyParagraph(editor) && slate.Node.string(block) !== QUICK_TOOLBAR_HOTKEY) {
12298
+ QuickInsertEditor.closeQuickInsertToolbar(editor);
12271
12299
  }
12272
12300
  }
12273
12301
  };
@@ -12576,6 +12604,78 @@
12576
12604
  args: ['class.disabled']
12577
12605
  }] } });
12578
12606
 
12607
+ var onKeydownTextIndent = function (editor, event, kinds, textIndentDisabled) {
12608
+ var selection = editor.selection;
12609
+ var isExpanded = slate.Range.isExpanded(selection);
12610
+ var nodes = Array.from(slate.Editor.nodes(editor, {
12611
+ mode: 'highest',
12612
+ match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
12613
+ }));
12614
+ var _a = __read(nodes, 1), startBlock = _a[0];
12615
+ if (!startBlock) {
12616
+ return false;
12617
+ }
12618
+ var _b = __read(startBlock, 2), block = _b[0], path = _b[1];
12619
+ var isStart = slate.Editor.isStart(editor, selection.anchor, path);
12620
+ if (isHotkey.isKeyHotkey('Tab', event)) {
12621
+ event.preventDefault();
12622
+ if (startBlock && (isExpanded || isStart)) {
12623
+ if (!editor.isVoid(block)) {
12624
+ var textIndent = block.textIndent, type = block.type;
12625
+ // do not apply first-line indentation for lists
12626
+ if (!textIndent && !textIndentDisabled.includes(type)) {
12627
+ IndentEditor.setTextIndent(editor, kinds, 2);
12628
+ return true;
12629
+ }
12630
+ else {
12631
+ IndentEditor.setIndent(editor);
12632
+ return true;
12633
+ }
12634
+ }
12635
+ }
12636
+ else {
12637
+ editor.insertText(TAB_SPACE);
12638
+ return true;
12639
+ }
12640
+ }
12641
+ if (isHotkey.isKeyHotkey('shift+Tab', event)) {
12642
+ if (startBlock && (isExpanded || isStart)) {
12643
+ if (!editor.isVoid(block)) {
12644
+ return IndentEditor.cancelTextIntent(editor, event, block, kinds);
12645
+ }
12646
+ }
12647
+ }
12648
+ if (selection && slate.Range.isCollapsed(selection) && i1.hotkeys.isDeleteBackward(event)) {
12649
+ if (startBlock && isStart) {
12650
+ return IndentEditor.cancelTextIntent(editor, event, block, kinds);
12651
+ }
12652
+ }
12653
+ return false;
12654
+ };
12655
+
12656
+ var withIndent = function (kinds) { return function (editor) {
12657
+ var onKeydown = editor.onKeydown;
12658
+ editor.onKeydown = function (event) {
12659
+ var _a, _b, _c, _d;
12660
+ var indentTypes = kinds;
12661
+ var disableIndentTypes = [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList, exports.ElementKinds.checkItem];
12662
+ if ((_b = (_a = editor.extraIndentOptions) === null || _a === void 0 ? void 0 : _a.indentTypes) === null || _b === void 0 ? void 0 : _b.length) {
12663
+ indentTypes = mergIndentTypes(kinds, editor.extraIndentOptions.indentTypes);
12664
+ }
12665
+ if ((_d = (_c = editor.extraIndentOptions) === null || _c === void 0 ? void 0 : _c.disabledIndentTypes) === null || _d === void 0 ? void 0 : _d.length) {
12666
+ disableIndentTypes = mergIndentTypes(disableIndentTypes, editor.extraIndentOptions.disabledIndentTypes);
12667
+ }
12668
+ var isContinue = !onKeydownTextIndent(editor, event, indentTypes, disableIndentTypes);
12669
+ if (isContinue) {
12670
+ onKeydown(event);
12671
+ }
12672
+ };
12673
+ return editor;
12674
+ }; };
12675
+ var mergIndentTypes = function (defaultTypes, indentTypes) {
12676
+ return Array.from(new Set(__spreadArray(__spreadArray([], __read(defaultTypes)), __read(indentTypes))));
12677
+ };
12678
+
12579
12679
  var MaxIndent = 11;
12580
12680
  var includesIndentTypes = __spreadArray([
12581
12681
  exports.ElementKinds.checkItem,
@@ -12583,11 +12683,15 @@
12583
12683
  exports.ElementKinds.bulletedList,
12584
12684
  exports.ElementKinds.paragraph
12585
12685
  ], __read(HEADING_TYPES));
12686
+ var getIndentTypes = function (editor) {
12687
+ var indentTypes = editor.extraIndentOptions ? editor.extraIndentOptions.indentTypes : [];
12688
+ return mergIndentTypes(includesIndentTypes, indentTypes);
12689
+ };
12586
12690
  var IndentEditor = {
12587
12691
  setIndent: function (editor) {
12588
12692
  var nodes = Array.from(slate.Editor.nodes(editor, {
12589
12693
  mode: 'highest',
12590
- match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
12694
+ match: function (n) { return slate.Element.isElement(n) && getIndentTypes(editor).includes(n.type); }
12591
12695
  }));
12592
12696
  var _a = __read(nodes, 1), startBlock = _a[0];
12593
12697
  if (startBlock) {
@@ -12597,7 +12701,7 @@
12597
12701
  if (indent <= MaxIndent) {
12598
12702
  slate.Transforms.setNodes(editor, { indent: indent }, {
12599
12703
  mode: 'highest',
12600
- match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
12704
+ match: function (n) { return slate.Element.isElement(n) && getIndentTypes(editor).includes(n.type); }
12601
12705
  });
12602
12706
  }
12603
12707
  }
@@ -12605,7 +12709,7 @@
12605
12709
  cancelIndent: function (editor) {
12606
12710
  var nodes = Array.from(slate.Editor.nodes(editor, {
12607
12711
  mode: 'highest',
12608
- match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
12712
+ match: function (n) { return slate.Element.isElement(n) && getIndentTypes(editor).includes(n.type); }
12609
12713
  }));
12610
12714
  var _a = __read(nodes, 1), startBlock = _a[0];
12611
12715
  if (startBlock) {
@@ -12613,7 +12717,7 @@
12613
12717
  indent = indent === 1 ? null : (indent -= 1);
12614
12718
  slate.Transforms.setNodes(editor, { indent: indent }, {
12615
12719
  mode: 'highest',
12616
- match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
12720
+ match: function (n) { return slate.Element.isElement(n) && getIndentTypes(editor).includes(n.type); }
12617
12721
  });
12618
12722
  }
12619
12723
  },
@@ -12645,14 +12749,8 @@
12645
12749
  },
12646
12750
  isDisabled: function (editor) {
12647
12751
  if (editor.selection) {
12648
- var allowGroup = __spreadArray([
12649
- exports.ElementKinds.paragraph,
12650
- exports.ElementKinds.numberedList,
12651
- exports.ElementKinds.bulletedList,
12652
- exports.ElementKinds.checkItem
12653
- ], __read(HEADING_TYPES));
12654
12752
  var anchorBlock$1 = anchorBlock(editor);
12655
- return anchorBlock$1 && !allowGroup.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
12753
+ return anchorBlock$1 && !getIndentTypes(editor).includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
12656
12754
  }
12657
12755
  return false;
12658
12756
  }
@@ -12682,67 +12780,6 @@
12682
12780
  }
12683
12781
  ];
12684
12782
 
12685
- var onKeydownTextIndent = function (editor, event, kinds) {
12686
- var selection = editor.selection;
12687
- var isExpanded = slate.Range.isExpanded(selection);
12688
- var nodes = Array.from(slate.Editor.nodes(editor, {
12689
- mode: 'highest',
12690
- match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
12691
- }));
12692
- var _a = __read(nodes, 1), startBlock = _a[0];
12693
- if (!startBlock) {
12694
- return false;
12695
- }
12696
- var _b = __read(startBlock, 2), block = _b[0], path = _b[1];
12697
- var isStart = slate.Editor.isStart(editor, selection.anchor, path);
12698
- var textIndentDisable = [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList, exports.ElementKinds.checkItem];
12699
- if (isHotkey.isKeyHotkey('Tab', event)) {
12700
- event.preventDefault();
12701
- if (startBlock && (isExpanded || isStart)) {
12702
- if (!editor.isVoid(block)) {
12703
- var textIndent = block.textIndent, type = block.type;
12704
- // do not apply first-line indentation for lists
12705
- if (!textIndent && !textIndentDisable.includes(type)) {
12706
- IndentEditor.setTextIndent(editor, kinds, 2);
12707
- return true;
12708
- }
12709
- else {
12710
- IndentEditor.setIndent(editor);
12711
- return true;
12712
- }
12713
- }
12714
- }
12715
- else {
12716
- editor.insertText(TAB_SPACE);
12717
- return true;
12718
- }
12719
- }
12720
- if (isHotkey.isKeyHotkey('shift+Tab', event)) {
12721
- if (startBlock && (isExpanded || isStart)) {
12722
- if (!editor.isVoid(block)) {
12723
- return IndentEditor.cancelTextIntent(editor, event, block, kinds);
12724
- }
12725
- }
12726
- }
12727
- if (selection && slate.Range.isCollapsed(selection) && i1.hotkeys.isDeleteBackward(event)) {
12728
- if (startBlock && isStart) {
12729
- return IndentEditor.cancelTextIntent(editor, event, block, kinds);
12730
- }
12731
- }
12732
- return false;
12733
- };
12734
-
12735
- var withIndent = function (kinds) { return function (editor) {
12736
- var onKeydown = editor.onKeydown;
12737
- editor.onKeydown = function (event) {
12738
- var isContinue = !onKeydownTextIndent(editor, event, kinds);
12739
- if (isContinue) {
12740
- onKeydown(event);
12741
- }
12742
- };
12743
- return editor;
12744
- }; };
12745
-
12746
12783
  var internalPlugins = [
12747
12784
  withTheHistory,
12748
12785
  withAutoInsertData(),
@@ -13417,7 +13454,11 @@
13417
13454
  TheQuickInsertComponent.prototype.handleClick = function (event) {
13418
13455
  event.stopPropagation();
13419
13456
  event.preventDefault();
13420
- QuickInsertEditor.openQuickToolbar(this.editor, this.quickToolbarItems, this.iconElement.nativeElement);
13457
+ if (QuickInsertEditor.isOpenedToolbar(this.editor)) {
13458
+ QuickInsertEditor.closeQuickInsertToolbar(this.editor);
13459
+ return;
13460
+ }
13461
+ QuickInsertEditor.openQuickInsertToolbar(this.editor, this.quickToolbarItems, this.iconElement.nativeElement);
13421
13462
  };
13422
13463
  return TheQuickInsertComponent;
13423
13464
  }());
@@ -13714,12 +13755,13 @@
13714
13755
  };
13715
13756
  TheEditorComponent.prototype.initialize = function () {
13716
13757
  var _this = this;
13717
- var _a, _b, _c;
13758
+ var _a, _b, _c, _d;
13718
13759
  this.editor = withTheEditor(this.thePlugins, slateHistory.withHistory(i1.withAngular(slate.createEditor(), CLIPBOARD_FORMAT_KEY)));
13719
13760
  this.generateDecorate();
13720
13761
  this.editor.disabled = (_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled;
13721
13762
  this.editor.extraElementOptions = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.extraElementOptions;
13722
13763
  this.editor.extraAutoFormatRules = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.extraAutoFormatRules;
13764
+ this.editor.extraIndentOptions = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.extraIndentOptions;
13723
13765
  setEditorUUID(this.editor, idCreator());
13724
13766
  this.theContextService.initialize({
13725
13767
  theOptions: this.theOptions,
@@ -14144,7 +14186,7 @@
14144
14186
  i3$1.ThyNavModule,
14145
14187
  i2$2.ThyFormModule,
14146
14188
  i5$2.ThySharedModule,
14147
- i2$3.ThyListModule,
14189
+ i1$7.ThyListModule,
14148
14190
  i5.ThyTooltipModule,
14149
14191
  i6.ThyProgressModule,
14150
14192
  autocomplete.ThyAutocompleteModule,
@@ -14245,7 +14287,7 @@
14245
14287
  i3$1.ThyNavModule,
14246
14288
  i2$2.ThyFormModule,
14247
14289
  i5$2.ThySharedModule,
14248
- i2$3.ThyListModule,
14290
+ i1$7.ThyListModule,
14249
14291
  i5.ThyTooltipModule,
14250
14292
  i6.ThyProgressModule,
14251
14293
  autocomplete.ThyAutocompleteModule,