config.html 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <!-- 富文本 -->
  2. <form onchange="changeForm($(this),2)">
  3. <input type="hidden" name="model_id" value="2" />
  4. <h2 class="attr-title">富文本</h2>
  5. <div class="layui-form-item">
  6. <label class="layui-form-label sm">背景颜色</label>
  7. <div class="layui-input-block">
  8. <div class="color-wrapper">
  9. <input data-js="color" type="text" name="back_color" value="{$config_info.back_color|default=''}" />
  10. </div>
  11. </div>
  12. </div>
  13. <div class="layui-form-item">
  14. <label class="layui-form-label sm">文本内容</label>
  15. <div class="layui-input-block">
  16. <textarea name="editor_content" id="editor_content" style="width:100%;">{if isset($config_info.editor_content)}{$config_info.editor_content|raw}{/if}</textarea>
  17. <div class="uploader-wrapper">
  18. <div>
  19. <div class="uploader-icon iconfont">&#xe6bf;</div>
  20. <div class="uploader-text">图片上传</div>
  21. <input type='file' class='uploader-file' onchange='uploadFile($(this),insertEditorImage)'>
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. </form>
  27. <script>
  28. if(typeof(loadConfig2)=='undefined'){
  29. function loadConfig2(obj){
  30. obj.find('[data-js="color"]').colorpicker({showOn: 'both'});
  31. obj.find('#editor_content').attr('id','editor_content_'+obj.attr('data-id'))
  32. ue['i_'+obj.attr('data-id')]=UE.getEditor('editor_content_'+obj.attr('data-id'),{toolbars:[[
  33. 'fullscreen', 'source', '|', 'undo', 'redo', '|',
  34. 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
  35. 'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
  36. 'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
  37. 'directionalityltr', 'directionalityrtl', 'indent', '|',
  38. 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
  39. 'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
  40. 'emotion', 'map', 'gmap', 'insertcode', 'template', '|',
  41. 'horizontal', 'date', 'time', 'spechars', '|',
  42. 'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',
  43. 'searchreplace', 'help', 'drafts', 'charts'
  44. ]]})
  45. ue['i_'+obj.attr('data-id')].addListener('blur',function(editor){
  46. obj.find('[name="editor_content"]').val(ue['i_'+obj.attr('data-id')].getContent())
  47. obj.find('form').change()
  48. });
  49. }
  50. }
  51. if(typeof(insertEditorImage)=='undefined'){
  52. function insertEditorImage(src,obj){
  53. ue['i_'+obj.parents('[data-type="config"]').attr('data-id')].execCommand('insertimage', {src:src});
  54. }
  55. }
  56. </script>