fabianmichael / kirby-markdown-field

Super-sophisticated markdown editor for Kirby 3, community built.
Other
162 stars 14 forks source link

Remove the narrow layout? #143

Closed medienbaecker closed 2 years ago

medienbaecker commented 2 years ago

Sorry for the provocative issue title.

I noticed some issues with the cursor position caused by the narrow layout option. It doesn't seem to be easy to fix unfortunately. CodeMirror doesn't like the two editor sizes at all. You're using a ResizeObserver which sometimes doesn't trigger (or triggers too early?) so it displays the cursor at the "narrow" position until you start typing:

So I'm wondering what's the purpose of the narrow layout? It's triggered when the field is less than 450px wide and looks very crammed in my opinion. It also doesn't provide that much more space:

What do you think?

fabianmichael commented 2 years ago

Bildschirmfoto 2022-05-18 um 10 10 57

Thanks for investigating this. The initial idea was to save space on mobile devices and in narrow columns. Since the Markdown field uses different paddings than other Kirby fields, this can make a huge difference, especially on mobile. My idea behind the field always was, that it should be able to replace the regular textarea field of Kirby in ideally all situations.

Maybe using a different style based on screen-size (a pure CSS solution) would be better. Or we would need to force-update CM through its API (don’t have the time for looking into this right now). Otherwise, I’m also open to the removal of this feature if it causes too many problems.

medienbaecker commented 2 years ago

I see. Then I think it would make sense to further align the field to the regular textarea and use one layout only. Currently the horizontal padding is slightly smaller and the vertical padding is larger.

What do you think? I can create a PR for the style adjustments.

markdown-textarea

fabianmichael commented 2 years ago

@medienbaecker Yeah, let’s do this. Unfortunately, CodeMirror introduced a lot of breaking changes lately. So the step from 0.19 to 0.20 requires me to overhaul quite a few parts of the codebase. Honestly, I got zero motivation for this, but otherwise the plugin will be cut-off from any further updates. So it might be a good idea to wait with this until I’ve updated all the plugin logic, as it also affects theming. But I really don’t know, when I’ll find the motivation and time for working on this … you can track the progress in the https://github.com/fabianmichael/kirby-markdown-field/tree/feature/disabled-state branch. If you want to step in to help any further with the project, I’m not holding you back. ;-)

fabianmichael commented 2 years ago

@medienbaecker Everything is merged, you can begin to update the style if you want. :-)