Ahhh, I see what you mean now, so the textarea controls all the input for the editor? That’s a good idea, I’ll test out your fork in detail this weekend.
Also, just a heads up, I think when you were updating to 0.19 you reversed the arguments to String.containshere, the string of non-word characters should be the second argument. Other than that, looks like a good update, I might merge that into my repo (I’ve stayed on 0.18 because I like the debugger in elm-reactor, but I’m not sure I really need it).
Ups, sorry about that flipped arguments. Very quick and dirty update, just to show you what I had in mind
Here is proof of concept for a working pure Elm copy/paste that should work for any system/browser:https://atlewee.github.io/demo/
Its not pure at the moment because I patched the Browser.Dom package to support “Browser.Dom.select” for testing purpose.
Turns out its enough to run select function on the element, it will then get focus as well.
So if “select” is added to the Browser.Dom package, this seems doable. If not, a single port for this select function is also cross-browser safe.
My example is not 100% working, the cursor is not at the correct position after paste, and also not all keyboard commands (Shift+End) selects the text, but that should be easy to fix
This is just meant as a hint to how real copy/paste can be achieved for your editor.
Thanks for taking the time to investigate! I’m in the middle of adding undo/redo but soon I’ll be working on copy/paste so I’ll try to work this in to my implementation.