forgejo/templates/repo
Beowulf 28e0af23fa feat(ui): replace Monaco with CodeMirror (#10559)
- Replace the [Monaco Editor](https://microsoft.github.io/monaco-editor/)
with [CodeMirror 6](https://codemirror.net/). This editor is used to
facilitate the 'Add file' and 'Edit file' functionality.
- Rationale:
  - Monaco editor is a great and powerful editor, however for Forgejo's
  purpose it acts more like a small IDE than a code editor and is doing
  too much. In my limited user research the usage of editing files via
  the web UI is largely for small changes that does not need the
  features that Monaco editor provides.
  - Monaco editor has no mobile support, Codemirror is very usable on mobile.
  - Monaco editor pulls in large dependencies (for language support) and
  by replacing it with Codemirror the amount of time that webpack needs
  to build the frontend is reduced by 50% (~30s -> ~15s).
  - The binary of Forgejo (build with `bindata` tag) is reduced by 2MiB.
  - Codemirror is much more lightweight and should be more usable on
  less powerful hardware, most notably the lazy loading is much faster
  as codemirror uses less javascript.
  - Because Codemirror is modular it is much easier to change the
  behavior of the code editor if we wish to.
- Drawbacks:
  - Codemirror is quite modular and as seen in `package.json` and in
  `codeeditor.ts` we have to supply a lot more of its features to have
  feature parity with Monaco editor.
  - Monaco editor has great integrated language support (features that
  an lsp would provide), Codemirror only has such language support to an
  extend.
  - Monaco editor has its famous command palette (known by many as its
  also available in VSCode), this is not available in code mirror.
- Good to note:
  - All features that was added on top of the monaco editor (such as
  dynamically changing language  support depending on the filename)
  still works and the theme is based on the VSCode colors which largely
  resembles the monaco editor.
  - The code editor is still lazy-loaded (this is painfully clear by
  reading how imports are passed around in `codeeditor.ts`).
  - This change was privately tested by a few people, a few bugs were
  found (and fixed) but no major drawbacks were noted for their usage of
  the web editor.
  - There's a "search" button in the top bar, so that search can be used
  on mobile. It is otherwise only accessible via
  <kbd>Ctrl</kbd>+<kbd>f</kbd>.

Co-authored-by: Beowulf <beowulf@beocode.eu>

Co-authored-by: Gusted <postmaster@gusted.xyz>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10559
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-committed-by: Beowulf <beowulf@beocode.eu>
2026-01-04 23:52:33 +01:00
..
actions fix: add missing space before 'Commit' back (#10521) 2025-12-21 04:44:40 +01:00
branch feat: convert create/rename branch and create tag to native dialog (#9760) 2025-10-30 21:06:14 +01:00
code feat: replace cross origin protection (#9830) 2025-10-29 22:43:22 +01:00
diff chore(ui): cleanup reviews css, improve consistency (#10268) 2025-12-01 01:30:25 +01:00
editor feat(ui): replace Monaco with CodeMirror (#10559) 2026-01-04 23:52:33 +01:00
find Migrate gt-hidden to tw-hidden (#30046) 2024-03-30 07:17:29 +01:00
graph fix: display orphan branches separately in commit graph (#10484) 2025-12-29 02:53:54 +01:00
issue feat: Retrieve default merge commit message for pull requests (#10022) 2026-01-01 11:45:43 +01:00
migrate feat: replace cross origin protection (#9830) 2025-10-29 22:43:22 +01:00
projects Migrate margin and padding helpers to tailwind (#30043) 2024-03-30 07:17:29 +01:00
pulls feat: UI for the pull request trust management panel 2025-11-06 11:07:39 +01:00
release ui: improve release editing (#9940) 2025-11-30 05:08:24 +01:00
settings feat(ui): replace Monaco with CodeMirror (#10559) 2026-01-04 23:52:33 +01:00
tag fix(ui): fix alignment of items in tag signature (#9398) 2025-09-24 14:54:24 +02:00
wiki feat: replace cross origin protection (#9830) 2025-10-29 22:43:22 +01:00
activity.tmpl Show repo activities even if only code unit active or git repo is empty but issue is active (#3455) 2024-04-28 13:47:52 +00:00
admin_flags.tmpl [FEAT] Repository flags 2024-02-05 16:09:42 +01:00
blame.tmpl ui(blame): remove broken padding (#4318) 2024-07-04 11:46:31 +00:00
branch_dropdown.tmpl fix(ui): show commit icon in branch dropdown button when viewing a commit (#7571) 2025-04-19 04:33:07 +00:00
clone_buttons.tmpl Refactor clone-panel styles (#29861) 2024-03-26 19:04:24 +01:00
clone_script.tmpl Customizable "Open with" applications for repository clone (#29320) 2024-03-23 11:58:54 +01:00
code_frequency.tmpl Implement code frequency graph (#29191) 2024-02-26 22:30:26 +01:00
commit_header.tmpl feat: convert create/rename branch and create tag to native dialog (#9760) 2025-10-30 21:06:14 +01:00
commit_load_branches_and_tags.tmpl Implement single-commit PR review flow (#7155) 2025-06-17 09:31:50 +02:00
commit_page.tmpl chore: extract commit header template (#8061) 2025-06-05 11:35:08 +02:00
commit_status.tmpl Restore warning commit status (#27504) 2023-10-08 22:16:06 +00:00
commit_statuses.tmpl Replace 10 more gt- classes with tw- (#29945) 2024-03-26 19:04:27 +01:00
commits.tmpl fix(ui): move file rename notice to before pagination (#8818) 2025-08-10 21:35:34 +02:00
commits_list.tmpl feat: add tag label to commit list view (#8759) 2025-08-06 14:47:51 +02:00
commits_list_small.tmpl Implement single-commit PR review flow (#7155) 2025-06-17 09:31:50 +02:00
commits_search_dropdown.tmpl Unify search boxes (#29530) 2024-03-20 12:31:05 +00:00
commits_table.tmpl fix(ui): move file rename notice to before pagination (#8818) 2025-08-10 21:35:34 +02:00
contributors.tmpl Add "n commits" link to contributors in contributors graph page (#32799) 2024-12-15 13:21:02 +01:00
create.tmpl feat: replace cross origin protection (#9830) 2025-10-29 22:43:22 +01:00
create_advanced.tmpl New repo: Rework advanced and template sections 2024-12-28 22:32:19 +01:00
create_basic.tmpl fix(ui): make limits clearer in create repo form (#7402) 2025-05-20 16:37:15 +02:00
create_from_template.tmpl New repo: Rework advanced and template sections 2024-12-28 22:32:19 +01:00
create_helper.tmpl Remove incorrect and unnecessary Escape from templates (#29394) 2024-02-26 22:30:27 +01:00
create_init.tmpl fix(ui): wrap items in gitignore dropdown (#8830) 2025-08-09 19:33:18 +02:00
empty.tmpl fix(ui): clarify repo init instruction for sha256 (#7394) 2025-03-30 18:08:05 +00:00
file_info.tmpl [UI] Adjust trailing EOL behavior for empty file 2024-08-19 20:23:15 +02:00
flags.tmpl feat: replace cross origin protection (#9830) 2025-10-29 22:43:22 +01:00
forks.tmpl Migrate margin and padding helpers to tailwind (#30043) 2024-03-30 07:17:29 +01:00
graph.tmpl fix(ui): use gap in switch items (#7581) 2025-04-21 04:25:08 +00:00
header.tmpl fix(ui): replace obsolete gt- helpers (#9964) 2025-11-08 18:21:05 +01:00
header_fork.tmpl feat: improve tooltips and aria-labels of stars/forks/watchers links (#9754) 2025-10-19 18:33:26 +02:00
home.tmpl feat(ui): add switch between formats when previewing CITATION.{cff,bib} files (#9103) 2025-11-14 14:39:20 +01:00
icon.tmpl Replace 10 more gt- classes with tw- (#29945) 2024-03-26 19:04:27 +01:00
latest_commit.tmpl Show if commit is signed in activity feed and unify sha box (#6933) 2025-05-03 10:54:52 +00:00
navbar.tmpl Hide activity contributors, recent commits and code frequrency left tabs if there is no code permission (#34053) 2025-04-01 02:28:02 +02:00
packages.tmpl Fix inconsistent user profile layout across tabs (#25625) 2023-07-06 18:59:24 +00:00
pulse.tmpl chore(i18n): move some plural strings to json (#9463) 2025-09-29 09:27:50 +02:00
recent_commits.tmpl Implement recent commits graph (#29210) 2024-02-26 22:30:26 +01:00
release_tag_header.tmpl fix(ui/releases): strech elements apart when no search bar (#9626) 2025-10-11 05:39:10 +02:00
search.tmpl ui(code-search): fix to use CodeSearchMode 2024-09-16 16:20:55 +02:00
search_name.tmpl Clean template/helper.go (#23922) 2023-04-07 03:31:41 -04:00
shabox.tmpl chore(ui): improve hashbox (#8721) 2025-08-03 05:49:24 +02:00
shabox_badge.tmpl chore(ui): clean up hashbox CSS, small design changes (#7822) 2025-05-25 12:51:27 +02:00
star_unstar.tmpl feat: improve tooltips and aria-labels of stars/forks/watchers links (#9754) 2025-10-19 18:33:26 +02:00
sub_menu.tmpl feat(ui): responsive, JS-free repo language stats panel (#9532) 2025-10-05 20:36:35 +02:00
unicode_escape_prompt.tmpl templates: remove superfluous SanitizeHTML 2024-03-11 23:36:58 +07:00
upload.tmpl Always use ctx.Locale.Tr inside templates (#27231) 2023-09-25 08:56:50 +00:00
user_cards.tmpl fix(ui): ensure same width of usercards in grid (#6799) 2025-05-25 13:31:53 +02:00
view_file.tmpl feat(ui): add switch between formats when previewing CITATION.{cff,bib} files (#9103) 2025-11-14 14:39:20 +01:00
view_list.tmpl git/commit: re-implement submodules file reader (#8438) 2025-07-15 00:20:00 +02:00
watch_unwatch.tmpl feat: improve tooltips and aria-labels of stars/forks/watchers links (#9754) 2025-10-19 18:33:26 +02:00
watchers.tmpl Fix user-cards format (#24428) 2023-04-29 15:43:01 -04:00