Skip to content

Instantly share code, notes, and snippets.

View SplitterAlex's full-sized avatar
🎯
Focusing

Alex SplitterAlex

🎯
Focusing
View GitHub Profile
@florianbrinkmann
florianbrinkmann / index.js
Last active February 26, 2024 21:40
Gutenberg FormTokenField block with posts as source
/**
* External dependencies
*/
const { isUndefined, pickBy } = lodash;
/**
* WordPress dependencies
*/
const {
registerBlockType,
ngOnInit() {
this.filteredRoutes$ = from(this.routes).pipe(
concatMap((route) => {
// handle if nothing is in canActivate
if (!route.canActivate || !route.canActivate.length) {
// create an object that has the route and result for filtering
return of({ route, result: true });
}
return from(route.canActivate).pipe(