zx-editor
Version:
ZxEditor is a HTML5 rich text editor
256 lines (253 loc) • 5.66 kB
text/less
/**
* ******************************************
* Expansion panel
* ******************************************
*/
@import "./config";
@headHeight: 44px;
@bodyHeight: 216px;
.zx-editor .zx-editor-expansion-panel {
position: fixed;
z-index: 9999;
left: 0;
width: 100%;
background-color: #fff;
height: @headHeight + @bodyHeight;
transform: translateY(0);
opacity: 0;
overflow: hidden;
.head-wrapper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: @headHeight;
box-shadow: 0 0 3px rgba(0, 0, 0, .05);
.l {
position: absolute;
top: 0;
padding: 0 10px;
height: 100%;
font-size: .8em;
color: #999;
}
.switch {
position: absolute;
top: 0;
width: @headHeight;
height: @headHeight;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
&:after {
display: inline-block;
content: '';
border-top: 7px solid @iconColor;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
}
}
&.center {
text-align: center;
.l {
left: 0;
}
.switch {
right: 0;
}
}
&.left {
text-align: left;
padding-left: 10px;
.l {
right: @headHeight;
}
.switch {
right: 0;
}
}
&.right {
text-align: right;
padding-right: 10px;
.l {
left: @headHeight;
padding: 0;
}
.switch {
left: 0;
}
}
}
.body-wrapper {
position: absolute;
top: @headHeight;
left: 0;
width: 100%;
height: @bodyHeight;
overflow-x: hidden;
overflow-y: auto;
}
&.in {
animation: .3s zxEditorBottomIn forwards;
}
&.out {
animation: .3s zxEditorBottomOut forwards;
}
/**
* *******************************************
* text-style
* *******************************************
*/
.body-wrapper .text-style-outer-wrapper {
.__style-wrapper {
position: relative;
display: flex;
height: @listHeight;
dd {
position: relative;
flex: 1;
line-height: @listHeight;
text-align: center;
font-size: 1.5em;
&:after {
position: absolute;
top: 0;
right: 0;
height: @listHeight;
content: '';
transform: scaleX(.5);
border-right: 1px solid @borderColor;
}
&:last-child:after {
border-right-width: 0;
}
&.text-align--l, &.text-align--c, &.text-align--r {
&:before {
display: inline-block;
content: '=';
line-height: 15px;
width: 20px;
height: 19px;
border-top: 2px solid #333;
border-bottom: 2px solid #333;
box-sizing: border-box;
overflow: hidden;
}
}
&.text-align--l:before {
text-indent: -10px;
}
&.text-align--c:before {}
&.text-align--r:before {
text-indent: 8px;
}
}
}
.__color-wrapper {
display: flex;
position: relative;
height: @listHeight;
dd {
flex: 1;
position: relative;
height: @listHeight;
display: flex;
justify-content: center;
align-items: center;
i {
position: relative;
display: inline-block;
width: 32px;
height: 32px;
border-radius: 50%;
// overflow: hidden;
&:before, &:after {
content: '';
position: absolute;
width: 26px;
height: 26px;
border-radius: 50%;
}
&:before {
top: -1px;
left: -1px;
border: 4px solid #fff;
}
&:after {
top: 1px;
left: 1px;
border: 2px solid #fff;
}
}
&.active i:before {
display: none;
}
}
}
.__tag-wrapper {
border-top: 5px solid @borderColor;
dd {
position: relative;
margin: 0 20px;
height: @listHeight;
line-height: @listHeight;
text-align: center;
&:after {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
content: '';
border-top: 1px solid @borderColor;
transform: scaleY(.5);
}
&:last-child:after {
border-top: 0;
}
&.__h2 {
font-size: 1.2em;
font-weight: 800 ;
}
&.__h4 {
font-weight: 800 ;
}
&.__blockquote {
&:before {
display: inline-block;
vertical-align: top;
margin: 8px 4px 0 0;
font-size: 2em;
content: '"';
}
}
&.__ul {
&:before {
display: inline-block;
vertical-align: top;
margin-right: 4px;
font-size: 1.5em;
content: '·';
}
}
i {
display: none;
position: absolute;
z-index: 1;
top: 18px;
right: 30px;
width: 14px;
height: 8px;
transform: rotate(-45deg);
border-left: 2px solid @primaryColor;
border-bottom: 2px solid @primaryColor;
}
&.active {
i {
display: inline-block;
}
}
}
}
}
}