-
Notifications
You must be signed in to change notification settings - Fork 58
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
Undo/redo - Apply text format to a link breaks the undo functionality #3136
Comments
👋 Carlos! Judging from the video, it looks like we can add a No8 step with: "8. Nothing happens"?, right? Kinda a nit but, it's better to have that last step "spelled out" to describe what's the behavior the tester should see when following the reproduction steps, thanks! |
Added the "[Prio] High" label since this breaks a core flow (undo/redo). @fluiddot please plan to have a deeper look into this, thanks! |
I debugged this some during Groundskeeping. I did not make it to a fix, but wanted to capture what I observed so far. It would appear that two First Action{
"type": "EDIT_ENTITY_RECORD",
"kind": "postType",
"name": "post",
"recordId": 1,
"edits": {
"blocks": [
{
"clientId": "d16c2b82-6aa6-4f3a-89fb-b1124b6f9de2",
"name": "core/paragraph",
"isValid": true,
"validationIssues": [],
"originalContent": "<p>Hello <a href=\"http://www.wordpress.org\" target=\"_blank\" rel=\"noreferrer noopener\">World</a></p>",
"attributes": {
"content": "Hello <a rel=\"noreferrer noopener\" href=\"http://www.wordpress.org\" target=\"_blank\"><strong>World</strong></a>",
"dropCap": false
},
"innerBlocks": []
}
],
"selection": {
"selectionStart": {
"clientId": "d16c2b82-6aa6-4f3a-89fb-b1124b6f9de2",
"attributeKey": "content",
"offset": 6
},
"selectionEnd": {
"clientId": "d16c2b82-6aa6-4f3a-89fb-b1124b6f9de2",
"attributeKey": "content",
"offset": 11
},
"initialPosition": null
},
"content": [Function]
},
"transientEdits": { "blocks": true, "selection": true },
"meta": {
"undo": {
"kind": "postType",
"name": "post",
"recordId": 1,
"edits": {
"blocks": [
{
"clientId": "d16c2b82-6aa6-4f3a-89fb-b1124b6f9de2",
"name": "core/paragraph",
"isValid": true,
"validationIssues": [],
"originalContent": "<p>Hello <a href=\"http://www.wordpress.org\" target=\"_blank\" rel=\"noreferrer noopener\">World</a></p>",
"attributes": {
"content": "Hello <a rel=\"noreferrer noopener\" href=\"http://www.wordpress.org\" target=\"_blank\">World</a>",
"dropCap": false
},
"innerBlocks": []
}
],
"selection": {
"selectionStart": {
"clientId": "d16c2b82-6aa6-4f3a-89fb-b1124b6f9de2",
"attributeKey": "content",
"offset": 0
},
"selectionEnd": {
"clientId": "d16c2b82-6aa6-4f3a-89fb-b1124b6f9de2",
"attributeKey": "content",
"offset": 0
},
"initialPosition": null
},
"content": [Function]
},
"transientEdits": { "blocks": true, "selection": true }
}
}
} Second Action{
"type": "EDIT_ENTITY_RECORD",
"kind": "postType",
"name": "post",
"recordId": 1,
"edits": {
"blocks": [
{
"clientId": "d16c2b82-6aa6-4f3a-89fb-b1124b6f9de2",
"name": "core/paragraph",
"isValid": true,
"validationIssues": [],
"originalContent": "<p>Hello <a href=\"http://www.wordpress.org\" target=\"_blank\" rel=\"noreferrer noopener\">World</a></p>",
"attributes": {
"content": "Hello <strong><a rel=\"noreferrer noopener\" href=\"http://www.wordpress.org\" target=\"_blank\">World</a></strong>",
"dropCap": false
},
"innerBlocks": []
}
],
"selection": {
"selectionStart": {
"clientId": "d16c2b82-6aa6-4f3a-89fb-b1124b6f9de2",
"attributeKey": "content",
"offset": 6
},
"selectionEnd": {
"clientId": "d16c2b82-6aa6-4f3a-89fb-b1124b6f9de2",
"attributeKey": "content",
"offset": 11
},
"initialPosition": null
},
"content": [Function]
},
"transientEdits": { "blocks": true, "selection": true },
"meta": {
"undo": {
"kind": "postType",
"name": "post",
"recordId": 1,
"edits": {
"blocks": [
{
"clientId": "d16c2b82-6aa6-4f3a-89fb-b1124b6f9de2",
"name": "core/paragraph",
"isValid": true,
"validationIssues": [],
"originalContent": "<p>Hello <a href=\"http://www.wordpress.org\" target=\"_blank\" rel=\"noreferrer noopener\">World</a></p>",
"attributes": {
"content": "Hello <a rel=\"noreferrer noopener\" href=\"http://www.wordpress.org\" target=\"_blank\"><strong>World</strong></a>",
"dropCap": false
},
"innerBlocks": []
}
],
"selection": {
"selectionStart": {
"clientId": "d16c2b82-6aa6-4f3a-89fb-b1124b6f9de2",
"attributeKey": "content",
"offset": 6
},
"selectionEnd": {
"clientId": "d16c2b82-6aa6-4f3a-89fb-b1124b6f9de2",
"attributeKey": "content",
"offset": 11
},
"initialPosition": null
},
"content": [Function]
},
"transientEdits": { "blocks": true, "selection": true }
}
}
} This duplicative second action creates the loop that one cannot exit with the Undo button. Stepping backwards with the Undo button causes the second "reformatting" action to trigger again. At this time, my belief is that this issue may be related to Aztec-Android. I believe the quote below from wordpress-mobile/WordPress-Android#13169 (comment) is likely true regarding this issue as well.
I have not proven this theory yet, so it is a possibility that something else is at hand, but given the slight modifications to the block HTML from the rich text field it seems likely. |
Thanks @dcalhoun for capturing all these useful findings ❤️ ! I've debugged the issue too but focused on the native side of Aztec. I confirm that this is coming from Aztec-Android and is actually related to the wordpress-mobile/WordPress-Android#13169 (comment) comment. Aztec-Android can perform modifications in the HTML provided by the Example:
Since this is done at a native level, when the undo action is triggered (Undo action 2), although the HTML is modified, Aztec modifies it again, generating another action like In the following items I added refereces to the flow related to how the
I lack context about whether we require Aztec to modify the HTML, maybe this is behavior inherited from the past when it was used as the editor, but now that we have the Being this said, as a workaround for this issue, we could skip applying the Aztec style, done in the |
I've just opened the following PRs that addresses the issue:
Additionally, I gathered further investigations in WordPress/gutenberg#36766 regarding the modifications that Aztec-Android does related to the links. @hypest @dcalhoun I'd appreciate it if you could take a look, thank you very much for the help 🙇 . |
Describe the bug
After applying any text format (bold, italic or strikethrough) on a previously created link, the undo action stops working.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Undo action should revert the text format.
Screenshots
undo-text-forma-link-android.mp4
Smartphone (please complete the following information):
Additional context
N/A
The text was updated successfully, but these errors were encountered: