PluginProbe
CryptX / trunk
CryptX vtrunk
4.2.0 4.1.1 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.9 2.0 2.1 2.2 2.3 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 All 92 releases
cryptx / src / index.js

index.js in CryptX trunk, at src/index.js

43 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * The CryptX settings screen.
3 *
4 * Everything this file knows about the options comes from the schema the REST
5 * route hands over. Adding an option means adding it to SettingsSchema.php --
6 * there is deliberately no second list of fields here that could fall behind.
7 */
8
9 import { createRoot, StrictMode } from '@wordpress/element';
10 import { __ } from '@wordpress/i18n';
11
12 import App from './components/App';
13 import './index.css';
14
15 document.addEventListener( 'DOMContentLoaded', () => {
16 const container = document.getElementById( 'cryptx-settings-root' );
17
18 if ( ! container ) {
19 return;
20 }
21
22 // The container carries the "loading" fallback that PHP printed. Clearing
23 // it here rather than in PHP means the fallback stays visible for people
24 // whose browser never gets this far.
25 container.textContent = '';
26 container.setAttribute( 'aria-busy', 'false' );
27 container.setAttribute( 'aria-label', __( 'CryptX settings', 'cryptx' ) );
28
29 // Two screens, one application. The site screen edits this site; the
30 // network screen edits what a newly created site starts with. PHP says
31 // which, because PHP is what knows which menu entry was opened.
32 const scope =
33 container.getAttribute( 'data-cryptx-scope' ) === 'network'
34 ? 'network'
35 : 'site';
36
37 createRoot( container ).render(
38 <StrictMode>
39 <App scope={ scope } />
40 </StrictMode>
41 );
42 } );
43