mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Desktop, Mobile: Improved: Gray out checkboxes that have been ticked inside notes
This commit is contained in:
parent
d60afcaabe
commit
e4a08c29d7
@ -161,6 +161,10 @@ module.exports = function(style, options) {
|
|||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.checkbox-label-checked {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
body {
|
body {
|
||||||
height: auto !important;
|
height: auto !important;
|
||||||
|
@ -32,7 +32,16 @@ function createPrefixTokens(Token, id, checked, label, postMessageSyntax, source
|
|||||||
// in calling code.
|
// in calling code.
|
||||||
const lineIndex = sourceToken.map && sourceToken.map.length ? sourceToken.map[0] : 99999999;
|
const lineIndex = sourceToken.map && sourceToken.map.length ? sourceToken.map[0] : 99999999;
|
||||||
const checkedString = checked ? 'checked' : 'unchecked';
|
const checkedString = checked ? 'checked' : 'unchecked';
|
||||||
const js = postMessageSyntax + "('checkboxclick:" + checkedString + ':' + lineIndex + "'); return true;";
|
|
||||||
|
const labelId = 'cb-label-' + id;
|
||||||
|
|
||||||
|
const js = `
|
||||||
|
${postMessageSyntax}('checkboxclick:${checkedString}:${lineIndex}');
|
||||||
|
const label = document.getElementById("${labelId}");
|
||||||
|
label.classList.remove(this.checked ? 'checkbox-label-unchecked' : 'checkbox-label-checked');
|
||||||
|
label.classList.add(this.checked ? 'checkbox-label-checked' : 'checkbox-label-unchecked');
|
||||||
|
return true;
|
||||||
|
`;
|
||||||
|
|
||||||
token = new Token('checkbox_input', 'input', 0);
|
token = new Token('checkbox_input', 'input', 0);
|
||||||
token.attrs = [
|
token.attrs = [
|
||||||
@ -44,7 +53,11 @@ function createPrefixTokens(Token, id, checked, label, postMessageSyntax, source
|
|||||||
tokens.push(token);
|
tokens.push(token);
|
||||||
|
|
||||||
token = new Token('label_open', 'label', 1);
|
token = new Token('label_open', 'label', 1);
|
||||||
token.attrs = [['for', id]];
|
token.attrs = [
|
||||||
|
['id', labelId],
|
||||||
|
['for', id],
|
||||||
|
['class', 'checkbox-label-' + checkedString],
|
||||||
|
];
|
||||||
tokens.push(token);
|
tokens.push(token);
|
||||||
|
|
||||||
if (label) {
|
if (label) {
|
||||||
|
Loading…
Reference in New Issue
Block a user