mediawiki-extensions-CodeMi.../resources/ve-cm
MusikAnimal 2ad096a580 ve.ui.CodeMirrorAction.v6: use infinity viewport to avoid misalignment
The 2017 editor has an infinite viewport, meaning the entire document is
printed on page load. CodeMirror 6 meanwhile only processes text in the
visible viewport. This presents a situation where if large chunks of
text are inserted outside the visible range (such as the "Changes
recovered" feature of VE), it can cause misalignment of the VE surface
and visible CodeMirror layer, as CodeMirror has not accounted for the
off-screen lines of text.

CodeMirror 5 had a `viewportMargin: infinity` option that prevented this
issue, but at the cost of performance. CodeMirror 6 removed this option,
but the same effect can be achieved by tricking CodeMirror into thinking
we're printing the document, in which case it will process all lines.
This seriously hurts performance, and is a nasty hack, but until the
2017 editor is reworked to have a viewport, there may be no other means
to prevent the misalignment.

The discovery of this issue and the fix are courtesy of Fandom engineers

Bug: T357482
Change-Id: If11ce48459e8faf55015108e8c2eabdc16e0d917
2024-08-20 14:08:04 -04:00
..
ve.ui.CodeMirror.init.js CodeMirror 6 for VE 2017 wikitext editor 2024-08-01 03:15:21 -04:00
ve.ui.CodeMirror.v6.less CodeMirror 6 for VE 2017 wikitext editor 2024-08-01 03:15:21 -04:00
ve.ui.CodeMirrorAction.v6.js ve.ui.CodeMirrorAction.v6: use infinity viewport to avoid misalignment 2024-08-20 14:08:04 -04:00
ve.ui.CodeMirrorTool.v6.js CodeMirror 6 for VE 2017 wikitext editor 2024-08-01 03:15:21 -04:00