3

我在我的一个项目中使用EpicEditor。因此,根据文档,我已将textarea属性添加到我的 textarea id,因此当页面第一次加载时,来自 textarea 的所有内容都显示在 EpicEditor 中。效果很好!!!

问题:


我从服务器获取该特定记录的实时更新,然后我相应地更新表单字段值。所以我无法在 EpicEditor 中设置新值。我已经更新了参考 textarea 值,但它不会同步到 EpicEditor。

解决方案


每当参考文本区域发生一些更新时,我想在 EpicEditor 中设置新值。

4

2 回答 2

4
var self = this;
var opts = {
    container: 'epiceditor',
    textarea: 'myTextArea',
    basePath: 'epiceditor',
...
}
var editor = new EpicEditor(opts);
self.editor.load();
// Now, import some content into the editor
// Since I don't know the filename I'm using `null` which will default to the current filename 
editor.importFile(null, 'This is to be displayed in the epic editor');

应该会自动更新文本区域。如果它没有更新文本区域,那是一个错误,请发送带有您的代码和可重现案例的票:https ://github.com/OscarGodson/EpicEditor/issues/new

于 2013-08-14T20:57:04.137 回答
-1

你可以这样做:

在您使用您的选项 () 创建史诗编辑器的实例opt并加载它之后。将要放置在史诗编辑器中的文本作为 textarea 值像这样 -$("#myTextArea").val('your value'))并调用me.editor._setupTextareaSync();

var me = this;
var opts = {
    container: 'epiceditor',
    textarea: 'myTextArea',
    basePath: 'epiceditor',
    -------
    -------
}
var editor = new EpicEditor(opts);
me.editor.load();
$("#myTextArea").val('This is to be displayed in the epic editor');
me.editor._setupTextareaSync();

干杯!

于 2013-08-14T13:47:21.117 回答