kelciour / edit-field-during-review

3 stars 1 forks source link

CTRL+B or U #13

Open Poker-Kid opened 1 year ago

Poker-Kid commented 1 year ago

https://forums.ankiweb.net/t/edit-field-during-review-use-of-ctrl-u-or-b/28071

kelciour commented 1 year ago

Maybe, if it's caused by some other addon or some JavaScript code in the card template, try turning off all the add-ons except this one and test it in a new Anki profile (File > Switch Profile) after modifying the Basic note type with the edit: prefix.

If it still doesn't work, maybe try adding this JavaScript code in the Front/Back template to enable them by using some other key.

<script>
$('[contenteditable=true]').keydown(function(e) {
  if(e.ctrlKey && e.keyCode == 71) { // Ctrl + g - https://keycode.info
    e.preventDefault();
    document.execCommand("bold");
  }
});
</script>
<script>
$('[contenteditable=true]').keydown(function(e) {
  if(e.ctrlKey && e.key == 'H') { // Ctrl + H == Ctrl + Shift + h
    e.preventDefault();
    document.execCommand("underline");
  }
});
</script>

https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand

Poker-Kid commented 1 year ago

Today I found a solution, but it only works with the other add on https://forums.ankiweb.net/t/edit-field-during-review-use-of-ctrl-u-or-b/28071/5+ https://ankiweb.net/shared/info/385888438