简体   繁体   中英

How do I capture events from dijit/Editor?

I set up a field for dijit/Editor and I'd like to capture events that occur on this field:

<label for="eed-event-description" class="required">Event Description</label><br />
<div id="eed-event-description" data-dojo-type="dijit/Editor" height="120px" title="required: brief description of what someone attending can expect at the event" required>
<p></p>
</div>

As suggested by Boo Berr'ita ( here ), I'm able to get the contents with:

var myEditor = registry.byId("eed-event-description");
var htmlValue = myEditor.get("value");

Now, I want to capture the onpaste event. I tried setting up on(), but I don't know how to reference the field. For example:

on(dom.byId("eed-event-description"), "paste", function () {
}

does not trigger.

I've looked in detail at the on() and registry() documentation, plus the widget events reference, but I don't see any way to capture the paste event.

Suggestions appreciated.

look at the below link for the available events for dijit/editor

https://dojotoolkit.org/api/?qs=1.10/dijit/Editor

paste event that you referring is not available by default. But you can use some the extra plug-in for that. Refer to the below link

https://dojotoolkit.org/api/?qs=1.10/dojox/editor/plugins/SafePaste

you can get more information on SafePaste @

https://dojotoolkit.org/reference-guide/1.10/dojox/editor/plugins/SafePaste.html

to capture the paste event. you can just use something like :

on(target, type, function (event) {    
    // your code    
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM