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

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