Commit graph

96 commits

Author SHA1 Message Date
bhsd 197b5649ff CodeMirrorModeMediaWiki: autocompletion
Autocomplete magic words, tag names and url protocols. This patch also enables block comment using `<!-- -->`.

Bug: T95100
Change-Id: If37da956ac1eb945b96753e6728c0247b1a68b66
2024-11-19 16:02:35 +08:00
MusikAnimal 13c9eae26e CodeMirrorPreferences: add panel to tweak prefs with the editor open
This is toggled by pressing Mod-Shift-, (or Command-Shift-, on MacOS),
which then puts focus on the preferences panel. It can be closed with
the Escape key, just like other CM panels.

The CodeMirror class comes with these extension which can be toggled in
preferences:
* Bracket matching
* Line numbering
* Line wrapping
* Highlight the active line
* Show special characters

Only bracket matching, line numbering, and line wrapping are available
in the 2017 editor.

The bidi isolation and template folding extensions are registered in
CodeMirrorModeMediaWiki as they are MW-specific. CodeMirrorPreferences'
new registerExtension() method allows any consumer of CodeMirror to add
any arbitrary extensions to the preferences panel. This is expected to
be called *after* CodeMirror has finished initializing. The
'ext.CodeMirror.ready' hook now passes the CodeMirror instance to
accommodate this.

The preferences are stored as a single user option in the database,
called 'codemirror-preferences'. The defaults can be configured with the
$wgCodeMirrorDefaultPreferences configuration setting. The
sysadmin-facing values are the familiar boolean, but since CodeMirror is
widely used, we make extra efforts to reduce the storage footprint (see
T54777). This includes only storing preferences that differ from the
defaults, and using binary representation instead of boolean values,
since the user option is stored as a string.

For now, all preferences are ignored in the 2017 editor. In a future
patch, we may add some as toggleable Tools in the VE toolbar.

Other changes:
* Refactor CSS to use a .darkmode() mixin
* Add a method to create a CSS-only fieldset in CodeMirrorPanel
* Fix Jest tests now that there are more calls to mw.user.options.get()
* Adjust Selenium tests to always use CM6
* Adjust Selenium tests to delete test pages (useful for local dev)
* Remove unused code

Bug: T359498
Change-Id: I70dcf2f49418cea632c452c1266440effad634f3
2024-11-18 22:23:22 -05:00
jenkins-bot 140ac0cdb0 Merge "CodeMirrorSearch: add num results and current selection; improve tabbing" 2024-11-01 05:52:50 +00:00
MusikAnimal 3c3050447b CodeMirrorSearch: add num results and current selection; improve tabbing
Just like the 2017 editor, we show the number of results and which one
is currently highlighted.

This patch also brings the Tab behaviour closer to the 2017 editor.
Hitting Tab from the search input focuses the replace input, followed by
the replacement buttons, then the find buttons, then the content
editable. Shift+Tab largely does the reverse, except Shift+Tab from the
editor doesn't bring you to the search panel. Doing this would require a
lot of work for minor benefit, as we'd need to determine which panel to
focus to.

Add basic unit test

Bug: T371436
Change-Id: I968f91320ecb6ab9e9da0994052d33c76f85974b
2024-10-31 18:25:05 -04:00
jenkins-bot cac24f0fa6 Merge "selenium: Delete 'CodeMirror bracket match highlighting for the wikitext 2017 editor'" 2024-10-31 17:47:06 +00:00
Umherirrender 75428fa046 Use namespaced classes
Changes to the use statements done automatically via script

Change-Id: Ic474721ccdb77614f46b0237251927e04b2f183d
2024-10-19 23:29:39 +02:00
Željko Filipin 37159fdae4 selenium: Delete 'CodeMirror bracket match highlighting for the wikitext 2017 editor'
The entire file was disabled more that 6 months ago.

Bug: T280652
Change-Id: I4fe43a15a35c51c3d84ab4061dff579f4f00fdc3
2024-10-15 12:01:48 +02:00
jenkins-bot a32d8005ea Merge "Remove $wgCodeMirrorRTL as redundant config setting" 2024-09-19 17:09:17 +00:00
thiemowmde f5a5598ba4 Make use of upstream markTestSkippedIfExtensionNotLoaded
This does the same as before.

Also:
* Make use of more fitting ??= operator.
* We can use & for union types, I believe.

