richer_text 0.2.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/richer_text/richer-text.css +36 -0
- data/app/views/richer_text/contents/_content.html.erb +1 -1
- data/lib/generators/richer_text/install/install_generator.rb +9 -1
- data/lib/richer_text/engine.rb +2 -3
- data/lib/richer_text/version.rb +1 -1
- data/lib/richer_text.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59e668e5d18697e8b1c568ac541fc821d1a83538040d3464625c8ac91c53dcb5
|
4
|
+
data.tar.gz: 1a20ee315751b8165c4038e1f79183e120d44f7e867221b26a910693cdc004b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/richer_text/engine.rb
CHANGED
@@ -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(:
|
16
|
-
helper RicherText::
|
14
|
+
ActiveSupport.on_load(:action_controller) do
|
15
|
+
helper RicherText::TagHelper
|
17
16
|
end
|
18
17
|
end
|
19
18
|
end
|
data/lib/richer_text/version.rb
CHANGED
data/lib/richer_text.rb
CHANGED
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.
|
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-
|
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
|