fatihsolhan / v-onboarding

v-onboarding is a super-slim, fully-typed onboarding component for Vue 3
https://v-onboarding.fatihsolhan.com/
MIT License
170 stars 22 forks source link

feat: Raw HTML support #82

Closed rozsazoltan closed 8 months ago

rozsazoltan commented 1 year ago

Inspired by: https://github.com/fatihsolhan/v-onboarding/issues/79 (issue)

Actually, it's not a major change, but it avoids generating a complete template reproduction just to implement HTML code in the description.

[!WARNING] It's important to note that in this case, it's up to the developer to only accept HTML code from trusted sources and validate them as needed, for example, using DOMPurify when possible.

Therefore, its default value is false by not being declared. So its current usage doesn't change, but in the future, there will be the possibility of implementing HTML code as well.

Examples ### 1. without `content.html` ```js // without content.html (result is not v-html) const steps = [{ content: { title: "Lorem ipsum...", description: "Lorem ipsum dolorem...." } }] ``` **Result:** `Lorem ipsum dolorem...` ### 2. with `content.html = false` ```js // with content.html = false (result is not v-html) const steps = [{ content: { title: "Lorem ipsum...", description: "Lorem ipsum dolorem...", html: false } }] ``` **Result:** `Lorem ipsum dolorem...` ### 3. with `content.html = true` --- just here enabled html tags ```js // with content.html = true (result is v-html) const steps = [{ content: { title: "Lorem ipsum...", description: "Lorem ipsum dolorem...", html: true } }] ``` **Result:** Lorem **ipsum** dolorem...
netlify[bot] commented 1 year ago

Deploy Preview for eloquent-lamport-f2ffa1 ready!

Name Link
Latest commit 4b7a0661c186af8a46aee90ca365add06be96513
Latest deploy log https://app.netlify.com/sites/eloquent-lamport-f2ffa1/deploys/64f32199bec46400081ddc9e
Deploy Preview https://deploy-preview-82--eloquent-lamport-f2ffa1.netlify.app/
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] commented 1 year ago

Deploy Preview for beamish-dango-bc9c2d ready!

Name Link
Latest commit 4b7a0661c186af8a46aee90ca365add06be96513
Latest deploy log https://app.netlify.com/sites/beamish-dango-bc9c2d/deploys/64f32199137680000818df1a
Deploy Preview https://deploy-preview-82--beamish-dango-bc9c2d.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

fatihsolhan commented 1 year ago

Hey @rozsazoltan, thank you for the changes. The point of custom UI was to meet this v-html need from the beginning. I don't think it's necessary to add v-html to the project, developers already can implement their own UI with the custom UI option. What do you think?

rozsazoltan commented 1 year ago

Ultimately, I agree with the question, and I've also contemplated whether this is indeed an important PR. However, if we truly want to create usefully guides, I believe using HTML is inevitable, so in reality, anyone who uses the package more seriously is forced to copy the entire template, even if they liked the original. There is a benefit to toggling HTML on/off, but as your question also pointed out, it's not such a critical modification.

By the way, I'm currently using templates everywhere to make the code v-html compatible, and I haven't made any other changes to the appearance. It's not a big task, but for smaller projects, it would indeed be nice not to have to copy a template, just to switch a variable from false to true.

fatihsolhan commented 8 months ago

Hey @rozsazoltan Although I think custom UI should meet this html need, providing an option for small html tags like strong makes sense. I'll merge this now, thank you for your support, I appreciate it 🙏 ❤️

github-actions[bot] commented 8 months ago

:tada: This PR is included in version 2.7.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: