зеркало из
https://github.com/rs-pro/activeadmin-quill_editor.git
synced 2026-09-03 10:16:18 +03:00
@@ -1,4 +1,12 @@
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
initQuillEditors();
|
||||
}
|
||||
|
||||
$(document).on('has_many_add:after', function() {
|
||||
initQuillEditors();
|
||||
});
|
||||
|
||||
var initQuillEditors = function() {
|
||||
var editors = document.querySelectorAll( '.quill-editor' );
|
||||
var default_options = {
|
||||
modules: {
|
||||
@@ -19,9 +27,11 @@ window.onload = function() {
|
||||
|
||||
for( var i = 0; i < editors.length; i++ ) {
|
||||
var content = editors[i].querySelector( '.quill-editor-content' );
|
||||
if( content ) {
|
||||
var isActive = editors[i].classList.contains('quill-editor--active');
|
||||
if( content && !isActive) {
|
||||
var options = editors[i].getAttribute( 'data-options' ) ? JSON.parse( editors[i].getAttribute( 'data-options' ) ) : default_options;
|
||||
editors[i]['_quill-editor'] = new Quill( content, options );
|
||||
editors[i].classList += ' quill-editor--active';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user