You are not logged in.
Hi
I am trying to modify the FindReplace plugin to work in text mode too. Ok, it works, but in Mozilla, the "selected" text appears unselected until the FindReplace window are closed. I think it is because the commands are sended from an window that gives focus every 50 miliseconds... don't know. in IE everything is allright.
In wysiwyg mode, FindReplace uses span elements to highlight the search terms, but in text mode it have to be done with real selections... and it happens (including replacements), but user can't see it until the end of the proccess.
Any help?
Thanks, Cau Guanabara
Offline
Hi Ray
do you can give me an example of using panels?
can I open and close a panel by a button click?
Offline
I'm returning just to tell you that I found it in FormOperations plugin.
I was thinking in something like the Stylist panel (large and fixed on screen), but I was wrong...
This panels system is really nice, man!
It means many modifications... but Iwill try.
Thank you.
Offline
Hi cau,
I made a template for a panel plugin
your-plugin.js
/*------------------------------------------*\
YourPlugin for Xinha
_______________________
\*------------------------------------------*/
function YourPlugin(editor) {
this.editor = editor;
var cfg = editor.config;
var self = this;
cfg.registerButton
({
id : "YourPlugin",
tooltip : this._lc("YourPlugin"),
image : _editor_url+"plugins/YourPlugin/img/smartquotes.gif",
textMode : false,
action : function() { self.buttonPress(); }
});
cfg.addToolbarElement("YourPlugin", "htmlmode", 1);
}
YourPlugin._pluginInfo = {
name : "YourPlugin",
version : "1.0",
developer : "Raimund Meyer",
developer_url : "http://rheinauf.de",
c_owner : "Raimund Meyer",
sponsor : "",
sponsor_url : "",
license : "htmlArea"
};
YourPlugin.prototype._lc = function(string) {
return Xinha._lc(string, 'YourPlugin');
};
Xinha.Config.prototype.YourPlugin =
{
// configName : "configDefaultValue"
}
YourPlugin.prototype.buttonPress = function(opts, obj)
{
var self = this;
if ( this.shown) // same as cancel
{
return this.hide();
}
var inputValues = // this fills the inputs with values
{
exampleInput : "value to put in"
};
this.dialog.setValues(inputValues);
this.dialog.show();
this.shown = true;
};
YourPlugin.prototype.onGenerateOnce = function()
{
var self = this;
this._prepareDialog();
// if the dialog is supposed to be hidden in text mode
this.editor.notifyOn('modechange',
function(e,args)
{
switch(args.mode)
{
case 'text':
{
if (self.shown) self.dialog.hide();
break;
}
case 'wysiwyg':
{
if (self.shown) self.dialog.show();
break;
}
}
}
);
};
YourPlugin.prototype._prepareDialog = function()
{
var self = this;
var editor = this.editor;
if ( typeof Xinha.PanelDialog == 'undefined')
{
Xinha._loadback( _editor_url + 'modules/Dialogs/panel-dialog.js', this._prepareDialog,this);
return;
}
if(!this.html)
{
Xinha._getback(_editor_url + 'plugins/YourPlugin/dialog.html', function(getback) { self.html = getback; self._prepareDialog(); });
return;
}
// Now we have everything we need, so we can build the dialog.
this.dialog = new Xinha.PanelDialog(editor, 'top',this.html);
this.dialog.getElementById('ok').onclick = function ()
{
// onOK
var values = self.hide(); // this gets us the values from the inputs in the dialog as an object
// do something
}
this.dialog.getElementById('cancel').onclick = function ()
{
self.hide();
}
this.ready = true;
this.hide();
};
YourPlugin.prototype.hide = function()
{
this.shown = false;
return this.dialog.hide();
};
dialog.html
<h1><l10n>YourPlugin</l10n></h1>
<input type="text" name="[exampleInput]" />
<div class="buttons">
<input type="button" id="[ok]" value="_(OK)" />
<input type="button" id="[cancel]" value="_(Cancel)" />
</div>
Last edited by ray (2007-06-23 11:53:41)
Offline