django-markdownx icon indicating copy to clipboard operation
django-markdownx copied to clipboard

Editor height grows on inputs

Open jgillard opened this issue 1 year ago • 17 comments

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.

jgillard avatar Feb 05 '24 12:02 jgillard

Which browser? version + os.

adi- avatar Feb 05 '24 13:02 adi-

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

jgillard avatar Feb 05 '24 14:02 jgillard

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

juanignaciosl avatar Apr 03 '24 08:04 juanignaciosl

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"}
        ),
    )

juanignaciosl avatar Apr 04 '24 20:04 juanignaciosl

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.

mgrdcm avatar May 20 '24 12:05 mgrdcm

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

adi- avatar May 20 '24 12:05 adi-

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.

mgrdcm avatar May 20 '24 12:05 mgrdcm

OK, I will do checking on my side too.

adi- avatar May 20 '24 12:05 adi-

OK, I will do checking on my side too.

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

mgrdcm avatar May 20 '24 12:05 mgrdcm

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?

adi- avatar May 20 '24 12:05 adi-

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.

mgrdcm avatar May 20 '24 12:05 mgrdcm

os/browser?

adi- avatar May 20 '24 12:05 adi-

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

mgrdcm avatar May 20 '24 12:05 mgrdcm

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.

jgillard avatar May 20 '24 13:05 jgillard

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?

adi- avatar May 21 '24 07:05 adi-

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.

mgrdcm avatar May 21 '24 13:05 mgrdcm

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.

kamocat avatar May 31 '24 04:05 kamocat

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

theaino avatar Aug 13 '24 09:08 theaino

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

class PostAdmin(MarkdownxModelAdmin):
    view_on_site = True

theaino avatar Aug 13 '24 10:08 theaino

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.

adi- avatar Sep 08 '24 17:09 adi-