Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luwes/craft-codemirror
Add the awesome in-browser code editor CodeMirror as a field type.
https://github.com/luwes/craft-codemirror
codemirror craft-plugin craftcms fieldtype
Last synced: 8 days ago
JSON representation
Add the awesome in-browser code editor CodeMirror as a field type.
- Host: GitHub
- URL: https://github.com/luwes/craft-codemirror
- Owner: luwes
- License: mit
- Created: 2017-03-14T04:39:23.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-09-24T14:26:45.000Z (about 2 years ago)
- Last Synced: 2024-10-04T13:32:10.894Z (about 1 month ago)
- Topics: codemirror, craft-plugin, craftcms, fieldtype
- Language: JavaScript
- Size: 977 KB
- Stars: 18
- Watchers: 5
- Forks: 10
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# CodeMirror plugin for Craft CMS
Add the awesome in-browser code editor CodeMirror as a field type.
![Screenshot](resources/img/codemirror-screenshot.png)
## Installation
To install CodeMirror, follow these steps:
1. Install with Composer via `composer require luwes/craft-codemirror`
2. Install plugin in the Craft Control Panel under Settings > PluginsCodeMirror works on Craft 3.x and 4.x.
## CodeMirror Overview
https://github.com/codemirror/codemirror
## Configuring CodeMirror
Copy the code below, create a file named `code-mirror.php` and place it in the craft config folder to override the default options.
``` php
return [
'jsOptions' => [
'theme' => 'default',
'lineNumbers' => true,
'lineWrapping' => true,
'viewportMargin' => new JsExpression('Infinity'),
],
'modes' => [
'gfm', // the first mode is enabled by default
'markdown',
'htmlmixed',
'javascript',
'css',
'xml',
],
'addons' => [
'mode/overlay', // needed for gfm (github flavored) mode
]
];
```Brought to you by [Wesley Luyten](https://wesleyluyten.com)