Change-Id: I359408473882a9337b40ec464562a4358f8d3241
2024-09-13 12:38:53 +02:00
MusikAnimal b27c9843b5 Remove $wgCodeMirrorRTL as redundant config setting
This was introduced in Iac30ffe274 to control the rollout of CM6 to RTL
wikis separately from LTR wikis because of various bugs. While RTL still
isn't perfect, it is stable enough now (hewiki has not complained) and
the 2017 editor is also fully supported. Thus, we no longer need this
feature flag.

Bug: T170001
Change-Id: Ia439527aaab07644b358cedf9603cd9d148b6608
2024-08-30 22:03:07 +00:00
MusikAnimal 81ec0c292a Implement dark mode styles and use Codex CSS components in search panel
Use Codex design tokens where possible, and implement custom dark
theming for things for which there is no suitable design token.
This means we're changing the colors for light mode ever so slightly.

We need to style the search panel for dark mode, so we might as well
tackle T371436 and use CSS-only Codex components. The same is done for
the "Go to line" panel (can be opened with Mod+Alt+g). The messages in
this panel are now also localizable.

The search panel (and goto line panel) are abstracted, with helpers to
create the Codex components. These will not only be used here but also
for the upcoming preferences panel (T359498).

Visually, the search and goto panels were inspired by the 2017 editor
and share a similar layout. CodeMirror similarly uses a more compact
design than usual to maximize the real estate of the editor itself.

Other changes:
* Bump codemirror/search to get latest bug fixes
* Remove stylelint ignorance and fix errors
* Move CM5 styles to ext.CodeMirror.less
* Move CM-specific styles out of mediawiki.less and into codemirror.less
* Move WikiEditor-specific styles to codemirror.wikieditor.less
  (incidentally, these only apply to CodeMirror 6)
* Correct qqq documentation; the "dialog" should be called a "panel"
* extension.json: alphabetize list of messages

Bug: T365311
Bug: T371436
Bug: T359498
Change-Id: I6a3bbc6bce4e490886753ff484e377c1763de456
2024-08-29 18:59:57 -04:00
jenkins-bot 05db91241d Merge "CodeMirrorModeMediaWiki: indented table" 2024-08-21 21:09:48 +00:00
jenkins-bot 0b52e3b125 Merge "selenium: Document when, how and why a test is skipped" 2024-08-21 09:57:58 +00:00
John Bolorinos 608c799aa8 selenium: Document when, how and why a test is skipped
Bug: T280652
Change-Id: I065c6ff4f50626904fde2d3e676c4b71d62c43e0
2024-08-19 15:02:18 +02:00
bhsd f23f487028 CodeMirrorModeMediaWiki: indented table
This is a follow-up of the patch 1032770, which misses one type of indented table in the test. It also specifies a unified `cm-mw-indenting` CSS class for all types of table indentation.

Bug: T108454
Change-Id: I77174cf3fa56382add6d80bf2ec7106c9b2cb642
2024-08-15 12:59:13 +08:00
jenkins-bot 75710d6d05 Merge "CodeMirrorModeMediaWiki: various small fixes" 2024-08-15 03:10:01 +00:00
bhsd 925775778a CodeMirror 6 for VE 2017 wikitext editor
Add new temporary ext.CodeMirror.visualEditor.init RL module which
selects the temporary ext.CodeMirror.visualEditor.v6 or non-v6 based on
$wgCodeMirrorV6. This will allow us to deploy CM6 further.

As a result of this work, the core CodeMirror class now has knowledge
of ve.ui.Surface.

Other changes:
* Add Compartment for specialCharsExtension so it can be disabled in VE.
* Add option to mediaWikiLang() to disable template folding.
* Add support for RTL wikis where $wgCodeMirrorRTL is enabled.
* Make CodeMirror.logUsage() and setCodeMirrorPreference() static.
* Fix unit and linting tests.

Some code courtesy of Fandom, GPLv2-or-later; see:
https://github.com/Wikia/mediawiki-extensions-CodeMirror/commit/ef297c48c

Bug: T357482
Change-Id: I15453b33e77e1c1b4d5e5183e41e53d56ff14c3e
2024-08-01 03:15:21 -04:00
bhsd 8ba52cdfcb CodeMirrorModeMediaWiki: various small fixes
This patch fixes a few minor issues in the tokenizer, including indented table (T108454), tag name followed by punctuations (T357720), free external link ending with `~` and `'` (T358643), and Hebrew parser function containing whitespace (T170004).

