diff --git a/src/components/wang-editor/EditorFooter.vue b/src/components/wang-editor/EditorFooter.vue
index 10ffea17..aae23f29 100644
--- a/src/components/wang-editor/EditorFooter.vue
+++ b/src/components/wang-editor/EditorFooter.vue
@@ -1,25 +1,23 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/components/wang-editor/SwitchButton.vue b/src/components/wang-editor/SwitchButton.vue
index 8f63dc67..02208419 100644
--- a/src/components/wang-editor/SwitchButton.vue
+++ b/src/components/wang-editor/SwitchButton.vue
@@ -1,6 +1,7 @@
-
diff --git a/src/components/wang-editor/Title.vue b/src/components/wang-editor/Title.vue
index 31047106..00985510 100644
--- a/src/components/wang-editor/Title.vue
+++ b/src/components/wang-editor/Title.vue
@@ -78,7 +78,5 @@ const handelInput = () => {
/* 标题输入字体大小 */
font-size: 40px;
border: none;
- /* 光标样式 */
- caret-shape: block;
}
diff --git a/src/components/wang-editor/WangEditor.vue b/src/components/wang-editor/WangEditor.vue
index 18333e3d..14a725d0 100644
--- a/src/components/wang-editor/WangEditor.vue
+++ b/src/components/wang-editor/WangEditor.vue
@@ -20,6 +20,7 @@ import { Editor } from '@wangeditor/editor-for-vue'
// 编辑器菜单配置
import { IToolbarConfig } from '@wangeditor/editor'
import { Toolbar } from '@wangeditor/editor-for-vue'
+import { keysToExclude } from './keysToExclude'
// 导入标题
const Title = defineAsyncComponent(
@@ -38,7 +39,9 @@ import DOMPurify from 'dompurify'
// 导入防抖函数
import { debounce } from '@/utils/debounce'
-const topicData = storeToRefs(useKUNGalgameEditStore())
+const { editorHeight, isShowAdvance, isSave, content } = storeToRefs(
+ useKUNGalgameEditStore()
+)
// 定义父组件传参
const props = defineProps<{
@@ -54,7 +57,7 @@ const props = defineProps<{
const editorRef = shallowRef(undefined)
// 编辑器的高度
-const editorHeight = computed(() => `height: ${topicData.editorHeight.value}px`)
+const editorHeightStyle = computed(() => `height: ${editorHeight.value}px`)
// 编辑器内的内容
const valueHtml = ref('')
// 编辑器文字计数
@@ -82,23 +85,23 @@ const editorConfig: Partial = {
},
}
-const keys: string[] = []
-
// 工具栏相关配置
const toolbarConfig: Partial = {
- excludeKeys: ['uploadVideo'].concat(keys),
+ // 是否显示高级模式,显示则不排除 keys
+ excludeKeys: isShowAdvance.value ? ['uploadVideo'] : keysToExclude,
}
const handleCreated = (editor: IDomEditor) => {
- console.log(editor.getAllMenuKeys())
-
editorRef.value = editor // 记录 editor 实例,重要!
+ editor.on('modalOrPanelShow', (modalOrPanel) => {
+ console.log(modalOrPanel)
+ })
}
// 挂载之前载入数据,如果不保存,则不载入
onBeforeMount(() => {
- if (topicData.isSave.value) {
- valueHtml.value = topicData.content.value
+ if (isSave.value) {
+ valueHtml.value = content.value
}
})
@@ -115,7 +118,7 @@ const handleChange = (editor: IDomEditor) => {
// 创建一个防抖处理函数
const debouncedUpdateContent = debounce(() => {
// 过滤 xss
- topicData.content.value = DOMPurify.sanitize(editor.getHtml())
+ content.value = DOMPurify.sanitize(editor.getHtml())
}, 1007)
// 调用防抖处理函数,会在延迟时间内只执行一次更新操作
@@ -149,7 +152,7 @@ const handleChange = (editor: IDomEditor) => {
{
-
+
@@ -177,8 +177,7 @@ const handleChange = (editor: IDomEditor) => {
width: 100%;
margin: 0 auto;
z-index: 1008;
- background-color: var(--kungalgame-trans-white-5);
- backdrop-filter: blur(5px);
+ background-color: var(--kungalgame-trans-white-2);
}
.toolbar {
diff --git a/src/components/wang-editor/key.js b/src/components/wang-editor/key.js
deleted file mode 100644
index 4eda1c17..00000000
--- a/src/components/wang-editor/key.js
+++ /dev/null
@@ -1,62 +0,0 @@
-;[
- 'bold',
- 'underline',
- 'italic',
- 'through',
- 'code',
- 'sub',
- 'sup',
- 'clearStyle',
- 'color',
- 'bgColor',
- 'fontSize',
- 'fontFamily',
- 'indent',
- 'delIndent',
- 'justifyLeft',
- 'justifyRight',
- 'justifyCenter',
- 'justifyJustify',
- 'lineHeight',
- 'insertImage',
- 'deleteImage',
- 'editImage',
- 'viewImageLink',
- 'imageWidth30',
- 'imageWidth50',
- 'imageWidth100',
- 'divider',
- 'emotion',
- 'insertLink',
- 'editLink',
- 'unLink',
- 'viewLink',
- 'codeBlock',
- 'blockquote',
- 'headerSelect',
- 'header1',
- 'header2',
- 'header3',
- 'header4',
- 'header5',
- 'todo',
- 'redo',
- 'undo',
- 'fullScreen',
- 'enter',
- 'bulletedList',
- 'numberedList',
- 'insertTable',
- 'deleteTable',
- 'insertTableRow',
- 'deleteTableRow',
- 'insertTableCol',
- 'deleteTableCol',
- 'tableHeader',
- 'tableFullWidth',
- 'insertVideo',
- 'uploadVideo',
- 'editVideoSize',
- 'uploadImage',
- 'codeSelectLang',
-]
diff --git a/src/components/wang-editor/keysToExclude.ts b/src/components/wang-editor/keysToExclude.ts
new file mode 100644
index 00000000..f71e6a58
--- /dev/null
+++ b/src/components/wang-editor/keysToExclude.ts
@@ -0,0 +1,34 @@
+// 编辑器 toolbar 要排除的项目
+export const keysToExclude: string[] = [
+ // 角标
+ 'sub',
+ 'sup',
+ // 文字精确大小,字体,行高
+ 'fontSize',
+ 'fontFamily',
+ 'lineHeight',
+ // 文字背景色
+ 'bgColor',
+ // todo, undo, redo
+ 'todo',
+ 'redo',
+ 'undo',
+ // 缩进的组
+ 'group-indent',
+ // 插入视频的组
+ 'group-video',
+ // 表格
+ 'insertTable',
+ 'deleteTable',
+ 'deleteTableRow',
+ 'insertTableCol',
+ 'deleteTableCol',
+ 'tableHeader',
+ 'tableFullWidth',
+ // 右键菜单已有的功能
+ 'headerSelect',
+ 'bold',
+ 'bulletedList',
+ 'insertLink',
+ 'group-more-style',
+]
diff --git a/src/styles/editor/editor.scss b/src/styles/editor/editor.scss
index cda72167..7b7973e4 100644
--- a/src/styles/editor/editor.scss
+++ b/src/styles/editor/editor.scss
@@ -27,14 +27,27 @@ u {
text-shadow: none;
}
+/* 不显示分割线 */
+.w-e-bar-divider {
+ display: none;
+}
+
+a {
+ color: var(--kungalgame-blue-5);
+ border-bottom: 1.5px solid var(--kungalgame-trans-white-9);
+ &:hover {
+ border-bottom: 1.5px solid var(--kungalgame-blue-5);
+ }
+}
+
:root {
/* textarea - css vars */
--w-e-textarea-bg-color: var(--kungalgame-white-9);
--w-e-textarea-color: var(--kungalgame-font-color-3);
- --w-e-textarea-border-color: var(--kungalgame-blue-1);
+ --w-e-textarea-border-color: var(--kungalgame-blue-4);
--w-e-textarea-slight-border-color: var(--kungalgame-blue-4);
--w-e-textarea-slight-color: var(--kungalgame-font-color-0);
- --w-e-textarea-slight-bg-color: var(--kungalgame-white-9);
+ --w-e-textarea-slight-bg-color: var(--kungalgame-trans-blue-0);
--w-e-textarea-selected-border-color: var(--kungalgame-blue-1);
/* 选中的元素,如选中了分割线 */
--w-e-textarea-handler-bg-color: var(--kungalgame-blue-4);
diff --git a/src/views/topic/content/components/Content.vue b/src/views/topic/content/components/Content.vue
index 33a11512..f7d17085 100644
--- a/src/views/topic/content/components/Content.vue
+++ b/src/views/topic/content/components/Content.vue
@@ -28,7 +28,8 @@ onMounted(() => {