diff --git a/packages/renderer/MdToHtml.ts b/packages/renderer/MdToHtml.ts index a97abd9199..4a22f4713c 100644 --- a/packages/renderer/MdToHtml.ts +++ b/packages/renderer/MdToHtml.ts @@ -148,6 +148,7 @@ export interface RuleOptions { // Used by checkboxes to specify how it should be rendered checkboxRenderingType?: number; + checkboxDisabled?: boolean; // Used by the keyword highlighting plugin (mobile only) highlightedKeywords?: any[]; diff --git a/packages/renderer/MdToHtml/rules/checkbox.ts b/packages/renderer/MdToHtml/rules/checkbox.ts index 15fab7b524..b6c8d44667 100644 --- a/packages/renderer/MdToHtml/rules/checkbox.ts +++ b/packages/renderer/MdToHtml/rules/checkbox.ts @@ -53,7 +53,7 @@ function pluginAssets(theme: any) { ]; } -function createPrefixTokens(Token: any, id: string, checked: boolean, label: string, postMessageSyntax: string, sourceToken: any): any[] { +function createPrefixTokens(Token: any, id: string, checked: boolean, label: string, postMessageSyntax: string, sourceToken: any, disabled: boolean): any[] { let token = null; const tokens = []; @@ -89,6 +89,7 @@ function createPrefixTokens(Token: any, id: string, checked: boolean, label: str token = new Token('checkbox_input', 'input', 0); token.attrs = [['type', 'checkbox'], ['id', id], ['onclick', js]]; + if (disabled) token.attrs.push(['disabled', 'disabled']); if (checked) token.attrs.push(['checked', 'checked']); tokens.push(token); @@ -169,7 +170,7 @@ function checkboxPlugin(markdownIt: any, options: RuleOptions) { // Prepend the text content with the checkbox markup and the opening tag at the end of the text content. - const prefix = createPrefixTokens(Token, id, checked, label, options.postMessageSyntax, token); + const prefix = createPrefixTokens(Token, id, checked, label, options.postMessageSyntax, token, !!options.checkboxDisabled); const suffix = createSuffixTokens(Token); token.children = markdownIt.utils.arrayReplaceAt(token.children, 0, prefix); diff --git a/packages/server/src/utils/joplinUtils.ts b/packages/server/src/utils/joplinUtils.ts index 51a70e87ac..ee1e7c6712 100644 --- a/packages/server/src/utils/joplinUtils.ts +++ b/packages/server/src/utils/joplinUtils.ts @@ -203,6 +203,7 @@ async function renderNote(share: Share, note: NoteEntity, resourceInfos: Resourc audioPlayerEnabled: false, videoPlayerEnabled: false, pdfViewerEnabled: false, + checkboxDisabled: true, linkRenderingType: 2, };