| Server IP : 77.50.203.18 / Your IP : 192.168.0.10 Web Server : Apache/2.4.62 (CentOS Stream) OpenSSL/3.5.7 mpm-itk/2.4.7-04 PHP/8.4.23 System : Linux web2 5.14.0-722.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jul 6 09:07:51 UTC 2026 x86_64 User : warsnews.ru ( 1001) PHP Version : 8.4.23 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/ifwar.ru/www/wp-includes/js/dist/script-modules/block-library/query/ |
Upload File : |
// packages/block-library/build-module/query/view.mjs
import {
store,
getContext,
getElement,
withSyncEvent
} from "@wordpress/interactivity";
var isValidLink = (ref) => ref && ref instanceof window.HTMLAnchorElement && ref.href && (!ref.target || ref.target === "_self") && ref.origin === window.location.origin;
var isValidEvent = (event) => event.button === 0 && // Left clicks only.
!event.metaKey && // Open in new tab (Mac).
!event.ctrlKey && // Open in new tab (Windows).
!event.altKey && // Download.
!event.shiftKey && !event.defaultPrevented;
store(
"core/query",
{
actions: {
navigate: withSyncEvent(function* (event) {
const ctx = getContext();
const { ref } = getElement();
const queryRef = ref.closest(
".wp-block-query[data-wp-router-region]"
);
if (isValidLink(ref) && isValidEvent(event)) {
event.preventDefault();
const { actions } = yield import("@wordpress/interactivity-router");
yield actions.navigate(ref.href);
ctx.url = ref.href;
const firstAnchor = `.wp-block-post-template a[href]`;
queryRef.querySelector(firstAnchor)?.focus();
}
}),
*prefetch() {
const { ref } = getElement();
if (isValidLink(ref)) {
const { actions } = yield import("@wordpress/interactivity-router");
yield actions.prefetch(ref.href);
}
}
},
callbacks: {
*prefetch() {
const { url } = getContext();
const { ref } = getElement();
if (url && isValidLink(ref)) {
const { actions } = yield import("@wordpress/interactivity-router");
yield actions.prefetch(ref.href);
}
}
}
},
{ lock: true }
);