geoproject-app/public/site/plugins/code-editor
isUnknown 0f46618066
All checks were successful
Deploy / Build and Deploy to Production (push) Successful in 16s
feat: add custom CSS save system with dual-editor interface
Implement complete custom CSS management system:
- Separate base CSS (readonly) and custom CSS (editable)
- Save custom CSS to Kirby backend per narrative
- Visual save button with state indicators (dirty/saving/success/error)
- CSRF-protected API endpoint for CSS operations
- Dual-editor StylesheetViewer (base + custom with edit mode toggle)
- Auto-format custom CSS with Prettier on edit mode exit

Backend changes:
- Add web2print Kirby plugin with POST/GET routes
- Add customCss field to narrative blueprint
- Add CSRF token meta tag in header
- Include customCss and modified timestamps in JSON template
- Install code-editor plugin for Kirby panel

Frontend changes:
- Refactor stylesheet store with baseCss/customCss refs
- Make content a computed property (baseCss + customCss)
- Add helper methods: replaceBlock, replaceInCustomCss, setCustomCss
- Update all components to use new store API
- Create SaveButton component with FAB design
- Redesign StylesheetViewer with collapsable sections
- Initialize store from narrative data on app mount

File changes:
- Rename stylesheet.css → stylesheet.print.css
- Update all references to new filename

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-09 13:39:25 +01:00
..
lib/fields feat: add custom CSS save system with dual-editor interface 2026-01-09 13:39:25 +01:00
src feat: add custom CSS save system with dual-editor interface 2026-01-09 13:39:25 +01:00
.editorconfig feat: add custom CSS save system with dual-editor interface 2026-01-09 13:39:25 +01:00
.gitignore feat: add custom CSS save system with dual-editor interface 2026-01-09 13:39:25 +01:00
composer.json feat: add custom CSS save system with dual-editor interface 2026-01-09 13:39:25 +01:00
eslint.config.mjs feat: add custom CSS save system with dual-editor interface 2026-01-09 13:39:25 +01:00
index.css feat: add custom CSS save system with dual-editor interface 2026-01-09 13:39:25 +01:00
index.js feat: add custom CSS save system with dual-editor interface 2026-01-09 13:39:25 +01:00
index.php feat: add custom CSS save system with dual-editor interface 2026-01-09 13:39:25 +01:00
LICENSE feat: add custom CSS save system with dual-editor interface 2026-01-09 13:39:25 +01:00
package.json feat: add custom CSS save system with dual-editor interface 2026-01-09 13:39:25 +01:00
README.md feat: add custom CSS save system with dual-editor interface 2026-01-09 13:39:25 +01:00

Kirby Code editor

Code editor field for Kirby 3, 4 and 5.

screenshot-code-editor


Overview

This plugin is completely free and published under the MIT license. However, if you are using it in a commercial project and want to help me keep up with maintenance, you can consider making a donation of your choice.


1. Installation

Download and copy this repository to /site/plugins/code-editor

Alternatively, you can install it with composer: composer require sylvainjule/code-editor


2. Setup

This field adds a code editor in the panel:

editor:
  label: My code editor
  type: code-editor

3. Options

Name Type Default Options Description
language String 'css' - Syntax mode of the editor. See below for available languages
size String 'small' - Min height of the editor. small / medium / large / huge
lineNumbers Boolean true - Whether to show line numbers.
tabSize number 4 - The number of characters to insert when pressing tab key.
insertSpaces boolean true - Whether to use spaces for indentation. If you set it to false, you might also want to set tabSize to 1
ignoreTabKey boolean false - Whether the editor should ignore tab key presses so that keyboard users can tab past the editor. Users can toggle this behaviour using Ctrl+Shift+M (Mac) / Ctrl+M manually when this is false.

Note that you can make the default height any height you want with some custom panel CSS. First, set the size option to any string you'd like:

size: custom-size

Then in your panel.css:

.k-code-editor-input[data-size="custom-size"] {
    min-height: 15rem;
}

3.1. Default options

You can globally override the default options, instead of setting them on a per-field basis. In your site/config/config.php:

return [
  'sylvainjule.code-editor.language'     => 'css',
  'sylvainjule.code-editor.size'         => 'small',
  'sylvainjule.code-editor.lineNumbers'  => true,
  'sylvainjule.code-editor.tabSize'      => 4,
  'sylvainjule.code-editor.insertSpaces' => true,
  'sylvainjule.code-editor.ignoreTabKey' => false,
];

4. Available languages

Currently supported languages are:

  • css
  • javascript
  • json
  • less
  • php
  • python
  • ruby
  • scss
  • yaml

5. License

MIT


6. Credits

Code editor: