Files
nairobi/app/assets/javascripts/html_editor.js
Javi Martín 6ef07f8a54 Use text_area instead of cktext_area
We're going to change CKEditor to an inline editor, and the "ckeditor"
gem doesn't provide an option to do so.

Since using `cktext_area` would automatically generate a "classic"
iframe CKEditor, we need to use `text_area` and load the editor using
JavaScript. Personally I prefer this option anyway.

Note in the jQuery selector we need to use `textarea.html-area`; using
just `.html-area` would fail if there's an error message associated to
the textarea, since Rails will add the `.html-area` class to the error
message.
2019-10-25 16:34:25 +02:00

15 lines
417 B
JavaScript

(function() {
"use strict";
App.HTMLEditor = {
initialize: function() {
$("textarea.html-area").each(function() {
if ($(this).hasClass("admin")) {
CKEDITOR.replace(this.name, { language: $("html").attr("lang"), toolbar: "admin", height: 500 });
} else {
CKEDITOR.replace(this.name, { language: $("html").attr("lang") });
}
});
}
};
}).call(this);