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

Creator: Speech has a default autoplay field #170

Open
brettfiedler opened this issue Oct 16, 2023 · 7 comments
Open

Creator: Speech has a default autoplay field #170

brettfiedler opened this issue Oct 16, 2023 · 7 comments
Assignees

Comments

@brettfiedler
Copy link
Contributor

We should add a simple case for speech that is similar to the abstracted Sound view component.

  • Add a text entry field for the desired spoken string
  • Default the string to autoplay when the component is triggered, perhaps with a similar "Autoplay" checkbox like the Sound component form.
  • A disabled checkbox uses the code from the Custom Function field as it currently does by default.
@brettfiedler
Copy link
Contributor Author

We'll want to be able to still add dependencies we can read out current model property values simply.

@jessegreenberg
Copy link
Contributor

@brettfiedler can you please comment on the goal for this issue? I was curious about it because it seems like we already have a simple way to accomplish this with the current form.

The behavior described above can be done now by writing

return "Hello, world!"

in the control function.

I can see why abstracting a bit more was useful for sound because every sound uses a play() call, and it is nice to skip that if you want the sound to always play. But speech requires some unique text content so why not provide that in the control function instead of adding a new text input?

For the second comment:

We'll want to be able to still add dependencies we can read out current model property values simply.

If not using the control function, how would this be done? Would this require a new form or maybe we let the user fill in a string pattern with component names?

@brettfiedler
Copy link
Contributor Author

In hindsight, I'm not sure about this one. I think for UI purposes, having the text field above the Control Function would be limited to playing basic speech. It'd be a super simple abstraction, but I think an expected one. It does indeed replace only "return some string" but for anyone not comfortable at all with code, it might be intuitive to just have it say something.

Probably any text in the control function should override the text entry (and empty it out once we save?).

@brettfiedler
Copy link
Contributor Author

Turns out we need to move the Control Components section from the View Control Function menu into the View form itself. Then this should be possible. Making new issue.

@brettfiedler
Copy link
Contributor Author

Assigning this for when #268 is complete.

@brettfiedler
Copy link
Contributor Author

We do want a text field to enter and tie the entry to a controlled component.

Adding text to the control function overrides the text entry field.

If simple, we should clear the text entry field when the component is saved with code in the control function editor.

(for extra validation, maybe we should guarantee it has a return or speak() somewhere in the editor?)

@jessegreenberg
Copy link
Contributor

OK, the above commits add a basic form entry for "basic" text, data and save and load functionality for the component, and the code generation.

If simple, we should clear the text entry field when the component is saved with code in the control function editor.

I thought this was a little tricky so I went with validation to start. You cannot create/save a Speech component if it has both a control function and a basic string.

maybe we should guarantee it has a return or speak() somewhere in the editor

Sounds good, I added this. Note that it isn't smart enough to skip comments and will let you create/save with // speak() in the control function.

@brettfiedler would you like to verify anything before we close? Do you have any recommendations for improving the labels/layout?

Capture

@jessegreenberg jessegreenberg removed their assignment Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants