承接 leandrogehlen/yii2-codemirror 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

leandrogehlen/yii2-codemirror

最新稳定版本:1.2.1

Composer 安装命令:

composer require leandrogehlen/yii2-codemirror

包简介

CodeMirror extension for Yii2

README 文档

README

CodeMirror extension for Yii2

Yii2

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist leandrogehlen/yii2-codemirror "*"

or add

"leandrogehlen/yii2-codemirror": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

<?php 

use leandrogehlen\codemirror\CodeMirror;

<?= $form->field($file, 'description')->widget(CodeMirror::className(), [
    'pluginOptions' => [
        'mode' => 'application/x-httpd-php', 
        'theme' => 'solarized dark',
        ...
    ]
]);

?>

By default, only core javascript and css files are registered:

  • lib/codemirror.js
  • lib/codemirror.css

If it is necessary adds other resource files, then should be used the Dependency Injection concept.

Example:

I want to use php mode in the codemirror editor

  
  //config/web.php
  
  $config = [
      'id' => 'my-app',
      'components' => [
        ...
      ]
      ...
  ]
  
  Yii::$container->set('leandrogehlen\codemirror\CodeMirrorAsset',[
      'js' => [
          'mode/htmlmixed/htmlmixed.js',
          'mode/xml/xml.js',
          'mode/javascript/javascript.js',
          'mode/clike/clike.js',
          'mode/php/php.js',
      ]
  ]);
  
  
  return $config;
  

统计信息

  • 总下载量: 4.44k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0
  • 更新时间: 2015-09-08