From 081f0a17af77c3c8548fd34c5cd8a1b0ded5acb2 Mon Sep 17 00:00:00 2001 From: bhsd <2545473905@qq.com> Date: Sat, 2 Nov 2024 15:14:07 +0800 Subject: [PATCH] templateFoldingExtension: hide tooltip when typing Temporary solution to T367256 before a folding gutter is applied. Hide the folding tooltip when typing, and make the tooltip semi-transparent until hovered. Bug: T367256 Change-Id: I3ee3de737aa36692d094a54e0eea94d6f5690767 --- resources/codemirror.less | 4 ++++ resources/codemirror.mediawiki.templateFolding.js | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/codemirror.less b/resources/codemirror.less index c8ea3da5..bd20b318 100644 --- a/resources/codemirror.less +++ b/resources/codemirror.less @@ -55,6 +55,10 @@ cursor: @cursor-base--hover; line-height: 1.2; padding: 0 1px; + opacity: 0.6; +} +.cm-tooltip-fold:hover { + opacity: 1; } .cm-editor .cm-foldPlaceholder { diff --git a/resources/codemirror.mediawiki.templateFolding.js b/resources/codemirror.mediawiki.templateFolding.js index bcdee46b..d3ecafe2 100644 --- a/resources/codemirror.mediawiki.templateFolding.js +++ b/resources/codemirror.mediawiki.templateFolding.js @@ -320,7 +320,10 @@ const templateFoldingExtension = [ StateField.define( { create, update( tooltip, { state, docChanged, selection } ) { - return docChanged || selection ? create( state ) : tooltip; + if ( docChanged ) { + return null; + } + return selection ? create( state ) : tooltip; }, provide( f ) { return showTooltip.from( f );