2017 © Pedro Peláez
 

symfony-bundle lcn-wysihtml5-bundle

WYSIWYG form type for Symfony2 using WYSIHTML5 and HTMLPurifier libraries

image

locaine/lcn-wysihtml5-bundle

WYSIWYG form type for Symfony2 using WYSIHTML5 and HTMLPurifier libraries

  • Thursday, August 3, 2017
  • by jfmaeck
  • Repository
  • 2 Watchers
  • 2 Stars
  • 1,321 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 10 Versions
  • 4 % Grown

The README.md

LcnWYSIHTML5Bundle

WYSIWYG-Editor form widget for Symfony2 based on wysihtml forked from WYSIHTML5. MIT License., (*1)

Installation

Step 1: Install dependencies

Install the required LcnIncludeAssetsBundle., (*2)

Step 2: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*3)

$ composer require locaine/lcn-wysihtml5-bundle "~1.0"

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*4)

Step 3: Enable the Bundle

Then, enable the bundle by adding the following line in the app/AppKernel.php file of your project:, (*5)

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Lcn\WYSIHTML5Bundle\LcnWYSIHTML5Bundle(),
        );

        // ...
    }

    // ...
}

Usage

In your Form class, set the field type "lcn_wysihtml5" whenever you want to output the WYSIWYG-Editor., (*6)

$form = $this->createFormBuilder($entity)->add('your_html_field', 'lcn_wysihtml5');

That's it. You're done., (*7)

Configuration

You can customize the default settings by overriding them in your app/config/parameters.yml or app/config/config.yml file., (*8)

Available editor commands

parameters:
    # configure the editor commands
    lcn_wysihtml5.commands:
        - { command: bold }
        - { command: italic }
        - { command: insertUnorderedList }
        - { command: insertOrderedList }
        - { command: formatBlock, value: h1 }
        - { command: formatBlock, value: h2 }

Use custom Stylsheets and Javascripts for advanced customizations

You can configure the included assets to achieve any configuration provided by the wysihtml editor. For more details, consult the documentation., (*9)

parameters:
    # stylesheets get included directly in the web page with the form widget
    lcn_wysihtml5.stylesheets.controls:
        - /bundles/lcnwysihtml5/dist/themes/basic/controls.css

    # stylesheets get included in the editor's sandboxed iframe
    # and should be included when outputting the generated html code.
    # you might want to add some base stylsheets from your own theme
    lcn_wysihtml5.stylesheets.content:
        - /bundles/lcnwysihtml5/dist/themes/basic/content.css

    lcn_wysihtml5.parser_rules: /bundles/lcnwysihtml5/dist/themes/basic/parser_rules.js

Customize HTMLPurifier Options for Server Side Sanitization

parameters:
    lcn_wysihtml5.purifier_config:
        'Attr.AllowedClasses':
            - wysiwyg-color-primary
            - wysiwyg-color-secondary
            - wysiwyg-float-left
            - wysiwyg-float-right
            - wysiwyg-clear-left
            - wysiwyg-clear-right

Customize existing colors

The editor uses class names to apply pre-defined colors:, (*10)

You need to adjust the colors in the css file (set your own theme):, (*11)

parameters:
    lcn_wysihtml5.stylesheets.content:
        - /bundles/lcnwysihtml5/dist/themes/basic/content.css

This stylesheet gets automatically included in the editor. However, you have to manually include this stylesheet in your page where you output the html code:, (*12)

<link rel="stylesheet" href="/bundles/lcnwysihtml5/dist/themes/basic/content.css">

Add or remove colors

Configure the available colors in the editor toolbar:, (*13)

parameters:
    # configure the editor commands
    lcn_wysihtml5.commands:
        ...
        - { command: foreColor, values: [primary, secondary] }

Configure the allowed color class names for Frontend validation in your own custom parser_rules set:, (*14)

parameters:
    lcn_wysihtml5.parser_rules: /bundles/lcnwysihtml5/dist/themes/basic/parser_rules.js

Configure the allowed color class names for Server-Side validation using HTMLPurifier:, (*15)

parameters:
    lcn_wysihtml5.purifier_config:
        'Attr.AllowedClasses':
            - wysiwyg-color-primary
            - wysiwyg-color-secondary
            ...

The Versions

03/08 2017

dev-master

9999999-dev

WYSIWYG form type for Symfony2 using WYSIHTML5 and HTMLPurifier libraries

  Sources   Download

MIT

The Requires

 

by Jonas Fischer-Maeck

twig wysiwyg symfony 2 form type

03/08 2017

1.2.0

1.2.0.0

WYSIWYG form type for Symfony2 using WYSIHTML5 and HTMLPurifier libraries

  Sources   Download

MIT

The Requires

 

by Jonas Fischer-Maeck

twig wysiwyg symfony 2 form type

01/06 2015

1.1.1

1.1.1.0

WYSIWYG form type for Symfony2 using WYSIHTML5 and HTMLPurifier libraries

  Sources   Download

MIT

The Requires

 

by Jonas Fischer-Maeck

twig wysiwyg symfony 2 form type

01/06 2015

1.1.0

1.1.0.0

WYSIWYG form type for Symfony2 using WYSIHTML5 and HTMLPurifier libraries

  Sources   Download

MIT

The Requires

 

by Jonas Fischer-Maeck

twig wysiwyg symfony 2 form type

19/05 2015

1.0.8

1.0.8.0

WYSIWYG form type for Symfony2 using WYSIHTML5 and HTMLPurifier libraries

  Sources   Download

MIT

The Requires

 

by Jonas Fischer-Maeck

twig wysiwyg symfony 2 form type

28/04 2015

1.0.7

1.0.7.0

WYSIWYG form type for Symfony2 using WYSIHTML5 and HTMLPurifier libraries

  Sources   Download

MIT

The Requires

 

by Jonas Fischer-Maeck

twig wysiwyg symfony 2 form type

25/02 2015

1.0.5

1.0.5.0

WYSIWYG form type for Symfony2 using WYSIHTML5 and HTMLPurifier libraries

  Sources   Download

MIT

The Requires

 

by Jonas Fischer-Maeck

twig wysiwyg symfony 2 form type

25/02 2015

1.0.4

1.0.4.0

WYSIWYG form type for Symfony2 using WYSIHTML5 and HTMLPurifier libraries

  Sources   Download

MIT

The Requires

 

by Jonas Fischer-Maeck

twig wysiwyg symfony 2 form type

18/02 2015

1.0.3

1.0.3.0

WYSIWYG form type for Symfony2 using WYSIHTML5 and HTMLPurifier libraries

  Sources   Download

MIT

The Requires

 

by Jonas Fischer-Maeck

twig wysiwyg symfony 2 form type

18/02 2015

1.0.1

1.0.1.0

WYSIWYG form type for Symfony2 using WYSIHTML5 and HTMLPurifier libraries

  Sources   Download

MIT

by Jonas Fischer-Maeck

twig wysiwyg symfony 2 form type