mediawiki-extensions-CodeMi.../resources/ve-cm/ve.ui.CodeMirror.v6.less
MusikAnimal f4cf12b383 ve.ui.CodeMirror.v6: use DOMRect width when updating gutter width
This fixes some Chromium-specific issues where offsetWidth was rounded
up and could cause misalignment issues. It does not fix all alignment
issues, but should hopefully be an improvement in most cases.

Other changes:
* Add Core VE padding to match CM5 variant (doesn't affect WMF cluster)
* Remove redundant margin rules from VE surface
* Minor code cleanup

Bug: T357482
Change-Id: Ic4246c0b8c39914021bbc2a84d52b332dafec20a
2024-11-05 23:41:06 -05:00

136 lines
2.7 KiB
Plaintext

.ve-init-mw-desktopArticleTarget {
.cm-editor {
background: transparent;
border: 0;
box-sizing: border-box;
height: auto;
left: 0;
pointer-events: none;
// stylelint-disable-next-line declaration-no-important
position: absolute !important;
top: 0;
width: 100%;
// 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;
}
}
.cm-gutterElement {
/* @noflip */
padding: 0 3px 0 4px !important; /* stylelint-disable-line declaration-no-important */
}
.cm-gutters {
background-color: transparent;
/* @noflip */
padding-right: 8px;
/* @noflip */
border-right: 0;
}
/* RTL rules need to apply to the content, not the interface language */
.cm-editor[ dir='rtl' ] .cm-gutters {
/* @noflip */
padding-left: 8px;
/* @noflip */
padding-right: initial;
.cm-gutterElement {
/* @noflip */
text-align: left;
}
}
.cm-focused {
outline: 0;
}
.cm-line {
padding: 0;
}
.cm-content {
padding: 0;
}
.CodeMirror-selected {
display: none;
}
// Ensure surfaces are using identical font rules
.cm-scroller,
.cm-scroller *,
.ext-codemirror-wrapper .ve-ce-paragraphNode {
// The following are already set by mw-editfont-monospace on the parent: font-size, font-family
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;
// T357482#10111614
font-style: normal;
}
.cm-mw-section-1,
.cm-mw-section-1 ~ *,
.cm-mw-section-2,
.cm-mw-section-2 ~ *,
/* TODO: remove overqualified `span` after CM6 upgrade */
span.cm-mw-section-3 ~ *,
span.cm-mw-section-4 ~ *,
span.cm-mw-section-5 ~ *,
span.cm-mw-section-6 ~ * {
font-size: inherit;
line-height: inherit;
font-weight: inherit;
}
.cm-activeLineGutter {
background-color: transparent;
border-right: 0;
}
}
.ext-codemirror-wrapper .ve-ce-documentNode-codeEditor-hide {
opacity: 0.4;
&::selection,
& *::selection {
background: #6da9f7 !important; /* stylelint-disable-line declaration-no-important */
}
}
.ext-codemirror-wrapper .ve-ce-documentNode-codeEditor-webkit-hide {
-webkit-text-fill-color: transparent;
}