mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-06 15:47:43 +08:00
fix(settings): bring back pinning of plain text in MIME types
This commit is contained in:
parent
0ef5cb843e
commit
5b90a1c3f6
@ -10,7 +10,8 @@ const TPL = `
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.options-mime-types section {
|
.options-mime-types section,
|
||||||
|
.options-mime-types > li:first-of-type {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -32,24 +33,9 @@ function groupMimeTypesAlphabetically(ungroupedMimeTypes) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class CodeMimeTypesOptions extends OptionsWidget {
|
function buildSelectionForMimeType(mimeType) {
|
||||||
doRender() {
|
|
||||||
this.$widget = $(TPL);
|
|
||||||
this.$mimeTypes = this.$widget.find(".options-mime-types");
|
|
||||||
}
|
|
||||||
|
|
||||||
async optionsLoaded(options) {
|
|
||||||
this.$mimeTypes.empty();
|
|
||||||
|
|
||||||
const groupedMimeTypes = groupMimeTypesAlphabetically(mimeTypesService.getMimeTypes());
|
|
||||||
|
|
||||||
for (const [ initial, mimeTypes ] of Object.entries(groupedMimeTypes)) {
|
|
||||||
const $section = $("<section>");
|
|
||||||
$section.append($("<h5>").text(initial));
|
|
||||||
|
|
||||||
for (const mimeType of mimeTypes) {
|
|
||||||
const id = "code-mime-type-" + (idCtr++);
|
const id = "code-mime-type-" + (idCtr++);
|
||||||
$section.append($("<li>")
|
return ($("<li>")
|
||||||
.append($('<input type="checkbox" class="form-check-input">')
|
.append($('<input type="checkbox" class="form-check-input">')
|
||||||
.attr("id", id)
|
.attr("id", id)
|
||||||
.attr("data-mime-type", mimeType.mime)
|
.attr("data-mime-type", mimeType.mime)
|
||||||
@ -62,6 +48,30 @@ export default class CodeMimeTypesOptions extends OptionsWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default class CodeMimeTypesOptions extends OptionsWidget {
|
||||||
|
doRender() {
|
||||||
|
this.$widget = $(TPL);
|
||||||
|
this.$mimeTypes = this.$widget.find(".options-mime-types");
|
||||||
|
}
|
||||||
|
|
||||||
|
async optionsLoaded(options) {
|
||||||
|
this.$mimeTypes.empty();
|
||||||
|
|
||||||
|
const ungroupedMimeTypes = mimeTypesService.getMimeTypes();
|
||||||
|
const plainTextMimeType = ungroupedMimeTypes.shift();
|
||||||
|
const groupedMimeTypes = groupMimeTypesAlphabetically(ungroupedMimeTypes);
|
||||||
|
|
||||||
|
// Plain text is displayed at the top intentionally.
|
||||||
|
this.$mimeTypes.append(buildSelectionForMimeType(plainTextMimeType));
|
||||||
|
|
||||||
|
for (const [ initial, mimeTypes ] of Object.entries(groupedMimeTypes)) {
|
||||||
|
const $section = $("<section>");
|
||||||
|
$section.append($("<h5>").text(initial));
|
||||||
|
|
||||||
|
for (const mimeType of mimeTypes) {
|
||||||
|
$section.append(buildSelectionForMimeType(mimeType));
|
||||||
|
}
|
||||||
|
|
||||||
this.$mimeTypes.append($section);
|
this.$mimeTypes.append($section);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user