PluginProbe
Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor / 2.0.14
Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor v2.0.14
2.0.14 2.0.13 2.0.12 2.0.11 2.0.10 2.0.9 trunk 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8
← All changes | blocks/tooltip/index.js +16 -6 2.0.8 → 2.0.14 View file →
@@ -14,12 +14,22 @@
14 14 var SelectControl = wp.components.SelectControl;
15 15 var TextControl = wp.components.TextControl;
16 16 var TextareaControl = wp.components.TextareaControl;
17 17
18 - var _tc, _tvf;
19 - Object.defineProperty(window, '_bkbgTypoCtrlCache', { get: function () { if (!_tc) { _tc = window.bkbgTypographyControl; } return _tc; } });
20 - Object.defineProperty(window, '_bkbgTypoVarsCache', { get: function () { if (!_tvf) { _tvf = window.bkbgTypoCssVars; } return _tvf; } });
21 - function getTypoControl(props, attrName, label) { return window._bkbgTypoCtrlCache(props, attrName, label); }
18 + // Resolve the shared components lazily without defining globals for each block.
19 + function _tc(props, key, label) {
20 + var Control = window.bkbgTypographyControl;
21 + return Control ? el(Control, {
22 + label: label,
23 + value: props.attributes[key] || {},
24 + onChange: function (value) { var update = {}; update[key] = value; props.setAttributes(update); }
25 + }) : null;
26 + }
27 + function _tvf(typo, prefix) {
28 + var cssVars = window.bkbgTypoCssVars;
29 + return cssVars ? cssVars(typo || {}, prefix) : {};
30 + }
31 + function getTypoControl(props, attrName, label) { return _tc(props, attrName, label); }
22 32
23 33 var POSITION_OPTIONS = [
24 34 { label: 'Top', value: 'top' },
25 35 { label: 'Bottom', value: 'bottom' },
@@ -108,9 +118,9 @@
108 118 var setPreviewOpen = showPreview[1];
109 119
110 120 var blockProps = (function () {
111 121 var s = { textAlign: a.align };
112 - Object.assign(s, window._bkbgTypoVarsCache(a.triggerTypo, '--bkttp-tr-'), window._bkbgTypoVarsCache(a.tooltipTypo, '--bkttp-tp-'));
122 + Object.assign(s, _tvf(a.triggerTypo, '--bkttp-tr-'), _tvf(a.tooltipTypo, '--bkttp-tp-'));
113 123 return useBlockProps({ style: s });
114 124 })();
115 125
116 126 return el(Fragment, null,
@@ -301,9 +311,9 @@
301 311 },
302 312
303 313 save: function (props) {
304 314 var bp = (function () {
305 - var tv = Object.assign({}, window._bkbgTypoVarsCache(props.attributes.triggerTypo, '--bkttp-tr-'), window._bkbgTypoVarsCache(props.attributes.tooltipTypo, '--bkttp-tp-'));
315 + var tv = Object.assign({}, _tvf(props.attributes.triggerTypo, '--bkttp-tr-'), _tvf(props.attributes.tooltipTypo, '--bkttp-tp-'));
306 316 var parts = []; Object.keys(tv).forEach(function (k) { parts.push(k + ':' + tv[k]); });
307 317 return useBlockProps.save(parts.length ? { style: parts.join(';') } : {});
308 318 })();
309 319 return el('div', bp,