PluginProbe
Extendify / 3.2.1
Extendify v3.2.1
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
← All changes | src/Agent/buttons.js +23 -13 3.0.63.2.1 View file →
@@ -12,22 +12,31 @@
12 12 // Global toolbar
13 13 domReady(() => {
14 14 if (isOnLaunch()) return;
15 15 const id = 'wp-admin-bar-extendify-agent-btn';
16 - if (document.getElementById(id)) return;
17 - const agent = Object.assign(document.createElement('li'), {
18 - className: 'extendify-agent',
19 - id,
20 - });
16 + // Skeleton.php may already own this node; reuse it so the item never moves.
17 + const agent =
18 + document.getElementById(id) ??
19 + Object.assign(document.createElement('li'), {
20 + className: 'extendify-agent',
21 + id,
22 + });
23 + // Presence no longer proves a mount, so the marker guards it.
24 + if (agent.dataset.extendifyMounted) return;
25 + agent.dataset.extendifyMounted = '1';
21 26 agent.style.height = '1.75rem';
22 27 agent.style.marginInlineEnd = '4px';
23 - // TODO: If we want to allow swapping live we need to rethink this
24 - const loc =
25 - window.extAgentData.agentPosition === 'floating'
26 - ? '#wp-admin-bar-my-account'
27 - : '#wp-admin-bar-wp-logo';
28 - document.querySelector(loc)?.before(agent);
29 - render(<AdminBar />, agent);
28 + if (!agent.isConnected) {
29 + // TODO: If we want to allow swapping live we need to rethink this
30 + const loc =
31 + window.extAgentData.agentPosition === 'floating'
32 + ? '#wp-admin-bar-my-account'
33 + : '#wp-admin-bar-wp-logo';
34 + document.querySelector(loc)?.before(agent);
35 + }
36 + // Clearing the slot first paints it empty when React commits a task later.
37 + const mount = agent.appendChild(document.createElement('span'));
38 + render(<AdminBar />, mount);
30 39 });
31 40
32 41 // Mobile
33 42 domReady(() => {
@@ -40,9 +49,10 @@
40 49 });
41 50 agent.style.position = 'sticky';
42 51 agent.style.top = 'calc(100% - var(--extendify-agent-mobile-btn-height))';
43 52 agent.style.bottom = '0';
44 - agent.style.zIndex = '99999';
53 + // Under the canvas scrim the tap that restores the chat never lands.
54 + agent.style.zIndex = '999999';
45 55 document.body.appendChild(agent);
46 56 render(<Mobile />, agent);
47 57 });
48 58