KevinBatdorf / code-block-pro

A Gutenberg code block with syntax highlighting powered by VS Code
https://code-block-pro.com
132 stars 10 forks source link

Allow copy override and callback #265

Closed KevinBatdorf closed 1 year ago

KevinBatdorf commented 1 year ago

This lets you override the text about to be copied, and also lets you fire a callback after the copy takes place (in case you wanted a custom notification)

window.cbpCopyOverride = (code, button) => {
    console.log('copied!', button, code)
    return `${code}\ntest test test`;
};
window.cbpCopyCallback = (code, button) => {
  console.log('callback', button, code)
}
ckuhtz commented 1 year ago

Thank you! How do I use this from within the Wordpress editor? Paste it in under Advanced, Additional CSS classes?

KevinBatdorf commented 1 year ago

Maybe I misunderstood what you're trying to do. Can you explain it again?