Skip to content

Commit

Permalink
Include scroll position on calculating embedded link toolbar
Browse files Browse the repository at this point in the history
Fixes #526
  • Loading branch information
ipeychev committed May 25, 2016
1 parent 3a0087d commit b3a4e24
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/plugins/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
});
});

// Add a listener to handle selection change events an properly detect editor
// Add a listener to handle selection change events and properly detect editor
// interactions on the widgets without messing with widget native selection
editor.on('selectionChange', function(event) {
var selection = editor.getSelection();
Expand All @@ -127,6 +127,11 @@

if (widgetElement) {
var region = element.getClientRect();

var scrollPosition = new CKEDITOR.dom.window(window).getScrollPosition();
region.left -= scrollPosition.x;
region.top += scrollPosition.y;

region.direction = CKEDITOR.SELECTION_BOTTOM_TO_TOP;

editor.fire('editorInteraction', {
Expand Down

0 comments on commit b3a4e24

Please sign in to comment.