This commit is contained in:
Vanessa 2023-11-10 20:02:03 +08:00
parent 580a502714
commit 432634beea
6 changed files with 23 additions and 23 deletions

View file

@ -162,7 +162,7 @@ const setSnippetPost = (dialog: Dialog, snippets: ISnippet[], removeIds: string[
renderSnippet();
dialog.destroy({cancel: "true"});
});
}
};
const setSnippet = (dialog: Dialog, oldSnippets: ISnippet[], removeIds: string[], confirm = false) => {
const snippets: ISnippet[] = [];
@ -180,10 +180,10 @@ const setSnippet = (dialog: Dialog, oldSnippets: ISnippet[], removeIds: string[]
} else {
if (confirm) {
confirmDialog(window.siyuan.languages.save, window.siyuan.languages.snippetsTip, () => {
setSnippetPost(dialog, snippets, removeIds)
})
setSnippetPost(dialog, snippets, removeIds);
});
} else {
setSnippetPost(dialog, snippets, removeIds)
setSnippetPost(dialog, snippets, removeIds);
}
}
}
};

View file

@ -90,7 +90,7 @@ const filterList = (inputElement: HTMLInputElement, listElement: Element) => {
if (!hasFocus) {
element.classList.add("b3-list-item--focus");
}
hasFocus = true
hasFocus = true;
element.classList.remove("fn__none");
} else {
element.classList.add("fn__none");

View file

@ -62,15 +62,15 @@ export class Gutter {
selectIds.push(item.getAttribute("data-node-id"));
});
} else {
selectElements = [protyle.wysiwyg.element.querySelector(`[data-node-id="${selectIds[0]}"]`)]
selectElements = [protyle.wysiwyg.element.querySelector(`[data-node-id="${selectIds[0]}"]`)];
}
const ghostElement = document.createElement("div");
ghostElement.className = protyle.wysiwyg.element.className;
selectElements.forEach(item => {
ghostElement.append(item.cloneNode(true));
})
ghostElement.setAttribute("style", `position:fixed;opacity:.1;width:${selectElements[0].clientWidth}px;padding:0;`)
});
ghostElement.setAttribute("style", `position:fixed;opacity:.1;width:${selectElements[0].clientWidth}px;padding:0;`);
document.body.append(ghostElement);
event.dataTransfer.setDragImage(ghostElement, 0, 0);
setTimeout(() => {
@ -1906,7 +1906,7 @@ data-type="fold"><svg style="width:10px${fold && fold === "1" ? "" : ";transform
this.element.innerHTML = html;
this.element.classList.remove("fn__none");
this.element.style.width = "";
const contentTop = wysiwyg.parentElement.getBoundingClientRect().top
const contentTop = wysiwyg.parentElement.getBoundingClientRect().top;
let rect = element.getBoundingClientRect();
let marginHeight = 0;
if (listItem) {

View file

@ -6,14 +6,14 @@ import {isMobile} from "../../util/functions";
import {hasClosestBlock, hasClosestByClassName} from "../util/hasClosest";
const getOffsetTop = (element: HTMLElement, topElement: HTMLElement) => {
let tempElement = element
let top = 0
let tempElement = element;
let top = 0;
while (topElement.contains(tempElement)) {
top += tempElement.offsetTop
tempElement = tempElement.offsetParent as HTMLElement
top += tempElement.offsetTop;
tempElement = tempElement.offsetParent as HTMLElement;
}
return top;
}
};
let getIndexTimeout: number;
export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {

View file

@ -733,23 +733,23 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
}
const rowElement = target.parentElement.parentElement;
const selectIds = [];
const rowElements = []
const rowElements = [];
if (rowElement.classList.contains("av__row--select")) {
rowElement.parentElement.querySelectorAll(".av__row--select:not(.av__row--header)").forEach((item) => {
selectIds.push(item.getAttribute("data-id"));
rowElements.push(item)
rowElements.push(item);
});
} else {
selectIds.push(rowElement.getAttribute("data-id"));
rowElements.push(rowElement)
rowElements.push(rowElement);
}
const ghostElement = document.createElement("div");
ghostElement.className = protyle.wysiwyg.element.className;
rowElements.forEach(item => {
ghostElement.append(item.cloneNode(true));
})
ghostElement.setAttribute("style", `position:fixed;opacity:.1;width:${rowElements[0].clientWidth}px;padding:0;`)
});
ghostElement.setAttribute("style", `position:fixed;opacity:.1;width:${rowElements[0].clientWidth}px;padding:0;`);
document.body.append(ghostElement);
event.dataTransfer.setDragImage(ghostElement, 0, 0);
setTimeout(() => {

View file

@ -23,7 +23,7 @@ export const upDownHint = (listElement: Element, event: KeyboardEvent, classActi
}
}
if (!currentHintElement) {
return
return;
}
currentHintElement.classList.add(classActiveName);
if (listElement.scrollTop < currentHintElement.offsetTop - listElement.clientHeight + currentHintElement.clientHeight ||
@ -43,14 +43,14 @@ export const upDownHint = (listElement: Element, event: KeyboardEvent, classActi
}
if (!currentHintElement) {
currentHintElement = listElement.children[listElement.children.length - 1] as HTMLElement
currentHintElement = listElement.children[listElement.children.length - 1] as HTMLElement;
while (currentHintElement &&
(currentHintElement.classList.contains("fn__none") || !currentHintElement.classList.contains(className))) {
currentHintElement = currentHintElement.previousElementSibling as HTMLElement;
}
}
if (!currentHintElement) {
return
return;
}
currentHintElement.classList.add(classActiveName);