Jump to content

[SOLVED] TinyMCE always adds empty paragraph after saving the page


wbmnfktr
 Share

Recommended Posts

As the title pretty much says... my TinyMCE always adds an almost empty paragraph (containing only a nbsp) after saving the page.

I have to manually remove it via Source Code view to have it fixed for that moment. The next time I edit the content the paragraph gets added again. In total I have to save a page twice.

I tried to find a setting or plugin that does that and even disabled lazy loading. No chance.

The only setting that fixes this issue is using the inline editor and not the normal editor
But that's not really an option.

Has anyone encountered this issue as well or maybe even knows a nicer fix for it?

ProcessWire: 3.0.221
PHP: 8.2
Profile: PW Multi-Language 

tinymce-p-nbsp.png.4687038fa2c279ffcdfbd100aafadbcc.png

Field export below:

Spoiler

{
    "prose": {
        "id": 108,
        "name": "prose",
        "label": "Prose",
        "flags": 0,
        "type": "FieldtypeTextarea",
        "inputfieldClass": "InputfieldTinyMCE",
        "contentType": 1,
        "inlineMode": 0,
        "height": 500,
        "lazyMode": 1,
        "features": [
            "toolbar",
            "menubar",
            "stickybars",
            "purifier",
            "imgUpload",
            "imgResize",
            "pasteFilter"
        ],
        "toolbar": "styles bold italic pwlink pwimage blockquote hr bullist numlist table anchor code",
        "plugins": [
            "anchor",
            "code",
            "link",
            "lists",
            "pwimage",
            "pwlink",
            "table"
        ],
        "collapsed": 0,
        "minlength": 0,
        "maxlength": 0,
        "showCount": 0,
        "rows": 15,
        "textformatters": "",
        "htmlOptions": "",
        "extPlugins": "",
        "toggles": "",
        "settingsJSON": "",
        "settingsFile": "",
        "showIf": "",
        "themeInputSize": "",
        "themeOffset": "",
        "themeBorder": "",
        "themeColor": "",
        "themeBlank": "",
        "columnWidth": 100,
        "required": "",
        "requiredAttr": "",
        "requiredIf": "",
        "stripTags": "",
        "placeholder": ""
    }
}

[BEST SOLUTION FOR ME SO FAR]

 

Edited by wbmnfktr
Added link to comment that helped me with this question.
Link to comment
Share on other sites

Not a real fix, but you could activate these two options:

Remove empty paragraph texts
Remove non-breaking spaces

You find them inside the input-tab of your field > Beautify Markup Toggles

I had the same issue with imported text from an API. They were using pseudo-elements inside empty headline tags as visual spacers.

  • Like 2
Link to comment
Share on other sites

I do not think that there is solution as TinyMCE writes that this is a feature and the editor would not work without this annoying behaviour... I wrote a function that deletes the first and the last <p>...

Link to comment
Share on other sites

15 hours ago, ngrmm said:

Remove empty paragraph texts
Remove non-breaking spaces

Woah... yes! They do the trick for me.
These settings are hidden pretty good.

@cpx3maybe you try the above mentioned setting. It works for me in my current setup.

 

On a side note: just noticed that this issue doesn't occure in Firefox (115.0.2) and only in Chrome-/Chromium-based browsers.

  • Like 1
Link to comment
Share on other sites

  • wbmnfktr changed the title to [SOLVED] TinyMCE always adds empty paragraph after saving the page
9 hours ago, cpx3 said:

For me it did not change anything. It starts and ends with a useless <p> that destroys the layout.

Is it a field inside a repeater matrix? Sometimes you need to save the repeater field again, after changing the ck-editor-configs.

Link to comment
Share on other sites

14 hours ago, cpx3 said:

For me it did not change anything. It starts and ends with a useless <p> that destroys the layout.

Are you talking about a wrapping <p>content</p> or are you talking about a trailing paragraph: ... content ... <p>&nbsp;</p> ?

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
On 7/23/2023 at 12:36 AM, bernhard said:

Are you talking about a wrapping <p>content</p> or are you talking about a trailing paragraph: ... content ... <p>&nbsp;</p> ?

I talk about the useless additional <p>content</p> wrap. ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...