-->

添加KEYUP行动iframe的niceEdit的版本(Adding keyup action to

2019-10-17 08:32发布

我使用它的iframe nicEdit format.Everytime用户在编辑器(keyup事件)什么,我需要运行另一个JS / jQuery函数。 如何这个自定义KEYUP操作添加到所需的iframe?

Answer 1:

其实答案就在于js代码。 在nicEdit.js搜索:

var nicEditorIFrameInstance = nicEditorInstance.extend({

这里面,在initFrame功能,寻找this.frameDoc.addEvent 。 这是被添加(通过的addEvent)的事件。 这个包括您KEYUP声明:

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

您需要添加closureListener(this)让这个这样initFrame功能后working.Then创建yourFunction中:

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

这种方法为我工作。 希望它为你做了。 nicEdit是迄今为止最糟糕的记录第三方的东西,我曾经碰到过。



文章来源: Adding keyup action to iframe of version of niceEdit