richer_text 0.13.0 → 0.14.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/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: fff049eb5287d1b4033a4cbd8b42b7e1cb8048273e6be55383ec282dc923feb1
|
4
|
+
data.tar.gz: 641adc8fdc6fa45dfe9aa0d9efb6971d3ed29d448335518d7069c1e306f8d0a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6735d25685c7efc9dfc22e709edd2c6f32b443d9c0f82d93d6697ead4467ee5e2946330be133d3693b589954fe65ef4242b86885b2c080fb370ec6d0f8cc9b96
|
7
|
+
data.tar.gz: 29319df08e89a28d230ff7b45f7d2c4bad11aae0b8927940c15827b2d6fa3ad4970af53ad908415d519c3697c07393d863cfa8c03b446ded0e42ccd08c394964
|
@@ -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@alpha" if destination.join("package-lock.json").exist?
|
31
|
+
run "bun add highlight.js @afomera/richer-text@alpha" if destination.join("bun.lockb").exist?
|
32
|
+
run "yarn add highlight.js @afomera/richer-text@alpha" if destination.join("yarn.lock").exist?
|
33
|
+
run "pnpm add highlight.js @afomera/richer-text@alpha" 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.14.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-03 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
|