-
Notifications
You must be signed in to change notification settings - Fork 7k
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
[MM-26675] Copy paste applies l ink markdown in edit_textbox #27097
base: master
Are you sure you want to change the base?
[MM-26675] Copy paste applies l ink markdown in edit_textbox #27097
Conversation
@cyrusjc: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. I understand the commands that are listed here |
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
E2E test triggered successfully for PR #27097. The corresponding commit's status check will be available shortly. |
E2E test run is starting for commit
|
…c/link_markdown_in_editbox
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A minor question.
@@ -157,6 +161,35 @@ const EditPost = ({editingPost, actions, canEditPost, config, channelId, draft, | |||
// just a helper so it's not always needed to update with setting both properties to the same value | |||
const setCaretPosition = (position: number) => setSelectionRange({start: position, end: position}); | |||
|
|||
useEffect(() => { | |||
function onPaste(event: ClipboardEvent) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have a pasteHandler
in webapp/channels/src/utils/paste.tsx
.
Is this something we can reuse in any way? or are there strong reasons to keep this one different? (I see it is for the most part the same, but missing some things).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's no major differences besides the fact that the post textbox uses some props that don't exist in webapp/channels/src/components/edit_post/edit_post.tsx
which is passed as arguments to pasteHandler()
. An alternative method is to modify pasteHandler()
to replace this logic which I originally didn't want to do but it does make sense for the logic for the post textbox and the edit textbox to be the same.
How would you want to approach this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go with updating the behavior in pasteHandler
. Without having looked at it much, what I would do is pass a special location from this component (maybe add it to the Locations constants as "EDIT"), and handle the differences based on that.
Summary:
Resolves part 1 of ticket #26675.
Fixes bug where the link markdown was not applied if copy and paste was done inside of the text box.
Ticket Link:
Fixes #26675
Screenshots / Gifs
Before
After
Release Note: