Skip to content

Instantly share code, notes, and snippets.

@Cyclodex
Created October 4, 2016 14:09
Show Gist options
  • Save Cyclodex/7f5c5f6e3ae4de5421c1605ead0af62c to your computer and use it in GitHub Desktop.
Save Cyclodex/7f5c5f6e3ae4de5421c1605ead0af62c to your computer and use it in GitHub Desktop.
Drupal JS behaviors: Bueditor: Adding toolbar to ajax added textfields (otherwise they are missing)
(function($, BUE) {
'use strict';
// Don't setup the behavior on pages without BUEditor.
if (typeof BUE ==='undefined') {
return;
}
/**
* New behavior to handle BUEditors text areas added dynamically
* by paragraphs.
* @type {{attach: Drupal.behaviors.paragraphsBUEditor.attach}}
*/
Drupal.behaviors.paragraphsBUEditor = {
attach: function(context, settings) {
/*
* e followed by the id of the editor to use based on
* /en/admin/config/content/bueditor
*/
var EDITOR_ID = 'e5';
$.each(
$('.field-type-paragraphs .field-widget-text-textarea textarea'),
function(i, T) {
BUE.processTextarea(T, EDITOR_ID);
}
);
}
};
})(jQuery, window.BUE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment