mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-04 15:58:49 +01:00
This commit is contained in:
parent
1b1ea3ca59
commit
5228511bd3
1 changed files with 4 additions and 3 deletions
|
|
@ -1070,7 +1070,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
} else if (event.dataTransfer.getData(Constants.SIYUAN_DROP_FILE)?.split("-").length > 1) {
|
||||
// 文件树拖拽
|
||||
const ids = event.dataTransfer.getData(Constants.SIYUAN_DROP_FILE).split(",");
|
||||
if (event.altKey) {
|
||||
if (!event.altKey) {
|
||||
if (event.y > protyle.wysiwyg.element.lastElementChild.getBoundingClientRect().bottom) {
|
||||
insertEmptyBlock(protyle, "afterend", protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"));
|
||||
} else {
|
||||
|
|
@ -1230,7 +1230,9 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
if (event.shiftKey || event.altKey) {
|
||||
const fileTreeIds = (event.dataTransfer.types.includes(Constants.SIYUAN_DROP_FILE) && window.siyuan.dragElement) ? window.siyuan.dragElement.innerText : "";
|
||||
if (event.shiftKey || (event.altKey && fileTreeIds.indexOf("-") === -1) ||
|
||||
(!event.altKey && fileTreeIds.indexOf("-") > -1)) {
|
||||
const targetElement = hasClosestBlock(event.target);
|
||||
if (targetElement) {
|
||||
targetElement.classList.remove("dragover__top", "protyle-wysiwyg--select", "dragover__bottom", "dragover__left", "dragover__right");
|
||||
|
|
@ -1315,7 +1317,6 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
if (!targetElement) {
|
||||
return;
|
||||
}
|
||||
const fileTreeIds = (event.dataTransfer.types.includes(Constants.SIYUAN_DROP_FILE) && window.siyuan.dragElement) ? window.siyuan.dragElement.innerText : "";
|
||||
if (targetElement && dragoverElement && targetElement.isSameNode(dragoverElement)) {
|
||||
// 性能优化,目标为同一个元素不再进行校验
|
||||
const nodeRect = targetElement.getBoundingClientRect();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue