richer_text 0.18.0 → 0.20.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e980db9b17d908bf7d262b4c161eb9f1157fc42ee8fb8c77f48ea5badd79d0e
4
- data.tar.gz: 39cb48282c6a278bd0e007669e7dcb55202a116e791e67679d222f0e5296d451
3
+ metadata.gz: 678e1169424b3442c3a1930a2ab34e4e7ec724e2a2e8381bfdd7f8b789bb1eff
4
+ data.tar.gz: 5dfd1574889342d9308fbbe79c5959bdc86eb816ae8d82f466ed6140f8ab3dc1
5
5
  SHA512:
6
- metadata.gz: 59a47127efcfec99b846b47ad40bf78b72b5a4149fc29b55085ddfcbad99543ef6d1b566fb5db0941e74081bf403b0f3a8d5c205f7def5888145570aa01d9a26
7
- data.tar.gz: 761aa4710136531f6e05f63c7214f753a710375c790e0b4e715d3c6f54dbbb521f2082dcf730008d44fce29e3b75f61fe9e8662f101b0dff0b3fe97400a5a779
6
+ metadata.gz: 59ca2d890918fb81e3d4ee4619c2ce1c5e41ea97736f90cf0bec50ab2eb10a2e007cdd2a466e5bdfe8ad0bb522252fa00165984bc8fcc729489eededf47c884d
7
+ data.tar.gz: 7fcb45cebc874bbe5437a695688677d6d4eb90493e18021b46e776453c105722946e14aa0845f33bd050bf1cfed64ca67063dd381044924d0c4b71b6d8552306
@@ -12,6 +12,7 @@ module ActionView::Helpers
12
12
  options["input"] ||= dom_id(object, [options["id"], :richer_text_input].compact.join("_")) if object
13
13
  options["value"] = options.fetch("value") { value&.to_editor_format }
14
14
  options["serializer"] = options.fetch("serializer") { object.class.send(:"richer_text_#{@method_name}_json") ? "json" : "html" }
15
+ options["attachments"] = options.fetch("attachments") { object.class.send(:"richer_text_#{@method_name}_allow_attachments") }
15
16
 
16
17
  @template_object.richer_text_area_tag(options.delete("name"), options["value"], options.except("value"))
17
18
  end
@@ -3,11 +3,15 @@ module RicherText
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  class_methods do
6
- def has_richer_text(name, store_as: :html)
6
+ def has_richer_text(name, store_as: :html, attachments: true)
7
7
  # Store if the attribute is using JSON or not.
8
8
  class_attribute :"richer_text_#{name}_json", instance_writer: false
9
9
  self.send(:"richer_text_#{name}_json=", store_as == :json)
10
10
 
11
+ # Store if the attribute allows attachments
12
+ class_attribute :"richer_text_#{name}_allow_attachments", instance_writer: false
13
+ self.send(:"richer_text_#{name}_allow_attachments=", attachments)
14
+
11
15
  class_eval <<-CODE, __FILE__, __LINE__ + 1
12
16
  def #{name}
13
17
  richer_text_#{name} || build_richer_text_#{name}
@@ -35,7 +35,7 @@ module RicherText
35
35
  end
36
36
 
37
37
  def visit_code_block(node)
38
- "<pre><code>#{visit_children(node).join("\n")}</code></pre>"
38
+ "<pre><code>#{ERB::Util.html_escape(visit_children(node).join("\n"))}</code></pre>"
39
39
  end
40
40
 
41
41
  def visit_doc(node)
@@ -1,3 +1,3 @@
1
1
  module RicherText
2
- VERSION = "0.18.0"
2
+ VERSION = "0.20.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: richer_text
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrea Fomera
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-28 00:00:00.000000000 Z
10
+ date: 2025-02-16 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rails
@@ -38,7 +37,6 @@ dependencies:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
39
  version: '0'
41
- description:
42
40
  email:
43
41
  - afomera@hey.com
44
42
  executables: []
@@ -112,7 +110,6 @@ licenses:
112
110
  - MIT
113
111
  metadata:
114
112
  homepage_uri: https://github.com/afomera/richer_text
115
- post_install_message:
116
113
  rdoc_options: []
117
114
  require_paths:
118
115
  - lib
@@ -127,8 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
124
  - !ruby/object:Gem::Version
128
125
  version: '0'
129
126
  requirements: []
130
- rubygems_version: 3.5.16
131
- signing_key:
127
+ rubygems_version: 3.6.2
132
128
  specification_version: 4
133
129
  summary: A richer text editor for Rails
134
130
  test_files: []