Developed with love by KnpLabs Hire us for your project!
41

aceeditor-bundle

by norberttech

Bundle that integrate excellent JavaScript ace editor into Symfony2 Form.

Ace Editor Bundle

Build Status

Bundle provides a Ace editor integration into Symfony Form component.
It automatically register ace_editor form type.

Symfony

This bundle is supporting following Symfony versions:

Composer

To use this bundle with Symfony ^4.0, require it in Composer:

composer require "norberttech/aceeditor-bundle" ^4.0

Register bundle in AppKernel.php

// app/AppKernel.php

public function registerBundles()
{
    return array(
        new Norzechowicz\AceEditorBundle\NorzechowiczAceEditorBundle(),
        // ...
    );
}

Ace editor

Unles you do some configuration, this bundle expect Ace editor files to be in web/vendor/ace:

cd your_project_root/web
mkdir vendor && cd vendor
wget https://github.com/ajaxorg/ace-builds/archive/v1.2.6.tar.gz
tar -xvf v1.2.6.tar.gz
mv ace-builds-1.2.6 ace
rm v1.2.6.tar.gz

Usage

use Norzechowicz\AceEditorBundle\Form\Type\AceEditorType;

/* @var $builder \Symfony\Component\Form\FormBuilderInterface */
$builder->add('description', AceEditorType::class, array(
    'wrapper_attr' => array(), // aceeditor wrapper html attributes.
    'width' => '100%',
    'height' => 250,
    'font_size' => 12,
    'mode' => 'ace/mode/html', // every single default mode must have ace/mode/* prefix
    'theme' => 'ace/theme/monokai', // every single default theme must have ace/theme/* prefix
    'tab_size' => null,
    'read_only' => null,
    'use_soft_tabs' => null,
    'use_wrap_mode' => null,
    'show_print_margin' => null,
    'show_invisibles' => null,
    'highlight_active_line' => null,
    'options_enable_basic_autocompletion' => true,
    'options_enable_live_autocompletion' => true,
    'options_enable_snippets' => false
    'keyboard_handler' => null
));

Above code will create textarea element that will be replaced with ace editor instance.
Textarea value is updated on every single change in ace editor.

Configuration

This section is optional, you dont need to configure anything and the form type will still work perfectly fine

Default configuration:

# app/config/config.yml

norzechowicz_ace_editor:
    base_path: "vendor/ace" # notice! this is starting from "your_project_root/web"!
    autoinclude: true
    debug: false # sources not minified, based on kernel.debug but it can force it
    noconflict: true # uses ace.require instead of require

You can also include Ace editor directly from a location that follow the same directory layout than
https://github.com/ajaxorg/ace-builds, all you need to do is setting base_path option:

norzechowicz_ace_editor:
base_path: "http://rawgithub.com/ajaxorg/ace-builds/master"

norzechowicz_ace_editor:
autoinclude: true
base_path: vendor/ace
debug: false
noconflict: true
  • Update composer.json
    By web-flow, 9 months ago
  • Update README.md
    By web-flow, 9 months ago
  • Update composer.json
    By web-flow, 9 months ago
  • Fixed tests: Use Twig namespaced classes and removed usage deprecated interface (#32)
    By norberttech, 9 months ago
  • Update README.md (#30)
    By norberttech, 1 year ago
  • Fixed form resource path (#29)
    By web-flow, 1 year ago
  • Added php 7.2 to test suite
    By norberttech, 1 year ago
  • Changed Composer constraints for Symfony 4 support (#27)
    By norberttech, 1 year ago
  • Symfony ^4.0 support (#26)
    By norberttech, 1 year ago
  • keyboard_handler option (#23)
    By norberttech, 2 years ago
  • Updated README.md
    By norberttech, 3 years ago
  • Symfony ^3.0 support
    By norberttech, 3 years ago
  • Update README.md
    By web-flow, 3 years ago
  • Removed @author, fixed form type parent, added editor to window namespace (#20)
    By web-flow, 3 years ago
  • Fix deprecated (#19)
    By norberttech, 3 years ago
  • Bundle compatibility Symfony >= 3.0 (#18)
    By norberttech, 3 years ago
  • Merge pull request #12 from AlexeyKupershtokh/show-invisibles
    By norzechowicz, 5 years ago
  • Added show_invisibles option
    By AlexeyKupershtokh, 5 years ago
  • Merge pull request #11 from EDSI-Tech/master
    By norzechowicz, 5 years ago
  • Fixed too strict AllowedTypes
    By romaricdrigon, 5 years ago
  • Add a Bitdeli badge to README
    By bitdeli-chef, 6 years ago
  • Merge pull request #5 from bitdeli-chef/master
    By norberttech, 6 years ago
  • Merge pull request #4 from xanido/dimension-units
    By norberttech, 6 years ago
  • Allow dimension units to be specified (width and height)
    By xanido, 6 years ago
  • Merge pull request #3 from thvd/patch-1
    By norberttech, 6 years ago
  • Cleaned up your code a little bit.
    By thvd, 6 years ago
  • Changed installation instructions
    By Norbert Orzechowicz, 7 years ago
  • Change dependency from sf 2.2 to 2.1
    By Norbert Orzechowicz, 7 years ago
  • Updated composer.json to support symfony 2.3
    By Norbert Orzechowicz, 7 years ago
  • Fixed typo in LICENSE.md
    By norberttech, 7 years ago