File tree Expand file tree Collapse file tree
app/controllers/ruby_cms/admin Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff 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.
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33module RubyCms
4- VERSION = "0.1.5 "
4+ VERSION = "0.1.6 "
55end
You can’t perform that action at this time.
0 commit comments