Author: alevkovsky
Date: 2008-11-12 09:01:02 -0500 (Wed, 12 Nov 2008)
New Revision: 11112
Modified:
trunk/sandbox/ui/editor/src/main/config/component/editor.xml
trunk/sandbox/ui/editor/src/main/java/org/richfaces/renderkit/EditorRendererBase.java
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/tiny_mce/plugins/paste/js/pasteword.js
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/plugins/preview/editor_plugin_src.js
trunk/sandbox/ui/editor/src/main/templates/editor.jspx
Log:
Editor: implementation of parameters intersection with attributes
Modified: trunk/sandbox/ui/editor/src/main/config/component/editor.xml
===================================================================
--- trunk/sandbox/ui/editor/src/main/config/component/editor.xml 2008-11-12 11:57:14 UTC
(rev 11111)
+++ trunk/sandbox/ui/editor/src/main/config/component/editor.xml 2008-11-12 14:01:02 UTC
(rev 11112)
@@ -52,17 +52,15 @@
<name>width</name>
<classname>int</classname>
<description>
- Attribute defines width of component. Default value is "300".
+ Attribute defines width of component.
</description>
- <defaultvalue>300</defaultvalue>
</property>
<property>
<name>height</name>
<classname>int</classname>
<description>
- Attribute defines height of component. Default value is "200".
+ Attribute defines height of component.
</description>
- <defaultvalue>200</defaultvalue>
</property>
<property>
<name>theme</name>
@@ -70,7 +68,6 @@
<description>
Attribute defines Editor theme
</description>
- <defaultvalue>"simple"</defaultvalue>
</property>
<property>
<name>useSeamText</name>
@@ -94,7 +91,6 @@
<description>
Attribute defines Editor is readonly
</description>
- <defaultvalue>false</defaultvalue>
</property>
<property>
<name>language</name>
@@ -102,7 +98,6 @@
<description>
Attribute defines Editor language
</description>
- <defaultvalue>"en"</defaultvalue>
</property>
<property>
<name>autoResize</name>
@@ -110,7 +105,6 @@
<description>
Attribute enables to get the Editor area to resize to the boundaries of the
contents.
</description>
- <defaultvalue>false</defaultvalue>
</property>
<property>
<name>tabindex</name>
@@ -170,7 +164,6 @@
<description>
Attribute defines Editor skin
</description>
- <defaultvalue>"default"</defaultvalue>
</property>
</component>
</components>
Modified:
trunk/sandbox/ui/editor/src/main/java/org/richfaces/renderkit/EditorRendererBase.java
===================================================================
---
trunk/sandbox/ui/editor/src/main/java/org/richfaces/renderkit/EditorRendererBase.java 2008-11-12
11:57:14 UTC (rev 11111)
+++
trunk/sandbox/ui/editor/src/main/java/org/richfaces/renderkit/EditorRendererBase.java 2008-11-12
14:01:02 UTC (rev 11112)
@@ -153,4 +153,50 @@
}
return ret.append("} ").toString();
}
+
+ public void writeEditorConfigurationAttributes(FacesContext context,
+ UIEditor component) throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+
+ if(component.getTheme() != null){
+ writer.writeText("tinyMceParams.theme = '" + component.getTheme() +
"';\n", null);
+ }
+ if(component.getLanguage() != null){
+ writer.writeText("tinyMceParams.language = '" + component.getLanguage()
+ "';\n", null);
+ }
+ if(component.getAutoResize() != null){
+ writer.writeText("tinyMceParams.auto_resize = " + component.getAutoResize()+
";\n", null);
+ }
+ if(component.getReadonly() != null){
+ writer.writeText("tinyMceParams.readonly = " + component.getReadonly()+
";\n", null);
+ }
+ if(component.getPlugins() != null){
+ writer.writeText("tinyMceParams.plugins = '" + component.getPlugins()
+"';\n", null);
+ }
+ if(component.getWidth() != 0){
+ writer.writeText("tinyMceParams.width = " + component.getWidth()
+";\n", null);
+ }
+ if(component.getHeight() != 0){
+ writer.writeText("tinyMceParams.height = " + component.getHeight()
+";\n", null);
+ }
+ if(component.getOninit() != null){
+ writer.writeText("tinyMceParams.oninit = '" + component.getOninit()
+"';\n", null);
+ }
+ if(component.getOnsave() != null){
+ writer.writeText("tinyMceParams.save_callback = '" +
component.getOnsave() +"';\n", null);
+ }
+ if(component.getOnchange() != null){
+ writer.writeText("tinyMceParams.onchange_callback = '" +
component.getOnchange() +"';\n", null);
+ }
+ if(component.getOnsetup() != null){
+ writer.writeText("tinyMceParams.setup = '" + component.getOnsetup()
+"';\n", null);
+ }
+ if(component.getSkin() != null){
+ writer.writeText("tinyMceParams.skin = '" + component.getSkin()
+"';\n", null);
+ }else{
+ writer.writeText("if(!tinyMceParams.skin){\n", null);
+ writer.writeText(" tinyMceParams.skin = 'richfaces';\n", null);
+ writer.writeText("}\n", null);
+ }
+ }
}
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-12
11:57:14 UTC (rev 11111)
+++
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/editor.js 2008-11-12
14:01:02 UTC (rev 11112)
@@ -1,7 +1,7 @@
if (!window.Richfaces) window.Richfaces = {};
+tinymce.richfaces = Richfaces;
Richfaces.Editor = {};
Richfaces.Editor.REGEXP_CSS =
/(\/tiny_mce\/(?:themes|plugins)\/[\w\.\\\/]*[\w\.]+\.)(c|C)[sS]{2}$/;
-Richfaces.Editor.extSuffix = "";
RichEditor = Class.create();
Object.extend(RichEditor.prototype, {
Modified:
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/plugins/paste/js/pasteword.js
===================================================================
---
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/plugins/paste/js/pasteword.js 2008-11-12
11:57:14 UTC (rev 11111)
+++
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/plugins/paste/js/pasteword.js 2008-11-12
14:01:02 UTC (rev 11112)
@@ -21,7 +21,7 @@
function createIFrame() {
// RF: added extsuffix // PY
- document.getElementById('iframecontainer').innerHTML = '<iframe
id="frmData" name="frmData" class="sourceIframe"
src="blank.htm'+(Richfaces && Richfaces.Editor ?
Richfaces.Editor.extSuffix : '')+'" height="280"
width="400" frameborder="0" style="background-color:#FFFFFF;
width:100%;" dir="ltr" wrap="soft"></iframe>';
+ document.getElementById('iframecontainer').innerHTML = '<iframe
id="frmData" name="frmData" class="sourceIframe"
src="blank.htm'+tinymce.richfaces.Editor.extScriptSuffix+'"
height="280" width="400" frameborder="0"
style="background-color:#FFFFFF; width:100%;" dir="ltr"
wrap="soft"></iframe>';
}
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
Modified:
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/plugins/preview/editor_plugin_src.js
===================================================================
---
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/plugins/preview/editor_plugin_src.js 2008-11-12
11:57:14 UTC (rev 11111)
+++
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/plugins/preview/editor_plugin_src.js 2008-11-12
14:01:02 UTC (rev 11112)
@@ -19,7 +19,11 @@
ed.addCommand('mcePreview', function() {
ed.windowManager.open({
- file : ed.getParam("plugin_preview_pageurl", url +
"/preview.html"),
+
+ //RF changes : added extsuffix // LA
+ file : ed.getParam("plugin_preview_pageurl", url +
"/preview.html" + tinymce.richfaces.Editor.extScriptSuffix),
+ //RF changes end
+
width : parseInt(ed.getParam("plugin_preview_width", "550")),
height : parseInt(ed.getParam("plugin_preview_height", "600")),
resizable : "yes",
Modified: trunk/sandbox/ui/editor/src/main/templates/editor.jspx
===================================================================
--- trunk/sandbox/ui/editor/src/main/templates/editor.jspx 2008-11-12 11:57:14 UTC (rev
11111)
+++ trunk/sandbox/ui/editor/src/main/templates/editor.jspx 2008-11-12 14:01:02 UTC (rev
11112)
@@ -12,7 +12,7 @@
<f:clientid var="clientId"/>
<h:styles>css/editor.xcss</h:styles>
- <h:scripts>new org.ajax4jsf.javascript.AjaxScript(), new
org.ajax4jsf.javascript.PrototypeScript(), scripts/editor.js,
scripts/tiny_mce/tiny_mce_src.js</h:scripts>
+ <h:scripts>new org.ajax4jsf.javascript.AjaxScript(), new
org.ajax4jsf.javascript.PrototypeScript(), scripts/tiny_mce/tiny_mce_src.js,
scripts/editor.js</h:scripts>
<div id="#{clientId}"
x:passThruWithExclusions="id,value,styleClass,class"
class="rich-editor #{component.attributes['styleClass']}"
style="#{component.attributes['style']}">
@@ -20,24 +20,20 @@
style="visibility: hidden">
#{this:getFormattedComponentStringValue(context, component)}
</textarea>
-
+ <jsp:scriptlet>
+ <![CDATA[
+ String onsetup = null;
+ if (component.getAttributes().get("onsetup") != null) {
+ onsetup = (String) component.getAttributes().get("onsetup");
+ }
+ variables.setVariable("onsetup", onsetup);
+ ]]>
+ </jsp:scriptlet>
<script type="text/javascript">
- <f:call name="writeEditorConfigurationParameters" />
-
- tinyMceParams.theme = '#{component.attributes["theme"]}';
- tinyMceParams.language =
'#{component.attributes["language"]}';
- tinyMceParams.autoResize = #{component.attributes["autoResize"]};
- tinyMceParams.readonly = #{component.attributes["readonly"]};
- tinyMceParams.plugins =
'#{component.attributes["plugins"]}';
- tinyMceParams.width = '#{component.attributes["width"]}';
- tinyMceParams.height = '#{component.attributes["height"]}';
- tinyMceParams.oninit = '#{component.attributes["oninit"]}';
- tinyMceParams.onchange_callback =
'#{component.attributes["onchange"]}';
- tinyMceParams.save_callback =
'#{component.attributes["onsave"]}';
- tinyMceParams.setup = '#{component.attributes["onsetup"]}';
- tinyMceParams.skin = '#{component.attributes["skin"]}';
-
+ <f:call name="writeEditorConfigurationParameters" />
+ <f:call name="writeEditorConfigurationAttributes" />
+
var richParams =
{extScriptSuffix:'#{this:getSriptMappingSuffix(context)}',
extCssSuffix:'#{this:getCssMappingSuffix(context)}'}