PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.13
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.13
1.1.13 1.1.12 1.1.11 1.1.10 1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 All 37 releases
← All changes | includes/render/classic-link-interceptor.php +19 -2 1.0.1 → 1.1.13 View file →
@@ -26,10 +26,11 @@
26 26 * `desktop_mode_classic=1` flag and the next page falls back to the
27 27 * desktop shell — because the user meta is still `'1'` and the
28 28 * `admin_init` portal redirect kicks in. The JS here re-stamps the flag
29 29 * on every same-origin `/wp-admin/` `<a href>` and `<form action>` so
30 - * navigations within the tab stay classic. Server-side redirects are
31 - * covered by {@see openstation_classic_preserve_redirect}.
30 + * navigations within the tab stay classic, and keeps it in the address
31 + * bar. Server-side redirects are covered by
32 + * {@see openstation_classic_preserve_redirect}.
32 33 *
33 34 * Narrowly scoped: only runs when the current request itself carries
34 35 * the classic flag. Skips modifier-clicks (cmd/ctrl/shift/alt), targets
35 36 * other than `_self`, downloads, anchors, and non-http schemes so we
@@ -105,8 +106,24 @@
105 106 if ( rewritten ) {
106 107 form.setAttribute( 'action', rewritten );
107 108 }
108 109 }, true );
110 +
111 + // The block editor rewrites the address bar on load, dropping the
112 + // flag; the server reads it off the Referer of script navigations.
113 + [ 'pushState', 'replaceState' ].forEach( function ( method ) {
114 + var original = window.history[ method ];
115 + if ( typeof original !== 'function' ) {
116 + return;
117 + }
118 + window.history[ method ] = function ( state, title, url ) {
119 + var rewritten = null;
120 + if ( typeof url === 'string' || url instanceof URL ) {
121 + rewritten = rewriteAdminUrl( String( url ), window.location.href );
122 + }
123 + return original.call( window.history, state, title, rewritten || url );
124 + };
125 + } );
109 126 } )();
110 127 ";
111 128
112 129 wp_print_inline_script_tag( $js );