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") { } else if (type === "remove") {
const urlPath = pdf.appConfig.file.replace(location.origin, "").substr(1); const urlPath = pdf.appConfig.file.replace(location.origin, "").substr(1);
const config = getConfig(pdf); const config = getConfig(pdf);
const id = rectElement.getAttribute("data-node-id") const id = rectElement.getAttribute("data-node-id");
delete config[id]; delete config[id];
element.querySelectorAll(`[data-node-id="${id}"]`).forEach(item => { element.querySelectorAll(`[data-node-id="${id}"]`).forEach(item => {
item.remove(); item.remove();

View file

@ -7,12 +7,12 @@ export const openModel = (obj: {
const modelElement = document.getElementById("model"); const modelElement = document.getElementById("model");
modelElement.style.transform = "translateY(0px)"; modelElement.style.transform = "translateY(0px)";
modelElement.style.zIndex = (++window.siyuan.zIndex).toString(); modelElement.style.zIndex = (++window.siyuan.zIndex).toString();
const iconElement = modelElement.querySelector(".toolbar__icon") const iconElement = modelElement.querySelector(".toolbar__icon");
if(obj.icon) { if(obj.icon) {
iconElement.classList.remove("fn__none") iconElement.classList.remove("fn__none");
iconElement.querySelector("use").setAttribute("xlink:href", "#" + obj.icon); iconElement.querySelector("use").setAttribute("xlink:href", "#" + obj.icon);
} else { } else {
iconElement.classList.add("fn__none") iconElement.classList.add("fn__none");
} }
modelElement.querySelector(".toolbar__text").innerHTML = obj.title; modelElement.querySelector(".toolbar__text").innerHTML = obj.title;
const modelMainElement = modelElement.querySelector("#modelMain") as HTMLElement; 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)) { while (target && !target.isSameNode(element)) {
const type = target.getAttribute("data-type"); const type = target.getAttribute("data-type");
if (type === "replaceHistory") { if (type === "replaceHistory") {
toggleReplaceHistory(target.nextElementSibling as HTMLInputElement) toggleReplaceHistory(target.nextElementSibling as HTMLInputElement);
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
break; break;
} else if (type === "assetHistory") { } else if (type === "assetHistory") {
toggleAssetHistory(assetsElement) toggleAssetHistory(assetsElement);
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
break; break;
@ -778,7 +778,7 @@ export const popSearch = (app: App, searchConfig?: any) => {
document.querySelector("#toolbarSearchNew").addEventListener("click", () => { document.querySelector("#toolbarSearchNew").addEventListener("click", () => {
newFileByName(app, (document.querySelector("#toolbarSearch") as HTMLInputElement).value); 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", () => { historyElement.addEventListener("click", () => {
toggleSearchHistory(document.querySelector("#model"), config, undefined); toggleSearchHistory(document.querySelector("#model"), config, undefined);
}); });
@ -811,7 +811,7 @@ const goAsset = () => {
assetInputEvent(assetsElement, localSearch); assetInputEvent(assetsElement, localSearch);
}); });
inputElement.addEventListener("blur", () => { inputElement.addEventListener("blur", () => {
saveAssetKeyList(inputElement) saveAssetKeyList(inputElement);
}); });
assetInputEvent(assetsElement, localSearch); assetInputEvent(assetsElement, localSearch);
addClearButton({ addClearButton({

View file

@ -522,7 +522,7 @@ export class Background {
k: "", k: "",
}, (response) => { }, (response) => {
let html = ""; let html = "";
const currentTags = this.getTags() const currentTags = this.getTags();
response.data.tags.forEach((item: string, index: number) => { response.data.tags.forEach((item: string, index: number) => {
html += `<div class="b3-list-item b3-list-item--narrow${index === 0 ? " b3-list-item--focus" : ""}"> html += `<div class="b3-list-item b3-list-item--narrow${index === 0 ? " b3-list-item--focus" : ""}">
<div class="fn__flex-1">${item}</div> <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) => { searchInputElement.addEventListener("compositionstart", (event: KeyboardEvent) => {
event.stopPropagation(); event.stopPropagation();
}) });
searchInputElement.addEventListener("input", (event: KeyboardEvent) => { searchInputElement.addEventListener("input", (event: KeyboardEvent) => {
event.stopPropagation(); event.stopPropagation();
if (event.isComposing) { if (event.isComposing) {

View file

@ -318,7 +318,7 @@ export const setColOption = (protyle: IProtyle, data: IAV, target: HTMLElement,
} }
}); });
menu.addSeparator(); 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 => { 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>`; 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 type = pathPosix().extname(key).toLowerCase();
const filename = protyle.options.upload.filename(key); const filename = protyle.options.upload.filename(key);
const name = filename.substring(0, filename.length - type.length); 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({ avAssets.push({
type: Constants.SIYUAN_ASSETS_IMAGE.includes(type) ? "image" : "file", type: Constants.SIYUAN_ASSETS_IMAGE.includes(type) ? "image" : "file",
content: path, content: path,

View file

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

View file

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

View file

@ -109,7 +109,7 @@ export const openSearchAsset = (element: Element, isStick: boolean) => {
assetInputEvent(element, localSearch); assetInputEvent(element, localSearch);
}); });
searchInputElement.addEventListener("blur", () => { searchInputElement.addEventListener("blur", () => {
saveAssetKeyList(searchInputElement) saveAssetKeyList(searchInputElement);
}); });
assetInputEvent(element, localSearch); assetInputEvent(element, localSearch);
addClearButton({ 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].k = inputElement.value;
window.siyuan.storage[Constants.LOCAL_SEARCHASSET].keys = list; window.siyuan.storage[Constants.LOCAL_SEARCHASSET].keys = list;
setStorageVal(Constants.LOCAL_SEARCHASSET, window.siyuan.storage[Constants.LOCAL_SEARCHASSET]); 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, x: rect.left,
y: rect.bottom y: rect.bottom
}); });
} };
inputEvent(); inputEvent();
inputElement.addEventListener("compositionend", (event: InputEvent) => { inputElement.addEventListener("compositionend", (event: InputEvent) => {
inputEvent(event); inputEvent(event);
@ -357,7 +357,7 @@ export const movePathTo = (cb: (toPath: string[], toNotebook: string[]) => void,
return; return;
} }
if (window.siyuan.menus.menu.element.getAttribute("data-name") === "move-path-history") { if (window.siyuan.menus.menu.element.getAttribute("data-name") === "move-path-history") {
return return;
} }
const currentPanelElement = searchListElement.classList.contains("fn__none") ? searchTreeElement : searchListElement; const currentPanelElement = searchListElement.classList.contains("fn__none") ? searchTreeElement : searchListElement;
const currentItemElements = currentPanelElement.querySelectorAll(".b3-list-item--focus"); const currentItemElements = currentPanelElement.querySelectorAll(".b3-list-item--focus");