CKEditor 中的只读部分

Read only part in CKEditor

我正在使用 CKEditor 显示一些文本
我有一个要求,以防止在文本的某些部分进行编辑 将由 JQuery 插入
我做了什么 我用 class 插入了输入,所以我可以改变它的值

 config.extraAllowedContent = 'input(*)';

<textarea name="editor1" id="editor1" rows="10" cols="80">
       Some Text <input type="text" id="txttest" class="form-control" style="border:none" />        
    </textarea> 

<script>  
var ed1;
ed1 = CKEDITOR.replace('editor1');ed1.on('loaded', function () {            
            $('.form-control')[0].val('Doctor'); });
</script>

这里的问题我找不到输入 $('.form-control') allows return 0 lenght


第二次尝试

var ed1;


$(document).ready(function () {

    var data = ' Some Text < input type = "text" id = "txttest" class="form-control" style = "border:none" value = "Doctor" />';
    ed1 = CKEDITOR.replace('editor1');

    CKEDITOR.instances['editor1'].setData(data)

这里的问题是 CKEditor 将输入呈现为纯文本而不是 html

任何帮助请

谢谢大家 这是我的问题的答案,任何人都会面临同样的问题 多亏了 Post
How to find and replace text in CKEditor using Javascript?

代码

<textarea name="editor1" id="editor1" rows="10" cols="80">
        Some Text.
<input type="text" id="txttest" class="form-control" style="border:none" value="yyy" />
            </textarea>
<script>  
var ed1;
ed1 = CKEDITOR.replace('editor1');

$(document).ready(function () {


    var editor = CKEDITOR.instances['editor1'];
    var edata = editor.getData();

    var replaced_text = edata.replace("yyy", "iwant this instead"); // you could also use a regex in the replace 

    editor.setData(replaced_text);

});