richer_text 0.12.0 → 0.13.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: e5520f0457b69a555273d7a738f5257a0951eef4d65153ad783cd2f31246daad
4
- data.tar.gz: d4978b9880b46a6af9a91868cdbf40ae8306d3dd749c6ec94631e6999820af89
3
+ metadata.gz: 93af4f6f1d3dba85682d797cd9433f76b557945ea1fef31859ea482cec66f2f6
4
+ data.tar.gz: 2537fb3cf9f2706e946e71385507ea035625416e4e730aefa6eb6ffbf345897c
5
5
  SHA512:
6
- metadata.gz: faca362e8db800731ec19ade535551664f5bcc2f379e80283229f536a8b06608a6601d50c4672e02394c650f178ec5697244e14adfca4f0a701ec4bba1ca4846
7
- data.tar.gz: 4662002c357fee3d91db0b96236c2d314c0551ecbc916a41f6e1c3dea63a5a5d30ab3208045160936b312500a72295d26aed2b59b2c487855431c69f5bf5da6a
6
+ metadata.gz: a4b553ac51eb39c4c6dc1cd849c5d3034873f0ad4436ba4fccaa7d5565ca55a3cf090207d2571fcd3ced60e9ad1ac4eb3947a12e9d16d53be32b943cf8769115
7
+ data.tar.gz: 3fa4670ddee0a16fc2ac12b878b3e222bd95c8b3dd06aef720aae5807c3c5c46fe19e272af0cffe3244c1c03b5c8704168776eec1a47e9fa857f978d440f5841
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  RicherText aims to provide a richer text editing experience than what comes out of the box with ActionText in Rails. **It is however a seperate thing from ActionText** and is **not** backwards compatible.
4
4
 
5
- RicherText uses React and TipTap under the hood to create an editor, this does mean that you'll have react and react-dom in your project, but you absolutely don't need to use it outside of the RicherText editor. Additionally there's currently a hard requirement for ActiveStorage as well.
5
+ RicherText uses Lit and TipTap under the hood to create an editor. Additionally there's currently a hard requirement for ActiveStorage as well.
6
6
 
7
7
  ## Installation
8
8
 
@@ -50,10 +50,12 @@ Take a Post model where you'd like to add RicherText to write, and edit the body
50
50
 
51
51
  ```ruby
52
52
  class Post < ApplicationRecord
53
- has_richer_text :body
53
+ has_richer_text :body, store_as: :json
54
54
  end
55
55
  ```
56
56
 
57
+ We recommend storing your Richer Text records as JSON for full compatibility with the TipTap schema under the hood.
58
+
57
59
  **Add the form helper to the form**
58
60
 
59
61
  Inside of your form partial:
@@ -83,3 +85,25 @@ Contribution directions go here.
83
85
  ## License
84
86
 
85
87
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
88
+
89
+ Portions of the code related to the `has_richer_text` attribute, and parsing of the HTML content for the RicherText::RichText model are licensed under the Rails source code license, as it falls under the substantial portion of Software:
90
+
91
+ Copyright (c) 37signals LLC
92
+
93
+ Permission is hereby granted, free of charge, to any person obtaining a copy
94
+ of this software and associated documentation files (the "Software"), to deal
95
+ in the Software without restriction, including without limitation the rights
96
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
97
+ copies of the Software, and to permit persons to whom the Software is
98
+ furnished to do so, subject to the following conditions:
99
+
100
+ The above copyright notice and this permission notice shall be included in all
101
+ copies or substantial portions of the Software.
102
+
103
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
104
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
105
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
106
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
107
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
108
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
109
+ SOFTWARE.
@@ -4,7 +4,7 @@ module RicherText
4
4
 
5
5
  belongs_to :record, polymorphic: true, touch: true
6
6
 
7
- serialize :body, JSON, default: DEFAULT_BODY.to_json
7
+ serialize :body, coder: JSON, default: DEFAULT_BODY.to_json
8
8
 
9
9
  has_many_attached :images
10
10
  has_many_attached :rhino_attachments # For handling attachments in the Rhino Editor
@@ -26,7 +26,7 @@ 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 react react-dom highlight.js @afomera/richer-text"
29
+ run "yarn add highlight.js @afomera/richer-text@alpha"
30
30
  end
31
31
 
32
32
  say "Adding import to application.js", :green
@@ -127,6 +127,8 @@ module RicherText
127
127
  attrs.merge(style: "background-color: #{attrs["color"]};")
128
128
  elsif attrs.dig("color").present? && tag == "span"
129
129
  attrs.merge(style: "color: #{attrs["color"]};")
130
+ elsif attrs.dig("fontSize").present? && tag == "span"
131
+ attrs.merge(style: "font-size: #{attrs["fontSize"]};")
130
132
  else
131
133
  attrs
132
134
  end
@@ -0,0 +1,4 @@
1
+ module RicherText
2
+ module TagHelper
3
+ end
4
+ end
@@ -1,3 +1,3 @@
1
1
  module RicherText
2
- VERSION = "0.12.0"
2
+ VERSION = "0.13.0"
3
3
  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.12.0
4
+ version: 0.13.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-10-03 00:00:00.000000000 Z
11
+ date: 2024-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -102,6 +102,7 @@ files:
102
102
  - lib/richer_text/nodes/text.rb
103
103
  - lib/richer_text/rendering.rb
104
104
  - lib/richer_text/serialization.rb
105
+ - lib/richer_text/tag_helper.rb
105
106
  - lib/richer_text/version.rb
106
107
  - lib/tasks/richer_text_tasks.rake
107
108
  homepage: https://github.com/afomera/richer_text
@@ -124,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
125
  - !ruby/object:Gem::Version
125
126
  version: '0'
126
127
  requirements: []
127
- rubygems_version: 3.4.10
128
+ rubygems_version: 3.5.3
128
129
  signing_key:
129
130
  specification_version: 4
130
131
  summary: A richer text editor for Rails