bullet_train-fields 1.0.4 → 1.0.7

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: f288c71440c56dac15e8d179ace977238706a1b9c7214a3b8d2d66932b4a9070
4
- data.tar.gz: 71267056d92d39a34c711bfbba666f9d5040ee373215e56be39dcf57d803aecb
3
+ metadata.gz: 7cb1ea56c420a20ce741816c549c2a3065c42cd6ed2a1885862c258530224db9
4
+ data.tar.gz: de265f0e2413c59cd834d08b900d2ad0fa2ceaf82eed04101660a4df8492cea4
5
5
  SHA512:
6
- metadata.gz: f6927ac05772ab8273c8f2457606af5c483db6092a9095de22c3b0e1380fa64e0b036788aeb971345bdadaac73e23bc5b7c3837bf02fb47264bcda108993d753
7
- data.tar.gz: a6665be5e8b939c866c25f5b56a0dee9a50de8835d2c4c81437a9ae178091e9bf4313ba9ccb98053a796bf215e716ebaf5cc2e2ab7a41e265f1d8f130a8d9237
6
+ metadata.gz: 2d7a3a2f146aa2d0af82531edcef465b83531c67560ebff199a8ff66644c64be561a2894e1c88f4743972fdf99369f7a2ed9e5fbd3e872a6cc59891d070e7557
7
+ data.tar.gz: 2016bb83be877b8cd1024c5283bdbea4df3613787bf70a69d48179dd787db9d0a0517bee8819f08e9b22c443d389e0ca6a881ac148afb9c4a8525c402d1cd188
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(body)
16
12
  end
17
13
  end
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module Fields
3
- VERSION = "1.0.4"
3
+ VERSION = "1.0.7"
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.4
4
+ version: 1.0.7
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-04 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
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
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'
55
69
  description: Bullet Train Fields
56
70
  email:
57
71
  - andrew.culver@gmail.com