User functionality help wanted!
The WYSIWYG has a big limitation. It is hard to decide how and where to end a BBCode tag that allows having itself inside.
E.g:
Tags such as
b and
i do not allow themselves as child of themselves, so knowing if, by pressing the button, the formatting should be added or removed is trivial.
On the other hand,
Tags such as
[ quote]
and
[ list]
allow stacking inside their own, so pressing the command button is ambiguous if the user means to stack more, for example,
[ quote]
tags instead of breaking it at that point.
I need suggestions on solutions to this problem.
IMO, the best way appears to be by detecting the
Shift
key while the button is pressed. Doing
Shift+click
forces the removal of 1 level of that specific tag's at cursor selection.
If I was not clear, think this example below.
Assume you have this quote:
author wrote:
top text
below text
Place the mouse after "top text" and press the
quote
button while keeping the
Shift
key pressed. That transforms the quote into:
author wrote:
top text
|
author wrote:
below text
If you select "below" while doing the combo, however, the result is:
author wrote:
top text
below
author wrote:
text
Is it a good idea? Do you have any alternatives that work for any block BBCode?
Regardless if it, though, there can be custom solutions for specific BBCode.