Skip to content

Commit 473e602

Browse files
committed
refactor: nested conditions
1 parent bfa0b79 commit 473e602

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/web/formats/EnrichedLink.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,11 @@ export function setLink(
150150
return;
151151
}
152152

153-
if (text.length === 0) {
154-
if (from !== to) {
155-
editor.chain().focus().deleteRange({ from, to }).run();
156-
}
157-
return;
153+
if (text.length === 0 && from !== to) {
154+
editor.chain().focus().deleteRange({ from, to }).run();
158155
}
159156

160-
if (url.length === 0) {
157+
if (text.length === 0 || url.length === 0) {
161158
return;
162159
}
163160

0 commit comments

Comments
 (0)