Open jxxcarlson opened 4 years ago
First, I just want to apologize for taking so long to see this... I guess GitHub didn't notify me since I wasn't watching the repo. Funny enough, I saw your posts on discourse.elm-lang.org but I didn't realize you had opened a PR.
I'm really glad you've been able to build on my code, it looks like you've added some great features! Unfortunately, I don't have time to dedicate to Elm projects, although I hope that will change one day. I'll leave this PR open in case I ever get around to reviewing/merging it.
Thanks so much for your comments -- great to hear from you. I've learned so much from your code!
Beautiful code! Have been studying it and have made some additions, most importantly a scrolling feature.
Scrolling is managed by the module
Window
which determines the range of lines of text that is visible to the user. One can scroll up and down using a slider, or using the up and down arrow keys.I've also implemented primitive copy, cut, paste: ctrl-c, ctrl-x, ctrl-v and a few other goodies: first and last line, go to specific line, wrap text, search and replace. There is also an external copy-paste feature. Please see the "Help" button in the Editor (and scroll down) for an explanation.
Please see the Basic Editor Demo.
I think that with a reasonable amount of work, a 1.0 version of the editor could be published soon as a package. I'd certainly be one to use it, and I"m sure that there would be many others.
If you are agreeable to it, I'd be very interested in contributing to your project. Looking forward to discussing this with you.
Notes. The purpose of some of the later commits is to reduce the amount of wiring that a user of this code needs to install to integrate the Editor in an app. I've outlined the steps (with one caveat) in
Embedding.md
. Everything in a client app is done using functions that operate on theEditor
data structure in moduleEditor
. TheEditor
type is opaque and incorporates bothBuffer
andInternalState
.To use the Editor in an app, one first says
then adds an
Editor
field to the app model, initializing it bywhere
config: EditorConfig Msg
holds configuration data, e.g. the number of lines to display in the editor, the width of the editor window in pixels, etc.Here is an example of integration of the Pure Elm Text Editor with another app: MiniLaTeX Demo.
Caveat. The external-copy paste feature requires some JS code (in
outside.js
) and also a moduleOutside
in the app that hosts the Editor. I haven't documented this yet, but you can see how it is set up in the demo.Additional Note. Just wanted to send you a copy of my DM to you on the Elm Slack today, January 10, 2020. Best regards, Jim