@worktile/theia 2.3.0-next.0 → 2.3.0-next.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.
Files changed (36) hide show
  1. package/bundles/worktile-theia.umd.js +142 -477
  2. package/bundles/worktile-theia.umd.js.map +1 -1
  3. package/constants/default.d.ts +0 -2
  4. package/editor.component.d.ts +0 -2
  5. package/editor.module.d.ts +24 -26
  6. package/esm2015/constants/default.js +1 -2
  7. package/esm2015/editor.component.js +17 -14
  8. package/esm2015/editor.module.js +3 -6
  9. package/esm2015/interfaces/editor.js +1 -1
  10. package/esm2015/plugins/align/align.editor.js +6 -2
  11. package/esm2015/plugins/image/image.component.js +13 -8
  12. package/esm2015/utils/dom.js +2 -2
  13. package/esm2015/utils/index.js +3 -1
  14. package/fesm2015/worktile-theia.js +135 -468
  15. package/fesm2015/worktile-theia.js.map +1 -1
  16. package/interfaces/editor.d.ts +1 -6
  17. package/package.json +1 -1
  18. package/plugins/image/image.component.scss +0 -7
  19. package/plugins/table/components/table.component.scss +2 -2
  20. package/styles/editor.scss +160 -133
  21. package/styles/index.scss +1 -2
  22. package/styles/typo.scss +12 -1
  23. package/utils/index.d.ts +2 -0
  24. package/esm2015/plugins/dnd/component/dnd.component.js +0 -260
  25. package/esm2015/plugins/dnd/utils/get-current-target.js +0 -19
  26. package/esm2015/plugins/dnd/utils/get-hover-direction.js +0 -13
  27. package/esm2015/plugins/dnd/utils/is-valid-drag.js +0 -38
  28. package/esm2015/plugins/dnd/utils/move-drag-node.js +0 -30
  29. package/esm2015/plugins/dnd/utils/remove-drop-thumb-line.js +0 -10
  30. package/plugins/dnd/component/dnd.component.d.ts +0 -42
  31. package/plugins/dnd/component/dnd.component.scss +0 -61
  32. package/plugins/dnd/utils/get-current-target.d.ts +0 -2
  33. package/plugins/dnd/utils/get-hover-direction.d.ts +0 -3
  34. package/plugins/dnd/utils/is-valid-drag.d.ts +0 -3
  35. package/plugins/dnd/utils/move-drag-node.d.ts +0 -2
  36. package/plugins/dnd/utils/remove-drop-thumb-line.d.ts +0 -2
@@ -1,11 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Component, ChangeDetectionStrategy, HostBinding, Input, HostListener, ViewContainerRef, ChangeDetectorRef, Injectable, Inject, ViewChild, Directive, ElementRef, TemplateRef, EventEmitter, Output, Pipe, forwardRef, NgModule } from '@angular/core';
2
+ import { InjectionToken, Component, ChangeDetectionStrategy, HostBinding, Input, HostListener, ViewContainerRef, ChangeDetectorRef, Injectable, Inject, ViewChild, Directive, ElementRef, TemplateRef, Pipe, EventEmitter, forwardRef, Output, NgModule } from '@angular/core';
3
3
  import * as i10 from '@angular/common';
4
4
  import { DOCUMENT, CommonModule } from '@angular/common';
5
5
  import * as i4$1 from '@angular/forms';
6
6
  import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
7
7
  import * as i1 from 'slate-angular';
8
- import { BaseTextComponent, BaseElementComponent, AngularEditor, NODE_TO_PARENT, NODE_TO_INDEX, IS_SAFARI, hotkeys, getPlainText as getPlainText$1, hasBlockCard, isCardLeft, FAKE_RIGHT_BLOCK_CARD_OFFSET, ELEMENT_TO_COMPONENT, EDITOR_TO_ELEMENT, isComponentType, withAngular, SlateModule } from 'slate-angular';
8
+ import { BaseTextComponent, BaseElementComponent, AngularEditor, NODE_TO_PARENT, NODE_TO_INDEX, EDITOR_TO_ELEMENT, IS_SAFARI, hotkeys, getPlainText as getPlainText$1, hasBlockCard, isCardLeft, FAKE_RIGHT_BLOCK_CARD_OFFSET, ELEMENT_TO_COMPONENT, isComponentType, withAngular, SlateModule } from 'slate-angular';
9
9
  import { mixinUnsubscribe, MixinBase } from 'ngx-tethys/core';
10
10
  import isHotkey, { isKeyHotkey } from 'is-hotkey';
11
11
  import { Element as Element$1, Editor, Range, Node, Span, Path, Text, Point, Transforms, Operation, createEditor } from 'slate';
@@ -69,7 +69,6 @@ const CLIPBOARD_FORMAT_KEY = 'x-theia-fragment';
69
69
  const DEFAULT_SCROLL_CONTAINER = '.the-editable-container';
70
70
  const ELEMENT_UNIQUE_ID = 'key';
71
71
  const ZERO_WIDTH_CHAR = '\u200B';
72
- const DROP_THUMB_LINE = 'drop-thumb-line';
73
72
  var TheMode;
