gpt4 book ai didi

javascript - setData 命令不是每次都将我的数据设置为 CKEDITOR

转载 作者:行者123 更新时间:2023-12-03 17:55:28 27 4
gpt4 key购买 nike

<分区>

          CKEDITOR.replace('editor1', {
contentsCss: '../assets/global/plugins/bootstrap/css/bootstrap.min.css',
toolbar:
[
{ name: 'document', groups: ['mode', 'document', 'doctools'], items: ['Source', '-', 'Save', 'NewPage', 'Preview', '-', 'Templates'] },
{ name: 'clipboard', groups: ['clipboard', 'undo'], items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'] },
{ name: 'editing', groups: ['find', 'selection', 'spellchecker'], items: ['Find', 'Replace', '-', 'SelectAll', '-', 'Scayt', 'ImageButton'] },
{ name: 'links', items: ['Link', 'Unlink', 'Anchor'] },
'/',
{ name: 'basicstyles', groups: ['basicstyles', 'cleanup'], items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'] },
{ name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi'], items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language'] },
'/',
{ name: 'styles', items: ['Styles', 'Format', 'Font', 'FontSize'] },
{ name: 'colors', items: ['TextColor', 'BGColor'] },
{ name: 'insert', items: ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe', 'ShowBlocks'] }
]
});



MyAjaxMethod('GetDatabyId', IdParam, function (data) {
var dt = data.d;
if (dt!= null) {


$("#foo").html(dt.asd);
$("#foo2").val(dt.asdf);
$("#foo3").val(dt.asdfg);

CKEDITOR.instances.editor1.setData(dt.Detay);

}
else {
alert('no data');
}
});

它需要获取数据并设置一些formtools,最后设置CKEDITOR,但有时不会将数据设置到CKEDITOR,有时会。我用相同的 ajax 方法和脚本尝试了一个简单的页面,但它不起作用,为什么会这样?我可以看到所有传入的数据,json 没问题。我试图发送到 CKEDITOR 的 html 和 inserthtml 也没有用。我认为它会尝试在替换 CKEDITOR 功能之前进行设置,但我对此无能为力。

编辑:我该如何解决这个问题? (澄清我的具体问题)

Edit2:感谢ojovirtualtorun发现问题,在设置数据之前确保该实例已准备就绪。

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com