在IFRAME Yii中动态添加多个CKEDitor

时间:2015-07-22 11:06:12

标签: javascript php jquery iframe yii

我在IFRAME Yii中需要多个CKEditor。

我跟着了 link 它适用于没有IFRAME,但我有一个带有IFrame的弹出对话框 iframe适用于单实例编辑器,但我需要它mulipte

单一实例代码:

   <?php echo $form->textArea($model, 'message', array('id'=>'question_editor','maxlength'=>508)); ?>
    <script src="<?php echo Yii::app()->baseUrl.'/assets/ckeditor/ckeditor.js'; ?>"></script> 
    <script type="text/javascript">
    CKEDITOR.config.toolbar_MA=[ ['Format','Bold','Italic','Underline','-','Superscript','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','NumberedList','BulletedList','-','Outdent','Indent'] ,{ name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] },{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },{name: 'insert',items:['Table','Image']},['Templates']];
    CKEDITOR.replace( 'question_editor', {   toolbar:'MA', height:'140px',width: '95%'  }  );
    </script>   

请有人帮我继续IFRAME中的Multiple CKEditor实例

1 个答案:

答案 0 :(得分:0)

使用Yii代码或HTML创建另一个文本区域,根据命名约定更改名称和ID

<textarea name="question_editor2" id="question_editor2" rows="10" cols="80">
       This is second editor.
  </textarea>

用CKEDITOR替换textarea

<script>
  CKEDITOR.replace( 'question_editor2' );
</script>