doucuyu2259 2019-08-08 20:32
浏览 218

如果文本区域(Summernote)具有复制/粘贴文本,则不会返回输入的值

I have a CodeIgniter view that uses the Summernote

<div class="col-lg-12 col-sm-12 col-xs-12">
  <label for="definpu">Requirement</label>
  <textarea class="input-block-level" id="requirement" name="requirement" rows="18">
     <?php if (isset($selected_record)): echo htmlspecialchars_decode($selected_record->requirement); endif; ?>
  </textarea>
</div>

...

<script src="<?php echo base_url(); ?>assets/js/editors/summernote/summernote.js"></script>
<script>
    $('#requirement').summernote({ height: 100 });
</script>

`

If I write a text and format it using the Summernote options then it seems to be working (I haven't tried all of them), however when I copy / paste from a word document it doesn't even come up in $_POST. So depending of the content of the Text Area, the value retrieved in $_POST is either the text (if simple format) or empty string (if format is for some reason unaccepted).

In my case the text is pasted from Word and I can see the source the Summernote generates, it looks fine:

`
echo '<style type="text/css">p { margin-bottom: 0.08in; direction: ltr; font-size: 12pt; text-align: left; background: transparent none repeat scroll 0% 0%; }a:link { color: rgb(0, 0, 255); text-decoration: underline; }a.ctl:link { font-family: "Times New Roman"; }a.sdfootnotesym-ctl { font-family: "Times New Roman"; }</style>
<ul><li><p style="margin-top: 0.04in; margin-bottom: 0.04in; line-height: 115%" align="justify">
    <font face="Calibri, serif"><font style="font-size: 11pt" size="2"><font face="Arial, serif"><font style="font-size: 10pt" size="2">Be
able to EDIT the “fixed cells (i.e. Job Type, Request Type, etc.)
without it requiring us to redo the entire request.</font></font>  </font></font></p>
</li></ul>';
`

however when I hit Save (Submit) the $_POST for my area is empty. If I start to type the text myself then it works, but of course format will be different.

So is there a way to overcome this and, if code can be generated from a copy/paste, to save it in the database and then displayed?

Again, my issue is to save it to database. To retrieve I use "htmlspecialchars_decode" and this seems to resolve the issue of displaying correctly.

Thank you!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度