Skip to content

Instantly share code, notes, and snippets.

@felixranesberger
Last active July 4, 2025 09:31
Show Gist options
  • Select an option

  • Save felixranesberger/70981602a594940e53e5da0d42dba132 to your computer and use it in GitHub Desktop.

Select an option

Save felixranesberger/70981602a594940e53e5da0d42dba132 to your computer and use it in GitHub Desktop.
TipTap Config
import { defineTipTapPlugin } from '@typo3/tiptap';
defineTipTapPlugin({
styleSheets: [
`path-to-css-file.css`
],
styles: [
{
name: 'Red Button',
allowedTags: ['button', 'a'],
attributes: {
'class': 'btn btn-danger',
'data-example-attribute': 'exampleValue',
},
},
],
commands: [
{
id: 'openCookieModal',
label: 'Insert Cookie Modal Button',
iconIdentifier: 'icon-backend-cookie', // defined with TYPO3 icons API
sortAfter: 'insertLink',
// This is the action that will be executed when the command button is triggered
action: ({ editor }) => {
const buttonHtml = `
<button
class="btn btn-danger"
data-example-attribute="exampleValue"
>
Open Cookie Modal
</button>
`;
editor.chain().focus().insertContent(buttonHtml).run();
},
},
],
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment