From 576a63fd61155505b38fd7a79d07a5eecf1fc187 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 24 Feb 2017 22:55:24 +0100 Subject: [PATCH] Fullscreen fix --- .../angular/markdown-editor.component.html | 6 +++++- .../angular/markdown-editor.component.scss | 9 +++++++++ .../angular/markdown-editor.component.ts | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/Squidex/app/framework/angular/markdown-editor.component.html b/src/Squidex/app/framework/angular/markdown-editor.component.html index e37c91756..b6efd8dc8 100644 --- a/src/Squidex/app/framework/angular/markdown-editor.component.html +++ b/src/Squidex/app/framework/angular/markdown-editor.component.html @@ -1 +1,5 @@ - \ No newline at end of file +
+
+ +
+
\ No newline at end of file diff --git a/src/Squidex/app/framework/angular/markdown-editor.component.scss b/src/Squidex/app/framework/angular/markdown-editor.component.scss index 38eac8026..834b5b55c 100644 --- a/src/Squidex/app/framework/angular/markdown-editor.component.scss +++ b/src/Squidex/app/framework/angular/markdown-editor.component.scss @@ -1,6 +1,15 @@ @import '_mixins'; @import '_vars'; +$background: #fff; + .editor { height: 30rem; +} + +.fullscreen { + @include fixed(0, 0, 0, 0); + border: 0; + background: $background; + z-index: 100000; } \ No newline at end of file diff --git a/src/Squidex/app/framework/angular/markdown-editor.component.ts b/src/Squidex/app/framework/angular/markdown-editor.component.ts index dd74c6af7..3bbbe4184 100644 --- a/src/Squidex/app/framework/angular/markdown-editor.component.ts +++ b/src/Squidex/app/framework/angular/markdown-editor.component.ts @@ -35,6 +35,14 @@ export class MarkdownEditorComponent implements ControlValueAccessor, AfterViewI @ViewChild('editor') public editor: ElementRef; + @ViewChild('container') + public container: ElementRef; + + @ViewChild('inner') + public inner: ElementRef; + + public isFullscreen = false; + constructor( private readonly resourceLoader: ResourceLoaderService ) { @@ -75,6 +83,16 @@ export class MarkdownEditorComponent implements ControlValueAccessor, AfterViewI this.changeCallback(value); }); + + this.simplemde.codemirror.on('refresh', () => { + this.isFullscreen = this.simplemde.isFullscreenActive(); + + if (this.isFullscreen) { + document.body.appendChild(this.inner.nativeElement); + } else { + this.container.nativeElement.appendChild(this.inner.nativeElement); + } + }); }); } } \ No newline at end of file