Commit graph

277 commits

Author SHA1 Message Date
Thiemo Kreuz 3e9bb4fb08 Replace all .png images with rgba() background colors
The rgba() syntax is supported for a very, very long time now:
https://caniuse.com/#feat=mdn-css_types_color_alpha

Notes:

I realized the numbers in these file names are actually their
transparency in percent (more precisely their opaqueness).
4 is 4% which translates to 0.04 in the rgba() syntax.

I used Gimp to pick the opaque color values from the images.
Gimp makes this easy. No guesswork or calculations needed.

For multiple, stacked images I calculated the colors by
averaging their RGB values (considering how opaque each color
is). Note this is actually *more* precise than the stacked
images before. Stacking alpha colors is flawed. For example:
Let's say we have an rgba(255, 255, 255, 1) background.
Layering a half transparent rgba(255, 0, 0, 0.5) on top means
half the background shines through. This averages to
rgba( 255, 127, 127, 1). Now we stack rgba(0, 0, 0, 0.5) on
top. Again, half the background shines through, resulting in
rgba(127, 63, 63, 1).

When we apply the two colors the other way around, the result
is rgba(191, 63, 63, 1), a much brighter red.

This flaw doesn't happen when precalculating the averages, as
done in this patch.

Change-Id: I29026864714c5f90c2613af57f08693e7e2b996c
2020-08-11 14:24:20 +02:00
jenkins-bot f40872ec83 Merge "Fix 'setSelection' in textSelection API" 2020-07-15 19:21:51 +00:00
Ed Sanders 9f566d6046 Fix 'setSelection' in textSelection API
focus needs to come after setSelection

Change-Id: Ib073ddad445e05c4bc042b9c382a7d74369e29e1
2020-07-12 15:10:58 +00:00
Pavel Astakhov a9da1fa59e Load pluginModules in CodeMirrorAction class
Change-Id: Ia698be63171868cf568b136df89ce3e48eab1340
2020-07-10 17:12:23 +06:00
Ed Sanders 89f52f6fbb VE: Add explicit dependency on targetLoader
Change-Id: I3d67837b462e0b79e124eff158bd7f88b5aaf63e
2020-06-30 22:47:41 +01:00
Ed Sanders 2518861bc1 build: Update devDependencies
Change-Id: I2f2967a1525c6a66eba2f5fc225e74b89380c5dd
2020-06-12 22:51:38 +01:00
Bartosz Dziewoński d23ffa17cb Update VisualEditor styles for Vector changes
Bug: T252471
Change-Id: I6ba64f2deaa27172842ee5f71363708758324aff
2020-05-12 00:42:03 +02:00
Ed Sanders 4d53bcbe09 VE: Don't load CodeMirror code until tool is activated
This saves about 300k uncompressed / 80k compressed whenever VE loads!

Change-Id: I7cf1c35292c2ea48cc15ceb4c22d4473a25484e9
2020-03-19 20:23:24 +00:00
Fomafix 6075e4cb83 Enable spellchecking on Firefox
The spellchecking was disabled for Firefox on non-Mac systems because
Firefox had a bug and inserts characters (like B) into the content when
enter an access key combination (like Shift+Alt+B).

Firefox 65 fixed the problem by changing the default for
dom.keyboardevent.keypress.dispatch_non_printable_keys_only_system_group_in_content
from false to true.

The old behavior can activated in about:config by setting
dom.keyboardevent.keypress.dispatch_non_printable_keys_only_system_group_in_content = false

This change reverts 29f6b48eeb.

Bug: T177509
Change-Id: I23773b2ea2a154269a5b3064cd8d9e9132051c38
2020-02-29 22:54:43 +01:00
AronDemian d0418ae8bb Don't let CodeMirror set the font to monospace if it's set on an ancestor.
Bug: T245568
Change-Id: I135bf0f7bf73e0d9faaa43c565cef43c5c934a34
2020-02-29 18:01:27 +00:00
AronDemian d70bd9d1ae Unify monospace font stack. Avoid potential sizing bug caused by weird browser behavior with font-family: monospace;
Problem: browsers implicitly and unexpectedly set the font-size to something around 13px with `font-family: monospace;`, but not with `font-family: monospace,monospace;`.
See:  http://code.iamkate.com/html-and-css/fixing-browsers-broken-monospace-font-handling/

Bug: T176636
Change-Id: Ied24a0cde7db4a6092d2cd7a6207d0a361424c3f
Related: T245568
Related: T245476
2020-02-28 04:44:07 +00:00
Derk-Jan Hartman 006d4ba9d8 Add comment to make usage of jquery.ui module discoverable
Change-Id: I79a54686024b22e2851bd396bb51101ca84626fa
2020-02-25 22:44:34 +00:00
Fomafix b17c8b7557 Move check for 'usebetatoolbar' from JS to PHP
This change avoids useless loading of the module 'ext.CodeMirror'.

