norberttech / aceeditor-bundle
Bundle that integrate excellent JavaScript ace editor into Symfony Form.
Installs: 263 291
Dependents: 0
Suggesters: 0
Security: 0
Stars: 27
Watchers: 5
Forks: 36
Open Issues: 14
Type:symfony-bundle
Requires
- php: ~8.1.0 || ~8.2.0 || ~8.3.0
- symfony/asset: ^5.4|^6.0
- symfony/expression-language: ^5.4|^6.0
- symfony/form: ^5.4|^6.0
- symfony/framework-bundle: ^5.4|^6.0|^7.0
- symfony/twig-bridge: ^5.4|^6.0
- twig/twig: ^2.0|^3.0
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.8
- phpunit/phpunit: ^10.5
- 5.x-dev
- dev-master / 5.0.x-dev
- 5.0.0
- 4.0.x-dev
- 4.0.2
- 4.0.1
- 4.0.0
- 3.0.x-dev
- 3.0.0
- 2.8.x-dev
- 2.8.0
- 0.1.2
- 0.1.1
- 0.1.0
- dev-dependabot/composer/symfony/twig-bridge-7.1.8
- dev-dependabot/composer/twig/twig-3.15.0
- dev-dependabot/composer/twig/twig-3.14.2
- dev-dependabot/composer/symfony/framework-bundle-7.1.6
- dev-dependabot/composer/symfony/twig-bridge-7.1.6
- dev-dependabot/composer/twig/twig-3.11.2
- dev-dependabot/composer/tools/php-cs-fixer/symfony/process-5.4.46
- dev-dependabot/composer/tools/phpstan/phpstan/phpstan-symfony-1.4.11
- dev-dependabot/composer/symfony/asset-7.1.6
- dev-dependabot/composer/phpunit/phpunit-11.4.3
- dev-dependabot/composer/symfony/form-7.1.6
- dev-dependabot/composer/symfony/expression-language-7.1.6
- dev-dependabot/composer/tools/phpstan/phpstan/phpstan-1.12.7
- dev-dependabot/composer/tools/php-cs-fixer/friendsofphp/php-cs-fixer-3.64.0
- dev-remove-renovate
- dev-renovate/phpunit-phpunit-10.x
- dev-renovate/all-minor-patch
- dev-renovate/symfony-framework-bundle-7.x
- dev-renovate/symfony-form-7.x
- dev-renovate/symfony-expression-language-7.x
- dev-renovate/symfony-asset-7.x
- dev-renovate/packagist-symfony/twig-bridge-vulnerability
- dev-renovate/actions-checkout-4.x
- dev-renovate/lock-file-maintenance
- dev-renovate/php
- dev-renovate/configure
This package is auto-updated.
Last update: 2024-11-18 23:58:55 UTC
README
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.
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