2024-08-09 06:04:19 +00:00
|
|
|
@import 'mediawiki.skin.variables.less';
|
|
|
|
|
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-03-26 20:40:13 +00:00
|
|
|
.cm-editor {
|
2024-08-01 21:39:43 +00:00
|
|
|
border: @border-width-base @border-style-base @border-color-subtle;
|
|
|
|
|
|
|
|
.cm-selectionBackground {
|
|
|
|
background: #d9d9d9;
|
|
|
|
|
|
|
|
@media screen {
|
|
|
|
html.skin-theme-clientpref-night & {
|
|
|
|
background: #222;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@media screen and ( prefers-color-scheme: dark ) {
|
|
|
|
html.skin-theme-clientpref-os & {
|
|
|
|
background: #222;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground {
|
|
|
|
background: #d7d4f0;
|
|
|
|
|
|
|
|
@media screen {
|
|
|
|
html.skin-theme-clientpref-night & {
|
|
|
|
background: #233;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@media screen and ( prefers-color-scheme: dark ) {
|
|
|
|
html.skin-theme-clientpref-os & {
|
|
|
|
background: #233;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
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-03-26 20:40:13 +00:00
|
|
|
}
|
|
|
|
|
2023-12-06 05:52:51 +00:00
|
|
|
.cm-matchingBracket,
|
|
|
|
.cm-focused .cm-matchingBracket {
|
|
|
|
background-color: #eee;
|
|
|
|
box-shadow: inset 0 0 1px 1px #999;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
2024-01-19 00:33:58 +00:00
|
|
|
|
2024-08-01 21:39:43 +00:00
|
|
|
.cm-editor .cm-specialChar {
|
|
|
|
color: @color-destructive--hover;
|
|
|
|
}
|
|
|
|
|
2024-01-19 00:33:58 +00:00
|
|
|
.cm-special-char-nbsp {
|
2024-08-01 21:39:43 +00:00
|
|
|
color: @color-placeholder;
|
2024-01-19 00:33:58 +00:00
|
|
|
}
|
2024-02-26 08:16:45 +00:00
|
|
|
|
|
|
|
.cm-tooltip-fold {
|
2024-08-01 21:39:43 +00:00
|
|
|
cursor: @cursor-base--hover;
|
2024-02-26 08:16:45 +00:00
|
|
|
line-height: 1.2;
|
|
|
|
padding: 0 1px;
|
|
|
|
}
|
2024-03-11 21:34:36 +00:00
|
|
|
|
2024-08-01 21:39:43 +00:00
|
|
|
.cm-editor .cm-foldPlaceholder {
|
|
|
|
background-color: @background-color-interactive;
|
|
|
|
border-color: @border-color-subtle;
|
|
|
|
color: @color-base;
|
|
|
|
}
|
|
|
|
|
2024-03-11 21:34:36 +00:00
|
|
|
.cm-bidi-isolate {
|
|
|
|
/* @noflip */
|
|
|
|
direction: ltr;
|
|
|
|
unicode-bidi: isolate;
|
|
|
|
}
|
2024-01-10 00:02:44 +00:00
|
|
|
|
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-03-26 20:40:13 +00:00
|
|
|
.ext-codemirror-wrapper {
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
|
2024-08-01 21:39:43 +00:00
|
|
|
// The various .cm-editor prefixed styles are required to have higher
|
|
|
|
// specificity than CodeMirror's default styles, which are set by JS.
|
|
|
|
.cm-editor .cm-gutters {
|
|
|
|
background-color: @background-color-interactive-subtle;
|
|
|
|
border-right-color: @border-color-subtle;
|
|
|
|
color: @color-subtle;
|
|
|
|
}
|
|
|
|
|
|
|
|
.cm-editor .cm-cursor {
|
|
|
|
border-left-color: @color-emphasized;
|
|
|
|
}
|
2024-08-09 06:04:19 +00:00
|
|
|
|
2024-08-01 21:39:43 +00:00
|
|
|
.cm-editor .cm-tooltip {
|
|
|
|
background-color: @background-color-neutral-subtle;
|
|
|
|
border-color: @border-color-base;
|
2024-08-09 06:04:19 +00:00
|
|
|
}
|
|
|
|
|
2024-08-01 21:39:43 +00:00
|
|
|
.cm-editor .cm-panels {
|
|
|
|
background-color: @background-color-neutral-subtle;
|
|
|
|
border-bottom: 0;
|
|
|
|
color: @color-base;
|
|
|
|
z-index: @z-index-above-content;
|
|
|
|
|
|
|
|
.cdx-button-group {
|
|
|
|
.cdx-button,
|
|
|
|
.cdx-toggle-button {
|
|
|
|
min-width: @min-width-toggle-switch;
|
|
|
|
}
|
2024-08-09 06:04:19 +00:00
|
|
|
}
|
|
|
|
|
2024-08-01 21:39:43 +00:00
|
|
|
.cm-mw-panel {
|
|
|
|
border-bottom: @border-style-base @border-width-base @border-color-subtle;
|
|
|
|
padding: @spacing-50;
|
2024-08-09 06:04:19 +00:00
|
|
|
}
|
|
|
|
|
2024-08-01 21:39:43 +00:00
|
|
|
.cm-mw-panel--text-input {
|
|
|
|
flex-basis: 0;
|
|
|
|
flex-grow: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.cm-mw-panel--row {
|
|
|
|
align-items: center;
|
|
|
|
column-gap: @spacing-50;
|
|
|
|
display: flex;
|
2024-08-09 06:04:19 +00:00
|
|
|
|
2024-08-01 21:39:43 +00:00
|
|
|
&:not( :last-child ) {
|
|
|
|
margin-bottom: @spacing-50;
|
2024-08-09 06:04:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-01 21:39:43 +00:00
|
|
|
.cm-mw-panel--button {
|
|
|
|
margin-bottom: 0;
|
2024-08-09 06:04:19 +00:00
|
|
|
}
|
|
|
|
|
2024-08-01 21:39:43 +00:00
|
|
|
.cm-mw-panel--toggle-button.cdx-toggle-button--toggled-on {
|
|
|
|
&:enabled:active {
|
|
|
|
background-color: @color-progressive--active;
|
|
|
|
}
|
|
|
|
|
|
|
|
.cdx-icon {
|
|
|
|
background-color: @color-inverted;
|
|
|
|
}
|
2024-01-10 00:02:44 +00:00
|
|
|
}
|
|
|
|
}
|
2024-08-01 21:39:43 +00:00
|
|
|
|
2024-08-14 19:56:24 +00:00
|
|
|
.cm-mw-find-results {
|
|
|
|
color: @color-placeholder;
|
|
|
|
position: absolute;
|
|
|
|
right: 9px;
|
|
|
|
top: 50%;
|
|
|
|
transform: translateY( -50% );
|
|
|
|
}
|
|
|
|
|
2024-08-01 21:39:43 +00:00
|
|
|
.cm-mw-icon--match-case {
|
|
|
|
background-color: @color-base;
|
|
|
|
.cdx-mixin-css-icon( @cdx-icon-search-case-sensitive, @color-base, @size-icon-medium, true );
|
|
|
|
}
|
|
|
|
|
|
|
|
.cm-mw-icon--regexp {
|
|
|
|
background-color: @color-base;
|
|
|
|
.cdx-mixin-css-icon( @cdx-icon-search-regular-expression, @color-base, @size-icon-medium, true );
|
|
|
|
}
|
|
|
|
|
|
|
|
.cm-mw-icon--quotes {
|
|
|
|
background-color: @color-base;
|
|
|
|
.cdx-mixin-css-icon( @cdx-icon-quotes, @color-base, @size-icon-medium, true );
|
|
|
|
}
|
|
|
|
|
|
|
|
.cm-mw-icon--previous {
|
|
|
|
background-color: @color-base;
|
|
|
|
.cdx-mixin-css-icon( @cdx-icon-previous, @color-base, @size-icon-medium, true );
|
|
|
|
}
|
|
|
|
|
|
|
|
.cm-mw-icon--next {
|
|
|
|
background-color: @color-base;
|
|
|
|
.cdx-mixin-css-icon( @cdx-icon-next, @color-base, @size-icon-medium, true );
|
|
|
|
}
|