2 * DO NOT EDIT THIS FILE.
3 * See the following change record for more information,
4 * https://www.drupal.org/node/2815083
8 (function ($, _, Backbone, Drupal) {
9 Drupal.quickedit.FieldToolbarView = Backbone.View.extend({
16 initialize: function initialize(options) {
17 this.$editedElement = options.$editedElement;
18 this.editorView = options.editorView;
20 this.$root = this.$el;
22 this._id = 'quickedit-toolbar-for-' + this.model.id.replace(/[\/\[\]]/g, '_');
24 this.listenTo(this.model, 'change:state', this.stateChange);
26 render: function render() {
27 this.setElement($(Drupal.theme('quickeditFieldToolbar', {
31 this.$el.prependTo(this.$root);
35 stateChange: function stateChange(model, state) {
36 var from = model.previous('state');
43 if (from !== 'inactive' && from !== 'highlighted') {
55 if (this.editorView.getQuickEditUISettings().fullWidthToolbar) {
56 this.$el.addClass('quickedit-toolbar-fullwidth');
59 if (this.editorView.getQuickEditUISettings().unifiedToolbar) {
60 this.insertWYSIWYGToolGroups();
80 insertWYSIWYGToolGroups: function insertWYSIWYGToolGroups() {
81 this.$el.append(Drupal.theme('quickeditToolgroup', {
82 id: this.getFloatedWysiwygToolgroupId(),
83 classes: ['wysiwyg-floated', 'quickedit-animate-slow', 'quickedit-animate-invisible', 'quickedit-animate-delay-veryfast'],
85 })).append(Drupal.theme('quickeditToolgroup', {
86 id: this.getMainWysiwygToolgroupId(),
87 classes: ['wysiwyg-main', 'quickedit-animate-slow', 'quickedit-animate-invisible', 'quickedit-animate-delay-veryfast'],
91 this.show('wysiwyg-floated');
92 this.show('wysiwyg-main');
94 getId: function getId() {
95 return 'quickedit-toolbar-for-' + this._id;
97 getFloatedWysiwygToolgroupId: function getFloatedWysiwygToolgroupId() {
98 return 'quickedit-wysiwyg-floated-toolgroup-for-' + this._id;
100 getMainWysiwygToolgroupId: function getMainWysiwygToolgroupId() {
101 return 'quickedit-wysiwyg-main-toolgroup-for-' + this._id;
103 _find: function _find(toolgroup) {
104 return this.$el.find('.quickedit-toolgroup.' + toolgroup);
106 show: function show(toolgroup) {
107 var $group = this._find(toolgroup);
109 $group.on(Drupal.quickedit.util.constants.transitionEnd, function (event) {
110 $group.off(Drupal.quickedit.util.constants.transitionEnd);
113 window.setTimeout(function () {
114 $group.removeClass('quickedit-animate-invisible');
118 })(jQuery, _, Backbone, Drupal);