[英]Redactor: Accessing a callback within plugin
I'm building a plugin for Redactor 10 and I want to access the syncBeforeCallback callback from within my plugin. 我正在为Redactor 10构建一个插件,并且想从我的插件中访问syncBeforeCallback回调。
I can access it whilst initialising redactor which is shown in the docs page linked above but I don't know how I can access it from within my plugin. 我可以在初始化编辑器的同时访问它,如上面链接的docs页面中所示,但是我不知道如何从插件中访问它。 I want my plugin to do something on that callback. 我希望我的插件在该回调上执行某些操作。
Please help. 请帮忙。 Thank you. 谢谢。
I had a response from Redactor support on this: 我收到了Redactor支持的回复:
Here's how you could access this callback from your plugin: 您可以通过以下方式从插件访问此回调:
This one is for Redactor itself: 这是针对Redactor本身的:
$('#redactor').redactor({
syncBeforeCallback: function(html)
{
return this.myplugin.get(html);
}
});
and here's the plugin accessing syncBeforeCallback data: 这是访问syncBeforeCallback数据的插件:
if (!RedactorPlugins) var RedactorPlugins = {};
RedactorPlugins.myplugin = function() {
return {
get: function(html)
{
// do somethings ...
return html;
}
}
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.