Skip to content

Commit 94cd982

Browse files
Update docs/source/development/widget.md
Co-authored-by: Steve Piercy <[email protected]>
1 parent 0aea31a commit 94cd982

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

docs/source/development/widget.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -359,21 +359,22 @@ import { useDispatch } from 'react-redux';
359359
import { setSidebarTab, setMetadataFocus } from '@plone/volto/actions';
360360
361361
const MyComponent = (/* ... */) => {
362+
// ...
363+
const dispatch = useDispatch();
364+
// ...
365+
366+
return (
362367
// ...
363-
const dispatch = useDispatch();
368+
<button
369+
onClick={() => {
370+
dispatch(setSidebarTab(0));
371+
dispatch(setMetadataFocus("ownership", "allow_discussion"));
372+
}}
373+
>
374+
This button will change the sidebar to the content form and focus
375+
ownership fieldset and the allow_discussion field
376+
</button>
364377
// ...
365-
366-
return (
367-
// ...
368-
<button
369-
onClick={() => {
370-
dispatch(setSidebarTab(0));
371-
dispatch(setMetadataFocus('ownership', 'allow_discussion'));
372-
}}
373-
>
374-
This button will change the sidebar to the content form and focus ownership fieldset and the allow_discussion field
375-
</button>
376-
// ...
377-
);
378+
);
378379
};
379380
```

0 commit comments

Comments
 (0)