[wp-trac] [WordPress Trac] #57788: HTML Tag Processor: Add bookmark invalidation logic

WordPress Trac noreply at wordpress.org
Thu Mar 16 13:10:11 UTC 2023


#57788: HTML Tag Processor: Add bookmark invalidation logic
-------------------------------------------------+-------------------------
 Reporter:  Bernhard Reiter                      |       Owner:
                                                 |  hellofromTonya
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:  6.3
Component:  Editor                               |     Version:
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch gutenberg-merge has-unit-  |     Focuses:
  tests commit                                   |
-------------------------------------------------+-------------------------
Changes (by hellofromTonya):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"55555" 55555]:
 {{{
 #!CommitTicketReference repository="" revision="55555"
 HTML API: Add bookmark invalidation logic.

 While `WP_HTML_Tag_Processor` currently only supports changing a given
 tag's attributes, the plan is to provide methods to make broader changes
 (possibly through a subclass of `WP_HTML_Tag_Processor`). The API will
 have the potential of replacing a tag that a bookmark points to. To
 prepare, this changeset makes sure that all bookmarks affected by a HTML
 replacement are invalidated (i.e. released).

 Changes:
 * Extends the existing loop in
 `WP_HTML_Tag_Processor::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.
 * Adds `WP_HTML_Tag_Processor::has_bookmark() to check whether the given
 bookmark name exists.

 References:
 * [https://github.com/WordPress/gutenberg/pull/47559 Gutenberg PR 47559]
 * [https://github.com/WordPress/gutenberg/releases/tag/v15.3.0 Released in
 Gutenberg 15.3.0]

 Follow-up to [55203].

 Props bernhard-reiter, dmsnell, zieladam.
 Fixes #57788.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57788#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list