|
@@ -3,6 +3,14 @@ import {
|
|
|
Edit,
|
|
|
Delete
|
|
|
} from '@element-plus/icons-vue'
|
|
|
+// 文章编辑器组件
|
|
|
+import { QuillEditor, Quill } from "@vueup/vue-quill";
|
|
|
+import "@vueup/vue-quill/dist/vue-quill.snow.css";
|
|
|
+import { ImageDrop } from 'quill-image-drop-module';
|
|
|
+import imageResize from 'quill-image-resize-module';
|
|
|
+
|
|
|
+Quill.register('modules/ImageDrop', ImageDrop);
|
|
|
+Quill.register('modules/imageResize', imageResize);
|
|
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
@@ -89,11 +97,38 @@ const articleModel = ref({
|
|
|
productId: ''
|
|
|
})
|
|
|
const fileList = ref([])
|
|
|
-
|
|
|
-// 文章编辑器组件
|
|
|
-import { QuillEditor } from '@vueup/vue-quill'
|
|
|
-import '@vueup/vue-quill/dist/vue-quill.snow.css'
|
|
|
-import { options } from '../../utils/quillEditorOptions'
|
|
|
+const options = ref({
|
|
|
+ theme: "snow",
|
|
|
+ bounds: document.body,
|
|
|
+ debug: "warn",
|
|
|
+ modules: {
|
|
|
+ // 工具栏配置
|
|
|
+ toolbar: [
|
|
|
+ ["bold", "italic", "underline", "strike"], // 加粗 斜体 下划线 删除线
|
|
|
+ ["blockquote", "code-block"], // 引用 代码块
|
|
|
+ [{ list: "ordered" }, { list: "bullet" }], // 有序、无序列表
|
|
|
+ [{ indent: "-1" }, { indent: "+1" }], // 缩进
|
|
|
+ [{ size: ["small", false, "large", "huge"] }], // 字体大小
|
|
|
+ [{ header: [1, 2, 3, 4, 5, 6, false] }], // 标题
|
|
|
+ [{ color: [] }, { background: [] }], // 字体颜色、字体背景颜色
|
|
|
+ [{ align: [] }], // 对齐方式
|
|
|
+ ["clean"], // 清除文本格式
|
|
|
+ ["link", "image"] // 链接、图片、视频
|
|
|
+ ],
|
|
|
+ // ImageDrop: true, // PS:因为QuillEditor自带可拖拽此配置可以不开,开启拖动会复制图片
|
|
|
+ // todo 富文本导入图片是否需要缩放拖拽
|
|
|
+ imageResize: {
|
|
|
+ displayStyles: {
|
|
|
+ backgroundColor: 'black',
|
|
|
+ border: 'none',
|
|
|
+ color: 'white',
|
|
|
+ },
|
|
|
+ modules: ['Resize', 'DisplaySize', 'Toolbar'],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ placeholder: "请输入内容",
|
|
|
+// readOnly: props.readOnly
|
|
|
+});
|
|
|
|
|
|
//导入token,方便编辑完文章后保存至服务器
|
|
|
import {userTokenStore} from '@/stores/token.js'
|