refactor(editor): 重构编辑器组件及样式,优化功能实现

重构编辑器工具栏样式及功能,使用wangEditor替换原有实现
优化图片和视频上传逻辑,增加自定义校验和上传处理
调整编辑器样式,修复对齐功能及段落标题样式
更新表情选择器位置逻辑,支持上下方向显示
统一组件导入方式,添加版本控制参数防止缓存
This commit is contained in:
DESKTOP-RQ919RC\Pc
2025-11-26 19:01:26 +08:00
parent 460450c339
commit 275b78b221
23 changed files with 678 additions and 320 deletions

View File

@@ -761,6 +761,15 @@
font-size: 22px;
padding: 8px;
}
.answer-discuss .input-box .bottom .operate .item .emoji-box.top {
top: inherit;
bottom: 36px;
}
.answer-discuss .input-box .bottom .operate .item .emoji-box.top::after {
bottom: -8px;
top: inherit;
transform: translateX(-50%) rotate(180deg);
}
.answer-discuss .input-box .bottom .operate .item .emoji-box::after {
content: "";
width: 0;

View File

@@ -878,16 +878,17 @@
cursor: pointer;
}
.answer-discuss .input-box .bottom .operate .item {
}
.answer-discuss .input-box .bottom .operate .item .emoji-box {
width: 582px;
border-radius: 8px;
background-color: #fff;
filter: drop-shadow(0 0 11px rgba(0, 0, 0, 0.1));
// top: 45px;
top: 36px;
position: absolute;
z-index: 1;
// left: -14px;
left: 50%;
transform: translateX(-50%);
border: 1px solid #ebebeb;
@@ -895,20 +896,30 @@
flex-wrap: wrap;
font-size: 22px;
padding: 8px;
}
.answer-discuss .input-box .bottom .operate .item .emoji-box::after {
content: "";
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 8px solid #ffffff;
position: absolute;
top: -8px;
// left: 15px;
left: 50%;
transform: translateX(-50%);
&.top {
top: inherit;
bottom: 36px;
&::after {
bottom: -8px;
top: inherit;
transform: translateX(-50%) rotate(180deg);
}
}
&::after {
content: "";
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 8px solid #ffffff;
position: absolute;
top: -8px;
left: 50%;
transform: translateX(-50%);
}
}
.answer-discuss .input-box .bottom .operate .item .emoji-box .emoji-icon {

View File

@@ -73,18 +73,44 @@
color: #555;
font-size: 14px;
}
#edit .edit-container .editor-toolbar {
#edit .edit-container #editorwrapper {
z-index: 100;
}
#edit .edit-container #editorwrapper .bold {
font-weight: bold;
}
#edit .edit-container #editorwrapper .editor-toolbar {
height: 36px;
line-height: 36px;
background-color: #fbfbfb;
padding-left: 25px;
position: sticky;
top: 0;
z-index: 10;
}
#edit .edit-container .editor-toolbar .toolbar-item {
#edit .edit-container #editorwrapper .editor-toolbar .w-e-panel-content-emotion {
width: 490px;
}
#edit .edit-container #editorwrapper .editor-toolbar .w-e-bar-item-group .w-e-bar-item-menus-container {
margin-top: 30px;
}
#edit .edit-container #editorwrapper .editor-toolbar > .w-e-bar {
background-color: transparent;
}
#edit .edit-container #editorwrapper .editor-toolbar .w-e-toolbar {
padding: 0;
}
#edit .edit-container #editorwrapper .editor-toolbar .w-e-toolbar > .w-e-bar-item {
margin-right: 40px;
}
#edit .edit-container #editorwrapper .editor-toolbar .w-e-toolbar > .w-e-bar-item > button {
color: #000000;
padding: 0 10px;
}
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item {
cursor: pointer;
height: 30px;
line-height: 30px;
height: 30px !important;
line-height: 30px !important;
font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
font-weight: 400;
font-style: normal;
@@ -93,15 +119,21 @@
line-height: 23px;
margin-right: 40px;
position: relative;
padding: 0 10px;
border-radius: 50px;
padding: 0;
}
#edit .edit-container .editor-toolbar .toolbar-item .icon {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item .icon {
width: 16px;
height: 16px;
margin-right: 5px;
}
#edit .edit-container .editor-toolbar .toolbar-item .file {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item > button {
padding: 0 10px;
border-radius: 50px;
}
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item > button.active {
background-color: #f6f6bd;
}
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item .file {
opacity: 0;
/* 隐藏输入框 */
background: transparent;
@@ -113,7 +145,7 @@
height: 100%;
cursor: pointer;
}
#edit .edit-container .editor-toolbar .toolbar-item .file::after {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item .file::after {
content: "";
width: 100%;
height: 100%;
@@ -121,14 +153,14 @@
top: 0;
left: 0;
}
#edit .edit-container .editor-toolbar .toolbar-item.expression.pitch .emoji-box-mask {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item.expression.pitch .emoji-box-mask {
display: block;
}
#edit .edit-container .editor-toolbar .toolbar-item.expression.pitch .emoji-box {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item.expression.pitch .emoji-box {
display: flex;
}
#edit .edit-container .editor-toolbar .toolbar-item .link-box-mask,
#edit .edit-container .editor-toolbar .toolbar-item .emoji-box-mask {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item .link-box-mask,
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item .emoji-box-mask {
position: fixed;
top: 0;
left: 0;
@@ -137,10 +169,10 @@
z-index: 1;
display: none;
}
#edit .edit-container .editor-toolbar .toolbar-item .link-box-mask {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item .link-box-mask {
background: transparent;
}
#edit .edit-container .editor-toolbar .toolbar-item .emoji-box {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item .emoji-box {
width: 582px;
border-radius: 8px;
background-color: #fff;
@@ -156,7 +188,7 @@
font-size: 22px;
padding: 8px;
}
#edit .edit-container .editor-toolbar .toolbar-item .emoji-box::after {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item .emoji-box::after {
content: "";
width: 0;
height: 0;
@@ -168,17 +200,17 @@
left: 50%;
transform: translateX(-50%);
}
#edit .edit-container .editor-toolbar .toolbar-item .emoji-box .emoji-icon {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item .emoji-box .emoji-icon {
margin: 5px;
cursor: pointer;
}
#edit .edit-container .editor-toolbar .toolbar-item.link.pitch .link-box-mask {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item.link.pitch .link-box-mask {
display: block;
}
#edit .edit-container .editor-toolbar .toolbar-item.link.pitch .link-box {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item.link.pitch .link-box {
display: flex;
}
#edit .edit-container .editor-toolbar .toolbar-item.link .link-box {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item.link .link-box {
background-color: #ffffff;
border-radius: 6px;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.16862745);
@@ -193,11 +225,11 @@
flex-direction: column;
padding: 18px 20px 0;
}
#edit .edit-container .editor-toolbar .toolbar-item.link .link-box .item {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item.link .link-box .item {
margin-bottom: 22px;
flex-direction: column;
}
#edit .edit-container .editor-toolbar .toolbar-item.link .link-box .item .name {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item.link .link-box .item .name {
font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
font-weight: 400;
font-style: normal;
@@ -206,7 +238,7 @@
line-height: 26px;
margin-bottom: 8px;
}
#edit .edit-container .editor-toolbar .toolbar-item.link .link-box .item .input {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item.link .link-box .item .input {
height: 36px;
border: 1px solid #d7d7d7;
border-radius: 7px;
@@ -214,7 +246,7 @@
font-size: 14px;
color: #000000;
}
#edit .edit-container .editor-toolbar .toolbar-item.link .link-box .btn {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item.link .link-box .btn {
width: 72px;
height: 40px;
line-height: 40px;
@@ -228,12 +260,27 @@
color: #000000;
margin-top: 8px;
}
#edit .edit-container .editor-toolbar .toolbar-item.link .link-box .btn:hover {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item.link .link-box .btn:hover {
background-color: #23e0b6;
}
#edit .edit-container .editor-toolbar .toolbar-item.h2.pitch {
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item.h2.pitch {
background-color: #f6f6bd;
}
#edit .edit-container #editorwrapper .editor-toolbar .toolbar-item.active > button {
background-color: #f6f6bd;
}
#edit .edit-container #editorwrapper #editor-container {
min-height: 500px;
max-height: 80vh;
font-size: 18px;
line-height: 26px;
color: #333333;
}
#edit .edit-container #editorwrapper #editor-container a {
font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
text-decoration: underline;
color: #04b0d5;
}
#edit .edit-container .content-input {
min-height: 509px;
font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;

