Skip to content

Commit

Permalink
fix: empty title case
Browse files Browse the repository at this point in the history
Fixes #350
  • Loading branch information
petyosi committed Apr 7, 2024
1 parent fbbc9c8 commit 089c29f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/plugins/link-dialog/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ export const linkDialogState$ = Cell<InactiveLinkDialog | PreviewLinkDialog | Ed
)

r.sub(r.pipe(updateLink$, withLatestFrom(activeEditor$, linkDialogState$, currentSelection$)), ([payload, editor, state, selection]) => {
const url = payload.url.trim()
const title = payload.title.trim()
const url = payload.url?.trim() ?? ''
const title = payload.title?.trim() ?? ''

if (url.trim() !== '') {
if (url !== '') {
if (selection?.isCollapsed()) {
const linkContent = title || url
editor?.update(
Expand Down

0 comments on commit 089c29f

Please sign in to comment.