定制 solilokiam/summernotebundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

solilokiam/summernotebundle

Composer 安装命令:

composer require solilokiam/summernotebundle

包简介

This bundle provides a WYSIWYG editor form type based on summernote

README 文档

README

What is SummernoteBundle?

Summernotebundle integrates SummerNote WYSIWYG Editor into Symfony form type.

Status

Build Status SensioLabsInsight Latest Stable Version Total Downloads Latest Unstable Version License

Requirements

Minimum requirements for this bundle are:

  • Symfony 2.3
  • Twitter's Bootstrap 3.0
  • jQuery 1.9

Installation

Add SummernoteBundle to your application's composer.json file

{
    "require": {
        "solilokiam/summernotebundle": "dev-master"
    }
}

Add SummernoteBundle to your application's AppKernel.php file

new Solilokiam\SummernoteBundle\SolilokiamSummernoteBundle()

Add Routing information to your application's routing.yml:

solilokiam_summernote_bundle:
    resource: "@SolilokiamSummernoteBundle/Resources/config/routing.xml"
    prefix: /summernote

Minimal Configuration

You must determine which object manager are you using. Currently it only supports Doctrine ODM, and doctrine ORM.

app/config/config.yml

solilokiam_summernote:
    db_driver: mongodb #supported orm,mongodb for odm

You must also tell which class is going to inherit the bundle asset class.

solilokiam_summernote:
    asset_class: Acme\DemoBundle\Document\Asset

An example for the asset class can be like this (doctrine odm):

<?php

namespace Acme\DemoBundle\Document;


use Solilokiam\SummernoteBundle\Model\SummernoteAsset;
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;

/**
 * Class Asset
 * @package Acme\DemoBundle\Document
 * @MongoDB\Document(collection="assets")
 */
class Asset extends SummernoteAsset
{
    /**
     * @MongoDB\Id(strategy="auto")
     */
    protected $id;

    ...
}

Additional Configuration

Summernote supports some configuration parameters. This parameters can configured application wide in config.yml.

  • width: This is the width of summernote widget
solilokiam_summernote:
   ...
   width: 500
  • focus: Autofocus the widget.
 solilokiam_summernote:
    ...
    focus: true
  • toolbar: Configure toolbars of the widget.Every line in toolbar config is a different button group. You can check available buttons at summernote documentation
  solilokiam_summernote:
    ...
    toolbar:
        - { name: style, buttons: ['bold', 'italic', 'underline', 'clear'] }
        - { name: paragraph, buttons: ['ul', 'ol', 'paragraph']}

Usage

Summernote bundle provides a formtype. This example form uses it:

class TestFormType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        ...
        $builder->add('test_text', 'summernote');
        ...

    }
    ...

}

You need also to add some twig tags in your templates to import all CSS and JS needed to make summernote work:

...
{% block stylesheets %}
    {{ summernote_form_stylesheet(form) }}
{% endblock %}

{% block javascripts %}
    {{ summernote_form_javascript(form) }}
{% endblock %}

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 2
  • 开发语言: CSS

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-04-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固