Low commit activity in last 3 years
No release in over a year
Make CodeMirror available as a Scrivito editor
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.0
 Project Readme

Scrivito CodeMirror Editor

Gem Version

Use CodeMirror to let your Scrivito users edit HTML attributes as source code.

Installation and Usage

Add the gem

# Gemfile
gem 'scrivito_codemirror_editor'

Add the assets

// application.js
// ...
//= require scrivito
//= require scrivito_codemirror_editor
// ...
/* application.css
 * ...
 *= require scrivito_codemirror_editor
 * ...
 */

Enable CodeMirror for a single attribute

scrivito_tag :div, :my_widget, :my_html_attribute, {}, editor: :codemirror

Enable CodeMirror for all HTML attributes on a details view

scrivito.on "load", ->
  scrivito.select_editor (element, editing) ->
    if $(element).is(".my_details_view [data-scrivito-field-type=html]")
      editing.use("codemirror")

License

This software can be used and modified under the LGPL-3.0. Please refer to http://www.gnu.org/licenses/lgpl-3.0.html for the license text.