apimediaru/nova-tinymce

一个提供 TinyMCE 集成的 Laravel Nova 字段。

安装: 195

依赖: 0

建议: 0

安全: 0

星标: 1

关注者: 1

分支: 0

公开问题: 0

语言:JavaScript

2.0.4 2022-04-11 09:44 UTC

This package is auto-updated.

Last update: 2024-09-11 15:13:57 UTC


README

安装

  1. 安装包
composer require apimediaru/nova-tinymce
  1. 发布资源
php artisan nova-tinymce:publish

发布资源

配置

php artisan vendor:publish --tag=nova-tinymce-config

本地化

php artisan vendor:publish --tag=nova-tinymce-lang

资源

(启用皮肤、语言和插件)

php artisan vendor:publish --tag=nova-tinymce-assets

用法

在 Nova 中使用示例

use APIMedia\TinyMCE\TinyMCE;

/**
 * Get the fields displayed by the resource.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return array
 */
public function fields(Request $request)
{
    return [
        // ...

        TinyMCE::make('Content'), 'content'),
    ];
}

可配置参数

TinyMCE 前端显示高度。传递 int 表示像素高度,但你也可以传递一个带有 CSS 值的 string,例如,20rem

TinyMCE::make('Content'), 'content')
  ->height(150),

为特定字段覆盖默认编辑器设置:editorConfig(array $config): array
可以在这里找到 TinyMCE 的文档。

TinyMCE::make('Content'), 'content')
  ->editorConfig([
    'menubar' => false,
    'plugins' => [
      // Some plugins
    ],
    'toolbar' => 'any custom toolbar items',
    // ...
  ]),