Coder Social home page Coder Social logo

Upload Image about nova-unlayer-field HOT 4 OPEN

espositodaniele avatar espositodaniele commented on June 16, 2024
Upload Image

from nova-unlayer-field.

Comments (4)

espositodaniele avatar espositodaniele commented on June 16, 2024 2

What I've done is to upload photo that are sorted on my server, and at the moment it is not configurable.

I needed to force the plug-in directly from .vue files.

Would be helpful to have an option to indicate our root folder where to place image and then provide that information to the api that store image.

Here is the code I've added to your UnlayerEditor.vue

window.unlayer.registerCallback('image', (file, done) => {
    let data = new FormData();
    data.append('file', file.attachments[0]);
    fetch('/api/upload-unlayer', {
        method: 'POST',
        headers: {
            'Accept': 'application/json',
            'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content'),
        },
        body: data
    }).then(response => {
        // Make sure the response was valid
        if (response.status >= 200 && response.status < 300) {
            return response.json()
        }
        let error = new Error(response.statusText);
        error.response = response;
        throw error
    }).then(data => done({progress: 100, url: data.url}))
});

from nova-unlayer-field.

alies-dev avatar alies-dev commented on June 16, 2024

That's currently not possible. PRs are very welcome to implement this

from nova-unlayer-field.

alies-dev avatar alies-dev commented on June 16, 2024

Hey @espositodaniele

What exactly do you want to implement for images? I'm exploring options how to improve the package, your input is very welcome.

from nova-unlayer-field.

alies-dev avatar alies-dev commented on June 16, 2024

guys, do you meth this upload functionality?
image

Also, I couldn't find any documentation for image callback/event, can you please provide some?

from nova-unlayer-field.

Related Issues (12)

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.