1
0
Fork 0

feat(lab): Paperless and render settings

This commit is contained in:
Joost De Cock 2022-01-28 13:39:07 +01:00
parent 21d1d15e53
commit 18f9e93cc0
9 changed files with 269 additions and 55 deletions

View file

@ -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}>

View file

@ -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(/&quot;/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>
)