AztecEditor-Android
AztecEditor-Android copied to clipboard
Add UrlPastePlugin.kt to handle pasted links
In this PR I'm adding a plugin option to handle pasted text. This could be useful to override the default behaviour of handling any links. I'm also adding UrlPastePlugin which makes sure that when you paste an URL over selected text, it makes the whole thing into a link instead of replacing the selected text with a link.
Before you start make sure you add the following code to aztec in your MainActivity
aztec.addPlugin(UrlPastePlugin())
Test
- Run the app
- Copy link from your browser
- Long press within the text
- Paste content of your clipboard
- Notice the pasted text is a link
- Click on the link
- Notice it's recognized by the toolbar as a link
Test
- Run the app
- Copy link from your browser
- Select a word in the text
- Long press on it
- Paste content of your clipboard
- Notice the previously selected text is now a link
- Click on the link
- Notice it's recognized by the toolbar as a link
Test
- Run the app
- Copy something that's not a link
- Long press within the text
- Paste content of your clipboard
- Notice the pasted text is not a link
Test
- Run the app
- Copy something that's not a link
- Select a word in the text
- Long press on it
- Paste content of your clipboard
- Notice the selected text is replaced by the pasted text and is not a link
Review
@khaykov
Make sure strings will be translated:
- [x] If there are new strings that have to be translated, I have added them to the client's
strings.xmlas a part of the integration PR.