Closed begedin closed 9 years ago
I did some refactoring to hopefully make a few things a bit clearer.
I also moved the setting of editor content to a point before the actual medium-editor initialization. This allows integration tests to reliably pass.
We still need actual unit test coverage, though, but before that, I think I need to redo how some of the stuff is loaded, so i created a separate task for that.
Description
This adds a button between the title and the content area of the medium editor, which allows uploading and inserting an image into the editor without requiring a selection being present in the editor itself.
The actual process of enabling this required a lot of hacking through the editor API, so it's not a very clean solution.
The reality is, the editor does require selection to insert anything, so the only way I could do it was to manually select the last character in the editor before performing the image insertion.
The unfortunate consequence of that is that the editor toolbar pops up after the insertion is done, since there seems to be no straightforward way to deselect everything in the editor.
I'm currently looking into ways to achieve that.I was actually unable to find a way to clear selection in the editor, which brings me to
medium-editor is becoming a pain to use
Everything works, for the most part.
However, in order to make it work, I had to basically hack together a solution which is far from being describable as "nice".
As far as I could find, there is
As I said, everything seems to be working from now, but I'm not expecting us being able to do a lot of customization without the editor getting in the way, a lot.
In addition to that, I should mention that, while
medium-editor
does look a lot like the actual medium editor, internally, it does create a lot of junk html. Inspecting the content area after a couple of edits gives me a bunch of empty html tags, etc.I'm afraid I don't have a better suggestion, though. Switching to another editor, doesn't really do much. We'll likely just be exchanging one set of problems for another.
Eventually, I think we'll just have to switch to something of our own.
That being said I'm marking this as awaiting review. The feature works and there are no apparent issues I'm aware of. The underlying issue of our editor library having flaws isn't something we can fix here.