Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions src/examples/english/ckeditor/plugins/jqueryspellchecker/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,35 @@ CKEDITOR.plugins.add('jqueryspellchecker', {

var t = this;

var win = $(window);

return function() {

var ed = t.editor;
var word = (this.wordElement.data('firstElement') || this.wordElement)[0];

var p1 = $(ed.container.$).find('iframe').offset();
var p2 = $(ed.container.$).offset();
var p3 = $(word).offset();

var left = p3.left + p2.left;
var top = p3.top + p2.top + (p1.top - p2.top) + word.offsetHeight;

top -= $(t.editorWindow).scrollTop();

var ed = t.editor;
var word = (this.wordElement.data('firstElement') || this.wordElement)[0];
var element = this.wordElement.data('firstElement') || this.wordElement;
var offset = element.offset();
var boxOffset = this.config.suggestBox.offset;
var containerHeight = this.container.outerHeight();

var p1 = $(ed.container.$).find('iframe').offset();
var p2 = $(ed.container.$).offset();
var p3 = $(word).offset();

var left = p3.left + p2.left;
var top = p3.top + p2.top + (p1.top - p2.top) + word.offsetHeight;
var positionAbove = p1.top + ( p3.top - $(ed.container.$).find('iframe').contents().find("html,body").scrollTop() ) - containerHeight;

top -= $(t.editorWindow).scrollTop();

if (win.height() + win.scrollTop() < top + containerHeight) {
top = positionAbove;
}

this.container.css({
top: top,
left: left
});
};
}
});
});