You are not logged in.
call
Xinha._stopEvent(event);You may also have a look at this: http://xinha.gogo.co.nz/punbb/viewtopic.php?id=1259
It is indeed the editor (technically an iframe) you have to add the listener to. You can do this either from "outside" like so
//add this in your init function AFTER Xinha.startEditors()
var editor = Xinha.getEditor('myTextArea'); //please update to the latest version to have this utility function
editor.whenDocReady (function() {Xinha._addEvent(editor._doc,"keydown", keyHandler)}); // you have to wait until every thing is initialized
function keyHandler (event) {
event = (event) ? event : window.event; // care for IE
var key = String.fromCharCode(event.keyCode);
alert (key);
// if you for some reason don't want the keypress to be executed, use this; otherwise just return true at the end of your function
Xinha._stopEvent(event);
return false;
}or you can create a custom plugin, which is what I would prefer. It is as easy as putting this code in a file plugins/MyCustomPlugin/my-custom-plugin.js
MyCustomPlugin._pluginInfo = {
name : "MyCustomPlugin"
}
function MyCustomPlugin(editor)
{
this.editor = editor;
}
MyCustomPlugin.prototype.onKeyPress = function ( event )
{ // here you don't have to care about getting the event right
var key = this.editor.getKey(event);
alert(key);
// once again you can stop the event
Xinha._stopEvent(event);
// return true here to to stop the event to be dispatched to other plugins, too
return true;
}Available API function: http://xinha.raimundmeyer.de/JSdoc/Xinha/
You should at least replace XinhaCore.js, Xinha.css and the whole modules folder
Just comittet a version with a first try of Safari 3 support. you can check it out here http://releases.xinha.gogo.co.nz/Xinha_0.95_RC2.tar.bz2
Please let me know everything that doesn't work right. Unfortunately I have only Windows to test
Possibly could be done similar to the PreserveScripts plugin (currently only in nightly), involving XMLHttpRequest and eval'ing the content on the server.
Stand by, Safari support is coming soon ![]()
Is the page located on http://joint.dudley.nhs.uk? If so, this is wanted, but should be possible to be switched off with
xinha_config.stripBaseHref = false;In the meantime, I'll try to isolate the html snippet that's causing the issue and post a ticket about it on trac.
Please do that, because actually I can't imagine how this can happen
The latest version is of course
the least buggy available!
Unfortunately not all plugins are so up-to-date, but that's only natural in an heterogeneous, plugin based system. Creating tickets is a good way to help. Thanks ![]()
At the moment there's no simple way to do that.
If you know some JavaScript you could do it by overwriting Xinha.prototype._shortCuts. This is the original function for a start. You can edit it to fit your needs and load the edited code at some point after XinhaCore.js
Xinha.prototype._shortCuts = function (ev)
{
var key = this.getKey(ev).toLowerCase();
var cmd = null;
var value = null;
switch (key)
{
// simple key commands follow
case 'b': cmd = "bold"; break;
case 'i': cmd = "italic"; break;
case 'u': cmd = "underline"; break;
case 's': cmd = "strikethrough"; break;
case 'l': cmd = "justifyleft"; break;
case 'e': cmd = "justifycenter"; break;
case 'r': cmd = "justifyright"; break;
case 'j': cmd = "justifyfull"; break;
case 'z': cmd = "undo"; break;
case 'y': cmd = "redo"; break;
case 'v': cmd = "paste"; break;
case 'n':
cmd = "formatblock";
value = "p";
break;
case '0': cmd = "killword"; break;
// headings
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
cmd = "formatblock";
value = "h" + key;
break;
}
if ( cmd )
{
// execute simple command
this.execCommand(cmd, false, value);
Xinha._stopEvent(ev);
}
};Be aware, though, that this -- like any "hack" -- after an update could stop working and in any case hinders any improvements made in this function (which are actually likely to happen some time in the future, as the shortcut handling definitively is too unflexible)
1) Yes, of course. That's exactly what it does
2-5) No. Xinha or any similar online editor do nothing expect provide a means to edit. Any saving or user management etc. is to be done by a CMS.
That's just two different things. Xinha or any similar online editor do nothing expect provide a means to edit. Any saving or user management etc. is to be done by a CMS.
Yes of course you are right as long as you don't want to use plugins
Hi, the buttons that are disabled in HTML mode are disabled, because they only work in WYSIWIG mode. There is no sense in enabling them when they do nothing and possibly only throw errors
That's a pretty frequent source for syntax errors
try
_editor_skin = "silva";As to why it doesn't work on your server: not beeing clairvoyant it's hard to guess (if you give a URL, it should be most probably sorted out, but otherwise most probably not)
Well from here on the thing starts to get a general JavaScript question, as opposed to a Xinha one. But here we go
if (!xinha_editors) // the init function may be executed several times during plugin loading, but we want to define the array only once
{
xinhas_editors = []; //new Array
var allTextareas = document.getElementsByTagName('textarea');
for (var i=0;i<allTextareas.length;i++) // iterate through the array
{
if (allTextareas[i].id != 'exclude') // check whatever condition you need to exclude your textarea
{
xinhas_editors.push(allTextareas[i]); // add the others to the array
}
}
}var editor = xinha_editors.idOfYourTextarea; //first, you must get a reference to the object that represents the editor you want to perform commands onReplace idOfYourTextarea with the according id of your textarea. This assumes that you use the xinha_editors array, as show in the NewbieGuide
var toolbar = editor._toolbarObjects; // this object contains all the button objects, referenced by a rather arbitrary id
toolbar.bold.cmd(); // call the actual button command; obviously you need the id of the buttonGet Firebug and click yourself through the DOM to access the id's of the buttons, and get an overview what's going on inside all these objects
Have fun ![]()
Just a little oversight in your plugins array: you have getHtml where it should be GetHtml (which is the name of the folder in the plugins folder)
You have your _editor_url set to "/xinha/XinhaCore/, but indeed your files reside in "/testroot/xinha/". Additionally you have a syntax error (missing ; between definitions of _editor_url and _editor_lang).
So correctly the respective lines should be like
<script type="text/javascript">_editor_url="/testroot/xinha/";
_editor_lang="en";
</script>
<script type="text/javascript" src="/testroot/xinha/XinhaCore.js"></script>
<script type="text/javascript" src="/testroot/xinha/my_config.js"></script>Another thing: You might want to read this text on using tags inside a textarea
Do you use a custom toolbar, and may be you have neither "separator" nor "linebreak" tags in it. That causes the toolbar to be one line that causes the table to grow to the length of the toolbar cell. If this is not the case, could you provide a link to a page where one can have a look at the problem? I'd like to help to sort this out, but I cannot reproduce it.
Hi, I jaust had the chance to have another look at your problem and found that it's really there's a problem converting all textareas with the described method. I fixed the code accordingly
Now, the way to convert all textareas in a document is to put
xinha_editors = xinha_editors ? xinha_editors : document.getElementsByTagName('textarea');in your config as Step 1
For this to work at the moment you have to change the code of XinhaCore.js. Open the the file, locate the function Xinha.makeEditors and replace it by the following code (or simply put it at the end of the file, doesn't actually matter)
Xinha.makeEditors = function(editor_names, default_config, plugin_names)
{
if ( !Xinha.isSupportedBrowser ) return;
if ( typeof default_config == 'function' )
{
default_config = default_config();
}
var editors = {};
var textarea;
for ( var x = 0; x < editor_names.length; x++ )
{
if ( typeof editor_names[x] == 'string' ) // the regular case, an id of a textarea
{
textarea = Xinha.getElementById('textarea', editor_names[x] );
if (!textarea) // the id may be specified for a textarea that is maybe on another page; we simply skip it and go on
{
editor_names[x] = null;
continue;
}
}
// make it possible to pass a reference instead of an id, for example from document.getElementsByTagName('textarea')
else if ( typeof editor_names[x] == 'object' && editor_names[x].tagName && editor_names[x].tagName.toLowerCase() == 'textarea' )
{
textarea = editor_names[x];
if ( !textarea.id ) // we'd like to have the textarea have an id
{
textarea.id = 'xinha_id_' + x;
}
}
var editor = new Xinha(textarea, Xinha.cloneObject(default_config));
editor.registerPlugins(plugin_names);
editors[textarea.id] = editor;
}
return editors;
};Im sorry this is not so easily doable as you might think