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

Try another hack to reposition CKEditor toolbar #16704

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions frontend/src/turbo/dialog-stream-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ export function registerDialogStreamAction() {
StreamActions.dialog = function dialogStreamAction(this:StreamElement) {
const content = this.templateElement.content;
const dialog = content.querySelector('dialog') as HTMLDialogElement;
// Set a temporary width so the dialog reflows after opening
dialog.style.width = '0px';

document.body.append(content);

Expand All @@ -21,8 +19,11 @@ export function registerDialogStreamAction() {
}
});

// Hack to fix the width calculation of nested elements
// such as the CKEditor toolbar.
setTimeout(() => {
dialog.style.removeProperty('width');
}, 10);
const width = dialog.offsetWidth;
dialog.style.width = `${width + 1}px`;
}, 50);
};
}
Loading