Report any technical problems you discover and discuss solutions.

Accordion Navigator inserting extra paragraphs

Plus d'informations
il y a 9 ans 3 mois #4436 par curryd
I'm using Xerte 3.4 (git v3.4.1).

If I create a new Accordion Navigator page and add a new nested page, the generated HTML for the page looks like this:
Code:
<div id="infoHolder" ...> <h3 class="paneHeader ui-accordion-header ..." ...> <span class="ui-accordion-header.." ...></span> <a href="#">My pane title</a> </h3> <div class="paneContents ui-accordion-content ..."> <p>Content for the pane</p> </div> </div>

However, as soon as I replace the "Content for the pane" with my own text, the generated HTML looks like this:
Code:
<div id="infoHolder" ...> <h3 class="paneHeader ui-accordion-header ..." ...> <span class="ui-accordion-header.." ...></span> <a href="#">My pane title</a> </h3> <div class="paneContents ui-accordion-content ..."> <p></p> <-- NOT SUPPOSED TO BE HERE <p>My content</p> <p></p> <-- NOT SUPPOSED TO BE HERE </div> </div>

Notice the extra, blank paragraphs above and below my text.

This happens regardless of whether I edit the content directly, or through the "source" raw html interface. Those extra blank paragraphs are NOT appearing in the editor window. Looking at the template.xml, it looks like the text of the various panels is passed as an attribute to a nestedPage XML element, rather than as CDATA. And then models_html5/accNav.html is just taking the text as an attribute and sticking it into the DOM with <p> tags around it.

Am I misunderstanding how this is supposed to work?

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 9 ans 3 mois #4437 par tom
Réponse de tom sur le sujet Accordion Navigator inserting extra paragraphs
Good catch. This is probably a historical issue.

1. The first editor, was flash based, and so the content was not realy html (The flash based editor didn't have a WYSIWYG editor), so that's the reason why the contents of the xml is surrounded by a <p> tag.

2. The new editor uses CKEditor, and that editor encapsulates it's content always in a <p> tag. Whatever you do.

So now, we have content both with and without a <p> tag. The new content should just be added to the pane, without surrounding it again with <p>.

I dont't think we realised this when creating the new editor.

We'll fix this issue (in the model file) and we need to check other occurrences as well.

If you catch others, please let us know.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 9 ans 3 mois #4438 par curryd
Réponse de curryd sur le sujet Accordion Navigator inserting extra paragraphs
For what it's worth, the Tabbed Navigator does the right thing with the same content (two or three paragraphs, with other tags, like <strong>, in them). Perhaps, then, this is just an accordion navigator issue.

Unfortunately for me, the tabbed navigator just won't meet my needs in this case (I have phrases for the click-on-me names of the panels, and the tab layout doesn't have room for them). :-(

Is the Git repository for the current Xerte code accessible, so I could maybe pick up this fix once it's made? All of the repos I see on GitHub seem to be for old versions.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 9 ans 3 mois #4439 par tom
Réponse de tom sur le sujet Accordion Navigator inserting extra paragraphs
Github repo can be found here:

github.com/thexerteproject/xerteonlinetoolkits
Les utilisateur(s) suivant ont remercié: curryd

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 9 ans 3 mois #4440 par curryd
Réponse de curryd sur le sujet Accordion Navigator inserting extra paragraphs
Oh, I did have the right repo. The README.md file talks about v3.2, so I thought it was out of date. :-)

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 9 ans 3 mois #4441 par curryd
Réponse de curryd sur le sujet Accordion Navigator inserting extra paragraphs
Following your "hint" in your first reply, I took a look at the model file. I can confirm that changing line 97 of modules/xerte/parent_templates/Nottingham/models_html5/accNav.html from
Code:
var infoString = '<p>' + x_addLineBreaks(this.getAttribute("text")) + '</p>',
to
Code:
var infoString = x_addLineBreaks(this.getAttribute("text")),
(stop putting the '<p>' and '</p>' tags around the string) appears to fix the immediate problem I complained about in the first post. I'm not sure I have a deep enough understanding of the code to say whether this is a complete (or even correct) fix, so I will humbly refrain from submitting it as a pull request.

Connexion ou Créer un compte pour participer à la conversation.

Modérateurs: ronmjultenJohnSmith
Temps de génération de la page : 0.151 secondes
Copyright © 2026 The Xerte Project.
Xerte logo Apereo logo OSI Logo