mirror of
https://github.com/zadam/trilium.git
synced 2025-06-05 01:18:44 +02:00
ckeditor 16 with code blocks plugin
This commit is contained in:
parent
af10f0f52a
commit
01cd9d8fb3
2
libraries/ckeditor/ckeditor.js
vendored
2
libraries/ckeditor/ckeditor.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "trilium",
|
||||
"version": "0.37.7",
|
||||
"version": "0.37.8",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import optionsService from "./options.js";
|
||||
|
||||
const MIME_TYPES_DICT = [
|
||||
{ default: true, title: "Plain text", mime: "text/plain" },
|
||||
{ title: "APL", mime: "text/apl" },
|
||||
{ title: "PGP", mime: "application/pgp" },
|
||||
{ title: "ASN.1", mime: "text/x-ttcn-asn" },
|
||||
@ -91,7 +92,6 @@ const MIME_TYPES_DICT = [
|
||||
{ default: true, title: "Perl", mime: "text/x-perl" },
|
||||
{ default: true, title: "PHP", mime: "text/x-php" },
|
||||
{ title: "Pig", mime: "text/x-pig" },
|
||||
{ title: "Plain Text", mime: "text/plain" },
|
||||
{ title: "PLSQL", mime: "text/x-plsql" },
|
||||
{ title: "PostgreSQL", mime: "text/x-pgsql" },
|
||||
{ title: "PowerShell", mime: "application/x-powershell" },
|
||||
@ -168,7 +168,7 @@ function loadMimeTypes(options) {
|
||||
|| MIME_TYPES_DICT.filter(mt => mt.default).map(mt => mt.mime);
|
||||
|
||||
for (const mt of mimeTypes) {
|
||||
mt.enabled = enabledMimeTypes.includes(mt.mime);
|
||||
mt.enabled = enabledMimeTypes.includes(mt.mime) || mt.mime === 'text/plain'; // text/plain is always enabled
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import libraryLoader from "./library_loader.js";
|
||||
import treeService from './tree.js';
|
||||
import noteAutocompleteService from './note_autocomplete.js';
|
||||
import mimeTypesService from './mime_types.js';
|
||||
|
||||
class NoteDetailText {
|
||||
/**
|
||||
@ -41,6 +42,16 @@ class NoteDetailText {
|
||||
// textEditor might have been initialized during previous await so checking again
|
||||
// looks like double initialization can freeze CKEditor pretty badly
|
||||
if (!this.textEditor) {
|
||||
const codeBlockLanguages =
|
||||
(await mimeTypesService.getMimeTypes())
|
||||
.filter(mt => mt.enabled)
|
||||
.map(mt => {
|
||||
return {
|
||||
language: mt.mime.toLowerCase().replace(/[\W_]+/g,"-"),
|
||||
label: mt.title
|
||||
}
|
||||
});
|
||||
|
||||
this.textEditor = await BalloonEditor.create(this.$editorEl[0], {
|
||||
placeholder: "Type the content of your note here ...",
|
||||
mention: {
|
||||
@ -77,6 +88,9 @@ class NoteDetailText {
|
||||
minimumCharacters: 0
|
||||
}
|
||||
]
|
||||
},
|
||||
codeBlock: {
|
||||
languages: codeBlockLanguages
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -196,7 +196,7 @@ body {
|
||||
|
||||
--ck-color-todo-list-checkmark-border: var(--main-border-color);
|
||||
|
||||
--ck-color-engine-placeholder-text: var(--main-text-color);
|
||||
--ck-color-engine-placeholder-text: var(--muted-text-color);
|
||||
}
|
||||
|
||||
body {
|
||||
|
Loading…
x
Reference in New Issue
Block a user