mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-19 19:19:03 +00:00
Option to show numbering on single-lined blocks
Disabled by default
This commit is contained in:
parent
1d3d524b2c
commit
f4e744fd99
@ -16,6 +16,14 @@ module.exports = {
|
|||||||
desc: 'adds line numbers to code blocks.',
|
desc: 'adds line numbers to code blocks.',
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
author: 'CloudHill',
|
author: 'CloudHill',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
key: 'single_lined',
|
||||||
|
label: 'show line numbers on single-lined code blocks',
|
||||||
|
type: 'toggle',
|
||||||
|
value: false
|
||||||
|
}
|
||||||
|
],
|
||||||
hacks: {
|
hacks: {
|
||||||
'renderer/preload.js'(store, __exports) {
|
'renderer/preload.js'(store, __exports) {
|
||||||
document.addEventListener('readystatechange', (event) => {
|
document.addEventListener('readystatechange', (event) => {
|
||||||
@ -65,6 +73,8 @@ module.exports = {
|
|||||||
block.lineHeight
|
block.lineHeight
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (lines > 1) {
|
||||||
|
block.children[0].classList.add('numbered');
|
||||||
numbers.innerText = Array.from(
|
numbers.innerText = Array.from(
|
||||||
Array(lines),
|
Array(lines),
|
||||||
(e, i) => i + 1
|
(e, i) => i + 1
|
||||||
@ -73,6 +83,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user