Thinking About ProseMirror and MarkupEditor #215
Replies: 1 comment
-
I have been looking into using ProseMirror some more, and I am feeling quite good about it. I am impressed by how well-thought-out ProseMirror is. The documentation is very complete, and the forums have useful support info as I was trying to get things to work. At this point, I have everything in the demo working except for the "insert" options like link, image, and table. As expected, the net reduction in my own JavaScript code is about 80% (I'll have actual numbers before long). I have made essentially zero Swift-side changes for this to work so far, so my belief that it would be transparent for users who have not forked From a development perspective, if you want to modify the JavaScript code (now in Right now all of this work is on a It should look familiar, because it is just like the "normal" demo, except that it currently shows the ProseMirror example toolbar as part of the MarkupWKWebView. This will go away, but it's been handy to check the operations that are invokable from the SwiftUI-based MarkupToolbar at the top. If all of this looks unimpressive in the demo, then that is success, because the code making changes to the displayed web page and the HTML you can see at the bottom all come from invoking ProseMirror functionality, not from my code manipulating the DOM. Undo/redo work beautifully, too! And here's a bonus... The issues (#214, #159) of the iOS keyboard disappearing on bold, italic, etc, and style changes are fixed in this version. |
Beta Was this translation helpful? Give feedback.
-
I came across ProseMirror the other day, and it made me wish it had existed in the form it is in now when I started MarkupEditor. I found this writeup comparing it to CKEditor to be useful, too. As I snarkily said in the MarkupEditor README, there are plenty of nice JavaScript WYSIWYG or rich text editors, but I'm working in a Swift world, and they didn't really fit well for me.
On the other hand, ProseMirror has a level of abstraction that makes a lot of sense to me. This is especially true because the 11,000 lines of JavaScript in the MarkupEditor are almost all centered around manipulating the DOM and dealing with the consequences of manipulating the DOM. ProseMirror exposes what looks like a well-thought-out document model of its own, along with first class representation of the editor state. The fact that the view is cleanly separated also means they have a well-formed notification mechanism for changes, something the MarkupEditor relies on to notify the Swift side of changes. All this leads me to believe that I could replace about 80% of the JavaScript code by introducing a - shudder - dependency on ProseMirror.
A few more of my thoughts on the topic, and then I hope others might pipe in with their own thoughts (and definitely with any direct experience with ProseMirror)...
The last item has me envisioning MarkupEditor users thinking: "Just fix my damned bug, don't even think about ripping things apart!". Okay, a legitimate concern, but I am also a user, and my ability to address bugs is quite bandwidth-limited. If introducing a ProseMirror dependency offloaded 80% of the JavaScript code and probably even more of the maintenance issues, then I would have a lot more time to devote to bug fixing (and, say, changing the iOS keyboard experience)
If anyone has thoughts or experience on this topic, I'd greatly appreciate you contributing to this discussion.
Beta Was this translation helpful? Give feedback.
All reactions