-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Conversation
The hardest bits to figure out here are going to be images and embeds. I think images we have to do GitHub-style "upload from client then input markdown link". /cc @brianlovin how would we best accomplish that? New I have no idea how to do the embeds, I think the choice is either to remove that functionality (while keeping existing embeds around, of course) or automatically "unfurling" a list of supported links into embeds (youtube, simplecast, soundcloud, etc) on the backend. Any thoughts? |
Generated by 🚫 dangerJS |
What are the problems with the current editor? |
It is very buggy, lots of users constantly complain about it (see my recent blog post). We want to replace the WYSIWYG part with a plaintext markdown editor, which is then converted on the backend! (this should be mostly irrelevant for your work in #4575 I think?) |
Yeah, it might be worth poking around to see if other libs exist for this yet, otherwise we could try and figure out how GitHub handles this by just inserting placeholder markdown while waiting for the upload to return a url. The downside here would be that you create an upload every time, regardless of if the resulting url actually gets posted. But storage is cheap, so not a problem really right now.
I'm fine with removing functionality and getting really smart with link unfurling for popular services. I'd add Figma embeds and code sandbox urls to your list. I don't know how that would look in the backend (just inserting an iframe into the draftjs body?) but this feels like the best user experience to me personally. |
The latest commit starts working on the client-side image uploads by adding an The embed stuff sounds good to me too, inserting an embed into the DraftJS content seems simple enough to be feasible. I'll try making that happen after making sure the image uploads will work. |
I have been battling around for hours with this image uploads stuff now, and can't seem to get it to work. When dropping an image on the new composer, |
@mxstbr could you push up your latest work? Not sure what could be going on there. Do you have |
That is not the issue, the |
Oh my god are you kidding me, did that fix it @brianlovin? 🤦♂️🤦♂️🤦♂️ I am such a dummy, sorry about all the struggles here. Cannot believe I spent three days messing around with this. |
A quite well unit tested util that parses supported URLs from text and returns their embed URLs. Currently supported services are Figma, Framer, Youtube, Vimeo, Codepen and Codesandbox, as well as support for generic <iframe>s
Todos
|
@mxstbr @ThomasRoest this PR seriously makes me so happy. What a huge, massive, seriously big quality of life improvement to composition on Spectrum. I'm running this locally and just so stoked to ship this. Going to do a bunch of testing and make sure we can't suss out some lingering bugs. |
@mxstbr found some bugs + notes:
|
The "convert draftjs to markdown for editing" thing that we do for messages won't work for the complex styling of threads. For example, what do we do with automatic embeds? If we do move editing to plain text we would need to store the raw markdown body on the server and send that down the wire. I think that is more work than necessary for this v1, I would rather ship this and then tackle plaintext thread editing in a followup? Noted on your other points, good catches! Will investigate on Monday |
see |
Yeah I think we can just entirely get rid of those focus states since they were only relevant during WYSIWYG editing. Want to submit a PR against this branch @ThomasRoest? |
remove active overlay / focus state from image in composer
After thinking about this more, really the only thing the plaintext input does not account for is the automatic embeds. If we are fine with users not being able to remove them, we can move the editing experience to plaintext too. That being said, it would require a lot more work to make plaintext editing work on both the back- and the frontend, so I would much rather ship this for now and then work on that afterwards if we are cool with that @brianlovin? |
Okay, I understand that's challenging. Since this is still a huge incremental improvement, let's 🚢 and figure out editing down the road. My 2 cents though is that I'm not worried about the user being able to edit the embeds after the fact. |
Merging!!!!! 😱 🎉 🎉 🎉 Will get this live on alpha. |
Status
Deploy after merge (delete what needn't be deployed)
After reassessing the importance of this change due to customer feedback I decided to investigate this after all. From the first exploration it seems doable, with some caveats.
Todo
Add note that drag and drop uploading is supported?Add note about automatic embeds?/new/thread
src/components/composer
withsrc/components/threadComposer/composer
(done by @ThomasRoest in WIP: combine / refactor threadcomposer #4575)