richer_text 0.2.0 → 0.3.1

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: 8ab9e5f516632d096522a7aa18daaad74e8c6b2eb5736bce0aff526e49a6f5a0
4
- data.tar.gz: 532ff98188ba2b2425188cfcbec7cf80d5563d65339c7a247fdebb41d418247a
3
+ metadata.gz: 59e668e5d18697e8b1c568ac541fc821d1a83538040d3464625c8ac91c53dcb5
4
+ data.tar.gz: 1a20ee315751b8165c4038e1f79183e120d44f7e867221b26a910693cdc004b1
5
5
  SHA512:
6
- metadata.gz: 39981e09d8ce208402c1c66a1541a706af868ad1563d4497b5d919a452256da00308448a6c08a5751f5cebc4b1613c165a2c0ec4d9302a8356a0f33f27f653db
7
- data.tar.gz: 5ea9229f6bfd06ab525ab96b543dc63eed8dcbd34b3419f2dda0fe1058dba8168d881e29871917916ba1b03be7b7d7372da1b233f7c37018528f7c867383d4a6
6
+ metadata.gz: 0dcc392bcfbed5598bfb4f902af9644d6cb75d54f2cffec27bedb6086fc96624b01227f46dfb0df07658fefe92859862ea60f7ae43d69ca34b8ed2a817238ca5
7
+ data.tar.gz: 881eb8e296ef1052e36a8c485d48e8d06ab73657ac98a3693abcaf24566a3111878e598cbf63fcff3fe2b39495fc0ae8eed8d13c66a78277f0f0b498f5a8eafe
@@ -0,0 +1,36 @@
1
+ .richer-text table {
2
+ border-collapse: collapse;
3
+ margin: 0;
4
+ overflow: hidden;
5
+ table-layout: fixed;
6
+ width: 100%;
7
+ }
8
+
9
+ .richer-text table td,
10
+ .richer-text table th {
11
+ border: 2px solid #ced4da;
12
+ box-sizing: border-box;
13
+ min-width: 1em;
14
+ padding: 3px 5px;
15
+ position: relative;
16
+ vertical-align: top;
17
+ }
18
+
19
+ .richer-text table td>*,
20
+ .richer-text table th>* {
21
+ margin-bottom: 0;
22
+ }
23
+
24
+ .richer-text table th {
25
+ background-color: #f1f3f5;
26
+ font-weight: bold;
27
+ text-align: left;
28
+ }
29
+
30
+ .richer-text p {
31
+ margin: 0;
32
+ }
33
+
34
+ .richer-text img {
35
+ width: 100%;
36
+ }
@@ -1,3 +1,3 @@
1
1
  <div class="richer-text">
2
- <%= sanitize(content.to_html, attributes: %w(id class style data-color)) %>
2
+ <%= sanitize(content.to_html, tags: %w(div img h1 h2 blockquote s del strong i em br pre code ol ul li table tbody th td tr p), attributes: %w(id class style data-color src alt colspan rowspan)) %>
3
3
  </div>
@@ -14,6 +14,11 @@ module RicherText
14
14
  "app/views/richer_text/contents/_content.html.erb",
15
15
  "app/views/richer_text/contents/_content.html.erb"
16
16
  )
17
+
18
+ copy_file(
19
+ "app/assets/stylesheets/richer_text/richer-text.css",
20
+ "app/assets/stylesheets/richer-text.css"
21
+ )
17
22
  end
18
23
 
19
24
  def install_javascript_dependencies
@@ -33,7 +38,10 @@ module RicherText
33
38
 
34
39
  if destination.join("app/assets/stylesheets/application.tailwind.css").exist?
35
40
  say "Adding import to application.tailwind.css", :green
36
- prepend_to_file "app/assets/stylesheets/application.tailwind.css", %(@import "@afomera/richer-text/dist/css/richer-text.css";\n@import "highlight.js/styles/github-dark.css";\n)
41
+ prepend_to_file "app/assets/stylesheets/application.tailwind.css", %(@import "@afomera/richer-text/dist/css/richer-text.css";\n@import "highlight.js/styles/github-dark.css";\n@import "richer-text.css";\n)
42
+ elsif (stylesheets = Dir.glob "#{destination_root}/app/assets/stylesheets/application.*.{scss}").length > 0
43
+ say "Adding import to #{stylesheets.first}", :green
44
+ prepend_to_file stylesheets.first, %(@import "@afomera/richer-text/dist/css/richer-text";\n@import "highlight.js/styles/github-dark";\n@import "richer-text";\n)
37
45
  end
38
46
  end
39
47
 
@@ -1,5 +1,4 @@
1
1
  require "rails"
2
- require "nokogiri"
3
2
 
4
3
  module RicherText
5
4
  class Engine < ::Rails::Engine
@@ -12,8 +11,8 @@ module RicherText
12
11
  end
13
12
 
14
13
  initializer "richer_text.helper" do
15
- ActiveSupport.on_load(:action_controller_base) do
16
- helper RicherText::Engine.helpers
14
+ ActiveSupport.on_load(:action_controller) do
15
+ helper RicherText::TagHelper
17
16
  end
18
17
  end
19
18
  end
@@ -1,3 +1,3 @@
1
1
  module RicherText
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/lib/richer_text.rb CHANGED
@@ -12,4 +12,5 @@ module RicherText
12
12
  autoload :Rendering
13
13
  autoload :Fragment
14
14
  autoload :Serialization
15
+ autoload :TagHelper
15
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: richer_text
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrea Fomera
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-29 00:00:00.000000000 Z
11
+ date: 2023-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -36,6 +36,7 @@ files:
36
36
  - Rakefile
37
37
  - app/assets/config/richer_text_manifest.js
38
38
  - app/assets/stylesheets/richer_text/application.css
39
+ - app/assets/stylesheets/richer_text/richer-text.css
39
40
  - app/controllers/richer_text/application_controller.rb
40
41
  - app/helpers/richer_text/application_helper.rb
41
42
  - app/helpers/richer_text/tag_helper.rb