helios-ag/fm-summernote-bundle

Summernote 扩展包,为您的 Symfony2/3/4 项目添加 WYSIWYG 编辑器

0.2 2016-04-16 05:47 UTC

This package is auto-updated.

Last update: 2024-08-27 19:57:28 UTC


README

FMSummernoteBundle 添加了 summernote 扩展包

安装

步骤 1: 安装

使用 Composer,只需将以下配置添加到您的 composer.json

或者您可以使用 Composer 安装此扩展包:在您的 composer.json 中添加 FMSummernoteBundle

composer require helios-ag/fm-summernote-bundle

步骤 2: 启用扩展包

最后,在内核中启用扩展包

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new FM\SummernoteBundle\FMSummernoteBundle(),
    );
}

配置

您可以根据以下方式配置扩展包,但请注意,“elfinder”和“video”插件在 Jquery2.x 中不受支持。

fm_summernote:
    plugins:
        - video
        - elfinder # by default plugins not set, bundle comes with elfinder plugin / provides integration with FMElfinderBundle
    selector: .summernote #defines summernote selector for apply to
    toolbar: # define toolbars, if no toolbar configured, default toolbars defined
        style: [style]
        bold: [bold]
    extra_toolbar: # extra toolbar can be used for plugins toolbar and as additional toolbar setings, when 'toolbar' option is omitted
        elfinder: [elfinder]
    width: 600
    height: 400
    language: '' # define language (with language culture code like de-DE, fr-FR, etc.) by default, it is in english
    include_jquery: true #include js libraries, if your template already have them, set to false
    include_bootstrap: true
    include_fontawesome: true

用法

Twig 模板示例

    {{ summernote_init() }}
    <textarea class="summernote"></textarea>