Hi,
i am making plugin under FCKeditor and i cant get selection type under Firefox.
I tried:
// base
var oEditor = FCKeditorAPI.GetInstance('FCKeditor1');
var eSelected = null;
var rSelected = null;
var selType = null;
if(document.all) {
eSelected = oEditor.EditorDocument.selection; // IE
rSelected = eSelected.createRange();
selType = eSelected.type; // soooo easy under IE
} else {
eSelected = FCK.EditorWindow.getSelection(); // gecko
rSelected = eSelected.getRangeAt(0);
}
So i tried
eSelected.type //like ie
eSelected._Type // find at script fckselection_gecko.js
eSelected.getType() // yeah its function at the same file like above WHYY that doesnt work?
eSelected.getType
Is there chance to get selection type, or its imposible with Firefox?
Thx for reply
i am making plugin under FCKeditor and i cant get selection type under Firefox.
I tried:
// base
var oEditor = FCKeditorAPI.GetInstance('FCKeditor1');
var eSelected = null;
var rSelected = null;
var selType = null;
if(document.all) {
eSelected = oEditor.EditorDocument.selection; // IE
rSelected = eSelected.createRange();
selType = eSelected.type; // soooo easy under IE
} else {
eSelected = FCK.EditorWindow.getSelection(); // gecko
rSelected = eSelected.getRangeAt(0);
}
So i tried
eSelected.type //like ie
eSelected._Type // find at script fckselection_gecko.js
eSelected.getType() // yeah its function at the same file like above WHYY that doesnt work?
eSelected.getType
Is there chance to get selection type, or its imposible with Firefox?
Thx for reply
RE: Selection type under Firefox = no chance?
FCKSelection.GetType() == 'Text'
If you are in a plugin context you reference FCKSelection directly, above your code looks more like something that happens outside of a plugin Execute() function ( oEditor would not have to be resolved, you just use FCK ).
Anyway, if you have to resolve the editor for some reason you would get FCKSelection like this:
oEditor.EditorWindow.parent.FCKSelection
Some other APIs:
FCKSelection.HasAncestorNode( 'P' )
var el = FCKSelection.MoveToAncestorNode( 'P' )
var node=FCKSelection.GetSelectedElement();
if GetSelectedElement() returns null and GetType() is 'Text' in Gecko you can get the selection by doing this call:
var oSelection = FCK.ToolbarSet.CurrentInstance.EditorWindow.getSelection() ;
Hope some of this helps you :0
RE: Selection type under Firefox = no chance?
Another post on using FCKSelection:
http://sourceforge.net/forum/message.php?msg_id=3987371