Allow modes to specify their own flattenSpans option

And use the editor-wide option when no value is found on the mode.

Issue #1281