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

Fix unwanted rich text formatting when pasting #6353

Merged
merged 3 commits into from
May 29, 2021

Conversation

imericxu
Copy link
Contributor

@imericxu imericxu commented May 23, 2021

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  • Use getSpans and removeSpan to remove text styling when pasting

Fixes the following issue(s)

APK testing

On the website, the APK can be found by going to the "Checks" tab below the title and then on "artifacts" on the right.

Due diligence

@TobiGr
Copy link
Member

TobiGr commented May 23, 2021

thank you. please add a comment in the code that it removes rich text formatting

@AudricV AudricV added bug Issue is related to a bug GUI Issue is related to the graphical user interface labels May 23, 2021
@imericxu
Copy link
Contributor Author

imericxu commented May 23, 2021

Since this issue seems to only occur when pasting, should I modify the solution to an override of the paste method so there are no unnecessary checks in the TextWatcher?

Edit: Nvm, looks like you’d need to override a private member or do a lot of extra stuff to achieve that unless I missed something.

@imericxu imericxu force-pushed the fix-pasting-rich-text-in-search branch 3 times, most recently from b29e91b to 3e24a40 Compare May 24, 2021 16:20
@imericxu imericxu force-pushed the fix-pasting-rich-text-in-search branch from 0efda98 to ea1b910 Compare May 26, 2021 16:02
@TobiGr
Copy link
Member

TobiGr commented May 28, 2021

thank you. Is there are reason for placing the code in afterTextChanged and not in onTextChanged?

@imericxu
Copy link
Contributor Author

@TobiGr Unless I’m mistaken, only afterTextChanged(…) allows you to edit the text. Here’s the StackOverflow post where I got my info about TextWatcher methods: Link.

Copy link
Member

@TobiGr TobiGr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation!

@TobiGr TobiGr merged commit 0eb69b6 into TeamNewPipe:dev May 29, 2021
This was referenced Jun 5, 2021
@imericxu imericxu deleted the fix-pasting-rich-text-in-search branch January 2, 2024 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug GUI Issue is related to the graphical user interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Text copied from HTML is rendered in search bar
3 participants