r1542 - in xwiki/trunk: core/src/main/java/com/xpn/xwiki core/src/main/java/com/xpn/xwiki/api core/src/main/java/com/xpn/xwiki/render/macro core/src/main/resources core/src/main/resources/META-INF/services web/standard/src/main/webapp/WEB-INF web/standard/src/main/webapp/templates web/standard/src/main/webapp/tiny_mce_2/themes/wikieditor web/standard/src/main/webapp/tiny_mce_2/themes/wikieditor/jscripts web/standard/src/main/webapp/wiki_editor_2 web/standard/src/main/webapp/wiki_editor_2/plugins web/standard/src/main/webapp/wiki_editor_2/themes
Phung Hai Nam
namphunghai at users.forge.objectweb.org
Tue Nov 14 03:10:42 CET 2006
Author: namphunghai
Date: 2006-11-14 03:10:42 +0100 (Tue, 14 Nov 2006)
New Revision: 1542
Added:
xwiki/trunk/core/src/main/java/com/xpn/xwiki/render/macro/StyleMacro.java
xwiki/trunk/web/standard/src/main/webapp/tiny_mce_2/themes/wikieditor/color_picker.htm
xwiki/trunk/web/standard/src/main/webapp/tiny_mce_2/themes/wikieditor/jscripts/color_picker.js
Modified:
xwiki/trunk/core/src/main/java/com/xpn/xwiki/XWiki.java
xwiki/trunk/core/src/main/java/com/xpn/xwiki/api/XWiki.java
xwiki/trunk/core/src/main/resources/META-INF/services/com.xpn.xwiki.render.macro.XWikiMacro
xwiki/trunk/core/src/main/resources/radeox_markup_xwiki.properties
xwiki/trunk/web/standard/src/main/webapp/WEB-INF/xwiki.cfg
xwiki/trunk/web/standard/src/main/webapp/templates/wysiwyg.vm
xwiki/trunk/web/standard/src/main/webapp/tiny_mce_2/themes/wikieditor/editor_template.js
xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/plugins/core.js
xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/themes/default.js
xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/wiki_editor.js
Log:
Fixed some bugs in wysiwyg 2 but haven't finished to support the style in editor toolbar ,yet
Modified: xwiki/trunk/core/src/main/java/com/xpn/xwiki/XWiki.java
===================================================================
--- xwiki/trunk/core/src/main/java/com/xpn/xwiki/XWiki.java 2006-11-13 21:52:32 UTC (rev 1541)
+++ xwiki/trunk/core/src/main/java/com/xpn/xwiki/XWiki.java 2006-11-14 02:10:42 UTC (rev 1542)
@@ -4031,6 +4031,10 @@
return (context.getWiki().ParamAsLong("xwiki.plugin.captcha", 0) == 1);
}
+ public boolean useWysiwygStyleToolbar(XWikiContext context) {
+ return (context.getWiki().ParamAsLong("xwiki.wysiwyg.use_style_toolbar", 0) == 1);
+ }
+
public String clearName(String name, XWikiContext context) {
name = name.replaceAll("[àâä]","a");
name = name.replaceAll("[éèêë]","e");
Modified: xwiki/trunk/core/src/main/java/com/xpn/xwiki/api/XWiki.java
===================================================================
--- xwiki/trunk/core/src/main/java/com/xpn/xwiki/api/XWiki.java 2006-11-13 21:52:32 UTC (rev 1541)
+++ xwiki/trunk/core/src/main/java/com/xpn/xwiki/api/XWiki.java 2006-11-14 02:10:42 UTC (rev 1542)
@@ -1941,6 +1941,14 @@
}
/**
+ * API to check if using the style toolbar in Wysiwyg editor
+ * @return a boolean value
+ */
+ public boolean useWysiwygStyleToolbar() {
+ return xwiki.useWysiwygStyleToolbar(context);
+ }
+
+ /**
* API to create an object from the request
* The parameters are the ones that are created from doc.display("field","edit") calls
* @param className XWiki Class Name to create the object from
Added: xwiki/trunk/core/src/main/java/com/xpn/xwiki/render/macro/StyleMacro.java
===================================================================
--- xwiki/trunk/core/src/main/java/com/xpn/xwiki/render/macro/StyleMacro.java 2006-11-13 21:52:32 UTC (rev 1541)
+++ xwiki/trunk/core/src/main/java/com/xpn/xwiki/render/macro/StyleMacro.java 2006-11-14 02:10:42 UTC (rev 1542)
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2006, XpertNet SARL, and individual contributors as indicated
+ * by the contributors.txt.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * @author Phung Nam (phunghainam at xwiki.com)
+ */
+
+package com.xpn.xwiki.render.macro;
+
+import org.radeox.macro.BaseLocaleMacro;
+import org.radeox.macro.parameter.MacroParameter;
+import org.radeox.api.engine.context.RenderContext;
+import org.radeox.api.engine.RenderEngine;
+
+import java.io.Writer;
+import java.io.IOException;
+
+public class StyleMacro extends BaseLocaleMacro {
+ public String getLocaleKey() {
+ return "macro.style";
+ }
+
+ public void execute(Writer writer, MacroParameter params)
+ throws IllegalArgumentException, IOException {
+ RenderContext context = params.getContext();
+ RenderEngine engine = context.getRenderEngine();
+
+ String text = params.getContent();
+ String type = params.get("type");
+ String id = params.get("id");
+ String classes = params.get("class");
+ String size = params.get("font-size");
+ String font = params.get("font-family");
+ String color = params.get("color");
+ String bgcolor = params.get("background-color");
+
+ if (("none".equals(type)) || (type == null) || ("".equals(type.trim()))) {
+ type = "span";
+ }
+ StringBuffer str = new StringBuffer();
+ str.append("<" + type + " ");
+
+ if ((!"none".equals(id)) && (id != null) && (!"".equals(id.trim()))) {
+ str.append("id=\"" + id.trim() + "\" ");
+ }
+ if ((!"none".equals(classes)) && (classes != null) && (!"".equals(classes.trim()))) {
+ str.append("class=\"" + classes.trim() + "\" ");
+ }
+
+ str.append("style=\"");
+
+ if ((!"none".equals(size)) && (size != null) && (!"".equals(size.trim()))) {
+ str.append("font-size:" + size.trim() + "; ");
+ }
+ if ((!"none".equals(font)) && (font != null) && (!"".equals(font.trim()))) {
+ str.append("font-family:" + font.trim() + "; ");
+ }
+ if ((!"none".equals(color)) && (color != null) && (!"".equals(color.trim()))) {
+ str.append("color:" + color.trim() + "; ");
+ }
+ if ((!"none".equals(bgcolor)) && (bgcolor != null) && (!"".equals(bgcolor.trim()))) {
+ str.append("background-color:" + bgcolor.trim() + "; ");
+ }
+ str.append("\" >");
+ str.append(text);
+ str.append("</" + type + ">");
+
+ writer.write(str.toString());
+ }
+}
Modified: xwiki/trunk/core/src/main/resources/META-INF/services/com.xpn.xwiki.render.macro.XWikiMacro
===================================================================
--- xwiki/trunk/core/src/main/resources/META-INF/services/com.xpn.xwiki.render.macro.XWikiMacro 2006-11-13 21:52:32 UTC (rev 1541)
+++ xwiki/trunk/core/src/main/resources/META-INF/services/com.xpn.xwiki.render.macro.XWikiMacro 2006-11-14 02:10:42 UTC (rev 1542)
@@ -3,6 +3,7 @@
com.xpn.xwiki.render.macro.AttachMacro
com.xpn.xwiki.render.macro.FormMacro
com.xpn.xwiki.render.macro.FieldMacro
+com.xpn.xwiki.render.macro.StyleMacro
com.xpn.xwiki.plugin.laszlo.LaszloMacro
com.xpn.xwiki.plugin.graphviz.GraphVizMacro
com.xpn.xwiki.plugin.svg.SVGMacro
Modified: xwiki/trunk/core/src/main/resources/radeox_markup_xwiki.properties
===================================================================
--- xwiki/trunk/core/src/main/resources/radeox_markup_xwiki.properties 2006-11-13 21:52:32 UTC (rev 1541)
+++ xwiki/trunk/core/src/main/resources/radeox_markup_xwiki.properties 2006-11-14 02:10:42 UTC (rev 1542)
@@ -2,6 +2,7 @@
macro.rss.name=rss
macro.image.name=image
macro.attach.name=attach
+macro.style.name=style
macro.field.name=field
macro.display.name=display
macro.form.name=form
Modified: xwiki/trunk/web/standard/src/main/webapp/WEB-INF/xwiki.cfg
===================================================================
--- xwiki/trunk/web/standard/src/main/webapp/WEB-INF/xwiki.cfg 2006-11-13 21:52:32 UTC (rev 1541)
+++ xwiki/trunk/web/standard/src/main/webapp/WEB-INF/xwiki.cfg 2006-11-14 02:10:42 UTC (rev 1542)
@@ -74,3 +74,6 @@
# This parameter will activate the sectional editing
xwiki.section.edit=1
+# Editor config
+xwiki.wysiwyg.use_style_toolbar=0
+
Modified: xwiki/trunk/web/standard/src/main/webapp/templates/wysiwyg.vm
===================================================================
--- xwiki/trunk/web/standard/src/main/webapp/templates/wysiwyg.vm 2006-11-13 21:52:32 UTC (rev 1541)
+++ xwiki/trunk/web/standard/src/main/webapp/templates/wysiwyg.vm 2006-11-14 02:10:42 UTC (rev 1542)
@@ -32,6 +32,7 @@
debug : false,
remove_linebreaks : false,
plugins: 'table, contextmenu, paste, searchreplace',
+ wiki_use_style: '$xwiki.useWysiwygStyleToolbar()',
wiki_images_path : '${request.contextPath}/bin/download/$doc.web/$doc.name/',
wiki_attach_path : '${request.contextPath}/bin/view/$doc.web/$doc.name',
wiki_macro_path : '${request.contextPath}/bin/view/$doc.web/$doc.name',
Added: xwiki/trunk/web/standard/src/main/webapp/tiny_mce_2/themes/wikieditor/color_picker.htm
===================================================================
--- xwiki/trunk/web/standard/src/main/webapp/tiny_mce_2/themes/wikieditor/color_picker.htm 2006-11-13 21:52:32 UTC (rev 1541)
+++ xwiki/trunk/web/standard/src/main/webapp/tiny_mce_2/themes/wikieditor/color_picker.htm 2006-11-14 02:10:42 UTC (rev 1542)
@@ -0,0 +1,13 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>{$lang_theme_colorpicker_title}</title>
+ <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script language="javascript" type="text/javascript" src="jscripts/color_picker.js"></script>
+ <base target="_self" />
+</head>
+<body onload="tinyMCEPopup.executeOnLoad('init();');" style="margin: 3px; ">
+ <div align="center">
+ <script language="javascript" type="text/javascript">renderColorMap();</script>
+ </div>
+</body>
+</html>
Modified: xwiki/trunk/web/standard/src/main/webapp/tiny_mce_2/themes/wikieditor/editor_template.js
===================================================================
--- xwiki/trunk/web/standard/src/main/webapp/tiny_mce_2/themes/wikieditor/editor_template.js 2006-11-13 21:52:32 UTC (rev 1541)
+++ xwiki/trunk/web/standard/src/main/webapp/tiny_mce_2/themes/wikieditor/editor_template.js 2006-11-14 02:10:42 UTC (rev 1542)
@@ -98,6 +98,43 @@
return true;
+ case "mceForeColor":
+ var template = new Array();
+ var elm = tinyMCE.selectedInstance.getFocusElement();
+ var inputColor = tinyMCE.getAttrib(elm, "color");
+
+ if (inputColor == '')
+ inputColor = elm.style.color;
+
+ if (!inputColor)
+ inputColor = "#000000";
+
+ template['file'] = 'color_picker.htm';
+ template['width'] = 220;
+ template['height'] = 190;
+
+ tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "forecolor", input_color : inputColor});
+ return true;
+
+ case "mceBackColor":
+ var template = new Array();
+ var elm = tinyMCE.selectedInstance.getFocusElement();
+ var inputColor = elm.style.backgroundColor;
+
+ if (!inputColor)
+ inputColor = "#000000";
+
+ template['file'] = 'color_picker.htm';
+ template['width'] = 220;
+ template['height'] = 190;
+
+ template['width'] += tinyMCE.getLang('lang_theme_advanced_backcolor_delta_width', 0);
+ template['height'] += tinyMCE.getLang('lang_theme_advanced_backcolor_delta_height', 0);
+
+ tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "HiliteColor", input_color : inputColor});
+ //mceBackColor
+ return true;
+
default :
return wikiEditor.execCommand(editor_id, element, command, user_interface, value);
}
Added: xwiki/trunk/web/standard/src/main/webapp/tiny_mce_2/themes/wikieditor/jscripts/color_picker.js
===================================================================
--- xwiki/trunk/web/standard/src/main/webapp/tiny_mce_2/themes/wikieditor/jscripts/color_picker.js 2006-11-13 21:52:32 UTC (rev 1541)
+++ xwiki/trunk/web/standard/src/main/webapp/tiny_mce_2/themes/wikieditor/jscripts/color_picker.js 2006-11-14 02:10:42 UTC (rev 1542)
@@ -0,0 +1,108 @@
+function init() {
+ if (tinyMCE.isMSIE)
+ tinyMCEPopup.resizeToInnerSize();
+}
+
+function selectColor() {
+ var color = document.getElementById("selectedColorBox").value;
+
+ tinyMCEPopup.execCommand(tinyMCE.getWindowArg('command'), false, color);
+ tinyMCEPopup.close();
+}
+
+function showColor(color) {
+ document.getElementById("selectedColor").style.backgroundColor = color;
+ document.getElementById("selectedColorBox").value = color;
+}
+
+var colors = new Array(
+ "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",
+ "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",
+ "#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff",
+ "#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033",
+ "#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399",
+ "#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff",
+ "#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333",
+ "#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399",
+ "#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff",
+ "#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633",
+ "#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699",
+ "#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff",
+ "#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633",
+ "#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999",
+ "#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff",
+ "#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933",
+ "#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999",
+ "#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff",
+ "#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33",
+ "#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99",
+ "#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff",
+ "#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33",
+ "#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99",
+ "#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff",
+ "#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33",
+ "#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99",
+ "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"
+);
+
+function convertRGBToHex(col) {
+ var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
+
+ var rgb = col.replace(re, "$1,$2,$3").split(',');
+ if (rgb.length == 3) {
+ r = parseInt(rgb[0]).toString(16);
+ g = parseInt(rgb[1]).toString(16);
+ b = parseInt(rgb[2]).toString(16);
+
+ r = r.length == 1 ? '0' + r : r;
+ g = g.length == 1 ? '0' + g : g;
+ b = b.length == 1 ? '0' + b : b;
+
+ return "#" + r + g + b;
+ }
+
+ return col;
+}
+
+function convertHexToRGB(col) {
+ if (col.indexOf('#') != -1) {
+ col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
+
+ r = parseInt(col.substring(0, 2), 16);
+ g = parseInt(col.substring(2, 4), 16);
+ b = parseInt(col.substring(4, 6), 16);
+
+ return "rgb(" + r + "," + g + "," + b + ")";
+ }
+
+ return col;
+}
+
+function renderColorMap() {
+ var html = "";
+ var inputColor = convertRGBToHex(tinyMCE.getWindowArg('input_color'));
+
+ html += '<table border="0" cellspacing="1" cellpadding="0">'
+ + '<tr>';
+ for (var i=0; i<colors.length; i++) {
+ html += '<td bgcolor="' + colors[i] + '">'
+ + '<a href="javascript:selectColor();" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');">'
+ + '<img border="0" src="images/spacer.gif" width="10" height="10" title="' + colors[i] + '" alt="' + colors[i] + '" /></a></td>';
+ if ((i+1) % 18 == 0)
+ html += '</tr><tr>';
+ }
+ html += '<tr><td colspan="18">'
+ + '<table width="100%" border="0" cellspacing="0" cellpadding="0">'
+ + '<tr><td>'
+ + '<img id="selectedColor" style="background-color:' + tinyMCE.getWindowArg('input_color') + '" border="0" src="images/spacer.gif" width="80" height="16" />'
+ + '</td><td align="right">'
+ + '<input id="selectedColorBox" name="selectedColorBox" type="text" size="7" maxlength="7" style="width:65px" value="' + inputColor + '" />'
+ + '</td></tr>'
+ + '</table>'
+ + '<div style="float: left"><input type="button" id="insert" name="insert" value="{$lang_theme_colorpicker_apply}" style="margin-top:3px" onclick="selectColor();"></div>'
+ + '<div style="float: right"><input type="button" name="cancel" value="{$lang_cancel}" style="margin-top:3px" onclick="tinyMCEPopup.close();" id="cancel" /></div>'
+ + '</td></tr>'
+ + '</table>';
+
+ document.write(html);
+}
\ No newline at end of file
Modified: xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/plugins/core.js
===================================================================
--- xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/plugins/core.js 2006-11-13 21:52:32 UTC (rev 1541)
+++ xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/plugins/core.js 2006-11-14 02:10:42 UTC (rev 1542)
@@ -12,7 +12,9 @@
this.addExternalProcessor((/^\s*(1(\.1)*)\s+([^\r\n]*)$/im), 'convertHeadingExternal');
this.addInternalProcessor((/\s*<h3\s*([^>]*)>([\s\S]+?)<\/h3>/i), 'convertHeadingInternal');
- this.addExternalProcessor((/^\s*((\*+)|#)\s+([^\r\n]+)$/im), 'convertListExternal');
+ this.addInternalProcessor((/<p[^>]*> <\/p>/gi), "");
+
+ this.addExternalProcessor((/^\s*((\*+)|#)\s+([^\r\n]+)$/im), 'convertListExternal');
this.addInternalProcessor((/\s*<(ul|ol)\s*([^>]*)>/i), 'convertListInternal');
this.addExternalProcessor((/^s*----(\-)*\s*$/gim), '<hr class="line" \/>');
@@ -116,7 +118,8 @@
WikiEditor.prototype.removeSpecialHtmlTags = function(str) {
str = str.replace(/<div class="paragraph">([\s\S]+?)<\/div>/g,'$1');
str = str.replace(/<p class="paragraph">\s*([\s\S]+?)<\/p>/g,'$1');
- str = str.replace(/<\/?span\s*([^>]*)>/gi, "");
+ str = str.replace(/<span class="wikilink">\s*([\s\S]+?)<\/span>/g,'$1');
+ str = str.replace(/<span class="wikiexternallink">\s*([\s\S]+?)<\/span>/g,'$1');
str = str.replace(/<\/?p[^>]*>/gi, "");
str = str.replace(/<br \/>/g, '\r\n')
return str;
@@ -570,16 +573,56 @@
}
WikiEditor.prototype.getTitleControl = function(button_name) {
- return '<select id="{$editor_id}_titleSelect" name="{$editor_id}_titleSelect" class="mceSelectList" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Title\',false,this.options[this.selectedIndex].value);wikiEditor.executedCommand(\'Title\');">\
- <option value="0">{$lang_wiki_title_menu}</option>\
- <option value="1">{$lang_wiki_title_1}</option>\
- <option value="2">{$lang_wiki_title_2}</option>\
- <option value="3">{$lang_wiki_title_3}</option>\
- <option value="4">{$lang_wiki_title_4}</option>\
- <option value="5">{$lang_wiki_title_5}</option>\
- </select>';
+ return '<select id="{$editor_id}_titleSelect" name="{$editor_id}_titleSelect" class="mceSelectList" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Title\',false,this.options[this.selectedIndex].value);wikiEditor.executedCommand(\'Title\');">' +
+ '<option value="0">{$lang_wiki_title_menu}</option>' +
+ '<option value="1">{$lang_wiki_title_1}</option>' +
+ '<option value="2">{$lang_wiki_title_2}</option>' +
+ '<option value="3">{$lang_wiki_title_3}</option>' +
+ '<option value="4">{$lang_wiki_title_4}</option>' +
+ '<option value="5">{$lang_wiki_title_5}</option>' +
+ '</select>';
}
+WikiEditor.prototype.getStyleToolbar = function() {
+ return this.getStyleControl("fontselect") + this.getStyleControl("fontSizeSelect") + this.getStyleControl("mceForeColor") + this.getStyleControl("mceBackColor");
+}
+
+WikiEditor.prototype.getStyleControl = function(button_name) {
+ switch(button_name) {
+ case 'mceForeColor' :
+ return this.createButtonHTML('forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', 'mceForeColor', true);
+ case 'fontSizeSelect':
+ return '<select id="{$editor_id}_fontSizeSelect" name="{$editor_id}_fontSizeSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontSize\',false,this.options[this.selectedIndex].value);" class="mceSelectList">' +
+ '<option value="0">{$lang_theme_font_size}</option>' +
+ '<option value="1">1 (8 pt)</option>' +
+ '<option value="2">2 (10 pt)</option>' +
+ '<option value="3">3 (12 pt)</option>' +
+ '<option value="4">4 (14 pt)</option>' +
+ '<option value="5">5 (18 pt)</option>' +
+ '<option value="6">6 (24 pt)</option>' +
+ '<option value="7">7 (36 pt)</option>' +
+ '</select>';
+
+ case "fontselect":
+ var fontHTML = '<select id="{$editor_id}_fontNameSelect" name="{$editor_id}_fontNameSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontName\',false,this.options[this.selectedIndex].value);" class="mceSelectList"><option value="">{$lang_theme_fontdefault}</option>';
+ var iFonts = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';
+ var nFonts = 'Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sand;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats';
+ var fonts = tinyMCE.getParam("theme_advanced_fonts", nFonts).split(';');
+ for (i=0; i<fonts.length; i++) {
+ if (fonts[i] != '') {
+ var parts = fonts[i].split('=');
+ fontHTML += '<option value="' + parts[1] + '">' + parts[0] + '</option>';
+ }
+ }
+
+ fontHTML += '</select>';
+ return fontHTML;
+
+ case 'mceBackColor' :
+ return this.createButtonHTML('backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', 'mceBackColor', true)
+ }
+}
+
WikiEditor.prototype.getListToolbar = function() {
return this.getListControls('bullist') + this.getListControls('numlist');
}
Modified: xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/themes/default.js
===================================================================
--- xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/themes/default.js 2006-11-13 21:52:32 UTC (rev 1541)
+++ xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/themes/default.js 2006-11-14 02:10:42 UTC (rev 1542)
@@ -14,10 +14,14 @@
<tr><td class="mceToolbar" align="center" height="1">';
str += this.getTextToolbar() + this.TOOLBAR_SPACER + this.getListToolbar() + this.TOOLBAR_SPACER +
- this.getTabToolbar() + this.TOOLBAR_SPACER + this.getUndoToolbar() + this.TOOLBAR_SPACER +
- this.getTitleToolbar() + this.TOOLBAR_SPACER + this.getTableToolbar() + this.TOOLBAR_SPACER +
- this.getTableRowToolbar() + this.TOOLBAR_SPACER + this.getTableColToolbar() + this.TOOLBAR_SPACER +
- this.getLinkToolbar();
+ this.getTabToolbar() + this.TOOLBAR_SPACER + this.getUndoToolbar() + this.TOOLBAR_SPACER + this.getTitleToolbar();
+
+ if (this._useStyleToolbar) {
+ str += this.TOOLBAR_SPACER + this.getStyleToolbar();
+ }
+
+ str += this.TOOLBAR_SPACER + this.getTableToolbar() + this.TOOLBAR_SPACER + this.getTableRowToolbar() +
+ this.TOOLBAR_SPACER + this.getTableColToolbar() + this.TOOLBAR_SPACER + this.getLinkToolbar();
if (this.isPluginLoaded("attachments")) {
str += this.TOOLBAR_SPACER + this.getAttachmentsToolbar();
}
Modified: xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/wiki_editor.js
===================================================================
--- xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/wiki_editor.js 2006-11-13 21:52:32 UTC (rev 1541)
+++ xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/wiki_editor.js 2006-11-14 02:10:42 UTC (rev 1542)
@@ -54,8 +54,9 @@
this.core = tinyMCE;
this._theme = 'default';
this._loadedPlugins = new Array();
-
- // Add the necessary plugin
+ this._useStyleToolbar = false;
+
+ // Add the necessary plugin
if(params["plugins"] == null) {
params["plugins"] = "";
}
@@ -76,6 +77,10 @@
this._theme = params["wiki_theme"];
}
+ if (params["wiki_use_style"] == 'true') {
+ this._useStyleToolbar = params["wiki_use_style"];
+ }
+
this.core.init(params);
// Load theme
More information about the Xwiki-notifications
mailing list