mediawiki-extensions-CodeMi.../resources/codemirror.wikieditor.less
MusikAnimal f62a2be966 CodeMirrorWikiEditor: properly manage WikiEditor buttons
Fixes an issue introduced with Ib65d47e989 where continually toggling on
and off CodeMirror would duplicate the search button exponentially, even
leading to browser crashes.

Create a new 'codemirror' toolbar group for the prefs button, styling it
just like the search group, and use WikiEditor's removeToToolbar() to
remove it.

Remove now redundant CSS classes.

Bug: T359498
Follow-Up: Ib65d47e98908b6a888d24157a235de4efe95a33b
Change-Id: If8ae9c0b04b2edcb30a5b8cd788214598a492d30
2024-11-25 02:37:57 -05:00

63 lines
1.5 KiB
Plaintext

@import 'mediawiki.skin.variables.less';
// Overrides for WikiEditor.
.wikiEditor-ui-text .cm-editor {
border: inherit;
}
// Mimics .group-search
.wikiEditor-ui-toolbar .group-codemirror {
float: right;
border-right: 0;
border-left: @border-subtle;
}
.cm-mw-toggle-wikieditor {
.oo-ui-icon-syntax-highlight {
background-color: @color-base;
// The SVG is just barely over 300 bytes, and is also only temporary
// until an official icon has been established in Codex/OOUI (T174145).
/* @embed */
@url: url( codemirror.icon.svg );
-webkit-mask-image: @url;
mask-image: @url;
-webkit-mask-size: @size-icon-medium;
mask-size: @size-icon-medium;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-position: center;
mask-position: center;
}
&:hover {
background-color: @background-color-interactive;
}
&.oo-ui-toggleWidget-on {
.oo-ui-labelElement-label {
color: @color-progressive;
}
.oo-ui-icon-syntax-highlight {
background-color: @color-progressive;
}
}
&.oo-ui-buttonElement-frameless.oo-ui-labelElement.oo-ui-iconElement:first-child {
margin-left: 0;
}
}
// Hide all buttons except CodeMirror on read only pages (T301615)
// This is the same hack that CodeEditor uses to customize the toolbar.
// WikiEditor should be updated to better handle read only pages (T188817).
.ext-codemirror-readonly {
.wikiEditor-section-secondary,
.group:not( .group-codemirror ),
.tabs,
.sections {
display: none;
}
}