-
Notifications
You must be signed in to change notification settings - Fork 2
BwMappedRichText
tromberg edited this page Sep 14, 2010
·
2 revisions
This class will generate a rich text Mapper field and store the content in a CLOB. Will also allow defining a default text that the input field will be filled with if the Mapper field is empty. The Mapper field will then only be updated if the user changed the default content.
The editor I used was tinyMCE, but there is no special dependency on that. All that the class does is add a “richtext” class. Your Javascript code will then have to pick it up. I included the following tinymce_setup.js on every form that uses the field as input, along with tinymce itself.
NOTE: Take care to include your own sanitization code on the server side.
tinyMCE.init({
mode : "specific_textareas",
theme: "advanced",
editor_selector : "richtext",
theme_advanced_buttons1 : "bold,italic,underline,bullist,numlist,formatselect,separator,cut,copy,paste,separator,undo,redo,separator,link,unlink,image",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
valid_elements: "-b/strong,-i/em,-u,#p,-ol,-ul,-li,img[src|alt=|title|width|height],-h1,-h2,-h3,-h4",
theme_advanced_toolbar_location : "top",
theme_advanced_blockformats : "p,h1,h2,h3,h4"
});