richer_text 0.3.0 → 0.4.0
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 +4 -4
- data/app/assets/stylesheets/richer_text/richer-text.css +4 -0
- data/app/helpers/richer_text/tag_helper.rb +10 -10
- data/app/views/richer_text/contents/_content.html.erb +1 -1
- data/lib/generators/richer_text/install/install_generator.rb +0 -8
- data/lib/richer_text/engine.rb +2 -3
- data/lib/richer_text/version.rb +1 -1
- data/lib/richer_text.rb +1 -0
- metadata +2 -3
- data/app/javascript/controllers/richer_text_editor_controller.js +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e556adef8ae4899aaf040aeb3c66ec608b3626530f8b8df100d454dcfa00787
|
4
|
+
data.tar.gz: '0353060393bf4d90744ec357f3791681d8484b0ee4d096086032018b8cfac6bb'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ba88bc3470365608710e8f764945e631cae368437e4524c2bc591ca04b128e6fc0ef5f343076c5983608e37299b2fffb306539a46f9c4359db4f716f0225029
|
7
|
+
data.tar.gz: 6b77c7fdb84a7310ceb48e7f98205ec58e8b2089970249e7f610647708716fcb65ae19ae1471d731f34673670211226a9bad510f4b03241cf9f1d8eb1b6d6338
|
@@ -4,12 +4,15 @@ module ActionView::Helpers
|
|
4
4
|
class Tags::Editor < Tags::Base
|
5
5
|
include Tags::Placeholderable
|
6
6
|
|
7
|
+
delegate :dom_id, to: ActionView::RecordIdentifier
|
8
|
+
|
7
9
|
def render
|
8
10
|
options = @options.stringify_keys
|
9
|
-
options["value"] = options.fetch("value") { value&.to_html }
|
10
11
|
add_default_name_and_id(options)
|
12
|
+
options["input"] ||= dom_id(object, [options["id"], :richer_text_input].compact.join("_")) if object
|
13
|
+
options["value"] = options.fetch("value") { value&.to_html }
|
11
14
|
|
12
|
-
@template_object.richer_text_area_tag(options
|
15
|
+
@template_object.richer_text_area_tag(options.delete("name"), options["value"], options.except("value"))
|
13
16
|
end
|
14
17
|
end
|
15
18
|
|
@@ -26,24 +29,21 @@ module ActionView::Helpers
|
|
26
29
|
end
|
27
30
|
end
|
28
31
|
|
29
|
-
|
30
32
|
module RicherText
|
31
33
|
module TagHelper
|
32
34
|
cattr_accessor(:id, instance_accessor: false) { 0 }
|
33
35
|
|
34
36
|
def richer_text_area_tag(name, value = nil, options = {})
|
35
37
|
options = options.symbolize_keys
|
36
|
-
options[:
|
37
|
-
options[:class] ||= "editor-input"
|
38
|
+
options[:input] ||= "richer_text_input_#{RicherText::TagHelper.id += 1}"
|
38
39
|
|
39
40
|
# So that we can access the content in the tiptap editor
|
40
41
|
options[:content] ||= value
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
43
|
+
input_tag = hidden_field_tag(name, value, id: options[:input])
|
44
|
+
editor_tag = tag("richer-text-editor", options)
|
45
|
+
|
46
|
+
input_tag + editor_tag
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -1,3 +1,3 @@
|
|
1
1
|
<div class="richer-text">
|
2
|
-
<%= sanitize(content.to_html, tags: %w(div 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 colspan rowspan)) %>
|
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>
|
@@ -44,14 +44,6 @@ module RicherText
|
|
44
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)
|
45
45
|
end
|
46
46
|
end
|
47
|
-
|
48
|
-
def generate_stimulus_controller
|
49
|
-
say "Copying Stimulus controller", :green
|
50
|
-
copy_file "app/javascript/controllers/richer_text_editor_controller.js", "app/javascript/controllers/richer_text_editor_controller.js"
|
51
|
-
|
52
|
-
say "Updating Stimulus manifest", :green
|
53
|
-
rails_command "stimulus:manifest:update"
|
54
|
-
end
|
55
47
|
end
|
56
48
|
end
|
57
49
|
end
|
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.4.0
|
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-08-
|
11
|
+
date: 2023-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -40,7 +40,6 @@ files:
|
|
40
40
|
- app/controllers/richer_text/application_controller.rb
|
41
41
|
- app/helpers/richer_text/application_helper.rb
|
42
42
|
- app/helpers/richer_text/tag_helper.rb
|
43
|
-
- app/javascript/controllers/richer_text_editor_controller.js
|
44
43
|
- app/jobs/richer_text/application_job.rb
|
45
44
|
- app/mailers/richer_text/application_mailer.rb
|
46
45
|
- app/models/richer_text/application_record.rb
|