Why are we doing this?
We have the ability to tell if text in the editor has Wikitext syntax applied to it, so we would like to be able to give users the ability to toggle syntax on and off.
User story
As a user of syntax highlighting I would like the toggle behavior to feel natural and be useful to me
Questions
Do we want special cases for Headers and Indentations?
Scenarios
User has text highlighted
Scenario 1A: No syntax applied
- The user highlights a string that does not have any Wikisyntax applied to it
- The user taps on an option from the toolbar to apply Wikisyntax to the highlighted string
Expected result: the appropriate syntax is applied to the highlighted text
Scenario 1B: Syntax applied (full string)
- The user highlights a string that has Wikisyntax applied to it (eg. they have highlighted the entirety of '''this is a bolded string''')
- The associated toolbar icon is toggled to active (in this case Bold)
- The user taps on the active icon
Expected result: the appropriate syntax is removed from the highlighted text
Scenario 1C: Syntax applied (partial string)
- The user highlights a portion of a string that has Wikisyntax applied to it (eg. they have highlighted just the word bolded in the string '''this is a bolded string''')
- The associated toolbar icon is toggled to active (in this case Bold)
- The user taps on the active icon
Expected result: Just the word bolded is unbolded
(eg. the output is now '''this is a''' bolded '''string''')
Scenario 1D: Applying additional syntax
- The user highlights a string that has Wikisyntax applied to it (eg. they have highlighted part of or the entirety of '''this is a bolded string''')
- The associated toolbar icon is toggled to active (in this case Bold)
- The user taps on the toolbar icon of a non-active syntax toggle (eg. Italics)
Expected result: The string or portion of the string they highlighted is now both bold and italicized
User placed their cursor in the editing view but has not highlighted any text
Scenario 2A: User places cursor in an area that has no syntax applied to it
- User places their cursor in the editing view (either inside of a string or a space)
- User taps on a syntax button from the toolbar
Expected result: The appropriate syntax is input and the cursor is placed in the middle of the syntax (eg. for bold the result would be ''' [CURSOR PLACED HERE]'''
Scenario 2B: User places cursor in an area that has syntax applied to it, but doesn't highlight any text and taps the same syntax element
- User places their cursor in the editing view any where within the following string '''This is example text'''
- The associated toolbar icon is toggled to active (in this case Bold)
- The user taps on the Bold icon again
Expected result: The Bold icon is deactivated in that space and the bold syntax is closed only for the area where the cursor is placed.
(eg. the output could not be '''This is''' [CURSOR PLACED HERE] '''example text''')
Scenario 2C: User places cursor in an area that has syntax applied to it, but doesn't highlight any text and taps a different syntax element
- User places their cursor in the editing view any where within the following string '''This is example text'''
- The associated toolbar icon is toggled to active (in this case Bold)
- The user taps on the Italic icon
Expected result: The Bold icon is still active, the Italic icon is now active and the italics syntax is applied within the bold syntax
(eg. the output could not be '''This is ''[CURSOR PLACED HERE]'' example text''')
Scenario 2D: Deselecting after applying by any of the scenarios outlined in this section
- Pre-requisite of user following Scenario 2A, 2B, or 2C
- User taps on the syntax button they just applied again
Expected result: Syntax around the cursor is removed.