Type.registerNamespace(
"CustomToolbarButton");
CustomToolbarButton.InsertDate =
function(element) {
CustomToolbarButton.InsertDate.initializeBase(
this, [element]);
}
CustomToolbarButton.InsertDate.prototype = {
callMethod:
function() {
if (!CustomToolbarButton.InsertDate.callBaseMethod(
this,
"callMethod")) {
return false;
}
var editor =
this.get_designPanel();
var editPanel =
this.get_editPanel();
try {
// For 'Undo'
editor._saveContent();
// What to do - insert date at current selection
//---------------------------------------------------
editor.insertHTML((
new Date()).toLocaleDateString());
//---------------------------------------------------
// Notify Editor about content changed
// and update toolbars linked to the edit panel
setTimeout(
function() {
editor.onContentChanged();
editPanel.updateToolbar();
}, 0);
// Ensure focus in design panel
editor.focusEditor();
return true;
}
catch (e) {}
}
}
CustomToolbarButton.InsertDate.registerClass(
"CustomToolbarButton.InsertDate",
Obout.Ajax.UI.HTMLEditor.ToolbarButton.MethodButton);
Sys.Application.notifyScriptLoaded();