优化编辑器

This commit is contained in:
icssoa 2022-08-17 10:48:26 +08:00
parent d2a55fe8f4
commit 83859b685a
4 changed files with 14 additions and 13 deletions

View File

@ -232,7 +232,9 @@ export async function createMenu({ router, columns, prefix, api, filePath }: any
upsert.items.push(format(item)); upsert.items.push(format(item));
} }
if (!["cl-codemirror", "cl-editor-quill"].includes(column.component?.name)) { if (
!["cl-codemirror", "cl-editor-quill", "cl-editor-wang"].includes(column.component?.name)
) {
table.columns.push(format(column)); table.columns.push(format(column));
} }
}); });

View File

@ -177,11 +177,8 @@ export default [
}, },
{ {
test: ["rich", "text", "html", "content", "introduce", "description", "desc"], test: ["rich", "text", "html", "content", "introduce", "description", "desc"],
table: {
name: "cl-editor-quill"
},
form: { form: {
name: "cl-editor-quill", name: "cl-editor-wang",
props: { props: {
height: 400 height: 400
} }
@ -189,9 +186,6 @@ export default [
}, },
{ {
test: ["code", "codes"], test: ["code", "codes"],
table: {
name: "cl-codemirror"
},
form: { form: {
name: "cl-codemirror", name: "cl-codemirror",
props: { props: {

View File

@ -37,9 +37,10 @@
<script lang="ts" name="cl-editor-wang" setup> <script lang="ts" name="cl-editor-wang" setup>
import "@wangeditor/editor/dist/css/style.css"; import "@wangeditor/editor/dist/css/style.css";
import { onBeforeUnmount, ref, shallowRef, watch, PropType, reactive } from "vue"; import { onBeforeUnmount, ref, shallowRef, watch, PropType, reactive, computed } from "vue";
import { Editor, Toolbar } from "@wangeditor/editor-for-vue"; import { Editor, Toolbar } from "@wangeditor/editor-for-vue";
import { IEditorConfig } from "@wangeditor/editor"; import { IEditorConfig } from "@wangeditor/editor";
import { isNumber } from "lodash-es";
const props = defineProps({ const props = defineProps({
modelValue: String, modelValue: String,
@ -48,8 +49,8 @@ const props = defineProps({
default: "default" default: "default"
}, },
height: { height: {
type: String, type: [String, Number],
default: "400px" default: 400
} }
}); });
@ -59,8 +60,12 @@ const ImageSpace = ref();
const VideoSpace = ref(); const VideoSpace = ref();
const editorRef = shallowRef(); const editorRef = shallowRef();
//
const value = ref(); const value = ref();
//
const height = computed(() => (isNumber(props.height) ? `${props.height}px` : props.height));
watch( watch(
() => props.modelValue, () => props.modelValue,
(val) => { (val) => {

View File

@ -2,12 +2,12 @@
<div class="editor scroller1"> <div class="editor scroller1">
<div class="item"> <div class="item">
<p class="title">Wang</p> <p class="title">Wang</p>
<cl-editor-wang v-model="w" height="400px" /> <cl-editor-wang v-model="w" :height="300" />
</div> </div>
<div class="item"> <div class="item">
<p class="title">Quill</p> <p class="title">Quill</p>
<cl-editor-quill v-model="q" height="400px" /> <cl-editor-quill v-model="q" :height="300" />
</div> </div>
</div> </div>
</template> </template>