You are not logged in.
I just can't figure out how to customize the Xinha editor at all. All I want is to add a button to the toolbar which calls my own Javascript code. This is what I'm doing:
xinha_config=new HTMLArea.Config();
xinha_config.registerButton("AddContent", "Add Content", "icon.gif", false, function(editor) {alert('here');});
xinha_editors=HTMLArea.makeEditors(xinha_editors,xinha_config,xinha_plugins);
HTMLArea.startEditors(xinha_editors);
Nothing happens. What am I doing wrong?
Offline
Hi i want to add new textbox button in my xinha editor toolbar.dnt know how to customize and in which file i have to add that code.please help me...
waiting for your earlier response...
Offline
A "textbox button"?
That makes little sense, you would have to describe more fully, but the appropriate manner in which to add something to a toolbar is generally by writing a plugin.
If you wanted to insert an actual text field in the toolbar, you would need to modify Xinha's core code fairly considerably I expect.
James Sleeman
Offline
hai am wrking with xinha editor...i like this editor very much and all features are there.all functions are working fine in IE. but save button didnt visible and cant save the textarea content..am using firefox 3.6 version.i have cleared all cookies also.don't know what is the problem?shall i change another version of firefox?am having deadline within 2 days...waiting for ur early answer...please help me...:(
i have attached my code:
<%@page import="java.awt.TextArea"%>
<%@page import="java.io.FileInputStream"%>
<%@page import="java.io.DataInputStream"%>
<%@page import="java.io.InputStreamReader"%>
<%@page import="java.io.BufferedReader"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import="java.util.*" %>
<!DOCTYPE BHTML PUBLIC "-//BC//DTD BHTML 3.2 Final//EN">
<html>
<title>Xinha Editor</title>
<head>
<script type="text/javascript">
function save()
{
str = document.forms[0].myTextArea.value;
mydoc = document.open();
mydoc.write(str);
mydoc.execCommand("saveAs",true,"save.html");
mydoc.close();
}
</script>
<script type="text/javascript">
_editor_url = "/new/Xinha";
_editor_lang = "en";
_editor_skin = "blue-metallic";
</script>
<script type="text/javascript" src="/new/Xinha/XinhaCore.js"></script>
<script type="text/javascript">
xinha_editors = null;
xinha_init = null;
xinha_config = null;
xinha_plugins = null;
xinha_init = xinha_init ? xinha_init : function()
{
xinha_editors = xinha_editors ? xinha_editors :
[
'myTextArea'
];
xinha_plugins = xinha_plugins ? xinha_plugins :
[
'CharacterMap',
'ContextMenu',
'ListType',
'Stylist',
'Linker',
'SuperClean',
'TableOperations',
'InsertSmiley',
'InsertNote',
'CharCounter',
'InsertAnchor',
'QuickTag',
'Template',
'FindReplace',
'SpellChecker',
'Equation',
'CSS',
'Abbreviation',
'Forms'
];
if(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return;
xinha_config = xinha_config ? xinha_config() : new Xinha.Config();
xinha_config.toolbar =
[
["popupeditor"],
["separator","formatblock","fontname","fontsize","bold","italic","underline","strikethrough"],
["separator","forecolor","hilitecolor","textindicator"],
["separator","subscript","superscript"],
["linebreak","separator","justifyleft","justifycenter","justifyright","justifyfull"],
["separator","insertorderedlist","insertunorderedlist","outdent","indent"],
["separator","inserthorizontalrule","createlink","insertimage","inserttable"],
["linebreak","separator","undo","redo","selectall","print"],(Xinha.is_gecko ? [] : ["cut","copy","paste","overwrite","saveas"]),
["separator","killword","clearfonts","removeformat","toggleborders","splitblock","lefttoright", "righttoleft"],
["separator","htmlmode","showhelp","about"]
];
xinha_config.pageStyleSheets = [ _editor_url + "examples/files/stylist.css" ];
xinha_config.stylistLoadStylesheet( _editor_url + "examples/files/stylist.css");
xinha_config.registerButton({
id : "stylist",
tooltip : "Toggle Stylist",
image : _editor_url + "plugins/Stylist/img/ed_style.GIF",
textMode : false,
action : function(editor) { editor._toggleStylist(editor); }
});
xinha_config.toolbar[1].splice(1, 0, "separator");
xinha_config.toolbar[1].splice(1, 0, "stylist");
// the button action function code
Xinha.prototype._toggleStylist = function(editor) {
if(editor._stylistVisible == true) {
editor.hidePanels(['right']);
editor._stylistVisible = false;
} else {
editor.showPanels(['right']);
editor._stylistVisible = true;
}
};
//initial visibility setting
Xinha.prototype._stylistVisible = true;
xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
Xinha.startEditors(xinha_editors);
};
Xinha._addEvent(window,'load', xinha_init);
</script>
</head>
<body bgcolor="#6D7B8D" style="margin-top:20px;margin-left:20px;margin-right:10px;margin-bottom:10px;">
<div style="padding-left=30em;padding-top=30em;padding-right=30em;padding-bottom=30em;">
<form>
<textarea id="myTextArea" name="myTextArea" rows="40" cols="100%" style="WIDTH:99%;"></textarea>
<input type="button" value="save" onclick="save()">
</form>
</div>
</body>
</html>
Offline
hai ..
now i got this error in error console:
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.execCommand]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost:8081/website/page1.jsp :: save :: line 18" data: no]
and in firefox message is displayed as "Unfined"
actually what is the problem in my code...help me...
Offline
I think that Firefox does not support "saveAs" execCommand, that is IE only.
Your application probably will only work on IE if you need to use "saveAs".
"saveAs" is for saving the file to the computer of the browser, not to the server.
James Sleeman
Offline
Hi thanks for your reply:)
Now i wantt this editor both in PC and Mac.if i use this editor in IE means,what browser i should use for mac?another problem is equation,find and replace and template forms are blinking when i click those buttons in IE8.what should i change now?
Offline
I do not know if "saveAs" command is supported on any Mac browser (Safari, Chrome?, Opera), possibly it is not.
It would be far smarter for you to submit the form to the server which can create the file and return it as a Content-Disposition:attachment; then you do not need to use the "saveAs" command and do not worry about what the browser supports.
I do not use IE, I don't know what your problem will be with that, you must use the IE developer tools to debug. Ensure your page is in standards mode.
James Sleeman
Offline