Hello.
I need a plugin that allow users to select some piece of text and transform it to upercase.
I have read the placeholder plugin and the wiki to figure how to make a plugin but I don't know how to do it.
Could you please tell me some clues to build an "upcase" plugin?
This is my plugin's skeleton:
// Based on TableToggleBorders from Brent Kelly - Zeald.com
var FCKUpcase = function(name) {
}
// how can I avoid a call to this function when the plugin is loaded?
FCKUpcase.prototype.GetState = function() {
ret = this.mode ? FCK_TRISTATE_ON : FCK_TRISTATE_OFF;
return ret;
}
FCKCommands.RegisterCommand('Upcase', new FCKUpcase('Upcase')) ;
// Create the toolbar button.
var oUpcaseItem = new FCKToolbarButton( 'Upcase' );
oUpcaseItem.IconPath = FCKConfig.PluginsPath + 'Upcase/upcase.gif' ;
FCKToolbarItems.RegisterItem( 'Upcase', oUpcaseItem ) ;
FCKUpcase.prototype.Execute = function() {
alert('executed');
}
I need a plugin that allow users to select some piece of text and transform it to upercase.
I have read the placeholder plugin and the wiki to figure how to make a plugin but I don't know how to do it.
Could you please tell me some clues to build an "upcase" plugin?
This is my plugin's skeleton:
// Based on TableToggleBorders from Brent Kelly - Zeald.com
var FCKUpcase = function(name) {
}
// how can I avoid a call to this function when the plugin is loaded?
FCKUpcase.prototype.GetState = function() {
ret = this.mode ? FCK_TRISTATE_ON : FCK_TRISTATE_OFF;
return ret;
}
FCKCommands.RegisterCommand('Upcase', new FCKUpcase('Upcase')) ;
// Create the toolbar button.
var oUpcaseItem = new FCKToolbarButton( 'Upcase' );
oUpcaseItem.IconPath = FCKConfig.PluginsPath + 'Upcase/upcase.gif' ;
FCKToolbarItems.RegisterItem( 'Upcase', oUpcaseItem ) ;
FCKUpcase.prototype.Execute = function() {
alert('executed');
}
RE: Transform a selected text to upcase
Thanks in advance.
RE: Transform a selected text to upcase
var FCKSentenceCase = function(name){
this.Name = name;
}
FCKSentenceCase.prototype.Execute = function(){
var selText;
var textRange;
if(document.all){//ie
textRange= FCK.EditorDocument.selection.createRange();
selText = textRange.text;
}else{ //gecko
selText = FCK.EditorWindow.getSelection().toString();
}
//// selText now holds the text you want!
var str=selText.toUpperCase();
FCK.InsertHtml(str);
if (textRange) textRange.select();
}
// manage the plugins' button behavior
FCKSentenceCase.prototype.GetState = function()
{
return FCK_TRISTATE_OFF;
}
FCKCommands.RegisterCommand( 'SentenceCase', new FCKSentenceCase('SentenceCase')) ;
// Create the toolbar button.
var oSentenceCaseItem = new FCKToolbarButton( 'SentenceCase', "SentenceCase", null, null, false, true ) ;
oSentenceCaseItem.IconPath = FCKConfig.PluginsPath + 'SentenceCase/sentencecase.gif' ;
FCKToolbarItems.RegisterItem( 'SentenceCase', oSentenceCaseItem ) ;
//End Code
RE: Transform a selected text to upcase