mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
adding check to the selected editability
This commit is contained in:
parent
32c88219c3
commit
0265c190db
@ -20,14 +20,17 @@ const TPL = `
|
|||||||
</button>
|
</button>
|
||||||
<div class="editability-dropdown dropdown-menu dropdown-menu-right">
|
<div class="editability-dropdown dropdown-menu dropdown-menu-right">
|
||||||
<a class="dropdown-item" href="#" data-editability="auto">
|
<a class="dropdown-item" href="#" data-editability="auto">
|
||||||
|
<span class="check">✓</span>
|
||||||
Auto
|
Auto
|
||||||
<div>Note is editable if it's not too long.</div>
|
<div>Note is editable if it's not too long.</div>
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="#" data-editability="readOnly">
|
<a class="dropdown-item" href="#" data-editability="readOnly">
|
||||||
|
<span class="check">✓</span>
|
||||||
Read-only
|
Read-only
|
||||||
<div>Note is read-only, but can be edited with a button click.</div>
|
<div>Note is read-only, but can be edited with a button click.</div>
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="#" data-editability="autoReadOnlyDisabled">
|
<a class="dropdown-item" href="#" data-editability="autoReadOnlyDisabled">
|
||||||
|
<span class="check">✓</span>
|
||||||
Always editable
|
Always editable
|
||||||
<div>Note is always editable, regardless of its length.</div>
|
<div>Note is always editable, regardless of its length.</div>
|
||||||
</a>
|
</a>
|
||||||
@ -60,11 +63,25 @@ export default class EditabilitySelectWidget extends NoteContextAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async refreshWithNote(note) {
|
async refreshWithNote(note) {
|
||||||
this.$editabilityActiveDesc.text(
|
let editability = 'auto'
|
||||||
this.note.hasLabel('readOnly') ? 'Read-Only' : (
|
|
||||||
this.note.hasLabel('autoReadOnlyDisabled') ? 'Always Editable' : 'Auto'
|
if (this.note.hasLabel('readOnly')) {
|
||||||
)
|
editability = 'readOnly';
|
||||||
);
|
}
|
||||||
|
else if (this.note.hasLabel('autoReadOnlyDisabled')) {
|
||||||
|
editability = 'autoReadOnlyDisabled';
|
||||||
|
}
|
||||||
|
|
||||||
|
const labels = {
|
||||||
|
"auto": "Auto",
|
||||||
|
"readOnly": "Read-only",
|
||||||
|
"autoReadOnlyDisabled": "Always Editable"
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$widget.find('.dropdown-item').removeClass("selected");
|
||||||
|
this.$widget.find(`.dropdown-item[data-editability='${editability}']`).addClass("selected");
|
||||||
|
|
||||||
|
this.$editabilityActiveDesc.text(labels[editability]);
|
||||||
}
|
}
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
entitiesReloadedEvent({loadResults}) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user