-
Notifications
You must be signed in to change notification settings - Fork 73
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
Conversation
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
src/inlineview.ts
Outdated
@@ -348,11 +348,13 @@ export class WidgetBufferView extends ContentView { | |||
domBoundsAround() { return null } | |||
|
|||
coordsAt(pos: number): Rect | null { | |||
let imgVisible = this.dom!.checkVisibility() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is checkVisibility
?
There was a problem hiding this comment.
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?
What is setting display: none on the widget buffer? |
HedgeDoc 2 is. (or will be?) by this commit: |
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
That style is not a good idea (the buffers are there for a reason), and not something this library supports. |
Thanks! I'll tell HedgeDoc devs so. |
By the way, the reason HedgeDoc hides the widgetbuffer is to solve yjs/y-codemirror.next#12 Can we use a span instead of the img? Or can we wrap the img with a div or a span? |
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