This commit is contained in:
Vanessa 2024-11-14 23:21:55 +08:00
parent 4670092d22
commit cb2560ffda
6 changed files with 22 additions and 23 deletions

View file

@ -732,7 +732,7 @@ export abstract class Constants {
"tag",
"inline-math",
"inline-memo",
]
];
// Google Analytics 事件
public static readonly ANALYTICS_EVT_ON_GET_CONFIG: string = "siyuan.onGetConfig";

View file

@ -201,7 +201,7 @@ const genWeekdayOptions = (lang: string, weekdayType: string) => {
"3": ["Sunday", "星期日", "星期日"],
"4": ["SUNDAY", "星期天", "星期天"],
};
let currentLang = 0
let currentLang = 0;
if (lang === "") {
lang = window.siyuan.config.lang;
}
@ -213,8 +213,8 @@ const genWeekdayOptions = (lang: string, weekdayType: string) => {
return `<option value="1" ${weekdayType === "1" ? " selected" : ""}>${dynamicWeekdayLang[1][currentLang]}</option>
<option value="2" ${weekdayType === "2" ? " selected" : ""}>${dynamicWeekdayLang[2][currentLang]}</option>
<option value="3" ${weekdayType === "3" ? " selected" : ""}>${dynamicWeekdayLang[3][currentLang]}</option>
<option value="4" ${weekdayType === "4" ? " selected" : ""}>${dynamicWeekdayLang[4][currentLang]}</option>`
}
<option value="4" ${weekdayType === "4" ? " selected" : ""}>${dynamicWeekdayLang[4][currentLang]}</option>`;
};
export const openEmojiPanel = (id: string, type: "doc" | "notebook" | "av", position: IPosition, avCB?: (emoji: string) => void, dynamicImgElement?: HTMLElement) => {
if (type !== "av") {
@ -235,7 +235,7 @@ export const openEmojiPanel = (id: string, type: "doc" | "notebook" | "av", posi
if (dynamicImgElement && dynamicImgElement.getAttribute("src").startsWith(dynamicURL)) {
const dynamicCurrentUrl = new URLSearchParams(dynamicImgElement.getAttribute("src").replace(dynamicURL, ""));
dynamicCurrentObj.color = dynamicCurrentUrl.get("color") || "#d23f31";
if (!dynamicCurrentObj.color.startsWith('#')) {
if (!dynamicCurrentObj.color.startsWith("#")) {
dynamicCurrentObj.color = "#" + dynamicCurrentObj.color;
}
dynamicCurrentObj.lang = dynamicCurrentUrl.get("lang") || "";
@ -631,7 +631,7 @@ ${unicode2Emoji(emoji.unicode)}</button>`;
url.delete("lang");
}
item.setAttribute("src", dynamicURL + url.toString());
dynamicLangElements[1].innerHTML = genWeekdayOptions(dynamicLangElements[0].value, dynamicLangElements[1].value)
dynamicLangElements[1].innerHTML = genWeekdayOptions(dynamicLangElements[0].value, dynamicLangElements[1].value);
});
});
dynamicLangElements[1].addEventListener("change", () => {

View file

@ -1716,9 +1716,9 @@ export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => {
label: window.siyuan.languages.copy,
icon: "iconCopy",
click() {
const range = document.createRange()
const range = document.createRange();
range.selectNode(tagElement);
focusByRange(range)
focusByRange(range);
document.execCommand("copy");
}
}).element);
@ -1726,9 +1726,9 @@ export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => {
label: window.siyuan.languages.cut,
icon: "iconCut",
click() {
const range = document.createRange()
const range = document.createRange();
range.selectNode(tagElement);
focusByRange(range)
focusByRange(range);
document.execCommand("cut");
}
}).element);
@ -1780,9 +1780,9 @@ export const inlineMathMenu = (protyle: IProtyle, element: Element) => {
label: window.siyuan.languages.copy,
icon: "iconCopy",
click() {
const range = document.createRange()
const range = document.createRange();
range.selectNode(element);
focusByRange(range)
focusByRange(range);
document.execCommand("copy");
}
}).element);
@ -1791,9 +1791,9 @@ export const inlineMathMenu = (protyle: IProtyle, element: Element) => {
icon: "iconCut",
label: window.siyuan.languages.cut,
click() {
const range = document.createRange()
const range = document.createRange();
range.selectNode(element);
focusByRange(range)
focusByRange(range);
document.execCommand("cut");
}
}).element);

View file

@ -669,13 +669,13 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va
if (!item) {
return;
}
let hasSameContent = false
let hasSameContent = false;
oldValue.mSelect.find((mSelectItem) => {
if (mSelectItem.content === item) {
hasSameContent = true
return true
hasSameContent = true;
return true;
}
})
});
if (hasSameContent) {
return;
}
@ -683,8 +683,8 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va
newMSelectValue.push({
content: item,
color: colorIndex.toString()
})
})
});
});
value = oldValue.mSelect.concat(newMSelectValue);
}
}

View file

@ -1,7 +1,6 @@
import {Constants} from "../../constants";
import {merge} from "./merge";
import {hintEmbed, hintRef, hintSlash, hintTag} from "../hint/extend";
import {isMobile} from "../../util/functions";
import {toolbarKeyToMenu} from "../toolbar/util";
export class Options {

View file

@ -194,7 +194,7 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:
} else if (cellsElement.length > 0) {
if (cellsElement.length > 1) {
// 选择多个单元格时,逐行填充
let rowIndex = 0
let rowIndex = 0;
text.split("\n").find((row) => {
if (!row) {
return false;
@ -205,7 +205,7 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:
} else {
return true;
}
})
});
} else {
updateCellsValue(protyle, blockElement as HTMLElement, text, cellsElement, columns, html);
}