2023-09-29 16:01:27 +02:00
|
|
|
// __SDEFILE__ - This file is a dependency for the stand-alone environment
|
2023-06-02 18:21:40 +02:00
|
|
|
import { PanZoomPattern as ShowPattern } from 'shared/components/workbench/pan-zoom-pattern.mjs'
|
2023-05-13 14:17:47 +02:00
|
|
|
import { DraftMenu, ns as menuNs } from './menu.mjs'
|
2023-09-07 10:29:19 +02:00
|
|
|
import { PatternWithMenu } from '../pattern-with-menu.mjs'
|
|
|
|
import { DraftHeader, ns as headerNs } from './header.mjs'
|
2023-05-11 19:14:48 +02:00
|
|
|
|
2023-09-07 10:29:19 +02:00
|
|
|
export const ns = [...menuNs, ...headerNs]
|
2023-05-13 14:17:47 +02:00
|
|
|
|
|
|
|
export const DraftView = ({
|
|
|
|
design,
|
|
|
|
pattern,
|
|
|
|
patternConfig,
|
|
|
|
settings,
|
2023-06-21 22:14:57 -05:00
|
|
|
setSettings,
|
2023-05-13 14:17:47 +02:00
|
|
|
ui,
|
|
|
|
update,
|
|
|
|
language,
|
|
|
|
account,
|
2023-05-18 15:25:40 +02:00
|
|
|
DynamicDocs,
|
2023-06-10 20:33:34 +02:00
|
|
|
setView,
|
|
|
|
view,
|
2023-09-27 12:04:26 +02:00
|
|
|
saveAs,
|
2023-06-01 17:01:48 +02:00
|
|
|
}) => {
|
|
|
|
let output = null
|
2023-06-05 19:16:53 +02:00
|
|
|
let renderProps = false
|
2023-06-01 17:01:48 +02:00
|
|
|
if (ui.renderer === 'svg') {
|
|
|
|
try {
|
|
|
|
const __html = pattern.render()
|
2023-06-24 15:00:46 -05:00
|
|
|
output = (
|
|
|
|
<ShowPattern>
|
|
|
|
<div className="w-full h-full" dangerouslySetInnerHTML={{ __html }} />
|
|
|
|
</ShowPattern>
|
|
|
|
)
|
2023-06-01 17:01:48 +02:00
|
|
|
} catch (err) {
|
|
|
|
console.log(err)
|
|
|
|
}
|
2023-06-02 18:21:40 +02:00
|
|
|
} else {
|
2023-06-05 19:16:53 +02:00
|
|
|
renderProps = pattern.getRenderProps()
|
2023-06-15 09:23:49 +02:00
|
|
|
output = <ShowPattern {...{ renderProps }} />
|
2023-06-02 18:21:40 +02:00
|
|
|
}
|
2023-06-01 17:01:48 +02:00
|
|
|
|
|
|
|
return (
|
2023-06-23 17:45:50 -05:00
|
|
|
<PatternWithMenu
|
|
|
|
{...{
|
|
|
|
settings,
|
|
|
|
ui,
|
|
|
|
update,
|
|
|
|
control: account.control,
|
2023-08-28 16:55:23 +02:00
|
|
|
account,
|
|
|
|
design,
|
2023-06-23 17:45:50 -05:00
|
|
|
pattern: output,
|
|
|
|
setSettings,
|
2023-09-27 12:04:26 +02:00
|
|
|
saveAs,
|
2023-09-07 10:29:19 +02:00
|
|
|
Header: DraftHeader,
|
2023-06-23 17:45:50 -05:00
|
|
|
menu: (
|
|
|
|
<DraftMenu
|
|
|
|
{...{
|
|
|
|
design,
|
|
|
|
pattern,
|
|
|
|
patternConfig,
|
2023-06-26 11:41:56 -05:00
|
|
|
setSettings,
|
2023-06-23 17:45:50 -05:00
|
|
|
settings,
|
|
|
|
ui,
|
|
|
|
update,
|
|
|
|
language,
|
|
|
|
account,
|
|
|
|
DynamicDocs,
|
|
|
|
renderProps,
|
|
|
|
view,
|
|
|
|
setView,
|
2023-09-09 15:31:53 +02:00
|
|
|
flags: pattern.setStores?.[0]?.plugins?.['plugin-annotations']?.flags,
|
2023-06-23 17:45:50 -05:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
}}
|
|
|
|
/>
|
2023-06-01 17:01:48 +02:00
|
|
|
)
|
|
|
|
}
|