Add the awesome in-browser code editor CodeMirror as a field type.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
resources/img
src
.editorconfig
.gitignore
CHANGELOG.md
LICENSE.md
README.md
composer.json

README.md

CodeMirror plugin for Craft CMS 3.x

Add the awesome in-browser code editor CodeMirror as a field type.

Screenshot

Installation

To install CodeMirror, follow these steps:

  1. Install with Composer via composer require luwes/craft3-codemirror
  2. Install plugin in the Craft Control Panel under Settings > Plugins

CodeMirror works on Craft 3.x.

CodeMirror Overview

https://github.com/codemirror/codemirror

Configuring CodeMirror

Copy the config.php file, rename to codemirror.php and place in the craft config folder to override the default options.

return [
	"jsOptions" => [
		"theme" => "default",
		"mode" => "gfm",
		"lineNumbers" => true,
		"lineWrapping" => true,
		"viewportMargin" => new JsExpression('Infinity'),
	],
	"modes" => [
		"xml",
		"htmlmixed",
		"javascript",
		"css",
		"markdown",
		"gfm",
	],
	"addons" => [
		"mode/overlay", // needed for gfm (github flavored) mode
	]
];

CodeMirror Roadmap

Some things to do, and ideas for potential features:

  • Release it

Brought to you by Wesley Luyten