ember-mobiledoc-editor icon indicating copy to clipboard operation
ember-mobiledoc-editor copied to clipboard

addAtom only works when editor is focused

Open benkingcode opened this issue 8 years ago • 2 comments

I have some buttons in my editor toolbar that add an atom to the editor. Here's the code:

<button class="btn tag tag-info" {{action editor.addAtom 'message-tag' 'example'}}>example</button>

However, the button only works when the editor is actively focused. If the user presses a button while the editor is not focused, nothing happens. The ideal behaviour would be appending the atom to the end of the document.

benkingcode avatar Dec 16 '16 00:12 benkingcode

I've run into this issue as well... 5 years later, is there any solution to this yet?

JimSchofield avatar Jul 06 '21 18:07 JimSchofield

I see the comment from https://github.com/bustle/mobiledoc-kit/issues/405 and I am able to find a solution by storing the last focusedCursor position and reapplying the cursor position before the atom is added. I hope that helps for anyone else who encounters this issue :)

JimSchofield avatar Jul 07 '21 19:07 JimSchofield