@worktile/theia 2.3.0-next.1 → 2.3.0-next.2
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.
- package/bundles/worktile-theia.umd.js +124 -467
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/constants/default.d.ts +0 -1
- package/editor.component.d.ts +0 -2
- package/editor.module.d.ts +24 -26
- package/esm2015/constants/default.js +1 -2
- package/esm2015/editor.component.js +5 -12
- package/esm2015/editor.module.js +3 -6
- package/esm2015/interfaces/editor.js +1 -1
- package/esm2015/plugins/align/align.editor.js +6 -2
- package/esm2015/plugins/image/image.component.js +6 -5
- package/esm2015/utils/index.js +3 -1
- package/fesm2015/worktile-theia.js +117 -457
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/editor.d.ts +1 -6
- package/package.json +1 -1
- package/plugins/image/image.component.scss +5 -2
- package/plugins/table/components/table.component.scss +2 -2
- package/styles/editor.scss +7 -0
- package/styles/index.scss +1 -2
- package/styles/typo.scss +12 -1
- package/utils/index.d.ts +2 -0
- package/esm2015/plugins/dnd/component/dnd.component.js +0 -254
- package/esm2015/plugins/dnd/utils/get-current-target.js +0 -19
- package/esm2015/plugins/dnd/utils/get-hover-direction.js +0 -13
- package/esm2015/plugins/dnd/utils/is-valid-drag.js +0 -38
- package/esm2015/plugins/dnd/utils/move-drag-node.js +0 -30
- package/esm2015/plugins/dnd/utils/remove-drop-thumb-line.js +0 -10
- package/plugins/dnd/component/dnd.component.d.ts +0 -42
- package/plugins/dnd/component/dnd.component.scss +0 -60
- package/plugins/dnd/utils/get-current-target.d.ts +0 -2
- package/plugins/dnd/utils/get-hover-direction.d.ts +0 -3
- package/plugins/dnd/utils/is-valid-drag.d.ts +0 -3
- package/plugins/dnd/utils/move-drag-node.d.ts +0 -2
- package/plugins/dnd/utils/remove-drop-thumb-line.d.ts +0 -2
|
@@ -379,7 +379,6 @@
|
|
|
379
379
|
var DEFAULT_SCROLL_CONTAINER = '.the-editable-container';
|
|
380
380
|
var ELEMENT_UNIQUE_ID = 'key';
|
|
381
381
|
var ZERO_WIDTH_CHAR = '\u200B';
|
|
382
|
-
var DROP_THUMB_LINE = 'drop-thumb-line';
|
|
383
382
|
exports.TheMode = void 0;
|
|
384
383
|
(function (TheMode) {
|
|
385
384
|
TheMode["fullMode"] = "full";
|
|
@@ -2577,6 +2576,108 @@
|
|
|
2577
2576
|
return false;
|
|
2578
2577
|
};
|
|
2579
2578
|
|
|
2579
|
+
var mergeElementOptions = function (elementOptions) {
|
|
2580
|
+
elementOptions = elementOptions.filter(function (item) { return item.inValidChildrenTypes.length > 0; });
|
|
2581
|
+
var combinationData = __spreadArray(__spreadArray([], __read(DefaultElementOptions)), __read(elementOptions));
|
|
2582
|
+
var dataInfo = {};
|
|
2583
|
+
combinationData.forEach(function (item) {
|
|
2584
|
+
var type = item.type, inValidChildrenTypes = item.inValidChildrenTypes, isIndivisible = item.isIndivisible, isSecondaryContainer = item.isSecondaryContainer;
|
|
2585
|
+
if (!dataInfo[type]) {
|
|
2586
|
+
dataInfo[type] = {
|
|
2587
|
+
type: type,
|
|
2588
|
+
inValidChildrenTypes: inValidChildrenTypes,
|
|
2589
|
+
isIndivisible: isIndivisible,
|
|
2590
|
+
isSecondaryContainer: isSecondaryContainer
|
|
2591
|
+
};
|
|
2592
|
+
}
|
|
2593
|
+
dataInfo[type].inValidChildrenTypes = Array.from(new Set(__spreadArray(__spreadArray([], __read(inValidChildrenTypes)), __read(dataInfo[type].inValidChildrenTypes))));
|
|
2594
|
+
});
|
|
2595
|
+
return dataInfo;
|
|
2596
|
+
};
|
|
2597
|
+
|
|
2598
|
+
/** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
|
|
2599
|
+
function coercePixelsFromCssValue(cssValue) {
|
|
2600
|
+
var match = cssValue.match(/(\d+(\.\d+)?)px/);
|
|
2601
|
+
if (match) {
|
|
2602
|
+
return Number(match[1]);
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
function getElementWidth(element) {
|
|
2606
|
+
// Optimization: Check style.width first as we probably set it already before reading
|
|
2607
|
+
// offsetWidth which triggers layout.
|
|
2608
|
+
return coercePixelsFromCssValue(element.style.width) || element.offsetWidth;
|
|
2609
|
+
}
|
|
2610
|
+
function getElementHeight(element) {
|
|
2611
|
+
return Math.round(element.getBoundingClientRect().height);
|
|
2612
|
+
}
|
|
2613
|
+
function getColsTotalWidth(cols) {
|
|
2614
|
+
return cols.reduce(function (total, col) {
|
|
2615
|
+
return total + getElementWidth(col);
|
|
2616
|
+
}, 0);
|
|
2617
|
+
}
|
|
2618
|
+
function getRowsTotalHeight(rows) {
|
|
2619
|
+
return rows.reduce(function (total, row) {
|
|
2620
|
+
return total + getElementHeight(row);
|
|
2621
|
+
}, 0);
|
|
2622
|
+
}
|
|
2623
|
+
function useElementStyle(el, element) {
|
|
2624
|
+
if (element.align) {
|
|
2625
|
+
el.style.textAlign = element.align || exports.Alignment.left;
|
|
2626
|
+
}
|
|
2627
|
+
if (element.textIndent) {
|
|
2628
|
+
el.style.textIndent = element.textIndent + 'em';
|
|
2629
|
+
}
|
|
2630
|
+
if (element.verticalAlign) {
|
|
2631
|
+
el.style.verticalAlign = element.verticalAlign;
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2634
|
+
function getElementClassByPrefix(el, prefix) {
|
|
2635
|
+
var matchClass = null;
|
|
2636
|
+
el.classList.forEach(function (value, key) {
|
|
2637
|
+
if (value.includes(prefix)) {
|
|
2638
|
+
matchClass = value;
|
|
2639
|
+
}
|
|
2640
|
+
});
|
|
2641
|
+
return matchClass;
|
|
2642
|
+
}
|
|
2643
|
+
function findRelativeElementByPoint(editor, x, y, mode) {
|
|
2644
|
+
var editableElement = i1.EDITOR_TO_ELEMENT.get(editor);
|
|
2645
|
+
var rectEditable = editableElement.getBoundingClientRect();
|
|
2646
|
+
if (x > rectEditable.x && x < rectEditable.x + rectEditable.width) {
|
|
2647
|
+
var centerX = rectEditable.x + rectEditable.width / 2;
|
|
2648
|
+
var relativeElement = document.elementFromPoint(mode === 'highest' ? centerX : x, y);
|
|
2649
|
+
return relativeElement;
|
|
2650
|
+
}
|
|
2651
|
+
return null;
|
|
2652
|
+
}
|
|
2653
|
+
function findNodeEntryByPoint(editor, x, y, mode) {
|
|
2654
|
+
var editableElement = i1.EDITOR_TO_ELEMENT.get(editor);
|
|
2655
|
+
var rootElement = null;
|
|
2656
|
+
var relativeElement = findRelativeElementByPoint(editor, x, y, mode);
|
|
2657
|
+
// 获取最顶层的DOM
|
|
2658
|
+
if (mode === 'highest') {
|
|
2659
|
+
while (relativeElement && editableElement.contains(relativeElement)) {
|
|
2660
|
+
relativeElement = relativeElement.closest('[data-slate-node="element"]');
|
|
2661
|
+
if (relativeElement) {
|
|
2662
|
+
rootElement = relativeElement;
|
|
2663
|
+
relativeElement = relativeElement.parentElement;
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
if (!mode) {
|
|
2668
|
+
if (relativeElement && editableElement.contains(relativeElement)) {
|
|
2669
|
+
relativeElement = relativeElement.closest('[data-slate-node="element"]');
|
|
2670
|
+
rootElement = relativeElement;
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
if (rootElement) {
|
|
2674
|
+
var node = i1.AngularEditor.toSlateNode(editor, rootElement);
|
|
2675
|
+
var path = i1.AngularEditor.findPath(editor, node);
|
|
2676
|
+
return [node, path];
|
|
2677
|
+
}
|
|
2678
|
+
return null;
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2580
2681
|
var withDeserializeMd = function (options) { return function (editor) {
|
|
2581
2682
|
var insertData = editor.insertData, onKeydown = editor.onKeydown;
|
|
2582
2683
|
editor.onKeydown = function (event) {
|
|
@@ -2681,25 +2782,6 @@
|
|
|
2681
2782
|
return regexps.some(function (regexp) { return regexp.test(content); });
|
|
2682
2783
|
};
|
|
2683
2784
|
|
|
2684
|
-
var mergeElementOptions = function (elementOptions) {
|
|
2685
|
-
elementOptions = elementOptions.filter(function (item) { return item.inValidChildrenTypes.length > 0; });
|
|
2686
|
-
var combinationData = __spreadArray(__spreadArray([], __read(DefaultElementOptions)), __read(elementOptions));
|
|
2687
|
-
var dataInfo = {};
|
|
2688
|
-
combinationData.forEach(function (item) {
|
|
2689
|
-
var type = item.type, inValidChildrenTypes = item.inValidChildrenTypes, isIndivisible = item.isIndivisible, isSecondaryContainer = item.isSecondaryContainer;
|
|
2690
|
-
if (!dataInfo[type]) {
|
|
2691
|
-
dataInfo[type] = {
|
|
2692
|
-
type: type,
|
|
2693
|
-
inValidChildrenTypes: inValidChildrenTypes,
|
|
2694
|
-
isIndivisible: isIndivisible,
|
|
2695
|
-
isSecondaryContainer: isSecondaryContainer
|
|
2696
|
-
};
|
|
2697
|
-
}
|
|
2698
|
-
dataInfo[type].inValidChildrenTypes = Array.from(new Set(__spreadArray(__spreadArray([], __read(inValidChildrenTypes)), __read(dataInfo[type].inValidChildrenTypes))));
|
|
2699
|
-
});
|
|
2700
|
-
return dataInfo;
|
|
2701
|
-
};
|
|
2702
|
-
|
|
2703
2785
|
var withAutoInsertData = function (validChildren) { return function (editor) {
|
|
2704
2786
|
var insertData = editor.insertData;
|
|
2705
2787
|
var allElementOptions = DefaultElementOptions;
|
|
@@ -3275,7 +3357,8 @@
|
|
|
3275
3357
|
$event.stopPropagation();
|
|
3276
3358
|
};
|
|
3277
3359
|
TheImageComponent.prototype.isShouldOpen = function () {
|
|
3278
|
-
|
|
3360
|
+
var richMedia = this.theContextService.getOptions().theOptions.richMedia;
|
|
3361
|
+
return !(this === null || this === void 0 ? void 0 : this.readonly) && richMedia && (this === null || this === void 0 ? void 0 : this.isCollapsed) && !this.uploading && !this.isOpen;
|
|
3279
3362
|
};
|
|
3280
3363
|
TheImageComponent.prototype.isShouldClose = function () {
|
|
3281
3364
|
return this.isOpen && ((this === null || this === void 0 ? void 0 : this.readonly) || !(this === null || this === void 0 ? void 0 : this.isCollapsed) || this.uploading);
|
|
@@ -3289,7 +3372,7 @@
|
|
|
3289
3372
|
insideClosable: false,
|
|
3290
3373
|
backdropClosable: true,
|
|
3291
3374
|
hasBackdrop: false,
|
|
3292
|
-
offset:
|
|
3375
|
+
offset: 10,
|
|
3293
3376
|
viewContainerRef: this.viewContainerRef,
|
|
3294
3377
|
scrollStrategy: this.overlay.scrollStrategies.reposition()
|
|
3295
3378
|
});
|
|
@@ -3335,7 +3418,7 @@
|
|
|
3335
3418
|
overlayX: 'center',
|
|
3336
3419
|
overlayY: 'top',
|
|
3337
3420
|
offsetX: 0,
|
|
3338
|
-
offsetY:
|
|
3421
|
+
offsetY: 10
|
|
3339
3422
|
};
|
|
3340
3423
|
return this.overlay
|
|
3341
3424
|
.position()
|
|
@@ -3348,7 +3431,7 @@
|
|
|
3348
3431
|
return TheImageComponent;
|
|
3349
3432
|
}(TheBaseElementComponent));
|
|
3350
3433
|
TheImageComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheImageComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i1__namespace$2.DomSanitizer }, { token: THE_UPLOAD_SERVICE_TOKEN }, { token: i0__namespace.ChangeDetectorRef }, { token: TheContextService }, { token: i1__namespace$3.ThyPopover }, { token: i2__namespace.Overlay }, { token: i0__namespace.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
3351
|
-
TheImageComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, 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-
|
|
3434
|
+
TheImageComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, 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__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i6__namespace.ThyProgressComponent, selector: "thy-progress", inputs: ["thyType", "thySize", "thyValue", "thyMax", "thyTips"] }, { type: i4__namespace.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i3__namespace.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: i3__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }], directives: [{ type: i10__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i10__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5__namespace.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
|
|
3352
3435
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheImageComponent, decorators: [{
|
|
3353
3436
|
type: i0.Component,
|
|
3354
3437
|
args: [{
|
|
@@ -6447,7 +6530,10 @@
|
|
|
6447
6530
|
return false;
|
|
6448
6531
|
},
|
|
6449
6532
|
isDisabled: function (editor) {
|
|
6450
|
-
|
|
6533
|
+
var _a;
|
|
6534
|
+
var contextService = (_a = editor === null || editor === void 0 ? void 0 : editor.injector) === null || _a === void 0 ? void 0 : _a.get(TheContextService);
|
|
6535
|
+
var richMedia = contextService.getOptions().theOptions.richMedia;
|
|
6536
|
+
if (richMedia && editor.selection) {
|
|
6451
6537
|
var disableGroup = [exports.ElementKinds.image];
|
|
6452
6538
|
var anchorBlock$1 = anchorBlock(editor);
|
|
6453
6539
|
return anchorBlock$1 && disableGroup.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
|
|
@@ -8763,89 +8849,6 @@
|
|
|
8763
8849
|
type: i0.Injectable
|
|
8764
8850
|
}], ctorParameters: function () { return []; } });
|
|
8765
8851
|
|
|
8766
|
-
/** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
|
|
8767
|
-
function coercePixelsFromCssValue(cssValue) {
|
|
8768
|
-
var match = cssValue.match(/(\d+(\.\d+)?)px/);
|
|
8769
|
-
if (match) {
|
|
8770
|
-
return Number(match[1]);
|
|
8771
|
-
}
|
|
8772
|
-
}
|
|
8773
|
-
function getElementWidth(element) {
|
|
8774
|
-
// Optimization: Check style.width first as we probably set it already before reading
|
|
8775
|
-
// offsetWidth which triggers layout.
|
|
8776
|
-
return coercePixelsFromCssValue(element.style.width) || element.offsetWidth;
|
|
8777
|
-
}
|
|
8778
|
-
function getElementHeight(element) {
|
|
8779
|
-
return Math.round(element.getBoundingClientRect().height);
|
|
8780
|
-
}
|
|
8781
|
-
function getColsTotalWidth(cols) {
|
|
8782
|
-
return cols.reduce(function (total, col) {
|
|
8783
|
-
return total + getElementWidth(col);
|
|
8784
|
-
}, 0);
|
|
8785
|
-
}
|
|
8786
|
-
function getRowsTotalHeight(rows) {
|
|
8787
|
-
return rows.reduce(function (total, row) {
|
|
8788
|
-
return total + getElementHeight(row);
|
|
8789
|
-
}, 0);
|
|
8790
|
-
}
|
|
8791
|
-
function useElementStyle(el, element) {
|
|
8792
|
-
if (element.align) {
|
|
8793
|
-
el.style.textAlign = element.align || exports.Alignment.left;
|
|
8794
|
-
}
|
|
8795
|
-
if (element.textIndent) {
|
|
8796
|
-
el.style.textIndent = element.textIndent + 'em';
|
|
8797
|
-
}
|
|
8798
|
-
if (element.verticalAlign) {
|
|
8799
|
-
el.style.verticalAlign = element.verticalAlign;
|
|
8800
|
-
}
|
|
8801
|
-
}
|
|
8802
|
-
function getElementClassByPrefix(el, prefix) {
|
|
8803
|
-
var matchClass = null;
|
|
8804
|
-
el.classList.forEach(function (value, key) {
|
|
8805
|
-
if (value.includes(prefix)) {
|
|
8806
|
-
matchClass = value;
|
|
8807
|
-
}
|
|
8808
|
-
});
|
|
8809
|
-
return matchClass;
|
|
8810
|
-
}
|
|
8811
|
-
function findRelativeElementByPoint(editor, x, y, mode) {
|
|
8812
|
-
var editableElement = i1.EDITOR_TO_ELEMENT.get(editor);
|
|
8813
|
-
var rectEditable = editableElement.getBoundingClientRect();
|
|
8814
|
-
if (x > rectEditable.x && x < rectEditable.x + rectEditable.width) {
|
|
8815
|
-
var centerX = rectEditable.x + rectEditable.width / 2;
|
|
8816
|
-
var relativeElement = document.elementFromPoint(mode === 'highest' ? centerX : x, y);
|
|
8817
|
-
return relativeElement;
|
|
8818
|
-
}
|
|
8819
|
-
return null;
|
|
8820
|
-
}
|
|
8821
|
-
function findNodeEntryByPoint(editor, x, y, mode) {
|
|
8822
|
-
var editableElement = i1.EDITOR_TO_ELEMENT.get(editor);
|
|
8823
|
-
var rootElement = null;
|
|
8824
|
-
var relativeElement = findRelativeElementByPoint(editor, x, y, mode);
|
|
8825
|
-
// 获取最顶层的DOM
|
|
8826
|
-
if (mode === 'highest') {
|
|
8827
|
-
while (relativeElement && editableElement.contains(relativeElement)) {
|
|
8828
|
-
relativeElement = relativeElement.closest('[data-slate-node="element"]');
|
|
8829
|
-
if (relativeElement) {
|
|
8830
|
-
rootElement = relativeElement;
|
|
8831
|
-
relativeElement = relativeElement.parentElement;
|
|
8832
|
-
}
|
|
8833
|
-
}
|
|
8834
|
-
}
|
|
8835
|
-
if (!mode) {
|
|
8836
|
-
if (relativeElement && editableElement.contains(relativeElement)) {
|
|
8837
|
-
relativeElement = relativeElement.closest('[data-slate-node="element"]');
|
|
8838
|
-
rootElement = relativeElement;
|
|
8839
|
-
}
|
|
8840
|
-
}
|
|
8841
|
-
if (rootElement) {
|
|
8842
|
-
var node = i1.AngularEditor.toSlateNode(editor, rootElement);
|
|
8843
|
-
var path = i1.AngularEditor.findPath(editor, node);
|
|
8844
|
-
return [node, path];
|
|
8845
|
-
}
|
|
8846
|
-
return null;
|
|
8847
|
-
}
|
|
8848
|
-
|
|
8849
8852
|
function splitCell(editor) {
|
|
8850
8853
|
var opts = new TableOptions$1();
|
|
8851
8854
|
var anchor = editor.selection.anchor;
|
|
@@ -13342,353 +13345,6 @@
|
|
|
13342
13345
|
args: ['mousedown', ['$event']]
|
|
13343
13346
|
}] } });
|
|
13344
13347
|
|
|
13345
|
-
var getCurrentTarget = function (editor, event) {
|
|
13346
|
-
var editorElement = i1.EDITOR_TO_ELEMENT.get(editor);
|
|
13347
|
-
var _a = editorElement.getBoundingClientRect(), left = _a.left, right = _a.right;
|
|
13348
|
-
var _b = window.getComputedStyle(editorElement, null), paddingLeft = _b.paddingLeft, paddingRight = _b.paddingRight;
|
|
13349
|
-
var paddingLeftPixels = coercePixelsFromCssValue(paddingLeft);
|
|
13350
|
-
var paddingRightPixels = coercePixelsFromCssValue(paddingRight);
|
|
13351
|
-
var x = event.x;
|
|
13352
|
-
if (event.x <= left + paddingLeftPixels || event.x >= right - paddingRightPixels) {
|
|
13353
|
-
x = left + paddingLeftPixels;
|
|
13354
|
-
}
|
|
13355
|
-
var nodeEntry = findNodeEntryByPoint(editor, x, event.y);
|
|
13356
|
-
if (nodeEntry) {
|
|
13357
|
-
return TheEditor.toDOMNode(editor, nodeEntry[0]);
|
|
13358
|
-
}
|
|
13359
|
-
};
|
|
13360
|
-
|
|
13361
|
-
var getHoverDirection = function (editor, event) {
|
|
13362
|
-
var rootNode = getCurrentTarget(editor, event);
|
|
13363
|
-
if (rootNode) {
|
|
13364
|
-
var _a = rootNode.getBoundingClientRect(), top = _a.top, bottom = _a.bottom;
|
|
13365
|
-
var middleHeight = (bottom - top) / 2;
|
|
13366
|
-
if (top + middleHeight > event.clientY) {
|
|
13367
|
-
return 'top';
|
|
13368
|
-
}
|
|
13369
|
-
return 'bottom';
|
|
13370
|
-
}
|
|
13371
|
-
};
|
|
13372
|
-
|
|
13373
|
-
var removeDropThumbLine = function (editor) {
|
|
13374
|
-
var element = i1.EDITOR_TO_ELEMENT.get(editor);
|
|
13375
|
-
var dropThumbLine = element.querySelector('.' + DROP_THUMB_LINE);
|
|
13376
|
-
if (dropThumbLine) {
|
|
13377
|
-
dropThumbLine.remove();
|
|
13378
|
-
}
|
|
13379
|
-
};
|
|
13380
|
-
|
|
13381
|
-
var moveDragNode = function (editor, dragNode, event) {
|
|
13382
|
-
event.stopPropagation();
|
|
13383
|
-
var element = i1.EDITOR_TO_ELEMENT.get(editor);
|
|
13384
|
-
var dropThumbLine = element.querySelector('.' + DROP_THUMB_LINE);
|
|
13385
|
-
var parentElement = dropThumbLine && dropThumbLine.parentNode;
|
|
13386
|
-
if (parentElement) {
|
|
13387
|
-
var node = TheEditor.toSlateNode(editor, parentElement);
|
|
13388
|
-
var dropPath_1 = node && TheEditor.findPath(editor, node);
|
|
13389
|
-
if (dropPath_1.length) {
|
|
13390
|
-
var dragPath_1 = dragNode.path;
|
|
13391
|
-
var before = slate.Path.isBefore(dragPath_1, dropPath_1) && slate.Path.isSibling(dragPath_1, dropPath_1);
|
|
13392
|
-
dropPath_1 = before ? dropPath_1 : slate.Path.next(dropPath_1);
|
|
13393
|
-
if (dropPath_1.length) {
|
|
13394
|
-
slate.Editor.withoutNormalizing(editor, function () {
|
|
13395
|
-
slate.Transforms.moveNodes(editor, {
|
|
13396
|
-
at: dragPath_1,
|
|
13397
|
-
to: dropPath_1
|
|
13398
|
-
});
|
|
13399
|
-
});
|
|
13400
|
-
}
|
|
13401
|
-
}
|
|
13402
|
-
}
|
|
13403
|
-
removeDropThumbLine(editor);
|
|
13404
|
-
};
|
|
13405
|
-
|
|
13406
|
-
var isValidDrag = function (editor, dragNode, currentTarget) {
|
|
13407
|
-
var _a;
|
|
13408
|
-
var node = TheEditor.toSlateNode(editor, currentTarget);
|
|
13409
|
-
var dropPath = TheEditor.findPath(editor, node);
|
|
13410
|
-
var dragPath = TheEditor.findPath(editor, dragNode);
|
|
13411
|
-
if (dragPath[0] === dropPath[0] && dropPath.length > 1) {
|
|
13412
|
-
// 阻止list元素拖入自身
|
|
13413
|
-
return false;
|
|
13414
|
-
}
|
|
13415
|
-
var allElementOptions = DefaultElementOptions;
|
|
13416
|
-
if ((_a = editor.extraElementOptions) === null || _a === void 0 ? void 0 : _a.length) {
|
|
13417
|
-
var extraInfo = mergeElementOptions(editor.extraElementOptions);
|
|
13418
|
-
allElementOptions = Object.values(extraInfo);
|
|
13419
|
-
}
|
|
13420
|
-
var types = allElementOptions.map(function (item) { return item.type; });
|
|
13421
|
-
if (types.indexOf(node.type) > -1 && allElementOptions[types.indexOf(node.type)].isSecondaryContainer) {
|
|
13422
|
-
// 阻止向table-celld等二级容器中拖入
|
|
13423
|
-
return false;
|
|
13424
|
-
}
|
|
13425
|
-
var containerParent = slate.Editor.above(editor, {
|
|
13426
|
-
at: dropPath,
|
|
13427
|
-
mode: 'lowest',
|
|
13428
|
-
match: function (node) {
|
|
13429
|
-
return node && node.type && types.includes(node.type);
|
|
13430
|
-
}
|
|
13431
|
-
});
|
|
13432
|
-
if (containerParent) {
|
|
13433
|
-
var inValidChildrenTypes = allElementOptions.find(function (item) { return item.type === containerParent[0].type; }).inValidChildrenTypes;
|
|
13434
|
-
if (inValidChildrenTypes.includes(dragNode.type)) {
|
|
13435
|
-
return false;
|
|
13436
|
-
}
|
|
13437
|
-
}
|
|
13438
|
-
return true;
|
|
13439
|
-
};
|
|
13440
|
-
|
|
13441
|
-
var SNAPSHOT_PADDING_WIDTH = 5;
|
|
13442
|
-
var SNAPSHOT_LIMI_HEIGHT = 70;
|
|
13443
|
-
var DRAG_ICON_SIZE = 24;
|
|
13444
|
-
var DRAG_ICON_OFFSET = 5;
|
|
13445
|
-
var DRAG_SNAPSHOT_OFFSET = 15; // 拖拽内容距离鼠标偏移量
|
|
13446
|
-
var TheDndComponent = /** @class */ (function () {
|
|
13447
|
-
function TheDndComponent(renderer, elementRef, ngZone, cdr) {
|
|
13448
|
-
this.renderer = renderer;
|
|
13449
|
-
this.elementRef = elementRef;
|
|
13450
|
-
this.ngZone = ngZone;
|
|
13451
|
-
this.cdr = cdr;
|
|
13452
|
-
this.isDraging = false;
|
|
13453
|
-
this.destroy$ = new rxjs.Subject();
|
|
13454
|
-
this.dragChange = new i0.EventEmitter();
|
|
13455
|
-
this.dropThumbLine = document.createElement('div');
|
|
13456
|
-
this.dropThumbLine.className = DROP_THUMB_LINE;
|
|
13457
|
-
}
|
|
13458
|
-
Object.defineProperty(TheDndComponent.prototype, "nativeElement", {
|
|
13459
|
-
get: function () {
|
|
13460
|
-
return this.elementRef.nativeElement;
|
|
13461
|
-
},
|
|
13462
|
-
enumerable: false,
|
|
13463
|
-
configurable: true
|
|
13464
|
-
});
|
|
13465
|
-
Object.defineProperty(TheDndComponent.prototype, "editableElement", {
|
|
13466
|
-
get: function () {
|
|
13467
|
-
return this.editor && i1.EDITOR_TO_ELEMENT.get(this.editor);
|
|
13468
|
-
},
|
|
13469
|
-
enumerable: false,
|
|
13470
|
-
configurable: true
|
|
13471
|
-
});
|
|
13472
|
-
TheDndComponent.prototype.ngAfterViewInit = function () {
|
|
13473
|
-
var _this = this;
|
|
13474
|
-
var contextService = this.editor.injector.get(TheContextService);
|
|
13475
|
-
this.ngZone.runOutsideAngular(function () {
|
|
13476
|
-
rxjs.merge(rxjs.fromEvent(_this.editableElement, "mousemove"), rxjs.fromEvent(_this.editableElement, "mouseleave"))
|
|
13477
|
-
.pipe(operators.takeUntil(_this.destroy$), operators.filter(function () {
|
|
13478
|
-
return !contextService.getOptions().theOptions.readonly && contextService.getOptions().theOptions.dragAndDrop;
|
|
13479
|
-
}))
|
|
13480
|
-
.subscribe(function (e) { return _this.setDragIcon(e); });
|
|
13481
|
-
rxjs.fromEvent(document, "drop")
|
|
13482
|
-
.pipe(operators.takeUntil(_this.destroy$), operators.filter(function () {
|
|
13483
|
-
return !contextService.getOptions().theOptions.readonly && contextService.getOptions().theOptions.dragAndDrop;
|
|
13484
|
-
}))
|
|
13485
|
-
.subscribe(function (e) { return _this.onDrop(e); });
|
|
13486
|
-
rxjs.fromEvent(document, "dragover")
|
|
13487
|
-
.pipe(operators.takeUntil(_this.destroy$), operators.filter(function () {
|
|
13488
|
-
return !contextService.getOptions().theOptions.readonly && contextService.getOptions().theOptions.dragAndDrop;
|
|
13489
|
-
}))
|
|
13490
|
-
.subscribe(function (e) { return _this.onDragover(e); });
|
|
13491
|
-
rxjs.fromEvent(document, "scroll")
|
|
13492
|
-
.pipe(operators.takeUntil(_this.destroy$), operators.filter(function () {
|
|
13493
|
-
return !contextService.getOptions().theOptions.readonly && contextService.getOptions().theOptions.dragAndDrop;
|
|
13494
|
-
}))
|
|
13495
|
-
.subscribe(function (e) {
|
|
13496
|
-
e.preventDefault();
|
|
13497
|
-
var scrollPosition = window.scrollY;
|
|
13498
|
-
if (!_this.isScrolling && _this.isDraging) {
|
|
13499
|
-
window.requestAnimationFrame(function () {
|
|
13500
|
-
if (_this.editableTop) {
|
|
13501
|
-
// 滚动过程中,通过设置父级元素来设置snapshot位置
|
|
13502
|
-
_this.updateDndContainerPosition(null, scrollPosition + _this.editableTop + 'px');
|
|
13503
|
-
}
|
|
13504
|
-
_this.isScrolling = false;
|
|
13505
|
-
});
|
|
13506
|
-
_this.isScrolling = true;
|
|
13507
|
-
}
|
|
13508
|
-
});
|
|
13509
|
-
});
|
|
13510
|
-
this.setVisibility(false);
|
|
13511
|
-
this.valueChangeHandle();
|
|
13512
|
-
};
|
|
13513
|
-
TheDndComponent.prototype.valueChangeHandle = function () {
|
|
13514
|
-
var _this = this;
|
|
13515
|
-
var onChange = this.editor.onChange;
|
|
13516
|
-
this.editor.onChange = function () {
|
|
13517
|
-
var ops = _this.editor.operations;
|
|
13518
|
-
var skip = ops.length === 1 && slate.Operation.isSelectionOperation(ops[0]);
|
|
13519
|
-
if (!skip) {
|
|
13520
|
-
_this.setVisibility(false);
|
|
13521
|
-
}
|
|
13522
|
-
onChange();
|
|
13523
|
-
};
|
|
13524
|
-
};
|
|
13525
|
-
TheDndComponent.prototype.updateDndContainerPosition = function (left, top) {
|
|
13526
|
-
var element = this.elementRef.nativeElement;
|
|
13527
|
-
var parentElement = element.parentElement;
|
|
13528
|
-
top && this.renderer.setStyle(parentElement, 'top', top);
|
|
13529
|
-
left && this.renderer.setStyle(parentElement, 'left', left);
|
|
13530
|
-
};
|
|
13531
|
-
TheDndComponent.prototype.getEditableTop = function (event) {
|
|
13532
|
-
var offsetHeight = document.documentElement.offsetHeight;
|
|
13533
|
-
var height = this.editableElement.getBoundingClientRect().height;
|
|
13534
|
-
if (event.clientY < this.dragElementHeight) {
|
|
13535
|
-
this.editableTop = -this.editableElement.offsetTop;
|
|
13536
|
-
return;
|
|
13537
|
-
}
|
|
13538
|
-
if (height > event.pageY && event.clientY + this.dragElementHeight >= offsetHeight) {
|
|
13539
|
-
this.editableTop = event.clientY - this.editableElement.offsetTop;
|
|
13540
|
-
return;
|
|
13541
|
-
}
|
|
13542
|
-
this.editableTop = null;
|
|
13543
|
-
};
|
|
13544
|
-
TheDndComponent.prototype.onDragStart = function (event) {
|
|
13545
|
-
this.isDraging = true;
|
|
13546
|
-
this.dragChange.emit(this.isDraging);
|
|
13547
|
-
this.dragSnapshotContent = this.elementRef.nativeElement.nextSibling;
|
|
13548
|
-
this.dragSnapshotContent.className = 'the-editor-typo drag-snapshot-container';
|
|
13549
|
-
this.dragSnapshotContent.appendChild(this.dragElement.cloneNode(true));
|
|
13550
|
-
this.dragElement.style.opacity = '0.3';
|
|
13551
|
-
};
|
|
13552
|
-
TheDndComponent.prototype.onDragEnd = function (event) {
|
|
13553
|
-
this.dragElement.style.opacity = '';
|
|
13554
|
-
this.isDraging = false;
|
|
13555
|
-
this.setVisibility(false);
|
|
13556
|
-
this.resetDragSnapshotContent();
|
|
13557
|
-
this.dragChange.emit(this.isDraging);
|
|
13558
|
-
};
|
|
13559
|
-
TheDndComponent.prototype.onDrop = function (event) {
|
|
13560
|
-
event.preventDefault();
|
|
13561
|
-
if (this.isDraging) {
|
|
13562
|
-
moveDragNode(this.editor, this.dragNode, event);
|
|
13563
|
-
}
|
|
13564
|
-
};
|
|
13565
|
-
TheDndComponent.prototype.onDragover = function (event) {
|
|
13566
|
-
event.preventDefault();
|
|
13567
|
-
if (this.isDraging && !this.isScrolling) {
|
|
13568
|
-
this.getEditableTop(event);
|
|
13569
|
-
var offsetWidth = document.documentElement.offsetWidth;
|
|
13570
|
-
var _b = this.editableElement.getBoundingClientRect(), editorLeft = _b.left, editorTop = _b.top, height = _b.height;
|
|
13571
|
-
var top = 0;
|
|
13572
|
-
var left = 0;
|
|
13573
|
-
if (event.clientX + this.dragElementWidth / 2 > offsetWidth) {
|
|
13574
|
-
left = event.pageX - editorLeft - this.nativeElement.offsetWidth;
|
|
13575
|
-
}
|
|
13576
|
-
else {
|
|
13577
|
-
left = Math.max(event.pageX - editorLeft, -editorLeft) + DRAG_SNAPSHOT_OFFSET;
|
|
13578
|
-
}
|
|
13579
|
-
var scrollTop = document.documentElement.scrollTop;
|
|
13580
|
-
var editorMarginTop = editorTop + scrollTop; // 编辑器距离顶部间距
|
|
13581
|
-
if (event.clientY + this.dragElementHeight + DRAG_SNAPSHOT_OFFSET > document.documentElement.offsetHeight) {
|
|
13582
|
-
top = event.pageY - editorMarginTop - this.nativeElement.offsetHeight + DRAG_SNAPSHOT_OFFSET;
|
|
13583
|
-
top = Math.min(top, height - this.editableElement.offsetTop);
|
|
13584
|
-
}
|
|
13585
|
-
else {
|
|
13586
|
-
top = event.pageY - editorMarginTop + this.editableElement.offsetTop + DRAG_SNAPSHOT_OFFSET;
|
|
13587
|
-
}
|
|
13588
|
-
this.updateDndContainerPosition(left + 'px', top + 'px');
|
|
13589
|
-
this.setSnapshotStyle(event);
|
|
13590
|
-
this.setDropThumbLine(event);
|
|
13591
|
-
}
|
|
13592
|
-
};
|
|
13593
|
-
TheDndComponent.prototype.setDropThumbLine = function (event) {
|
|
13594
|
-
var _a;
|
|
13595
|
-
var element = getCurrentTarget(this.editor, event);
|
|
13596
|
-
var direction = getHoverDirection(this.editor, event);
|
|
13597
|
-
if (element) {
|
|
13598
|
-
if (direction && direction === 'top') {
|
|
13599
|
-
element = (_a = element.previousElementSibling) === null || _a === void 0 ? void 0 : _a.querySelector('[data-slate-node="element"]');
|
|
13600
|
-
}
|
|
13601
|
-
if (element && isValidDrag(this.editor, this.dragNode.node, element)) {
|
|
13602
|
-
element.appendChild(this.dropThumbLine);
|
|
13603
|
-
}
|
|
13604
|
-
}
|
|
13605
|
-
};
|
|
13606
|
-
TheDndComponent.prototype.setDragIcon = function (event) {
|
|
13607
|
-
if (!this.isDraging) {
|
|
13608
|
-
var nodeEntry = findNodeEntryByPoint(this.editor, event.x, event.y, 'highest');
|
|
13609
|
-
if (nodeEntry && !slate.Editor.isEmpty(this.editor, nodeEntry[0])) {
|
|
13610
|
-
var rootNode = i1.AngularEditor.toDOMNode(this.editor, nodeEntry[0]);
|
|
13611
|
-
this.dragNode = {
|
|
13612
|
-
node: nodeEntry[0],
|
|
13613
|
-
path: nodeEntry[1]
|
|
13614
|
-
};
|
|
13615
|
-
this.dragElement = rootNode;
|
|
13616
|
-
var lineHeight = coercePixelsFromCssValue(window.getComputedStyle(rootNode)['lineHeight']);
|
|
13617
|
-
var offsetTop = rootNode.offsetTop + rootNode.offsetParent.offsetTop + (lineHeight - DRAG_ICON_SIZE) / 2;
|
|
13618
|
-
var offsetLeft = rootNode.offsetLeft + rootNode.offsetParent.offsetLeft;
|
|
13619
|
-
this.updateDndContainerPosition(offsetLeft - DRAG_ICON_SIZE - DRAG_ICON_OFFSET + 'px', offsetTop + 'px');
|
|
13620
|
-
this.setVisibility(true);
|
|
13621
|
-
}
|
|
13622
|
-
else {
|
|
13623
|
-
this.setVisibility(false);
|
|
13624
|
-
}
|
|
13625
|
-
}
|
|
13626
|
-
};
|
|
13627
|
-
TheDndComponent.prototype.setSnapshotStyle = function (event) {
|
|
13628
|
-
var _b = this.dragElement.getBoundingClientRect(), width = _b.width, height = _b.height;
|
|
13629
|
-
this.dragElementHeight = height;
|
|
13630
|
-
this.dragElementWidth = width;
|
|
13631
|
-
var dragSnapshotContentStyle = "display: block; min-height: 0; width: " + (width + SNAPSHOT_PADDING_WIDTH * 2) + "px;";
|
|
13632
|
-
if (height > SNAPSHOT_LIMI_HEIGHT) {
|
|
13633
|
-
dragSnapshotContentStyle = dragSnapshotContentStyle + 'transform: scale(0.45);';
|
|
13634
|
-
this.dragElementHeight = this.dragElementHeight * 0.45;
|
|
13635
|
-
this.dragElementWidth = this.dragElementWidth * 0.45;
|
|
13636
|
-
}
|
|
13637
|
-
var snapshotTop = 0;
|
|
13638
|
-
var snapshotLeft = 0;
|
|
13639
|
-
// 上下移动:超出屏幕高度,重新设置snapshot的位置
|
|
13640
|
-
if (event.clientY + this.dragElementHeight + DRAG_SNAPSHOT_OFFSET > document.documentElement.offsetHeight) {
|
|
13641
|
-
snapshotTop = this.dragElementHeight;
|
|
13642
|
-
}
|
|
13643
|
-
else {
|
|
13644
|
-
snapshotTop = 0;
|
|
13645
|
-
}
|
|
13646
|
-
// 左右移动:超出屏幕宽度,重新设置snapshot的位置
|
|
13647
|
-
if (event.clientX + this.dragElementWidth / 2 > document.documentElement.offsetWidth) {
|
|
13648
|
-
snapshotLeft = this.dragElementWidth;
|
|
13649
|
-
}
|
|
13650
|
-
else {
|
|
13651
|
-
snapshotLeft = 0;
|
|
13652
|
-
}
|
|
13653
|
-
dragSnapshotContentStyle = dragSnapshotContentStyle + ("top: " + -snapshotTop + "px; left: " + -snapshotLeft + "px;");
|
|
13654
|
-
this.dragSnapshotContent.setAttribute('style', dragSnapshotContentStyle);
|
|
13655
|
-
};
|
|
13656
|
-
TheDndComponent.prototype.resetDragSnapshotContent = function () {
|
|
13657
|
-
this.dragSnapshotContent.className = 'drag-snapshot-container';
|
|
13658
|
-
this.dragSnapshotContent.setAttribute('style', '');
|
|
13659
|
-
this.dragSnapshotContent.innerHTML = '';
|
|
13660
|
-
};
|
|
13661
|
-
TheDndComponent.prototype.setVisibility = function (visible) {
|
|
13662
|
-
if (visible === void 0) { visible = true; }
|
|
13663
|
-
var dndContainer = this.nativeElement.parentNode;
|
|
13664
|
-
dndContainer.style.display = visible ? 'block' : 'none';
|
|
13665
|
-
};
|
|
13666
|
-
TheDndComponent.prototype.ngOnDestroy = function () {
|
|
13667
|
-
this.destroy$.next();
|
|
13668
|
-
this.destroy$.complete();
|
|
13669
|
-
};
|
|
13670
|
-
return TheDndComponent;
|
|
13671
|
-
}());
|
|
13672
|
-
TheDndComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheDndComponent, deps: [{ token: i0__namespace.Renderer2 }, { token: i0__namespace.ElementRef }, { token: i0__namespace.NgZone }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
13673
|
-
TheDndComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, 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__namespace.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i10__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
13674
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheDndComponent, decorators: [{
|
|
13675
|
-
type: i0.Component,
|
|
13676
|
-
args: [{
|
|
13677
|
-
selector: '[theDnd]',
|
|
13678
|
-
templateUrl: './dnd.component.html',
|
|
13679
|
-
host: {
|
|
13680
|
-
class: 'the-drag-drop'
|
|
13681
|
-
}
|
|
13682
|
-
}]
|
|
13683
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.Renderer2 }, { type: i0__namespace.ElementRef }, { type: i0__namespace.NgZone }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { editor: [{
|
|
13684
|
-
type: i0.Input
|
|
13685
|
-
}], dragChange: [{
|
|
13686
|
-
type: i0.Output
|
|
13687
|
-
}], content: [{
|
|
13688
|
-
type: i0.ViewChild,
|
|
13689
|
-
args: ['content', { static: false }]
|
|
13690
|
-
}] } });
|
|
13691
|
-
|
|
13692
13348
|
var ElementStylePipe = /** @class */ (function () {
|
|
13693
13349
|
function ElementStylePipe() {
|
|
13694
13350
|
}
|
|
@@ -13902,16 +13558,10 @@
|
|
|
13902
13558
|
_this.onSlaDragStart = function (event) { };
|
|
13903
13559
|
_this.onSlaDragOver = function (event) { };
|
|
13904
13560
|
_this.onDrop = function (event) {
|
|
13905
|
-
if (_this.isDraging) {
|
|
13906
|
-
event.preventDefault();
|
|
13907
|
-
}
|
|
13908
13561
|
_this.theOnDOMEvent.emit({
|
|
13909
13562
|
nativeEvent: event
|
|
13910
13563
|
});
|
|
13911
13564
|
};
|
|
13912
|
-
_this.onDragChange = function (isDraging) {
|
|
13913
|
-
_this.isDraging = isDraging;
|
|
13914
|
-
};
|
|
13915
13565
|
return _this;
|
|
13916
13566
|
}
|
|
13917
13567
|
Object.defineProperty(TheEditorComponent.prototype, "theGlobalToolbarInstance", {
|
|
@@ -14172,7 +13822,7 @@
|
|
|
14172
13822
|
useExisting: i0.forwardRef(function () { return TheEditorComponent; }),
|
|
14173
13823
|
multi: true
|
|
14174
13824
|
}
|
|
14175
|
-
], 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__namespace, 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 <
|
|
13825
|
+
], 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__namespace, 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__namespace.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__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4__namespace$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
14176
13826
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheEditorComponent, decorators: [{
|
|
14177
13827
|
type: i0.Component,
|
|
14178
13828
|
args: [{
|
|
@@ -14434,8 +14084,7 @@
|
|
|
14434
14084
|
TheTableComponent,
|
|
14435
14085
|
TheTableRowComponent,
|
|
14436
14086
|
TheTdComponent,
|
|
14437
|
-
TheInlineCodeComponent
|
|
14438
|
-
TheDndComponent
|
|
14087
|
+
TheInlineCodeComponent
|
|
14439
14088
|
];
|
|
14440
14089
|
var PIPES = [ElementStylePipe, ElementClassPipe];
|
|
14441
14090
|
var TheEditorModule = /** @class */ (function () {
|
|
@@ -14479,8 +14128,7 @@
|
|
|
14479
14128
|
TheTableComponent,
|
|
14480
14129
|
TheTableRowComponent,
|
|
14481
14130
|
TheTdComponent,
|
|
14482
|
-
TheInlineCodeComponent,
|
|
14483
|
-
TheDndComponent], imports: [i10.CommonModule, i1.SlateModule, i4$1.FormsModule, i4.ThyIconModule,
|
|
14131
|
+
TheInlineCodeComponent], imports: [i10.CommonModule, i1.SlateModule, i4$1.FormsModule, i4.ThyIconModule,
|
|
14484
14132
|
avatar.ThyAvatarModule,
|
|
14485
14133
|
i3.ThyNavModule,
|
|
14486
14134
|
i2$1.ThyFormModule,
|
|
@@ -14545,7 +14193,6 @@
|
|
|
14545
14193
|
exports.ColorEditor = ColorEditor;
|
|
14546
14194
|
exports.DEFAULT_LANGUAGE = DEFAULT_LANGUAGE;
|
|
14547
14195
|
exports.DEFAULT_SCROLL_CONTAINER = DEFAULT_SCROLL_CONTAINER;
|
|
14548
|
-
exports.DROP_THUMB_LINE = DROP_THUMB_LINE;
|
|
14549
14196
|
exports.DefaultElementOptions = DefaultElementOptions;
|
|
14550
14197
|
exports.DefaultGlobalToolbarDefinition = DefaultGlobalToolbarDefinition;
|
|
14551
14198
|
exports.DefaultInlineToolbarDefinition = DefaultInlineToolbarDefinition;
|
|
@@ -14600,15 +14247,25 @@
|
|
|
14600
14247
|
exports.VOID_BLOCK_TYPES = VOID_BLOCK_TYPES;
|
|
14601
14248
|
exports.VerticalAlignEditor = VerticalAlignEditor;
|
|
14602
14249
|
exports.ZERO_WIDTH_CHAR = ZERO_WIDTH_CHAR;
|
|
14250
|
+
exports.coercePixelsFromCssValue = coercePixelsFromCssValue;
|
|
14603
14251
|
exports.createEmptyParagraph = createEmptyParagraph;
|
|
14604
14252
|
exports.dataDeserialize = dataDeserialize;
|
|
14605
14253
|
exports.dataSerializing = dataSerializing;
|
|
14254
|
+
exports.findNodeEntryByPoint = findNodeEntryByPoint;
|
|
14255
|
+
exports.findRelativeElementByPoint = findRelativeElementByPoint;
|
|
14256
|
+
exports.getColsTotalWidth = getColsTotalWidth;
|
|
14257
|
+
exports.getElementClassByPrefix = getElementClassByPrefix;
|
|
14258
|
+
exports.getElementHeight = getElementHeight;
|
|
14259
|
+
exports.getElementWidth = getElementWidth;
|
|
14260
|
+
exports.getRowsTotalHeight = getRowsTotalHeight;
|
|
14606
14261
|
exports.getToolbarClass = getToolbarClass;
|
|
14607
14262
|
exports.htmlToTheia = htmlToTheia;
|
|
14608
14263
|
exports.inValidTypes = inValidTypes;
|
|
14609
14264
|
exports.isCleanEmptyParagraph = isCleanEmptyParagraph;
|
|
14265
|
+
exports.mergeElementOptions = mergeElementOptions;
|
|
14610
14266
|
exports.plainToTheia = plainToTheia;
|
|
14611
14267
|
exports.toolbarCompose = toolbarCompose;
|
|
14268
|
+
exports.useElementStyle = useElementStyle;
|
|
14612
14269
|
exports.withTheEditor = withTheEditor;
|
|
14613
14270
|
|
|
14614
14271
|
Object.defineProperty(exports, '__esModule', { value: true });
|