Creates an Ace Code Editor (https://ace.c9.io/)
- Silverstripe 4+ or 5+
- PHP 8+
composer require kevingroeger/codeeditorfield
$codeEditor = CodeEditorField::create('Title', 'Enter Source Code Here');
// set mode to html (default is json)
$codeEditor->setMode('ace/mode/html');
// set mode to github (default is monokai)
$codeEditor->setTheme('ace/theme/github');
$fields->addFieldsToTab('Root.Main', [
$codeEditor
]);
For available modes and themes, see resources/thirdparty/ace
-
Thanks to @nathancox for creating this repository https://github.com/nathancox/silverstripe-codeeditorfield
-
Thanks to @jinjie for creating this repository https://github.com/jinjie/codeeditorfield
Both have stopped development, but this package is highly inspired by the great work of these two!