Bug: T108454
Bug: T357720
Bug: T358643
Bug: T170004
Change-Id: Ib3fff9ea8f9045d885ecfb1dc58c72f5afb8877a
2024-08-01 02:03:17 -04:00
MusikAnimal 7d3482f89e Isolate build step to CM6 library and restructure files to work with RL
CodeMirror 6 requires the use of NPM, but we can still bundle all CM
packages into one file, and then everything else (i.e. our code) is
managed by ResourceLoader as per usual. This makes contribution
considerably easier as we no longer need a build step for each change.

CM5 files are now under resources/legacy, and the CM6 files are moved to
the root of the resources/ directory. Only one file,
codemirror.bundle.js, is managed by Rollup, while everything else is RL.
The Rollup output for now is put under resources/lib/ alongside the CM5
upstream files.

This patch is *mostly* renames of files, along with changing ECMAScript
Module (ESM) syntax into the CommonJS style that ResourceLoader prefers.
We also remove more modern JS syntax (i.e. private class methods) that
we were able to use before because we had a build step with Babel.

This patch should effectively make no user-facing changes, or to the
ResourceLoader modules we offer in Extension:CodeMirror.

Finally, bump version in extension.json to 6, to match the upstream lib,
and add Bhsd as an author :-)

Bug: T368053
Change-Id: Ie258e49f5df8db23a7344ac3c4c9300aaa991042
2024-07-31 22:45:48 -04:00
Fomafix e0dc1c0c32 Use service 'GadgetsRepo' instead of deprecated GadgetRepo::singleton()
The service 'GadgetsRepo' gets injected as optional service.

This change requires a phan dependency on extension Gadgets in
project integration/config in file zuul/parameter_functions.py:
I5052e0c666b7dc7af6061e57001f9feac666e029

Change-Id: Ib405ad79b3c348bed51a8938a6a8f73bd35267d2
2024-07-01 09:32:50 +00:00
Ed Sanders 6958b99f2e build: Update eslint-config-wikimedia to 0.28.2 and autofix
Change-Id: I622f53bf5f56782b7a0529cdc6bb27c1315ff5a0
2024-06-17 13:02:26 +00:00
James D. Forrester 170869190c HooksTest: Swap out use of deprecated getOptionKinds()
Change-Id: I992b102de6fc4e346d27d6a729c5b518a6d2fb3c
2024-06-14 11:34:06 -04:00
jenkins-bot d594143c04 Merge "CM6: Rework ResourceLoader modules" 2024-05-14 01:23:01 +00:00
bhsd 52471d4b8f CodeMirrorModeMediaWiki: one-line definition list
Add highlighting for a special one-line definition list syntax `;a:b`. Also highlight `;a` in bold.

Bug: T170042
Change-Id: Ia3bdf481469368fcb5a7651729dde4b5f3682ed8
2024-04-29 09:44:27 +08:00
MusikAnimal c853e9587d CM6: Rework ResourceLoader modules
Documentation is at https://w.wiki/9kxt

The idea is that modules ending in `.init` imply they initialize
CodeMirror and maniuplate the DOM. The others only export classes for
use in integreations.

In doing so, 'ext.CodeMirror.v6.WikiEditor' now only exports the
CodeMirrorWikiEditor class, while 'ext.CodeMirror.v6.WikiEditor.init'
is added for use on #wpTextbox1 through action=edit.

Bug: T174811
Change-Id: Iec62ac9dc77918904bed886d2d46ccc03e0927f7
2024-04-15 12:40:16 -04:00
MusikAnimal fcb7633eb1 CodeMirrorModeMediaWikiConfig: add missing TagStyle for cm-mw-link
The number sign in `[[Link#Section]]` is supposed to have the class
.cm-mw-link, but didn't because it was missing a TagStyle which actually
gives it the CSS class. Now it does.

Add test case for all known CSS classes.

Bug: T348019
Follow-Up: I8f8a81f362bed60dea14ecde9487a2b0c89225e8
Change-Id: I613f8bead76523fbe1a9f05ed75d81893b8737d3
2024-04-11 14:02:24 -04:00
jenkins-bot b97d51ff51 Merge "CM6: Add syntax highlighting preference for users without WikiEditor" 2024-04-11 14:00:05 +00:00
MusikAnimal f3f46d8e05 CM6: Add syntax highlighting preference for users without WikiEditor
This adds the `ext.CodeMirror.v6.init` ResourceLoader module which
allows use of CodeMirror on `#wpTextbox1` without the use of WikiEditor
(the 'usebetatoolbar' preference). In order for users to opt-in to using
CodeMirror, we make the existing 'usecodemirror' option into a visible
preference. In addition, with two preferences related to CodeMirror, we
group them under a new heading 'Syntax highlighting'. More preferences
may be added later to this section following T359498.

