Created
October 4, 2016 14:09
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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