updates to include tinymce in the default data property editing form

This commit is contained in:
hjkhjk54 2011-11-02 18:00:04 +00:00
parent 15c78c74d4
commit b2f1680402
4 changed files with 54 additions and 5 deletions

View file

@ -0,0 +1,29 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
var initTinyMCE = {
// Initial page setup
onLoad: function() {
this.mergeFromTemplate();
this.initObjects();
this.initEditor();
},
// Add variables from menupage template
mergeFromTemplate: function() {
$.extend(this, customFormData);
},
initObjects: function() {
this.wsywigFields = $(".useTinyMce");
},
// Create references to frequently used elements for convenience
initEditor: function() {
initTinyMCE.wsywigFields.tinymce(initTinyMCE.tinyMCEData);
}
};
$(document).ready(function() {
initTinyMCE.onLoad();
});

View file

@ -0,0 +1,18 @@
/**
* jQuery TinyMCE (http://mktgdept.com/jquery-tinymce-plugin)
* A jQuery plugin for unobtrusive TinyMCE
*
* v0.0.2 - 28 August 2009
*
* Copyright (c) 2009 Chad Smith (http://twitter.com/chadsmith)
* Dual licensed under the MIT and GPL licenses.
* http://www.opensource.org/licenses/mit-license.php
* http://www.opensource.org/licenses/gpl-license.php
*
* Add TinyMCE to an element using: $(element).tinymce([settings]);
* Note that TinyMCE has released a Jquery version of itself that includes a plugin for jquery
* and we should probably use that instead but that would require overwriting the tiny mce javscript
* that currently exists
*
**/
;jQuery.fn.tinymce=jQuery.fn.tinyMCE=jQuery.fn.TinyMCE=function(d,e){return this.each(function(i){var a,b,c=this.id=this.id||this.name||(this.className||'jMCE')+i;if(d&&Object===d.constructor){e=d;d=null}if(!d&&tinyMCE.get(c)){d='remove';b=true}switch(d){case'remove':a='mceRemoveControl';break;case'toggle':a='mceToggleEditor';break;default:a='mceAddControl'}tinyMCE.settings=e;tinyMCE.execCommand(a,false,c);if(b)$(this).tinyMCE(e)})};

View file

@ -11,9 +11,9 @@
</#if>
<input rows="2" type="textarea"
<textarea rows="2"
id="${editConfiguration.dataLiteral}" name="${editConfiguration.dataLiteral}"
value="${literalValues}"/>
value="${literalValues}" class="useTinyMce">${literalValues}</textarea>
<div style="margin-top: 0.2em">

View file

@ -25,13 +25,14 @@
<#-- Set up data -->
<script type="text/javascript">
var tinyMCEData = {
var customFormData = {
tinyMCEData : {
theme : "advanced",
mode : "textareas",
theme_advanced_buttons1 : "${buttons}",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "{toolbarLocation}",
theme_advanced_toolbar_location : "${toolbarLocation}",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_path : false,
@ -59,6 +60,7 @@
// theme_advanced_buttons3_add_before : "tablecontrols,separator",
// invalid_elements : "li",
// theme_advanced_styles : "Header 1=header1;Header 2=header2;Header 3=header3;Table Row=tableRow1", // Theme specific setting CSS classes
}
};
</script>