diff options
author | Julien Déramond <julien.deramond@orange.com> | 2022-06-20 17:19:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-20 17:19:47 +0300 |
commit | cfabeb71fa41a7e4438a8f769cad5286f749d9a3 (patch) | |
tree | 8f2a7061de5fdd9a715029e50c9293df2c78757b /site/layouts | |
parent | 22503d6b21a3530d2f312c0a8c0ce1c2956fc146 (diff) |
Fix StackBlitz Popovers and Tooltips examples (#36449)
* Fix StackBlitz Popovers and Tooltips examples
* Rename shortcode example parameters
* Reorder example shortcode doc params + fix Cspell
* Remove 'stackblitz' param + use data-bs-title instead of title
* Update site/layouts/partials/callout-warning-data-bs-title-vs-title.md
Co-authored-by: Mark Otto <markd.otto@gmail.com>
Co-authored-by: Mark Otto <markd.otto@gmail.com>
Diffstat (limited to 'site/layouts')
-rw-r--r-- | site/layouts/partials/callout-warning-data-bs-title-vs-title.md | 1 | ||||
-rw-r--r-- | site/layouts/partials/scripts.html | 2 | ||||
-rw-r--r-- | site/layouts/shortcodes/example.html | 11 |
3 files changed, 8 insertions, 6 deletions
diff --git a/site/layouts/partials/callout-warning-data-bs-title-vs-title.md b/site/layouts/partials/callout-warning-data-bs-title-vs-title.md new file mode 100644 index 0000000000..e932f22ad9 --- /dev/null +++ b/site/layouts/partials/callout-warning-data-bs-title-vs-title.md @@ -0,0 +1 @@ +Feel free to use either `title` or `data-bs-title` in your HTML. When `title` is used, Popper will replace it automatically with `data-bs-title` when the element is rendered. diff --git a/site/layouts/partials/scripts.html b/site/layouts/partials/scripts.html index 5535d64391..477ba76e58 100644 --- a/site/layouts/partials/scripts.html +++ b/site/layouts/partials/scripts.html @@ -30,7 +30,7 @@ // Get extra classes for this example except '.bd-example' const classes = Array.from(event.target.closest('.bd-code-snippet').querySelector('.bd-example').classList).filter(x => x !== 'bd-example').join(' ') - const jsSnippet = event.target.closest('.bd-code-snippet').querySelector('.btn-edit').getAttribute('data-js-snippet') + const jsSnippet = event.target.closest('.bd-code-snippet').querySelector('.btn-edit').getAttribute('data-sb-js-snippet') StackBlitzSDK.openBootstrapSnippet(htmlSnippet, jsSnippet, classes) }) }) diff --git a/site/layouts/shortcodes/example.html b/site/layouts/shortcodes/example.html index a1685a0a6b..3cbbd9fca9 100644 --- a/site/layouts/shortcodes/example.html +++ b/site/layouts/shortcodes/example.html @@ -4,17 +4,18 @@ `args` are all optional and can be one of the following: * id: the `div`'s id - default: "" * class: any extra class(es) to be added to the `div` - default: "" - * js_snippet: add extra JS snippet to StackBlitz - default: `false` - * show_preview: if the preview should be output in the HTML - default: `true` + * lang: language used to display the code - default: "html" * show_markup: if the markup should be output in the HTML - default: `true` + * show_preview: if the preview should be output in the HTML - default: `true` + * stackblitz_add_js: if extra JS snippet shoud le added to StackBlitz - default: `false` */ -}} {{- $id := .Get "id" -}} {{- $class := .Get "class" -}} {{- $lang := .Get "lang" | default "html" -}} -{{- $show_preview := .Get "show_preview" | default true -}} +{{- $stackblitz_add_js := .Get "stackblitz_add_js" | default false -}} {{- $show_markup := .Get "show_markup" | default true -}} -{{- $js_snippet := .Get "js_snippet" | default false -}} +{{- $show_preview := .Get "show_preview" | default true -}} {{- $input := .Inner -}} <div class="bd-example-snippet bd-code-snippet"> @@ -29,7 +30,7 @@ <div class="d-flex align-items-center highlight-toolbar bg-light ps-3 pe-2 py-1"> <small class="font-monospace text-muted text-uppercase">{{- $lang -}}</small> <div class="d-flex ms-auto"> - <button type="button" class="btn-edit text-nowrap"{{ with $js_snippet }} data-js-snippet="{{ $js_snippet }}"{{ end }} title="Try it on StackBlitz"> + <button type="button" class="btn-edit text-nowrap"{{ with $stackblitz_add_js }} data-sb-js-snippet="{{ $stackblitz_add_js }}"{{ end }} title="Try it on StackBlitz"> <svg class="bi" role="img" aria-label="Try it"><use xlink:href="#lightning-charge-fill"/></svg> </button> <button type="button" class="btn-clipboard mt-0 me-0" title="Copy to clipboard"> |