saving a blank value, not an empty p tag?

saving a blank value, not an empty p tag?

by tim st.clair -
Number of replies: 2
Picture of Plugin developers

Say I have a normal moodle editor and had a value in it that I want to remove.

editor showing a value

I select all and delete. Good. But if I view the source of the editor, there's a P and a BR

source code showing an empty element

And that is in turn rendered to the final page. In some cases this stuffs up formatting of other elements - particularly when the editor decides to throw in half a dozen empty P tags.

rendered html source showing empty tag

Once you have had a value in a HTML editor field, how do you then save a true "empty" value instead of an empty tag?

Average of ratings: -
In reply to tim st.clair

saving a blank value, not an empty p tag?

by John Provasnik -
Picture of Particularly helpful Moodlers Picture of Testers
Hi Tim, I've opened this tracker regarding this issue. This same issue prevents topic summaries from being imported from one course to another. MDL-68982
In reply to tim st.clair

Re: saving a blank value, not an empty p tag?

by Eoin Campbell -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
I find that this issue often causes superfluous vertical spacing (via the empty paragraphs) in Label and course section summaries in particular. As if course pages aren't already long enough! My workaround for Moodle 3.9 is as follows (see screenshot below).
  1. In the Atto editor toolbar, toggle the "Show/hide advanced buttons" button.
  2. Toggle the "HTML" button to see the raw HTML. 
  3. Delete the raw HTML.
  4. Toggle the "HTML" button again to show WYSIWYG view. (This step seems to be essential.)
  5. Save the changes to the Label or section (or Description field for an activity or resource where it is displayed on the course page). 


Average of ratings: Useful (1)