mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
client: Improve code selection in note type
This commit is contained in:
parent
13860a3f16
commit
07170a5a39
@ -70,7 +70,10 @@ export default class NoteTypeWidget extends NoteContextAwareWidget {
|
|||||||
this.$noteTypeDropdown.empty();
|
this.$noteTypeDropdown.empty();
|
||||||
|
|
||||||
for (const noteType of NOTE_TYPES.filter(nt => nt.selectable)) {
|
for (const noteType of NOTE_TYPES.filter(nt => nt.selectable)) {
|
||||||
const $typeLink = $('<a class="dropdown-item">')
|
let $typeLink;
|
||||||
|
|
||||||
|
if (noteType.type !== "code") {
|
||||||
|
$typeLink = $('<a class="dropdown-item">')
|
||||||
.attr("data-note-type", noteType.type)
|
.attr("data-note-type", noteType.type)
|
||||||
.append('<span class="check">✓</span> ')
|
.append('<span class="check">✓</span> ')
|
||||||
.append($('<span>').text(noteType.title))
|
.append($('<span>').text(noteType.title))
|
||||||
@ -80,15 +83,19 @@ export default class NoteTypeWidget extends NoteContextAwareWidget {
|
|||||||
|
|
||||||
this.save(noteType.type, noteType.mime);
|
this.save(noteType.type, noteType.mime);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
this.$noteTypeDropdown
|
||||||
|
.append('<div class="dropdown-divider"></div>');
|
||||||
|
$typeLink = $('<a class="dropdown-item disabled">')
|
||||||
|
.attr("data-note-type", noteType.type)
|
||||||
|
.append('<span class="check">✓</span> ')
|
||||||
|
.append($('<strong>').text(noteType.title));
|
||||||
|
}
|
||||||
|
|
||||||
if (this.note.type === noteType.type) {
|
if (this.note.type === noteType.type) {
|
||||||
$typeLink.addClass("selected");
|
$typeLink.addClass("selected");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (noteType.type === 'code') {
|
|
||||||
this.$noteTypeDropdown.append('<div class="dropdown-divider"></div>');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$noteTypeDropdown.append($typeLink);
|
this.$noteTypeDropdown.append($typeLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user