Yes, this would go on the same page as the FCKEditor control, either as an inline script or an external .js file. It will not modify the behavior of the editor on any other page. One consideration my first example doesn't take in to account is if you have multiple editor fields on the same page. For this you would need to map each onclick listener to a different function. So in the FCKeditor_OnComplete function would be:
// Register your command. FCKCommands.RegisterCommand( 'SaveAs', new FCKSaveAs ) ; var oFCKSaveAs = new FCKToolbarButton( "SaveAs",'Save As',null,FCK_TOOLBARITEM_ICONTEXT, true,true,1) ;
I can get the aler command to pop up. Now how can I call a function in my main page where FCKEditor resides? The example you give works if any command gets clicked. How can I check to see if my command got clicked?
RE: Clear out VALUE when a user clicks in the
FCKeditor_OnComplete(fckEditor) {
if (fckEditor.Name == "myTextField_1") {
fckEditor.EditorDocument.addEventListener("onclick", clear_myTextField_1, true);
}
if (fckEditor.Name == "myTextField_2") {
fckEditor.EditorDocument.addEventListener("onclick", clear_myTextField_2, true);
}
}
It's probably a good idea to check the name of the field before setting the event listener anyway, even for just one editor instance on the page.
RE: Clear out VALUE when a user clicks in the
FCKeditor_OnComplete(fckEditor) {
fckEditor.EditorDocument.addEventListener("onclick", clearText, true);
}
clearText(onClickEvent) {
var fckEditor = FCKeditorAPI.GetInstance("myTextField");
//fckEditor.SetHTML removes any current event listeners!
fckEditor.EditorDocument.body.innerHTML = "";
return true;
}
RE: Clear out VALUE when a user clicks in the
RE: Clear out VALUE when a user clicks in the
FCKeditor_OnComplete(fckEditor) {
fckEditor.EditorDocument.addEventListener("onclick", clearText, true);
}
clearText(onClickEvent) {
var fckEditor = FCKeditorAPI.GetInstance("DocumentFolderDescription");
//fckEditor.SetHTML removes any current event listeners!
fckEditor.EditorDocument.body.innerHTML = "";
return true;
}
</script>
I tried putting this in the head of my page with no result. Sorry, don't use javascript much. Is there something I am missing?
RE: Clear out VALUE when a user clicks in the box
I created a "SaveAs" button where I do the following:
var FCKSaveAs = function()
{
}
FCKSaveAs.prototype.Execute = function()
{
//your code here
var name = prompt("Enter file name?", "File name here");
alert('You file name is:');
}
FCKSaveAs.prototype.GetState = function()
{
return FCK_TRISTATE_OFF;
}
// Register your command.
FCKCommands.RegisterCommand( 'SaveAs', new FCKSaveAs ) ;
var oFCKSaveAs = new FCKToolbarButton( "SaveAs",'Save As',null,FCK_TOOLBARITEM_ICONTEXT, true,true,1) ;
oFCKSaveAs.IconPath = FCKConfig.PluginsPath + 'SaveAs/SaveAsFile.gif' ;
FCKToolbarItems.RegisterItem( 'SaveAs', oFCKSaveAs ) ;
I can get the aler command to pop up. Now how can I call a function in my main page where FCKEditor resides?
The example you give works if any command gets clicked. How can I check to see if my command got clicked?
Thanks