Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [Bug]: file and image upload #180

Open
grekpg opened this issue Dec 29, 2024 · 1 comment
Open

🐛 [Bug]: file and image upload #180

grekpg opened this issue Dec 29, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@grekpg
Copy link

grekpg commented Dec 29, 2024

Version

3.24.0

Link to minimal reproduction

uploadOption: {
// Jedna funkcja, która obsługuje każdy plik,
// niezależnie czy to obraz, wideo czy inny plik
imageUpload: ({ file, callback }) => {
this.uploadHandler('image',file, callback);
},

            // 3) Obsługa plików dowolnych (pdf, docx, itp.)
            fileUpload: ({ file, callback }) => {
                console.log('file upload');
                this.uploadHandler('file',file, callback);
            },
        },
        
        
        file upload is not fired

Step to reproduce

copy code

uploadOption: {
// Jedna funkcja, która obsługuje każdy plik,
// niezależnie czy to obraz, wideo czy inny plik
imageUpload: ({ file, callback }) => {
this.uploadHandler('image',file, callback);
},

            // 3) Obsługa plików dowolnych (pdf, docx, itp.)
            fileUpload: ({ file, callback }) => {
                console.log('file upload');
                this.uploadHandler('file',file, callback);
            },
        },

What is expected

copy code

What is actually happening

No response

What is your project name

test

Any additional comments (optional)

No response

@kagol kagol added the bug Something isn't working label Dec 30, 2024
@kagol
Copy link
Member

kagol commented Dec 30, 2024

@grekpg You need to set modules: { file: true }, for example:

editor = new FluentEditor('#editor-file-upload-to-server', {
  theme: 'snow',
  modules: {
    toolbar: TOOLBAR_CONFIG,
    file: true, // this is important!!!
  },
  uploadOption: {
    fileUpload: ({ file, callback }) => {
      // Upload file to server, get fileUrl: https://calibre-ebook.com/downloads/demos/demo.docx
      callback({
        fileUrl: 'https://calibre-ebook.com/downloads/demos/demo.docx',
      })
    },
  },
})

more details: https://opentiny.github.io/fluent-editor/docs/file-upload

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants