fx-platform-ui 0.0.13-alpha5 → 0.0.13-alpha6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/fx-platform-ui.mjs +69966 -21265
- package/lib/fx-platform-ui.umd.js +119 -32
- package/lib/packages/components/editor/src/hook/index.d.ts +1 -0
- package/lib/packages/components/editor/src/hook/useEditorState.d.ts +28 -0
- package/lib/packages/components/editor/src/index.vue.d.ts +54 -1
- package/lib/packages/components/editor/src/plat-editor-emits.d.ts +1 -0
- package/lib/packages/components/editor/src/plat-editor-props.d.ts +37 -0
- package/lib/packages/components/editor/src/type/index.d.ts +10 -0
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/components/editor/src/index.vue +69 -2
|
@@ -1,17 +1,84 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="fx-editor">
|
|
3
|
-
|
|
3
|
+
<editor v-model="modelValue" :init="init" :disabled="disabled"></editor>
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script lang="ts" setup>
|
|
8
|
+
import { onMounted, watch, ref } from 'vue'
|
|
9
|
+
//在js中引入所需的主题和组件
|
|
10
|
+
import tinymce from 'tinymce/tinymce'
|
|
11
|
+
import 'tinymce/skins/content/default/content.css'
|
|
12
|
+
import Editor from '@tinymce/tinymce-vue'
|
|
13
|
+
import 'tinymce/themes/silver'
|
|
14
|
+
import 'tinymce/themes/silver/theme'
|
|
15
|
+
import 'tinymce/icons/default' //引入编辑器图标icon,不引入则不显示对应图标
|
|
16
|
+
import 'tinymce/models/dom' // 这里是个坑 一定要引入
|
|
17
|
+
|
|
18
|
+
//在TinyMce.vue中接着引入相关插件
|
|
19
|
+
import 'tinymce/icons/default/icons'
|
|
20
|
+
import 'tinymce/plugins/image' // 插入上传图片插件
|
|
21
|
+
import 'tinymce/plugins/media' // 插入视频插件
|
|
22
|
+
import 'tinymce/plugins/table' // 插入表格插件
|
|
23
|
+
import 'tinymce/plugins/lists' // 列表插件
|
|
24
|
+
import 'tinymce/plugins/wordcount' // 字数统计插件
|
|
25
|
+
import 'tinymce/plugins/code' // 源码
|
|
26
|
+
import 'tinymce/plugins/fullscreen' //全屏
|
|
27
|
+
import 'tinymce/plugins/pagebreak' //插入分页符
|
|
28
|
+
import 'tinymce/plugins/codesample'
|
|
29
|
+
import 'tinymce/plugins/searchreplace'
|
|
30
|
+
import 'tinymce/plugins/link'
|
|
31
|
+
import 'tinymce/plugins/autolink'
|
|
32
|
+
import 'tinymce/plugins/anchor'
|
|
33
|
+
|
|
34
|
+
import { platEditorProps } from './plat-editor-props'
|
|
35
|
+
import { platEditorEmits } from './plat-editor-emits'
|
|
36
|
+
import { useEditorState } from './hook'
|
|
8
37
|
defineOptions({
|
|
9
38
|
name: 'PlEditor'
|
|
10
39
|
})
|
|
40
|
+
const props = defineProps(platEditorProps)
|
|
41
|
+
const emit = defineEmits(platEditorEmits)
|
|
42
|
+
|
|
43
|
+
const { init, modelValue } = useEditorState(props)
|
|
44
|
+
const editorBorder = ref('1px solid #d9d9d9')
|
|
45
|
+
|
|
46
|
+
watch(
|
|
47
|
+
() => modelValue.value,
|
|
48
|
+
(val) => {
|
|
49
|
+
emit('update:value', val)
|
|
50
|
+
emit('change', val)
|
|
51
|
+
}
|
|
52
|
+
)
|
|
11
53
|
|
|
54
|
+
// 添加红色边框
|
|
55
|
+
const addValidate = (border = '1px solid #ff4d4f') => {
|
|
56
|
+
editorBorder.value = border
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// 取消红色边框
|
|
60
|
+
const removeValidate = (border = '1px solid #d9d9d9') => {
|
|
61
|
+
editorBorder.value = border
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const instance = {
|
|
65
|
+
...props,
|
|
66
|
+
addValidate,
|
|
67
|
+
removeValidate
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
defineExpose(instance)
|
|
71
|
+
|
|
72
|
+
//在onMounted中初始化编辑器
|
|
73
|
+
onMounted(() => {
|
|
74
|
+
tinymce.init({})
|
|
75
|
+
})
|
|
12
76
|
</script>
|
|
13
77
|
<style lang="less" scoped>
|
|
14
|
-
|
|
78
|
+
//:deep(.tox-tinymce) {
|
|
79
|
+
// border: v-bind(editorBorder);
|
|
80
|
+
// border-radius: 2px;
|
|
81
|
+
//}
|
|
15
82
|
:deep(.tox-tinymce-aux) {
|
|
16
83
|
z-index: 1000;
|
|
17
84
|
}
|