richer_text 0.3.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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/version.rb +1 -1
- 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: bc9681628df0cea14882f90ddc28774653a87d2d7db1ef38049bcbc3e67ddb49
|
4
|
+
data.tar.gz: e99f8e2774aede03570dd03ec2f995f6b3e8ab46a9c7f4eedcdd7527fde69995
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93038afde3fae59acedbdd62d1879cdb7825e2d134d8aa520ae620a66619de0b32a594e5f34114e7dac66566f66523150d689a39500968076317313f15f00267
|
7
|
+
data.tar.gz: 176ea00a46823251b32ddcb0cd8e9a59eb00eb6f452a2c7c98b43a797bf95e683f4d6df99452ad903ef5c5d6bc2fadf3ff9174f19a31476d07a44455d00b4dd0
|
@@ -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 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)) %>
|
2
|
+
<%= sanitize(content.to_html, tags: %w(a 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 href 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/version.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.5.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-
|
11
|
+
date: 2023-09-02 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
|