Skip to content

Commit a5cc588

Browse files
authored
Tooltip (#5088)
* add right aligned mode for autocomplete popup * fix tooltip style
1 parent 34e769c commit a5cc588

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

src/autocomplete/popup.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ dom.importCssString(`
340340
}
341341
.ace_completion-meta {
342342
opacity: 0.5;
343-
margin: 0.9em;
343+
margin: 0 0.9em;
344344
}
345345
.ace_completion-message {
346346
color: blue;
@@ -367,7 +367,18 @@ dom.importCssString(`
367367
line-height: 1.4;
368368
background: #25282c;
369369
color: #c1c1c1;
370-
}`, "autocompletion.css", false);
370+
}
371+
.ace_autocomplete_right .ace_text-layer {
372+
width: calc(100% - 8px);
373+
}
374+
.ace_autocomplete_right .ace_line {
375+
display: flex;
376+
}
377+
.ace_autocomplete_right .ace_completion-meta {
378+
flex: 1;
379+
text-align: right;
380+
}
381+
`, "autocompletion.css", false);
371382

372383
exports.AcePopup = AcePopup;
373384
exports.$singleLineEditor = $singleLineEditor;

src/css/editor.css.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,7 @@ module.exports = `
399399
}
400400
401401
.ace_tooltip {
402-
background-color: #FFF;
403-
background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));
402+
background-color: #f5f5f5;
404403
border: 1px solid gray;
405404
border-radius: 1px;
406405
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
@@ -420,6 +419,10 @@ module.exports = `
420419
pointer-events: none;
421420
}
422421
422+
.ace_tooltip:focus {
423+
outline: 1px solid black;
424+
}
425+
423426
.ace_folding-enabled > .ace_gutter-cell {
424427
padding-right: 13px;
425428
}

src/ext/prompt.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ function prompt(editor, message, options, callback) {
7272
if (options.getCompletions) {
7373
var popup = new AcePopup();
7474
popup.renderer.setStyle("ace_autocomplete_inline");
75+
popup.renderer.setStyle("ace_autocomplete_right");
7576
popup.container.style.display = "block";
7677
popup.container.style.maxWidth = "600px";
7778
popup.container.style.width = "100%";
@@ -470,7 +471,7 @@ prompt.modes = function(editor, callback) {
470471
};
471472

472473
dom.importCssString(`.ace_prompt_container {
473-
max-width: 600px;
474+
max-width: 603px;
474475
width: 100%;
475476
margin: 20px auto;
476477
padding: 3px;

0 commit comments

Comments
 (0)