client: Support custom language types for highlight

This commit is contained in:
Elian Doran 2024-10-27 10:39:31 +02:00
parent 6c4513fb2e
commit 1e9324c303
No known key found for this signature in database
5 changed files with 111 additions and 92 deletions

View File

@ -1,3 +1,5 @@
import mimeTypesService from "./mime_types.js";
const CKEDITOR = {"js": ["libraries/ckeditor/ckeditor.js"]}; const CKEDITOR = {"js": ["libraries/ckeditor/ckeditor.js"]};
const CODE_MIRROR = { const CODE_MIRROR = {
@ -85,7 +87,16 @@ const MIND_ELIXIR = {
}; };
const HIGHLIGHT_JS = { const HIGHLIGHT_JS = {
js: [ "node_modules/@highlightjs/cdn-assets/highlight.min.js" ], js: () => {
const mimeTypes = mimeTypesService.getMimeTypes();
const scriptsToLoad = [ "node_modules/@highlightjs/cdn-assets/highlight.min.js" ];
for (const mimeType of mimeTypes) {
if (mimeType.enabled && mimeType.highlightJs) {
scriptsToLoad.push(`node_modules/@highlightjs/cdn-assets/languages/${mimeType.highlightJs}.min.js`);
}
}
return scriptsToLoad;
},
css: [ "node_modules/@highlightjs/cdn-assets/styles/atom-one-dark.css" ] css: [ "node_modules/@highlightjs/cdn-assets/styles/atom-one-dark.css" ]
}; };
@ -95,12 +106,20 @@ async function requireLibrary(library) {
} }
if (library.js) { if (library.js) {
for (const scriptUrl of library.js) { for (const scriptUrl of unwrapValue(library.js)) {
await requireScript(scriptUrl); await requireScript(scriptUrl);
} }
} }
} }
function unwrapValue(value) {
if (typeof value === "function") {
return value();
}
return value;
}
// we save the promises in case of the same script being required concurrently multiple times // we save the promises in case of the same script being required concurrently multiple times
const loadedScriptPromises = {}; const loadedScriptPromises = {};

View File

@ -1,162 +1,162 @@
import options from "./options.js"; import options from "./options.js";
const MIME_TYPES_DICT = [ const MIME_TYPES_DICT = [
{ default: true, title: "Plain text", mime: "text/plain" }, { default: true, title: "Plain text", mime: "text/plain", highlightJs: "plaintext" },
{ title: "APL", mime: "text/apl" }, { title: "APL", mime: "text/apl" },
{ title: "ASN.1", mime: "text/x-ttcn-asn" }, { title: "ASN.1", mime: "text/x-ttcn-asn" },
{ title: "ASP.NET", mime: "application/x-aspx" }, { title: "ASP.NET", mime: "application/x-aspx" },
{ title: "Asterisk", mime: "text/x-asterisk" }, { title: "Asterisk", mime: "text/x-asterisk" },
{ title: "Brainfuck", mime: "text/x-brainfuck" }, { title: "Brainfuck", mime: "text/x-brainfuck", highlightJs: "brainfuck" },
{ default: true, title: "C", mime: "text/x-csrc" }, { default: true, title: "C", mime: "text/x-csrc", highlightJs: "c" },
{ default: true, title: "C#", mime: "text/x-csharp" }, { default: true, title: "C#", mime: "text/x-csharp", highlightJs: "csharp" },
{ default: true, title: "C++", mime: "text/x-c++src" }, { default: true, title: "C++", mime: "text/x-c++src", highlightJs: "cpp" },
{ title: "Clojure", mime: "text/x-clojure" }, { title: "Clojure", mime: "text/x-clojure", highlightJs: "clojure" },
{ title: "ClojureScript", mime: "text/x-clojurescript" }, { title: "ClojureScript", mime: "text/x-clojurescript" },
{ title: "Closure Stylesheets (GSS)", mime: "text/x-gss" }, { title: "Closure Stylesheets (GSS)", mime: "text/x-gss" },
{ title: "CMake", mime: "text/x-cmake" }, { title: "CMake", mime: "text/x-cmake", highlightJs: "cmake" },
{ title: "Cobol", mime: "text/x-cobol" }, { title: "Cobol", mime: "text/x-cobol" },
{ title: "CoffeeScript", mime: "text/coffeescript" }, { title: "CoffeeScript", mime: "text/coffeescript", highlightJs: "coffeescript" },
{ title: "Common Lisp", mime: "text/x-common-lisp" }, { title: "Common Lisp", mime: "text/x-common-lisp", highlightJs: "lisp" },
{ title: "CQL", mime: "text/x-cassandra" }, { title: "CQL", mime: "text/x-cassandra" },
{ title: "Crystal", mime: "text/x-crystal" }, { title: "Crystal", mime: "text/x-crystal", highlightJs: "crystal" },
{ default: true, title: "CSS", mime: "text/css" }, { default: true, title: "CSS", mime: "text/css", highlightJs: "css" },
{ title: "Cypher", mime: "application/x-cypher-query" }, { title: "Cypher", mime: "application/x-cypher-query" },
{ title: "Cython", mime: "text/x-cython" }, { title: "Cython", mime: "text/x-cython" },
{ title: "D", mime: "text/x-d" }, { title: "D", mime: "text/x-d", highlightJs: "d" },
{ title: "Dart", mime: "application/dart" }, { title: "Dart", mime: "application/dart", highlightJs: "dart" },
{ title: "diff", mime: "text/x-diff" }, { title: "diff", mime: "text/x-diff", highlightJs: "diff" },
{ title: "Django", mime: "text/x-django" }, { title: "Django", mime: "text/x-django", highlightJs: "django" },
{ title: "Dockerfile", mime: "text/x-dockerfile" }, { title: "Dockerfile", mime: "text/x-dockerfile", highlightJs: "dockerfile" },
{ title: "DTD", mime: "application/xml-dtd" }, { title: "DTD", mime: "application/xml-dtd" },
{ title: "Dylan", mime: "text/x-dylan" }, { title: "Dylan", mime: "text/x-dylan" },
{ title: "EBNF", mime: "text/x-ebnf" }, { title: "EBNF", mime: "text/x-ebnf", highlightJs: "ebnf" },
{ title: "ECL", mime: "text/x-ecl" }, { title: "ECL", mime: "text/x-ecl" },
{ title: "edn", mime: "application/edn" }, { title: "edn", mime: "application/edn" },
{ title: "Eiffel", mime: "text/x-eiffel" }, { title: "Eiffel", mime: "text/x-eiffel" },
{ title: "Elm", mime: "text/x-elm" }, { title: "Elm", mime: "text/x-elm", highlightJs: "elm" },
{ title: "Embedded Javascript", mime: "application/x-ejs" }, { title: "Embedded Javascript", mime: "application/x-ejs" },
{ title: "Embedded Ruby", mime: "application/x-erb" }, { title: "Embedded Ruby", mime: "application/x-erb", highlightJs: "erb" },
{ title: "Erlang", mime: "text/x-erlang" }, { title: "Erlang", mime: "text/x-erlang", highlightJs: "erlang" },
{ title: "Esper", mime: "text/x-esper" }, { title: "Esper", mime: "text/x-esper" },
{ title: "F#", mime: "text/x-fsharp" }, { title: "F#", mime: "text/x-fsharp", highlightJs: "fsharp" },
{ title: "Factor", mime: "text/x-factor" }, { title: "Factor", mime: "text/x-factor" },
{ title: "FCL", mime: "text/x-fcl" }, { title: "FCL", mime: "text/x-fcl" },
{ title: "Forth", mime: "text/x-forth" }, { title: "Forth", mime: "text/x-forth" },
{ title: "Fortran", mime: "text/x-fortran" }, { title: "Fortran", mime: "text/x-fortran", highlightJs: "fortran" },
{ title: "Gas", mime: "text/x-gas" }, { title: "Gas", mime: "text/x-gas" },
{ title: "Gherkin", mime: "text/x-feature" }, { title: "Gherkin", mime: "text/x-feature", highlightJs: "gherkin" },
{ title: "GitHub Flavored Markdown", mime: "text/x-gfm" }, { title: "GitHub Flavored Markdown", mime: "text/x-gfm", highlightJs: "markdown" },
{ default: true, title: "Go", mime: "text/x-go" }, { default: true, title: "Go", mime: "text/x-go", highlightJs: "go" },
{ default: true, title: "Groovy", mime: "text/x-groovy" }, { default: true, title: "Groovy", mime: "text/x-groovy", highlightJs: "groovy" },
{ title: "HAML", mime: "text/x-haml" }, { title: "HAML", mime: "text/x-haml", highlightJs: "haml" },
{ default: true, title: "Haskell", mime: "text/x-haskell" }, { default: true, title: "Haskell", mime: "text/x-haskell", highlightJs: "haskell" },
{ title: "Haskell (Literate)", mime: "text/x-literate-haskell" }, { title: "Haskell (Literate)", mime: "text/x-literate-haskell" },
{ title: "Haxe", mime: "text/x-haxe" }, { title: "Haxe", mime: "text/x-haxe", highlightJs: "haxe" },
{ default: true, title: "HTML", mime: "text/html" }, { default: true, title: "HTML", mime: "text/html", highlightJs: "xml" },
{ default: true, title: "HTTP", mime: "message/http" }, { default: true, title: "HTTP", mime: "message/http", highlightJs: "http" },
{ title: "HXML", mime: "text/x-hxml" }, { title: "HXML", mime: "text/x-hxml" },
{ title: "IDL", mime: "text/x-idl" }, { title: "IDL", mime: "text/x-idl" },
{ default: true, title: "Java", mime: "text/x-java" }, { default: true, title: "Java", mime: "text/x-java", highlightJs: "java" },
{ title: "Java Server Pages", mime: "application/x-jsp" }, { title: "Java Server Pages", mime: "application/x-jsp", highlightJs: "java" },
{ title: "Jinja2", mime: "text/jinja2" }, { title: "Jinja2", mime: "text/jinja2" },
{ default: true, title: "JS backend", mime: "application/javascript;env=backend" }, { default: true, title: "JS backend", mime: "application/javascript;env=backend", highlightJs: "javascript" },
{ default: true, title: "JS frontend", mime: "application/javascript;env=frontend" }, { default: true, title: "JS frontend", mime: "application/javascript;env=frontend", highlightJs: "javascript" },
{ default: true, title: "JSON", mime: "application/json" }, { default: true, title: "JSON", mime: "application/json", highlightJs: "json" },
{ title: "JSON-LD", mime: "application/ld+json" }, { title: "JSON-LD", mime: "application/ld+json", highlightJs: "json" },
{ title: "JSX", mime: "text/jsx" }, { title: "JSX", mime: "text/jsx", highlightJs: "javascript" },
{ title: "Julia", mime: "text/x-julia" }, { title: "Julia", mime: "text/x-julia", highlightJs: "julia" },
{ default: true, title: "Kotlin", mime: "text/x-kotlin" }, { default: true, title: "Kotlin", mime: "text/x-kotlin", highlightJs: "kotlin" },
{ title: "LaTeX", mime: "text/x-latex" }, { title: "LaTeX", mime: "text/x-latex", highlightJs: "latex" },
{ title: "LESS", mime: "text/x-less" }, { title: "LESS", mime: "text/x-less", highlightJs: "less" },
{ title: "LiveScript", mime: "text/x-livescript" }, { title: "LiveScript", mime: "text/x-livescript", highlightJs: "livescript" },
{ title: "Lua", mime: "text/x-lua" }, { title: "Lua", mime: "text/x-lua", highlightJs: "lua" },
{ title: "MariaDB SQL", mime: "text/x-mariadb" }, { title: "MariaDB SQL", mime: "text/x-mariadb", highlightJs: "sql" },
{ default: true, title: "Markdown", mime: "text/x-markdown" }, { default: true, title: "Markdown", mime: "text/x-markdown", highlightJs: "markdown" },
{ title: "Mathematica", mime: "text/x-mathematica" }, { title: "Mathematica", mime: "text/x-mathematica", highlightJs: "mathematica" },
{ title: "mbox", mime: "application/mbox" }, { title: "mbox", mime: "application/mbox" },
{ title: "mIRC", mime: "text/mirc" }, { title: "mIRC", mime: "text/mirc" },
{ title: "Modelica", mime: "text/x-modelica" }, { title: "Modelica", mime: "text/x-modelica" },
{ title: "MS SQL", mime: "text/x-mssql" }, { title: "MS SQL", mime: "text/x-mssql", highlightJs: "sql" },
{ title: "mscgen", mime: "text/x-mscgen" }, { title: "mscgen", mime: "text/x-mscgen" },
{ title: "msgenny", mime: "text/x-msgenny" }, { title: "msgenny", mime: "text/x-msgenny" },
{ title: "MUMPS", mime: "text/x-mumps" }, { title: "MUMPS", mime: "text/x-mumps" },
{ title: "MySQL", mime: "text/x-mysql" }, { title: "MySQL", mime: "text/x-mysql", highlightJs: "sql" },
{ title: "Nginx", mime: "text/x-nginx-conf" }, { title: "Nginx", mime: "text/x-nginx-conf", highlightJs: "nginx" },
{ title: "NSIS", mime: "text/x-nsis" }, { title: "NSIS", mime: "text/x-nsis", highlightJs: "nsis" },
{ title: "NTriples", mime: "application/n-triples" }, { title: "NTriples", mime: "application/n-triples" },
{ title: "Objective-C", mime: "text/x-objectivec" }, { title: "Objective-C", mime: "text/x-objectivec", highlightJs: "objectivec" },
{ title: "OCaml", mime: "text/x-ocaml" }, { title: "OCaml", mime: "text/x-ocaml", highlightJs: "ocaml" },
{ title: "Octave", mime: "text/x-octave" }, { title: "Octave", mime: "text/x-octave" },
{ title: "Oz", mime: "text/x-oz" }, { title: "Oz", mime: "text/x-oz" },
{ title: "Pascal", mime: "text/x-pascal" }, { title: "Pascal", mime: "text/x-pascal", highlightJs: "delphi" },
{ title: "PEG.js", mime: "null" }, { title: "PEG.js", mime: "null" },
{ default: true, title: "Perl", mime: "text/x-perl" }, { default: true, title: "Perl", mime: "text/x-perl" },
{ title: "PGP", mime: "application/pgp" }, { title: "PGP", mime: "application/pgp" },
{ default: true, title: "PHP", mime: "text/x-php" }, { default: true, title: "PHP", mime: "text/x-php" },
{ title: "Pig", mime: "text/x-pig" }, { title: "Pig", mime: "text/x-pig" },
{ title: "PLSQL", mime: "text/x-plsql" }, { title: "PLSQL", mime: "text/x-plsql", highlightJs: "sql" },
{ title: "PostgreSQL", mime: "text/x-pgsql" }, { title: "PostgreSQL", mime: "text/x-pgsql", highlightJs: "pgsql" },
{ title: "PowerShell", mime: "application/x-powershell" }, { title: "PowerShell", mime: "application/x-powershell", highlightJs: "powershell" },
{ title: "Properties files", mime: "text/x-properties" }, { title: "Properties files", mime: "text/x-properties", highlightJs: "properties" },
{ title: "ProtoBuf", mime: "text/x-protobuf" }, { title: "ProtoBuf", mime: "text/x-protobuf", highlightJs: "protobuf" },
{ title: "Pug", mime: "text/x-pug" }, { title: "Pug", mime: "text/x-pug" },
{ title: "Puppet", mime: "text/x-puppet" }, { title: "Puppet", mime: "text/x-puppet", highlightJs: "puppet" },
{ default: true, title: "Python", mime: "text/x-python" }, { default: true, title: "Python", mime: "text/x-python", highlightJs: "python" },
{ title: "Q", mime: "text/x-q" }, { title: "Q", mime: "text/x-q", highlightJs: "q" },
{ title: "R", mime: "text/x-rsrc" }, { title: "R", mime: "text/x-rsrc", highlightJs: "r" },
{ title: "reStructuredText", mime: "text/x-rst" }, { title: "reStructuredText", mime: "text/x-rst" },
{ title: "RPM Changes", mime: "text/x-rpm-changes" }, { title: "RPM Changes", mime: "text/x-rpm-changes" },
{ title: "RPM Spec", mime: "text/x-rpm-spec" }, { title: "RPM Spec", mime: "text/x-rpm-spec" },
{ default: true, title: "Ruby", mime: "text/x-ruby" }, { default: true, title: "Ruby", mime: "text/x-ruby", highlightJs: "ruby" },
{ title: "Rust", mime: "text/x-rustsrc" }, { title: "Rust", mime: "text/x-rustsrc", highlightJs: "rust" },
{ title: "SAS", mime: "text/x-sas" }, { title: "SAS", mime: "text/x-sas", highlightJs: "sas" },
{ title: "Sass", mime: "text/x-sass" }, { title: "Sass", mime: "text/x-sass" },
{ title: "Scala", mime: "text/x-scala" }, { title: "Scala", mime: "text/x-scala" },
{ title: "Scheme", mime: "text/x-scheme" }, { title: "Scheme", mime: "text/x-scheme" },
{ title: "SCSS", mime: "text/x-scss" }, { title: "SCSS", mime: "text/x-scss", highlightJs: "scss" },
{ default: true, title: "Shell (bash)", mime: "text/x-sh" }, { default: true, title: "Shell (bash)", mime: "text/x-sh", highlightJs: "shell" },
{ title: "Sieve", mime: "application/sieve" }, { title: "Sieve", mime: "application/sieve" },
{ title: "Slim", mime: "text/x-slim" }, { title: "Slim", mime: "text/x-slim" },
{ title: "Smalltalk", mime: "text/x-stsrc" }, { title: "Smalltalk", mime: "text/x-stsrc", highlightJs: "smalltalk" },
{ title: "Smarty", mime: "text/x-smarty" }, { title: "Smarty", mime: "text/x-smarty" },
{ title: "SML", mime: "text/x-sml" }, { title: "SML", mime: "text/x-sml", highlightJs: "sml" },
{ title: "Solr", mime: "text/x-solr" }, { title: "Solr", mime: "text/x-solr" },
{ title: "Soy", mime: "text/x-soy" }, { title: "Soy", mime: "text/x-soy" },
{ title: "SPARQL", mime: "application/sparql-query" }, { title: "SPARQL", mime: "application/sparql-query" },
{ title: "Spreadsheet", mime: "text/x-spreadsheet" }, { title: "Spreadsheet", mime: "text/x-spreadsheet" },
{ default: true, title: "SQL", mime: "text/x-sql" }, { default: true, title: "SQL", mime: "text/x-sql", highlightJs: "sql" },
{ title: "SQLite", mime: "text/x-sqlite" }, { title: "SQLite", mime: "text/x-sqlite", highlightJs: "sql" },
{ default: true, title: "SQLite (Trilium)", mime: "text/x-sqlite;schema=trilium" }, { default: true, title: "SQLite (Trilium)", mime: "text/x-sqlite;schema=trilium", highlightJs: "sql" },
{ title: "Squirrel", mime: "text/x-squirrel" }, { title: "Squirrel", mime: "text/x-squirrel" },
{ title: "sTeX", mime: "text/x-stex" }, { title: "sTeX", mime: "text/x-stex" },
{ title: "Stylus", mime: "text/x-styl" }, { title: "Stylus", mime: "text/x-styl", highlightJs: "stylus" },
{ default: true, title: "Swift", mime: "text/x-swift" }, { default: true, title: "Swift", mime: "text/x-swift" },
{ title: "SystemVerilog", mime: "text/x-systemverilog" }, { title: "SystemVerilog", mime: "text/x-systemverilog" },
{ title: "Tcl", mime: "text/x-tcl" }, { title: "Tcl", mime: "text/x-tcl", highlightJs: "tcl" },
{ title: "Textile", mime: "text/x-textile" }, { title: "Textile", mime: "text/x-textile" },
{ title: "TiddlyWiki ", mime: "text/x-tiddlywiki" }, { title: "TiddlyWiki ", mime: "text/x-tiddlywiki" },
{ title: "Tiki wiki", mime: "text/tiki" }, { title: "Tiki wiki", mime: "text/tiki" },
{ title: "TOML", mime: "text/x-toml" }, { title: "TOML", mime: "text/x-toml", highlightJs: "ini" },
{ title: "Tornado", mime: "text/x-tornado" }, { title: "Tornado", mime: "text/x-tornado" },
{ title: "troff", mime: "text/troff" }, { title: "troff", mime: "text/troff" },
{ title: "TTCN", mime: "text/x-ttcn" }, { title: "TTCN", mime: "text/x-ttcn" },
{ title: "TTCN_CFG", mime: "text/x-ttcn-cfg" }, { title: "TTCN_CFG", mime: "text/x-ttcn-cfg" },
{ title: "Turtle", mime: "text/turtle" }, { title: "Turtle", mime: "text/turtle" },
{ title: "Twig", mime: "text/x-twig" }, { title: "Twig", mime: "text/x-twig", highlightJs: "twig" },
{ title: "TypeScript", mime: "application/typescript" }, { title: "TypeScript", mime: "application/typescript", highlightJs: "typescript" },
{ title: "TypeScript-JSX", mime: "text/typescript-jsx" }, { title: "TypeScript-JSX", mime: "text/typescript-jsx" },
{ title: "VB.NET", mime: "text/x-vb" }, { title: "VB.NET", mime: "text/x-vb", highlightJs: "vbnet" },
{ title: "VBScript", mime: "text/vbscript" }, { title: "VBScript", mime: "text/vbscript", highlightJs: "vbscript" },
{ title: "Velocity", mime: "text/velocity" }, { title: "Velocity", mime: "text/velocity" },
{ title: "Verilog", mime: "text/x-verilog" }, { title: "Verilog", mime: "text/x-verilog", highlightJs: "verilog" },
{ title: "VHDL", mime: "text/x-vhdl" }, { title: "VHDL", mime: "text/x-vhdl", highlightJs: "vhdl" },
{ title: "Vue.js Component", mime: "text/x-vue" }, { title: "Vue.js Component", mime: "text/x-vue" },
{ title: "Web IDL", mime: "text/x-webidl" }, { title: "Web IDL", mime: "text/x-webidl" },
{ default: true, title: "XML", mime: "text/xml" }, { default: true, title: "XML", mime: "text/xml", highlightJs: "xml" },
{ title: "XQuery", mime: "application/xquery" }, { title: "XQuery", mime: "application/xquery", highlightJs: "xquery" },
{ title: "xu", mime: "text/x-xu" }, { title: "xu", mime: "text/x-xu" },
{ title: "Yacas", mime: "text/x-yacas" }, { title: "Yacas", mime: "text/x-yacas" },
{ default: true, title: "YAML", mime: "text/x-yaml" }, { default: true, title: "YAML", mime: "text/x-yaml", highlightJs: "yaml" },
{ title: "Z80", mime: "text/x-z80" } { title: "Z80", mime: "text/x-z80" }
]; ];
@ -173,7 +173,7 @@ function loadMimeTypes() {
} }
} }
async function getMimeTypes() { function getMimeTypes() {
if (mimeTypes === null) { if (mimeTypes === null) {
loadMimeTypes(); loadMimeTypes();
} }

View File

@ -101,7 +101,7 @@ export default class NoteTypeWidget extends NoteContextAwareWidget {
this.$noteTypeDropdown.append($typeLink); this.$noteTypeDropdown.append($typeLink);
} }
for (const mimeType of await mimeTypesService.getMimeTypes()) { for (const mimeType of mimeTypesService.getMimeTypes()) {
if (!mimeType.enabled) { if (!mimeType.enabled) {
continue; continue;
} }
@ -128,7 +128,7 @@ export default class NoteTypeWidget extends NoteContextAwareWidget {
async findTypeTitle(type, mime) { async findTypeTitle(type, mime) {
if (type === 'code') { if (type === 'code') {
const mimeTypes = await mimeTypesService.getMimeTypes(); const mimeTypes = mimeTypesService.getMimeTypes();
const found = mimeTypes.find(mt => mt.mime === mime); const found = mimeTypes.find(mt => mt.mime === mime);
return found ? found.title : mime; return found ? found.title : mime;

View File

@ -109,7 +109,7 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
await libraryLoader.requireLibrary(libraryLoader.HIGHLIGHT_JS); await libraryLoader.requireLibrary(libraryLoader.HIGHLIGHT_JS);
const codeBlockLanguages = const codeBlockLanguages =
(await mimeTypesService.getMimeTypes()) (mimeTypesService.getMimeTypes())
.filter(mt => mt.enabled) .filter(mt => mt.enabled)
.map(mt => ({ .map(mt => ({
language: mt.mime.toLowerCase().replace(/[\W_]+/g,"-"), language: mt.mime.toLowerCase().replace(/[\W_]+/g,"-"),

View File

@ -20,7 +20,7 @@ export default class CodeMimeTypesOptions extends OptionsWidget {
async optionsLoaded(options) { async optionsLoaded(options) {
this.$mimeTypes.empty(); this.$mimeTypes.empty();
for (const mimeType of await mimeTypesService.getMimeTypes()) { for (const mimeType of mimeTypesService.getMimeTypes()) {
const id = "code-mime-type-" + (idCtr++); const id = "code-mime-type-" + (idCtr++);
this.$mimeTypes.append($("<li>") this.$mimeTypes.append($("<li>")