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

Sync editor upon editor change #448

Merged
merged 8 commits into from
Oct 11, 2024
Merged
Changes from 2 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
12 changes: 12 additions & 0 deletions packages/base/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,17 @@ function getSelectedObjectId(widget: JupyterCadWidget): string {
return '';
}

function syncEditor(tracker: WidgetTracker<JupyterCadWidget>) {
tracker.currentChanged.connect(() => {
const currentWidget = tracker.currentWidget;

if (currentWidget) {
const resizeEvent = new Event('resize');
window.dispatchEvent(resizeEvent);
}
});
}

/**
* Add the FreeCAD commands to the application's command registry.
*/
Expand All @@ -683,6 +694,7 @@ export function addCommands(
const trans = translator.load('jupyterlab');
const { commands } = app;
Private.updateFormSchema(formSchemaRegistry);
syncEditor(tracker);

commands.addCommand(CommandIDs.toggleConsole, {
label: trans.__('Toggle console'),
Expand Down
Loading