Skip to content

Commit

Permalink
[FIX] validations - fix validation for entire jsx selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Sahar Avr committed Jul 30, 2021
1 parent e42b91c commit 6eb7d7a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/splitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const validateSelection = () => {
try { transformCode(`<>${selection}</>`); }
catch { throw new Error('Invalid selection. Make sure your selection represents a valid React component'); }

const codeWithoutSelection = replaceCodeByRange(editor.document.getText(), editor.selection, '');
const codeWithoutSelection = replaceCodeByRange(editor.document.getText(), editor.selection, '<></>');

try { transformCode(codeWithoutSelection); }
catch { throw new Error('Invalid selection. Make sure the code remains valid without your selection'); }
Expand Down

0 comments on commit 6eb7d7a

Please sign in to comment.