每次用户编辑文本区域条目时,Ckeditor ruby gem 在条目末尾添加“>”
Ckeditor ruby gem adds ">" at the end of the entries every time a user edits the textarea entry
Ckeditor ruby gem 每次用户编辑内容时都会在我的内容条目末尾添加一个“>”。
这是它发生的视频:https://drive.google.com/file/d/16sus8LGxHBZLFs_ts5_SJJSwLfisJzom/view?usp=sharing
这是我的 update_row 控制器代码 text_component 模型。文本区域输入被保存在内容列中。
定义 update_row
@text_component = TextComponent.find(params.fetch("id_to_modify"))
@text_component.tab_id = params.fetch("tab_id")
@text_component.content = params.fetch("content")
if @text_component.valid?
@text_component.save
redirect_to("/guides/"+params.fetch("guide_id"), :notice => "Text component updated successfully.")
else
@guide = Guide.find(params.fetch("guide_id"))
render("guide_templates/show.html.erb")
end
end
已回答:这是我的 edit_form 视图中的工作表单代码:
<form action="/update_text_component/<%= @text_component.id %>" method="post">
<!--input for guide_id -->
<div class="form-group">
<input type="hidden" id="guide_id" name="guide_id" class="form-control" value="<%= params.fetch("guide_id") %>">
</div>
<!-- input for tab_id -->
<div class="form-group">
<input type="hidden" id="tab_id" name="tab_id" class="form-control" value="<%= params.fetch("tab_id") %>">
</div>
<div class="form-group">
<label for="content">
Content
</label>
<textarea id="content" name="content" class="ckeditor" rows="10"><%= raw @text_component.content %></textarea>
</div>
<button class="btn btn-block btn-outline-secondary">
Update text component
</button>
</form>
<form action="/update_text_component/<%= @text_component.id %>" method="post">
<!--input for guide_id -->
<div class="form-group">
<input type="hidden" id="guide_id" name="guide_id" class="form-control" value="<%= params.fetch("guide_id") %>">
</div>
<!-- input for tab_id -->
<div class="form-group">
<input type="hidden" id="tab_id" name="tab_id" class="form-control" value="<%= params.fetch("tab_id") %>">
</div>
<div class="form-group">
<label for="content">
Content
</label>
<textarea id="content" name="content" class="ckeditor" rows="10"><%= raw @text_component.content %></textarea>
</div>
<button class="btn btn-block btn-outline-secondary">
Update text component
</button>
</form>
Ckeditor ruby gem 每次用户编辑内容时都会在我的内容条目末尾添加一个“>”。 这是它发生的视频:https://drive.google.com/file/d/16sus8LGxHBZLFs_ts5_SJJSwLfisJzom/view?usp=sharing
这是我的 update_row 控制器代码 text_component 模型。文本区域输入被保存在内容列中。
定义 update_row
@text_component = TextComponent.find(params.fetch("id_to_modify"))
@text_component.tab_id = params.fetch("tab_id")
@text_component.content = params.fetch("content")
if @text_component.valid?
@text_component.save
redirect_to("/guides/"+params.fetch("guide_id"), :notice => "Text component updated successfully.")
else
@guide = Guide.find(params.fetch("guide_id"))
render("guide_templates/show.html.erb")
end
end
已回答:这是我的 edit_form 视图中的工作表单代码:
<form action="/update_text_component/<%= @text_component.id %>" method="post">
<!--input for guide_id -->
<div class="form-group">
<input type="hidden" id="guide_id" name="guide_id" class="form-control" value="<%= params.fetch("guide_id") %>">
</div>
<!-- input for tab_id -->
<div class="form-group">
<input type="hidden" id="tab_id" name="tab_id" class="form-control" value="<%= params.fetch("tab_id") %>">
</div>
<div class="form-group">
<label for="content">
Content
</label>
<textarea id="content" name="content" class="ckeditor" rows="10"><%= raw @text_component.content %></textarea>
</div>
<button class="btn btn-block btn-outline-secondary">
Update text component
</button>
</form>
<form action="/update_text_component/<%= @text_component.id %>" method="post">
<!--input for guide_id -->
<div class="form-group">
<input type="hidden" id="guide_id" name="guide_id" class="form-control" value="<%= params.fetch("guide_id") %>">
</div>
<!-- input for tab_id -->
<div class="form-group">
<input type="hidden" id="tab_id" name="tab_id" class="form-control" value="<%= params.fetch("tab_id") %>">
</div>
<div class="form-group">
<label for="content">
Content
</label>
<textarea id="content" name="content" class="ckeditor" rows="10"><%= raw @text_component.content %></textarea>
</div>
<button class="btn btn-block btn-outline-secondary">
Update text component
</button>
</form>