| @@ -714,8 +714,20 @@ | ||
| 714 | 714 | }; |
| 715 | 715 | |
| 716 | 716 | // show menu |
| 717 | 717 | Pen.prototype.menu = function() { |
| 718 | + | |
| 719 | + var allMenus = document.getElementsByClassName('pen-menu'); | |
| 720 | + | |
| 721 | + // Hide all menus | |
| 722 | + for(var x in allMenus){ | |
| 723 | + try{ | |
| 724 | + if('style' in allMenus[x]){ | |
| 725 | + allMenus[x].style.display = 'none'; | |
| 726 | + } | |
| 727 | + }catch(e){} | |
| 728 | + } | |
| 729 | + | |
| 718 | 730 | if (!this._menu) return this; |
| 719 | 731 | if (selection.isCollapsed) { |
| 720 | 732 | this._menu.style.display = 'none'; //hide menu |
| 721 | 733 | this._inputActive = false; |
| @@ -741,8 +753,9 @@ | ||
| 741 | 753 | var style = document.createElement("style"); |
| 742 | 754 | document.head.appendChild(style); |
| 743 | 755 | this._stylesheet = stylesheet = style.sheet; |
| 744 | 756 | } |
| 757 | + | |
| 745 | 758 | // display block to caculate its width & height |
| 746 | 759 | menu.style.display = 'block'; |
| 747 | 760 | |
| 748 | 761 | menuOffset.x = left - (menu.clientWidth / 2); |