neutronX / django-markdownx

Comprehensive Markdown plugin built for Django
https://neutronx.github.io/django-markdownx/
Other
854 stars 153 forks source link

Editor height grows on inputs #263

Closed jgillard closed 4 weeks ago

jgillard commented 8 months ago

When typing or even focussing in the editor, the height of the textarea grows:

height

I think this behaviour first started in v4.0.4. We first noticed it when upgrading from v4.0.2 to v4.0.7. The latest version v4.0.7 still exhibits this behaviour.

adi- commented 8 months ago

Which browser? version + os.

jgillard commented 8 months ago

I've tested latest versions of Chrome, Safari & Firefox on a Mac (13.6.3), and all 3 show the issue.

juanignaciosl commented 6 months ago

Same here. Version 122.0.6261.128 (Official Build) (64-bit). Arch Linux, Linux 6.8.2-arch2-1, Gnome 46, X11.

juanignaciosl commented 6 months ago

As a workaround, set the editor to not resizable at settings:

MARKDOWNX_EDITOR_RESIZABLE = False

You might want to change the default size. You can with:

    question = MarkdownxFormField(
        required=False,
        label="Add question",
        widget=widgets.MarkdownxWidget(
            attrs={"rows": "5", "cols": "40"}
        ),
    )
mgrdcm commented 4 months ago

Just came across this myself (Django 4.2, FireFox and Safari). Definitely started in 4.0.4 probably with https://github.com/neutronX/django-markdownx/commit/45df5cbcb380ba85f3d63f0111d657c025ca160e.

@juanignaciosl's fix above (https://github.com/neutronX/django-markdownx/issues/263#issuecomment-2038148082) does work for me. I haven't had a chance to try a code change fix yet.

adi- commented 4 months ago

Can anyone do tests to confirm that this fixes the problem?

mgrdcm commented 4 months ago

Can anyone do tests to confirm that this fixes the problem?

Hey @adi-! I had just updated my comment above https://github.com/neutronX/django-markdownx/issues/263#issuecomment-2120363434 to note that https://github.com/neutronX/django-markdownx/issues/263#issuecomment-2038148082 does fix the issue for me when I saw your question.

adi- commented 4 months ago

OK, I will do checking on my side too.

mgrdcm commented 4 months ago

OK, I will do checking on my side too.

Thanks so much for your work on this package @adi-!

adi- commented 4 months ago

Oh, I understood you wrong. There is a newer version 4.0.7 (https://github.com/neutronX/django-markdownx/releases/tag/v4.0.7) which already has some fixes on that. Can you confirm that 4.0.7 is already working for you?

mgrdcm commented 4 months ago

Oh, I understood you wrong. There is a newer version 4.0.7 (https://github.com/neutronX/django-markdownx/releases/tag/v4.0.7) which already has some fixes on that. Can you confirm that 4.0.7 is already working for you?

No sorry, it is still happening for me in 4.0.7.

adi- commented 4 months ago

os/browser?

mgrdcm commented 4 months ago

I'm seeing this on macOS Ventura 13.6.6 with both Safari 17.3.1 and FireFox 127.0b3.

jgillard commented 4 months ago

Yep as mentioned in my original post this issue still exists on 4.0.7. I've just retested with that version, and MacOS 14.4.1 and Safari of the same version / Chrome 124 / Firefox 124.0.2, and the issue persists for all of those.

adi- commented 4 months ago

That is really strange. I have tested this on Ubuntu/Firefox, osx/Safari, osx/Firefox and everything looks fine.

Can you verify that web browser's cache was cleared?

mgrdcm commented 4 months ago

Can you verify that web browser's cache was cleared?

Yup! I tried clearing the cache and even a private browsing window in both Safari and Firefox.

kamocat commented 4 months ago

I just installed this plugin for the first time and immediately noticed this issue. Running Python 3.12 container on rpi, Django 5.0.6, and django-markdownx 4.0.7 Issue shows up in Chrome on both Chrome OS and Windows 11. I didn't test any other browsers.

theaino commented 1 month ago

+1 Firefox 129.0 Fedora 40 python3.11 django-markdownx 4.0.7

theaino commented 1 month ago

So I managed to fix this by making my admin site class inherit from markdownx.admin.MarkdownxModelAdmin

class PostAdmin(MarkdownxModelAdmin):
    view_on_site = True
adi- commented 4 weeks ago

Finally figured out what is going on here. When you want to register model field into admin, you need to use MarkdownxModelAdmin base class. I think you forgot about adding it in your admin.py. Read about it here: https://neutronx.github.io/django-markdownx/example/#django-admin

P.S. Set height for the editor works as it should.