Happy New Year! To make room for all of the things you have going on at this time of year, we have a short but sweet issue for you. This month, we’ll share with you what we’ve been doing to retire the content sink in our note components.
The content sink has served us well and allowed us to create dynamic text in our activities. But now with the ability to format text, we need to find ways to make our notes dynamic while also taking advantage of text formatting. To address all of your needs, we’ll show how to update two types of content that you can use in combination with one another.
Case 1: Updating Short Strings in a Complete Note
What We Used to Do:
- Create a content sink, and within that content sink, interpolate the values we want by wrapping a
source in ${ }.
Why We Don’t Like It:
- We can’t format any of the text if we use the content sink.
- In order to see what the note will look like, we need to preview the whole screen.
What We Do Now:
- Create variables in the note component for everything you want to use in the note. You can name
your variables anything (well, almost); you just need to follow the name with an equal sign so that
CL knows its a variable and not a sink.
- In the note component, type out everything you want to appear in the note. Then in the places
where you want the variables to go, press the {#} button or type ${ on the keyboard). A menu will
pop up with a list of the variables we can place there.
- BONUS: You can format the text in the note, including the text you are interpolating! Click on the interpolated variable to highlight it, then format it using the menu at the bottom of the note.
Case 2: Displaying a Whole or Large Part of a Note Conditionally
What We Used to Do:
- Use a content sink and conditionally switch between two large blocks of text.
Why We Don’t Like It:
- It can be difficult to format large blocks of text in CL script. And longer strings that wrap nicely in a note can make your code messy and tough to decipher.
- There’s no way to format the text using the content sink.
- For special formatting, special commands need to be used.
What We Do Now:
- Use a second note and add a hidden sink to it so that it doesn’t show unless it’s needed.
- Type the text as you want it to appear in each note and format them as desired.
We love this new way of creating dynamic text because it’s much easier to make and track changes during authoring, the text shows up in screen tiles in the dashboard and on the activity landing page, and we can add formatting to notes with dynamic text, not to mention the cool fade-in we get when we use the hidden sink method.
You’ll most likely need a combination of interpolation and the hidden sink to create the notes you want. It may feel slow at first, but stick with it! While it took us a while to get used to it, we’ve found it to be a huge advantage and a time saver once we got the hang of it. If you get stuck, this page is a great reference. You can also get there by clicking on the “Learn More” icon (?) in the note component. You can also see the before and after screens from this newsletter here.