Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take account of visibility of WidgetBufferView #42

Closed
wants to merge 2 commits into from
Closed

Take account of visibility of WidgetBufferView #42

wants to merge 2 commits into from

Conversation

tamo
Copy link

@tamo tamo commented Oct 19, 2022

If WidgetBufferView has "display: none" style, its getBoundingClientRect() returns {0,0,0,0,0...} so it's useless.
I'm not sure at all that this PR works but I wish this will help hedgedoc/hedgedoc#2957
Thanks

If WidgetBufferView has "display: none" style, its getBoundingClientRect() returns {0,0,0,0,0...} so it's useless.
I wish this will help https://github.com/hedgedoc/react-client/issues/2446
@@ -348,11 +348,13 @@ export class WidgetBufferView extends ContentView {
domBoundsAround() { return null }

coordsAt(pos: number): Rect | null {
let imgVisible = this.dom!.checkVisibility()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is checkVisibility?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My browser's inspector auto-completed it for "this.dom.visi" but you are right I should not have used it here.
Maybe we can check style.display or offsetparent or anything?

@marijnh
Copy link
Member

marijnh commented Oct 19, 2022

What is setting display: none on the widget buffer?

@tamo
Copy link
Author

tamo commented Oct 20, 2022

because I don't know how to check actual style.display

Seems that manually modifying node_modules/@codemirror/view/dist/index.js fixes https://github.com/hedgedoc/react-client/issues/2446
@marijnh
Copy link
Member

marijnh commented Oct 20, 2022

That style is not a good idea (the buffers are there for a reason), and not something this library supports.

@marijnh marijnh closed this Oct 20, 2022
@tamo
Copy link
Author

tamo commented Oct 21, 2022

Thanks! I'll tell HedgeDoc devs so.

@tamo
Copy link
Author

tamo commented Oct 21, 2022

By the way, the reason HedgeDoc hides the widgetbuffer is to solve yjs/y-codemirror.next#12

image
(remote cursors break line)

Can we use a span instead of the img? Or can we wrap the img with a div or a span?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants