block_editor 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -1
- data/config/initializers/webpacker_extension.rb +9 -0
- data/lib/block_editor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 222c57bb2ab266c6fa4f18bea9628aa15681b66d328e150fa66997d093bf7d38
|
4
|
+
data.tar.gz: 538a806469ac8f376d738595d8c086ff6b3a0eb0ccb93de8729f0ff0033a2a64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b005ffcf7ef175d1458fb4097585e2e16c0ba431a2c348cdcb5d67a6feb598cf04edf2ec3449ed2a6ecd7da89b51148837ad8c3e69eeb9d59ad32c54cdb84461
|
7
|
+
data.tar.gz: fd8f8cbadbd0a9653ee70745072af406425cded4333070144b94b7e610a3f4cca75543ef4cea3594ecaa11266f9ba1a9fce573d989e0b97ef325b304ab8e90bb
|
data/README.md
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
# Block Editor for Ruby on Rails
|
2
2
|
This editor uses packages from the [Wordpress Gutenberg project](https://github.com/WordPress/gutenberg) to build a standalone block editor for Rails. This editor has been extracted from [Integral CMS](https://github.com/yamasolutions/integral) where it was built following the [Wordpress custom block editor tutorial](https://developer.wordpress.org/block-editor/how-to-guides/platform/custom-block-editor/).
|
3
3
|
|
4
|
+
Looking for a demo? Checkout this [simple host application example.](https://block-editor-rails.herokuapp.com/)
|
5
|
+
|
4
6
|
More information;
|
5
7
|
|
6
|
-
* [
|
8
|
+
* [Simple host application example source repository](https://github.com/yamasolutions/block-editor-sample)
|
9
|
+
* [Current Wordpress Editor Demo](https://wordpress.org/gutenberg/)
|
7
10
|
* [Gutenberg Block Editor Developer Documentation](https://developer.wordpress.org/block-editor/)
|
8
11
|
|
9
12
|
## Installation
|
@@ -50,6 +53,11 @@ end
|
|
50
53
|
```
|
51
54
|
* Boom! You have a Block Editor linked to your model
|
52
55
|
|
56
|
+
Note: If the error `Webpacker::Manifest::MissingEntryError` appears you need to run the following command to precompile the BlockEditor assets;
|
57
|
+
```
|
58
|
+
rails block_editor:webpacker:compile
|
59
|
+
```
|
60
|
+
|
53
61
|
### Strong Parameters
|
54
62
|
Remember to permit the block list attributes if you're using Strong Parameters (you should be), i.e;
|
55
63
|
```
|
@@ -80,6 +88,15 @@ The below files should be overridden within your application in order to style y
|
|
80
88
|
* `app/assets/stylesheets/block_editor/frontend/blocks.scss` - Any styles that should be displayed within the frontend and backend
|
81
89
|
* `app/assets/stylesheets/block_editor/backend/blocks.scss` - Any styles that should _only_ be displayed within the block editor itself, i.e when creating or editing the blocks
|
82
90
|
|
91
|
+
### MediaUploader & Images
|
92
|
+
There is no built in MediaUploader or media gallery, it is up to the host application to implement this.
|
93
|
+
|
94
|
+
When the media uploader is requested the Block Editor checks if `window.MediaUploader` is defined. If it is defined the block editor will call `window.MediaUploader.open(callback)`, otherwise it will randomly select an image from [Unsplash](https://unsplash.com)
|
95
|
+
|
96
|
+
When an image is successfully uploaded or selected the MediaUploader instance should call the callback which was passed into the `open` function;
|
97
|
+
```
|
98
|
+
callback({url: imageUrl})
|
99
|
+
```
|
83
100
|
|
84
101
|
### Turbolinks
|
85
102
|
Currently Block Editor is not compatible with Turbolinks as history is only being reset on full page loads. To disable Turbolinks per page add the following in your layout view file within your `<HEAD>`;;
|
@@ -7,6 +7,15 @@ module Webpacker::DynamicTag
|
|
7
7
|
end
|
8
8
|
new_helper.javascript_pack_tag(*names, **options.except(:webpacker))
|
9
9
|
end
|
10
|
+
|
11
|
+
def stylesheet_pack_tag(*names, **options)
|
12
|
+
return super unless options[:webpacker]
|
13
|
+
new_helper = self.dup
|
14
|
+
new_helper.define_singleton_method(:current_webpacker_instance) do
|
15
|
+
options[:webpacker].constantize.webpacker
|
16
|
+
end
|
17
|
+
new_helper.stylesheet_pack_tag(*names, **options.except(:webpacker))
|
18
|
+
end
|
10
19
|
end
|
11
20
|
|
12
21
|
Webpacker::Helper.prepend Webpacker::DynamicTag
|
data/lib/block_editor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: block_editor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Lindsay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|