Skip to content

Instantly share code, notes, and snippets.

@deanebarker
Created October 12, 2017 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deanebarker/9ca278b50efb15e0578f19f9d590d482 to your computer and use it in GitHub Desktop.
Save deanebarker/9ca278b50efb15e0578f19f9d590d482 to your computer and use it in GitHub Desktop.
The simplest possible Dojo widget-based editing component for Episerver.
define(
["dojo/_base/declare", "dojo/ready", "dijit/_Widget", "dijit/_TemplatedMixin", "epi/epi"],
function (declare, ready, _Widget, _TemplatedMixin, epi) {
return declare(
[_Widget, _TemplatedMixin],
{
templateString: '<textarea data-dojo-attach-event="onchange:_onChange"></textarea>',
constructor: function () {
ready(this, function () {
this.set('value', this.value);
});
},
_onChange: function (event) {
if (!epi.areEqual(this.get('value'), event.target.value)) {
this.set('value', event.target.value);
this.onChange(this.value);
}
}
}
)
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment