bullet_train-fields 1.0.5 → 1.0.6

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: fc400167a3654881eab0140f0e4c256928f8c46cda2398897e4883d7c778d89b
4
- data.tar.gz: 80b95fd1af091b146684217ae697882163c61609c885b20105b2967b73abbbab
3
+ metadata.gz: 0f63de0bb7a786cd95e769c829420c2a29c10713e5be22dfd157aa53315bd925
4
+ data.tar.gz: fd78ed080007169562c4b28fbf1ff8df578c16b666a92dd8ebe722ae30d050fc
5
5
  SHA512:
6
- metadata.gz: 0164f78c54a1db1aba3d120460b26ea718c7c67dd8f8d20a4c217322b64cf1e60f32eb9a6860a3e10b1e23e0bca385b6c63cb5dfe9a7ed62cd99e2d575ba46f3
7
- data.tar.gz: 5e313ecb25347839dfbe835c883cfa86f00ef665cada93a1b73c32471fe7160aaa8b310129508e1ff028b9d068ddf8a903e1ed4eccf1f63b6f6fa7d2861ef2ef
6
+ metadata.gz: 40fd79035d4b8624b924b18279ba58503fc5e0202c7ed6970fbe6bfb5a0016ba9f7793fa22c40e54c74dd8111f277a81383b9cb7aca35970f026cfa58ef11b4e
7
+ data.tar.gz: 77ff3f43a2c03aa461a8ef9ee27a22e1fa390e904ae0ef3de4eb7064c1c9682acc2c8de3538287cd0c65303e51a7f75d1ffb0a07214d94e41ddbc6c68a24d06f
@@ -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.5"
3
+ VERSION = "1.0.6"
4
4
  end
5
5
  end
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.5
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-03-29 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