wood burning stoves 2.0*
The moose likes JSF and the fly likes How to insert <span> tag into rich:editor using jquery drag and drop? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "How to insert <span> tag into rich:editor using jquery drag and drop?" Watch "How to insert <span> tag into rich:editor using jquery drag and drop?" New topic
Author

How to insert <span> tag into rich:editor using jquery drag and drop?

Boris Golman
Ranch Hand

Joined: Apr 24, 2008
Posts: 31
Hello everyone. I have another question on rich:editor. I am implementing a feature that allows a user to drag a tag, which serves as a placeholder (kinda like a template) into Richfaces component rich:editor at the cursor. I was able to get it to work, but only partially: I can drag and drop the text value of the span into rich:faces, but not the actual tag. Here is what I have:

I know I'm missing something fairly simple, but, unfortunately, I'm rather new to jquery. The method insertAtCaret I've found somewhere on http://stackoverflow.com website and I was able to make it work with the text inside rich:editor, but as placing the actual span there and make sure that rich:editor displays it properly - I'm a bit lost here.
Another thing I've noticed is that you can actually drag and drop the span into rich:editor, at the right place in the text without using jquery, but for that you have to select a span first, which with jquery you can drag the whole thing. It would be great if someone here could help me or point me to the right direction.

Thanks
Boris Golman
Ranch Hand

Joined: Apr 24, 2008
Posts: 31
I figured it out. However, I have another problem. How would you call "onkeyup" event from rich:editor? I want to be able to check if the user tries to delete a certain object, because some of them are not meant to be deleted, and I need to prevent the user from deleting it. I thought I can use onkeyup event to achieve that, but I don't know how to run it from rich:editor and doesn't do anything. Any suggestions? Thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16160
    
  21

Actually, your best bet is to look at the docs for the component that the rich:editor is based on. I believe that it's tinyMCE.

RichFaces often prefers to use pre-existing functionality over re-inventing the idea from scratch, so in the case of a rich editor, they wrapped one of the more popular HTML editors with JSF support.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to insert <span> tag into rich:editor using jquery drag and drop?