mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-31 13:58:49 +01:00
🎨 Supports disabling Markdown syntax input for some inline elements https://github.com/siyuan-note/siyuan/issues/11141
This commit is contained in:
parent
53f5b08038
commit
b9f269ae85
17 changed files with 185 additions and 41 deletions
|
|
@ -24,6 +24,38 @@ export const editor = {
|
|||
<span class="fn__space"></span>
|
||||
<input class="b3-switch fn__flex-center" id="fullWidth" type="checkbox"${window.siyuan.config.editor.fullWidth ? " checked" : ""}/>
|
||||
</label>
|
||||
<label class="fn__flex b3-label">
|
||||
<div class="fn__flex-1">
|
||||
${window.siyuan.languages.editorMarkdownInlineSup}
|
||||
<div class="b3-label__text">${window.siyuan.languages.editorMarkdownInlineSupTip}</div>
|
||||
</div>
|
||||
<span class="fn__space"></span>
|
||||
<input class="b3-switch fn__flex-center" id="editorMarkdownInlineSup" type="checkbox"${window.siyuan.config.editor.markdown.inlineSup ? " checked" : ""}/>
|
||||
</label>
|
||||
<label class="fn__flex b3-label">
|
||||
<div class="fn__flex-1">
|
||||
${window.siyuan.languages.editorMarkdownInlineSub}
|
||||
<div class="b3-label__text">${window.siyuan.languages.editorMarkdownInlineSubTip}</div>
|
||||
</div>
|
||||
<span class="fn__space"></span>
|
||||
<input class="b3-switch fn__flex-center" id="editorMarkdownInlineSub" type="checkbox"${window.siyuan.config.editor.markdown.inlineSub ? " checked" : ""}/>
|
||||
</label>
|
||||
<label class="fn__flex b3-label">
|
||||
<div class="fn__flex-1">
|
||||
${window.siyuan.languages.editorMarkdownInlineTag}
|
||||
<div class="b3-label__text">${window.siyuan.languages.editorMarkdownInlineTagTip}</div>
|
||||
</div>
|
||||
<span class="fn__space"></span>
|
||||
<input class="b3-switch fn__flex-center" id="editorMarkdownInlineTag" type="checkbox"${window.siyuan.config.editor.markdown.inlineTag ? " checked" : ""}/>
|
||||
</label>
|
||||
<label class="fn__flex b3-label">
|
||||
<div class="fn__flex-1">
|
||||
${window.siyuan.languages.editorMarkdownInlineMath}
|
||||
<div class="b3-label__text">${window.siyuan.languages.editorMarkdownInlineMathTip}</div>
|
||||
</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.justify}
|
||||
|
|
@ -296,8 +328,16 @@ export const editor = {
|
|||
(editor.element.querySelector("#dynamicLoadBlocks") as HTMLInputElement).value = "1024";
|
||||
}
|
||||
|
||||
let markdown = {
|
||||
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
|
||||
};
|
||||
|
||||
fetchPost("/api/setting/setEditor", {
|
||||
fullWidth: (editor.element.querySelector("#fullWidth") as HTMLInputElement).checked,
|
||||
markdown: markdown,
|
||||
justify: (editor.element.querySelector("#justify") as HTMLInputElement).checked,
|
||||
rtl: (editor.element.querySelector("#rtl") as HTMLInputElement).checked,
|
||||
readOnly: (editor.element.querySelector("#readOnly") as HTMLInputElement).checked,
|
||||
|
|
@ -371,6 +411,7 @@ export const editor = {
|
|||
item.editor.protyle.contentElement.removeAttribute("data-fullwidth");
|
||||
}
|
||||
});
|
||||
|
||||
setInlineStyle();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,8 +25,11 @@ export const setLute = (options: ILuteOptions) => {
|
|||
lute.SetTag(true);
|
||||
lute.SetSuperBlock(true);
|
||||
lute.SetMark(true);
|
||||
lute.SetSup(true);
|
||||
lute.SetSub(true);
|
||||
lute.SetSup(window.siyuan.config.editor.markdown.inlineSup);
|
||||
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.SetGFMStrikethrough1(false);
|
||||
lute.SetSpin(true);
|
||||
lute.SetProtyleWYSIWYG(true);
|
||||
if (options.lazyLoadImage) {
|
||||
|
|
|
|||
28
app/src/types/config.d.ts
vendored
28
app/src/types/config.d.ts
vendored
|
|
@ -279,10 +279,38 @@ declare namespace Config {
|
|||
trust: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* SiYuan editor markdown related configuration
|
||||
*/
|
||||
interface IMarkdown {
|
||||
/**
|
||||
* Whether to enable the inline superscript
|
||||
*/
|
||||
inlineSup: boolean;
|
||||
/**
|
||||
* Whether to enable the inline subscript
|
||||
*/
|
||||
inlineSub: boolean;
|
||||
/**
|
||||
* Whether to enable the inline tag
|
||||
*/
|
||||
inlineTag: boolean;
|
||||
/**
|
||||
* Whether to enable the inline math
|
||||
*/
|
||||
inlineMath: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* SiYuan editor related configuration
|
||||
*/
|
||||
export interface IEditor {
|
||||
|
||||
/**
|
||||
* Markdown configuration
|
||||
*/
|
||||
markdown: IMarkdown;
|
||||
|
||||
/**
|
||||
* The default number of backlinks to expand
|
||||
*/
|
||||
|
|
|
|||
4
app/src/types/protyle.d.ts
vendored
4
app/src/types/protyle.d.ts
vendored
|
|
@ -202,6 +202,10 @@ declare class Lute {
|
|||
|
||||
public SetTag(enable: boolean): void;
|
||||
|
||||
public SetInlineMath(enable: boolean): void;
|
||||
|
||||
public SetGFMStrikethrough1(enable: boolean): void;
|
||||
|
||||
public SetMark(enable: boolean): void;
|
||||
|
||||
public SetSub(enable: boolean): void;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue