# Overriding editor buttons?

**URL:** <https://forums.ankiweb.net/t/overriding-editor-buttons/41188>\
**Category:** Development\
**Created:** [February 16, 2024, 8:31am UTC](https://forums.ankiweb.net/t/overriding-editor-buttons/41188 "2024-02-16T08:31:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![saiyr](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@saiyr](https://forums.ankiweb.net/u/saiyr)\
**Post date:** [February 16, 2024, 8:31am UTC](https://forums.ankiweb.net/t/overriding-editor-buttons/41188/1 "2024-02-16T08:31:16Z")

</div>

I’m trying to update an addon with a fair amount of monkeypatching in it that no longer works. One of the monkeypatches is to override Editor.onCloze, which no longer does anything, presumably because it’s all in JS now. Is it possible to change the behavior of the cloze deletion button and its corresponding keyboard shortcut? Or am I better off just adding a new button and shortcut?

---

<div class="post-metadata">

**Author:** ![abdo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/abdo/32/654_2.png) [@abdo](https://forums.ankiweb.net/u/abdo)\
**Post date:** [February 16, 2024, 4:44pm UTC](https://forums.ankiweb.net/t/overriding-editor-buttons/41188/2 "2024-02-16T16:44:12Z")

</div>

I don’t think it’s possible to override the button’s behavior anymore. Definitely better to add a new button.

---

<div class="post-metadata">

**Author:** ![saiyr](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@saiyr](https://forums.ankiweb.net/u/saiyr)\
**Post date:** [February 16, 2024, 5:55pm UTC](https://forums.ankiweb.net/t/overriding-editor-buttons/41188/3 "2024-02-16T17:55:06Z")

</div>

Thanks. What about the keyboard shortcut? If I use `registerShortcut` using an existing shortcut, will it override or do nothing?

---

<div class="post-metadata">

**Author:** ![abdo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/abdo/32/654_2.png) [@abdo](https://forums.ankiweb.net/u/abdo)\
**Post date:** [February 16, 2024, 8:57pm UTC](https://forums.ankiweb.net/t/overriding-editor-buttons/41188/4 "2024-02-16T20:57:21Z")

</div>

I don’t think it overrides the existing shortcut: [Make registerShortcut from anki/shortcuts package override conflicting shortcuts by kleinerpirat · Pull Request #2391 · ankitects/anki · GitHub](https://github.com/ankitects/anki/pull/2391)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [March 17, 2024, 8:58pm UTC](https://forums.ankiweb.net/t/overriding-editor-buttons/41188/5 "2024-03-17T20:58:04Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
