MDL-68551 editor-atto: change <strike> to <del>
authorNeosi <maxlarkin@protonmail.com>
Wed, 29 Apr 2020 15:00:12 +0000 (16:00 +0100)
committerNeosi <maxlarkin@protonmail.com>
Wed, 29 Apr 2020 15:00:12 +0000 (16:00 +0100)
lib/editor/atto/plugins/strike/tests/behat/strike.feature
lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button-debug.js
lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button-min.js
lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button.js
lib/editor/atto/plugins/strike/yui/src/button/js/button.js

index 57c55ea..c4eb973 100644 (file)
@@ -16,4 +16,4 @@ Feature: Atto strike button
     And I set the field "Text editor" to "Plain text area"
     And I press "Save changes"
     And I click on "Edit profile" "link" in the "region-main" "region"
-    Then I should see "<strike>MUA</strike>"
+    Then I should see "<del>MUA</del>"
index d646364..2f2bcae 100644 (file)
Binary files a/lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button-debug.js and b/lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button-debug.js differ
index 3627c73..341f0d9 100644 (file)
Binary files a/lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button-min.js and b/lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button-min.js differ
index d646364..2f2bcae 100644 (file)
Binary files a/lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button.js and b/lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button.js differ
index 0a7eab5..a19b5f1 100644 (file)
 
 Y.namespace('M.atto_strike').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
     initializer: function() {
-        this.addBasicButton({
-            exec: 'strikeThrough',
+        var strike;
+
+        this.addButton({
+            callback: this._toggleStrike,
             icon: 'e/strikethrough',
+            buttonName: strike,
+            inlineFormat: true,
 
             // Watch the following tags and add/remove highlighting as appropriate:
-            tags: 'strike'
+            tags: 'del, strike'
         });
+        this._strikeApplier = window.rangy.createClassApplier("bf-editor-strike-del");
+    },
+    /**
+     * Toggle the strikethrough setting.
+     *
+     * @method _toggleStrike
+     */
+    _toggleStrike: function() {
+        var host = this.get('host');
+
+        // Change all <del> and <strike> tags to applier class.
+        host.changeToCSS('del', 'bf-editor-strike-del');
+        host.changeToCSS('strike', 'bf-editor-strike-del');
+
+        // Use the applier toggle selection.
+        this._strikeApplier.toggleSelection();
+
+        // Then change the applier class back to <del> tags.
+        host.changeToTags('bf-editor-strike-del', 'del');
     }
 });