Code Monkey home page Code Monkey logo

aceeditor-bundle's Introduction

Ace Editor Bundle

Tests

This bundle provides an Ace editor integration for the Symfony Form component by automatically registering the ace_editor form type.

Compatibility

Check the table below to check if your PHP and symfony versions are supported.

PHP version(s) Symfony version(s) AceEditorBundle version
>= 8.1 ^5.4 | ^6.4 ^5.0

For older unsupported versions check the releases page.

Installation

To use this bundle with the latest Symfony version install it using Composer:

composer require norberttech/aceeditor-bundle ^5.0

If you're using symfony/flex then the bundle will be automatically registered for you, otherwise you need to register the bundle yourself:

// app/config/bundles.php

return [
    // ...
    AceEditorBundle\AceEditorBundle::class => ['all' => true],
    // ...
];

Usage

use AceEditorBundle\Form\Extension\AceEditor\Type\AceEditorType;

/** @var $builder \Symfony\Component\Form\FormBuilderInterface */
$builder->add('description', AceEditorType::class, [
    'wrapper_attr' => [], // 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
]);

The above code will create a textarea element that will be replaced with an ace editor instance. The textarea value is updated on every change done 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

ace_editor:
    base_path: "vendor/ace" # notice! this is starting from your project's public web root, typically: `%kernel.project_dir%/public`!
    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:

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

Ace editor assets

Unless you do some configuration, this bundle expects Ace editor files to be in public/vendor/ace. You can download any ace editor build version from the upstream repository and drop its contents in the corresponding folder.

ACE_VERSION=1.32.3 # replace with whatever ace version you need

cd <YOUR_PROJECT_ROOT>/public
mkdir vendor && cd vendor
wget https://github.com/ajaxorg/ace-builds/archive/v${ACE_VERSION}.tar.gz
tar -xvf v${ACE_VERSION}.tar.gz
mv ace-${ACE_VERSION} ace
rm v${ACE_VERSION}.tar.gz

aceeditor-bundle's People

Contributors

dependabot[bot] avatar norberttech avatar nocive avatar renovate[bot] avatar azzra avatar alexeykupershtokh avatar bitdeli-chef avatar devristo avatar tito10047 avatar verheyenkoen avatar sukovanej avatar romaricdrigon avatar sander-toonen avatar selion05 avatar tacman avatar thvd avatar xanido avatar zhil avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.