0 votes
by (350 points)
edited by

I'm using Custom Styles with the TypedJS SugarCube integration. I find that passages I <<include>>d don't trigger the TypedJS's typing.

Is there a way to make TypedJS work inside passages being included?

Here's a couple of passages to illustrate.

:: 0010
@@.typed-speed10;Here's 0011@@
<<linkreplace "show it">><<include "0011">><</linkreplace>>

:: 0011
@@.typed-speed10;Here's 0010@@
<<linkreplace "show it">><<include "0010">><</linkreplace>>


2 Answers

0 votes
by (63.1k points)
Custom styles can't be nested, so I imagine that's the problem. Without seeing any of your code though, all anyone can do is speculate.
by (350 points)
I suppose it's because I have the include inside a linkreplace. I added some code to my question to illustrate.
0 votes
by (159k points)

The Typed.js integration module uses a postrender task and postdisplay task to execute the code required to produce the Typewriter effect for the marked content of the current Passage (and any child passage directly referenced) being processed by the Passage Transition process.

Passage content that is dynamically injected after the current Passage Transition process has finished, like that of you <<linkreplace>> + <<include>> combination, does not cause the above mentioned tasks to be executed again.

This is why the Typewriter effect does not happen for your dynamically injected content.

by (350 points)
AH, yeah, I knew it was something about the Passage being 'done' somehow.

Is it possible to trigger (or re-trigger) the postrender/postdisplay tasks execute the Typewriter code for the injected content? Maybe even a Macro that would run the task, having the Passage name as parameter?