Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/v3.0.0-rc'
Browse files Browse the repository at this point in the history
  • Loading branch information
SofiaSousa committed Oct 31, 2018
2 parents 38b8974 + 53eefec commit c2b951d
Show file tree
Hide file tree
Showing 43 changed files with 2,017 additions and 2,076 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
],
"settings": {
"react": {
"pragma": "React"
"pragma": "React",
"version": "16.0"
}
},
"rules": {
Expand Down
83 changes: 58 additions & 25 deletions README.md
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

Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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/).
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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)
12 changes: 12 additions & 0 deletions gutenberg_js_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@frontkom/gutenberg-js",
"version": "2.6.1",
"version": "3.0.0-rc",
"description": "gutenberg-js - An extension of the Wordpress Gutenberg editor",
"main": "build/js/gutenberg-js.js",
"repository": {
Expand All @@ -13,7 +13,8 @@
"dev": "NODE_ENV=development webpack",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"postinstall": "./scripts/install.sh"
"postinstall": "./scripts/install.sh",
"deploy": "npm run lint && npm publish --access public"
},
"homepage": "https://github.com/front/gutenberg-js#readme",
"bugs": {
Expand All @@ -32,6 +33,7 @@
"WYSIWYG"
],
"dependencies": {
"react-dates": "^18.1.1",
"tinymce": "4.8.0"
},
"devDependencies": {
Expand Down Expand Up @@ -60,9 +62,7 @@
"raw-loader": "0.5.1",
"sass-loader": "6.0.7",
"webpack": "4.8.3",
"webpack-cli": "2.1.3",
"webpack-livereload-plugin": "2.1.1",
"webpack-rtl-plugin": "github:yoavf/webpack-rtl-plugin#develop"
"webpack-cli": "2.1.3"
},
"private": false
}
5 changes: 3 additions & 2 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ git clone https://github.com/WordPress/gutenberg.git
cd gutenberg

# checkout to version we want
git checkout tags/v3.9.0
git checkout tags/v4.2.0-rc.1

# remove git references
rm -rf .git
# GUTENBERG HAS A SUBMODULE NOW
# rm -rf .git

# install gutenberg dependencies
npm i
12 changes: 12 additions & 0 deletions src/js/api-fetch-init.js
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;
}
25 changes: 0 additions & 25 deletions src/js/gutenberg-overrides/edit-post/CHANGELOG.md

This file was deleted.

This file was deleted.

Loading

0 comments on commit c2b951d

Please sign in to comment.