Hey team, I noticed the issue #8356 closed.
I'd only like to have an option to customize the story view (especially source code view), too.
Have you got any plan to resolve this issue?
addParameters({ docs: { previewSource: 'open' } })
@shilman has new progress?
This would be lovely, I was just searching the docs on how to do this!
🤞 my current workaround is to poll the page for show code buttons and click them. It's crazy janky.
🤞 my current workaround is to poll the page for show code buttons and click them. It's crazy janky.
@signal-intrusion How can you solve the problem by this hacking tricks.Could you pls show the code?Thank you
Any progress on this?
@ron0115 In preview.js I added this:
// this little bit of hacky code opens code samples
window.addEventListener('load', () => {
let loc = window.location.href
showCodeSamples()
window.setInterval(() => {
let newLoc = window.location.href
if (newLoc !== loc) {
loc = newLoc
showCodeSamples()
}
}, 300)
})
function showCodeSamples() {
try {
const docs = document.querySelectorAll('.sbdocs')
;[].forEach.call(docs, (el) => {
const buttons = el.querySelectorAll('button')
const codeButton = [].find.call(buttons, (el) => el.textContent === 'Show code')
if (codeButton) {
codeButton.click()
}
})
} catch (e) {
console.warn(e)
}
}
Most helpful comment
This would be lovely, I was just searching the docs on how to do this!