mirror of
https://github.com/typecho/typecho.git
synced 2025-03-25 12:29:43 +01:00
修改编辑预览方式
This commit is contained in:
parent
a453f470d4
commit
5692ff5cb1
@ -903,7 +903,8 @@ a.operate-reply {
|
||||
.typecho-post-area .url-slug {
|
||||
margin-top: -0.5em;
|
||||
color: #AAA;
|
||||
font-size: .92857em; }
|
||||
font-size: .92857em;
|
||||
word-break: break-word; }
|
||||
|
||||
.typecho-post-area #slug {
|
||||
padding: 2px;
|
||||
@ -1191,12 +1192,30 @@ a.operate-reply {
|
||||
background: #E9E9E6;
|
||||
cursor: default; }
|
||||
|
||||
.editor span {
|
||||
#wmd-button-row span {
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background: transparent url(../img/editor.png) no-repeat; }
|
||||
|
||||
.wmd-edittab {
|
||||
float: right;
|
||||
margin-top: 5px;
|
||||
font-size: .92857em; }
|
||||
.wmd-edittab a {
|
||||
display: inline-block;
|
||||
padding: 0 10px;
|
||||
margin-left: 5px;
|
||||
line-height: 20px; }
|
||||
.wmd-edittab a:hover {
|
||||
text-decoration: none; }
|
||||
.wmd-edittab a.active {
|
||||
background: #E9E9E6;
|
||||
color: #999; }
|
||||
|
||||
.wmd-hidetab {
|
||||
display: none; }
|
||||
|
||||
/* 对话框 */
|
||||
.wmd-prompt-background {
|
||||
background-color: #000; }
|
||||
@ -1224,8 +1243,16 @@ a.operate-reply {
|
||||
/* 预览 */
|
||||
#wmd-preview {
|
||||
background: #FFF;
|
||||
padding: 5px 15px;
|
||||
word-wrap: break-word; }
|
||||
margin: 1em 0;
|
||||
padding: 0 15px;
|
||||
border: 1px solid #D9D9D6;
|
||||
word-wrap: break-word;
|
||||
overflow: scroll;
|
||||
-webkit-border-radius: 2px;
|
||||
-moz-border-radius: 2px;
|
||||
-ms-border-radius: 2px;
|
||||
-o-border-radius: 2px;
|
||||
border-radius: 2px; }
|
||||
#wmd-preview img {
|
||||
max-width: 100%; }
|
||||
#wmd-preview code, #wmd-preview pre {
|
||||
@ -1267,7 +1294,12 @@ a.operate-reply {
|
||||
z-index: 999;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box; }
|
||||
box-sizing: border-box;
|
||||
-webkit-border-radius: 0;
|
||||
-moz-border-radius: 0;
|
||||
-ms-border-radius: 0;
|
||||
-o-border-radius: 0;
|
||||
border-radius: 0; }
|
||||
.fullscreen #wmd-button-bar {
|
||||
left: 0;
|
||||
padding: 13px 20px;
|
||||
@ -1278,16 +1310,13 @@ a.operate-reply {
|
||||
left: 0;
|
||||
padding: 20px;
|
||||
border: none;
|
||||
outline: none;
|
||||
-webkit-border-radius: 0;
|
||||
-moz-border-radius: 0;
|
||||
-ms-border-radius: 0;
|
||||
-o-border-radius: 0;
|
||||
border-radius: 0; }
|
||||
outline: none; }
|
||||
.fullscreen #wmd-preview {
|
||||
top: 53px;
|
||||
right: 0;
|
||||
margin: 0;
|
||||
padding: 5px 20px;
|
||||
border: none;
|
||||
border-left: 1px solid #F3F3F0;
|
||||
background: #F6F6F3;
|
||||
overflow: auto; }
|
||||
@ -1298,6 +1327,7 @@ a.operate-reply {
|
||||
margin: 0;
|
||||
padding: 10px 20px;
|
||||
border-bottom: 1px solid #F3F3F0; }
|
||||
.fullscreen .wmd-edittab,
|
||||
.fullscreen .typecho-post-option,
|
||||
.fullscreen .title,
|
||||
.fullscreen .url-slug,
|
||||
@ -1306,6 +1336,8 @@ a.operate-reply {
|
||||
.fullscreen .message,
|
||||
.fullscreen #upload-panel {
|
||||
display: none; }
|
||||
.fullscreen .wmd-hidetab {
|
||||
display: block; }
|
||||
|
||||
/**
|
||||
* Jquery Timepicker
|
||||
|
@ -7,7 +7,7 @@
|
||||
$(document).ready(function () {
|
||||
var textarea = $('#text'),
|
||||
toolbar = $('<div class="editor" id="wmd-button-bar" />').insertBefore(textarea.parent())
|
||||
preview = $('<div id="wmd-preview" />').insertAfter('.submit');
|
||||
preview = $('<div id="wmd-preview" class="wmd-hidetab" />').insertAfter('.editor');
|
||||
|
||||
var options = {};
|
||||
|
||||
@ -196,6 +196,25 @@ $(document).ready(function () {
|
||||
}
|
||||
}, 10);
|
||||
};
|
||||
|
||||
|
||||
// 编辑预览切换
|
||||
var edittab = $('.editor').prepend('<div class="wmd-edittab"><a href="#wmd-editarea" class="active">撰写</a><a href="#wmd-preview">预览</a></div>'),
|
||||
editarea = $(textarea.parent()).attr("id", "wmd-editarea");
|
||||
|
||||
$(".wmd-edittab a").click(function() {
|
||||
$(".wmd-edittab a").removeClass('active');
|
||||
$(this).addClass("active");
|
||||
$("#wmd-editarea, #wmd-preview").addClass("wmd-hidetab");
|
||||
|
||||
var selected_tab = $(this).attr("href"),
|
||||
selected_el = $(selected_tab).removeClass("wmd-hidetab");
|
||||
|
||||
// 预览和编辑窗口高度一致
|
||||
$("#wmd-preview").height($("#text").innerHeight());
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
@ -32,13 +32,38 @@
|
||||
}
|
||||
}
|
||||
|
||||
.editor span {
|
||||
#wmd-button-row span {
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background: transparent url(../img/editor.png) no-repeat;
|
||||
}
|
||||
|
||||
// 撰写预览切换 tab
|
||||
.wmd-edittab {
|
||||
float: right;
|
||||
margin-top: 5px;
|
||||
font-size: .92857em;
|
||||
a {
|
||||
display: inline-block;
|
||||
padding: 0 10px;
|
||||
margin-left: 5px;
|
||||
line-height: 20px;
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
&.active {
|
||||
background: #E9E9E6;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 控制被隐藏的 tab,全屏时显示
|
||||
.wmd-hidetab {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* 对话框 */
|
||||
.wmd-prompt-background {
|
||||
background-color: #000;
|
||||
@ -66,8 +91,12 @@
|
||||
/* 预览 */
|
||||
#wmd-preview {
|
||||
background: #FFF;
|
||||
padding: 5px 15px;
|
||||
margin: 1em 0;
|
||||
padding: 0 15px;
|
||||
border: 1px solid #D9D9D6;
|
||||
word-wrap: break-word;
|
||||
overflow: scroll;
|
||||
@include border-radius(2px);
|
||||
img { max-width: 100%; }
|
||||
code, pre {
|
||||
padding: 2px 4px;
|
||||
@ -115,6 +144,7 @@
|
||||
background: #FFF;
|
||||
z-index: 999;
|
||||
@include box-sizing(border-box);
|
||||
@include border-radius(0);
|
||||
}
|
||||
#wmd-button-bar {
|
||||
left: 0;
|
||||
@ -128,12 +158,13 @@
|
||||
padding: 20px;
|
||||
border: none;
|
||||
outline: none;
|
||||
@include border-radius(0);
|
||||
}
|
||||
#wmd-preview {
|
||||
top: 53px;
|
||||
right: 0;
|
||||
margin: 0;
|
||||
padding: 5px 20px;
|
||||
border: none;
|
||||
border-left: 1px solid #F3F3F0;
|
||||
background: #F6F6F3;
|
||||
overflow: auto;
|
||||
@ -147,6 +178,7 @@
|
||||
padding: 10px 20px;
|
||||
border-bottom: 1px solid #F3F3F0;
|
||||
}
|
||||
.wmd-edittab,
|
||||
.typecho-post-option,
|
||||
.title,
|
||||
.url-slug,
|
||||
@ -154,4 +186,5 @@
|
||||
.typecho-head-nav,
|
||||
.message,
|
||||
#upload-panel { display: none; }
|
||||
.wmd-hidetab { display: block; }
|
||||
}
|
@ -653,6 +653,7 @@ a.operate-reply {
|
||||
margin-top: -0.5em;
|
||||
color: #AAA;
|
||||
font-size: .92857em;
|
||||
word-break: break-word;
|
||||
}
|
||||
.typecho-post-area #slug {
|
||||
padding: 2px;
|
||||
|
@ -185,12 +185,13 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
// 控制附件和参数的转换
|
||||
// 控制选项和附件的切换
|
||||
var fileUploadInit = false;
|
||||
$("#edit-secondary .typecho-option-tabs li").click(function() {
|
||||
$("#edit-secondary .typecho-option-tabs li").removeClass('active');
|
||||
$(this).addClass("active");
|
||||
$(".tab-content").hide();
|
||||
|
||||
var selected_tab = $(this).find("a").attr("href"),
|
||||
selected_el = $(selected_tab).show();
|
||||
|
||||
|
@ -41,11 +41,6 @@ Typecho_Widget::widget('Widget_Contents_Post_Edit')->to($post);
|
||||
<label for="text" class="visuallyhidden"><?php _e('文章内容'); ?></label>
|
||||
<textarea style="height: <?php $options->editorSize(); ?>px" autocomplete="off" id="text" name="text" class="w-100 mono"><?php echo htmlspecialchars($post->text); ?></textarea>
|
||||
</p>
|
||||
|
||||
<!-- <div class="">
|
||||
<a href="###" class="current">撰写</a>
|
||||
<a href="###">预览</a>
|
||||
</div> -->
|
||||
|
||||
<?php include 'custom-fields.php'; ?>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user