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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71804c0e217ea2d99fda291adbf76209974e772f62a6bd678f5fcaa5ef4828b5
4
- data.tar.gz: 2a807f11fdb2a41d61e4965ed308e82b595dc0c85240d033bd1579a8572e1413
3
+ metadata.gz: 222c57bb2ab266c6fa4f18bea9628aa15681b66d328e150fa66997d093bf7d38
4
+ data.tar.gz: 538a806469ac8f376d738595d8c086ff6b3a0eb0ccb93de8729f0ff0033a2a64
5
5
  SHA512:
6
- metadata.gz: d035c48fb813f7665e28e785878cc31783feebcbfd21f060d5805bf2885cf4f1537c2a89a2791ed0f4c4db755a1e2be99de0e2cc60c8c9afe518d8027afcc751
7
- data.tar.gz: 30ba747ad027940856616d421cfac76dfc2407d651d651889f6550ad54398e1375c3a7ccfbceaba2124fd2d89ea70d64937cf6cf9d3d911d4c2ba67821b35b55
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
- * [Gutenberg Demo](https://wordpress.org/gutenberg/)
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
@@ -1,3 +1,3 @@
1
1
  module BlockEditor
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
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.2
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-16 00:00:00.000000000 Z
11
+ date: 2021-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails