Merge pull request #1671 from hmhealey/plt1430
PLT-1430 Removed space bar from autocompletes
Этот коммит содержится в:
@@ -39,7 +39,6 @@ export default class CommandProvider {
|
|||||||
handlePretextChanged(suggestionId, pretext) {
|
handlePretextChanged(suggestionId, pretext) {
|
||||||
if (pretext.startsWith('/')) {
|
if (pretext.startsWith('/')) {
|
||||||
SuggestionStore.setMatchedPretext(suggestionId, pretext);
|
SuggestionStore.setMatchedPretext(suggestionId, pretext);
|
||||||
SuggestionStore.setCompleteOnSpace(suggestionId, false);
|
|
||||||
|
|
||||||
AsyncClient.getSuggestedCommands(pretext, suggestionId, CommandSuggestion);
|
AsyncClient.getSuggestedCommands(pretext, suggestionId, CommandSuggestion);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ export default class SuggestionBox extends React.Component {
|
|||||||
} else if (e.which === KeyCodes.DOWN) {
|
} else if (e.which === KeyCodes.DOWN) {
|
||||||
EventHelpers.emitSelectNextSuggestion(this.suggestionId);
|
EventHelpers.emitSelectNextSuggestion(this.suggestionId);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
} else if (e.which === KeyCodes.ENTER || e.which === KeyCodes.TAB || (e.which === KeyCodes.SPACE && SuggestionStore.shouldCompleteOnSpace(this.suggestionId))) {
|
} else if (e.which === KeyCodes.ENTER || e.which === KeyCodes.TAB) {
|
||||||
EventHelpers.emitCompleteWordSuggestion(this.suggestionId);
|
EventHelpers.emitCompleteWordSuggestion(this.suggestionId);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
} else if (this.props.onKeyDown) {
|
} else if (this.props.onKeyDown) {
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ class SuggestionStore extends EventEmitter {
|
|||||||
// items: a list of objects backing the terms which may be used in rendering
|
// items: a list of objects backing the terms which may be used in rendering
|
||||||
// components: a list of react components that can be used to render their corresponding item
|
// components: a list of react components that can be used to render their corresponding item
|
||||||
// selection: the term currently selected by the keyboard
|
// selection: the term currently selected by the keyboard
|
||||||
// completeOnSpace: whether or not space will trigger the term to be autocompleted
|
|
||||||
this.suggestions = new Map();
|
this.suggestions = new Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,8 +78,7 @@ class SuggestionStore extends EventEmitter {
|
|||||||
terms: [],
|
terms: [],
|
||||||
items: [],
|
items: [],
|
||||||
components: [],
|
components: [],
|
||||||
selection: '',
|
selection: ''
|
||||||
completeOnSpace: true
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +93,6 @@ class SuggestionStore extends EventEmitter {
|
|||||||
suggestion.terms = [];
|
suggestion.terms = [];
|
||||||
suggestion.items = [];
|
suggestion.items = [];
|
||||||
suggestion.components = [];
|
suggestion.components = [];
|
||||||
suggestion.completeOnSpace = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection(id) {
|
clearSelection(id) {
|
||||||
@@ -120,12 +117,6 @@ class SuggestionStore extends EventEmitter {
|
|||||||
suggestion.matchedPretext = matchedPretext;
|
suggestion.matchedPretext = matchedPretext;
|
||||||
}
|
}
|
||||||
|
|
||||||
setCompleteOnSpace(id, completeOnSpace) {
|
|
||||||
const suggestion = this.suggestions.get(id);
|
|
||||||
|
|
||||||
suggestion.completeOnSpace = completeOnSpace;
|
|
||||||
}
|
|
||||||
|
|
||||||
addSuggestion(id, term, item, component) {
|
addSuggestion(id, term, item, component) {
|
||||||
const suggestion = this.suggestions.get(id);
|
const suggestion = this.suggestions.get(id);
|
||||||
|
|
||||||
@@ -189,10 +180,6 @@ class SuggestionStore extends EventEmitter {
|
|||||||
return this.suggestions.get(id).selection;
|
return this.suggestions.get(id).selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldCompleteOnSpace(id) {
|
|
||||||
return this.suggestions.get(id).completeOnSpace;
|
|
||||||
}
|
|
||||||
|
|
||||||
selectNext(id) {
|
selectNext(id) {
|
||||||
this.setSelectionByDelta(id, 1);
|
this.setSelectionByDelta(id, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user