1function outlineShowOptions(props) { 2 const { Button, ButtonGroup } = this.components; 3 const { __ } = wp.i18n; 4 5 let currentValue = props.metaValue; 6 const outlineShowValue = props.outlineShowState; 7 8 if (currentValue === undefined) { 9 currentValue = 'hover'; 10 } 11 12 // if state value is set then use it. This will disable control UI flickering 13 if (outlineShowValue !== undefined && outlineShowValue !== '') { 14 currentValue = outlineShowValue; 15 } 16 17 const outlineShowOptionList = [ 18 { key: 'hover', name: __('Hover') }, 19 { key: 'always', name: __('Always') }, 20 { key: 'never', name: __('Disable') }, 21 ]; 22 23 return this.el( 24 ButtonGroup, 25 null, 26 outlineShowOptionList.map(({ name, key }) => { 27 const elProperties = { 28 key: key, 29 variant: 'secondary', 30 isTertiary: currentValue !== key, 31 isPrimary: currentValue === key, 32 isPressed: currentValue === key, 33 onClick: () => { 34 // Update state to update control ui 35 props.setState({ 36 outlineShowState: key, 37 }); 38 39 // Update editor ui 40 const body = getDocumentBody(); 41 body.attr('show-outline', key); 42 43 // update meta 44 this.debounce(() => { 45 props.setMetaValue(key); 46 })(); 47 }, 48 }; 49 50 return this.el(Button, elProperties, name); 51 }) 52 ); 53}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.