You are here: php » tinymce wysiwyg editor removingstripping lightbox effect (class)
TinyMCE WYSIWYG editor removing/stripping lightbox effect (class)
- Written By
- PHPin24
- Submitted At
- 2009-08-10 18:45:56
- Num Views
- 970
- Category
- PHP
|
In tinyMCE(WYSIWYG) editor if you have a lightbox effect in your HTML (class="lightbox") or (class="thickbox"). You load it in your editor and then save tinyMCE by default removes it. To fix this: Where you call it. In joomla mambots/editors/tinymce.php LINE 259 you will find it. Just add "class" to the accepted elements in a link element <a> under extended_valid_elements Here's the fixed version return <<<EOD $load $load_init <script type="text/javascript"> tinyMCE.init({ theme : "$theme", language : "en", mode : "specific_textareas", document_base_url : "$mosConfig_live_site/", relative_urls : $relative_urls, remove_script_host : false, save_callback : "TinyMCE_Save", invalid_elements : "$invalid_elements", theme_advanced_toolbar_location : "$toolbar", theme_advanced_source_editor_height : "$html_height", theme_advanced_source_editor_width : "$html_width", directionality: "$text_direction", force_br_newlines : "$br_newlines", force_p_newlines : "$p_newlines", $content_css debug : false, cleanup : $cleanup, cleanup_on_startup : $cleanup_startup, safari_warning : false, plugins : "advlink, advimage, $plugins", theme_advanced_buttons2_add : "$buttons2", theme_advanced_buttons3_add : "$buttons3", plugin_insertdate_dateFormat : "$format_date", plugin_insertdate_timeFormat : "$format_time", plugin_preview_width : "$preview_width", plugin_preview_height : "$preview_height", extended_valid_elements : "a[name|href|target|title|onclick|class], img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name], $elements", disk_cache : true, debug : false, fullscreen_settings : { theme_advanced_path_location : "top" } }); function TinyMCE_Save(editor_id, content, node) { base_url = tinyMCE.settings['document_base_url']; var vHTML = content; if (true == true){ vHTML = tinyMCE.regexpReplace(vHTML, 'href\s*=\s*"?'+base_url+'', 'href="', 'gi'); vHTML = tinyMCE.regexpReplace(vHTML, 'src\s*=\s*"?'+base_url+'', 'src="', 'gi'); vHTML = tinyMCE.regexpReplace(vHTML, 'mce_real_src\s*=\s*"?', '', 'gi'); vHTML = tinyMCE.regexpReplace(vHTML, 'mce_real_href\s*=\s*"?', '', 'gi'); } return vHTML; } </script> EOD; } By PHPin24 @ 2009-08-10 18:45:56
|
