norberttech/aceeditor-bundle
Composer 安装命令:
composer require norberttech/aceeditor-bundle
包简介
Bundle that integrate excellent JavaScript ace editor into Symfony Form.
README 文档
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.
| PHP version(s) | Symfony version(s) | AceEditorBundle version |
|---|---|---|
| >= 8.2 | ^5.4 | ^6.4 | ^7.0 | ^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, 'autocomplete_words' => ['foo', 'bar', 'baz'] ]);
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
Use with Stimulus and Asset Mapper
Stimulus version is supported only with Asset mapper dependency
composer require symfony/stimulus-bundlecomposer require symfony/asset-mapperbin/console importmap:require ace-builds/css/ace.cssbin/console importmap:require ace-builds/src-noconflict/ace.jsbin/console importmap:require ace-builds/src-noconflict/ext-language_tools.js
fell free to add more dependencies for your theme and mode
bin/console importmap:require ace-builds/src-noconflict/theme-monokai.jsbin/console importmap:require ace-builds/src-noconflict/worker-javascript.jsbin/console importmap:require ace-builds/src-noconflict/mode-javascript.js
Autocomplete
$autocomplete = [ 'foo' => [ 'bar' => [ 'baz' => true, 'baz' => ['gaz','haz'], ], ], ]; $builder = new AutocompleteTreeBuilder($autocomplete, "->"); $builder ->add('formula', AceEditorType::class, [ 'autocomplete_builder' => $keywords, ]);
norberttech/aceeditor-bundle 适用场景与选型建议
norberttech/aceeditor-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 316.98k 次下载、GitHub Stars 达 29, 最近一次更新时间为 2019 年 12 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「javascript」 「form」 「bundle」 「code」 「editor」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 norberttech/aceeditor-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 norberttech/aceeditor-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 norberttech/aceeditor-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Generates a Blade directive exporting all of your named Laravel routes. Also provides a nice route() helper function in JavaScript.
Caching and compression for Twig assets (JavaScript and CSS).
A pretty nice way to expose your translation messages to your JavaScript.
The bundle for easy using json-rpc api on your project
Diese Contao 4 Erweiterung stellt Google reCAPTCHA V2 in Form eines neuen Formularfeldes im Formulargenerator bereit. This extension provides Google reCAPTCHA V2 in the form of a new form field in the form generator of Contao Open Source CMS.
PHP client for the Google Closure Compiler API in one file.
统计信息
- 总下载量: 316.98k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 29
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-12-15