From cebbe57f56225db86c2be077a4a4f8340e81c3ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=94=AF=E4=BD=B3?= Date: Wed, 17 Oct 2018 15:25:08 +0800 Subject: [PATCH 1/2] =?UTF-8?q?ios=20=E6=97=A0=E6=B3=95=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E5=88=B0=E5=BA=95=E9=83=A8=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/RichTextEditor.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/RichTextEditor.js b/src/RichTextEditor.js index 51e212ef..2d567058 100644 --- a/src/RichTextEditor.js +++ b/src/RichTextEditor.js @@ -87,10 +87,13 @@ export default class RichTextEditor extends Component { setEditorAvailableHeightBasedOnKeyboardHeight(keyboardHeight) { const {top = 0, bottom = 0} = this.props.contentInset; - const {marginTop = 0, marginBottom = 0} = this.props.style; + const {marginTop = 0, marginBottom = 0, height = undefined} = this.props.style; const spacing = marginTop + marginBottom + top + bottom; - const editorAvailableHeight = Dimensions.get('window').height - keyboardHeight - spacing; + let editorAvailableHeight = Dimensions.get('window').height - keyboardHeight - spacing; + if (height) { + editorAvailableHeight = height - keyboardHeight - spacing; + } this.setEditorHeight(editorAvailableHeight); } From 35bf92c56082c3842c20ff72658761dcd78e88d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=94=AF=E4=BD=B3?= Date: Thu, 18 Oct 2018 11:19:28 +0800 Subject: [PATCH 2/2] fix web var undefault --- src/editor.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/editor.html b/src/editor.html index 1b30f937..5d99dad4 100644 --- a/src/editor.html +++ b/src/editor.html @@ -1067,8 +1067,10 @@ var selection = window.getSelection(); selection.removeAllRanges(); var range = document.createRange(); - range.setStart(zss_editor.currentSelection.startContainer, zss_editor.currentSelection.startOffset); - range.setEnd(zss_editor.currentSelection.endContainer, zss_editor.currentSelection.endOffset); + if (zss_editor.currentSelection) { + range.setStart(zss_editor.currentSelection.startContainer, zss_editor.currentSelection.startOffset); + range.setEnd(zss_editor.currentSelection.endContainer, zss_editor.currentSelection.endOffset); + } selection.addRange(range); }