Skip to content

Commit c4346ea

Browse files
committed
1. HTML 编辑器加入当前主题样式
2. 粘贴图片自动上传
1 parent 08ac157 commit c4346ea

File tree

79 files changed

+777
-466
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+777
-466
lines changed

Easy.CMS.Web/Content/themes/Admin/admin.css

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* http://www.zkea.net/
3-
* Copyright 2016 ZKEASOFT
3+
* Copyright 2017 ZKEASOFT
44
* http://www.zkea.net/licenses
55
*/
66

@@ -31,16 +31,70 @@ img {
3131
padding-right: 15px;
3232
}
3333

34-
@media (min-width: 1300px) {
34+
.form-horizontal .control-label {
35+
display: block;
36+
text-align: right;
37+
}
38+
39+
@media (max-width:1199px) {
40+
.form-horizontal .control-label {
41+
padding-top: 0;
42+
margin-bottom: 7px;
43+
text-align: left;
44+
}
45+
}
46+
47+
.field-validation-error {
48+
top: 10px;
49+
position: relative;
50+
display: block;
51+
background: #ca2026;
52+
color: white;
53+
padding: .5rem;
54+
font-size: 14px;
55+
}
56+
57+
.field-validation-error:before {
58+
content: " ";
59+
display: block;
60+
border-top: 2px solid transparent;
61+
border-left: 8px solid transparent;
62+
border-right: 8px solid transparent;
63+
border-bottom: 8px solid #ca2026;
64+
position: absolute;
65+
left: 10px;
66+
top: -10px;
67+
}
68+
69+
@media (min-width: 1440px) {
3570
.form-horizontal {
36-
width: 70%;
71+
width: 85%;
3772
}
3873
}
3974

4075

4176
.input-group .form-control {
4277
position: static;
4378
}
79+
.input-group.loading::before {
80+
display: block;
81+
content: " ";
82+
position: absolute;
83+
height: 2px;
84+
bottom: 0;
85+
left: 0;
86+
width: 0;
87+
background: red;
88+
}
89+
90+
.input-group.loading.processing::before {
91+
width: 100%;
92+
transition: width 2s;
93+
}
94+
95+
.form-control.required {
96+
background-color: #fff0dd;
97+
}
4498

4599
a.badge:hover {
46100
background-color: #1F1F1F;
@@ -275,7 +329,8 @@ a.badge:hover {
275329
content: " [未发布]";
276330
}
277331

278-
.jstree a[ishomepage="true"] {
332+
.jstree a[ishomepage="true"],
333+
.jstree a[url="~/index"] {
279334
font-weight: bold;
280335
color: red;
281336
}
@@ -308,10 +363,6 @@ a.badge:hover {
308363
.ui-draggable-dragging {
309364
z-index: 1;
310365
}
311-
312-
.simplePreview {
313-
}
314-
315366
.simplePreview .simpleDesign .panel {
316367
margin: 5px;
317368
}

Easy.CMS.Web/Content/themes/Admin/admin.min.css

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Easy.CMS.Web/Content/themes/Admin/script/admin.js

Lines changed: 64 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ $(function () {
115115
});
116116
}
117117
});
118-
})
119-
.on("submit", "form", function () {
120-
Easy.Block();
121-
});
118+
}).on("submit", "form", function () {
119+
Easy.Block();
120+
});
121+
122122
$(".form-group select#ZoneID,.form-group select.select").on("mousedown", false);
123123

124124
var mainMenu = $("#main-menu");
@@ -210,7 +210,49 @@ $(function () {
210210
return null;
211211
},
212212
placement: "bottom"
213-
});
213+
}).parent().addClass("loading");;
214+
215+
if (document.addEventListener) {
216+
document.addEventListener("paste", function (e) {
217+
if (e.target.className && e.target.className.indexOf("select-image") >= 0) {
218+
var target = e.target;
219+
var cbData;
220+
if (e.clipboardData) {
221+
cbData = e.clipboardData;
222+
} else if (window.clipboardData) {
223+
cbData = window.clipboardData;
224+
}
225+
if (cbData && cbData.items) {
226+
for (var i = 0; i < cbData.items.length; i++) {
227+
if (cbData.items[i].type.indexOf('image') !== -1) {
228+
target.parentNode.className = target.parentNode.className + " processing";
229+
target.value = "图片上传中...";
230+
var file = cbData.items[i].getAsFile();
231+
var xhr = new XMLHttpRequest();
232+
xhr.open("POST", "/admin/media/Upload");
233+
xhr.onload = function (data) {
234+
target.parentNode.className = target.parentNode.className.replace(" processing", "");
235+
var result = JSON.parse(data.target.response);
236+
if (result.ID) {
237+
target.value = "~" + result.Url;
238+
$(target).blur().focus();
239+
}
240+
}
241+
xhr.onerror = function () {
242+
target.parentNode.className = target.parentNode.className.replace(" processing", "");
243+
target.value = "图片上传失败";
244+
}
245+
var formData = new FormData();
246+
formData.append('file', file);
247+
formData.append("folder", "图片");
248+
xhr.send(formData);
249+
break;
250+
}
251+
}
252+
}
253+
}
254+
});
255+
}
214256

215257
$(".input-group .glyphicon.glyphicon-play").popover({
216258
trigger: "click",
@@ -229,21 +271,23 @@ $(function () {
229271
placement: "left"
230272
});
231273

232-
tinymce.init({
233-
content_css: ["//cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css", "//cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css"],
234-
selector: "textarea.html",
235-
verify_html: false,
236-
plugins: [
237-
"advlist autolink lists link image charmap print preview anchor",
238-
"searchreplace visualblocks code fullscreen",
239-
"insertdatetime media table contextmenu paste",
240-
"filebrowser textcolor hr",
241-
"bootstrap"
242-
],
243-
toolbar: "insertfile undo redo | styleselect | bold italic forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | filebrowser",
244-
height: 300,
245-
relative_urls: false,
246-
language_url: "http://cdn.zkeasoft.com/Scripts/tinymce/langs/zh_CN.js"
274+
$.post("/admin/Theme/GetCurrentTheme", function (theme) {
275+
tinymce.init({
276+
content_css: [theme],
277+
selector: "textarea.html",
278+
verify_html: false,
279+
plugins: [
280+
"advlist autolink lists link image charmap print preview anchor",
281+
"searchreplace visualblocks code fullscreen",
282+
"insertdatetime media table contextmenu paste",
283+
"filebrowser textcolor hr",
284+
"bootstrap pasteImage"
285+
],
286+
toolbar: "insertfile undo redo | styleselect | bold italic forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | filebrowser",
287+
height: 300,
288+
relative_urls: false,
289+
language: "zh_CN"
290+
});
247291
});
248292

249293
$("#main-menu").slimscroll({ height: $(window).height() - 170 });

0 commit comments

Comments
 (0)