Change-Id: I2637487b72c028d272748f2891239401412f77b5
2020-02-23 20:50:17 +00:00
AronDemian f0e689d203 Remove the unnecessary 1.5em padding in MinervaNeue skin that misaligns highlights.
Bug: T245532
Bug: T245568
Change-Id: Ib29678eb38ebb5a5d2975a087e55b2ddd2a4b35d
Related: I135bf0f7bf73e0d9faaa43c565cef43c5c934a34 - T245476
2020-02-19 15:00:43 +01:00
Bartosz Dziewoński 5a1501d46f VE: Update padding to match VisualEditor changes
See Ib7ffbf09d5aa23fddb894aa3b081ec993ddcee2d.

Bug: T238678
Change-Id: Ia9d38599e76b63147318c6604dbd9b9fabf35b16
2019-12-13 14:54:03 +00:00
Ed Sanders a134e66777 Don't replace whitespace characters in VE
Bug: T153434
Depends-On: Ic4a5ab803c89b3671f452579bca0da08b779bdfe
Change-Id: Ic3d848ff86cceceeeea9385bfc49ad2241e3801b
2019-11-14 22:30:32 +00:00
Ed Sanders cf9885b586 Match tabSize to surface view CSS property
For browsers that don't support the property, assume
the default value of 8 is used.

Change-Id: Icb9a97fa79e08458bf717903f1d7b68e433e7904
2019-11-14 22:30:32 +00:00
Isarra 90ac9d3475 Remove Timeless VE styles, too many variables to do them properly here
Move this stuff to Timeless itself since we can just reuse the width cutoff
and padding variables directly there and don't need to worry about them
randomly changing.

Corresponding change: Ic64b9786cb7186dba3eb2042a3238149c3bb44c6

Bug: T230756
Change-Id: Ia7168341bcadbc60e307b58b67afc1975a2424f9
2019-08-20 20:26:45 +00:00
Derk-Jan Hartman d1a3e49265 Highlight match end tag with different capitalization
This recoginizes <ref></Ref>

Bug: T179321
Change-Id: Ib1e501f97654a019281eddd6cc69ea3b979daec7
2019-04-14 01:25:40 +02:00
jenkins-bot fc4d4b0c36 Merge "Do not load module 'ext.CodeMirror' when CodeEditor is active" 2019-03-20 21:31:03 +00:00
Fomafix f0757cb0dc Do not load module 'ext.CodeMirror' when CodeEditor is active
Change-Id: I8fd0de727f2ebb1bf9f23981438d6cafa962ad17
2019-03-20 21:01:35 +00:00
jenkins-bot d48a8caa0d Merge "Conditionally load CodeMirror lib" 2019-03-15 08:50:49 +00:00
Derk-Jan Hartman 758523b65f Conditionally load CodeMirror lib
Also remove two unneeded dependencies

Bug: T209824
Change-Id: I5b528bde346780ca5ae5d615c4ca0d617a6cd615
2019-03-14 23:31:18 +00:00
jenkins-bot 71a96af684 Merge "Make Special:JavaScriptTest pass on Webkit and on Firefox" 2019-03-12 10:32:28 +00:00
jenkins-bot f6c86b9867 Merge "build: Update eslint-config-wikimedia to 0.11.0" 2019-03-06 14:39:37 +00:00
jenkins-bot f048f45b50 Merge "Use 'wikiEditor-toolbar-doneInitialSections' as trigger" 2019-03-06 14:39:27 +00:00
Ed Sanders 37b49bfdc4 build: Update eslint-config-wikimedia to 0.11.0
Change-Id: I7ca5276791d9add0709387422016d7193e8d9945
2019-03-06 12:10:29 +00:00
Fomafix 9c04302f23 Use 'wikiEditor-toolbar-doneInitialSections' as trigger
Also refactor out single use functions and call enableCodeMirror
from within addCodeMirrorToWikiEditor.

Change-Id: I77d37ae401483e187fe0bc355d7173b57fbe454b
2019-03-06 12:09:28 +00:00
jenkins-bot 8a1e8552f3 Merge "Wait for DOM ready before querying DOM" 2019-03-06 11:59:14 +00:00
Fomafix 4181729151 Wait for DOM ready before querying DOM
This avoids a race condition on loading.

Change-Id: I31c01f9c2b2025b4a46d5afc6ada5044f750eff7
2019-02-25 21:55:31 +01:00
Fomafix ebd382f004 Make Special:JavaScriptTest pass on Webkit and on Firefox
CodeMirror inserts

 style="padding-right: 0.1px;"

only on Webkit.

The test case now strips this pattern from the rendered HTML before
comparing with the expected test case output.

