2017-04-07 180 views
1

我使用TinyMCE的编辑对我的Laravel应用程序的HTML代码。一切工作正常,但当我更改任何文本的颜色或背景颜色时,会出现一些问题。TinyMCE的编辑器生成的文字颜色和背景颜色变化,但不发送

Trying to do the following 它生成HTML,但不发送,当我提交 enter image description here 初始化是以下几点:

tinymce.init({ 
     selector: '#description', 
     extended_valid_elements : 'span', 
     verify_html: true, 
     height: 400, 
     theme: 'modern', 
     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 codesample toc' 
     ], 
     toolbar1: 'undo redo | insert | styleselect | fontselect fontsizeselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image', 
     toolbar2: 'print preview media | forecolor backcolor emoticons | codesample | mybutton', 
     image_advtab: true, 
     image_title: true, 
     image_caption: true, 
     relative_urls: false, 
     theme_advanced_buttons1: "forecolor,backcolor,fontselect,fontsizeselect", 

     templates: [ 
      { title: 'Test template 1', content: 'Test 1' }, 
      { title: 'Test template 2', content: 'Test 2' }, 
     ], 
    }); 

当我调试它显示我的输出如下: enter image description here

+1

如果您检查与DOM查看器的文本,并在HTML具有正确的内嵌样式属性呢?或者是一个处理规则的CSS样式表? – Ohgodwhy

+0

是的,它生成内联的CSS。但是当我提交它时,它跳过了内联CSS。我正在更新我的问题。请看截图。 –

+0

如果您使用TinyMCE的API来获取数据,它是否显示这种方式?类似'window.tinymce.get('myTextEditorID')。getContent()' – Ohgodwhy

回答

0

我得到了我的解决方案:它的工作原理,如果我设置

tinymce.init({ 
    extended_valid_elements: true, 
    //or 
    extended_valid_elements: 'a[href|target=_blank]', 
});