74
73
  (function (TheMode) {
75
74
  TheMode["fullMode"] = "full";
@@ -2152,6 +2151,108 @@ const isCleanEmptyParagraph = (editor) => {
2152
2151
  return false;
2153
2152
  };
2154
2153
 
2154
+ const mergeElementOptions = (elementOptions) => {
2155
+ elementOptions = elementOptions.filter(item => item.inValidChildrenTypes.length > 0);
2156
+ const combinationData = [...DefaultElementOptions, ...elementOptions];
2157
+ const dataInfo = {};
2158
+ combinationData.forEach(item => {
2159
+ const { type, inValidChildrenTypes, isIndivisible, isSecondaryContainer } = item;
2160
+ if (!dataInfo[type]) {
2161
+ dataInfo[type] = {
2162
+ type,
2163
+ inValidChildrenTypes,
2164
+ isIndivisible,
2165
+ isSecondaryContainer
2166
+ };
2167
+ }
2168
+ dataInfo[type].inValidChildrenTypes = Array.from(new Set([...inValidChildrenTypes, ...dataInfo[type].inValidChildrenTypes]));
2169
+ });
2170
+ return dataInfo;
2171
+ };
2172
+
2173
+ /** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
2174
+ function coercePixelsFromCssValue(cssValue) {
2175
+ const match = cssValue.match(/(\d+(\.\d+)?)px/);
2176
+ if (match) {
2177
+ return Number(match[1]);
2178
+ }
2179
+ }
2180
+ function getElementWidth(element) {
2181
+ // Optimization: Check style.width first as we probably set it already before reading
2182
+ // offsetWidth which triggers layout.
2183
+ return coercePixelsFromCssValue(element.style.width) || element.offsetWidth;
2184
+ }
2185
+ function getElementHeight(element) {
2186
+ return Math.round(element.getBoundingClientRect().height);
2187
+ }
2188
+ function getColsTotalWidth(cols) {
2189
+ return cols.reduce((total, col) => {
2190
+ return total + getElementWidth(col);
2191
+ }, 0);
2192
+ }
2193
+ function getRowsTotalHeight(rows) {
2194
+ return rows.reduce((total, row) => {
2195
+ return total + getElementHeight(row);
2196
+ }, 0);
2197
+ }
2198
+ function useElementStyle(el, element) {
2199
+ if (element.align) {
2200
+ el.style.textAlign = element.align || Alignment.left;
2201
+ }
2202
+ if (element.textIndent) {
2203
+ el.style.textIndent = element.textIndent + 'em';
2204
+ }
2205
+ if (element.verticalAlign) {
2206
+ el.style.verticalAlign = element.verticalAlign;
2207
+ }
2208
+ }
2209
+ function getElementClassByPrefix(el, prefix) {
2210
+ let matchClass = null;
2211
+ el.classList.forEach((value, key) => {
2212
+ if (value.includes(prefix)) {
2213
+ matchClass = value;
2214
+ }
2215
+ });
2216
+ return matchClass;
2217
+ }
2218
+ function findRelativeElementByPoint(editor, x, y, mode) {
2219
+ const editableElement = EDITOR_TO_ELEMENT.get(editor);
2220
+ const rectEditable = editableElement.getBoundingClientRect();
2221
+ if (x > rectEditable.x && x < rectEditable.x + rectEditable.width) {
2222
+ const centerX = rectEditable.x + rectEditable.width / 2;
2223
+ let relativeElement = document.elementFromPoint(mode === 'highest' ? centerX : x, y);
2224
+ return relativeElement;
2225
+ }
2226
+ return null;
2227
+ }
2228
+ function findNodeEntryByPoint(editor, x, y, mode) {
2229
+ const editableElement = EDITOR_TO_ELEMENT.get(editor);
2230
+ let rootElement = null;
2231
+ let relativeElement = findRelativeElementByPoint(editor, x, y, mode);
2232
+ // 获取最顶层的DOM
2233
+ if (mode === 'highest') {
2234
+ while (relativeElement && editableElement.contains(relativeElement)) {
2235
+ relativeElement = relativeElement.closest('[data-slate-node="element"]');
2236
+ if (relativeElement) {
2237
+ rootElement = relativeElement;
2238
+ relativeElement = relativeElement.parentElement;
2239
+ }
2240
+ }
2241
+ }
2242
+ if (!mode) {
2243
+ if (relativeElement && editableElement.contains(relativeElement)) {
2244
+ relativeElement = relativeElement.closest('[data-slate-node="element"]');
2245
+ rootElement = relativeElement;
2246
+ }
2247
+ }
2248
+ if (rootElement) {
2249
+ const node = AngularEditor.toSlateNode(editor, rootElement);
2250
+ const path = AngularEditor.findPath(editor, node);
2251
+ return [node, path];
2252
+ }
2253
+ return null;
2254
+ }
2255
+
2155
2256
  const withDeserializeMd = (options) => (editor) => {
2156
2257
  const { insertData, onKeydown } = editor;
2157
2258
  editor.onKeydown = (event) => {
@@ -2256,25 +2357,6 @@ const isMarkdownStynx = content => {
2256
2357
  return regexps.some(regexp => regexp.test(content));
2257
2358
  };
2258
2359
 
2259
- const mergeElementOptions = (elementOptions) => {
2260
- elementOptions = elementOptions.filter(item => item.inValidChildrenTypes.length > 0);
2261
- const combinationData = [...DefaultElementOptions, ...elementOptions];
2262
- const dataInfo = {};
2263
- combinationData.forEach(item => {
2264
- const { type, inValidChildrenTypes, isIndivisible, isSecondaryContainer } = item;
2265
- if (!dataInfo[type]) {
2266
- dataInfo[type] = {
2267
- type,
2268
- inValidChildrenTypes,
2269
- isIndivisible,
2270
- isSecondaryContainer
2271
- };
2272
- }
2273
- dataInfo[type].inValidChildrenTypes = Array.from(new Set([...inValidChildrenTypes, ...dataInfo[type].inValidChildrenTypes]));
2274
- });
2275
- return dataInfo;
2276
- };
2277
-
2278
2360
  const withAutoInsertData = (validChildren) => (editor) => {
2279
2361
  const { insertData } = editor;
2280
2362
  let allElementOptions = DefaultElementOptions;
@@ -2606,13 +2688,13 @@ class TheImageComponent extends TheBaseElementComponent {
2606
2688
  {
2607
2689
  key: LayoutTypes.wrapLeft,
2608
2690
  icon: 'wrap-left',
2609
- name: '隐藏左边',
2691
+ name: '图片居左',
2610
2692
  handle: (e, key) => this.setImageNode(e, { layout: key })
2611
2693
  },
2612
2694
  {
2613
2695
  key: LayoutTypes.wrapRight,
2614
2696
  icon: 'wrap-right',
2615
- name: '隐藏右边',
2697
+ name: '图片居右',
2616
2698
  handle: (e, key) => this.setImageNode(e, { layout: key })
2617
2699
  },
2618
2700
  {
@@ -2808,7 +2890,8 @@ class TheImageComponent extends TheBaseElementComponent {
2808
2890
  $event.stopPropagation();
2809
2891
  }
2810
2892
  isShouldOpen() {
2811
- return !(this === null || this === void 0 ? void 0 : this.readonly) && (this === null || this === void 0 ? void 0 : this.isCollapsed) && !this.uploading && !this.isOpen;
2893
+ const { theOptions: { richMedia } } = this.theContextService.getOptions();
2894
+ return !(this === null || this === void 0 ? void 0 : this.readonly) && richMedia && (this === null || this === void 0 ? void 0 : this.isCollapsed) && !this.uploading && !this.isOpen;
2812
2895
  }
2813
2896
  isShouldClose() {
2814
2897
  return this.isOpen && ((this === null || this === void 0 ? void 0 : this.readonly) || !(this === null || this === void 0 ? void 0 : this.isCollapsed) || this.uploading);
@@ -2817,16 +2900,20 @@ class TheImageComponent extends TheBaseElementComponent {
2817
2900
  var _a;
2818
2901
  this.layoutToolbarRef = this.thyPopover.open(this.layoutToolbar, {
2819
2902
  origin: this.imageContent,
2820
- panelClass: ['the-image-toolbar'],
2903
+ panelClass: ['the-block-toolbar'],
2821
2904
  placement: 'bottom',
2822
2905
  insideClosable: false,
2823
2906
  backdropClosable: true,
2824
2907
  hasBackdrop: false,
2825
- offset: 60,
2908
+ offset: 10,
2826
2909
  viewContainerRef: this.viewContainerRef,
2827
2910
  scrollStrategy: this.overlay.scrollStrategies.reposition()
2828
2911
  });
2829
2912
  (_a = this.layoutToolbarRef) === null || _a === void 0 ? void 0 : _a.getOverlayRef().updatePositionStrategy(this.createPositionStrategy());
2913
+ setTimeout(() => {
2914
+ var _a;
2915
+ (_a = this.layoutToolbarRef) === null || _a === void 0 ? void 0 : _a.getOverlayRef().updatePosition();
2916
+ }, 150);
2830
2917
  }
2831
2918
  closeLayoutToolbar() {
2832
2919
  var _a;
@@ -2867,7 +2954,7 @@ class TheImageComponent extends TheBaseElementComponent {
2867
2954
  overlayX: 'center',
2868
2955
  overlayY: 'top',
2869
2956
  offsetX: 0,
2870
- offsetY: 60
2957
+ offsetY: 10
2871
2958
  };
2872
2959
  return this.overlay
2873
2960
  .position()
@@ -2879,7 +2966,7 @@ class TheImageComponent extends TheBaseElementComponent {
2879
2966
  }
2880
2967
  }
2881
2968
  TheImageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheImageComponent, deps: [{ token: i0.ElementRef }, { token: i1$2.DomSanitizer }, { token: THE_UPLOAD_SERVICE_TOKEN }, { token: i0.ChangeDetectorRef }, { token: TheContextService }, { token: i1$3.ThyPopover }, { token: i2.Overlay }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
2882
- TheImageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheImageComponent, selector: "the-image, [theImage]", viewQueries: [{ propertyName: "imageContent", first: true, predicate: ["imageContent"], descendants: true }, { propertyName: "img", first: true, predicate: ["img"], descendants: true }, { propertyName: "layoutToolbar", first: true, predicate: ["layoutToolbar"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n\n<div class=\"image-container\" contenteditable=\"false\" [style.textAlign]=\"imageEntry.align\">\n <div\n #imageContent\n *ngIf=\"imageEntry.thumbUrl\"\n class=\"image-content\"\n [class.pointer]=\"!selection\"\n [ngStyle]=\"{\n 'width.px':\n imageEntry?.layout && imageEntry?.width > layoutDefaultWidth && !imageEntry?.reSized\n ? layoutDefaultWidth\n : imageEntry.width,\n 'height.px': imageEntry.height\n }\"\n >\n <img #img class=\"main-image\" [src]=\"imageEntry.thumbUrl\" [alt]=\"imageEntry.name\" />\n <div *ngIf=\"selection\" class=\"image-profile\" [class.outline]=\"selection\">\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right bottom\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left bottom\"></span>\n </div>\n <div *ngIf=\"uploading\" class=\"uploading\">\n <div class=\"uploading-percentage\">\n <thy-progress thyType=\"primary\" [thyValue]=\"percentage\" thySize=\"sm\"></thy-progress>\n <thy-icon (click)=\"cancelUpload($event)\" thyIconName=\"close-circle-bold-fill\" thyIconLegging=\"true\"></thy-icon>\n </div>\n </div>\n <div *ngIf=\"!uploading\" class=\"layer\" (mousedown)=\"preview($event)\" [class.readonly]=\"readonly\"></div>\n </div>\n <div *ngIf=\"!imageEntry.thumbUrl\" class=\"image-loading\" contenteditable=\"false\">\n <thy-icon thyIconName=\"image\"></thy-icon>\n </div>\n</div>\n\n<ng-template #layoutToolbar>\n <div class=\"the-block-operate\" contenteditable=\"false\">\n <thy-icon-nav>\n <ng-container *ngFor=\"let item of layoutOptions\">\n <a\n *ngIf=\"item.key !== 'split'\"\n href=\"javascript:;\"\n thyIconNavLink\n [ngClass]=\"{ 'remove-link': item.key === 'remove' }\"\n [thyIconNavLinkIcon]=\"item.icon\"\n [thyTooltip]=\"item.name\"\n [thyIconNavLinkActive]=\"layoutActive(item.key)\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"item?.handle($event, item.key)\"\n ></a>\n <nav-split-line *ngIf=\"item.key === 'split'\"></nav-split-line>\n </ng-container>\n </thy-icon-nav>\n </div>\n</ng-template>\n", components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i6.ThyProgressComponent, selector: "thy-progress", inputs: ["thyType", "thySize", "thyValue", "thyMax", "thyTips"] }, { type: i4.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i3.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }], directives: [{ type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
2969
+ TheImageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheImageComponent, selector: "the-image, [theImage]", viewQueries: [{ propertyName: "imageContent", first: true, predicate: ["imageContent"], descendants: true }, { propertyName: "img", first: true, predicate: ["img"], descendants: true }, { propertyName: "layoutToolbar", first: true, predicate: ["layoutToolbar"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n\n<div class=\"image-container\" contenteditable=\"false\" [style.textAlign]=\"imageEntry.align\">\n <div\n #imageContent\n *ngIf=\"imageEntry.thumbUrl\"\n class=\"image-content\"\n [class.pointer]=\"!selection\"\n [ngStyle]=\"{\n 'width.px':\n imageEntry?.layout && imageEntry?.width > layoutDefaultWidth && !imageEntry?.reSized\n ? layoutDefaultWidth\n : imageEntry.width,\n 'height.px': imageEntry.height\n }\"\n >\n <img #img class=\"main-image\" [src]=\"imageEntry.thumbUrl\" [alt]=\"imageEntry.name\" />\n <div *ngIf=\"selection\" class=\"image-profile\" [class.outline]=\"selection\">\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right bottom\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left bottom\"></span>\n </div>\n <div *ngIf=\"uploading\" class=\"uploading\">\n <div class=\"uploading-percentage\">\n <thy-progress thyType=\"primary\" [thyValue]=\"percentage\" thySize=\"sm\"></thy-progress>\n <thy-icon (click)=\"cancelUpload($event)\" thyIconName=\"close-circle-bold-fill\" thyIconLegging=\"true\"></thy-icon>\n </div>\n </div>\n <div *ngIf=\"!uploading\" class=\"layer\" (mousedown)=\"preview($event)\" [class.readonly]=\"readonly\"></div>\n </div>\n <div *ngIf=\"!imageEntry.thumbUrl\" class=\"image-loading\" contenteditable=\"false\">\n <thy-icon thyIconName=\"image\"></thy-icon>\n </div>\n</div>\n\n<ng-template #layoutToolbar>\n <div class=\"the-block-toolbar-popover\" contenteditable=\"false\">\n <thy-icon-nav>\n <ng-container *ngFor=\"let item of layoutOptions\">\n <a\n *ngIf=\"item.key !== 'split'\"\n href=\"javascript:;\"\n thyIconNavLink\n [ngClass]=\"{ 'remove-link': item.key === 'remove' }\"\n [thyIconNavLinkIcon]=\"item.icon\"\n [thyTooltip]=\"item.name\"\n [thyIconNavLinkActive]=\"layoutActive(item.key)\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"item?.handle($event, item.key)\"\n ></a>\n <nav-split-line *ngIf=\"item.key === 'split'\"></nav-split-line>\n </ng-container>\n </thy-icon-nav>\n </div>\n</ng-template>\n", components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i6.ThyProgressComponent, selector: "thy-progress", inputs: ["thyType", "thySize", "thyValue", "thyMax", "thyTips"] }, { type: i4.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i3.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }], directives: [{ type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
2883
2970
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheImageComponent, decorators: [{
2884
2971
  type: Component,
2885
2972
  args: [{
@@ -5842,7 +5929,10 @@ const AlignEditor = {
5842
5929
  return false;
5843
5930
  },
5844
5931
  isDisabled(editor) {
5845
- if (editor.selection) {
5932
+ var _a;
5933
+ const contextService = (_a = editor === null || editor === void 0 ? void 0 : editor.injector) === null || _a === void 0 ? void 0 : _a.get(TheContextService);
5934
+ const { theOptions: { richMedia } } = contextService.getOptions();
5935
+ if (richMedia && editor.selection) {
5846
5936
  const disableGroup = [ElementKinds.image];
5847
5937
  const anchorBlock$1 = anchorBlock(editor);
5848
5938
  return anchorBlock$1 && disableGroup.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
@@ -8070,89 +8160,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
8070
8160
  type: Injectable
8071
8161
  }], ctorParameters: function () { return []; } });
8072
8162
 
8073
- /** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
8074
- function coercePixelsFromCssValue(cssValue) {
8075
- const match = cssValue.match(/(\d+)px/);
8076
- if (match) {
8077
- return Number(match[1]);
8078
- }
8079
- }
8080
- function getElementWidth(element) {
8081
- // Optimization: Check style.width first as we probably set it already before reading
8082
- // offsetWidth which triggers layout.
8083
- return coercePixelsFromCssValue(element.style.width) || element.offsetWidth;
8084
- }
8085
- function getElementHeight(element) {
8086
- return Math.round(element.getBoundingClientRect().height);
8087
- }
8088
- function getColsTotalWidth(cols) {
8089
- return cols.reduce((total, col) => {
8090
- return total + getElementWidth(col);
8091
- }, 0);
8092
- }
8093
- function getRowsTotalHeight(rows) {
8094
- return rows.reduce((total, row) => {
8095
- return total + getElementHeight(row);
8096
- }, 0);
8097
- }
8098
- function useElementStyle(el, element) {
8099
- if (element.align) {
8100
- el.style.textAlign = element.align || Alignment.left;
8101
- }
8102
- if (element.textIndent) {
8103
- el.style.textIndent = element.textIndent + 'em';
8104
- }
8105
- if (element.verticalAlign) {
8106
- el.style.verticalAlign = element.verticalAlign;
8107
- }
8108
- }
8109
- function getElementClassByPrefix(el, prefix) {
8110
- let matchClass = null;
8111
- el.classList.forEach((value, key) => {
8112
- if (value.includes(prefix)) {
8113
- matchClass = value;
8114
- }
8115
- });
8116
- return matchClass;
8117
- }
8118
- function findRelativeElementByPoint(editor, x, y, mode) {
8119
- const editableElement = EDITOR_TO_ELEMENT.get(editor);
8120
- const rectEditable = editableElement.getBoundingClientRect();
8121
- if (x > rectEditable.x && x < rectEditable.x + rectEditable.width) {
8122
- const centerX = rectEditable.x + rectEditable.width / 2;
8123
- let relativeElement = document.elementFromPoint(mode === 'highest' ? centerX : x, y);
8124
- return relativeElement;
8125
- }
8126
- return null;
8127
- }
8128
- function findNodeEntryByPoint(editor, x, y, mode) {
8129
- const editableElement = EDITOR_TO_ELEMENT.get(editor);
8130
- let rootElement = null;
8131
- let relativeElement = findRelativeElementByPoint(editor, x, y, mode);
8132
- // 获取最顶层的DOM
8133
- if (mode === 'highest') {
8134
- while (relativeElement && editableElement.contains(relativeElement)) {
8135
- relativeElement = relativeElement.closest('[data-slate-node="element"]');
8136
- if (relativeElement) {
8137
- rootElement = relativeElement;
8138
- relativeElement = relativeElement.parentElement;
8139
- }
8140
- }
8141
- }
8142
- if (!mode) {
8143
- if (relativeElement && editableElement.contains(relativeElement)) {
8144
- relativeElement = relativeElement.closest('[data-slate-node="element"]');
8145
- rootElement = relativeElement;
8146
- }
8147
- }
8148
- if (rootElement) {
8149
- const node = AngularEditor.toSlateNode(editor, rootElement);
8150
- const path = AngularEditor.findPath(editor, node);
8151
- return [node, path];
8152
- }
8153
- return null;
8154
- }
8155
-
8156
8163
  function splitCell(editor) {
8157
8164
  const opts = new TableOptions$1();
8158
8165
  const { anchor } = editor.selection;
@@ -12405,347 +12412,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
12405
12412
  args: ['mousedown', ['$event']]
12406
12413
  }] } });
12407
12414
 
12408
- const getCurrentTarget = (editor, event) => {
12409
- const editorElement = EDITOR_TO_ELEMENT.get(editor);
12410
- const { left, right } = editorElement.getBoundingClientRect();
12411
- let { paddingLeft, paddingRight } = window.getComputedStyle(editorElement, null);
12412
- const paddingLeftPixels = coercePixelsFromCssValue(paddingLeft);
12413
- const paddingRightPixels = coercePixelsFromCssValue(paddingRight);
12414
- let x = event.x;
12415
- if (event.x <= left + paddingLeftPixels || event.x >= right - paddingRightPixels) {
12416
- x = left + paddingLeftPixels;
12417
- }
12418
- const nodeEntry = findNodeEntryByPoint(editor, x, event.y);
12419
- if (nodeEntry) {
12420
- return TheEditor.toDOMNode(editor, nodeEntry[0]);
12421
- }
12422
- };
12423
-
12424
- const getHoverDirection = (editor, event) => {
12425
- const rootNode = getCurrentTarget(editor, event);
12426
- if (rootNode) {
12427
- const { top, bottom } = rootNode.getBoundingClientRect();
12428
- const middleHeight = (bottom - top) / 2;
12429
- if (top + middleHeight > event.clientY) {
12430
- return 'top';
12431
- }
12432
- return 'bottom';
12433
- }
12434
- };
12435
-
12436
- const removeDropThumbLine = (editor) => {
12437
- const element = EDITOR_TO_ELEMENT.get(editor);
12438
- const dropThumbLine = element.querySelector('.' + DROP_THUMB_LINE);
12439
- if (dropThumbLine) {
12440
- dropThumbLine.remove();
12441
- }
12442
- };
12443
-
12444
- const moveDragNode = (editor, dragNode, event) => {
12445
- event.stopPropagation();
12446
- const element = EDITOR_TO_ELEMENT.get(editor);
12447
- const dropThumbLine = element.querySelector('.' + DROP_THUMB_LINE);
12448
- const parentElement = dropThumbLine && dropThumbLine.parentNode;
12449
- if (parentElement) {
12450
- const node = TheEditor.toSlateNode(editor, parentElement);
12451
- let dropPath = node && TheEditor.findPath(editor, node);
12452
- if (dropPath.length) {
12453
- const dragPath = dragNode.path;
12454
- const before = Path.isBefore(dragPath, dropPath) && Path.isSibling(dragPath, dropPath);
12455
- dropPath = before ? dropPath : Path.next(dropPath);
12456
- if (dropPath.length) {
12457
- Editor.withoutNormalizing(editor, () => {
12458
- Transforms.moveNodes(editor, {
12459
- at: dragPath,
12460
- to: dropPath
12461
- });
12462
- });
12463
- }
12464
- }
12465
- }
12466
- removeDropThumbLine(editor);
12467
- };
12468
-
12469
- const isValidDrag = (editor, dragNode, currentTarget) => {
12470
- var _a;
12471
- const node = TheEditor.toSlateNode(editor, currentTarget);
12472
- const dropPath = TheEditor.findPath(editor, node);
12473
- const dragPath = TheEditor.findPath(editor, dragNode);
12474
- if (dragPath[0] === dropPath[0] && dropPath.length > 1) {
12475
- // 阻止list元素拖入自身
12476
- return false;
12477
- }
12478
- let allElementOptions = DefaultElementOptions;
12479
- if ((_a = editor.extraElementOptions) === null || _a === void 0 ? void 0 : _a.length) {
12480
- const extraInfo = mergeElementOptions(editor.extraElementOptions);
12481
- allElementOptions = Object.values(extraInfo);
12482
- }
12483
- const types = allElementOptions.map(item => item.type);
12484
- if (types.indexOf(node.type) > -1 && allElementOptions[types.indexOf(node.type)].isSecondaryContainer) {
12485
- // 阻止向table-celld等二级容器中拖入
12486
- return false;
12487
- }
12488
- let containerParent = Editor.above(editor, {
12489
- at: dropPath,
12490
- mode: 'lowest',
12491
- match: (node) => {
12492
- return node && node.type && types.includes(node.type);
12493
- }
12494
- });
12495
- if (containerParent) {
12496
- const { inValidChildrenTypes } = allElementOptions.find(item => item.type === containerParent[0].type);
12497
- if (inValidChildrenTypes.includes(dragNode.type)) {
12498
- return false;
12499
- }
12500
- }
12501
- return true;
12502
- };
12503
-
12504
- const SNAPSHOT_PADDING_WIDTH = 5;
12505
- const SNAPSHOT_LIMI_HEIGHT = 70;
12506
- const DRAG_ICON_SIZE = 24;
12507
- const DRAG_ICON_OFFSET = 5;
12508
- class TheDndComponent {
12509
- constructor(renderer, elementRef, ngZone, cdr) {
12510
- this.renderer = renderer;
12511
- this.elementRef = elementRef;
12512
- this.ngZone = ngZone;
12513
- this.cdr = cdr;
12514
- this.isDraging = false;
12515
- this.destroy$ = new Subject();
12516
- this.dragChange = new EventEmitter();
12517
- this.dropThumbLine = document.createElement('div');
12518
- this.dropThumbLine.className = DROP_THUMB_LINE;
12519
- }
12520
- get nativeElement() {
12521
- return this.elementRef.nativeElement;
12522
- }
12523
- get editableElement() {
12524
- return this.editor && EDITOR_TO_ELEMENT.get(this.editor);
12525
- }
12526
- ngAfterViewInit() {
12527
- const contextService = this.editor.injector.get(TheContextService);
12528
- this.ngZone.runOutsideAngular(() => {
12529
- merge(fromEvent(this.editableElement, `mousemove`), fromEvent(this.editableElement, `mouseleave`))
12530
- .pipe(takeUntil(this.destroy$), filter(() => {
12531
- return !contextService.getOptions().theOptions.readonly && contextService.getOptions().theOptions.dragAndDrop;
12532
- }))
12533
- .subscribe(e => this.setDragIcon(e));
12534
- fromEvent(document, `drop`)
12535
- .pipe(takeUntil(this.destroy$), filter(() => {
12536
- return !contextService.getOptions().theOptions.readonly && contextService.getOptions().theOptions.dragAndDrop;
12537
- }))
12538
- .subscribe(e => this.onDrop(e));
12539
- fromEvent(document, `dragover`)
12540
- .pipe(takeUntil(this.destroy$), filter(() => {
12541
- return !contextService.getOptions().theOptions.readonly && contextService.getOptions().theOptions.dragAndDrop;
12542
- }))
12543
- .subscribe(e => this.onDragover(e));
12544
- fromEvent(document, `scroll`)
12545
- .pipe(takeUntil(this.destroy$), filter(() => {
12546
- return !contextService.getOptions().theOptions.readonly && contextService.getOptions().theOptions.dragAndDrop;
12547
- }))
12548
- .subscribe(e => {
12549
- e.preventDefault();
12550
- let scrollPosition = window.scrollY;
12551
- if (!this.isScrolling && this.isDraging) {
12552
- window.requestAnimationFrame(() => {
12553
- if (this.editableTop) {
12554
- // 滚动过程中,通过设置父级元素来设置snapshot位置
12555
- this.updateDndContainerPosition(null, scrollPosition + this.editableTop + 'px');
12556
- }
12557
- this.isScrolling = false;
12558
- });
12559
- this.isScrolling = true;
12560
- }
12561
- });
12562
- });
12563
- this.setVisibility(false);
12564
- this.valueChangeHandle();
12565
- }
12566
- valueChangeHandle() {
12567
- const { onChange } = this.editor;
12568
- this.editor.onChange = () => {
12569
- const ops = this.editor.operations;
12570
- const skip = ops.length === 1 && Operation.isSelectionOperation(ops[0]);
12571
- if (!skip) {
12572
- this.setVisibility(false);
12573
- }
12574
- onChange();
12575
- };
12576
- }
12577
- updateDndContainerPosition(left, top) {
12578
- const element = this.elementRef.nativeElement;
12579
- const parentElement = element.parentElement;
12580
- top && this.renderer.setStyle(parentElement, 'top', top);
12581
- left && this.renderer.setStyle(parentElement, 'left', left);
12582
- }
12583
- getEditableTop(event) {
12584
- const offsetHeight = document.documentElement.offsetHeight;
12585
- const { height } = this.editableElement.getBoundingClientRect();
12586
- if (event.clientY < this.dragElementHeight) {
12587
- this.editableTop = -this.editableElement.offsetTop;
12588
- return;
12589
- }
12590
- if (height > event.pageY && event.clientY + this.dragElementHeight >= offsetHeight) {
12591
- this.editableTop = event.clientY - this.editableElement.offsetTop;
12592
- return;
12593
- }
12594
- this.editableTop = null;
12595
- }
12596
- onDragStart(event) {
12597
- this.isDraging = true;
12598
- this.dragChange.emit(this.isDraging);
12599
- this.dragSnapshotContent = document.querySelector('.drag-snapshot-container');
12600
- this.dragSnapshotContent.className = 'the-editor-typo drag-snapshot-container';
12601
- this.dragSnapshotContent.appendChild(this.dragElement.cloneNode(true));
12602
- this.dragElement.style.opacity = '0.3';
12603
- }
12604
- onDragEnd(event) {
12605
- this.dragElement.style.opacity = '';
12606
- this.isDraging = false;
12607
- this.setVisibility(false);
12608
- this.resetDragSnapshotContent();
12609
- this.dragChange.emit(this.isDraging);
12610
- }
12611
- onDrop(event) {
12612
- event.preventDefault();
12613
- if (this.isDraging) {
12614
- moveDragNode(this.editor, this.dragNode, event);
12615
- }
12616
- }
12617
- onDragover(event) {
12618
- event.preventDefault();
12619
- if (this.isDraging && !this.isScrolling) {
12620
- this.getEditableTop(event);
12621
- const offsetWidth = document.documentElement.offsetWidth;
12622
- const { left: editorLeft, top: editorTop, height } = this.editableElement.getBoundingClientRect();
12623
- let top = 0;
12624
- let left = 0;
12625
- if (editorLeft > 0) {
12626
- if (event.clientX + this.dragElementWidth / 2 > offsetWidth) {
12627
- left = event.pageX - editorLeft - this.elementRef.nativeElement.offsetWidth;
12628
- }
12629
- else {
12630
- left = Math.max(event.pageX - editorLeft, -editorLeft) + 10;
12631
- }
12632
- }
12633
- let paddingTop = 0; // paddingTop: 编辑器距离顶部的距离
12634
- if (editorTop >= 0) {
12635
- // 无滚动情况下
12636
- top = event.clientY - this.editableElement.offsetTop;
12637
- paddingTop = editorTop - this.editableElement.offsetTop;
12638
- }
12639
- else {
12640
- // 有滚动距离
12641
- top = Math.abs(editorTop) + event.clientY; // 滚动距离 + 鼠标clientY
12642
- paddingTop = event.pageY - this.editableElement.offsetTop - top;
12643
- // 防止底部出现滚动条
12644
- if (paddingTop < height - top) {
12645
- top = top + paddingTop;
12646
- }
12647
- }
12648
- this.updateDndContainerPosition(left + 'px', top + 'px');
12649
- this.setSnapshotStyle(event);
12650
- this.setDropThumbLine(event);
12651
- }
12652
- }
12653
- setDropThumbLine(event) {
12654
- var _a;
12655
- let element = getCurrentTarget(this.editor, event);
12656
- const direction = getHoverDirection(this.editor, event);
12657
- if (element) {
12658
- if (direction && direction === 'top') {
12659
- element = (_a = element.previousElementSibling) === null || _a === void 0 ? void 0 : _a.querySelector('[data-slate-node="element"]');
12660
- }
12661
- if (element && isValidDrag(this.editor, this.dragNode.node, element)) {
12662
- element.appendChild(this.dropThumbLine);
12663
- }
12664
- }
12665
- }
12666
- setDragIcon(event) {
12667
- if (!this.isDraging) {
12668
- const nodeEntry = findNodeEntryByPoint(this.editor, event.x, event.y, 'highest');
12669
- if (nodeEntry && !Editor.isEmpty(this.editor, nodeEntry[0])) {
12670
- const rootNode = AngularEditor.toDOMNode(this.editor, nodeEntry[0]);
12671
- this.dragNode = {
12672
- node: nodeEntry[0],
12673
- path: nodeEntry[1]
12674
- };
12675
- this.dragElement = rootNode;
12676
- let lineHeight = coercePixelsFromCssValue(window.getComputedStyle(rootNode)['lineHeight']);
12677
- const offsetTop = rootNode.offsetTop + rootNode.offsetParent.offsetTop + (lineHeight - DRAG_ICON_SIZE) / 2;
12678
- const offsetLeft = rootNode.offsetLeft + rootNode.offsetParent.offsetLeft;
12679
- this.updateDndContainerPosition(offsetLeft - DRAG_ICON_SIZE - DRAG_ICON_OFFSET + 'px', offsetTop + 'px');
12680
- this.setVisibility(true);
12681
- }
12682
- else {
12683
- this.setVisibility(false);
12684
- }
12685
- }
12686
- }
12687
- setSnapshotStyle(event) {
12688
- const { width, height } = this.dragElement.getBoundingClientRect();
12689
- this.dragElementHeight = height;
12690
- this.dragElementWidth = width;
12691
- let dragSnapshotContentStyle = `visibility: visible; width: ${width + SNAPSHOT_PADDING_WIDTH * 2}px;`;
12692
- if (height > SNAPSHOT_LIMI_HEIGHT) {
12693
- dragSnapshotContentStyle = dragSnapshotContentStyle + 'transform: scale(0.45);';
12694
- this.dragElementHeight = this.dragElementHeight * 0.45;
12695
- this.dragElementWidth = this.dragElementWidth * 0.45;
12696
- }
12697
- let snapshotTop = 0;
12698
- let snapshotLeft = 0;
12699
- // 上下移动:超出屏幕高度,重新设置snapshot的位置
12700
- if (event.clientY + this.dragElementHeight > document.documentElement.offsetHeight) {
12701
- snapshotTop = this.dragElementHeight;
12702
- }
12703
- else {
12704
- snapshotTop = 0;
12705
- }
12706
- // 左右移动:超出屏幕宽度,重新设置snapshot的位置
12707
- if (event.clientX + this.dragElementWidth / 2 > document.documentElement.offsetWidth) {
12708
- snapshotLeft = this.dragElementWidth;
12709
- }
12710
- else {
12711
- snapshotLeft = 0;
12712
- }
12713
- dragSnapshotContentStyle = dragSnapshotContentStyle + `top: ${-snapshotTop}px; left: ${-snapshotLeft}px;`;
12714
- this.dragSnapshotContent.setAttribute('style', dragSnapshotContentStyle);
12715
- }
12716
- resetDragSnapshotContent() {
12717
- this.dragSnapshotContent.className = 'drag-snapshot-container';
12718
- this.dragSnapshotContent.setAttribute('style', '');
12719
- this.dragSnapshotContent.innerHTML = '';
12720
- }
12721
- setVisibility(visible = true) {
12722
- this.nativeElement.parentNode.style.visibility = visible ? 'visible' : 'hidden';
12723
- }
12724
- ngOnDestroy() {
12725
- this.destroy$.next();
12726
- this.destroy$.complete();
12727
- }
12728
- }
12729
- TheDndComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheDndComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
12730
- TheDndComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheDndComponent, selector: "[theDnd]", inputs: { editor: "editor" }, outputs: { dragChange: "dragChange" }, host: { classAttribute: "the-drag-drop" }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true }], ngImport: i0, template: "<div\n draggable=\"true\"\n class=\"the-drag-drop-icon\"\n [ngStyle]=\"{ opacity: isDraging ? 0 : '' }\"\n (dragstart)=\"onDragStart($event)\"\n (dragend)=\"onDragEnd($event)\"\n>\n <thy-icon thyIconName=\"drag\"> </thy-icon>\n</div>\n", components: [{ type: i4.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
12731
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheDndComponent, decorators: [{
12732
- type: Component,
12733
- args: [{
12734
- selector: '[theDnd]',
12735
- templateUrl: './dnd.component.html',
12736
- host: {
12737
- class: 'the-drag-drop'
12738
- }
12739
- }]
12740
- }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { editor: [{
12741
- type: Input
12742
- }], dragChange: [{
12743
- type: Output
12744
- }], content: [{
12745
- type: ViewChild,
12746
- args: ['content', { static: false }]
12747
- }] } });
12748
-
12749
12415
  class ElementStylePipe {
12750
12416
  transform(element, align) {
12751
12417
  const style = {};
@@ -12950,16 +12616,10 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
12950
12616
  this.onSlaDragStart = (event) => { };
12951
12617
  this.onSlaDragOver = (event) => { };
12952
12618
  this.onDrop = (event) => {
12953
- if (this.isDraging) {
12954
- event.preventDefault();
12955
- }
12956
12619
  this.theOnDOMEvent.emit({
12957
12620
  nativeEvent: event
12958
12621
  });
12959
12622
  };
12960
- this.onDragChange = isDraging => {
12961
- this.isDraging = isDraging;
12962
- };
12963
12623
  }
12964
12624
  get theGlobalToolbarInstance() {
12965
12625
  return this.theGlobalToolbar ? this.theGlobalToolbar : this.globalToolbarInstance;
@@ -13133,8 +12793,17 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
13133
12793
  if (event.target === editableElement) {
13134
12794
  const rectEditable = editableElement.getBoundingClientRect();
13135
12795
  const centerX = rectEditable.x + rectEditable.width / 2;
13136
- const relativeElement = document.elementFromPoint(centerX, event.y);
13137
- const relativeBlockCardElement = relativeElement.closest('.slate-block-card');
12796
+ let { paddingLeft, paddingRight } = window.getComputedStyle(editableElement, null);
12797
+ const paddingLeftPixels = coercePixelsFromCssValue(paddingLeft);
12798
+ const paddingRightPixels = coercePixelsFromCssValue(paddingRight);
12799
+ const fakeLeftX = rectEditable.x + paddingLeftPixels + 50;
12800
+ const fakeRightX = rectEditable.right - paddingRightPixels - 50;
12801
+ let relativeElement = document.elementFromPoint(fakeLeftX, event.y);
12802
+ let relativeBlockCardElement = relativeElement.closest('.slate-block-card');
12803
+ if (!relativeBlockCardElement) {
12804
+ relativeElement = document.elementFromPoint(fakeRightX, event.y);
12805
+ relativeBlockCardElement = relativeElement.closest('.slate-block-card');
12806
+ }
13138
12807
  if (relativeBlockCardElement) {
13139
12808
  const blockCardEntry = AngularEditor.toSlateCardEntry(this.editor, relativeBlockCardElement.firstElementChild);
13140
12809
  if (blockCardEntry && blockCardEntry[1]) {
@@ -13201,7 +12870,7 @@ TheEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
13201
12870
  useExisting: forwardRef(() => TheEditorComponent),
13202
12871
  multi: true
13203
12872
  }
13204
- ], 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 }], 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 [placeholder]=\"theOptions?.placeholder\"\n [placeholderDecorate]=\"theOptions?.placeholderDecorate ? theOptions?.placeholderDecorate : null\"\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\n *ngIf=\"!theOptions?.readonly && theOptions?.inlineToobarVisible\"\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.inline\"\n ></the-inline-toolbar>\n <div\n #quickInsert\n theQuickInsert\n [editor]=\"editor\"\n [quickToolbarItems]=\"quickToolbarItems\"\n [isVisible]=\"theOptions?.quickInsertVisible\"\n ></div>\n <div class=\"drag-container\">\n <div #drag theDnd [editor]=\"editor\" (dragChange)=\"onDragChange($event)\"></div>\n <div class=\"drag-snapshot-container\"></div>\n </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", "isVisible"] }, { type: TheDndComponent, selector: "[theDnd]", inputs: ["editor"], outputs: ["dragChange"] }, { type: TheTemplateComponent, selector: "the-template,[theTemplate]" }], directives: [{ type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
12873
+ ], 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 }], 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 [placeholder]=\"theOptions?.placeholder\"\n [placeholderDecorate]=\"theOptions?.placeholderDecorate ? theOptions?.placeholderDecorate : null\"\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\n *ngIf=\"!theOptions?.readonly && theOptions?.inlineToobarVisible\"\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.inline\"\n ></the-inline-toolbar>\n <div\n #quickInsert\n theQuickInsert\n [editor]=\"editor\"\n [quickToolbarItems]=\"quickToolbarItems\"\n [isVisible]=\"theOptions?.quickInsertVisible\"\n ></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", "isVisible"] }, { type: TheTemplateComponent, selector: "the-template,[theTemplate]" }], directives: [{ type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
13205
12874
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheEditorComponent, decorators: [{
13206
12875
  type: Component,
13207
12876
  args: [{
@@ -13446,8 +13115,7 @@ const PLUGIN_COMPONENTS = [
13446
13115
  TheTableComponent,
13447
13116
  TheTableRowComponent,
13448
13117
  TheTdComponent,
13449
- TheInlineCodeComponent,
13450
- TheDndComponent
13118
+ TheInlineCodeComponent
13451
13119
  ];
13452
13120
  const PIPES = [ElementStylePipe, ElementClassPipe];
13453
13121
  class TheEditorModule {
@@ -13488,8 +13156,7 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
13488
13156
  TheTableComponent,
13489
13157
  TheTableRowComponent,
13490
13158
  TheTdComponent,
13491
- TheInlineCodeComponent,
13492
- TheDndComponent], imports: [CommonModule, SlateModule, FormsModule, ThyIconModule,
13159
+ TheInlineCodeComponent], imports: [CommonModule, SlateModule, FormsModule, ThyIconModule,
13493
13160
  ThyAvatarModule,
13494
13161
  ThyNavModule,
13495
13162
  ThyFormModule,
@@ -13538,5 +13205,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
13538
13205
  * Generated bundle index. Do not edit.
13539
13206
  */
13540
13207
 
13541
- 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, DROP_THUMB_LINE, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeadingEditor, HrEditor, IS_MAC, ImageEditor, Indents, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LayoutTypes, 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, isCleanEmptyParagraph, plainToTheia, toolbarCompose, withTheEditor };
13208
+ 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, Indents, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LayoutTypes, 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, coercePixelsFromCssValue, createEmptyParagraph, dataDeserialize, dataSerializing, findNodeEntryByPoint, findRelativeElementByPoint, getColsTotalWidth, getElementClassByPrefix, getElementHeight, getElementWidth, getRowsTotalHeight, getToolbarClass, htmlToTheia, inValidTypes, isCleanEmptyParagraph, mergeElementOptions, plainToTheia, toolbarCompose, useElementStyle, withTheEditor };
13542
13209
  //# sourceMappingURL=worktile-theia.js.map