mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #13118 from overleaf/mj-fix-centering-editable-graphics
[web] Always update centering in editablegraphics updateDOM GitOrigin-RevId: 366a109c2006dea3cd3660f7a380fbbc0e203cca
This commit is contained in:
parent
988fc57574
commit
47b1a731fb
1 changed files with 7 additions and 5 deletions
|
@ -19,19 +19,21 @@ export class EditableGraphicsWidget extends GraphicsWidget {
|
|||
}
|
||||
|
||||
updateDOM(element: HTMLImageElement, view: EditorView): boolean {
|
||||
this.destroyed = false
|
||||
element.classList.toggle('ol-cm-environment-centered', this.centered)
|
||||
if (
|
||||
this.filePath === element.dataset.filepath &&
|
||||
element.dataset.width === String(this.figureData?.width?.toString())
|
||||
) {
|
||||
// Figure remained the same, so just update the event listener on the button
|
||||
this.setEditDispatcher(
|
||||
element.querySelector('.ol-cm-graphics-edit-button')!,
|
||||
view
|
||||
const button = element.querySelector<HTMLButtonElement>(
|
||||
'.ol-cm-graphics-edit-button'
|
||||
)
|
||||
if (button) {
|
||||
this.setEditDispatcher(button, view)
|
||||
}
|
||||
return true
|
||||
}
|
||||
this.destroyed = false
|
||||
element.classList.toggle('ol-cm-environment-centered', this.centered)
|
||||
this.renderGraphic(element, view)
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue