diff --git a/src/app/components/editor/code/code.component.ts b/src/app/components/editor/code/code.component.ts index 9f7cb3a..d7c59ea 100644 --- a/src/app/components/editor/code/code.component.ts +++ b/src/app/components/editor/code/code.component.ts @@ -11,6 +11,7 @@ import {EditorService} from '../../../service/editor.service'; }) export class CodeComponent extends EditorNodeContract implements OnInit { @Input() nodeId: string; + @Input() editorUUID?: string; public dirty = false; protected dbRecord: any = {}; protected codeRefId!: string; @@ -95,7 +96,7 @@ export class CodeComponent extends EditorNodeContract implements OnInit { protected hadLoad = false; constructor( - public readonly editorService: EditorService, + public editorService: EditorService, public readonly api: ApiService, ) { super(); } @@ -183,6 +184,7 @@ export class CodeComponent extends EditorNodeContract implements OnInit { } ngOnInit() { + this.editorService = this.editorService.getEditor(this.editorUUID); this.editorService.registerNodeEditor(this.nodeId, this).then(() => { this.editorOptions.readOnly = !this.editorService.canEdit(); }); diff --git a/src/app/components/editor/database/database.component.ts b/src/app/components/editor/database/database.component.ts index 9106e91..df4e88f 100644 --- a/src/app/components/editor/database/database.component.ts +++ b/src/app/components/editor/database/database.component.ts @@ -22,6 +22,7 @@ import {EditorService} from '../../../service/editor.service'; }) export class DatabaseComponent extends EditorNodeContract implements OnInit { @Input() nodeId: string; + @Input() editorUUID?: string; @ViewChild('agGridElement') agGridElement: AgGridAngular; public dbRecord: any; @@ -41,7 +42,7 @@ export class DatabaseComponent extends EditorNodeContract implements OnInit { protected modals: ModalController, protected alerts: AlertController, protected loader: LoadingController, - public readonly editorService: EditorService, + public editorService: EditorService, ) { super(); } title = 'app'; @@ -65,6 +66,7 @@ export class DatabaseComponent extends EditorNodeContract implements OnInit { } ngOnInit() { + this.editorService = this.editorService.getEditor(this.editorUUID); this.editorService.registerNodeEditor(this.nodeId, this).then(() => { console.log('database editor', this); }); diff --git a/src/app/components/editor/files/files.component.ts b/src/app/components/editor/files/files.component.ts index 234f724..7d1c96f 100644 --- a/src/app/components/editor/files/files.component.ts +++ b/src/app/components/editor/files/files.component.ts @@ -12,6 +12,7 @@ import {EditorNodeContract} from '../../nodes/EditorNode.contract'; }) export class FilesComponent extends EditorNodeContract implements OnInit { @Input() nodeId: string; + @Input() editorUUID: string; @ViewChild('uploadForm') uploadForm: ElementRef; public fileRecords: Array = []; @@ -26,7 +27,7 @@ export class FilesComponent extends EditorNodeContract implements OnInit { constructor( protected api: ApiService, - public readonly editorService: EditorService, + public editorService: EditorService, @Inject(APP_BASE_HREF) private baseHref: string ) { super(); } @@ -76,6 +77,7 @@ export class FilesComponent extends EditorNodeContract implements OnInit { } ngOnInit() { + this.editorService = this.editorService.getEditor(this.editorUUID); this.editorService.registerNodeEditor(this.nodeId, this).then(() => { }); diff --git a/src/app/components/nodes/markdown/markdown.component.ts b/src/app/components/nodes/markdown/markdown.component.ts index 2ebcc6d..c490426 100644 --- a/src/app/components/nodes/markdown/markdown.component.ts +++ b/src/app/components/nodes/markdown/markdown.component.ts @@ -11,6 +11,7 @@ import {v4} from 'uuid'; export class MarkdownComponent extends EditorNodeContract implements OnInit { // @ViewChild('editable') editable; @Input() nodeId: string; + @Input() editorUUID?: string; // public isFocused = false; public initialValue = 'Click to edit...'; @@ -29,7 +30,7 @@ export class MarkdownComponent extends EditorNodeContract implements OnInit { }; constructor( - public readonly editorService: EditorService, + public editorService: EditorService, ) { super(); this.contents = this.initialValue; @@ -37,6 +38,7 @@ export class MarkdownComponent extends EditorNodeContract implements OnInit { } ngOnInit() { + this.editorService = this.editorService.getEditor(this.editorUUID); this.editorService.registerNodeEditor(this.nodeId, this).then(() => { if ( !this.node.Value ) { this.node.Value = {}; diff --git a/src/app/components/nodes/norm/norm.component.ts b/src/app/components/nodes/norm/norm.component.ts index 0eb7be2..d6b6f56 100644 --- a/src/app/components/nodes/norm/norm.component.ts +++ b/src/app/components/nodes/norm/norm.component.ts @@ -10,6 +10,7 @@ import {EditorService} from '../../../service/editor.service'; export class NormComponent extends EditorNodeContract implements OnInit { @ViewChild('editable') editable; @Input() nodeId: string; + @Input() editorUUID?: string; public isFocused = false; public initialValue = 'Click to edit...'; @@ -19,7 +20,7 @@ export class NormComponent extends EditorNodeContract implements OnInit { protected hadOneFocusOut = false; constructor( - public readonly editorService: EditorService, + public editorService: EditorService, ) { super(); this.contents = this.initialValue; @@ -36,6 +37,7 @@ export class NormComponent extends EditorNodeContract implements OnInit { } ngOnInit() { + this.editorService = this.editorService.getEditor(this.editorUUID); this.editorService.registerNodeEditor(this.nodeId, this).then(() => { if ( !this.node.Value ) { this.node.Value = {}; diff --git a/src/app/pages/editor/editor.page.html b/src/app/pages/editor/editor.page.html index 933d86f..8cdc5e0 100644 --- a/src/app/pages/editor/editor.page.html +++ b/src/app/pages/editor/editor.page.html @@ -48,19 +48,19 @@ - + - + - + - + - +