You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-13 00:10:37 +02:00
Server: Do not make checkboxes in published notes clickable
This commit is contained in:
@ -148,6 +148,7 @@ export interface RuleOptions {
|
|||||||
|
|
||||||
// Used by checkboxes to specify how it should be rendered
|
// Used by checkboxes to specify how it should be rendered
|
||||||
checkboxRenderingType?: number;
|
checkboxRenderingType?: number;
|
||||||
|
checkboxDisabled?: boolean;
|
||||||
|
|
||||||
// Used by the keyword highlighting plugin (mobile only)
|
// Used by the keyword highlighting plugin (mobile only)
|
||||||
highlightedKeywords?: any[];
|
highlightedKeywords?: any[];
|
||||||
|
@ -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;
|
let token = null;
|
||||||
const tokens = [];
|
const tokens = [];
|
||||||
|
|
||||||
@ -89,6 +89,7 @@ function createPrefixTokens(Token: any, id: string, checked: boolean, label: str
|
|||||||
|
|
||||||
token = new Token('checkbox_input', 'input', 0);
|
token = new Token('checkbox_input', 'input', 0);
|
||||||
token.attrs = [['type', 'checkbox'], ['id', id], ['onclick', js]];
|
token.attrs = [['type', 'checkbox'], ['id', id], ['onclick', js]];
|
||||||
|
if (disabled) token.attrs.push(['disabled', 'disabled']);
|
||||||
if (checked) token.attrs.push(['checked', 'checked']);
|
if (checked) token.attrs.push(['checked', 'checked']);
|
||||||
tokens.push(token);
|
tokens.push(token);
|
||||||
|
|
||||||
@ -169,7 +170,7 @@ function checkboxPlugin(markdownIt: any, options: RuleOptions) {
|
|||||||
// Prepend the text content with the checkbox markup and the opening <label> tag
|
// Prepend the text content with the checkbox markup and the opening <label> tag
|
||||||
// then append the </label> tag at the end of the text content.
|
// then append the </label> 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);
|
const suffix = createSuffixTokens(Token);
|
||||||
|
|
||||||
token.children = markdownIt.utils.arrayReplaceAt(token.children, 0, prefix);
|
token.children = markdownIt.utils.arrayReplaceAt(token.children, 0, prefix);
|
||||||
|
@ -203,6 +203,7 @@ async function renderNote(share: Share, note: NoteEntity, resourceInfos: Resourc
|
|||||||
audioPlayerEnabled: false,
|
audioPlayerEnabled: false,
|
||||||
videoPlayerEnabled: false,
|
videoPlayerEnabled: false,
|
||||||
pdfViewerEnabled: false,
|
pdfViewerEnabled: false,
|
||||||
|
checkboxDisabled: true,
|
||||||
|
|
||||||
linkRenderingType: 2,
|
linkRenderingType: 2,
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user