remove the Microsoft Office tags that get copied into the tinyMCE fields when users paste from a Office document.
This commit is contained in:
parent
3e3986172c
commit
676ec502ac
3 changed files with 52 additions and 6 deletions
|
@ -49,3 +49,8 @@
|
|||
|
||||
<#include "defaultFormScripts.ftl">
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
defaultDataPropertyUtils.onLoad();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -44,18 +44,18 @@
|
|||
fix_nesting : true,
|
||||
cleanup_on_startup : true,
|
||||
gecko_spellcheck : true,
|
||||
forced_root_block: false
|
||||
//forced_root_block : 'p',
|
||||
forced_root_block: false,
|
||||
forced_root_block : 'p'
|
||||
// plugins: "paste",
|
||||
// theme_advanced_buttons1_add : "pastetext,pasteword,selectall",
|
||||
// paste_create_paragraphs: false,
|
||||
// paste_create_linebreaks: false,
|
||||
// paste_use_dialog : true,
|
||||
// paste_auto_cleanup_on_paste: true,
|
||||
// paste_convert_headers_to_strong : true
|
||||
// paste_convert_headers_to_strong : true,
|
||||
// save_callback : "customSave",
|
||||
// content_css : "example_advanced.css",
|
||||
// extended_valid_elements : "a[href|target|name]",
|
||||
// extended_valid_elements : "a[href|target|name]"
|
||||
// plugins : "table",
|
||||
// theme_advanced_buttons3_add_before : "tablecontrols,separator",
|
||||
// invalid_elements : "li",
|
||||
|
@ -67,5 +67,6 @@
|
|||
<#-- Script to enable browsing individuals within a class -->
|
||||
<#--'<script type="text/javascript" src="${urls.base}/js/jquery_plugins/jquery.scrollTo-min.js"></script>',-->
|
||||
${scripts.add('<script type="text/javascript" src="${urls.base}/js/tiny_mce/tiny_mce.js"></script>',
|
||||
'<script type="text/javascript" src="${urls.base}/js/tiny_mce/jquery-tinymce.js"></script>',
|
||||
'<script type="text/javascript" src="${urls.base}/js/edit/initTinyMce.js"></script>')}
|
||||
'<script type="text/javascript" src="${urls.base}/js/tiny_mce/jquery-tinymce.js"></script>',
|
||||
'<script type="text/javascript" src="${urls.base}/js/edit/initTinyMce.js"></script>',
|
||||
'<script type="text/javascript" src="${urls.base}/templates/freemarker/edit/forms/js/defaultDataPropertyUtils.js"></script>')}
|
|
@ -0,0 +1,40 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
var defaultDataPropertyUtils = {
|
||||
|
||||
onLoad: function() {
|
||||
|
||||
this.initObjectReferences();
|
||||
this.bindEventListeners();
|
||||
|
||||
},
|
||||
|
||||
initObjectReferences: function() {
|
||||
|
||||
this.form = $('form.editForm');
|
||||
this.textArea = $('textarea.useTinyMce');
|
||||
|
||||
},
|
||||
|
||||
bindEventListeners: function() {
|
||||
|
||||
this.form.submit(function() {
|
||||
var theText = tinyMCE.get('literal').getContent();
|
||||
|
||||
if ( theText.indexOf("<!--") > -1 && theText.indexOf("-->") > -1 ) {
|
||||
var start = theText.indexOf("<p><!--");
|
||||
var end = (theText.indexOf("--></p>") + 10);
|
||||
var removeText = theText.slice(start,end);
|
||||
var newText = theText.replace(removeText,"");
|
||||
tinyMCE.get('literal').setContent(newText);
|
||||
}
|
||||
else if ( theText.indexOf("<!--") > -1 && theText.indexOf("-->") > -1 ) {
|
||||
var start = theText.indexOf("<p><!--");
|
||||
var end = (theText.indexOf("--></p>") + 10);
|
||||
var removeText = theText.slice(start,end);
|
||||
var newText = theText.replace(removeText,"");
|
||||
tinyMCE.get('literal').setContent(newText);
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
Loading…
Add table
Reference in a new issue