更新
This commit is contained in:
parent
db5f2fcba5
commit
e3871dec10
@ -9,9 +9,49 @@ class Editor
|
|||||||
{
|
{
|
||||||
public static function edit()
|
public static function edit()
|
||||||
{
|
{
|
||||||
echo "<link rel='stylesheet' href='" . Helper::options()->themeUrl . '/typecho/editor/joe.editor.css' . "'>";
|
echo "<link rel='stylesheet' href='" . Helper::options()->themeUrl . '/typecho/editor/joe.editor.css' . "'>\n";
|
||||||
echo "<script src='" . Helper::options()->themeUrl . '/typecho/editor/joe.extend.js' . "'></script>";
|
echo "<script src='" . Helper::options()->themeUrl . '/typecho/editor/joe.extend.js' . "'></script>\n";
|
||||||
echo "<script src='" . Helper::options()->themeUrl . '/typecho/editor/joe.editor.js' . "'></script>";
|
echo "<script src='" . Helper::options()->themeUrl . '/typecho/editor/joe.editor.js' . "'></script>\n";
|
||||||
|
if (Helper::options()->JPasteUpload === "on") { ?>
|
||||||
|
<script>
|
||||||
|
$("#text").on("paste", event => {
|
||||||
|
let clipboardData = event.clipboardData || window.clipboardData || event.originalEvent.clipboardData;
|
||||||
|
if (!clipboardData || !clipboardData.items) return;
|
||||||
|
let items = clipboardData.items;
|
||||||
|
let file = null;
|
||||||
|
if (items.length === 0) return;
|
||||||
|
for (let i = 0; i < items.length; i++) {
|
||||||
|
if (items[i].kind === 'file' && items[i].type.match(/^image/)) {
|
||||||
|
event.preventDefault(), file = items[i].getAsFile()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!file) return;
|
||||||
|
let uploadUrl = '<?php Helper::security()->index('/action/upload'); ?>';
|
||||||
|
($('input[name="cid"]').val()) && (uploadUrl = uploadUrl + '&cid=' + cid);
|
||||||
|
let random = Date.now().toString(36);
|
||||||
|
let fileName = random + '.png'
|
||||||
|
let uploadText = '[图片上传中...(' + random + ')]';
|
||||||
|
$('#text').insertContent(uploadText)
|
||||||
|
let formData = new FormData();
|
||||||
|
formData.append('name', fileName);
|
||||||
|
formData.append('file', file, fileName);
|
||||||
|
$.ajax({
|
||||||
|
method: 'post',
|
||||||
|
url: uploadUrl,
|
||||||
|
data: formData,
|
||||||
|
contentType: false,
|
||||||
|
processData: false,
|
||||||
|
success(res) {
|
||||||
|
$("#text").val($("#text").val().replace(uploadText, '![' + res[1].title + '](' + res[0] + ')'))
|
||||||
|
},
|
||||||
|
error() {
|
||||||
|
$("#text").val($("#text").val().replace(uploadText, '[图片上传失败!(' + random + ')]'))
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
/* 获取主题当前版本号 */
|
/* 获取主题当前版本号 */
|
||||||
function _getVersion()
|
function _getVersion()
|
||||||
{
|
{
|
||||||
return "5.2.7";
|
return "5.2.8";
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 判断是否是手机 */
|
/* 判断是否是手机 */
|
||||||
|
@ -734,6 +734,17 @@ function themeConfig($form)
|
|||||||
$JLimitOneChinese->setAttribute('class', 'joe_content joe_other');
|
$JLimitOneChinese->setAttribute('class', 'joe_content joe_other');
|
||||||
$form->addInput($JLimitOneChinese->multiMode());
|
$form->addInput($JLimitOneChinese->multiMode());
|
||||||
|
|
||||||
|
$JPasteUpload = new Typecho_Widget_Helper_Form_Element_Select(
|
||||||
|
'JPasteUpload',
|
||||||
|
array('off' => '关闭(默认)', 'on' => '开启'),
|
||||||
|
'off',
|
||||||
|
'是否开启编辑器粘贴上传图片功能',
|
||||||
|
'介绍:开启后文章编辑器将拥有图片上传功能 <br />
|
||||||
|
其他:Typecho开发版已实现粘贴上传,如果您使用的是开发版,请关闭此项'
|
||||||
|
);
|
||||||
|
$JPasteUpload->setAttribute('class', 'joe_content joe_other');
|
||||||
|
$form->addInput($JPasteUpload->multiMode());
|
||||||
|
|
||||||
$JBaiduToken = new Typecho_Widget_Helper_Form_Element_Text(
|
$JBaiduToken = new Typecho_Widget_Helper_Form_Element_Text(
|
||||||
'JBaiduToken',
|
'JBaiduToken',
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -1 +1 @@
|
|||||||
table.typecho-list-table textarea[name='fields[thumb]'],table.typecho-list-table textarea[name='fields[abstract]'],table.typecho-list-table textarea[name='fields[description]'],table.typecho-list-table textarea[name='fields[video]']{width:100%;height:80px}table.typecho-list-table input[name='fields[keywords]']{width:100%}#wmd-button-row{height:auto}#wmd-button-row .wmd-button .icon{width:20px;height:20px;vertical-align:middle;fill:#9b9b9b}.joe_owo__contain{position:relative}.joe_owo__contain *{box-sizing:border-box}.joe_owo__contain .seat{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}.joe_owo__contain .box{position:absolute;top:30px;left:0;width:300px;background:#fff;box-shadow:0px 0px 20px -5px rgba(158,158,158,0.22);border-radius:4px;overflow:hidden;visibility:hidden;-webkit-transform:scale(0.5);transform:scale(0.5);opacity:0;transition:visibility, 0.35s, opacity 0.35s, -webkit-transform 0.35s;transition:visibility, 0.35s, opacity 0.35s, transform 0.35s;transition:visibility, 0.35s, opacity 0.35s, transform 0.35s, -webkit-transform 0.35s}.joe_owo__contain .box.show{visibility:visible;-webkit-transform:scale(1);transform:scale(1);opacity:1}.joe_owo__contain .box .scroll{display:none;max-height:200px;overflow-y:auto;-ms-scroll-chaining:none;overscroll-behavior:none;padding:5px}.joe_owo__contain .box .scroll::-webkit-scrollbar{width:8px;height:8px}.joe_owo__contain .box .scroll::-webkit-scrollbar-thumb{border-radius:4px;background:#c0c4cc}.joe_owo__contain .box .scroll::-webkit-scrollbar-track{background:transparent}.joe_owo__contain .box .scroll:nth-child(3) .item{text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:50%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.joe_owo__contain .box .scroll .item{width:20%;display:inline-block;padding:5px;cursor:pointer;border-radius:4px;transition:background 0.25s;margin:0}.joe_owo__contain .box .scroll .item img{max-width:100%;max-height:100%}.joe_owo__contain .box .scroll .item:hover{background:#f2f6fc}.joe_owo__contain .box .bar{display:flex;align-items:center;border-top:1px solid #f2f6fc}.joe_owo__contain .box .bar .item{line-height:30px;padding:0 10px;cursor:pointer;color:var(--routine);transition:background 0.25s}.joe_owo__contain .box .bar .item.active{background:#f2f6fc}
|
table.typecho-list-table textarea[name='fields[thumb]'],table.typecho-list-table textarea[name='fields[abstract]'],table.typecho-list-table textarea[name='fields[description]'],table.typecho-list-table textarea[name='fields[video]']{width:100%;height:80px}table.typecho-list-table input[name='fields[keywords]']{width:100%}body.fullscreen{overflow-x:hidden}#wmd-button-row{height:auto}#wmd-button-row .wmd-button .icon{width:20px;height:20px;vertical-align:middle;fill:#9b9b9b}.joe_owo__contain{position:relative}.joe_owo__contain *{box-sizing:border-box}.joe_owo__contain .seat{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}.joe_owo__contain .box{position:absolute;top:30px;left:0;width:300px;background:#fff;box-shadow:0px 0px 20px -5px rgba(158,158,158,0.22);border-radius:4px;overflow:hidden;visibility:hidden;-webkit-transform:scale(0.5);transform:scale(0.5);opacity:0;transition:visibility, 0.35s, opacity 0.35s, -webkit-transform 0.35s;transition:visibility, 0.35s, opacity 0.35s, transform 0.35s;transition:visibility, 0.35s, opacity 0.35s, transform 0.35s, -webkit-transform 0.35s}.joe_owo__contain .box.show{visibility:visible;-webkit-transform:scale(1);transform:scale(1);opacity:1}.joe_owo__contain .box .scroll{display:none;max-height:200px;overflow-y:auto;-ms-scroll-chaining:none;overscroll-behavior:none;padding:5px}.joe_owo__contain .box .scroll::-webkit-scrollbar{width:8px;height:8px}.joe_owo__contain .box .scroll::-webkit-scrollbar-thumb{border-radius:4px;background:#c0c4cc}.joe_owo__contain .box .scroll::-webkit-scrollbar-track{background:transparent}.joe_owo__contain .box .scroll:nth-child(3) .item{text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:50%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.joe_owo__contain .box .scroll .item{width:20%;display:inline-block;padding:5px;cursor:pointer;border-radius:4px;transition:background 0.25s;margin:0}.joe_owo__contain .box .scroll .item img{max-width:100%;max-height:100%}.joe_owo__contain .box .scroll .item:hover{background:#f2f6fc}.joe_owo__contain .box .bar{display:flex;align-items:center;border-top:1px solid #f2f6fc}.joe_owo__contain .box .bar .item{line-height:30px;padding:0 10px;cursor:pointer;color:var(--routine);transition:background 0.25s}.joe_owo__contain .box .bar .item.active{background:#f2f6fc}
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
$(function () {
|
$(function () {
|
||||||
$('#wmd-editarea textarea').attr('placeholder', '请输入文章内容...(支持图片粘贴上传)');
|
$('#wmd-editarea textarea').attr('placeholder', '请输入文章内容...(开启粘贴上传功能后,支持图片粘贴上传哦~)');
|
||||||
$('#wmd-button-bar .wmd-edittab').remove();
|
$('#wmd-button-bar .wmd-edittab').remove();
|
||||||
$('#wmd-button-row .wmd-spacer').remove();
|
$('#wmd-button-row .wmd-spacer').remove();
|
||||||
$('#wmd-button-row #wmd-code-button').remove();
|
$('#wmd-button-row #wmd-code-button').remove();
|
||||||
|
$('#wmd-fullscreen-button').on('click', function () {
|
||||||
|
$('.fullscreen #text').css('top', $('.fullscreen #wmd-button-bar').outerHeight());
|
||||||
|
});
|
||||||
/* 增加自定义功能 */
|
/* 增加自定义功能 */
|
||||||
const items = [
|
const items = [
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,11 @@ table.typecho-list-table {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body.fullscreen {
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
#wmd-button-row {
|
#wmd-button-row {
|
||||||
height: auto;
|
height: auto;
|
||||||
.wmd-button {
|
.wmd-button {
|
||||||
|
Loading…
Reference in New Issue
Block a user