Hej,
Currently I try to make a little plug-in which will apply some site-specific HTML code (which includes a table) to the selected text.
It will pop-up with a dialog and the selected text should be transfered to a textarea. When clicking on OK the select text should be replaced by the plug-in.
Now :
1) How do I get the selected text. I tried oEditor.FCK.selection but that doesn't work.
2) How can I insert? I tried CreateElement( 'TABLE' ) (+the attributes stuff) and then InsertElement(oTable), but that doesn't work either.
Could someone please give me a hint? Thank you.
Jenny
Currently I try to make a little plug-in which will apply some site-specific HTML code (which includes a table) to the selected text.
It will pop-up with a dialog and the selected text should be transfered to a textarea. When clicking on OK the select text should be replaced by the plug-in.
Now :
1) How do I get the selected text. I tried oEditor.FCK.selection but that doesn't work.
2) How can I insert? I tried CreateElement( 'TABLE' ) (+the attributes stuff) and then InsertElement(oTable), but that doesn't work either.
Could someone please give me a hint? Thank you.
Jenny
RE: Getting/Inserting text (-> Plug-in)
As far as getting the selected text, I tried this but it only returns the selected text, and doesn't include any tags etc:
if(document.all)
{
content = oEditor.FCK.EditorDocument.selection
}
else
{
content = oEditor.FCK.EditorWindow.getSelection()
}
To insert HTML (replaced selected text if anything is selected):
oEditor.FCK.InsertHtml(content)
RE: Getting/Inserting text (-> Plug-in)
var oQoute = document.CreateElement( 'TABLE' ) ;
oQuote.border = '0' ;
oQuote.align = 'center' ;
oQuote.width = '90%' ;
oQuote.cellpadding = '3' ;
oQuote.cellspacing = '1' ;
var oRow = oQuote.insertRow(-1);
var oCell = oRow.insertCell(-1);
oCell.innerHTML = "<b><i>Quote:</i></b>";
var oRow = oQuote.insertRow(-1);
var oCell = oRow.insertCell(-1);
oCell.className= 'code';
oCell.innerHTML = document.getElementById("quotetext").value;
oEditor.FCK.InsertHtml( oQuote ) ;
window.close();
return true;
It doesn't work though, and I don't know why.
-----------------------------------------------
And this is done when the plugin loads :
var oEditor = window.parent.InnerDialogLoaded() ;
oEditor.FCKLanguageManager.TranslatePage( document ) ;
window.document.dir = dialogArguments.Editor.FCKLang.Dir ;
quote = oEditor.FCK.EditorDocument.selection
window.parent.SetOkButton( true ) ;
It doesn't work either....
Jenny