mediawiki-extensions-CodeMi.../resources/legacy/modules/ve-cm/ve.ui.CodeMirror.less
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

111 lines
2.3 KiB
Plaintext

.ve-init-mw-desktopArticleTarget {
.CodeMirror {
height: auto;
z-index: -1;
position: absolute;
top: 0;
left: 0;
width: 100%;
box-sizing: border-box;
pointer-events: none;
background: transparent;
// Core VE default padding
padding: 1.5em;
// Skin specific paddings
.skin-vector & {
padding: 0 1rem;
@media screen and ( min-width: 982px ) {
.skin-vector-legacy& {
padding: 0 1.5rem;
}
}
}
.skin-minerva &,
.skin-monobook & {
padding: 0;
}
}
.CodeMirror-lines,
.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like {
padding: 0;
}
.CodeMirror-scroll {
margin-right: 0;
overflow: auto !important; /* stylelint-disable-line declaration-no-important */
}
.CodeMirror-sizer {
border-right: 0;
}
.CodeMirror-selected {
display: none;
}
.CodeMirror pre.cm-mw-section-1,
.CodeMirror pre.cm-mw-section-2 {
font-size: inherit;
line-height: inherit;
}
// Ensure surfaces are using identical font rules
.CodeMirror-code,
.CodeMirror-code *,
.ve-ui-mwWikitextSurface .ve-ce-paragraphNode {
// The following are already set by mw-editfont-monospace on the parent: font-size, font-family
line-height: 1.5em;
word-wrap: break-word;
// Support: Chrome<76, Firefox<69
// Fallback for browsers which don't support break-spaces
white-space: pre-wrap;
// T347902
white-space: break-spaces;
word-break: normal;
-webkit-hyphens: manual;
-moz-hyphens: manual;
-ms-hyphens: manual;
hyphens: manual;
-webkit-font-variant-ligatures: contextual;
font-variant-ligatures: contextual;
// Monospace fonts can change width when bold
// stylelint-disable-next-line declaration-no-important
font-weight: normal !important;
// T252965
line-break: initial;
}
.CodeMirror-gutters {
background-color: transparent;
border-right: 0;
}
.CodeMirror-linenumber {
color: #72777d; // Codex Gray300
padding-left: 0;
}
.CodeMirror-linenumber-padding {
// Create a 12px padding between the line numbers and content.
width: 8px;
}
}
.ve-ce-documentNode-codeEditor-hide {
opacity: 0.4;
&::selection,
& *::selection {
background: #6da9f7 !important; /* stylelint-disable-line declaration-no-important */
}
}
.ve-ce-documentNode-codeEditor-webkit-hide {
-webkit-text-fill-color: transparent;
}