@worktile/theia 2.3.0-next.0 → 2.3.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/worktile-theia.umd.js +18 -24
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/esm2015/plugins/dnd/component/dnd.component.js +18 -24
- package/esm2015/utils/dom.js +2 -2
- package/fesm2015/worktile-theia.js +18 -24
- package/fesm2015/worktile-theia.js.map +1 -1
- package/package.json +1 -1
- package/plugins/dnd/component/dnd.component.scss +1 -2
|
@@ -8765,7 +8765,7 @@
|
|
|
8765
8765
|
|
|
8766
8766
|
/** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
|
|
8767
8767
|
function coercePixelsFromCssValue(cssValue) {
|
|
8768
|
-
var match = cssValue.match(/(\d+)px/);
|
|
8768
|
+
var match = cssValue.match(/(\d+(\.\d+)?)px/);
|
|
8769
8769
|
if (match) {
|
|
8770
8770
|
return Number(match[1]);
|
|
8771
8771
|
}
|
|
@@ -13442,6 +13442,7 @@
|
|
|
13442
13442
|
var SNAPSHOT_LIMI_HEIGHT = 70;
|
|
13443
13443
|
var DRAG_ICON_SIZE = 24;
|
|
13444
13444
|
var DRAG_ICON_OFFSET = 5;
|
|
13445
|
+
var DRAG_SNAPSHOT_OFFSET = 15; // 拖拽内容距离鼠标偏移量
|
|
13445
13446
|
var TheDndComponent = /** @class */ (function () {
|
|
13446
13447
|
function TheDndComponent(renderer, elementRef, ngZone, cdr) {
|
|
13447
13448
|
this.renderer = renderer;
|
|
@@ -13543,7 +13544,7 @@
|
|
|
13543
13544
|
TheDndComponent.prototype.onDragStart = function (event) {
|
|
13544
13545
|
this.isDraging = true;
|
|
13545
13546
|
this.dragChange.emit(this.isDraging);
|
|
13546
|
-
this.dragSnapshotContent =
|
|
13547
|
+
this.dragSnapshotContent = this.elementRef.nativeElement.nextSibling;
|
|
13547
13548
|
this.dragSnapshotContent.className = 'the-editor-typo drag-snapshot-container';
|
|
13548
13549
|
this.dragSnapshotContent.appendChild(this.dragElement.cloneNode(true));
|
|
13549
13550
|
this.dragElement.style.opacity = '0.3';
|
|
@@ -13569,28 +13570,20 @@
|
|
|
13569
13570
|
var _b = this.editableElement.getBoundingClientRect(), editorLeft = _b.left, editorTop = _b.top, height = _b.height;
|
|
13570
13571
|
var top = 0;
|
|
13571
13572
|
var left = 0;
|
|
13572
|
-
if (
|
|
13573
|
-
|
|
13574
|
-
left = event.pageX - editorLeft - this.elementRef.nativeElement.offsetWidth;
|
|
13575
|
-
}
|
|
13576
|
-
else {
|
|
13577
|
-
left = Math.max(event.pageX - editorLeft, -editorLeft) + 10;
|
|
13578
|
-
}
|
|
13573
|
+
if (event.clientX + this.dragElementWidth / 2 > offsetWidth) {
|
|
13574
|
+
left = event.pageX - editorLeft - this.nativeElement.offsetWidth;
|
|
13579
13575
|
}
|
|
13580
|
-
|
|
13581
|
-
|
|
13582
|
-
|
|
13583
|
-
|
|
13584
|
-
|
|
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);
|
|
13585
13584
|
}
|
|
13586
13585
|
else {
|
|
13587
|
-
|
|
13588
|
-
top = Math.abs(editorTop) + event.clientY; // 滚动距离 + 鼠标clientY
|
|
13589
|
-
paddingTop = event.pageY - this.editableElement.offsetTop - top;
|
|
13590
|
-
// 防止底部出现滚动条
|
|
13591
|
-
if (paddingTop < height - top) {
|
|
13592
|
-
top = top + paddingTop;
|
|
13593
|
-
}
|
|
13586
|
+
top = event.pageY - editorMarginTop + this.editableElement.offsetTop + DRAG_SNAPSHOT_OFFSET;
|
|
13594
13587
|
}
|
|
13595
13588
|
this.updateDndContainerPosition(left + 'px', top + 'px');
|
|
13596
13589
|
this.setSnapshotStyle(event);
|
|
@@ -13635,7 +13628,7 @@
|
|
|
13635
13628
|
var _b = this.dragElement.getBoundingClientRect(), width = _b.width, height = _b.height;
|
|
13636
13629
|
this.dragElementHeight = height;
|
|
13637
13630
|
this.dragElementWidth = width;
|
|
13638
|
-
var dragSnapshotContentStyle = "
|
|
13631
|
+
var dragSnapshotContentStyle = "display: block; min-height: 0; width: " + (width + SNAPSHOT_PADDING_WIDTH * 2) + "px;";
|
|
13639
13632
|
if (height > SNAPSHOT_LIMI_HEIGHT) {
|
|
13640
13633
|
dragSnapshotContentStyle = dragSnapshotContentStyle + 'transform: scale(0.45);';
|
|
13641
13634
|
this.dragElementHeight = this.dragElementHeight * 0.45;
|
|
@@ -13644,7 +13637,7 @@
|
|
|
13644
13637
|
var snapshotTop = 0;
|
|
13645
13638
|
var snapshotLeft = 0;
|
|
13646
13639
|
// 上下移动:超出屏幕高度,重新设置snapshot的位置
|
|
13647
|
-
if (event.clientY + this.dragElementHeight > document.documentElement.offsetHeight) {
|
|
13640
|
+
if (event.clientY + this.dragElementHeight + DRAG_SNAPSHOT_OFFSET > document.documentElement.offsetHeight) {
|
|
13648
13641
|
snapshotTop = this.dragElementHeight;
|
|
13649
13642
|
}
|
|
13650
13643
|
else {
|
|
@@ -13667,7 +13660,8 @@
|
|
|
13667
13660
|
};
|
|
13668
13661
|
TheDndComponent.prototype.setVisibility = function (visible) {
|
|
13669
13662
|
if (visible === void 0) { visible = true; }
|
|
13670
|
-
this.nativeElement.parentNode
|
|
13663
|
+
var dndContainer = this.nativeElement.parentNode;
|
|
13664
|
+
dndContainer.style.display = visible ? 'block' : 'none';
|
|
13671
13665
|
};
|
|
13672
13666
|
TheDndComponent.prototype.ngOnDestroy = function () {
|
|
13673
13667
|
this.destroy$.next();
|