norzechowicz / aceeditor-bundle
5.0.0
2024-01-02 17:57 UTC
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/framework-bundle-7.1.5
- dev-dependabot/composer/symfony/twig-bridge-7.1.5
- dev-dependabot/composer/symfony/form-7.1.5
- dev-dependabot/composer/phpunit/phpunit-11.3.6
- dev-dependabot/composer/tools/phpstan/phpstan/phpstan-1.12.4
- dev-dependabot/composer/phpunit/phpunit-11.3.5
- dev-dependabot/composer/tools/phpstan/phpstan/phpstan-1.12.3
- dev-dependabot/composer/tools/phpstan/phpstan/phpstan-symfony-1.4.9
- dev-dependabot/composer/twig/twig-3.14.0
- dev-dependabot/composer/symfony/expression-language-7.1.4
- dev-dependabot/composer/symfony/twig-bridge-7.1.4
- dev-dependabot/composer/twig/twig-3.12.0
- dev-dependabot/composer/symfony/framework-bundle-7.1.4
- dev-dependabot/composer/symfony/form-7.1.4
- dev-dependabot/composer/tools/php-cs-fixer/friendsofphp/php-cs-fixer-3.64.0
- dev-dependabot/composer/symfony/asset-7.1.1
- 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-09-23 23:16:34 UTC
README
此包通过自动注册 ace_editor
表单类型,为Symfony表单组件提供了 Ace编辑器 的集成。
兼容性
请查看下表以检查您的PHP和symfony版本是否受支持。
对于旧版本的不受支持的版本,请查看 版本发布 页面。
安装
要使用此包与最新版本的Symfony一起使用,请使用 Composer 安装。
composer require norberttech/aceeditor-bundle ^5.0
如果您正在使用 symfony/flex,则包将自动为您注册,否则您需要自行注册包。
// app/config/bundles.php return [ // ... AceEditorBundle\AceEditorBundle::class => ['all' => true], // ... ];
使用
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 ]);
上述代码将创建一个文本区域元素,该元素将被Ace编辑器实例替换。在Ace编辑器中进行的每次更改都会更新文本区域值。
配置
本节是可选的,您无需配置任何内容,表单类型仍然可以完美工作。
默认配置
# 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
您还可以直接从与 https://github.com/ajaxorg/ace-builds
相同目录结构的地址包含Ace编辑器,您只需设置 base_path
选项即可。
ace_editor:
base_path: "http://rawgithub.com/ajaxorg/ace-builds/master"
Ace编辑器资源
除非您进行一些配置,否则此包期望Ace编辑器文件位于 public/vendor/ace
。您可以从中下载任何Ace编辑器构建版本 上游存储库 并将其内容放入相应的文件夹。
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