fiaw 2011-08-01 10:53:12 4880次浏览 2条回复 0 0 0

是最新版的 ckeditor3.6.1 不是fckeditor 我整了半天 只整合了 fckeditor2.6.6的 fckeditor2.6.6对ie9兼容不好?不好使[attach]283[/attach]

  • 回复于 2017-01-04 17:40 举报

    yii2 CKEDITOR上传图片怎么上传

  • 回复于 2017-01-04 17:47 举报

    asset/CkeditorAsset
    <?php
    namespace common\assets;

    use yii\web\AssetBundle;
    /*

    • To change this license header, choose License Headers in Project Properties.
    • To change this template file, choose Tools | Templates
    • and open the template in the editor.
      */
      class CkeditorAsset extends AssetBundle
      {
      public $sourcePath = '@vendor/almasaeed2010/adminlte/plugins/ckeditor';

      public $js = [

       'ckeditor.js',
      

      ];

      public $css = [
      ];

      public $depends = [

       '\dmstr\web\AdminLteAsset'
      

      ];
      }

    视图中引用js
    <?php

    use yii\helpers\Html;
    use yii\widgets\ActiveForm;
    use dosamigos\datepicker\DatePicker;

    common\assets\CkeditorAsset::register($this);
    $this->registerJsFile('/js/news.js',['depends'=>'common\assets\DatePickerAsset']);
    $this->registerJsFile('/js/news-editor.js',['depends'=>'common\assets\DatePickerAsset']);
    / @var $this yii\web\View /
    / @var $model backend\models\News /
    / @var $form yii\widgets\ActiveForm /
    ?>

    <?php $form = ActiveForm::begin(); ?> <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'keywords')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'typeId')->dropDownList(\yii\helpers\ArrayHelper::map($configModel['NewsType'],'id','name')); ?> <?= $form->field($model, 'seen')->textInput(['value' => '0']) ?> <?= $form->field($model, 'createTime')->textInput(['id' => 'datepicker'])?> <?= $form->field($model, 'isHot')->textInput(['value' => '0']) ?> <?= $form->field($model, 'isTop')->textInput(['value' => '0']) ?> <?= $form->field($model, 'sort')->textInput(['value' => '0']) ?> <?= $form->field($model, 'status')->textInput(['value' => '0']) ?> <?= $form->field($model, 'content')->textarea(['id' => 'editor1']) ?> <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> <?php ActiveForm::end(); ?>

    web/js
    $(function () {

    // Replace the <textarea id="editor1"> with a CKEditor
    // instance, using default configuration.
    CKEDITOR.replace('editor1');
    

    });

您需要登录后才可以回复。登录 | 立即注册