[wp-trac] [WordPress Trac] #51712: editPermalink() does not properly restore buttons after editing.
WordPress Trac
noreply at wordpress.org
Thu Nov 5 16:14:08 UTC 2020
#51712: editPermalink() does not properly restore buttons after editing.
-----------------------------------+-----------------------------
Reporter: bjornbrandewallnaviga | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 5.5.1
Severity: minor | Keywords:
Focuses: javascript |
-----------------------------------+-----------------------------
= DESCRIPTION =
In www/wp-admin/js/post.js, the function editPermalink():
When clicking the '.save' button, it makes a post/ajax request and
replaces #edit-slug-box with new data. Before this, it has made "backups"
of fields in variables ''permalinkOrig'' and ''buttonsOrig''. However,
when it supposedly restores these, the variables it sets the content to
(''permalink'' and ''buttons''), have been removed from the document tree
by ''box.html(data);'', so nothing happens.
= TO REPRODUCE =
1. Run something like this, which will add a button next to the "Edit"
button in the permalink area:
{{{
jQuery(document).ready(function(){
jQuery('<button type="button" class="button button-small">This button
ought to perservere!</button>')
.insertAfter('#edit-slug-buttons')
});
}}}
2. Edit the permalink, make some change, and click "OK".
DESIRED BEHAVIOR: As the "Edit" button reappears, the new button is still
next to it.
ACTUAL BEHAVIOR: The new button is gone.
= SOLUTION =
After running ''box.html(data);'', add these lines (around line 1017) to
"reload" the variables before filling them with content:
{{{
permalink = $( '#sample-permalink' );
buttons = $('#edit-slug-buttons');
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51712>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list