Fixes #4204: use div instead of p in visual editor to prevent nesting issues.
authorRadek Czajka <rczajka@rczajka.pl>
Tue, 6 Jul 2021 12:26:44 +0000 (14:26 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Tue, 6 Jul 2021 12:26:44 +0000 (14:26 +0200)
src/redakcja/static/js/wiki/xslt.js
src/redakcja/static/xsl/wl2html_client.xsl

index 5111ae7..8e80a9c 100644 (file)
@@ -17,7 +17,7 @@ function withStylesheets(code_block, onError)
     if (!xml2htmlStylesheet) {
        $.blockUI({message: 'Ładowanie arkuszy stylów...'});
        $.ajax({
     if (!xml2htmlStylesheet) {
        $.blockUI({message: 'Ładowanie arkuszy stylów...'});
        $.ajax({
-            url: STATIC_URL + 'xsl/wl2html_client.xsl?210129',
+            url: STATIC_URL + 'xsl/wl2html_client.xsl?210706',
             dataType: 'xml',
             timeout: 10000,
             success: function(data) {
             dataType: 'xml',
             timeout: 10000,
             success: function(data) {
index c4e68ce..b277c6a 100644 (file)
         
     <xsl:template match="motto_podpis" mode="motto">
         <xsl:param name="mixed" />
         
     <xsl:template match="motto_podpis" mode="motto">
         <xsl:param name="mixed" />
-        <p x-editable="true">
+        <div x-editable="true">
             <xsl:call-template name="standard-attributes" />
             <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
             <xsl:call-template name="standard-attributes" />
             <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
-        </p>
+        </div>
     </xsl:template>    
     
     <xsl:template match="motto_podpis" />
     </xsl:template>    
     
     <xsl:template match="motto_podpis" />
 
     <xsl:template match="naglowek_listy">
         <xsl:param name="mixed" />
 
     <xsl:template match="naglowek_listy">
         <xsl:param name="mixed" />
-        <p x-editable="true">
+        <div x-editable="true">
             <xsl:call-template name="standard-attributes" />
             <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
             <xsl:call-template name="standard-attributes" />
             <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
-        </p>
+        </div>
     </xsl:template>
 
     <xsl:template match="lista_osoba">
         <xsl:param name="mixed" />
     </xsl:template>
 
     <xsl:template match="lista_osoba">
         <xsl:param name="mixed" />
-        <p x-editable="true">
+        <div x-editable="true">
             <xsl:call-template name="standard-attributes" />
             <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
             <xsl:call-template name="standard-attributes" />
             <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
-        </p>
+        </div>
     </xsl:template>
 
     <!--  Tagi obejmujące inne komentarze wprowadzające
     </xsl:template>
 
     <!--  Tagi obejmujące inne komentarze wprowadzające
     -->
     <xsl:template match="miejsce_czas">
         <xsl:param name="mixed" />
     -->
     <xsl:template match="miejsce_czas">
         <xsl:param name="mixed" />
-        <p x-editable="true">
+        <div x-editable="true">
             <xsl:call-template name="standard-attributes" />
             <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
             <xsl:call-template name="standard-attributes" />
             <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
-        </p>
+        </div>
     </xsl:template>
 
 
     </xsl:template>
 
 
 
     <xsl:template match="akap">
         <xsl:param name="mixed" />
 
     <xsl:template match="akap">
         <xsl:param name="mixed" />
-        <p x-editable="true">
+        <div x-editable="true">
             <xsl:call-template name="standard-attributes" />
             <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
             <xsl:call-template name="standard-attributes" />
             <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
-        </p>
+        </div>
     </xsl:template>
 
     <xsl:template match="akap_cd">
         <xsl:param name="mixed" />
     </xsl:template>
 
     <xsl:template match="akap_cd">
         <xsl:param name="mixed" />
-        <p x-editable="true">
+        <div x-editable="true">
             <xsl:call-template name="standard-attributes" />
             <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
             <xsl:call-template name="standard-attributes" />
             <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
-        </p>
+        </div>
     </xsl:template>
 
     <xsl:template match="akap_dialog">
         <xsl:param name="mixed" />
     </xsl:template>
 
     <xsl:template match="akap_dialog">
         <xsl:param name="mixed" />
-        <p x-editable="true">
+        <div x-editable="true">
             <xsl:call-template name="standard-attributes" />
             <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
             <xsl:call-template name="standard-attributes" />
             <xsl:call-template name="context-menu" />
             <xsl:apply-templates select="child::node()">
                 <xsl:with-param name="mixed" select="true()" />
             </xsl:apply-templates>
-        </p>
+        </div>
     </xsl:template>
 
     <!--
     </xsl:template>
 
     <!--
         <xsl:choose>
             <!-- Simple verse == not wers_ tags anywhere until the ending br -->
             <xsl:when test="not($verse-content[starts-with(name(), 'wers')])">
         <xsl:choose>
             <!-- Simple verse == not wers_ tags anywhere until the ending br -->
             <xsl:when test="not($verse-content[starts-with(name(), 'wers')])">
-                <p class="wers" x-node="wers" x-verse="true" x-auto-node="true">
+                <div class="wers" x-node="wers" x-verse="true" x-auto-node="true">
                 <xsl:apply-templates select="$verse-content[local-name(.) != 'br']">
                     <xsl:with-param name="mixed" select="true()" />
                 </xsl:apply-templates>
                 <xsl:apply-templates select="$verse-content[local-name(.) != 'br']">
                     <xsl:with-param name="mixed" select="true()" />
                 </xsl:apply-templates>
-                </p>
+                </div>
             </xsl:when>
 
             <xsl:otherwise>
             </xsl:when>
 
             <xsl:otherwise>
         <xsl:param name="mixed" />
                <!-- <xsl:choose>
                <xsl:when test="ancestor::*[0]/self::strofa"> -->
         <xsl:param name="mixed" />
                <!-- <xsl:choose>
                <xsl:when test="ancestor::*[0]/self::strofa"> -->
-               <p x-verse="true">
+               <div x-verse="true">
                <xsl:call-template name="standard-attributes" />
                <xsl:apply-templates select="child::node()">
                        <xsl:with-param name="mixed" select="true()" />
                </xsl:apply-templates>
                <xsl:call-template name="standard-attributes" />
                <xsl:apply-templates select="child::node()">
                        <xsl:with-param name="mixed" select="true()" />
                </xsl:apply-templates>
-               </p>
+               </div>
                <!-- </xsl:when> 
                <xsl:choose> -->
     </xsl:template>
                <!-- </xsl:when> 
                <xsl:choose> -->
     </xsl:template>
 
     <xsl:template match="sekcja_asterysk">
         <xsl:param name="mixed" />
 
     <xsl:template match="sekcja_asterysk">
         <xsl:param name="mixed" />
-        <p><xsl:call-template name="standard-attributes" /></p>
+        <div><xsl:call-template name="standard-attributes" /></div>
     </xsl:template>
 
     <xsl:template match="separator_linia">
     </xsl:template>
 
     <xsl:template match="separator_linia">