2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-07-23 09:54:28 -06:00

Attempt at improving submenus in Safari for #362

This commit is contained in:
Jeroen Akkerman 2022-01-11 20:10:00 +01:00
parent 59a676bc8a
commit e2db3c6946

View File

@ -188,6 +188,11 @@ function removeClass(el, className) {
function createToolbarDropdown(options, enableTooltips, shortcuts, parent) { function createToolbarDropdown(options, enableTooltips, shortcuts, parent) {
var el = createToolbarButton(options, false, enableTooltips, shortcuts, 'button', parent); var el = createToolbarButton(options, false, enableTooltips, shortcuts, 'button', parent);
el.className += ' easymde-dropdown'; el.className += ' easymde-dropdown';
el.onclick = function () {
el.focus();
};
var content = document.createElement('div'); var content = document.createElement('div');
content.className = 'easymde-dropdown-content'; content.className = 'easymde-dropdown-content';
for (var childrenIndex = 0; childrenIndex < options.children.length; childrenIndex++) { for (var childrenIndex = 0; childrenIndex < options.children.length; childrenIndex++) {
@ -201,6 +206,7 @@ function createToolbarDropdown(options, enableTooltips, shortcuts, parent) {
childElement = createToolbarButton(child, true, enableTooltips, shortcuts, 'button', parent); childElement = createToolbarButton(child, true, enableTooltips, shortcuts, 'button', parent);
} }
childElement.addEventListener('click', function (e) { e.stopPropagation(); }, false);
content.appendChild(childElement); content.appendChild(childElement);
} }
el.appendChild(content); el.appendChild(content);