Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I don't want to 'pollute' my Fusion with ${Editable.attributes(...)} #1

Open
mhsdesign opened this issue Oct 3, 2021 · 0 comments
Open

Comments

@mhsdesign
Copy link
Owner

jup - but i didn't found a better way to handle this than using an explicit Eel helper. I took a similar approach like the Neos.Neos:Editable Fusion object, which will also render some extra markup into your HTML.

The issue is, that you need to insert something into the markup of the HTML element to make the frontend understand what to change and how to change it.

One can't simply search the server rendered HTML for the value of the node property, since the value could be transformed.
For example this - the client will only now that newVal is false or true but not what to change. With a clientEval or a custom changer, this becomes possible:

// boolean border
border = ${q(node).property('border')}

borderChange = ${Editable.attributes(node, 'border', 'clientEval', '
    if (newVal === true) {
        el.classList.add('border-2', 'border-red')
    } else {
        el.classList.remove('border-2', 'border-red')
    }
')}

renderer = afx`
    <div {...props.borderChange} class={props.border ? 'border-2 border-red' : null}></div>
`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant