承接 gregsphotography/tinymce-nova 相关项目开发

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

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

gregsphotography/tinymce-nova

Composer 安装命令:

composer require gregsphotography/tinymce-nova

包简介

A Laravel Nova field that integrates TinyMCE editor with your local TinyMCE installation.

README 文档

README

Latest Version on Packagist Total Downloads Tests License

A custom Laravel Nova field that integrates TinyMCE editor with your local TinyMCE installation.

Features

  • Uses local TinyMCE from /public/tinymce/ directory
  • Fully customizable toolbar and plugins
  • Support for images, tables, code, and fullscreen editing
  • No external CDN dependencies
  • Dark mode compatible
  • Paste handling with image support
  • Laravel Package Tools integration
  • Comprehensive test coverage

Installation

You can install the package via Composer:

composer require gregsphotography/tinymce-nova

Publish Configuration

After installation, publish the configuration file:

php artisan vendor:publish --provider="Greg\TinymceNova\TinymceNovaServiceProvider" --tag="config"

This will create config/tinymce-nova.php with all available configuration options.

Configuration

Environment Variables

Add these to your .env file:

# TinyMCE Source (local or cdn)
TINYMCE_SOURCE=local

# For Local Installation
TINYMCE_LOCAL_URL=/tinymce
TINYMCE_SCRIPT_PATH=/js/tinymce/tinymce.min.js
TINYMCE_LICENSE_KEY=gpl

# For CDN Installation
TINYMCE_CDN_URL=https://cdn.tiny.cloud/1
TINYMCE_API_KEY=your-api-key-here
TINYMCE_VERSION=7

Configuration File

The published config/tinymce-nova.php file contains all available options:

return [
    'source' => env('TINYMCE_SOURCE', 'local'),
    
    'local' => [
        'base_url' => env('TINYMCE_LOCAL_URL', '/tinymce'),
        'script_path' => env('TINYMCE_SCRIPT_PATH', '/js/tinymce/tinymce.min.js'),
        'license_key' => env('TINYMCE_LICENSE_KEY', 'gpl'),
    ],
    
    'cdn' => [
        'base_url' => env('TINYMCE_CDN_URL', 'https://cdn.tiny.cloud/1'),
        'api_key' => env('TINYMCE_API_KEY', 'no-api-key'),
        'license_key' => env('TINYMCE_LICENSE_KEY', 'gpl'),
        'version' => env('TINYMCE_VERSION', '7'),
    ],
    
    'defaults' => [
        'height' => 400,
        'toolbar' => 'undo redo | blocks | bold italic...',
        'plugins' => 'lists link image code table',
        // ... more options
    ],
];

Usage

Basic Usage

use Greg\TinymceNova\Tinymce;

Tinymce::make('Content')
    ->rules('required')

With Configuration

Tinymce::make('Content')
    ->rules('required')
    ->alwaysShow()
    ->height(500)
    ->plugins(['lists', 'link', 'image', 'paste', 'code', 'table', 'fullscreen', 'wordcount'])
    ->toolbar('undo redo | blocks | bold italic | link image')

Using CDN

Tinymce::make('Content')
    ->useCdn()
    ->apiKey('your-api-key')
    ->licenseKey('your-license-key')

Using Local Installation

Tinymce::make('Content')
    ->useLocal()
    ->baseUrl('/tinymce')
    ->scriptPath('/js/tinymce/tinymce.min.js')
    ->licenseKey('gpl') // or your commercial license

Available Methods

height(int $height)

Set the editor height in pixels.

Tinymce::make('Content')->height(600)

toolbar(string $toolbar)

Customize the toolbar buttons.

Tinymce::make('Content')->toolbar('undo redo | bold italic | link')

plugins(string|array $plugins)

Set the TinyMCE plugins to use.

Tinymce::make('Content')->plugins(['lists', 'link', 'image', 'code'])

menubar(bool $menubar)

Show or hide the menubar.

Tinymce::make('Content')->menubar(false)

