mirror of
https://github.com/heyman/heynote.git
synced 2025-06-20 09:37:50 +02:00
Use correct width for block decorations
This commit is contained in:
parent
c0f8bffc84
commit
fc4c7c8145
@ -122,7 +122,18 @@ const atomicNoteBlock = ViewPlugin.fromClass(
|
|||||||
)
|
)
|
||||||
|
|
||||||
const blockLayer = () => {
|
const blockLayer = () => {
|
||||||
return layer({
|
let editorWidth = 0;
|
||||||
|
const measureEditorWidth = EditorView.updateListener.of((update) => {
|
||||||
|
if (update.geometryChanged) {
|
||||||
|
update.view.requestMeasure({
|
||||||
|
read(a) {
|
||||||
|
editorWidth = update.view.dom.clientWidth
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const layerExtension = layer({
|
||||||
above: false,
|
above: false,
|
||||||
|
|
||||||
markers(view) {
|
markers(view) {
|
||||||
@ -145,7 +156,7 @@ const blockLayer = () => {
|
|||||||
idx++ % 2 == 0 ? "block-even" : "block-odd",
|
idx++ % 2 == 0 ? "block-even" : "block-odd",
|
||||||
0,
|
0,
|
||||||
fromCoords.top - (view.documentTop - view.documentPadding.top),
|
fromCoords.top - (view.documentTop - view.documentPadding.top),
|
||||||
2000,
|
editorWidth,
|
||||||
(toCoords.bottom - fromCoords.top),
|
(toCoords.bottom - fromCoords.top),
|
||||||
))
|
))
|
||||||
return false;
|
return false;
|
||||||
@ -164,6 +175,8 @@ const blockLayer = () => {
|
|||||||
|
|
||||||
class: "blocks-layer"
|
class: "blocks-layer"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
return [measureEditorWidth, layerExtension]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user