fix(rich-text-editor): DP-134543 patchfix paste#676
fix(rich-text-editor): DP-134543 patchfix paste#676Bianca Artola (bianca-artola-dialpad) merged 1 commit intostagingfrom
Conversation
|
Please add either the |
|
✔️ Deploy previews ready! |
Brad Paugh (braddialpad)
left a comment
There was a problem hiding this comment.
I think this should work well
| const regex = /^https?:\/\//; | ||
|
|
||
| if (!event?.clipboardData) { | ||
| return false; | ||
| } | ||
| const pastedContent = event.clipboardData.getData('text'); | ||
|
|
||
| // Check if the pasted content is a valid URL (starting with http:// or https://) | ||
| // If it's not a URL, allow the default paste behavior | ||
| if (!regex.test(pastedContent)) { | ||
| return false; | ||
| } | ||
|
|
||
| // If `text/html` is missing from clipboard data, it's a plain link | ||
| // In this case, allow the default paste behavior | ||
| if (!event.clipboardData.getData('text/html')) { | ||
| return false; | ||
| } | ||
|
|
There was a problem hiding this comment.
I'm actually wondering if we should just ALWAYS take the text property from clipboard when our input is running in non-rich-text mode. Anyways that's a bit more dangerous so we can do this first.
|
Bianca Artola (@bianca-artola-dialpad) Do you know what the plan is with this fix, if it's going to be a prod CP we'll have to handle the release a bit differently. |
Waiting for Andrea response. Will update here |
She said we can go with the regular flow for release, so if we deploy a version and update it on firespotter before Tuesday should be okay. I'll merge this, thank you Brad |
d46fe42
into
staging
thanks! let's make sure to get some good QA testing on it so we don't continue creating regressions haha. |
## [2.178.2](dialtone-vue2/v2.178.1...dialtone-vue2/v2.178.2) (2025-03-20) ### Bug Fixes * **Rich Text Editor:** DP-134543 patchfix paste ([#676](#676)) ([d46fe42](d46fe42))
## [3.171.2](dialtone-vue3/v3.171.1...dialtone-vue3/v3.171.2) (2025-03-20) ### Bug Fixes * **Rich Text Editor:** DP-134543 patchfix paste ([#676](#676)) ([d46fe42](d46fe42))
## [9.105.2](dialtone/v9.105.1...dialtone/v9.105.2) (2025-03-20) ### Bug Fixes * **Rich Text Editor:** DP-134543 patchfix paste ([#676](#676)) ([d46fe42](d46fe42))
fix(rich-text-editor): DP-134543 patchfix paste
Obligatory GIF (super important!)
🛠️ Type Of Change
These types will increment the version number on release:
📖 Jira Ticket
https://dialpad.atlassian.net/browse/DP-134569
https://dialpad.atlassian.net/browse/DP-134543
📖 Description
The initial issue that was reported was an issue with links on Edge. With some investigation, we realized that when copying and pasting links from edge brings some html data inside that makes links not working as the other ones.
Technical details
I added these logs to see the behavior:
This is what happened when pasting an edge link:

vs pasting a link from any other place:

but i don't think we can do something with that as we also get text/html when pasting for example a piece of code.
The original issue was with edge links -> we can identify those links with a regex and also we can also do the special handlePaste when the text/html section from the clipboardData is not null which we saw is the case for edge. Then, for all the other cases, we can just return and go into the normal paste behavior (in that way, we will avoid the new issues with pasting that were generated after my changes, like losing formatting or not working okey for pasting code).
I know it's no clean but it will give us more time to launch the link into the input with all the cases covered and tested.
💡 Context
We are receiving reports saying that the paste functionality is not working fine on the message input; this was caused by #653. We initially think on reverting those changes and using the link extension instead, but as we noticed some unexpected behavior with it I think adding this patch fix will be the easiest and most quick patch fix we can do to fix both errors.
Link PR for future: #674
Let me know what you think team!