Skip to content

Commit aee1f82

Browse files
committed
restore current module registration
1 parent 8112472 commit aee1f82

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

contrib/ext_editor.lua

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,28 @@ local box1 = dt.new_widget("box") {
411411
}
412412

413413

414-
-- install module in lighttable and darkroom ----------------------------------
414+
-- table with all the widgets --------------------------------------------------
415415
table.insert(ee.widgets, combobox)
416416
table.insert(ee.widgets, box1)
417-
install_module()
417+
418+
419+
-- register new module, but only when in lighttable ----------------------------
420+
if dt.gui.current_view().id == "lighttable" then
421+
install_module()
422+
else
423+
if not ee.event_registered then
424+
dt.register_event(
425+
MODULE_NAME, "view-changed",
426+
function(event, old_view, new_view)
427+
if new_view.name == "lighttable" and old_view.name == "darkroom" then
428+
install_module()
429+
end
430+
end
431+
)
432+
ee.event_registered = true
433+
end
434+
end
435+
418436

419437
-- initialize list of programs and widgets ------------------------------------
420438
UpdateProgramList(combobox, button_edit, button_edit_copy, false)

0 commit comments

Comments
 (0)