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