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

[Feature request] Text / Inscruction panel #124

Closed
Lennart-Lucas opened this issue Nov 7, 2023 · 10 comments · Fixed by #164
Closed

[Feature request] Text / Inscruction panel #124

Lennart-Lucas opened this issue Nov 7, 2023 · 10 comments · Fixed by #164
Assignees
Labels

Comments

@Lennart-Lucas
Copy link

It would be handy to have a way to display text of instructions without having an input field tied to it.
Something akin to QuickAdd's infoDialog where you pass in a string in the definition which the user gets to see.
with the full width of the form but without input field.

This would be especially helpfull with more complex workflows where you want to display previously selected or generated
information.

@Lennart-Lucas Lennart-Lucas added the enhancement New feature or request label Nov 7, 2023
@danielo515
Copy link
Owner

This is something I thought about myself too.
Something where you can add some more detailed explanation. This type of "visual components" may be extended to more types like images and stuff. I like the idea.

What about starting with something simple where you just put a text?
How is the QuickAdd info dialog? Do you have any screenshot?

@Lennart-Lucas
Copy link
Author

The QuickAdd info dialog was just an example, it basically displays a given text to the user with an okay button.
It would be amazing to have something similar to put into the form.

Screenshot 2023-11-08 002000

@danielo515
Copy link
Owner

Cool. Will add something similar as next feature

@danielo515
Copy link
Owner

danielo515 commented Dec 19, 2023

@Lennart-Lucas I'm working on this and I have doubts about certain details.
For now, the best way to do this (the most flexible one at least) is that the documentation block will be a function that gets all the form values, and it should return a string that will be rendered in the documentation block.
However, I am not sure about the following:

  • Should this block have the label visible? Just like any other form input, with the label on top and the form text below?
  • Do you think returning a single string is enough? I can expect 2 strings and put the first one in the description, and the second one in the body. I'm not sure either about this

Here is the current implementation, where all I'm doing is rendering the returned string as is, letting the form label and form description just like the rest of the other blocks:

Screenshot 2023-12-19 at 10 22 11

The form definition will be something like this (the form builder will take care of everything except the body part)

        {
            name: "document",
            description: "Document block example",
            input: {
                type: "document_block",
                body: "return `Hello ${form.name}!\n Your best friend is ${form.best_fried}`",
            },
        },

If you have any thoughts, let me know

@danielo515 danielo515 moved this to Backlog in Roadmap Dec 24, 2023
@github-project-automation github-project-automation bot moved this from Backlog to Done in Roadmap Dec 25, 2023
@Lennart-Lucas
Copy link
Author

I've played around with this and it seems great!

The label is optional, so if people want to use it then it's there if not then it's not a hassle.

One string for the text itself should be sufficient if the formatting works. As it stands the newline (\n) seems to be ignored by the form? When I try the example form or implement it myself the newlines get skipped. If the form correctly interprets the newline it's possible to create paragraphs and format text.

@danielo515
Copy link
Owner

danielo515 commented Dec 30, 2023 via email

@Lennart-Lucas
Copy link
Author

Lennart-Lucas commented Jan 2, 2024

I have tried that, but HTML doens't seem to get parsed at all.

HTML such as <br/> or <b> is treated like regular text and gets printed as such.
For instance <b>Hello ${form.name}!</b><br/>Your best friend is ${form.best_fried}
Gets printed as <b>Hello undefined</b><br/>Your best friend is (using the preview form).

@danielo515
Copy link
Owner

danielo515 commented Jan 2, 2024 via email

@danielo515
Copy link
Owner

@Lennart-Lucas I just added support for html in the returned string.
Can you try again using
and any other tag you may wish? like <b>Hello</b>

@Lennart-Lucas
Copy link
Author

Both the tags and new lines work, thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants