richer_text 0.13.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93af4f6f1d3dba85682d797cd9433f76b557945ea1fef31859ea482cec66f2f6
4
- data.tar.gz: 2537fb3cf9f2706e946e71385507ea035625416e4e730aefa6eb6ffbf345897c
3
+ metadata.gz: fff049eb5287d1b4033a4cbd8b42b7e1cb8048273e6be55383ec282dc923feb1
4
+ data.tar.gz: 641adc8fdc6fa45dfe9aa0d9efb6971d3ed29d448335518d7069c1e306f8d0a2
5
5
  SHA512:
6
- metadata.gz: a4b553ac51eb39c4c6dc1cd849c5d3034873f0ad4436ba4fccaa7d5565ca55a3cf090207d2571fcd3ced60e9ad1ac4eb3947a12e9d16d53be32b943cf8769115
7
- data.tar.gz: 3fa4670ddee0a16fc2ac12b878b3e222bd95c8b3dd06aef720aae5807c3c5c46fe19e272af0cffe3244c1c03b5c8704168776eec1a47e9fa857f978d440f5841
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
- run "yarn add highlight.js @afomera/richer-text@alpha"
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)
@@ -0,0 +1,15 @@
1
+ module RicherText
2
+ module Nodes
3
+ class IframelyEmbed < ::RicherText::Node
4
+ def href
5
+ @attrs["href"]
6
+ end
7
+
8
+ def html
9
+ "<div class='iframely'>
10
+ #{@attrs["previewHtml"]}
11
+ </div>"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module RicherText
2
- VERSION = "0.13.0"
2
+ VERSION = "0.14.0"
3
3
  end
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
- attr_writer :default_renderer
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.13.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-05-08 00:00:00.000000000 Z
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