refactor: rename EditorView.state.allStackComponents to stackComponents

This commit is contained in:
Baptiste Grob
2020-07-07 16:57:52 +02:00
parent 1a5a5021d5
commit d7c8efee25

View File

@@ -57,10 +57,9 @@ type NoteStatus = {
}
type EditorState = {
allStackComponents: SNComponent[]
stackComponents: SNComponent[]
activeEditorComponent?: SNComponent
activeTagsComponent?: SNComponent
activeStackComponents: SNComponent[]
saveError?: any
noteStatus?: NoteStatus
tagsAsStrings?: string
@@ -228,8 +227,7 @@ class EditorViewCtrl extends PureViewCtrl<{}, EditorState> {
/** @override */
getInitialState() {
return {
allStackComponents: [],
activeStackComponents: [],
stackComponents: [],
editorDebounce: EDITOR_DEBOUNCE,
isDesktop: isDesktopApplication(),
spellcheck: true,
@@ -385,7 +383,7 @@ class EditorViewCtrl extends PureViewCtrl<{}, EditorState> {
async (items) => {
if (!this.note) return;
this.setState({
allStackComponents: sortAlphabetically(
stackComponents: sortAlphabetically(
this.application.componentManager!.componentsForArea(ComponentArea.EditorStack)
.filter(component => component.active)
)
@@ -1063,7 +1061,7 @@ class EditorViewCtrl extends PureViewCtrl<{}, EditorState> {
if (
componentUuid === currentEditor?.uuid ||
componentUuid === this.activeTagsComponent?.uuid ||
Uuids(this.state.allStackComponents).includes(componentUuid)
Uuids(this.state.stackComponents).includes(componentUuid)
) {
return this.note;
}
@@ -1127,7 +1125,7 @@ class EditorViewCtrl extends PureViewCtrl<{}, EditorState> {
reloadComponentContext() {
if (this.note) {
for (const component of this.state.allStackComponents!) {
for (const component of this.state.stackComponents!) {
if (component.active) {
this.application.componentManager!.setComponentHidden(
component,