http://stackoverflow.com/questions/2385609/getting-selected-text-win-ckeditor-plugin
var okListener = function(ev) {
console.log(CKEDITOR);
var mySelection = CKEDITOR.editor.getSelection();
if (CKEDITOR.env.ie) {
mySelection.unlock(true);
selectedText = mySelection.getNative().createRange().text;
} else {
selectedText = mySelection.getNative();
}
console.log(selectedText);
CKEDITOR.plugins.add('tree',{
requires: ['iframedialog'],
init:function(editor){
CKEDITOR.dialog.addIframe('tree_dialog', 'Content Tree', this.path + '../../../admin/contents/editor',650,400,function(){/*oniframeload*/})
var cmd = editor.addCommand('tree', {exec:tree_onclick})
cmd.modes={wysiwyg:1,source:1}
cmd.canUndo=false
editor.ui.addButton('tree',{ label:'Go ahead, pick a page...', command:'tree', icon:this.path+'tree.png' })
}
})
function tree_onclick(editor)
{
editor.openDialog('tree_dialog');
}
Re: Getting selected text in an iframe plugin