Skip to content

Instantly share code, notes, and snippets.

@josephfusco
Last active February 24, 2023 18:04
Show Gist options
  • Save josephfusco/b781839e8c33dc729b64f94eaa8a57c3 to your computer and use it in GitHub Desktop.
Save josephfusco/b781839e8c33dc729b64f94eaa8a57c3 to your computer and use it in GitHub Desktop.

Revisions

  1. josephfusco revised this gist Feb 24, 2023. No changes.
  2. josephfusco revised this gist Feb 24, 2023. No changes.
  3. josephfusco created this gist Feb 24, 2023.
    25 changes: 25 additions & 0 deletions CustomToolbar.tsx
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    import React from 'react';
    import { FaustHooks, FaustPlugin } from '@faustwp/core';
    import { FaustToolbarNodes, ToolbarNodeSkeleton } from '@faustwp/core/toolbar';

    export class CustomToolbar implements FaustPlugin {
    apply(hooks: FaustHooks) {
    hooks.addFilter('toolbarNodes', 'faust', (toolbarNodes: FaustToolbarNodes) => {

    const customToolbarNodes: FaustToolbarNodes = [
    {
    id: 'test1',
    location: 'primary',
    component: <ToolbarNodeSkeleton />,
    },
    {
    id: 'test2',
    location: 'primary',
    component: <ToolbarNodeSkeleton />,
    },
    ];

    return [...toolbarNodes, ...customToolbarNodes];
    });
    }
    }