承接 moonshine/tinymce 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

moonshine/tinymce

Composer 安装命令:

composer require moonshine/tinymce

包简介

TinyMce editor for MoonShine

README 文档

README

Extends Textarea and has the same features

windows

Important

Before using this field, you must register on the site at Tiny.Cloud, get the token and add it to the .env

TINYMCE_TOKEN="YOUR_TOKEN"

Compatibility

MoonShine Moonshine TinyMce Currently supported
>= v3.0 >= v1.0.0 yes
>= v4.0 >= v2.0.0 yes

Installation

composer require moonshine/tinymce

Usage

use MoonShine\TinyMce\Fields\TinyMce;


TinyMce::make('Description')

Default config

TinyMce field uses the most common settings such as plugins, menubar and toolbar by default

To change the default settings, you need to publish the configuration file:

php artisan vendor:publish --tag="moonshine-tinymce-config"

You can also add additional options to the configuration file that will apply to all TinyMce fields

'options' => [
    'forced_root_block' => 'div',
    'force_br_newlines' => true,
    'force_p_newlines' => false,
],

Locale

The default is your application's locale, but using the locale() method you can define a specific locale

locale(string $locale)
TinyMce::make('Description')
    ->locale('ru');

English (en), Russian (ru) and Ukrainian (uk) are currently available, but we are always ready to add the others.

To add new localizations, create an issue or make a pull request

Plugins

The plugins() method allows you to completely override the plugins that the field will use

plugins(array $plugins)
TinyMce::make('Description')
    ->plugins(['code', 'image', 'link', 'media', 'table'])

The addPlugins() method allows you to add new plugins to the default plugins

addPlugins(array $plugins)
TinyMce::make('Description')
    ->addPlugins(['wordcount'])

The removePlugins() method allows you to exclude plugins that the field will use

removePlugins(array $plugins)
TinyMce::make('Description')
    ->removePlugins(['autoresize'])

Menubar

The menubar() method allows you to completely override menubar for a field

menubar(string|bool $menubar)
TinyMce::make('Description')
    ->menubar('file edit view')

Toolbar

The toolbar() method allows you to completely override toolbar for a field

toolbar(string|bool|array $toolbar)
TinyMce::make('Description')
    ->toolbar('file edit view')

Options

The addOption() method allows you to add additional options for a field

addOption(string $name, string|int|float|bool|array $value)
TinyMce::make('Description')
    ->addOption('forced_root_block', 'div')

The addCallback() method allows you to add callback options for a field

addCallback(string $name, string $value)
TinyMce::make('Description')
    ->addCallback('setup', '(editor) => console.log(editor)')

Note

You can use string, number, boolean and array as values.

File manager

If you want to use the file manager in TinyMce, you need to install the package Laravel FileManager

Installation

composer require unisharp/laravel-filemanager

php artisan vendor:publish --tag=lfm_config
php artisan vendor:publish --tag=lfm_public

Note

Be sure to set the 'use_package_routes' flag in the lfm config to false, otherwise caching routes will cause an error.

// config/lfm.php

'use_package_routes' => false,

Routes file

Create a routes file like routes/moonshine.php and register the LaravelFilemanager routes.

use Illuminate\Support\Facades\Route;
use UniSharp\LaravelFilemanager\Lfm;

Route::prefix('laravel-filemanager')->group(function () {
    Lfm::routes();
});

File registration

Register the generated routes file in app/Providers/RouteServiceProvider.php

Warning

The route file must be in the middleware moonshine group!

public function boot()
{
    // ...

    $this->routes(function () {
        // ...

        Route::middleware('moonshine')
            ->namespace($this->namespace)
            ->group(base_path('routes/moonshine.php'));
    });
}

Important

In order to allow access only to users authorized in the admin panel you need to add middleware MoonShine\Laravel\Http\Middleware\Authenticate.

use MoonShine\Laravel\Http\Middleware\Authenticate;

// ...

public function boot()
{
    // ...

    $this->routes(function () {
        // ...

        Route::middleware(['moonshine', Authenticate::class])
            ->namespace($this->namespace)
            ->group(base_path('routes/moonshine.php'));
    });
}

Configuration

You need to add an option for the field

TinyMce::make('Description')
    ->addOption('file_manager', 'laravel-filemanager')

or add in the config/moonshine_tinymce.php configuration file to apply to all TinyMCe fields

'options' => [
    'file_manager' => 'laravel-filemanager',
],

moonshine/tinymce 适用场景与选型建议

moonshine/tinymce 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 31.49k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2024 年 10 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「tinymce」 「moonshine」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 moonshine/tinymce 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 moonshine/tinymce 我们能提供哪些服务?
定制开发 / 二次开发

基于 moonshine/tinymce 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 4
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-20