diff --git a/core/misc/create/create-editonly.js b/core/misc/create/create-editonly.js index aed84a4ffcddc04e78f9e37b68b7e278793efe87..4279a1b905837a205bef9df8ae5231b3da2a9b23 100644 --- a/core/misc/create/create-editonly.js +++ b/core/misc/create/create-editonly.js @@ -334,6 +334,7 @@ element: this.element, instance: this.options.model }; + var propertyParams = (predicate) ? { predicate: predicate, propertyEditor: this.options.propertyEditors[predicate], @@ -516,11 +517,11 @@ disable: function () { _.each(this.options.propertyEditors, function (editable) { - this.disablePropertyEditor({ + this.disableEditor({ widget: this, editable: editable, entity: this.options.model, - element: editable.element + element: jQuery(editable) }); }, this); this.options.propertyEditors = {}; @@ -591,7 +592,7 @@ return; } var widgetType = propertyElement.data('createWidgetName'); - this.options.propertyEditors[predicate] = propertyElement.data('Midgard-' + widgetType); + this.options.propertyEditors[predicate] = propertyElement.data(widgetType); // Deprecated. this.options.editables.push(propertyElement); @@ -672,13 +673,18 @@ }, disablePropertyEditor: function (data) { - data.element[data.editable.widgetName]({ - disabled: true - }); - jQuery(data.element).removeClass('ui-state-disabled'); + var widgetName = jQuery(data.element).data('createWidgetName'); + + data.disabled = true; - if (data.element.is(':focus')) { - data.element.blur(); + if (widgetName) { + // only if there has been an editing widget registered + jQuery(data.element)[widgetName](data); + jQuery(data.element).removeClass('ui-state-disabled'); + + if (data.element.is(':focus')) { + data.element.blur(); + } } }, @@ -749,7 +755,7 @@ // jQuery.widget('Namespace.MyWidget', jQuery.Create.editWidget, { // // override any properties // }); - jQuery.widget('Midgard.editWidget', { + jQuery.widget('Create.editWidget', { options: { disabled: false, vie: null @@ -843,7 +849,7 @@ // // Due to licensing incompatibilities, Aloha Editor needs to be installed // and configured separately. - jQuery.widget('Midgard.alohaWidget', jQuery.Midgard.editWidget, { + jQuery.widget('Create.alohaWidget', jQuery.Create.editWidget, { _initialize: function () {}, enable: function () { var options = this.options; @@ -906,7 +912,7 @@ // // This widget allows editing textual content areas with the // [CKEditor](http://ckeditor.com/) rich text editor. - jQuery.widget('Midgard.ckeditorWidget', jQuery.Midgard.editWidget, { + jQuery.widget('Create.ckeditorWidget', jQuery.Create.editWidget, { enable: function () { this.element.attr('contentEditable', 'true'); this.editor = CKEDITOR.inline(this.element.get(0)); @@ -918,7 +924,6 @@ }); this.editor.on('blur', function () { widget.options.activated(); - widget.options.changed(widget.editor.getData()); }); this.editor.on('key', function () { widget.options.changed(widget.editor.getData()); @@ -929,11 +934,6 @@ this.editor.on('afterCommandExec', function () { widget.options.changed(widget.editor.getData()); }); - this.editor.on('configLoaded', function() { - jQuery.each(widget.options.editorOptions, function(optionName, option) { - widget.editor.config[optionName] = option; - }); - }); }, disable: function () { @@ -964,7 +964,7 @@ // // This widget allows editing textual content areas with the // [Hallo](http://hallojs.org) rich text editor. - jQuery.widget('Midgard.halloWidget', jQuery.Midgard.editWidget, { + jQuery.widget('Create.halloWidget', jQuery.Create.editWidget, { options: { editorOptions: {}, disabled: true, @@ -1006,10 +1006,6 @@ return; } self.options.toolbarState = data.display; - if (!self.element.data('IKS-hallo')) { - // Hallo not yet instantiated - return; - } var newOptions = self.getHalloOptions(); self.element.hallo('changeToolbar', newOptions.parentElement, newOptions.toolbar, true); }); @@ -1065,7 +1061,7 @@ // // This widget allows editing textual content areas with the // [Redactor](http://redactorjs.com/) rich text editor. - jQuery.widget('Midgard.redactorWidget', jQuery.Midgard.editWidget, { + jQuery.widget('Create.redactorWidget', jQuery.Create.editWidget, { editor: null, options: { diff --git a/core/modules/edit/js/app.js b/core/modules/edit/js/app.js index 14d76a087f52d4e99b4c970a07eb13b34fdea2c2..07f006f5e432b090d8e45375e94eeb1e8bad8e04 100644 --- a/core/modules/edit/js/app.js +++ b/core/modules/edit/js/app.js @@ -317,7 +317,7 @@ // Discarded if it transitions from a changed state to 'candidate'. if (from === 'changed' || from === 'invalid') { // Retrieve the storage widget from DOM. - var createStorageWidget = this.$el.data('DrupalCreateStorage'); + var createStorageWidget = this.$el.data('createStorage'); // Revert changes in the model, this will trigger the direct editable // content to be reset and redrawn. createStorageWidget.revertChanges(editor.options.entity); diff --git a/core/modules/edit/js/createjs/editingWidgets/drupalcontenteditablewidget.js b/core/modules/edit/js/createjs/editingWidgets/drupalcontenteditablewidget.js index cde6163730a0dace7cc4d4eaffeaa228d094d1ff..bc86a04a828d906aa59f8a55ebbf216de6e8c11b 100644 --- a/core/modules/edit/js/createjs/editingWidgets/drupalcontenteditablewidget.js +++ b/core/modules/edit/js/createjs/editingWidgets/drupalcontenteditablewidget.js @@ -8,7 +8,7 @@ // @todo D8: use jQuery UI Widget bridging. // @see http://drupal.org/node/1874934#comment-7124904 - jQuery.widget('Midgard.direct', jQuery.Midgard.editWidget, { + jQuery.widget('DrupalEditEditor.direct', jQuery.Create.editWidget, { /** * Implements getEditUISettings() method. diff --git a/core/modules/edit/js/createjs/editingWidgets/formwidget.js b/core/modules/edit/js/createjs/editingWidgets/formwidget.js index aa2dd0abda8b35a07d64fc4543ef61e57db5ecb9..8824a5d00f496aca6cf7d5bd7641845102f33828 100644 --- a/core/modules/edit/js/createjs/editingWidgets/formwidget.js +++ b/core/modules/edit/js/createjs/editingWidgets/formwidget.js @@ -8,7 +8,7 @@ // @todo D8: change the name to "form" + use jQuery UI Widget bridging. // @see http://drupal.org/node/1874934#comment-7124904 - $.widget('Midgard.formEditEditor', $.Midgard.editWidget, { + $.widget('DrupalEditEditor.formEditEditor', $.Create.editWidget, { id: null, $formContainer: null, diff --git a/core/modules/editor/js/editor.createjs.js b/core/modules/editor/js/editor.createjs.js index de15c7796c0083dc81343ee03eeb657f59c5327c..c4bfae6c443ecdd99bf3b435482393c53d31607c 100644 --- a/core/modules/editor/js/editor.createjs.js +++ b/core/modules/editor/js/editor.createjs.js @@ -18,7 +18,7 @@ // @todo D8: use jQuery UI Widget bridging. // @see http://drupal.org/node/1874934#comment-7124904 -jQuery.widget('Midgard.editor', jQuery.Midgard.direct, { +jQuery.widget('DrupalEditEditor.editor', jQuery.DrupalEditEditor.direct, { textFormat: null, textFormatHasTransformations: null,