Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperaamodt committed May 7, 2021
0 parents commit 945046c
Show file tree
Hide file tree
Showing 8 changed files with 432 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
~
339 changes: 339 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Block Processors

Block processors package for [Frontity](https://frontity.org).

# Installation

1. Do `npm install @aamodtgroup/block-processors` in the root of your project.
1. Add the package name in `frontity-settings.js`.

```javascript
"packages": [
"@aamodtgroup/block-processors"
// other packages ...
]
```

3. Run `npx frontity dev` again.

That's it! The package doesn't need any settings.

## Credits

- Build with love :blue_heart:, using [Frontity](https://frontity.org)

## Authors

1. [Kasper Aamodt](https://twitter.com/kasperaamodt) - Owner and developer [@aamodtgroup](https://twitter.com/aamodtgroup)

## License

![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)

- **[GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)**
30 changes: 30 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "@aamodtgroup/block-processors",
"version": "0.1.0",
"description": "Block processors for Gutenberg blocks in Frontity.",
"keywords": [
"Frontity",
"WordPress",
"Reactjs",
"react",
"gutenberg"
],
"homepage": "https://aamodtgroup.com",
"license": "GPL-2.0-or-later",
"repository": {
"type": "git",
"url": "https://github.com/aamodtgroup/gutenberg-processors"
},
"bugs": {
"url": "https://github.com/aamodtgroup/gutenberg-processors/issues"
},
"author": "Aamodt Group",
"peerDependencies": {
"frontity": "^1.15.0",
"@frontity/html2react": "^1.6.2"
},
"publishConfig": {
"cache": "~/.npm",
"access": "public"
}
}
13 changes: 13 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import processors from "./processors";

const BlockProcessors = {

libraries: {
html2react: {
processors,
}
}

}

export default BlockProcessors;
9 changes: 9 additions & 0 deletions src/processors/file-block.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const fileBlock = {
name: 'fileBlock',
test: ({ node }) => node.component === "div" && node.props.className === "wp-block-file",
processor: ({ node }) => {
node.children[0].props.target = "_blank";
node.children[1].props.target = "_blank";
return node;
}
};
5 changes: 5 additions & 0 deletions src/processors/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { fileBlock } from './file-block';

export default [
fileBlock
];

0 comments on commit 945046c

Please sign in to comment.