🎨 Supports disabling Markdown ~~ syntax input https://github.com/siyuan-note/siyuan/issues/12641

This commit is contained in:
Daniel 2024-10-20 17:40:26 +08:00
parent 920794b803
commit 1ab7e16888
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
18 changed files with 84 additions and 32 deletions

View file

@ -319,6 +319,14 @@ export const editor = {
</div>
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="editorMarkdownInlineMath" type="checkbox"${window.siyuan.config.editor.markdown.inlineMath ? " checked" : ""}/>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.editorMarkdownInlineStrikethrough}
<div class="b3-label__text">${window.siyuan.languages.editorMarkdownInlineStrikethroughTip}</div>
</div>
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="editorMarkdownInlineStrikethrough" type="checkbox"${window.siyuan.config.editor.markdown.inlineStrikethrough ? " checked" : ""}/>
</label>`;
},
bindEvent: () => {
@ -353,7 +361,8 @@ export const editor = {
inlineSup: (editor.element.querySelector("#editorMarkdownInlineSup") as HTMLInputElement).checked,
inlineSub: (editor.element.querySelector("#editorMarkdownInlineSub") as HTMLInputElement).checked,
inlineTag: (editor.element.querySelector("#editorMarkdownInlineTag") as HTMLInputElement).checked,
inlineMath: (editor.element.querySelector("#editorMarkdownInlineMath") as HTMLInputElement).checked
inlineMath: (editor.element.querySelector("#editorMarkdownInlineMath") as HTMLInputElement).checked,
inlineStrikethrough: (editor.element.querySelector("#editorMarkdownInlineStrikethrough") as HTMLInputElement).checked
},
allowHTMLBLockScript: (editor.element.querySelector("#allowHTMLBLockScript") as HTMLInputElement).checked,
justify: (editor.element.querySelector("#justify") as HTMLInputElement).checked,

View file

@ -20,7 +20,8 @@ const setEditor = (modelMainElement: Element) => {
inlineSup: (modelMainElement.querySelector("#editorMarkdownInlineSup") as HTMLInputElement).checked,
inlineSub: (modelMainElement.querySelector("#editorMarkdownInlineSub") as HTMLInputElement).checked,
inlineTag: (modelMainElement.querySelector("#editorMarkdownInlineTag") as HTMLInputElement).checked,
inlineMath: (modelMainElement.querySelector("#editorMarkdownInlineMath") as HTMLInputElement).checked
inlineMath: (modelMainElement.querySelector("#editorMarkdownInlineMath") as HTMLInputElement).checked,
inlineStrikethrough: (modelMainElement.querySelector("#editorMarkdownInlineStrikethrough") as HTMLInputElement).checked
};
window.siyuan.config.editor.allowHTMLBLockScript = (modelMainElement.querySelector("#allowHTMLBLockScript") as HTMLInputElement).checked;
window.siyuan.config.editor.dynamicLoadBlocks = dynamicLoadBlocks;
@ -312,6 +313,14 @@ export const initEditor = () => {
</div>
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="editorMarkdownInlineMath" type="checkbox"${window.siyuan.config.editor.markdown.inlineMath ? " checked" : ""}/>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.editorMarkdownInlineStrikethrough}
<div class="b3-label__text">${window.siyuan.languages.editorMarkdownInlineStrikethroughTip}</div>
</div>
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="editorMarkdownInlineStrikethrough" type="checkbox"${window.siyuan.config.editor.markdown.inlineStrikethrough ? " checked" : ""}/>
</label>`,
bindEvent(modelMainElement: HTMLElement) {
modelMainElement.querySelector("#clearHistory").addEventListener("click", () => {

View file

@ -31,6 +31,7 @@ export const setLute = (options: ILuteOptions) => {
lute.SetSub(window.siyuan.config.editor.markdown.inlineSub);
lute.SetTag(window.siyuan.config.editor.markdown.inlineTag);
lute.SetInlineMath(window.siyuan.config.editor.markdown.inlineMath);
lute.SetGFMStrikethrough(window.siyuan.config.editor.markdown.inlineStrikethrough);
lute.SetGFMStrikethrough1(false);
lute.SetSpin(true);
lute.SetProtyleWYSIWYG(true);

View file

@ -32,6 +32,7 @@ export const reloadProtyle = (protyle: IProtyle, focus: boolean, updateReadonly?
protyle.lute.SetSub(window.siyuan.config.editor.markdown.inlineSub);
protyle.lute.SetTag(window.siyuan.config.editor.markdown.inlineTag);
protyle.lute.SetInlineMath(window.siyuan.config.editor.markdown.inlineMath);
protyle.lute.SetGFMStrikethrough(window.siyuan.config.editor.markdown.inlineStrikethrough);
protyle.lute.SetGFMStrikethrough1(false);
addLoading(protyle);
if (protyle.options.backlinkData) {

View file

@ -312,6 +312,10 @@ declare namespace Config {
* Whether to enable the inline math
*/
inlineMath: boolean;
/**
* Whether to enable the inline strikethrough
*/
inlineStrikethrough: boolean;
}
/**

View file

@ -206,6 +206,8 @@ declare class Lute {
public SetInlineMath(enable: boolean): void;
public SetGFMStrikethrough(enable: boolean): void;
public SetGFMStrikethrough1(enable: boolean): void;
public SetMark(enable: boolean): void;