migrate to new git
This commit is contained in:
146
web/admin/ckeditor/plugins/EzTemplates/dialogs/EzTemplates.js
Normal file
146
web/admin/ckeditor/plugins/EzTemplates/dialogs/EzTemplates.js
Normal file
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
|
||||
modified by eztrust, yiming
|
||||
*/
|
||||
(function () {
|
||||
function setHtml(a) {
|
||||
var r, h;
|
||||
if (a.id) {
|
||||
r = "<link href=\"" + a.css + "\" rel=\"stylesheet\" />";
|
||||
h = "";
|
||||
$.ajax({
|
||||
async: false,
|
||||
dataType: "text",
|
||||
url: a.htmlsrc,
|
||||
data: {},
|
||||
success: function (data) {
|
||||
h = data;
|
||||
}
|
||||
});
|
||||
r += h;
|
||||
} else {
|
||||
r = a.html;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
CKEDITOR.dialog.add("EzTemplatesDialog", function (c) {
|
||||
function o(a, b) {
|
||||
var k = CKEDITOR.dom.element.createFromHtml('<a href="javascript:void(0)" tabIndex="-1" role="option" ><div class="cke_tpl_item"></div></a>'), d = '<table style="width:100%;" class="cke_tpl_preview" role="presentation"><tr>';
|
||||
a.image && b && (d += '<td class="cke_tpl_preview_img"><img src="' + CKEDITOR.getUrl(b + a.image) + '"' + (CKEDITOR.env.ie6Compat ? ' onload="this.width=this.width"' : "") + ' alt="" title=""></td>');
|
||||
d += '<td style="white-space:normal;"><span class="cke_tpl_title">' +
|
||||
a.title + "</span><br/>";
|
||||
a.description && (d += "<span>" + a.description + "</span>");
|
||||
k.getFirst().setHtml(d + "</td></tr></table>");
|
||||
k.on("click", function () {
|
||||
//ez:get html src
|
||||
a.html = setHtml(a);
|
||||
p(a.html);
|
||||
});
|
||||
return k
|
||||
}
|
||||
function p(a) {
|
||||
var b = CKEDITOR.dialog.getCurrent();
|
||||
var element = c.document.createElement('div');
|
||||
element.setHtml(a);
|
||||
b.getValueOf("selectTpl", "chkInsertOpt") ? (c.fire("saveSnapshot"), c.setData(a, function () {
|
||||
b.hide();
|
||||
var a = c.createRange();
|
||||
a.moveToElementEditStart(c.editable());
|
||||
a.select();
|
||||
setTimeout(function () {
|
||||
c.fire("saveSnapshot")
|
||||
}, 0)
|
||||
})) : (c.insertElement(element), b.hide())
|
||||
}
|
||||
function i(a) {
|
||||
var b = a.data.getTarget(),
|
||||
c = g.equals(b);
|
||||
if (c || g.contains(b)) {
|
||||
var d = a.data.getKeystroke(), f = g.getElementsByTag("a"), e;
|
||||
if (f) {
|
||||
if (c)
|
||||
e = f.getItem(0);
|
||||
else
|
||||
switch (d) {
|
||||
case 40:
|
||||
e = b.getNext();
|
||||
break;
|
||||
case 38:
|
||||
e = b.getPrevious();
|
||||
break;
|
||||
case 13:
|
||||
case 32:
|
||||
b.fire("click")
|
||||
}
|
||||
e && (e.focus(), a.data.preventDefault())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var h = CKEDITOR.plugins.get("EzTemplates");
|
||||
CKEDITOR.document.appendStyleSheet(CKEDITOR.getUrl(h.path + "dialogs/templates.css"));
|
||||
var g, h = "cke_tpl_list_label_" + CKEDITOR.tools.getNextNumber(), f = c.lang.templates, l = c.config;
|
||||
return {
|
||||
title: c.lang.templates.title,
|
||||
width: 800,
|
||||
minwidth: CKEDITOR.env.ie ? 440 : 400,
|
||||
minHeight: 340,
|
||||
contents:
|
||||
[{
|
||||
id: "selectTpl",
|
||||
label: f.title,
|
||||
elements: [{
|
||||
type: "vbox",
|
||||
padding: 5,
|
||||
children: [
|
||||
{
|
||||
type: 'html',
|
||||
id: 'kind',
|
||||
attributes: { 'class': 'my_style' },
|
||||
onChange: function () {
|
||||
$.setList($.getList($("#templatesKind option:selected").val()));
|
||||
loadTemplates();
|
||||
},
|
||||
html: '<div class="ck_kindBox">範本分類<select id="templatesKind">' + $.setKinds($.getKind()) + '</select>' + f.selectPromptMsg + '</div>'
|
||||
},
|
||||
{ id: "templatesList", type: "html", focus: !0, html: '<div class="cke_tpl_list" tabIndex="-1" role="listbox" aria-labelledby="' + h + '"><div class="cke_tpl_loading"><span></span></div></div><span class="cke_voice_label" id="' + h + '">' + f.options + "</span>" },
|
||||
{ id: "chkInsertOpt", type: "checkbox", label: f.insertOption, "default": l.templates_replaceContent}
|
||||
|
||||
]
|
||||
}]
|
||||
}],
|
||||
buttons: [CKEDITOR.dialog.cancelButton],
|
||||
onShow: function () {
|
||||
loadTemplates();
|
||||
},
|
||||
onHide: function () {
|
||||
this._.element.removeListener("keydown", i)
|
||||
}
|
||||
}
|
||||
|
||||
function loadTemplates() {
|
||||
var a = CKEDITOR.dialog.getCurrent().getContentElement("selectTpl", "templatesList");
|
||||
g = a.getElement();
|
||||
CKEDITOR.loadTemplates(l.templates_files, function () {
|
||||
var b = (l.templates || "default").split(",");
|
||||
if (b.length) {
|
||||
var c = g;
|
||||
c.setHtml("");
|
||||
for (var d = 0, h = b.length; d < h; d++)
|
||||
for (var e = CKEDITOR.getTemplates(b[d]), i = e.imagesPath, e = e.templates, n = e.length, j = 0; j < n; j++) {
|
||||
var m = o(e[j], i);
|
||||
m.setAttribute("aria-posinset", j + 1);
|
||||
m.setAttribute("aria-setsize",
|
||||
n);
|
||||
c.append(m)
|
||||
}
|
||||
a.focus()
|
||||
} else
|
||||
g.setHtml('<div class="cke_tpl_empty"><span>' + f.emptyListMsg + "</span></div>")
|
||||
});
|
||||
CKEDITOR.dialog.getCurrent()._.element.on("keydown", i)
|
||||
}
|
||||
})
|
||||
})();
|
||||
123
web/admin/ckeditor/plugins/EzTemplates/dialogs/templates.css
Normal file
123
web/admin/ckeditor/plugins/EzTemplates/dialogs/templates.css
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
.cke_tpl_list
|
||||
{
|
||||
border: #dcdcdc 2px solid;
|
||||
background-color: #ffffff;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
width: 100%;
|
||||
height: 340px;
|
||||
}
|
||||
|
||||
.cke_tpl_item
|
||||
{
|
||||
margin: 5px;
|
||||
padding: 7px;
|
||||
border: #eeeeee 1px solid;
|
||||
*width: 88%;
|
||||
}
|
||||
|
||||
.cke_tpl_preview
|
||||
{
|
||||
border-collapse: separate;
|
||||
text-indent:0;
|
||||
width: 100%;
|
||||
}
|
||||
.cke_tpl_preview td
|
||||
{
|
||||
padding: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.cke_tpl_preview .cke_tpl_preview_img
|
||||
{
|
||||
width: 100px;
|
||||
}
|
||||
.cke_tpl_preview span
|
||||
{
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.cke_tpl_title
|
||||
{
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.cke_tpl_list a:hover .cke_tpl_item,
|
||||
.cke_tpl_list a:focus .cke_tpl_item,
|
||||
.cke_tpl_list a:active .cke_tpl_item
|
||||
{
|
||||
border: #ff9933 1px solid;
|
||||
background-color: #fffacd;
|
||||
}
|
||||
|
||||
.cke_tpl_list a:hover *,
|
||||
.cke_tpl_list a:focus *,
|
||||
.cke_tpl_list a:active *
|
||||
{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* IE Quirks contextual selectors children will not get :hover transition until
|
||||
the hover style of the link itself contains certain CSS declarations. */
|
||||
.cke_browser_quirks .cke_tpl_list a:active,
|
||||
.cke_browser_quirks .cke_tpl_list a:hover,
|
||||
.cke_browser_quirks .cke_tpl_list a:focus
|
||||
{
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
.cke_hc .cke_tpl_list a:hover .cke_tpl_item,
|
||||
.cke_hc .cke_tpl_list a:focus .cke_tpl_item,
|
||||
.cke_hc .cke_tpl_list a:active .cke_tpl_item
|
||||
{
|
||||
border-width: 3px;
|
||||
}
|
||||
|
||||
.cke_tpl_empty, .cke_tpl_loading
|
||||
{
|
||||
text-align: center;
|
||||
padding: 5px;
|
||||
}
|
||||
.cke_tpl_list > a{
|
||||
width:33.3333%;
|
||||
float:left;
|
||||
}
|
||||
.cke_tpl_list > a:nth-child(3n+1){
|
||||
clear: both;
|
||||
}
|
||||
.ck_kindBox {
|
||||
padding: 5px 0;
|
||||
display: block;
|
||||
}
|
||||
.ck_kindBox *{
|
||||
font-size: 14px;
|
||||
}
|
||||
.ck_kindBox select{
|
||||
margin:0 15px;
|
||||
border: 1px solid #ccc;
|
||||
padding: 2px 5px;
|
||||
}
|
||||
.cke_dialog_contents_body{
|
||||
padding-top: 0px;
|
||||
}
|
||||
|
||||
@media (max-width: 700px) {
|
||||
.cke_tpl_list > a{
|
||||
width:50%;
|
||||
}
|
||||
.cke_tpl_list > a:nth-child(3n+1){
|
||||
clear: none;
|
||||
}
|
||||
.cke_tpl_list > a:nth-child(2n+1){
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.cke_tpl_list > a{
|
||||
width:100%;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user