codicastudio/unlayer-editor

一个随机的Codica Studio软件包。

1.0.0 2020-09-25 01:54 UTC

This package is auto-updated.

Last update: 2024-09-25 13:31:59 UTC


README

为Unlayer添加Laravel Nova字段,用于编写邮件和落地页。

安装

您可以通过composer将此软件包安装到使用Nova的Laravel应用中

composer require idf/nova-unlayer-field

使用方法

此软件包假定您的模型有一个属性用于存储设计配置(最好使用jsonlongtext SQL类型来存储它)。

在提交时,该软件包发送两个字段

  • 设计(字符串化的json对象)
  • HTML代码。如果您想将HTML存储到模型中,请使用savingCallback()
public function fields()
{
    return [ 
        Unlayer::make('Content', 'design')->config([
            'projectId' => config('unlayer.project_id'),
            'templateId' => config('unlayer.newsletter_template_id'), // Optional, used only if bound attribute is empty (e.g. $newsletter->design)
            'displayMode' => 'email', // Optional, "email" by default
            'locale' => app()->getLocale(), // Optional
        ]),
     ];
}

选项

  • ->config(array|callable $config):指定Unlayer配置
  • ->savingCallback(?callable $callback):指定在保存模型时的回调。用于存储HTML结果代码。
  • ->height(string $height):设置编辑器的高度(带有单位)。例如,'1000px'(默认为800px)。

更新日志

请参阅发布以获取有关最近更改的更多信息。

贡献

有关详细信息,请参阅CONTRIBUTING

编译资源

# Compile and minify your assets:
npm run prod

# Compile your assets for local development:
npm run dev

# Run the NPM "watch" command to auto-compile your assets when they are changed:
npm run watch