I'm working on a plugin to put <blockquote></blockquote> around some selected text. I followed the instructions found on this thread - https://sourceforge.net/forum/forum.php ... _id=257180
Unfortunately, that code didn't work in Gecko. I goggled a little and the result was something like this:
//Begin Code
var FCKblockquote = function(name)
{
this.Name = name;
}
FCKblockquote.prototype.Execute = function()
{
var myText = '';
if (window.getSelection)
{
myText = FCK.EditorWindow.getSelection();
}
else if (document.getSelection)
{
myText = FCK.EditorDocument.getSelection();
}
else if (document.selection)
{
myText = FCK.EditorDocument.selection.createRange().text;
}
else return
FCK.InsertHtml("<blockquote>"+myText+"</blockquote>")
}
// manage the plugins' button behavior
FCKblockquote.prototype.GetState = function()
{
return FCK_TRISTATE_OFF;
}
FCKCommands.RegisterCommand( 'blockquote', new FCKblockquote('blockquote')) ;
// Create the toolbar button. I provided the blockquote.gif here
var oblockquoteItem = new FCKToolbarButton( 'blockquote', "blockquote", null, null, false, true ) ;
oblockquoteItem.IconPath = FCKConfig.PluginsPath + 'blockquote/blockquote.gif' ;
FCKToolbarItems.RegisterItem( 'blockquote', oblockquoteItem ) ;
//EndCode
This worked for me in Gecko browsers and IE. The problem I face now is: how can I remove the blockquote tag I just applied without doing it manually in the source view?
The "Remove Format" button works well with bold and italic tags, but it seems it doesn't like blockquote...
BTW, I found that I didn't have to go through it all: if you add a line with <Style name="Blockquote" element="blockquote" /> in your fckstyles.xml, you will have the blockquote tag available through the styles drop-down combo (but of course a button is a better option for lazy people like me)...
Wed, 06/01/2005 - 06:02
#1