Skip to content

Commit 2a0c3f8

Browse files
author
Job Hammer
committed
Updates
1 parent 0ff954f commit 2a0c3f8

4 files changed

Lines changed: 21 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## [Unreleased]
22

3+
## [0.1.0.6] - 2026-03-23
4+
5+
- Fix visual editor content block bug
6+
37
## [0.1.5] - 2026-03-23
48

59
- Fix image bug

app/controllers/ruby_cms/admin/visual_editor_controller.rb

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,22 @@ def update_content_block_attributes(block)
135135

136136
def assign_content_block_content(block)
137137
if rich_text_content?
138-
block.rich_content = params[:rich_content]
138+
assign_rich_text_content(block)
139139
elsif params[:content].present?
140140
block.content = params[:content]
141141
end
142142
end
143143

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+
144154
def rich_text_content?
145155
params[:content_type] == "rich_text" && params[:rich_content].present?
146156
end
@@ -158,7 +168,11 @@ def success_response(block)
158168
end
159169

160170
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
162176
end
163177

164178
# Return body HTML only (no layout/comments) so preview and Trix get clean HTML.

lib/ruby_cms/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module RubyCms
4-
VERSION = "0.1.5"
4+
VERSION = "0.1.6"
55
end

ruby_cms-0.1.6.gem

646 KB
Binary file not shown.

0 commit comments

Comments
 (0)