nitrado/code-mirror-bundle

此包已被废弃,不再维护。未建议替代包。

此包将CodeMirror编辑器集成到Symfony2项目中。

安装次数: 6,212

依赖项: 0

建议者: 0

安全性: 0

星标: 2

关注者: 3

分支: 18

语言:JavaScript

类型:symfony-bundle

dev-master 2016-02-24 21:24 UTC

This package is not auto-updated.

Last update: 2022-06-11 04:10:29 UTC


README

将CodeMirror编辑器集成到您的symfony2项目中。

###安装

只需将以下行添加到项目的composer.json的require部分,并更新vendor

"nitrado/code-mirror-bundle": "dev-master"

启用包,添加到AppKernel.php

 new Solution\CodeMirrorBundle\SolutionCodeMirrorBundle()

###配置 在config.yml中添加默认参数

twig:
    form:
        resources:
            - 'SolutionCodeMirrorBundle:Form:code_mirror_widget.html.twig'

assetic:
    bundles:
        - # ... other bundles
        - SolutionCodeMirrorBundle

solution_code_mirror:
    parameters:
        mode: text/html
        lineNumbers: true
        lineWrapping: true
        theme: base16-dark
    mode_dirs:
        - @SolutionCodeMirrorBundle/Resources/public/js/mode
    themes_dirs:
        - @SolutionCodeMirrorBundle/Resources/public/css/theme

安装资源

$ ./app/console assets:install web --symlink

###使用

 $builder->add('content', 'code_mirror', array(
    'required' => true,
    'parameters' => array(
         'lineNumbers' => 'true'
     )
 ));