Hi !
First, thank you for this great RTE.
I'm currently developing an extension which allow the user to insert abbr and acronym.
But I need some help about how to get the html code of a selected text.
Actually, I tried this function :
function getSelect() { if (document.getSelection) methodeselection = oEditor.FCK.EditorDocument.getSelection(); else if (document.selection) methodeselection = oEditor.FCK.EditorDocument.selection.createRange().text; else return; return methodeselection; }
Can you help me ? Thank you so much
Re: [New plugin] how to get HTML selected text ?
I'm a begginer, i don't know if it's the answer, it works for me ...
Re: [New plugin] how to get HTML selected text ?
Re: [New plugin] how to get HTML selected text ?
Re: [New plugin] how to get HTML selected text ?
Hi i would like to know this too, as i'm trying to find a way to prevent editor users delete objects/tables/images with the delete/backspace keystroke.
For start - i need to know how to get selected html text and the text before/after the cursor.
thank you
Re: [New plugin] how to get HTML selected text ?
I noticed that is not working anymore in FCKeditor 2.6RC (and also in the 2.6 beta).
In IE you have to use this function to retreive the selected text.
In the current stable release 2.5.1 the function is working like a sharm!
Firefox users can use: and that is still working in 2.6RC!
I hope it will be fixed in the upcoming release of this great editor!
Re: [New plugin] how to get HTML selected text ?
According to the comment on ticket #2071:
So the code to will work now!
Re: [New plugin] how to get HTML selected text ?
Re: [New plugin] how to get HTML selected text ?
But it works great now. Excellent!
Re: [New plugin] how to get HTML selected text ?
Re: [New plugin] how to get HTML selected text ?
There is some sample code for creating a non-dialog plugin over a Source Forge. It works - but only in IE. The problem in Safari and FireFox is the line containing the .createRange() method. The JS console says the method doesn't exist. This is the code. Is there an easy way to generalize this so it works in Safari and FireFox as well?
Thanks!
doug
Re: [New plugin] how to get HTML selected text ?
I haven't dug into this much, but you'll see from my previous post that createRange() is in an if statement. I'm pretty sure you need to do the same. That part of the code is called in IE, but you need an else for Firefox/Safari that contains other code.
Good luck.
Re: [New plugin] how to get HTML selected text ?
It turns out if you just make sure that the "range" related statements just get used in IE and make sure they aren't executed in Firefox/Safari (no substitutions with other methods) it seems to work just fine.
doug
Re: [New plugin] how to get HTML selected text ?
Thanks a lot, but this doesn't work in IE7 either. I always get an empty string in IE7.
Re: [New plugin] how to get HTML selected text ?
I'm also in the case :
FCKSelection.GetSelection().createRange().text
doesn't work with IE 6 & 7
I'm using FCKEditor 2.6.4
I'm trying to use the plugin Abbr. It's OK with FF, but IE refuse to get the selection :
when i trace FCKSelection.GetSelection().createRange().text, it's empty
After reading diffeent topics, it seems that new revision bring bugs that werent there
Anyone got this plugin working with FCK 2.6.4 and IE
thanks
Re: [New plugin] how to get HTML selected text ?
Try this to get the content of the selection on IE 7:
var selection = oEditor.FCK.Selection.GetSelection().createRange().text;