MDL-61733 atto_table: fix creating new table

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.
This commit is contained in:
Martin Gauk
2018-03-23 09:08:39 +00:00
parent a15c745936
commit db3da830c1
4 changed files with 13 additions and 10 deletions
@@ -317,7 +317,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);
},
/**
@@ -411,12 +411,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) {
File diff suppressed because one or more lines are too long
@@ -317,7 +317,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);
},
/**
@@ -411,12 +411,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) {
+4 -3
View 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) {