When WikiEditor is not enabled, the layout of the action=edit page has
the textarea as a sibling to other visible content, like `.editOptions`.
Because of this, we can't simply append the CodeMirror DOM to the parent
like we were before, as that would put the visible editor beneath the
edit summary, Publish button, etc. Instead we rework the CodeMirror to
first add a wrapper around the textarea and use that as the parent. This
way, `.cm-editor` is always in the same place in the DOM as the native
textarea.

Line wrapping and focus/blur events are also moved to CodeMirror, as
these are needed when not using WikiEditor.

Bug: T190108
Change-Id: I4bc069e0d398aa7088e4f50bbd0ddda458b289c3
2024-04-09 22:05:20 -04:00
MusikAnimal e1f397f048 CodeMirrorBidiIsolation: fix for when the tag is the first element
This fixes a careless error introduced in I1338afeefa where we don't do
a strict equality test and thus if the tag is the first element (at
position 0), the following bracket is also treated as the start
position. Here we simply do a strict equality test against null (the
reset value), and viola, several issues are fixed.

Bug: T358804
Change-Id: I86021d363ecc33a7551bc887439dc1902914026f
2024-04-09 22:04:45 -04:00
MusikAnimal ca02360228 CM6: Switch to using Rollup instead of Webpack; make RL-compatible
See https://w.wiki/9Twh for example usage with ResourceLoader.

Webpack is retired in favor of Rollup, which allows us to convert the
ECMAScript Modules into CommonJS modules for use by ResourceLoader.
We now have a file in dist/ for each RL module that we want to offer,
including the 'lib' module which includes the CM library itself.

Because Rollup has no knowledge of the ResourceLoader module registry,
the generated output requires other modules via relative path, when it
needs to be the RL module name. To get around this, we do a crude
find/replace after the files are generated. Hacky, but necessary to make
CodeMirror usable by gadgets and scripts that don't also want
WikiEditor.

Add new RL modules 'ext.CodeMirror.v6.lib' (vendor code) and
'ext.CodeMirror.v6' (the main CodeMirror class, sans WikiEditor).

Clean up extension.json, listing the v6 modules beneath the old ones.

