| 1 |
import { __ } from "@wordpress/i18n"; |
| 2 |
import { PanelBody } from "@wordpress/components"; |
| 3 |
import Editor from "@monaco-editor/react"; |
| 4 |
import { useDispatch, useSelect } from "@wordpress/data"; |
| 5 |
|
| 6 |
const CustomCss = () => { |
| 7 |
const customCss = useSelect((select) => select("smartpost/global-settings").getCustomCSS()); |
| 8 |
|
| 9 |
const { setCustomCSS } = useDispatch("smartpost/global-settings"); |
| 10 |
|
| 11 |
return ( |
| 12 |
<PanelBody title={__("Custom CSS", "post-carousel")} initialOpen={false}> |
| 13 |
<p className="sp-smart-post-component-title sp-smart-mb-5"> |
| 14 |
Use this area to add CSS and customize the page to your preference. |
| 15 |
</p> |
| 16 |
|
| 17 |
<Editor |
| 18 |
height="200px" |
| 19 |
defaultLanguage="css" |
| 20 |
theme="vs-dark" |
| 21 |
defaultValue="" |
| 22 |
value={customCss} |
| 23 |
onChange={(e) => setCustomCSS(e)} |
| 24 |
options={{ |
| 25 |
quickSuggestions: { |
| 26 |
other: "on", |
| 27 |
comments: "off", |
| 28 |
strings: "off", |
| 29 |
}, |
| 30 |
quickSuggestionsDelay: 10, |
| 31 |
minimap: { |
| 32 |
enabled: false, |
| 33 |
}, |
| 34 |
scrollbar: { |
| 35 |
vertical: "auto", |
| 36 |
horizontal: "auto", |
| 37 |
verticalScrollbarSize: 5, |
| 38 |
horizontalScrollbarSize: 5, |
| 39 |
scrollByPage: false, |
| 40 |
ignoreHorizontalScrollbarInContentHeight: false, |
| 41 |
}, |
| 42 |
lineNumbersMinChars: 1, |
| 43 |
folding: false, |
| 44 |
wordWrap: "on", |
| 45 |
}} |
| 46 |
/> |
| 47 |
</PanelBody> |
| 48 |
); |
| 49 |
}; |
| 50 |
|
| 51 |
export default CustomCss; |
| 52 |
|