-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Situation
This system was quickly created to implement import dialog, and it needs improvements to support different kinds of dialogs.
Currently, the (top-level) dialogs are rendered in the View component, which has the toplevel viewport div:
Line 295 in 4bcb47f
function View({ doc, updateDoc, buffer, setBuffer }) { |
It is called by App component with import dialog related props:
Line 197 in 4bcb47f
<View key={doc?.key} doc={doc} updateDoc={updateDoc} buffer={importing} setBuffer={setImporting} /> |
Command interface
Command interface was implemented to remove need to pass doc to file menu, instead we set up a command that is performed at the top level.
Command "switch":
Line 137 in 4bcb47f
switch (action) { |
Functions to create commands:
Line 36 in 4bcb47f
//----------------------------------------------------------------------------- |
Calling functions to create commands:
Line 459 in 4bcb47f
onClick={e => { cmdNewFile({ setCommand }); popupState.close(e); }} |
Dialog improvement
We could follow bit the same interface with dialogs. We would have a command structure to pass arguments to dialogs from deeper components. The we would have a switch or similar to render the dialogs.