View File

@@ -82,192 +82,253 @@
}
}
.editor-toolbar {
height: 36px;
background-color: rgba(251, 251, 251, 1);
padding-left: 25px;
position: sticky;
top: 0;
z-index: 10;
#editor—wrapper {
z-index: 100;
.toolbar-item {
.icon {
width: 16px;
height: 16px;
margin-right: 5px;
.bold {
font-weight: bold;
}
.editor-toolbar {
height: 36px;
line-height: 36px;
background-color: rgba(251, 251, 251, 1);
padding-left: 25px;
position: sticky;
top: 0;
z-index: 10;
.w-e-panel-content-emotion {
width: 490px;
}
.w-e-bar-item-group .w-e-bar-item-menus-container {
margin-top: 30px;
}
cursor: pointer;
height: 30px;
line-height: 30px;
font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
font-weight: 400;
font-style: normal;
font-size: 14px;
color: #000000;
line-height: 23px;
margin-right: 40px;
position: relative;
padding: 0 10px;
border-radius: 50px;
> .w-e-bar {
background-color: transparent;
}
.w-e-toolbar {
padding: 0;
// .w-e-bar-item {
// padding: 0 10px;
// }
> .w-e-bar-item {
margin-right: 40px;
> button {
color: #000000;
padding: 0 10px;
}
}
}
.toolbar-item {
.icon {
width: 16px;
height: 16px;
margin-right: 5px;
}
.file {
opacity: 0; /* 隐藏输入框 */
background: transparent;
border: none;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
cursor: pointer;
height: 30px !important;
line-height: 30px !important;
font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
font-weight: 400;
font-style: normal;
font-size: 14px;
color: #000000;
line-height: 23px;
margin-right: 40px;
position: relative;
padding: 0;
&::after {
content: "";
width: 100%;
height: 100%;
> button {
padding: 0 10px;
border-radius: 50px;
&.active {
background-color: rgba(246, 246, 189, 1);
}
}
.file {
opacity: 0; /* 隐藏输入框 */
background: transparent;
border: none;
position: absolute;
top: 0;
left: 0;
}
}
&.expression.pitch {
.emoji-box-mask {
display: block;
}
.emoji-box {
display: flex;
}
}
.link-box-mask,
.emoji-box-mask {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
// background-color: rgba(0, 0, 0, 0.20392157);
display: none;
}
.link-box-mask {
background: transparent;
}
.emoji-box {
width: 582px;
border-radius: 8px;
background-color: #fff;
filter: drop-shadow(0 0 11px rgba(0, 0, 0, 0.1));
top: 45px;
position: absolute;
z-index: 1;
left: 50%;
transform: translateX(-50%);
border: 1px solid #ebebeb;
display: none;
flex-wrap: wrap;
font-size: 22px;
padding: 8px;
&::after {
content: "";
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 8px solid #ffffff;
position: absolute;
top: -8px;
left: 50%;
transform: translateX(-50%);
}
.emoji-icon {
margin: 5px;
width: 100%;
height: 100%;
cursor: pointer;
}
}
&.link {
&.pitch {
.link-box-mask {
&::after {
content: "";
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
}
&.expression.pitch {
.emoji-box-mask {
display: block;
}
.link-box {
.emoji-box {
display: flex;
}
}
.link-box {
background-color: rgba(255, 255, 255, 1);
border-radius: 6px;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.168627450980392);
width: 336px;
height: 282px;
position: absolute;
top: 30px;
left: 0%;
.link-box-mask,
.emoji-box-mask {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
// background-color: rgba(0, 0, 0, 0.20392157);
display: none;
}
.link-box-mask {
background: transparent;
}
.emoji-box {
width: 582px;
border-radius: 8px;
background-color: #fff;
filter: drop-shadow(0 0 11px rgba(0, 0, 0, 0.1));
top: 45px;
position: absolute;
z-index: 1;
left: 50%;
transform: translateX(-50%);
border: 1px solid #ebebeb;
display: none;
flex-direction: column;
padding: 18px 20px 0;
flex-wrap: wrap;
font-size: 22px;
padding: 8px;
.item {
margin-bottom: 22px;
flex-direction: column;
.name {
font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
font-weight: 400;
font-style: normal;
font-size: 14px;
color: #555555;
line-height: 26px;
margin-bottom: 8px;
&::after {
content: "";
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 8px solid #ffffff;
position: absolute;
top: -8px;
left: 50%;
transform: translateX(-50%);
}
.emoji-icon {
margin: 5px;
cursor: pointer;
}
}
&.link {
&.pitch {
.link-box-mask {
display: block;
}
.input {
height: 36px;
border: 1px solid rgba(215, 215, 215, 1);
border-radius: 7px;
padding: 0 10px;
font-size: 14px;
color: #000000;
.link-box {
display: flex;
}
}
.btn {
width: 72px;
height: 40px;
line-height: 40px;
background-color: rgba(80, 227, 194, 1);
border-radius: 8px;
margin-left: auto;
font-family: "PingFangSC-Semibold", "PingFang SC Semibold", "PingFang SC", sans-serif;
font-weight: 650;
font-style: normal;
font-size: 16px;
color: #000000;
margin-top: 8px;
&:hover {
background-color: rgb(35, 224, 182);
.link-box {
background-color: rgba(255, 255, 255, 1);
border-radius: 6px;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.168627450980392);
width: 336px;
height: 282px;
position: absolute;
top: 30px;
left: 0%;
z-index: 1;
border: 1px solid #ebebeb;
display: none;
flex-direction: column;
padding: 18px 20px 0;
.item {
margin-bottom: 22px;
flex-direction: column;
.name {
font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
font-weight: 400;
font-style: normal;
font-size: 14px;
color: #555555;
line-height: 26px;
margin-bottom: 8px;
}
.input {
height: 36px;
border: 1px solid rgba(215, 215, 215, 1);
border-radius: 7px;
padding: 0 10px;
font-size: 14px;
color: #000000;
}
}
.btn {
width: 72px;
height: 40px;
line-height: 40px;
background-color: rgba(80, 227, 194, 1);
border-radius: 8px;
margin-left: auto;
font-family: "PingFangSC-Semibold", "PingFang SC Semibold", "PingFang SC", sans-serif;
font-weight: 650;
font-style: normal;
font-size: 16px;
color: #000000;
margin-top: 8px;
&:hover {
background-color: rgb(35, 224, 182);
}
}
}
}
&.h2 {
&.pitch {
background-color: rgba(246, 246, 189, 1);
}
}
&.active {
> button {
background-color: rgba(246, 246, 189, 1);
}
}
}
}
&.h2 {
&.pitch {
background-color: rgba(246, 246, 189, 1);
}
#editor-container {
min-height: 500px;
max-height: 80vh;
font-size: 18px;
line-height: 26px;
color: #333333;
a {
font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
text-decoration: underline;
color: #04b0d5;
}
}
}

View File

@@ -109,15 +109,18 @@
height: 26px;
border-radius: 50%;
}
#appIndex .header-content-box .header-content-left .topic-and-selectives .topic-box .topic-head .people .right .item:nth-child(6) {
margin-right: -9px;
}
#appIndex .header-content-box .header-content-left .topic-and-selectives .topic-box .topic-head .people .right .item:nth-child(5) {
margin-right: -9px;
}
#appIndex .header-content-box .header-content-left .topic-and-selectives .topic-box .topic-head .people .right .item:nth-child(4) {
margin-right: -9px;
}
#appIndex .header-content-box .header-content-left .topic-and-selectives .topic-box .topic-head .people .right .item:nth-child(3) {
margin-right: -9px;
}
#appIndex .header-content-box .header-content-left .topic-and-selectives .topic-box .topic-head .people .right .item:nth-child(2) {
margin-right: -7px;
}
#appIndex .header-content-box .header-content-left .topic-and-selectives .topic-box .topic-head .people .right .item:nth-child(2) {
margin-right: -5px;
}
#appIndex .header-content-box .header-content-left .topic-and-selectives .topic-box .topic-list .item {
cursor: pointer;
}

View File

@@ -125,17 +125,18 @@
border-radius: 50%;
}
&:nth-child(6) {
margin-right: -9px;
}
&:nth-child(5) {
margin-right: -9px;
}
&:nth-child(4) {
margin-right: -9px;
}
&:nth-child(3) {
margin-right: -9px;
}
&:nth-child(2) {
margin-right: -7px;
}
&:nth-child(2) {
margin-right: -5px;
}
}
}
}

View File

@@ -3,7 +3,6 @@
padding: 0;
box-sizing: border-box;
font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
font-weight: 400;
font-style: normal;
word-break: break-word;
}

View File

@@ -3,7 +3,7 @@
padding: 0;
box-sizing: border-box;
font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
font-weight: 400;
// font-weight: 400;
font-style: normal;
word-break: break-word;
}