This commit is contained in:
Vanessa 2024-01-29 15:44:18 +08:00
parent c8bb337ede
commit 2a8f8abc8d
11 changed files with 23 additions and 23 deletions

View File

@ -634,7 +634,7 @@ export const bazaar = {
} catch (e) { } catch (e) {
console.error("destroyTheme error: " + e); console.error("destroyTheme error: " + e);
} }
window.siyuan.config.appearance = response.data.appearance window.siyuan.config.appearance = response.data.appearance;
loadAssets(window.siyuan.config.appearance); loadAssets(window.siyuan.config.appearance);
} else { } else {
exportLayout({ exportLayout({
@ -796,7 +796,7 @@ export const bazaar = {
} catch (e) { } catch (e) {
console.error("destroyTheme error: " + e); console.error("destroyTheme error: " + e);
} }
window.siyuan.config.appearance = appearanceResponse.data window.siyuan.config.appearance = appearanceResponse.data;
loadAssets(window.siyuan.config.appearance); loadAssets(window.siyuan.config.appearance);
} else { } else {
exportLayout({ exportLayout({

View File

@ -188,7 +188,7 @@ export const exportImage = (id: string) => {
item.innerHTML = symbolElements[symbolElements.length - 1].innerHTML; item.innerHTML = symbolElements[symbolElements.length - 1].innerHTML;
}); });
previewElement.querySelectorAll(".img img").forEach((item: HTMLImageElement) => { previewElement.querySelectorAll(".img img").forEach((item: HTMLImageElement) => {
const imgSrc = item.getAttribute("src") const imgSrc = item.getAttribute("src");
if (imgSrc.endsWith(".svg")) { if (imgSrc.endsWith(".svg")) {
fetchGet(item.src, (response: string) => { fetchGet(item.src, (response: string) => {
item.src = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(response)))}`; item.src = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(response)))}`;

View File

@ -791,7 +791,7 @@ export class Gutter {
icon: "iconDatabase", icon: "iconDatabase",
click: () => { click: () => {
openSearchAV("", this.element, (listItemElement) => { openSearchAV("", this.element, (listItemElement) => {
const sourceIds: string[] = [] const sourceIds: string[] = [];
selectsElement.forEach(item => { selectsElement.forEach(item => {
sourceIds.push(item.getAttribute("data-node-id")); sourceIds.push(item.getAttribute("data-node-id"));
}); });

View File

@ -549,7 +549,7 @@ export const renderCellAttr = (cellElement: Element, value: IAVCellValue) => {
cellElement.setAttribute("data-detached", "true"); cellElement.setAttribute("data-detached", "true");
} }
} }
} };
export const renderCell = (cellValue: IAVCellValue) => { export const renderCell = (cellValue: IAVCellValue) => {
let text = ""; let text = "";

View File

@ -235,11 +235,11 @@ const filterItem = (listElement: Element, key: string) => {
if (item.textContent.includes(key)) { if (item.textContent.includes(key)) {
item.classList.remove("fn__none"); item.classList.remove("fn__none");
} else { } else {
item.classList.add("fn__none") item.classList.add("fn__none");
} }
} }
}) });
} };
export const bindRelationEvent = (options: { export const bindRelationEvent = (options: {
menuElement: HTMLElement, menuElement: HTMLElement,
@ -290,9 +290,9 @@ export const bindRelationEvent = (options: {
const cellRect = options.cellElements[options.cellElements.length - 1].getBoundingClientRect(); const cellRect = options.cellElements[options.cellElements.length - 1].getBoundingClientRect();
setPosition(options.menuElement, cellRect.left, cellRect.bottom, cellRect.height); setPosition(options.menuElement, cellRect.left, cellRect.bottom, cellRect.height);
options.menuElement.querySelector(".b3-menu__items .b3-menu__item").classList.add("b3-menu__item--current"); options.menuElement.querySelector(".b3-menu__items .b3-menu__item").classList.add("b3-menu__item--current");
const inputElement = options.menuElement.querySelector("input") const inputElement = options.menuElement.querySelector("input");
inputElement.focus(); inputElement.focus();
const listElement = options.menuElement.querySelector(".b3-menu__items") const listElement = options.menuElement.querySelector(".b3-menu__items");
inputElement.addEventListener("keydown", (event) => { inputElement.addEventListener("keydown", (event) => {
event.stopPropagation(); event.stopPropagation();
if (event.isComposing) { if (event.isComposing) {
@ -309,18 +309,18 @@ export const bindRelationEvent = (options: {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
} }
}) });
inputElement.addEventListener("input", (event: InputEvent) => { inputElement.addEventListener("input", (event: InputEvent) => {
if (event.isComposing) { if (event.isComposing) {
return; return;
} }
filterItem(listElement, inputElement.value); filterItem(listElement, inputElement.value);
event.stopPropagation(); event.stopPropagation();
}) });
inputElement.addEventListener("compositionend", (event) => { inputElement.addEventListener("compositionend", (event) => {
event.stopPropagation(); event.stopPropagation();
filterItem(listElement, inputElement.value); filterItem(listElement, inputElement.value);
}) });
}); });
}; };
@ -397,7 +397,7 @@ export const setRelationCell = (protyle: IProtyle, nodeElement: HTMLElement, tar
separatorElement.insertAdjacentHTML("afterend", genSelectItemHTML("empty")); separatorElement.insertAdjacentHTML("afterend", genSelectItemHTML("empty"));
} }
} }
menuElement.firstElementChild.classList.add("b3-menu__item--current") menuElement.firstElementChild.classList.add("b3-menu__item--current");
} }
updateCellsValue(protyle, nodeElement, newValue, cellElements); updateCellsValue(protyle, nodeElement, newValue, cellElements);
}; };

View File

@ -131,7 +131,7 @@ style="width: ${index === 0 ? ((parseInt(column.width || "200") + 24) + "px") :
return; return;
} }
// https://github.com/siyuan-note/siyuan/issues/10262 // https://github.com/siyuan-note/siyuan/issues/10262
let checkClass = "" let checkClass = "";
if (cell.valueType === "checkbox") { if (cell.valueType === "checkbox") {
checkClass = cell.value?.checkbox?.checked ? " av__cell-check" : " av__cell-uncheck"; checkClass = cell.value?.checkbox?.checked ? " av__cell-check" : " av__cell-uncheck";
} }

View File

@ -34,7 +34,7 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:
const avID = blockElement.dataset.avId; const avID = blockElement.dataset.avId;
const id = blockElement.dataset.nodeId; const id = blockElement.dataset.nodeId;
cellElements.forEach((item: HTMLElement, elementIndex) => { cellElements.forEach((item: HTMLElement, elementIndex) => {
let cellValue: IAVCellValue = values[elementIndex] let cellValue: IAVCellValue = values[elementIndex];
if (!cellValue) { if (!cellValue) {
return; return;
} }
@ -60,7 +60,7 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:
// 类型不能转换时就不进行替换 // 类型不能转换时就不进行替换
return; return;
} }
const content = cellValue[cellValue.type as "text"].content const content = cellValue[cellValue.type as "text"].content;
if (!content) { if (!content) {
return; return;
} }
@ -110,7 +110,7 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:
} }
return; return;
} catch (e) { } catch (e) {
console.warn("insert cell: JSON.parse error") console.warn("insert cell: JSON.parse error");
} }
} }
const text = protyle.lute.BlockDOM2EscapeMarkerContent(html); const text = protyle.lute.BlockDOM2EscapeMarkerContent(html);

View File

@ -6,7 +6,7 @@ import {lineNumberRender} from "../render/highlightRender";
import {stickyRow} from "../render/av/row"; import {stickyRow} from "../render/av/row";
export const resize = (protyle: IProtyle) => { export const resize = (protyle: IProtyle) => {
hideElements(["gutterOnly"], protyle) hideElements(["gutterOnly"], protyle);
const abs = setPadding(protyle); const abs = setPadding(protyle);
const MIN_ABS = 4; const MIN_ABS = 4;
// 不能 clearTimeout否则 split 时左侧无法 resize // 不能 clearTimeout否则 split 时左侧无法 resize

View File

@ -1301,7 +1301,7 @@ export class WYSIWYG {
} }
} else if (selectAVElement) { } else if (selectAVElement) {
const cellsValue = updateCellsValue(protyle, nodeElement); const cellsValue = updateCellsValue(protyle, nodeElement);
html = JSON.stringify(cellsValue.json) html = JSON.stringify(cellsValue.json);
textPlain = cellsValue.text; textPlain = cellsValue.text;
} else { } else {
const id = nodeElement.getAttribute("data-node-id"); const id = nodeElement.getAttribute("data-node-id");

View File

@ -315,7 +315,7 @@ export const setMode = (modeElementValue: number) => {
const updateMobileTheme = (OSTheme: string) => { const updateMobileTheme = (OSTheme: string) => {
if (isInIOS() || isInAndroid()) { if (isInIOS() || isInAndroid()) {
setTimeout(() => { setTimeout(() => {
const backgroundColor = getComputedStyle(document.body).getPropertyValue("--b3-theme-background").trim(); const backgroundColor = getComputedStyle(document.body).getPropertyValue("--b3-theme-background").trim().replace(" ", "");
let mode = window.siyuan.config.appearance.mode; let mode = window.siyuan.config.appearance.mode;
if (window.siyuan.config.appearance.modeOS) { if (window.siyuan.config.appearance.modeOS) {
if (OSTheme === "dark") { if (OSTheme === "dark") {

View File

@ -1,6 +1,6 @@
const isNormalItem = (currentHintElement: HTMLElement, className: string) => { const isNormalItem = (currentHintElement: HTMLElement, className: string) => {
return currentHintElement.classList.contains("fn__none") || !currentHintElement.classList.contains(className) return currentHintElement.classList.contains("fn__none") || !currentHintElement.classList.contains(className);
} };
export const upDownHint = (listElement: Element, event: KeyboardEvent, classActiveName = "b3-list-item--focus") => { export const upDownHint = (listElement: Element, event: KeyboardEvent, classActiveName = "b3-list-item--focus") => {
let currentHintElement: HTMLElement = listElement.querySelector("." + classActiveName); let currentHintElement: HTMLElement = listElement.querySelector("." + classActiveName);