This commit is contained in:
Vanessa 2024-11-03 11:48:07 +08:00
parent 5b15802def
commit cd9baa2b67
6 changed files with 17 additions and 17 deletions

View file

@ -259,14 +259,14 @@ export class BlockPanel {
html += '</div><div class="resize__rd"></div><div class="resize__ld"></div><div class="resize__lt"></div><div class="resize__rt"></div><div class="resize__r"></div><div class="resize__d"></div><div class="resize__t"></div><div class="resize__l"></div>';
}
this.element.innerHTML = html;
let resizeTimeout: number
let resizeTimeout: number;
this.observerResize = new ResizeObserver(() => {
clearTimeout(resizeTimeout);
resizeTimeout = window.setTimeout(() => {
this.editors.forEach(item => {
resize(item.protyle);
});
}, Constants.TIMEOUT_TRANSITION)
}, Constants.TIMEOUT_TRANSITION);
});
this.observerResize.observe(this.element);
this.observerLoad = new IntersectionObserver((e) => {

View file

@ -19,7 +19,7 @@ export const onlyProtyleCommand = (options: {
topNodeElement.nextElementSibling?.classList.contains("list") && topNodeElement.previousElementSibling.classList.contains("protyle-action")) {
topNodeElement = topNodeElement.parentElement;
}
const id = topNodeElement.getAttribute("data-node-id")
const id = topNodeElement.getAttribute("data-node-id");
if (options.protyle.options.backlinkData) {
openFileById({
app: options.protyle.app,

View file

@ -150,13 +150,13 @@ export class Files extends Model {
});
break;
} else if (type === "toggle") {
const svgElement = target.querySelector("svg")
const svgElement = target.querySelector("svg");
if (svgElement.classList.contains("b3-list-item__arrow--open")) {
this.closeElement.style.height = "30px"
this.closeElement.style.height = "30px";
svgElement.classList.remove("b3-list-item__arrow--open");
this.closeElement.lastElementChild.classList.add("fn__none");
} else {
this.closeElement.style.height = "40%"
this.closeElement.style.height = "40%";
svgElement.classList.add("b3-list-item__arrow--open");
this.closeElement.lastElementChild.classList.remove("fn__none");
}
@ -775,7 +775,7 @@ export class Files extends Model {
if (!init) {
return;
}
const svgElement = this.closeElement.querySelector("svg")
const svgElement = this.closeElement.querySelector("svg");
if (html !== "") {
this.closeElement.style.height = "30px";
svgElement.classList.remove("b3-list-item__arrow--open");
@ -954,9 +954,9 @@ export class Files extends Model {
tempElement.innerHTML = fileHTML;
// 保持文件夹展开状态
nextElement.querySelectorAll(":scope > .b3-list-item > .b3-list-item__toggle> .b3-list-item__arrow--open").forEach(item => {
const openLiElement = hasClosestByClassName(item, "b3-list-item")
const openLiElement = hasClosestByClassName(item, "b3-list-item");
if (openLiElement) {
const tempOpenLiElement = tempElement.content.querySelector(`.b3-list-item[data-node-id="${openLiElement.getAttribute("data-node-id")}"]`)
const tempOpenLiElement = tempElement.content.querySelector(`.b3-list-item[data-node-id="${openLiElement.getAttribute("data-node-id")}"]`);
tempOpenLiElement.after(openLiElement.nextElementSibling);
tempOpenLiElement.querySelector(".b3-list-item__arrow").classList.add("b3-list-item__arrow--open");
}

View file

@ -158,13 +158,13 @@ export class MobileFiles extends Model {
event.stopPropagation();
break;
} else if (type === "toggle") {
const svgElement = target.querySelector("svg")
const svgElement = target.querySelector("svg");
if (svgElement.classList.contains("b3-list-item__arrow--open")) {
this.closeElement.style.height = "42px"
this.closeElement.style.height = "42px";
svgElement.classList.remove("b3-list-item__arrow--open");
this.closeElement.lastElementChild.classList.add("fn__none");
} else {
this.closeElement.style.height = "40%"
this.closeElement.style.height = "40%";
svgElement.classList.add("b3-list-item__arrow--open");
this.closeElement.lastElementChild.classList.remove("fn__none");
}
@ -322,7 +322,7 @@ export class MobileFiles extends Model {
if (!init) {
return;
}
const svgElement = this.closeElement.querySelector("svg")
const svgElement = this.closeElement.querySelector("svg");
if (html !== "") {
this.closeElement.style.height = "30px";
svgElement.classList.remove("b3-list-item__arrow--open");
@ -546,9 +546,9 @@ export class MobileFiles extends Model {
tempElement.innerHTML = fileHTML;
// 保持文件夹展开状态
nextElement.querySelectorAll(":scope > .b3-list-item > .b3-list-item__toggle> .b3-list-item__arrow--open").forEach(item => {
const openLiElement = hasClosestByClassName(item, "b3-list-item")
const openLiElement = hasClosestByClassName(item, "b3-list-item");
if (openLiElement) {
const tempOpenLiElement = tempElement.content.querySelector(`.b3-list-item[data-node-id="${openLiElement.getAttribute("data-node-id")}"]`)
const tempOpenLiElement = tempElement.content.querySelector(`.b3-list-item[data-node-id="${openLiElement.getAttribute("data-node-id")}"]`);
tempOpenLiElement.after(openLiElement.nextElementSibling);
tempOpenLiElement.querySelector(".b3-list-item__arrow").classList.add("b3-list-item__arrow--open");
}

View file

@ -76,7 +76,7 @@ export class Gutter {
.replace(/⌘/g, "Ctrl+").replace(/⌥/g, "Alt+").replace(/⇧/g, "Shift+").replace(/⌃/g, "Ctrl+");
}
if (protyle.options.backlinkData) {
this.gutterTip = this.gutterTip.replace(window.siyuan.languages.enter, window.siyuan.languages.openBy)
this.gutterTip = this.gutterTip.replace(window.siyuan.languages.enter, window.siyuan.languages.openBy);
}
this.element = document.createElement("div");
this.element.className = "protyle-gutters";

View file

@ -158,7 +158,7 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range:
// 在数学公式输入框中撤销到最后一步,再继续撤销会撤销编辑器正文内容,从而出发 input 事件
hideElements(["util"], protyle, true);
if (type === "NodeTable") {
blockElement.querySelector(".table__select").removeAttribute("style")
blockElement.querySelector(".table__select").removeAttribute("style");
}
const tempElement = document.createElement("template");
tempElement.innerHTML = html;