Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
KonnorRogers committed Nov 22, 2024
1 parent e281841 commit bf21676
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/exports/elements/tip-tap-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,24 +355,25 @@ export class TipTapEditor extends TipTapEditorBase {
return;
}

if (!this.editor) { return }
if (!this.editor) {
return;
}

if (href) {
this.closeLinkDialog();
inputElement.value = "";

if (this.editor.state.selection.empty && !this.editor.getAttributes('link').href) {
if (
this.editor.state.selection.empty &&
!this.editor.getAttributes("link").href
) {
const from = this.editor.state.selection.anchor;
this.editor.commands.insertContent(href);
const to = this.editor.state.selection.anchor;
this.editor.commands.setTextSelection({from, to});
this.editor.commands.setTextSelection({ from, to });
}

this.editor
?.chain()
.extendMarkRange("link")
.setLink({ href })
.run();
this.editor?.chain().extendMarkRange("link").setLink({ href }).run();
}
}

Expand Down

0 comments on commit bf21676

Please sign in to comment.