Created
October 12, 2017 19:32
-
-
Save deanebarker/9ca278b50efb15e0578f19f9d590d482 to your computer and use it in GitHub Desktop.
The simplest possible Dojo widget-based editing component for Episerver.
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
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