Bug: T214989
Change-Id: Ide716247e545cf2bdd977bea645729564ebbe6e2
2024-03-19 22:48:52 -04:00
MusikAnimal 00f947e97f CM6: move bidiIsolation to be part of CodeMirrorModeMediaWiki
The extension is custom built for MediaWiki (i.e. handling of extension
tags like <ref> that aren't HTML tags), so it only makes sense to bundle
it as part of the MediaWiki language mode.

Resultantly, we can no longer check the direction of the textarea where
we enable bidi isolation, because the language mode should have no
knowledge of the textarea. Instead we offer a `config` object (akin to
other language modes offered by CodeMirror), with currently only one
option: `bidiIsolation`. It is the responsibility of the caller to
enable this where desired.

Also make templateFolding and CodeMirrorModeMediaWiki use
`export default` since they both only export one thing.

This commit is in preparation for Ide716247e5, where we need bidi
isolation separated from the CodeMirror class due to its dependency on
CodeMirrorModeMediaConfig.

Bug: T358804
Bug: T214989
Change-Id: If3211bd259bd7833919a627faabd86ae7aa81b53
2024-03-19 22:48:34 -04:00
MusikAnimal b18ded0a13 CM6: move more Extensions to CodeMirror so they don't require WikiEditor
We want CodeMirror to be usable outside WikiEditor. This commit moves
the more critical extensions from the CodeMirrorWikiEditor class to the
parent CodeMirror class.

The linked tasks are only broadly related. In Ide716247e5 we will
introduce a ResourceLoader module that makes CodeMirror usable on any
textarea.

Bug: T214989
Bug: T190108
Change-Id: Ib199cf700c3235812f7c9a9bcb3703917f0887de
2024-03-19 22:48:17 -04:00
MusikAnimal d1863e4d0b tests: disable flaky CM5 bracket matching test for 2017 editor
This legacy CM5 test has always been flaky and is now consistently
failing. It can be reinstated with T357482, or not at all, seeing as
bracket matching is a core extension in CodeMirror 6 and probably
doesn't need a dedicated test on top of what's upstream.

Change-Id: I77362c1c47be902cc888682aae926154470f1a56
2024-03-19 22:47:23 -04:00
MusikAnimal 911b2d3d46 CodeMirror: add 'dir' and 'lang' attrs to .cm-editor and not .cm-content
Before we were adding these attributes to .cm-content, which didn't
encompass the gutter (line numbers). When you edited a LTR page in a RTL
interface language (or vice versa), the line gutter appeared on the
wrong side, which caused the cursor to be misaligned.

This commit fixes this by applying the direction and language to the
entire editor (.cm-editor), and not just .cm-content. However this means
the search panel could be in the page language when it should be the
interface language. This will be addressed in a follow-up patch.

Other attributes like 'class' that are copied from the textarea must
remain on .cm-content, because the parent .cm-scroller would otherwise
override them.

Bug: T359589
Change-Id: Id805944231fd75c1dc1c336e3cd4c7bc5c42c036
2024-03-13 11:19:16 -04:00
MusikAnimal aa3876a97e CodeMirrorWikiEditor: Remove hack to fix height in WikiEditor
WikiEditor's ResizingDragBar makes the editor resizable, so we need to
set the height to 100%. This was attempted in Ib49d1d9e71 and
I4deeda192b but both ultimately suffer from race conditions. Instead
we're setting the height in WikiEditor with Ia5e9767e08.

The heightExtension in the CodeMirror class still remains, in the event
a subclass wishes to override the default behaviour in CM directly and
not with CSS.

Bug: T357794
Depends-On: Ia5e9767e0814eac29d58bc0d9c1023344a29dd84
Change-Id: Ic55dd098d70fd173ddee7100e392b889ee6ddd08
2024-03-13 11:18:20 -04:00
MusikAnimal d927b01ec1 CodeMirror: fix implementation of jQuery.textSelection encapsulate
In Idc0abb64eb we added support for 'encapsulateSelection' and multiple
cursors, but broke other jQuery.textSelection functionality in the
process. In this commit, we move the logic to a dedicated class, and
more fully and accurately mimic the native implementation.

All functionality in WikiEditor should now be supported.

Bug: T359671
Follow-Up: Idc0abb64eb036fa4a60382aca401d1dba1722405
Change-Id: I9b947d80616bd4c4372b981b2271a281d1fc0252
2024-03-11 17:38:20 -04:00
MusikAnimal 63cd3e4ff8 CodeMirror 6: show wikitext highlighting on protected pages
It is necessary to have a way to toggle CodeMirror on and off, so we use
WikiEditor and hide all other buttons. This is more costly than loading
just vanilla CodeMirror, but it ensures a consistent experience with
pages that are editable, with the toggle button in the familiar place.
At a later time, WikiEditor may be updated to better support read only
pages in a lightweight fashion (T188817).

Bug: T301615
Change-Id: I8ea7597d07ff60a3f58ba306d2d6d12d3ec08b16
2024-03-11 17:35:20 -04:00
MusikAnimal 18a92122ef CodeMirror 6: Add bidi isolation to HTML tags
HTML tags and similar markup may appear jumbled on RTL pages due to the
standard algorithm used for character placement. With this patch, we
detect all tags (HTML or MediaWiki-supplied) and wrap them with
<span class=cm-bidi-isolate>. This CSS class forces the content to be
LTR, making the tags easier to work with on RTL pages.

Bug: T358804
Change-Id: I1338afeefa16102d5cc8fd6c8a236c144e5cf81f
2024-03-11 17:34:41 -04:00
MusikAnimal 894d2c33e9 Hooks: further limit where CodeMirror RL modules are loaded
This fixes a preexisting issue where we were loading CodeMirror on pages
where it would never be used. We use the EditPage__showEditForm_initial
hook so we don't need to check the action.

This commit introduces the CodeMirrorContentModels extension attribute,
used to limit where CodeMirror is loaded automatically. By default,
this includes only CONTENT_MODEL_WIKITEXT ('wikitext'). This extension
attribute serves as a stepping stone to CM being used on content types
other than just wikitext.

Bug: T359206
Change-Id: Ibefc028c5ef6275393202fe773c26162715e1bca
2024-03-11 17:30:10 -04:00
jenkins-bot 829ad8e79f Merge "Use namespaces class MediaWiki\Context\RequestContext" 2024-03-08 20:26:44 +00:00
jenkins-bot 985f2991e5 Merge "CodeMirror 6 template folding" 2024-03-08 02:38:43 +00:00
Fomafix f706c0dc99 Use namespaces class MediaWiki\Context\RequestContext
This change depends on I4dbef138fd0110c14c70214282519189d70c94fb
included in MediaWiki 1.42.

Change-Id: I37b5bbe06dfb99b5ff819188a1b76ad6c669ecda
2024-03-07 20:05:27 +00:00
jenkins-bot 210f78aa90 Merge "Avoid wgTitle in tests" 2024-03-07 19:21:51 +00:00
bhsd 506d998767 CodeMirror 6 template folding
This patch adds an icon displayed above the cursor inside a template. By clicking it, the template parameters become hidden and replaced by three dots, while the template name remains visible. Clicking the dots will unfold the template. New key bindings include fold (Ctrl-Shift-[/Cmd-Alt-[), unfold (Ctrl-Shift-]/Cmd-Alt-]) and unfoldAll (Ctrl-Alt-]).

Bug: T30684
Change-Id: I631fe0ecf21d0a80306bd40d66d22478a1aefe58
2024-03-07 13:47:47 +08:00
Fomafix b4b1004499 Avoid wgTitle in tests
Change-Id: I1323b9b9542598d33f7150cc0d468e581b0d8c09
2024-03-06 15:59:33 +00:00
MusikAnimal 321d462311 CodeMirrorModeMediaWikiConfig: add missing tokens for nested templates
Nested templates have background shading relative to their level of
nesting. See the newly added test case as an example. Without these
tokens registered, the styling won't show properly.

Since these tokens aren't referenced directly by the StreamParser, nor
do they have a parent Tag, we don't need them as constants like we do
for other tokens.

Bug: T348019
Change-Id: I87bb99d538344957987b2bd88f902a1427a36522
2024-03-05 00:34:34 -05:00
MusikAnimal 7002bc434d CM6: use textarea height unless WikiEditor's Realtime Preview is loaded
The ResizingDragBar makes the editor resizable, so we need to set the
CodeMirror height to 100%. This only happens when the Realtime Preview
module is loaded.

This fixes a critical issue introduced by I4deeda192b that caused blank
renderings when scrolling large documents.

Bug: T357794
Follow-Up: I4deeda192bdc233101ba61739a636f8fd143c1de
Change-Id: Ib49d1d9e71df3653b13dfd44a8efedbf1ef9cd93
2024-03-04 17:41:04 -05:00
Fomafix c3df98cff6 Remove $this->setService( 'UserOptionsLookup', ... ) in tests
The mocked service UserOptionsLookup is already injected via contructor
to Hooks.

Change-Id: I013aa6f62bd50802889a0037721ba06902d1a18e
2024-03-04 20:04:02 +00:00
MusikAnimal 657ba3648a CodeMirror: sync text editor font preference
This only effects users of the CM6 CodeMirror class, so doesn't (yet)
solve the issue for the 2017 editor which is partly what T245568 is for.

I135bf0f7bf supposedly fixed it for the 2010 editor, but that fix
apparently doesn't work anymore, and thus those styles have simply been
removed (the .CodeMirror element is never a child of the edit font
classes).

This change also incidentally fixes font sizing issues by ensuring the
styles are applied to `.cm-content` and not `.cm-editor`. This prior bug
was most notably visible in other skins such as Timeless and Monobook.
The colorblind CSS class is now applied in the same way using the
EditorView.contrentAttributes facet.

Bug: T245568
Change-Id: Iaaf65e47ce8ed9303147aadc7e18a9aaa051405b
2024-02-25 23:08:38 -05:00
MusikAnimal 26d5023bb7 CodeMirror: partially implement $.textSelection 'encapsulateSelection'
Popular extensions like Charinsert use this method to wrap text around a
selection. This patch adds support for multiple selections in CM6.

Some options to encapsulateSelection do not yet have explicit support
here, such as 'peri', but it's unclear if they are truly needed.

Bug: T211205
Change-Id: Idc0abb64eb036fa4a60382aca401d1dba1722405
2024-02-16 04:42:14 +00:00