[英]Summernote - Custom Button on multiple Editor Instances
i have a custom Button in Summernote, it's working as expected.我在 Summernote 中有一个自定义按钮,它按预期工作。 Problem is, that it works on all instantiated Editors at the same time.
问题是,它同时适用于所有实例化的编辑器。
To reconstruct the issue better: I have a button, when i click it, a new Editor is initialized.为了更好地重建问题:我有一个按钮,当我单击它时,会初始化一个新的编辑器。 I'm making 2 Editors.
我正在制作 2 个编辑器。 I click 1 of them and add Text to it via my custom button -> works.
我单击其中 1 个并通过我的自定义按钮向其中添加文本 -> 工作。
I click the second Instance and add Text to it via my custom button: The text gets added to both editors.我单击第二个实例并通过我的自定义按钮向其中添加文本:文本被添加到两个编辑器中。
var HelloButton = function (context) {
var ui = $.summernote.ui;
// create button
var button = ui.button({
contents: '<i class="fa fa-child"/> Hello',
tooltip: 'hello',
click: function () {
context.invoke('editor.insertText', myCat);
});
}
});
return button.render(); // return button as jquery object
}
Any help appreciated, thanks!任何帮助表示赞赏,谢谢!
How are you instantiating your summer note editors ?你是如何实例化你的夏季笔记编辑器的? are you creating them by class id or name html attribute ?
您是按类 id 还是名称 html 属性创建它们? making each input distinct should resolve your issue.
使每个输入不同应该可以解决您的问题。
<div class ="form-group">
<label for="inputA"> Input A </label>
<textarea class="textarea-inputA" id="inputA" name="inputA" />
<span validationfor="inputA">
</div>
<div class ="form-group">
<label for="inputB"> Input B </label>
<textarea class="textarea-inputA" id="inputB" name="inputB" />
<span validationfor="inputB">
</div>
then call summernote() on each selection how you were activating the controls previously.然后在每个选择上调用 summernote() 之前如何激活控件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.