statusbar(bool $statusbar)

Show or hide the status bar.

Tinymce::make('Content')->statusbar(false)

branding(bool $branding)

Show or hide TinyMCE branding.

Tinymce::make('Content')->branding(true)

resize(bool $resize)

Enable or disable editor resizing.

Tinymce::make('Content')->resize(false)

options(array $options)

Pass custom TinyMCE configuration options.

Tinymce::make('Content')->options([
    'content_css' => '/css/custom-editor.css',
    'body_class' => 'my-editor-class'
])

useLocal()

Force the field to use local TinyMCE installation.

Tinymce::make('Content')->useLocal()

useCdn()

Force the field to use TinyMCE from CDN.

Tinymce::make('Content')->useCdn()

licenseKey(string $licenseKey)

Set the TinyMCE license key (GPL or commercial).

Tinymce::make('Content')->licenseKey('your-license-key')

apiKey(string $apiKey)

Set the TinyMCE API key for CDN usage.

Tinymce::make('Content')->apiKey('your-api-key')

baseUrl(string $baseUrl)

Set the base URL for TinyMCE (local or CDN).

Tinymce::make('Content')->baseUrl('/tinymce')

scriptPath(string $scriptPath)

Set the script path for local TinyMCE installation.

Tinymce::make('Content')->scriptPath('/js/tinymce/tinymce.min.js')

version(string $version)

Set the TinyMCE version for CDN usage.

Tinymce::make('Content')->version('7')

Available Plugins

  • lists - Bulleted and numbered lists
  • link - Insert/edit links
  • image - Insert/edit images
  • paste - Paste from Word with formatting
  • code - Edit HTML source code
  • table - Insert/edit tables
  • fullscreen - Fullscreen editing mode
  • wordcount - Word and character count

Default Configuration

[
    'height' => 400,
    'toolbar' => 'undo redo | blocks | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | removeformat | code',
    'plugins' => 'lists link image code table',
    'menubar' => true,
    'statusbar' => true,
    'branding' => false,
    'resize' => true,
]

Example: Article Resource

<?php

declare(strict_types=1);

namespace App\Nova;

use Greg\TinymceNova\Tinymce;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Fields\Slug;
use Laravel\Nova\Fields\Textarea;
use Laravel\Nova\Fields\Image;
use Laravel\Nova\Http\Requests\NovaRequest;

final class Article extends Resource
{
    public function fields(NovaRequest $request)
    {
        return [
            ID::make()->sortable(),

            Text::make('Title')
                ->sortable()
                ->rules('required', 'max:255'),

            Slug::make('Slug')
                ->from('Title')
                ->separator('-')
                ->rules('required', 'max:255')
                ->hideFromIndex(),

            Textarea::make('Excerpt')
                ->alwaysShow()
                ->rules('required', 'max:500'),

            Tinymce::make('Content')
                ->rules('required')
                ->alwaysShow()
                ->height(500)
                ->plugins(['lists', 'link', 'image', 'paste', 'code', 'table', 'fullscreen', 'wordcount']),

            Image::make('Image')
                ->disk('public')
                ->rules('required', 'image', 'mimes:jpeg,png,jpg,gif,webp', 'max:5120'),
        ];
    }
}

TinyMCE Installation

The field expects TinyMCE to be installed at:

/public/tinymce/js/tinymce/tinymce.min.js

Installing TinyMCE

  1. Download TinyMCE from tinymce.com
  2. Extract the files to your public/tinymce/ directory
  3. Ensure the structure is: public/tinymce/js/tinymce/tinymce.min.js

Development

Building Assets

If you make changes to the Vue components or JavaScript:

npm install
npm run production

Testing

composer test

Code Style

The package follows PSR-12 coding standards and uses PHPStan for static analysis.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email security@gbrown.ch instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Tools

This package uses Laravel Package Tools to provide a clean and consistent package development experience.

gregsphotography/tinymce-nova 适用场景与选型建议

gregsphotography/tinymce-nova 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 11 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-03