-
-
Save mikebranski/60902 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From the command authoring tutorial | |
CmdUtils.CreateCommand({ | |
name: "date", | |
homepage: "http://www.leftrightdesigns.com/", | |
author: {name: "Mike Branski", email: "[email protected]"}, | |
description: "Inserts today's date.", | |
help: "If you're in an editable text area, inserts today's date, formatted for the current locale.", | |
_date: function() { | |
var date = new Date(); | |
return date.toLocaleDateString(); | |
}, | |
preview: function( pblock ) { | |
var msg = 'Insert todays date: "<i>${date}</i>"'; | |
pblock.innerHTML = CmdUtils.renderTemplate( msg, {date: this._date()} ); | |
}, | |
execute: function() { | |
CmdUtils.setSelection( this._date() ); | |
} | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment