You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
3.0 KiB

5 years ago
  1. <template>
  2. <!--工具条1-->
  3. <!--如果有更多工具条,放开此注释
  4. <el-col :span="24" class="toolbar" size="small" style="padding-bottom: 0px;">
  5. <el-col :span="4">
  6. </el-col>
  7. </el-col>
  8. -->
  9. <!--新增界面 Archive 档案信息表-->
  10. <quill-editor ref="archiveContextEditor"
  11. v-model="value"
  12. :options="editorOption"
  13. @blur="onEditorBlur($event)"
  14. @focus="onEditorFocus($event)"
  15. @ready="onEditorReady($event)">
  16. </quill-editor>
  17. </template>
  18. <script>
  19. //begin富文本编辑器
  20. import { quillEditor,Quill } from 'vue-quill-editor'
  21. import 'quill/dist/quill.core.css'
  22. import 'quill/dist/quill.snow.css'
  23. import 'quill/dist/quill.bubble.css'
  24. import { ImageDrop } from 'quill-image-drop-module'
  25. import ImageResize from 'quill-image-resize-module'
  26. Quill.register('modules/imageDrop', ImageDrop)
  27. Quill.register('modules/imageResize', ImageResize)
  28. //end 富文本编辑器
  29. export default {
  30. props:['value']
  31. data() {
  32. return {
  33. editorOption: {
  34. modules: {
  35. toolbar: [
  36. [{ 'size': ['small', false, 'large'] }],
  37. ['bold', 'italic'],
  38. [{ 'list': 'ordered'}, { 'list': 'bullet' }],
  39. ['link', 'image']
  40. ],
  41. history: {
  42. delay: 1000,
  43. maxStack: 50,
  44. userOnly: false
  45. },
  46. imageDrop: true,
  47. imageResize: {
  48. displayStyles: {
  49. backgroundColor: 'black',
  50. border: 'none',
  51. color: 'white'
  52. },
  53. modules: [ 'Resize', 'DisplaySize', 'Toolbar' ]
  54. }
  55. }
  56. }
  57. }
  58. },
  59. mounted() {
  60. },
  61. computed: {
  62. contentCode() {
  63. return hljs.highlightAuto(this.content).value
  64. },
  65. },
  66. methods: {
  67. onEditorBlur(editor) {
  68. // console.log('editor blur!', editor)
  69. },
  70. onEditorFocus(editor) {
  71. // console.log('editor focus!', editor)
  72. },
  73. onEditorReady(editor) {
  74. // console.log('editor ready!', editor)
  75. }
  76. },
  77. components: {
  78. //在下面添加其它组件 'archive-edit':ArchiveEdit
  79. 'quill-editor':quillEditor
  80. },
  81. }
  82. </script>
  83. <style>
  84. .quill-editor:not(.bubble) .ql-container,
  85. .quill-editor:not(.bubble) .ql-container .ql-editor {
  86. height: 30rem;
  87. padding-bottom: 1rem;
  88. }
  89. </style>
  90. <style lang="scss" scoped>
  91. .quill-editor,
  92. .quill-code {
  93. width: 50%;
  94. float: left;
  95. }
  96. .quill-code {
  97. height: auto;
  98. border: none;
  99. > .title {
  100. border: 1px solid #ccc;
  101. border-left: none;
  102. height: 3em;
  103. line-height: 3em;
  104. text-indent: 1rem;
  105. font-weight: bold;
  106. }
  107. > code {
  108. width: 100%;
  109. margin: 0;
  110. padding: 1rem;
  111. border: 1px solid #ccc;
  112. border-top: none;
  113. border-left: none;
  114. border-radius: 0;
  115. height: 30rem;
  116. overflow-y: auto;
  117. }
  118. }
  119. </style>