【问题标题】:TinyMCE 5 : Image is not showing unless there is a text after the imageTinyMCE 5:除非图像后面有文字,否则图像不会显示
【发布时间】:2020-12-01 14:55:27
【问题描述】:

如果我们通过 TinyMCE 编辑器中的插入图像选项添加图像。预览显示正确。但是提交后图片消失了。

如果您在图像后面添加文本或点 (.),则可以使用。

tinymce.init({
      selector: 'textarea#myTxtID',
      height: 335,
        resize: "both",
      plugins: [
                'advlist autolink lists link image charmap print preview hr anchor pagebreak',
                'searchreplace wordcount visualblocks visualchars code fullscreen',
                'insertdatetime media nonbreaking save table contextmenu directionality',
                'emoticons template paste textcolor colorpicker textpattern imagetools'
        ],
        toolbar1: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
        toolbar2: 'print preview media | forecolor backcolor emoticons'
    });

只有图像时不起作用。

但是当有额外的文本时它会起作用

知道为什么吗?

【问题讨论】:

    标签: tinymce tinymce-4 tinymce-plugins


    【解决方案1】:

    没有找到解决办法,暂时通过添加一个不可见的点(.)来修复它

    tinyMCE.get('myTxtID').getContent()+'<p style=\"display:none\">.</p>'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-28
      • 2012-01-27
      • 1970-01-01
      • 1970-01-01
      • 2016-05-28
      • 2021-12-09
      相关资源
      最近更新 更多