diff --git a/src/components/Block/DefaultView.jsx b/src/components/Block/DefaultView.jsx index 961ad8f..1b37330 100644 --- a/src/components/Block/DefaultView.jsx +++ b/src/components/Block/DefaultView.jsx @@ -7,7 +7,9 @@ import clipboardSVG from '@plone/volto/icons/copy.svg'; const CodeView = (props) => { const { data } = props; - const className = `code-block-wrapper ${data.style}`; + const { style, showLineNumbers, wrapLongLines } = data; + const styleWrap = wrapLongLines ? 'wrapLongLines' : ''; + const className = `code-block-wrapper ${style} ${styleWrap}`; const [copied, copy, setCopied] = useCopy(data.code); const copyText = () => { @@ -35,8 +37,8 @@ const CodeView = (props) => { {data.code} diff --git a/src/components/Block/DefaultView.stories.jsx b/src/components/Block/DefaultView.stories.jsx index a138074..08078bc 100644 --- a/src/components/Block/DefaultView.stories.jsx +++ b/src/components/Block/DefaultView.stories.jsx @@ -6,11 +6,13 @@ import Wrapper from '@plone/volto/storybook'; const codePython = 'import requests\nresp = requests.get("https://plone.org")\nassert resp.status_code == 200'; +const codeLongLines = '# Code to show how wrap long lines would work\n\ntext = "This is a really, really, really, really long line including a lot of words and letters and a text that should not make any sense, but should be long, very long"\n\nprint(text)' + const StoryComponent = injectIntl(({ children, ...args }) => { const { language, style, code, showLineNumbers, wrapLongLines } = args; return ( -
+
span { + display: block !important; + } + } + } + .hljs { padding: 10px; }