From ab48a0843994eb2d70ef9f3955f0b25bc65a66a1 Mon Sep 17 00:00:00 2001 From: Jolene Langlinais Date: Thu, 14 May 2020 14:04:36 -0400 Subject: [PATCH] fix(cicero-ui): prevent backspace at variable start - I78 (#80) Signed-off-by: irmerk --- DEVELOPERS.md | 11 +++++++++++ .../src/lib/ContractEditor/plugins/withVariables.js | 3 +++ 2 files changed, 14 insertions(+) diff --git a/DEVELOPERS.md b/DEVELOPERS.md index 31b07ec1..846d2d7f 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -36,4 +36,15 @@ cd packages/storybook npm run storybook ``` +### Develop inside Storybook + +While Storybook is running, if you make a change in a package that you want to see reflected in the demo, in a new terminal: + +``` +cd packages/ +npm run build +``` + +Storybook will reload with the applied changes. + [apdev]: https://github.com/accordproject/techdocs/blob/master/DEVELOPERS.md \ No newline at end of file diff --git a/packages/cicero-ui/src/lib/ContractEditor/plugins/withVariables.js b/packages/cicero-ui/src/lib/ContractEditor/plugins/withVariables.js index e6ceab59..e0f9e7a0 100644 --- a/packages/cicero-ui/src/lib/ContractEditor/plugins/withVariables.js +++ b/packages/cicero-ui/src/lib/ContractEditor/plugins/withVariables.js @@ -57,6 +57,9 @@ export const isEditableVariable = (lockText, editor, event) => { const nextNode = Editor.next(editor, { at: editor.selection.focus.path }); // if the current focus is at the end of a node & the next node is a variable allow editing if (nextNode && nextNode[0].type === VARIABLE && textLength === editor.selection.focus.offset) { + if (event.inputType === 'deleteContentBackward') { + return false; + } return true; } return inVariable(editor);