Commit e784be49737e3ea2c2653b2d01a20a4a120d2bea
Committed by
Antonio Terceiro
1 parent
cafc8c58
Exists in
master
and in
29 other branches
ActionItem1152: fixing & bug on tinymce
Links in WYSIWYG don't keep changing & to & 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,7 +23,8 @@ tinyMCE.init({ | ||
| 23 | paste_use_dialog: false, | 23 | paste_use_dialog: false, |
| 24 | apply_source_formatting : true, | 24 | apply_source_formatting : true, |
| 25 | content_css: '/stylesheets/tinymce.css', | 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 | function convertWord(type, content) { | 30 | function convertWord(type, content) { |
| @@ -41,8 +42,17 @@ function convertWord(type, content) { | @@ -41,8 +42,17 @@ function convertWord(type, content) { | ||
| 41 | 42 | ||
| 42 | return content; | 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;/g,"&"); | ||
| 50 | + break; | ||
| 51 | + case "insert_to_editor": | ||
| 52 | + value = value.replace(/&amp;/g,"&"); | ||
| 53 | + break; | ||
| 54 | + } | ||
| 55 | + return value; | ||
| 56 | +} | ||
| 48 | 57 | ||
| 58 | +</script> |