File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Boris Golman
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 17624
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic