mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 08:30:42 +02:00
🚨
This commit is contained in:
parent
580a502714
commit
432634beea
6 changed files with 23 additions and 23 deletions
|
@ -162,7 +162,7 @@ const setSnippetPost = (dialog: Dialog, snippets: ISnippet[], removeIds: string[
|
||||||
renderSnippet();
|
renderSnippet();
|
||||||
dialog.destroy({cancel: "true"});
|
dialog.destroy({cancel: "true"});
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
const setSnippet = (dialog: Dialog, oldSnippets: ISnippet[], removeIds: string[], confirm = false) => {
|
const setSnippet = (dialog: Dialog, oldSnippets: ISnippet[], removeIds: string[], confirm = false) => {
|
||||||
const snippets: ISnippet[] = [];
|
const snippets: ISnippet[] = [];
|
||||||
|
@ -180,10 +180,10 @@ const setSnippet = (dialog: Dialog, oldSnippets: ISnippet[], removeIds: string[]
|
||||||
} else {
|
} else {
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
confirmDialog(window.siyuan.languages.save, window.siyuan.languages.snippetsTip, () => {
|
confirmDialog(window.siyuan.languages.save, window.siyuan.languages.snippetsTip, () => {
|
||||||
setSnippetPost(dialog, snippets, removeIds)
|
setSnippetPost(dialog, snippets, removeIds);
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
setSnippetPost(dialog, snippets, removeIds)
|
setSnippetPost(dialog, snippets, removeIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
|
@ -90,7 +90,7 @@ const filterList = (inputElement: HTMLInputElement, listElement: Element) => {
|
||||||
if (!hasFocus) {
|
if (!hasFocus) {
|
||||||
element.classList.add("b3-list-item--focus");
|
element.classList.add("b3-list-item--focus");
|
||||||
}
|
}
|
||||||
hasFocus = true
|
hasFocus = true;
|
||||||
element.classList.remove("fn__none");
|
element.classList.remove("fn__none");
|
||||||
} else {
|
} else {
|
||||||
element.classList.add("fn__none");
|
element.classList.add("fn__none");
|
||||||
|
|
|
@ -62,15 +62,15 @@ export class Gutter {
|
||||||
selectIds.push(item.getAttribute("data-node-id"));
|
selectIds.push(item.getAttribute("data-node-id"));
|
||||||
});
|
});
|
||||||
} else {
|
} 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");
|
const ghostElement = document.createElement("div");
|
||||||
ghostElement.className = protyle.wysiwyg.element.className;
|
ghostElement.className = protyle.wysiwyg.element.className;
|
||||||
selectElements.forEach(item => {
|
selectElements.forEach(item => {
|
||||||
ghostElement.append(item.cloneNode(true));
|
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);
|
document.body.append(ghostElement);
|
||||||
event.dataTransfer.setDragImage(ghostElement, 0, 0);
|
event.dataTransfer.setDragImage(ghostElement, 0, 0);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
@ -1906,7 +1906,7 @@ data-type="fold"><svg style="width:10px${fold && fold === "1" ? "" : ";transform
|
||||||
this.element.innerHTML = html;
|
this.element.innerHTML = html;
|
||||||
this.element.classList.remove("fn__none");
|
this.element.classList.remove("fn__none");
|
||||||
this.element.style.width = "";
|
this.element.style.width = "";
|
||||||
const contentTop = wysiwyg.parentElement.getBoundingClientRect().top
|
const contentTop = wysiwyg.parentElement.getBoundingClientRect().top;
|
||||||
let rect = element.getBoundingClientRect();
|
let rect = element.getBoundingClientRect();
|
||||||
let marginHeight = 0;
|
let marginHeight = 0;
|
||||||
if (listItem) {
|
if (listItem) {
|
||||||
|
|
|
@ -6,14 +6,14 @@ import {isMobile} from "../../util/functions";
|
||||||
import {hasClosestBlock, hasClosestByClassName} from "../util/hasClosest";
|
import {hasClosestBlock, hasClosestByClassName} from "../util/hasClosest";
|
||||||
|
|
||||||
const getOffsetTop = (element: HTMLElement, topElement: HTMLElement) => {
|
const getOffsetTop = (element: HTMLElement, topElement: HTMLElement) => {
|
||||||
let tempElement = element
|
let tempElement = element;
|
||||||
let top = 0
|
let top = 0;
|
||||||
while (topElement.contains(tempElement)) {
|
while (topElement.contains(tempElement)) {
|
||||||
top += tempElement.offsetTop
|
top += tempElement.offsetTop;
|
||||||
tempElement = tempElement.offsetParent as HTMLElement
|
tempElement = tempElement.offsetParent as HTMLElement;
|
||||||
}
|
}
|
||||||
return top;
|
return top;
|
||||||
}
|
};
|
||||||
|
|
||||||
let getIndexTimeout: number;
|
let getIndexTimeout: number;
|
||||||
export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
|
export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
|
||||||
|
|
|
@ -733,23 +733,23 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
}
|
}
|
||||||
const rowElement = target.parentElement.parentElement;
|
const rowElement = target.parentElement.parentElement;
|
||||||
const selectIds = [];
|
const selectIds = [];
|
||||||
const rowElements = []
|
const rowElements = [];
|
||||||
if (rowElement.classList.contains("av__row--select")) {
|
if (rowElement.classList.contains("av__row--select")) {
|
||||||
rowElement.parentElement.querySelectorAll(".av__row--select:not(.av__row--header)").forEach((item) => {
|
rowElement.parentElement.querySelectorAll(".av__row--select:not(.av__row--header)").forEach((item) => {
|
||||||
selectIds.push(item.getAttribute("data-id"));
|
selectIds.push(item.getAttribute("data-id"));
|
||||||
rowElements.push(item)
|
rowElements.push(item);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
selectIds.push(rowElement.getAttribute("data-id"));
|
selectIds.push(rowElement.getAttribute("data-id"));
|
||||||
rowElements.push(rowElement)
|
rowElements.push(rowElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ghostElement = document.createElement("div");
|
const ghostElement = document.createElement("div");
|
||||||
ghostElement.className = protyle.wysiwyg.element.className;
|
ghostElement.className = protyle.wysiwyg.element.className;
|
||||||
rowElements.forEach(item => {
|
rowElements.forEach(item => {
|
||||||
ghostElement.append(item.cloneNode(true));
|
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);
|
document.body.append(ghostElement);
|
||||||
event.dataTransfer.setDragImage(ghostElement, 0, 0);
|
event.dataTransfer.setDragImage(ghostElement, 0, 0);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
|
@ -23,7 +23,7 @@ export const upDownHint = (listElement: Element, event: KeyboardEvent, classActi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!currentHintElement) {
|
if (!currentHintElement) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
currentHintElement.classList.add(classActiveName);
|
currentHintElement.classList.add(classActiveName);
|
||||||
if (listElement.scrollTop < currentHintElement.offsetTop - listElement.clientHeight + currentHintElement.clientHeight ||
|
if (listElement.scrollTop < currentHintElement.offsetTop - listElement.clientHeight + currentHintElement.clientHeight ||
|
||||||
|
@ -43,14 +43,14 @@ export const upDownHint = (listElement: Element, event: KeyboardEvent, classActi
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!currentHintElement) {
|
if (!currentHintElement) {
|
||||||
currentHintElement = listElement.children[listElement.children.length - 1] as HTMLElement
|
currentHintElement = listElement.children[listElement.children.length - 1] as HTMLElement;
|
||||||
while (currentHintElement &&
|
while (currentHintElement &&
|
||||||
(currentHintElement.classList.contains("fn__none") || !currentHintElement.classList.contains(className))) {
|
(currentHintElement.classList.contains("fn__none") || !currentHintElement.classList.contains(className))) {
|
||||||
currentHintElement = currentHintElement.previousElementSibling as HTMLElement;
|
currentHintElement = currentHintElement.previousElementSibling as HTMLElement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!currentHintElement) {
|
if (!currentHintElement) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
currentHintElement.classList.add(classActiveName);
|
currentHintElement.classList.add(classActiveName);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue