From 79d790aa6f5c7d6384ced2be8f3916ef4f601bb8 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Mon, 17 Apr 2017 13:36:36 +0300 Subject: [PATCH] if containerId equals mini editor don't create an empty paragraph --- app/components/SimpleEditor/ContainerEditor.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/app/components/SimpleEditor/ContainerEditor.js b/app/components/SimpleEditor/ContainerEditor.js index 65ef7f4..ae552f5 100644 --- a/app/components/SimpleEditor/ContainerEditor.js +++ b/app/components/SimpleEditor/ContainerEditor.js @@ -35,7 +35,7 @@ class ContainerEditor extends SubstanceContainerEditor { didMount () { super.didMount() - if (this.isEmpty()) this.createText() + if (this.isEmpty() && this.props.containerId !== 'mini') this.createText() // TODO -- why this and not this.focus ? this.el.focus() @@ -193,13 +193,12 @@ class ContainerEditor extends SubstanceContainerEditor { }) container.show(node.id) - const containerId = this.getContainerId() newSel = tx.createSelection({ type: 'property', // TODO -- both id's ?? - containerId: containerId, - surfaceId: containerId, + containerId: this.props.containerId, + surfaceId: this.props.containerId, path: [ node.id, 'content' ], startOffset: 0, endOffset: 0 @@ -237,12 +236,6 @@ class ContainerEditor extends SubstanceContainerEditor { ) } - getContainerId () { - let containerId = this.props.containerId - if (typeof containerId === 'undefined') containerId = 'mini' - return containerId - } - getEditor () { return this.context.editor } -- GitLab