IE workarounds, insertHTML is not possible.
This commit is contained in:
parent
59ec65a0f1
commit
3f330a2588
1 changed files with 14 additions and 2 deletions
|
@ -166,7 +166,13 @@
|
||||||
|
|
||||||
// get cursor position
|
// get cursor position
|
||||||
Plugin.prototype.getCaretPosition = function() {
|
Plugin.prototype.getCaretPosition = function() {
|
||||||
document.execCommand('insertHTML', false, '<span id="hidden"></span>');
|
// not needed on IE
|
||||||
|
if (document.selection) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
document.execCommand('insertHTML', false, '<span id="hidden"></span>')
|
||||||
|
}
|
||||||
var hiddenNode = document.getElementById('hidden');
|
var hiddenNode = document.getElementById('hidden');
|
||||||
if (!hiddenNode) {
|
if (!hiddenNode) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -226,7 +232,13 @@
|
||||||
if ( item.id == id ) {
|
if ( item.id == id ) {
|
||||||
var content = item.content + "\n"
|
var content = item.content + "\n"
|
||||||
this.cutInput()
|
this.cutInput()
|
||||||
|
if (document.selection) {
|
||||||
|
var range = document.selection.createRange()
|
||||||
|
range.pasteHTML(content)
|
||||||
|
}
|
||||||
|
else {
|
||||||
document.execCommand('insertHTML', false, content)
|
document.execCommand('insertHTML', false, content)
|
||||||
|
}
|
||||||
this.close()
|
this.close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue