spaceshelter / orbitar

Experimental collective social/blogging platform with self-regulation.
MIT License
62 stars 24 forks source link

Fixed file paste #349

Closed maximt closed 1 year ago

maximt commented 1 year ago
  1. Fixed file paste: upload file instead of pasting file:// uri.
  2. Upload file by form submitting.
Aivean commented 1 year ago

I'm a bit confused.

Trying to test locally, here are the results:

  1. Pasting image content:
    • directly in the comment textarea: works ✅
    • in the upload form: works ✅
    • enter submission: works ✅
  2. Pasting image file:
    • directly in the comment textarea: works, enter: works ✅
    • in the upload form: inserts file name, enter/submit inserts an a filename instead of url ❌
  3. Dragging image file:
    • directly into the text area: doesn't work ❌
    • into the upload form: works, enter/submit: works ✅

Newly added submitUpload doesn't seem to be called in any of the cases, not sure if it's needed.

Could you please specify which cases this PR intends to fix?

maximt commented 1 year ago
  1. Pasting image file:

    • directly in the comment textarea: works, enter: works ✅
    • in the upload form: inserts file name, enter/submit inserts an a filename instead of url ❌

https://github.com/spaceshelter/orbitar/pull/345#pullrequestreview-1618684952

It strange, it was expected that both cases should work.

Newly added submitUpload doesn't seem to be called in any of the cases, not sure if it's needed.

This is need to prevent the page reloading on submit, but seems it need to change button type=submit too.

4vanger commented 1 year ago

Verified on windows - copied file in File Explorer using right button and ctrl+v into Chrome - pasted image content correctly

Aivean commented 1 year ago

Verified on windows - copied file in File Explorer using right button and ctrl+v into Chrome - pasted image content correctly

Are you checking two cases:

  1. Ctrl-V the file into the comment textarea (works for me)
  2. Ctrl-V the file into the upload form (when it's already open) — doesn't work for me
4vanger commented 1 year ago

Verified on windows - copied file in File Explorer using right button and ctrl+v into Chrome - pasted image content correctly

Are you checking two cases:

  1. Ctrl-V the file into the comment textarea (works for me)
  2. Ctrl-V the file into the upload form (when it's already open) — doesn't work for me

Yes, both cases are working as expected - pasting image content and previewing it

Aivean commented 1 year ago

Found and fixed the problem. The Ctrl/Cmd-V behavior was different in the upload form, depending on whether the focus was on the input element.

Aivean commented 1 year ago

Checklist (updating):

  1. Pasting image content:
    • directly in the comment textarea: works ✅
    • in the upload form: works ✅
    • enter submission: works ✅
  2. Pasting image file:
    • directly in the comment textarea: works, enter: works ✅
    • in the upload form: works, both into the input and the upload area ✅
  3. Dragging image file:
    • directly into the text area: fixed, opens form ✅
    • into the upload form: works, enter/submit: works ✅
Aivean commented 1 year ago

Supported image drag into the editor.

maximt commented 1 year ago

Supported image drag into the editor.

works for me.