feat: multiple selected notes panel

This commit is contained in:
Baptiste Grob
2021-04-08 11:30:56 +02:00
parent 0f53361689
commit abfc588368
36 changed files with 542 additions and 128 deletions

View File

@@ -1,7 +1,14 @@
.flex-grow(
ng-repeat='editor in self.editors'
)
editor-view(
.h-full
multiple-selected-notes-panel.h-full(
app-state='self.appState'
application='self.application'
editor='editor'
ng-if='self.state.showMultipleSelectedNotes'
)
.flex-grow.h-full(
ng-if='!self.state.showMultipleSelectedNotes'
ng-repeat='editor in self.editors'
)
editor-view(
application='self.application'
editor='editor'
)

View File

@@ -2,16 +2,31 @@ import { WebApplication } from '@/ui_models/application';
import { WebDirective } from './../../types';
import template from './editor-group-view.pug';
import { Editor } from '@/ui_models/editor';
import { PureViewCtrl } from '../abstract/pure_view_ctrl';
class EditorGroupViewCtrl {
class EditorGroupViewCtrl extends PureViewCtrl<unknown, {
showMultipleSelectedNotes: boolean
}> {
private application!: WebApplication
public editors: Editor[] = []
/* @ngInject */
constructor($timeout: ng.ITimeoutService,) {
super($timeout);
this.state = {
showMultipleSelectedNotes: false
}
}
$onInit() {
this.application.editorGroup.addChangeObserver(() => {
this.editors = this.application.editorGroup.editors;
});
this.autorun(() => {
this.setState({
showMultipleSelectedNotes: this.appState.notes.selectedNotesCount > 1
});
});
}
}
@@ -20,7 +35,6 @@ export class EditorGroupView extends WebDirective {
super();
this.template = template;
this.controller = EditorGroupViewCtrl;
this.replace = true;
this.controllerAs = 'self';
this.bindToController = true;
this.scope = {