From f3462496855bf9fc8454c1d4fbe8e652d4d445e5 Mon Sep 17 00:00:00 2001 From: KUN1007 Date: Mon, 4 Sep 2023 20:02:23 +0800 Subject: [PATCH] feat: advance toolbar --- src/components/wang-editor/EditorFooter.vue | 82 ++-------- .../wang-editor/EditorSettingsMenu.vue | 146 ++++++++++++++++++ src/components/wang-editor/SwitchButton.vue | 12 +- src/components/wang-editor/Title.vue | 2 - src/components/wang-editor/WangEditor.vue | 33 ++-- src/components/wang-editor/key.js | 62 -------- src/components/wang-editor/keysToExclude.ts | 34 ++++ src/styles/editor/editor.scss | 17 +- .../topic/content/components/Content.vue | 3 +- 9 files changed, 229 insertions(+), 162 deletions(-) create mode 100644 src/components/wang-editor/EditorSettingsMenu.vue delete mode 100644 src/components/wang-editor/key.js create mode 100644 src/components/wang-editor/keysToExclude.ts 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 @@ @@ -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(() => {