将keyup操作添加到niceEdit版本的iframe

将keyup操作添加到niceEdit版本的iframe,iframe,nicedit,keyup,Iframe,Nicedit,Keyup,我使用的是iframe格式的nicEdit。每次用户在编辑器中写入任何内容(keyup事件),我都需要运行另一个js/jquery函数。如何将此自定义键控操作添加到所需的iframe?答案实际上在于js代码。在nicEdit.js中搜索: var nicEditorIFrameInstance = nicEditorInstance.extend({ 在此内部,在initFrame函数中, 查找this.frameDoc.addEvent。 这是添加事件的地方(通过addEvent)。这包括您

我使用的是iframe格式的nicEdit。每次用户在编辑器中写入任何内容(keyup事件),我都需要运行另一个js/jquery函数。如何将此自定义键控操作添加到所需的iframe?

答案实际上在于js代码。在nicEdit.js中搜索:

var nicEditorIFrameInstance = nicEditorInstance.extend({
在此内部,在
initFrame
函数中, 查找
this.frameDoc.addEvent
。 这是添加事件的地方(通过addEvent)。这包括您的keyup声明:

addEvent('keyup',this.YOURFUNCTIONAME.closureListener(this))
您需要添加
closureListener(this)
以使其正常工作。然后在initFrame函数之后创建您的函数,如下所示:

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

这种方法对我有效。希望对你也一样。nicEdit是迄今为止我遇到的最糟糕的第三方文档。

答案实际上在于js代码。在nicEdit.js中搜索:

var nicEditorIFrameInstance = nicEditorInstance.extend({
在此内部,在
initFrame
函数中, 查找
this.frameDoc.addEvent
。 这是添加事件的地方(通过addEvent)。这包括您的keyup声明:

addEvent('keyup',this.YOURFUNCTIONAME.closureListener(this))
您需要添加
closureListener(this)
以使其正常工作。然后在initFrame函数之后创建您的函数,如下所示:

YOURFUNCTIONAME: function() {
//Do what you like. Probably call any JS function that lies in the file where 
//you have included the nicEdit.js
},
这种方法对我有效。希望对你也一样。nicEdit是迄今为止我遇到的最糟糕的第三方文档