mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 10:00:13 +01:00
🚨
This commit is contained in:
parent
4e5a195290
commit
36c69ef9fc
11 changed files with 19 additions and 30 deletions
|
|
@ -214,7 +214,7 @@ export const appearance = {
|
||||||
_send: () => {
|
_send: () => {
|
||||||
const themeLight = (appearance.element.querySelector("#themeLight") as HTMLSelectElement).value;
|
const themeLight = (appearance.element.querySelector("#themeLight") as HTMLSelectElement).value;
|
||||||
const themeDark = (appearance.element.querySelector("#themeDark") as HTMLSelectElement).value;
|
const themeDark = (appearance.element.querySelector("#themeDark") as HTMLSelectElement).value;
|
||||||
const modeElementValue = parseInt((appearance.element.querySelector("#mode") as HTMLSelectElement).value)
|
const modeElementValue = parseInt((appearance.element.querySelector("#mode") as HTMLSelectElement).value);
|
||||||
fetchPost("/api/setting/setAppearance", {
|
fetchPost("/api/setting/setAppearance", {
|
||||||
icon: (appearance.element.querySelector("#icon") as HTMLSelectElement).value,
|
icon: (appearance.element.querySelector("#icon") as HTMLSelectElement).value,
|
||||||
mode: modeElementValue === 2 ? window.siyuan.config.appearance.mode : modeElementValue,
|
mode: modeElementValue === 2 ? window.siyuan.config.appearance.mode : modeElementValue,
|
||||||
|
|
@ -320,15 +320,15 @@ export const appearance = {
|
||||||
}
|
}
|
||||||
const themeLightElement = appearance.element.querySelector("#themeLight") as HTMLSelectElement;
|
const themeLightElement = appearance.element.querySelector("#themeLight") as HTMLSelectElement;
|
||||||
if (themeLightElement) {
|
if (themeLightElement) {
|
||||||
themeLightElement.innerHTML = genOptions(window.siyuan.config.appearance.lightThemes, window.siyuan.config.appearance.themeLight)
|
themeLightElement.innerHTML = genOptions(window.siyuan.config.appearance.lightThemes, window.siyuan.config.appearance.themeLight);
|
||||||
}
|
}
|
||||||
const themeDarkElement = appearance.element.querySelector("#themeDark") as HTMLSelectElement;
|
const themeDarkElement = appearance.element.querySelector("#themeDark") as HTMLSelectElement;
|
||||||
if (themeDarkElement) {
|
if (themeDarkElement) {
|
||||||
themeDarkElement.innerHTML = genOptions(window.siyuan.config.appearance.darkThemes, window.siyuan.config.appearance.themeDark)
|
themeDarkElement.innerHTML = genOptions(window.siyuan.config.appearance.darkThemes, window.siyuan.config.appearance.themeDark);
|
||||||
}
|
}
|
||||||
const iconElement = appearance.element.querySelector("#icon") as HTMLSelectElement;
|
const iconElement = appearance.element.querySelector("#icon") as HTMLSelectElement;
|
||||||
if (iconElement) {
|
if (iconElement) {
|
||||||
iconElement.innerHTML = genOptions(window.siyuan.config.appearance.icons, window.siyuan.config.appearance.icon)
|
iconElement.innerHTML = genOptions(window.siyuan.config.appearance.icons, window.siyuan.config.appearance.icon);
|
||||||
}
|
}
|
||||||
if (data.customCSS) {
|
if (data.customCSS) {
|
||||||
fetchPost("/api/setting/getCustomCSS", {
|
fetchPost("/api/setting/getCustomCSS", {
|
||||||
|
|
|
||||||
|
|
@ -337,9 +337,9 @@ export const bazaar = {
|
||||||
const type = target.getAttribute("data-type");
|
const type = target.getAttribute("data-type");
|
||||||
if (type === "open") {
|
if (type === "open") {
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
const dirName = target.parentElement.parentElement.getAttribute("data-bazaar")
|
const dirName = target.parentElement.parentElement.getAttribute("data-bazaar");
|
||||||
if (dirName === "icons" || dirName === "themes") {
|
if (dirName === "icons" || dirName === "themes") {
|
||||||
shell.openPath(path.join(window.siyuan.config.system.confDir, "appearance", dirName, target.parentElement.getAttribute("data-name")))
|
shell.openPath(path.join(window.siyuan.config.system.confDir, "appearance", dirName, target.parentElement.getAttribute("data-name")));
|
||||||
} else {
|
} else {
|
||||||
shell.openPath(path.join(window.siyuan.config.system.dataDir, dirName, target.parentElement.getAttribute("data-name")));
|
shell.openPath(path.join(window.siyuan.config.system.dataDir, dirName, target.parentElement.getAttribute("data-name")));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ export const initConfigSearch = (element: HTMLElement) => {
|
||||||
configIndex.map((item, index) => {
|
configIndex.map((item, index) => {
|
||||||
item.map((subItem) => {
|
item.map((subItem) => {
|
||||||
if (!subItem) {
|
if (!subItem) {
|
||||||
console.warn("Search config miss language: ", item, index)
|
console.warn("Search config miss language: ", item, index);
|
||||||
}
|
}
|
||||||
if (subItem && (inputValue.toLowerCase().indexOf(subItem) > -1 || subItem.toLowerCase().indexOf(inputValue) > -1)) {
|
if (subItem && (inputValue.toLowerCase().indexOf(subItem) > -1 || subItem.toLowerCase().indexOf(inputValue) > -1)) {
|
||||||
indexList.push(index);
|
indexList.push(index);
|
||||||
|
|
|
||||||
|
|
@ -383,7 +383,7 @@ const renderPDF = (id: string) => {
|
||||||
});
|
});
|
||||||
fetchPost("/api/export/exportTempContent", {content: html}, (response) => {
|
fetchPost("/api/export/exportTempContent", {content: html}, (response) => {
|
||||||
window.siyuan.printWin.loadURL(response.data.url);
|
window.siyuan.printWin.loadURL(response.data.url);
|
||||||
})
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getExportPath = (option: { type: string, id: string }, removeAssets?: boolean) => {
|
const getExportPath = (option: { type: string, id: string }, removeAssets?: boolean) => {
|
||||||
|
|
|
||||||
|
|
@ -379,7 +379,7 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
|
||||||
if (nodeElement) {
|
if (nodeElement) {
|
||||||
id = nodeElement.getAttribute("data-node-id");
|
id = nodeElement.getAttribute("data-node-id");
|
||||||
}
|
}
|
||||||
let html = nodeElement.outerHTML;
|
const html = nodeElement.outerHTML;
|
||||||
// 自顶向下法新建文档后光标定位问题 https://github.com/siyuan-note/siyuan/issues/299
|
// 自顶向下法新建文档后光标定位问题 https://github.com/siyuan-note/siyuan/issues/299
|
||||||
// QQ 拼音输入法自动补全需移除补全内容 https://github.com/siyuan-note/siyuan/issues/320
|
// QQ 拼音输入法自动补全需移除补全内容 https://github.com/siyuan-note/siyuan/issues/320
|
||||||
// 前后有标记符的情况 https://github.com/siyuan-note/siyuan/issues/2511
|
// 前后有标记符的情况 https://github.com/siyuan-note/siyuan/issues/2511
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ export const setFontStyle = (textElement: HTMLElement, textOption: ITextOption)
|
||||||
textElement.setAttribute("data-id", blockRefData[0]);
|
textElement.setAttribute("data-id", blockRefData[0]);
|
||||||
textElement.setAttribute("data-subtype", blockRefData[1]);
|
textElement.setAttribute("data-subtype", blockRefData[1]);
|
||||||
textElement.innerText = blockRefData[2];
|
textElement.innerText = blockRefData[2];
|
||||||
}
|
};
|
||||||
|
|
||||||
if (textOption) {
|
if (textOption) {
|
||||||
switch (textOption.type) {
|
switch (textOption.type) {
|
||||||
|
|
@ -214,7 +214,7 @@ export const hasSameTextStyle = (currentElement: HTMLElement, sideElement: HTMLE
|
||||||
currentElement.getAttribute("data-subtype") === sideElement.getAttribute("data-subtype") &&
|
currentElement.getAttribute("data-subtype") === sideElement.getAttribute("data-subtype") &&
|
||||||
currentElement.textContent === sideElement.textContent;
|
currentElement.textContent === sideElement.textContent;
|
||||||
}
|
}
|
||||||
const blockRefData = textObj.color.split(Constants.ZWSP)
|
const blockRefData = textObj.color.split(Constants.ZWSP);
|
||||||
return blockRefData[0] === sideElement.getAttribute("data-id") &&
|
return blockRefData[0] === sideElement.getAttribute("data-id") &&
|
||||||
blockRefData[1] === sideElement.getAttribute("data-subtype") &&
|
blockRefData[1] === sideElement.getAttribute("data-subtype") &&
|
||||||
blockRefData[2] === sideElement.textContent;
|
blockRefData[2] === sideElement.textContent;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
import {ToolbarItem} from "./ToolbarItem";
|
import {ToolbarItem} from "./ToolbarItem";
|
||||||
import * as dayjs from "dayjs";
|
|
||||||
import {updateTransaction} from "../wysiwyg/transaction";
|
|
||||||
import {hasClosestBlock, hasClosestByAttribute} from "../util/hasClosest";
|
import {hasClosestBlock, hasClosestByAttribute} from "../util/hasClosest";
|
||||||
import {hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock";
|
import {hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock";
|
||||||
import {mathRender} from "../markdown/mathRender";
|
|
||||||
import {fixTableRange, focusByRange} from "../util/selection";
|
|
||||||
|
|
||||||
export class InlineMath extends ToolbarItem {
|
export class InlineMath extends ToolbarItem {
|
||||||
public element: HTMLElement;
|
public element: HTMLElement;
|
||||||
|
|
@ -24,7 +20,7 @@ export class InlineMath extends ToolbarItem {
|
||||||
if (!mathElement && range.startContainer.nodeType !== 3) {
|
if (!mathElement && range.startContainer.nodeType !== 3) {
|
||||||
const previousSibling = hasPreviousSibling(range.startContainer.childNodes[range.startOffset]) as HTMLElement;
|
const previousSibling = hasPreviousSibling(range.startContainer.childNodes[range.startOffset]) as HTMLElement;
|
||||||
if (previousSibling && previousSibling.getAttribute("data-type").indexOf("inline-math") > -1) {
|
if (previousSibling && previousSibling.getAttribute("data-type").indexOf("inline-math") > -1) {
|
||||||
mathElement = previousSibling
|
mathElement = previousSibling;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!mathElement && range.startOffset === range.startContainer.textContent.length && range.startContainer.nodeType === 3) {
|
if (!mathElement && range.startOffset === range.startContainer.textContent.length && range.startContainer.nodeType === 3) {
|
||||||
|
|
@ -34,9 +30,9 @@ export class InlineMath extends ToolbarItem {
|
||||||
(item.nodeType == 3 && item.textContent === "")) {
|
(item.nodeType == 3 && item.textContent === "")) {
|
||||||
// 是否仅选中数学公式
|
// 是否仅选中数学公式
|
||||||
} else {
|
} else {
|
||||||
isMath = false
|
isMath = false;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
if (isMath) {
|
if (isMath) {
|
||||||
const nextSibling = hasNextSibling(range.startContainer) as HTMLElement;
|
const nextSibling = hasNextSibling(range.startContainer) as HTMLElement;
|
||||||
if (nextSibling && nextSibling.nodeType !== 3 && nextSibling.getAttribute("data-type").indexOf("inline-math") > -1) {
|
if (nextSibling && nextSibling.nodeType !== 3 && nextSibling.getAttribute("data-type").indexOf("inline-math") > -1) {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
import {ToolbarItem} from "./ToolbarItem";
|
import {ToolbarItem} from "./ToolbarItem";
|
||||||
import {hasClosestBlock, hasClosestByAttribute} from "../util/hasClosest";
|
import {hasClosestBlock, hasClosestByAttribute} from "../util/hasClosest";
|
||||||
import {hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock";
|
|
||||||
import {fixTableRange} from "../util/selection";
|
|
||||||
import {isArrayEqual} from "../../util/functions";
|
|
||||||
|
|
||||||
export class InlineMemo extends ToolbarItem {
|
export class InlineMemo extends ToolbarItem {
|
||||||
public element: HTMLElement;
|
public element: HTMLElement;
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,7 @@
|
||||||
import {ToolbarItem} from "./ToolbarItem";
|
import {ToolbarItem} from "./ToolbarItem";
|
||||||
import {linkMenu} from "../../menus/protyle";
|
import {linkMenu} from "../../menus/protyle";
|
||||||
import {Constants} from "../../constants";
|
|
||||||
import * as dayjs from "dayjs";
|
|
||||||
import {updateTransaction} from "../wysiwyg/transaction";
|
|
||||||
import {hasClosestBlock, hasClosestByAttribute} from "../util/hasClosest";
|
import {hasClosestBlock, hasClosestByAttribute} from "../util/hasClosest";
|
||||||
import {hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock";
|
import {focusByRange, focusByWbr} from "../util/selection";
|
||||||
import {fixTableRange, focusByRange, focusByWbr} from "../util/selection";
|
|
||||||
|
|
||||||
export class Link extends ToolbarItem {
|
export class Link extends ToolbarItem {
|
||||||
public element: HTMLElement;
|
public element: HTMLElement;
|
||||||
|
|
@ -28,7 +24,7 @@ export class Link extends ToolbarItem {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const rangeString = range.toString().trim()
|
const rangeString = range.toString().trim();
|
||||||
let dataHref = "";
|
let dataHref = "";
|
||||||
try {
|
try {
|
||||||
const clipText = await navigator.clipboard.readText();
|
const clipText = await navigator.clipboard.readText();
|
||||||
|
|
|
||||||
|
|
@ -486,7 +486,7 @@ export class Toolbar {
|
||||||
} else if (item.tagName !== "BR") {
|
} else if (item.tagName !== "BR") {
|
||||||
item.setAttribute("data-type", types.join(" "));
|
item.setAttribute("data-type", types.join(" "));
|
||||||
item.querySelectorAll("span").forEach(backslashItem => {
|
item.querySelectorAll("span").forEach(backslashItem => {
|
||||||
backslashItem.remove()
|
backslashItem.remove();
|
||||||
});
|
});
|
||||||
setFontStyle(item, textObj);
|
setFontStyle(item, textObj);
|
||||||
newNodes.push(item);
|
newNodes.push(item);
|
||||||
|
|
@ -598,7 +598,7 @@ export class Toolbar {
|
||||||
} else if (type === "block-ref") {
|
} else if (type === "block-ref") {
|
||||||
this.range.collapse(false);
|
this.range.collapse(false);
|
||||||
} else if (type === "a") {
|
} else if (type === "a") {
|
||||||
const aElement = newNodes[0] as HTMLElement
|
const aElement = newNodes[0] as HTMLElement;
|
||||||
if (aElement.textContent.replace(Constants.ZWSP, "") === "" || !aElement.getAttribute("data-href")) {
|
if (aElement.textContent.replace(Constants.ZWSP, "") === "" || !aElement.getAttribute("data-href")) {
|
||||||
linkMenu(protyle, aElement, aElement.getAttribute("data-href") ? true : false);
|
linkMenu(protyle, aElement, aElement.getAttribute("data-href") ? true : false);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -688,7 +688,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
previousSibling.classList.add("img--select");
|
previousSibling.classList.add("img--select");
|
||||||
} else if (previousSibling.getAttribute("data-type")?.indexOf("inline-math") > -1) {
|
} else if (previousSibling.getAttribute("data-type")?.indexOf("inline-math") > -1) {
|
||||||
// 数学公式相邻中有 zwsp,无法删除
|
// 数学公式相邻中有 zwsp,无法删除
|
||||||
previousSibling.after(document.createElement("wbr"))
|
previousSibling.after(document.createElement("wbr"));
|
||||||
const oldHTML = nodeElement.outerHTML;
|
const oldHTML = nodeElement.outerHTML;
|
||||||
range.startContainer.textContent = "";
|
range.startContainer.textContent = "";
|
||||||
previousSibling.remove();
|
previousSibling.remove();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue