mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-08 09:48:50 +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
|
|
@ -1,4 +1,12 @@
|
|||
{
|
||||
"editorMarkdownInlineSup": "Markdown inline superscript syntax",
|
||||
"editorMarkdownInlineSupTip": "After enabling, <code class='fn__code'>^foo^</code> inline superscript input will be supported",
|
||||
"editorMarkdownInlineSub": "Markdown inline subscript syntax",
|
||||
"editorMarkdownInlineSubTip": "After enabling, <code class='fn__code'>~foo~</code> inline subscript input will be supported",
|
||||
"editorMarkdownInlineTag": "Markdown inline tag syntax",
|
||||
"editorMarkdownInlineTagTip": "After enabling, <code class='fn__code'>#foo#</code> inline tag input will be supported",
|
||||
"editorMarkdownInlineMath": "Markdown inline formula syntax",
|
||||
"editorMarkdownInlineMathTip": "After enabling, <code class='fn__code'>$foo$</code> inline formula input will be supported",
|
||||
"currentNotebook": "Current Notebook",
|
||||
"containerBlockTip1": "Enabling container blocks will result in duplicate search results",
|
||||
"containerBlockTip2": "Enabling document blocks currently only supports searching for document titles",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,12 @@
|
|||
{
|
||||
"editorMarkdownInlineSup": "Sintaxis de superíndice en línea de Markdown",
|
||||
"editorMarkdownInlineSupTip": "Después de habilitar, se admitirá la entrada de superíndice en línea <code class='fn__code'>^foo^</code>",
|
||||
"editorMarkdownInlineSub": "Sintaxis del subíndice en línea de Markdown",
|
||||
"editorMarkdownInlineSubTip": "Después de habilitar, se admitirá la entrada de subíndice en línea <code class='fn__code'>~foo~</code>",
|
||||
"editorMarkdownInlineTag": "Sintaxis de etiquetas en línea de Markdown",
|
||||
"editorMarkdownInlineTagTip": "Después de habilitar, se admitirá la entrada de etiquetas en línea <code class='fn__code'>#foo#</code>",
|
||||
"editorMarkdownInlineMath": "Sintaxis de fórmula en línea de Markdown",
|
||||
"editorMarkdownInlineMathTip": "Después de habilitar, se admitirá la entrada de fórmula en línea <code class='fn__code'>$foo$</code>",
|
||||
"currentNotebook": "Cuaderno actual",
|
||||
"containerBlockTip1": "Habilitar bloques de contenedores generará resultados de búsqueda duplicados",
|
||||
"containerBlockTip2": "Habilitar bloques de documentos actualmente solo admite la búsqueda de títulos de documentos",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,12 @@
|
|||
{
|
||||
"editorMarkdownInlineSup": "Syntaxe exposant Markdown en ligne",
|
||||
"editorMarkdownInlineSupTip": "Après l'activation, la saisie en exposant <code class='fn__code'>^foo^</code> en ligne sera prise en charge",
|
||||
"editorMarkdownInlineSub": "Syntaxe d'indice en ligne Markdown",
|
||||
"editorMarkdownInlineSubTip": "Après l'activation, la saisie en indice <code class='fn__code'>~foo~</code> en ligne sera prise en charge",
|
||||
"editorMarkdownInlineTag": "Syntaxe des balises en ligne Markdown",
|
||||
"editorMarkdownInlineTagTip": "Après l'activation, la saisie de balises en ligne <code class='fn__code'>#foo#</code> sera prise en charge",
|
||||
"editorMarkdownInlineMath": "Syntaxe de formule en ligne Markdown",
|
||||
"editorMarkdownInlineMathTip": "Après l'activation, la saisie de formule en ligne <code class='fn__code'>$foo$</code> sera prise en charge",
|
||||
"currentNotebook": "Carnet actuel",
|
||||
"containerBlockTip1": "L'activation des blocs de conteneurs entraînera des résultats de recherche en double",
|
||||
"containerBlockTip2": "L'activation des blocs de documents ne prend actuellement en charge que la recherche de titres de documents",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,12 @@
|
|||
{
|
||||
"editorMarkdownInlineSup": "Markdown 行級上標語法",
|
||||
"editorMarkdownInlineSupTip": "啟用後將支援 <code class='fn__code'>^foo^</code> 行級上標輸入",
|
||||
"editorMarkdownInlineSub": "Markdown 行級下標語法",
|
||||
"editorMarkdownInlineSubTip": "啟用後將支援 <code class='fn__code'>~foo~</code> 行級下標輸入",
|
||||
"editorMarkdownInlineTag": "Markdown 行級標籤語法",
|
||||
"editorMarkdownInlineTagTip": "啟用後將支援 <code class='fn__code'>#foo#</code> 行級標籤輸入",
|
||||
"editorMarkdownInlineMath": "Markdown 行級公式語法",
|
||||
"editorMarkdownInlineMathTip": "啟用後將支援 <code class='fn__code'>$foo$</code> 行級公式輸入",
|
||||
"currentNotebook": "目前筆記本",
|
||||
"containerBlockTip1": "啟用容器區塊後會導致搜尋結果重複",
|
||||
"containerBlockTip2": "啟用文件區塊目前僅支援搜尋文件名稱",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,12 @@
|
|||
{
|
||||
"editorMarkdownInlineSup": "Markdown 行级上标语法",
|
||||
"editorMarkdownInlineSupTip": "启用后将支持 <code class='fn__code'>^foo^</code> 上标输入",
|
||||
"editorMarkdownInlineSub": "Markdown 行级下标语法",
|
||||
"editorMarkdownInlineSubTip": "启用后将支持 <code class='fn__code'>~foo~</code> 下标输入",
|
||||
"editorMarkdownInlineTag": "Markdown 行级标签语法",
|
||||
"editorMarkdownInlineTagTip": "启用后将支持 <code class='fn__code'>#foo#</code> 标签输入",
|
||||
"editorMarkdownInlineMath": "Markdown 行级公式语法",
|
||||
"editorMarkdownInlineMathTip": "启用后将支持 <code class='fn__code'>$foo$</code> 行级公式输入",
|
||||
"currentNotebook": "当前笔记本",
|
||||
"containerBlockTip1": "启用容器块后会导致搜索结果重复",
|
||||
"containerBlockTip2": "启用文档块目前仅支持搜索文档名",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
4
app/stage/protyle/js/lute/lute.min.js
vendored
4
app/stage/protyle/js/lute/lute.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue