Skip to content

Commit

Permalink
Merge pull request #3521 from artragis/patch-7
Browse files Browse the repository at this point in the history
fix 3513: supprime la supperposition des aides markdown
  • Loading branch information
sandhose committed Apr 6, 2016
2 parents 8bca4c2 + a8cad6c commit ee7feb9
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion assets/js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@

isExecuted: false,
selection: null,
currentElemPopup: null,

addEvent: function(elem, evt, listener) {
if (elem.addEventListener) {
Expand Down Expand Up @@ -230,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);
Expand All @@ -247,6 +249,7 @@
while (menus[i]) {
if (menus[i].getAttribute("data-zform-info") !== "dontclose" || event.target.nodeName.toLowerCase() === "textarea") {
menus[i].style.display = "none";
self.currentElemPopup = (menus[i] == self.currentElemPopup) ? null: self.currentElemPopup;
}
i++;
}
Expand Down Expand Up @@ -288,13 +291,25 @@
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;
}
}
});

Expand All @@ -307,6 +322,7 @@
elemPopup.style.whiteSpace = "nowrap";
elemPopup.style.textAlign = "left";
elemPopup = this[currentButton.action](elemPopup, currentButton, opts.textarea);

} else {
this.addEvent(elemButton, "click", (function(_button, _textareaId, _this, _tagtype, _extraoption) {
return function(event) {
Expand Down

0 comments on commit ee7feb9

Please sign in to comment.