Commit e784be49737e3ea2c2653b2d01a20a4a120d2bea

Authored by Daniela Feitosa
Committed by Antonio Terceiro
1 parent cafc8c58

ActionItem1152: fixing & bug on tinymce

Links in WYSIWYG don't keep changing & to &amp in each edition
Showing 1 changed file with 14 additions and 4 deletions   Show diff stats
app/views/shared/tiny_mce.rhtml
... ... @@ -23,7 +23,8 @@ tinyMCE.init({
23 23 paste_use_dialog: false,
24 24 apply_source_formatting : true,
25 25 content_css: '/stylesheets/tinymce.css',
26   - language: <%= tinymce_language.inspect %>
  26 + language: <%= tinymce_language.inspect %>,
  27 + cleanup_callback : "customCleanup"
27 28 });
28 29  
29 30 function convertWord(type, content) {
... ... @@ -41,8 +42,17 @@ function convertWord(type, content) {
41 42  
42 43 return content;
43 44 }
44   -</script>
45   -
46   -
47 45  
  46 +function customCleanup(type, value) {
  47 + switch (type) {
  48 + case "get_from_editor":
  49 + value = value.replace(/&amp;amp;/g,"&amp;");
  50 + break;
  51 + case "insert_to_editor":
  52 + value = value.replace(/&amp;amp;/g,"&amp;");
  53 + break;
  54 + }
  55 + return value;
  56 +}
48 57  
  58 +</script>
... ...