mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 04:09:12 +00:00
remove examples
This commit is contained in:
@@ -22,8 +22,6 @@ export function codeExamplesPlugin(options = {}) {
|
||||
// Look for external links
|
||||
container.querySelectorAll('code.example').forEach(code => {
|
||||
const pre = code.closest('pre');
|
||||
const adjacentPre = pre.nextElementSibling?.localName === 'pre' ? pre.nextElementSibling : null;
|
||||
const adjacentPreForReact = adjacentPre?.querySelector('code.react') ? adjacentPre.querySelector('code') : null;
|
||||
const hasButtons = !code.classList.contains('no-buttons');
|
||||
const isOpen = code.classList.contains('open') || !hasButtons;
|
||||
const noEdit = code.classList.contains('no-edit');
|
||||
@@ -41,18 +39,7 @@ export function codeExamplesPlugin(options = {}) {
|
||||
${preview}
|
||||
</div>
|
||||
<div class="code-example-source" id="${id}">
|
||||
<wa-tab-group>
|
||||
<wa-tab slot="nav" panel="html">HTML</wa-tab>
|
||||
<wa-tab-panel name="html">${pre.outerHTML}</wa-tab-panel>
|
||||
${
|
||||
adjacentPreForReact
|
||||
? `
|
||||
<wa-tab slot="nav" panel="react">React</wa-tab>
|
||||
<wa-tab-panel name="react">${adjacentPre.outerHTML}</wa-tab-panel>
|
||||
`
|
||||
: ''
|
||||
}
|
||||
</wa-tab-group>
|
||||
${pre.outerHTML}
|
||||
</div>
|
||||
${
|
||||
hasButtons
|
||||
@@ -87,7 +74,6 @@ export function codeExamplesPlugin(options = {}) {
|
||||
`);
|
||||
|
||||
pre.replaceWith(codeExample);
|
||||
adjacentPre?.remove();
|
||||
});
|
||||
|
||||
return doc.toString();
|
||||
|
||||
Reference in New Issue
Block a user