This commit is contained in:
Vanessa 2024-03-29 09:47:40 +08:00
parent 15f1510d6c
commit 13332781c9
7 changed files with 13 additions and 13 deletions

View File

@ -1041,7 +1041,7 @@ app.whenReady().then(() => {
return; return;
} }
if (globalShortcut.isRegistered(shortcut)) { if (globalShortcut.isRegistered(shortcut)) {
globalShortcut.unregister(shortcut) globalShortcut.unregister(shortcut);
} }
if (index === 0) { if (index === 0) {
globalShortcut.register(shortcut, () => { globalShortcut.register(shortcut, () => {

View File

@ -186,7 +186,7 @@ export const keymap = {
}, },
_setkeymap(app: App) { _setkeymap(app: App) {
const data: Config.IKeymap = JSON.parse(JSON.stringify(Constants.SIYUAN_KEYMAP)); const data: Config.IKeymap = JSON.parse(JSON.stringify(Constants.SIYUAN_KEYMAP));
const oldToggleWin = window.siyuan.config.keymap.general.toggleWin.custom const oldToggleWin = window.siyuan.config.keymap.general.toggleWin.custom;
keymap.element.querySelectorAll("label.b3-list-item input").forEach((item) => { keymap.element.querySelectorAll("label.b3-list-item input").forEach((item) => {
const keys = item.getAttribute("data-key").split(Constants.ZWSP); const keys = item.getAttribute("data-key").split(Constants.ZWSP);
const newHotkey = item.getAttribute("data-value"); const newHotkey = item.getAttribute("data-value");

View File

@ -171,7 +171,7 @@ export const openSnippets = () => {
}, (searchResponse) => { }, (searchResponse) => {
dialog.element.querySelectorAll(`.fn__flex-1 > div > [data-type="${inputItem.dataset.type}"]`).forEach((snipeetPanel: Element) => { dialog.element.querySelectorAll(`.fn__flex-1 > div > [data-type="${inputItem.dataset.type}"]`).forEach((snipeetPanel: Element) => {
snipeetPanel.classList.add("fn__none"); snipeetPanel.classList.add("fn__none");
}) });
searchResponse.data.snippets.forEach((snippetItem: ISnippet) => { searchResponse.data.snippets.forEach((snippetItem: ISnippet) => {
if (snippetItem.type === inputItem.dataset.type) { if (snippetItem.type === inputItem.dataset.type) {
dialog.element.querySelector(`[data-id="${snippetItem.id}"]`).classList.remove("fn__none"); dialog.element.querySelector(`[data-id="${snippetItem.id}"]`).classList.remove("fn__none");
@ -180,7 +180,7 @@ export const openSnippets = () => {
}); });
} }
}); });
}) });
}); });
}; };

View File

@ -98,7 +98,7 @@ const editLayout = (layoutName?: string) => {
}); });
dialog.destroy(); dialog.destroy();
}); });
} };
const togglePinDock = (dock: Dock, icon: string) => { const togglePinDock = (dock: Dock, icon: string) => {
return { return {

View File

@ -331,7 +331,7 @@ ${window.siyuan.languages.insertRowBefore.replace("${x}", '<span class="fn__spac
} }
insertRows(blockElement, protyle, parseInt(inputElement.value), rowElements[0].previousElementSibling.getAttribute("data-id")); insertRows(blockElement, protyle, parseInt(inputElement.value), rowElements[0].previousElementSibling.getAttribute("data-id"));
menu.close(); menu.close();
}) });
inputElement.addEventListener("keydown", (event: KeyboardEvent) => { inputElement.addEventListener("keydown", (event: KeyboardEvent) => {
if (!event.isComposing && event.key === "Enter") { if (!event.isComposing && event.key === "Enter") {
insertRows(blockElement, protyle, parseInt(inputElement.value), rowElements[0].previousElementSibling.getAttribute("data-id")); insertRows(blockElement, protyle, parseInt(inputElement.value), rowElements[0].previousElementSibling.getAttribute("data-id"));

View File

@ -15,11 +15,11 @@ import {hintRef} from "../../hint/extend";
const renderCellURL = (urlContent: string) => { const renderCellURL = (urlContent: string) => {
let host = urlContent; let host = urlContent;
let suffix = "" let suffix = "";
try { try {
const urlObj = new URL(urlContent); const urlObj = new URL(urlContent);
host = urlObj.host; host = urlObj.host;
suffix = urlObj.href.replace(urlObj.origin, "") suffix = urlObj.href.replace(urlObj.origin, "");
if (suffix.length > 12) { if (suffix.length > 12) {
suffix = suffix.substring(0, 4) + "..." + suffix.substring(suffix.length - 6); suffix = suffix.substring(0, 4) + "..." + suffix.substring(suffix.length - 6);
} }
@ -404,9 +404,9 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type
addDragFill(cellElements[0]); addDragFill(cellElements[0]);
let textPlain = inputElement.value; let textPlain = inputElement.value;
if (isDynamicRef(textPlain)) { if (isDynamicRef(textPlain)) {
textPlain = textPlain.substring(2, 22 + 2) textPlain = textPlain.substring(2, 22 + 2);
} else { } else {
textPlain = textPlain.substring(2) textPlain = textPlain.substring(2);
} }
hintRef(textPlain, protyle, "av"); hintRef(textPlain, protyle, "av");
avMaskElement?.remove(); avMaskElement?.remove();
@ -630,7 +630,7 @@ export const renderCell = (cellValue: IAVCellValue) => {
} else if (["email", "phone"].includes(cellValue.type)) { } else if (["email", "phone"].includes(cellValue.type)) {
text = `<span class="av__celltext av__celltext--url" data-type="${cellValue.type}">${cellValue ? cellValue[cellValue.type as "email"].content : ""}</span>`; text = `<span class="av__celltext av__celltext--url" data-type="${cellValue.type}">${cellValue ? cellValue[cellValue.type as "email"].content : ""}</span>`;
} else if ("url" === cellValue.type) { } else if ("url" === cellValue.type) {
text = renderCellURL(cellValue?.url?.content || "") text = renderCellURL(cellValue?.url?.content || "");
} else if (cellValue.type === "block") { } else if (cellValue.type === "block") {
if (cellValue?.isDetached) { if (cellValue?.isDetached) {
text = `<span class="av__celltext">${cellValue.block.content || ""}</span> text = `<span class="av__celltext">${cellValue.block.content || ""}</span>
@ -709,7 +709,7 @@ const renderRollup = (cellValue: IAVCellValue) => {
text = `<span class="av__celltext av__celltext--url" data-type="${cellValue.type}">${emailContent}</span>`; text = `<span class="av__celltext av__celltext--url" data-type="${cellValue.type}">${emailContent}</span>`;
} }
} else if ("url" === cellValue.type) { } else if ("url" === cellValue.type) {
const urlContent = cellValue?.url?.content || "" const urlContent = cellValue?.url?.content || "";
if (urlContent) { if (urlContent) {
text = renderCellURL(urlContent); text = renderCellURL(urlContent);
} }

View File

@ -137,7 +137,7 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:
} }
const contenteditableElement = getContenteditableElement(tempElement.content.firstElementChild); const contenteditableElement = getContenteditableElement(tempElement.content.firstElementChild);
if (contenteditableElement && contenteditableElement.childNodes.length === 1 && contenteditableElement.firstElementChild?.getAttribute("data-type") === "block-ref") { if (contenteditableElement && contenteditableElement.childNodes.length === 1 && contenteditableElement.firstElementChild?.getAttribute("data-type") === "block-ref") {
const selectCellElement = blockElement.querySelector(".av__cell--select") as HTMLElement const selectCellElement = blockElement.querySelector(".av__cell--select") as HTMLElement;
if (selectCellElement) { if (selectCellElement) {
const avID = blockElement.dataset.avId; const avID = blockElement.dataset.avId;
const sourceId = contenteditableElement.firstElementChild.getAttribute("data-id"); const sourceId = contenteditableElement.firstElementChild.getAttribute("data-id");