richer_text 0.13.0 → 0.15.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 +1 -1
- data/app/models/richer_text/rich_text.rb +1 -1
- data/lib/generators/richer_text/install/install_generator.rb +5 -1
- data/lib/richer_text/html_visitor.rb +4 -0
- data/lib/richer_text/nodes/iframely_embed.rb +15 -0
- data/lib/richer_text/version.rb +1 -1
- data/lib/richer_text.rb +6 -1
- 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: d703c776c9c1eea2bddf68c2684bf642a5e788e24e67c2da86ab174a36375fd4
|
4
|
+
data.tar.gz: 356b5961abe5334a0f1acfad1ed436e15021c9883bec94076a2658a46c8a7e14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3229812766e24565f0cfd8f384f5bf1e62b5bfa4f4d6ff1e912223d475b67556bf54c6b6fb731cb1cbc7778a7c0bae5f86a54df8316d67bd0169e8ef8e1bb545
|
7
|
+
data.tar.gz: 7aa2fa96a14b331270ed16ded0c5edf3b540d728664eb7465faeb2a694c52ff2dbdad0b1cf34d9ef21155d40e0b169be804a0887e893387d04758ab3ed48286f
|
@@ -59,7 +59,7 @@ module RicherText
|
|
59
59
|
cattr_accessor(:id, instance_accessor: false) { 0 }
|
60
60
|
|
61
61
|
def richer_text_area_tag(name, value = nil, options = {})
|
62
|
-
options = options.symbolize_keys
|
62
|
+
options = RicherText.default_form_options.merge(options.symbolize_keys).symbolize_keys
|
63
63
|
options[:input] ||= "richer_text_input_#{RicherText::TagHelper.id += 1}"
|
64
64
|
|
65
65
|
# So that we can access the content in the tiptap editor
|
@@ -2,7 +2,7 @@ module RicherText
|
|
2
2
|
class RichText < ApplicationRecord
|
3
3
|
belongs_to :record, polymorphic: true, touch: true
|
4
4
|
|
5
|
-
serialize :body, RicherText::Content
|
5
|
+
serialize :body, coder: RicherText::Content
|
6
6
|
|
7
7
|
delegate :to_s, :nil?, to: :body
|
8
8
|
delegate :blank?, :empty?, :present?, to: :to_html
|
@@ -26,7 +26,11 @@ module RicherText
|
|
26
26
|
|
27
27
|
if destination.join("package.json").exist?
|
28
28
|
say "Adding dependencies to package.json", :green
|
29
|
-
|
29
|
+
|
30
|
+
run "npm install highlight.js @afomera/richer-text@beta" if destination.join("package-lock.json").exist?
|
31
|
+
run "bun add highlight.js @afomera/richer-text@beta" if destination.join("bun.lockb").exist?
|
32
|
+
run "yarn add highlight.js @afomera/richer-text@beta" if destination.join("yarn.lock").exist?
|
33
|
+
run "pnpm add highlight.js @afomera/richer-text@beta" if destination.join("pnpm-lock.yaml").exist?
|
30
34
|
end
|
31
35
|
|
32
36
|
say "Adding import to application.js", :green
|
@@ -42,6 +42,10 @@ module RicherText
|
|
42
42
|
"<div class='richer-text'>#{visit_children(node).join("\n")}</div>".html_safe
|
43
43
|
end
|
44
44
|
|
45
|
+
def visit_iframely_embed(node)
|
46
|
+
node.html
|
47
|
+
end
|
48
|
+
|
45
49
|
def visit_mention(node, marks)
|
46
50
|
if marks.any?
|
47
51
|
content_tag(marks[0].tag, visit_mention(node, marks[1..]), marks[0].attrs)
|
data/lib/richer_text/version.rb
CHANGED
data/lib/richer_text.rb
CHANGED
@@ -34,6 +34,7 @@ module RicherText
|
|
34
34
|
autoload :HardBreak
|
35
35
|
autoload :Heading
|
36
36
|
autoload :HorizontalRule
|
37
|
+
autoload :IframelyEmbed
|
37
38
|
autoload :Image
|
38
39
|
autoload :ListItem
|
39
40
|
autoload :Mention
|
@@ -52,6 +53,10 @@ module RicherText
|
|
52
53
|
@default_renderer ||= RicherText::HTMLVisitor.new
|
53
54
|
end
|
54
55
|
|
55
|
-
|
56
|
+
def default_form_options
|
57
|
+
@default_form_options ||= {}
|
58
|
+
end
|
59
|
+
|
60
|
+
attr_writer :default_renderer, :default_form_options
|
56
61
|
end
|
57
62
|
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.
|
4
|
+
version: 0.15.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: 2024-
|
11
|
+
date: 2024-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- lib/richer_text/nodes/hard_break.rb
|
90
90
|
- lib/richer_text/nodes/heading.rb
|
91
91
|
- lib/richer_text/nodes/horizontal_rule.rb
|
92
|
+
- lib/richer_text/nodes/iframely_embed.rb
|
92
93
|
- lib/richer_text/nodes/image.rb
|
93
94
|
- lib/richer_text/nodes/list_item.rb
|
94
95
|
- lib/richer_text/nodes/mention.rb
|