Skip to content

Commit baa5138

Browse files
committed
fix: filter out hidden elements
1 parent 33a7ceb commit baa5138

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const buttonSelectors = [
1818
function getButtons(toolbar: Element): Element[] {
1919
const els = []
2020
for (const button of toolbar.querySelectorAll(buttonSelectors.join(', '))) {
21-
if (button.closest('markdown-toolbar') === toolbar) els.push(button)
21+
if (button.closest('markdown-toolbar') === toolbar && !button.hidden) els.push(button)
2222
}
2323
return els
2424
}

test/test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ describe('markdown-toolbar-element', function() {
7171
<md-bold>bold</md-bold>
7272
<md-header>header</md-header>
7373
<md-header level="1">h1</md-header>
74+
<md-header level="5" hidden>h1</md-header>
7475
<md-header level="10">h1</md-header>
7576
<div data-md-button>Other button</div>
7677
<md-italic>italic</md-italic>

0 commit comments

Comments
 (0)