Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
ddf43a5
chore(nx): create project for codemirror
eliandoran May 10, 2025
cfa8987
feat(code): switch to CodeMirror 6
eliandoran May 10, 2025
c84a390
feat(code): enable line numbers
eliandoran May 10, 2025
0c9be92
fix(code): set initial text
eliandoran May 10, 2025
ef312c9
refactor(code): use dedicated method for setting text
eliandoran May 10, 2025
3e5e909
fix(code): saving on change
eliandoran May 10, 2025
385809d
fix(code): reintroduce indent with tab
eliandoran May 10, 2025
71218c0
chore(code): enable syntax highlighting plugin
eliandoran May 10, 2025
8bb1ac7
chore(code): start mapping syntax highlight
eliandoran May 10, 2025
5a07d5a
chore(code): define legacy mappings
eliandoran May 10, 2025
01f02b7
chore(code): enable syntax highlighting
eliandoran May 10, 2025
efc08a6
chore(code): reintegrate batch syntax
eliandoran May 11, 2025
9f3e990
chore(code): reintegrate hcl syntax
eliandoran May 11, 2025
55cf7e0
refactor(code): sort by mime type
eliandoran May 11, 2025
7cd4bce
feat(code): support gdscript (godot)
eliandoran May 11, 2025
d29286f
chore(code): reintroduce placeholder
eliandoran May 11, 2025
9867cd8
chore(code): reintroduce tab size of 4
eliandoran May 11, 2025
2628132
chore(code): reintroduce line wrapping
eliandoran May 11, 2025
ec72800
chore(code): reintroduce highlight active line & selection
eliandoran May 11, 2025
df92ec9
chore(code): reintroduce bracket matching
eliandoran May 11, 2025
67d1868
chore(code): mark syntax highlighting as fallback
eliandoran May 11, 2025
a4054df
chore(code): reintroduce history (undo-redo)
eliandoran May 11, 2025
9c81260
fix(code): history of undo/redo preserved across notes
eliandoran May 11, 2025
686e575
chore(code): integrate more legacy modes
eliandoran May 11, 2025
afa1aa3
chore(code): integrate Markdown support
eliandoran May 11, 2025
1454af6
chore(code): integrate PHP support
eliandoran May 11, 2025
327fe21
chore(code): integrate Vue support
eliandoran May 11, 2025
620927d
chore(code): integrate Twig support
eliandoran May 11, 2025
2fe0914
chore(code): integrate Smarty support
eliandoran May 11, 2025
e5402ab
chore(code): use html plugin
eliandoran May 11, 2025
06e1144
chore(code): use XML plugin
eliandoran May 11, 2025
c09d3ae
chore(code): use CSS plugin
eliandoran May 11, 2025
dbfc36f
chore(code): integrate JavaScript extension
eliandoran May 11, 2025
fade41f
chore(code): integrate JavaScript for TypeScript and JSX
eliandoran May 11, 2025
38fbaab
chore(code): integrate ESLint
eliandoran May 11, 2025
2476f38
chore(code): set up test for eslint
eliandoran May 11, 2025
9e5f2bf
chore(code): fix type errors
eliandoran May 11, 2025
7fda705
chore(code): use proper JSON extension
eliandoran May 11, 2025
9d363fb
refactor(code): clean up library_loader
eliandoran May 11, 2025
e5fad63
chore(code): set up TypeScript TSX
eliandoran May 11, 2025
9b958fc
chore(code): reintroduce vim keybindings
eliandoran May 11, 2025
9bbe111
chore(code): introduce fold gutter
eliandoran May 11, 2025
4bac035
chore(code): add smart tab behaviour
eliandoran May 11, 2025
8d18823
chore(code): support multiple selections in tab
eliandoran May 11, 2025
44069b8
chore(code): replace tab if pressed while selected
eliandoran May 11, 2025
efece39
chore(code): adapt stylesheet
eliandoran May 11, 2025
f0ae5ae
chore(code): fix placeholder
eliandoran May 11, 2025
b1f08b9
feat(code): remove unnecessary border in read-only code
eliandoran May 11, 2025
c24e1f0
fix(code): syntax highlighting not working in read-only code
eliandoran May 11, 2025
49838fb
refactor(code): stop exposing CodeMirror configuration
eliandoran May 11, 2025
3e5e19b
chore(code): reintroduce read-only mode
eliandoran May 11, 2025
a20a51f
fix(code): indentation working in read-only mode
eliandoran May 11, 2025
2704548
chore(code): stop loading unnecessary extensions for read-only mode
eliandoran May 11, 2025
58b9d90
feat(mermaid): add basic syntax highlight
eliandoran May 11, 2025
e4f5e54
chore(release): update changelog
eliandoran May 11, 2025
ce5debd
fix(mermaid): diagram not updating
eliandoran May 11, 2025
2b192eb
feat(code): add Nix language
eliandoran May 11, 2025
cf7c5d3
feat(text): add Nix language
eliandoran May 11, 2025
3624610
feat(codemirror): add model for themes
eliandoran May 11, 2025
7475e94
chore(settings): empty section for code notes color theme
eliandoran May 11, 2025
ca467fc
feat(server): add endpoint to list code note themes
eliandoran May 11, 2025
224b7f4
feat(options): list color themes
eliandoran May 11, 2025
92dcfb3
feat(server): define code note theme option
eliandoran May 11, 2025
af187d1
feat(client): set color scheme option
eliandoran May 11, 2025
b2aec4d
feat(code): display user-selected color themes
eliandoran May 11, 2025
340dec7
fix(code): align syntax highlight settings
eliandoran May 11, 2025
d80d97c
feat(code): add the rest of the themes
eliandoran May 11, 2025
d41b780
feat(code): friendly theme names
eliandoran May 11, 2025
f0d2fbc
feat(code): update theme automatically when changed
eliandoran May 11, 2025
34a1f48
refactor(code): use hyphens for theme ID
eliandoran May 11, 2025
bd26e1a
feat(code): provide sensible theme defaults
eliandoran May 11, 2025
65699ba
style(code): slight adjustments
eliandoran May 11, 2025
9875d4b
feat(code): basic theme preview for code notes
eliandoran May 11, 2025
81a7133
fix(code): apply syntax highlighting to preview
eliandoran May 11, 2025
21a72ab
style(code): improve margins for preview
eliandoran May 11, 2025
4e18798
feat(code): move preview to apperance
eliandoran May 11, 2025
d79977b
feat(code): adjust word wrapping automatically in preview
eliandoran May 11, 2025
e3aa8af
feat(code): adjust word wrapping automatically
eliandoran May 11, 2025
fac16ff
feat(code): add translations for settings change
eliandoran May 11, 2025
46c689e
docs(release): update changelog
eliandoran May 11, 2025
00a9908
Merge remote-tracking branch 'origin/develop' into feature/codemirror6
eliandoran May 12, 2025
bedbc93
chore(code): reintroduce some commented-out behaviours
eliandoran May 12, 2025
260e6ee
feat(options): move code block appearance settings to "Text notes"
eliandoran May 12, 2025
5f2314f
chore(options): change translations for code block appearance
eliandoran May 12, 2025
42ed616
style(options): reduce margins for code block appearance
eliandoran May 12, 2025
1a7a651
feat(options): add a related settings option for Appearance
eliandoran May 12, 2025
1719480
chore(code): reintroduce tab index
eliandoran May 12, 2025
3600930
refactor(server): remove dependency on codemirror
eliandoran May 12, 2025
ac49c0f
refactor(server): remove dependency on codemirror project
eliandoran May 12, 2025
f20232c
fix(code/find): crashes at dialog shown
eliandoran May 12, 2025
749ae1b
chore(code/find): reintroduce match highlighting
eliandoran May 12, 2025
f2745d5
chore(code/find): reintroduce total number of results
eliandoran May 12, 2025
c4863de
chore(code/find): jump to first result
eliandoran May 12, 2025
e08011b
chore(code/find): scroll to nearest result
eliandoran May 12, 2025
e541782
chore(code/find): update current found
eliandoran May 12, 2025
8a35e39
refactor(code/find): remove inner class
eliandoran May 12, 2025
ba2dae4
refactor(code/find): integrate search into find plugin
eliandoran May 12, 2025
2fbff53
chore(options): remove redundant log
eliandoran May 12, 2025
22d9091
refactor(code/find): reimplement find next
eliandoran May 12, 2025
3b7870f
chore(deps): update lock file
eliandoran May 12, 2025
07a751c
fix(server): assets that were no longer needed
eliandoran May 12, 2025
da6cb71
fix(code/find): infinite loop when empty
eliandoran May 12, 2025
77fe100
fix(code/find): clean up search
eliandoran May 12, 2025
690337e
chore(code/find): reintroduce highlight for active item
eliandoran May 12, 2025
b646475
chore(code/find): reimplement single replace
eliandoran May 12, 2025
3ace3d9
chore(code/find): reimplement replace all
eliandoran May 13, 2025
28aaa28
feat(code): integrate indentation markers
eliandoran May 13, 2025
41f142a
feat(code): re-trigger search after replace
eliandoran May 13, 2025
1f57aaf
feat(code): proper search for read-only notes
eliandoran May 13, 2025
cead31e
fix(e2e): code script broken due to codemirror update
eliandoran May 13, 2025
cfe3aa5
chore(release): document regression in syntax highlighting
eliandoran May 13, 2025
588a9dc
chore(edit-docs): fix nixos serve script
eliandoran May 13, 2025
3a984ff
feat(docs): color schemes for code notes
eliandoran May 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
"@popperjs/core": "2.11.8",
"@triliumnext/ckeditor5": "workspace:*",
"@triliumnext/commons": "workspace:*",
"@triliumnext/codemirror": "workspace:*",
"bootstrap": "5.3.6",
"dayjs": "1.11.13",
"dayjs-plugin-utc": "0.1.2",
"debounce": "2.2.0",
"draggabilly": "3.0.0",
"eslint-linter-browserify": "9.26.0",
"force-graph": "1.49.5",
"globals": "16.1.0",
"i18next": "25.1.2",
Expand Down
3 changes: 2 additions & 1 deletion apps/client/src/components/note_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type { ViewScope } from "../services/link.js";
import type FNote from "../entities/fnote.js";
import type TypeWidget from "../widgets/type_widgets/type_widget.js";
import type { CKTextEditor } from "@triliumnext/ckeditor5";
import type CodeMirror from "@triliumnext/codemirror";

