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

Embedding non-XML views in Picto #14

Closed
kolovos opened this issue Nov 29, 2022 · 1 comment · Fixed by #15
Closed

Embedding non-XML views in Picto #14

kolovos opened this issue Nov 29, 2022 · 1 comment · Fixed by #15
Assignees
Labels
bug Something isn't working
Milestone

Comments

@kolovos
Copy link
Contributor

kolovos commented Nov 29, 2022

Trying to embed views which are not valid XML in other Picto views fails at the moment as reported in this forum post. A minimal example with a standalone Picto file and two custom HTML views follows.

<!--example.picto-->
<?nsuri picto?>
<picto standalone="true">
	<view path="Root, View1" format="html" source="view1.html"/>
	<view path="Root, View2" format="html" source="view2.html"/>
</picto>
<!--view1.html-->
View 1
<!--view2.html-->
<html>
<h1>View 2</h1>
<picto-view path="Root, View1"/>
</html>

Trying to render Root/View2 produces a Content is not allowed in prolog. error message in Picto because view1.html is not valid XML.

To fix this we could try to parse the content of the view to embed as XML and if this fails, put it in an iframe instead.

It would also be nice to support a custom iframe attribute in <picto-view> elements to allow the user to force an iframe (e.g. if the other view is XHTML but the user doesn’t want its CSS/JavaScript to mess up the host page’s style/functionality).

@alfonsodelavega alfonsodelavega self-assigned this Nov 29, 2022
@alfonsodelavega
Copy link
Member

I have found a solution that also solves an extra problem with iframes: detecting the proper height and width of the contents.

Using the iFrame Resizer library, it's possible to fix iframe weight at 100% and then determine the height of the contents after rendering (example).

This library requires adding a js file to the upper html, and another js file to the inner one (i.e. the one contained in the iframe). Would this last part be much of a hussle?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants