docs: update doc

pull/1849/head
tangjinzhou 2020-03-03 21:49:34 +08:00
parent b2b500f70e
commit e7ff6d6602
3 changed files with 77 additions and 61 deletions

View File

@ -13,29 +13,9 @@
<section class="code-box-meta markdown"> <section class="code-box-meta markdown">
<slot v-if="isZhCN" name="description" /> <slot v-if="isZhCN" name="description" />
<slot v-else name="us-description" /> <slot v-else name="us-description" />
<a-tooltip :title="codeExpand ? 'Hide Code' : 'Show Code'"> <div class="code-box-actions">
<span class="code-expand-icon">
<img
width="16"
alt="expand code"
src="https://gw.alipayobjects.com/zos/rmsportal/wSAkBuJFbdxsosKKpqyq.svg"
:class="codeExpand ? 'code-expand-icon-hide' : 'code-expand-icon-show'"
@click="handleCodeExpand"
/>
<img
width="16"
alt="expand code"
src="https://gw.alipayobjects.com/zos/rmsportal/OpROPHYqWmrMDBFMZtKF.svg"
:class="codeExpand ? 'code-expand-icon-show' : 'code-expand-icon-hide'"
@click="handleCodeExpand"
/>
</span>
</a-tooltip>
</section>
<transition appear :css="false" @enter="enter" @leave="leave">
<section v-show="codeExpand" class="highlight-wrapper" style="position: relative;">
<a-tooltip <a-tooltip
:title="copied ? '复制成功' : '复制代码'" :title="copied ? 'Copied!' : 'Copy code'"
:visible="copyTooltipVisible" :visible="copyTooltipVisible"
@visibleChange="onCopyTooltipVisibleChange" @visibleChange="onCopyTooltipVisibleChange"
> >
@ -46,6 +26,28 @@
class="code-box-code-copy" class="code-box-code-copy"
/> />
</a-tooltip> </a-tooltip>
<a-tooltip :title="codeExpand ? 'Hide Code' : 'Show Code'">
<span class="code-expand-icon">
<img
width="16"
alt="expand code"
src="https://gw.alipayobjects.com/zos/rmsportal/wSAkBuJFbdxsosKKpqyq.svg"
:class="codeExpand ? 'code-expand-icon-hide' : 'code-expand-icon-show'"
@click="handleCodeExpand"
/>
<img
width="16"
alt="expand code"
src="https://gw.alipayobjects.com/zos/rmsportal/OpROPHYqWmrMDBFMZtKF.svg"
:class="codeExpand ? 'code-expand-icon-show' : 'code-expand-icon-hide'"
@click="handleCodeExpand"
/>
</span>
</a-tooltip>
</div>
</section>
<transition appear :css="false" @enter="enter" @leave="leave">
<section v-show="codeExpand" class="highlight-wrapper" style="position: relative;">
<slot name="code" /> <slot name="code" />
</section> </section>
</transition> </transition>

View File

@ -56,19 +56,14 @@ pre > code[class*='language-'] {
position: absolute; position: absolute;
top: -14px; top: -14px;
padding: 1px 8px; padding: 1px 8px;
margin-left: -8px; margin-left: 16px;
color: #777; color: #777;
border-radius: 2px 2px 0 0; border-radius: 2px 2px 0 0;
background: #fff; background: #fff;
font-size: 14px; font-size: 14px;
width: auto; width: auto;
} }
.code-box-code-copy {
opacity: 1;
position: absolute;
right: 15px;
top: 10px;
}
#search-box { #search-box {
.ant-select-focused, .ant-select-focused,
.ant-select-selection, .ant-select-selection,

View File

@ -73,11 +73,10 @@
&-meta { &-meta {
&.markdown { &.markdown {
position: relative; position: relative;
padding: 18px 32px;
border-radius: 0 0 @border-radius-sm @border-radius-sm;
transition: background-color 0.4s;
width: 100%; width: 100%;
font-size: @font-size-base; font-size: @font-size-base;
border-radius: 0 0 @border-radius-sm @border-radius-sm;
transition: background-color 0.4s;
} }
blockquote { blockquote {
@ -93,7 +92,7 @@
> p { > p {
font-size: 12px; font-size: 12px;
margin: 0.5em 0; margin: 0.5em 0;
padding-right: 25px; padding: 18px 24px 12px;
width: 100%; width: 100%;
word-break: break-word; word-break: break-word;
} }
@ -105,28 +104,20 @@
} }
.code-expand-icon { .code-expand-icon {
position: absolute;
right: 16px;
bottom: 23px;
cursor: pointer; cursor: pointer;
width: 16px;
height: 16px;
line-height: 16px;
text-align: center;
} }
.code-expand-icon-show, .code-expand-icon-show,
.code-expand-icon-hide { .code-expand-icon-hide {
position: absolute;
top: 0;
left: 0;
width: 100%;
max-width: 100%;
margin: 0;
box-shadow: none;
transition: all 0.4s; transition: all 0.4s;
user-select: none; user-select: none;
position: absolute;
left: 0;
top: 0;
margin: 0;
max-width: 100%;
width: 100%;
vertical-align: baseline;
box-shadow: none;
} }
.code-expand-icon-show { .code-expand-icon-show {
@ -169,29 +160,57 @@
} }
&-actions { &-actions {
position: absolute; padding-top: 12px;
top: 10px; text-align: center;
right: 12px; border-top: 1px dashed @site-border-color-split;
text-align: right; opacity: 0.7;
transition: opacity 0.3s;
&:hover {
opacity: 1;
}
> i, > i,
> form { > form,
> span {
position: relative;
display: inline-block; display: inline-block;
margin-left: 8px; width: 16px;
height: 16px;
margin-left: 16px;
vertical-align: top;
&:first-child {
margin-left: 0;
}
}
> form {
top: -2px;
} }
} }
&-code-copy { &-code-action {
font-size: 14px;
cursor: pointer;
color: @site-text-color-secondary;
transition: all 0.24s;
background: #fff;
width: 20px; width: 20px;
height: 20px; height: 20px;
color: @site-text-color-secondary;
font-size: 16px;
line-height: 18px;
cursor: pointer;
transition: all 0.24s;
}
&-code-copy {
width: 20px;
height: 20px;
color: @site-text-color-secondary;
font-size: 14px;
line-height: 20px; line-height: 20px;
text-align: center; text-align: center;
background: #fff;
border-radius: 20px; border-radius: 20px;
opacity: 0; cursor: pointer;
transition: all 0.24s;
&:hover { &:hover {
color: @site-text-color-secondary; color: @site-text-color-secondary;