定制 bnine/mdeditorbundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bnine/mdeditorbundle

最新稳定版本:v1.1.5

Composer 安装命令:

composer require bnine/mdeditorbundle

包简介

Symfony bundle for entity-based file browser and management.

README 文档

README

A lightweight Symfony bundle to integrate a Markdown editor (EasyMDE) into your forms using a reusable FormType.

The bundle packages the required JS/CSS assets and provides a simple configuration and rendering mechanism.

✨ Features

  • Simple integration of EasyMDE Markdown editor via a custom FormType.
  • Bundled JS/CSS assets, no external CDN dependency required.
  • Ready-to-use form integration and demo controller.
  • Symfony 7 compatible.
  • Assets auto-installed via assets:install.

🚀 Installation

Require the bundle via Composer:

composer require bnine/mdeditorbundle

Then install the assets:

php bin/console assets:install

Make sure Symfony copies the bundle's public assets to public/bundles/bninemdeditor.

🧩 Usage

Include the JavaScript helper in your base layout

In your base Twig layout (e.g. base.html.twig), add:

<script src="{{ asset('bundles/bninemdeditor/bninemdeditor.js') }}"></script>

Use the MarkdownType in a Form

<?php

namespace Bnine\MdEditorBundle\Form;

use Bnine\MdEditorBundle\Dto\Markdown;
use Bnine\MdEditorBundle\Form\Type\MarkdownType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class DtoType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('markdown', MarkdownType::class)
            ->add('submit', SubmitType::class, [
                'label' => 'Prévisualiser',
            ]);
    }

    public function configureOptions(OptionsResolver $resolver): void
    {
        $resolver->setDefaults([
            'data_class' => Markdown::class,
        ]);
    }
}

📦 Requirements

  • PHP ^8.1
  • Symfony ^7.1

📜 License

MIT

👤 Author

Arnaud Fornerot
https://github.com/afornerot

统计信息

  • 总下载量: 98
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-02