mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
fix blanks
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { power_user } from '../power-user.js';
|
import { power_user } from '../power-user.js';
|
||||||
import { debounce, escapeRegex } from '../utils.js';
|
import { debounce, escapeRegex } from '../utils.js';
|
||||||
import { OPTION_TYPE, SlashCommandAutoCompleteOption, SlashCommandFuzzyScore } from './SlashCommandAutoCompleteOption.js';
|
import { SlashCommandAutoCompleteOption, SlashCommandFuzzyScore } from './SlashCommandAutoCompleteOption.js';
|
||||||
|
import { SlashCommandBlankAutoCompleteOption } from './SlashCommandBlankAutoCompleteOption.js';
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
import { SlashCommandParserNameResult } from './SlashCommandParserNameResult.js';
|
import { SlashCommandParserNameResult } from './SlashCommandParserNameResult.js';
|
||||||
|
|
||||||
@@ -101,7 +102,6 @@ export class SlashCommandAutoComplete {
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {SlashCommandAutoCompleteOption} option
|
* @param {SlashCommandAutoCompleteOption} option
|
||||||
* @returns
|
|
||||||
*/
|
*/
|
||||||
makeItem(option) {
|
makeItem(option) {
|
||||||
const li = option.renderItem();
|
const li = option.renderItem();
|
||||||
@@ -313,17 +313,12 @@ export class SlashCommandAutoComplete {
|
|||||||
return this.hide();
|
return this.hide();
|
||||||
}
|
}
|
||||||
// otherwise add "no match" notice
|
// otherwise add "no match" notice
|
||||||
const option = new SlashCommandAutoCompleteOption(
|
const option = new SlashCommandBlankAutoCompleteOption(
|
||||||
OPTION_TYPE.BLANK,
|
this.name.length ?
|
||||||
null,
|
|
||||||
'',
|
|
||||||
);
|
|
||||||
const li = document.createElement('li'); {
|
|
||||||
li.textContent = this.name.length ?
|
|
||||||
this.parserResult.makeNoMatchText()
|
this.parserResult.makeNoMatchText()
|
||||||
: this.parserResult.makeNoOptionstext();
|
: this.parserResult.makeNoOptionstext()
|
||||||
}
|
,
|
||||||
option.dom = li;
|
);
|
||||||
this.result.push(option);
|
this.result.push(option);
|
||||||
} else if (this.result.length == 1 && this.parserResult && this.result[0].name == this.parserResult.name) {
|
} else if (this.result.length == 1 && this.parserResult && this.result[0].name == this.parserResult.name) {
|
||||||
// only one result that is exactly the current value? just show hint, no autocomplete
|
// only one result that is exactly the current value? just show hint, no autocomplete
|
||||||
|
@@ -0,0 +1,27 @@
|
|||||||
|
import { SlashCommandAutoCompleteOption } from './SlashCommandAutoCompleteOption.js';
|
||||||
|
|
||||||
|
export class SlashCommandBlankAutoCompleteOption extends SlashCommandAutoCompleteOption {
|
||||||
|
/**
|
||||||
|
* @param {string} value
|
||||||
|
*/
|
||||||
|
constructor(value) {
|
||||||
|
super(value, value);
|
||||||
|
this.dom = this.renderItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
renderItem() {
|
||||||
|
const li = document.createElement('li'); {
|
||||||
|
li.classList.add('item');
|
||||||
|
li.classList.add('blank');
|
||||||
|
li.textContent = this.name;
|
||||||
|
}
|
||||||
|
return li;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
renderDetails() {
|
||||||
|
const frag = document.createDocumentFragment();
|
||||||
|
return frag;
|
||||||
|
}
|
||||||
|
}
|
@@ -1326,6 +1326,10 @@ body[data-stscript-style] .hljs.language-stscript {
|
|||||||
gap: 0.5em;
|
gap: 0.5em;
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
display: contents;
|
display: contents;
|
||||||
|
&.blank {
|
||||||
|
display: block;
|
||||||
|
grid-column: 1 / 4;
|
||||||
|
}
|
||||||
&:hover > * {
|
&:hover > * {
|
||||||
background-color: var(--ac-color-hoveredBackground);
|
background-color: var(--ac-color-hoveredBackground);
|
||||||
color: var(--ac-color-hoveredText);
|
color: var(--ac-color-hoveredText);
|
||||||
|
Reference in New Issue
Block a user