Skip to content

Commit

Permalink
if there's only one type of box, just pick that
Browse files Browse the repository at this point in the history
  • Loading branch information
olynch committed Jul 19, 2021
1 parent 2fadb75 commit 864a295
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions javascript/src/EditorState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,16 @@ export class EditorState {
*/
addBox() {
const box_types = [...Object.keys(this.ls.sg.schema.box_types)];
this.dialogue.modal = {
ty: ModalState.SelectBox,
choices: box_types
};
if (box_types.length == 1) {
this.ls.addBox(box_types[0], this.cursor.cursor);
} else if (box_types.length == 0) {
// do nothing
} else {
this.dialogue.modal = {
ty: ModalState.SelectBox,
choices: box_types
};
}
}

/** Add a new port to the `cursor.hoveredAttachment` box, assuming it's a box */
Expand Down

4 comments on commit 864a295

@olynch
Copy link
Member Author

@olynch olynch commented on 864a295 Jul 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/40885

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.1 -m "<description of version>" 864a2957ffca00fdb00a390ae440fa53d26ed327
git push origin v0.1.1

@olynch
Copy link
Member Author

@olynch olynch commented on 864a295 Jul 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/40885

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.1 -m "<description of version>" 864a2957ffca00fdb00a390ae440fa53d26ed327
git push origin v0.1.1

Please sign in to comment.