fix(Split): iframe drags incorrectly (#4109)

* feat: 支持 iframe 拖动

* chore: bump version 8.8.4-beta02
This commit is contained in:
Argo Zhang 2024-08-21 14:13:18 +08:00 committed by GitHub
parent 4ee8dd7065
commit eb7a516394
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 34 additions and 3 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<Version>8.8.4-beta01</Version>
<Version>8.8.4-beta02</Version>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">

View File

@ -21,7 +21,12 @@ export function init(id) {
const isVertical = !splitWrapper.classList.contains('is-horizontal')
const splitBar = splitWrapper.children[1]
const splitLeft = splitWrapper.children[0]
const splitRight = splitWrapper.children[2]
const splitRight = splitWrapper.children[2];
split.splitBar = splitBar;
EventHandler.on(splitBar, 'mousedown', e => showMask(splitLeft, splitRight));
EventHandler.on(splitBar, 'mouseup', e => removeMask(splitLeft, splitRight));
Drag.drag(splitBar,
e => {
splitWidth = el.offsetWidth
@ -57,11 +62,36 @@ export function init(id) {
})
}
const showMask = (left, right) => {
const div = document.createElement('div');
div.style = "position: absolute; inset: 0; opacity: 0; z-index: 5;";
div.className = "split-mask";
left.appendChild(div);
right.appendChild(div.cloneNode(true));
}
const removeMask = (left, right) => {
deleteMask(left);
deleteMask(right);
}
const deleteMask = el => {
let mask = el.querySelector('.split-mask');
if (mask) {
mask.remove();
mask = null;
}
}
export function dispose(id) {
const split = Data.get(id)
Data.remove(id)
if (split) {
Drag.dispose(split.el)
const { el, splitBar } = split;
EventHandler.on(splitBar, 'mousedown');
EventHandler.on(splitBar, 'mouseup');
Drag.dispose(el)
}
}

View File

@ -26,6 +26,7 @@
.split-pane {
height: 100%;
overflow: hidden;
position: relative;
}
.split-bar {