Changeset 3145331
- Timestamp:
- 09/02/2024 12:40:00 PM (17 months ago)
- Location:
- sharable-password-protected-posts
- Files:
-
- 4 added
- 8 edited
- 1 copied
-
tags/1.1.0 (copied) (copied from sharable-password-protected-posts/trunk)
-
tags/1.1.0/build/index.asset.php (modified) (1 diff)
-
tags/1.1.0/build/index.js (modified) (1 diff)
-
tags/1.1.0/languages/good-slider.pot (added)
-
tags/1.1.0/languages/sharable-password-protected-posts-de_DE.l10n.php (added)
-
tags/1.1.0/sharable-password-protected-posts.php (modified) (2 diffs)
-
tags/1.1.0/src/PostStatusSettings/index.js (modified) (4 diffs)
-
trunk/build/index.asset.php (modified) (1 diff)
-
trunk/build/index.js (modified) (1 diff)
-
trunk/languages/good-slider.pot (added)
-
trunk/languages/sharable-password-protected-posts-de_DE.l10n.php (added)
-
trunk/sharable-password-protected-posts.php (modified) (2 diffs)
-
trunk/src/PostStatusSettings/index.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sharable-password-protected-posts/tags/1.1.0/build/index.asset.php
r2809716 r3145331 1 <?php return array('dependencies' => array(' wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-url'), 'version' => '929f19f0796b8f796f89');1 <?php return array('dependencies' => array('react', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-url'), 'version' => 'eb9f3e35316836719bd7'); -
sharable-password-protected-posts/tags/1.1.0/build/index.js
r2809716 r3145331 1 !function(){"use strict";var e=window.wp.plugins,t=window.wp.element,s=window.wp.editPost,o=window.wp.components,n=window.wp.i18n,i=window.wp.data,p=window.wp.editor;function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[o])}return e},r.apply(this,arguments)}var a=window.wp.url,l=window.wp.compose,c={META_ENABLED:"_sppp_enabled",META_KEY:"_sppp_key",QUERY_PARAM:"_sppp_key"};const{META_KEY:d,QUERY_PARAM:w}=c,m=e=>{let{text:s,onCopy:n,children:i,...p}=e;const a=(0,l.useCopyToClipboard)(s,n);return(0,t.createElement)(o.Button,r({variant:"secondary",ref:a},p),i)};class u extends t.Component{constructor(){super(...arguments),this.state={showCopyConfirmation:!1},this.onCopy=this.onCopy.bind(this),this.onSelectInput=this.onSelectInput.bind(this)}componentWillUnmount(){clearTimeout(this.dismissCopyConfirmation)}onCopy(){this.setState({showCopyConfirmation:!0}),clearTimeout(this.dismissCopyConfirmation),this.dismissCopyConfirmation=setTimeout((()=>{this.setState({showCopyConfirmation:!1})}),4e3)}onSelectInput(e){e.target.select()}render(){const e=(0,a.addQueryArgs)(this.props.postLink,{[w]:this.props.secretKey});return(0,t.createElement)("div",null,(0,t.createElement)("label",{htmlFor:"sppp-link-field",className:"screen-reader-text"},(0,n.__)("Share this URL","sharable-password-protected-posts")),(0,t.createElement)(o.Flex,{className:"sppp__link-copy"},(0,t.createElement)(o.TextControl,{id:"sppp-link-field",className:"sppp__link-field",readOnly:!0,label:(0,n.__)("Secret URL:","sharable-password-protected-posts"),value:(0,a.safeDecodeURIComponent)(e),onFocus:this.onSelectInput}),(0,t.createElement)(m,{text:e,onCopy:this.onCopy,className:"sppp__copy-button"},this.state.showCopyConfirmation?(0,n.__)("Copied!","sharable-password-protected-posts"):(0,n.__)("Copy","sharable-password-protected-posts"))))}}var h=(0,i.withSelect)((e=>{const{getEditedPostAttribute:t,getPermalink:s}=e(p.store);return{postLink:s(),secretKey:t("meta")[d]}}))(u),y=window.wp.coreData,_=e=>{let{children:t}=e;const{isPostTypeVisible:s,postType:o,isPostPrivate:n}=(0,i.useSelect)((e=>{let t=!1;const s=e(p.store).getCurrentPostType(),o=e(y.store).getPostType(s),n=e(p.store).getEditedPostAttribute("link"),i=e(p.store).getEditedPostVisibility();return null!=o&&o.viewable&&(t=!0),n&&(t=!0),e(p.store).getPermalinkParts()&&(t=!0),{isPostTypeVisible:t,postType:s,isPostPrivate:"private"===i||"password"===i}}),[]),r=window.sppp&&window.sppp.settings.postTypes.includes(o);return window.sppp&&window.sppp.settings.hasPermissions&&s&&r&&n?t:null};const{META_ENABLED:E,META_KEY:C}=c;(0,e.registerPlugin)("sharable-password-protected-posts",{render:()=>{const{sharingEnabled:e,existingKey:r}=(0,i.useSelect)((e=>{const{getEditedPostAttribute:t}=e(p.store),s=t("meta");return{sharingEnabled:s[E],existingKey:s[C]}})),{editPost:a}=(0,i.useDispatch)(p.store);return(0,t.createElement)(s.PluginPostStatusInfo,{className:"sppp"},(0,t.createElement)(_,null,(0,t.createElement)("div",{className:"sppp__checkbox"},(0,t.createElement)(o.CheckboxControl,{label:(0,n.__)("Share post via secret URL","sharable-password-protected-posts"),checked:e,onChange:e=>{a(e?{meta:{[E]:!0,[C]:r||window.sppp.newKey||""}}:{meta:{[E]:!1,[C]:""}})}})),e&&(0,t.createElement)("div",{className:"sppp__link"},(0,t.createElement)(h,null))))}})}();1 (()=>{"use strict";const e=window.wp.plugins,t=window.React,s=window.wp.components,o=window.wp.i18n,n=window.wp.data,i=window.wp.editor,p=window.wp.element,r=window.wp.url,a=window.wp.compose,l={META_ENABLED:"_sppp_enabled",META_KEY:"_sppp_key",QUERY_PARAM:"_sppp_key"},{META_KEY:d,QUERY_PARAM:c}=l,w=({text:e,onCopy:o,children:n,...i})=>{const p=(0,a.useCopyToClipboard)(e,o);return(0,t.createElement)(s.Button,{variant:"secondary",ref:p,...i},n)};class u extends p.Component{constructor(){super(...arguments),this.state={showCopyConfirmation:!1},this.onCopy=this.onCopy.bind(this),this.onSelectInput=this.onSelectInput.bind(this)}componentWillUnmount(){clearTimeout(this.dismissCopyConfirmation)}onCopy(){this.setState({showCopyConfirmation:!0}),clearTimeout(this.dismissCopyConfirmation),this.dismissCopyConfirmation=setTimeout((()=>{this.setState({showCopyConfirmation:!1})}),4e3)}onSelectInput(e){e.target.select()}render(){const e=(0,r.addQueryArgs)(this.props.postLink,{[c]:this.props.secretKey});return(0,t.createElement)("div",null,(0,t.createElement)("label",{htmlFor:"sppp-link-field",className:"screen-reader-text"},(0,o.__)("Share this URL","sharable-password-protected-posts")),(0,t.createElement)(s.Flex,{className:"sppp__link-copy"},(0,t.createElement)(s.TextControl,{id:"sppp-link-field",className:"sppp__link-field",readOnly:!0,label:(0,o.__)("Secret URL:","sharable-password-protected-posts"),value:(0,r.safeDecodeURIComponent)(e),onFocus:this.onSelectInput}),(0,t.createElement)(w,{text:e,onCopy:this.onCopy,className:"sppp__copy-button"},this.state.showCopyConfirmation?(0,o.__)("Copied!","sharable-password-protected-posts"):(0,o.__)("Copy","sharable-password-protected-posts"))))}}const m=(0,n.withSelect)((e=>{const{getEditedPostAttribute:t,getPermalink:s}=e(i.store);return{postLink:s(),secretKey:t("meta")[d]}}))(u),h=window.wp.coreData,y=({children:e})=>{const{isPostTypeVisible:t,postType:s,isPostPrivate:o}=(0,n.useSelect)((e=>{let t=!1;const s=e(i.store).getCurrentPostType(),o=e(h.store).getPostType(s),n=e(i.store).getEditedPostAttribute("link"),p=e(i.store).getEditedPostVisibility();return o?.viewable&&(t=!0),n&&(t=!0),e(i.store).getPermalinkParts()&&(t=!0),{isPostTypeVisible:t,postType:s,isPostPrivate:"private"===p||"password"===p}}),[]),p=window.sppp&&window.sppp.settings.postTypes.includes(s);return window.sppp&&window.sppp.settings.hasPermissions&&t&&p&&o?e:null};var _,E;const C=null!==(_=wp.editor?.PluginPostStatusInfo)&&void 0!==_?_:null!==(E=wp.editPost?.PluginPostStatusInfo)&&void 0!==E?E:wp.editSite?.PluginPostStatusInfo,{META_ENABLED:P,META_KEY:b}=l;(0,e.registerPlugin)("sharable-password-protected-posts",{render:()=>{const{sharingEnabled:e,existingKey:p}=(0,n.useSelect)((e=>{const{getEditedPostAttribute:t}=e(i.store),s=t("meta");return{sharingEnabled:s?.[P]||null,existingKey:s?.[b]||null}})),{editPost:r}=(0,n.useDispatch)(i.store);return(0,t.createElement)(C,{className:"sppp"},(0,t.createElement)(y,null,(0,t.createElement)("div",{className:"sppp__checkbox"},(0,t.createElement)(s.CheckboxControl,{label:(0,o.__)("Share post via secret URL","sharable-password-protected-posts"),checked:!!e,onChange:e=>{r(e?{meta:{[P]:!0,[b]:p||window.sppp.newKey||""}}:{meta:{[P]:!1,[b]:""}})}})),e&&(0,t.createElement)("div",{className:"sppp__link"},(0,t.createElement)(m,null))))}})})(); -
sharable-password-protected-posts/tags/1.1.0/sharable-password-protected-posts.php
r2809749 r3145331 6 6 * Requires at least: 6.0 7 7 * Requires PHP: 7.4 8 * Version: 1. 0.28 * Version: 1.1.0 9 9 * Author: Fabian Todt 10 10 * Author URI: https://fabiantodt.at/en/ … … 40 40 ]; 41 41 42 $scriptDependencies = $assetsConfig['dependencies']; 43 // For WordPress < 6.6 the editor script depends on wp-edit-post (because of PluginPostStatusInfo) 44 // but the script is built against 6.6, therefore only requiring the wp-editor script. 45 require ABSPATH . WPINC . '/version.php'; 46 if(version_compare($wp_version, '6.6', '<')) { 47 $scriptDependencies[] = 'wp-edit-post'; 48 } 49 42 50 wp_enqueue_script( 43 51 'sppp', 44 52 plugin_dir_url(__FILE__) . 'build/index.js', 45 $ assetsConfig['dependencies'],53 $scriptDependencies, 46 54 $assetsConfig['version'] 47 55 ); -
sharable-password-protected-posts/tags/1.1.0/src/PostStatusSettings/index.js
r2809716 r3145331 1 import { PluginPostStatusInfo } from "@wordpress/edit-post";2 1 import { CheckboxControl } from "@wordpress/components"; 3 2 import { __ } from "@wordpress/i18n"; … … 6 5 import CopyUrl from "./CopyUrl"; 7 6 import Check from "./Check"; 7 8 // Support < WP 6.6 and > WP 6.6 9 // See https://make.wordpress.org/core/2024/06/18/editor-unified-extensibility-apis-in-6-6/ 10 const PluginPostStatusInfo = wp.editor?.PluginPostStatusInfo ?? ( wp.editPost?.PluginPostStatusInfo ?? wp.editSite?.PluginPostStatusInfo ); 8 11 9 12 import CONSTANTS from "./constants"; … … 15 18 const { sharingEnabled, existingKey } = useSelect((select) => { 16 19 const { getEditedPostAttribute } = select(editorStore); 17 const meta = getEditedPostAttribute("meta"); 20 const meta = getEditedPostAttribute("meta"); // Will be undefined in site editor. 18 21 return { 19 sharingEnabled: meta [META_ENABLED],20 existingKey: meta [META_KEY],22 sharingEnabled: meta?.[META_ENABLED] || null, 23 existingKey: meta?.[META_KEY] || null, 21 24 }; 22 25 }); … … 40 43 <CheckboxControl 41 44 label={__("Share post via secret URL", "sharable-password-protected-posts")} 42 checked={ sharingEnabled}45 checked={!!sharingEnabled} // Cast to bool, so null value after changing and reloading state does not trigger uncontrolled input warning. 43 46 onChange={onChangeEnabled} 44 47 /> -
sharable-password-protected-posts/trunk/build/index.asset.php
r2809716 r3145331 1 <?php return array('dependencies' => array(' wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-url'), 'version' => '929f19f0796b8f796f89');1 <?php return array('dependencies' => array('react', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-url'), 'version' => 'eb9f3e35316836719bd7'); -
sharable-password-protected-posts/trunk/build/index.js
r2809716 r3145331 1 !function(){"use strict";var e=window.wp.plugins,t=window.wp.element,s=window.wp.editPost,o=window.wp.components,n=window.wp.i18n,i=window.wp.data,p=window.wp.editor;function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[o])}return e},r.apply(this,arguments)}var a=window.wp.url,l=window.wp.compose,c={META_ENABLED:"_sppp_enabled",META_KEY:"_sppp_key",QUERY_PARAM:"_sppp_key"};const{META_KEY:d,QUERY_PARAM:w}=c,m=e=>{let{text:s,onCopy:n,children:i,...p}=e;const a=(0,l.useCopyToClipboard)(s,n);return(0,t.createElement)(o.Button,r({variant:"secondary",ref:a},p),i)};class u extends t.Component{constructor(){super(...arguments),this.state={showCopyConfirmation:!1},this.onCopy=this.onCopy.bind(this),this.onSelectInput=this.onSelectInput.bind(this)}componentWillUnmount(){clearTimeout(this.dismissCopyConfirmation)}onCopy(){this.setState({showCopyConfirmation:!0}),clearTimeout(this.dismissCopyConfirmation),this.dismissCopyConfirmation=setTimeout((()=>{this.setState({showCopyConfirmation:!1})}),4e3)}onSelectInput(e){e.target.select()}render(){const e=(0,a.addQueryArgs)(this.props.postLink,{[w]:this.props.secretKey});return(0,t.createElement)("div",null,(0,t.createElement)("label",{htmlFor:"sppp-link-field",className:"screen-reader-text"},(0,n.__)("Share this URL","sharable-password-protected-posts")),(0,t.createElement)(o.Flex,{className:"sppp__link-copy"},(0,t.createElement)(o.TextControl,{id:"sppp-link-field",className:"sppp__link-field",readOnly:!0,label:(0,n.__)("Secret URL:","sharable-password-protected-posts"),value:(0,a.safeDecodeURIComponent)(e),onFocus:this.onSelectInput}),(0,t.createElement)(m,{text:e,onCopy:this.onCopy,className:"sppp__copy-button"},this.state.showCopyConfirmation?(0,n.__)("Copied!","sharable-password-protected-posts"):(0,n.__)("Copy","sharable-password-protected-posts"))))}}var h=(0,i.withSelect)((e=>{const{getEditedPostAttribute:t,getPermalink:s}=e(p.store);return{postLink:s(),secretKey:t("meta")[d]}}))(u),y=window.wp.coreData,_=e=>{let{children:t}=e;const{isPostTypeVisible:s,postType:o,isPostPrivate:n}=(0,i.useSelect)((e=>{let t=!1;const s=e(p.store).getCurrentPostType(),o=e(y.store).getPostType(s),n=e(p.store).getEditedPostAttribute("link"),i=e(p.store).getEditedPostVisibility();return null!=o&&o.viewable&&(t=!0),n&&(t=!0),e(p.store).getPermalinkParts()&&(t=!0),{isPostTypeVisible:t,postType:s,isPostPrivate:"private"===i||"password"===i}}),[]),r=window.sppp&&window.sppp.settings.postTypes.includes(o);return window.sppp&&window.sppp.settings.hasPermissions&&s&&r&&n?t:null};const{META_ENABLED:E,META_KEY:C}=c;(0,e.registerPlugin)("sharable-password-protected-posts",{render:()=>{const{sharingEnabled:e,existingKey:r}=(0,i.useSelect)((e=>{const{getEditedPostAttribute:t}=e(p.store),s=t("meta");return{sharingEnabled:s[E],existingKey:s[C]}})),{editPost:a}=(0,i.useDispatch)(p.store);return(0,t.createElement)(s.PluginPostStatusInfo,{className:"sppp"},(0,t.createElement)(_,null,(0,t.createElement)("div",{className:"sppp__checkbox"},(0,t.createElement)(o.CheckboxControl,{label:(0,n.__)("Share post via secret URL","sharable-password-protected-posts"),checked:e,onChange:e=>{a(e?{meta:{[E]:!0,[C]:r||window.sppp.newKey||""}}:{meta:{[E]:!1,[C]:""}})}})),e&&(0,t.createElement)("div",{className:"sppp__link"},(0,t.createElement)(h,null))))}})}();1 (()=>{"use strict";const e=window.wp.plugins,t=window.React,s=window.wp.components,o=window.wp.i18n,n=window.wp.data,i=window.wp.editor,p=window.wp.element,r=window.wp.url,a=window.wp.compose,l={META_ENABLED:"_sppp_enabled",META_KEY:"_sppp_key",QUERY_PARAM:"_sppp_key"},{META_KEY:d,QUERY_PARAM:c}=l,w=({text:e,onCopy:o,children:n,...i})=>{const p=(0,a.useCopyToClipboard)(e,o);return(0,t.createElement)(s.Button,{variant:"secondary",ref:p,...i},n)};class u extends p.Component{constructor(){super(...arguments),this.state={showCopyConfirmation:!1},this.onCopy=this.onCopy.bind(this),this.onSelectInput=this.onSelectInput.bind(this)}componentWillUnmount(){clearTimeout(this.dismissCopyConfirmation)}onCopy(){this.setState({showCopyConfirmation:!0}),clearTimeout(this.dismissCopyConfirmation),this.dismissCopyConfirmation=setTimeout((()=>{this.setState({showCopyConfirmation:!1})}),4e3)}onSelectInput(e){e.target.select()}render(){const e=(0,r.addQueryArgs)(this.props.postLink,{[c]:this.props.secretKey});return(0,t.createElement)("div",null,(0,t.createElement)("label",{htmlFor:"sppp-link-field",className:"screen-reader-text"},(0,o.__)("Share this URL","sharable-password-protected-posts")),(0,t.createElement)(s.Flex,{className:"sppp__link-copy"},(0,t.createElement)(s.TextControl,{id:"sppp-link-field",className:"sppp__link-field",readOnly:!0,label:(0,o.__)("Secret URL:","sharable-password-protected-posts"),value:(0,r.safeDecodeURIComponent)(e),onFocus:this.onSelectInput}),(0,t.createElement)(w,{text:e,onCopy:this.onCopy,className:"sppp__copy-button"},this.state.showCopyConfirmation?(0,o.__)("Copied!","sharable-password-protected-posts"):(0,o.__)("Copy","sharable-password-protected-posts"))))}}const m=(0,n.withSelect)((e=>{const{getEditedPostAttribute:t,getPermalink:s}=e(i.store);return{postLink:s(),secretKey:t("meta")[d]}}))(u),h=window.wp.coreData,y=({children:e})=>{const{isPostTypeVisible:t,postType:s,isPostPrivate:o}=(0,n.useSelect)((e=>{let t=!1;const s=e(i.store).getCurrentPostType(),o=e(h.store).getPostType(s),n=e(i.store).getEditedPostAttribute("link"),p=e(i.store).getEditedPostVisibility();return o?.viewable&&(t=!0),n&&(t=!0),e(i.store).getPermalinkParts()&&(t=!0),{isPostTypeVisible:t,postType:s,isPostPrivate:"private"===p||"password"===p}}),[]),p=window.sppp&&window.sppp.settings.postTypes.includes(s);return window.sppp&&window.sppp.settings.hasPermissions&&t&&p&&o?e:null};var _,E;const C=null!==(_=wp.editor?.PluginPostStatusInfo)&&void 0!==_?_:null!==(E=wp.editPost?.PluginPostStatusInfo)&&void 0!==E?E:wp.editSite?.PluginPostStatusInfo,{META_ENABLED:P,META_KEY:b}=l;(0,e.registerPlugin)("sharable-password-protected-posts",{render:()=>{const{sharingEnabled:e,existingKey:p}=(0,n.useSelect)((e=>{const{getEditedPostAttribute:t}=e(i.store),s=t("meta");return{sharingEnabled:s?.[P]||null,existingKey:s?.[b]||null}})),{editPost:r}=(0,n.useDispatch)(i.store);return(0,t.createElement)(C,{className:"sppp"},(0,t.createElement)(y,null,(0,t.createElement)("div",{className:"sppp__checkbox"},(0,t.createElement)(s.CheckboxControl,{label:(0,o.__)("Share post via secret URL","sharable-password-protected-posts"),checked:!!e,onChange:e=>{r(e?{meta:{[P]:!0,[b]:p||window.sppp.newKey||""}}:{meta:{[P]:!1,[b]:""}})}})),e&&(0,t.createElement)("div",{className:"sppp__link"},(0,t.createElement)(m,null))))}})})(); -
sharable-password-protected-posts/trunk/sharable-password-protected-posts.php
r2809749 r3145331 6 6 * Requires at least: 6.0 7 7 * Requires PHP: 7.4 8 * Version: 1. 0.28 * Version: 1.1.0 9 9 * Author: Fabian Todt 10 10 * Author URI: https://fabiantodt.at/en/ … … 40 40 ]; 41 41 42 $scriptDependencies = $assetsConfig['dependencies']; 43 // For WordPress < 6.6 the editor script depends on wp-edit-post (because of PluginPostStatusInfo) 44 // but the script is built against 6.6, therefore only requiring the wp-editor script. 45 require ABSPATH . WPINC . '/version.php'; 46 if(version_compare($wp_version, '6.6', '<')) { 47 $scriptDependencies[] = 'wp-edit-post'; 48 } 49 42 50 wp_enqueue_script( 43 51 'sppp', 44 52 plugin_dir_url(__FILE__) . 'build/index.js', 45 $ assetsConfig['dependencies'],53 $scriptDependencies, 46 54 $assetsConfig['version'] 47 55 ); -
sharable-password-protected-posts/trunk/src/PostStatusSettings/index.js
r2809716 r3145331 1 import { PluginPostStatusInfo } from "@wordpress/edit-post";2 1 import { CheckboxControl } from "@wordpress/components"; 3 2 import { __ } from "@wordpress/i18n"; … … 6 5 import CopyUrl from "./CopyUrl"; 7 6 import Check from "./Check"; 7 8 // Support < WP 6.6 and > WP 6.6 9 // See https://make.wordpress.org/core/2024/06/18/editor-unified-extensibility-apis-in-6-6/ 10 const PluginPostStatusInfo = wp.editor?.PluginPostStatusInfo ?? ( wp.editPost?.PluginPostStatusInfo ?? wp.editSite?.PluginPostStatusInfo ); 8 11 9 12 import CONSTANTS from "./constants"; … … 15 18 const { sharingEnabled, existingKey } = useSelect((select) => { 16 19 const { getEditedPostAttribute } = select(editorStore); 17 const meta = getEditedPostAttribute("meta"); 20 const meta = getEditedPostAttribute("meta"); // Will be undefined in site editor. 18 21 return { 19 sharingEnabled: meta [META_ENABLED],20 existingKey: meta [META_KEY],22 sharingEnabled: meta?.[META_ENABLED] || null, 23 existingKey: meta?.[META_KEY] || null, 21 24 }; 22 25 }); … … 40 43 <CheckboxControl 41 44 label={__("Share post via secret URL", "sharable-password-protected-posts")} 42 checked={ sharingEnabled}45 checked={!!sharingEnabled} // Cast to bool, so null value after changing and reloading state does not trigger uncontrolled input warning. 43 46 onChange={onChangeEnabled} 44 47 />
Note: See TracChangeset
for help on using the changeset viewer.