Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix 3513: supprime la supperposition des aides markdown #3521

Merged
merged 1 commit into from
Apr 6, 2016

Conversation

artragis
Copy link
Member

@artragis artragis commented Apr 6, 2016

Q R
Type de modification correction de bug
Ticket(s) (issue(s)) concerné(s) (ex #3513 )

QA

  • Buildez le front
  • Dans la page de rédaction d'un message (i.e forum/mp/topic/tuto/article), vérifiez que si vous appuyez successivement sur les boutons "smiley"/"caractères spéciaux"/"blocs spéciaux" vous n'avez pas de superposition. Vérifiez que le menu "titres" ne gène pas non plus.

@@ -289,7 +290,9 @@

if (currentButton.action) { // Button with a submenu
elemButton.style.position = "relative";

if (this.currentElemPopup){
$(this.currentElemPopup).remove();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jQuery est pas dispo dans ce scope via $. Le mieux, c'est de pas l'utiliser:

                if (this.currentElemPopup){
-                    $(this.currentElemPopup).remove();
+                    elemButton.removeChild(this.currentElemPopup);
+                    this.currentElemPopup = null;
                }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrigé, merci.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 87.337% when pulling 3087820 on artragis:patch-7 into cf876e5 on zestedesavoir:release-v18.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 87.337% when pulling 7ac7924 on artragis:patch-7 into cf876e5 on zestedesavoir:release-v18.

@sandhose
Copy link
Contributor

sandhose commented Apr 6, 2016

Sorry, j'avais pas testé le code. Voici le patch qui corrige le bug:

diff --git a/assets/js/editor.js b/assets/js/editor.js
index 440e430..e7744c3 100644
--- a/assets/js/editor.js
+++ b/assets/js/editor.js
@@ -231,6 +231,7 @@
         setup: function(textareaId) {
             var elemTexta = document.getElementById(textareaId);
             var elemTools = document.createElement("ul");
+            var self = this;
             elemTools.className = "zform-toolbar hide-for-small";

             elemTexta.parentNode.insertBefore(elemTools, elemTexta);
@@ -248,6 +249,8 @@
                     while (menus[i]) {
                         if (menus[i].getAttribute("data-zform-info") !== "dontclose" || event.target.nodeName.toLowerCase() === "textarea") {
                             menus[i].style.display = "none";
+                            if (menus[i] == self.currentElemPopup)
+                                self.currentElemPopup = null;
                         }
                         i++;
                     }
@@ -289,16 +292,21 @@
             if (currentButton.hasOwnProperty("image")) elemButton.innerHTML = '<img src="' + currentButton.image +  '" alt="' + currentButton.title + '" />';

             if (currentButton.action) { // Button with a submenu
+                var self = this;
                 elemButton.style.position = "relative";
-                if (this.currentElemPopup){
-                    elemButton.removeChild(this.currentElemPopup);
-                    this.currentElemPopup = null;
-                }
                 this.addEvent(elemButton, "click", function(event, elemPopup) {
                     event.preventDefault();

                     if (elemPopup = this.getElementsByTagName("div")[0]) {
                         elemPopup.style.display = "block";
+
+                        if(self.currentElemPopup)
+                            self.currentElemPopup.style.display = "none";
+
+                        if(self.currentElemPopup == elemPopup)
+                            self.currentElemPopup = null;
+                        else
+                            self.currentElemPopup = elemPopup;
                     }
                 });

@@ -311,7 +319,6 @@
                 elemPopup.style.whiteSpace = "nowrap";
                 elemPopup.style.textAlign = "left";
                 elemPopup = this[currentButton.action](elemPopup, currentButton, opts.textarea);
-                this.currentElemPopup = elemPopup;
             } else {
                 this.addEvent(elemButton, "click", (function(_button, _textareaId, _this, _tagtype, _extraoption) {
                     return function(event) {

@artragis
Copy link
Member Author

artragis commented Apr 6, 2016

ok
merci.

@artragis
Copy link
Member Author

artragis commented Apr 6, 2016

Done.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 87.337% when pulling a8cad6c on artragis:patch-7 into cf876e5 on zestedesavoir:release-v18.

@Emeric54
Copy link
Contributor

Emeric54 commented Apr 6, 2016

QA : On est bon ici 👍

@sandhose sandhose merged commit ee7feb9 into zestedesavoir:release-v18 Apr 6, 2016
@artragis artragis deleted the patch-7 branch April 25, 2021 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants