Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:sparkles: fix https://github.com/siyuan-note/insider/issues/1045

Vanessaa7a77c4ebb44
diff --git a/app/src/protyle/toolbar/Font.ts b/app/src/protyle/toolbar/Font.ts
index 38ee4d3f21..fe214debe0 100644
--- a/app/src/protyle/toolbar/Font.ts
+++ b/app/src/protyle/toolbar/Font.ts
@@ -51,9 +51,6 @@ export const fontMenu = (protyle: IProtyle) => {
lastFonts.forEach((item: string) => {
const lastFontStatus = item.split(Constants.ZWSP);
switch (lastFontStatus[0]) {
- case "remove":
- lastColorHTML += `<button style="margin-right: 4px" data-type="remove" class="b3-button--outline b3-button b3-button--small">${window.siyuan.languages.clearFontStyle}</button>`;
- break;
case "color":
lastColorHTML += `<button class="b3-color__square" data-type="color" style="background-color:${lastFontStatus[1]}"></button>`;
break;
@@ -82,10 +79,6 @@ export const fontMenu = (protyle: IProtyle) => {
<div class="fn__flex">
<button data-type="style2" class="protyle-font__style" style="-webkit-text-stroke: 0.2px var(--b3-theme-on-background);-webkit-text-fill-color : transparent;">${window.siyuan.languages.hollow}</button>
<button data-type="style4" class="protyle-font__style" style="text-shadow: 1px 1px var(--b3-border-color), 2px 2px var(--b3-border-color), 3px 3px var(--b3-border-color), 4px 4px var(--b3-border-color)">${window.siyuan.languages.shadow}</button>
- <span class="fn__space fn__flex-1"></span>
- <button data-type="remove" class="b3-button--outline b3-button b3-button--small">
- ${window.siyuan.languages.clearFontStyle}
- </button>
</div>`;
element.addEventListener(getEventName(), function (event: Event) {
let target = event.target as HTMLElement;
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index c4adf5a152..edb142023d 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -537,7 +537,8 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
if (previousSibling && previousSibling.nodeType !== 3 && previousSibling.getAttribute("data-type").indexOf("inline-math") > -1) {
protyle.toolbar.showRender(protyle, previousSibling);
return;
- } else if (!previousSibling && range.startContainer.parentElement.previousSibling.isSameNode(range.startContainer.parentElement.previousElementSibling) &&
+ } else if (!previousSibling &&
+ range.startContainer.parentElement.previousSibling && range.startContainer.parentElement.previousSibling.isSameNode(range.startContainer.parentElement.previousElementSibling) &&
range.startContainer.parentElement.previousElementSibling.getAttribute("data-type").indexOf("inline-math") > -1) {
protyle.toolbar.showRender(protyle, range.startContainer.parentElement.previousElementSibling);
return;