This commit is contained in:
Vanessa 2022-11-08 19:25:07 +08:00
parent 0f97325d51
commit 6a143c699f
5 changed files with 9 additions and 9 deletions

View file

@ -202,7 +202,7 @@ export class Files extends Model {
} }
target = target.parentElement; target = target.parentElement;
} }
}) });
this.element.addEventListener("click", (event) => { this.element.addEventListener("click", (event) => {
if (event.detail !== 1) { if (event.detail !== 1) {
setPanelFocus(this.element.parentElement); setPanelFocus(this.element.parentElement);
@ -319,14 +319,14 @@ export class Files extends Model {
selectElements = [liElement]; selectElements = [liElement];
} }
let ids = ""; let ids = "";
const ghostElement = document.createElement("ul") const ghostElement = document.createElement("ul");
selectElements.forEach((item: HTMLElement) => { selectElements.forEach((item: HTMLElement) => {
ghostElement.append(item.cloneNode(true)); ghostElement.append(item.cloneNode(true));
item.style.opacity = "0.1"; item.style.opacity = "0.1";
ids += (item.getAttribute("data-node-id") || "") + ","; ids += (item.getAttribute("data-node-id") || "") + ",";
}); });
ghostElement.setAttribute("style", `width: 219px;position: fixed;top:-${selectElements.length * 30}px`) ghostElement.setAttribute("style", `width: 219px;position: fixed;top:-${selectElements.length * 30}px`);
ghostElement.setAttribute("class", "b3-list b3-list--background") ghostElement.setAttribute("class", "b3-list b3-list--background");
document.body.append(ghostElement); document.body.append(ghostElement);
event.dataTransfer.setDragImage(ghostElement, 16, 16); event.dataTransfer.setDragImage(ghostElement, 16, 16);
event.dataTransfer.setData(Constants.SIYUAN_DROP_FILE, ids); event.dataTransfer.setData(Constants.SIYUAN_DROP_FILE, ids);
@ -335,7 +335,7 @@ export class Files extends Model {
window.siyuan.dragElement.innerText = ids; window.siyuan.dragElement.innerText = ids;
setTimeout(() => { setTimeout(() => {
ghostElement.remove(); ghostElement.remove();
}) });
} }
}); });
this.element.addEventListener("dragend", () => { this.element.addEventListener("dragend", () => {

View file

@ -23,7 +23,7 @@ export const showKeyboardToolbar = (bottom = 0) => {
toolbarElement.style.bottom = bottom + "px"; toolbarElement.style.bottom = bottom + "px";
setTimeout(() => { setTimeout(() => {
const contentElement = window.siyuan.mobileEditor.protyle.contentElement const contentElement = window.siyuan.mobileEditor.protyle.contentElement;
const cursorTop = getSelectionPosition(contentElement).top - contentElement.getBoundingClientRect().top; const cursorTop = getSelectionPosition(contentElement).top - contentElement.getBoundingClientRect().top;
if (cursorTop < window.innerHeight - 96) { if (cursorTop < window.innerHeight - 96) {
return; return;

View file

@ -105,7 +105,7 @@ export class Toolbar {
this.range.collapse(false); this.range.collapse(false);
} else if (event.key === "ArrowUp") { } else if (event.key === "ArrowUp") {
this.range = setFirstNodeRange(getContenteditableElement(endElement), range); this.range = setFirstNodeRange(getContenteditableElement(endElement), range);
nodeElement = hasClosestBlock(endElement) nodeElement = hasClosestBlock(endElement);
if (!nodeElement) { if (!nodeElement) {
return; return;
} }

View file

@ -1931,7 +1931,7 @@ export class WYSIWYG {
// 清除选中的子块 https://ld246.com/article/1667826582251 // 清除选中的子块 https://ld246.com/article/1667826582251
item.querySelectorAll(".protyle-wysiwyg--select").forEach(subItem => { item.querySelectorAll(".protyle-wysiwyg--select").forEach(subItem => {
subItem.classList.remove("protyle-wysiwyg--select"); subItem.classList.remove("protyle-wysiwyg--select");
}) });
}); });
countBlockWord(ids); countBlockWord(ids);
if (toDown) { if (toDown) {

View file

@ -381,7 +381,7 @@ export const openHistory = () => {
}); });
break; break;
} else if (type === "toggle") { } else if (type === "toggle") {
const iconElement = target.firstElementChild.firstElementChild const iconElement = target.firstElementChild.firstElementChild;
if (iconElement.classList.contains("b3-list-item__arrow--open")) { if (iconElement.classList.contains("b3-list-item__arrow--open")) {
target.nextElementSibling.classList.add("fn__none"); target.nextElementSibling.classList.add("fn__none");
iconElement.classList.remove("b3-list-item__arrow--open"); iconElement.classList.remove("b3-list-item__arrow--open");