优化编辑器

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));
}
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));
}
});

View File

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

View File

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

View File

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