Author: alevkovsky
Date: 2008-11-15 07:35:11 -0500 (Sat, 15 Nov 2008)
New Revision: 11182
Modified:
trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/UIEditor.java
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/editor.js
trunk/sandbox/ui/editor/src/main/templates/editor.jspx
Log:
Editor: add seam text configuration
Modified: trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/UIEditor.java
===================================================================
--- trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/UIEditor.java 2008-11-15
10:34:16 UTC (rev 11181)
+++ trunk/sandbox/ui/editor/src/main/java/org/richfaces/component/UIEditor.java 2008-11-15
12:35:11 UTC (rev 11182)
@@ -127,11 +127,11 @@
@Override
public Converter getConverter() {
- if(getUseSeamText()){
+ Converter converter = super.getConverter();
+ if (getUseSeamText() && converter == null) {
return new SeamTextConverter();
- }else{
- return super.getConverter();
}
+ return converter;
}
Modified:
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/editor.js
===================================================================
---
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/editor.js 2008-11-15
10:34:16 UTC (rev 11181)
+++
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/editor.js 2008-11-15
12:35:11 UTC (rev 11182)
@@ -9,6 +9,8 @@
this.id = id;
this.editorTextAreaId = this.id +'TextArea';
+ this.params = params;
+ this.tinyparams = tinyparams;
var obj = $(this.id);
obj.component = this;
@@ -18,16 +20,18 @@
Richfaces.Editor.extScriptSuffix = params.extScriptSuffix;
Richfaces.Editor.extCssSuffix = params.extCssSuffix;
+ this.synchronizeConfiguration();
+
this.tinyMCE_editor = null;
- this.onInitInstanceCallbackFunction = tinyparams.onInitInstanceCallback;
+ this.onInitInstanceCallbackFunction = this.tinyparams.onInitInstanceCallback;
- tinyparams.mode = 'exact';
- tinyparams.elements = this.editorTextAreaId;
- tinyparams.editor_selector = null;
- tinyparams.editor_deselector = null;
- tinyparams.init_instance_callback = this.onInitInstanceCallback.bind(this);
+ this.tinyparams.mode = 'exact';
+ this.tinyparams.elements = this.editorTextAreaId;
+ this.tinyparams.editor_selector = null;
+ this.tinyparams.editor_deselector = null;
+ this.tinyparams.init_instance_callback = this.onInitInstanceCallback.bind(this);
- tinyMCE.init(tinyparams);
+ tinyMCE.init(this.tinyparams);
this.onBeforeAjaxListener = new A4J.AJAX.AjaxListener("onbeforeajax",
this.onBeforeAjax.bind(this));
A4J.AJAX.AddListener(this.onBeforeAjaxListener);
@@ -50,8 +54,29 @@
onInitInstanceCallback: function(inst) {
this.tinyMCE_editor = tinyMCE.get(this.editorTextAreaId);
if (this.onInitInstanceCallbackFunction)
this.onInitInstanceCallbackFunction.call(this, inst);
+ },
+
+ synchronizeConfiguration: function(){
+ if(this.params.useSeamText){
+ this.tinyparams.plugins = Richfaces.Editor.SeamTextConfiguration.plugins;
+
+ this.tinyparams.theme_advanced_buttons1 =
Richfaces.Editor.SeamTextConfiguration.theme_advanced_buttons1;
+ this.tinyparams.theme_advanced_buttons2 =
Richfaces.Editor.SeamTextConfiguration.theme_advanced_buttons2;
+ this.tinyparams.theme_advanced_buttons3 =
Richfaces.Editor.SeamTextConfiguration.theme_advanced_buttons3;
+ this.tinyparams.theme_advanced_buttons4 =
Richfaces.Editor.SeamTextConfiguration.theme_advanced_buttons4;
+ }
}
});
+
+Richfaces.Editor.SeamTextConfiguration = {
+ plugins :
"safari,spellchecker,style,table,save,advhr,advimage,advlink,iespell,inlinepopups,insertdatetime,preview,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
+
+ // Theme options
+ theme_advanced_buttons1 :
"save,newdocument,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,|,cut,copy,paste,pastetext,pasteword",
+ theme_advanced_buttons2 :
"search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
+ theme_advanced_buttons3 :
"tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,iespell,advhr,|,print,|,ltr,rtl,|,fullscreen",
+ theme_advanced_buttons4 :
"styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote"
+}
\ No newline at end of file
Modified: trunk/sandbox/ui/editor/src/main/templates/editor.jspx
===================================================================
--- trunk/sandbox/ui/editor/src/main/templates/editor.jspx 2008-11-15 10:34:16 UTC (rev
11181)
+++ trunk/sandbox/ui/editor/src/main/templates/editor.jspx 2008-11-15 12:35:11 UTC (rev
11182)
@@ -32,7 +32,9 @@
<f:call name="writeEditorConfigurationAttributes" />
<f:call name="writeEditorParameters" />
- var richParams =
{extScriptSuffix:'#{this:getSriptMappingSuffix(context)}',
extCssSuffix:'#{this:getCssMappingSuffix(context)}'}
+ var richParams = {extScriptSuffix :
'#{this:getSriptMappingSuffix(context)}',
+ extCssSuffix : '#{this:getCssMappingSuffix(context)}',
+ useSeamText : #{component.attributes['useSeamText']}}
new RichEditor('#{clientId}', richParams, tinyMceParams);
</script>