I have a markdown object with a binding script that looks like this:
return """<div
onmousemove="
view = [...window.__client.page.views._data.values()].find(view => view.value.mountPath == this.parentNode.parentNode.parentNode.parentNode.getAttributeNode('data-component-path').value.split('.')[0]).value;
rect = this.getBoundingClientRect();
view.params.write('fromTop', event.clientY - rect.top);
view.params.write('fromBottom', rect.bottom - event.clientY);
view.params.write('fromLeft', event.clientX - rect.left);
view.params.write('fromRight', rect.right - event.clientX);
view.params.write('width', rect.width);
view.params.write('height', rect.height);
"
style="display: block; position: fixed; inset: 0;">
</div>""".replace("\n", " ").replace("\t", "")
I found that view = ...
line on a different project that I scavenge for this. In the designer, on the view itself, this seems to work fine, but when I try to embed the view into another, it writes to that view's view.params
instead. I don't want that. I want it to only write to the view.params
of the view that it is in. I don't know anything about this 'view.value.mountPath' thing, but when I try to not include the .split('.')[0]
part at the end, it throws an error.