With the Question Editor API, you can use the CKE (rich text editor) plugin, 'underlined indicator' - a feature for adding underlined indicators to text in passages.
Try out the plugin in the demo.
Overview
The underlined indicator is designed to be used with a text passage. It allows part of a text passage to be underlined, and have a indicator, e.g. "Q1" placed below. This indicator can then be be referred to by the stimulus of a Question, in order to ask questions specific to the part of the underlined text.
The indicator:
- Can contain any characters, and must be between one and three characters in length.
- Can be applied to a single character, or multiple sentences spanning several lines (wrapping is supported).
An example is below:
Use cases
The primary use case is only for "normal" text. This text may also contain an inline style.
The following is not supported:
- Other block style formats like H1,
- Widgets e.g. Math, or
- Embedded images or videos.
Adding an underlined indicator
When adding an underlined indicator, the following occurs:
- The highlighted text, or the word the cursor is in, is underlined and your indicator is added to the bottom left of the text,
- The line spacing is doubled for the entire field, and
- In the edit panel of Author API, when clicking on the underlined text or the indicator, a popover will appear. This allows you to edit or remove the indicator.
To add an underlined undicator:
- Target some text, using one of the ways below:
- Highlight a single word,
- Highlight multiple words,
- Highlight part of a word, or
- Place the cursor at the start, middle, or end of a word.
- Then, click on the underlined indicator button on the CKEditor toolbar, indicated below (red outline):
Screenshot 2: The underlined indicator button on the CKEditor toolbar (red outline).
Removing an underlined indicator
When removing an underlined indicator, the following occurs:
- The highlighted text should have the underlined indicator removed, and
- The double line spacing is removed from the field if there are no other indicators.
To remove an underlined indicator, use one of the ways below:
- Click on the word or the indicator to bring up the popover, then click "Remove":
Screenshot 3: The underlined indicator popover window, 'remove' button.
- Place cursor at end of word and press the backspace key,
- Place cursor at start of word and press the delete key,
- Highlight part or all of the indicator, then click the "Remove Format" button, or
- Highlight some text, including the indicator, and type to overwrite (i.e. replacing it).
Editing an underlined indicator
Editing the indicator value
- Click on the word or the indicator to bring up the popover, then click "Edit":
Screenshot 4: The underlined indicator popover window, 'edit' button.
- Place cursor at the start, middle or end of the word, then click on the underlined indicator button on the CKE toolbar,
- Highlight the existing word, then click the underlined indicator button on the CKE bar, or
- Highlight the existing word, then click the word, to bring up the popover, then click "Edit".
Editing the text the indicator is applied to
To extend the selection:- Highlight the new text.
- Click the indicator button on the CKE toolbar.
- Enter the same indicator.
- Click "OK". The old indicator will be removed and replaced.
- Highlight a part of the existing indicated text.
- Click the "Remove Format" button on the CKE toolbar.
- The indicator will stay, but it will be removed from that part of the text.