Fix JS errors with RHS and flagged posts (#4771)
Этот коммит содержится в:
коммит произвёл
enahum
родитель
e28dea6b11
Коммит
27aaa6dad3
@@ -450,7 +450,7 @@ export default class PostList extends React.Component {
|
|||||||
}
|
}
|
||||||
} else if (this.refs.postlist.scrollHeight !== this.prevScrollHeight) {
|
} else if (this.refs.postlist.scrollHeight !== this.prevScrollHeight) {
|
||||||
window.requestAnimationFrame(() => {
|
window.requestAnimationFrame(() => {
|
||||||
if (this.jumpToPostNode) {
|
if (this.jumpToPostNode && this.refs.postlist) {
|
||||||
this.refs.postlist.scrollTop += (this.jumpToPostNode.offsetTop - this.prevOffsetTop);
|
this.refs.postlist.scrollTop += (this.jumpToPostNode.offsetTop - this.prevOffsetTop);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class SuggestionStore extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clearSuggestions(id) {
|
clearSuggestions(id) {
|
||||||
const suggestion = this.suggestions.get(id);
|
const suggestion = this.getSuggestions(id);
|
||||||
|
|
||||||
suggestion.matchedPretext = [];
|
suggestion.matchedPretext = [];
|
||||||
suggestion.terms = [];
|
suggestion.terms = [];
|
||||||
@@ -96,23 +96,23 @@ class SuggestionStore extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clearSelection(id) {
|
clearSelection(id) {
|
||||||
const suggestion = this.suggestions.get(id);
|
const suggestion = this.getSuggestions(id);
|
||||||
|
|
||||||
suggestion.selection = '';
|
suggestion.selection = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
hasSuggestions(id) {
|
hasSuggestions(id) {
|
||||||
return this.suggestions.get(id).terms.length > 0;
|
return this.getSuggestions(id).terms.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
setPretext(id, pretext) {
|
setPretext(id, pretext) {
|
||||||
const suggestion = this.suggestions.get(id);
|
const suggestion = this.getSuggestions(id);
|
||||||
|
|
||||||
suggestion.pretext = pretext;
|
suggestion.pretext = pretext;
|
||||||
}
|
}
|
||||||
|
|
||||||
addSuggestion(id, term, item, component, matchedPretext) {
|
addSuggestion(id, term, item, component, matchedPretext) {
|
||||||
const suggestion = this.suggestions.get(id);
|
const suggestion = this.getSuggestions(id);
|
||||||
|
|
||||||
suggestion.terms.push(term);
|
suggestion.terms.push(term);
|
||||||
suggestion.items.push(item);
|
suggestion.items.push(item);
|
||||||
@@ -126,7 +126,7 @@ class SuggestionStore extends EventEmitter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const suggestion = this.suggestions.get(id);
|
const suggestion = this.getSuggestions(id);
|
||||||
|
|
||||||
suggestion.terms.push(...terms);
|
suggestion.terms.push(...terms);
|
||||||
suggestion.items.push(...items);
|
suggestion.items.push(...items);
|
||||||
@@ -139,7 +139,7 @@ class SuggestionStore extends EventEmitter {
|
|||||||
|
|
||||||
// make sure that if suggestions exist, then one of them is selected. return true if the selection changes.
|
// make sure that if suggestions exist, then one of them is selected. return true if the selection changes.
|
||||||
ensureSelectionExists(id) {
|
ensureSelectionExists(id) {
|
||||||
const suggestion = this.suggestions.get(id);
|
const suggestion = this.getSuggestions(id);
|
||||||
|
|
||||||
if (suggestion.terms.length > 0) {
|
if (suggestion.terms.length > 0) {
|
||||||
// if the current selection is no longer in the map, select the first term in the list
|
// if the current selection is no longer in the map, select the first term in the list
|
||||||
@@ -158,11 +158,11 @@ class SuggestionStore extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPretext(id) {
|
getPretext(id) {
|
||||||
return this.suggestions.get(id).pretext;
|
return this.getSuggestions(id).pretext;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSelectedMatchedPretext(id) {
|
getSelectedMatchedPretext(id) {
|
||||||
const suggestion = this.suggestions.get(id);
|
const suggestion = this.getSuggestions(id);
|
||||||
|
|
||||||
for (let i = 0; i < suggestion.terms.length; i++) {
|
for (let i = 0; i < suggestion.terms.length; i++) {
|
||||||
if (suggestion.terms[i] === suggestion.selection) {
|
if (suggestion.terms[i] === suggestion.selection) {
|
||||||
@@ -174,23 +174,23 @@ class SuggestionStore extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getItems(id) {
|
getItems(id) {
|
||||||
return this.suggestions.get(id).items;
|
return this.getSuggestions(id).items;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTerms(id) {
|
getTerms(id) {
|
||||||
return this.suggestions.get(id).terms;
|
return this.getSuggestions(id).terms;
|
||||||
}
|
}
|
||||||
|
|
||||||
getComponents(id) {
|
getComponents(id) {
|
||||||
return this.suggestions.get(id).components;
|
return this.getSuggestions(id).components;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuggestions(id) {
|
getSuggestions(id) {
|
||||||
return this.suggestions.get(id);
|
return this.suggestions.get(id) || {};
|
||||||
}
|
}
|
||||||
|
|
||||||
getSelection(id) {
|
getSelection(id) {
|
||||||
return this.suggestions.get(id).selection;
|
return this.getSuggestions(id).selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
selectNext(id) {
|
selectNext(id) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user