MDL-61733 atto_table: fix creating new table
authorMartin Gauk <gauk@math.tu-berlin.de>
Fri, 23 Mar 2018 09:08:39 +0000 (09:08 +0000)
committerMartin Gauk <gauk@math.tu-berlin.de>
Fri, 23 Mar 2018 09:08:39 +0000 (09:08 +0000)
If Atto is embedded in an HTML table (e.g. in the database activity
on the template pages), you could not create a new table.

lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-debug.js
lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-min.js
lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button.js
lib/editor/atto/plugins/table/yui/src/button/js/button.js

index a7d073c..c8db3c5 100644 (file)
Binary files a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-debug.js and b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-debug.js differ
index 015f2f1..5b9e915 100644 (file)
Binary files a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-min.js and b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-min.js differ
index a7d073c..c8db3c5 100644 (file)
Binary files a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button.js and b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button.js differ
index 8d3705b..f33bc87 100644 (file)
@@ -315,7 +315,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
      * @return {boolean} whether or not the parameter node exists within the editor.
      */
     _stopAtContentEditableFilter: function(node) {
-        this.editor.contains(node);
+        return this.editor.contains(node);
     },
 
     /**
@@ -409,12 +409,13 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
     _getSuitableTableCell: function() {
         var targetcell = null,
             host = this.get('host');
+        var stopAtContentEditableFilter = Y.bind(this._stopAtContentEditableFilter, this);
 
         host.getSelectedNodes().some(function(node) {
-            if (node.ancestor('td, th, caption', true, this._stopAtContentEditableFilter)) {
+            if (node.ancestor('td, th, caption', true, stopAtContentEditableFilter)) {
                 targetcell = node;
 
-                var caption = node.ancestor('caption', true, this._stopAtContentEditableFilter);
+                var caption = node.ancestor('caption', true, stopAtContentEditableFilter);
                 if (caption) {
                     var table = caption.get('parentNode');
                     if (table) {