Adding keyup action in iframe version of niceEdit

I am using nicEdit in my iframe format. Every time a user writes something in the editor (keyup event), I need to run another js / jquery function. How to add this custom action for keys to the desired iframe?

+1
source share
1 answer

The answer actually lies in the js code. In nicEdit.js, find:

var nicEditorIFrameInstance = nicEditorInstance.extend({ 

Inside this, in the initFrame function initFrame find this.frameDoc.addEvent . Events are added here (via addEvent). This includes your keyup statement:

 addEvent('keyup',this.YOURFUNCTIONAME.closureListener(this)) 

You need to add closureListener(this) to get this working. Then create YOURFUNCTION after the initFrame function as follows:

 YOURFUNCTIONAME: function() { //Do what you like. Probably call any JS function that lies in the file where //you have included the nicEdit.js }, 

This method worked for me. Hope this is for you too. nicEdit is by far the worst documented third party I've ever come across.

+1
source

Source: https://habr.com/ru/post/1469008/


All Articles