cloudcannon-jekyll-bookshop 2.0.8 → 2.0.10.pre.editorlinks.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '038f7a7501b7d6a71c9761749d193ed2afd2edb1bcc69d954e0a62f61a3335ca'
4
- data.tar.gz: 67e6cd9f9a024acb7e3be50174722acfe45f7da91ed9709b334d36b77ad8430f
3
+ metadata.gz: ccd01e96bba92e85e0afe856ebd828dfa0e59f1dc6cb54cdf8aaf372561de1ff
4
+ data.tar.gz: 225e9713f532e3ed707d73ac62a290d739209fc97ddd7e330337e00b4205e36f
5
5
  SHA512:
6
- metadata.gz: d79cd68cab59614f93d486583b1fbfb9db5aa01d26f4eba75ee64676d154ad487309dad91a62f2950facfe5278e7cfce1ccdbc129192d54c945de10b0f2d6830
7
- data.tar.gz: 491e22beed820e04ce22c979f49913e41d7aeef5a2a4c8bd08932a816c117db5accfa80ff69a8efb3b094294c318177fa3937d7208446bfe384f28cee5a7a50c
6
+ metadata.gz: 5c12a1317f729b151f9a5c765acbc998b4b5b22ab0c70bd41774fd7068cfe8e430c335c7ed00ed84cc8e44c9282ade23d27e5466252bbb70cf849e23ae8cb504
7
+ data.tar.gz: 17a093605c52a1d32319d3059670d0991f400ae6a4503b8a7fe1036817d8e7202f69784a7f04239172ac0a8dc4e79bac878c83c91db172d97bac63325161b2b9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cloudcannon-jekyll-bookshop (2.0.8)
4
+ cloudcannon-jekyll-bookshop (2.0.10.pre.editorlinks.2)
5
5
  dry-inflector (>= 0.1, < 1.0)
6
6
  jekyll (>= 3.7, < 5.0)
7
7
  node-runner-temp-fix-windows (>= 1.0, < 2.0)
@@ -11,8 +11,10 @@ module CloudCannonJekyllBookshop
11
11
  site = context.registers[:site]
12
12
 
13
13
  "<script>
14
- window.addEventListener('load', function() {
15
- if (window.inEditorMode) {
14
+ (function(){
15
+ const bookshopLiveSetup = (CloudCannon) => {
16
+ CloudCannon.enableEvents();
17
+
16
18
  const head = document.querySelector('head');
17
19
  const script = document.createElement('script');
18
20
  script.src = `/#{@script}`;
@@ -20,16 +22,21 @@ window.addEventListener('load', function() {
20
22
  window.bookshopLive = new window.BookshopLive({
21
23
  remoteGlobals: ['/_cloudcannon/bookshop-site-data.json']
22
24
  });
23
- window.CloudCannon = {
24
- trigger: function (eventName, frontMatter) {
25
- if (typeof frontMatter === 'string') frontMatter = JSON.parse(frontMatter);
26
- window.bookshopLive.update({page: frontMatter});
27
- }
25
+ const updateBookshopLive = async () => {
26
+ const frontMatter = await CloudCannon.value();
27
+ const options = window.bookshopLiveOptions || {};
28
+ window.bookshopLive.update({page: frontMatter}, options);
28
29
  }
30
+ document.addEventListener('cloudcannon:update', updateBookshopLive);
31
+ updateBookshopLive();
29
32
  }
30
33
  head.appendChild(script);
31
34
  }
32
- });
35
+
36
+ document.addEventListener('cloudcannon:load', function (e) {
37
+ bookshopLiveSetup(e.detail.CloudCannon);
38
+ });
39
+ })();
33
40
  </script>"
34
41
  end
35
42
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CloudCannonJekyllBookshop
4
- VERSION = "2.0.8"
4
+ VERSION = "2.0.10.pre.editorlinks.2"
5
5
  end
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bookshop/cloudcannon-structures",
3
3
  "packageManager": "yarn@3.0.0",
4
- "version": "2.0.8",
4
+ "version": "2.0.10-editorlinks.2",
5
5
  "description": "Convert a Bookshop object into a CloudCannon structure",
6
6
  "main": "main.js",
7
7
  "scripts": {
@@ -17,7 +17,7 @@
17
17
  "access": "public"
18
18
  },
19
19
  "devDependencies": {
20
- "@bookshop/toml-narrator": "2.0.8",
20
+ "@bookshop/toml-narrator": "2.0.10-editorlinks.2",
21
21
  "@ltd/j-toml": "^1.17.0",
22
22
  "ava": "^3.15.0",
23
23
  "nyc": "^15.1.0",
@@ -7,7 +7,6 @@ module.exports = {
7
7
  const isVariableComment = /^[a-z0-9\-_\.\s]+=.*?#.+?$/i;
8
8
  // [some_section] #: Some comment
9
9
  const isBlockComment = /^\s*?\[.*?#.+?$/i;
10
-
11
10
  const extractComment = /#:([^#]+)$/i;
12
11
  const extractVariable = /^\s*?([a-z0-9\-_\.]+)\s?=/i;
13
12
 
@@ -15,12 +14,10 @@ module.exports = {
15
14
  const [, comment] = extractComment.exec(line) || [];
16
15
  const [, variable_name] = extractVariable.exec(line) || [];
17
16
  if (!comment || !variable_name) return line;
18
-
19
- return `${variable_name}--bookshop_comment = "${comment.trim()}"\n${line}`
17
+ return `${variable_name}--bookshop_comment = "${comment.replace(/"/g, '\"').trim()}"\n${line}`
20
18
  } else if (isBlockComment.test(line)) {
21
19
  const [, comment] = extractComment.exec(line) || [];
22
20
  if (!comment) return line;
23
-
24
21
  return `${line}\n--bookshop_comment = "${comment.trim()}"`
25
22
  } else {
26
23
  return line;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bookshop/toml-narrator",
3
3
  "packageManager": "yarn@3.0.0",
4
- "version": "2.0.8",
4
+ "version": "2.0.10-editorlinks.2",
5
5
  "description": "Rewrite Bookshop TOML files to preserve comments",
6
6
  "main": "main.js",
7
7
  "scripts": {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudcannon-jekyll-bookshop
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.8
4
+ version: 2.0.10.pre.editorlinks.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liam Bigelow
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-12 00:00:00.000000000 Z
11
+ date: 2021-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -175,9 +175,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
175
175
  version: 2.3.0
176
176
  required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ">="
178
+ - - ">"
179
179
  - !ruby/object:Gem::Version
180
- version: '0'
180
+ version: 1.3.1
181
181
  requirements: []
182
182
  rubygems_version: 3.0.3
183
183
  signing_key: