This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
2,017 additions
and
2,076 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,8 @@ | |
], | ||
"settings": { | ||
"react": { | ||
"pragma": "React" | ||
"pragma": "React", | ||
"version": "16.0" | ||
} | ||
}, | ||
"rules": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
# gutenberg-js | ||
|
||
![gutenberg-js](gutenberg_js_logo.svg?sanitize=true "gutenberg-js") | ||
|
||
We made [Gutenberg](https://github.com/Wordpress/gutenberg) editor a little more **customizable**! | ||
|
||
Gutenberg editor can **be easly included in your apps** with this [package](https://github.com/front/gutenberg-js). Also you can customize blocks menu panels, blocks categories, document panels and more! | ||
|
||
This package is based on [Gutenberg v3.9.0](https://github.com/WordPress/gutenberg/releases/tag/v3.9.0). | ||
This package is based on [Gutenberg v4.2.0-rc.1](https://github.com/WordPress/gutenberg/releases/tag/v4.2.0-rc.1). | ||
|
||
## Table of contents | ||
|
||
|
@@ -16,10 +18,10 @@ This package is based on [Gutenberg v3.9.0](https://github.com/WordPress/gutenbe | |
* [Wp block](#wp-block) | ||
* [Posts and Pages](#posts-and-pages) | ||
* [Categories](#categories) | ||
* [Index](#index) | ||
* [Media](#media) | ||
* [Taxonomies](#taxonomies) | ||
* [Blocks](#blocks) | ||
* [Themes](#themes) | ||
* [url](#url) | ||
* [Usage](#usage) | ||
* [Gutenberg Stores](#gutenberg-stores) | ||
|
@@ -30,13 +32,14 @@ This package is based on [Gutenberg v3.9.0](https://github.com/WordPress/gutenbe | |
* [Custom blocks](#custom-blocks) | ||
* [Creating and Registering](#creating-and-registering) | ||
* [Sharing](#sharing) | ||
* [Development](#development) | ||
|
||
## Installation | ||
|
||
**gutenberg-js** is available through npm. | ||
|
||
```sh | ||
npm install @frontkom/gutenberg-js | ||
$ npm install @frontkom/gutenberg-js | ||
``` | ||
|
||
[↑ Go up to Table of contents](#table-of-contents) | ||
|
@@ -62,6 +65,17 @@ module.exports = { | |
} | ||
``` | ||
|
||
GutenbergJS expects to find React (v16.4.1), ReactDOM (v16.4.1), moment (v2.22.1), jQuery (v1.12.4) and lodash (v4.17.5) libraries in the environment it runs. Maybe you would add the following lines to your pages. | ||
|
||
```html | ||
<script src="https://unpkg.com/[email protected]/umd/react.production.min.js"></script> | ||
<script src="https://unpkg.com/[email protected]/umd/react-dom.production.min.js"></script> | ||
<script src="https://unpkg.com/[email protected]/min/moment.min.js"></script> | ||
<script src="https://unpkg.com/[email protected]/lodash.min.js"></script> | ||
<script>window.lodash = _.noConflict();</script> | ||
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script> | ||
``` | ||
|
||
[↑ Go up to Table of contents](#table-of-contents) | ||
|
||
## Global variables | ||
|
@@ -159,23 +173,6 @@ Check the WordPress API documentation for [Categories](https://developer.wordpre | |
|
||
[↑ Go up to Table of contents](#table-of-contents) | ||
|
||
#### Index | ||
|
||
Gutenberg will ask for the [theme features](https://codex.wordpress.org/Theme_Features) through the index request (`/`). The response should be the following object. | ||
|
||
```js | ||
{ | ||
..., | ||
theme_supports: { | ||
formats: [ 'standard', 'aside', 'image', 'video', 'quote', 'link', 'gallery', 'audio' ], | ||
'post-thumbnails': true, | ||
}, | ||
..., | ||
} | ||
``` | ||
|
||
[↑ Go up to Table of contents](#table-of-contents) | ||
|
||
#### Taxonomies | ||
|
||
Taxonomies and Categories are requested to fill Categories panel in Document sidebar. Check the WordPress API documentation for [Taxonomies](https://developer.wordpress.org/rest-api/reference/taxonomies/). | ||
|
@@ -214,6 +211,25 @@ There is no documentation for `/wp/v2/wp_blocks` or `/wp/v2/blocks` request yet, | |
|
||
Gutenberg editor allows us to create, edit, list, get one and delete one block operations, so make sure you expect GET, POST, PUT and DELETE requests. | ||
|
||
[↑ Go up to Table of contents](#table-of-contents) | ||
|
||
#### Themes | ||
|
||
Gutenberg will ask for the [theme features](https://codex.wordpress.org/Theme_Features) through the index request (`/wp/v2/themes`). The response should be the following object. | ||
|
||
```js | ||
{ | ||
..., | ||
theme_supports: { | ||
formats: [ 'standard', 'aside', 'image', 'video', 'quote', 'link', 'gallery', 'audio' ], | ||
'post-thumbnails': true, | ||
}, | ||
..., | ||
} | ||
``` | ||
|
||
[↑ Go up to Table of contents](#table-of-contents) | ||
|
||
### url | ||
|
||
***url*** should has a function called `addQueryArgs( url, args )` that handles with `url` and `args` and returns the final url to different actions. The original implementation is the following, feel free to keep it or change it according to your needs. | ||
|
@@ -257,11 +273,6 @@ import { editPost } from '@frontkom/gutenberg-js'; | |
|
||
// Don't forget to import the style | ||
import '@frontkom/gutenberg-js/build/css/block-library/style.css'; | ||
import '@frontkom/gutenberg-js/build/css/components/style.css'; | ||
import '@frontkom/gutenberg-js/build/css/nux/style.css'; | ||
import '@frontkom/gutenberg-js/build/css/editor/style.css'; | ||
import '@frontkom/gutenberg-js/build/css/block-library/theme.css'; | ||
import '@frontkom/gutenberg-js/build/css/block-library/edit-blocks.css'; | ||
import '@frontkom/gutenberg-js/build/css/style.css'; | ||
|
||
// DOM element id where editor will be displayed | ||
|
@@ -277,11 +288,16 @@ const settings = { | |
availableTemplates: [], | ||
allowedBlockTypes: true, | ||
disableCustomColors: false, | ||
disableCustomFontSizes: false, | ||
disablePostFormats: false, | ||
titlePlaceholder: "Add title", | ||
bodyPlaceholder: "Write your story", | ||
isRTL: false, | ||
autosaveInterval: 10, | ||
styles: [], | ||
postLock: { | ||
isLocked: false, | ||
}, | ||
... | ||
// @frontkom/gutenberg-js settings | ||
canAutosave: false, // to disable the Editor Autosave feature (default: true) | ||
|
@@ -564,3 +580,20 @@ An easy way to share a custom block is to publish the block as a npm package. | |
Here is an example of a custom block npm package, the [Hero Section](https://github.com/front/g-hero-section). | ||
|
||
[↑ Go up to Table of contents](#table-of-contents) | ||
|
||
## Development | ||
|
||
### Upgrading | ||
|
||
* Update Gutenberg version in `scripts/install.sh` | ||
* Check `gutenbergPackages` list in `webpack.config.js` | ||
* Check modules list in `index.js` | ||
* Check `gutenberg-overrides` one by one | ||
|
||
### Publising | ||
|
||
```sh | ||
$ npm run deploy | ||
``` | ||
|
||
[↑ Go up to Table of contents](#table-of-contents) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import apiFetch from 'gutenberg/packages/api-fetch/build-module'; | ||
|
||
if (window.wp.apiFetch) { | ||
const props = Object.keys(apiFetch); | ||
|
||
props.forEach(prop => { | ||
window.wp.apiFetch[prop] = window.wp.apiFetch[prop] || apiFetch[prop]; | ||
}); | ||
} | ||
else { | ||
window.wp.apiFetch = apiFetch; | ||
} |
This file was deleted.
Oops, something went wrong.
62 changes: 0 additions & 62 deletions
62
src/js/gutenberg-overrides/edit-post/components/header/more-menu/index.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.