From 0d51194b6a5a2b1b7eba70bd26c5a4f4d360479f Mon Sep 17 00:00:00 2001 From: vitalif Date: Tue, 16 Jun 2015 13:04:10 +0000 Subject: [PATCH] Attempt to fix nicFloatingPanel positioning, focus before command (for example fixes table insertion) --- nicEdit.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nicEdit.js b/nicEdit.js index 4d814f7..08f6576 100644 --- a/nicEdit.js +++ b/nicEdit.js @@ -618,6 +618,7 @@ var nicEditorInstance = bkClass.extend({ }, nicCommand : function(cmd,args) { + this.elm.focus(); document.execCommand(cmd,false,args); } }); @@ -1581,7 +1582,13 @@ nicEditor = nicEditor.extend({ if(top < d) { top = d; } - this.floating.setStyle({ top: top+'px', left: e.offsetLeft+'px' }); + var x = 0; + var c = e; + while (c && c != document.body) { + x += c.offsetLeft; + c = c.offsetParent; + } + this.floating.setStyle({ top: top+'px', left: x+'px' }); }, hide: function() {