mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-12-23 23:02:08 +03:00
Lexical: Revamped image node resize method
Changed from using a decorator to using a helper that watches for image selections to then display a resize helper. Also changes resizer to use a ghost and apply changes on end instead of continuosly during resize.
This commit is contained in:
@@ -144,6 +144,14 @@ export class EditorUIManager {
|
||||
this.selectionChangeHandlers.delete(handler);
|
||||
}
|
||||
|
||||
triggerLayoutUpdate(): void {
|
||||
window.requestAnimationFrame(() => {
|
||||
for (const toolbar of this.activeContextToolbars) {
|
||||
toolbar.updatePosition();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected updateContextToolbars(update: EditorUiStateUpdate): void {
|
||||
for (let i = this.activeContextToolbars.length - 1; i >= 0; i--) {
|
||||
const toolbar = this.activeContextToolbars[i];
|
||||
@@ -220,13 +228,8 @@ export class EditorUIManager {
|
||||
}
|
||||
|
||||
protected setupEventListeners(context: EditorUiContext) {
|
||||
const updateToolbars = (event: Event) => {
|
||||
for (const toolbar of this.activeContextToolbars) {
|
||||
toolbar.updatePosition();
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('scroll', updateToolbars, {capture: true, passive: true});
|
||||
window.addEventListener('resize', updateToolbars, {passive: true});
|
||||
const layoutUpdate = this.triggerLayoutUpdate.bind(this);
|
||||
window.addEventListener('scroll', layoutUpdate, {capture: true, passive: true});
|
||||
window.addEventListener('resize', layoutUpdate, {passive: true});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user