Closed caffodian closed 7 years ago
However, storing the extra invisible element would allow for presets to more easily change
idea:
assert all headings of the same level have the same bullet styling class
candidate_presets = copy(all_presets)
for all heading levels:
for all candidate_presets
if the candidate preset's bullet doesn't match the current heading level's bullet, remove it from candidates
if one candidate remains:
return it
return one of the few remaining candidates (somehow we didn't have enough information to determine which one it should be)
with the default settings, we should never need to go past the first heading level, since all the first levels differ
the ultimate worst one would be if all presets only differed on the 5th level
Ideally this function should be exposed on the plugin, this will make for less bad testing.
Updating things in place is annoying
boo @ sketchy set support in IE11 as well
Something that sucks kinda, is we'll always have 1.1.1.1.1. to fall back on if we can't detect something.
The default case also sucks because it never gets removed. This is why even on sets where we actually detect correctly, the "return first" idea doesn't wokr
So after fixing some bad mixups due to my unpolished variable naming, we actually run into the issue I hypothesized above, which is that we shouldn't consider "1.1.1.1.1." as a candidate until all others are exhausted
Figure out what the current preset should be, based on the headings already in the document.
Alternately, we could add an extra invisible element that stores the preset, but that seems annoying to everything we've already done.