feat(lab): Paperless and render settings
This commit is contained in:
parent
21d1d15e53
commit
18f9e93cc0
9 changed files with 269 additions and 55 deletions
|
@ -2,11 +2,17 @@ import React, { useState } from 'react'
|
|||
import Svg from './svg'
|
||||
import Defs from './defs'
|
||||
import Part from './part'
|
||||
import theme from 'pkgs/plugin-theme/src/index.js'
|
||||
|
||||
const LabDraft = ({ app, pattern, gist, updateGist }) => {
|
||||
|
||||
const patternInstance = new pattern(gist).draft()
|
||||
const patternProps = patternInstance.getRenderProps()
|
||||
const patternInstance = new pattern(gist)
|
||||
if (gist?.renderer === 'svg') return <div
|
||||
dangerouslySetInnerHTML={{ __html: patternInstance.use(theme).draft().render()}} />
|
||||
|
||||
const patternProps = patternInstance.draft().getRenderProps()
|
||||
console.log(patternProps)
|
||||
|
||||
|
||||
return (
|
||||
<Svg {...patternProps}>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const TextOnPath = (props) => {
|
||||
const text = []
|
||||
// Handle translation
|
||||
// Handle translation (and spaces)
|
||||
let translated = ''
|
||||
for (let string of props.path.attributes.getAsArray('data-text')) {
|
||||
translated += props.app.t(string, false, props.locale).replace(/"/g, '"') + ' '
|
||||
|
@ -16,7 +16,10 @@ const TextOnPath = (props) => {
|
|||
return (
|
||||
<text>
|
||||
<textPath {...textPathProps}>
|
||||
<tspan {...props.path.attributes.asPropsIfPrefixIs('data-text-')}>{translated}</tspan>
|
||||
<tspan
|
||||
{...props.path.attributes.asPropsIfPrefixIs('data-text-')}
|
||||
dangerouslySetInnerHTML={{__html: translated}}
|
||||
/>
|
||||
</textPath>
|
||||
</text>
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue