Merge pull request #1347 from esteemapp/bugfix/editor-selection

Bugfix/editor selection
This commit is contained in:
Feruz M 2019-12-03 04:40:49 +02:00 committed by GitHub
commit 11ca8e3185
3 changed files with 8 additions and 11 deletions

View File

@ -1,4 +0,0 @@
module.exports = {
root: true,
extends: '@react-native-community',
};

View File

@ -7,7 +7,8 @@
"plugin:eslint-comments/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:jest/recommended"
"plugin:jest/recommended",
"@react-native-community"
],
"env": {
"browser": true,
@ -46,7 +47,7 @@
"no-case-declarations": "off",
"no-cycle": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react-hooks/exhaustive-deps": "off",
"import/no-extraneous-dependencies": [
"error",
{

View File

@ -45,13 +45,13 @@ const MarkdownEditorView = ({
if (!isPreviewActive) {
_setTextAndSelection({ selection: { start: 0, end: 0 }, text });
}
}, [_setTextAndSelection, isPreviewActive, text]);
}, [isPreviewActive]);
useEffect(() => {
if (text === '' && draftBody !== '') {
_setTextAndSelection({ selection: { start: 0, end: 0 }, text: draftBody });
}
}, [_setTextAndSelection, draftBody, text]);
}, [draftBody]);
useEffect(() => {
if (editable === null) {
@ -63,7 +63,7 @@ const MarkdownEditorView = ({
} else {
setEditable(!isLoading);
}
}, [editable, isLoading]);
}, [isLoading]);
useEffect(() => {
if (uploadedImage && uploadedImage.url) {
@ -75,7 +75,7 @@ const MarkdownEditorView = ({
isImage: !!uploadedImage,
});
}
}, [_setTextAndSelection, selection, text, uploadedImage]);
}, [uploadedImage]);
useEffect(() => {
setText(draftBody);
@ -91,7 +91,7 @@ const MarkdownEditorView = ({
handleIsFormValid(text);
}
}
}, [_changeText, handleIsFormValid, text]);
}, [text]);
// eslint-disable-next-line react-hooks/exhaustive-deps
const _changeText = useCallback(input => {