mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-01 18:33:54 -05:00
Merge pull request #13085 from overleaf/mj-figure-rt-flicker
[cm6+rt] Reduce flickering of rendered figure GitOrigin-RevId: a88845621228fa3a78ced023d5b5480ed600256a
This commit is contained in:
parent
0bfd1fc852
commit
e306369b9a
2 changed files with 7 additions and 4 deletions
|
@ -49,9 +49,6 @@ export class EditableGraphicsWidget extends GraphicsWidget {
|
||||||
renderGraphic(element: HTMLElement, view: EditorView) {
|
renderGraphic(element: HTMLElement, view: EditorView) {
|
||||||
super.renderGraphic(element, view)
|
super.renderGraphic(element, view)
|
||||||
if (this.figureData) {
|
if (this.figureData) {
|
||||||
if (this.figureData.width) {
|
|
||||||
element.dataset.width = this.figureData.width.toString()
|
|
||||||
}
|
|
||||||
const button = this.createEditButton(view)
|
const button = this.createEditButton(view)
|
||||||
element.prepend(button)
|
element.prepend(button)
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,12 @@ export class GraphicsWidget extends WidgetType {
|
||||||
updateDOM(element: HTMLImageElement, view: EditorView) {
|
updateDOM(element: HTMLImageElement, view: EditorView) {
|
||||||
this.destroyed = false
|
this.destroyed = false
|
||||||
element.classList.toggle('ol-cm-environment-centered', this.centered)
|
element.classList.toggle('ol-cm-environment-centered', this.centered)
|
||||||
|
if (
|
||||||
|
this.filePath === element.dataset.filepath &&
|
||||||
|
element.dataset.width === this.figureData?.width?.toString()
|
||||||
|
) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
this.renderGraphic(element, view)
|
this.renderGraphic(element, view)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -76,7 +82,7 @@ export class GraphicsWidget extends WidgetType {
|
||||||
|
|
||||||
const preview = this.getPreviewByPath(this.filePath)
|
const preview = this.getPreviewByPath(this.filePath)
|
||||||
element.dataset.filepath = this.filePath
|
element.dataset.filepath = this.filePath
|
||||||
element.dataset.width = undefined
|
element.dataset.width = this.figureData?.width?.toString()
|
||||||
|
|
||||||
if (!preview) {
|
if (!preview) {
|
||||||
const message = document.createElement('div')
|
const message = document.createElement('div')
|
||||||
|
|
Loading…
Reference in a new issue