#57788 closed enhancement (fixed)
HTML Tag Processor: Add bookmark invalidation logic
Reported by: | Bernhard Reiter | Owned by: | hellofromTonya |
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | |
Component: | HTML API | Keywords: | has-patch gutenberg-merge has-unit-tests commit |
Focuses: | Cc: |
Description
While WP_HTML_Tag_Processor
currently only supports changing a given tag's attributes, we plan to also provide methods to make broader changes (possibly through a subclass of WP_HTML_Tag_Processor
).
An API like that will have the potential of replacing a tag that a bookmark points to. As a preparation, we thus need to make sure that all bookmarks affected by a HTML replacement are invalidated (i.e. released).
Change History (10)
This ticket was mentioned in PR #4116 on WordPress/wordpress-develop by @Bernhard Reiter.
22 months ago
#1
- Keywords has-patch added
@Bernhard Reiter commented on PR #4116:
22 months ago
#2
cc/ @dmsnell 😊
#3
@
22 months ago
- Keywords gutenberg-merge added
Original Gutenberg PR https://github.com/WordPress/gutenberg/pull/47559.
@Bernhard Reiter commented on PR #4116:
22 months ago
#4
Thank you! 😊
Just noting that we can't merge this to trunk
until Core is comes out of the 6.2 Beta phase, which should happen on March 7.
#5
@
21 months ago
- Keywords has-unit-tests commit added
- Owner set to hellofromTonya
- Status changed from new to reviewing
Patch:
- Confirmed this is a copy of Gutenberg PR 47559 ✅
- Includes ticket annotation in tests ✅
- Includes
@since
annotation ✅ - Change was released in Gutenberg 15.3.0 ✅
Ready for commit 👍 Prepping commit now.
@hellofromTonya commented on PR #4116:
21 months ago
#6
Prepping commit now ✅
@hellofromTonya commented on PR #4116:
21 months ago
#8
Committed via https://core.trac.wordpress.org/changeset/55555.
@Bernhard Reiter commented on PR #4116:
21 months ago
#10
Thank you very much for landing this @hellofromtonya !
While
WP_HTML_Tag_Processor
currently only supports changing a given tag's attributes, we plan to also provide methods to make broader changes (possibly through a subclass ofWP_HTML_Tag_Processor
).An API like that will have the potential of replacing a tag that a bookmark points to. As a preparation, we thus need to make sure that all bookmarks affected by a HTML replacement are invalidated (i.e. released).
This is done by extending the existing loop in
apply_attributes_updates
that adjusts bookmarks' start and end positions upon HTML changes to check if the entire bookmark is within a portion of the HTML that has been replaced.Note that this PR is a backport of https://github.com/WordPress/gutenberg/pull/47559.
Trac ticket: https://core.trac.wordpress.org/ticket/57788