core/modules/editor/editor.module | 5 +++-- core/modules/editor/js/editor.createjs.js | 15 ++++----------- .../lib/Drupal/editor/Plugin/edit/editor/Editor.php | 10 +++++----- .../lib/Drupal/editor/Tests/EditIntegrationTest.php | 4 ++-- .../editor_test/Plugin/editor/editor/UnicornEditor.php | 2 +- 5 files changed, 15 insertions(+), 21 deletions(-) diff --git a/core/modules/editor/editor.module b/core/modules/editor/editor.module index 46f384e..a0946a3 100644 --- a/core/modules/editor/editor.module +++ b/core/modules/editor/editor.module @@ -78,11 +78,12 @@ function editor_library_info() { array('system', 'jquery.once'), ), ); - $libraries['edit.editor.editor'] = array( + // Create.js PropertyEditor widget library names begin with "edit.editor". + $libraries['edit.editor.wysiwyg'] = array( 'title' => '"Editor" Create.js PropertyEditor widget', 'version' => VERSION, 'js' => array( - $path . '/js/createjs/drupalwysiwygwidget.js' => array( + $path . '/js/editor.createjs.js' => array( 'scope' => 'footer', 'attributes' => array('defer' => TRUE), ) diff --git a/core/modules/editor/js/editor.createjs.js b/core/modules/editor/js/editor.createjs.js index a3d7e97..56780dd 100644 --- a/core/modules/editor/js/editor.createjs.js +++ b/core/modules/editor/js/editor.createjs.js @@ -3,7 +3,7 @@ * Text editor-based Create.js widget for processed text content in Drupal. * * Depends on Editor.module. Works with any (WYSIWYG) editor that implements the - * attachTrueWysiwyg(), detach() and onChange() methods. + * attachInlineEditor(), detach() and onChange() methods. */ (function (jQuery, Drupal, drupalSettings) { @@ -102,7 +102,7 @@ break; case 'active': this.element.attr('contentEditable', 'true'); - this.textEditor.attachTrueWysiwyg( + this.textEditor.attachInlineEditor( this.element.get(0), this.textFormat, this.toolbarView.getMainWysiwygToolgroupId(), @@ -129,9 +129,7 @@ /** * Removes validation errors' markup changes, if any. * - * Note: this only needs to happen for type=direct, because for type=direct, - * the property DOM element itself is modified; this is not the case for - * type=form. + * @todo: this should not be necessary, will be obviated by edit.module. */ _removeValidationErrors: function() { this.element @@ -142,12 +140,7 @@ /** * Cleans up after the widget has been saved. * - * Note: this is where the Create.Storage and accompanying Backbone.sync - * abstractions "leak" implementation details. That is only the case because - * we have to use Drupal's Form API as a transport mechanism. It is - * unfortunately a stateful transport mechanism, and that's why we have to - * clean it up here. This clean-up is only necessary when canceling the - * editing of a property after having attempted to save at least once. + * @todo: this should not be necessary, will be obviated by edit.module. */ _cleanUp: function() { Drupal.edit.util.form.unajaxifySaving(jQuery('#edit_backstage form .edit-form-submit')); diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/edit/editor/Editor.php b/core/modules/editor/lib/Drupal/editor/Plugin/edit/editor/Editor.php index 352bce1..30eedca 100644 --- a/core/modules/editor/lib/Drupal/editor/Plugin/edit/editor/Editor.php +++ b/core/modules/editor/lib/Drupal/editor/Plugin/edit/editor/Editor.php @@ -2,7 +2,7 @@ /** * @file - * Definition of \Drupal\editor\Plugin\edit\editor\Editor. + * Contains \Drupal\editor\Plugin\edit\editor\Editor. */ namespace Drupal\editor\Plugin\edit\editor; @@ -38,12 +38,12 @@ function isCompatible(FieldInstance $instance, array $items) { } // This editor is compatible with processed ("rich") text fields; but only // if there is a currently active text format, that text format has an - // associated editor and that editor supports "true WYSIWYG". + // associated editor and that editor supports inline editing. elseif (!empty($instance['settings']['text_processing'])) { $format_id = $items[0]['format']; if (isset($format_id) && $editor = editor_load($format_id)) { $definition = drupal_container()->get('plugin.manager.editor')->getDefinition($editor->editor); - if ($definition['supports_true_wysiwyg'] === TRUE) { + if ($definition['supports_inline_editing'] === TRUE) { return TRUE; } } @@ -79,11 +79,11 @@ public function getAttachments() { $manager = drupal_container()->get('plugin.manager.editor'); $definitions = $manager->getDefinitions(); - // Filter the current user's text to those that support "true WYSIWYG". + // Filter the current user's text to those that support inline editing. $formats = array(); foreach ($user_format_ids as $format_id) { $editor = editor_load($format_id); - if ($editor && isset($definitions[$editor->editor]) && isset($definitions[$editor->editor]['supports_true_wysiwyg']) && $definitions[$editor->editor]['supports_true_wysiwyg'] === TRUE) { + if ($editor && isset($definitions[$editor->editor]) && isset($definitions[$editor->editor]['supports_inline_editing']) && $definitions[$editor->editor]['supports_inline_editing'] === TRUE) { $formats[] = $format_id; } } diff --git a/core/modules/editor/lib/Drupal/editor/Tests/EditIntegrationTest.php b/core/modules/editor/lib/Drupal/editor/Tests/EditIntegrationTest.php index 5406d54..162d604 100644 --- a/core/modules/editor/lib/Drupal/editor/Tests/EditIntegrationTest.php +++ b/core/modules/editor/lib/Drupal/editor/Tests/EditIntegrationTest.php @@ -14,7 +14,7 @@ use Drupal\edit_test\MockEditEntityFieldAccessCheck; /** - * Tests Edit module integration (Editor module's "true WYSIWYG" support). + * Tests Edit module integration (Editor module's inline editing support). */ class EditIntegrationTest extends EditTestBase { @@ -56,7 +56,7 @@ class EditIntegrationTest extends EditTestBase { public static function getInfo() { return array( 'name' => 'In-place text editors (Edit module integration)', - 'description' => 'Tests Edit module integration (Editor module\'s "true WYSIWYG" support).', + 'description' => 'Tests Edit module integration (Editor module\'s inline editing support).', 'group' => 'Text Editor', ); } diff --git a/core/modules/editor/tests/modules/lib/Drupal/editor_test/Plugin/editor/editor/UnicornEditor.php b/core/modules/editor/tests/modules/lib/Drupal/editor_test/Plugin/editor/editor/UnicornEditor.php index b6acfb2..4ba8fac 100644 --- a/core/modules/editor/tests/modules/lib/Drupal/editor_test/Plugin/editor/editor/UnicornEditor.php +++ b/core/modules/editor/tests/modules/lib/Drupal/editor_test/Plugin/editor/editor/UnicornEditor.php @@ -19,7 +19,7 @@ * id = "unicorn", * label = @Translation("Unicorn Editor"), * module = "editor_test", - * supports_true_wysiwyg = TRUE + * supports_inline_editing = TRUE * ) */ class UnicornEditor extends EditorBase {