freshinteractive/fresh-tap

Laravel Nova 字段。

0.0.4 2023-11-09 21:37 UTC

This package is auto-updated.

Last update: 2024-09-10 00:26:02 UTC


README

Fresh Tap 定制的 Laravel Nova 字段。

Fresh Tap 是一个框架无关的、基于 TiptapVue自定义元素 WYSIWYG 编辑器。

安装

composer require freshinteractive/fresh-tap

使用

<?php

namespace App\Nova;

...
use Freshinteractive\FreshTap\FreshTap;
...

class YourResource extends Resource
{
    ...
    
    /**
     * Get the fields displayed by the resource.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function fields(Request $request)
    {
        ...,
        FreshTap::make('Content')
                ->previewUrl('https://your-preview-url-here.com/page-content-will-live-on')
                ->previewSelector('.css-selector')
                ->previewWrapperElement([
                    'element' => 'div',
                    'attributes' => [
                        'class' => 'your-wrapper-class'
                    ]
                ])
                ->keepEmptyParagraphLineBreaks(),
                ->editorStyles("
                    .FreshTapEditor .ProseMirror { display: grid; grid-template-columns: 100%; gap: 20px; }
                ")
    }
}

注意

不需要任何方法。只需 `FreshTap::make('Content')` 即可。

当使用 `->editorStyles()时,请确保您的样式以.FreshTapEditor .ProseMirror` 开头。这些样式仅应用于实现编辑器的实例。