Giter Club home page Giter Club logo

Comments (6)

ArtMin96 avatar ArtMin96 commented on July 29, 2024

@xpalko Hi. Have you found anything related to patterns?

from laraberg.

xpalko avatar xpalko commented on July 29, 2024

@ArtMin96 Hi. I've already solved both the localization and patterns issues, but now I can't figure out how to use a custom Media Library/Upload without Wordpress dependencies. Some idea?

https://github.com/WordPress/gutenberg/blob/trunk/packages/block-editor/src/components/media-upload/README.md

doesn't work for me (probably not the whole code, just a hint).

from laraberg.

ArtMin96 avatar ArtMin96 commented on July 29, 2024

@xpalko Can you show an example of how you did it? I mean patterns and translations

Try this for media.

const mediaUpload = ({filesList, onFileChange}) => {}

Laraberg.init('element', {
    mediaUpload,
    //...
})

// Or

const mediaUploaded = ({
           filesList,
           onFileChange
       }) => {
           setTimeout(async () => {
 
               let formD = new FormData;

               Array.from(filesList).map(file => {
                   formD.append('upload', file);
               });
 
               const uploadedResponse = await $.ajax({
                   method: "POST",
                   url: `${APP_URL}/filemanager/upload`,
                   data: formD,
                   processData: false,
                   contentType: false,
                   success: function(response) {
                       console.log({
                           response
                       })
                       return response;
                   },
                   error: function(savePostErr) {
                       console.log({
                           savePostErr
                       })
                   }
               })
 
 
               const uploadedFiles = Array.from(filesList).map(file => {
 
                   return {
                       id: new Date().getTime(),
                       name: file.name,
                       url: uploadedResponse.url
                   }
               })
 
               console.log(uploadedFiles)
 
               onFileChange(uploadedFiles)
           }, 1000)
       }

from laraberg.

xpalko avatar xpalko commented on July 29, 2024

@ArtMin96 Thanks a lot, I'll give it a try. As for localization and patterns, I implemented it in a similar Automattic/isolated-block-editor project, but the code could definitely be used for Laraberg as well. I hope to try it soon!
In more detail it is https://github.com/xpalko/isolated-block-editor/commits/trunk, commits on Jan 5, 2023

from laraberg.

ArtMin96 avatar ArtMin96 commented on July 29, 2024

@xpalko Thanks. When you get the block patterns in laraberg can you share?

from laraberg.

github-actions avatar github-actions commented on July 29, 2024

This issue has been automatically marked as stale because it has been open for 60 days with no activity.

from laraberg.

Related Issues (20)

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.