# Adding a link to a canned reply

**URL:** https://meta.discourse.org/t/adding-a-link-to-a-canned-reply/200997
**Category:** Feature
**Created:** [August 19, 2021, 5:00pm UTC](https://meta.discourse.org/t/adding-a-link-to-a-canned-reply/200997 "2021-08-19T17:00:57Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![ganncamp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ganncamp/32/106199_2.png) [@ganncamp](https://meta.discourse.org/u/ganncamp)
#### Post date: [August 19, 2021, 5:00pm UTC](https://meta.discourse.org/t/adding-a-link-to-a-canned-reply/200997/1 "2021-08-19T17:00:57Z")

</div>

I just tried to add a link to an existing canned reply. When I ctrl-k’d, the link-editing popup replaced the canned reply-editing popup and I lost all my edits. 😢

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [August 19, 2021, 7:40pm UTC](https://meta.discourse.org/t/adding-a-link-to-a-canned-reply/200997/2 "2021-08-19T19:40:35Z")

</div>

> [@ganncamp](#):
>
> When I ctrl-k’d, the link-editing popup replaced the canned reply-editing popup and I lost all my edits.

Oh no! I’ve just tried to reproduce the issue on my hosted Discourse site. When I open the insert link modal with ctrl-k, I’m not actually able to insert the link. Instead, I get the following error in my browser’s console: `Cannot read property 'querySelector' of null` called from [https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/components/d-editor.js#L878](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/components/d-editor.js#L878).

I’m not sure if this should be a feature request or a bug report. I guess the feature request is to support using the insert link modal when editing canned replies.

What browser and operating system were you using when you lost your edits?

---

<div class="post-metadata">

### Author: ![ganncamp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ganncamp/32/106199_2.png) [@ganncamp](https://meta.discourse.org/u/ganncamp)
#### Post date: [August 20, 2021, 11:48am UTC](https://meta.discourse.org/t/adding-a-link-to-a-canned-reply/200997/3 "2021-08-20T11:48:23Z")

</div>

I’m on Ubuntu/Chrome

Also, I should maybe have added to the OP that the link popup seemed to behave a little oddly: I couldn’t `esc` out of it.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 17, 2022, 7:54pm UTC](https://meta.discourse.org/t/adding-a-link-to-a-canned-reply/200997/4 "2022-01-17T19:54:32Z")

</div>

Can we still repro this @simon?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [January 17, 2022, 8:11pm UTC](https://meta.discourse.org/t/adding-a-link-to-a-canned-reply/200997/5 "2022-01-17T20:11:23Z")

</div>

Testing this just now, if I hit Ctrl + K to open the link modal when creating a new whisper, after clicking the “OK” button to insert the link, the canned reply that I was composing disappears. I am not seeing any errors in my console. Testing this with the latest Chrome browser on Ubuntu.

I’m assuming the issue is related to both “Add Canned Reply” and “Insert Hyperlink” using modal windows. When the Insert Hyperlink modal is opened the Add Canned Reply modal automatically closes.
