Commit 24a44ec43365b93c26c09a94ff52ab2d66992464
1 parent
f75c68d0
Exists in
master
and in
9 other branches
Fixed design mode state
Showing
3 changed files
with
14 additions
and
7 deletions
Show diff stats
src/app/admin/layout-edit/designMode.service.ts
| 1 | -import {Injectable, Output, EventEmitter} from 'ng-forward'; | |
| 1 | +import {Injectable, Output, EventEmitter, Inject} from 'ng-forward'; | |
| 2 | +import {INoosferoLocalStorage} from "./../../shared/models/interfaces"; | |
| 2 | 3 | |
| 3 | 4 | @Injectable() |
| 5 | +@Inject("$localStorage") | |
| 4 | 6 | export class DesignModeService { |
| 5 | 7 | @Output() onToggle: EventEmitter<boolean> = new EventEmitter<boolean>(); |
| 6 | 8 | |
| 7 | - private designModeOn: boolean = false; | |
| 9 | + //private designModeOn: boolean = false; | |
| 8 | 10 | |
| 9 | 11 | isInDesignMode(): boolean { |
| 10 | - return this.designModeOn; | |
| 12 | + return this.$localStorage.settings.designModeOn; | |
| 11 | 13 | } |
| 12 | 14 | |
| 13 | 15 | setInDesignMode(value: boolean) { |
| 14 | - if (this.designModeOn !== value) { | |
| 15 | - this.designModeOn = value; | |
| 16 | - this.onToggle.next(this.designModeOn); | |
| 16 | + if (this.$localStorage.settings.designModeOn !== value) { | |
| 17 | + this.$localStorage.settings.designModeOn = value; | |
| 18 | + this.onToggle.next(value); | |
| 17 | 19 | } |
| 18 | 20 | } |
| 19 | 21 | |
| 20 | - constructor() { | |
| 22 | + constructor(private $localStorage: INoosferoLocalStorage) { | |
| 23 | + if (!this.$localStorage.settings) { | |
| 24 | + this.$localStorage.settings = {}; | |
| 25 | + } | |
| 21 | 26 | } |
| 22 | 27 | } | ... | ... |
src/app/login/session.service.ts