MDL-44221 editor_atto: fixed bug creating table in IE <= 10
This involved introducing a insert_html_at_focus_point method for the editor and using that instead of insertHTML
This commit is contained in:
committed by
Damyon Wiese
parent
9d535d04c2
commit
2faf4c4584
Vendored
+1
-1
@@ -594,7 +594,7 @@ M.atto_table = M.atto_table || {
|
||||
tablehtml += '</tbody>' + nl;
|
||||
tablehtml += '</table>' + nl + '<br/>';
|
||||
|
||||
document.execCommand('insertHTML', false, tablehtml);
|
||||
M.editor_atto.insert_html_at_focus_point(tablehtml);
|
||||
|
||||
// Clean the YUI ids from the HTML.
|
||||
M.editor_atto.text_updated(elementid);
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -594,7 +594,7 @@ M.atto_table = M.atto_table || {
|
||||
tablehtml += '</tbody>' + nl;
|
||||
tablehtml += '</table>' + nl + '<br/>';
|
||||
|
||||
document.execCommand('insertHTML', false, tablehtml);
|
||||
M.editor_atto.insert_html_at_focus_point(tablehtml);
|
||||
|
||||
// Clean the YUI ids from the HTML.
|
||||
M.editor_atto.text_updated(elementid);
|
||||
|
||||
@@ -592,7 +592,7 @@ M.atto_table = M.atto_table || {
|
||||
tablehtml += '</tbody>' + nl;
|
||||
tablehtml += '</table>' + nl + '<br/>';
|
||||
|
||||
document.execCommand('insertHTML', false, tablehtml);
|
||||
M.editor_atto.insert_html_at_focus_point(tablehtml);
|
||||
|
||||
// Clean the YUI ids from the HTML.
|
||||
M.editor_atto.text_updated(elementid);
|
||||
|
||||
+18
@@ -1313,6 +1313,24 @@ M.editor_atto = M.editor_atto || {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Inserts the given HTML into the editable content at the currently focused point.
|
||||
* @param {String} html
|
||||
*/
|
||||
insert_html_at_focus_point: function(html) {
|
||||
// We check document.selection here as the insertHTML exec command wan't available in IE until version 11.
|
||||
// In IE document.selection was removed at from version 11. Making it an easy affordable check.
|
||||
if (document.selection && document.selection.createRange) {
|
||||
var range = document.selection.createRange();
|
||||
if (range.pasteHTML) {
|
||||
range.pasteHTML(html);
|
||||
}
|
||||
} else {
|
||||
// All other browsers are great!
|
||||
document.execCommand('insertHTML', false, html);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+18
@@ -1313,6 +1313,24 @@ M.editor_atto = M.editor_atto || {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Inserts the given HTML into the editable content at the currently focused point.
|
||||
* @param {String} html
|
||||
*/
|
||||
insert_html_at_focus_point: function(html) {
|
||||
// We check document.selection here as the insertHTML exec command wan't available in IE until version 11.
|
||||
// In IE document.selection was removed at from version 11. Making it an easy affordable check.
|
||||
if (document.selection && document.selection.createRange) {
|
||||
var range = document.selection.createRange();
|
||||
if (range.pasteHTML) {
|
||||
range.pasteHTML(html);
|
||||
}
|
||||
} else {
|
||||
// All other browsers are great!
|
||||
document.execCommand('insertHTML', false, html);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
+18
@@ -1311,6 +1311,24 @@ M.editor_atto = M.editor_atto || {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Inserts the given HTML into the editable content at the currently focused point.
|
||||
* @param {String} html
|
||||
*/
|
||||
insert_html_at_focus_point: function(html) {
|
||||
// We check document.selection here as the insertHTML exec command wan't available in IE until version 11.
|
||||
// In IE document.selection was removed at from version 11. Making it an easy affordable check.
|
||||
if (document.selection && document.selection.createRange) {
|
||||
var range = document.selection.createRange();
|
||||
if (range.pasteHTML) {
|
||||
range.pasteHTML(html);
|
||||
}
|
||||
} else {
|
||||
// All other browsers are great!
|
||||
document.execCommand('insertHTML', false, html);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user