Coder Social home page Coder Social logo

interactiondesignfoundation / nova-unlayer-field Goto Github PK

View Code? Open in Web Editor NEW
32.0 12.0 8.0 3.35 MB

🦜 Drag’n’drop email builder for Laravel Nova that uses Adds a Laravel Nova field for Unlayer service under the hood.

License: MIT License

Vue 37.37% JavaScript 30.56% PHP 32.08%
unlayer laravel-nova-field laravel nova hacktoberfest laravel-nova

nova-unlayer-field's People

Contributors

alies-dev avatar dependabot[bot] avatar hasan-wajahat avatar lptn avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nova-unlayer-field's Issues

Please make the "Enter fullscreen", "Exit fullscreen" text translatable

It should be as simple as using the __ translation helper that is available on the Vue instance, i.e. change these lines:

data: () => ({
fullscreenButtonText: {
on: '▶ Enter fullscreen',
off: '✖︎ Exit fullscreen',
},
}),

to this:

on: '▶ ' + __('Enter fullscreen'),
off: '✖︎ ' + __('Exit fullscreen'),

Or maybe it's this.__('Enter fullscreen'), I'm not 100% sure.

Anyway, like this, a developer can define a translation in a translation file and if none is defined it will still display the English text.

A more elaborate alternative (might be overkill) is to make the text completely customizable, something that could be used like this when instantiating the field:

Unlayer::make('something')->withButtonLabels([
    'enterFullscreen' => 'foo',
    'exitFullscreen' => 'bar'
])

Upload Image

Hello,

how we can manager uploap image?
The docs from unlayer says that we need to add a callbacks like the this:

unlayer.registerCallback('image', function(file, done) {
  var data = new FormData()
  data.append('file', file.attachments[0])

  fetch('/uploads', {
    method: 'POST',
    headers: {
      'Accept': 'application/json'
    },
    body: data
  }).then(response => {
    // Make sure the response was valid
    if (response.status >= 200 && response.status < 300) {
      return response
    } else {
      var error = new Error(response.statusText)
      error.response = response
      throw error
    }
  }).then(response => {
    return response.json()
  }).then(data => {
    // Pass the URL back to Unlayer to mark this upload as completed
    done({ progress: 100, url: data.filelink })
  })
})

How can we add this feature?

Many thanks

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • Lock file maintenance

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

composer
composer.json
  • php ^8.1
  • laravel/nova ^4.20
  • interaction-design-foundation/coding-standard ^0.2.0
  • orchestra/testbench ^9.0
  • phpunit/phpunit ^10.5 || ^11.0
  • vimeo/psalm ^5.22
github-actions
.github/workflows/psalm.yml
  • actions/checkout v4
  • shivammathur/setup-php v2
  • actions/cache v4
.github/workflows/run-tests.yml
  • actions/checkout v4
  • shivammathur/setup-php v2
  • actions/setup-node v4
  • actions/cache v4
npm
package.json
  • @vue/compiler-sfc ^3.2.33
  • form-backend-validation ^2.3.8
  • laravel-mix ^6.0.43
  • lodash ^4.17.21
  • postcss ^8.4.14
  • vue-loader ^16.8.3
  • node >=16.0

  • Check this box to trigger a request for Renovate to run again on this repository

Question: how to edit stored design/html?

Hi,

I'm using the latest version of your package. Creation page works, I can save it to database, no problem.

Issue is, when I face to editing page, empty page appears, not my previous design.

  Unlayer::make('Content', 'content')
      ->config([
          'displayMode' => 'email',
          'locale' => 'en',
      ])
      ->savingCallback(function (NovaRequest $request, $attribute, Model $model, $outputHtmlFieldName) {
          $model->html = $request->input($outputHtmlFieldName);
      })
      ->onlyOnForms()
      ->hideFromDetail()
      ->hideFromIndex(),

I store content field as json and html field as html.

Am I missing something?

Thanks.

Not compatible with nova 3.2

Laravel nova 3.2 introduced new method called height() for code field. Same method implemented with this plugin with different signature. it throws error.

Array to string conversion

Hello,

First of all thanks for this package.
I've correctly installed the package but I had same error on save. Every time I try to save I'm having this error:

Array to string conversion
vendor/laravel/framework/src/Illuminate/Support/Str.php#488

I would also ask some more information to get correctly working this field. Here is the code:

Unlayer::make('Design')->config([
      'projectId' => config('unlayer.project_id'),
  ])
  ->savingCallback(function (NovaRequest $request, $attribute, Campaign $newsletterModel, $htmlFieldName) {
      $newsletterModel->content = $request->input($htmlFieldName);
  }),

config('unlayer.project_id') where it get the config?
What should I do to save correctly the config design ?

I've created a field on my table with json type to save the design as you illustrate on the docs, and also a content field to save html code.

Thanks

Use dynamic variables

Hey. Thanks for your package.
I would like to know if it is possible to somehow use my variable values.

For example, routes, data from a model, etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.