Change-Id: I34b201f790d3d85a5f51d8200bf8219f11d14506
2019-02-25 08:14:58 +01:00
Fomafix 5161c6abe9 Make Special:JavaScriptTest pass with and without extension Cite
Change-Id: Ib3bae7968c7d1eb0d5f862f0410f016f47abcd15
2019-02-25 08:10:32 +01:00
Ed Sanders 7604581cc1 Remove obsolete aliases from closures
Bug: T208951
Change-Id: I64c2966b7c41d6b2b1911e2fb52e4c7364bf7964
2018-11-12 13:19:41 +00:00
James D. Forrester 8ac2d11b1b Drop support for MediaWiki core's removed "2006 wikitext editor"
Change-Id: Ib8d104ddf104cfeeee1fc7a055293a03fe8e2d3d
2018-10-25 14:06:59 -07:00
Bartosz Dziewoński 079d240a2c ve.ui.CodeMirror: Fix padding to match VisualEditor's padding
VisualEditor's default padding for the source editing surface was
changed in Icdc6f1e2a7544ebbd828f85ff370113a0e06983a (June 2018).

Since then the alignment of editing surface and CodeMirror syntax
highlighting surface was broken in skins that don't override the
default padding (basically every skin except Vector and MonoBook).
Unfortunately Vector and MonoBook happen to be the only skins we
officially support and actually test, so the issue went unnoticed.

Bug: T205154
Bug: T205658
Change-Id: Ic85a6c20b266f6b93ab8ec9c2d35acff679f31bc
2018-09-27 22:06:00 +02:00
Ed Sanders ef8c62c74b Use renamed ve.visibleWhitespaceCharacters
Change-Id: I246079505d4c37406b3f99ca17b7e8e926adaec5
2018-09-24 16:34:54 +01:00
jenkins-bot 7dd9688663 Merge "build: Update linters" 2018-09-13 12:27:47 +00:00
Ed Sanders 1be09a9a1d build: Update linters
Change-Id: I8d3aaf0b7d453033b72e5d6622b8f54df2c86bca
2018-09-12 00:03:19 +01:00
Derk-Jan Hartman d5124e2920 Make use of new WikiEditor 2010 toggle tool
Bug: T198781
Depends-On: I8b7fd41571a48fa4f6560790d94bb966972e740f
Change-Id: Id275142c0d50ca6a133129eebeee8cfc5c1ca99a
2018-07-25 01:12:28 +02:00
Derk-Jan Hartman 4ebe54a588 Focus before setting the cursor/selection
Bug: T197263
Change-Id: If5efed656746e3e40fcda118e487cdcb00e0114a
2018-06-26 21:55:09 +00:00
jenkins-bot 7fa197b2dc Merge "Accessibility: mark syntaxhighlight button as a switch" 2018-06-18 16:04:35 +00:00
Derk-Jan Hartman 42e3dc7cdb Accessibility: mark syntaxhighlight button as a switch
* Protect from setActive not being defined on the old toolbar button
* Use role is switch on the button, since WE only supports simple
buttons
* Add the checked attribute to reflect state of the toggle button

Bug: T196512
Bug: T197534
Change-Id: I48dfef1740f124105f65859ce4f51098f1157fd0
2018-06-18 15:53:37 +00:00
jenkins-bot 579611ff5e Merge "Accessibility: Disable both directions of tabbing in CodeMirror" 2018-06-18 03:41:25 +00:00
Derk-Jan Hartman 736c63fd0b Accessibility: Disable both directions of tabbing in CodeMirror
Bug: T197534
Change-Id: Ia05c3ccbdb4baa8e701bf46478c42d2473777535
2018-06-17 19:24:14 +02:00
Max Semenik 63647bb5dc Remove all BetaFeatures support
Bug: T185030
Change-Id: I1ad451acfd163c783e7b8ec604d8695c14342667
2018-06-13 16:42:40 -07:00
Max Semenik f973652942 Disable ULS when CodeMirror is on
Bug: T194102
Change-Id: I25894d98a28e2c6096796ab912cc0ee04dd0a6e3
2018-05-30 13:07:07 -07:00
Ed Sanders 341a67496a Simplify target lookup
Change-Id: I00449f043c391c7648e2c17651d15c2807044402
2018-05-12 13:10:05 +01:00
Ed Sanders fca1d62a6c Apply line height selector to CodeMirror line wrapper
Bug: T193219
Change-Id: I7973b5e1a4f602c0fc371d78a1ebead093c48e74
2018-04-27 21:42:45 +01:00
jenkins-bot d3c7f3cdd4 Merge "Use CM API for setting document direction" 2018-04-25 18:36:32 +00:00
jenkins-bot 466fca0ec0 Merge "Load CodeMirror with VE always" 2018-04-25 16:04:39 +00:00