export interface SetNoteOpts {
triggerSwitchEvent?: unknown;
Expand Down Expand Up @@ -312,7 +313,7 @@ class NoteContext extends Component implements EventListener<"entitiesReloaded">

async getCodeEditor() {
return this.timeout(
new Promise<CodeMirrorInstance>((resolve) =>
new Promise<CodeMirror>((resolve) =>
appContext.triggerCommand("executeWithCodeEditor", {
resolve,
ntxId: this.ntxId
Expand Down
74 changes: 0 additions & 74 deletions apps/client/src/libraries/codemirror/eslint.js

This file was deleted.

2 changes: 0 additions & 2 deletions apps/client/src/services/glob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import libraryLoader from "./library_loader.js";
import ws from "./ws.js";
import froca from "./froca.js";
import linkService from "./link.js";
import { lint } from "./eslint.js";

function setupGlobs() {
window.glob.isDesktop = utils.isDesktop;
Expand All @@ -19,7 +18,6 @@ function setupGlobs() {
// required for ESLint plugin and CKEditor
window.glob.getActiveContextNote = () => appContext.tabManager.getActiveContextNote();
window.glob.requireLibrary = libraryLoader.requireLibrary;
window.glob.linter = lint;
window.glob.appContext = appContext; // for debugging
window.glob.froca = froca;
window.glob.treeCache = froca; // compatibility for CKEditor builds for a while
Expand Down
32 changes: 0 additions & 32 deletions apps/client/src/services/library_loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,6 @@ export interface Library {
css?: string[];
}

const CODE_MIRROR: Library = {
js: () => {
const scriptsToLoad = [
"node_modules/codemirror/lib/codemirror.js",
"node_modules/codemirror/addon/display/placeholder.js",
"node_modules/codemirror/addon/edit/matchbrackets.js",
"node_modules/codemirror/addon/edit/matchtags.js",
"node_modules/codemirror/addon/fold/xml-fold.js",
"node_modules/codemirror/addon/lint/lint.js",
"node_modules/codemirror/addon/mode/loadmode.js",
"node_modules/codemirror/addon/mode/multiplex.js",
"node_modules/codemirror/addon/mode/overlay.js",
"node_modules/codemirror/addon/mode/simple.js",
"node_modules/codemirror/addon/search/match-highlighter.js",
"node_modules/codemirror/mode/meta.js",
"node_modules/codemirror/keymap/vim.js",
"libraries/codemirror/eslint.js"
];

const mimeTypes = mimeTypesService.getMimeTypes();
for (const mimeType of mimeTypes) {
if (mimeType.enabled && mimeType.codeMirrorSource) {
scriptsToLoad.push(mimeType.codeMirrorSource);
}
}

return scriptsToLoad;
},
css: ["node_modules/codemirror/lib/codemirror.css", "node_modules/codemirror/addon/lint/lint.css"]
};

const KATEX: Library = {
js: ["node_modules/katex/dist/katex.min.js", "node_modules/katex/dist/contrib/mhchem.min.js", "node_modules/katex/dist/contrib/auto-render.min.js"],
css: ["node_modules/katex/dist/katex.min.css"]
Expand Down Expand Up @@ -152,7 +121,6 @@ export default {
requireCss,
requireLibrary,
loadHighlightingTheme,
CODE_MIRROR,
KATEX,
HIGHLIGHT_JS
};
2 changes: 2 additions & 0 deletions apps/client/src/services/mime_type_definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const MIME_TYPES_DICT: readonly MimeTypeDefinition[] = Object.freeze([
{ title: "Forth", mime: "text/x-forth" },
{ title: "Fortran", mime: "text/x-fortran", highlightJs: "fortran" },
{ title: "Gas", mime: "text/x-gas" },
{ title: "GDScript (Godot)", mime: "text/x-gdscript" },
{ title: "Gherkin", mime: "text/x-feature", highlightJs: "gherkin" },
{ title: "GitHub Flavored Markdown", mime: "text/x-gfm", highlightJs: "markdown" },
{ title: "Go", mime: "text/x-go", highlightJs: "go", default: true },
Expand Down Expand Up @@ -106,6 +107,7 @@ export const MIME_TYPES_DICT: readonly MimeTypeDefinition[] = Object.freeze([
{ title: "msgenny", mime: "text/x-msgenny" },
{ title: "MUMPS", mime: "text/x-mumps" },
{ title: "MySQL", mime: "text/x-mysql", highlightJs: "sql" },
{ title: "Nix", mime: "text/x-nix", highlightJs: "nix" },
{ title: "Nginx", mime: "text/x-nginx-conf", highlightJs: "nginx" },
{ title: "NSIS", mime: "text/x-nsis", highlightJs: "nsis" },
{ title: "NTriples", mime: "application/n-triples" },
Expand Down
31 changes: 11 additions & 20 deletions apps/client/src/stylesheets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -420,33 +420,24 @@ body.desktop #context-menu-container .dropdown-item > span {
width: 100%;
}

.CodeMirror {
.cm-editor {
height: 100%;
background: inherit;
outline: none !important;
border-radius: 6px;
overflow: hidden;
margin: 4px;
}

body .CodeMirror {
body .cm-editor {
font-size: var(--monospace-font-size);
}

.CodeMirror-gutters {
body .cm-editor .cm-gutters {
background-color: inherit !important;
border-right: none;
}

.cm-matchhighlight {
background-color: #eeeeee;
}

.cm-matchhighlight.ck-find-result{
background: var(--ck-color-highlight-background);
}

.cm-matchhighlight.ck-find-result_selected {
background-color: #ff9633;
}

.CodeMirror pre.CodeMirror-placeholder {
body .cm-editor .cm-placeholder {
color: #999 !important;
}

Expand All @@ -457,11 +448,11 @@ body .CodeMirror {
margin-bottom: 10px;
}

#sql-console-query .CodeMirror {
#sql-console-query .cm-editor {
height: 150px;
}

#sql-console-query .CodeMirror-scroll {
#sql-console-query .cm-editor .cm-scroller {
min-height: inherit !important;
}

Expand Down Expand Up @@ -524,7 +515,7 @@ button.btn-sm {
padding: 0;
}

pre:not(.CodeMirror-line):not(.hljs) {
pre:not(.hljs) {
color: var(--main-text-color) !important;
white-space: pre-wrap;
font-size: 100%;
Expand Down
4 changes: 0 additions & 4 deletions apps/client/src/stylesheets/theme-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ body ::-webkit-calendar-picker-indicator {
filter: invert(1);
}

body .CodeMirror {
filter: invert(90%) hue-rotate(180deg);
}

.excalidraw.theme--dark {
--theme-filter: invert(80%) hue-rotate(180deg) !important;
}
Expand Down
4 changes: 0 additions & 4 deletions apps/client/src/stylesheets/theme-next-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,6 @@ body ::-webkit-calendar-picker-indicator {
filter: invert(1);
}

body .CodeMirror {
filter: invert(90%) hue-rotate(180deg);
}

.excalidraw.theme--dark {
--theme-filter: invert(80%) hue-rotate(180deg) !important;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/translations/cn/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1616,7 +1616,7 @@
"auto-detect-language": "自动检测"
},
"highlighting": {
"title": "文本笔记的代码语法高亮",
"title": "",
"description": "控制文本笔记中代码块的语法高亮,代码笔记不会受到影响。",
"color-scheme": "颜色方案"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/translations/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1568,7 +1568,7 @@
"auto-detect-language": "Automatisch erkannt"
},
"highlighting": {
"title": "Code-Syntax-Hervorhebung für Textnotizen",
"title": "",
"description": "Steuert die Syntaxhervorhebung für Codeblöcke in Textnotizen, Code-Notizen sind nicht betroffen.",
"color-scheme": "Farbschema"
},
Expand Down
9 changes: 6 additions & 3 deletions apps/client/src/translations/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1247,13 +1247,11 @@
"reprocessing_embeddings": "Reprocessing...",
"reprocess_started": "Embedding reprocessing started in the background",
"reprocess_error": "Error starting embedding reprocessing",

"reprocess_index": "Rebuild Search Index",
"reprocess_index_description": "Optimize the search index for better performance. This uses existing embeddings without regenerating them (much faster than reprocessing all embeddings).",
"reprocessing_index": "Rebuilding...",
"reprocess_index_started": "Search index optimization started in the background",
"reprocess_index_error": "Error rebuilding search index",

"index_rebuild_progress": "Index Rebuild Progress",
"index_rebuilding": "Optimizing index ({{percentage}}%)",
"index_rebuild_complete": "Index optimization complete",
Expand Down Expand Up @@ -1824,7 +1822,7 @@
"auto-detect-language": "Auto-detected"
},
"highlighting": {
"title": "Code Syntax Highlighting for Text Notes",
"title": "Code Blocks",
"description": "Controls the syntax highlighting for code blocks inside text notes, code notes will not be affected.",
"color-scheme": "Color Scheme"
},
Expand Down Expand Up @@ -1953,5 +1951,10 @@
},
"svg": {
"export_to_png": "The diagram could not be exported to PNG."
},
"code_theme": {
"title": "Appearance",
"word_wrapping": "Word wrapping",
"color-scheme": "Color scheme"
}
}
2 changes: 1 addition & 1 deletion apps/client/src/translations/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,7 @@
"auto-detect-language": "Detectado automáticamente"
},
"highlighting": {
"title": "Resaltado de sintaxis de de código para Notas de Texto",
"title": "",
"description": "Controla el resaltado de sintaxis para bloques de código dentro de las notas de texto, las notas de código no serán afectadas.",
"color-scheme": "Esquema de color"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/translations/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1574,7 +1574,7 @@
"auto-detect-language": "Détecté automatiquement"
},
"highlighting": {
"title": "Coloration syntaxique du code pour les notes texte",
"title": "",
"description": "Contrôle la coloration syntaxique des blocs de code à l'intérieur des notes texte, les notes de code ne seront pas affectées.",
"color-scheme": "Jeu de couleurs"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/translations/ro/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,7 @@
},
"highlighting": {
"color-scheme": "Temă de culori",
"title": "Evidențiere de sintaxă pentru notițele de tip text",
"title": "",
"description": "Controlează evidențierea de sintaxă pentru blocurile de cod în interiorul notițelor text, notițele de tip cod nu vor fi afectate de aceste setări."
},
"code_block": {
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/translations/tw/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1514,7 +1514,7 @@
"auto-detect-language": "自動檢測"
},
"highlighting": {
"title": "文字筆記的程式碼語法高亮",
"title": "",
"description": "控制文字筆記中程式碼塊的語法高亮,程式碼筆記不會受到影響。",
"color-scheme": "顏色方案"
},
Expand Down
Loading
Loading