【问题标题】:CKEditor textarea created with display:noneCKEditor 使用 display:none 创建的文本区域
【发布时间】:2019-03-22 03:57:25
【问题描述】:

我最近克隆了一个脚本,虽然原始脚本中的 CKEditor 文本区域可以正常工作,但新脚本中的文本区域却不行。

原脚本代码如下:

<td align="left" valign="top">Description: <a target="_blank" href="faq_bb.php#edit"><img title = "<?= $bb_help; ?>" alt="<?= $bb_help; ?>" height=17 width=19 border=0 src="/images2/query_icon.gif"></a>
</td>
<td valign=top align="left" colspan=2>
<?php
    $winsize = strlen($bb_desc);
    if ($winsize < 255)
    {
        $editorheight = 10;
    }
    else
    {
        $editorheight = 20;
    }
    $text = html_entity_decode($bb_desc, ENT_QUOTES);
?>
    <textarea name="_bb_desc" cols=<?= $editorheight ?>>
        <?= $text ?>
    </textarea>
    <script type="text/javascript">
      CKEDITOR.replace( '_bb_desc');
    </script>
 </td>

新脚本有:

<td align="left" valign="top">Description: <a target="_blank" href="faq_bb.php#edit"><img title = "<?= $bb_help; ?>" alt="<?= $bb_help; ?>" height=17 width=19 border=0 src="/images2/query_icon.gif"></a>
</td>
<td valign=top align="left" colspan=2>
<?php
    $winsize = strlen($bb_desc);
    if ($winsize < 255)
    {
        $editorheight = 10;
    }
    else
    {
        $editorheight = 20;
    }
    $text = html_entity_decode($bb_desc, ENT_QUOTES);
?>
    <textarea name="_bb_desc" cols=<?= $editorheight ?>>
        <?= $text ?>
    </textarea>
    <script type="text/javascript">
      CKEDITOR.replace( '_bb_desc');
    </script>
 </td>

在 Web Console Element Inspector 中查看呈现的页面,原始脚本生成:

<iframe src="" style="width: 100%; height: 100%;" class="cke_wysiwyg_frame cke_reset" title="Rich Text Editor, _bb_desc" aria-describedby="cke_87" tabindex="0" allowtransparency="true" frameborder="0"></iframe>

新脚本产生:

<iframe src="" style="width: 100%; height: 100%; display: none !important;" class="cke_wysiwyg_frame cke_reset" title="Rich Text Editor, _bb_desc" aria-describedby="cke_72" tabindex="0" allowtransparency="true" hidden="" frameborder="0"></iframe>

这两个脚本在相同的环境中执行,使用相同版本的 CKEditor (4.5.3.Full)。

对于可能导致不同行为的任何建议,我们将不胜感激。

【问题讨论】:

    标签: ckeditor


    【解决方案1】:

    嗯,我找到了解决方案,虽然我比以前更不知道问题是什么。

    问题似乎是由脚本名称引起的。如果它被称为 tracker.php,CKEditor 无法正常工作。显然,将其更改为其他任何内容都解决了问题。

    很奇怪。

    【讨论】:

      猜你喜欢
      • 2012-11-21
      • 2011-03-10
      • 2018-06-08
      • 2018-06-16
      • 2017-02-11
      • 2021-12-22
      • 1970-01-01
      • 2015-08-16
      • 1970-01-01
      相关资源
      最近更新 更多