Skip to content

feat: allow embedded ReadAlong in <read-along> element#203

Merged
dhdaines merged 3 commits intomainfrom
dev.embedded-ras
Oct 5, 2023
Merged

feat: allow embedded ReadAlong in <read-along> element#203
dhdaines merged 3 commits intomainfrom
dev.embedded-ras

Conversation

@dhdaines
Copy link
Copy Markdown
Collaborator

@dhdaines dhdaines commented Apr 3, 2023

Small caveat, you must use the <text> element to enclose it even though this is optional for standalone ReadAlong files.

This was surprisingly easy, the only quirk is that it gets parsed as HTML rather than XML, so the nodeName property is uppercase for everything inside it.

@joanise
Copy link
Copy Markdown
Member

joanise commented Apr 4, 2023

Nice and simple, and I like the resulting format, and I'm impressed at how easy it was to support.

We will have to document somewhere that the <read-along> element can take an href attribute pointing to a .readalong file or or <text> child.

Am I right in assuming that <text> can be at any depth, through that querySelector call? That seems like too much freedom to me, I'd restrict it to having a child <text> element rather than arbitrarily searching. I don't know if I'm being overly picky, though, My two opposing questions: a) is there a use case for allowing it deeper? and b) is there any risk in allowing it deeper?

If there's no risk, then it doesn't matter and we can keep it this way, but in the documentation I would only mention the child node syntax unless and until there was a use case.

@dhdaines
Copy link
Copy Markdown
Collaborator Author

We will have to document somewhere that the <read-along> element can take an href attribute pointing to a .readalong file or or <text> child.

Yes, I guess this should go in the web component documentation?

Am I right in assuming that <text> can be at any depth, through that querySelector call? That seems like too much freedom to me, I'd restrict it to having a child <text> element rather than arbitrarily searching.

Yes, this makes sense, I've updated it to just do that!

@dhdaines
Copy link
Copy Markdown
Collaborator Author

I've also updated the Studio-Web application to embed the ReadAlong in the downloaded stand-alone HTML, to facilitate manual editing.

It's still encoded as base64 for the actual component in the Angular application, because just inserting it into the component is one of these seemly obvious things (like, I just want to add things to a DOM element!!!) that is impossibly difficult to figure out how to do in Angular. Maybe ChatGPT can do it for me.

Small caveat, you *must* use the <text> element to enclose it even though this
is optional for standalone ReadAlong files.
@dhdaines dhdaines force-pushed the dev.embedded-ras branch 2 times, most recently from 1b53dc0 to 44f6ce8 Compare October 5, 2023 04:10
@dhdaines
Copy link
Copy Markdown
Collaborator Author

dhdaines commented Oct 5, 2023

Hi - I modified this slightly so that it merely accepts the embedded ReadAlong in the web component, since there is maybe limited value in having the alignments expanded out in the all-in-one HTML download.

I also bumped the minor version number of the web component as this is a significant new feature that other code may want to depend on.

@dhdaines dhdaines merged commit b09f89b into main Oct 5, 2023
@dhdaines dhdaines deleted the dev.embedded-ras branch October 5, 2023 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants