mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-19 11:09:03 +00:00
Update mod.js
This commit is contained in:
parent
b671451261
commit
5f8e3cc332
@ -43,9 +43,14 @@ module.exports = {
|
||||
'propertylayout-hidden'
|
||||
);
|
||||
const toggle = createElement(
|
||||
'<button class="propertylayout-toggle" data-action="show">properties</button>'
|
||||
'<button class="propertylayout-toggle" data-action="show">Properties</button>'
|
||||
);
|
||||
toggle.prepend(
|
||||
createElement('<svg viewBox="0 0 100 100" class="triangle"><polygon points="5.9,88.2 50,11.8 94.1,88.2 "></polygon></svg>')
|
||||
);
|
||||
toggle.addEventListener('click', (event) => {
|
||||
properties.style.maxHeight = properties.children[0].offsetHeight + 'px';
|
||||
setTimeout(() => {
|
||||
properties.classList.toggle('propertylayout-hidden');
|
||||
toggle.setAttribute(
|
||||
'data-action',
|
||||
@ -53,6 +58,14 @@ module.exports = {
|
||||
? 'show'
|
||||
: 'hide'
|
||||
);
|
||||
}, 0);
|
||||
});
|
||||
const propObserver = new MutationObserver(() => {
|
||||
properties.style.maxHeight = '';
|
||||
});
|
||||
propObserver.observe(properties, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
});
|
||||
if (properties.previousElementSibling) {
|
||||
properties.previousElementSibling.append(toggle);
|
||||
|
Loading…
Reference in New Issue
Block a user