Skip to content

Commit d78ea8f

Browse files
committed
Restore addition of links
1 parent b2b0765 commit d78ea8f

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

django_prose_editor/static/django_prose_editor/editor.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

django_prose_editor/static/django_prose_editor/editor.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/link.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,16 @@ export const Link = BaseLink.extend({
104104

105105
linkDialog(editor, attrs, this.options).then((attrs) => {
106106
if (attrs) {
107-
editor
108-
.chain()
109-
.focus()
110-
.extendMarkRange(this.name)
111-
.updateAttributes(this.name, attrs)
112-
.run()
107+
if (editor.isActive("link")) {
108+
editor
109+
.chain()
110+
.focus()
111+
.extendMarkRange(this.name)
112+
.updateAttributes(this.name, attrs)
113+
.run()
114+
} else {
115+
editor.chain().focus().setMark(this.name, attrs).run()
116+
}
113117
}
114118
})
115119
}

0 commit comments

Comments
 (0)