author Ben Hayward
 *  desc import { Component , Input , Output , EventEmitter , Inject , PLATFORM_ID , } from '@angular/core' ; import { isPlatformBrowser } from '@angular/common' ; import { AttachmentService } from '../../../../../services/attachment' ; import { SiteService } from '../../../../../common/services/site.service' ; import { ThemeService } from '../../../../../common/services/theme.service' ; declare var require ; @ Component ( { selector : 'm-blog__editor' , host : { class : 'm-blog' , } , templateUrl : 'editor.component.html' , styleUrls : [ './editor.component.ng.scss' , '../../../view/view.ng.scss' ] , } ) export class BlogEditorComponent { /**
     * Content to place into the editor on load.
     */ @ Input ( ) content : string ; /**
     * Emitted when content changes.
     */ @ Output ( ) contentChanged : EventEmitter < Event > = new EventEmitter < Event > ( ) ; Editor : any ; constructor ( @ Inject ( PLATFORM_ID ) protected platformId , private attachment , private site , public themeService ) { } ngOnInit ( ) { this . themeService . emitThemePreference ( ) ; if ( isPlatformBrowser ( this . platformId ) ) { const MindsEditor = require ( '@bhayward93/ckeditor5-build-minds' ) ; this . Editor = MindsEditor ; this . Editor . config = { uploadHandler : async ( file ) => { const response = this . attachment . upload ( await file ) ; return `${ this . site . baseUrl }fs/v1/thumbnail/${ await response }/xlarge` ; } , isDark$ : this . themeService . isDark$ , } ; } } param Event onContentChanged ( $event ) { this . contentChanged . emit ( $event ) ; } }