This commit is contained in:
Vanessa 2024-12-13 21:56:06 +08:00
parent b6925ab9e2
commit 1dc297d856
12 changed files with 20 additions and 20 deletions

View file

@ -197,7 +197,7 @@ export const initAnno = (element: HTMLElement, pdf: any) => {
} else if (type === "remove") {
const urlPath = pdf.appConfig.file.replace(location.origin, "").substr(1);
const config = getConfig(pdf);
const id = rectElement.getAttribute("data-node-id")
const id = rectElement.getAttribute("data-node-id");
delete config[id];
element.querySelectorAll(`[data-node-id="${id}"]`).forEach(item => {
item.remove();

View file

@ -7,12 +7,12 @@ export const openModel = (obj: {
const modelElement = document.getElementById("model");
modelElement.style.transform = "translateY(0px)";
modelElement.style.zIndex = (++window.siyuan.zIndex).toString();
const iconElement = modelElement.querySelector(".toolbar__icon")
const iconElement = modelElement.querySelector(".toolbar__icon");
if(obj.icon) {
iconElement.classList.remove("fn__none")
iconElement.classList.remove("fn__none");
iconElement.querySelector("use").setAttribute("xlink:href", "#" + obj.icon);
} else {
iconElement.classList.add("fn__none")
iconElement.classList.add("fn__none");
}
modelElement.querySelector(".toolbar__text").innerHTML = obj.title;
const modelMainElement = modelElement.querySelector("#modelMain") as HTMLElement;

View file

@ -323,12 +323,12 @@ const initSearchEvent = (app: App, element: Element, config: Config.IUILayoutTab
while (target && !target.isSameNode(element)) {
const type = target.getAttribute("data-type");
if (type === "replaceHistory") {
toggleReplaceHistory(target.nextElementSibling as HTMLInputElement)
toggleReplaceHistory(target.nextElementSibling as HTMLInputElement);
event.stopPropagation();
event.preventDefault();
break;
} else if (type === "assetHistory") {
toggleAssetHistory(assetsElement)
toggleAssetHistory(assetsElement);
event.stopPropagation();
event.preventDefault();
break;
@ -778,7 +778,7 @@ export const popSearch = (app: App, searchConfig?: any) => {
document.querySelector("#toolbarSearchNew").addEventListener("click", () => {
newFileByName(app, (document.querySelector("#toolbarSearch") as HTMLInputElement).value);
});
const historyElement = document.querySelector('.toolbar [data-type="history"]')
const historyElement = document.querySelector('.toolbar [data-type="history"]');
historyElement.addEventListener("click", () => {
toggleSearchHistory(document.querySelector("#model"), config, undefined);
});
@ -811,7 +811,7 @@ const goAsset = () => {
assetInputEvent(assetsElement, localSearch);
});
inputElement.addEventListener("blur", () => {
saveAssetKeyList(inputElement)
saveAssetKeyList(inputElement);
});
assetInputEvent(assetsElement, localSearch);
addClearButton({

View file

@ -522,7 +522,7 @@ export class Background {
k: "",
}, (response) => {
let html = "";
const currentTags = this.getTags()
const currentTags = this.getTags();
response.data.tags.forEach((item: string, index: number) => {
html += `<div class="b3-list-item b3-list-item--narrow${index === 0 ? " b3-list-item--focus" : ""}">
<div class="fn__flex-1">${item}</div>

View file

@ -351,7 +351,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex)}
}
searchInputElement.addEventListener("compositionstart", (event: KeyboardEvent) => {
event.stopPropagation();
})
});
searchInputElement.addEventListener("input", (event: KeyboardEvent) => {
event.stopPropagation();
if (event.isComposing) {

View file

@ -318,7 +318,7 @@ export const setColOption = (protyle: IProtyle, data: IAV, target: HTMLElement,
}
});
menu.addSeparator();
let html = `<div class="fn__flex fn__flex-wrap" style="width: 238px">`;
let html = "<div class=\"fn__flex fn__flex-wrap\" style=\"width: 238px\">";
Array.from(Array(14).keys()).forEach(index => {
html += `<button data-color="${index + 1}" class="color__square${parseInt(color) === index + 1 ? " color__square--current" : ""}" style="color: var(--b3-font-color${index + 1});background-color: var(--b3-font-background${index + 1});">A</button>`;
});

View file

@ -128,7 +128,7 @@ const genUploadedLabel = (responseText: string, protyle: IProtyle) => {
const type = pathPosix().extname(key).toLowerCase();
const filename = protyle.options.upload.filename(key);
const name = filename.substring(0, filename.length - type.length);
hasImage = Constants.SIYUAN_ASSETS_IMAGE.includes(type)
hasImage = Constants.SIYUAN_ASSETS_IMAGE.includes(type);
avAssets.push({
type: Constants.SIYUAN_ASSETS_IMAGE.includes(type) ? "image" : "file",
content: path,

View file

@ -738,9 +738,9 @@ export const clearTableCell = (protyle: IProtyle, tableBlockElement: HTMLElement
});
tableSelectElement.removeAttribute("style");
if (getSelection().rangeCount>0) {
const range = getSelection().getRangeAt(0)
const range = getSelection().getRangeAt(0);
if (tableBlockElement.contains(range.startContainer)) {
range.insertNode(document.createElement("wbr"))
range.insertNode(document.createElement("wbr"));
}
}
const oldHTML = tableBlockElement.outerHTML;

View file

@ -1483,9 +1483,9 @@ export class WYSIWYG {
});
tableSelectElement.removeAttribute("style");
if (getSelection().rangeCount>0) {
const range = getSelection().getRangeAt(0)
const range = getSelection().getRangeAt(0);
if (nodeElement.contains(range.startContainer)) {
range.insertNode(document.createElement("wbr"))
range.insertNode(document.createElement("wbr"));
}
}
const oldHTML = nodeElement.outerHTML;

View file

@ -109,7 +109,7 @@ export const openSearchAsset = (element: Element, isStick: boolean) => {
assetInputEvent(element, localSearch);
});
searchInputElement.addEventListener("blur", () => {
saveAssetKeyList(searchInputElement)
saveAssetKeyList(searchInputElement);
});
assetInputEvent(element, localSearch);
addClearButton({

View file

@ -246,4 +246,4 @@ export const saveAssetKeyList = (inputElement:HTMLInputElement) => {
window.siyuan.storage[Constants.LOCAL_SEARCHASSET].k = inputElement.value;
window.siyuan.storage[Constants.LOCAL_SEARCHASSET].keys = list;
setStorageVal(Constants.LOCAL_SEARCHASSET, window.siyuan.storage[Constants.LOCAL_SEARCHASSET]);
}
};

View file

@ -324,7 +324,7 @@ export const movePathTo = (cb: (toPath: string[], toNotebook: string[]) => void,
x: rect.left,
y: rect.bottom
});
}
};
inputEvent();
inputElement.addEventListener("compositionend", (event: InputEvent) => {
inputEvent(event);
@ -357,7 +357,7 @@ export const movePathTo = (cb: (toPath: string[], toNotebook: string[]) => void,
return;
}
if (window.siyuan.menus.menu.element.getAttribute("data-name") === "move-path-history") {
return
return;
}
const currentPanelElement = searchListElement.classList.contains("fn__none") ? searchTreeElement : searchListElement;
const currentItemElements = currentPanelElement.querySelectorAll(".b3-list-item--focus");