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

Enable Github like image Paste in Ticket Editor Component #789

Closed
tobi-bams opened this issue Dec 17, 2024 · 5 comments
Closed

Enable Github like image Paste in Ticket Editor Component #789

tobi-bams opened this issue Dec 17, 2024 · 5 comments
Assignees
Labels
Bounties bug Something isn't working

Comments

@tobi-bams
Copy link
Collaborator

Context

We want to enable pasting images directly into the ticket component.

Design

  1. The ticket component should include a Preview button to display the description as markdown.
  2. When in edit mode, use the TicketTextArea component.
  3. When in preview mode, use the renderMarkdown function found in this file.
  4. In the TicketTextArea component, listen for the onPaste event and handle it as follows:
    • Check whether the pasted content is an image or plain text.
    • If it's text, allow the default behavior of appending the text to the description.
    • If it's an image, immediately append a placeholder in the description using the format:
      ![Uploading unique-uuid-filename…]()  
      
      • Ensure that each placeholder has a unique identifier (e.g., a UUID) to handle multiple simultaneous uploads.
    • Upload the image through the public_pic endpoint (which stores it in the Meme Server). For reference, see a sample upload here.
    • v. If the upload is successful, replace the placeholder with the final markdown:
      ![image](image_url_from_response)  
      
    • vi. If the upload fails, update the placeholder to indicate failure:
      ![Failed to upload unique-uuid-filename…]()  
      
@jordan-ae
Copy link
Contributor

I'm available

1 similar comment
@jordan-ae
Copy link
Contributor

I'm available

@humansinstitute humansinstitute changed the title Design Project to Provide Github like image Paste in Ticket Editor Component Enable Github like image Paste in Ticket Editor Component Dec 19, 2024
@humansinstitute
Copy link
Collaborator

@jordan-ae

[BUG] - please update a new PR to switch edit and preview labels on the button in the ticket editor.

E.g. this should say "Preview" as this will load the preview.

Image

E.g. this should say "edit" as this will exit preview and allow edits.

Image

@jordan-ae
Copy link
Contributor

@humansinstitute I've opened a PR to fix this. I added a switcher component. There's a demo on the PR. Hope it matches the UX we are aiming for

@humansinstitute
Copy link
Collaborator

Looks good. just merged

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

No branches or pull requests

3 participants