bullet_train-fields 1.0.3 → 1.0.6

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: e0c6ee9c8a4d9d7ee7adfcc87115a68917d29759e3718b6038210c5cdfb4b12a
4
- data.tar.gz: b9bf7d09c220452ad6ac89c6367a9299065f56b3b8ff180e95cbd8373e91e7e2
3
+ metadata.gz: 0f63de0bb7a786cd95e769c829420c2a29c10713e5be22dfd157aa53315bd925
4
+ data.tar.gz: fd78ed080007169562c4b28fbf1ff8df578c16b666a92dd8ebe722ae30d050fc
5
5
  SHA512:
6
- metadata.gz: '08a3e7f4402718678a31f0679f6afdd45e2e7fd3dc9b06d9d24e9d77425e30d84b83e6f4cfb22ee050b87a75c8b953f71ef5b12694bd522ff466c4465e4aeb20'
7
- data.tar.gz: 2056cd6c9eccd8b4c77df97bacde3bde1259364893bf93feeaad1c73bb3b3249afac24dd7cee52d805827c7601184eb579f58a245069673dad2a546f2b04d50e
6
+ metadata.gz: 40fd79035d4b8624b924b18279ba58503fc5e0202c7ed6970fbe6bfb5a0016ba9f7793fa22c40e54c74dd8111f277a81383b9cb7aca35970f026cfa58ef11b4e
7
+ data.tar.gz: 77ff3f43a2c03aa461a8ef9ee27a22e1fa390e904ae0ef3de4eb7064c1c9682acc2c8de3538287cd0c65303e51a7f75d1ffb0a07214d94e41ddbc6c68a24d06f
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2022 Andrew Culver
1
+ Copyright 2022 Bullet Train, Inc.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -1,8 +1,16 @@
1
1
  module Fields::HtmlEditorHelper
2
2
  TEMPORARY_REPLACEMENT = "https://temp.bullettrain.co/"
3
+
3
4
  def html_sanitize(string)
4
5
  return string unless string
6
+ # TODO this is a hack to get around the fact that rails doesn't allow us to add any acceptable protocols.
7
+ string = string.gsub("bullettrain://", TEMPORARY_REPLACEMENT)
5
8
  string = sanitize(string, tags: %w[div br strong em b i del a h1 blockquote pre ul ol li], attributes: %w[href])
9
+ # given the limited scope of what we're doing here, this string replace should work.
10
+ # it should also use a lot less memory than nokogiri.
11
+ string = string.gsub(/<a href="#{TEMPORARY_REPLACEMENT}(.*?)\/.*?">(.*?)<\/a>/o, "<span class=\"tribute-reference tribute-\\1-reference\">\\2</span>").html_safe
12
+
13
+ # Also, while we're at it ...
6
14
  links_target_blank(string).html_safe
7
15
  end
8
16
 
@@ -1,17 +1,13 @@
1
1
  module Fields::TrixEditorHelper
2
2
  TEMPORARY_REPLACEMENT = "https://temp.bullettrain.co/"
3
- def trix_sanitize(string)
4
- return string unless string
5
- # TODO this is a hack to get around the fact that rails doesn't allow us to add any acceptable protocols.
6
- string = string.gsub("bullettrain://", TEMPORARY_REPLACEMENT)
7
- string = sanitize(string, tags: %w[div br strong em del a h1 blockquote pre ul ol li], attributes: %w[href])
8
- # given the limited scope of what we're doing here, this string replace should work.
9
- # it should also use a lot less memory than nokogiri.
10
- string = string.gsub(/<a href="#{TEMPORARY_REPLACEMENT}(.*?)\/.*?">(.*?)<\/a>/o, "<span class=\"tribute-reference tribute-\\1-reference\">\\2</span>").html_safe
11
- trix_content(string)
3
+
4
+ # TODO We should migrate away from this, but I think we'll need to update Super Scaffolding.
5
+ def trix_sanitize(html)
6
+ html_sanitize(html)
12
7
  end
13
8
 
9
+ # TODO Confirm there are no references to this anywhere (in other repositories) and remove it.
14
10
  def trix_content(body)
15
- links_target_blank(body).html_safe
11
+ html_sanitize(string)
16
12
  end
17
13
  end
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module Fields
3
- VERSION = "1.0.3"
3
+ VERSION = "1.0.6"
4
4
  end
5
5
  end
@@ -1,6 +1,9 @@
1
1
  require "bullet_train/fields/version"
2
2
  require "bullet_train/fields/engine"
3
3
 
4
+ require "cloudinary"
5
+ require "phonelib"
6
+
4
7
  module BulletTrain
5
8
  module Fields
6
9
  # Your code goes here...
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-fields
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-24 00:00:00.000000000 Z
11
+ date: 2022-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 7.0.0
19
+ version: 6.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 7.0.0
26
+ version: 6.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: cloudinary
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: phonelib
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: chronic
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
27
69
  description: Bullet Train Fields
28
70
  email:
29
71
  - andrew.culver@gmail.com