ruby_cms 0.1.5 → 0.1.6

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: 4fa21941a1f42d8be087400c5bc0afd982436dbf6a474622615db9f12428c0e5
4
- data.tar.gz: d62db03474980981273e2127cd783c9566bc34a4e6ee484c38e29fefe1dfc341
3
+ metadata.gz: 83d1d3f4aadd9f1f8ad953f3babc9fbb104c2238ba411d0d24bf97bba3574684
4
+ data.tar.gz: 8bef2b9e212a3da28f8af8f387c648c57a5e76a1a50a29b757e49a54b2fe0e62
5
5
  SHA512:
6
- metadata.gz: 26706bfada49a696a98d091dd80659cbcada261d77374c76ec52c32fec421492f1f153cfbfcdc90007c61dd3d9be330e804c4a55ea3c9026d10eeec63cbc079c
7
- data.tar.gz: 8b736ae9123c71f27c2a3f4d9b880d00702129dd23db0755432633582411672b0e4c50543e4afb371a57bf7eba0fc0cf06925ea294542c265887628b45f73e67
6
+ metadata.gz: 957a2871489bcdc0680f029b43dc7696ec3109bfff994227771c9ff29cf069f529e9d9c99fed37ca1e31eb13acc049dfe2d9c72fb2617f2ac9d755e2928accf0
7
+ data.tar.gz: 800a6f5e760a8d5a5a99e86d5e9d6f9ad2015664c79c2068178f10d5b6c1b59d7d88a5d40230c33577d9d44d950e9a86cfd9f124ebbd166d13a2e06eada03754
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.0.6] - 2026-03-23
4
+
5
+ - Fix visual editor content block bug
6
+
3
7
  ## [0.1.5] - 2026-03-23
4
8
 
5
9
  - Fix image bug
@@ -135,12 +135,22 @@ module RubyCms
135
135
 
136
136
  def assign_content_block_content(block)
137
137
  if rich_text_content?
138
- block.rich_content = params[:rich_content]
138
+ assign_rich_text_content(block)
139
139
  elsif params[:content].present?
140
140
  block.content = params[:content]
141
141
  end
142
142
  end
143
143
 
144
+ def assign_rich_text_content(block)
145
+ rich_content = params[:rich_content].to_s
146
+
147
+ if block.respond_to?(:rich_content=)
148
+ block.rich_content = rich_content
149
+ else
150
+ block.content = ActionController::Base.helpers.strip_tags(rich_content)
151
+ end
152
+ end
153
+
144
154
  def rich_text_content?
145
155
  params[:content_type] == "rich_text" && params[:rich_content].present?
146
156
  end
@@ -158,7 +168,11 @@ module RubyCms
158
168
  end
159
169
 
160
170
  def content_block_content_text(block)
161
- block.content_type == "rich_text" ? block.rich_content.to_plain_text : block.content
171
+ return block.content unless block.content_type == "rich_text"
172
+ return block.content unless block.respond_to?(:rich_content)
173
+ return block.content unless block.rich_content.respond_to?(:to_plain_text)
174
+
175
+ block.rich_content.to_plain_text
162
176
  end
163
177
 
164
178
  # Return body HTML only (no layout/comments) so preview and Trix get clean HTML.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyCms
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Codebyjob