From 3151d797f778b53d43aae02456a36709db5dbe4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B5=D0=B2=D1=80=D0=B8=D0=B7=D0=BC=D0=B0?= Date: Mon, 21 Jan 2019 16:33:19 +0300 Subject: [PATCH] Jero/hotfix/initial value rich editor (#891) * feat (RichEditor) trigger initial value * refactor (Manage/Store/Products/Product) set font-size for long description label * refactor (Manage/Store/Products/Product) apply styles for asterisk --- src/components/RichEditor/RichEditor.js | 23 ++++++++++++++++++- .../Store/Products/Product/Product.scss | 11 ++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/components/RichEditor/RichEditor.js b/src/components/RichEditor/RichEditor.js index 82ac0a47..349b82f5 100644 --- a/src/components/RichEditor/RichEditor.js +++ b/src/components/RichEditor/RichEditor.js @@ -34,6 +34,14 @@ const menu = { tools: { title: 'Tools', items: 'spellchecker code' }, }; +const initialValue = ` +

+ + Write something... + +

+`; + class RichEditor extends Component { static defaultProps = { onChange: () => {}, @@ -44,14 +52,27 @@ class RichEditor extends Component { onChange(text); }; + isContentEmpty = (): boolean => { + const { content } = this.props; + return isEmpty(content); + }; + // $FlowIgnore + handleInit = e => { + if (this.isContentEmpty()) { + const { target } = e; + this.handleEditorChange(target.getContent()); + } + }; + render() { const { content, onError } = this.props; return (