代码功能更新

This commit is contained in:
root
2025-05-18 07:29:01 +00:00
commit 12b03531c5
2083 changed files with 695218 additions and 0 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,522 @@
layui.define([
'message',
'table',
'jquery',
'element',
'yaml',
'form',
'laytpTab',
'apimenu',
'frame',
'theme',
'convert'
],
function(exports) {
"use strict";
var $ = layui.jquery,
form = layui.form,
element = layui.element,
yaml = layui.yaml,
laytpTab = layui.laytpTab,
convert = layui.convert,
laytpApiMenu = layui.apimenu,
laytpFrame = layui.frame,
laytpTheme = layui.theme,
message = layui.message;
var bodyFrame;
var sideMenu;
var bodyTab;
var config;
var logout = function() {};
var msgInstance;
var body = layui.$('body');
var laytpApidoc = new function() {
// 默认配置
var configType = 'yml';
var configPath = 'api.config.yml';
this.setConfigPath = function(path) {
configPath = path;
};
this.setConfigType = function(type) {
configType = type;
};
this.setAvatar = function(url, username) {
var image = new Image();
image.src = url || "/static/admin/images/avatar.jpg";
image.onload = function() {
layui.$(".layui-nav-img").attr("src", convert.imageToBase64(image));
};
layui.$(".layui-nav-img").parent().append(username);
};
this.render = function(initConfig) {
if (initConfig !== undefined) {
applyConfig(initConfig);
} else {
applyConfig(laytpApidoc.readConfig());
}
};
this.readConfig = function() {
if (configType === "yml") {
return yaml.load(configPath);
} else {
var data;
$.ajax({
url: configPath,
type: 'get',
dataType: 'json',
async: false,
success: function(result) {
data = result;
}
});
return data;
}
};
this.messageRender = function(option) {
var option = {
elem: '.message',
url: option.header.message,
height: '250px'
};
msgInstance = message.render(option);
};
this.logoRender = function(param) {
layui.$(".layui-logo .logo").attr("src", param.logo.image);
layui.$(".layui-logo .title").html(param.logo.title);
};
this.menuRender = function(param) {
sideMenu = laytpApiMenu.render({
elem: 'sideMenu',
async: param.menu.async !== undefined ? param.menu.async : true,
theme: "dark-theme",
// height: '100%',
method: param.menu.method,
control: param.menu.control ? 'control' : false, // control
defaultMenu: 0,
accordion: param.menu.accordion,
url: param.menu.data,
data: param.menu.data, //async为false时,传入菜单数组
parseData: function(res){
if(param.isSearch){
var result = {
"id" : -1,
"is_menu" : 1,
"is_show" : 1,
"title" : "搜索结果",
"type" : 0,
"children" : res,
"href" : "",
"icon" : ""
};
var resArr = [];
resArr.push(result);
return resArr;
}else{
window.menuData = laytpApidoc.parseData(res.data);
return window.menuData;
}
},
change: function() {
compatible();
},
done: function() {
let firstMenuObj = layui.$("#sideMenu a[menu-id='" + param.menu.select + "']").parent();
let menuType = $(firstMenuObj.html()).attr("doc-type");
let id = $(firstMenuObj.html()).attr("menu-id");
$('.api-page-tab-content').hide();
$('#' + menuType + '_' + id).show();
sideMenu.selectItem(param.menu.select);
}
});
};
this.parseData = function(data){
$.each(data, function(i, item) {
var tempItem = item;
// tempItem.id = item.id;
// tempItem.href = item.href;
// tempItem.icon = item.icon;
tempItem.type = 0;
// tempItem.title = item.name;
if(typeof item.children != null && typeof item.children !== "undefined" && item.children.length > 0){
tempItem.children = laytpApidoc.parseData(item.children);
}else{
tempItem.type = 1;
}
data[i] = tempItem;
});
return data;
};
this.bodyRender = function(param) {
if (param.tab.muiltTab) {
sideMenu.click(function(dom, data) {
let menuType = data.docType;
let id = data.menuId;
$('.api-page-tab-content').hide();
$('#' + menuType + '_' + id).show();
compatible();
});
} else {
sideMenu.click(function(dom, data) {
let menuType = data.docType;
let id = data.menuId;
$('.api-page-tab-content').hide();
$('#' + menuType + '_' + id).show();
compatible();
});
}
};
this.keepLoad = function(param) {
compatible();
setTimeout(function() {
layui.$(".loader-main").fadeOut(200);
}, param.other.keepLoad)
};
this.themeRender = function(option) {
if (option.theme.allowCustom === false) {
layui.$(".setting").remove();
}
var colorId = localStorage.getItem("theme-color");
var currentColor = getColorById(colorId);
localStorage.setItem("theme-color", currentColor.id);
localStorage.setItem("theme-color-context", currentColor.color);
laytpTheme.changeTheme(window, option.other.autoHead);
var menu = localStorage.getItem("theme-menu");
if (menu == null) {
menu = option.theme.defaultMenu;
} else {
if (option.theme.allowCustom === false) {
menu = option.theme.defaultMenu;
}
}
localStorage.setItem("theme-menu", menu);
this.menuSkin(menu);
}
this.menuSkin = function(theme) {
var laytpApidoc = layui.$(".laytp-admin");
laytpApidoc.removeClass("light-theme");
laytpApidoc.removeClass("dark-theme");
laytpApidoc.addClass(theme);
}
this.logout = function(callback) {
logout = callback;
}
this.message = function(callback) {
if (callback != null) {
msgInstance.click(callback);
} else {
msgInstance.click(messageTip);
}
}
this.jump = function(id, title, url) {
if (config.tab.muiltTab) {
bodyTab.addTabOnly({
id: id,
title: title,
url: url,
icon: null,
close: true
}, 300);
} else {
sideMenu.selectItem(id);
bodyFrame.changePage(url, title, true);
}
}
};
var messageTip = function(id, title, context, form) {
layer.open({
type: 1,
title: '消息', //标题
area: ['390px', '330px'], //宽高
shade: 0.4, //遮罩透明度
content: "<div style='background-color:whitesmoke;'><div class='layui-card'><div class='layui-card-body'>来源 : &nbsp; " +
form + "</div><div class='layui-card-header' >标题 : &nbsp; " + title +
"</div><div class='layui-card-body' >内容 : &nbsp; " + context + "</div></div></div>", //支持获取DOM元素
btn: ['确认'], //按钮组
scrollbar: false, //屏蔽浏览器滚动条
yes: function(index) { //layer.msg('yes'); //点击确定回调
layer.close(index);
showToast();
}
});
}
function collaspe() {
sideMenu.collaspe();
var admin = layui.$(".laytp-admin");
var left = layui.$(".layui-icon-spread-left")
var right = layui.$(".layui-icon-shrink-right")
if (admin.is(".laytp-mini")) {
$(".search").show();
left.addClass("layui-icon-shrink-right")
left.removeClass("layui-icon-spread-left")
admin.removeClass("laytp-mini");
} else {
$(".search").hide();
right.addClass("layui-icon-spread-left")
right.removeClass("layui-icon-shrink-right")
admin.addClass("laytp-mini");
}
}
body.on("click", ".logout", function() {
// 回调
var result = logout();
if (result) {
// 清空缓存
bodyTab.clear();
}
})
body.on("click", ".collaspe,.laytp-cover", function() {
collaspe();
});
body.on("click", ".fullScreen", function() {
if (layui.$(this).hasClass("layui-icon-screen-restore")) {
screenFun(2).then(function() {
layui.$(".fullScreen").eq(0).removeClass("layui-icon-screen-restore");
});
} else {
screenFun(1).then(function() {
layui.$(".fullScreen").eq(0).addClass("layui-icon-screen-restore");
});
}
});
body.on("click", '[user-menu-id]', function() {
if (config.tab.muiltTab) {
bodyTab.addTabOnly({
id: layui.$(this).attr("user-menu-id"),
title: layui.$(this).attr("user-menu-title"),
url: layui.$(this).attr("user-menu-url"),
icon: "",
close: true
}, 300);
} else {
bodyFrame.changePage(layui.$(this).attr("user-menu-url"), "", true);
}
});
body.on("click", ".setting", function() {
var bgColorHtml =
'<li class="layui-this" data-select-bgcolor="dark-theme" >' +
'<a href="javascript:;" data-skin="skin-blue" style="" class="clearfix full-opacity-hover">' +
'<div><span style="display:block; width: 20%; float: left; height: 12px; background: #28333E;"></span><span style="display:block; width: 80%; float: left; height: 12px; background: white;"></span></div>' +
'<div><span style="display:block; width: 20%; float: left; height: 40px; background: #28333E;"></span><span style="display:block; width: 80%; float: left; height: 40px; background: #f4f5f7;"></span></div>' +
'</a>' +
'</li>';
bgColorHtml +=
'<li data-select-bgcolor="light-theme" >' +
'<a href="javascript:;" data-skin="skin-blue" style="" class="clearfix full-opacity-hover">' +
'<div><span style="display:block; width: 20%; float: left; height: 12px; background: white;"></span><span style="display:block; width: 80%; float: left; height: 12px; background: white;"></span></div>' +
'<div><span style="display:block; width: 20%; float: left; height: 40px; background: white;"></span><span style="display:block; width: 80%; float: left; height: 40px; background: #f4f5f7;"></span></div>' +
'</a>' +
'</li>';
var html =
'<div class="laytpone-color">\n' +
'<div class="color-title">整体风格</div>\n' +
'<div class="color-content">\n' +
'<ul>\n' + bgColorHtml + '</ul>\n' +
'</div>\n' +
'</div>';
layer.open({
type: 1,
offset: 'r',
area: ['320px', '100%'],
title: false,
shade: 0.1,
closeBtn: 0,
shadeClose: false,
anim: -1,
skin: 'layer-anim-right',
move: false,
content: html + buildColorHtml() + buildLinkHtml() + bottomTool(),
success: function(layero, index) {
var color = localStorage.getItem("theme-color");
var menu = localStorage.getItem("theme-menu");
if (color !== "null") {
layui.$(".select-color-item").removeClass("layui-icon").removeClass("layui-icon-ok");
layui.$("*[color-id='" + color + "']").addClass("layui-icon").addClass("layui-icon-ok");
}
if (menu !== "null") {
layui.$("*[data-select-bgcolor]").removeClass("layui-this");
layui.$("[data-select-bgcolor='" + menu + "']").addClass("layui-this");
}
layui.$('#layui-layer-shade' + index).click(function() {
var $layero = layui.$('#layui-layer' + index);
$layero.animate({
left: $layero.offset().left + $layero.width()
}, 200, function() {
layer.close(index);
});
})
layui.$('#closeTheme').click(function() {
var $layero = layui.$('#layui-layer' + index);
$layero.animate({
left: $layero.offset().left + $layero.width()
}, 200, function() {
layer.close(index);
});
})
}
});
});
function bottomTool() {
return "<button id='closeTheme' style='position: absolute;bottom: 20px;left: 20px;' class='laytp-btn'>关闭</button>"
}
body.on('click', '[data-select-bgcolor]', function() {
var theme = layui.$(this).attr('data-select-bgcolor');
layui.$('[data-select-bgcolor]').removeClass("layui-this");
layui.$(this).addClass("layui-this");
localStorage.setItem("theme-menu", theme);
laytpApidoc.menuSkin(theme);
});
body.on('click', '.select-color-item', function() {
layui.$(".select-color-item").removeClass("layui-icon").removeClass("layui-icon-ok");
layui.$(this).addClass("layui-icon").addClass("layui-icon-ok");
var colorId = layui.$(".select-color-item.layui-icon-ok").attr("color-id");
var currentColor = getColorById(colorId);
localStorage.setItem("theme-color", currentColor.id);
localStorage.setItem("theme-color-context", currentColor.color);
laytpTheme.changeTheme(window, config.other.autoHead);
});
function applyConfig(param) {
config = param;
laytpApidoc.logoRender(param);
laytpApidoc.menuRender(param);
laytpApidoc.bodyRender(param);
laytpApidoc.themeRender(param);
laytpApidoc.keepLoad(param);
if (param.header.message !== false) {
laytpApidoc.messageRender(param);
}
}
function getColorById(id) {
var color;
var flag = false;
$.each(config.colors, function(i, value) {
if (value.id === id) {
color = value;
flag = true;
}
})
if (flag === false || config.theme.allowCustom === false) {
$.each(config.colors, function(i, value) {
if (value.id === config.theme.defaultColor) {
color = value;
}
})
}
return color;
}
function buildLinkHtml() {
var links = "";
$.each(config.links, function(i, value) {
links += '<a class="more-menu-item" href="' + value.href + '">' +
'<i class="' + value.icon + '" style="font-size: 19px;"></i> ' + value.title +
'</a>'
})
return '<div class="more-menu-list">' + links + '</div>';
}
function buildColorHtml() {
return "";
var colors = "";
$.each(config.colors, function(i, value) {
colors += "<span class='select-color-item' color-id='" + value.id + "' style='background-color:" + value.color +
";'></span>";
})
return "<div class='select-color'><div class='select-color-title'>主题配色</div><div class='select-color-content'>" +
colors + "</div></div>"
}
function compatible() {
if (layui.$(window).width() <= 768) {
collaspe()
}
}
function screenFun(num) {
num = num || 1;
num = num * 1;
var docElm = document.documentElement;
switch (num) {
case 1:
if (docElm.requestFullscreen) {
docElm.requestFullscreen();
} else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen();
} else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen();
} else if (docElm.msRequestFullscreen) {
docElm.msRequestFullscreen();
}
break;
case 2:
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
break;
}
return new Promise(function(res, rej) {
res("返回值");
});
}
function isFullscreen() {
return document.fullscreenElement ||
document.msFullscreenElement ||
document.mozFullScreenElement ||
document.webkitFullscreenElement || false;
}
window.onresize = function() {
if (!isFullscreen()) {
layui.$(".fullScreen").eq(0).removeClass("layui-icon-screen-restore");
}
}
exports('apidoc', laytpApidoc);
})
@@ -0,0 +1,491 @@
layui.define(['table', 'jquery', 'element'], function(exports) {
"use strict";
var MOD_NAME = 'apimenu',
$ = layui.jquery,
element = layui.element;
var laytpApiMenu = function(opt) {
this.option = opt;
};
// 供外部调用的,渲染菜单方法
laytpApiMenu.prototype.render = function(opt) {
var option = {
elem: opt.elem,
async: opt.async,
parseData: opt.parseData,
url: opt.url,
method: opt.method ? opt.method : "GET",
defaultOpen: opt.defaultOpen,
defaultSelect: opt.defaultSelect,
control: opt.control,
defaultMenu: opt.defaultMenu,
accordion: opt.accordion,
height: opt.height,
theme: opt.theme,
data: opt.data ? opt.data : [],
change: opt.change ? opt.change : function() {},
done: opt.done ? opt.done : function() {}
};
if (option.async) {
if (option.method === "GET") {
getData(option.url).then(function(data) {
option.data = data;
renderMenu(option);
});
} else {
postData(option.url).then(function(data) {
option.data = data;
renderMenu(option);
});
}
} else {
//renderMenu中需要调用done事件,done事件中需要menu对象,但是此时还未返回menu对象,做个延时提前返回对象
window.setTimeout(function() { renderMenu(option);}, 500);
}
// 处理高度
layui.$("#"+opt.elem).height(option.height);
return new laytpApiMenu(opt);
};
// 任意左侧菜单绑定点击事件
laytpApiMenu.prototype.click = function(clickEvent) {
var _this = this;
layui.$(document).off("click", "#" + _this.option.elem + " .site-demo-active").on("click", "#" + _this.option.elem + " .site-demo-active", function() {
// layui.$("body").on("click", "#" + _this.option.elem + " .site-demo-active", function() {
var dom = layui.$(this);
var data = {
menuId: dom.attr("menu-id"),
docType: dom.attr("doc-type"),
menuTitle: dom.attr("menu-title"),
};
var doms = hash(dom);
if (doms != null) {
if (doms.text() != '') {
data['menuPath'] = doms.find("span").text() + " / " + data['menuPath'];
}
}
if (doms != null) {
var domss = hash(doms);
if(domss!=null){
if (domss.text() != '') {
data['menuPath'] = domss.find("span").text() + " / " + data['menuPath'];
}}
}
if (domss != null) {
var domsss = hash(domss);
if(domsss!=null){
if (domsss.text() != '') {
data['menuPath'] = domsss.find("span").text() + " / " + data['menuPath'];
}}
}
if (layui.$("#" + _this.option.elem).is(".laytp-nav-mini")) {
if (_this.option.accordion) {
activeMenus = layui.$(this).parent().parent().parent().children("a");
} else {
activeMenus.push(layui.$(this).parent().parent().parent().children("a"));
}
}
clickEvent(dom, data);
})
};
function hash(dom) {
var d = dom.parent().parent().prev();
if (d.prop("tagName") === "UL") {
return null;
}
return d;
}
// 样式选择
laytpApiMenu.prototype.skin = function(skin) {
var menu = layui.$(".laytp-nav-tree[lay-filter='" + this.option.elem + "']").parent();
menu.removeClass("dark-theme");
menu.removeClass("light-theme");
menu.addClass(skin);
};
// 选择没有子级的菜单节点
laytpApiMenu.prototype.selectItem = function(laytpId) {
if (this.option.control != false) {
layui.$("#" + this.option.elem + " a[menu-id='" + laytpId + "']").parents(".layui-side-scroll ").find("ul").css({
display: "none"
});
layui.$("#" + this.option.elem + " a[menu-id='" + laytpId + "']").parents(".layui-side-scroll ").find(".layui-this").removeClass(
"layui-this");
layui.$("#" + this.option.elem + " a[menu-id='" + laytpId + "']").parents("ul").css({
display: "block"
});
var controlId = layui.$("#" + this.option.elem + " a[menu-id='" + laytpId + "']").parents("ul").attr("menu-id");
if (controlId != undefined) {
layui.$("#" + this.option.control).find(".layui-this").removeClass("layui-this");
layui.$("#" + this.option.control).find("[menu-id='" + controlId + "']").addClass("layui-this");
}
}
if (this.option.accordion === true) {
layui.$("#" + this.option.elem + " a[menu-id='" + laytpId + "']").parents(".laytp-nav-tree").find(".layui-nav-itemed").removeClass(
"layui-nav-itemed");
}
layui.$("#" + this.option.elem + " a[menu-id='" + laytpId + "']").parents(".laytp-nav-tree").find(".layui-this").removeClass(
"layui-this");
if (!layui.$("#" + this.option.elem).is(".laytp-nav-mini")) {
layui.$("#" + this.option.elem + " a[menu-id='" + laytpId + "']").parents(".layui-nav-item").addClass("layui-nav-itemed");
layui.$("#" + this.option.elem + " a[menu-id='" + laytpId + "']").parents("dd").addClass("layui-nav-itemed");
}
layui.$("#" + this.option.elem + " a[menu-id='" + laytpId + "']").parent().addClass("layui-this");
}
var activeMenus;
// 手机模式下,右下角按钮点击展开收缩左侧菜单事件
laytpApiMenu.prototype.collaspe = function(time) {
var elem = this.option.elem;
var config = this.option;
if (layui.$("#" + this.option.elem).is(".laytp-nav-mini")) {
$.each(activeMenus, function(i, item) {
layui.$("#" + elem + " a[menu-id='" + layui.$(this).attr("menu-id") + "']").parent().addClass("layui-nav-itemed");
});
layui.$("#" + this.option.elem).removeClass("laytp-nav-mini");
layui.$("#" + this.option.elem).animate({
width: "220px"
}, 150);
isHoverMenu(false, config);
} else {
activeMenus = layui.$("#" + this.option.elem).find(".layui-nav-itemed>a");
layui.$("#" + this.option.elem).find(".layui-nav-itemed").removeClass("layui-nav-itemed");
layui.$("#" + this.option.elem).addClass("laytp-nav-mini");
layui.$("#" + this.option.elem).animate({
width: "60px"
}, 400);
isHoverMenu(true, config);
}
};
function getData(url) {
var defer = $.Deferred();
var contact = (url.indexOf('?') > -1) ? "&" : "?";
$.get(url + contact + "fresh=" + Math.random(), function(result) {
defer.resolve(result)
});
return defer.promise();
}
function postData(url) {
var defer = $.Deferred();
$.post(url + "?fresh=" + Math.random(), function(result) {
defer.resolve(result)
});
return defer.promise();
}
// 内部使用,渲染菜单函数
function renderMenu(option) {
if (option.parseData != false) {
option.data = option.parseData(option.data);
}
if (option.data.length > 0) {
if (option.control != false) {
createMenuAndControl(option);
} else {
createMenu(option);
}
}
element.init();
downShow(option);
option.done();
}
// 创建菜单
function createMenu(option) {
var menuHtml = '<div style="height:100%!important;" class="laytp-side-scroll layui-side-scroll ' + option.theme + '"><ul lay-filter="' + option.elem +
'" class="layui-nav arrow laytp-menu layui-nav-tree laytp-nav-tree">';
$.each(option.data, function(i, item) {
var content = '<li class="layui-nav-item">';
if (i === option.defaultOpen) {
content = '<li class="layui-nav-item layui-nav-itemed">';
}
var href = "javascript:void(0);";
var className = "site-demo-active";
if (item.openType === "_blank" && item.type === 1) {
className = "";
}
if (item.type === 0) {
// 创 建 目 录 结 构
content += '<a href="javascript:;" menu-type="' + item.type + '" doc-type="' + item.docType + '" menu-id="' + item.id + '" href="' + href + '">' +
'<span>' + item.title + '</span></a>';
} else if (item.type === 1) {
content += '<a class="' + className + '" menu-type="' + item.type + '" doc-type="' + item.docType + '" menu-id="' +
item.id +
'" menu-title="' + item.title + '" href="' + href + '"><span>' + item.title + '</span></a>';
}
// 调 用 递 归 方 法 加 载 无 限 层 级 的 子 菜 单
content += loadchild(item);
// 结 束 一 个 根 菜 单 项
content += '</li>';
menuHtml += content;
});
// 结 束 菜 单 结 构 的 初 始 化
menuHtml += "</ul></div>";
// 将 菜 单 拼 接 到 初 始 化 容 器 中
layui.$("#" + option.elem).html(menuHtml);
}
// 创建多系统菜单, 包括渲染静态html和绑定顶部菜单点击事件
function createMenuAndControl(option) {
var control = '<ul class="layui-nav laytp-nav-control pc layui-hide-xs">';
var controlPe = '<ul class="layui-nav laytp-nav-control layui-hide-sm">';
// 声 明 头 部
var menu = '<div class="layui-side-scroll ' + option.theme + '">';
// 开 启 同 步 操 作
var index = 0;
var controlItemPe = '<dl class="layui-nav-child">';
var config = layui.apidoc.readConfig();
$.each(option.data, function(i, item) {
var menuItem = '';
var controlItem = '';
if(index < config.menu['maxTopMenuNum']){
if (i === option.defaultMenu) {
controlItem = '<li menu-title="' + item.title + '" doc-type="' + item.docType + '" menu-id="' + item.id +
'" class="layui-this layui-nav-item"><a href="javascript:void(0);">' + item.title + '</a></li>';
menuItem = '<ul menu-id="' + item.id + '" lay-filter="' + option.elem +
'" class="layui-nav arrow laytp-menu layui-nav-tree laytp-nav-tree">';
// 兼容移动端
controlPe += '<li class="layui-nav-item"><a class="pe-title" href="javascript:void(0);" >' + item.title + '</a>';
controlItemPe += '<dd menu-title="' + item.title + '" menu-id="' + item.id +
'"><a href="javascript:void(0);">' + item.title + '</a></dd>';
} else {
controlItem = '<li menu-title="' + item.title + '" doc-type="' + item.docType + '" menu-id="' + item.id +
'" class="layui-nav-item"><a href="javascript:void(0);">' + item.title + '</a></li>';
menuItem = '<ul style="display:none" menu-id="' + item.id + '" lay-filter="' + option.elem +
'" class="layui-nav arrow layui-nav-tree laytp-nav-tree">';
controlItemPe += '<dd menu-title="' + item.title + '" doc-type="' + item.docType + '" menu-id="' + item.id +
'"><a href="javascript:void(0);">' + item.title + '</a></dd>';
}
index++;
}else{
menuItem = '<ul style="display:none" menu-id="' + item.id + '" lay-filter="' + option.elem +
'" class="layui-nav arrow layui-nav-tree laytp-nav-tree">';
controlItemPe += '<dd menu-title="' + item.title + '" doc-type="' + item.docType + '" menu-id="' + item.id +
'"><a href="javascript:void(0);">' + item.title + '</a></dd>';
index++;
}
$.each(item.children, function(i, note) {
// 创 建 每 一 个 菜 单 项
var content = '<li class="layui-nav-item" >';
var href = "javascript:void(0);";
var target = "";
var className = "site-demo-active";
if (note.openType == "_blank" && note.type == 1) {
href = note.href;
target = "target='_blank'";
className = "";
}
// 判 断 菜 单 类 型 0 是 不可跳转的目录 1 是 可 点 击 跳 转 的 菜 单
if (note.type == 0) {
// 创 建 目 录 结 构
content += '<a href="javascript:void(0);" menu-type="' + item.type + '" doc-type="' + note.docType + '" menu-id="' + note.id +
'" ><span>' + note.title +
'</span></a>';
} else if (note.type == 1) {
// 创 建 菜 单 结 构
content += '<a class="' + className + '" menu-type="' + item.type + '" doc-type="' + note.docType + '" menu-id="' + note.id +
'" menu-title="' + note.title + '" href="' + href + '"><span>' + note.title + '</span></a>';
}
content += loadchild(note);
content += '</li>';
menuItem += content;
})
menu += menuItem + '</ul>';
control += controlItem;
})
if(option.data.length > config.menu['maxTopMenuNum']){
control += '<li class="layui-nav-item">\n' +
'<a href="javascript:void(0);" class="laytp-icon laytp-icon-elipsis"></a>' +
'<!-- 功 能 菜 单 -->\n' +
'<dl class="layui-nav-child">';
var moreTopMenuIndex = 0;
$.each(option.data, function(i, item) {
var moreTopMenuItem = '';
if(moreTopMenuIndex >= config.menu['maxTopMenuNum']){
moreTopMenuItem = '<dd><a menu-title="' + item.title + '" menu-id="' + item.id +'">' + item.title + '</a></dd>';
}
moreTopMenuIndex++;
control += moreTopMenuItem;
});
control += '</dl></li></ul>';
}
controlItemPe += "</li></dl></ul>";
controlPe += controlItemPe;
layui.$("#" + option.control).html(control);
layui.$("#" + option.control).append(controlPe);
layui.$("#" + option.elem).html(menu);
// 绑定顶部菜单点击事件
layui.$(document).off("click", "#" + option.control + " .laytp-nav-control [menu-id]").on("click", "#" + option.control + " .laytp-nav-control [menu-id]", function() {
// layui.$("#" + option.control + " .laytp-nav-control").on("click", "[menu-id]", function() {
layui.$("#" + option.elem).find(".laytp-nav-tree").css({
display: 'none'
});
layui.$("#" + option.elem).find(".laytp-nav-tree[menu-id='" + layui.$(this).attr("menu-id") + "']").css({
display: 'block'
});
layui.$("#" + option.control).find(".pe-title").html(layui.$(this).attr("menu-title"));
layui.$("#" + option.control).find("");
option.change(layui.$(this).attr("menu-id"), layui.$(this).attr("menu-title"), layui.$(this).attr("menu-href"));
// 自动点击左侧的第一个菜单
var s = layui.$("a:first",layui.$("#" + option.elem).find("ul[style='display: block;']")).parent();
if(s.hasClass("layui-nav-itemed")){
recursionFindA(s);
}else{
layui.$("a:first",layui.$("#" + option.elem).find("ul[style='display: block;']")).click();
}
});
}
// 点击顶部菜单,自动点击左侧菜单,当菜单已经是展开状态时,要递归找到最低级别的A标签进行点击
function recursionFindA(obj){
var dlObj = layui.$("dl:first", obj);
if(dlObj.length === 0){
layui.$("a:first", obj).click();
}else{
recursionFindA(layui.$("dd:first",dlObj));
}
}
/** 加载子菜单 (递归)*/
function loadchild(obj) {
// 判 单 是 否 是 菜 单, 如 果 是 菜 单 直 接 返 回
if (obj.type == 1) {
return "";
}
// 创 建 子 菜 单 结 构
var content = '<dl class="layui-nav-child">';
// 如 果 嵌 套 不 等 于 空
if (obj.children != null && obj.children.length > 0) {
// 遍 历 子 项 目
$.each(obj.children, function(i, note) {
// 创 建 子 项 结 构
content += '<dd>';
var href = "javascript:;";
var target = "";
var className = "site-demo-active";
if (note.openType == "_blank" && note.type == 1) {
href = note.href;
target = "target='_blank'";
className = "";
}
// 判 断 子 项 类 型
if (note.type == 0) {
// 创 建 目 录 结 构
content += '<a href="' + href + '" doc-type="' + note.docType + '" menu-id="' + note.id +
'"><i class="' + note.icon + '"></i><span>' + note.title + '</span></a>';
} else if (note.type == 1) {
// 创 建 菜 单 结 构
content += '<a class="' + className + '" doc-type="' + note.docType + '" menu-id="' + note.id + '" menu-title="' + note.title + '" href="' + href +
'" ><i class="' + note.icon + '"></i><span>' + note.title + '</span></a>';
}
// 加 载 子 项 目 录
content += loadchild(note);
// 结 束 当 前 子 菜 单
content += '</dd>';
});
// 封 装
} else {
content += '<div class="toast"> 无 内 容 </div>';
}
content += '</dl>';
return content;
}
// 左侧菜单点击事件
function downShow(option) {
layui.$(document).off("click", "#" + option.elem + " a[menu-type='0']").on("click", "#" + option.elem + " a[menu-type='0']", function() {
// layui.$("body #" + option.elem).on("click", "a[menu-type='0']", function() {
if (!layui.$("#" + option.elem).is(".laytp-nav-mini")) {
var superEle = layui.$(this).parent();
var ele = layui.$(this).next('.layui-nav-child');
var heights = ele.children("dd").length * 48;
if (superEle.is(".layui-nav-itemed")) {
if (option.accordion) {
superEle.parent().find(".layui-nav-itemed").removeClass("layui-nav-itemed");
superEle.addClass("layui-nav-itemed");
//自动点击第一个子菜单
layui.$("a:first",ele).click();
}
ele.height(0);
ele.animate({
height: heights + "px"
}, 200, function() {
ele.css({
height: "auto"
});
});
} else {
superEle.addClass("layui-nav-itemed");
ele.animate({
height: "0px"
}, 200, function() {
ele.css({
height: "auto"
});
superEle.removeClass("layui-nav-itemed");
});
}
}
})
}
/** 二 级 悬 浮 菜 单*/
function isHoverMenu(b, option) {
if (b) {
layui.$("#" + option.elem + ".laytp-nav-mini .layui-nav-item,#" + option.elem + ".laytp-nav-mini dd").hover(function(e) {
e.stopPropagation();
var _this = layui.$(this);
_this.siblings().find(".layui-nav-child")
.removeClass("layui-nav-hover").css({
left: 0,
top: 0
});
_this.children(".layui-nav-child").addClass("layui-nav-hover");
_this.closest('.layui-nav-item').data('time') && clearTimeout(_this.closest('.layui-nav-item').data('time'));
var height = layui.$(window).height();
var topLength = _this.offset().top;
var thisHeight = _this.children(".layui-nav-child").height();
if ((thisHeight + topLength) > height) {
topLength = height - thisHeight - 10;
}
var left = _this.offset().left + 60;
if (!_this.hasClass("layui-nav-item")) {
left = _this.offset().left + _this.width();
}
_this.children(".layui-nav-child").offset({
top: topLength,
left: left + 3
});
}, function(e) {
e.stopPropagation();
var _this = layui.$(this);
_this.closest('.layui-nav-item').data('time', setTimeout(function() {
_this.closest('.layui-nav-item')
.find(".layui-nav-child")
.removeClass("layui-nav-hover")
.css({
left: 0,
top: 0
});
}, 50));
})
} else {
layui.$("#" + option.elem + " .layui-nav-item").off('mouseenter').unbind('mouseleave');
layui.$("#" + option.elem + " dd").off('mouseenter').unbind('mouseleave');
}
}
exports(MOD_NAME, new laytpApiMenu());
});
File diff suppressed because it is too large Load Diff
+53
View File
@@ -0,0 +1,53 @@
layui.define(['jquery'], function(exports) {
"use strict";
/**
* Button component
* */
var MOD_NAME = 'button',
$ = layui.jquery;
var button = function(opt) {
this.option = opt;
};
/**
* Button start loading
* */
button.prototype.load = function(opt) {
var option = {
elem: opt.elem,
time: opt.time ? opt.time : false,
done: opt.done ? opt.done : function(){}
}
var text = $(option.elem).html();
$(option.elem).html("<i class='layui-anim layui-anim-rotate layui-icon layui-anim-loop layui-icon-loading'/>");
$(option.elem).attr("disabled", "disabled");
var buttons = $(option.elem);
if (option.time != "" || option.time !=false) {
setTimeout(function() {
$(option.elem).attr("disabled", false);
buttons.html(text);
option.done();
}, option.time);
}
option.text = text;
return new button(option);
}
/**
* Button stop loaded
* */
button.prototype.stop = function(success) {
$(this.option.elem).attr("disabled", false);
$(this.option.elem).html(this.option.text);
success && success();
}
exports(MOD_NAME, new button());
});
+396
View File
@@ -0,0 +1,396 @@
layui.define(['table', 'laypage', 'jquery', 'element', 'laytpl', 'util', 'facade', 'laytpUpload'], function(exports) {
"use strict";
var MOD_NAME = 'card',
$ = layui.jquery,
element = layui.element,
laypage = layui.laypage;
var _instances = {}; // 记录所有实例
var defaultOption = {
elem: "#currentTableId",// 构建的模型
url: "",// 数据 url 连接
loading: true,//是否加载
limit: 0, //每页数量默认是每行数量的双倍
linenum: 6, //每行数量 2,3,4,6
currentPage: 1,//当前页
data:[], //静态数据
limits:[], //页码
page: true, //是否分页
layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'],//分页控件
request: {
pageName: 'page' //页码的参数名称,默认:page
, limitName: 'limit' //每页数据量的参数名,默认:limit
, idName: 'id' //主键名称,默认:id
, titleName: 'title' //标题名称,默认:title
, imageName: 'image' //图片地址,默认:image
, remarkName: 'remark' //备注名称,默认:remark
, timeName: 'time' //时间名称,默认:time
},
response: {
statusName: 'code' //规定数据状态的字段名称,默认:code
, statusCode: 0 //规定成功的状态码,默认:0
, msgName: 'msg' //规定状态信息的字段名称,默认:msg
, countName: 'count' //规定数据总数的字段名称,默认:count
, dataName: 'data' //规定数据列表的字段名称,默认:data
},
where:{},
toolbar:"",
bar:"",
clickItem: function(data){},
done: function () {},
};
var card = function(opt) {
_instances[opt.elem.substring(1)] = this;
this.reload(opt);
};
card.prototype.initOptions = function (opt) {
this.option = $.extend(true, {}, defaultOption, opt);
if (!this.option.limit || this.option.limit == 0) {
this.option.limit = this.option.linenum * 2;
}
if (!this.option.limits || this.option.limits.length == 0) {
this.option.limits = [this.option.limit];
}
};
card.prototype.init = function () {
var option = this.option;
var url = option.url;
var html = "";
html += option.loading == true ? '<div class="ew-table-loading">' : ' <div class="ew-table-loading layui-hide">';
html += '<i class="layui-icon layui-icon-loading layui-anim layui-anim-rotate layui-anim-loop"></i>';
html += '</div>';
$(option.elem).html(html);
html = "";
if (!!url) {
if (url.indexOf("?") >= 0) {
url = url + '&v=1.0.0';
}
else {
url = url + '?v=1.0.0';
}
if (!!option.page) {
url = url + '&' + option.request.limitName + '=' + option.limit;
url = url + '&' + option.request.pageName + '=' + option.currentPage;
}
if (!!option.where) {
url = url + '&' + facade.arrayToUrlParams(option.where);
// for (let key in option.where) {
// url = url + '&' + key + '=' + option.where[key];
// }
}
getData(url).then(function(data){
option.sourceData = data.data.data;
data = initData(data, option);
if (data.code != option.response.statusCode) {
option.data = [];
option.count = 0;
} else {
option.data = data.data;
option.count = data.count;
}
if (!!option.data && option.data.length > 0) {
html = createComponent(option.elem.substring(1), option.linenum, option.data, option);
html += "<div id='cardpage'></div>";
}
else {
if (data.code != option.response.statusCode) {
html = "<p>" + data.msg + "</p>";
} else {
html = "<p>没有数据</p>";
}
}
$(option.elem).html(html);
if (option.page) {
laypage.render({
elem: 'cardpage'
, count: option.count, limit: option.limit, limits: option.limits, curr: option.currentPage
, layout: option.layout
, jump: function (obj, first) {
option.limit = obj.limit;
option.currentPage = obj.curr;
if (!first) {
_instances[option.elem.substring(1)].reload(option);
}
}
});
}
});
}
else {
if (!option.alldata) {
option.alldata = option.data;
}
if (option.page) {
var data = [];
option.count = option.alldata.length;
for (var i = (option.currentPage - 1) * option.limit; i < option.currentPage * option.limit && i<option.alldata.length; i++) {
data.push(option.alldata[i]);
}
option.data = data;
}
if (!!option.data && option.data.length > 0) {
html = createComponent(option.elem.substring(1), option.linenum, option.data, option);
html += "<div id='cardpage'></div>";
}
else {
html = "<p>没有数据</p>";
}
$(option.elem).html(html);
if (option.page) {
laypage.render({
elem: 'cardpage'
, count: option.count, limit: option.limit, limits: option.limits, curr: option.currentPage
, layout: option.layout
, jump: function (obj, first) {
option.limit = obj.limit;
option.currentPage = obj.curr;
if (!first) {
_instances[option.elem.substring(1)].reload(option);
}
}
});
}
}
}
card.prototype.reload = function (opt) {
this.initOptions(this.option ? $.extend(true, this.option, opt) : opt);
this.init(); // 初始化表格
}
function createComponent(elem,linenum,data,option) {
var html = "<div class='cloud-card-component'>"
var content = createCards(elem, linenum,data,option);
var page = "";
content = content + page;
html += content + "</div>"
return html;
}
function createCards(elem, linenum, data, option) {
var windowHeight = $(window).height();
var maxHeight = parseInt(windowHeight) - 172;
var content = `
<div class='layui-row layui-col-space30'>
<div class="card-toolbar">
{{- d.toolbarHtml}}
</div>
<div class="card-body layui-row layui-col-space30" style="height: `+maxHeight+`px;max-height: `+maxHeight+`px;overflow-y: auto">
`;
option.toolbarHtml = layui.laytpl($(option.toolbar).html()).render();
content = layui.laytpl(content).render(option);
for (var i = 0; i < data.length; i++) {
content += createCard(elem,linenum,data[i],i,option);
}
content += "</div>";
content += "</div>";
return content;
}
function createCard(elem, linenum, item, no, option) {
var line = 12 / linenum;
// var card =
// '<div id=' + item.id + ' onclick="cardTableCheckedCard(' + elem + ',this)" class="layui-col-md' + line + ' ew-datagrid-item" data-index="' + no+'" data-number="1"> <div class="project-list-item"> <img class="project-list-item-cover" src="' + item.image + '"> <div class="project-list-item-body"> <h2 class="layui-elip">' + item.title + '</h2> <div class="project-list-item-text layui-text">' + item.remark + '</div> <div class="project-list-item-desc"> <span class="time">' +item.time + '</span> <div class="ew-head-list"> <img class="ew-head-list-item" lay-tips="曲丽丽" lay-offset="0,-5px" src="https://gw.alipayobjects.com/zos/rmsportal/ZiESqWwCXBRQoaPONSJe.png"> <img class="ew-head-list-item" lay-tips="王昭君" lay-offset="0,-5px" src="https://gw.alipayobjects.com/zos/rmsportal/tBOxZPlITHqwlGjsJWaF.png"> <img class="ew-head-list-item" lay-tips="董娜娜" lay-offset="0,-5px" src="https://gw.alipayobjects.com/zos/rmsportal/sBxjgqiuHMGRkIjqlQCd.png"> </div> </div> </div > </div > </div > '
// return card;
item.elem = elem;
item.line = line;
item.no = no;
var cardHtml = `
<div id="{{d.id}}" onclick="cardTableCheckedCard('{{d.elem}}',this)" class="layui-col-md{{d.line}} ew-datagrid-item card-item" data-index="{{d.no}}" data-number="1">
<div class="project-list-item">
{{# if(d.file_type == "image"){ }}
<img class="project-list-item-cover" src="{{d.file_path}}" />
{{# } }}
{{# if(d.file_type == "audio"){ }}
<div class="project-list-item-cover" style="display: grid;place-items: center">
<audio style="width: 100%" src="{{d.file_path}}" controls="controls"></audio>
</div>
{{# } }}
{{# if(d.file_type == "video"){ }}
<div class="project-list-item-cover" style="display: grid;place-items: center">
<video style="width: 100%" src="{{d.file_path}}" controls="controls"></video>
</div>
{{# } }}
{{# if(d.file_type == "file"){ }}
{{# var iconClassName = layui.laytpUpload.getFaByFilename(d.file_path); }}
{{# if(iconClassName == "image"){ }}
<img class="project-list-item-cover" src="{{d.file_path}}" />
{{# }else{ }}
<div class="project-list-item-cover {{iconClassName}}"></div>
{{# } }}
{{# } }}
<div class="project-list-item-body">
<h2 class="layui-elip">{{d.title}}</h2>
<div class="project-list-item-text layui-text">{{d.remark}}</div>
<div class="project-list-item-text layui-text card-tool">
{{- d.barHtml}}
</div>
<div class="project-list-item-desc">
<span class="time">{{d.create_time}}</span>
<div class="ew-head-list">
<img class="ew-head-list-item layerTips" data-text="{{d.create_nickname}}" src="{{d.create_avatar}}">
</div>
</div>
</div>
</div>
</div>
`;
item.barHtml = layui.laytpl($(option.bar).html()).render(item);
return layui.laytpl(cardHtml).render(item);
}
function initData(tempData, option) {
if(typeof option.parseData == "function") {
data = option.parseData(tempData);
var dataList = data.data;
if(!dataList){
return data;
}
data.data = [];
for (var i = 0; i < dataList.length; i++) {
var item = option.parseItem(dataList[i]);
// item.id = dataList[i][option.request.idName];
// item.image = dataList[i][option.request.imageName];
// item.title = dataList[i][option.request.titleName];
// item.remark = dataList[i][option.request.remarkName];
// item.time = dataList[i][option.request.timeName];
data.data.push(item);
}
return data;
}else{
var data = {};
data.code = tempData[option.response.statusName];
data.msg = tempData[option.response.msgName];
data.count = tempData[option.response.countName];
var dataList = tempData[option.response.dataName];
if(!dataList){
return data;
}
data.data = [];
for (var i = 0; i < dataList.length; i++) {
var item = dataList[i];
item.id = dataList[i][option.request.idName];
item.image = dataList[i][option.request.imageName];
item.title = dataList[i][option.request.titleName];
item.remark = dataList[i][option.request.remarkName];
item.time = dataList[i][option.request.timeName];
data.data.push(item);
}
return data;
}
}
function getData(url) {
var defer = $.Deferred();
$.get(url + (url.indexOf("?") ? "&" : "?") + "fresh=" + Math.random(), function(result) {
defer.resolve(result)
});
return defer.promise();
}
window.cardTableCheckedCard = function (elem,obj) {
$(obj).addClass('layui-table-click').siblings().removeClass('layui-table-click');
var item = {};
item.id = obj.id;
item.index = $(obj).attr('data-index');
item.image = $(obj).find('.project-list-item-cover')[0].src;
item.title = $(obj).find('h2')[0].innerHTML;
item.remark = $(obj).find('.project-list-item-text')[0].innerHTML;
item.time = $(obj).find('.time')[0].innerHTML;
_instances[elem].option.checkedItem = item;
_instances[elem].option.clickItem(item);
}
/** 对外提供的方法 */
var tt = {
render: function (options) {
return new card(options);
},
reload: function (id, opt) {
_instances[id].option.checkedItem = null;
_instances[id].reload(opt);
},
getChecked: function (id) {
var option = _instances[id].option;
var data = option.checkedItem;
var item = {};
if (!data) {
return null;
}
item[option.request.idName] = data.id;
item[option.request.imageName] = data.image;
item[option.request.titleName] = data.title;
item[option.request.remarkName] = data.remark;
item[option.request.timeName] = data.time;
return item;
},
getAllData: function (id) {
var option = _instances[id].option;
var data = [];
for (var i = 0; i < option.data.length; i++) {
var item = {};
item[option.request.idName] = option.data[i].id;
item[option.request.imageName] = option.data[i].image;
item[option.request.titleName] = option.data[i].title;
item[option.request.remarkName] = option.data[i].remark;
item[option.request.timeName] = option.data[i].time;
data.push(item);
}
return data;
},
on: function(type, callBackFun){
var beginIndex = type.indexOf('(');
var endIndex = type.indexOf(')');
var toolName = type.slice(0, beginIndex);
var layFilter = type.slice(beginIndex+1, endIndex);
if(toolName === "toolbar" || toolName === "tool"){
$(document).off("click", "[lay-filter='"+layFilter+"'] .card-"+toolName+" [lay-event]")
.on("click", "[lay-filter='"+layFilter+"'] .card-"+toolName+" [lay-event]", function () {
var obj = {event: $(this).attr('lay-event')};
if(toolName === "tool"){
var index = $(this).closest(".card-item").data('index');
obj.data = _instances[layFilter]['option']['sourceData'][index];
}
callBackFun.call(this, obj);
});
}
},
done: function(reduceHeight, tableId){
if(!reduceHeight){
reduceHeight = 0;
}
// 获取屏幕可见高度
var windowHeight = $(window).height();
console.log(windowHeight);
var maxHeight = parseInt(windowHeight) - (172 + reduceHeight);
console.log(maxHeight);
// 设置.layui-table-body的最大高度和y轴滚动条自动出现
// 为了防止fixed="left" 固定层也出现滚动条,增加上.layui-table-main类的限制
if(!tableId){
console.log('test1');
$(".card-body").css("height", maxHeight + 'px');
$(".card-body").css("max-height", maxHeight + 'px');
$(".card-body").css("overflow-y", "auto");
console.log('test2');
}else{
$("div[lay-id='"+tableId+"'] .layui-table-body.layui-table-main").css("height", maxHeight + 'px');
$("div[lay-id='"+tableId+"'] .layui-table-body.layui-table-main").css("max-height", maxHeight + 'px');
$("div[lay-id='"+tableId+"'] .layui-table-body.layui-table-main").css("overflow-y", "auto");
}
}
}
exports(MOD_NAME, tt);
})
+114
View File
@@ -0,0 +1,114 @@
layui.define(['jquery', 'element', 'table'], function (exports) {
"use strict";
/**
* 常用封装类
* */
var MOD_NAME = 'common',
$ = layui.jquery,
table = layui.table,
element = layui.element;
var common = new function () {
/**
* 获取当前表格选中字段
* @param obj 表格回调参数
* @param field 要获取的字段
* */
this.checkField = function (obj, field) {
let data = table.checkStatus(obj.config.id).data;
if (data.length === 0) {
return "";
}
let ids = "";
for (let i = 0; i < data.length; i++) {
ids += data[i][field] + ",";
}
ids = ids.substring(0, ids.length - 1);
return ids;
}
/**
* 当前是否为与移动端
* */
this.isModile = function () {
return $(window).width() <= 768;
}
/**
* 提交 json 数据
* @param href 必选 提交接口
* @param data 可选 提交数据
* @param ajaxtype 可选 提交方式(默认为get)
* @param table 可选 刷新父级表
* @param callback 可选 自定义回调函数
* @param dataType 可选 返回数据类型 智能猜测(可以是xml, json, script, 或 html
* @param is_async 可选 请求是否异步处理。默认是 true
* @param is_cache 可选 浏览器是否缓存被请求页面。默认是 true
* */
this.submit = function (href, data, ajaxtype, table, callback, dataType, is_async, is_cache) {
if (data !== undefined) {
$.ajaxSetup({data: JSON.stringify(data)});
} else {
$.ajaxSetup({data: ''});
}
if (dataType !== undefined) {
$.ajaxSetup({dataType: dataType});
}
if (is_async !== undefined) {
$.ajaxSetup({async: is_async});
}
if (is_cache !== undefined) {
$.ajaxSetup({cache: is_cache});
}
$.ajax({
url: href,
contentType: 'application/json',
type: ajaxtype || 'get',
success: callback != null ? callback : function (result) {
if (result.code === 1) {
layer.msg(result.msg, {icon: 1, time: 1000}, function () {
let frameIndex = parent.layer.getFrameIndex(window.name);
if (frameIndex) {
parent.layer.close(frameIndex);//关闭当前页
}
table && parent.layui.table.reloadData(table);
});
} else {
layer.msg(result.msg, {icon: 2, time: 1000});
}
},
error: function (xhr) {
if (xhr.status === 401) {
layer.msg('权限不足,您无法访问受限资源或数据', {icon: 5});
return;
}
if (xhr.status === 404) {
layer.msg('请求url地址错误,请确认后刷新重试', {icon: 5});
return;
}
if (xhr.status === 419) {
layer.msg('长时间未操作,自动刷新后重试!', {icon: 5});
setTimeout(function () {
window.location.reload();
}, 2000);
return;
}
if (xhr.status === 429) {
layer.msg('尝试次数太多,请一分钟后再试', {icon: 5});
return;
}
if (xhr.status === 500) {
layer.msg(xhr.responseJSON.message, {icon: 5});
}
}
, complete: function (xhr, status) {
}
})
}
}
exports(MOD_NAME, common);
});
+38
View File
@@ -0,0 +1,38 @@
layui.define(['jquery', 'element'], function(exports) {
"use strict";
var MOD_NAME = 'context',
$ = layui.jquery,
element = layui.element;
var context = new function() {
this.put = function(key,value){
if(typeof value === "object"){
value = JSON.stringify(value);
}
localStorage.setItem(key,value);
};
this.get = function(key){
var str = localStorage.getItem(key);
if (typeof str === "string") {
try {
var obj = JSON.parse(str);
if (typeof obj == 'object' && obj) {
return obj;
} else {
return str;
}
} catch (e) {
return str;
}
}
};
this.del = function(key){
localStorage.removeItem(key);
}
};
exports(MOD_NAME, context);
});
+27
View File
@@ -0,0 +1,27 @@
layui.define(['jquery', 'element'], function(exports) {
"use strict";
/**
* 类 型 转 换 工 具 类
* */
var MOD_NAME = 'convert',
$ = layui.jquery,
element = layui.element;
var convert = new function() {
// image 转 base64
this.imageToBase64 = function(img) {
var canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, img.width, img.height);
var ext = img.src.substring(img.src.lastIndexOf(".")+1).toLowerCase();
var dataURL = canvas.toDataURL("image/"+ext);
return dataURL;
}
}
exports(MOD_NAME, convert);
});
+37
View File
@@ -0,0 +1,37 @@
layui.define(['jquery', 'element'], function(exports) {
"use strict";
var MOD_NAME = 'count',
$ = layui.jquery,
element = layui.element;
var count = new function() {
this.up = function(targetEle, options) {
options = options || {};
var $this = document.getElementById(targetEle),
time = options.time,
finalNum = options.num,
regulator = options.regulator,
step = finalNum / (time / regulator),
count = 0.00,
initial = 0;
var timer = setInterval(function() {
count = count + step;
if (count >= finalNum) {
clearInterval(timer);
count = finalNum;
}
var t = count.toFixed(options.bit?options.bit:0);;
if (t == initial) return;
initial = t;
$this.innerHTML = initial;
}, 30);
}
}
exports(MOD_NAME, count);
});
File diff suppressed because it is too large Load Diff
+182
View File
@@ -0,0 +1,182 @@
layui.define(['layer', 'form'], function(exports) {
var layer = layui.layer,
form = layui.form,
$ = layui.$,
key = '';
delHtml()
$('button').on('click', function() {
var _this = $(this),
size = _this.data('size'),
type = _this.data('type'),
html = '';
key = randStrName();
switch (type) {
case 'text':
html = input(type, size)
break;
case 'password':
html = input(type, size)
break;
case 'select':
html = select(size)
break;
case 'checkbox_a':
html = checkbox_a(size)
break;
case 'checkbox_b':
html = checkbox_b(size)
break;
case 'radio':
html = radio(size)
break;
case 'textarea':
html = textarea(size)
break;
case 'submit':
html = submits(size)
break;
case 'del':
$('form').html("\n")
delHtml()
$('.code-show').text('')
return false
break;
default:
layer.msg('类型错误', {
icon: 2
})
}
$('form').append(html);
form.render();
setHtml(html)
})
function delHtml() {
layui.data('form_html', {
key: 'html',
remove: true
});
}
function setHtml(html) {
var h = layui.data('form_html');
if (h && h.html) {
var _d = h.html + html
} else {
var _d = html
}
layui.data('form_html', {
key: 'html',
value: _d
})
$('.code-show').text('<form class="layui-form" action="" onsubmit="return false">\n' + _d + '</form>')
}
function input(type, size) {
var name = type === 'text' ? '输入框' : (type === 'password' ? '密码框' : '');
var html = ' <div class="layui-form-item">\n' +
' <label class="layui-form-label">' + name + '</label>\n' +
' <div class="layui-input-' + size + '">\n' +
' <input type="' + type + '" name="' + key + '" required lay-verify="required" placeholder="请输入' + name +
'内容" autocomplete="off" class="layui-input">\n' +
' </div>\n' +
' </div>\n';
return html;
}
function select(size) {
var html = ' <div class="layui-form-item">\n' +
' <label class="layui-form-label">选择框</label>\n' +
' <div class="layui-input-' + size + '">\n' +
' <select name="' + key + '" lay-verify="required" lay-search>\n' +
' <option value=""></option>\n' +
' <option value="0">北京</option>\n' +
' <option value="1">上海</option>\n' +
' <option value="2">广州</option>\n' +
' <option value="3">深圳</option>\n' +
' <option value="4">杭州</option>\n' +
' </select>\n' +
' </div>\n' +
' </div>\n';
return html;
}
function checkbox_a(size) {
var html = ' <div class="layui-form-item">\n' +
' <label class="layui-form-label">复选框</label>\n' +
' <div class="layui-input-' + size + '">\n' +
' <input type="checkbox" name="' + key + '[]" title="写作">\n' +
' <input type="checkbox" name="' + key + '[]" title="阅读" checked>\n' +
' <input type="checkbox" name="' + key + '[]" title="发呆">\n' +
' </div>\n' +
' </div>\n';
return html;
}
function checkbox_b(size) {
var html = ' <div class="layui-form-item">\n' +
' <label class="layui-form-label">开关</label>\n' +
' <div class="layui-input-' + size + '">\n' +
' <input type="checkbox" name="' + key + '" lay-skin="switch">\n' +
' </div>\n' +
' </div>\n';
return html;
}
function radio(size) {
var html = ' <div class="layui-form-item">\n' +
' <label class="layui-form-label">单选框</label>\n' +
' <div class="layui-input-' + size + '">\n' +
' <input type="radio" name="' + key + '" value="男" title="男">\n' +
' <input type="radio" name="' + key + '" value="女" title="女" checked>\n' +
' </div>\n' +
' </div>\n';
return html;
}
function textarea(size) {
var html = ' <div class="layui-form-item layui-form-text">\n' +
' <label class="layui-form-label">文本域</label>\n' +
' <div class="layui-input-' + size + '">\n' +
' <textarea name="' + key + '" placeholder="请输入内容" class="layui-textarea"></textarea>\n' +
' </div>\n' +
' </div>\n';
return html;
}
function submits(size) {
var html = ' <div class="layui-form-item">\n' +
' <div class="layui-input-' + size + '">\n' +
' <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>\n' +
' <button type="reset" class="layui-btn layui-btn-primary">重置</button>\n' +
' </div>\n' +
' </div>\n';
return html;
}
function jscode() {
var html = '<script>\n' +
' layui.use(\'form\', function(){\n' +
' var form = layui.form;\n' +
' form.on(\'submit(formDemo)\', function(data){\n' +
' layer.msg(JSON.stringify(data.field));\n' +
' return false;\n' +
' });\n' +
' });\n' +
'</script>';
return html;
}
function randStrName() {
return Math.random().toString(36).substr(8);
}
var jscodehtml = jscode();
$('.js-show').text(jscodehtml)
form.on('submit(formDemo)', function(data) {
layer.msg(JSON.stringify(data.field));
return false;
});
exports('design', {});
});
+420
View File
@@ -0,0 +1,420 @@
layui.define(['jquery', 'element', 'layer', 'loading'], function (exports) {
"use strict";
/**
* Drawer component
* */
var MOD_NAME = 'drawer',
$ = layui.jquery,
element = layui.element,
layer = layui.layer,
loading = layui.loading;
var drawer = new function () {
/**
* open drawer
* */
this.open = function (option) {
// 默认使用 legacy 模式
if (option.legacy === undefined) {
option.legacy = true;
};
if (option.legacy) {
var obj = new mSlider({
target: option.target,
dom: option.dom,
direction: option.direction,
distance: option.distance,
time: option.time ? option.time : 0,
maskClose: option.maskClose,
callback: option.success
});
obj.open();
return obj;
} else {
return layerDrawer(option);
}
}
this.title = layer.title;
this.style = layer.style;
this.close = layer.close;
this.closeAll = layer.closeAll;
}
/**
*
* 封装 layer.open
* type,anim,move,fixed不可用,其它参数和 layer.open 一致
* @param {LayerOption} option
* @returns 原生 layer 的 index
*/
function layerDrawer(option) {
var opt = normalizeOption(option)
if (opt.target) appendToTarget(opt);
if (opt.url) loadFragment(opt);
var layerIndex = layer.open(opt);
return layerIndex;
}
/**
* 加载 HTML 片段到 layer content
* @param {*} option
*/
function loadFragment(option) {
option.success = Aspect(option.success, function (layero, index) {
var layerID = "#" + layero.attr("id");
loading.block({
type: 1,
elem: layerID,
msg: ''
});
$.ajax({
url: option.url,
dataType: "html",
success: function (result) {
layero.children('.layui-layer-content').html(result);
loading.blockRemove(layerID);
}
})
})
}
/**
*将 layer 挂载到指定节点
* @param {object} opt
*/
function appendToTarget(opt) {
var targetDOM = $(opt.target);
var contentDOM = $(opt.content);
contentDOM.appendTo(targetDOM);
opt.skin = getDrawerAnimationClass(opt.offset, true);
opt.offset = calcOffset(opt.offset, opt.area, targetDOM);
// 处理关闭后偶现 DOM 仍显示的问题,layer 的 BUG
opt.end = Aspect(opt.end, function () {
contentDOM.css("display", "none");
})
if (opt.shade) {
opt.success = Aspect(opt.success, function (layero, index) {
var shadeDOM = $("#layui-layer-shade" + index);
shadeDOM.css("position", "absolute");
shadeDOM.appendTo(layero.parent());
})
}
}
/**
* 规格化 layer.open 选项,兼容原版 Drawer 所有选项
* @param {LayerOption} option layer.open 的选项
* @returns 规格化后的 layer.open 选项
*/
function normalizeOption(option) {
if (option.direction && !option.offset) {
if (option.direction === "right") {
option.offset = "r";
} else if (option.direction === "left") {
option.offset = "l";
} else if (option.direction === "top") {
option.offset = "t";
} else if (option.direction === "bottom") {
option.offset = "b";
} else {
option.offset = "r";
}
}
if (option.distance && !option.area) {
option.area = option.distance;
}
if (option.dom && !option.content) {
option.content = $(option.dom);
}
if (option.maskClose && option.shadeClose === undefined) {
option.shadeClose = (option.maskClose + "").toString() !== "false" ? true : false;
}
option.type = 1
option.anim = -1;
option.move = false;
option.fixed = true;
if (option.iframe) {
option.type = 2;
option.content = option.iframe;
}
if (option.offset === undefined) option.offset = "r";
option.area = calcDrawerArea(option.offset, option.area);
if (option.title === undefined) option.title = false;
if (option.closeBtn === undefined) option.closeBtn = false;
if (option.shade === undefined) option.shade = 0.3;
if (option.shadeClose === undefined) option.shadeClose = true;
if (option.skin === undefined) option.skin = getDrawerAnimationClass(option.offset);
if (option.resize === undefined) option.resize = false;
if (option.success === undefined) option.success = function () { }; // 处理遮罩需要
if (option.end === undefined) option.end = function () { };
return option;
}
/**
* 计算抽屉宽高
* @param {string} offset 抽屉方向 l = 左, r = 右, t = 上, b = 下
* @param {string[] | string} drawerArea 抽屉大小,字符串数组格式:[width, height],字符串格式:百分比或单位 px。
* @returns 抽屉宽高数组
*/
function calcDrawerArea(offset, drawerArea) {
if (drawerArea instanceof Array) {
return drawerArea;
}
if (drawerArea === undefined || drawerArea === "auto") {
drawerArea = "30%";
}
if (offset === "l" || offset === "r") {
return [drawerArea, "100%"];
} else if (offset === "t" || offset === "b") {
return ["100%", drawerArea];
}
return [drawerArea, "100%"];
}
/**
* 获取抽屉动画类
* @param {string} offset 抽屉方向
* @param {boolean} 是否 absolute 布局
* @returns 抽屉入场动画类
*/
function getDrawerAnimationClass(offset, isAbsolute) {
var positionAbsoluteClass = "position-absolute ";
var prefixClass = "laytp-drawer laytp-drawer-anim layui-anim layer-anim-";
var suffix = "rl";
if (isAbsolute) {
prefixClass = positionAbsoluteClass + prefixClass;
}
if (offset === "l") {
suffix = "lr";
} else if (offset === "r") {
suffix = "rl";
} else if (offset === "t") {
suffix = "tb";
} else if (offset === "b") {
suffix = "bt";
}
return prefixClass + suffix;
}
/**
* 指定挂载容器重新计算 offset
* @param {*} offset 位置
* @param {*} area 范围大小
* @param {*} targetEl 挂载节点
* @returns 包含抽屉位置信息的数组,[top,left]
*/
function calcOffset(offset, area, targetEl) {
if (offset === undefined || offset === "l" || offset === "t") {
offset = "lt";
} else if (offset === "r") {
var left;
if (area instanceof Array) {
area = area[0];
}
if (area.indexOf("%") != -1) {
left = targetEl.innerWidth() * (1 - area.replace("%", "") / 100);
} else {
left = targetEl.innerWidth() - area;
}
offset = [0, left];
} else if (offset === "b") {
var top;
if (area instanceof Array) {
area = area[1];
}
if (area.indexOf("%") != -1) {
top = targetEl.innerHeight() * (1 - area.replace("%", "") / 100);
} else {
top = targetEl.innerHeight() - area;
}
offset = [top, 0];
}
return offset;
}
/**
* 简易的切面
* @param {Function} func 被通知的对象,原函数
* @param {Function | undefined} before 前置通知
* @param {Function | undefined} after 后置通知
* @returns 代理函数
*/
function Aspect(target, before, after) {
function proxyFunc() {
if (before && typeof before === "function") {
before.apply(this, arguments)
}
target.apply(this, arguments);
if (after && typeof after === "function") {
after.apply(this, arguments)
}
}
return proxyFunc;
}
exports(MOD_NAME, drawer);
});
/**
* 源码
* */
(function (b, c) {
function a(d) {
this.opts = {
"target": d.target || "body",
"direction": d.direction || "left",
"distance": d.distance || "60%",
"dom": this.Q(d.dom),
"time": d.time || "",
"maskClose": (d.maskClose + "").toString() !== "false" ? true : false,
"callback": d.callback || ""
};
this.rnd = this.rnd();
this.target = this.opts.target;
this.dom = this.opts.dom[0];
this.wrap = "";
this.inner = "";
this.mask = "";
this.init()
}
a.prototype = {
Q: function (d) {
return document.querySelectorAll(d)
},
isMobile: function () {
return navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i) ? true : false
},
addEvent: function (f, e, d) {
if (f.attachEvent) {
f.attachEvent("on" + e, d)
} else {
f.addEventListener(e, d, false)
}
},
rnd: function () {
return Math.random().toString(36).substr(2, 6)
},
init: function () {
var g = this;
if (!g.dom) {
console.log("未正确绑定弹窗容器");
return
}
g.dom.style.display = "block"; // 兼容 layer 捕获层
var d = document.createElement("div");
var e = document.createElement("div");
var f = document.createElement("div");
d.setAttribute("class", "mSlider-main ms-" + g.rnd);
e.setAttribute("class", "mSlider-inner");
f.setAttribute("class", "mSlider-mask");
g.Q(g.target)[0].appendChild(d);
g.Q(".ms-" + g.rnd)[0].appendChild(e);
g.Q(".ms-" + g.rnd)[0].appendChild(f);
g.wrap = g.Q(".ms-" + g.rnd)[0];
g.inner = g.Q(".ms-" + g.rnd + " .mSlider-inner")[0];
g.mask = g.Q(".ms-" + g.rnd + " .mSlider-mask")[0];
g.inner.appendChild(g.dom);
switch (g.opts.direction) {
case "top":
g.top = "0";
g.left = "0";
g.width = "100%";
g.height = g.opts.distance;
g.translate = "0,-100%,0";
break;
case "bottom":
g.bottom = "0";
g.left = "0";
g.width = "100%";
g.height = g.opts.distance;
g.translate = "0,100%,0";
break;
case "right":
g.top = "0";
g.right = "0";
g.width = g.opts.distance;
g.height = document.documentElement.clientHeight + "px";
g.translate = "100%,0,0";
break;
default:
g.top = "0";
g.left = "0";
g.width = g.opts.distance;
g.height = document.documentElement.clientHeight + "px";
g.translate = "-100%,0,0"
}
g.wrap.style.display = "none";
g.wrap.style.position = (g.target === "body" ? "fixed" : "absolute");
g.wrap.style.top = "0";
g.wrap.style.left = "0";
g.wrap.style.width = "100%";
g.wrap.style.height = "100%";
g.wrap.style.zIndex = 9999999;
g.inner.style.position = "absolute";
g.inner.style.top = g.top;
g.inner.style.bottom = g.bottom;
g.inner.style.left = g.left;
g.inner.style.right = g.right;
g.inner.style.width = g.width;
g.inner.style.height = (g.target === "body" ? g.height : "100%");
g.inner.style.backgroundColor = "#fff";
g.inner.style.transform = "translate3d(" + g.translate + ")";
g.inner.style.webkitTransition = "all .2s ease-out";
g.inner.style.transition = "all .2s ease-out";
g.inner.style.zIndex = 10000000;
g.mask.style.width = "100%";
g.mask.style.height = "100%";
g.mask.style.opacity = "0.1";
g.mask.style.backgroundColor = "black";
g.mask.style.zIndex = "9999998";
g.mask.style.webkitBackfaceVisibility = "hidden";
g.events()
},
open: function () {
var d = this;
d.wrap.style.display = "block";
setTimeout(function () {
d.inner.style.transform = "translate3d(0,0,0)";
d.inner.style.webkitTransform = "translate3d(0,0,0)";
d.mask.style.opacity = 0.1
d.opts.callback && d.opts.callback(d)
}, 30);
if (d.opts.time) {
d.timer = setTimeout(function () {
d.close()
}, d.opts.time)
}
},
close: function () {
var d = this;
d.timer && clearTimeout(d.timer);
d.inner.style.webkitTransform = "translate3d(" + d.translate + ")";
d.inner.style.transform = "translate3d(" + d.translate + ")";
d.mask.style.opacity = 0;
setTimeout(function () {
d.wrap.style.display = "none";
d.timer = null;
}, 300)
},
events: function () {
var d = this;
d.addEvent(d.mask, "touchmove", function (f) {
f.preventDefault()
});
d.addEvent(d.mask, (d.isMobile() ? "touchend" : "click"), function (f) {
if (d.opts.maskClose) {
d.close()
}
})
}
};
b.mSlider = a
})(window);
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+450
View File
@@ -0,0 +1,450 @@
layui.define(function(exports) {
exports('echartsTheme',
{
"color": [
"#3fb1e3",
"#6be6c1",
"#626c91",
"#a0a7e6",
"#c4ebad",
"#96dee8"
],
"backgroundColor": "rgba(252,252,252,0)",
"textStyle": {},
"title": {
"textStyle": {
"color": "#666666"
},
"subtextStyle": {
"color": "#999999"
}
},
"line": {
"itemStyle": {
"borderWidth": "3"
},
"lineStyle": {
"width": "4"
},
"symbolSize": "10",
"symbol": "emptyCircle",
"smooth": true
},
"radar": {
"itemStyle": {
"borderWidth": "3"
},
"lineStyle": {
"width": "4"
},
"symbolSize": "10",
"symbol": "emptyCircle",
"smooth": true
},
"bar": {
"itemStyle": {
"barBorderWidth": 0,
"barBorderColor": "#ccc"
},
"emphasis": {
"itemStyle": {
"barBorderWidth": 0,
"barBorderColor": "#ccc"
}
}
},
"pie": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"scatter": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"boxplot": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"parallel": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"sankey": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"funnel": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"gauge": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"candlestick": {
"itemStyle": {
"color": "#e6a0d2",
"color0": "transparent",
"borderColor": "#e6a0d2",
"borderColor0": "#3fb1e3",
"borderWidth": "2"
}
},
"graph": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"lineStyle": {
"width": "1",
"color": "#cccccc"
},
"symbolSize": "10",
"symbol": "emptyCircle",
"smooth": true,
"color": [
"#3fb1e3",
"#6be6c1",
"#626c91",
"#a0a7e6",
"#c4ebad",
"#96dee8"
],
"label": {
"color": "#ffffff"
}
},
"map": {
"itemStyle": {
"areaColor": "#eeeeee",
"borderColor": "#aaaaaa",
"borderWidth": 0.5
},
"label": {
"color": "#ffffff"
},
"emphasis": {
"itemStyle": {
"areaColor": "rgba(63,177,227,0.25)",
"borderColor": "#3fb1e3",
"borderWidth": 1
},
"label":{
"color": "rgb(63,177,227)"
}
}
},
"geo": {
"itemStyle": {
"areaColor": "#eeeeee",
"borderColor": "#aaaaaa",
"borderWidth": 0.5
},
"label": {
"color": "#ffffff"
},
"emphasis": {
"itemStyle": {
"areaColor": "rgba(63,177,227,0.25)",
"borderColor": "#3fb1e3",
"borderWidth": 1
},
"label":{
"color": "rgb(63,177,227)"
}
}
},
"categoryAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#cccccc"
}
},
"axisTick": {
"show": false,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"color": "#999999"
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#eeeeee"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.05)",
"rgba(200,200,200,0.02)"
]
}
}
},
"valueAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#cccccc"
}
},
"axisTick": {
"show": false,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"color": "#999999"
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#eeeeee"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.05)",
"rgba(200,200,200,0.02)"
]
}
}
},
"logAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#cccccc"
}
},
"axisTick": {
"show": false,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"color": "#999999"
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#eeeeee"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.05)",
"rgba(200,200,200,0.02)"
]
}
}
},
"timeAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#cccccc"
}
},
"axisTick": {
"show": false,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"color": "#999999"
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#eeeeee"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.05)",
"rgba(200,200,200,0.02)"
]
}
}
},
"toolbox": {
"iconStyle": {
"borderColor": "#999999"
},
"emphasis": {
"iconStyle": {
"borderColor": "#666666"
}
}
},
"legend": {
"textStyle": {
"color": "#999999"
}
},
"tooltip": {
"axisPointer": {
"lineStyle": {
"color": "#cccccc",
"width": 1
},
"crossStyle": {
"color": "#cccccc",
"width": 1
}
}
},
"timeline": {
"lineStyle": {
"color": "#626c91",
"width": 1
},
"itemStyle": {
"color": "#626c91",
"borderWidth": 1
},
"controlStyle": {
"color": "#626c91",
"borderColor": "#626c91",
"borderWidth": 0.5
},
"checkpointStyle": {
"color": "#3fb1e3",
"borderColor": "rgba(63,177,227,0.15)"
},
"label": {
"color": "#626c91"
},
"emphasis": {
"itemStyle": {
"color": "#626c91"
},
"controlStyle":{
"color": "#626c91",
"borderColor": "#626c91",
"borderWidth": 0.5
},
"label":{
"color": "#626c91"
}
}
},
"visualMap": {
"color": [
"#2a99c9",
"#afe8ff"
]
},
"dataZoom": {
"backgroundColor": "rgba(255,255,255,0)",
"dataBackgroundColor": "rgba(222,222,222,1)",
"fillerColor": "rgba(114,230,212,0.25)",
"handleColor": "#cccccc",
"handleSize": "100%",
"textStyle": {
"color": "#999999"
}
},
"markPoint": {
"label": {
"color": "#ffffff"
},
"emphasis": {
"label": {
"color": "#ffffff"
}
}
}
});
});
File diff suppressed because it is too large Load Diff
+924
View File
@@ -0,0 +1,924 @@
/**
* 常用函数库
* @version: 2.0
* @Author: JunStar
* @Date: 2020-7-22 20:16:03
* @Last Modified by: JunStar
* @Last Modified time: 2020-08-28 18:15:28
*/
layui.define([
"context",
"notice",
"popup",
],function (exports) {
const MOD_NAME = "facade";
let $ = layui.$;
let facade = {
arrayToUrlParams: function(paramsArray) {
var urlParams = [];
for(let key in paramsArray){
urlParams.push( encodeURIComponent(key) + '=' + encodeURIComponent(paramsArray[key]));
}
return urlParams.join('&');
},
/**
* 当前是否为与移动端
* */
isMobile: function(){
if ($(window).width() <= 768) {
return true;
}
return false;
},
//获取是否为静态界面独立域名部署模式
isAdminDomainModel: function(){
return (localStorage.getItem('adminDomainModel') === 'true');
},
/**
* 兼容Html页面path
* 兼容单域名和多域名部署
* @param htmlPath
* @returns {string}
*/
compatibleHtmlPath: function(htmlPath){
if(facade.isAdminDomainModel()){
if(htmlPath.substring(0,7) === '/admin/'){
htmlPath = '/' + htmlPath.substring(7);
}
}else{
if(htmlPath.substring(0,7) !== '/admin/'){
htmlPath = '/admin/' + facade.ltrim(htmlPath, '/');
}
}
return htmlPath;
},
/**
* 兼容Api地址
* 兼容单域名和多域名部署
* @param apiPath
* @returns {string}
*/
compatibleApiRoute: function(apiRoute){
if(facade.getAdminApiDomain()){
if(apiRoute.substring(0,7) === '/admin.' && apiRoute.substring(0,8) !== '/plugin/'){
apiRoute = '/' + apiRoute.substring(7);
}
}else{
if(apiRoute.substring(0,7) !== '/admin.' && apiRoute.substring(0,8) !== '/plugin/'){
apiRoute = '/admin.' + facade.ltrim(apiRoute, '/');
}
}
return apiRoute;
},
/**
* 根据路由获取Api请求地址
* 兼容单域名和多域名部署
* @param apiRoute
* @returns {string}
*/
getApiUrlByRoute: function(apiRoute){
return facade.getAdminApiDomain() + facade.compatibleApiRoute(apiRoute);
},
//获取静态资源访问域名
getStaticDomain: function(){
return localStorage.getItem('staticDomain');
},
//获取后台接口访问域名
getAdminApiDomain: function(){
return localStorage.getItem('adminApiDomain');
},
//获取文件后缀名
getFileExt: function(filename){
return filename.substring(filename.lastIndexOf('.')+1);
},
//判断是否为数组
isArray: function (obj) {
return obj instanceof Array;
},
//下划线转驼峰
underlineToCamel: function(str, firstUpper){
let ret = str.toLowerCase();
ret = ret.replace( /_([\w+])/g, function( all, letter ) {
return letter.toUpperCase();
});
if(firstUpper){
ret = ret.replace(/\b(\w)(\w*)/g, function($0, $1, $2) {
return $1.toUpperCase() + $2;
});
}
return ret;
},
//驼峰转下划线
camelToUnderline: function(str, upper){
const ret = str.replace(/([A-Z])/g,"_$1");
if(upper){
return ret.toUpperCase();
}else{
return ret.toLowerCase();
}
},
//首字母大写
ucFirst: function(str){
let ret = str.toLowerCase();
ret = ret.replace(/\b(\w)(\w*)/g, function($0, $1, $2) {
return $1.toUpperCase() + $2;
});
return ret;
},
//获取表单中编辑器的内容设置到表单元素中
setEditorField: function(data){
let obj = $(".editor");
if(obj.length>0){
layui.each(obj, function (key, item) {
let id = $(item).data('id');
let type = $(item).data('type');
let pluginConf = layui.context.get("pluginConf");
if(facade.inArray("ueditor", pluginConf.installedEditor)){
try{
data.field[id] = $(item)[0].contentWindow.getEditorContent();//这一句不能省略,否则第一次提交表单时会获取不到值
}catch (e) {
throw new Error(type + '编辑器未初始化完成,请勿提交表单');
}
}
// meditor编辑器有两个内容,
// 一个是Markdown语法的内容,一个是html标记的内容,
// Markdown语法的内容会存入字段,如果需要存储html的内容,自行在控制器中加入代码存储
if(facade.inArray("meditor", pluginConf.installedEditor)){
if(type === "meditor"){
try{
data.field[id+"_html"] = $(item)[0].contentWindow.getHtmlContent();//这一句不能省略,否则第一次提交表单时会获取不到值
}catch (e) {
throw new Error('meditor编辑器未初始化完成,请勿提交表单');
}
}
}
});
}
return data;
},
/**
* 设置cookie
* @param name
* @param value
* @param Days 有效天数
* - 为0时,有效期与会话Session一致
* - 大于0,有效期为天数
* - 小于0,删除cookie
*/
setCookie: function (name, value, Days) {
let exp = new Date();
let expires = 0;
if (Days === undefined) {
Days = 0;
}
if (Days > 0) {
exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
expires = exp.toGMTString();
} else if (Days == 0) {
expires = 0;
} else {
exp.setTime(exp.getTime() - 1);
expires = exp.toGMTString();
}
document.cookie = name + "=" + escape(value) + ";expires=" + expires + ";path=/";
},
//获取cookie
getCookie: function (name) {
let arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
if (arr != null) {
return (arr[2]);
} else {
return "";
}
},
//删除cookie
delCookie: function (name) {
let cookieVal = facade.getCookie(name);
if (cookieVal != null) {
facade.setCookie(name, "", -1);
}
},
// 清空所有缓存数据
// 不清空与主题样式有关的数据缓存
clearCache: function(){
// var themeStorageKeys = ['theme-color','theme-menu','theme-color-context'];
var themeColor = localStorage.getItem('theme-color');
var themeMenu = localStorage.getItem('theme-menu');
var themeColorContext = localStorage.getItem('theme-color-context');
localStorage.clear();
localStorage.setItem('theme-color', themeColor);
localStorage.setItem('theme-menu', themeMenu);
localStorage.setItem('theme-color-context', themeColorContext);
sessionStorage.clear();
var tokenKey = layui.context.get("tokenCookieKey") ? layui.context.get("tokenCookieKey") : "laytpAdminToken";
facade.delCookie(tokenKey);
},
//layer提示操作成功
success: function (text) {
layui.notice.success(text);
},
/**
* layer操作失败提示
* @param text 提示内容
* @param title 弹窗标题
* @param callback 点击确定后的匿名回调函数
*/
error: function (text, title, callback) {
console.info(text);
layui.notice.error(text);
// if (title === undefined) {
// title = "错误提示信息"
// }
// let options = {
// closeBtn: 0
// , btnAlign: "r"
// , skin: "laytp"
// , title: title
// , yes: function () {
// if (typeof callback === "function") {
// callback();
// }
// layui.layer.close(alertLayer);
// }
// };
// let alertLayer = layui.layer.alert(text, options);
},
//layer提示框
alert: function (text, title, callback) {
if (title === undefined) {
title = "提示信息"
}
layui.layer.alert(text, {
closeBtn: 0
, title: title
}, callback);
},
//layer加载层
loading: function (type) {
if (type == null) {
type = 0;
}
return layui.layer.load(type, {shade: 0.1});
},
//关闭layer加载层
closeLoading: function (loading) {
return layui.layer.close(loading);
},
/**
* 根据Api请求的路由和需要传递的参数组合成url
* 兼容单域名部署和多域名部署
* @param route string
* @param params object
* @returns {string}
*/
url: function (route, params) {
let count = 0;
let k;
for (k in params) {
if (params.hasOwnProperty(k)) {
count++;
}
}
if (typeof params !== "undefined" && count > 0) {
params = $.param(params);
} else {
params = "";
}
route = "/" + route.replace(/(^\/)|(\/$)/, "");
route = facade.getApiUrlByRoute(route);
return params ? route + "?" + params : route;
},
//组装成插件url
pluginUrl: function (plugin, path, params) {
let count = 0;
let k;
for (k in params) {
if (params.hasOwnProperty(k)) {
count++;
}
}
if (typeof params !== "undefined" && count > 0) {
let urlParams = {}, key;
for (key in params) {
if (params[key]) urlParams[key] = params[key];
}
params = $.param(urlParams);
let reg = new RegExp("=", "g");
params = params.replace(reg, "/");
let reg_1 = new RegExp("&", "g");
params = params.replace(reg_1, "/");
params = "/" + params;
} else {
params = "";
}
path = "/" + path.replace(/(^\/)|(\/$)/, "");
return "/plugin/" + plugin + path + params;
},
//跳转页面,传入path,兼容单域名部署模式和多域名部署模式
redirect: function (path) {
top.location.href = facade.compatibleHtmlPath(path);
},
//跳转指定url页面
redirectUrl: function (url) {
top.location.href = url;
},
/**
* ajax封装
* @param options
* options.route route和url二选一,优先使用route,请求接口的路由,函数内部会自行兼容单域名和多域名部署模式
* options.url route和url二选一,请求接口的完整url地址,如果仅设置了url参数,那么url的值是什么,ajax请求的地址就是什么
* options.data 请求参数,调用时允许设置成对象,封装函数会判断为对象时,自动转换成json字符串
* options.type 请求方式,默认为POST
* options.async 是否异步请求,默认为true,是异步请求
* options.contentType 参数传递的格式,默认application/json
* options.dataType 解析数据返回的格式,默认json
* options.successAlert 请求成功是否弹窗提示,默认true
* options.errorAlert 请求失败是否弹窗提示,默认true
* options.exceptionAlert 请求异常是否弹窗提示,默认true
* options.showLoading 是否显示加载层,默认false,不显示加载层
* options.headers ajax请求时,需要传递的headers,默认值使用ajaxHeaders全局变量进行定义
* @returns {PromiseLike<T | never> | Promise<T | never> | *}
*/
ajax: function (options) {
/**
* 如果不加laytp.init.ajaxSet();的代码,登录后浏览器里面删除cookie,header里面依旧会传递token
* 没有直接使用laytp.init.ajaxSet();是因为laytp的init对象中有使用到facade.ajax方法,在这里又调用laytp.init会报错
*/
if(!options.url && !options.route){
return facade.error("facade.ajax()未定义options.url和options.route");
}
if(options.route){
options.url = facade.getAdminApiDomain() + facade.compatibleApiRoute(options.route);
}
if (options.showLoading == null) options.showLoading = false;
let loading;
if (options.showLoading) {
loading = facade.loading();
}
if (options.successAlert == null) options.successAlert = true;
if (options.errorAlert == null) options.errorAlert = true;
if (options.exceptionAlert == null) options.exceptionAlert = true;
if (options.async == null) options.async = true;
if (options.type == null) options.type = "POST";
// TP6已经完全兼容application/json和application/x-www-form-urlencoded方式传递参数
// 两种方式传递参数,后端使用$this->request->param();都能得到想要的参数
// 只是为了html的name="sign[]"这种方式方便传递数组类型的参数,所以此处默认使用application/x-www-form-urlencoded方式
if (options.contentType == null) options.contentType = "application/x-www-form-urlencoded";
if (options.dataType == null) options.dataType = "json";
if (options.data == null) options.data = {};
if (typeof options.data === "object" && options.contentType === "application/json") options.data = JSON.stringify(options.data);
if (options.headers == null) options.headers = layui.context.get("ajaxHeaders");
return $.ajax({
timeout: 30000,
headers: options.headers,
complete: function () {
if (options.showLoading) {
facade.closeLoading(loading);
}
},
// ajax请求无需cookie,此处禁止携带cookie进行请求
xhrFields : {
withCredentials : false
},
url : options.url,
async: options.async,
data : options.data,
contentType: options.contentType,//此参数是指定ajax请求的参数格式为json字符串
type: options.type,
dataType: options.dataType,//此参数是指定将ajax请求返回的字符串结果转换为json对象
success: function(res, statusText, xhr){
if (xhr.status === 204) {
facade.error("后端接口没有返回结果", "异常提示");
}
if (res.code === 10401) {
layui.popup.failure(res["msg"],function(){
facade.redirect("/admin/login.html");
});
}
if (options.errorAlert && res.code === 1) {
facade.error(res["msg"]);
}
if (options.successAlert && res["code"] === 0) {
facade.success(res["msg"]);
}
if( res.code > 10000 ){
facade.error(res["msg"]);
}
// defer.resolve(res);
},
error: function (xhr) {
if(options.exceptionAlert){
if(xhr.status === 0){
facade.error('Ajax请求【' + options.url + '】时出现网络错误');
}else{
if (xhr["responseJSON"] === undefined) {
facade.error(xhr["responseText"]);
} else {
facade.error("[Message:]" + xhr["responseJSON"]["message"] + "<br /><br />[File:]" + xhr["responseJSON"]["traces"][0]["file"] + "<br /><br />[Line:]" + xhr["responseJSON"]["traces"][0]["line"], "异常提示");
}
}
}
}
});
// return $.ajax({
// timeout: 30000,
// headers: options.headers,
// complete: function () {
// if (options.showLoading) {
// facade.closeLoading(loading);
// }
// },
// url: options.url,
// async: options.async,
// // data: options.data,
// // TP6已经完全兼容application/json和application/x-www-form-urlencoded方式传递参数
// // 使用如下方式传递参数,后端使用$this->request->param();依旧能得到想要的参数
// data : options.data,
// contentType: options.contentType,//此参数是指定ajax请求的参数格式为json字符串
// type: options.type,
// dataType: "json",//此参数是指定将ajax请求返回的字符串结果转换为json对象
// success: function (res, statusText, xhr) {
// if (xhr.status === 204) {
// facade.error("后端接口没有返回结果", "异常提示");
// return;
// }
// if (res.code === 10401) {
// layui.popup.failure(res["msg"],function(){
// facade.clearCache();
// facade.redirect("/admin/login.html");
// });
// return;
// }
// if (options.errorAlert && res.code === 1) {
// facade.error(res["msg"]);
// return;
// }
// if (options.successAlert && res["code"] === 0) {
// facade.success(res["msg"]);
// return;
// }
// return res;
// },
// error: function (xhr) {
// if (xhr["responseJSON"] === undefined) {
// facade.error(xhr["responseText"], "异常提示");
// } else {
// facade.error("[Message:]" + xhr["responseJSON"]["message"] + "<br /><br />[File:]" + xhr["responseJSON"]["traces"][0]["file"] + "<br /><br />[Line:]" + xhr["responseJSON"]["traces"][0]["line"], "异常提示");
// }
// $("[class='laytp-hidden-submitBtn']").attr("disabled", false);
// }
// }).then(function (res) {
// return res;
// });
},
/**
* 去掉字符串左右两端指定字符
* @param str 需要处理的字符串
* @param char 字符,为空时表示去除空格
*/
trim: function (str, char) {
if (char) {
return str.replace(new RegExp("^\\" + char + "+|\\" + char + "+$", "g"), "");
} else {
return str.replace(/^\s+|\s+$/g, "");
}
},
/**
* 去除字符串左侧指定字符
* @param str 需要处理的字符串
* @param char 字符,为空时表示去除空格
*/
ltrim: function (str, char) {
if (char) {
return str.replace(new RegExp("^\\" + char + "+", "g"), "");
} else {
return str.replace(/^\s+|\s+$/g, "");
}
},
/**
* 去除字符串右侧指定字符
* @param str 需要处理的字符串
* @param char 字符,为空时表示去除空格
*/
rtrim: function (str, char) {
if (char) {
return str.replace(new RegExp("\\" + char + "+$", "g"), "");
} else {
return str.replace(/^\s+|\s+$/g, "");
}
},
/**
* 判断元素value是否存在于array数组中
* @param value
* @param array
* @returns {boolean}
*/
inArray: function (value, array) {
let key;
for (key in array) {
if (array[key] == value) {
return true;
}
}
return false;
// let index = $.inArray(value, array);
// return index >= 0;
},
/**
* 从当前url中获取参数
* @param name 参数名称
* @returns {string}
*/
getUrlParam: function (name) {
let sear = window.location.search.substr(1);
let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
let r = sear.match(reg);
return r ? sear.match(reg)[2] : "";
},
/**
* 转义html
* @param s
* @returns {string}
*/
encodeHtml: function (s) {
return (typeof s != "string") ? s :
s.replace(/"|&|'|<|>|[\x00-\x20]|[\x7F-\xFF]|[\u0100-\u2700]/g,
function ($0) {
var c = $0.charCodeAt(0), r = ["&#"];
c = (c == 0x20) ? 0xA0 : c;
r.push(c);
r.push(";");
return r.join("");
});
},
//修改浏览器地址栏地址和标题栏标题
editHistory: function (url) {
let stateObject = {};
let title = "LayTp2.0极速后台开发框架";
history.replaceState(stateObject, title, url);
},
/**
* 封装弹出层
* @param options
* {
* title 必设,弹出层标题
* type 非必设,弹出层类型,1=页面层,2=iframe层,默认2
* path 当type=2时有效,url和path二选一,优先使用path,请求的静态文件path,例:plugin/core/auth.menu/add.html,函数内部会自动兼容单域名和多域名部署模式
* url 当type=2时有效,url和path二选一,优先使用path,弹窗内容的完整url,例:http://www.baidu.com/index.html
* content 当type=1时有效,传弹窗中需要展示的html文本内容
* anim 动画效果,默认slideLeft
* offset 弹窗位置,默认r
* shade 非必设,阴影,默认0.0001
* width 非必设,宽度,单位支持px和%,默认,手机模式下100%,PC模式下90%
* height 高度,单位支持px和%,默认,手机模式下100%,PC模式下90%
* closeBtn layer提供了两种风格的关闭按钮,可通过配置1和2来展示,如果不显示,则closeBtn: 1
* success 弹窗成功后的回调函数
* yes 确定按钮回调
* cancel 右上角关闭按钮触发的回调
* end 层销毁后触发的回调
* }
*/
popupDiv: function (options) {
let loading = facade.loading();
if (!options.title) {
facade.error("facade.popupDiv()没有设置title");
facade.closeLoading(loading);
return false;
}
if(options.type == null){
options.type = 2;
}
if(options.type === 2){
if (!options.url && !options.path) {
facade.error("title为" + options.title + "的facade.popupDiv()的url和path参数都没有设置");
facade.closeLoading(loading);
return false;
}
}else{
if (!options.content) {
facade.error("title为" + options.title + "的facade.popupDiv()的content参数没有设置");
facade.closeLoading(loading);
return false;
}
}
if(!options.width){
options.width = facade.isMobile()?'100%':'60%';
}
if(!options.height){
options.height = facade.isMobile()?'100%':'100%';
}
if (options.shade === undefined) options.shade = 0.03;
if(options.path){
if(options.path.indexOf("?") !== -1){
options.url = facade.compatibleHtmlPath(options.path) + "&f=" + Math.random();
}else{
options.url = facade.compatibleHtmlPath(options.path) + "?f=" + Math.random();
}
}
if(options.closeBtn == null){
options.closeBtn = 1;
}
if(options.anim == null){
options.anim = 'slideLeft';
}
if(options.offset == null){
options.offset = 'r';
}
if(options.success == null){
options.success = function(){
if(options.type === 1){
layui.form.render();
layui.laytpForm.render();
}
facade.closeLoading(loading);
}
}
let layerDivConfig = {
type: options.type
, title: options.title
, anim: options.anim
, shade: options.shade
, shadeClose: true
, content: (options.type === 2) ? options.url : options.content
, area: [options.width, options.height]
, maxmin: true
, skin: "laytp"
, offset: options.offset
, closeBtn : options.closeBtn
, success : options.success
, yes: options.yes
, cancel: options.cancel
, end: options.end
};
return layui.layer.open(layerDivConfig);
},
/**
* 点击按钮打开新的tab menu
* @param options
* {
* id : "菜单ID,用于菜单自动选中,允许不传",
* title : "tab菜单的名称",
* url : "必填,弹窗展示的静态文件url",
* }
*/
openTabMenu: function(options){
if (parent.config.tab.muiltTab) {
parent.bodyTab.addTabOnly({
id: options.id,
title: options.title,
url: options.url,
icon: "",
close: true
}, 300);
} else {
parent.bodyFrame.changePage(options.url, "", true);
}
},
/**
* 封装弹出确认框
* @param options
* {
* text: 弹窗确认框的文本
* route route和url二选一,优先使用route,请求接口的路由,函数内部会自行兼容单域名和多域名部署模式
* url route和url二选一,请求接口的完整url地址,如果仅设置了url参数,那么url的值是什么,ajax请求的地址就是什么
* data: 路由参数
* }
* @param callback
* @returns {boolean}
*/
popupConfirm: function (options, callback) {
if (!options.url && !options.route) {
facade.error("facade.popupConfirm()没有设置options.url和options.route");
return false;
}
if (options.params === undefined) {
options.params = {};
}
let layerConfirm = layui.layer.confirm(options.text, {title: "确认继续", skin: "laytp"}, function () {
facade.ajax({route: options.route, url: options.url, data: options.data, showLoading: true}).done(function (res) {
if (res.code === 0) {
if (typeof callback === "function") {
callback(res);
} else {
if (typeof funController !== "undefined" && typeof funController.tableRender === "function") {
funController.tableRender();
}
if (typeof funRecycleController !== "undefined" && typeof funRecycleController.tableRender === "function") {
funRecycleController.tableRender();
}
}
}
});
layui.layer.close(layerConfirm);
});
},
//获取树插件选中的项
getTreeCheckedIds: function (jsonObj) {
let id = "";
$.each(jsonObj, function (index, item) {
if (id != "") {
id = id + "," + item.id;
} else {
id = item.id;
}
let i = facade.getTreeCheckedIds(item.children);
if (i != "") {
id = id + "," + i;
}
});
return id;
},
/**
* 判断当前后台管理员,是否拥有某个节点的权限
* @param path 完整的路由地址,例:apiPrefix + "add"
* 这里一开始设计的是,只需要传递action,
* 但是为了能自定义开发,能在页面上展示一个跨应用的按钮且进行权限控制,这里需要传递完整的路由地址
* @returns {boolean}
*/
hasAuth: function (path) {
var authList = layui.context.get('authList');
var ruleList = [], key;
for(key in authList){
if(authList[key]['rule']){
ruleList.push(authList[key]['rule']);
}
}
if(facade.isAdminDomainModel()){
if(path.substring(0,7) === '/admin.'){
path = '/' + path.substring(7);
}
}
if (facade.inArray(path, ruleList)) {
return true;
} else {
return false;
}
},
/**
* 格式化数据表格的数据
* @param res
* @param isPage
* @returns {boolean | {code: *, msg: *, count: PaymentItem | number | p.fileLength, data: *}}
*/
parseTableData: function (res, isPage) {
if(!res){
facade.error('接口返回结果为空');
return false;
}
if(res.code === 10401){
layui.popup.failure(res["msg"],function(){
facade.redirect("/admin/login.html");
});
}
if(isPage !== false){
return {
"code": res.code, //解析接口状态
"msg": res.msg, //解析提示文本
"count": res.data.total, //解析数据长度
"data": res.data.data //解析数据列表
};
}else{
return {
"code": res.code, //解析接口状态
"msg": res.msg, //解析提示文本
"count": res.data.length, //解析数据长度
"data": res.data //解析数据列表
};
}
},
/**
* 删除数组指定元素
* @param arr
* @param delVal
*/
arrayRemoveItem: function(arr, delVal) {
if (arr instanceof Array) {
var index = arr.indexOf(delVal);
if (index > -1) {
arr.splice(index, 1);
}
}
},
// 获取对象属性,如果对象不存在此属性,就返回空字符串
getObjAttr: function(object, attr){
if(object.hasOwnProperty(attr)){
return object[attr];
}else{
return '';
}
},
getLimit: function(key){
var allLimit = layui.context.get('allLimit');
if(!allLimit){
allLimit = {};
}
if(!allLimit[key]){
allLimit[key] = 20;
layui.context.put('allLimit', allLimit);
}
return allLimit[key];
},
setLimit: function(key, limit){
var allLimit = layui.context.get('allLimit');
if(!allLimit){
allLimit = {};
}
allLimit[key] = limit;
layui.context.put('allLimit', allLimit);
return true;
},
downloadImg: function(imgUrl, imgTitle){
var img = new Image();
img.src = imgUrl;
// 必须设置,否则canvas中的内容无法转换为blob
img.setAttribute('crossOrigin', 'Anonymous');
img.onload = function () {
var canvas = document.createElement('canvas');
canvas.width = img.width;
canvas.height = img.height;
// 将img中的内容画到画布上
canvas.getContext('2d').drawImage(img, 0, 0, canvas.width, canvas.height);
// 将画布内容转换为Blob
canvas.toBlob(blob => {
// blob转为同源url
var blobUrl = window.URL.createObjectURL(blob);
// 创建a链接
var a = document.createElement('a');
a.href = blobUrl;
a.download = imgTitle || '下载图片'; // 设置图片名称
// 触发a链接点击事件,浏览器开始下载文件
a.click();
});
};
},
downloadFile: function(url, fileName){
fetch(url)
.then(response => response.blob())
.then(blob => {
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = fileName;
link.target = "_blank";// 可选,如果希望在新窗口中下载文件,请取消注释此行
link.click();
});
}
};
//输出模块
exports(MOD_NAME, facade);
//注入layui组件中,供全局调用
layui.facade = facade;
//注入window全局对象中,供全局调用
window.facade = facade;
});
+71
View File
@@ -0,0 +1,71 @@
layui.define(['jquery', 'element'], function(exports) {
"use strict";
var $ = layui.jquery;
var frame = function(opt) {
this.option = opt;
};
frame.prototype.render = function(opt) {
var option = {
elem: opt.elem,
url: opt.url,
title: opt.title,
width: opt.width,
height: opt.height,
done: opt.done ? opt.done : function() {
console.log("菜单渲染成功");
}
}
renderContent(option);
$("#" + option.elem).width(option.width);
$("#" + option.elem).height(option.height);
return new frame(option);
}
frame.prototype.changePage = function(url, loading) {
var $frameLoad = $("#" + this.option.elem).find(".laytp-frame-loading");
var $frame = $("#" + this.option.elem + " iframe");
$frame.attr("src", url);
renderContentLoading($frame, $frameLoad, loading);
}
frame.prototype.changePageByElement = function(elem, url, title, loading) {
var $frameLoad = $("#" + elem).find(".laytp-frame-loading");
var $frame = $("#" + elem + " iframe");
$frame.attr("src", url);
$("#" + elem + " .title").html(title);
renderContentLoading($frame, $frameLoad, loading);
}
frame.prototype.refresh = function(loading) {
var $frameLoad = $("#" + this.option.elem).find(".laytp-frame-loading");
var $frame = $("#" + this.option.elem).find("iframe");
$frame.attr("src", $frame.attr("src"));
renderContentLoading($frame, $frameLoad, loading);
}
function renderContent(option) {
var iframe = `<iframe class='laytp-frame-content' style='width:100%;height:100%;' scrolling='auto' frameborder='0' src='${option.url}' allowfullscreen='true' ></iframe>`;
var loading = `<div class="laytp-frame-loading">
<div class="ball-loader">
<span></span><span></span><span></span><span></span>
</div>
</div></div>`;
$("#" + option.elem).html("<div class='laytp-frame'>" + iframe + loading + "</div>");
}
function renderContentLoading (iframeEl, loadingEl, isLoading) {
if (isLoading) {
loadingEl.css({
display: 'block'
});
$(iframeEl).on('load', function() {
loadingEl.fadeOut(1000);
})
}
}
exports('frame', new frame());
});
+54
View File
@@ -0,0 +1,54 @@
layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'laytpTab', 'laytpMenu', 'frame', 'theme', 'convert'],
function(exports) {
"use strict";
var $ = layui.jquery;
var defer = $.Deferred();
var fullScreen = new function() {
this.func = null;
this.onFullchange = function(func){
this.func = func;
var evts = ['fullscreenchange','webkitfullscreenchange','mozfullscreenchange','MSFullscreenChange'];
for(var i=0;i<evts.length && func;i++) {
window.addEventListener(evts[i], this.func);
}
}
this.fullScreen = function(dom){
var docElm = dom && document.querySelector(dom) || document.documentElement;
if (docElm.requestFullscreen) {
docElm.requestFullscreen();
} else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen();
} else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen();
} else if (docElm.msRequestFullscreen) {
docElm.msRequestFullscreen();
}else{
defer.reject("");
}
defer.resolve("返回值");
return defer.promise();
}
this.fullClose = function(){
if(this.isFullscreen()) {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
}
defer.resolve("返回值");
return defer.promise();
}
this.isFullscreen = function(){
return document.fullscreenElement ||
document.msFullscreenElement ||
document.mozFullScreenElement ||
document.webkitFullscreenElement || false;
}
};
exports('fullscreen', fullScreen);
})
+181
View File
@@ -0,0 +1,181 @@
layui.define(['jquery', 'layer'], function (exports) {
"use strict";
var $ = layui.jquery;
var layer = layui.layer;
var http = {};
http.ajax = function (userOptions) {
userOptions = userOptions || {};
var options = $.extend(true, {}, http.ajax.defaultOpts, userOptions);
var oldBeforeSendOption = options.beforeSend;
options.beforeSend = function (xhr) {
if (oldBeforeSendOption) {
oldBeforeSendOption(xhr);
}
xhr.setRequestHeader("Pragma", "no-cache");
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("Expires", "Sat, 01 Jan 2000 00:00:00 GMT");
};
options.success = undefined;
options.error = undefined;
return $.Deferred(function ($dfd) {
$.ajax(options)
.done(function (data, textStatus, jqXHR) {
$dfd.resolve(data);
userOptions.success && userOptions.success(data);
})
.fail(function (jqXHR) {
http.ajax.handleErrorResponse(jqXHR, userOptions, $dfd);
});
});
}
$.extend(http.ajax, {
defaultOpts: {
dataType: 'json',
type: 'POST',
contentType: 'application/json',
headers: {
'X-Requested-With': 'XMLHttpRequest'
},
customHandleError: true
},
defaultError: {
message: 'An error has occurred!',
details: 'Error detail not sent by server.'
},
defaultError401: {
message: 'You are not authenticated!',
details: 'You should be authenticated (sign in) in order to perform this operation.'
},
defaultError403: {
message: 'You are not authorized!',
details: 'You are not allowed to perform this operation.'
},
defaultError404: {
message: 'Resource not found!',
details: 'The resource requested could not found on the server.'
},
logError: function (error) {
console.log(error);
},
showError: function (error) {
if (error.details) {
return layer.alert(error.details, {
title: error.message,
icon: 2,
closeBtn: 0
});
} else {
return layer.alert(http.ajax.defaultError.details, {
title: error.message || http.ajax.defaultError.message,
icon: 2,
closeBtn: 0
});
}
},
showErrorAndRedirectUrl: function (error, targetUrl) {
if (error.details) {
return layer.alert(error.details, {
title: error.message,
icon: 2,
closeBtn: 0,
end: http.ajax.handleTargetUrl(targetUrl)
});
} else {
return layer.alert(http.ajax.defaultError.details, {
title: error.message || http.ajax.defaultError.message,
icon: 2,
closeBtn: 0,
end: http.ajax.handleTargetUrl(targetUrl)
});
}
},
handleTargetUrl: function (targetUrl) {
if (!targetUrl) {
location.href = http.appPath;
} else {
location.href = targetUrl;
}
},
handleErrorResponse: function (jqXHR, userOptions, $dfd) {
if (!userOptions.customHandleError) {
switch (jqXHR.status) {
case 401:
http.ajax.showErrorAndRedirectUrl(http.ajax.defaultError401, http.appPath);
break;
case 403:
http.ajax.showError(http.ajax.defaultError403);
break;
case 404:
http.ajax.showError(http.ajax.defaultError404);
break;
default:
http.ajax.showError(http.ajax.defaultError);
break;
}
}
$dfd.reject.apply(this, arguments);
userOptions.error && userOptions.error.apply(this, arguments);
},
ajaxSendHandler: function (event, request, settings) {
var token = http.ajax.getToken();
if (!token) {
return;
}
if (!settings.headers || settings.headers[http.ajax.tokenHeaderName] === undefined) {
request.setRequestHeader(http.ajax.tokenHeaderName, token);
}
},
getToken: function () {
return http.ajax.getCookieValue(http.ajax.tokenCookieName);
},
tokenCookieName: 'XSRF-TOKEN',
tokenHeaderName: 'X-XSRF-TOKEN',
getCookieValue: function (key) {
var equalities = document.cookie.split('; ');
for (var i = 0; i < equalities.length; i++) {
if (!equalities[i]) {
continue;
}
var splitted = equalities[i].split('=');
if (splitted.length != 2) {
continue;
}
if (decodeURIComponent(splitted[0]) === key) {
return decodeURIComponent(splitted[1] || '');
}
}
return null;
}
});
$(document).ajaxSend(function (event, request, settings) {
return http.ajax.ajaxSendHandler(event, request, settings);
});
exports('http', http);
});
+524
View File
@@ -0,0 +1,524 @@
layui.define(['laypage', 'form'], function(exports) {
"use strict";
var IconPicker = function() {
this.v = '1.1';
},
_MOD = 'iconPicker',
_this = this,
$ = layui.jquery,
laypage = layui.laypage,
form = layui.form,
BODY = 'body',
TIPS = '请选择图标';
/**
* 渲染组件
*/
IconPicker.prototype.render = function(options) {
var opts = options,
// DOM选择器
elem = opts.elem,
// 数据类型:fontClass/unicode
type = opts.type == null ? 'fontClass' : opts.type,
// 是否分页:true/false
page = opts.page == null ? true : opts.page,
// 每页显示数量
limit = opts.limit == null ? 12 : opts.limit,
// 是否开启搜索:true/false
search = opts.search == null ? true : opts.search,
// 每个图标格子的宽度:'43px'或'20%'
cellWidth = opts.cellWidth,
// 点击回调
click = opts.click,
// 渲染成功后的回调
success = opts.success,
// 前缀 默认使用 layui-icon
ICON_prefix = opts.prefix == null ? "layui-icon" : opts.prefix,
// 异步获取外部字体图标数据
ICON_url = opts.url ,
// json数据
data = {},
// 唯一标识
tmp = new Date().getTime(),
// 是否使用的class数据
isFontClass = opts.type === 'fontClass',
// 是否使用自定义图标数据
isCustom = opts.url !=null && opts.prefix != null,
// 初始化时input的值
ORIGINAL_ELEM_VALUE = $(elem).val(),
TITLE = 'layui-select-title',
TITLE_ID = 'layui-select-title-' + tmp,
ICON_BODY = 'layui-iconpicker-' + tmp,
PICKER_BODY = 'layui-iconpicker-body-' + tmp,
PAGE_ID = 'layui-iconpicker-page-' + tmp,
LIST_BOX = 'layui-iconpicker-list-box',
selected = 'layui-form-selected',
unselect = 'layui-unselect';
var a = {
init: function() {
if(isCustom)
{
data = common.ajaxData(ICON_url,ICON_prefix);
}else{
data = common.getData[type]();
}
a.hideElem().createSelect().createBody().toggleSelect();
a.preventEvent().inputListen();
common.loadCss();
if (success) {
success(this.successHandle());
}
return a;
},
successHandle: function() {
var d = {
options: opts,
data: data,
id: tmp,
elem: $('#' + ICON_BODY)
};
return d;
},
/**
* 隐藏elem
*/
hideElem: function() {
$(elem).hide();
return a;
},
/**
* 绘制select下拉选择框
*/
createSelect: function() {
var oriIcon = '<i class="layui-icon">';
// 默认图标
if (ORIGINAL_ELEM_VALUE === '') {
if (isFontClass) {
ORIGINAL_ELEM_VALUE = 'layui-icon-circle-dot';
} else {
ORIGINAL_ELEM_VALUE = '&#xe617;';
}
}
if (isFontClass || isCustom) {
oriIcon = '<i class="'+ ICON_prefix + ' ' + ORIGINAL_ELEM_VALUE + '">';
} else {
oriIcon += ORIGINAL_ELEM_VALUE;
}
oriIcon += '</i>';
var selectHtml =
'<div class="layui-iconpicker layui-unselect layui-form-select" id="' +
ICON_BODY + '">' +
'<div class="' + TITLE + '" id="' + TITLE_ID + '">' +
'<div class="layui-iconpicker-item">' +
'<span class="layui-iconpicker-icon layui-unselect">' +
oriIcon +
'</span>' +
'<i class="layui-edge"></i>' +
'</div>' +
'</div>' +
'<div class="layui-anim layui-anim-upbit" style="">' +
'123' +
'</div>';
$(elem).after(selectHtml);
return a;
},
/**
* 展开/折叠下拉框
*/
toggleSelect: function() {
var item = '#' + TITLE_ID + ' .layui-iconpicker-item,#' + TITLE_ID +
' .layui-iconpicker-item .layui-edge';
a.event('click', item, function(e) {
var $icon = $('#' + ICON_BODY);
if ($icon.hasClass(selected)) {
$icon.removeClass(selected).addClass(unselect);
} else {
// 隐藏其他picker
$('.layui-form-select').removeClass(selected);
// 显示当前picker
$icon.addClass(selected).removeClass(unselect);
}
e.stopPropagation();
});
return a;
},
/**
* 绘制主体部分
*/
createBody: function() {
// 获取数据
var searchHtml = '';
if (search) {
searchHtml = '<div class="layui-iconpicker-search">' +
'<input class="layui-input">' +
'<i class="layui-icon">&#xe615;</i>' +
'</div>';
}
// 组合dom
var bodyHtml = '<div class="layui-iconpicker-body" id="' + PICKER_BODY + '">' +
searchHtml +
'<div class="' + LIST_BOX + '"></div> ' +
'</div>';
$('#' + ICON_BODY).find('.layui-anim').eq(0).html(bodyHtml);
a.search().createList().check().page();
return a;
},
/**
* 绘制图标列表
* @param text 模糊查询关键字
* @returns {string}
*/
createList: function(text) {
var d = data,
l = d.length,
pageHtml = '',
listHtml = $(
'<div class="layui-iconpicker-list">') //'<div class="layui-iconpicker-list">';
// 计算分页数据
var _limit = limit, // 每页显示数量
_pages = l % _limit === 0 ? l / _limit : parseInt(l / _limit + 1), // 总计多少页
_id = PAGE_ID;
// 图标列表
var icons = [];
for (var i = 0; i < l; i++) {
var obj = d[i];
// 判断是否模糊查询
if (text && obj.indexOf(text) === -1) {
continue;
}
// 是否自定义格子宽度
var style = '';
if (cellWidth !== null) {
style += ' style="width:' + cellWidth + '"';
}
// 每个图标dom
var icon = '<div class="layui-iconpicker-icon-item" title="' + obj + '" ' +
style + '>';
if (isFontClass || isCustom)
{
icon += '<i class="'+ ICON_prefix + ' ' + obj + '"></i>';
}else{
icon += '<i class="layui-icon">' + obj.replace('amp;', '') + '</i>';
}
icon += '</div>';
icons.push(icon);
}
// 查询出图标后再分页
l = icons.length;
_pages = l % _limit === 0 ? l / _limit : parseInt(l / _limit + 1);
for (var i = 0; i < _pages; i++) {
// 按limit分块
var lm = $(
'<div class="layui-iconpicker-icon-limit" id="layui-iconpicker-icon-limit-' +
tmp + (i + 1) + '">');
for (var j = i * _limit; j < (i + 1) * _limit && j < l; j++) {
lm.append(icons[j]);
}
listHtml.append(lm);
}
// 无数据
if (l === 0) {
listHtml.append('<p class="layui-iconpicker-tips">无数据</p>');
}
// 判断是否分页
if (page) {
$('#' + PICKER_BODY).addClass('layui-iconpicker-body-page');
pageHtml = '<div class="layui-iconpicker-page" id="' + PAGE_ID + '">' +
'<div class="layui-iconpicker-page-count">' +
'<span id="' + PAGE_ID + '-current">1</span>/' +
'<span id="' + PAGE_ID + '-pages">' + _pages + '</span>' +
' (<span id="' + PAGE_ID + '-length">' + l + '</span>)' +
'</div>' +
'<div class="layui-iconpicker-page-operate">' +
'<i class="layui-icon" id="' + PAGE_ID +
'-prev" data-index="0" prev>&#xe603;</i> ' +
'<i class="layui-icon" id="' + PAGE_ID +
'-next" data-index="2" next>&#xe602;</i> ' +
'</div>' +
'</div>';
}
$('#' + ICON_BODY).find('.layui-anim').find('.' + LIST_BOX).html('').append(
listHtml).append(pageHtml);
return a;
},
// 阻止Layui的一些默认事件
preventEvent: function() {
var item = '#' + ICON_BODY + ' .layui-anim';
a.event('click', item, function(e) {
e.stopPropagation();
});
return a;
},
// 分页
page: function() {
var icon = '#' + PAGE_ID + ' .layui-iconpicker-page-operate .layui-icon';
$(icon).unbind('click');
a.event('click', icon, function(e) {
var elem = e.currentTarget,
total = parseInt($('#' + PAGE_ID + '-pages').html()),
isPrev = $(elem).attr('prev') !== undefined,
// 按钮上标的页码
index = parseInt($(elem).attr('data-index')),
$cur = $('#' + PAGE_ID + '-current'),
// 点击时正在显示的页码
current = parseInt($cur.html());
// 分页数据
if (isPrev && current > 1) {
current = current - 1;
$(icon + '[prev]').attr('data-index', current);
} else if (!isPrev && current < total) {
current = current + 1;
$(icon + '[next]').attr('data-index', current);
}
$cur.html(current);
// 图标数据
$('#' + ICON_BODY + ' .layui-iconpicker-icon-limit').hide();
$('#layui-iconpicker-icon-limit-' + tmp + current).show();
e.stopPropagation();
});
return a;
},
/**
* 搜索
*/
search: function() {
var item = '#' + PICKER_BODY + ' .layui-iconpicker-search .layui-input';
a.event('input propertychange', item, function(e) {
var elem = e.target,
t = $(elem).val();
a.createList(t);
});
return a;
},
/**
* 点击选中图标
*/
check: function() {
var item = '#' + PICKER_BODY + ' .layui-iconpicker-icon-item';
a.event('click', item, function(e) {
var el = $(e.currentTarget).find('.' + ICON_prefix),
icon = '';
if (isFontClass || isCustom) {
var clsArr = el.attr('class').split(/[\s\n]/),
cls = clsArr[1],
icon = cls;
$('#' + TITLE_ID).find('.layui-iconpicker-item .' + ICON_prefix).html(
'').attr('class', clsArr.join(' '));
} else {
var cls = el.html(),
icon = cls;
$('#' + TITLE_ID).find('.layui-iconpicker-item .layui-icon').html(
icon);
}
$('#' + ICON_BODY).removeClass(selected).addClass(unselect);
$(elem).val(icon).attr('value', icon);
// 回调
if (click) {
click({
icon: icon
});
}
});
return a;
},
// 监听原始input数值改变
inputListen: function() {
var el = $(elem);
a.event('change', elem, function() {
var value = el.val();
})
// el.change(function(){
// });
return a;
},
event: function(evt, el, fn) {
$(BODY).on(evt, el, fn);
}
};
var common = {
/**
* 加载样式表
*/
loadCss: function() {
var css =
'.layui-iconpicker {max-width: 280px;}.layui-iconpicker .layui-anim{display:none;position:absolute;left:0;top:42px;padding:5px 0;z-index:899;min-width:100%;border:1px solid #d2d2d2;max-height:300px;overflow-y:auto;background-color:#fff;border-radius:2px;box-shadow:0 2px 4px rgba(0,0,0,.12);box-sizing:border-box;}.layui-iconpicker-item{border:1px solid #e6e6e6;width:90px;height:38px;border-radius:4px;cursor:pointer;position:relative;}.layui-iconpicker-icon{border-right:1px solid #e6e6e6;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;width:60px;height:100%;float:left;text-align:center;background:#fff;transition:all .3s;}.layui-iconpicker-icon i{line-height:38px;font-size:18px;}.layui-iconpicker-item > .layui-edge{left:70px;}.layui-iconpicker-item:hover{border-color:#D2D2D2!important;}.layui-iconpicker-item:hover .layui-iconpicker-icon{border-color:#D2D2D2!important;}.layui-iconpicker.layui-form-selected .layui-anim{display:block;}.layui-iconpicker-body{padding:6px;}.layui-iconpicker .layui-iconpicker-list{background-color:#fff;border:1px solid #ccc;border-radius:4px;}.layui-iconpicker .layui-iconpicker-icon-item{display:inline-block;width:21.1%;line-height:36px;text-align:center;cursor:pointer;vertical-align:top;height:36px;margin:4px;border:1px solid #ddd;border-radius:2px;transition:300ms;}.layui-iconpicker .layui-iconpicker-icon-item i.layui-icon{font-size:17px;}.layui-iconpicker .layui-iconpicker-icon-item:hover{background-color:#eee;border-color:#ccc;-webkit-box-shadow:0 0 2px #aaa,0 0 2px #fff inset;-moz-box-shadow:0 0 2px #aaa,0 0 2px #fff inset;box-shadow:0 0 2px #aaa,0 0 2px #fff inset;text-shadow:0 0 1px #fff;}.layui-iconpicker-search{position:relative;margin:0 0 6px 0;border:1px solid #e6e6e6;border-radius:2px;transition:300ms;}.layui-iconpicker-search:hover{border-color:#D2D2D2!important;}.layui-iconpicker-search .layui-input{cursor:text;display:inline-block;width:86%;border:none;padding-right:0;margin-top:1px;}.layui-iconpicker-search .layui-icon{position:absolute;top:11px;right:4%;}.layui-iconpicker-tips{text-align:center;padding:8px 0;cursor:not-allowed;}.layui-iconpicker-page{margin-top:6px;margin-bottom:-6px;font-size:12px;padding:0 2px;}.layui-iconpicker-page-count{display:inline-block;}.layui-iconpicker-page-operate{display:inline-block;float:right;cursor:default;}.layui-iconpicker-page-operate .layui-icon{font-size:12px;cursor:pointer;}.layui-iconpicker-body-page .layui-iconpicker-icon-limit{display:none;}.layui-iconpicker-body-page .layui-iconpicker-icon-limit:first-child{display:block;}';
var $style = $('head').find('style[iconpicker]');
if ($style.length === 0) {
$('head').append('<style rel="stylesheet" iconpicker>' + css + '</style>');
}
},
/**
* 获取数据
*/
getData: {
fontClass: function() {
var arr = ["layui-icon-rate-half", "layui-icon-rate", "layui-icon-rate-solid",
"layui-icon-cellphone", "layui-icon-vercode", "layui-icon-login-wechat",
"layui-icon-login-qq", "layui-icon-login-weibo", "layui-icon-password",
"layui-icon-username", "layui-icon-refresh-3", "layui-icon-auz",
"layui-icon-spread-left", "layui-icon-shrink-right",
"layui-icon-snowflake", "layui-icon-tips", "layui-icon-note",
"layui-icon-home", "layui-icon-senior", "layui-icon-refresh",
"layui-icon-refresh-1", "layui-icon-flag", "layui-icon-theme",
"layui-icon-notice", "layui-icon-website", "layui-icon-console",
"layui-icon-face-surprised", "layui-icon-set", "layui-icon-template-1",
"layui-icon-app", "layui-icon-template", "layui-icon-praise",
"layui-icon-tread", "layui-icon-male", "layui-icon-female",
"layui-icon-camera", "layui-icon-camera-fill", "layui-icon-more",
"layui-icon-more-vertical", "layui-icon-rmb", "layui-icon-dollar",
"layui-icon-diamond", "layui-icon-fire", "layui-icon-return",
"layui-icon-location", "layui-icon-read", "layui-icon-survey",
"layui-icon-face-smile", "layui-icon-face-cry",
"layui-icon-cart-simple", "layui-icon-cart", "layui-icon-next",
"layui-icon-prev", "layui-icon-upload-drag", "layui-icon-upload",
"layui-icon-download-circle", "layui-icon-component",
"layui-icon-file-b", "layui-icon-user", "layui-icon-find-fill",
"layui-icon-loading", "layui-icon-loading-1", "layui-icon-add-1",
"layui-icon-play", "layui-icon-pause", "layui-icon-headset",
"layui-icon-video", "layui-icon-voice", "layui-icon-speaker",
"layui-icon-fonts-del", "layui-icon-fonts-code",
"layui-icon-fonts-html", "layui-icon-fonts-strong", "layui-icon-unlink",
"layui-icon-picture", "layui-icon-link", "layui-icon-face-smile-b",
"layui-icon-align-left", "layui-icon-align-right",
"layui-icon-align-center", "layui-icon-fonts-u", "layui-icon-fonts-i",
"layui-icon-tabs", "layui-icon-radio", "layui-icon-circle",
"layui-icon-edit", "layui-icon-share", "layui-icon-delete",
"layui-icon-form", "layui-icon-cellphone-fine", "layui-icon-dialogue",
"layui-icon-fonts-clear", "layui-icon-layer", "layui-icon-date",
"layui-icon-water", "layui-icon-code-circle", "layui-icon-carousel",
"layui-icon-prev-circle", "layui-icon-layouts", "layui-icon-util",
"layui-icon-templeate-1", "layui-icon-upload-circle", "layui-icon-tree",
"layui-icon-table", "layui-icon-chart", "layui-icon-chart-screen",
"layui-icon-engine", "layui-icon-triangle-d", "layui-icon-triangle-r",
"layui-icon-file", "layui-icon-set-sm", "layui-icon-add-circle",
"layui-icon-404", "layui-icon-about", "layui-icon-up",
"layui-icon-down", "layui-icon-left", "layui-icon-right",
"layui-icon-circle-dot", "layui-icon-search", "layui-icon-set-fill",
"layui-icon-group", "layui-icon-friends", "layui-icon-reply-fill",
"layui-icon-menu-fill", "layui-icon-log", "layui-icon-picture-fine",
"layui-icon-face-smile-fine", "layui-icon-list", "layui-icon-release",
"layui-icon-ok", "layui-icon-help", "layui-icon-chat", "layui-icon-top",
"layui-icon-star", "layui-icon-star-fill", "layui-icon-close-fill",
"layui-icon-close", "layui-icon-ok-circle", "layui-icon-add-circle-fine"
];
return arr;
},
unicode: function() {
return ["&amp;#xe6c9;", "&amp;#xe67b;", "&amp;#xe67a;", "&amp;#xe678;",
"&amp;#xe679;", "&amp;#xe677;", "&amp;#xe676;", "&amp;#xe675;",
"&amp;#xe673;", "&amp;#xe66f;", "&amp;#xe9aa;", "&amp;#xe672;",
"&amp;#xe66b;", "&amp;#xe668;", "&amp;#xe6b1;", "&amp;#xe702;",
"&amp;#xe66e;", "&amp;#xe68e;", "&amp;#xe674;", "&amp;#xe669;",
"&amp;#xe666;", "&amp;#xe66c;", "&amp;#xe66a;", "&amp;#xe667;",
"&amp;#xe7ae;", "&amp;#xe665;", "&amp;#xe664;", "&amp;#xe716;",
"&amp;#xe656;", "&amp;#xe653;", "&amp;#xe663;", "&amp;#xe6c6;",
"&amp;#xe6c5;", "&amp;#xe662;", "&amp;#xe661;", "&amp;#xe660;",
"&amp;#xe65d;", "&amp;#xe65f;", "&amp;#xe671;", "&amp;#xe65e;",
"&amp;#xe659;", "&amp;#xe735;", "&amp;#xe756;", "&amp;#xe65c;",
"&amp;#xe715;", "&amp;#xe705;", "&amp;#xe6b2;", "&amp;#xe6af;",
"&amp;#xe69c;", "&amp;#xe698;", "&amp;#xe657;", "&amp;#xe65b;",
"&amp;#xe65a;", "&amp;#xe681;", "&amp;#xe67c;", "&amp;#xe601;",
"&amp;#xe857;", "&amp;#xe655;", "&amp;#xe770;", "&amp;#xe670;",
"&amp;#xe63d;", "&amp;#xe63e;", "&amp;#xe654;", "&amp;#xe652;",
"&amp;#xe651;", "&amp;#xe6fc;", "&amp;#xe6ed;", "&amp;#xe688;",
"&amp;#xe645;", "&amp;#xe64f;", "&amp;#xe64e;", "&amp;#xe64b;",
"&amp;#xe62b;", "&amp;#xe64d;", "&amp;#xe64a;", "&amp;#xe64c;",
"&amp;#xe650;", "&amp;#xe649;", "&amp;#xe648;", "&amp;#xe647;",
"&amp;#xe646;", "&amp;#xe644;", "&amp;#xe62a;", "&amp;#xe643;",
"&amp;#xe63f;", "&amp;#xe642;", "&amp;#xe641;", "&amp;#xe640;",
"&amp;#xe63c;", "&amp;#xe63b;", "&amp;#xe63a;", "&amp;#xe639;",
"&amp;#xe638;", "&amp;#xe637;", "&amp;#xe636;", "&amp;#xe635;",
"&amp;#xe634;", "&amp;#xe633;", "&amp;#xe632;", "&amp;#xe631;",
"&amp;#xe630;", "&amp;#xe62f;", "&amp;#xe62e;", "&amp;#xe62d;",
"&amp;#xe62c;", "&amp;#xe629;", "&amp;#xe628;", "&amp;#xe625;",
"&amp;#xe623;", "&amp;#xe621;", "&amp;#xe620;", "&amp;#xe61f;",
"&amp;#xe61c;", "&amp;#xe60b;", "&amp;#xe619;", "&amp;#xe61a;",
"&amp;#xe603;", "&amp;#xe602;", "&amp;#xe617;", "&amp;#xe615;",
"&amp;#xe614;", "&amp;#xe613;", "&amp;#xe612;", "&amp;#xe611;",
"&amp;#xe60f;", "&amp;#xe60e;", "&amp;#xe60d;", "&amp;#xe60c;",
"&amp;#xe60a;", "&amp;#xe609;", "&amp;#xe605;", "&amp;#xe607;",
"&amp;#xe606;", "&amp;#xe604;", "&amp;#xe600;", "&amp;#xe658;",
"&amp;#x1007;", "&amp;#x1006;", "&amp;#x1005;", "&amp;#xe608;"
];
},
},
//通过异步获取自定义图标数据源
ajaxData:function (url,prefix){
var iconlist = [];
$.ajax({
url: url,
type: 'get',
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
async: false,
success: function (ret) {
var exp = eval("/"+prefix+"-(.*):/ig");
var result;
while ((result = exp.exec(ret)) != null) {
iconlist.push(prefix + '-' + result[1]);
}
},
error: function (xhr, textstatus, thrown) {
layer.msg('自定义图标接口有误');
}
});
return iconlist;
}
};
a.init();
return new IconPicker();
};
/**
* 选中图标
* @param filter lay-filter
* @param iconName 图标名称,自动识别fontClass/unicode
*/
IconPicker.prototype.checkIcon = function(filter, iconName) {
var el = $('*[lay-filter=' + filter + ']'),
p = el.next().find('.layui-iconpicker-item .layui-icon'),
c = iconName;
if (c.indexOf('#xe') > 0) {
p.html(c);
} else {
p.html('').attr('class', 'layui-icon ' + c);
}
el.attr('value', c).val(c);
};
var iconPicker = new IconPicker();
exports(_MOD, iconPicker);
});
+567
View File
@@ -0,0 +1,567 @@
/**
* laytp极速后台框架layUI的js扩展,后台界面使用
* @version: 2.0
* @Author: JunStar
* @Date: 2018年09月20日11:47:00
* @Last Modified by: JunStar
* @Last Modified time: 2021-09-22 17:19:40
*/
layui.define([
"facade", // 助手函数
"laytpForm", // 表单元素组件
"laytpDropdown", // 数据表格顶部批量操作下拉组件
"laytpTable", // 数据表格处理完成后需要执行的操作组件
"button", // 按钮点击过渡效果组件
"drawer", // 抽屉组件
"react", // 模拟react的响应式组件,允许注册一些数据,方法,钩子并提供简单的响应式
], function (exports) {
const MOD_NAME = "laytp";
let $ = layui.jquery
, facade = layui.facade
, laytp = {}
;
window.$ = $;
//数据表格,格式化展示数据
laytp.tableFormatter = {
custom: ["#FF5722", "#009688", "#FFB800", "#2F4056", "#1E9FFF", "#393D49", "#999999", "#0b1bf8", "#7a0bf8", "#f00bf8", "#5FB878", "#1E9FFF", "#2F4056"],
status: function (field, value, json, isTreeTable) {
let customIndex = 0, key;
if (value) {
for (key in json['value']) {
if (value.toString() === json['value'][key].toString()) {
if (isTreeTable) {
return '<span class="layui-icon layui-icon-circle-dot" style="color:' + laytp.tableFormatter.custom[customIndex] + ';font-size:14px;">' + json['text'][key] + '</span>';
} else {
return '<a href="javascript:void(0);" class="laytpClickSearch layerTips layui-icon layui-icon-circle-dot" data-field="' + field + '" data-val="' + value + '" data-text="点击搜索 ' + json['text'][key] + '" data-tipsColor="#393D49" style="color:' + laytp.tableFormatter.custom[customIndex] + ';font-size:14px;">' + json['text'][key] + '</a>';
}
}
customIndex++;
}
}
return '';
},
colorPicker: function (value) {
return "<span class='layui-badge' style='background-color:" + value + ";font-size:14px;'>&nbsp;&nbsp;</span>\n\t\t\t";
},
//form_type=checkbox
flag: function (value, dataList) {
let html = '';
let customIndex = 0, key, v;
let valueArr = value.toString().split(',');
for (key in dataList.value) {
for (v in valueArr) {
if (valueArr[v].toString() === dataList.value[key].toString()) {
customIndex = key % laytp.tableFormatter.custom.length;
html += '<span class="layui-btn layui-btn-xs" style="background-color: ' + laytp.tableFormatter.custom[customIndex] + '">' + dataList.text[key] + '</span>';
}
}
}
return html;
},
images: function (value) {
let html = "";
if (value) {
let valueArr = value.split(", "), key;
for (key in valueArr) {
html += '<a href="javascript:void(0);" onclick="layui.laytp.tableFormatter.showImage(\'' + valueArr[key] + '\')"><img src="' + valueArr[key] + '" class="layerImgTips" style="width:30px;height:30px;" /></a> ';
}
}
return html;
},
showImage: function (url) {
layui.facade.popupDiv({
title: '查看图片',
path: "/admin/showImage.html?img_url=" + window.btoa(url)
});
},
video: function (value) {
let html = '';
if (value) {
let i = 1;
let valueArr = value.split(','), key;
for (key in valueArr) {
html += '<a href="javascript:void(0);" onclick="layui.laytp.tableFormatter.showVideo(\'' + valueArr[key] + '\')" class=\"layui-link\">视频' + i + '</a> ';
i++;
}
}
return html;
},
showVideo: function (url) {
layui.facade.popupDiv({
title: '查看视频',
path: "/admin/showVideo.html?video_url=" + window.btoa(url)
});
},
audio: function (value) {
let html = '';
if (value) {
let i = 1;
let valueArr = value.split(','), key;
for (key in valueArr) {
html += '<a href="javascript:void(0);" onclick="layui.laytp.tableFormatter.showAudio(\'' + valueArr[key] + '\')" class=\"layui-link\">音频' + i + '</a> ';
i++;
}
}
return html;
},
showAudio: function (url) {
layui.facade.popupDiv({
title: '查看音频',
path: "/admin/showAudio.html?audio_url=" + window.btoa(url)
});
},
file: function (value) {
let html = '';
if (value) {
let i = 1;
let valueArr = value.split(','), key;
for (key in valueArr) {
html += '<a target="_blank" href="' + valueArr[key] + '" title="点击下载" class="layui-link">文件' + i + '</a> ';
i++;
}
}
return html;
},
};
/**
* 监听数据表格顶部左侧默认按钮点击事件
*/
laytp.tableToolbar = function (obj, isTreeTable) {
// 窗口句柄
let indexes = [];
if (obj.event === "add") {
let options = {};
options.title = "添 加";
options.path = facade.compatibleHtmlPath(window.htmlPrefix) + "add.html";
indexes.push(facade.popupDiv(options));
} else if (obj.event === "edit") {
let checkData, checkStatus;
if (isTreeTable) {
checkStatus = layui.treeTable.checkStatus(obj.config.id);
} else {
checkStatus = layui.table.checkStatus(obj.config.id);
}
checkData = checkStatus.data;
if (checkData.length === 0) {
facade.error("请选择数据");
return false;
}
if (checkData.length >= 30) {
facade.error("选择数据量过多,最多选择30条数据,总共选择了" + checkData.length + "条数据");
return false;
}
let key;
for (key in checkData) {
indexes.push(facade.popupDiv({
title: "编辑",
path: facade.compatibleHtmlPath(window.htmlPrefix) + "edit.html?id=" + checkData[key].id
}));
}
} else if (obj.event === "del") {
let checkData, checkStatus;
if (isTreeTable) {
checkStatus = layui.treeTable.checkStatus(obj.config.id);
} else {
checkStatus = layui.table.checkStatus(obj.config.id);
}
checkData = checkStatus.data;
if (checkData.length === 0) {
facade.error("请选择数据");
return false;
}
let ids = [];
let key;
for (key in checkData) {
ids.push(checkData[key].id);
}
if (isTreeTable) {
facade.popupConfirm({ text: "确定删除么?", route: window.apiPrefix + "del", data: { ids: ids } }, function (res) {
if (res.code === 0) {
if (typeof obj.del === "function") {
obj.del();
} else {
funController.tableRender();
}
}
});
} else {
facade.popupConfirm({ text: "确定删除么?", route: window.apiPrefix + "del", data: { ids: ids } });
}
} else if (obj.event === "search") {
layui.drawer.open({
direction: "right",
dom: "#search-form",
distance: "70%",
success: function (d) {
var windowHeight = d.height;
var height = parseInt(windowHeight) - 115;
$(".search-form-body").css("height", height + 'px');
$(".search-form-body").css("max-height", height + 'px');
$(".search-form-body").css("overflow-y", "auto");
}
});
} else if (obj.event === "recycle-search") {
layui.drawer.open({
direction: "right",
dom: "#recycle-search-form",
distance: "70%",
success: function (d) {
var windowHeight = d.height;
var height = parseInt(windowHeight) - 115;
$(".search-form-body").css("height", height + 'px');
$(".search-form-body").css("max-height", height + 'px');
$(".search-form-body").css("overflow-y", "auto");
}
});
} else if (obj.event === "recycle") {
let options = {};
options.title = "回收站";
options.path = facade.compatibleHtmlPath(window.htmlPrefix) + "recycle.html";
options.offset = "auto";
options.width = facade.isMobile() ? '100%' : '90%';
options.height = facade.isMobile() ? '100%' : '90%';
options.anim = 2;
indexes.push(facade.popupDiv(options));
} else if (obj.event === "restore") {
let checkData, checkStatus;
if (isTreeTable) {
checkStatus = layui.treeTable.checkStatus(obj.config.id);
} else {
checkStatus = layui.table.checkStatus(obj.config.id);
}
checkData = checkStatus.data;
if (checkData.length === 0) {
facade.error("请选择数据");
return false;
}
let key;
let ids = [];
for (key in checkData) {
ids.push(checkData[key].id);
}
facade.ajax({
route: window.apiPrefix + "restore",
data: { ids: ids },
showLoading: true
}).done(function (res) {
if (res.code === 0) {
parent.funController.tableRender();
funRecycleController.tableRender();
}
});
} else if (obj.event === "true-del") {
let checkData, checkStatus;
if (isTreeTable) {
checkStatus = layui.treeTable.checkStatus(obj.config.id);
} else {
checkStatus = layui.table.checkStatus(obj.config.id);
}
checkData = checkStatus.data;
if (checkData.length === 0) {
facade.error("请选择数据");
return false;
}
let key;
let ids = [];
for (key in checkData) {
ids.push(checkData[key].id);
}
facade.popupConfirm({
text: "真的在回收站删除么?此次删除将不能还原",
route: window.apiPrefix + "trueDel",
data: { ids: ids }
});
} else if (obj.event === "refresh") {
if (typeof funController !== "undefined") {
funController.tableRender(layui.form.val("layui-form"), $(".layui-laypage-em").next().html());
}
} else if (obj.event === "recycle-refresh") {
if (typeof funRecycleController !== "undefined") {
funRecycleController.tableRender(layui.form.val("layui-form"), $(".layui-laypage-em").next().html());
}
}
// 返回窗口句柄
if (indexes.length === 1) return indexes.pop();
else return [...indexes];
};
/**
* 监听数据表格操作列,默认按钮点击事件
*/
laytp.tableTool = function (obj, isTreeTable) {
let indexes = [];
if (obj.event === "del") {
if (isTreeTable) {
facade.popupConfirm({ text: "真的删除么?", route: window.apiPrefix + "del", data: { ids: [obj.data.id] } }, function (res) {
if (res.code === 0) {
obj.del();
}
});
} else {
facade.popupConfirm({ text: "真的删除么?", route: window.apiPrefix + "del", data: { ids: [obj.data.id] } });
}
} else if (obj.event === "edit") {
let options = {};
options.title = "编 辑";
options.path = facade.compatibleHtmlPath(window.htmlPrefix) + "edit.html?id=" + obj.data.id;
indexes.push(facade.popupDiv(options));
} else if (obj.event === "restore") {
facade.ajax({ route: window.apiPrefix + "restore", data: { ids: [obj.data.id] } }).done(function (res) {
if (res.code === 0) {
parent.funController.tableRender();
funRecycleController.tableRender();
}
});
} else if (obj.event === "true-del") {
facade.popupConfirm({
text: "真的在回收站删除么?此次删除将不能还原",
route: window.apiPrefix + "trueDel",
data: { ids: [obj.data.id] }
});
}
if (indexes.length === 1) return indexes.pop();
else return indexes;
};
//初始化
laytp.init = {
/**
* 全局ajax设置
* - 设置默认的headers
* - ajax过度效果设置
*/
ajaxSet: function () {
let commonHeaders = {
"LayTp-Admin-Token": facade.getCookie("laytpAdminToken"),
"Cache-Control": "no-cache"
};
$.ajaxSetup({
timeout: 30000,
headers: commonHeaders,
});
},
/**
* 点击按钮弹出表单层
* 所有拥有popupDiv类名的节点,点击后都会弹出层
* data-name 弹窗标题,默认为当前节点的html()
* data-url 必填,弹窗展示的静态文件url
* data-btn 弹出层底部按钮,只有两种设置方式,1.不设置,表示弹出一个表单,底部展示['确定','取消']两个按钮,点击确定按钮可以提交表单。2.设置为空字符串,表示弹出一个非表单层,仅展示页面,底部没有按钮,其他复杂的弹出层,比如有三个或者三个以上按钮,请自行编写JS实现
* data-width 属性为弹窗的宽度百分比,非必填,默认值在/a/index.html中设置
* data-height 属性为弹窗的高度百分比,非必填,默认值在/a/index.html中设置
* data-shade 属性为弹窗背景阴影,非必填,默认值在/a/index.html中设置
*/
popupDiv: function () {
$(document).off("click", ".popupDiv").on("click", ".popupDiv", function () {
let options = {};
options.title = $(this).data("title") ? $(this).data("title") : $(this).html();
options.shade = $(this).data("shade");
if (!options.shade) options.shade = 0.01;
options.width = $(this).data("width");
options.height = $(this).data("height");
options.path = $(this).data("url");
facade.popupDiv(options);
});
},
/**
* 点击按钮打开新的tab menu
* 所有拥有tabMenu类名的节点,点击后都会打开新的tab menu
* data-id 菜单ID,用于菜单自动选中
* data-url 必填,弹窗展示的静态文件url
* data-title tab菜单的名称
*/
openTabMenu: function () {
$(document).off("click", ".openTabMenu").on("click", ".openTabMenu", function () {
if (parent.config.tab.muiltTab) {
parent.bodyTab.addTabOnly({
id: $(this).data("id"),
title: $(this).data("title"),
url: $(this).data("url"),
icon: "",
close: true
}, 300);
} else {
parent.bodyFrame.changePage($(this).data("url"), "", true);
}
});
},
/**
* 监听拥有laytpClickSearch样式的节点,点击进行表单搜索
*/
laytpClickSearch: function () {
$(document).off("click", ".laytpClickSearch").on("click", ".laytpClickSearch", function () {
let field = $(this).data('field');
if (!field) facade.error("tab的字段名未定义");
let value = $(this).data('val');
$("#" + field).val(value);
layui.form.render('select');
$("button[lay-filter=laytp-search-form]").click();
$("button[lay-filter=laytp-recycle-search-form]").click();
});
},
/**
* 监听.delArrayItem节点,删除表格中的一行
* .delArrayItem节点存在的位置举例:系统配置,数组类型配置,删除某一个数组元素
*/
delArrayItem: function () {
$(document).off("click", ".delArrayItem").on('click', '.delArrayItem', function () {
let clickObj = $(this);
let childrenLength = clickObj.parent().parent().parent().children().length;
if (childrenLength > 2) {
clickObj.parent().parent().remove();
} else {
facade.error('请留下这唯一的一行数据');
}
});
},
/**
* 监听.addArrayItem节点,追加表格中的一行
* .addArrayItem节点存在的位置举例:系统配置,数组类型配置,追加一个数组元素
*/
addArrayItem: function () {
$(document).off("click", ".addArrayItem").on('click', '.addArrayItem', function () {
let clickObj = $(this);
var itemHtml = clickObj.parent().parent().prev().prop("outerHTML");
clickObj.parent().parent().before(itemHtml);
layui.form.render();
layui.laytp.init.tableDnd();
});
},
/**
* 监听.tableDnd节点,允许拖动排序
* .tableDnd节点存在的位置举例:系统配置,数组类型配置,拖动排序数组元素
*
* 要求
* - 页面上要加载jquery_3.3.1.js和jquery.tablednd.js两个js库
* - table的class要加上tableDnd
*
* 注意
* - 使用任意layui.js不存在的第三方jQuery库都需要加载
* ```
* /static/component/jquery_3.3.1.js
* ```
* - 然后再加载第三方jQuery库,比如当前是表格排序库
* ```
* /static/component/jquery.tablednd.js
* ```
* - 且一定要注意加载顺序,layui.js要优先加载,否则layui可能会报错
* - 先加载layui.js
* - 然后加载layuiConfig.js
* - 再加载jquery_3.3.1.js
* - 最后加载第三方jQuery库jquery.tablednd.js
*/
tableDnd: function () {
layui.each($(".tableDnd"), function (key, item) {
$(item).tableDnD({});
});
},
/**
* 监听拥有layerTips样式的节点,渲染layerTips组件
* data-color 弹窗背景颜色
* data-time 弹窗展示时间,单位秒
* data-text 弹窗内文本
*/
layerTips: function () {
var tipsIndex;
// 鼠标进入层就展示Tips
$(document).off('mouseover', '.layerTips').on('mouseover', '.layerTips', function () {
let obj = $(this);
let color = (typeof obj.data('color') != 'undefined') ? obj.data('color') : '#3595CC';
let time = (typeof obj.data('time') != 'undefined') ? obj.data('time') : 5000;
let text = $(this).data('text');
tipsIndex = layui.layer.tips(text, this, {
tips: [4, color]
, time: time
});
});
// 鼠标离开层就关闭Tips
$(document).off('mouseout', '.layerTips').on('mouseout', '.layerTips', function () {
layui.layer.close(tipsIndex);
});
},
/**
* 监听拥有layerImgTips样式的节点,渲染layerImgTips组件
* data-time 弹窗展示时间,单位秒
* data-text 弹窗内文本
*/
layerImgTips: function () {
var tipsIndex;
// 鼠标进入层就展示Tips
$(document).off('mouseover', '.layerImgTips').on('mouseover', '.layerImgTips', function (e) {
let position = 2;
if (e.screenY > (window.screen.height) / 2) {
position = 1
}
let obj = $(this);
let time = (typeof obj.data('time') != 'undefined') ? obj.data('time') : 5000;
var img = "<img src='" + $(this).attr('src') + "' style='width:300px; max-height:400px;' />";
tipsIndex = layui.layer.tips(img, this, {
tips: [position]
, time: time
, area: ['300px']
, skin: "laytpLayerImgTips"
});
});
// 鼠标离开层就关闭Tips
$(document).off('mouseout', '.layerImgTips').on('mouseout', '.layerImgTips', function () {
layui.layer.close(tipsIndex);
});
},
//锁屏
lockScreen: function () {
let lockScreenStatus = localStorage.getItem("laytpLockScreen");
$(document).ready(function () {
if (lockScreenStatus === "locked") {
layui.facade.popupDiv({
title: '锁屏',
path: '/admin/lockScreen.html',
shade: 0.5
});
}
});
$(document).on('click', '#lockScreen', function () {
layui.layer.confirm('锁屏后,需要使用登录密码解锁,确定锁屏么?', { title: "锁屏确认继续", skin: "laytp" }, function (index) {
layui.layer.close(index);
localStorage.setItem("laytpLockScreen", "locked");
layui.facade.popupDiv({
title: '锁屏',
path: '/admin/lockScreen.html',
shade: 0.5
});
});
});
},
};
layui.each(laytp.init, function (key, item) {
if (typeof item === "function") {
item();
}
});
layui.laytpForm.render();
//输出模块
exports(MOD_NAME, laytp);
layui.laytp = laytp;
window.laytp = laytp;
window.$ = $;
});
+244
View File
@@ -0,0 +1,244 @@
layui.define(["jquery"], function (f) {
var h = layui.jquery;
var i = "dropdown-open";
var e = "dropdown-disabled";
var b = "dropdown-no-scroll";
var c = "dropdown-menu-shade";
var n = "dropdown-menu";
var m = "dropdown-menu-nav";
var j = "dropdown-hover";
var d = "fixed";
var g = "no-shade";
var k = "layui-anim layui-anim-upbit";
var a = "layui-anim layui-anim-fadein";
var l = ["bottom-left", "bottom-right", "bottom-center", "top-left", "top-right", "top-center", "left-top", "left-bottom", "left-center", "right-top", "right-bottom", "right-center"];
if (h("#ew-css-dropdown").length <= 0) {
if(localStorage.getItem("staticDomain")){
layui.addcss("../component/laytp/css/module/dropdown.css?v=" + localStorage.getItem("version"), "skindropdowncss");
}else{
layui.link("/static/component/laytp/css/module/dropdown.css?v=" + localStorage.getItem("version"), "skindropdowncss");
}
}
var o = {
init: function () {
h(document).off("click.dropdown").on("click.dropdown", "." + n + ">*:first-child", function (t) {
var u = h(this).parent();
if (!u.hasClass(j)) {
if (u.hasClass(i)) {
u.removeClass(i)
} else {
o.hideAll();
o.show(h(this).parent().find("." + m))
}
}
t.stopPropagation()
});
h(document).off("click.dropHide").on("click.dropHide", function (t) {
o.hideAll()
});
h(document).off("click.dropNav").on("click.dropNav", "." + m, function (t) {
t.stopPropagation()
});
var s, p, q = "." + n + "." + j;
h(document).off("mouseenter.dropdown").on("mouseenter.dropdown", q, function (t) {
if (p && p == t.currentTarget) {
clearTimeout(s)
}
o.show(h(this).find("." + m))
});
h(document).off("mouseleave.dropdown").on("mouseleave.dropdown", q, function (t) {
p = t.currentTarget;
s = setTimeout(function () {
h(t.currentTarget).removeClass(i)
}, 300)
});
h(document).off("click.dropStand").on("click.dropStand", "[data-dropdown]", function (t) {
o.showFixed(h(this));
t.stopPropagation()
});
var r = "." + m + " li";
h(document).off("mouseenter.dropdownNav").on("mouseenter.dropdownNav", r, function (t) {
h(this).children(".dropdown-menu-nav-child").addClass(k);
h(this).addClass("active")
});
h(document).off("mouseleave.dropdownNav").on("mouseleave.dropdownNav", r, function (t) {
h(this).removeClass("active");
h(this).find("li.active").removeClass("active")
});
h(document).off("click.popconfirm").on("click.popconfirm", ".dropdown-menu-nav [btn-cancel]", function (t) {
o.hideAll();
t.stopPropagation()
})
},
openClickNavClose: function () {
h(document).off("click.dropNavA").on("click.dropNavA", "." + m + ">li>a", function (p) {
o.hideAll();
h(this).parentsUntil("." + n).last().parent().removeClass(i);
p.stopPropagation()
})
},
hideAll: function () {
h("." + n).removeClass(i);
h("." + m + "." + d).addClass("layui-hide");
h("." + c).remove();
h("body").removeClass(b);
h(".dropdown-fix-parent").removeClass("dropdown-fix-parent");
h("[data-dropdown]").removeClass(i)
},
show: function (r) {
if (r && r.length > 0 && !r.hasClass(e)) {
if (r.hasClass("dropdown-popconfirm")) {
r.removeClass(k);
r.addClass(a)
} else {
r.removeClass(a);
r.addClass(k)
}
var p;
for (var q = 0; q < l.length; q++) {
if (r.hasClass("dropdown-" + l[q])) {
p = l[q];
break
}
}
if (!p) {
r.addClass("dropdown-" + l[0]);
p = l[0]
}
o.forCenter(r, p);
r.parent("." + n).addClass(i);
return p
}
return false
},
showFixed: function (q) {
var t = h(q.data("dropdown")), p;
if (!t.hasClass("layui-hide")) {
o.hideAll();
return
}
o.hideAll();
p = o.show(t);
if (p) {
t.addClass(d);
t.removeClass("layui-hide");
var s = o.getTopLeft(q, t, p);
s = o.checkPosition(t, q, p, s);
t.css(s);
h("body").addClass(b);
var r = (q.attr("no-shade") == "true");
h("body").append('<div class="' + (r ? (c + " " + g) : c) + ' layui-anim layui-anim-fadein"></div>');
q.parentsUntil("body").each(function () {
var u = h(this).css("z-index");
if (/[0-9]+/.test(u)) {
h(this).addClass("dropdown-fix-parent")
}
});
q.addClass(i)
}
},
forCenter: function (p, u) {
if (!p.hasClass(d)) {
var t = p.parent().outerWidth()
, q = p.parent().outerHeight();
var s = p.outerWidth()
, v = p.outerHeight();
var w = u.split("-")
, r = w[0]
, x = w[1];
if ((r == "top" || r == "bottom") && x == "center") {
p.css("left", (t - s) / 2)
}
if ((r == "left" || r == "right") && x == "center") {
p.css("top", (q - v) / 2)
}
}
},
getTopLeft: function (B, A, y) {
var w = B.outerWidth();
var u = B.outerHeight();
var p = A.outerWidth();
var x = A.outerHeight();
var z = B.offset().top - h(document).scrollTop();
var t = B.offset().left;
var D = t + w;
var C = 0
, s = 0;
var v = y.split("-");
var r = v[0];
var q = v[1];
if (r == "top" || r == "bottom") {
x += 8;
switch (q) {
case "left":
s = t;
break;
case "center":
s = t - p / 2 + w / 2;
break;
case "right":
s = D - p
}
}
if (r == "left" || r == "right") {
p += 8;
switch (q) {
case "top":
C = z + u - x;
break;
case "center":
C = z - x / 2 + u / 2;
break;
case "bottom":
C = z
}
}
switch (r) {
case "top":
C = z - x;
break;
case "right":
s = t + w;
break;
case "bottom":
C = z + u;
break;
case "left":
s = t - p
}
return {
top: C,
left: s,
right: "auto",
bottom: "auto"
}
},
checkPosition: function (t, q, p, r) {
var s = p.split("-");
if ("bottom" == s[0]) {
if ((r.top + t.outerHeight()) > o.getPageHeight()) {
r = o.getTopLeft(q, t, "top-" + s[1]);
t.removeClass("dropdown-" + p);
t.addClass("dropdown-top-" + s[1])
}
} else {
if ("top" == s[0]) {
if (r.top < 0) {
r = o.getTopLeft(q, t, "bottom-" + s[1]);
t.removeClass("dropdown-" + p);
t.addClass("dropdown-bottom-" + s[1])
}
}
}
return r
},
getPageHeight: function () {
return document.documentElement.clientHeight || document.body.clientHeight
},
getPageWidth: function () {
return document.documentElement.clientWidth || document.body.clientWidth
}
};
o.init();
f("laytpDropdown", o)
});
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+652
View File
@@ -0,0 +1,652 @@
layui.define(['table', 'jquery', 'element', 'facade'], function (exports) {
"use strict";
var MOD_NAME = 'laytpMenu',
$ = layui.jquery,
element = layui.element;
var laytpMenu = function (opt) {
this.option = opt;
};
laytpMenu.prototype.render = function (opt) {
var option = {
elem: opt.elem,
async: opt.async,
parseData: opt.parseData,
url: opt.url,
method: opt.method ? opt.method : "GET",
defaultOpen: opt.defaultOpen,
defaultSelect: opt.defaultSelect,
control: opt.control,
defaultMenu: opt.defaultMenu,
accordion: opt.accordion,
height: opt.height,
theme: opt.theme,
data: opt.data ? opt.data : [],
change: opt.change ? opt.change : function () { },
done: opt.done ? opt.done : function () { }
}
var tempDone = option.done;
option.done = function(){
if (option.control) {
rationalizeHeaderControlWidthAuto(option);
}
tempDone();
}
if (option.async) {
if (option.method === "GET") {
getData(option.url).then(function (data) {
option.data = data;
renderMenu(option);
});
} else {
postData(option.url).then(function (data) {
option.data = data;
renderMenu(option);
});
}
} else {
// 延时返回,和 javascript 执行时序关联
window.setTimeout(function () { renderMenu(option); }, 500);
}
// 处理高度
$("#" + opt.elem).height(option.height)
return new laytpMenu(option);
}
// 任意左侧菜单绑定点击事件
laytpMenu.prototype.click = function (clickEvent) {
var _this = this;
$(document).off("click", "#" + _this.option.elem + " .site-demo-active").on("click", "#" + _this.option.elem + " .site-demo-active", function() {
var dom = $(this);
var data = {
menuId: dom.attr("menu-id"),
menuTitle: dom.attr("menu-title"),
menuPath: dom.attr("menu-title"),
menuIcon: dom.attr("menu-icon"),
menuUrl: dom.attr("menu-url"),
openType: dom.attr("open-type")
};
var doms = hash(dom);
if (doms != null) {
if (doms.text() != '') {
data['menuPath'] = doms.find("span").text() + " / " + data['menuPath'];
}
}
if (doms != null) {
var domss = hash(doms);
if (domss != null) {
if (domss.text() != '') {
data['menuPath'] = domss.find("span").text() + " / " + data['menuPath'];
}
}
}
if (domss != null) {
var domsss = hash(domss);
if (domsss != null) {
if (domsss.text() != '') {
data['menuPath'] = domsss.find("span").text() + " / " + data['menuPath'];
}
}
}
if ($("#" + _this.option.elem).is(".laytp-nav-mini")) {
if (_this.option.accordion) {
activeMenus = $(this).parent().parent().parent().children("a");
} else {
activeMenus.push($(this).parent().parent().parent().children("a"));
}
}
clickEvent(dom, data);
})
}
function hash(dom) {
var d = dom.parent().parent().prev();
if (d.prop("tagName") === "UL") {
return null;
}
return d;
}
// 样式选择
laytpMenu.prototype.skin = function (skin) {
var menu = $(".laytp-nav-tree[lay-filter='" + this.option.elem + "']").parent();
menu.removeClass("dark-theme");
menu.removeClass("light-theme");
menu.addClass(skin);
}
// 选择没有子级的菜单节点
laytpMenu.prototype.selectItem = function (laytpId) {
if (this.option.control != false) {
$("#" + this.option.elem + " a[menu-id='" + laytpId + "']").parents(".layui-side-scroll ").find("ul").css({
display: "none"
});
$("#" + this.option.elem + " a[menu-id='" + laytpId + "']").parents(".layui-side-scroll ").find(".layui-this").removeClass("layui-this");
$("#" + this.option.elem + " a[menu-id='" + laytpId + "']").parents("ul").css({
display: "block"
});
var controlId = $("#" + this.option.elem + " a[menu-id='" + laytpId + "']").parents("ul").attr("menu-id");
if (controlId != undefined) {
$("#" + this.option.control).find(".layui-this").removeClass("layui-this");
$("#" + this.option.control).find("[menu-id='" + controlId + "']").addClass("layui-this");
}
}
$("#" + this.option.elem + " a[menu-id='" + laytpId + "']").parents(".laytp-nav-tree").find(".layui-this").removeClass("layui-this");
if (!$("#" + this.option.elem).is(".laytp-nav-mini")) {
var openEle = null;
var openEleHeight = 0;
$($("#" + this.option.elem + " a[menu-id='" + laytpId + "']").parents('.layui-nav-child').get().reverse()).each(function () {
if (!$(this).parent().is('.layui-nav-itemed')) {
if (openEleHeight == 0) {
openEle = $(this);
} else {
$(this).parent().addClass('layui-nav-itemed');
$(this).css({
height: 'auto',
});
}
openEleHeight += $(this).children("dd").length * 48;
}
});
if (this.option.accordion) {
$("#" + this.option.elem + " a[menu-id='" + laytpId + "']").parent().parent().find("li").removeClass("layui-nav-itemed");
if (openEleHeight > 0) {
var currentDom = openEle.parent().siblings('.layui-nav-itemed').children(".layui-nav-child");
currentDom.animate({
height: "0px"
}, 240, function () {
currentDom.css({
height: "auto"
});
$(this).parent().removeClass("layui-nav-itemed");
$(this).find('.layui-nav-itemed').removeClass("layui-nav-itemed");
});
}
}
if (openEleHeight > 0) {
openEle.parent().addClass("layui-nav-itemed");
openEle.height(0);
openEle.animate({
height: openEleHeight + "px"
}, 240, function () {
$(this).css({ height: 'auto' });
});
}
}
$("#" + this.option.elem + " a[menu-id='" + laytpId + "']").parent().addClass("layui-this");
}
var activeMenus;
// 手机模式下,右下角按钮点击展开收缩左侧菜单事件
laytpMenu.prototype.collapse = function (time) {
var elem = this.option.elem;
var config = this.option;
if ($("#" + this.option.elem).is(".laytp-nav-mini")) {
$.each(activeMenus, function (i, item) {
$("#" + elem + " a[menu-id='" + $(this).attr("menu-id") + "']").parent().addClass("layui-nav-itemed");
});
$("#" + this.option.elem).removeClass("laytp-nav-mini");
$("#" + this.option.elem).animate({
width: "220px"
}, 150);
isHoverMenu(false, config);
var that = this;
$("#" + this.option.elem)
.promise()
.done(function () {
if (that.option.control) {
rationalizeHeaderControlWidth(that.option);
}
})
} else {
activeMenus = $("#" + this.option.elem).find(".layui-nav-itemed>a");
$("#" + this.option.elem).find(".layui-nav-itemed").removeClass("layui-nav-itemed");
$("#" + this.option.elem).addClass("laytp-nav-mini");
$("#" + this.option.elem).animate({
width: "60px"
}, 400);
var that = this;
$("#" + this.option.elem)
.promise()
.done(function () {
isHoverMenu(true, config);
if (that.option.control) {
rationalizeHeaderControlWidth(that.option);
}
})
}
}
function getData(route) {
var defer = $.Deferred();
var contact = (route.indexOf('?') > -1) ? "&" : "?";
facade.ajax({
type: 'GET',
route: route + contact + "fresh=" + Math.random(),
successAlert: false
}).done(function(result){
defer.resolve(result);
});
return defer.promise();
}
function postData(url) {
var defer = $.Deferred();
$.post(localStorage.getItem("staticDomain") + url + "?fresh=" + Math.random(), function(result) {
defer.resolve(result)
});
return defer.promise();
}
function renderMenu(option) {
if (option.parseData != false) {
option.data = option.parseData(option.data);
}
if (option.data.length > 0) {
if (option.control != false) {
createMenuAndControl(option);
} else {
createMenu(option);
}
}
element.init();
downShow(option);
option.done();
}
function createMenu(option) {
var menuHtml = '<div style="height:100%!important;" class="laytp-side-scroll layui-side-scroll ' + option.theme + '"><ul lay-filter="' + option.elem +
'" class="layui-nav arrow laytp-menu layui-nav-tree laytp-nav-tree">';
$.each(option.data, function (i, item) {
var content = '<li class="layui-nav-item">';
if (i === option.defaultOpen) {
content = '<li class="layui-nav-item layui-nav-itemed" >';
}
var href = "javascript:void(0);";
var target = "";
var className = "site-demo-active";
if (item.openType === "_blank" && item.type === 1) {
href = item.href;
target = "target='_blank'";
className = "";
}
if (item.type === 0) {
// 创 建 目 录 结 构
content += '<a href="javascript:;" menu-type="' + item.type + '" menu-id="' + item.id + '" href="' + href +
'" ' + target + '><i class="' + item.icon + '"></i><span>' + item.title +
'</span></a>';
} else if (item.type === 1) {
content += '<a class="' + className + '" menu-type="' + item.type + '" menu-url="' + item.href + '" menu-id="' +
item.id +
'" menu-title="' + item.title + '" href="' + href + '" ' + target + '><i class="' + item.icon +
'"></i><span>' + item.title + '</span></a>';
}
// 调 用 递 归 方 法 加 载 无 限 层 级 的 子 菜 单
content += loadchild(item);
// 结 束 一 个 根 菜 单 项
content += '</li>';
menuHtml += content;
});
// 结 束 菜 单 结 构 的 初 始 化
menuHtml += "</ul></div>";
// 将 菜 单 拼 接 到 初 始 化 容 器 中
$("#" + option.elem).html(menuHtml);
}
// 创建多系统菜单, 包括渲染静态html和绑定顶部菜单点击事件
function createMenuAndControl(option) {
var control = '<div class="control"><ul class="layui-nav laytp-nav-control pc layui-hide-xs" style="width: fit-content;">';
control+= '<li class="layui-nav-item tabdrop layui-hide" style="float:right !important;"><a href="javascript:void(0);"><i class="layui-icon layui-icon-more layui-font-20"></i></a><dl class="layui-nav-child"></dl></li>';
var controlPe = '<ul class="layui-nav laytp-nav-control layui-hide-sm">';
// 声 明 头 部
var menu = '<div class="layui-side-scroll ' + option.theme + '">'
// 开 启 同 步 操 作
var index = 0;
var controlItemPe = '<dl class="layui-nav-child">';
var config = layui.admin.readConfig();
$.each(option.data, function (i, item) {
var menuItem = '';
var controlItem = '';
if(index < config.menu['maxTopMenuNum']){
if (i === option.defaultMenu) {
controlItem = '<li laytp-href="' + item.href + '" laytp-title="' + item.title + '" menu-id="' + item.id +
'" class="layui-this layui-nav-item"><a href="javascript:void(0);">' + item.title + '</a></li>';
menuItem = '<ul menu-id="' + item.id + '" lay-filter="' + option.elem +
'" class="layui-nav arrow layui-nav-tree laytp-nav-tree">';
controlPe += '<li class="layui-nav-item"><a class="pe-title" href="javascript:void(0);" >' + item.title + '</a>';
controlItemPe += '<dd laytp-href="' + item.href + '" laytp-title="' + item.title + '" menu-id="' + item.id +
'"><a href="javascript:void(0);">' + item.title + '</a></dd>';
} else {
controlItem = '<li laytp-href="' + item.href + '" laytp-title="' + item.title + '" menu-id="' + item.id +
'" class="layui-nav-item"><a href="javascript:void(0);">' + item.title + '</a></li>';
menuItem = '<ul style="display:none" menu-id="' + item.id + '" lay-filter="' + option.elem +
'" class="layui-nav arrow layui-nav-tree laytp-nav-tree">';
controlItemPe += '<dd laytp-href="' + item.href + '" laytp-title="' + item.title + '" menu-id="' + item.id +
'"><a href="javascript:void(0);">' + item.title + '</a></dd>';
}
index++;
}else{
menuItem = '<ul style="display:none" menu-id="' + item.id + '" lay-filter="' + option.elem +
'" class="layui-nav arrow layui-nav-tree laytp-nav-tree">';
controlItemPe += '<dd menu-href="' + item.href + '" menu-title="' + item.title + '" menu-id="' + item.id +
'"><a href="javascript:void(0);">' + item.title + '</a></dd>';
index++;
}
$.each(item.children, function (i, note) {
// 创 建 每 一 个 菜 单 项
var content = '<li class="layui-nav-item" >';
var href = "javascript:void(0);";
var target = "";
var className = "site-demo-active";
if (note.openType == "_blank" && note.type == 1) {
href = note.href;
target = "target='_blank'";
className = "";
}
// 判 断 菜 单 类 型 0 是 不可跳转的目录 1 是 可 点 击 跳 转 的 菜 单
if (note.type == 0) {
// 创 建 目 录 结 构
content += '<a href="' + href + '" ' + target + ' menu-type="' + note.type + '" menu-id="' + note.id +
'" ><i class="' + note.icon + '"></i><span>' + note.title +
'</span></a>';
} else if (note.type == 1) {
// 创 建 菜 单 结 构
content += '<a ' + target + ' class="' + className + '" menu-type="' + note.type + '" menu-url="' + note.href +
'" menu-id="' + note.id +
'" menu-title="' + note.title + '" href="' + href + '"><i class="' + note.icon +
'"></i><span>' + note.title + '</span></a>';
}
content += loadchild(note);
content += '</li>';
menuItem += content;
})
menu += menuItem + '</ul>';
control += controlItem;
})
if(option.data.length > config.menu['maxTopMenuNum']){
control += '<li class="layui-nav-item">\n' +
'<a href="javascript:void(0);" class="laytp-icon laytp-icon-elipsis"></a>' +
'<!-- 功 能 菜 单 -->\n' +
'<dl class="layui-nav-child">';
var moreTopMenuIndex = 0;
$.each(option.data, function(i, item) {
var moreTopMenuItem = '';
if(moreTopMenuIndex >= config.menu['maxTopMenuNum']){
moreTopMenuItem = '<dd><a menu-href="' + item.href + '" menu-title="' + item.title + '" menu-id="' + item.id +'">' + item.title + '</a></dd>';
}
moreTopMenuIndex++;
control += moreTopMenuItem;
});
control += '</dl></li></ul>';
}
controlItemPe += "</li></dl></ul>"
controlPe += controlItemPe;
$("#" + option.control).html(control + "</div>");
$("#" + option.control).append(controlPe);
$("#" + option.elem).html(menu);
// 绑定顶部菜单点击事件
$(document).off("click", "#" + option.control + " .laytp-nav-control [menu-id]").on("click", "#" + option.control + " .laytp-nav-control [menu-id]", function() {
// $("#" + option.control + " .laytp-nav-control").on("click", "[menu-id]", function () {
$("#" + option.elem).find(".laytp-nav-tree").css({
display: 'none'
});
$("#" + option.elem).find(".laytp-nav-tree[menu-id='" + $(this).attr("menu-id") + "']").css({
display: 'block'
});
$("#" + option.control).find(".pe-title").html($(this).attr("menu-title"));
$("#" + option.control).find("")
option.change($(this).attr("menu-id"), $(this).attr("menu-title"), $(this).attr("menu-href"))
// 自动点击左侧的第一个菜单
var s = $("a:first",$("#" + option.elem).find("ul[style='display: block;']")).parent();
if(s.hasClass("layui-nav-itemed")){
recursionFindA(s);
}else{
$("a:first",$("#" + option.elem).find("ul[style='display: block;']")).click();
}
});
}
// 点击顶部菜单,自动点击左侧菜单,当菜单已经是展开状态时,要递归找到最低级别的A标签进行点击
function recursionFindA(obj){
var dlObj = $("dl:first", obj);
if(dlObj.length === 0){
$("a:first", obj).click();
}else{
recursionFindA($("dd:first",dlObj));
}
}
/** 加载子菜单 (递归)*/
function loadchild(obj) {
// 判 单 是 否 是 菜 单, 如 果 是 菜 单 直 接 返 回
if (obj.type == 1) {
return "";
}
// 创 建 子 菜 单 结 构
var content = '<dl class="layui-nav-child">';
// 如 果 嵌 套 不 等 于 空
if (obj.children != null && obj.children.length > 0) {
// 遍 历 子 项 目
$.each(obj.children, function (i, note) {
// 创 建 子 项 结 构
content += '<dd>';
var href = "javascript:void(0);";
var target = "";
var className = "site-demo-active";
if (note.openType == "_blank" && note.type == 1) {
href = note.href;
target = "target='_blank'";
className = "";
}
// 判 断 子 项 类 型
if (note.type == 0) {
// 创 建 目 录 结 构
content += '<a ' + target + ' href="' + href + '" menu-type="' + note.type + '" menu-id="' + note.id +
'"><i class="' + note.icon + '"></i><span>' + note.title + '</span></a>';
} else if (note.type == 1) {
// 创 建 菜 单 结 构
content += '<a ' + target + ' class="' + className + '" menu-type="' + note.type + '" menu-url="' + note.href +
'" menu-id="' + note.id + '" menu-title="' + note.title + '" menu-icon="' + note.icon + '" href="' + href +
'" ><i class="' + note.icon + '"></i><span>' + note.title + '</span></a>';
}
// 加 载 子 项 目 录
content += loadchild(note);
// 结 束 当 前 子 菜 单
content += '</dd>';
});
// 封 装
} else {
content += '<dd style="background-color: transparent!important;"><a style="background-color: transparent!important;margin-left: 26px">目录为空</a></dd>';
}
content += '</dl>';
return content;
}
function downShow(option) {
$(document).off("click", "#" + option.elem + " a[menu-type='0']").on("click", "#" + option.elem + " a[menu-type='0']", function() {
// $("body #" + option.elem).on("click", "a[menu-type='0']", function () {
if (!$("#" + option.elem).is(".laytp-nav-mini")) {
var superEle = $(this).parent();
var ele = $(this).next('.layui-nav-child');
var heights = ele.children("dd").length * 48;
if (superEle.is(".layui-nav-itemed")) {
// if (option.accordion) {
// var currentDom = $(this).parent().siblings('.layui-nav-itemed').children('.layui-nav-child');
// currentDom.animate({
// height: '0px'
// }, 240, function () {
// currentDom.css({
// height: "auto",
// });
// $(this).parent().removeClass("layui-nav-itemed");
// $(this).find('.layui-nav-itemed').removeClass("layui-nav-itemed");
// });
// }
if (option.accordion) {
superEle.parent().find(".layui-nav-itemed").removeClass("layui-nav-itemed");
superEle.addClass("layui-nav-itemed");
//自动点击第一个子菜单
$("a:first",ele).click();
}
// ele.height(0);
// ele.animate({
// height: heights + "px"
// }, 200, function() {
// ele.css({
// height: "auto"
// });
// });
} else {
// superEle.addClass("layui-nav-itemed");
ele.animate({
height: "0px"
}, 200, function() {
ele.css({
height: "auto"
});
superEle.removeClass("layui-nav-itemed");
});
}
}
})
}
/** 二 级 悬 浮 菜 单*/
function isHoverMenu(b, option) {
if (b) {
var navItem = "#" + option.elem + ".laytp-nav-mini .layui-nav-item";
var navChildDl = navItem + " .layui-nav-child>dl";
var navChildDd = navItem + " .layui-nav-child>dd";
$(navItem + "," + navChildDd).mouseenter(function () {
var _this = $(this);
_this.siblings().find(".layui-nav-child")
.removeClass("layui-nav-hover").css({
left: 0,
top: 0
});
_this.children(".layui-nav-child").addClass("layui-nav-hover");
var height = $(window).height();
var topLength = _this.offset().top;
var thisHeight = _this.children(".layui-nav-child").height();
if ((thisHeight + topLength) > height) {
topLength = height - thisHeight - 10;
}
var left = _this.offset().left + 60;
if (!_this.hasClass("layui-nav-item")) {
left = _this.offset().left + _this.width();
}
_this.children(".layui-nav-child").offset({
top: topLength,
left: left
});
});
$(navItem + "," + navChildDl).mouseleave(function () {
var _this = $(this);
_this.closest('.layui-nav-item')
.find(".layui-nav-child")
.removeClass("layui-nav-hover")
.css({
left: 0,
top: 0
});
});
} else {
$("#" + option.elem + " .layui-nav-item").off('mouseenter').unbind('mouseleave');
$("#" + option.elem + " dd").off('mouseenter').unbind('mouseleave');
}
}
function rationalizeHeaderControlWidth(option) {
var $headerControl = $("#" + option.control);
var $nextEl = $headerControl.next();
var rationalizeWidth;
if ($nextEl.length) {
rationalizeWidth = $nextEl.position().left - $headerControl.position().left;
} else {
rationalizeWidth = $headerControl.parent().innerWidth() - $headerControl.position().left;
}
$("#" + option.control + " .control").css({"width": rationalizeWidth});
var navobj = $("#" + option.control+' ul.laytp-nav-control.pc');
var dropdown = $(".tabdrop", navobj);
var collection = 0;
var maxwidth = rationalizeWidth - 60;
var liwidth = 0;
//检查超过一行的标签页
$('.tabdrop').find('dd').each(function(){
var newLI = $('<li></li>').html($(this).html());
newLI.addClass('layui-nav-item');
newLI.attr('laytp-href', $(this).attr('laytp-href'));
newLI.attr('laytp-title', $(this).attr('laytp-title'));
newLI.attr('menu-id', $(this).attr('menu-id'));
navobj.append(newLI);
$(this).remove();
})
var litabs = navobj.find('>li').not('.tabdrop');
var totalwidth = 0;
litabs.each(function () {
totalwidth += $(this).outerWidth(true);
});
if (rationalizeWidth < totalwidth) {
litabs.each(function () {
liwidth += $(this).outerWidth(true);
if (liwidth > maxwidth) {
var newDD = $('<dd></dd>').html($(this).html());
newDD.attr('laytp-href', $(this).attr('laytp-href'));
newDD.attr('laytp-title', $(this).attr('laytp-title'));
newDD.attr('menu-id', $(this).attr('menu-id'));
dropdown.find('dl').append(newDD);
collection++;
$(this).remove();
}
});
if (collection > 0) {
dropdown.removeClass('layui-hide');
if (dropdown.find('.active').length === 1) {
dropdown.addClass('active');
} else {
dropdown.removeClass('active');
}
}
}else {
dropdown.addClass('layui-hide');
}
}
function rationalizeHeaderControlWidthAuto(option){
$(window).on('resize', function () {
rationalizeHeaderControlWidth(option);
})
$(document).ready(function () {
rationalizeHeaderControlWidth(option);
});
}
exports(MOD_NAME, new laytpMenu());
})
+659
View File
@@ -0,0 +1,659 @@
layui.define(['jquery', 'element'], function(exports) {
"use strict";
var MOD_NAME = 'laytpTab',
$ = layui.jquery,
element = layui.element;
var laytpTab = function(opt) {
this.option = opt;
};
var tabData = new Array();
var tabDataCurrent = 0;
laytpTab.prototype.render = function(opt) {
//默认配置值
var option = {
elem: opt.elem,
data: opt.data,
tool: opt.tool,
roll: opt.roll,
index: opt.index,
width: opt.width,
height: opt.height,
tabMax: opt.tabMax,
session: opt.session ? opt.session : false,
closeEvent: opt.closeEvent,
success: opt.success ? opt.success : function(id) {}
};
// 初始化,检索 session 是否开启
if (option.session) {
// 替换 opt.data 数据
if (sessionStorage.getItem(option.elem + "-laytp-tab-data") != null) {
tabData = JSON.parse(sessionStorage.getItem(option.elem + "-laytp-tab-data"));
option.data = JSON.parse(sessionStorage.getItem(option.elem + "-laytp-tab-data"));
tabDataCurrent = sessionStorage.getItem(option.elem + "-laytp-tab-data-current");
tabData.forEach(function(item, index) {
if (item.id == tabDataCurrent) {
option.index = index;
}
})
} else {
tabData = opt.data;
}
}
var lastIndex;
var tab = createTab(option);
$("#" + option.elem).html(tab);
$(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-prev").click(function() {
rollPage("left", option);
})
$(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-next").click(function() {
rollPage("right", option);
})
element.init();
toolEvent(option);
$("#" + option.elem).width(opt.width);
$("#" + option.elem).height(opt.height);
$("#" + option.elem).css({
position: "relative"
});
closeEvent(option);
option.success(sessionStorage.getItem(option.elem + "-laytp-tab-data-current"));
$("body .layui-tab[lay-filter='" + option.elem + "']").on("contextmenu", "li", function(e) {
// 获取当前元素位置
var top = e.clientY;
var left = e.clientX;
var currentId = $(this).attr("lay-id");
var menu = "<ul><li class='item' id='" + option.elem + "closeThis'>关闭当前</li><li class='item' id='" + option.elem +
"closeOther'>关闭其他</li><li class='item' id='" + option.elem + "closeAll'>关闭所有</li></ul>";
// 初始化
layer.open({
type: 1,
title: false,
shade: false,
skin: 'laytp-tab-menu',
closeBtn: false,
area: ['100px', '108px'],
fixed: true,
offset: [top, left],
content: menu, //iframe的url,
success: function(layero, index) {
layer.close(lastIndex);
lastIndex = index;
menuEvent(option,index);
var timer;
$(layero).on('mouseout', function() {
timer = setTimeout(function() {
layer.close(index);
}, 30)
});
$(layero).on('mouseover', function() {
clearTimeout(timer);
});
// 清除 item 右击
$(layero).on('contextmenu',function(){
return false;
})
}
});
return false;
})
return new laytpTab(option);
};
laytpTab.prototype.click = function(callback) {
var elem = this.option.elem;
var option = this.option;
element.on('tab(' + this.option.elem + ')', function(data) {
var id = $("#" + elem + " .layui-tab-title .layui-this").attr("lay-id");
sessionStorage.setItem(option.elem + "-laytp-tab-data-current", id);
callback(id);
});
};
laytpTab.prototype.positionTab = function() {
var $tabTitle = $('.layui-tab[lay-filter=' + this.option.elem + '] .layui-tab-title');
var autoLeft = 0;
$tabTitle.children("li").each(function() {
if ($(this).hasClass('layui-this')) {
return false;
} else {
autoLeft += $(this).outerWidth();
}
});
$tabTitle.animate({
scrollLeft: autoLeft - $tabTitle.width() / 3
}, 200);
};
laytpTab.prototype.clear = function() {
sessionStorage.removeItem(this.option.elem + "-laytp-tab-data");
sessionStorage.removeItem(this.option.elem + "-laytp-tab-data-current");
};
laytpTab.prototype.addTab = function(opt) {
var title = '';
if (opt.close) {
title += '<span class="laytp-tab-active"></span><span class="able-close title">' + opt.title +
'</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>';
} else {
title += '<span class="laytp-tab-active"></span><span class="disable-close">' + opt.title +
'</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>';
}
element.tabAdd(this.option.elem, {
title: title,
content: '<iframe id="' + opt.id + '" name="' + opt.id + '" data-frameid="' + opt.id + '" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes" width="100%" height="100%" frameborder="no" src="javascript:void(0);" style="width:100%;height:100%;"></iframe>',
id: opt.id
});
setTimeout("document.getElementById('"+opt.id+"').src='"+opt.url+"';",0);
tabData.push(opt);
sessionStorage.setItem(this.option.elem + "-laytp-tab-data", JSON.stringify(tabData));
sessionStorage.setItem(this.option.elem + "-laytp-tab-data-current", opt.id);
element.tabChange(this.option.elem, opt.id);
};
var index = 0;
// 根据过滤 filter 标识, 删除执行选项卡
laytpTab.prototype.delTabByElem = function(elem, id, callback) {
var currentTab = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title [lay-id='" + id + "']");
if (currentTab.find("span").is(".able-close")) {
tabDelete(elem, id, callback);
}
};
// 关闭所有选项卡
laytpTab.prototype.delAllTabByElem = function(elem, callback) {
var currentId = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title .layui-this").attr(
"lay-id");
var tabtitle = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title li");
$.each(tabtitle, function(i) {
if ($(this).find("span").is(".able-close")) {
tabDelete(elem, $(this).attr("lay-id"), callback);
}
})
}
// 根据过滤 filter 标识, 删除当前选项卡
laytpTab.prototype.delCurrentTabByElem = function(elem, callback) {
var currentTab = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title .layui-this");
if (currentTab.find("span").is(".able-close")) {
var currentId = currentTab.attr("lay-id");
tabDelete(elem, currentId, callback);
}
};
// 关闭其他选项卡
laytpTab.prototype.delOtherTabByElem = function(elem, callback) {
var currentId = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title .layui-this").attr(
"lay-id");
var tabtitle = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title li");
$.each(tabtitle, function(i) {
if ($(this).attr("lay-id") != currentId) {
if ($(this).find("span").is(".able-close")) {
tabDelete(elem, $(this).attr("lay-id"), callback);
}
}
})
}
// 修改标题
laytpTab.prototype.changeTabTitleById = function(elem, id, title) {
var currentTab = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title [lay-id='" + id +
"'] .title");
currentTab.html(title);
}
// 通过过滤 filter 标识, 新增标签页
laytpTab.prototype.addTabOnlyByElem = function(elem, opt, time) {
var title = '';
if (opt.close) {
title += '<span class="laytp-tab-active"></span><span class="able-close title">' + opt.title +
'</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>'
} else {
title += '<span class="laytp-tab-active"></span><span class="disable-close">' + opt.title +
'</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>'
}
if ($(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title li[lay-id]").length <= 0) {
if (time != false && time != 0) {
var load = '<div id="laytp-tab-loading' + index + '" class="laytp-tab-loading">' +
'<div class="ball-loader">' +
'<span></span><span></span><span></span><span></span>' +
'</div>' +
'</div>'
$("#" + elem).find(".laytp-tab").append(load);
var laytpLoad = $("#" + elem).find("#laytp-tab-loading" + index);
laytpLoad.css({
display: "block"
});
setTimeout(function() {
laytpLoad.fadeOut(500);
}, time);
index++;
}
element.tabAdd(this.option.elem, {
title: title,
content: '<iframe id="' + opt.id + '" name="' + opt.id + '" data-frameid="' + opt.id + '" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes" width="100%" height="100%" frameborder="no" src="javascript:void(0);" style="width:100%;height:100%;"></iframe>',
id: opt.id
});
setTimeout("document.getElementById('"+opt.id+"').src='"+opt.url+"';",0);
tabData.push(opt);
sessionStorage.setItem(elem + "-laytp-tab-data", JSON.stringify(tabData));
} else {
var isData = false;
$.each($(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title li[lay-id]"), function() {
if ($(this).attr("lay-id") == opt.id) {
isData = true;
}
})
if (isData == false) {
if (time != false && time != 0) {
var load = '<div id="laytp-tab-loading' + index + '" class="laytp-tab-loading">' +
'<div class="ball-loader">' +
'<span></span><span></span><span></span><span></span>' +
'</div>' +
'</div>'
$("#" + elem).find(".laytp-tab").append(load);
var laytpLoad = $("#" + elem).find("#laytp-tab-loading" + index);
laytpLoad.css({
display: "block"
});
setTimeout(function() {
laytpLoad.fadeOut(500);
}, time);
index++;
}
element.tabAdd(this.option.elem, {
title: title,
content: '<iframe id="' + opt.id + '" name="' + opt.id + '" data-frameid="' + opt.id + '" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes" width="100%" height="100%" frameborder="no" src="javascript:void(0);" style="width:100%;height:100%;"></iframe>',
id: opt.id
});
setTimeout("document.getElementById('"+opt.id+"').src='"+opt.url+"';",0);
tabData.push(opt);
sessionStorage.setItem(elem + "-laytp-tab-data", JSON.stringify(tabData));
}
}
sessionStorage.setItem(elem + "-laytp-tab-data-current", opt.id);
element.tabChange(elem, opt.id);
};
/** 添 加 唯 一 选 项 卡 */
laytpTab.prototype.addTabOnly = function(opt, time) {
var title = '';
if (opt.close) {
title += '<span class="laytp-tab-active"></span><span class="able-close title">' + opt.title +
'</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>';
} else {
title += '<span class="laytp-tab-active"></span><span class="disable-close">' + opt.title +
'</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>';
}
if ($(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-title li[lay-id]").length <= 0) {
if (time != false && time != 0) {
var load = '<div id="laytp-tab-loading' + index + '" class="laytp-tab-loading">' +
'<div class="ball-loader">' +
'<span></span><span></span><span></span><span></span>' +
'</div>' +
'</div>';
$("#" + this.option.elem).find(".laytp-tab").append(load);
var laytpLoad = $("#" + this.option.elem).find("#laytp-tab-loading" + index);
laytpLoad.css({
display: "block"
});
setTimeout(function() {
laytpLoad.fadeOut(500);
}, time);
index++;
}
element.tabAdd(this.option.elem, {
title: title,
content: '<iframe id="' + opt.id + '" name="' + opt.id + '" data-frameid="' + opt.id + '" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes" width="100%" height="100%" frameborder="no" src="javascript:void(0);" style="width:100%;height:100%;"></iframe>',
id: opt.id
});
setTimeout("document.getElementById('"+opt.id+"').src='"+opt.url+"';",0);
tabData.push(opt);
sessionStorage.setItem(this.option.elem + "-laytp-tab-data", JSON.stringify(tabData));
sessionStorage.setItem(this.option.elem + "-laytp-tab-data-current", opt.id);
} else {
var isData = false;
//查询当前选项卡数量
if ($(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-title li[lay-id]").length >= this.option.tabMax) {
layer.msg("最多打开" + this.option.tabMax + "个标签页", {
icon: 2,
time: 1000,
shift: 6 //抖动效果
});
return false;
}
$.each($(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-title li[lay-id]"), function() {
if ($(this).attr("lay-id") == opt.id) {
isData = true;
}
});
if (isData == false) {
if (time != false && time != 0) {
var load = '<div id="laytp-tab-loading' + index + '" class="laytp-tab-loading">' +
'<div class="ball-loader">' +
'<span></span><span></span><span></span><span></span>' +
'</div>' +
'</div>'
$("#" + this.option.elem).find(".laytp-tab").append(load);
var laytpLoad = $("#" + this.option.elem).find("#laytp-tab-loading" + index);
laytpLoad.css({
display: "block"
});
setTimeout(function() {
laytpLoad.fadeOut(500);
}, time);
index++;
}
element.tabAdd(this.option.elem, {
title: title,
content: '<iframe id="' + opt.id + '" name="' + opt.id + '" data-frameid="' + opt.id + '" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes" width="100%" height="100%" frameborder="no" src="javascript:void(0);" style="width:100%;height:100%;"></iframe>',
id: opt.id
});
// 兼容FireFox,避免NS_BINDING_ABORTED错误
setTimeout("document.getElementById('"+opt.id+"').src='"+opt.url+"';", 10);
tabData.push(opt);
sessionStorage.setItem(this.option.elem + "-laytp-tab-data", JSON.stringify(tabData));
sessionStorage.setItem(this.option.elem + "-laytp-tab-data-current", opt.id);
}
}
element.tabChange(this.option.elem, opt.id);
sessionStorage.setItem(this.option.elem + "-laytp-tab-data-current", opt.id);
};
// 刷 新 指 定 的 选 项 卡
laytpTab.prototype.refresh = function(time) {
// 1.为了使用layui的样式加载器,tab页面所有的样式都使用layui的js统一加载了
// 2.javascript的执行需要放在页面底部
// 因为js的执行需要让document元素优先加载,然后再执行js对document元素进行操作
// 3.现在样式也放在js里面加载所以,document元素优先于css加载了,于是会造成页面跳动
// index.html的加载方式是在head部分加载了需要的css样式,所以index.html的css样式是优于document加载的
// 而tab页面的css样式使用的是js统一加载的,所以需要延迟200毫秒,让js把样式都加载完毕之后再渲染展示document元素
// time = 200;
// 刷 新 指 定 的 选 项 卡
if (time != false && time != 0) {
var load = '<div id="laytp-tab-loading' + index + '" class="laytp-tab-loading">' +
'<div class="ball-loader">' +
'<span></span><span></span><span></span><span></span>' +
'</div>' +
'</div>';
var elem = this.option.elem;
$("#" + this.option.elem).find(".laytp-tab").append(load);
var laytpLoad = $("#" + this.option.elem).find("#laytp-tab-loading" + index);
laytpLoad.css({
display: "block"
});
index++;
setTimeout(function() {
laytpLoad.fadeOut(500, function() {
laytpLoad.remove();
});
}, time);
$(".layui-tab[lay-filter='" + elem + "'] .layui-tab-content .layui-show").find("iframe")[0].contentWindow
.location.reload(true);
} else {
$(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-content .layui-show").find("iframe")[0].contentWindow
.location.reload(true);
}
};
function tabDelete(elem, id, callback, option) {
//根据 elem id 来删除指定的 layui title li
var tabTitle = $(".layui-tab[lay-filter='" + elem + "']").find(".layui-tab-title");
// 删除指定 id 的 title
var removeTab = tabTitle.find("li[lay-id='" + id + "']");
var nextNode = removeTab.next("li");
if (!removeTab.hasClass("layui-this")) {
removeTab.remove();
var tabContent = $(".layui-tab[lay-filter='" + elem + "']").find("iframe[id='" + id + "']").parent();
tabContent.remove();
tabData = JSON.parse(sessionStorage.getItem(elem + "-laytp-tab-data"));
tabDataCurrent = sessionStorage.getItem(elem + "-laytp-tab-data-current");
tabData = tabData.filter(function(item) {
return item.id != id;
})
sessionStorage.setItem(elem + "-laytp-tab-data", JSON.stringify(tabData));
return false;
}
var currId;
if (nextNode.length) {
nextNode.addClass("layui-this");
currId = nextNode.attr("lay-id");
$("#" + elem + " [id='" + currId + "']").parent().addClass("layui-show");
} else {
var prevNode = removeTab.prev("li");
prevNode.addClass("layui-this");
currId = prevNode.attr("lay-id");
$("#" + elem + " [id='" + currId + "']").parent().addClass("layui-show");
}
callback(currId);
tabData = JSON.parse(sessionStorage.getItem(elem + "-laytp-tab-data"));
tabDataCurrent = sessionStorage.getItem(elem + "-laytp-tab-data-current");
tabData = tabData.filter(function(item) {
return item.id != id;
})
sessionStorage.setItem(elem + "-laytp-tab-data", JSON.stringify(tabData));
sessionStorage.setItem(elem + "-laytp-tab-data-current", currId);
removeTab.remove();
// 删除 content
var tabContent = $(".layui-tab[lay-filter='" + elem + "']").find("iframe[id='" + id + "']").parent();
// 删除
tabContent.remove();
}
function createTab(option) {
var type = "";
var types = option.type + " ";
if (option.roll == true) {
type = "layui-tab-roll";
}
if (option.tool != false) {
type = "layui-tab-tool";
}
if (option.roll == true && option.tool != false) {
type = "layui-tab-rollTool";
}
var tab = '<div class="laytp-tab ' + types + type + ' layui-tab" lay-filter="' + option.elem +
'" lay-allowClose="true">';
var title = '<ul class="layui-tab-title">';
var content = '<div class="layui-tab-content">';
var control =
'<div class="layui-tab-control"><li class="layui-tab-prev layui-icon layui-icon-left"></li><li class="layui-tab-next layui-icon layui-icon-right"></li><li class="layui-tab-tool layui-icon layui-icon-down"><ul class="layui-nav" lay-filter=""><li class="layui-nav-item"><a href="javascript:;"></a><dl class="layui-nav-child">';
// 处 理 选 项 卡 头 部
var index = 0;
$.each(option.data, function(i, item) {
var TitleItem = '';
if (option.index == index) {
TitleItem += '<li lay-id="' + item.id + '" class="layui-this"><span class="laytp-tab-active"></span>';
} else {
TitleItem += '<li lay-id="' + item.id + '" ><span class="laytp-tab-active"></span>';
}
if (item.close) {
// 当 前 选 项 卡 可 以 关 闭
TitleItem += '<span class="able-close title">' + item.title + '</span>';
} else {
// 当 前 选 项 卡 不 允 许 关 闭
TitleItem += '<span class="disable-close">' + item.title + '</span>';
}
TitleItem += '<i class="layui-icon layui-unselect layui-tab-close">ဆ</i></li>';
title += TitleItem;
if (option.index == index) {
// 处 理 显 示 内 容
content += '<div class="layui-show layui-tab-item"><iframe id="' + item.id + '" data-frameid="' + item.id +
'" src="' + item.url +
'" frameborder="no" border="0" marginwidth="0" marginheight="0" style="width: 100%;height: 100%;"></iframe></div>'
} else {
// 处 理 显 示 内 容
content += '<div class="layui-tab-item"><iframe id="' + item.id + '" data-frameid="' + item.id + '" src="' +
item.url +
'" frameborder="no" border="0" marginwidth="0" marginheight="0" style="width: 100%;height: 100%;"></iframe></div>'
}
index++;
});
title += '</ul>';
content += '</div>';
control += '<dd id="closeThis"><a href="javascript:void(0);">关 闭 当 前</a></dd>'
control += '<dd id="closeOther"><a href="javascript:void(0);">关 闭 其 他</a></dd>'
control += '<dd id="closeAll"><a href="javascript:void(0);">关 闭 全 部</a></dd>'
control += '</dl></li></ul></li></div>';
tab += title;
tab += control;
tab += content;
tab += '</div>';
tab += '';
return tab;
}
function rollPage(d, option) {
var $tabTitle = $('#' + option.elem + ' .layui-tab-title');
var left = $tabTitle.scrollLeft();
if ('left' === d) {
$tabTitle.animate({
scrollLeft: left - 450
}, 200);
} else {
$tabTitle.animate({
scrollLeft: left + 450
}, 200);
}
}
function closeEvent(option) {
$(".layui-tab[lay-filter='" + option.elem + "']").on("click", ".layui-tab-close", function() {
var layid = $(this).parent().attr("lay-id");
tabDelete(option.elem, layid, option.closeEvent, option);
})
}
function menuEvent(option,index) {
$("#" + option.elem + "closeThis").click(function() {
var currentTab = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title .layui-this");
if (currentTab.find("span").is(".able-close")) {
var currentId = currentTab.attr("lay-id");
tabDelete(option.elem, currentId, option.closeEvent, option);
} else {
layer.msg("当前页面不允许关闭", {
icon: 3,
time: 800
})
}
layer.close(index);
});
$("#" + option.elem + "closeOther").click(function() {
var currentId = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title .layui-this").attr("lay-id");
var tabtitle = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title li");
$.each(tabtitle, function(i) {
if ($(this).attr("lay-id") != currentId) {
if ($(this).find("span").is(".able-close")) {
tabDelete(option.elem, $(this).attr("lay-id"), option.closeEvent, option);
}
}
})
layer.close(index);
});
$("#" + option.elem + "closeAll").click(function() {
var currentId = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title .layui-this").attr("lay-id");
var tabtitle = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title li");
$.each(tabtitle, function(i) {
if ($(this).find("span").is(".able-close")) {
tabDelete(option.elem, $(this).attr("lay-id"), option.closeEvent, option);
}
});
layer.close(index);
});
}
function toolEvent(option) {
$("body .layui-tab[lay-filter='" + option.elem + "']").on("click", "#closeThis", function() {
var currentTab = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title .layui-this");
if (currentTab.find("span").is(".able-close")) {
var currentId = currentTab.attr("lay-id");
tabDelete(option.elem, currentId, option.closeEvent, option);
} else {
layer.msg("当前页面不允许关闭", {
icon: 3,
time: 800
})
}
})
$("body .layui-tab[lay-filter='" + option.elem + "']").on("click", "#closeOther", function() {
var currentId = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title .layui-this").attr("lay-id");
var tabtitle = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title li");
$.each(tabtitle, function(i) {
if ($(this).attr("lay-id") != currentId) {
if ($(this).find("span").is(".able-close")) {
tabDelete(option.elem, $(this).attr("lay-id"), option.closeEvent, option);
}
}
})
})
$("body .layui-tab[lay-filter='" + option.elem + "']").on("click", "#closeAll", function() {
var currentId = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title .layui-this").attr("lay-id");
var tabtitle = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title li");
$.each(tabtitle, function(i) {
if ($(this).find("span").is(".able-close")) {
tabDelete(option.elem, $(this).attr("lay-id"), option.closeEvent, option);
}
})
})
}
exports(MOD_NAME, new laytpTab());
});
+79
View File
@@ -0,0 +1,79 @@
/**
* 数据表格处理
* @version: 1.0
* @Author: JunStar
* @Date: 2021-9-8 23:56:21
* @Last Modified by: JunStar
* @Last Modified time: 2021-09-22 17:19:12
*/
layui.define([
],function (exports) {
const MOD_NAME = "laytpTable";
let $ = layui.$;
let laytpTable = {
/**
* 数据表格渲染完成调用的方法
* 主要工作,让layui-table-body的最大高度最多就是当前可见屏幕,超过了当前可见高度,就出现滚动条
* 增加参数reduceHeight的设置,是当底部有浮动的层时,需要把底部浮动层的高度也减去
* 弹窗展示数据表格时,底部可能需要加上操作按钮,reduceHeight的值设置上浮动层高度即可
* @param reduceHeight int 减少的高度,单位px
* @param tableId string 表格的ID
*/
done : function(reduceHeight, tableId){
if(!reduceHeight){
reduceHeight = 0;
}
// 获取屏幕可见高度
var windowHeight = $(window).height();
var maxHeight = parseInt(windowHeight) - (172 + reduceHeight);
// 设置.layui-table-body的最大高度和y轴滚动条自动出现
// 为了防止fixed="left" 固定层也出现滚动条,增加上.layui-table-main类的限制
if(!tableId){
$(".layui-table-body.layui-table-main").css("height", maxHeight + 'px');
$(".layui-table-body.layui-table-main").css("max-height", maxHeight + 'px');
$(".layui-table-body.layui-table-main").css("overflow-y", "auto");
}else{
$("div[lay-id='"+tableId+"'] .layui-table-body.layui-table-main").css("height", maxHeight + 'px');
$("div[lay-id='"+tableId+"'] .layui-table-body.layui-table-main").css("max-height", maxHeight + 'px');
$("div[lay-id='"+tableId+"'] .layui-table-body.layui-table-main").css("overflow-y", "auto");
}
},
/**
* 树形数据表格渲染完成调用的方法
* 主要工作,让layui-table-body的最大高度最多就是当前可见屏幕,超过了当前可见高度,就出现滚动条
* 增加参数reduceHeight的设置,是当底部有浮动的层时,需要把底部浮动层的高度也减去
* 弹窗展示数据表格时,底部可能需要加上操作按钮,reduceHeight的值设置上浮动层高度即可
* @param reduceHeight int 减少的高度,单位px
* @param tableId string 表格的ID
*/
treeDone : function(reduceHeight, tableId){
if(!reduceHeight){
reduceHeight = 0;
}
// 获取屏幕可见高度
var windowHeight = $(window).height();
var maxHeight = parseInt(windowHeight) - (130 + reduceHeight);
// 设置.layui-table-body的最大高度和y轴滚动条自动出现
// 为了防止fixed="left" 固定层也出现滚动条,增加上.layui-table-main类的限制
if(!tableId){
$(".layui-table-body.layui-table-main").css("height", maxHeight + 'px');
$(".layui-table-body.layui-table-main").css("max-height", maxHeight + 'px');
$(".layui-table-body.layui-table-main").css("overflow-y", "auto");
}else{
$("div[lay-id="+tableId+"] .layui-table-body.layui-table-main").css("height", maxHeight + 'px');
$("div[lay-id="+tableId+"] .layui-table-body.layui-table-main").css("max-height", maxHeight + 'px');
$("div[lay-id="+tableId+"] .layui-table-body.layui-table-main").css("overflow-y", "auto");
}
},
setLimit: function(key, limit){
facade.setLimit(key, limit);
}
};
//输出模块
exports(MOD_NAME, laytpTable);
});
+936
View File
@@ -0,0 +1,936 @@
/**
* 上传组件,基于layui.upload组件进行封装,html代码<div class="laytpUpload" data-id="id" data-name="name"></div>渲染成一个上传组件
* - 允许上传图片、音频、视频和任意文件
* - input输入框的展示访问上传文件的url地址
* - 图片、音频、视频的预览和删除
* @version: 1.0
* @Author: JunStar
* @Date: 2020-09-03 11:33:43
* @Last Modified by: JunStar
* @Last Modified time: 2020-09-03 11:33:48
*/
layui.define(["jquery", "element"], function (exports) {
const MOD_NAME = "laytpUpload";
var $ = layui.$;
var element = layui.element;
let storeAsOptions = [];
var optionsObj = {};
var laytpUpload = {
pathSplitStr: ", ",
idSplitStr: ", ",
uploadType: {
"image": "图片",
"video": "视频",
"audio": "音频",
"file": "文件"
},
// 展示上传按钮和选择附件的html内容
uploadHtml: function (options) {
var html =
"<div class=\"layui-upload\">" +
" <input type=\"hidden\" class=\"layui-input\" id=\"id_{{d.name}}\" value='{{d.uploadedId}}' lay-verify=\"{{d.layVerify}}\" lay-verType=\"{{d.layVerType}}\" readonly=\"readonly\" name=\"{{d.name}}\" />" +
" <input type=\"hidden\" class=\"layui-input\" id=\"input_{{d.name}}\" value='{{d.uploaded}}' lay-verify=\"{{d.layVerify}}\" lay-verType=\"{{d.layVerType}}\" readonly=\"readonly\" />" +
"{{# if(d.showUploadBtn){ }}" +
" <div class=\"layui-inline\">" +
" <a id='laytpUploadBtn_{{d.name}}' class=\"laytp-btn laytp-btn-primary laytp-btn-md pull-left\">" +
" <i class='layui-icon layui-icon-upload-drag'></i> 点击上传{{laytpUpload.uploadType[d.accept]}}" +
" </a>" +
" </div>" +
"{{# } }}" +
"{{# if(d.showChoiceBtn){ }}" +
" <div class=\"layui-inline\">" +
" <a id='laytpCheckFileBtn_{{d.name}}' data-name='{{d.name}}' class=\"laytp-btn laytp-btn-warming laytp-btn-md pull-left\">" +
" <i class='layui-icon layui-icon-file-b'></i> 选择附件" +
" </a>" +
" </div>" +
"{{# } }}" +
" {{# if(d.accept === 'image'){ }}" +
" {{# var widthText = ''; var heightText = ''; var sizeText = ''; }}" +
" {{# if(d.width === '0' || d.width === 'undefined'){ }}" +
" {{# widthText = '不限制'; }}" +
" {{# }else{ }}" +
" {{# widthText = d.width + 'px'; }}" +
" {{# } }}" +
" {{# if(d.height === '0' || d.height === 'undefined'){ }}" +
" {{# heightText = '不限制'; }}" +
" {{# }else{ }}" +
" {{# heightText = d.height + 'px'; }}" +
" {{# } }}" +
" {{# if(d.size === 'undefined' || d.size === ''){ }}" +
" {{# sizeText = '不限制'; }}" +
" {{# }else{ }}" +
" {{# sizeText = d.size; }}" +
" {{# } }}" +
" <div class=\"layui-inline\">" +
" <div class=\"layui-form-mid layui-word-aux\">" +
" 建议尺寸,宽:{{widthText}},高:{{heightText}};文件大小上限:{{sizeText}}" +
" </div>" +
" </div>" +
" {{# }else if(d.accept === 'video' || d.accept === 'audio' || d.accept === 'file'){ }}" +
" {{# var sizeText = ''; }}" +
" {{# if(d.size === 'undefined' || d.size === ''){ }}" +
" {{# sizeText = '不限制'; }}" +
" {{# }else{ }}" +
" {{# sizeText = d.size; }}" +
" {{# } }}" +
" <div class=\"layui-inline\">" +
" <div class=\"layui-form-mid layui-word-aux\">" +
" 文件大小上限:{{sizeText}}" +
" </div>" +
" </div>" +
" {{# } }}" +
" {{- d.previewHtml}}" +
"</div>";
return layui.laytpl(html).render(options);
},
// 经过服务器方式上传文件,选中文件后,展示上传的中间过程html
viaChooseProgress: function (options) {
var html =
"<div class=\"laytp-more\">" +
" <ul class=\"laytp-more-upload-list\" id=\"preview_{{d.name}}\">" +
" <li class=\"item_img\" data-index=\"{{d.index}}\">" +
" <div class=\"layui-progress layui-progress-big\" lay-filter=\"{{d.index}}\">" +
" <div class=\"layui-progress-bar\" lay-percent=\"0%\">" +
" <span class=\"layui-progress-text\">0%</span>" +
" </div>" +
" </div>" +
" </li>" +
" </ul>" +
"</div>";
return layui.laytpl(html).render(options);
},
// 不经过服务器方式上传文件,选中文件后,展示上传的中间过程html
unViaChooseProgress: function (options) {
var html =
"<div class=\"laytp-more\">" +
" <ul class=\"laytp-more-upload-list\" id=\"preview_{{d.name}}\">" +
" <li class=\"item_img\" data-path=\"{{d.path}}\">" +
" <div class=\"layui-progress layui-progress-big\" lay-filter=\"{{d.storeAsKey}}\">" +
" <div class=\"layui-progress-bar\" lay-percent=\"0%\">" +
" <span class=\"layui-progress-text\">0%</span>" +
" </div>" +
" </div>" +
" </li>" +
" </ul>" +
"</div>";
return layui.laytpl(html).render(options);
},
// 预览图片的html
imagePreviewHtml: function (options) {
var html =
"<div class=\"laytp-more\">" +
" <ul class=\"laytp-more-upload-list\" id=\"preview_{{d.name}}\">" +
" {{# var uploaded=d.uploaded; var uploadedId=d.uploadedId.toString(); }}" +
" {{# if(typeof uploaded !== 'undefined' && uploaded){ }}" +
" {{# var key,uploadedArr=uploaded.split(laytpUpload.pathSplitStr); }}" +
" {{# var uploadedIdArr=uploadedId.split(laytpUpload.idSplitStr); }}" +
" {{# for(key in uploadedArr){ }}" +
" <li class=\"item_img\">" +
" <div class=\"operate\">" +
" <i class=\"upload_img_close layui-icon\" data-fileUrl=\"{{uploadedArr[key]}}\" data-fileId=\"{{uploadedIdArr[key]}}\" data-id=\"{{d.name}}\" data-parentElem=\"{{d.parentElem}}\"></i>" +
" </div>" +
" <img src=\"{{uploadedArr[key]}}\" class=\"img\">" +
" </li>" +
" {{# } }}" +
" {{# } }}" +
" </ul>" +
"</div>";
return layui.laytpl(html).render(options);
},
// 预览视频的html
videoPreviewHtml: function (options) {
var html =
"<div class=\"laytp-more\">" +
" <ul class=\"laytp-more-upload-list\" id=\"preview_{{d.name}}\">" +
" {{# var uploaded=d.uploaded; var uploadedId=d.uploadedId.toString(); }}" +
" {{# if(typeof uploaded !== 'undefined' && uploaded){ var key,uploadedArr=uploaded.split(laytpUpload.pathSplitStr); }}" +
" {{# var uploadedIdArr=uploadedId.split(laytpUpload.idSplitStr); }}" +
" {{# for(key in uploadedArr){ }}" +
" <li class=\"item_video\">" +
" <div style=\"height:200px;display: grid;place-items: center\">" +
" <video src=\"{{uploadedArr[key]}}\" controls=\"controls\" width=\"200px\"></video>" +
" </div>" +
" <button type=\"button\" class=\"layui-btn layui-btn-sm layui-btn-danger upload_delete\" style=\"display: block; width: 100%;\" data-fileUrl=\"{{uploadedArr[key]}}\" data-fileId=\"{{uploadedIdArr[key]}}\" data-id=\"{{d.name}}\"><i class=\"layui-icon\">&#xe640;</i></button>" +
" </li>" +
" {{# } }}" +
" {{# } }}" +
" </ul>" +
"</div>";
return layui.laytpl(html).render(options);
},
// 预览音频的html
audioPreviewHtml: function (options) {
var html =
"<div class=\"laytp-more\">" +
" <ul class=\"laytp-more-upload-list\" id=\"preview_{{d.name}}\">" +
" {{# var uploaded=d.uploaded; var uploadedId=d.uploadedId.toString(); }}" +
" {{# if(typeof uploaded !== 'undefined' && uploaded){ var key,uploadedArr=uploaded.split(laytpUpload.pathSplitStr); }}" +
" {{# var uploadedIdArr=uploadedId.split(laytpUpload.idSplitStr); }}" +
" {{# for(key in uploadedArr){ }}" +
" <li class=\"item_audio\">" +
" <audio src=\"{{uploadedArr[key]}}\" controls=\"controls\" style=\"height:54px;\"></audio>" +
" <button type=\"button\" class=\"layui-btn layui-btn-sm layui-btn-danger upload_delete\" style=\"display: block; width: 100%;\" data-fileUrl=\"{{uploadedArr[key]}}\" data-fileId=\"{{uploadedIdArr[key]}}\" data-id=\"{{d.name}}\"><i class=\"layui-icon\">&#xe640;</i></button>" +
" </li>" +
" {{# } }}" +
" {{# } }}" +
" </ul>" +
"</div>";
return layui.laytpl(html).render(options);
},
// 预览文件的html
filePreviewHtml: function (options) {
var html =
"<div class=\"laytp-more\">" +
" <ul class=\"laytp-more-upload-list\" id=\"preview_{{d.name}}\">" +
" {{# var uploaded=d.uploaded; var uploadedFilename=d.uploadedFilename; var uploadedId=d.uploadedId.toString(); }}" +
" {{# if(typeof uploaded !== 'undefined' && uploaded){ }}" +
" {{# var key,uploadedArr=uploaded.split(laytpUpload.pathSplitStr); }}" +
" {{# var uploadedIdArr=uploadedId.split(laytpUpload.idSplitStr); var uploadedFilenameArr=uploadedFilename.split(laytpUpload.pathSplitStr); }}" +
" {{# for(key in uploadedArr){ }}" +
" <li class=\"item_file\">" +
" <div class=\"operate\">" +
" <i class=\"upload_file_close layui-icon\" data-fileUrl=\"{{uploadedArr[key]}}\" data-fileName=\"{{uploadedFilenameArr[key]}}\" data-fileId=\"{{uploadedIdArr[key]}}\" data-id=\"{{d.name}}\" data-parentElem=\"{{d.parentElem}}\"></i>" +
" </div>" +
" {{# var fa=laytpUpload.getFaByFilename(uploadedArr[key]); }}" +
" {{# if(fa == 'image'){ }}" +
" <img src=\"{{uploadedArr[key]}}\" class=\"img\">" +
" {{# }else{ }}" +
" <div class=\"file {{fa}} layerTips\" data-text=\"{{uploadedFilenameArr[key]}}\"></div>" +
" {{# } }}" +
" </li>" +
" {{# } }}" +
" {{# } }}" +
" </ul>" +
"</div>";
return layui.laytpl(html).render(options);
},
// 单个图片模板
singleImageHtml: function (options) {
var html =
'<li class="item_img">' +
' <div class="operate">' +
' <i class="upload_img_close layui-icon" data-fileUrl="{{d.data.path}}" data-fileId="{{d.data.id}}" data-id="{{d.name}}" data-parentElem=\"{{d.parentElem}}\"></i>' +
' </div>' +
' <img src="{{d.data.path}}" class="img" />' +
'</li>';
return layui.laytpl(html).render(options);
},
// 单个视频模板
singleVideoHtml: function (options) {
var html =
'<li class="item_video">' +
' <video src="{{d.data.path}}" controls="controls" width="200px" height="200px"></video>' +
' <button type=\"button\" class="layui-btn layui-btn-sm layui-btn-danger upload_delete" style="display: block; width: 100%;" data-fileUrl="{{d.data.path}}" data-fileId="{{d.data.id}}" data-id="{{d.name}}" data-parentElem=\"{{d.parentElem}}\"><i class="layui-icon">&#xe640;</i></button>' +
'</li>';
return layui.laytpl(html).render(options);
},
// 单个音频模板
singleAudioHtml: function (options) {
var html =
'<li class="item_audio">' +
' <audio src="{{d.data.path}}" controls="controls" style="height:54px;"></audio>' +
' <button type=\"button\" class="layui-btn layui-btn-sm layui-btn-danger upload_delete" style="display: block; width: 100%;" data-fileUrl="{{d.data.path}}" data-fileId="{{d.data.id}}" data-id="{{d.name}}" data-parentElem=\"{{d.parentElem}}\"><i class="layui-icon">&#xe640;</i></button>' +
'</li>';
return layui.laytpl(html).render(options);
},
// 单个文件模板
singleFileHtml: function (options) {
var html =
'<li class="item_file">' +
' <div class="operate">' +
' <i class="upload_file_close layui-icon" data-fileUrl="{{d.data.path}}" data-fileName="{{=d.data.name}}" data-fileId="{{d.data.id}}" data-id="{{d.name}}" data-parentElem=\"{{d.parentElem}}\"></i>' +
' </div>' +
' {{# var fa=laytpUpload.getFaByFilename(d.data.path); }}' +
' {{# if(fa == "image"){ }}' +
' <img src="{{d.data.path}}" class="img" />' +
' {{# }else{ }}' +
' <div class=\"file {{fa}} layerTips\" data-text="{{=d.data.name}}"></div>' +
' {{# } }}' +
'</li>';
return layui.laytpl(html).render(options);
},
// 通过文件名获取字体样式
getFaByFilename: function (filename) {
var fileExtention = facade.getFileExt(filename);
var imageExtArr = ['jpg', 'jpeg', 'gif', 'png'];
var pptExtArr = ['ppt', 'pptx'];
var excelExtArr = ['xls', 'xlsx'];
var wordExtArr = ['doc', 'docx'];
var videoExtArr = ['mp4'];
var audioExtArr = ['mp3'];
if (facade.inArray(fileExtention, imageExtArr)) {
return 'image';
} else if (facade.inArray(fileExtention, pptExtArr)) {
return 'fa fa-file-powerpoint-o';
} else if (facade.inArray(fileExtention, excelExtArr)) {
return 'fa fa-file-excel-o';
} else if (facade.inArray(fileExtention, wordExtArr)) {
return 'fa fa-file-word-o';
} else if (facade.inArray(fileExtention, videoExtArr)) {
return 'fa fa-film';
} else if (facade.inArray(fileExtention, audioExtArr)) {
return 'fa fa-file-audio-o';
} else {
return 'fa fa-file-o';
}
},
// 经过服务器方式上传
render: function (options) {
optionsObj[options.name] = options;
if (options.accept === "image") {
options.previewHtml = laytpUpload.imagePreviewHtml(options);
} else if (options.accept === "file") {
options.previewHtml = laytpUpload.filePreviewHtml(options);
} else if (options.accept === "video") {
options.previewHtml = laytpUpload.videoPreviewHtml(options);
} else if (options.accept === "audio") {
options.previewHtml = laytpUpload.audioPreviewHtml(options);
}
$(options.el).after(laytpUpload.uploadHtml(options));
// 渲染点击上传按钮
var ajaxHeaders = {};
ajaxHeaders[layui.context.get("tokenKey")] = facade.getCookie(layui.context.get("tokenCookieKey"));
layui.upload.render({
headers: ajaxHeaders,
elem: $("#laytpUploadBtn_" + options.name, options.parentElem),
url: options.route ? facade.url(options.route) : facade.url("/admin.common/upload"),
accept: options.accept,
multiple: options.multi,
data: options.params,
field: "laytpUploadFile",
auto: false, // 为了调试选中文件后,展示上传的中间过程的html,暂时先不自动上传
choose: function (obj) {
// 这个位置开始预览,展示上传的中间过程
obj.preview(function (index, file, result) {
options.index = index;
$("#preview_" + options.name, options.parentElem).append(laytpUpload.viaChooseProgress(options));
element.progress(index, '20%');
obj.upload(index, file);
});
},
done: function (res, index, upload) {
if (res.code === 10401) {
layui.popup.failure(res["msg"], function () {
facade.redirect("admin/login.html");
});
return;
}
if (res.code === 1) {
facade.error(res["msg"], "失败提示");
return;
}
options.data = res.data;
if (options.multi) {
//多个预览
$("li[data-index=" + index + "]", $("#preview_" + options.name, options.parentElem)).remove();
if (options.accept === "image") {
$("#preview_" + options.name, options.parentElem).append(laytpUpload.singleImageHtml(options));
} else if (options.accept === "video") {
$("#preview_" + options.name, options.parentElem).append(laytpUpload.singleVideoHtml(options));
} else if (options.accept === "audio") {
$("#preview_" + options.name, options.parentElem).append(laytpUpload.singleAudioHtml(options));
} else if (options.accept === "file") {
$("#preview_" + options.name, options.parentElem).append(laytpUpload.singleFileHtml(options));
}
//input框增加文件值
var inputValue = $("#input_" + options.name).val();
var idValue = $("#id_" + options.name).val();
if (inputValue) {
$("#id_" + options.name, options.parentElem).val(idValue + laytpUpload.idSplitStr + res.data.id);
$("#input_" + options.name, options.parentElem).val(inputValue + laytpUpload.pathSplitStr + res.data.path);
} else {
$("#id_" + options.name, options.parentElem).val(res.data.id);
$("#input_" + options.name, options.parentElem).val(res.data.path);
}
} else {
//单个预览
if (options.accept === "image") {
$("#preview_" + options.name, options.parentElem).html(laytpUpload.singleImageHtml(options));
} else if (options.accept === "video") {
$("#preview_" + options.name, options.parentElem).html(laytpUpload.singleVideoHtml(options));
} else if (options.accept === "audio") {
$("#preview_" + options.name, options.parentElem).html(laytpUpload.singleAudioHtml(options));
} else if (options.accept === "file") {
$("#preview_" + options.name, options.parentElem).html(laytpUpload.singleFileHtml(options));
}
//input框增加文件值
$("#id_" + options.name, options.parentElem).val(res.data.id);
$("#input_" + options.name, options.parentElem).val(res.data.path);
}
return facade.success(res.msg);
}
});
// 渲染选择附件按钮
laytpUpload.renderChoiceFile(options);
// 删除已经上传的东西
$("body").off("click", ".upload_img_close, .upload_delete, .upload_file_close").on("click", ".upload_img_close, .upload_delete, .upload_file_close", function () {
var id = $(this).data("id");
var parentElem = $(this).data('parentelem');
var idObj = (parentElem !== "undefined") ? $("#id_" + id, parentElem) : $("#id_" + id);
var inputObj = (parentElem !== "undefined") ? $("#input_" + id, parentElem) : $("#input_" + id);
if (optionsObj[id].multi) {
var fileUrl = $(this).data("fileurl");
var fileId = $(this).data("fileid");
var idValue = idObj.val();
var inputValue = inputObj.val();
var newIdValue = "";
var newInputValue = "";
if (inputValue.indexOf(fileUrl + laytpUpload.pathSplitStr) !== -1) {
var reg = new RegExp(fileUrl + laytpUpload.pathSplitStr);
newInputValue = inputValue.replace(reg, "");
var idReg = new RegExp(fileId + laytpUpload.idSplitStr);
newIdValue = idValue.replace(idReg, "");
} else {
if (inputValue.indexOf(laytpUpload.pathSplitStr + fileUrl) !== -1) {
var reg = new RegExp(laytpUpload.pathSplitStr + fileUrl);
newInputValue = inputValue.replace(reg, "");
var idReg = new RegExp(laytpUpload.idSplitStr + fileId);
newIdValue = idValue.replace(idReg, "");
} else {
var reg = new RegExp(fileUrl);
newInputValue = inputValue.replace(reg, "");
var idReg = new RegExp(fileId);
newIdValue = idValue.replace(idReg, "");
}
}
inputObj.val(newInputValue);
idObj.val(newIdValue);
} else {
inputObj.val("");
idObj.val("");
}
$(this).closest("li").remove();
});
},
// 获取sts临时凭证,客户端上传到oss
renderStsOss: function (options) {
optionsObj[options.name] = options;
if (options.accept === "image") {
options.previewHtml = laytpUpload.imagePreviewHtml(options);
} else if (options.accept === "file") {
options.previewHtml = laytpUpload.filePreviewHtml(options);
} else if (options.accept === "video") {
options.previewHtml = laytpUpload.videoPreviewHtml(options);
} else if (options.accept === "audio") {
options.previewHtml = laytpUpload.audioPreviewHtml(options);
}
$(options.el).after(laytpUpload.uploadHtml(options));
var uploadInst = layui.upload.render({
elem: $("#laytpUploadBtn_" + options.name, options.parentElem),
url: options.route ? facade.url(options.route) : facade.url("/admin.common/upload"),
accept: options.accept,
multiple: options.multi,
data: options.params,
auto: false,
field: "laytpUploadFile",
choose: function (obj) {
//choose的回调,在第二次选择相同文件时,只会触发第一次
//加上如下语句,就会每次都触发,不管选择是不是相同的文件
uploadInst.config.elem.next()[0].value = '';
obj.preview(function (index, file, base64) {
facade.ajax({
route: "/admin.common/aliSts",
data: {name: file.name, size: file.size, ext: facade.getFileExt(file.name), index: index},
successAlert: false
}).done(function (res) {
if (res.code === 0) {
var storeAs = res.data.path;//设置上传的文件名
var storeAsKey = storeAs.replace('/', '-').substr(0, storeAs.lastIndexOf('.'));
if (!(storeAsKey in storeAsOptions)) {
storeAsOptions[storeAsKey] = {};
storeAsOptions[storeAsKey].index = res.data.index;
storeAsOptions[storeAsKey].storeAsKey = storeAsKey;
storeAsOptions[storeAsKey].status = 'uploading';
storeAsOptions[storeAsKey].path = res.data.path;
storeAsOptions[storeAsKey].name = options.name;
storeAsOptions[storeAsKey].parentElem = options.parentElem;
storeAsOptions[storeAsKey].accept = options.accept;
storeAsOptions[storeAsKey].type = options.type;
storeAsOptions[storeAsKey].via_server = options.viaServer;
storeAsOptions[storeAsKey].multi = options.multi;
storeAsOptions[storeAsKey].filename = file.name;
storeAsOptions[storeAsKey].size = file.size;
storeAsOptions[storeAsKey].category_id = options.category_id;
storeAsOptions[storeAsKey].ext = facade.getFileExt(file.name);
storeAsOptions[storeAsKey].data = {};
}
// options.path = storeAsKey;
$("#preview_" + storeAsOptions[storeAsKey].name, storeAsOptions[storeAsKey].parentElem).append(laytpUpload.unViaChooseProgress(storeAsOptions[storeAsKey]));
element.progress(index, '0%');
$.ajax({
url: "https://gosspublic.alicdn.com/aliyun-oss-sdk-6.3.1.min.js",
dataType: "script",
cache: true
}).done(function () {
var client = new OSS({
accessKeyId: res.data.sts.AccessKeyId,
accessKeySecret: res.data.sts.AccessKeySecret,
stsToken: res.data.sts.SecurityToken,
region: res.data.sts.endpoint,
bucket: res.data.sts.bucket
});
client.multipartUpload(storeAs, file, {
progress: function (p) {
var storeAsKey = storeAs.replace('/', '-').substr(0, storeAs.lastIndexOf('.'));
element.progress(storeAsKey, (p * 100).toFixed(2) + '%');
if (p === 1) {
facade.ajax({
route: "/admin.files/unViaSave",
data: {
name: storeAsOptions[storeAsKey].filename
, category_id: storeAsOptions[storeAsKey].category_id
, file_type: storeAsOptions[storeAsKey].accept
, upload_type: storeAsOptions[storeAsKey].type
, ext: storeAsOptions[storeAsKey].ext
, path: storeAs
, size: storeAsOptions[storeAsKey].size
, via_server: storeAsOptions[storeAsKey].via_server
},
successAlert: false
}).done(function (resFile) {
storeAsOptions[storeAsKey].data.path = res.data.sts.domain + '/' + storeAs;
storeAsOptions[storeAsKey].data.id = resFile.data.id;
storeAsOptions[storeAsKey].data.name = file.name;
storeAsOptions[storeAsKey].status = "uploaded";
if (options.uploadedCallback) {
options.uploadedCallback(storeAsOptions[storeAsKey]);
}
if (laytpUpload.hasUploadingStoreAsOptions()) {
return facade.success('上传成功,页面上所有文件上传成功后,才可预览');
} else {
facade.success('所有文件上传成功,正在渲染预览');
for (let k in storeAsOptions) {
var item = storeAsOptions[k];
if (item.multi) {
$("li[data-path=" + k + "]", $("#preview_" + item.name, item.parentElem)).remove();
//多个预览
if (item.accept === "image") {
$("#preview_" + item.name, item.parentElem).append(laytpUpload.singleImageHtml(item));
} else if (item.accept === "video") {
$("#preview_" + item.name, item.parentElem).append(laytpUpload.singleVideoHtml(item));
} else if (item.accept === "audio") {
$("#preview_" + item.name, item.parentElem).append(laytpUpload.singleAudioHtml(item));
} else if (item.accept === "file") {
$("#preview_" + item.name, item.parentElem).append(laytpUpload.singleFileHtml(item));
}
//input框增加文件值
var inputValue = $("#input_" + item.name).val();
var idValue = $("#id_" + item.name).val();
if (inputValue) {
$("#id_" + item.name, item.parentElem).val(idValue + laytpUpload.idSplitStr + item.data.id);
$("#input_" + item.name, item.parentElem).val(inputValue + laytpUpload.pathSplitStr + item.data.path);
} else {
$("#id_" + item.name, item.parentElem).val(item.data.id);
$("#input_" + item.name, item.parentElem).val(item.data.path);
}
} else {
//单个预览
if (item.accept === "image") {
$("#preview_" + item.name, item.parentElem).html(laytpUpload.singleImageHtml(item));
} else if (item.accept === "video") {
$("#preview_" + item.name, item.parentElem).html(laytpUpload.singleVideoHtml(item));
} else if (item.accept === "audio") {
$("#preview_" + item.name, item.parentElem).html(laytpUpload.singleAudioHtml(item));
} else if (item.accept === "file") {
$("#preview_" + item.name, item.parentElem).html(laytpUpload.singleFileHtml(item));
}
//input框增加文件值
$("#id_" + item.name, item.parentElem).val(item.data.id);
$("#input_" + item.name, item.parentElem).val(item.data.path);
}
}
// 预览都执行完毕之后,就把storeAsOptions数组清空
storeAsOptions = [];
}
});
}
}
});
});
}
});
});
}
});
// 渲染选择附件按钮
laytpUpload.renderChoiceFile(options);
// 删除已经上传的东西
$("body").off("click", ".upload_img_close, .upload_delete, .upload_file_close").on("click", ".upload_img_close, .upload_delete, .upload_file_close", function () {
var id = $(this).data("id");
var parentElem = $(this).data('parentelem');
var idObj = (parentElem !== "undefined") ? $("#id_" + id, parentElem) : $("#id_" + id);
var inputObj = (parentElem !== "undefined") ? $("#input_" + id, parentElem) : $("#input_" + id);
if (optionsObj[id].multi) {
var fileUrl = $(this).data("fileurl");
var fileId = $(this).data("fileid");
var idValue = idObj.val();
var inputValue = inputObj.val();
var newIdValue = "";
var newInputValue = "";
if (inputValue.indexOf(fileUrl + laytpUpload.pathSplitStr) !== -1) {
var reg = new RegExp(fileUrl + laytpUpload.pathSplitStr);
newInputValue = inputValue.replace(reg, "");
var idReg = new RegExp(fileId + laytpUpload.idSplitStr);
newIdValue = idValue.replace(idReg, "");
} else {
if (inputValue.indexOf(laytpUpload.pathSplitStr + fileUrl) !== -1) {
var reg = new RegExp(laytpUpload.pathSplitStr + fileUrl);
newInputValue = inputValue.replace(reg, "");
var idReg = new RegExp(laytpUpload.idSplitStr + fileId);
newIdValue = idValue.replace(idReg, "");
} else {
var reg = new RegExp(fileUrl);
newInputValue = inputValue.replace(reg, "");
var idReg = new RegExp(fileId);
newIdValue = idValue.replace(idReg, "");
}
}
inputObj.val(newInputValue);
idObj.val(newIdValue);
} else {
inputObj.val("");
idObj.val("");
}
$(this).closest("li").remove();
});
},
// 获取token,客户端上传到kodo
renderTokenKodo: function (options) {
optionsObj[options.name] = options;
if (options.accept === "image") {
options.previewHtml = laytpUpload.imagePreviewHtml(options);
} else if (options.accept === "file") {
options.previewHtml = laytpUpload.filePreviewHtml(options);
} else if (options.accept === "video") {
options.previewHtml = laytpUpload.videoPreviewHtml(options);
} else if (options.accept === "audio") {
options.previewHtml = laytpUpload.audioPreviewHtml(options);
}
$(options.el).after(laytpUpload.uploadHtml(options));
var uploadInst = layui.upload.render({
elem: $("#laytpUploadBtn_" + options.name, options.parentElem),
url: options.route ? facade.url(options.route) : facade.url("/admin.common/upload"),
accept: options.accept,
multiple: options.multi,
data: options.params,
auto: false,
field: "laytpUploadFile",
choose: function (obj) {
//choose的回调,在第二次选择相同文件时,只会触发第一次
//加上如下语句,就会每次都触发,不管选择是不是相同的文件
uploadInst.config.elem.next()[0].value = '';
obj.preview(function (index, file, base64) {
facade.ajax({
route: facade.url("/admin.common/kodoToken"),
data: {name: file.name, size: file.size, ext: facade.getFileExt(file.name), index: index},
successAlert: false
}).done(function (res) {
if (res.code === 0) {
var storeAs = res.data.path;//设置上传的文件名
var storeAsKey = storeAs.replace('/', '-').substr(0, storeAs.lastIndexOf('.'));
if (!(storeAsKey in storeAsOptions)) {
storeAsOptions[storeAsKey] = {};
storeAsOptions[storeAsKey].index = res.data.index;
storeAsOptions[storeAsKey].status = 'uploading';
storeAsOptions[storeAsKey].path = storeAsKey;
storeAsOptions[storeAsKey].name = options.name;
storeAsOptions[storeAsKey].parentElem = options.parentElem;
storeAsOptions[storeAsKey].accept = options.accept;
storeAsOptions[storeAsKey].type = options.type;
storeAsOptions[storeAsKey].via_server = options.viaServer;
storeAsOptions[storeAsKey].multi = options.multi;
storeAsOptions[storeAsKey].filename = file.name;
storeAsOptions[storeAsKey].size = file.size;
storeAsOptions[storeAsKey].category_id = options.category_id;
storeAsOptions[storeAsKey].ext = facade.getFileExt(file.name);
storeAsOptions[storeAsKey].data = {};
}
options.path = storeAsKey;
$("#preview_" + storeAsOptions[storeAsKey].name, storeAsOptions[storeAsKey].parentElem).append(laytpUpload.unViaChooseProgress(storeAsOptions[storeAsKey]));
element.progress(index, '0%');
$.ajax({
url: "https://cdnjs.cloudflare.com/ajax/libs/qiniu-js/3.1.4/qiniu.min.js",
dataType: "script",
cache: true
}).done(function () {
const observable = qiniu.upload(file, storeAs, res.data.token, {fname: file.name,}, {});
const subscription = observable.subscribe({
next: function (res) {
var p = res.total.percent.toFixed(2);
var storeAsKey = storeAs.replace('/', '-').substr(0, storeAs.lastIndexOf('.'));
element.progress(storeAsKey, p + '%');
},
error(err){
// ...
},
complete(completeRes){
var storeAsKey = completeRes.key.replace('/', '-').substr(0, storeAs.lastIndexOf('.'));
facade.ajax({
route: "/admin.files/unViaSave",
data: {
name: storeAsOptions[storeAsKey].filename
, category_id: storeAsOptions[storeAsKey].category_id
, file_type: storeAsOptions[storeAsKey].accept
, upload_type: storeAsOptions[storeAsKey].type
, ext: storeAsOptions[storeAsKey].ext
, path: completeRes.key
, size: completeRes.size
, via_server: storeAsOptions[storeAsKey].via_server
},
successAlert: false
}).done(function (resFile) {
storeAsOptions[storeAsKey].data.path = res.data.domain + '/' + completeRes.key;
storeAsOptions[storeAsKey].data.id = resFile.data.id;
storeAsOptions[storeAsKey].data.name = storeAsOptions[storeAsKey].filename;
storeAsOptions[storeAsKey].status = "uploaded";
if (options.uploadedCallback) {
options.uploadedCallback(storeAsOptions[storeAsKey]);
}
if (laytpUpload.hasUploadingStoreAsOptions()) {
return facade.success('上传成功,页面上所有文件上传成功后,才可预览');
} else {
facade.success('所有文件上传成功,正在渲染预览');
for (let k in storeAsOptions) {
var item = storeAsOptions[k];
if (item.multi) {
$("li[data-path=" + k + "]", $("#preview_" + item.name, item.parentElem)).remove();
//多个预览
if (item.accept === "image") {
$("#preview_" + item.name, item.parentElem).append(laytpUpload.singleImageHtml(item));
} else if (item.accept === "video") {
$("#preview_" + item.name, item.parentElem).append(laytpUpload.singleVideoHtml(item));
} else if (item.accept === "audio") {
$("#preview_" + item.name, item.parentElem).append(laytpUpload.singleAudioHtml(item));
} else if (item.accept === "file") {
$("#preview_" + item.name, item.parentElem).append(laytpUpload.singleFileHtml(item));
}
//input框增加文件值
var inputValue = $("#input_" + item.name).val();
var idValue = $("#id_" + item.name).val();
if (inputValue) {
$("#id_" + item.name, item.parentElem).val(idValue + laytpUpload.idSplitStr + item.data.id);
$("#input_" + item.name, item.parentElem).val(inputValue + laytpUpload.pathSplitStr + item.data.path);
} else {
$("#id_" + item.name, item.parentElem).val(item.data.id);
$("#input_" + item.name, item.parentElem).val(item.data.path);
}
} else {
//单个预览
if (item.accept === "image") {
$("#preview_" + item.name, item.parentElem).html(laytpUpload.singleImageHtml(item));
} else if (item.accept === "video") {
$("#preview_" + item.name, item.parentElem).html(laytpUpload.singleVideoHtml(item));
} else if (item.accept === "audio") {
$("#preview_" + item.name, item.parentElem).html(laytpUpload.singleAudioHtml(item));
} else if (item.accept === "file") {
$("#preview_" + item.name, item.parentElem).html(laytpUpload.singleFileHtml(item));
}
//input框增加文件值
$("#id_" + item.name, item.parentElem).val(item.data.id);
$("#input_" + item.name, item.parentElem).val(item.data.path);
}
}
// 预览都执行完毕之后,就把storeAsOptions数组清空
storeAsOptions = [];
}
});
}
});
});
}
});
});
}
});
// 渲染选择附件按钮
laytpUpload.renderChoiceFile(options);
// 删除已经上传的东西
$("body").off("click", ".upload_img_close, .upload_delete, .upload_file_close").on("click", ".upload_img_close, .upload_delete, .upload_file_close", function () {
var id = $(this).data("id");
var parentElem = $(this).data('parentelem');
var idObj = (parentElem !== "undefined") ? $("#id_" + id, parentElem) : $("#id_" + id);
var inputObj = (parentElem !== "undefined") ? $("#input_" + id, parentElem) : $("#input_" + id);
if (optionsObj[id].multi) {
var fileUrl = $(this).data("fileurl");
var fileId = $(this).data("fileid");
var idValue = idObj.val();
var inputValue = inputObj.val();
var newIdValue = "";
var newInputValue = "";
if (inputValue.indexOf(fileUrl + laytpUpload.pathSplitStr) !== -1) {
var reg = new RegExp(fileUrl + laytpUpload.pathSplitStr);
newInputValue = inputValue.replace(reg, "");
var idReg = new RegExp(fileId + laytpUpload.idSplitStr);
newIdValue = idValue.replace(idReg, "");
} else {
if (inputValue.indexOf(laytpUpload.pathSplitStr + fileUrl) !== -1) {
var reg = new RegExp(laytpUpload.pathSplitStr + fileUrl);
newInputValue = inputValue.replace(reg, "");
var idReg = new RegExp(laytpUpload.idSplitStr + fileId);
newIdValue = idValue.replace(idReg, "");
} else {
var reg = new RegExp(fileUrl);
newInputValue = inputValue.replace(reg, "");
var idReg = new RegExp(fileId);
newIdValue = idValue.replace(idReg, "");
}
}
inputObj.val(newInputValue);
idObj.val(newIdValue);
} else {
inputObj.val("");
idObj.val("");
}
$(this).closest("li").remove();
});
},
hasUploadingStoreAsOptions: function () {
for (let k in storeAsOptions) {
if (storeAsOptions[k].status === "uploading") {
return true;
}
}
return false;
},
// 选择附件按钮渲染
renderChoiceFile: function(options){
$("body").off("click", "#laytpCheckFileBtn_" + options.name).on("click", "#laytpCheckFileBtn_" + options.name, function () {
var checkedIds = $("#id_"+options.name).val();
facade.popupDiv({
title : "选择附件",
path : facade.compatibleHtmlPath("/admin/files/choice.html?checked_ids="+checkedIds+"&name=" + options.name + "&multi=" + options.multi + "&file_type=" + options.accept + "&category_id=" + options.fileCategoryId),
width : '95%',
height : '100%'
});
});
},
// 弹窗选择文件,选择完后,关闭弹窗执行此函数进行界面预览
choiceAfter: function(name, multi, accept, checkedItems){
console.log(name, multi, accept, checkedItems);
$("#id_" + name, window.parent.document).val('');
$("#input_" + name, window.parent.document).val('');
$("li", $("#preview_" + name, window.parent.document)).remove();
for(let k in checkedItems){
var checkedItem = {};
checkedItem.path = checkedItems[k].path;
checkedItem.id = checkedItems[k].id;
checkedItem.name = name;
checkedItem.data = {
id : checkedItems[k].id,
path : checkedItem.path,
name : checkedItems[k].name,
};
if (multi) {
//多个预览
if (accept === "image") {
$("#preview_" + name, window.parent.document).append(laytpUpload.singleImageHtml(checkedItem));
} else if (accept === "video") {
$("#preview_" + name, window.parent.document).append(laytpUpload.singleVideoHtml(checkedItem));
} else if (accept === "audio") {
$("#preview_" + name, window.parent.document).append(laytpUpload.singleAudioHtml(checkedItem));
} else if (accept === "file") {
$("#preview_" + name, window.parent.document).append(laytpUpload.singleFileHtml(checkedItem));
}
//input框增加文件值
var inputValue = $("#input_" + name, window.parent.document).val();
var idValue = $("#id_" + name, window.parent.document).val();
if (inputValue) {
$("#id_" + name, window.parent.document).val(idValue + laytpUpload.idSplitStr + checkedItem.id);
$("#input_" + name, window.parent.document).val(inputValue + laytpUpload.pathSplitStr + checkedItem.path);
} else {
$("#id_" + name, window.parent.document).val(checkedItem.id);
$("#input_" + name, window.parent.document).val(checkedItem.path);
}
} else {
//单个预览
if (accept === "image") {
$("#preview_" + name, window.parent.document).html(laytpUpload.singleImageHtml(checkedItem));
} else if (accept === "video") {
$("#preview_" + name, window.parent.document).html(laytpUpload.singleVideoHtml(checkedItem));
} else if (accept === "audio") {
$("#preview_" + name, window.parent.document).html(laytpUpload.singleAudioHtml(checkedItem));
} else if (accept === "file") {
$("#preview_" + name, window.parent.document).html(laytpUpload.singleFileHtml(checkedItem));
}
//input框增加文件值
$("#id_" + name, window.parent.document).val(checkedItem.id);
$("#input_" + name, window.parent.document).val(checkedItem.path);
}
}
// 删除已经上传的东西
parent.$("body").off("click", ".upload_img_close, .upload_delete, .upload_file_close").on("click", ".upload_img_close, .upload_delete, .upload_file_close", function () {
var idObj = $("input",$(this).parent().parent().parent().parent().parent()).first();
var inputObj = $("input",$(this).parent().parent().parent().parent().parent()).eq(1);
if (multi) {
var fileUrl = $(this).data("fileurl");
var fileId = $(this).data("fileid");
var idValue = idObj.val();
var inputValue = inputObj.val();
var newIdValue = "";
var newInputValue = "";
if (inputValue.indexOf(fileUrl + laytpUpload.pathSplitStr) !== -1) {
var reg = new RegExp(fileUrl + laytpUpload.pathSplitStr);
newInputValue = inputValue.replace(reg, "");
var idReg = new RegExp(fileId + laytpUpload.idSplitStr);
newIdValue = idValue.replace(idReg, "");
} else {
if (inputValue.indexOf(laytpUpload.pathSplitStr + fileUrl) !== -1) {
var reg = new RegExp(laytpUpload.pathSplitStr + fileUrl);
newInputValue = inputValue.replace(reg, "");
var idReg = new RegExp(laytpUpload.idSplitStr + fileId);
newIdValue = idValue.replace(idReg, "");
} else {
var reg = new RegExp(fileUrl);
newInputValue = inputValue.replace(reg, "");
var idReg = new RegExp(fileId);
newIdValue = idValue.replace(idReg, "");
}
}
inputObj.val(newInputValue);
idObj.val(newIdValue);
} else {
inputObj.val("");
idObj.val("");
}
$(this).closest("li").remove();
});
},
};
// 输出模块
exports(MOD_NAME, laytpUpload);
// 注入layui组件中,供全局调用
layui.laytpUpload = laytpUpload;
// 注入window全局对象中,供全局调用
window.laytpUpload = laytpUpload;
});
File diff suppressed because one or more lines are too long
+140
View File
@@ -0,0 +1,140 @@
layui.define(['table', 'jquery', 'element'], function (exports) {
"use strict";
var MOD_NAME = 'message',
$ = layui.jquery,
element = layui.element;
var message = function (opt) {
this.option = opt;
};
message.prototype.render = function (opt) {
//默认配置值
var option = {
elem: opt.elem,
url: opt.url ? opt.url : false,
height: opt.height,
data: opt.data
}
if (option.url != false) {
option.data = getData(option.url);
var notice = createHtml(option);
$(option.elem).html(notice);
var targetNode = document.querySelector(option.elem + ' .laytp-notice')
var mutationObserver = new MutationObserver(function (mutationsList, observer) {
if (getComputedStyle(targetNode).display !== 'none') {
var rect = targetNode.getBoundingClientRect();
//是否超出右侧屏幕
if (rect.right > $(window).width()) {
var elemRight = document.querySelector(option.elem).getBoundingClientRect().right;
var offsetRight = 20;
targetNode.style.right = elemRight - $(window).width() + offsetRight + 'px';
targetNode.style.left = 'unset';
}
}
});
mutationObserver.observe(targetNode, {
attributes: true,
childList: false,
subtree: false,
attributeOldValue: false,
attributeFilter: ['class']
});
}
setTimeout(function () {
element.init();
$(opt.elem + " li").click(function (e) {
$(this).siblings().removeClass('laytp-this');
$(this).addClass('laytp-this');
})
}, 300);
return new message(option);
}
message.prototype.click = function (callback) {
$("*[notice-id]").click(function (event) {
event.preventDefault();
var id = $(this).attr("notice-id");
var title = $(this).attr("notice-title");
var context = $(this).attr("notice-context");
var form = $(this).attr("notice-form");
callback(id, title, context, form);
})
}
/** 刷 新 消 息 */
message.prototype.reload = function () {
}
/** 同 步 请 求 获 取 数 据 */
function getData(url) {
$.ajaxSettings.async = false;
var data = null;
$.get(url, function (result) {
data = result;
});
$.ajaxSettings.async = true;
return data;
}
function createHtml(option) {
var count = 0;
var noticeTitle = '<ul class="layui-tab-title">';
var noticeContent = '<div class="layui-tab-content" style="height:' + option.height + ';overflow-x: hidden;padding:0px;">';
// 根据 data 便利数据
$.each(option.data, function (i, item) {
if (i === 0) {
noticeTitle += '<li class="laytp-this">' + item.title + '</li>';
noticeContent += '<div class="layui-tab-item layui-show">';
} else {
noticeTitle += '<li>' + item.title + '</li>';
noticeContent += '<div class="layui-tab-item">';
}
$.each(item.children, function (i, note) {
count++;
noticeContent += '<div class="laytp-notice-item" notice-form="' + note.form + '" notice-context="' + note.context +
'" notice-title="' + note.title + '" notice-id="' + note.id + '">' ;
if (note.avatar)
noticeContent +='<img src="' + note.avatar + '"/>';
noticeContent +='<div style="display:inline-block;">' + note.title + '</div>' +
'<div class="laytp-notice-end">' + note.time + '</div>' +
'</div>';
})
// 空内容
if(item.children.length==0){
noticeContent +='<div class="laytp-empty"><div class="laytp-empty-image"><svg class="laytp-empty-img-default" width="184" height="152" viewBox="0 0 184 152"><g fill="none" fill-rule="evenodd"><g transform="translate(24 31.67)"><ellipse class="laytp-empty-img-default-ellipse" cx="67.797" cy="106.89" rx="67.797" ry="12.668"></ellipse><path class="laytp-empty-img-default-path-1" d="M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z"></path><path class="laytp-empty-img-default-path-2" d="M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z" transform="translate(13.56)"></path><path class="laytp-empty-img-default-path-3" d="M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z"></path><path class="laytp-empty-img-default-path-4" d="M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z"></path></g><path class="laytp-empty-img-default-path-5" d="M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z"></path><g class="laytp-empty-img-default-g" transform="translate(149.65 15.383)"><ellipse cx="20.654" cy="3.167" rx="2.849" ry="2.815"></ellipse><path d="M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"></path></g></g></svg></div><p class="laytp-empty-description">暂无数据</p></div>';
}
noticeContent += '</div>';
})
var notice;
if (count > 0){
notice = '<li class="layui-nav-item" lay-unselect="">' +
'<a href="#" class="notice layui-icon layui-icon-notice"><span class="layui-badge-dot"></span></a>' +
'<div class="layui-nav-child layui-tab laytp-notice" style="margin-top: 0px;left: -200px;padding:0px;">';
}else {
notice = '<li class="layui-nav-item" lay-unselect="">' +
'<a href="#" class="notice layui-icon layui-icon-notice"></a>' +
'<div class="layui-nav-child layui-tab laytp-notice" style="margin-top: 0px;left: -200px;padding:0px;">';
}
noticeTitle += '</ul>';
noticeContent += '</div>';
notice += noticeTitle;
notice += noticeContent;
notice += '</div></li>';
return notice;
}
exports(MOD_NAME, new message());
})
File diff suppressed because one or more lines are too long
+503
View File
@@ -0,0 +1,503 @@
/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
* @license MIT */
;(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(factory);
} else if (typeof exports === 'object') {
module.exports = factory();
} else {
root.NProgress = factory();
}
})(this, function() {
var NProgress = {};
NProgress.version = '0.2.0';
var Settings = NProgress.settings = {
minimum: 0.08,
easing: 'linear',
positionUsing: '',
speed: 200,
trickle: true,
trickleSpeed: 200,
showSpinner: true,
barSelector: '[role="bar"]',
spinnerSelector: '[role="spinner"]',
parent: 'body',
template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
};
/**
* Updates configuration.
*
* NProgress.configure({
* minimum: 0.1
* });
*/
NProgress.configure = function(options) {
var key, value;
for (key in options) {
value = options[key];
if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value;
}
return this;
};
/**
* Last number.
*/
NProgress.status = null;
/**
* Sets the progress bar status, where `n` is a number from `0.0` to `1.0`.
*
* NProgress.set(0.4);
* NProgress.set(1.0);
*/
NProgress.set = function(n) {
var started = NProgress.isStarted();
n = clamp(n, Settings.minimum, 1);
NProgress.status = (n === 1 ? null : n);
var progress = NProgress.render(!started),
bar = progress.querySelector(Settings.barSelector),
speed = Settings.speed,
ease = Settings.easing;
progress.offsetWidth; /* Repaint */
queue(function(next) {
// Set positionUsing if it hasn't already been set
if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS();
// Add transition
css(bar, barPositionCSS(n, speed, ease));
if (n === 1) {
// Fade out
css(progress, {
transition: 'none',
opacity: 1
});
progress.offsetWidth; /* Repaint */
setTimeout(function() {
css(progress, {
transition: 'all ' + speed + 'ms linear',
opacity: 0
});
setTimeout(function() {
NProgress.remove();
next();
}, speed);
}, speed);
} else {
setTimeout(next, speed);
}
});
return this;
};
NProgress.isStarted = function() {
return typeof NProgress.status === 'number';
};
/**
* Shows the progress bar.
* This is the same as setting the status to 0%, except that it doesn't go backwards.
*
* NProgress.start();
*
*/
NProgress.start = function() {
if (!NProgress.status) NProgress.set(0);
var work = function() {
setTimeout(function() {
if (!NProgress.status) return;
NProgress.trickle();
work();
}, Settings.trickleSpeed);
};
if (Settings.trickle) work();
return this;
};
/**
* Hides the progress bar.
* This is the *sort of* the same as setting the status to 100%, with the
* difference being `done()` makes some placebo effect of some realistic motion.
*
* NProgress.done();
*
* If `true` is passed, it will show the progress bar even if its hidden.
*
* NProgress.done(true);
*/
NProgress.done = function(force) {
if (!force && !NProgress.status) return this;
return NProgress.inc(0.3 + 0.5 * Math.random()).set(1);
};
/**
* Increments by a random amount.
*/
NProgress.inc = function(amount) {
var n = NProgress.status;
if (!n) {
return NProgress.start();
} else if(n > 1) {
return;
} else {
if (typeof amount !== 'number') {
if (n >= 0 && n < 0.2) { amount = 0.1; }
else if (n >= 0.2 && n < 0.5) { amount = 0.04; }
else if (n >= 0.5 && n < 0.8) { amount = 0.02; }
else if (n >= 0.8 && n < 0.99) { amount = 0.005; }
else { amount = 0; }
}
n = clamp(n + amount, 0, 0.994);
return NProgress.set(n);
}
};
NProgress.trickle = function() {
return NProgress.inc();
};
/**
* Waits for all supplied jQuery promises and
* increases the progress as the promises resolve.
*
* @param $promise jQUery Promise
*/
(function() {
var initial = 0, current = 0;
NProgress.promise = function($promise) {
if (!$promise || $promise.state() === "resolved") {
return this;
}
if (current === 0) {
NProgress.start();
}
initial++;
current++;
$promise.always(function() {
current--;
if (current === 0) {
initial = 0;
NProgress.done();
} else {
NProgress.set((initial - current) / initial);
}
});
return this;
};
})();
/**
* (Internal) renders the progress bar markup based on the `template`
* setting.
*/
NProgress.render = function(fromStart) {
if (NProgress.isRendered()) return document.getElementById('nprogress');
addClass(document.documentElement, 'nprogress-busy');
var progress = document.createElement('div');
progress.id = 'nprogress';
progress.innerHTML = Settings.template;
var bar = progress.querySelector(Settings.barSelector),
perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0),
parent = isDOM(Settings.parent)
? Settings.parent
: document.querySelector(Settings.parent),
spinner
css(bar, {
transition: 'all 0 linear',
transform: 'translate3d(' + perc + '%,0,0)'
});
if (!Settings.showSpinner) {
spinner = progress.querySelector(Settings.spinnerSelector);
spinner && removeElement(spinner);
}
if (parent != document.body) {
addClass(parent, 'nprogress-custom-parent');
}
parent.appendChild(progress);
return progress;
};
/**
* Removes the element. Opposite of render().
*/
NProgress.remove = function() {
removeClass(document.documentElement, 'nprogress-busy');
var parent = isDOM(Settings.parent)
? Settings.parent
: document.querySelector(Settings.parent)
removeClass(parent, 'nprogress-custom-parent')
var progress = document.getElementById('nprogress');
progress && removeElement(progress);
};
/**
* Checks if the progress bar is rendered.
*/
NProgress.isRendered = function() {
return !!document.getElementById('nprogress');
};
/**
* Determine which positioning CSS rule to use.
*/
NProgress.getPositioningCSS = function() {
// Sniff on document.body.style
var bodyStyle = document.body.style;
// Sniff prefixes
var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :
('MozTransform' in bodyStyle) ? 'Moz' :
('msTransform' in bodyStyle) ? 'ms' :
('OTransform' in bodyStyle) ? 'O' : '';
if (vendorPrefix + 'Perspective' in bodyStyle) {
// Modern browsers with 3D support, e.g. Webkit, IE10
return 'translate3d';
} else if (vendorPrefix + 'Transform' in bodyStyle) {
// Browsers without 3D support, e.g. IE9
return 'translate';
} else {
// Browsers without translate() support, e.g. IE7-8
return 'margin';
}
};
/**
* Helpers
*/
function isDOM (obj) {
if (typeof HTMLElement === 'object') {
return obj instanceof HTMLElement
}
return (
obj &&
typeof obj === 'object' &&
obj.nodeType === 1 &&
typeof obj.nodeName === 'string'
)
}
function clamp(n, min, max) {
if (n < min) return min;
if (n > max) return max;
return n;
}
/**
* (Internal) converts a percentage (`0..1`) to a bar translateX
* percentage (`-100%..0%`).
*/
function toBarPerc(n) {
return (-1 + n) * 100;
}
/**
* (Internal) returns the correct CSS for changing the bar's
* position given an n percentage, and speed and ease from Settings
*/
function barPositionCSS(n, speed, ease) {
var barCSS;
if (Settings.positionUsing === 'translate3d') {
barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };
} else if (Settings.positionUsing === 'translate') {
barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };
} else {
barCSS = { 'margin-left': toBarPerc(n)+'%' };
}
barCSS.transition = 'all '+speed+'ms '+ease;
return barCSS;
}
/**
* (Internal) Queues a function to be executed.
*/
var queue = (function() {
var pending = [];
function next() {
var fn = pending.shift();
if (fn) {
fn(next);
}
}
return function(fn) {
pending.push(fn);
if (pending.length == 1) next();
};
})();
/**
* (Internal) Applies css properties to an element, similar to the jQuery
* css method.
*
* While this helper does assist with vendor prefixed property names, it
* does not perform any manipulation of values prior to setting styles.
*/
var css = (function() {
var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
cssProps = {};
function camelCase(string) {
return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) {
return letter.toUpperCase();
});
}
function getVendorProp(name) {
var style = document.body.style;
if (name in style) return name;
var i = cssPrefixes.length,
capName = name.charAt(0).toUpperCase() + name.slice(1),
vendorName;
while (i--) {
vendorName = cssPrefixes[i] + capName;
if (vendorName in style) return vendorName;
}
return name;
}
function getStyleProp(name) {
name = camelCase(name);
return cssProps[name] || (cssProps[name] = getVendorProp(name));
}
function applyCss(element, prop, value) {
prop = getStyleProp(prop);
element.style[prop] = value;
}
return function(element, properties) {
var args = arguments,
prop,
value;
if (args.length == 2) {
for (prop in properties) {
value = properties[prop];
if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value);
}
} else {
applyCss(element, args[1], args[2]);
}
}
})();
/**
* (Internal) Determines if an element or space separated list of class names contains a class name.
*/
function hasClass(element, name) {
var list = typeof element == 'string' ? element : classList(element);
return list.indexOf(' ' + name + ' ') >= 0;
}
/**
* (Internal) Adds a class to an element.
*/
function addClass(element, name) {
var oldList = classList(element),
newList = oldList + name;
if (hasClass(oldList, name)) return;
// Trim the opening space.
element.className = newList.substring(1);
}
/**
* (Internal) Removes a class from an element.
*/
function removeClass(element, name) {
var oldList = classList(element),
newList;
if (!hasClass(element, name)) return;
// Replace the class name.
newList = oldList.replace(' ' + name + ' ', ' ');
// Trim the opening and closing spaces.
element.className = newList.substring(1, newList.length - 1);
}
/**
* (Internal) Gets a space separated list of the class names on the element.
* The list is wrapped with a single space on each end to facilitate finding
* matches within the list.
*/
function classList(element) {
return (' ' + (element && element.className || '') + ' ').replace(/\s+/gi, ' ');
}
/**
* (Internal) Removes an element from the DOM.
*/
function removeElement(element) {
element && element.parentNode && element.parentNode.removeChild(element);
}
return NProgress;
});
layui.define([], function(exports) {
exports('nprogress', NProgress);
});
+159
View File
@@ -0,0 +1,159 @@
layui.define(['jquery'], function(exports) {
var $ = layui.jquery
var CLS_DROPDOWN = 'layui-dropdown'
var CLS_DROPDOWN_RIGHT = 'layui-dropdown-direright'
var CLS_SELECT = 'layui-dropdown-select'
var CLS_OPTION = 'layui-dropdown-option'
var CLS_TITLE = 'layui-dropdown-title'
var CLS_ARROW = 'layui-dropdown-arrow-up'
var HTML_DROPDOWN = '<div class="' + CLS_DROPDOWN + '"><div>'
var DEPTH = 0
var INDEX = 0
var operationConfigData;
var Class = function(config) {
this.config = $.extend({}, this.config, config);
this.render(config);
};
Class.prototype.config = {
width: 150,
trigger: 'click'
};
Class.prototype.dropdownElem = '';
Class.prototype.exists = false;
Class.prototype.depth = 0;
Class.prototype.index = 0;
Class.prototype.render = function(config) {
var self = this;
if (typeof this.config.elem == 'string') {
$(document).on('click', this.config.elem, event);
} else {
this.config.elem.click(event);
}
function event(e) {
e.stopPropagation()
if (self.dropdownElem == '') {
INDEX += 1
self.index = INDEX
var dropdown = $(HTML_DROPDOWN).attr('lay-index', self.index)
$('.' + CLS_DROPDOWN + '[lay-index="' + self.index + '"]').remove()
dropdown.html(self.createOptionsHtml(config))
$('body').prepend(dropdown)
// dropdown.on('click', '.' + CLS_OPTION, function(e) {
// e.stopPropagation()
// if ($.isFunction(config.click)) {
// config.click($(this).attr('lay-action'), $(this), e)
// dropdown.hide()
// }
// })
self.dropdownElem = dropdown
self.dropdownSelect = dropdown.find('.' + CLS_SELECT)
}
var dropdown = self.dropdownElem
dropdown.css('z-index','999');
var top = $(this).offset().top + $(this).height() + 12 - $(document).scrollTop()
var left = $(this).offset().left
dropdown.css({
top: top - 10
})
var offsetWidth = (self.depth + 1) * self.config.width
if (left + offsetWidth > $(window).width()) {
dropdown
.addClass('layui-dropdown-right')
.css('left', left - dropdown.width() + $(this).width())
self.dropdownSelect.css({ left: 'auto', right: self.config.width })
} else {
dropdown.removeClass('layui-dropdown-right').css('left', left)
self.dropdownSelect.css({ right: 'auto', left: self.config.width })
}
$('body').one('click', function(e) {
dropdown.hide();
dropdown.css('z-index','-1');
dropdown.stop().animate(
{
top: '-=10',
opacity: 0
},
250
)
});
dropdown
.show()
.stop()
.animate(
{
top: '+=10',
opacity: 1
},
250
);
}
};
Class.prototype.createOptionsHtml = function(data, depth) {
depth = depth || 0
var self = this
var width = self.config.width + 'px;'
var html =
'<div class="' +
CLS_SELECT +
'" style="width:' +
width +
(depth > 0 ? 'left:' + width : '') +
'">'
if (depth == 0) {
html += '<div class="' + CLS_ARROW + '"></div>'
}
layui.each(data.options, function(i, option) {
var options = option.options || [];
html +=
'<div ' +
'class="' + CLS_OPTION +' operationDropdown"' +
'data-option=\''+JSON.stringify(option)+'\'' +
'title=\''+option.title+'\'' +
'>' +
'<p class="' + CLS_TITLE +' layui-elip">' +
'<span class="layui-icon ' + option.icon + '"></span>' + option.title +
'</p>' +
(options.length > 0
? '<i class="layui-icon layui-icon-right"></i>'
: '');
option.options = option.options || [];
if (option.options.length > 0){
html += self.createOptionsHtml(option, depth + 1);
}
html += '</div>';
if (self.depth < depth) self.depth = depth
});
html += '</div>';
return html
};
var self = {
render: function(config) {
operationConfigData = config;
new Class(config);
}
};
$(document).off("click", ".operationDropdown").on("click", ".operationDropdown", function () {
var obj = $(this);
var option = obj.data("option");
if(typeof operationConfigData["click"] === "function"){
operationConfigData["click"](option);
}
});
exports('operationDropdown', self)
});
File diff suppressed because it is too large Load Diff
+49
View File
@@ -0,0 +1,49 @@
layui.define(['layer', 'jquery', 'element'], function(exports) {
"use strict";
var MOD_NAME = 'popup',
$ = layui.jquery,
layer = layui.layer,
element = layui.element;
var popup = new function() {
this.success = function(msg) {
layer.msg(msg, {
icon: 1,
time: 1000
})
},
this.failure = function(msg) {
layer.msg(msg, {
icon: 2,
time: 1000
})
},
this.warning = function(msg) {
layer.msg(msg, {
icon: 3,
time: 1000
})
},
this.success = function(msg, callback) {
layer.msg(msg, {
icon: 1,
time: 1000
}, callback);
},
this.failure = function(msg, callback) {
layer.msg(msg, {
icon: 2,
time: 1000
}, callback);
},
this.warming = function(msg, callback) {
layer.msg(msg, {
icon: 3,
time: 1000
}, callback);
}
};
exports(MOD_NAME, popup);
})
+335
View File
@@ -0,0 +1,335 @@
layui.define([], function (exports) {
const MOD_NAME = "react";
// 监听数据,后面可以用一个WeakMap + 存放key的数组替换
let proxyData = {
data: [], // 数据
methods: [], // 方法
hooks: [], // 钩子
};
let react = {
/**
* @abstract 通知并执行钩子函数
*
* @param {String} hook 监听的变量名
* @param {'pre'|'post'} type 类型
* @param {...any} args
*/
notifyHooks: (hook, type = 'pre', ...args) => {
for (const f of proxyData.hooks.filter(v => {
return v.target === hook && v.type === type;
})) {
f.handler(args);
}
},
/**
* @abstract 注册一些钩子当托管变量发生改变时触发
*
* 注册钩子
* @example
* ```javascript
* // 注册托管变量
* laytp.react.regData({
* hello: 0,
* world: 2
* });
*
* // 注册钩子
* laytp.react.regHooks({
* // 监听名为hello的变量改变
* hello: () => {
* console.log('Here!');
* },
*
* world: {
* type: 'post', // 默认都为'pre',为变量修改前回调,'post'为变量修改后回调
* handler: (target, prop, data) => {
* data.value = 50;
* }
* }
* });
* ```
*
* 调用
* @example
* ```javascript
* laytp.data.hello = 10;
* // laytp.data.hello -> 10
*
* laytp.data.world = 20;
* // laytp.data.world -> 50
* ```
*
* @param {Object} obj 需注册的钩子的Object
* @returns
*/
regHooks: function (obj) {
if (typeof obj !== 'function' && typeof obj !== 'object') {
console.error('请传入钩子对象或一个具名函数');
return;
}
if (typeof obj === 'function') {
if (obj.name === '') {
console.error('不支持传入闭包');
return;
}
proxyData.hooks.push({
target: obj.name,
type: 'pre',
handler: obj
});
return;
}
for (const key in obj) {
if (Object.hasOwnProperty.call(obj, key)) {
const func = obj[key];
if (typeof func === 'object' && typeof func.type === 'string' && typeof func.handler === 'function')
proxyData.hooks.push({
target: key,
type: func.type,
handler: func.handler
});
else if (typeof func === 'function')
proxyData.hooks.push({
target: key,
type: 'pre',
handler: func
});
else
console.warn(`${key} 不是一个合法的钩子`);
}
}
},
/**
* @abstract 注册一些托管方法
*
* 注册
* @example
* ```javascript
* laytp.react.regMethods({
* alert() {
* alert('warning');
* }
* });
* ```
*
* 调用
* @example
* ```javascript
* laytp.methods.alert();
* ```
*
* @param {Object} obj 需注册的方法的Object
* @returns
*/
regMethods: function (obj) {
if (typeof obj === 'function') {
if (obj.name === '') {
console.error('不支持传入闭包');
return;
}
if (proxyData.methods.findIndex(v => { return v.key === key; }) > -1) {
proxyData.methods.find(v => { return v.key === key }).handler = func;
return;
}
proxyData.methods.push({
key: obj.name,
handler: func
});
Object.defineProperty(laytp.methods, `${obj.name}`, {
get() {
let q = proxyData.methods.find(v => {
return v.key === obj.name;
});
return q === undefined ? undefined : q.handler;
}
});
return;
}
for (const key in obj) {
if (Object.hasOwnProperty.call(obj, key)) {
const func = obj[key];
if (typeof func !== 'function') {
console.warn(`${key} 不是一个合法的函数`);
continue;
}
if (proxyData.methods.findIndex(v => { return v.key === key; }) > -1) {
proxyData.methods.find(v => { return v.key === key }).handler = func;
continue;
}
proxyData.methods.push({
key,
handler: func
});
Object.defineProperty(react.methods, `${key}`, {
get() {
let q = proxyData.methods.find(v => {
return v.key === key;
});
return q === undefined ? undefined : q.handler;
}
});
}
}
},
/**
* @abstract 注册一些托管数据当托管数据发生变化时调用同名钩子函数暂不支持深度监听
*
* 注册
* @example
* ```javascript
* laytp.react.regData({
* some: 1,
* other: 10,
* meow: "I'm hungry"
* });
* ```
*
* 调用
* @example
* ```javascript
* laytp.data.some = 10;
* laytp.data.other = 'Ok';
* ```
*
* @param {Object} obj 需注册的数据的Object
* @returns
*/
regData: function (obj) {
if (typeof obj !== 'object') {
console.error('请传入数据对象');
return;
}
const handler = {
setByOutside(hooks, target, prop, value) {
for (const h of hooks) {
let data = {
get value() {
return value;
},
set value(v) {
value = v;
}
};
h.handler(target, prop, data);
target[prop] = value;
}
},
set(target, prop, value) {
// 写入前钩子
try {
handler.setByOutside(proxyData.hooks.filter(o => {
return o.target === target.key && o.type === 'pre';
}), target, prop, value);
} catch (error) {
console.error(error);
return;
}
// 写入
target[prop] = value;
// 写入后钩子
try {
handler.setByOutside(proxyData.hooks.filter(o => {
return o.target === target.key && o.type === 'post';
}), target, prop, value);
} catch (error) {
console.error(error);
}
},
get(target, prop) {
return target[prop];
}
};
for (const key in obj) {
if (Object.hasOwnProperty.call(obj, key)) {
const element = obj[key];
if (proxyData.data.findIndex(v => { return v.key === key }) > -1) {
proxyData.data.find(v => { return v.key === key }).value = element;
continue;
}
proxyData.data.push(new Proxy({
key,
value: element
}, handler));
Object.defineProperty(react.data, `${key}`, {
get() {
let q = proxyData.data.find(v => {
return v.key === key;
});
return q === undefined ? undefined : q.value;
},
set(v) {
let q = proxyData.data.find(v => {
return v.key === key;
});
(q) && (q.value = v);
}
});
}
}
},
data: new Proxy({}, {
set(target, p, newVal) {
react.regData({
[p]: newVal
});
},
get(target, p) {
return target[p];
}
}),
methods: new Proxy({}, {
set(target, p, newVal) {
react.regMethods({
[p]: newVal
});
},
get(target, p) {
return target[p];
}
}),
hooks: new Proxy({}, {
set(target, p, newVal) {
react.regHooks({
[p]: newVal
});
},
get(target, p) {
return target[p];
}
})
};
//输出模块
exports(MOD_NAME, react);
});
File diff suppressed because it is too large Load Diff
+80
View File
@@ -0,0 +1,80 @@
layui.define(['layer', 'carousel'], function (exports) {
var $ = layui.jquery;
var layer = layui.layer;
var carousel = layui.carousel;
var renderDom = function (elem, stepItems, postion) {
var stepDiv = '<div class="lay-step">';
for (var i = 0; i < stepItems.length; i++) {
stepDiv += '<div class="step-item">';
if (i < (stepItems.length - 1)) {
if (i < postion) {
stepDiv += '<div class="step-item-tail"><i class="step-item-tail-done"></i></div>';
} else {
stepDiv += '<div class="step-item-tail"><i class=""></i></div>';
}
}
var number = stepItems[i].number;
if (!number) {
number = i + 1;
}
if (i == postion) {
stepDiv += '<div class="step-item-head step-item-head-active"><i class="layui-icon">' + number + '</i></div>';
} else if (i < postion) {
stepDiv += '<div class="step-item-head"><i class="layui-icon layui-icon-ok"></i></div>';
} else {
stepDiv += '<div class="step-item-head "><i class="layui-icon">' + number + '</i></div>';
}
var title = stepItems[i].title;
var desc = stepItems[i].desc;
var time = stepItems[i].time;
if (title || desc || time) {
stepDiv += '<div class="step-item-main">';
if (title) {
stepDiv += '<div class="step-item-main-title">' + title + '</div>';
}
if (desc) {
stepDiv += '<div class="step-item-main-desc">' + desc + '</div>';
}
if (time) {
stepDiv += '<div class="step-item-main-time">' + time + '</div>';
}
stepDiv += '</div>';
}
stepDiv += '</div>';
}
stepDiv += '</div>';
$(elem).prepend(stepDiv);
var bfb = 100 / stepItems.length;
$('.step-item').css('width', bfb + '%');
};
var laytpStep = {
render: function (param) {
param.indicator = 'none'; // 不显示指示器
param.arrow = 'always'; // 始终显示箭头
param.autoplay = false; // 关闭自动播放
if (!param.stepWidth) {
param.stepWidth = '400px';
}
carousel.render(param);
var stepItems = param.stepItems;
renderDom(param.elem, stepItems, 0);
$('.lay-step').css('width', param.stepWidth);
carousel.on('change(' + param.filter + ')', function (obj) {
$(param.elem).find('.lay-step').remove();
renderDom(param.elem, stepItems, obj.index);
$('.lay-step').css('width', param.stepWidth);
});
$(param.elem).find('.layui-carousel-arrow').css('display', 'none');
$(param.elem).css('background-color', 'transparent');
},
next: function (elem) {
$(elem).find('.layui-carousel-arrow[lay-type=add]').trigger('click');
},
pre: function (elem) {
$(elem).find('.layui-carousel-arrow[lay-type=sub]').trigger('click');
}
};
exports('step', laytpStep);
});
+159
View File
@@ -0,0 +1,159 @@
layui.define('jquery', function(exports){
"use strict";
var $ = layui.$
,MOD_NAME = 'tag',
TAG_CLASS = '.tag',
BUTTON_NEW_TAG ='button-new-tag',
INPUT_NEW_TAG ='input-new-tag',
TAG_ITEM ='tag-item',
CLOSE = 'tag-close',
DEFAULT_SKIN ='layui-btn layui-btn-primary layui-btn-sm'
,tag = function(){
this.config = {
skin: DEFAULT_SKIN,
tagText:'+ New Tag'
};
this.configs = {}
};
//全局设置
tag.prototype.set = function(options){
var that = this;
$.extend(true, that.config, options);
tag.render();
return that;
};
//表单事件监听
tag.prototype.on = function(events, callback){
return layui.onevent.call(this, MOD_NAME, events, callback);
};
//外部Tag新增
tag.prototype.add = function(filter, options){
var tagElem = $(TAG_CLASS + '[lay-filter='+ filter +']')
call.add(null, tagElem, options);
call.tagAuto(filter);
return this;
};
//外部Tag删除
tag.prototype.delete = function(filter, layid){
var tagElem = $(TAG_CLASS + '[lay-filter='+ filter +']')
,tagItemElem = tagElem.find('>.' + TAG_ITEM + '[lay-id="'+ layid +'"]');
call.delete(null, tagItemElem);
return this;
};
//基础事件体
var call = {
//Tag点击
tagClick: function(e, index, tagItemElem, options){
options = options || {};
var othis = tagItemElem || $(this)
,index = index || othis.index(othis)
,parents = othis.parents(TAG_CLASS).eq(0)
,filter = parents.attr('lay-filter');
layui.event.call(this, MOD_NAME, 'click('+ filter +')', {
elem: parents
,index: index
});
}
//Tag新增事件
,add: function(e, tagElem, options){
var filter = tagElem.attr('lay-filter'),
buttonNewTag = tagElem.children('.' + BUTTON_NEW_TAG),
index = buttonNewTag.index()
,newTag = '<button lay-id="'+ (options.id||'') +'"' +(options.attr ? ' lay-attr="'+ options.attr +'"' : '') +' type="button" class="' + TAG_ITEM + '">'+ (options.text||'unnaming') +'</button>';
var result = layui.event.call(this, MOD_NAME, 'add('+ filter +')', {
elem: tagElem
,index: index
,othis: newTag
})
if(result === false) return;
buttonNewTag[0] ? buttonNewTag.before(newTag) : tagElem.append(newTag);
}
//Tag输入事件
,input: function(e, othis){
var buttonNewTag = othis || $(this)
,parents = buttonNewTag.parents(TAG_CLASS).eq(0)
,filter = parents.attr('lay-filter')
var options = tag.configs[filter] = $.extend({}, tag.config, tag.configs[filter] || {}, options);
//标签输入框
var inpatNewTag = $('<div class="' + INPUT_NEW_TAG + '"><input type="text" autocomplete="off" class="layui-input"></div>');
inpatNewTag.addClass(options.skin);
buttonNewTag.after(inpatNewTag).remove();
inpatNewTag.children('.layui-input').on('blur', function () {
if(this.value){
var options = {
text: this.value
}
call.add(null, parents, options);
}
inpatNewTag.remove();
call.tagAuto(filter);
}).focus();
}
//Tag删除
,delete: function(e, othis){
var tagItem = othis || $(this).parent(), index = tagItem.index()
,parents = tagItem.parents(TAG_CLASS).eq(0)
,filter = parents.attr('lay-filter');
var result = layui.event.call(this, MOD_NAME, 'delete('+ filter +')', {
elem: parents
,index: index
})
if(result === false) return;
tagItem.remove()
}
//Tag 自适应
,tagAuto: function(filter){
filter = filter || '';
var options = filter ? tag.configs[filter] || tag.config : tag.config;
var elemFilter = function(){
return filter ? ('[lay-filter="' + filter +'"]') : '';
}();
$(TAG_CLASS + elemFilter).each(function(){
var othis = $(this),tagItem = othis.children('.' + TAG_ITEM), buttonNewTag = othis.children('.' + BUTTON_NEW_TAG);
tagItem.removeClass(DEFAULT_SKIN).addClass(options.skin);
//允许关闭
if(othis.attr('lay-allowClose') && tagItem.length){
tagItem.each(function(){
var li = $(this);
if(!li.find('.'+CLOSE)[0]){
var close = $('<i class="layui-icon layui-unselect '+ CLOSE +'">&#x1006;</i>');
close.on('click', call.delete);
li.append(close);
}
});
}
//允许新增标签
if(othis.attr('lay-newTag') && buttonNewTag.length === 0){
buttonNewTag = $('<button type="button" class="' + BUTTON_NEW_TAG + '"></button>');
buttonNewTag.on('click', call.input);
othis.append(buttonNewTag);
}
buttonNewTag.html(options.tagText);
buttonNewTag.removeClass(DEFAULT_SKIN).addClass(options.skin);
});
}
};
tag.prototype.init = function(filter, options){
if(filter){
tag.configs[filter] = $.extend({}, tag.config, tag.configs[filter] || {}, options);
}
return call.tagAuto.call(this, filter);
};
tag.prototype.render = tag.prototype.init;
var tag = new tag(), dom = $(document);
tag.render();
dom.on('click', '.' + TAG_ITEM, call.tagClick); //tag 单击事件
exports(MOD_NAME, tag);
});
+110
View File
@@ -0,0 +1,110 @@
layui.define(["jquery","layer"], function (exports) {
var MOD_NAME = 'theme',
$ = layui.jquery;
var theme = {};
theme.autoHead = false;
theme.changeTheme = function (target, autoHead) {
this.autoHead = autoHead;
var color = localStorage.getItem("theme-color-color");
var second = localStorage.getItem("theme-color-second");
var tableChecked = localStorage.getItem("theme-color-table_checked");
this.colorSet(color, second, tableChecked);
if (target.frames.length == 0) return;
for (var i = 0; i < target.frames.length; i++) {
try {
if(target.frames[i].layui == undefined) continue;
target.frames[i].layui.theme.changeTheme(target.frames[i], autoHead);
}
catch (error) {
console.log(error);
}
}
}
theme.colorSet = function(color, second, tableChecked) {
var style = '';
style += '.light-theme .laytp-nav-tree .layui-this a:hover,.light-theme .laytp-nav-tree .layui-this,.light-theme .laytp-nav-tree .layui-this a,.laytp-nav-tree .layui-this a,.laytp-nav-tree .layui-this{background-color: ' +color + '!important;}';
style += '.laytp-admin .layui-logo .title{color:' + color + '!important;}';
style += '.laytp-frame-title .dot,.laytp-tab .layui-this .laytp-tab-active{background-color: ' + color +'!important;}';
style += '.bottom-nav li a:hover{background-color:' + color + '!important;}';
style += '.laytp-admin .layui-header .layui-nav .layui-nav-bar{background-color: ' + color + '!important;}'
style += '.ball-loader>span,.signal-loader>span {background-color: ' + color + '!important;}';
style += '.layui-header .layui-nav-child .layui-this a{background-color:' + color +'!important;color:white!important;}';
style += '#preloader{background-color:' + color + '!important;}';
style += '.laytpone-color .color-content li.layui-this:after, .laytpone-color .color-content li:hover:after {border: ' +color + ' 3px solid!important;}';
style += '.layui-nav .layui-nav-child dd.layui-this a, .layui-nav-child dd.layui-this{background-color:' + color + ';color:white;}';
style += '.laytp-social-entrance {background-color:' + color + '!important}';
style += '.laytp-admin .pe-collapse {background-color:' + color + '!important}';
style += '.layui-fixbar li {background-color:' + color + '!important}';
style += '.laytp-btn-primary {background-color:' + color + '!important}';
style += '.layui-input:hover,.layui-textarea:hover {border-color: ' + color + '!important;}'
style += '.layui-input:focus,.layui-textarea:focus {border-color: ' + color + '!important;}'
style += '.layui-laypage input:focus,.layui-laypage select:focus{border-color:' + color + '!important;}'
style += 'xm-select:hover{border-color: ' + color + '!important;}'
style += 'xm-select > .xm-tips{color:#c6c6c6!important;font-size:14px;}'
style += '.layui-form-checkbox[lay-skin=primary]:hover span {background-color: initial;}'
style += '.layui-form-checked[lay-skin=primary] i {border-color: ' + color + '!important;background-color: ' + color + '!important;}'
style += '.layui-form-checked,.layui-form-checked:hover {border-color: ' + color + '!important;}'
style += '.layui-form-checked span,.layui-form-checked:hover span {background-color: ' + color + ';}'
style += '.layui-form-checked i,.layui-form-checked:hover i {color: ' + color + ';}'
style += '.layui-form-checkbox[lay-skin=primary]>.layui-icon-indeterminate:before{background-color: ' + color + '!important;}'
style += '.layui-form-checkbox[lay-skin=primary]>.layui-icon-indeterminate{border-color:' + color + '!important}'
style += '.layui-form-onswitch { border-color: ' + color + '!important; background-color: ' + color + '!important;}'
style += '.layui-form-radio>i:hover, .layui-form-radioed>i {color: ' + color + ';}'
style += '.layui-laypage .layui-laypage-curr .layui-laypage-em{background-color:'+ color +'!important}'
style += '.layui-tab-brief>.layui-tab-more li.layui-this:after, .layui-tab-brief>.layui-tab-title .layui-this:after{border-bottom: 3px solid '+color+'!important}'
style += '.layui-tab-brief>.layui-tab-title .layui-this{color:'+color+'!important}'
style += '.layui-progress-bar{background-color:'+color+'!important}';
style += '.layui-elem-quote{border-left: 5px solid '+ color +'!important}';
style += '.layui-timeline-axis{color:' + color + '!important}';
style += '.layui-laydate .layui-this{background-color:'+color+'!important}';
style += '.layui-laydate-content td.laydate-day-now{color:'+color+'!important}';
style += '.layui-laydate-content td.laydate-day-now:after{border-color:'+color+'!important}';
style += '.laytp-this,.laytp-text{color:' + color + '!important}';
style += '.laytp-back{background-color:'+ color +'!important}';
style += '.laytp-collapsed-pe{background-color:'+color+'!important}'
style += '.layui-form-select dl dd.layui-this{color:'+color+'!important;}'
style += '.tag-item-normal{background:'+color+'!important}';
style += '.step-item-head.step-item-head-active{background-color:'+color+'}'
style += '.step-item-head{border: 3px solid '+color+';}'
style += '.step-item-tail i{background-color:'+color+'}'
style += '.step-item-head{color:' + color + '}'
style += 'div[xm-select-skin=normal] .xm-select-title div.xm-select-label>span i {background-color:'+color+'!important}'
style += 'div[xm-select-skin=normal] .xm-select-title div.xm-select-label>span{border: 1px solid '+color+'!important;background-color:'+color+'!important}'
style += 'div[xm-select-skin=normal] dl dd:not(.xm-dis-disabled) i{border-color:'+color+'!important}'
style += 'div[xm-select-skin=normal] dl dd.xm-select-this:not(.xm-dis-disabled) i{color:'+color+'!important}'
style += 'div[xm-select-skin=normal].xm-form-selected .xm-select, div[xm-select-skin=normal].xm-form-selected .xm-select:hover{border-color:'+color+'!important}'
style += '.layui-layer-btn a:first-child{border-color:'+color+';background-color:'+color+'!important}';
style += '.layui-form-checkbox[lay-skin=primary]:hover i{border-color:'+color+'!important}'
style += '.laytp-tab-menu .item:hover{background-color:'+color+'!important}'
style += '.layui-form-danger:focus {border-color:#FF5722 !important}'
style += '.laytp-admin .user .layui-this a:hover{color:white!important}'
style += '.laytp-admin .user a:hover{color:'+color+'!important}'
style += '.laytp-notice .layui-this{color:'+color+'!important}'
style += '.layui-form-radio:hover *, .layui-form-radioed, .layui-form-radioed>i{color:' + color + ' !important}';
style += '.laytp-btn:hover {color: '+color+';background-color: ' + second + ';}'
style += '.laytp-btn-primary[plain] {color: '+ color +' !important;background: ' + second + ' !important;}'
style += '.laytp-btn-primary[plain]:hover {background-color: ' + color + '!important}'
style += '.light-theme .laytp-nav-tree .layui-this a:hover,.light-theme .laytp-nav-tree .layui-this,.light-theme .laytp-nav-tree .layui-this a {background-color:'+second+'!important;color:'+color+'!important;}'
style += '.light-theme .laytp-nav-tree .layui-this{ border-right: 3px solid '+color+'!important}'
style += '.loader:after {background:'+color+'}'
style += '.layui-laydate .layui-this, .layui-laydate .layui-this>div{background:'+color+'!important}'
if(this.autoHead === true || this.autoHead === "true"){
style += '.laytp-admin.banner-layout .layui-header .layui-logo,.laytp-admin .layui-header{border:none;background-color:' + color + '!important;}.laytp-admin.banner-layout .layui-header .layui-logo .title,.laytp-admin .layui-header .layui-nav .layui-nav-item>a{color:whitesmoke!important;}';
style += '.laytp-admin.banner-layout .layui-header{ box-shadow: 2px 0 6px rgb(0 21 41 / 35%) }'
style += '.laytp-admin .layui-header .layui-layout-control .layui-this *,.laytp-admin.banner-layout .layui-header .layui-layout-control .layui-this *{ background-color: rgba(0,0,0,.1)!important;}'
}
style += '.menu-search-list li:hover,.menu-search-list li.this{background-color:'+ color +'}';
style += '.layui-table-checked{background-color:' + tableChecked + '!important}'
var colorPane = $("#laytp-admin-color");
if(colorPane.length>0){
colorPane.html(style);
}else{
$("head").append("<style id='laytp-admin-color'>"+style+"</style>")
}
}
exports(MOD_NAME, theme);
});
+213
View File
@@ -0,0 +1,213 @@
layui.define(['jquery'],function (exports) {
var $ = layui.$
var modFile = layui.cache.modules['tinymce'];
var modPath = modFile.substr(0, modFile.lastIndexOf('.'))
var setter = layui.setter || {}
var response = setter.response || {}
var plugin_filename = 'tinymce.min.js'//插件路径,不包含base_url部分
var settings = {
base_url: modPath
, images_upload_url: ''//图片上传接口,可在option传入,也可在这里修改,option的值优先
, language: 'zh_CN'//语言,可在option传入,也可在这里修改,option的值优先
, response: {//后台返回数据格式设置
statusName: response.statusName || 'code'//返回状态字段
, msgName: response.msgName || 'msg'//返回消息字段
, dataName: response.dataName || 'data'//返回的数据
, statusCode: response.statusCode || {
ok: 0//数据正常
}
}
, success: function (res, succFun, failFun) {//图片上传完成回调 根据自己需要修改
if (res[this.response.statusName] == this.response.statusCode.ok) {
succFun(res[this.response.dataName]);
} else {
failFun(res[this.response.msgName]);
}
}
};
// ---------------- 以下代码无需修改 ----------------
var t = {};
//初始化
t.render = function (options,callback) {
initTinymce();
var option = initOptions(options,callback)
,edit = t.get(option.elem);
if (edit) {
edit.destroy();
}
tinymce.init(option);
return t.get(option.elem);
};
t.init = t.render
// 获取ID对应的编辑器对象
t.get = function (elem) {
initTinymce();
if (elem && /^#|\./.test(elem)) {
var id = elem.substr(1);
var edit = tinymce.editors[id];
return edit
} else {
return false;
}
}
//重载
t.reload = function (elem, option, callback) {
var options = {}
if(typeof elem == 'string'){
option.elem = elem
options = $.extend({}, option)
} else if (typeof elem == 'object' && typeof elem.elem == 'string'){
options = $.extend({}, elem)
callback = option
}
var optionCache = layui.sessionData('layui-tinymce')[options.elem]
delete optionCache.init_instance_callback
$.extend(optionCache,options)
return t.render(optionCache,callback)
}
function initOptions(option,callback) {
var admin = layui.admin || {}
var form = option.form || {}
var file_field = form.name || 'edit' //文件字段名
var form_data = form.data || {} //其他表单数据 {key:value, ...}
option.suffix= isset(option.suffix) ? option.suffix : (plugin_filename.indexOf('.min')>-1 ? '.min' : '')
option.base_url = isset(option.base_url) ? option.base_url : settings.base_url
option.language = isset(option.language) ? option.language : settings.language
option.selector = isset(option.selector) ? option.selector : option.elem
option.quickbars_selection_toolbar = isset(option.quickbars_selection_toolbar) ? option.quickbars_selection_toolbar : 'cut copy | bold italic underline strikethrough '
option.plugins = isset(option.plugins) ? option.plugins : 'code kityformula-editor quickbars print preview searchreplace autolink fullscreen image link media codesample table charmap hr advlist lists wordcount imagetools indent2em';
option.toolbar = isset(option.toolbar) ? option.toolbar : 'code undo redo | kityformula-editor forecolor backcolor bold italic underline strikethrough | indent2em alignleft aligncenter alignright alignjustify outdent indent | link bullist numlist image table codesample | formatselect fontselect fontsizeselect';
option.resize = isset(option.resize) ? option.resize : false;
option.elementpath = isset(option.elementpath) ? option.elementpath : false;
option.branding = isset(option.branding) ? option.branding : false;
option.contextmenu_never_use_native = isset(option.contextmenu_never_use_native) ? option.contextmenu_never_use_native : true;
option.menubar = isset(option.menubar) ? option.menubar : 'file edit insert format table';
option.menu = isset(option.menu) ? option.menu : {
file: {title: '文件', items: 'newdocument | print preview fullscreen | wordcount'},
edit: {title: '编辑', items: 'undo redo | cut copy paste pastetext selectall | searchreplace'},
format: {
title: '格式',
items: 'bold italic underline strikethrough superscript subscript | formats | forecolor backcolor | removeformat'
},
table: {title: '表格', items: 'inserttable tableprops deletetable | cell row column'},
};
option.init_instance_callback =isset(option.init_instance_callback) ? option.init_instance_callback : function(inst) {
if(typeof callback == 'function') callback(option,inst)
};
option.images_upload_url = isset(option.images_upload_url) ? option.images_upload_url : settings.images_upload_url;
option.images_upload_handler = isset(option.images_upload_handler) ? option.images_upload_handler : function(blobInfo, succFun, failFun) {
if(isEmpty(option.images_upload_url)){
failFun("上传接口未配置");
return console.error('images_upload_url未配置');
}
var formData = new FormData();
formData.append(file_field, blobInfo.blob());
if(typeof form_data == 'object'){
for(var key in form_data){
formData.append(key, form_data[key]);
}
}
var ajaxOpt = {
url: option.images_upload_url,
dataType: 'json',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function (res) {
settings.success(res, succFun, failFun)
},
error: function (res) {
failFun("网络错误:" + res.status);
}
};
if (typeof admin.req == 'function') {
admin.req(ajaxOpt);
} else {
$.ajax(ajaxOpt);
}
}
layui.sessionData('layui-tinymce',{
key:option.selector,
value:option
})
return option
}
function initTinymce() {
if (typeof tinymce == 'undefined') {
$.ajax({//获取插件
url: settings.base_url + '/' + plugin_filename,
dataType: 'script',
cache: true,
async: false,
});
}
}
function isset(value) {
return typeof value !== 'undefined' && value !== null
}
function isEmpty(value) {
if(typeof value === 'undefined' || value === null|| value === ''){
return true
} else if (value instanceof Array && value.length === 0){
return true
} else if (typeof value === 'object' && Object.keys(value).length === 0){
return true
}
return false
}
exports('tinymce', t);
});
@@ -0,0 +1,172 @@
tinymce.IconManager.add('default', {
icons: {
'accessibility-check': '<svg width="24" height="24"><path d="M12 2a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2c0-1.1.9-2 2-2zm8 7h-5v12c0 .6-.4 1-1 1a1 1 0 01-1-1v-5c0-.6-.4-1-1-1a1 1 0 00-1 1v5c0 .6-.4 1-1 1a1 1 0 01-1-1V9H4a1 1 0 110-2h16c.6 0 1 .4 1 1s-.4 1-1 1z" fill-rule="nonzero"/></svg>',
'action-next': '<svg width="24" height="24"><path fill-rule="nonzero" d="M5.7 7.3a1 1 0 00-1.4 1.4l7.7 7.7 7.7-7.7a1 1 0 10-1.4-1.4L12 13.6 5.7 7.3z"/></svg>',
'action-prev': '<svg width="24" height="24"><path fill-rule="nonzero" d="M18.3 15.7a1 1 0 001.4-1.4L12 6.6l-7.7 7.7a1 1 0 001.4 1.4L12 9.4l6.3 6.3z"/></svg>',
'align-center': '<svg width="24" height="24"><path d="M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 110-2zm3 4h8c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 110-2zm0 8h8c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 010-2zm-3-4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 010-2z" fill-rule="evenodd"/></svg>',
'align-justify': '<svg width="24" height="24"><path d="M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 110-2zm0 4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 110-2zm0 4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 010-2zm0 4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 010-2z" fill-rule="evenodd"/></svg>',
'align-left': '<svg width="24" height="24"><path d="M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 110-2zm0 4h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 110-2zm0 8h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 010-2zm0-4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 010-2z" fill-rule="evenodd"/></svg>',
'align-none': '<svg width="24" height="24"><path d="M14.2 5L13 7H5a1 1 0 110-2h9.2zm4 0h.8a1 1 0 010 2h-2l1.2-2zm-6.4 4l-1.2 2H5a1 1 0 010-2h6.8zm4 0H19a1 1 0 010 2h-4.4l1.2-2zm-6.4 4l-1.2 2H5a1 1 0 010-2h4.4zm4 0H19a1 1 0 010 2h-6.8l1.2-2zM7 17l-1.2 2H5a1 1 0 010-2h2zm4 0h8a1 1 0 010 2H9.8l1.2-2zm5.2-13.5l1.3.7-9.7 16.3-1.3-.7 9.7-16.3z" fill-rule="evenodd"/></svg>',
'align-right': '<svg width="24" height="24"><path d="M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 110-2zm6 4h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0 8h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm-6-4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 010-2z" fill-rule="evenodd"/></svg>',
'arrow-left': '<svg width="24" height="24"><path d="M5.6 13l12 6a1 1 0 001.4-1V6a1 1 0 00-1.4-.9l-12 6a1 1 0 000 1.8z" fill-rule="evenodd"/></svg>',
'arrow-right': '<svg width="24" height="24"><path d="M18.5 13l-12 6A1 1 0 015 18V6a1 1 0 011.4-.9l12 6a1 1 0 010 1.8z" fill-rule="evenodd"/></svg>',
'bold': '<svg width="24" height="24"><path d="M7.8 19c-.3 0-.5 0-.6-.2l-.2-.5V5.7c0-.2 0-.4.2-.5l.6-.2h5c1.5 0 2.7.3 3.5 1 .7.6 1.1 1.4 1.1 2.5a3 3 0 01-.6 1.9c-.4.6-1 1-1.6 1.2.4.1.9.3 1.3.6s.8.7 1 1.2c.4.4.5 1 .5 1.6 0 1.3-.4 2.3-1.3 3-.8.7-2.1 1-3.8 1H7.8zm5-8.3c.6 0 1.2-.1 1.6-.5.4-.3.6-.7.6-1.3 0-1.1-.8-1.7-2.3-1.7H9.3v3.5h3.4zm.5 6c.7 0 1.3-.1 1.7-.4.4-.4.6-.9.6-1.5s-.2-1-.7-1.4c-.4-.3-1-.4-2-.4H9.4v3.8h4z" fill-rule="evenodd"/></svg>',
'bookmark': '<svg width="24" height="24"><path d="M6 4v17l6-4 6 4V4c0-.6-.4-1-1-1H7a1 1 0 00-1 1z" fill-rule="nonzero"/></svg>',
'border-width': '<svg width="24" height="24"><path d="M5 14.8h14a1 1 0 010 2H5a1 1 0 010-2zm-.5 3.7h15c.3 0 .5.2.5.5s-.2.5-.5.5h-15a.5.5 0 110-1zm.5-8.3h14c.6 0 1 .4 1 1v1c0 .5-.4 1-1 1H5a1 1 0 01-1-1v-1c0-.6.4-1 1-1zm0-5.7h14c.6 0 1 .4 1 1v2c0 .6-.4 1-1 1H5a1 1 0 01-1-1v-2c0-.6.4-1 1-1z" fill-rule="evenodd"/></svg>',
'brightness': '<svg width="24" height="24"><path d="M12 17c.3 0 .5.1.7.3.2.2.3.4.3.7v1c0 .3-.1.5-.3.7a1 1 0 01-.7.3 1 1 0 01-.7-.3 1 1 0 01-.3-.7v-1c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3zm0-10a1 1 0 01-.7-.3A1 1 0 0111 6V5c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3.3 0 .5.1.7.3.2.2.3.4.3.7v1c0 .3-.1.5-.3.7a1 1 0 01-.7.3zm7 4c.3 0 .5.1.7.3.2.2.3.4.3.7 0 .3-.1.5-.3.7a1 1 0 01-.7.3h-1a1 1 0 01-.7-.3 1 1 0 01-.3-.7c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h1zM7 12c0 .3-.1.5-.3.7a1 1 0 01-.7.3H5a1 1 0 01-.7-.3A1 1 0 014 12c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h1c.3 0 .5.1.7.3.2.2.3.4.3.7zm10 3.5l.7.8c.2.1.3.4.3.6 0 .3-.1.6-.3.8a1 1 0 01-.8.3 1 1 0 01-.6-.3l-.8-.7a1 1 0 01-.3-.8c0-.2.1-.5.3-.7a1 1 0 011.4 0zm-10-7l-.7-.8a1 1 0 01-.3-.6c0-.3.1-.6.3-.8.2-.2.5-.3.8-.3.2 0 .5.1.7.3l.7.7c.2.2.3.5.3.8 0 .2-.1.5-.3.7a1 1 0 01-.7.3 1 1 0 01-.8-.3zm10 0a1 1 0 01-.8.3 1 1 0 01-.7-.3 1 1 0 01-.3-.7c0-.3.1-.6.3-.8l.8-.7c.1-.2.4-.3.6-.3.3 0 .6.1.8.3.2.2.3.5.3.8 0 .2-.1.5-.3.7l-.7.7zm-10 7c.2-.2.5-.3.8-.3.2 0 .5.1.7.3a1 1 0 010 1.4l-.8.8a1 1 0 01-.6.3 1 1 0 01-.8-.3 1 1 0 01-.3-.8c0-.2.1-.5.3-.6l.7-.8zM12 8a4 4 0 013.7 2.4 4 4 0 010 3.2A4 4 0 0112 16a4 4 0 01-3.7-2.4 4 4 0 010-3.2A4 4 0 0112 8zm0 6.5c.7 0 1.3-.2 1.8-.7.5-.5.7-1.1.7-1.8s-.2-1.3-.7-1.8c-.5-.5-1.1-.7-1.8-.7s-1.3.2-1.8.7c-.5.5-.7 1.1-.7 1.8s.2 1.3.7 1.8c.5.5 1.1.7 1.8.7z" fill-rule="evenodd"/></svg>',
'browse': '<svg width="24" height="24"><path d="M19 4a2 2 0 012 2v12a2 2 0 01-2 2h-4v-2h4V8H5v10h4v2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zm-8 9.4l-2.3 2.3a1 1 0 11-1.4-1.4l4-4a1 1 0 011.4 0l4 4a1 1 0 01-1.4 1.4L13 13.4V20a1 1 0 01-2 0v-6.6z" fill-rule="nonzero"/></svg>',
'cancel': '<svg width="24" height="24"><path d="M12 4.6a7.4 7.4 0 110 14.8 7.4 7.4 0 010-14.8zM12 3a9 9 0 100 18 9 9 0 000-18zm0 8L14.8 8l1 1.1-2.7 2.8 2.7 2.7-1.1 1.1-2.7-2.7-2.7 2.7-1-1.1 2.6-2.7-2.7-2.7 1-1.1 2.8 2.7z" fill-rule="nonzero"/></svg>',
'change-case': '<svg width="24" height="24"><path d="M18.4 18.2v-.6c-.5.8-1.3 1.2-2.4 1.2-2.2 0-3.3-1.6-3.3-4.8 0-3.1 1-4.7 3.3-4.7 1.1 0 1.8.3 2.4 1.1v-.6c0-.5.4-.8.8-.8s.8.3.8.8v8.4c0 .5-.4.8-.8.8a.8.8 0 01-.8-.8zm-2-7.4c-1.3 0-1.8.9-1.8 3.2 0 2.4.5 3.3 1.7 3.3 1.3 0 1.8-.9 1.8-3.2 0-2.4-.5-3.3-1.7-3.3zM10 15.7H5.5l-.8 2.6a1 1 0 01-1 .7h-.2a.7.7 0 01-.7-1l4-12a1 1 0 012 0l4 12a.7.7 0 01-.8 1h-.2a1 1 0 01-1-.7l-.8-2.6zm-.3-1.5l-2-6.5-1.9 6.5h3.9z" fill-rule="evenodd"/></svg>',
'character-count': '<svg width="24" height="24"><path d="M4 11.5h16v1H4v-1zm4.8-6.8V10H7.7V5.8h-1v-1h2zM11 8.3V9h2v1h-3V7.7l2-1v-.9h-2v-1h3v2.4l-2 1zm6.3-3.4V10h-3.1V9h2.1V8h-2.1V6.8h2.1v-1h-2.1v-1h3.1zM5.8 16.4c0-.5.2-.8.5-1 .2-.2.6-.3 1.2-.3l.8.1c.2 0 .4.2.5.3l.4.4v2.8l.2.3H8.2v-.1-.2l-.6.3H7c-.4 0-.7 0-1-.2a1 1 0 01-.3-.9c0-.3 0-.6.3-.8.3-.2.7-.4 1.2-.4l.6-.2h.3v-.2l-.1-.2a.8.8 0 00-.5-.1 1 1 0 00-.4 0l-.3.4h-1zm2.3.8h-.2l-.2.1-.4.1a1 1 0 00-.4.2l-.2.2.1.3.5.1h.4l.4-.4v-.6zm2-3.4h1.2v1.7l.5-.3h.5c.5 0 .9.1 1.2.5.3.4.5.8.5 1.4 0 .6-.2 1.1-.5 1.5-.3.4-.7.6-1.3.6l-.6-.1-.4-.4v.4h-1.1v-5.4zm1.1 3.3c0 .3 0 .6.2.8a.7.7 0 001.2 0l.2-.8c0-.4 0-.6-.2-.8a.7.7 0 00-.6-.3l-.6.3-.2.8zm6.1-.5c0-.2 0-.3-.2-.4a.8.8 0 00-.5-.2c-.3 0-.5.1-.6.3l-.2.9c0 .3 0 .6.2.8.1.2.3.3.6.3.2 0 .4 0 .5-.2l.2-.4h1.1c0 .5-.3.8-.6 1.1a2 2 0 01-1.3.4c-.5 0-1-.2-1.3-.6a2 2 0 01-.5-1.4c0-.6.1-1.1.5-1.5.3-.4.8-.5 1.4-.5.5 0 1 0 1.2.3.4.3.5.7.5 1.2h-1v-.1z" fill-rule="evenodd"/></svg>',
'checklist-rtl': '<svg width="24" height="24"><path d="M5 17h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 010-2zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 010-2zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 110-2zm14.2 11c.2-.4.6-.5.9-.3.3.2.4.6.2 1L18 20c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 010-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8zm0-6c.2-.4.6-.5.9-.3.3.2.4.6.2 1L18 14c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 010-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8zm0-6c.2-.4.6-.5.9-.3.3.2.4.6.2 1L18 8c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 010-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8z" fill-rule="evenodd"/></svg>',
'checklist': '<svg width="24" height="24"><path d="M11 17h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0-6h8a1 1 0 010 2h-8a1 1 0 010-2zM7.2 16c.2-.4.6-.5.9-.3.3.2.4.6.2 1L6 20c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 010-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8zm0-6c.2-.4.6-.5.9-.3.3.2.4.6.2 1L6 14c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 010-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8zm0-6c.2-.4.6-.5.9-.3.3.2.4.6.2 1L6 8c-.2.3-.7.4-1 0L3.8 6.9a.7.7 0 010-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8z" fill-rule="evenodd"/></svg>',
'checkmark': '<svg width="24" height="24"><path d="M18.2 5.4a1 1 0 011.6 1.2l-8 12a1 1 0 01-1.5.1l-5-5a1 1 0 111.4-1.4l4.1 4.1 7.4-11z" fill-rule="nonzero"/></svg>',
'chevron-down': '<svg width="10" height="10"><path d="M8.7 2.2c.3-.3.8-.3 1 0 .4.4.4.9 0 1.2L5.7 7.8c-.3.3-.9.3-1.2 0L.2 3.4a.8.8 0 010-1.2c.3-.3.8-.3 1.1 0L5 6l3.7-3.8z" fill-rule="nonzero"/></svg>',
'chevron-left': '<svg width="10" height="10"><path d="M7.8 1.3L4 5l3.8 3.7c.3.3.3.8 0 1-.4.4-.9.4-1.2 0L2.2 5.7a.8.8 0 010-1.2L6.6.2C7 0 7.4 0 7.8.2c.3.3.3.8 0 1.1z" fill-rule="nonzero"/></svg>',
'chevron-right': '<svg width="10" height="10"><path d="M2.2 1.3a.8.8 0 010-1c.4-.4.9-.4 1.2 0l4.4 4.1c.3.4.3.9 0 1.2L3.4 9.8c-.3.3-.8.3-1.2 0a.8.8 0 010-1.1L6 5 2.2 1.3z" fill-rule="nonzero"/></svg>',
'chevron-up': '<svg width="10" height="10"><path d="M8.7 7.8L5 4 1.3 7.8c-.3.3-.8.3-1 0a.8.8 0 010-1.2l4.1-4.4c.3-.3.9-.3 1.2 0l4.2 4.4c.3.3.3.9 0 1.2-.3.3-.8.3-1.1 0z" fill-rule="nonzero"/></svg>',
'close': '<svg width="24" height="24"><path d="M17.3 8.2L13.4 12l3.9 3.8a1 1 0 01-1.5 1.5L12 13.4l-3.8 3.9a1 1 0 01-1.5-1.5l3.9-3.8-3.9-3.8a1 1 0 011.5-1.5l3.8 3.9 3.8-3.9a1 1 0 011.5 1.5z" fill-rule="evenodd"/></svg>',
'code-sample': '<svg width="24" height="26"><path d="M7.1 11a2.8 2.8 0 01-.8 2 2.8 2.8 0 01.8 2v1.7c0 .3.1.6.4.8.2.3.5.4.8.4.3 0 .4.2.4.4v.8c0 .2-.1.4-.4.4-.7 0-1.4-.3-2-.8-.5-.6-.8-1.3-.8-2V15c0-.3-.1-.6-.4-.8-.2-.3-.5-.4-.8-.4a.4.4 0 01-.4-.4v-.8c0-.2.2-.4.4-.4.3 0 .6-.1.8-.4.3-.2.4-.5.4-.8V9.3c0-.7.3-1.4.8-2 .6-.5 1.3-.8 2-.8.3 0 .4.2.4.4v.8c0 .2-.1.4-.4.4-.3 0-.6.1-.8.4-.3.2-.4.5-.4.8V11zm9.8 0V9.3c0-.3-.1-.6-.4-.8-.2-.3-.5-.4-.8-.4a.4.4 0 01-.4-.4V7c0-.2.1-.4.4-.4.7 0 1.4.3 2 .8.5.6.8 1.3.8 2V11c0 .3.1.6.4.8.2.3.5.4.8.4.2 0 .4.2.4.4v.8c0 .2-.2.4-.4.4-.3 0-.6.1-.8.4-.3.2-.4.5-.4.8v1.7c0 .7-.3 1.4-.8 2-.6.5-1.3.8-2 .8a.4.4 0 01-.4-.4v-.8c0-.2.1-.4.4-.4.3 0 .6-.1.8-.4.3-.2.4-.5.4-.8V15a2.8 2.8 0 01.8-2 2.8 2.8 0 01-.8-2zm-3.3-.4c0 .4-.1.8-.5 1.1-.3.3-.7.5-1.1.5-.4 0-.8-.2-1.1-.5-.4-.3-.5-.7-.5-1.1 0-.5.1-.9.5-1.2.3-.3.7-.4 1.1-.4.4 0 .8.1 1.1.4.4.3.5.7.5 1.2zM12 13c.4 0 .8.1 1.1.5.4.3.5.7.5 1.1 0 1-.1 1.6-.5 2a3 3 0 01-1.1 1c-.4.3-.8.4-1.1.4a.5.5 0 01-.5-.5V17a3 3 0 001-.2l.6-.6c-.6 0-1-.2-1.3-.5-.2-.3-.3-.7-.3-1 0-.5.1-1 .5-1.2.3-.4.7-.5 1.1-.5z" fill-rule="evenodd"/></svg>',
'color-levels': '<svg width="24" height="24"><path d="M17.5 11.4A9 9 0 0118 14c0 .5 0 1-.2 1.4 0 .4-.3.9-.5 1.3a6.2 6.2 0 01-3.7 3 5.7 5.7 0 01-3.2 0A5.9 5.9 0 017.6 18a6.2 6.2 0 01-1.4-2.6 6.7 6.7 0 010-2.8c0-.4.1-.9.3-1.3a13.6 13.6 0 012.3-4A20 20 0 0112 4a26.4 26.4 0 013.2 3.4 18.2 18.2 0 012.3 4zm-2 4.5c.4-.7.5-1.4.5-2a7.3 7.3 0 00-1-3.2c.2.6.2 1.2.2 1.9a4.5 4.5 0 01-1.3 3 5.3 5.3 0 01-2.3 1.5 4.9 4.9 0 01-2 .1 4.3 4.3 0 002.4.8 4 4 0 002-.6 4 4 0 001.5-1.5z" fill-rule="evenodd"/></svg>',
'color-picker': '<svg width="24" height="24"><path d="M12 3a9 9 0 000 18 1.5 1.5 0 001.1-2.5c-.2-.3-.4-.6-.4-1 0-.8.7-1.5 1.5-1.5H16a5 5 0 005-5c0-4.4-4-8-9-8zm-5.5 9a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm3-4a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm5 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm3 4a1.5 1.5 0 110-3 1.5 1.5 0 010 3z" fill-rule="nonzero"/></svg>',
'color-swatch-remove-color': '<svg width="24" height="24"><path stroke="#000" stroke-width="2" d="M21 3L3 21" fill-rule="evenodd"/></svg>',
'color-swatch': '<svg width="24" height="24"><rect x="3" y="3" width="18" height="18" rx="1" fill-rule="evenodd"/></svg>',
'comment-add': '<svg width="24" height="24"><g fill-rule="nonzero"><path d="M9 19l3-2h7c.6 0 1-.4 1-1V6c0-.6-.4-1-1-1H5a1 1 0 00-1 1v10c0 .6.4 1 1 1h4v2zm-2 4v-4H5a3 3 0 01-3-3V6a3 3 0 013-3h14a3 3 0 013 3v10a3 3 0 01-3 3h-6.4L7 23z"/><path d="M13 10h2a1 1 0 010 2h-2v2a1 1 0 01-2 0v-2H9a1 1 0 010-2h2V8a1 1 0 012 0v2z"/></g></svg>',
'comment': '<svg width="24" height="24"><path fill-rule="nonzero" d="M9 19l3-2h7c.6 0 1-.4 1-1V6c0-.6-.4-1-1-1H5a1 1 0 00-1 1v10c0 .6.4 1 1 1h4v2zm-2 4v-4H5a3 3 0 01-3-3V6a3 3 0 013-3h14a3 3 0 013 3v10a3 3 0 01-3 3h-6.4L7 23z"/></svg>',
'contrast': '<svg width="24" height="24"><path d="M12 4a7.8 7.8 0 015.7 2.3A8 8 0 1112 4zm-6 8a6 6 0 006 6V6a6 6 0 00-6 6z" fill-rule="evenodd"/></svg>',
'copy': '<svg width="24" height="24"><path d="M16 3H6a2 2 0 00-2 2v11h2V5h10V3zm1 4a2 2 0 012 2v10a2 2 0 01-2 2h-7a2 2 0 01-2-2V9c0-1.2.9-2 2-2h7zm0 12V9h-7v10h7z" fill-rule="nonzero"/></svg>',
'crop': '<svg width="24" height="24"><path d="M17 8v7h2c.6 0 1 .4 1 1s-.4 1-1 1h-2v2c0 .6-.4 1-1 1a1 1 0 01-1-1v-2H7V9H5a1 1 0 110-2h2V5c0-.6.4-1 1-1s1 .4 1 1v2h7l3-3 1 1-3 3zM9 9v5l5-5H9zm1 6h5v-5l-5 5z" fill-rule="evenodd"/></svg>',
'cut-column': '<svg width="24" height="24"><path fill-rule="evenodd" d="M7.2 4.5c.9 0 1.6.4 2.2 1A3.7 3.7 0 0110.5 8v.5l1 1 4-4 1-.5a3.3 3.3 0 012 0c.4 0 .7.3 1 .5L17 8h4v13h-6V10l-1.5 1.5.5.5v4l-2.5-2.5-1 1v.5c0 .4 0 .8-.3 1.2-.2.5-.4.9-.8 1.2-.6.7-1.3 1-2.2 1-.8.2-1.5 0-2-.6l-.5-.8-.2-1c0-.4 0-.8.3-1.2A3.9 3.9 0 017 12.7c.5-.2 1-.3 1.5-.2l1-1-1-1c-.5 0-1 0-1.5-.2-.5-.1-1-.4-1.4-.9-.4-.3-.6-.7-.8-1.2L4.5 7c0-.4 0-.7.2-1 0-.3.3-.6.5-.8.5-.5 1.2-.8 2-.7zm12.3 5h-3v10h3v-10zM8 13.8h-.3l-.4.2a2.8 2.8 0 00-.7.4v.1a2.8 2.8 0 00-.6.8l-.1.4v.7l.2.5.5.2h.7a2.6 2.6 0 00.8-.3 2.4 2.4 0 00.7-.7 2.5 2.5 0 00.3-.8 1.5 1.5 0 000-.8 1 1 0 00-.2-.4 1 1 0 00-.5-.2H8zm3.5-3.7c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zM7 5.8h-.4a1 1 0 00-.5.3 1 1 0 00-.2.5v.7a2.5 2.5 0 00.3.8l.2.3h.1l.4.4.4.2.4.1h.7L9 9l.2-.4a1.6 1.6 0 000-.8 2.6 2.6 0 00-.3-.8A2.5 2.5 0 007.7 6l-.4-.1H7z"/></svg>',
'cut-row': '<svg width="24" height="24"><path fill-rule="evenodd" d="M22 3v5H9l3 3 2-2h4l-4 4 1 1h.5c.4 0 .8 0 1.2.3.5.2.9.4 1.2.8.7.6 1 1.3 1 2.2.2.8 0 1.5-.6 2l-.8.5-1 .2c-.4 0-.8 0-1.2-.3a3.9 3.9 0 01-2.1-2.2c-.2-.5-.3-1-.2-1.5l-1-1-1 1c0 .5 0 1-.2 1.5-.1.5-.4 1-.9 1.4-.3.4-.7.6-1.2.8l-1.2.3c-.4 0-.7 0-1-.2-.3 0-.6-.3-.8-.5-.5-.5-.8-1.2-.7-2 0-.9.4-1.6 1-2.2A3.7 3.7 0 018.6 14H9l1-1-4-4-.5-1a3.3 3.3 0 010-2c0-.4.3-.7.5-1l2 2V3h14zM8.5 15.3h-.3a2.6 2.6 0 00-.8.4 2.5 2.5 0 00-.9 1.1l-.1.4v.7l.2.5.5.2h.7a2.5 2.5 0 00.8-.3L9 18V18l.4-.4.2-.4.1-.4v-.3-.4a1 1 0 00-.2-.5 1 1 0 00-.4-.2h-.5zm7 0H15a1 1 0 00-.4.3 1 1 0 00-.2.5 1.5 1.5 0 000 .7v.4a2.8 2.8 0 00.5.7h.1a2.8 2.8 0 00.8.6l.4.1h.7l.5-.2.2-.5v-.4-.3a2.6 2.6 0 00-.3-.8 2.4 2.4 0 00-.7-.7 2.5 2.5 0 00-.8-.3h-.3zM12 11.6c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zm8.5-7.1h-11v2h11v-2z"/></svg>',
'cut': '<svg width="24" height="24"><path d="M18 15c.6.7 1 1.4 1 2.3 0 .8-.2 1.5-.7 2l-.8.5-1 .2c-.4 0-.8 0-1.2-.3a3.9 3.9 0 01-2.1-2.2c-.2-.5-.3-1-.2-1.5l-1-1-1 1c0 .5 0 1-.2 1.5-.1.5-.4 1-.9 1.4-.3.4-.7.6-1.2.8l-1.2.3c-.4 0-.7 0-1-.2-.3 0-.6-.3-.8-.5-.5-.5-.8-1.2-.7-2 0-.9.4-1.6 1-2.2A3.7 3.7 0 018.6 14H9l1-1-4-4-.5-1a3.3 3.3 0 010-2c0-.4.3-.7.5-1l6 6 6-6 .5 1a3.3 3.3 0 010 2c0 .4-.3.7-.5 1l-4 4 1 1h.5c.4 0 .8 0 1.2.3.5.2.9.4 1.2.8zm-8.5 2.2l.1-.4v-.3-.4a1 1 0 00-.2-.5 1 1 0 00-.4-.2 1.6 1.6 0 00-.8 0 2.6 2.6 0 00-.8.3 2.5 2.5 0 00-.9 1.1l-.1.4v.7l.2.5.5.2h.7a2.5 2.5 0 00.8-.3 2.8 2.8 0 001-1zm2.5-2.8c.4 0 .7-.1 1-.4.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4s-.7.1-1 .4c-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4zm5.4 4l.2-.5v-.4-.3a2.6 2.6 0 00-.3-.8 2.4 2.4 0 00-.7-.7 2.5 2.5 0 00-.8-.3 1.5 1.5 0 00-.8 0 1 1 0 00-.4.2 1 1 0 00-.2.5 1.5 1.5 0 000 .7v.4l.3.4.3.4a2.8 2.8 0 00.8.5l.4.1h.7l.5-.2z" fill-rule="evenodd"/></svg>',
'document-properties': '<svg width="24" height="24"><path d="M14.4 3H7a2 2 0 00-2 2v14c0 1.1.9 2 2 2h10a2 2 0 002-2V7.6L14.4 3zM17 19H7V5h6v4h4v10z" fill-rule="nonzero"/></svg>',
'drag': '<svg width="24" height="24"><path d="M13 5h2v2h-2V5zm0 4h2v2h-2V9zM9 9h2v2H9V9zm4 4h2v2h-2v-2zm-4 0h2v2H9v-2zm0 4h2v2H9v-2zm4 0h2v2h-2v-2zM9 5h2v2H9V5z" fill-rule="evenodd"/></svg>',
'duplicate-column': '<svg width="24" height="24"><path d="M17 6v16h-7V6h7zm-2 2h-3v12h3V8zm-2-6v2H8v15H6V2h7z"/></svg>',
'duplicate-row': '<svg width="24" height="24"><path d="M22 11v7H6v-7h16zm-2 2H8v3h12v-3zm-1-6v2H4v5H2V7h17z"/></svg>',
'duplicate': '<svg width="24" height="24"><g fill-rule="nonzero"><path d="M16 3v2H6v11H4V5c0-1.1.9-2 2-2h10zm3 8h-2V9h-7v10h9a2 2 0 01-2 2h-7a2 2 0 01-2-2V9c0-1.2.9-2 2-2h7a2 2 0 012 2v2z"/><path d="M17 14h1a1 1 0 010 2h-1v1a1 1 0 01-2 0v-1h-1a1 1 0 010-2h1v-1a1 1 0 012 0v1z"/></g></svg>',
'edit-block': '<svg width="24" height="24"><path fill-rule="nonzero" d="M19.8 8.8l-9.4 9.4c-.2.2-.5.4-.9.4l-5.4 1.2 1.2-5.4.5-.8 9.4-9.4c.7-.7 1.8-.7 2.5 0l2.1 2.1c.7.7.7 1.8 0 2.5zm-2-.2l1-.9v-.3l-2.2-2.2a.3.3 0 00-.3 0l-1 1L18 8.5zm-1 1l-2.5-2.4-6 6 2.5 2.5 6-6zm-7 7.1l-2.6-2.4-.3.3-.1.2-.7 3 3.1-.6h.1l.4-.5z"/></svg>',
'edit-image': '<svg width="24" height="24"><path d="M18 16h2V7a2 2 0 00-2-2H7v2h11v9zM6 17h15a1 1 0 010 2h-1v1a1 1 0 01-2 0v-1H6a2 2 0 01-2-2V7H3a1 1 0 110-2h1V4a1 1 0 112 0v13zm3-5.3l1.3 2 3-4.7 3.7 6H7l2-3.3z" fill-rule="nonzero"/></svg>',
'embed-page': '<svg width="24" height="24"><path d="M19 6V5H5v14h2A13 13 0 0119 6zm0 1.4c-.8.8-1.6 2.4-2.2 4.6H19V7.4zm0 5.6h-2.4c-.4 1.8-.6 3.8-.6 6h3v-6zm-4 6c0-2.2.2-4.2.6-6H13c-.7 1.8-1.1 3.8-1.1 6h3zm-4 0c0-2.2.4-4.2 1-6H9.6A12 12 0 008 19h3zM4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 01-1-1V4c0-.6.4-1 1-1zm11.8 9c.4-1.9 1-3.4 1.8-4.5a9.2 9.2 0 00-4 4.5h2.2zm-3.4 0a12 12 0 012.8-4 12 12 0 00-5 4h2.2z" fill-rule="nonzero"/></svg>',
'embed': '<svg width="24" height="24"><path d="M4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 01-1-1V4c0-.6.4-1 1-1zm1 2v14h14V5H5zm4.8 2.6l5.6 4a.5.5 0 010 .8l-5.6 4A.5.5 0 019 16V8a.5.5 0 01.8-.4z" fill-rule="nonzero"/></svg>',
'emoji': '<svg width="24" height="24"><path d="M9 11c.6 0 1-.4 1-1s-.4-1-1-1a1 1 0 00-1 1c0 .6.4 1 1 1zm6 0c.6 0 1-.4 1-1s-.4-1-1-1a1 1 0 00-1 1c0 .6.4 1 1 1zm-3 5.5c2.1 0 4-1.5 4.4-3.5H7.6c.5 2 2.3 3.5 4.4 3.5zM12 4a8 8 0 100 16 8 8 0 000-16zm0 14.5a6.5 6.5 0 110-13 6.5 6.5 0 010 13z" fill-rule="nonzero"/></svg>',
'export': '<svg width="24" height="24"><g fill-rule="nonzero"><path d="M14.4 3L18 7v1h-5V5H7v14h9a1 1 0 012 0c0 1-.8 2-1.9 2H7c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h7.5z"/><path d="M18.1 12c.5 0 .9.4.9 1 0 .5-.3 1-.8 1h-7.3c-.5 0-.9-.4-.9-1 0-.5.3-1 .8-1h7.3z"/><path d="M16.4 9.2a1 1 0 011.4.2l2.4 3.6-2.4 3.6a1 1 0 01-1.7-1v-.2l1.7-2.4-1.6-2.4a1 1 0 01.2-1.4z"/></g></svg>',
'fill': '<svg width="24" height="26"><path d="M16.6 12l-9-9-1.4 1.4 2.4 2.4-5.2 5.1c-.5.6-.5 1.6 0 2.2L9 19.6a1.5 1.5 0 002.2 0l5.5-5.5c.5-.6.5-1.6 0-2.2zM5.2 13L10 8.2l4.8 4.8H5.2zM19 14.5s-2 2.2-2 3.5c0 1.1.9 2 2 2a2 2 0 002-2c0-1.3-2-3.5-2-3.5z" fill-rule="nonzero"/></svg>',
'flip-horizontally': '<svg width="24" height="24"><path d="M14 19h2v-2h-2v2zm4-8h2V9h-2v2zM4 7v10c0 1.1.9 2 2 2h3v-2H6V7h3V5H6a2 2 0 00-2 2zm14-2v2h2a2 2 0 00-2-2zm-7 16h2V3h-2v18zm7-6h2v-2h-2v2zm-4-8h2V5h-2v2zm4 12a2 2 0 002-2h-2v2z" fill-rule="nonzero"/></svg>',
'flip-vertically': '<svg width="24" height="24"><path d="M5 14v2h2v-2H5zm8 4v2h2v-2h-2zm4-14H7a2 2 0 00-2 2v3h2V6h10v3h2V6a2 2 0 00-2-2zm2 14h-2v2a2 2 0 002-2zM3 11v2h18v-2H3zm6 7v2h2v-2H9zm8-4v2h2v-2h-2zM5 18c0 1.1.9 2 2 2v-2H5z" fill-rule="nonzero"/></svg>',
'format-painter': '<svg width="24" height="24"><path d="M18 5V4c0-.5-.4-1-1-1H5a1 1 0 00-1 1v4c0 .6.5 1 1 1h12c.6 0 1-.4 1-1V7h1v4H9v9c0 .6.4 1 1 1h2c.6 0 1-.4 1-1v-7h8V5h-3z" fill-rule="nonzero"/></svg>',
'format': '<svg width="24" height="24"><path fill-rule="evenodd" d="M17 5a1 1 0 010 2h-4v11a1 1 0 01-2 0V7H7a1 1 0 110-2h10z"/></svg>',
'fullscreen': '<svg width="24" height="24"><path d="M15.3 10l-1.2-1.3 2.9-3h-2.3a.9.9 0 110-1.7H19c.5 0 .9.4.9.9v4.4a.9.9 0 11-1.8 0V7l-2.9 3zm0 4l3 3v-2.3a.9.9 0 111.7 0V19c0 .5-.4.9-.9.9h-4.4a.9.9 0 110-1.8H17l-3-2.9 1.3-1.2zM10 15.4l-2.9 3h2.3a.9.9 0 110 1.7H5a.9.9 0 01-.9-.9v-4.4a.9.9 0 111.8 0V17l2.9-3 1.2 1.3zM8.7 10L5.7 7v2.3a.9.9 0 01-1.7 0V5c0-.5.4-.9.9-.9h4.4a.9.9 0 010 1.8H7l3 2.9-1.3 1.2z" fill-rule="nonzero"/></svg>',
'gallery': '<svg width="24" height="24"><path fill-rule="nonzero" d="M5 15.7l2.3-2.2c.3-.3.7-.3 1 0L11 16l5.1-5c.3-.4.8-.4 1 0l2 1.9V8H5v7.7zM5 18V19h3l1.8-1.9-2-2L5 17.9zm14-3l-2.5-2.4-6.4 6.5H19v-4zM4 6h16c.6 0 1 .4 1 1v13c0 .6-.4 1-1 1H4a1 1 0 01-1-1V7c0-.6.4-1 1-1zm6 7a2 2 0 110-4 2 2 0 010 4zM4.5 4h15a.5.5 0 110 1h-15a.5.5 0 010-1zm2-2h11a.5.5 0 110 1h-11a.5.5 0 010-1z"/></svg>',
'gamma': '<svg width="24" height="24"><path d="M4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 01-1-1V4c0-.6.4-1 1-1zm1 2v14h14V5H5zm6.5 11.8V14L9.2 8.7a5.1 5.1 0 00-.4-.8l-.1-.2H8 8v-1l.3-.1.3-.1h.7a1 1 0 01.6.5l.1.3a8.5 8.5 0 01.3.6l1.9 4.6 2-5.2a1 1 0 011-.6.5.5 0 01.5.6L13 14v2.8a.7.7 0 01-1.4 0z" fill-rule="nonzero"/></svg>',
'help': '<svg width="24" height="24"><g fill-rule="evenodd"><path d="M12 5.5a6.5 6.5 0 00-6 9 6.3 6.3 0 001.4 2l1 1a6.3 6.3 0 003.6 1 6.5 6.5 0 006-9 6.3 6.3 0 00-1.4-2l-1-1a6.3 6.3 0 00-3.6-1zM12 4a7.8 7.8 0 015.7 2.3A8 8 0 1112 4z"/><path d="M9.6 9.7a.7.7 0 01-.7-.8c0-1.1 1.5-1.8 3.2-1.8 1.8 0 3.2.8 3.2 2.4 0 1.4-.4 2.1-1.5 2.8-.2 0-.3.1-.3.2a2 2 0 00-.8.8.8.8 0 01-1.4-.6c.3-.7.8-1 1.3-1.5l.4-.2c.7-.4.8-.6.8-1.5 0-.5-.6-.9-1.7-.9-.5 0-1 .1-1.4.3-.2 0-.3.1-.3.2v-.2c0 .4-.4.8-.8.8z" fill-rule="nonzero"/><circle cx="12" cy="16" r="1"/></g></svg>',
'highlight-bg-color': '<svg width="24" height="24"><g fill-rule="evenodd"><path id="tox-icon-highlight-bg-color__color" d="M3 18h18v3H3z"/><path fill-rule="nonzero" d="M7.7 16.7H3l3.3-3.3-.7-.8L10.2 8l4 4.1-4 4.2c-.2.2-.6.2-.8 0l-.6-.7-1.1 1.1zm5-7.5L11 7.4l3-2.9a2 2 0 012.6 0L18 6c.7.7.7 2 0 2.7l-2.9 2.9-1.8-1.8-.5-.6"/></g></svg>',
'home': '<svg width="24" height="24"><path fill-rule="nonzero" d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/></svg>',
'horizontal-rule': '<svg width="24" height="24"><path d="M4 11h16v2H4z" fill-rule="evenodd"/></svg>',
'image-options': '<svg width="24" height="24"><path d="M6 10a2 2 0 00-2 2c0 1.1.9 2 2 2a2 2 0 002-2 2 2 0 00-2-2zm12 0a2 2 0 00-2 2c0 1.1.9 2 2 2a2 2 0 002-2 2 2 0 00-2-2zm-6 0a2 2 0 00-2 2c0 1.1.9 2 2 2a2 2 0 002-2 2 2 0 00-2-2z" fill-rule="nonzero"/></svg>',
'image': '<svg width="24" height="24"><path d="M5 15.7l3.3-3.2c.3-.3.7-.3 1 0L12 15l4.1-4c.3-.4.8-.4 1 0l2 1.9V5H5v10.7zM5 18V19h3l2.8-2.9-2-2L5 17.9zm14-3l-2.5-2.4-6.4 6.5H19v-4zM4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 01-1-1V4c0-.6.4-1 1-1zm6 8a2 2 0 100-4 2 2 0 000 4z" fill-rule="nonzero"/></svg>',
'indent': '<svg width="24" height="24"><path d="M7 5h12c.6 0 1 .4 1 1s-.4 1-1 1H7a1 1 0 110-2zm5 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 010-2zm0 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 010-2zm-5 4h12a1 1 0 010 2H7a1 1 0 010-2zm-2.6-3.8L6.2 12l-1.8-1.2a1 1 0 011.2-1.6l3 2a1 1 0 010 1.6l-3 2a1 1 0 11-1.2-1.6z" fill-rule="evenodd"/></svg>',
'info': '<svg width="24" height="24"><path d="M12 4a7.8 7.8 0 015.7 2.3A8 8 0 1112 4zm-1 3v2h2V7h-2zm3 10v-1h-1v-5h-3v1h1v4h-1v1h4z" fill-rule="evenodd"/></svg>',
'insert-character': '<svg width="24" height="24"><path d="M15 18h4l1-2v4h-6v-3.3l1.4-1a6 6 0 001.8-2.9 6.3 6.3 0 00-.1-4.1 5.8 5.8 0 00-3-3.2c-.6-.3-1.3-.5-2.1-.5a5.1 5.1 0 00-3.9 1.8 6.3 6.3 0 00-1.3 6 6.2 6.2 0 001.8 3l1.4.9V20H4v-4l1 2h4v-.5l-2-1L5.4 15A6.5 6.5 0 014 11c0-1 .2-1.9.6-2.7A7 7 0 016.3 6C7.1 5.4 8 5 9 4.5c1-.3 2-.5 3.1-.5a8.8 8.8 0 015.7 2 7 7 0 011.7 2.3 6 6 0 01.2 4.8c-.2.7-.6 1.3-1 1.9a7.6 7.6 0 01-3.6 2.5v.5z" fill-rule="evenodd"/></svg>',
'insert-time': '<svg width="24" height="24"><g fill-rule="nonzero"><path d="M12 19a7 7 0 100-14 7 7 0 000 14zm0 2a9 9 0 110-18 9 9 0 010 18z"/><path d="M16 12h-3V7c0-.6-.4-1-1-1a1 1 0 00-1 1v7h5c.6 0 1-.4 1-1s-.4-1-1-1z"/></g></svg>',
'invert': '<svg width="24" height="24"><path d="M18 19.3L16.5 18a5.8 5.8 0 01-3.1 1.9 6.1 6.1 0 01-5.5-1.6A5.8 5.8 0 016 14v-.3l.1-1.2A13.9 13.9 0 017.7 9l-3-3 .7-.8 2.8 2.9 9 8.9 1.5 1.6-.7.6zm0-5.5v.3l-.1 1.1-.4 1-1.2-1.2a4.3 4.3 0 00.2-1v-.2c0-.4 0-.8-.2-1.3l-.5-1.4a14.8 14.8 0 00-3-4.2L12 6a26.1 26.1 0 00-2.2 2.5l-1-1a20.9 20.9 0 012.9-3.3L12 4l1 .8a22.2 22.2 0 014 5.4c.6 1.2 1 2.4 1 3.6z" fill-rule="evenodd"/></svg>',
'italic': '<svg width="24" height="24"><path d="M16.7 4.7l-.1.9h-.3c-.6 0-1 0-1.4.3-.3.3-.4.6-.5 1.1l-2.1 9.8v.6c0 .5.4.8 1.4.8h.2l-.2.8H8l.2-.8h.2c1.1 0 1.8-.5 2-1.5l2-9.8.1-.5c0-.6-.4-.8-1.4-.8h-.3l.2-.9h5.8z" fill-rule="evenodd"/></svg>',
'line-height': '<svg width="24" height="24"><path d="M21 5a1 1 0 01.1 2H13a1 1 0 01-.1-2H21zm0 4a1 1 0 01.1 2H13a1 1 0 01-.1-2H21zm0 4a1 1 0 01.1 2H13a1 1 0 01-.1-2H21zm0 4a1 1 0 01.1 2H13a1 1 0 01-.1-2H21zM7 3.6l3.7 3.7a1 1 0 01-1.3 1.5h-.1L8 7.3v9.2l1.3-1.3a1 1 0 011.3 0h.1c.4.4.4 1 0 1.3v.1L7 20.4l-3.7-3.7a1 1 0 011.3-1.5h.1L6 16.7V7.4L4.7 8.7a1 1 0 01-1.3 0h-.1a1 1 0 010-1.3v-.1L7 3.6z"/></svg>',
'line': '<svg width="24" height="24"><path d="M15 9l-8 8H4v-3l8-8 3 3zm1-1l-3-3 1-1h1c-.2 0 0 0 0 0l2 2s0 .2 0 0v1l-1 1zM4 18h16v2H4v-2z" fill-rule="evenodd"/></svg>',
'link': '<svg width="24" height="24"><path d="M6.2 12.3a1 1 0 011.4 1.4l-2.1 2a2 2 0 102.7 2.8l4.8-4.8a1 1 0 000-1.4 1 1 0 111.4-1.3 2.9 2.9 0 010 4L9.6 20a3.9 3.9 0 01-5.5-5.5l2-2zm11.6-.6a1 1 0 01-1.4-1.4l2-2a2 2 0 10-2.6-2.8L11 10.3a1 1 0 000 1.4A1 1 0 119.6 13a2.9 2.9 0 010-4L14.4 4a3.9 3.9 0 015.5 5.5l-2 2z" fill-rule="nonzero"/></svg>',
'list-bull-circle': '<svg width="48" height="48"><g fill-rule="evenodd"><path d="M11 16a2 2 0 100-4 2 2 0 000 4zm0 1a3 3 0 110-6 3 3 0 010 6zM11 26a2 2 0 100-4 2 2 0 000 4zm0 1a3 3 0 110-6 3 3 0 010 6zM11 36a2 2 0 100-4 2 2 0 000 4zm0 1a3 3 0 110-6 3 3 0 010 6z" fill-rule="nonzero"/><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/></g></svg>',
'list-bull-default': '<svg width="48" height="48"><g fill-rule="evenodd"><circle cx="11" cy="14" r="3"/><circle cx="11" cy="24" r="3"/><circle cx="11" cy="34" r="3"/><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/></g></svg>',
'list-bull-square': '<svg width="48" height="48"><g fill-rule="evenodd"><path d="M8 11h6v6H8zM8 21h6v6H8zM8 31h6v6H8z"/><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/></g></svg>',
'list-num-default-rtl': '<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z"/><path d="M37.4 17v-4.8l-1.6 1v-1.1l1.6-1h1.2V17zM33.3 17.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zm1.7 5.7c0-1.2 1-2 2.2-2 1.3 0 2.1.8 2.1 1.8 0 .7-.3 1.2-1.3 2.2l-1.2 1v.2h2.6v1h-4.3v-.9l2-1.9c.8-.8 1-1.1 1-1.5 0-.5-.4-.8-1-.8-.5 0-.9.3-.9.9H35zm-1.7 4.3c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zm3.2 7.3v-1h.7c.6 0 1-.3 1-.8 0-.4-.4-.7-1-.7s-1 .3-1 .8H35c0-1.1 1-1.8 2.2-1.8 1.2 0 2.1.6 2.1 1.6 0 .7-.4 1.2-1 1.3v.1c.7.1 1.3.7 1.3 1.4 0 1-1 1.9-2.4 1.9-1.3 0-2.2-.8-2.3-2h1.2c0 .6.5 1 1.1 1 .6 0 1-.4 1-1 0-.5-.3-.8-1-.8h-.7zm-3.3 2.7c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7z"/></g></svg>',
'list-num-default': '<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="M10 17v-4.8l-1.5 1v-1.1l1.6-1h1.2V17h-1.2zm3.6.1c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .7.3.7.7 0 .4-.2.7-.7.7zm-5 5.7c0-1.2.8-2 2.1-2s2.1.8 2.1 1.8c0 .7-.3 1.2-1.4 2.2l-1.1 1v.2h2.6v1H8.6v-.9l2-1.9c.8-.8 1-1.1 1-1.5 0-.5-.4-.8-1-.8-.5 0-.9.3-.9.9H8.5zm6.3 4.3c-.5 0-.7-.3-.7-.7 0-.4.2-.7.7-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zM10 34.4v-1h.7c.6 0 1-.3 1-.8 0-.4-.4-.7-1-.7s-1 .3-1 .8H8.6c0-1.1 1-1.8 2.2-1.8 1.3 0 2.1.6 2.1 1.6 0 .7-.4 1.2-1 1.3v.1c.8.1 1.3.7 1.3 1.4 0 1-1 1.9-2.4 1.9-1.3 0-2.2-.8-2.3-2h1.2c0 .6.5 1 1.1 1 .7 0 1-.4 1-1 0-.5-.3-.8-1-.8h-.7zm4.7 2.7c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7z"/></g></svg>',
'list-num-lower-alpha-rtl': '<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z"/><path d="M36.5 16c-.9 0-1.5-.5-1.5-1.3s.6-1.3 1.8-1.4h1v-.4c0-.4-.2-.6-.7-.6-.4 0-.7.1-.8.4h-1.1c0-.8.8-1.4 2-1.4S39 12 39 13V16h-1.2v-.6c-.3.4-.8.7-1.4.7zm.4-.8c.6 0 1-.4 1-.9V14h-1c-.5.1-.7.3-.7.6 0 .4.3.6.7.6zM33.1 16.1c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7zM37.7 26c-.7 0-1.2-.2-1.5-.7v.7H35v-6.3h1.2v2.5c.3-.5.8-.9 1.5-.9 1.1 0 1.8 1 1.8 2.4 0 1.5-.7 2.4-1.8 2.4zm-.5-3.6c-.6 0-1 .5-1 1.3s.4 1.4 1 1.4c.7 0 1-.6 1-1.4 0-.8-.3-1.3-1-1.3zM33.2 26.1c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7zm6 7h-1c-.1-.5-.4-.8-1-.8s-1 .5-1 1.4c0 1 .4 1.4 1 1.4.5 0 .9-.2 1-.7h1c0 1-.8 1.7-2 1.7-1.4 0-2.2-.9-2.2-2.4s.8-2.4 2.2-2.4c1.2 0 2 .7 2 1.7zm-6.1 3c-.5 0-.7-.3-.7-.7 0-.4.2-.7.7-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7z"/></g></svg>',
'list-num-lower-alpha': '<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="M10.3 15.2c.5 0 1-.4 1-.9V14h-1c-.5.1-.8.3-.8.6 0 .4.3.6.8.6zm-.4.9c-1 0-1.5-.6-1.5-1.4 0-.8.6-1.3 1.7-1.4h1.1v-.4c0-.4-.2-.6-.7-.6-.5 0-.8.1-.9.4h-1c0-.8.8-1.4 2-1.4 1.1 0 1.8.6 1.8 1.6V16h-1.1v-.6h-.1c-.2.4-.7.7-1.3.7zm4.6 0c-.5 0-.7-.3-.7-.7 0-.4.2-.7.7-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zm-3.2 10c-.6 0-1.2-.3-1.4-.8v.7H8.5v-6.3H10v2.5c.3-.5.8-.9 1.4-.9 1.2 0 1.9 1 1.9 2.4 0 1.5-.7 2.4-1.9 2.4zm-.4-3.7c-.7 0-1 .5-1 1.3s.3 1.4 1 1.4c.6 0 1-.6 1-1.4 0-.8-.4-1.3-1-1.3zm4 3.7c-.5 0-.7-.3-.7-.7 0-.4.2-.7.7-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zm-2.2 7h-1.2c0-.5-.4-.8-.9-.8-.6 0-1 .5-1 1.4 0 1 .4 1.4 1 1.4.5 0 .8-.2 1-.7h1c0 1-.8 1.7-2 1.7-1.4 0-2.2-.9-2.2-2.4s.8-2.4 2.2-2.4c1.2 0 2 .7 2 1.7zm1.8 3c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7z"/></g></svg>',
'list-num-lower-greek-rtl': '<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z"/><path d="M37.4 16c-1.2 0-2-.8-2-2.3 0-1.5.8-2.4 2-2.4.6 0 1 .4 1.3 1v-.9H40v3.2c0 .4.1.5.4.5h.2v.9h-.6c-.6 0-1-.2-1-.7h-.2c-.2.4-.7.8-1.3.8zm.3-1c.6 0 1-.5 1-1.3s-.4-1.3-1-1.3-1 .5-1 1.3.4 1.4 1 1.4zM33.3 16.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zM36 21.9c0-1.5.8-2.3 2.1-2.3 1.2 0 2 .6 2 1.6 0 .6-.3 1-.9 1.3.9.3 1.3.8 1.3 1.7 0 1.2-.7 1.9-1.8 1.9-.6 0-1.1-.3-1.4-.8v2.2H36V22zm1.8 1.2v-1h.3c.5 0 .9-.2.9-.7 0-.5-.3-.8-.9-.8-.5 0-.8.3-.8 1v2.2c0 .8.4 1.3 1 1.3s1-.4 1-1-.4-1-1.2-1h-.3zM33.3 26.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zM37.1 34.6L34.8 30h1.4l1.7 3.5 1.7-3.5h1.1l-2.2 4.6v.1c.5.8.7 1.4.7 1.8 0 .4-.2.8-.4 1-.2.2-.6.3-1 .3-.9 0-1.3-.4-1.3-1.2 0-.5.2-1 .5-1.7l.1-.2zm.7 1a2 2 0 00-.4.9c0 .3.1.4.4.4.3 0 .4-.1.4-.4 0-.2-.1-.6-.4-1zM33.3 36.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7z"/></g></svg>',
'list-num-lower-greek': '<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="M10.5 15c.7 0 1-.5 1-1.3s-.3-1.3-1-1.3c-.5 0-.9.5-.9 1.3s.4 1.4 1 1.4zm-.3 1c-1.1 0-1.8-.8-1.8-2.3 0-1.5.7-2.4 1.8-2.4.7 0 1.1.4 1.3 1h.1v-.9h1.2v3.2c0 .4.1.5.4.5h.2v.9h-.6c-.6 0-1-.2-1.1-.7h-.1c-.2.4-.7.8-1.4.8zm5 .1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7zm-4.9 7v-1h.3c.6 0 1-.2 1-.7 0-.5-.4-.8-1-.8-.5 0-.8.3-.8 1v2.2c0 .8.4 1.3 1.1 1.3.6 0 1-.4 1-1s-.5-1-1.3-1h-.3zM8.6 22c0-1.5.7-2.3 2-2.3 1.2 0 2 .6 2 1.6 0 .6-.3 1-.8 1.3.8.3 1.3.8 1.3 1.7 0 1.2-.8 1.9-1.9 1.9-.6 0-1.1-.3-1.3-.8v2.2H8.5V22zm6.2 4.2c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .7.3.7.7 0 .4-.2.7-.7.7zm-4.5 8.5L8 30h1.4l1.7 3.5 1.7-3.5h1.1l-2.2 4.6v.1c.5.8.7 1.4.7 1.8 0 .4-.1.8-.4 1-.2.2-.6.3-1 .3-.9 0-1.3-.4-1.3-1.2 0-.5.2-1 .5-1.7l.1-.2zm.7 1a2 2 0 00-.4.9c0 .3.1.4.4.4.3 0 .4-.1.4-.4 0-.2-.1-.6-.4-1zm4.5.5c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7z"/></g></svg>',
'list-num-lower-roman-rtl': '<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z"/><path d="M32.9 16v-1.2h-1.3V16H33zm0 10v-1.2h-1.3V26H33zm0 10v-1.2h-1.3V36H33z"/><path fill-rule="nonzero" d="M36 21h-1.5v5H36zM36 31h-1.5v5H36zM39 21h-1.5v5H39zM39 31h-1.5v5H39zM42 31h-1.5v5H42zM36 11h-1.5v5H36zM36 19h-1.5v1H36zM36 29h-1.5v1H36zM39 19h-1.5v1H39zM39 29h-1.5v1H39zM42 29h-1.5v1H42zM36 9h-1.5v1H36z"/></g></svg>',
'list-num-lower-roman': '<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="M15.1 16v-1.2h1.3V16H15zm0 10v-1.2h1.3V26H15zm0 10v-1.2h1.3V36H15z"/><path fill-rule="nonzero" d="M12 21h1.5v5H12zM12 31h1.5v5H12zM9 21h1.5v5H9zM9 31h1.5v5H9zM6 31h1.5v5H6zM12 11h1.5v5H12zM12 19h1.5v1H12zM12 29h1.5v1H12zM9 19h1.5v1H9zM9 29h1.5v1H9zM6 29h1.5v1H6zM12 9h1.5v1H12z"/></g></svg>',
'list-num-upper-alpha-rtl': '<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z"/><path d="M39.3 17l-.5-1.4h-2l-.5 1.4H35l2-6h1.6l2 6h-1.3zm-1.6-4.7l-.7 2.3h1.6l-.8-2.3zM33.4 17c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .7.3.7.7 0 .4-.2.7-.7.7zm4.7 9.9h-2.7v-6H38c1.2 0 1.9.6 1.9 1.5 0 .6-.5 1.2-1 1.3.7.1 1.3.7 1.3 1.5 0 1-.8 1.7-2 1.7zm-1.4-5v1.5h1c.6 0 1-.3 1-.8 0-.4-.4-.7-1-.7h-1zm0 4h1.1c.7 0 1.1-.3 1.1-.8 0-.6-.4-.9-1.1-.9h-1.1V26zM33 27.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zm4.9 10c-1.8 0-2.8-1.1-2.8-3.1s1-3.1 2.8-3.1c1.4 0 2.5.9 2.6 2.2h-1.3c0-.7-.6-1.1-1.3-1.1-1 0-1.6.7-1.6 2s.6 2 1.6 2c.7 0 1.2-.4 1.4-1h1.2c-.1 1.3-1.2 2.2-2.6 2.2zm-4.5 0c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7z"/></g></svg>',
'list-num-upper-alpha': '<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="M12.6 17l-.5-1.4h-2L9.5 17H8.3l2-6H12l2 6h-1.3zM11 12.3l-.7 2.3h1.6l-.8-2.3zm4.7 4.8c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .7.3.7.7 0 .4-.2.7-.7.7zM11.4 27H8.7v-6h2.6c1.2 0 1.9.6 1.9 1.5 0 .6-.5 1.2-1 1.3.7.1 1.3.7 1.3 1.5 0 1-.8 1.7-2 1.7zM10 22v1.5h1c.6 0 1-.3 1-.8 0-.4-.4-.7-1-.7h-1zm0 4H11c.7 0 1.1-.3 1.1-.8 0-.6-.4-.9-1.1-.9H10V26zm5.4 1.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zm-4.1 10c-1.8 0-2.8-1.1-2.8-3.1s1-3.1 2.8-3.1c1.4 0 2.5.9 2.6 2.2h-1.3c0-.7-.6-1.1-1.3-1.1-1 0-1.6.7-1.6 2s.6 2 1.6 2c.7 0 1.2-.4 1.4-1h1.2c-.1 1.3-1.2 2.2-2.6 2.2zm4.5 0c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7z"/></g></svg>',
'list-num-upper-roman-rtl': '<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z"/><path d="M31.6 17v-1.2H33V17h-1.3zm0 10v-1.2H33V27h-1.3zm0 10v-1.2H33V37h-1.3z"/><path fill-rule="nonzero" d="M34.5 20H36v7h-1.5zM34.5 30H36v7h-1.5zM37.5 20H39v7h-1.5zM37.5 30H39v7h-1.5zM40.5 30H42v7h-1.5zM34.5 10H36v7h-1.5z"/></g></svg>',
'list-num-upper-roman': '<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="M15.1 17v-1.2h1.3V17H15zm0 10v-1.2h1.3V27H15zm0 10v-1.2h1.3V37H15z"/><path fill-rule="nonzero" d="M12 20h1.5v7H12zM12 30h1.5v7H12zM9 20h1.5v7H9zM9 30h1.5v7H9zM6 30h1.5v7H6zM12 10h1.5v7H12z"/></g></svg>',
'lock': '<svg width="24" height="24"><path d="M16.3 11c.2 0 .3 0 .5.2l.2.6v7.4c0 .3 0 .4-.2.6l-.6.2H7.8c-.3 0-.4 0-.6-.2a.7.7 0 01-.2-.6v-7.4c0-.3 0-.4.2-.6l.5-.2H8V8c0-.8.3-1.5.9-2.1.6-.6 1.3-.9 2.1-.9h2c.8 0 1.5.3 2.1.9.6.6.9 1.3.9 2.1v3h.3zM10 8v3h4V8a1 1 0 00-.3-.7A1 1 0 0013 7h-2a1 1 0 00-.7.3 1 1 0 00-.3.7z" fill-rule="evenodd"/></svg>',
'ltr': '<svg width="24" height="24"><path d="M11 5h7a1 1 0 010 2h-1v11a1 1 0 01-2 0V7h-2v11a1 1 0 01-2 0v-6c-.5 0-1 0-1.4-.3A3.4 3.4 0 017.8 10a3.3 3.3 0 010-2.8 3.4 3.4 0 011.8-1.8L11 5zM4.4 16.2L6.2 15l-1.8-1.2a1 1 0 011.2-1.6l3 2a1 1 0 010 1.6l-3 2a1 1 0 11-1.2-1.6z" fill-rule="evenodd"/></svg>',
'more-drawer': '<svg width="24" height="24"><path d="M6 10a2 2 0 00-2 2c0 1.1.9 2 2 2a2 2 0 002-2 2 2 0 00-2-2zm12 0a2 2 0 00-2 2c0 1.1.9 2 2 2a2 2 0 002-2 2 2 0 00-2-2zm-6 0a2 2 0 00-2 2c0 1.1.9 2 2 2a2 2 0 002-2 2 2 0 00-2-2z" fill-rule="nonzero"/></svg>',
'new-document': '<svg width="24" height="24"><path d="M14.4 3H7a2 2 0 00-2 2v14c0 1.1.9 2 2 2h10a2 2 0 002-2V7.6L14.4 3zM17 19H7V5h6v4h4v10z" fill-rule="nonzero"/></svg>',
'new-tab': '<svg width="24" height="24"><path d="M15 13l2-2v8H5V7h8l-2 2H7v8h8v-4zm4-8v5.5l-2-2-5.6 5.5H10v-1.4L15.5 7l-2-2H19z" fill-rule="evenodd"/></svg>',
'non-breaking': '<svg width="24" height="24"><path d="M11 11H8a1 1 0 110-2h3V6c0-.6.4-1 1-1s1 .4 1 1v3h3c.6 0 1 .4 1 1s-.4 1-1 1h-3v3c0 .6-.4 1-1 1a1 1 0 01-1-1v-3zm10 4v5H3v-5c0-.6.4-1 1-1s1 .4 1 1v3h14v-3c0-.6.4-1 1-1s1 .4 1 1z" fill-rule="evenodd"/></svg>',
'notice': '<svg width="24" height="24"><path d="M17.8 9.8L15.4 4 20 8.5v7L15.5 20h-7L4 15.5v-7L8.5 4h7l2.3 5.8zm0 0l2.2 5.7-2.3-5.8zM13 17v-2h-2v2h2zm0-4V7h-2v6h2z" fill-rule="evenodd"/></svg>',
'ordered-list-rtl': '<svg width="24" height="24"><path d="M6 17h8a1 1 0 010 2H6a1 1 0 010-2zm0-6h8a1 1 0 010 2H6a1 1 0 010-2zm0-6h8a1 1 0 010 2H6a1 1 0 110-2zm13-1v3.5a.5.5 0 11-1 0V5h-.5a.5.5 0 110-1H19zm-1 8.8l.2.2h1.3a.5.5 0 110 1h-1.6a1 1 0 01-.9-1V13c0-.4.3-.8.6-1l1.2-.4.2-.3a.2.2 0 00-.2-.2h-1.3a.5.5 0 01-.5-.5c0-.3.2-.5.5-.5h1.6c.5 0 .9.4.9 1v.1c0 .4-.3.8-.6 1l-1.2.4-.2.3zm2 4.2v2c0 .6-.4 1-1 1h-1.5a.5.5 0 010-1h1.2a.3.3 0 100-.6h-1.3a.4.4 0 110-.8h1.3a.3.3 0 000-.6h-1.2a.5.5 0 110-1H19c.6 0 1 .4 1 1z" fill-rule="evenodd"/></svg>',
'ordered-list': '<svg width="24" height="24"><path d="M10 17h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 110-2zM6 4v3.5c0 .3-.2.5-.5.5a.5.5 0 01-.5-.5V5h-.5a.5.5 0 010-1H6zm-1 8.8l.2.2h1.3c.3 0 .5.2.5.5s-.2.5-.5.5H4.9a1 1 0 01-.9-1V13c0-.4.3-.8.6-1l1.2-.4.2-.3a.2.2 0 00-.2-.2H4.5a.5.5 0 01-.5-.5c0-.3.2-.5.5-.5h1.6c.5 0 .9.4.9 1v.1c0 .4-.3.8-.6 1l-1.2.4-.2.3zM7 17v2c0 .6-.4 1-1 1H4.5a.5.5 0 010-1h1.2c.2 0 .3-.1.3-.3 0-.2-.1-.3-.3-.3H4.4a.4.4 0 110-.8h1.3c.2 0 .3-.1.3-.3 0-.2-.1-.3-.3-.3H4.5a.5.5 0 110-1H6c.6 0 1 .4 1 1z" fill-rule="evenodd"/></svg>',
'orientation': '<svg width="24" height="24"><path d="M7.3 6.4L1 13l6.4 6.5 6.5-6.5-6.5-6.5zM3.7 13l3.6-3.7L11 13l-3.7 3.7-3.6-3.7zM12 6l2.8 2.7c.3.3.3.8 0 1-.3.4-.9.4-1.2 0L9.2 5.7a.8.8 0 010-1.2L13.6.2c.3-.3.9-.3 1.2 0 .3.3.3.8 0 1.1L12 4h1a9 9 0 11-4.3 16.9l1.5-1.5A7 7 0 1013 6h-1z" fill-rule="nonzero"/></svg>',
'outdent': '<svg width="24" height="24"><path d="M7 5h12c.6 0 1 .4 1 1s-.4 1-1 1H7a1 1 0 110-2zm5 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 010-2zm0 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 010-2zm-5 4h12a1 1 0 010 2H7a1 1 0 010-2zm1.6-3.8a1 1 0 01-1.2 1.6l-3-2a1 1 0 010-1.6l3-2a1 1 0 011.2 1.6L6.8 12l1.8 1.2z" fill-rule="evenodd"/></svg>',
'page-break': '<svg width="24" height="24"><g fill-rule="evenodd"><path d="M5 11c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 010-2zm3 0h1c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 010-2zm4 0c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 010-2zm3 0h1c.6 0 1 .4 1 1s-.4 1-1 1h-1a1 1 0 010-2zm4 0c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 010-2zM7 3v5h10V3c0-.6.4-1 1-1s1 .4 1 1v7H5V3c0-.6.4-1 1-1s1 .4 1 1zM6 22a1 1 0 01-1-1v-7h14v7c0 .6-.4 1-1 1a1 1 0 01-1-1v-5H7v5c0 .6-.4 1-1 1z"/></g></svg>',
'paragraph': '<svg width="24" height="24"><path fill-rule="evenodd" d="M10 5h7a1 1 0 010 2h-1v11a1 1 0 01-2 0V7h-2v11a1 1 0 01-2 0v-6c-.5 0-1 0-1.4-.3A3.4 3.4 0 016.8 10a3.3 3.3 0 010-2.8 3.4 3.4 0 011.8-1.8L10 5z"/></svg>',
'paste-column-after': '<svg width="24" height="24"><path fill-rule="evenodd" d="M12 1a3 3 0 012.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 01-1-1V5H6v13h7v2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2H9.2A3 3 0 0112 1zm8 7v12h-6V8h6zm-1.5 1.5h-3v9h3v-9zM12 3a1 1 0 100 2 1 1 0 000-2z"/></svg>',
'paste-column-before': '<svg width="24" height="24"><path fill-rule="evenodd" d="M12 1a3 3 0 012.8 2H18c1 0 2 .8 2 1.9V18c0 1-.8 2-1.9 2H11v-2h7V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 01-1-1V5H6v2H4V5c0-1 .8-2 1.9-2H9.2A3 3 0 0112 1zm-2 7v12H4V8h6zM8.5 9.5h-3v9h3v-9zM12 3a1 1 0 100 2 1 1 0 000-2z"/></svg>',
'paste-row-after': '<svg width="24" height="24"><path fill-rule="evenodd" d="M12 1a3 3 0 012.8 2H18c1 0 2 .8 2 1.9V11h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 01-1-1V5H6v13h14c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2H9.2A3 3 0 0112 1zm10 11v5H8v-5h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 100 2 1 1 0 000-2z"/></svg>',
'paste-row-before': '<svg width="24" height="24"><path fill-rule="evenodd" d="M12 1a3 3 0 012.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 01-1-1V5H6v13h12v-4h2v4c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2H9.2A3 3 0 0112 1zm10 7v5H8V8h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 100 2 1 1 0 000-2z"/></svg>',
'paste-text': '<svg width="24" height="24"><path d="M18 9V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 01-1-1V5H6v13h3V9h9zM9 20H6a2 2 0 01-2-2V5c0-1.1.9-2 2-2h3.2A3 3 0 0112 1a3 3 0 012.8 2H18a2 2 0 012 2v4h1v12H9v-1zm1.5-9.5v9h9v-9h-9zM12 3a1 1 0 00-1 1c0 .5.4 1 1 1s1-.5 1-1-.4-1-1-1zm0 9h6v2h-.5l-.5-1h-1v4h.8v1h-3.6v-1h.8v-4h-1l-.5 1H12v-2z" fill-rule="nonzero"/></svg>',
'paste': '<svg width="24" height="24"><path d="M18 9V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 01-1-1V5H6v13h3V9h9zM9 20H6a2 2 0 01-2-2V5c0-1.1.9-2 2-2h3.2A3 3 0 0112 1a3 3 0 012.8 2H18a2 2 0 012 2v4h1v12H9v-1zm1.5-9.5v9h9v-9h-9zM12 3a1 1 0 00-1 1c0 .5.4 1 1 1s1-.5 1-1-.4-1-1-1z" fill-rule="nonzero"/></svg>',
'permanent-pen': '<svg width="24" height="24"><path d="M10.5 17.5L8 20H3v-3l3.5-3.5a2 2 0 010-3L14 3l1 1-7.3 7.3a1 1 0 000 1.4l3.6 3.6c.4.4 1 .4 1.4 0L20 9l1 1-7.6 7.6a2 2 0 01-2.8 0l-.1-.1z" fill-rule="nonzero"/></svg>',
'plus': '<svg width="24" height="24"><path d="M12 4c.5 0 1 .4 1 .9V11h6a1 1 0 01.1 2H13v6a1 1 0 01-2 .1V13H5a1 1 0 01-.1-2H11V5c0-.6.4-1 1-1z"/></svg>',
'preferences': '<svg width="24" height="24"><path d="M20.1 13.5l-1.9.2a5.8 5.8 0 01-.6 1.5l1.2 1.5c.4.4.3 1 0 1.4l-.7.7a1 1 0 01-1.4 0l-1.5-1.2a6.2 6.2 0 01-1.5.6l-.2 1.9c0 .5-.5.9-1 .9h-1a1 1 0 01-1-.9l-.2-1.9a5.8 5.8 0 01-1.5-.6l-1.5 1.2a1 1 0 01-1.4 0l-.7-.7a1 1 0 010-1.4l1.2-1.5a6.2 6.2 0 01-.6-1.5l-1.9-.2a1 1 0 01-.9-1v-1c0-.5.4-1 .9-1l1.9-.2a5.8 5.8 0 01.6-1.5L5.2 7.3a1 1 0 010-1.4l.7-.7a1 1 0 011.4 0l1.5 1.2a6.2 6.2 0 011.5-.6l.2-1.9c0-.5.5-.9 1-.9h1c.5 0 1 .4 1 .9l.2 1.9a5.8 5.8 0 011.5.6l1.5-1.2a1 1 0 011.4 0l.7.7c.3.4.4 1 0 1.4l-1.2 1.5a6.2 6.2 0 01.6 1.5l1.9.2c.5 0 .9.5.9 1v1c0 .5-.4 1-.9 1zM12 15a3 3 0 100-6 3 3 0 000 6z" fill-rule="evenodd"/></svg>',
'preview': '<svg width="24" height="24"><path d="M3.5 12.5c.5.8 1.1 1.6 1.8 2.3 2 2 4.2 3.2 6.7 3.2s4.7-1.2 6.7-3.2a16.2 16.2 0 002.1-2.8 15.7 15.7 0 00-2.1-2.8c-2-2-4.2-3.2-6.7-3.2a9.3 9.3 0 00-6.7 3.2A16.2 16.2 0 003.2 12c0 .2.2.3.3.5zm-2.4-1l.7-1.2L4 7.8C6.2 5.4 8.9 4 12 4c3 0 5.8 1.4 8.1 3.8a18.2 18.2 0 012.8 3.7v1l-.7 1.2-2.1 2.5c-2.3 2.4-5 3.8-8.1 3.8-3 0-5.8-1.4-8.1-3.8a18.2 18.2 0 01-2.8-3.7 1 1 0 010-1zm12-3.3a2 2 0 102.7 2.6 4 4 0 11-2.6-2.6z" fill-rule="nonzero"/></svg>',
'print': '<svg width="24" height="24"><path d="M18 8H6a3 3 0 00-3 3v6h2v3h14v-3h2v-6a3 3 0 00-3-3zm-1 10H7v-4h10v4zm.5-5c-.8 0-1.5-.7-1.5-1.5s.7-1.5 1.5-1.5 1.5.7 1.5 1.5-.7 1.5-1.5 1.5zm.5-8H6v2h12V5z" fill-rule="nonzero"/></svg>',
'quote': '<svg width="24" height="24"><path d="M7.5 17h.9c.4 0 .7-.2.9-.6L11 13V8c0-.6-.4-1-1-1H6a1 1 0 00-1 1v4c0 .6.4 1 1 1h2l-1.3 2.7a1 1 0 00.8 1.3zm8 0h.9c.4 0 .7-.2.9-.6L19 13V8c0-.6-.4-1-1-1h-4a1 1 0 00-1 1v4c0 .6.4 1 1 1h2l-1.3 2.7a1 1 0 00.8 1.3z" fill-rule="nonzero"/></svg>',
'redo': '<svg width="24" height="24"><path d="M17.6 10H12c-2.8 0-4.4 1.4-4.9 3.5-.4 2 .3 4 1.4 4.6a1 1 0 11-1 1.8c-2-1.2-2.9-4.1-2.3-6.8.6-3 3-5.1 6.8-5.1h5.6l-3.3-3.3a1 1 0 111.4-1.4l5 5a1 1 0 010 1.4l-5 5a1 1 0 01-1.4-1.4l3.3-3.3z" fill-rule="nonzero"/></svg>',
'reload': '<svg width="24" height="24"><g fill-rule="nonzero"><path d="M5 22.1l-1.2-4.7v-.2a1 1 0 011-1l5 .4a1 1 0 11-.2 2l-2.2-.2a7.8 7.8 0 008.4.2 7.5 7.5 0 003.5-6.4 1 1 0 112 0 9.5 9.5 0 01-4.5 8 9.9 9.9 0 01-10.2 0l.4 1.4a1 1 0 11-2 .5zM13.6 7.4c0-.5.5-1 1-.9l2.8.2a8 8 0 00-9.5-1 7.5 7.5 0 00-3.6 7 1 1 0 01-2 0 9.5 9.5 0 014.5-8.6 10 10 0 0110.9.3l-.3-1a1 1 0 012-.5l1.1 4.8a1 1 0 01-1 1.2l-5-.4a1 1 0 01-.9-1z"/></g></svg>',
'remove-formatting': '<svg width="24" height="24"><path d="M13.2 6a1 1 0 010 .2l-2.6 10a1 1 0 01-1 .8h-.2a.8.8 0 01-.8-1l2.6-10H8a1 1 0 110-2h9a1 1 0 010 2h-3.8zM5 18h7a1 1 0 010 2H5a1 1 0 010-2zm13 1.5L16.5 18 15 19.5a.7.7 0 01-1-1l1.5-1.5-1.5-1.5a.7.7 0 011-1l1.5 1.5 1.5-1.5a.7.7 0 011 1L17.5 17l1.5 1.5a.7.7 0 01-1 1z" fill-rule="evenodd"/></svg>',
'remove': '<svg width="24" height="24"><path d="M16 7h3a1 1 0 010 2h-1v9a3 3 0 01-3 3H9a3 3 0 01-3-3V9H5a1 1 0 110-2h3V6a3 3 0 013-3h2a3 3 0 013 3v1zm-2 0V6c0-.6-.4-1-1-1h-2a1 1 0 00-1 1v1h4zm2 2H8v9c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V9zm-7 3a1 1 0 012 0v4a1 1 0 01-2 0v-4zm4 0a1 1 0 012 0v4a1 1 0 01-2 0v-4z" fill-rule="nonzero"/></svg>',
'resize-handle': '<svg width="10" height="10"><g fill-rule="nonzero"><path d="M8.1 1.1A.5.5 0 119 2l-7 7A.5.5 0 111 8l7-7zM8.1 5.1A.5.5 0 119 6l-3 3A.5.5 0 115 8l3-3z"/></g></svg>',
'resize': '<svg width="24" height="24"><path d="M4 5c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h6c.3 0 .5.1.7.3.2.2.3.4.3.7 0 .3-.1.5-.3.7a1 1 0 01-.7.3H7.4L18 16.6V13c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3.3 0 .5.1.7.3.2.2.3.4.3.7v6c0 .3-.1.5-.3.7a1 1 0 01-.7.3h-6a1 1 0 01-.7-.3 1 1 0 01-.3-.7c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h3.6L6 7.4V11c0 .3-.1.5-.3.7a1 1 0 01-.7.3 1 1 0 01-.7-.3A1 1 0 014 11V5z" fill-rule="evenodd"/></svg>',
'restore-draft': '<svg width="24" height="24"><g fill-rule="evenodd"><path d="M17 13c0 .6-.4 1-1 1h-4V8c0-.6.4-1 1-1s1 .4 1 1v4h2c.6 0 1 .4 1 1z"/><path d="M4.7 10H9a1 1 0 010 2H3a1 1 0 01-1-1V5a1 1 0 112 0v3l2.5-2.4a9.2 9.2 0 0110.8-1.5A9 9 0 0113.4 21c-2.4.1-4.7-.7-6.5-2.2a1 1 0 111.3-1.5 7.2 7.2 0 0011.6-3.7 7 7 0 00-3.5-7.7A7.2 7.2 0 008 7L4.7 10z" fill-rule="nonzero"/></g></svg>',
'rotate-left': '<svg width="24" height="24"><path d="M4.7 10H9a1 1 0 010 2H3a1 1 0 01-1-1V5a1 1 0 112 0v3l2.5-2.4a9.2 9.2 0 0110.8-1.5A9 9 0 0113.4 21c-2.4.1-4.7-.7-6.5-2.2a1 1 0 111.3-1.5 7.2 7.2 0 0011.6-3.7 7 7 0 00-3.5-7.7A7.2 7.2 0 008 7L4.7 10z" fill-rule="nonzero"/></svg>',
'rotate-right': '<svg width="24" height="24"><path d="M20 8V5a1 1 0 012 0v6c0 .6-.4 1-1 1h-6a1 1 0 010-2h4.3L16 7A7.2 7.2 0 007.7 6a7 7 0 003 13.1c1.9.1 3.7-.5 5-1.7a1 1 0 011.4 1.5A9.2 9.2 0 012.2 14c-.9-3.9 1-8 4.5-9.9 3.5-1.9 8-1.3 10.8 1.5L20 8z" fill-rule="nonzero"/></svg>',
'rtl': '<svg width="24" height="24"><path d="M8 5h8v2h-2v12h-2V7h-2v12H8v-7c-.5 0-1 0-1.4-.3A3.4 3.4 0 014.8 10a3.3 3.3 0 010-2.8 3.4 3.4 0 011.8-1.8L8 5zm12 11.2a1 1 0 11-1 1.6l-3-2a1 1 0 010-1.6l3-2a1 1 0 111 1.6L18.4 15l1.8 1.2z" fill-rule="evenodd"/></svg>',
'save': '<svg width="24" height="24"><path d="M5 16h14a2 2 0 012 2v2a2 2 0 01-2 2H5a2 2 0 01-2-2v-2c0-1.1.9-2 2-2zm0 2v2h14v-2H5zm10 0h2v2h-2v-2zm-4-6.4L8.7 9.3a1 1 0 10-1.4 1.4l4 4c.4.4 1 .4 1.4 0l4-4a1 1 0 10-1.4-1.4L13 11.6V4a1 1 0 00-2 0v7.6z" fill-rule="nonzero"/></svg>',
'search': '<svg width="24" height="24"><path d="M16 17.3a8 8 0 111.4-1.4l4.3 4.4a1 1 0 01-1.4 1.4l-4.4-4.3zm-5-.3a6 6 0 100-12 6 6 0 000 12z" fill-rule="nonzero"/></svg>',
'select-all': '<svg width="24" height="24"><path d="M3 5h2V3a2 2 0 00-2 2zm0 8h2v-2H3v2zm4 8h2v-2H7v2zM3 9h2V7H3v2zm10-6h-2v2h2V3zm6 0v2h2a2 2 0 00-2-2zM5 21v-2H3c0 1.1.9 2 2 2zm-2-4h2v-2H3v2zM9 3H7v2h2V3zm2 18h2v-2h-2v2zm8-8h2v-2h-2v2zm0 8a2 2 0 002-2h-2v2zm0-12h2V7h-2v2zm0 8h2v-2h-2v2zm-4 4h2v-2h-2v2zm0-16h2V3h-2v2zM7 17h10V7H7v10zm2-8h6v6H9V9z" fill-rule="nonzero"/></svg>',
'selected': '<svg width="24" height="24"><path fill-rule="nonzero" d="M6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6c0-1.1.9-2 2-2zm3.6 10.9L7 12.3a.7.7 0 00-1 1L9.6 17 18 8.6a.7.7 0 000-1 .7.7 0 00-1 0l-7.4 7.3z"/></svg>',
'settings': '<svg width="24" height="24"><path d="M11 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8v.3c0 .2 0 .3-.2.5l-.6.2H7.8c-.3 0-.4 0-.6-.2a.7.7 0 01-.2-.6V8H5a1 1 0 110-2h2v-.3c0-.2 0-.3.2-.5l.5-.2h2.5c.3 0 .4 0 .6.2l.2.5V6zM8 8h2V6H8v2zm9 2.8v.2h2c.6 0 1 .4 1 1s-.4 1-1 1h-2v.3c0 .2 0 .3-.2.5l-.6.2h-2.4c-.3 0-.4 0-.6-.2a.7.7 0 01-.2-.6V13H5a1 1 0 010-2h8v-.3c0-.2 0-.3.2-.5l.6-.2h2.4c.3 0 .4 0 .6.2l.2.6zM14 13h2v-2h-2v2zm-3 2.8v.2h8c.6 0 1 .4 1 1s-.4 1-1 1h-8v.3c0 .2 0 .3-.2.5l-.6.2H7.8c-.3 0-.4 0-.6-.2a.7.7 0 01-.2-.6V18H5a1 1 0 010-2h2v-.3c0-.2 0-.3.2-.5l.5-.2h2.5c.3 0 .4 0 .6.2l.2.6zM8 18h2v-2H8v2z" fill-rule="evenodd"/></svg>',
'sharpen': '<svg width="24" height="24"><path d="M16 6l4 4-8 9-8-9 4-4h8zm-4 10.2l5.5-6.2-.1-.1H12v-.3h5.1l-.2-.2H12V9h4.6l-.2-.2H12v-.3h4.1l-.2-.2H12V8h3.6l-.2-.2H8.7L6.5 10l.1.1H12v.3H6.9l.2.2H12v.3H7.3l.2.2H12v.3H7.7l.3.2h4v.3H8.2l.2.2H12v.3H8.6l.3.2H12v.3H9l.3.2H12v.3H9.5l.2.2H12v.3h-2l.2.2H12v.3h-1.6l.2.2H12v.3h-1.1l.2.2h.9v.3h-.7l.2.2h.5v.3h-.3l.3.2z" fill-rule="evenodd"/></svg>',
'sourcecode': '<svg width="24" height="24"><g fill-rule="nonzero"><path d="M9.8 15.7c.3.3.3.8 0 1-.3.4-.9.4-1.2 0l-4.4-4.1a.8.8 0 010-1.2l4.4-4.2c.3-.3.9-.3 1.2 0 .3.3.3.8 0 1.1L6 12l3.8 3.7zM14.2 15.7c-.3.3-.3.8 0 1 .4.4.9.4 1.2 0l4.4-4.1c.3-.3.3-.9 0-1.2l-4.4-4.2a.8.8 0 00-1.2 0c-.3.3-.3.8 0 1.1L18 12l-3.8 3.7z"/></g></svg>',
'spell-check': '<svg width="24" height="24"><path d="M6 8v3H5V5c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h2c.3 0 .5.1.7.3.2.2.3.4.3.7v6H8V8H6zm0-3v2h2V5H6zm13 0h-3v5h3v1h-3a1 1 0 01-.7-.3 1 1 0 01-.3-.7V5c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h3v1zm-5 1.5l-.1.7c-.1.2-.3.3-.6.3.3 0 .5.1.6.3l.1.7V10c0 .3-.1.5-.3.7a1 1 0 01-.7.3h-3V4h3c.3 0 .5.1.7.3.2.2.3.4.3.7v1.5zM13 10V8h-2v2h2zm0-3V5h-2v2h2zm3 5l1 1-6.5 7L7 15.5l1.3-1 2.2 2.2L16 12z" fill-rule="evenodd"/></svg>',
'strike-through': '<svg width="24" height="24"><g fill-rule="evenodd"><path d="M15.6 8.5c-.5-.7-1-1.1-1.3-1.3-.6-.4-1.3-.6-2-.6-2.7 0-2.8 1.7-2.8 2.1 0 1.6 1.8 2 3.2 2.3 4.4.9 4.6 2.8 4.6 3.9 0 1.4-.7 4.1-5 4.1A6.2 6.2 0 017 16.4l1.5-1.1c.4.6 1.6 2 3.7 2 1.6 0 2.5-.4 3-1.2.4-.8.3-2-.8-2.6-.7-.4-1.6-.7-2.9-1-1-.2-3.9-.8-3.9-3.6C7.6 6 10.3 5 12.4 5c2.9 0 4.2 1.6 4.7 2.4l-1.5 1.1z"/><path d="M5 11h14a1 1 0 010 2H5a1 1 0 010-2z" fill-rule="nonzero"/></g></svg>',
'subscript': '<svg width="24" height="24"><path d="M10.4 10l4.6 4.6-1.4 1.4L9 11.4 4.4 16 3 14.6 7.6 10 3 5.4 4.4 4 9 8.6 13.6 4 15 5.4 10.4 10zM21 19h-5v-1l1-.8 1.7-1.6c.3-.4.5-.8.5-1.2 0-.3 0-.6-.2-.7-.2-.2-.5-.3-.9-.3a2 2 0 00-.8.2l-.7.3-.4-1.1 1-.6 1.2-.2c.8 0 1.4.3 1.8.7.4.4.6.9.6 1.5s-.2 1.1-.5 1.6a8 8 0 01-1.3 1.3l-.6.6h2.6V19z" fill-rule="nonzero"/></svg>',
'superscript': '<svg width="24" height="24"><path d="M15 9.4L10.4 14l4.6 4.6-1.4 1.4L9 15.4 4.4 20 3 18.6 7.6 14 3 9.4 4.4 8 9 12.6 13.6 8 15 9.4zm5.9 1.6h-5v-1l1-.8 1.7-1.6c.3-.5.5-.9.5-1.3 0-.3 0-.5-.2-.7-.2-.2-.5-.3-.9-.3l-.8.2-.7.4-.4-1.2c.2-.2.5-.4 1-.5.3-.2.8-.2 1.2-.2.8 0 1.4.2 1.8.6.4.4.6 1 .6 1.6 0 .5-.2 1-.5 1.5l-1.3 1.4-.6.5h2.6V11z" fill-rule="nonzero"/></svg>',
'table-cell-properties': '<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zm-8 9H5v5h6v-5zm8 0h-6v5h6v-5zm-8-7H5v5h6V6z"/></svg>',
'table-cell-select-all': '<svg width="24" height="24"><g fill-rule="evenodd"><path fill-rule="nonzero" d="M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zm0 2H5v12h14V6z"/><path d="M13 6v5h6v2h-6v5h-2v-5H5v-2h6V6h2z" opacity=".2"/></g></svg>',
'table-cell-select-inner': '<svg width="24" height="24"><g fill-rule="evenodd"><path fill-rule="nonzero" d="M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zm0 2H5v12h14V6z" opacity=".2"/><path d="M13 6v5h6v2h-6v5h-2v-5H5v-2h6V6h2z"/></g></svg>',
'table-delete-column': '<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zm-4 4h-2V6h-2v2H9V6H5v12h4v-2h2v2h2v-2h2v2h4V6h-4v2zm.3.5l1 1.2-3 2.3 3 2.3-1 1.2L12 13l-3.3 2.6-1-1.2 3-2.3-3-2.3 1-1.2L12 11l3.3-2.5z"/></svg>',
'table-delete-row': '<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zm0 2H5v3h2.5v2H5v2h2.5v2H5v3h14v-3h-2.5v-2H19v-2h-2.5V9H19V6zm-4.7 1.8l1.2 1L13 12l2.6 3.3-1.2 1-2.3-3-2.3 3-1.2-1L11 12 8.5 8.7l1.2-1 2.3 3 2.3-3z"/></svg>',
'table-delete-table': '<svg width="24" height="24"><g fill-rule="nonzero"><path d="M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zM5 6v12h14V6H5z"/><path d="M14.4 8.6l1 1-2.3 2.4 2.3 2.4-1 1-2.4-2.3-2.4 2.3-1-1 2.3-2.4-2.3-2.4 1-1 2.4 2.3z"/></g></svg>',
'table-insert-column-after': '<svg width="24" height="24"><path fill-rule="nonzero" d="M20 4c.6 0 1 .4 1 1v2a1 1 0 01-2 0V6h-8v12h8v-1a1 1 0 012 0v2c0 .5-.4 1-.9 1H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h15zM9 13H5v5h4v-5zm7-5c.5 0 1 .4 1 .9V11h2a1 1 0 01.1 2H17v2a1 1 0 01-2 .1V13h-2a1 1 0 01-.1-2H15V9c0-.6.4-1 1-1zM9 6H5v5h4V6z"/></svg>',
'table-insert-column-before': '<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 012 2v12a2 2 0 01-2 2H4a1 1 0 01-1-1v-2a1 1 0 012 0v1h8V6H5v1a1 1 0 11-2 0V5c0-.6.4-1 1-1h15zm0 9h-4v5h4v-5zM8 8c.5 0 1 .4 1 .9V11h2a1 1 0 01.1 2H9v2a1 1 0 01-2 .1V13H5a1 1 0 01-.1-2H7V9c0-.6.4-1 1-1zm11-2h-4v5h4V6z"/></svg>',
'table-insert-row-above': '<svg width="24" height="24"><path fill-rule="nonzero" d="M6 4a1 1 0 110 2H5v6h14V6h-1a1 1 0 010-2h2c.6 0 1 .4 1 1v13a2 2 0 01-2 2H5a2 2 0 01-2-2V5c0-.6.4-1 1-1h2zm5 10H5v4h6v-4zm8 0h-6v4h6v-4zM12 3c.5 0 1 .4 1 .9V6h2a1 1 0 010 2h-2v2a1 1 0 01-2 .1V8H9a1 1 0 010-2h2V4c0-.6.4-1 1-1z"/></svg>',
'table-insert-row-after': '<svg width="24" height="24"><path fill-rule="nonzero" d="M12 13c.5 0 1 .4 1 .9V16h2a1 1 0 01.1 2H13v2a1 1 0 01-2 .1V18H9a1 1 0 01-.1-2H11v-2c0-.6.4-1 1-1zm6 7a1 1 0 010-2h1v-6H5v6h1a1 1 0 010 2H4a1 1 0 01-1-1V6c0-1.1.9-2 2-2h14a2 2 0 012 2v13c0 .5-.4 1-.9 1H18zM11 6H5v4h6V6zm8 0h-6v4h6V6z"/></svg>',
'table-left-header': '<svg width="24" height="24"><path d="M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zm0 9h-4v5h4v-5zm-6 0H9v5h4v-5zm0-7H9v5h4V6zm6 0h-4v5h4V6z"/></svg>',
'table-merge-cells': '<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zM5 15.5V18h3v-2.5H5zm14-5h-9V18h9v-7.5zM19 6h-4v2.5h4V6zM8 6H5v2.5h3V6zm5 0h-3v2.5h3V6zm-8 7.5h3v-3H5v3z"/></svg>',
'table-row-properties': '<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zM5 15v3h6v-3H5zm14 0h-6v3h6v-3zm0-9h-6v3h6V6zM5 9h6V6H5v3z"/></svg>',
'table-split-cells': '<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zM8 15.5H5V18h3v-2.5zm11-5h-9V18h9v-7.5zm-2.5 1l1 1-2 2 2 2-1 1-2-2-2 2-1-1 2-2-2-2 1-1 2 2 2-2zm-8.5-1H5v3h3v-3zM19 6h-4v2.5h4V6zM8 6H5v2.5h3V6zm5 0h-3v2.5h3V6z"/></svg>',
'table-top-header': '<svg width="24" height="24"><path d="M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zm-8 11H5v3h6v-3zm8 0h-6v3h6v-3zm0-5h-6v3h6v-3zM5 13h6v-3H5v3z"/></svg>',
'table': '<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zM5 14v4h6v-4H5zm14 0h-6v4h6v-4zm0-6h-6v4h6V8zM5 12h6V8H5v4z"/></svg>',
'template': '<svg width="24" height="24"><path d="M19 19v-1H5v1h14zM9 16v-4a5 5 0 116 0v4h4a2 2 0 012 2v3H3v-3c0-1.1.9-2 2-2h4zm4 0v-5l.8-.6a3 3 0 10-3.6 0l.8.6v5h2z" fill-rule="nonzero"/></svg>',
'temporary-placeholder': '<svg width="24" height="24"><g fill-rule="evenodd"><path d="M9 7.6V6h2.5V4.5a.5.5 0 111 0V6H15v1.6a8 8 0 11-6 0zm-2.6 5.3a.5.5 0 00.3.6c.3 0 .6 0 .6-.3l.1-.2a5 5 0 013.3-2.8c.3-.1.4-.4.4-.6-.1-.3-.4-.5-.6-.4a6 6 0 00-4.1 3.7z"/><circle cx="14" cy="4" r="1"/><circle cx="12" cy="2" r="1"/><circle cx="10" cy="4" r="1"/></g></svg>',
'text-color': '<svg width="24" height="24"><g fill-rule="evenodd"><path id="tox-icon-text-color__color" d="M3 18h18v3H3z"/><path d="M8.7 16h-.8a.5.5 0 01-.5-.6l2.7-9c.1-.3.3-.4.5-.4h2.8c.2 0 .4.1.5.4l2.7 9a.5.5 0 01-.5.6h-.8a.5.5 0 01-.4-.4l-.7-2.2c0-.3-.3-.4-.5-.4h-3.4c-.2 0-.4.1-.5.4l-.7 2.2c0 .3-.2.4-.4.4zm2.6-7.6l-.6 2a.5.5 0 00.5.6h1.6a.5.5 0 00.5-.6l-.6-2c0-.3-.3-.4-.5-.4h-.4c-.2 0-.4.1-.5.4z"/></g></svg>',
'toc': '<svg width="24" height="24"><path d="M5 5c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 110-2zm3 0h11c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 110-2zm-3 8c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 010-2zm3 0h11c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 010-2zm0-4c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 110-2zm3 0h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm-3 8c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 010-2zm3 0h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2z" fill-rule="evenodd"/></svg>',
'translate': '<svg width="24" height="24"><path d="M12.7 14.3l-.3.7-.4.7-2.2-2.2-3.1 3c-.3.4-.8.4-1 0a.7.7 0 010-1l3.1-3A12.4 12.4 0 016.7 9H8a10.1 10.1 0 001.7 2.4c.5-.5 1-1.1 1.4-1.8l.9-2H4.7a.7.7 0 110-1.5h4.4v-.7c0-.4.3-.8.7-.8.4 0 .7.4.7.8v.7H15c.4 0 .8.3.8.7 0 .4-.4.8-.8.8h-1.4a12.3 12.3 0 01-1 2.4 13.5 13.5 0 01-1.7 2.3l1.9 1.8zm4.3-3l2.7 7.3a.5.5 0 01-.4.7 1 1 0 01-1-.7l-.6-1.5h-3.4l-.6 1.5a1 1 0 01-1 .7.5.5 0 01-.4-.7l2.7-7.4a1 1 0 012 0zm-2.2 4.4h2.4L16 12.5l-1.2 3.2z" fill-rule="evenodd"/></svg>',
'underline': '<svg width="24" height="24"><path d="M16 5c.6 0 1 .4 1 1v5.5a4 4 0 01-.4 1.8l-1 1.4a5.3 5.3 0 01-5.5 1 5 5 0 01-1.6-1c-.5-.4-.8-.9-1.1-1.4a4 4 0 01-.4-1.8V6c0-.6.4-1 1-1s1 .4 1 1v5.5c0 .3 0 .6.2 1l.6.7a3.3 3.3 0 002.2.8 3.4 3.4 0 002.2-.8c.3-.2.4-.5.6-.8l.2-.9V6c0-.6.4-1 1-1zM8 17h8c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 010-2z" fill-rule="evenodd"/></svg>',
'undo': '<svg width="24" height="24"><path d="M6.4 8H12c3.7 0 6.2 2 6.8 5.1.6 2.7-.4 5.6-2.3 6.8a1 1 0 01-1-1.8c1.1-.6 1.8-2.7 1.4-4.6-.5-2.1-2.1-3.5-4.9-3.5H6.4l3.3 3.3a1 1 0 11-1.4 1.4l-5-5a1 1 0 010-1.4l5-5a1 1 0 011.4 1.4L6.4 8z" fill-rule="nonzero"/></svg>',
'unlink': '<svg width="24" height="24"><path d="M6.2 12.3a1 1 0 011.4 1.4l-2 2a2 2 0 102.6 2.8l4.8-4.8a1 1 0 000-1.4 1 1 0 111.4-1.3 2.9 2.9 0 010 4L9.6 20a3.9 3.9 0 01-5.5-5.5l2-2zm11.6-.6a1 1 0 01-1.4-1.4l2.1-2a2 2 0 10-2.7-2.8L11 10.3a1 1 0 000 1.4A1 1 0 119.6 13a2.9 2.9 0 010-4L14.4 4a3.9 3.9 0 015.5 5.5l-2 2zM7.6 6.3a.8.8 0 01-1 1.1L3.3 4.2a.7.7 0 111-1l3.2 3.1zM5.1 8.6a.8.8 0 010 1.5H3a.8.8 0 010-1.5H5zm5-3.5a.8.8 0 01-1.5 0V3a.8.8 0 011.5 0V5zm6 11.8a.8.8 0 011-1l3.2 3.2a.8.8 0 01-1 1L16 17zm-2.2 2a.8.8 0 011.5 0V21a.8.8 0 01-1.5 0V19zm5-3.5a.7.7 0 110-1.5H21a.8.8 0 010 1.5H19z" fill-rule="nonzero"/></svg>',
'unlock': '<svg width="24" height="24"><path d="M16 5c.8 0 1.5.3 2.1.9.6.6.9 1.3.9 2.1v3h-2V8a1 1 0 00-.3-.7A1 1 0 0016 7h-2a1 1 0 00-.7.3 1 1 0 00-.3.7v3h.3c.2 0 .3 0 .5.2l.2.6v7.4c0 .3 0 .4-.2.6l-.6.2H4.8c-.3 0-.4 0-.6-.2a.7.7 0 01-.2-.6v-7.4c0-.3 0-.4.2-.6l.5-.2H11V8c0-.8.3-1.5.9-2.1.6-.6 1.3-.9 2.1-.9h2z" fill-rule="evenodd"/></svg>',
'unordered-list': '<svg width="24" height="24"><path d="M11 5h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zM4.5 6c0-.4.1-.8.4-1 .3-.4.7-.5 1.1-.5.4 0 .8.1 1 .4.4.3.5.7.5 1.1 0 .4-.1.8-.4 1-.3.4-.7.5-1.1.5-.4 0-.8-.1-1-.4-.4-.3-.5-.7-.5-1.1zm0 6c0-.4.1-.8.4-1 .3-.4.7-.5 1.1-.5.4 0 .8.1 1 .4.4.3.5.7.5 1.1 0 .4-.1.8-.4 1-.3.4-.7.5-1.1.5-.4 0-.8-.1-1-.4-.4-.3-.5-.7-.5-1.1zm0 6c0-.4.1-.8.4-1 .3-.4.7-.5 1.1-.5.4 0 .8.1 1 .4.4.3.5.7.5 1.1 0 .4-.1.8-.4 1-.3.4-.7.5-1.1.5-.4 0-.8-.1-1-.4-.4-.3-.5-.7-.5-1.1z" fill-rule="evenodd"/></svg>',
'unselected': '<svg width="24" height="24"><path fill-rule="nonzero" d="M6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6c0-1.1.9-2 2-2zm0 1a1 1 0 00-1 1v12c0 .6.4 1 1 1h12c.6 0 1-.4 1-1V6c0-.6-.4-1-1-1H6z"/></svg>',
'upload': '<svg width="24" height="24"><path d="M18 19v-2a1 1 0 012 0v3c0 .6-.4 1-1 1H5a1 1 0 01-1-1v-3a1 1 0 012 0v2h12zM11 6.4L8.7 8.7a1 1 0 01-1.4-1.4l4-4a1 1 0 011.4 0l4 4a1 1 0 11-1.4 1.4L13 6.4V16a1 1 0 01-2 0V6.4z" fill-rule="nonzero"/></svg>',
'user': '<svg width="24" height="24"><path d="M12 24a12 12 0 110-24 12 12 0 010 24zm-8.7-5.3a11 11 0 0017.4 0C19.4 16.3 14.6 15 12 15c-2.6 0-7.4 1.3-8.7 3.7zM12 13c2.2 0 4-2 4-4.5S14.2 4 12 4 8 6 8 8.5 9.8 13 12 13z" fill-rule="nonzero"/></svg>',
'visualblocks': '<svg width="24" height="24"><path d="M9 19v2H7v-2h2zm-4 0v2a2 2 0 01-2-2h2zm8 0v2h-2v-2h2zm8 0a2 2 0 01-2 2v-2h2zm-4 0v2h-2v-2h2zM15 7a1 1 0 010 2v7a1 1 0 01-2 0V9h-1v7a1 1 0 01-2 0v-4a2.5 2.5 0 01-.2-5H15zM5 15v2H3v-2h2zm16 0v2h-2v-2h2zM5 11v2H3v-2h2zm16 0v2h-2v-2h2zM5 7v2H3V7h2zm16 0v2h-2V7h2zM5 3v2H3c0-1.1.9-2 2-2zm8 0v2h-2V3h2zm6 0a2 2 0 012 2h-2V3zM9 3v2H7V3h2zm8 0v2h-2V3h2z" fill-rule="evenodd"/></svg>',
'visualchars': '<svg width="24" height="24"><path d="M10 5h7a1 1 0 010 2h-1v11a1 1 0 01-2 0V7h-2v11a1 1 0 01-2 0v-6c-.5 0-1 0-1.4-.3A3.4 3.4 0 016.8 10a3.3 3.3 0 010-2.8 3.4 3.4 0 011.8-1.8L10 5z" fill-rule="evenodd"/></svg>',
'warning': '<svg width="24" height="24"><path d="M19.8 18.3c.2.5.3.9 0 1.2-.1.3-.5.5-1 .5H5.2c-.5 0-.9-.2-1-.5-.3-.3-.2-.7 0-1.2L11 4.7l.5-.5.5-.2c.2 0 .3 0 .5.2.2 0 .3.3.5.5l6.8 13.6zM12 18c.3 0 .5-.1.7-.3.2-.2.3-.4.3-.7a1 1 0 00-.3-.7 1 1 0 00-.7-.3 1 1 0 00-.7.3 1 1 0 00-.3.7c0 .3.1.5.3.7.2.2.4.3.7.3zm.7-3l.3-4a1 1 0 00-.3-.7 1 1 0 00-.7-.3 1 1 0 00-.7.3 1 1 0 00-.3.7l.3 4h1.4z" fill-rule="evenodd"/></svg>',
'zoom-in': '<svg width="24" height="24"><path d="M16 17.3a8 8 0 111.4-1.4l4.3 4.4a1 1 0 01-1.4 1.4l-4.4-4.3zm-5-.3a6 6 0 100-12 6 6 0 000 12zm-1-9a1 1 0 012 0v6a1 1 0 01-2 0V8zm-2 4a1 1 0 010-2h6a1 1 0 010 2H8z" fill-rule="nonzero"/></svg>',
'zoom-out': '<svg width="24" height="24"><path d="M16 17.3a8 8 0 111.4-1.4l4.3 4.4a1 1 0 01-1.4 1.4l-4.4-4.3zm-5-.3a6 6 0 100-12 6 6 0 000 12zm-3-5a1 1 0 010-2h6a1 1 0 010 2H8z" fill-rule="nonzero"/></svg>',
}
});
File diff suppressed because one or more lines are too long
@@ -0,0 +1,3 @@
This is where language files should be placed.
Please DO NOT translate these directly use this service: https://www.transifex.com/projects/p/tinymce/
@@ -0,0 +1,419 @@
tinymce.addI18n('zh_CN',{
"Redo": "\u91cd\u505a",
"Undo": "\u64a4\u9500",
"Cut": "\u526a\u5207",
"Copy": "\u590d\u5236",
"Paste": "\u7c98\u8d34",
"Select all": "\u5168\u9009",
"New document": "\u65b0\u6587\u4ef6",
"Ok": "\u786e\u5b9a",
"Cancel": "\u53d6\u6d88",
"Visual aids": "\u7f51\u683c\u7ebf",
"Bold": "\u7c97\u4f53",
"Italic": "\u659c\u4f53",
"Underline": "\u4e0b\u5212\u7ebf",
"Strikethrough": "\u5220\u9664\u7ebf",
"Superscript": "\u4e0a\u6807",
"Subscript": "\u4e0b\u6807",
"Clear formatting": "\u6e05\u9664\u683c\u5f0f",
"Align left": "\u5de6\u8fb9\u5bf9\u9f50",
"Align center": "\u4e2d\u95f4\u5bf9\u9f50",
"Align right": "\u53f3\u8fb9\u5bf9\u9f50",
"Justify": "\u4e24\u7aef\u5bf9\u9f50",
"Bullet list": "\u9879\u76ee\u7b26\u53f7",
"Numbered list": "\u7f16\u53f7\u5217\u8868",
"Decrease indent": "\u51cf\u5c11\u7f29\u8fdb",
"Increase indent": "\u589e\u52a0\u7f29\u8fdb",
"Close": "\u5173\u95ed",
"Formats": "\u683c\u5f0f",
"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.": "\u4f60\u7684\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u6253\u5f00\u526a\u8d34\u677f\uff0c\u8bf7\u4f7f\u7528Ctrl+X\/C\/V\u7b49\u5feb\u6377\u952e\u3002",
"Headers": "\u6807\u9898",
"Header 1": "\u6807\u98981",
"Header 2": "\u6807\u98982",
"Header 3": "\u6807\u98983",
"Header 4": "\u6807\u98984",
"Header 5": "\u6807\u98985",
"Header 6": "\u6807\u98986",
"Headings": "\u6807\u9898",
"Heading 1": "\u6807\u98981",
"Heading 2": "\u6807\u98982",
"Heading 3": "\u6807\u98983",
"Heading 4": "\u6807\u98984",
"Heading 5": "\u6807\u98985",
"Heading 6": "\u6807\u98986",
"Preformatted": "\u9884\u5148\u683c\u5f0f\u5316\u7684",
"Div": "Div",
"Pre": "Pre",
"Code": "\u4ee3\u7801",
"Paragraph": "\u6bb5\u843d",
"Blockquote": "\u5f15\u6587\u533a\u5757",
"Inline": "\u6587\u672c",
"Blocks": "\u57fa\u5757",
"Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.": "\u5f53\u524d\u4e3a\u7eaf\u6587\u672c\u7c98\u8d34\u6a21\u5f0f\uff0c\u518d\u6b21\u70b9\u51fb\u53ef\u4ee5\u56de\u5230\u666e\u901a\u7c98\u8d34\u6a21\u5f0f\u3002",
"Fonts": "\u5b57\u4f53",
"Font Sizes": "\u5b57\u53f7",
"Class": "\u7c7b\u578b",
"Browse for an image": "\u6d4f\u89c8\u56fe\u50cf",
"OR": "\u6216",
"Drop an image here": "\u62d6\u653e\u4e00\u5f20\u56fe\u50cf\u81f3\u6b64",
"Upload": "\u4e0a\u4f20",
"Block": "\u5757",
"Align": "\u5bf9\u9f50",
"Default": "\u9ed8\u8ba4",
"Circle": "\u7a7a\u5fc3\u5706",
"Disc": "\u5b9e\u5fc3\u5706",
"Square": "\u65b9\u5757",
"Lower Alpha": "\u5c0f\u5199\u82f1\u6587\u5b57\u6bcd",
"Lower Greek": "\u5c0f\u5199\u5e0c\u814a\u5b57\u6bcd",
"Lower Roman": "\u5c0f\u5199\u7f57\u9a6c\u5b57\u6bcd",
"Upper Alpha": "\u5927\u5199\u82f1\u6587\u5b57\u6bcd",
"Upper Roman": "\u5927\u5199\u7f57\u9a6c\u5b57\u6bcd",
"Anchor...": "\u951a\u70b9...",
"Name": "\u540d\u79f0",
"Id": "\u6807\u8bc6\u7b26",
"Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.": "\u6807\u8bc6\u7b26\u5e94\u8be5\u4ee5\u5b57\u6bcd\u5f00\u5934\uff0c\u540e\u8ddf\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u7834\u6298\u53f7\u3001\u70b9\u3001\u5192\u53f7\u6216\u4e0b\u5212\u7ebf\u3002",
"You have unsaved changes are you sure you want to navigate away?": "\u4f60\u8fd8\u6709\u6587\u6863\u5c1a\u672a\u4fdd\u5b58\uff0c\u786e\u5b9a\u8981\u79bb\u5f00\uff1f",
"Restore last draft": "\u6062\u590d\u4e0a\u6b21\u7684\u8349\u7a3f",
"Special character...": "\u7279\u6b8a\u5b57\u7b26...",
"Source code": "\u6e90\u4ee3\u7801",
"Insert\/Edit code sample": "\u63d2\u5165\/\u7f16\u8f91\u4ee3\u7801\u793a\u4f8b",
"Language": "\u8bed\u8a00",
"Code sample...": "\u793a\u4f8b\u4ee3\u7801...",
"Color Picker": "\u9009\u8272\u5668",
"R": "R",
"G": "G",
"B": "B",
"Left to right": "\u4ece\u5de6\u5230\u53f3",
"Right to left": "\u4ece\u53f3\u5230\u5de6",
"Emoticons...": "\u8868\u60c5\u7b26\u53f7...",
"Metadata and Document Properties": "\u5143\u6570\u636e\u548c\u6587\u6863\u5c5e\u6027",
"Title": "\u6807\u9898",
"Keywords": "\u5173\u952e\u8bcd",
"Description": "\u63cf\u8ff0",
"Robots": "\u673a\u5668\u4eba",
"Author": "\u4f5c\u8005",
"Encoding": "\u7f16\u7801",
"Fullscreen": "\u5168\u5c4f",
"Action": "\u64cd\u4f5c",
"Shortcut": "\u5feb\u6377\u952e",
"Help": "\u5e2e\u52a9",
"Address": "\u5730\u5740",
"Focus to menubar": "\u79fb\u52a8\u7126\u70b9\u5230\u83dc\u5355\u680f",
"Focus to toolbar": "\u79fb\u52a8\u7126\u70b9\u5230\u5de5\u5177\u680f",
"Focus to element path": "\u79fb\u52a8\u7126\u70b9\u5230\u5143\u7d20\u8def\u5f84",
"Focus to contextual toolbar": "\u79fb\u52a8\u7126\u70b9\u5230\u4e0a\u4e0b\u6587\u83dc\u5355",
"Insert link (if link plugin activated)": "\u63d2\u5165\u94fe\u63a5 (\u5982\u679c\u94fe\u63a5\u63d2\u4ef6\u5df2\u6fc0\u6d3b)",
"Save (if save plugin activated)": "\u4fdd\u5b58(\u5982\u679c\u4fdd\u5b58\u63d2\u4ef6\u5df2\u6fc0\u6d3b)",
"Find (if searchreplace plugin activated)": "\u67e5\u627e(\u5982\u679c\u67e5\u627e\u66ff\u6362\u63d2\u4ef6\u5df2\u6fc0\u6d3b)",
"Plugins installed ({0}):": "\u5df2\u5b89\u88c5\u63d2\u4ef6 ({0}):",
"Premium plugins:": "\u4f18\u79c0\u63d2\u4ef6\uff1a",
"Learn more...": "\u4e86\u89e3\u66f4\u591a...",
"You are using {0}": "\u4f60\u6b63\u5728\u4f7f\u7528 {0}",
"Plugins": "\u63d2\u4ef6",
"Handy Shortcuts": "\u5feb\u6377\u952e",
"Horizontal line": "\u6c34\u5e73\u5206\u5272\u7ebf",
"Insert\/edit image": "\u63d2\u5165\/\u7f16\u8f91\u56fe\u7247",
"Image description": "\u56fe\u7247\u63cf\u8ff0",
"Source": "\u5730\u5740",
"Dimensions": "\u5927\u5c0f",
"Constrain proportions": "\u4fdd\u6301\u7eb5\u6a2a\u6bd4",
"General": "\u666e\u901a",
"Advanced": "\u9ad8\u7ea7",
"Style": "\u6837\u5f0f",
"Vertical space": "\u5782\u76f4\u8fb9\u8ddd",
"Horizontal space": "\u6c34\u5e73\u8fb9\u8ddd",
"Border": "\u8fb9\u6846",
"Insert image": "\u63d2\u5165\u56fe\u7247",
"Image...": "\u56fe\u7247...",
"Image list": "\u56fe\u7247\u5217\u8868",
"Rotate counterclockwise": "\u9006\u65f6\u9488\u65cb\u8f6c",
"Rotate clockwise": "\u987a\u65f6\u9488\u65cb\u8f6c",
"Flip vertically": "\u5782\u76f4\u7ffb\u8f6c",
"Flip horizontally": "\u6c34\u5e73\u7ffb\u8f6c",
"Edit image": "\u7f16\u8f91\u56fe\u7247",
"Image options": "\u56fe\u7247\u9009\u9879",
"Zoom in": "\u653e\u5927",
"Zoom out": "\u7f29\u5c0f",
"Crop": "\u88c1\u526a",
"Resize": "\u8c03\u6574\u5927\u5c0f",
"Orientation": "\u65b9\u5411",
"Brightness": "\u4eae\u5ea6",
"Sharpen": "\u9510\u5316",
"Contrast": "\u5bf9\u6bd4\u5ea6",
"Color levels": "\u989c\u8272\u5c42\u6b21",
"Gamma": "\u4f3d\u9a6c\u503c",
"Invert": "\u53cd\u8f6c",
"Apply": "\u5e94\u7528",
"Back": "\u540e\u9000",
"Insert date\/time": "\u63d2\u5165\u65e5\u671f\/\u65f6\u95f4",
"Date\/time": "\u65e5\u671f\/\u65f6\u95f4",
"Insert\/Edit Link": "\u63d2\u5165\/\u7f16\u8f91\u94fe\u63a5",
"Insert\/edit link": "\u63d2\u5165\/\u7f16\u8f91\u94fe\u63a5",
"Text to display": "\u663e\u793a\u6587\u5b57",
"Url": "\u5730\u5740",
"Open link in...": "\u94fe\u63a5\u6253\u5f00\u4f4d\u7f6e...",
"Current window": "\u5f53\u524d\u7a97\u53e3",
"None": "\u65e0",
"New window": "\u5728\u65b0\u7a97\u53e3\u6253\u5f00",
"Remove link": "\u5220\u9664\u94fe\u63a5",
"Anchors": "\u951a\u70b9",
"Link...": "\u94fe\u63a5...",
"Paste or type a link": "\u7c98\u8d34\u6216\u8f93\u5165\u94fe\u63a5",
"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?": "\u4f60\u6240\u586b\u5199\u7684URL\u5730\u5740\u4e3a\u90ae\u4ef6\u5730\u5740\uff0c\u9700\u8981\u52a0\u4e0amailto:\u524d\u7f00\u5417\uff1f",
"The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?": "\u4f60\u6240\u586b\u5199\u7684URL\u5730\u5740\u5c5e\u4e8e\u5916\u90e8\u94fe\u63a5\uff0c\u9700\u8981\u52a0\u4e0ahttp:\/\/:\u524d\u7f00\u5417\uff1f",
"Link list": "\u94fe\u63a5\u5217\u8868",
"Insert video": "\u63d2\u5165\u89c6\u9891",
"Insert\/edit video": "\u63d2\u5165\/\u7f16\u8f91\u89c6\u9891",
"Insert\/edit media": "\u63d2\u5165\/\u7f16\u8f91\u5a92\u4f53",
"Alternative source": "\u955c\u50cf",
"Alternative source URL": "\u66ff\u4ee3\u6765\u6e90\u7f51\u5740",
"Media poster (Image URL)": "\u5c01\u9762(\u56fe\u7247\u5730\u5740)",
"Paste your embed code below:": "\u5c06\u5185\u5d4c\u4ee3\u7801\u7c98\u8d34\u5728\u4e0b\u9762:",
"Embed": "\u5185\u5d4c",
"Media...": "\u591a\u5a92\u4f53...",
"Nonbreaking space": "\u4e0d\u95f4\u65ad\u7a7a\u683c",
"Page break": "\u5206\u9875\u7b26",
"Paste as text": "\u7c98\u8d34\u4e3a\u6587\u672c",
"Preview": "\u9884\u89c8",
"Print...": "\u6253\u5370...",
"Save": "\u4fdd\u5b58",
"Find": "\u67e5\u627e",
"Replace with": "\u66ff\u6362\u4e3a",
"Replace": "\u66ff\u6362",
"Replace all": "\u5168\u90e8\u66ff\u6362",
"Previous": "\u4e0a\u4e00\u4e2a",
"Next": "\u4e0b\u4e00\u4e2a",
"Find and replace...": "\u67e5\u627e\u5e76\u66ff\u6362...",
"Could not find the specified string.": "\u672a\u627e\u5230\u641c\u7d22\u5185\u5bb9.",
"Match case": "\u533a\u5206\u5927\u5c0f\u5199",
"Find whole words only": "\u5168\u5b57\u5339\u914d",
"Spell check": "\u62fc\u5199\u68c0\u67e5",
"Ignore": "\u5ffd\u7565",
"Ignore all": "\u5168\u90e8\u5ffd\u7565",
"Finish": "\u5b8c\u6210",
"Add to Dictionary": "\u6dfb\u52a0\u5230\u5b57\u5178",
"Insert table": "\u63d2\u5165\u8868\u683c",
"Table properties": "\u8868\u683c\u5c5e\u6027",
"Delete table": "\u5220\u9664\u8868\u683c",
"Cell": "\u5355\u5143\u683c",
"Row": "\u884c",
"Column": "\u5217",
"Cell properties": "\u5355\u5143\u683c\u5c5e\u6027",
"Merge cells": "\u5408\u5e76\u5355\u5143\u683c",
"Split cell": "\u62c6\u5206\u5355\u5143\u683c",
"Insert row before": "\u5728\u4e0a\u65b9\u63d2\u5165",
"Insert row after": "\u5728\u4e0b\u65b9\u63d2\u5165",
"Delete row": "\u5220\u9664\u884c",
"Row properties": "\u884c\u5c5e\u6027",
"Cut row": "\u526a\u5207\u884c",
"Copy row": "\u590d\u5236\u884c",
"Paste row before": "\u7c98\u8d34\u5230\u4e0a\u65b9",
"Paste row after": "\u7c98\u8d34\u5230\u4e0b\u65b9",
"Insert column before": "\u5728\u5de6\u4fa7\u63d2\u5165",
"Insert column after": "\u5728\u53f3\u4fa7\u63d2\u5165",
"Delete column": "\u5220\u9664\u5217",
"Cols": "\u5217",
"Rows": "\u884c",
"Width": "\u5bbd",
"Height": "\u9ad8",
"Cell spacing": "\u5355\u5143\u683c\u5916\u95f4\u8ddd",
"Cell padding": "\u5355\u5143\u683c\u5185\u8fb9\u8ddd",
"Show caption": "\u663e\u793a\u6807\u9898",
"Left": "\u5de6\u5bf9\u9f50",
"Center": "\u5c45\u4e2d",
"Right": "\u53f3\u5bf9\u9f50",
"Cell type": "\u5355\u5143\u683c\u7c7b\u578b",
"Scope": "\u8303\u56f4",
"Alignment": "\u5bf9\u9f50\u65b9\u5f0f",
"H Align": "\u6c34\u5e73\u5bf9\u9f50",
"V Align": "\u5782\u76f4\u5bf9\u9f50",
"Top": "\u9876\u90e8\u5bf9\u9f50",
"Middle": "\u5782\u76f4\u5c45\u4e2d",
"Bottom": "\u5e95\u90e8\u5bf9\u9f50",
"Header cell": "\u8868\u5934\u5355\u5143\u683c",
"Row group": "\u884c\u7ec4",
"Column group": "\u5217\u7ec4",
"Row type": "\u884c\u7c7b\u578b",
"Header": "\u8868\u5934",
"Body": "\u8868\u4f53",
"Footer": "\u8868\u5c3e",
"Border color": "\u8fb9\u6846\u989c\u8272",
"Insert template...": "\u63d2\u5165\u6a21\u677f...",
"Templates": "\u6a21\u677f",
"Template": "\u6a21\u677f",
"Text color": "\u6587\u5b57\u989c\u8272",
"Background color": "\u80cc\u666f\u8272",
"Custom...": "\u81ea\u5b9a\u4e49...",
"Custom color": "\u81ea\u5b9a\u4e49\u989c\u8272",
"No color": "\u65e0",
"Remove color": "\u79fb\u9664\u989c\u8272",
"Table of Contents": "\u5185\u5bb9\u5217\u8868",
"Show blocks": "\u663e\u793a\u533a\u5757\u8fb9\u6846",
"Show invisible characters": "\u663e\u793a\u4e0d\u53ef\u89c1\u5b57\u7b26",
"Word count": "\u5b57\u6570",
"Count": "\u8ba1\u6570",
"Document": "\u6587\u6863",
"Selection": "\u9009\u62e9",
"Words": "\u5355\u8bcd",
"Words: {0}": "\u5b57\u6570\uff1a{0}",
"{0} words": "{0} \u5b57",
"File": "\u6587\u4ef6",
"Edit": "\u7f16\u8f91",
"Insert": "\u63d2\u5165",
"View": "\u89c6\u56fe",
"Format": "\u683c\u5f0f",
"Table": "\u8868\u683c",
"Tools": "\u5de5\u5177",
"Powered by {0}": "\u7531{0}\u9a71\u52a8",
"Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help": "\u5728\u7f16\u8f91\u533a\u6309ALT-F9\u6253\u5f00\u83dc\u5355\uff0c\u6309ALT-F10\u6253\u5f00\u5de5\u5177\u680f\uff0c\u6309ALT-0\u67e5\u770b\u5e2e\u52a9",
"Image title": "\u56fe\u7247\u6807\u9898",
"Border width": "\u8fb9\u6846\u5bbd\u5ea6",
"Border style": "\u8fb9\u6846\u6837\u5f0f",
"Error": "\u9519\u8bef",
"Warn": "\u8b66\u544a",
"Valid": "\u6709\u6548",
"To open the popup, press Shift+Enter": "\u6309Shitf+Enter\u952e\u6253\u5f00\u5bf9\u8bdd\u6846",
"Rich Text Area. Press ALT-0 for help.": "\u7f16\u8f91\u533a\u3002\u6309Alt+0\u952e\u6253\u5f00\u5e2e\u52a9\u3002",
"System Font": "\u7cfb\u7edf\u5b57\u4f53",
"Failed to upload image: {0}": "\u56fe\u7247\u4e0a\u4f20\u5931\u8d25: {0}",
"Failed to load plugin: {0} from url {1}": "\u63d2\u4ef6\u52a0\u8f7d\u5931\u8d25: {0} \u6765\u81ea\u94fe\u63a5 {1}",
"Failed to load plugin url: {0}": "\u63d2\u4ef6\u52a0\u8f7d\u5931\u8d25 \u94fe\u63a5: {0}",
"Failed to initialize plugin: {0}": "\u63d2\u4ef6\u521d\u59cb\u5316\u5931\u8d25: {0}",
"example": "\u793a\u4f8b",
"Search": "\u641c\u7d22",
"All": "\u5168\u90e8",
"Currency": "\u8d27\u5e01",
"Text": "\u6587\u5b57",
"Quotations": "\u5f15\u7528",
"Mathematical": "\u6570\u5b66",
"Extended Latin": "\u62c9\u4e01\u8bed\u6269\u5145",
"Symbols": "\u7b26\u53f7",
"Arrows": "\u7bad\u5934",
"User Defined": "\u81ea\u5b9a\u4e49",
"dollar sign": "\u7f8e\u5143\u7b26\u53f7",
"currency sign": "\u8d27\u5e01\u7b26\u53f7",
"euro-currency sign": "\u6b27\u5143\u7b26\u53f7",
"colon sign": "\u5192\u53f7",
"cruzeiro sign": "\u514b\u9c81\u8d5b\u7f57\u5e01\u7b26\u53f7",
"french franc sign": "\u6cd5\u90ce\u7b26\u53f7",
"lira sign": "\u91cc\u62c9\u7b26\u53f7",
"mill sign": "\u5bc6\u5c14\u7b26\u53f7",
"naira sign": "\u5948\u62c9\u7b26\u53f7",
"peseta sign": "\u6bd4\u585e\u5854\u7b26\u53f7",
"rupee sign": "\u5362\u6bd4\u7b26\u53f7",
"won sign": "\u97e9\u5143\u7b26\u53f7",
"new sheqel sign": "\u65b0\u8c22\u514b\u5c14\u7b26\u53f7",
"dong sign": "\u8d8a\u5357\u76fe\u7b26\u53f7",
"kip sign": "\u8001\u631d\u57fa\u666e\u7b26\u53f7",
"tugrik sign": "\u56fe\u683c\u91cc\u514b\u7b26\u53f7",
"drachma sign": "\u5fb7\u62c9\u514b\u9a6c\u7b26\u53f7",
"german penny symbol": "\u5fb7\u56fd\u4fbf\u58eb\u7b26\u53f7",
"peso sign": "\u6bd4\u7d22\u7b26\u53f7",
"guarani sign": "\u74dc\u62c9\u5c3c\u7b26\u53f7",
"austral sign": "\u6fb3\u5143\u7b26\u53f7",
"hryvnia sign": "\u683c\u91cc\u592b\u5c3c\u4e9a\u7b26\u53f7",
"cedi sign": "\u585e\u5730\u7b26\u53f7",
"livre tournois sign": "\u91cc\u5f17\u5f17\u5c14\u7b26\u53f7",
"spesmilo sign": "spesmilo\u7b26\u53f7",
"tenge sign": "\u575a\u6208\u7b26\u53f7",
"indian rupee sign": "\u5370\u5ea6\u5362\u6bd4",
"turkish lira sign": "\u571f\u8033\u5176\u91cc\u62c9",
"nordic mark sign": "\u5317\u6b27\u9a6c\u514b",
"manat sign": "\u9a6c\u7eb3\u7279\u7b26\u53f7",
"ruble sign": "\u5362\u5e03\u7b26\u53f7",
"yen character": "\u65e5\u5143\u5b57\u6837",
"yuan character": "\u4eba\u6c11\u5e01\u5143\u5b57\u6837",
"yuan character, in hong kong and taiwan": "\u5143\u5b57\u6837\uff08\u6e2f\u53f0\u5730\u533a\uff09",
"yen\/yuan character variant one": "\u5143\u5b57\u6837\uff08\u5927\u5199\uff09",
"Loading emoticons...": "\u52a0\u8f7d\u8868\u60c5\u7b26\u53f7...",
"Could not load emoticons": "\u4e0d\u80fd\u52a0\u8f7d\u8868\u60c5\u7b26\u53f7",
"People": "\u4eba\u7c7b",
"Animals and Nature": "\u52a8\u7269\u548c\u81ea\u7136",
"Food and Drink": "\u98df\u7269\u548c\u996e\u54c1",
"Activity": "\u6d3b\u52a8",
"Travel and Places": "\u65c5\u6e38\u548c\u5730\u70b9",
"Objects": "\u7269\u4ef6",
"Flags": "\u65d7\u5e1c",
"Characters": "\u5b57\u7b26",
"Characters (no spaces)": "\u5b57\u7b26(\u65e0\u7a7a\u683c)",
"{0} characters": "{0} \u4e2a\u5b57\u7b26",
"Error: Form submit field collision.": "\u9519\u8bef: \u8868\u5355\u63d0\u4ea4\u5b57\u6bb5\u51b2\u7a81\u3002",
"Error: No form element found.": "\u9519\u8bef: \u6ca1\u6709\u8868\u5355\u63a7\u4ef6\u3002",
"Update": "\u66f4\u65b0",
"Color swatch": "\u989c\u8272\u6837\u672c",
"Turquoise": "\u9752\u7eff\u8272",
"Green": "\u7eff\u8272",
"Blue": "\u84dd\u8272",
"Purple": "\u7d2b\u8272",
"Navy Blue": "\u6d77\u519b\u84dd",
"Dark Turquoise": "\u6df1\u84dd\u7eff\u8272",
"Dark Green": "\u6df1\u7eff\u8272",
"Medium Blue": "\u4e2d\u84dd\u8272",
"Medium Purple": "\u4e2d\u7d2b\u8272",
"Midnight Blue": "\u6df1\u84dd\u8272",
"Yellow": "\u9ec4\u8272",
"Orange": "\u6a59\u8272",
"Red": "\u7ea2\u8272",
"Light Gray": "\u6d45\u7070\u8272",
"Gray": "\u7070\u8272",
"Dark Yellow": "\u6697\u9ec4\u8272",
"Dark Orange": "\u6df1\u6a59\u8272",
"Dark Red": "\u6df1\u7ea2\u8272",
"Medium Gray": "\u4e2d\u7070\u8272",
"Dark Gray": "\u6df1\u7070\u8272",
"Light Green": "\u6d45\u7eff\u8272",
"Light Yellow": "\u6d45\u9ec4\u8272",
"Light Red": "\u6d45\u7ea2\u8272",
"Light Purple": "\u6d45\u7d2b\u8272",
"Light Blue": "\u6d45\u84dd\u8272",
"Dark Purple": "\u6df1\u7d2b\u8272",
"Dark Blue": "\u6df1\u84dd\u8272",
"Black": "\u9ed1\u8272",
"White": "\u767d\u8272",
"Switch to or from fullscreen mode": "\u5207\u6362\u5168\u5c4f\u6a21\u5f0f",
"Open help dialog": "\u6253\u5f00\u5e2e\u52a9\u5bf9\u8bdd\u6846",
"history": "\u5386\u53f2",
"styles": "\u6837\u5f0f",
"formatting": "\u683c\u5f0f\u5316",
"alignment": "\u5bf9\u9f50",
"indentation": "\u7f29\u8fdb",
"permanent pen": "\u8bb0\u53f7\u7b14",
"comments": "\u5907\u6ce8",
"Format Painter": "\u683c\u5f0f\u5237",
"Insert\/edit iframe": "\u63d2\u5165\/\u7f16\u8f91\u6846\u67b6",
"Capitalization": "\u5927\u5199",
"lowercase": "\u5c0f\u5199",
"UPPERCASE": "\u5927\u5199",
"Title Case": "\u9996\u5b57\u6bcd\u5927\u5199",
"Permanent Pen Properties": "\u6c38\u4e45\u7b14\u5c5e\u6027",
"Permanent pen properties...": "\u6c38\u4e45\u7b14\u5c5e\u6027...",
"Font": "\u5b57\u4f53",
"Size": "\u5b57\u53f7",
"More...": "\u66f4\u591a...",
"Spellcheck Language": "\u62fc\u5199\u68c0\u67e5\u8bed\u8a00",
"Select...": "\u9009\u62e9...",
"Preferences": "\u9996\u9009\u9879",
"Yes": "\u662f",
"No": "\u5426",
"Keyboard Navigation": "\u952e\u76d8\u6307\u5f15",
"Version": "\u7248\u672c",
"Anchor": "\u951a\u70b9",
"Special character": "\u7279\u6b8a\u7b26\u53f7",
"Code sample": "\u4ee3\u7801\u793a\u4f8b",
"Color": "\u989c\u8272",
"Emoticons": "\u8868\u60c5",
"Document properties": "\u6587\u6863\u5c5e\u6027",
"Image": "\u56fe\u7247",
"Insert link": "\u63d2\u5165\u94fe\u63a5",
"Target": "\u6253\u5f00\u65b9\u5f0f",
"Link": "\u94fe\u63a5",
"Poster": "\u5c01\u9762",
"Media": "\u5a92\u4f53",
"Print": "\u6253\u5370",
"Prev": "\u4e0a\u4e00\u4e2a",
"Find and replace": "\u67e5\u627e\u548c\u66ff\u6362",
"Whole words": "\u5168\u5b57\u5339\u914d",
"Spellcheck": "\u62fc\u5199\u68c0\u67e5",
"Caption": "\u6807\u9898",
"Insert template": "\u63d2\u5165\u6a21\u677f"
});
@@ -0,0 +1,278 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
(function () {
'use strict';
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
var applyListFormat = function (editor, listName, styleValue) {
var cmd = listName === 'UL' ? 'InsertUnorderedList' : 'InsertOrderedList';
editor.execCommand(cmd, false, styleValue === false ? null : { 'list-style-type': styleValue });
};
var register = function (editor) {
editor.addCommand('ApplyUnorderedListStyle', function (ui, value) {
applyListFormat(editor, 'UL', value['list-style-type']);
});
editor.addCommand('ApplyOrderedListStyle', function (ui, value) {
applyListFormat(editor, 'OL', value['list-style-type']);
});
};
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
var getNumberStyles = function (editor) {
var styles = editor.getParam('advlist_number_styles', 'default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman');
return styles ? styles.split(/[ ,]/) : [];
};
var getBulletStyles = function (editor) {
var styles = editor.getParam('advlist_bullet_styles', 'default,circle,square');
return styles ? styles.split(/[ ,]/) : [];
};
var noop = function () {
};
var constant = function (value) {
return function () {
return value;
};
};
var never = constant(false);
var always = constant(true);
var none = function () {
return NONE;
};
var NONE = function () {
var eq = function (o) {
return o.isNone();
};
var call = function (thunk) {
return thunk();
};
var id = function (n) {
return n;
};
var me = {
fold: function (n, _s) {
return n();
},
is: never,
isSome: never,
isNone: always,
getOr: id,
getOrThunk: call,
getOrDie: function (msg) {
throw new Error(msg || 'error: getOrDie called on none.');
},
getOrNull: constant(null),
getOrUndefined: constant(undefined),
or: id,
orThunk: call,
map: none,
each: noop,
bind: none,
exists: never,
forall: always,
filter: none,
equals: eq,
equals_: eq,
toArray: function () {
return [];
},
toString: constant('none()')
};
return me;
}();
var some = function (a) {
var constant_a = constant(a);
var self = function () {
return me;
};
var bind = function (f) {
return f(a);
};
var me = {
fold: function (n, s) {
return s(a);
},
is: function (v) {
return a === v;
},
isSome: always,
isNone: never,
getOr: constant_a,
getOrThunk: constant_a,
getOrDie: constant_a,
getOrNull: constant_a,
getOrUndefined: constant_a,
or: self,
orThunk: self,
map: function (f) {
return some(f(a));
},
each: function (f) {
f(a);
},
bind: bind,
exists: bind,
forall: bind,
filter: function (f) {
return f(a) ? me : NONE;
},
toArray: function () {
return [a];
},
toString: function () {
return 'some(' + a + ')';
},
equals: function (o) {
return o.is(a);
},
equals_: function (o, elementEq) {
return o.fold(never, function (b) {
return elementEq(a, b);
});
}
};
return me;
};
var from = function (value) {
return value === null || value === undefined ? NONE : some(value);
};
var Optional = {
some: some,
none: none,
from: from
};
var isChildOfBody = function (editor, elm) {
return editor.$.contains(editor.getBody(), elm);
};
var isTableCellNode = function (node) {
return node && /^(TH|TD)$/.test(node.nodeName);
};
var isListNode = function (editor) {
return function (node) {
return node && /^(OL|UL|DL)$/.test(node.nodeName) && isChildOfBody(editor, node);
};
};
var getSelectedStyleType = function (editor) {
var listElm = editor.dom.getParent(editor.selection.getNode(), 'ol,ul');
var style = editor.dom.getStyle(listElm, 'listStyleType');
return Optional.from(style);
};
var findIndex = function (list, predicate) {
for (var index = 0; index < list.length; index++) {
var element = list[index];
if (predicate(element)) {
return index;
}
}
return -1;
};
var styleValueToText = function (styleValue) {
return styleValue.replace(/\-/g, ' ').replace(/\b\w/g, function (chr) {
return chr.toUpperCase();
});
};
var isWithinList = function (editor, e, nodeName) {
var tableCellIndex = findIndex(e.parents, isTableCellNode);
var parents = tableCellIndex !== -1 ? e.parents.slice(0, tableCellIndex) : e.parents;
var lists = global$1.grep(parents, isListNode(editor));
return lists.length > 0 && lists[0].nodeName === nodeName;
};
var addSplitButton = function (editor, id, tooltip, cmd, nodeName, styles) {
editor.ui.registry.addSplitButton(id, {
tooltip: tooltip,
icon: nodeName === 'OL' ? 'ordered-list' : 'unordered-list',
presets: 'listpreview',
columns: 3,
fetch: function (callback) {
var items = global$1.map(styles, function (styleValue) {
var iconStyle = nodeName === 'OL' ? 'num' : 'bull';
var iconName = styleValue === 'disc' || styleValue === 'decimal' ? 'default' : styleValue;
var itemValue = styleValue === 'default' ? '' : styleValue;
var displayText = styleValueToText(styleValue);
return {
type: 'choiceitem',
value: itemValue,
icon: 'list-' + iconStyle + '-' + iconName,
text: displayText
};
});
callback(items);
},
onAction: function () {
return editor.execCommand(cmd);
},
onItemAction: function (_splitButtonApi, value) {
applyListFormat(editor, nodeName, value);
},
select: function (value) {
var listStyleType = getSelectedStyleType(editor);
return listStyleType.map(function (listStyle) {
return value === listStyle;
}).getOr(false);
},
onSetup: function (api) {
var nodeChangeHandler = function (e) {
api.setActive(isWithinList(editor, e, nodeName));
};
editor.on('NodeChange', nodeChangeHandler);
return function () {
return editor.off('NodeChange', nodeChangeHandler);
};
}
});
};
var addButton = function (editor, id, tooltip, cmd, nodeName, _styles) {
editor.ui.registry.addToggleButton(id, {
active: false,
tooltip: tooltip,
icon: nodeName === 'OL' ? 'ordered-list' : 'unordered-list',
onSetup: function (api) {
var nodeChangeHandler = function (e) {
api.setActive(isWithinList(editor, e, nodeName));
};
editor.on('NodeChange', nodeChangeHandler);
return function () {
return editor.off('NodeChange', nodeChangeHandler);
};
},
onAction: function () {
return editor.execCommand(cmd);
}
});
};
var addControl = function (editor, id, tooltip, cmd, nodeName, styles) {
if (styles.length > 1) {
addSplitButton(editor, id, tooltip, cmd, nodeName, styles);
} else {
addButton(editor, id, tooltip, cmd, nodeName);
}
};
var register$1 = function (editor) {
addControl(editor, 'numlist', 'Numbered list', 'InsertOrderedList', 'OL', getNumberStyles(editor));
addControl(editor, 'bullist', 'Bullet list', 'InsertUnorderedList', 'UL', getBulletStyles(editor));
};
function Plugin () {
global.add('advlist', function (editor) {
if (editor.hasPlugin('lists')) {
register$1(editor);
register(editor);
}
});
}
Plugin();
}());
@@ -0,0 +1,9 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
!function(){"use strict";var n,e,t,r=tinymce.util.Tools.resolve("tinymce.PluginManager"),u=function(n,e,t){var r="UL"===e?"InsertUnorderedList":"InsertOrderedList";n.execCommand(r,!1,!1===t?null:{"list-style-type":t})},l=tinymce.util.Tools.resolve("tinymce.util.Tools"),i=function(n){return function(){return n}},c=i(!1),s=i(!0),o=function(){return a},a=(n=function(n){return n.isNone()},{fold:function(n,e){return n()},is:c,isSome:c,isNone:s,getOr:t=function(n){return n},getOrThunk:e=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:i(null),getOrUndefined:i(undefined),or:t,orThunk:e,map:o,each:function(){},bind:o,exists:c,forall:s,filter:o,equals:n,equals_:n,toArray:function(){return[]},toString:i("none()")}),f=function(t){var n=i(t),e=function(){return o},r=function(n){return n(t)},o={fold:function(n,e){return e(t)},is:function(n){return t===n},isSome:s,isNone:c,getOr:n,getOrThunk:n,getOrDie:n,getOrNull:n,getOrUndefined:n,or:e,orThunk:e,map:function(n){return f(n(t))},each:function(n){n(t)},bind:r,exists:r,forall:r,filter:function(n){return n(t)?o:a},toArray:function(){return[t]},toString:function(){return"some("+t+")"},equals:function(n){return n.is(t)},equals_:function(n,e){return n.fold(c,function(n){return e(t,n)})}};return o},d=function(n){return null===n||n===undefined?a:f(n)},g=function(n){return n&&/^(TH|TD)$/.test(n.nodeName)},m=function(r){return function(n){return n&&/^(OL|UL|DL)$/.test(n.nodeName)&&(t=n,(e=r).$.contains(e.getBody(),t));var e,t}},p=function(n,e,t){var r=function(n,e){for(var t=0;t<n.length;t++){if(e(n[t]))return t}return-1}(e.parents,g),o=-1!==r?e.parents.slice(0,r):e.parents,i=l.grep(o,m(n));return 0<i.length&&i[0].nodeName===t},y=function(o,n,e,t,r,i){o.ui.registry.addSplitButton(n,{tooltip:e,icon:"OL"===r?"ordered-list":"unordered-list",presets:"listpreview",columns:3,fetch:function(n){n(l.map(i,function(n){return{type:"choiceitem",value:"default"===n?"":n,icon:"list-"+("OL"===r?"num":"bull")+"-"+("disc"===n||"decimal"===n?"default":n),text:n.replace(/\-/g," ").replace(/\b\w/g,function(n){return n.toUpperCase()})}}))},onAction:function(){return o.execCommand(t)},onItemAction:function(n,e){u(o,r,e)},select:function(e){var n,t,r;return(t=(n=o).dom.getParent(n.selection.getNode(),"ol,ul"),r=n.dom.getStyle(t,"listStyleType"),d(r)).map(function(n){return e===n}).getOr(!1)},onSetup:function(e){var n=function(n){e.setActive(p(o,n,r))};return o.on("NodeChange",n),function(){return o.off("NodeChange",n)}}})},v=function(n,e,t,r,o,i){var u,l,c,s,a;1<i.length?y(n,e,t,r,o,i):(l=e,c=t,s=r,a=o,(u=n).ui.registry.addToggleButton(l,{active:!1,tooltip:c,icon:"OL"===a?"ordered-list":"unordered-list",onSetup:function(e){var n=function(n){e.setActive(p(u,n,a))};return u.on("NodeChange",n),function(){return u.off("NodeChange",n)}},onAction:function(){return u.execCommand(s)}}))};r.add("advlist",function(n){var t,e,r,o;n.hasPlugin("lists")&&(v(e=n,"numlist","Numbered list","InsertOrderedList","OL",(r=e.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman"))?r.split(/[ ,]/):[]),v(e,"bullist","Bullet list","InsertUnorderedList","UL",(o=e.getParam("advlist_bullet_styles","default,circle,square"))?o.split(/[ ,]/):[]),(t=n).addCommand("ApplyUnorderedListStyle",function(n,e){u(t,"UL",e["list-style-type"])}),t.addCommand("ApplyOrderedListStyle",function(n,e){u(t,"OL",e["list-style-type"])}))})}();
@@ -0,0 +1,216 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
(function () {
'use strict';
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');
var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools');
var allowHtmlInNamedAnchor = function (editor) {
return editor.getParam('allow_html_in_named_anchor', false, 'boolean');
};
var namedAnchorSelector = 'a:not([href])';
var isEmptyString = function (str) {
return !str;
};
var getIdFromAnchor = function (elm) {
var id = elm.getAttribute('id') || elm.getAttribute('name');
return id || '';
};
var isAnchor = function (elm) {
return elm && elm.nodeName.toLowerCase() === 'a';
};
var isNamedAnchor = function (elm) {
return isAnchor(elm) && !elm.getAttribute('href') && getIdFromAnchor(elm) !== '';
};
var isEmptyNamedAnchor = function (elm) {
return isNamedAnchor(elm) && !elm.firstChild;
};
var removeEmptyNamedAnchorsInSelection = function (editor) {
var dom = editor.dom;
global$1(dom).walk(editor.selection.getRng(), function (nodes) {
global$2.each(nodes, function (node) {
if (isEmptyNamedAnchor(node)) {
dom.remove(node, false);
}
});
});
};
var isValidId = function (id) {
return /^[A-Za-z][A-Za-z0-9\-:._]*$/.test(id);
};
var getNamedAnchor = function (editor) {
return editor.dom.getParent(editor.selection.getStart(), namedAnchorSelector);
};
var getId = function (editor) {
var anchor = getNamedAnchor(editor);
if (anchor) {
return getIdFromAnchor(anchor);
} else {
return '';
}
};
var createAnchor = function (editor, id) {
editor.undoManager.transact(function () {
if (!allowHtmlInNamedAnchor(editor)) {
editor.selection.collapse(true);
}
if (editor.selection.isCollapsed()) {
editor.insertContent(editor.dom.createHTML('a', { id: id }));
} else {
removeEmptyNamedAnchorsInSelection(editor);
editor.formatter.remove('namedAnchor', null, null, true);
editor.formatter.apply('namedAnchor', { value: id });
editor.addVisual();
}
});
};
var updateAnchor = function (editor, id, anchorElement) {
anchorElement.removeAttribute('name');
anchorElement.id = id;
editor.addVisual();
editor.undoManager.add();
};
var insert = function (editor, id) {
var anchor = getNamedAnchor(editor);
if (anchor) {
updateAnchor(editor, id, anchor);
} else {
createAnchor(editor, id);
}
editor.focus();
};
var insertAnchor = function (editor, newId) {
if (!isValidId(newId)) {
editor.windowManager.alert('Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.');
return false;
} else {
insert(editor, newId);
return true;
}
};
var open = function (editor) {
var currentId = getId(editor);
editor.windowManager.open({
title: 'Anchor',
size: 'normal',
body: {
type: 'panel',
items: [{
name: 'id',
type: 'input',
label: 'ID',
placeholder: 'example'
}]
},
buttons: [
{
type: 'cancel',
name: 'cancel',
text: 'Cancel'
},
{
type: 'submit',
name: 'save',
text: 'Save',
primary: true
}
],
initialData: { id: currentId },
onSubmit: function (api) {
if (insertAnchor(editor, api.getData().id)) {
api.close();
}
}
});
};
var register = function (editor) {
editor.addCommand('mceAnchor', function () {
open(editor);
});
};
var isNamedAnchorNode = function (node) {
return node && isEmptyString(node.attr('href')) && !isEmptyString(node.attr('id') || node.attr('name'));
};
var isEmptyNamedAnchorNode = function (node) {
return isNamedAnchorNode(node) && !node.firstChild;
};
var setContentEditable = function (state) {
return function (nodes) {
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
if (isEmptyNamedAnchorNode(node)) {
node.attr('contenteditable', state);
}
}
};
};
var setup = function (editor) {
editor.on('PreInit', function () {
editor.parser.addNodeFilter('a', setContentEditable('false'));
editor.serializer.addNodeFilter('a', setContentEditable(null));
});
};
var registerFormats = function (editor) {
editor.formatter.register('namedAnchor', {
inline: 'a',
selector: namedAnchorSelector,
remove: 'all',
split: true,
deep: true,
attributes: { id: '%value' },
onmatch: function (node, _fmt, _itemName) {
return isNamedAnchor(node);
}
});
};
var register$1 = function (editor) {
editor.ui.registry.addToggleButton('anchor', {
icon: 'bookmark',
tooltip: 'Anchor',
onAction: function () {
return editor.execCommand('mceAnchor');
},
onSetup: function (buttonApi) {
return editor.selection.selectorChangedWithUnbind('a:not([href])', buttonApi.setActive).unbind;
}
});
editor.ui.registry.addMenuItem('anchor', {
icon: 'bookmark',
text: 'Anchor...',
onAction: function () {
return editor.execCommand('mceAnchor');
}
});
};
function Plugin () {
global.add('anchor', function (editor) {
setup(editor);
register(editor);
register$1(editor);
editor.on('PreInit', function () {
registerFormats(editor);
});
});
}
Plugin();
}());
@@ -0,0 +1,9 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),o=tinymce.util.Tools.resolve("tinymce.util.Tools"),a="a:not([href])",n=function(e){return e.getAttribute("id")||e.getAttribute("name")||""},r=function(e){return(t=e)&&"a"===t.nodeName.toLowerCase()&&!e.getAttribute("href")&&""!==n(e);var t},c=function(e){var n=e.dom;t(n).walk(e.selection.getRng(),function(e){o.each(e,function(e){var t;r(t=e)&&!t.firstChild&&n.remove(e,!1)})})},u=function(e){return e.dom.getParent(e.selection.getStart(),a)},i=function(e,t){var n,o,a,r,i,l=u(e);l?(a=e,r=t,(i=l).removeAttribute("name"),i.id=r,a.addVisual(),a.undoManager.add()):(o=t,(n=e).undoManager.transact(function(){n.getParam("allow_html_in_named_anchor",!1,"boolean")||n.selection.collapse(!0),n.selection.isCollapsed()?n.insertContent(n.dom.createHTML("a",{id:o})):(c(n),n.formatter.remove("namedAnchor",null,null,!0),n.formatter.apply("namedAnchor",{value:o}),n.addVisual())})),e.focus()},l=function(o){var e,t=(e=u(o))?n(e):"";o.windowManager.open({title:"Anchor",size:"normal",body:{type:"panel",items:[{name:"id",type:"input",label:"ID",placeholder:"example"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{id:t},onSubmit:function(e){var t,n;t=o,n=e.getData().id,(/^[A-Za-z][A-Za-z0-9\-:._]*$/.test(n)?(i(t,n),1):(t.windowManager.alert("Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores."),0))&&e.close()}})},d=function(r){return function(e){for(var t,n,o=0;o<e.length;o++){var a=e[o];n=void 0,!(n=t=a)||n.attr("href")||!n.attr("id")&&!n.attr("name")||t.firstChild||a.attr("contenteditable",r)}}};e.add("anchor",function(e){var t,n,o;(t=e).on("PreInit",function(){t.parser.addNodeFilter("a",d("false")),t.serializer.addNodeFilter("a",d(null))}),(n=e).addCommand("mceAnchor",function(){l(n)}),(o=e).ui.registry.addToggleButton("anchor",{icon:"bookmark",tooltip:"Anchor",onAction:function(){return o.execCommand("mceAnchor")},onSetup:function(e){return o.selection.selectorChangedWithUnbind("a:not([href])",e.setActive).unbind}}),o.ui.registry.addMenuItem("anchor",{icon:"bookmark",text:"Anchor...",onAction:function(){return o.execCommand("mceAnchor")}}),e.on("PreInit",function(){e.formatter.register("namedAnchor",{inline:"a",selector:a,remove:"all",split:!0,deep:!0,attributes:{id:"%value"},onmatch:function(e,t,n){return r(e)}})})})}();
@@ -0,0 +1,185 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
(function () {
'use strict';
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
var getAutoLinkPattern = function (editor) {
return editor.getParam('autolink_pattern', /^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@(?!.*@))(.+)$/i);
};
var getDefaultLinkTarget = function (editor) {
return editor.getParam('default_link_target', false);
};
var getDefaultLinkProtocol = function (editor) {
return editor.getParam('link_default_protocol', 'http', 'string');
};
var rangeEqualsDelimiterOrSpace = function (rangeString, delimiter) {
return rangeString === delimiter || rangeString === ' ' || rangeString.charCodeAt(0) === 160;
};
var handleEclipse = function (editor) {
parseCurrentLine(editor, -1, '(');
};
var handleSpacebar = function (editor) {
parseCurrentLine(editor, 0, '');
};
var handleEnter = function (editor) {
parseCurrentLine(editor, -1, '');
};
var scopeIndex = function (container, index) {
if (index < 0) {
index = 0;
}
if (container.nodeType === 3) {
var len = container.data.length;
if (index > len) {
index = len;
}
}
return index;
};
var setStart = function (rng, container, offset) {
if (container.nodeType !== 1 || container.hasChildNodes()) {
rng.setStart(container, scopeIndex(container, offset));
} else {
rng.setStartBefore(container);
}
};
var setEnd = function (rng, container, offset) {
if (container.nodeType !== 1 || container.hasChildNodes()) {
rng.setEnd(container, scopeIndex(container, offset));
} else {
rng.setEndAfter(container);
}
};
var parseCurrentLine = function (editor, endOffset, delimiter) {
var end, endContainer, bookmark, text, prev, len, rngText;
var autoLinkPattern = getAutoLinkPattern(editor);
var defaultLinkTarget = getDefaultLinkTarget(editor);
if (editor.selection.getNode().tagName === 'A') {
return;
}
var rng = editor.selection.getRng().cloneRange();
if (rng.startOffset < 5) {
prev = rng.endContainer.previousSibling;
if (!prev) {
if (!rng.endContainer.firstChild || !rng.endContainer.firstChild.nextSibling) {
return;
}
prev = rng.endContainer.firstChild.nextSibling;
}
len = prev.length;
setStart(rng, prev, len);
setEnd(rng, prev, len);
if (rng.endOffset < 5) {
return;
}
end = rng.endOffset;
endContainer = prev;
} else {
endContainer = rng.endContainer;
if (endContainer.nodeType !== 3 && endContainer.firstChild) {
while (endContainer.nodeType !== 3 && endContainer.firstChild) {
endContainer = endContainer.firstChild;
}
if (endContainer.nodeType === 3) {
setStart(rng, endContainer, 0);
setEnd(rng, endContainer, endContainer.nodeValue.length);
}
}
if (rng.endOffset === 1) {
end = 2;
} else {
end = rng.endOffset - 1 - endOffset;
}
}
var start = end;
do {
setStart(rng, endContainer, end >= 2 ? end - 2 : 0);
setEnd(rng, endContainer, end >= 1 ? end - 1 : 0);
end -= 1;
rngText = rng.toString();
} while (rngText !== ' ' && rngText !== '' && rngText.charCodeAt(0) !== 160 && end - 2 >= 0 && rngText !== delimiter);
if (rangeEqualsDelimiterOrSpace(rng.toString(), delimiter)) {
setStart(rng, endContainer, end);
setEnd(rng, endContainer, start);
end += 1;
} else if (rng.startOffset === 0) {
setStart(rng, endContainer, 0);
setEnd(rng, endContainer, start);
} else {
setStart(rng, endContainer, end);
setEnd(rng, endContainer, start);
}
text = rng.toString();
if (text.charAt(text.length - 1) === '.') {
setEnd(rng, endContainer, start - 1);
}
text = rng.toString().trim();
var matches = text.match(autoLinkPattern);
var protocol = getDefaultLinkProtocol(editor);
if (matches) {
if (matches[1] === 'www.') {
matches[1] = protocol + '://www.';
} else if (/@$/.test(matches[1]) && !/^mailto:/.test(matches[1])) {
matches[1] = 'mailto:' + matches[1];
}
bookmark = editor.selection.getBookmark();
editor.selection.setRng(rng);
editor.execCommand('createlink', false, matches[1] + matches[2]);
if (defaultLinkTarget !== false) {
editor.dom.setAttrib(editor.selection.getNode(), 'target', defaultLinkTarget);
}
editor.selection.moveToBookmark(bookmark);
editor.nodeChanged();
}
};
var setup = function (editor) {
var autoUrlDetectState;
editor.on('keydown', function (e) {
if (e.keyCode === 13) {
return handleEnter(editor);
}
});
if (global$1.browser.isIE()) {
editor.on('focus', function () {
if (!autoUrlDetectState) {
autoUrlDetectState = true;
try {
editor.execCommand('AutoUrlDetect', false, true);
} catch (ex) {
}
}
});
return;
}
editor.on('keypress', function (e) {
if (e.keyCode === 41) {
return handleEclipse(editor);
}
});
editor.on('keyup', function (e) {
if (e.keyCode === 32) {
return handleSpacebar(editor);
}
});
};
function Plugin () {
global.add('autolink', function (editor) {
setup(editor);
});
}
Plugin();
}());
@@ -0,0 +1,9 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),o=tinymce.util.Tools.resolve("tinymce.Env"),i=function(e,t){var n;return t<0&&(t=0),3!==e.nodeType||(n=e.data.length)<t&&(t=n),t},y=function(e,t,n){1!==t.nodeType||t.hasChildNodes()?e.setStart(t,i(t,n)):e.setStartBefore(t)},k=function(e,t,n){1!==t.nodeType||t.hasChildNodes()?e.setEnd(t,i(t,n)):e.setEndAfter(t)},r=function(e,t,n){var o,i,r,a,s,d,f,l=e.getParam("autolink_pattern",/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@(?!.*@))(.+)$/i),c=e.getParam("default_link_target",!1);if("A"!==e.selection.getNode().tagName){var g=e.selection.getRng().cloneRange();if(g.startOffset<5){if(!(s=g.endContainer.previousSibling)){if(!g.endContainer.firstChild||!g.endContainer.firstChild.nextSibling)return;s=g.endContainer.firstChild.nextSibling}if(d=s.length,y(g,s,d),k(g,s,d),g.endOffset<5)return;o=g.endOffset,i=s}else{if(3!==(i=g.endContainer).nodeType&&i.firstChild){for(;3!==i.nodeType&&i.firstChild;)i=i.firstChild;3===i.nodeType&&(y(g,i,0),k(g,i,i.nodeValue.length))}o=1===g.endOffset?2:g.endOffset-1-t}for(var u,h=o;y(g,i,2<=o?o-2:0),k(g,i,1<=o?o-1:0),--o," "!==(f=g.toString())&&""!==f&&160!==f.charCodeAt(0)&&0<=o-2&&f!==n;);(u=g.toString())===n||" "===u||160===u.charCodeAt(0)?(y(g,i,o),k(g,i,h),o+=1):(0===g.startOffset?y(g,i,0):y(g,i,o),k(g,i,h)),"."===(a=g.toString()).charAt(a.length-1)&&k(g,i,h-1);var m=(a=g.toString().trim()).match(l),C=e.getParam("link_default_protocol","http","string");m&&("www."===m[1]?m[1]=C+"://www.":/@$/.test(m[1])&&!/^mailto:/.test(m[1])&&(m[1]="mailto:"+m[1]),r=e.selection.getBookmark(),e.selection.setRng(g),e.execCommand("createlink",!1,m[1]+m[2]),!1!==c&&e.dom.setAttrib(e.selection.getNode(),"target",c),e.selection.moveToBookmark(r),e.nodeChanged())}},t=function(t){var n;t.on("keydown",function(e){13!==e.keyCode||r(t,-1,"")}),o.browser.isIE()?t.on("focus",function(){if(!n){n=!0;try{t.execCommand("AutoUrlDetect",!1,!0)}catch(e){}}}):(t.on("keypress",function(e){41!==e.keyCode||r(t,-1,"(")}),t.on("keyup",function(e){32!==e.keyCode||r(t,0,"")}))};e.add("autolink",function(e){t(e)})}();
@@ -0,0 +1,171 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
(function () {
'use strict';
var Cell = function (initial) {
var value = initial;
var get = function () {
return value;
};
var set = function (v) {
value = v;
};
return {
get: get,
set: set
};
};
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay');
var fireResizeEditor = function (editor) {
return editor.fire('ResizeEditor');
};
var getAutoResizeMinHeight = function (editor) {
return editor.getParam('min_height', editor.getElement().offsetHeight, 'number');
};
var getAutoResizeMaxHeight = function (editor) {
return editor.getParam('max_height', 0, 'number');
};
var getAutoResizeOverflowPadding = function (editor) {
return editor.getParam('autoresize_overflow_padding', 1, 'number');
};
var getAutoResizeBottomMargin = function (editor) {
return editor.getParam('autoresize_bottom_margin', 50, 'number');
};
var shouldAutoResizeOnInit = function (editor) {
return editor.getParam('autoresize_on_init', true, 'boolean');
};
var isFullscreen = function (editor) {
return editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen();
};
var wait = function (editor, oldSize, times, interval, callback) {
global$2.setEditorTimeout(editor, function () {
resize(editor, oldSize);
if (times--) {
wait(editor, oldSize, times, interval, callback);
} else if (callback) {
callback();
}
}, interval);
};
var toggleScrolling = function (editor, state) {
var body = editor.getBody();
if (body) {
body.style.overflowY = state ? '' : 'hidden';
if (!state) {
body.scrollTop = 0;
}
}
};
var parseCssValueToInt = function (dom, elm, name, computed) {
var value = parseInt(dom.getStyle(elm, name, computed), 10);
return isNaN(value) ? 0 : value;
};
var resize = function (editor, oldSize) {
var dom = editor.dom;
var doc = editor.getDoc();
if (!doc) {
return;
}
if (isFullscreen(editor)) {
toggleScrolling(editor, true);
return;
}
var docEle = doc.documentElement;
var resizeBottomMargin = getAutoResizeBottomMargin(editor);
var resizeHeight = getAutoResizeMinHeight(editor);
var marginTop = parseCssValueToInt(dom, docEle, 'margin-top', true);
var marginBottom = parseCssValueToInt(dom, docEle, 'margin-bottom', true);
var contentHeight = docEle.offsetHeight + marginTop + marginBottom + resizeBottomMargin;
if (contentHeight < 0) {
contentHeight = 0;
}
var containerHeight = editor.getContainer().offsetHeight;
var contentAreaHeight = editor.getContentAreaContainer().offsetHeight;
var chromeHeight = containerHeight - contentAreaHeight;
if (contentHeight + chromeHeight > getAutoResizeMinHeight(editor)) {
resizeHeight = contentHeight + chromeHeight;
}
var maxHeight = getAutoResizeMaxHeight(editor);
if (maxHeight && resizeHeight > maxHeight) {
resizeHeight = maxHeight;
toggleScrolling(editor, true);
} else {
toggleScrolling(editor, false);
}
if (resizeHeight !== oldSize.get()) {
var deltaSize = resizeHeight - oldSize.get();
dom.setStyle(editor.getContainer(), 'height', resizeHeight + 'px');
oldSize.set(resizeHeight);
fireResizeEditor(editor);
if (global$1.browser.isSafari() && global$1.mac) {
var win = editor.getWin();
win.scrollTo(win.pageXOffset, win.pageYOffset);
}
if (editor.hasFocus()) {
editor.selection.scrollIntoView(editor.selection.getNode());
}
if (global$1.webkit && deltaSize < 0) {
resize(editor, oldSize);
}
}
};
var setup = function (editor, oldSize) {
editor.on('init', function () {
var overflowPadding = getAutoResizeOverflowPadding(editor);
var dom = editor.dom;
dom.setStyles(editor.getDoc().documentElement, { height: 'auto' });
dom.setStyles(editor.getBody(), {
'paddingLeft': overflowPadding,
'paddingRight': overflowPadding,
'min-height': 0
});
});
editor.on('NodeChange SetContent keyup FullscreenStateChanged ResizeContent', function () {
resize(editor, oldSize);
});
if (shouldAutoResizeOnInit(editor)) {
editor.on('init', function () {
wait(editor, oldSize, 20, 100, function () {
wait(editor, oldSize, 5, 1000);
});
});
}
};
var register = function (editor, oldSize) {
editor.addCommand('mceAutoResize', function () {
resize(editor, oldSize);
});
};
function Plugin () {
global.add('autoresize', function (editor) {
if (!editor.settings.hasOwnProperty('resize')) {
editor.settings.resize = false;
}
if (!editor.inline) {
var oldSize = Cell(0);
register(editor, oldSize);
setup(editor, oldSize);
}
});
}
Plugin();
}());
@@ -0,0 +1,9 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),h=tinymce.util.Tools.resolve("tinymce.Env"),r=tinymce.util.Tools.resolve("tinymce.util.Delay"),y=function(e){return e.getParam("min_height",e.getElement().offsetHeight,"number")},a=function(e,t,n,i,o){r.setEditorTimeout(e,function(){b(e,t),n--?a(e,t,n,i,o):o&&o()},i)},p=function(e,t){var n=e.getBody();n&&(n.style.overflowY=t?"":"hidden",t||(n.scrollTop=0))},v=function(e,t,n,i){var o=parseInt(e.getStyle(t,n,i),10);return isNaN(o)?0:o},b=function(e,t){var n,i,o,r,s,a,g,u,l,c,m,f=e.dom,d=e.getDoc();d&&((n=e).plugins.fullscreen&&n.plugins.fullscreen.isFullscreen()?p(e,!0):(i=d.documentElement,o=e.getParam("autoresize_bottom_margin",50,"number"),r=y(e),s=v(f,i,"margin-top",!0),a=v(f,i,"margin-bottom",!0),(g=i.offsetHeight+s+a+o)<0&&(g=0),g+(u=e.getContainer().offsetHeight-e.getContentAreaContainer().offsetHeight)>y(e)&&(r=g+u),(l=e.getParam("max_height",0,"number"))&&l<r?(r=l,p(e,!0)):p(e,!1),r!==t.get()&&(c=r-t.get(),f.setStyle(e.getContainer(),"height",r+"px"),t.set(r),e.fire("ResizeEditor"),h.browser.isSafari()&&h.mac&&(m=e.getWin()).scrollTo(m.pageXOffset,m.pageYOffset),e.hasFocus()&&e.selection.scrollIntoView(e.selection.getNode()),h.webkit&&c<0&&b(e,t))))};e.add("autoresize",function(e){var t,n,i,o,r,s;e.settings.hasOwnProperty("resize")||(e.settings.resize=!1),e.inline||(s=0,r=t={get:function(){return s},set:function(e){s=e}},(o=e).addCommand("mceAutoResize",function(){b(o,r)}),i=t,(n=e).on("init",function(){var e=n.getParam("autoresize_overflow_padding",1,"number"),t=n.dom;t.setStyles(n.getDoc().documentElement,{height:"auto"}),t.setStyles(n.getBody(),{paddingLeft:e,paddingRight:e,"min-height":0})}),n.on("NodeChange SetContent keyup FullscreenStateChanged ResizeContent",function(){b(n,i)}),n.getParam("autoresize_on_init",!0,"boolean")&&n.on("init",function(){a(n,i,20,100,function(){a(n,i,5,1e3)})}))})}();
@@ -0,0 +1,212 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
(function () {
'use strict';
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
var eq = function (t) {
return function (a) {
return t === a;
};
};
var isUndefined = eq(undefined);
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Delay');
var global$2 = tinymce.util.Tools.resolve('tinymce.util.LocalStorage');
var global$3 = tinymce.util.Tools.resolve('tinymce.util.Tools');
var fireRestoreDraft = function (editor) {
return editor.fire('RestoreDraft');
};
var fireStoreDraft = function (editor) {
return editor.fire('StoreDraft');
};
var fireRemoveDraft = function (editor) {
return editor.fire('RemoveDraft');
};
var parse = function (timeString, defaultTime) {
var multiples = {
s: 1000,
m: 60000
};
var toParse = timeString || defaultTime;
var parsedTime = /^(\d+)([ms]?)$/.exec('' + toParse);
return (parsedTime[2] ? multiples[parsedTime[2]] : 1) * parseInt(toParse, 10);
};
var shouldAskBeforeUnload = function (editor) {
return editor.getParam('autosave_ask_before_unload', true);
};
var getAutoSavePrefix = function (editor) {
var location = document.location;
return editor.getParam('autosave_prefix', 'tinymce-autosave-{path}{query}{hash}-{id}-').replace(/{path}/g, location.pathname).replace(/{query}/g, location.search).replace(/{hash}/g, location.hash).replace(/{id}/g, editor.id);
};
var shouldRestoreWhenEmpty = function (editor) {
return editor.getParam('autosave_restore_when_empty', false);
};
var getAutoSaveInterval = function (editor) {
return parse(editor.getParam('autosave_interval'), '30s');
};
var getAutoSaveRetention = function (editor) {
return parse(editor.getParam('autosave_retention'), '20m');
};
var isEmpty = function (editor, html) {
if (isUndefined(html)) {
return editor.dom.isEmpty(editor.getBody());
} else {
var trimmedHtml = global$3.trim(html);
if (trimmedHtml === '') {
return true;
} else {
var fragment = new DOMParser().parseFromString(trimmedHtml, 'text/html');
return editor.dom.isEmpty(fragment);
}
}
};
var hasDraft = function (editor) {
var time = parseInt(global$2.getItem(getAutoSavePrefix(editor) + 'time'), 10) || 0;
if (new Date().getTime() - time > getAutoSaveRetention(editor)) {
removeDraft(editor, false);
return false;
}
return true;
};
var removeDraft = function (editor, fire) {
var prefix = getAutoSavePrefix(editor);
global$2.removeItem(prefix + 'draft');
global$2.removeItem(prefix + 'time');
if (fire !== false) {
fireRemoveDraft(editor);
}
};
var storeDraft = function (editor) {
var prefix = getAutoSavePrefix(editor);
if (!isEmpty(editor) && editor.isDirty()) {
global$2.setItem(prefix + 'draft', editor.getContent({
format: 'raw',
no_events: true
}));
global$2.setItem(prefix + 'time', new Date().getTime().toString());
fireStoreDraft(editor);
}
};
var restoreDraft = function (editor) {
var prefix = getAutoSavePrefix(editor);
if (hasDraft(editor)) {
editor.setContent(global$2.getItem(prefix + 'draft'), { format: 'raw' });
fireRestoreDraft(editor);
}
};
var startStoreDraft = function (editor) {
var interval = getAutoSaveInterval(editor);
global$1.setEditorInterval(editor, function () {
storeDraft(editor);
}, interval);
};
var restoreLastDraft = function (editor) {
editor.undoManager.transact(function () {
restoreDraft(editor);
removeDraft(editor);
});
editor.focus();
};
var get = function (editor) {
return {
hasDraft: function () {
return hasDraft(editor);
},
storeDraft: function () {
return storeDraft(editor);
},
restoreDraft: function () {
return restoreDraft(editor);
},
removeDraft: function (fire) {
return removeDraft(editor, fire);
},
isEmpty: function (html) {
return isEmpty(editor, html);
}
};
};
var global$4 = tinymce.util.Tools.resolve('tinymce.EditorManager');
var setup = function (editor) {
editor.editorManager.on('BeforeUnload', function (e) {
var msg;
global$3.each(global$4.get(), function (editor) {
if (editor.plugins.autosave) {
editor.plugins.autosave.storeDraft();
}
if (!msg && editor.isDirty() && shouldAskBeforeUnload(editor)) {
msg = editor.translate('You have unsaved changes are you sure you want to navigate away?');
}
});
if (msg) {
e.preventDefault();
e.returnValue = msg;
}
});
};
var makeSetupHandler = function (editor) {
return function (api) {
api.setDisabled(!hasDraft(editor));
var editorEventCallback = function () {
return api.setDisabled(!hasDraft(editor));
};
editor.on('StoreDraft RestoreDraft RemoveDraft', editorEventCallback);
return function () {
return editor.off('StoreDraft RestoreDraft RemoveDraft', editorEventCallback);
};
};
};
var register = function (editor) {
startStoreDraft(editor);
editor.ui.registry.addButton('restoredraft', {
tooltip: 'Restore last draft',
icon: 'restore-draft',
onAction: function () {
restoreLastDraft(editor);
},
onSetup: makeSetupHandler(editor)
});
editor.ui.registry.addMenuItem('restoredraft', {
text: 'Restore last draft',
icon: 'restore-draft',
onAction: function () {
restoreLastDraft(editor);
},
onSetup: makeSetupHandler(editor)
});
};
function Plugin () {
global.add('autosave', function (editor) {
setup(editor);
register(editor);
editor.on('init', function () {
if (shouldRestoreWhenEmpty(editor) && editor.dom.isEmpty(editor.getBody())) {
restoreDraft(editor);
}
});
return get(editor);
});
}
Plugin();
}());
@@ -0,0 +1,9 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
!function(){"use strict";var e,t=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=(e=undefined,function(t){return e===t}),r=tinymce.util.Tools.resolve("tinymce.util.Delay"),n=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),o=tinymce.util.Tools.resolve("tinymce.util.Tools"),i=function(t,e){var r=t||e,n=/^(\d+)([ms]?)$/.exec(""+r);return(n[2]?{s:1e3,m:6e4}[n[2]]:1)*parseInt(r,10)},u=function(t){var e=document.location;return t.getParam("autosave_prefix","tinymce-autosave-{path}{query}{hash}-{id}-").replace(/{path}/g,e.pathname).replace(/{query}/g,e.search).replace(/{hash}/g,e.hash).replace(/{id}/g,t.id)},s=function(t,e){if(a(e))return t.dom.isEmpty(t.getBody());var r=o.trim(e);if(""===r)return!0;var n=(new DOMParser).parseFromString(r,"text/html");return t.dom.isEmpty(n)},f=function(t){var e=parseInt(n.getItem(u(t)+"time"),10)||0;return!((new Date).getTime()-e>i(t.getParam("autosave_retention"),"20m"))||(c(t,!1),!1)},c=function(t,e){var r=u(t);n.removeItem(r+"draft"),n.removeItem(r+"time"),!1!==e&&t.fire("RemoveDraft")},m=function(t){var e=u(t);!s(t)&&t.isDirty()&&(n.setItem(e+"draft",t.getContent({format:"raw",no_events:!0})),n.setItem(e+"time",(new Date).getTime().toString()),t.fire("StoreDraft"))},l=function(t){var e=u(t);f(t)&&(t.setContent(n.getItem(e+"draft"),{format:"raw"}),t.fire("RestoreDraft"))},v=function(t){var e=i(t.getParam("autosave_interval"),"30s");r.setEditorInterval(t,function(){m(t)},e)},d=function(t){t.undoManager.transact(function(){l(t),c(t)}),t.focus()},g=tinymce.util.Tools.resolve("tinymce.EditorManager"),y=function(r){return function(t){t.setDisabled(!f(r));var e=function(){return t.setDisabled(!f(r))};return r.on("StoreDraft RestoreDraft RemoveDraft",e),function(){return r.off("StoreDraft RestoreDraft RemoveDraft",e)}}};t.add("autosave",function(t){var e,r;return t.editorManager.on("BeforeUnload",function(t){var e;o.each(g.get(),function(t){t.plugins.autosave&&t.plugins.autosave.storeDraft(),!e&&t.isDirty()&&t.getParam("autosave_ask_before_unload",!0)&&(e=t.translate("You have unsaved changes are you sure you want to navigate away?"))}),e&&(t.preventDefault(),t.returnValue=e)}),v(e=t),e.ui.registry.addButton("restoredraft",{tooltip:"Restore last draft",icon:"restore-draft",onAction:function(){d(e)},onSetup:y(e)}),e.ui.registry.addMenuItem("restoredraft",{text:"Restore last draft",icon:"restore-draft",onAction:function(){d(e)},onSetup:y(e)}),t.on("init",function(){t.getParam("autosave_restore_when_empty",!1)&&t.dom.isEmpty(t.getBody())&&l(t)}),r=t,{hasDraft:function(){return f(r)},storeDraft:function(){return m(r)},restoreDraft:function(){return l(r)},removeDraft:function(t){return c(r,t)},isEmpty:function(t){return s(r,t)}}})}();
@@ -0,0 +1,99 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
(function () {
'use strict';
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
var html2bbcode = function (s) {
s = global$1.trim(s);
var rep = function (re, str) {
s = s.replace(re, str);
};
rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi, '[url=$1]$2[/url]');
rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]');
rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]');
rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]');
rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]');
rep(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi, '[color=$1]$2[/color]');
rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, '[color=$1]$2[/color]');
rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi, '[size=$1]$2[/size]');
rep(/<font>(.*?)<\/font>/gi, '$1');
rep(/<img.*?src=\"(.*?)\".*?\/>/gi, '[img]$1[/img]');
rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi, '[code]$1[/code]');
rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi, '[quote]$1[/quote]');
rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi, '[code][b]$1[/b][/code]');
rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi, '[quote][b]$1[/b][/quote]');
rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi, '[code][i]$1[/i][/code]');
rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi, '[quote][i]$1[/i][/quote]');
rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi, '[code][u]$1[/u][/code]');
rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi, '[quote][u]$1[/u][/quote]');
rep(/<\/(strong|b)>/gi, '[/b]');
rep(/<(strong|b)>/gi, '[b]');
rep(/<\/(em|i)>/gi, '[/i]');
rep(/<(em|i)>/gi, '[i]');
rep(/<\/u>/gi, '[/u]');
rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi, '[u]$1[/u]');
rep(/<u>/gi, '[u]');
rep(/<blockquote[^>]*>/gi, '[quote]');
rep(/<\/blockquote>/gi, '[/quote]');
rep(/<br \/>/gi, '\n');
rep(/<br\/>/gi, '\n');
rep(/<br>/gi, '\n');
rep(/<p>/gi, '');
rep(/<\/p>/gi, '\n');
rep(/&nbsp;|\u00a0/gi, ' ');
rep(/&quot;/gi, '"');
rep(/&lt;/gi, '<');
rep(/&gt;/gi, '>');
rep(/&amp;/gi, '&');
return s;
};
var bbcode2html = function (s) {
s = global$1.trim(s);
var rep = function (re, str) {
s = s.replace(re, str);
};
rep(/\n/gi, '<br />');
rep(/\[b\]/gi, '<strong>');
rep(/\[\/b\]/gi, '</strong>');
rep(/\[i\]/gi, '<em>');
rep(/\[\/i\]/gi, '</em>');
rep(/\[u\]/gi, '<u>');
rep(/\[\/u\]/gi, '</u>');
rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi, '<a href="$1">$2</a>');
rep(/\[url\](.*?)\[\/url\]/gi, '<a href="$1">$1</a>');
rep(/\[img\](.*?)\[\/img\]/gi, '<img src="$1" />');
rep(/\[color=(.*?)\](.*?)\[\/color\]/gi, '<font color="$1">$2</font>');
rep(/\[code\](.*?)\[\/code\]/gi, '<span class="codeStyle">$1</span>&nbsp;');
rep(/\[quote.*?\](.*?)\[\/quote\]/gi, '<span class="quoteStyle">$1</span>&nbsp;');
return s;
};
function Plugin () {
global.add('bbcode', function (editor) {
editor.on('BeforeSetContent', function (e) {
e.content = bbcode2html(e.content);
});
editor.on('PostProcess', function (e) {
if (e.set) {
e.content = bbcode2html(e.content);
}
if (e.get) {
e.content = html2bbcode(e.content);
}
});
});
}
Plugin();
}());
@@ -0,0 +1,9 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
!function(){"use strict";var o=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=tinymce.util.Tools.resolve("tinymce.util.Tools"),t=function(t){t=e.trim(t);var o=function(o,e){t=t.replace(o,e)};return o(/\n/gi,"<br />"),o(/\[b\]/gi,"<strong>"),o(/\[\/b\]/gi,"</strong>"),o(/\[i\]/gi,"<em>"),o(/\[\/i\]/gi,"</em>"),o(/\[u\]/gi,"<u>"),o(/\[\/u\]/gi,"</u>"),o(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>'),o(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>'),o(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />'),o(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>'),o(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span>&nbsp;'),o(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span>&nbsp;'),t};o.add("bbcode",function(o){o.on("BeforeSetContent",function(o){o.content=t(o.content)}),o.on("PostProcess",function(o){o.set&&(o.content=t(o.content)),o.get&&(o.content=function(t){t=e.trim(t);var o=function(o,e){t=t.replace(o,e)};return o(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]"),o(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),o(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),o(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),o(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),o(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]"),o(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]"),o(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]"),o(/<font>(.*?)<\/font>/gi,"$1"),o(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]"),o(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]"),o(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]"),o(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),o(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),o(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),o(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),o(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),o(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),o(/<\/(strong|b)>/gi,"[/b]"),o(/<(strong|b)>/gi,"[b]"),o(/<\/(em|i)>/gi,"[/i]"),o(/<(em|i)>/gi,"[i]"),o(/<\/u>/gi,"[/u]"),o(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]"),o(/<u>/gi,"[u]"),o(/<blockquote[^>]*>/gi,"[quote]"),o(/<\/blockquote>/gi,"[/quote]"),o(/<br \/>/gi,"\n"),o(/<br\/>/gi,"\n"),o(/<br>/gi,"\n"),o(/<p>/gi,""),o(/<\/p>/gi,"\n"),o(/&nbsp;|\u00a0/gi," "),o(/&quot;/gi,'"'),o(/&lt;/gi,"<"),o(/&gt;/gi,">"),o(/&amp;/gi,"&"),t}(o.content))})})}();
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,92 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
(function () {
'use strict';
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
var setContent = function (editor, html) {
editor.focus();
editor.undoManager.transact(function () {
editor.setContent(html);
});
editor.selection.setCursorLocation();
editor.nodeChanged();
};
var getContent = function (editor) {
return editor.getContent({ source_view: true });
};
var open = function (editor) {
var editorContent = getContent(editor);
editor.windowManager.open({
title: 'Source Code',
size: 'large',
body: {
type: 'panel',
items: [{
type: 'textarea',
name: 'code'
}]
},
buttons: [
{
type: 'cancel',
name: 'cancel',
text: 'Cancel'
},
{
type: 'submit',
name: 'save',
text: 'Save',
primary: true
}
],
initialData: { code: editorContent },
onSubmit: function (api) {
setContent(editor, api.getData().code);
api.close();
}
});
};
var register = function (editor) {
editor.addCommand('mceCodeEditor', function () {
open(editor);
});
};
var register$1 = function (editor) {
editor.ui.registry.addButton('code', {
icon: 'sourcecode',
tooltip: 'Source code',
onAction: function () {
return open(editor);
}
});
editor.ui.registry.addMenuItem('code', {
icon: 'sourcecode',
text: 'Source code',
onAction: function () {
return open(editor);
}
});
};
function Plugin () {
global.add('code', function (editor) {
register(editor);
register$1(editor);
return {};
});
}
Plugin();
}());
@@ -0,0 +1,9 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),o=function(o){var e=o.getContent({source_view:!0});o.windowManager.open({title:"Source Code",size:"large",body:{type:"panel",items:[{type:"textarea",name:"code"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{code:e},onSubmit:function(e){var t,n;t=o,n=e.getData().code,t.focus(),t.undoManager.transact(function(){t.setContent(n)}),t.selection.setCursorLocation(),t.nodeChanged(),e.close()}})};e.add("code",function(e){var t,n;return(t=e).addCommand("mceCodeEditor",function(){o(t)}),(n=e).ui.registry.addButton("code",{icon:"sourcecode",tooltip:"Source code",onAction:function(){return o(n)}}),n.ui.registry.addMenuItem("code",{icon:"sourcecode",text:"Source code",onAction:function(){return o(n)}}),{}})}();
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,22 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
(function () {
'use strict';
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
function Plugin () {
global.add('colorpicker', function () {
console.warn('Color picker plugin is now built in to the core editor, please remove it from your editor configuration');
});
}
Plugin();
}());
@@ -0,0 +1,9 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
!function(){"use strict";tinymce.util.Tools.resolve("tinymce.PluginManager").add("colorpicker",function(){console.warn("Color picker plugin is now built in to the core editor, please remove it from your editor configuration")})}();
@@ -0,0 +1,22 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
(function () {
'use strict';
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
function Plugin () {
global.add('contextmenu', function () {
console.warn('Context menu plugin is now built in to the core editor, please remove it from your editor configuration');
});
}
Plugin();
}());
@@ -0,0 +1,9 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
!function(){"use strict";tinymce.util.Tools.resolve("tinymce.PluginManager").add("contextmenu",function(){console.warn("Context menu plugin is now built in to the core editor, please remove it from your editor configuration")})}();
@@ -0,0 +1,314 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
(function () {
'use strict';
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
var setDir = function (editor, dir) {
var dom = editor.dom;
var curDir;
var blocks = editor.selection.getSelectedBlocks();
if (blocks.length) {
curDir = dom.getAttrib(blocks[0], 'dir');
global$1.each(blocks, function (block) {
if (!dom.getParent(block.parentNode, '*[dir="' + dir + '"]', dom.getRoot())) {
dom.setAttrib(block, 'dir', curDir !== dir ? dir : null);
}
});
editor.nodeChanged();
}
};
var register = function (editor) {
editor.addCommand('mceDirectionLTR', function () {
setDir(editor, 'ltr');
});
editor.addCommand('mceDirectionRTL', function () {
setDir(editor, 'rtl');
});
};
var noop = function () {
};
var compose1 = function (fbc, fab) {
return function (a) {
return fbc(fab(a));
};
};
var constant = function (value) {
return function () {
return value;
};
};
var never = constant(false);
var always = constant(true);
var none = function () {
return NONE;
};
var NONE = function () {
var eq = function (o) {
return o.isNone();
};
var call = function (thunk) {
return thunk();
};
var id = function (n) {
return n;
};
var me = {
fold: function (n, _s) {
return n();
},
is: never,
isSome: never,
isNone: always,
getOr: id,
getOrThunk: call,
getOrDie: function (msg) {
throw new Error(msg || 'error: getOrDie called on none.');
},
getOrNull: constant(null),
getOrUndefined: constant(undefined),
or: id,
orThunk: call,
map: none,
each: noop,
bind: none,
exists: never,
forall: always,
filter: none,
equals: eq,
equals_: eq,
toArray: function () {
return [];
},
toString: constant('none()')
};
return me;
}();
var some = function (a) {
var constant_a = constant(a);
var self = function () {
return me;
};
var bind = function (f) {
return f(a);
};
var me = {
fold: function (n, s) {
return s(a);
},
is: function (v) {
return a === v;
},
isSome: always,
isNone: never,
getOr: constant_a,
getOrThunk: constant_a,
getOrDie: constant_a,
getOrNull: constant_a,
getOrUndefined: constant_a,
or: self,
orThunk: self,
map: function (f) {
return some(f(a));
},
each: function (f) {
f(a);
},
bind: bind,
exists: bind,
forall: bind,
filter: function (f) {
return f(a) ? me : NONE;
},
toArray: function () {
return [a];
},
toString: function () {
return 'some(' + a + ')';
},
equals: function (o) {
return o.is(a);
},
equals_: function (o, elementEq) {
return o.fold(never, function (b) {
return elementEq(a, b);
});
}
};
return me;
};
var from = function (value) {
return value === null || value === undefined ? NONE : some(value);
};
var Optional = {
some: some,
none: none,
from: from
};
var isSimpleType = function (type) {
return function (value) {
return typeof value === type;
};
};
var isFunction = isSimpleType('function');
var isSupported = function (dom) {
return dom.style !== undefined && isFunction(dom.style.getPropertyValue);
};
var fromHtml = function (html, scope) {
var doc = scope || document;
var div = doc.createElement('div');
div.innerHTML = html;
if (!div.hasChildNodes() || div.childNodes.length > 1) {
console.error('HTML does not have a single root node', html);
throw new Error('HTML must have a single root node');
}
return fromDom(div.childNodes[0]);
};
var fromTag = function (tag, scope) {
var doc = scope || document;
var node = doc.createElement(tag);
return fromDom(node);
};
var fromText = function (text, scope) {
var doc = scope || document;
var node = doc.createTextNode(text);
return fromDom(node);
};
var fromDom = function (node) {
if (node === null || node === undefined) {
throw new Error('Node cannot be null or undefined');
}
return { dom: node };
};
var fromPoint = function (docElm, x, y) {
return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
};
var SugarElement = {
fromHtml: fromHtml,
fromTag: fromTag,
fromText: fromText,
fromDom: fromDom,
fromPoint: fromPoint
};
var Global = typeof window !== 'undefined' ? window : Function('return this;')();
var DOCUMENT = 9;
var DOCUMENT_FRAGMENT = 11;
var TEXT = 3;
var type = function (element) {
return element.dom.nodeType;
};
var isType = function (t) {
return function (element) {
return type(element) === t;
};
};
var isText = isType(TEXT);
var isDocument = isType(DOCUMENT);
var isDocumentFragment = isType(DOCUMENT_FRAGMENT);
var owner = function (element) {
return SugarElement.fromDom(element.dom.ownerDocument);
};
var documentOrOwner = function (dos) {
return isDocument(dos) ? dos : owner(dos);
};
var isShadowRoot = function (dos) {
return isDocumentFragment(dos);
};
var supported = isFunction(Element.prototype.attachShadow) && isFunction(Node.prototype.getRootNode);
var getRootNode = supported ? function (e) {
return SugarElement.fromDom(e.dom.getRootNode());
} : documentOrOwner;
var getShadowRoot = function (e) {
var r = getRootNode(e);
return isShadowRoot(r) ? Optional.some(r) : Optional.none();
};
var getShadowHost = function (e) {
return SugarElement.fromDom(e.dom.host);
};
var inBody = function (element) {
var dom = isText(element) ? element.dom.parentNode : element.dom;
if (dom === undefined || dom === null || dom.ownerDocument === null) {
return false;
}
var doc = dom.ownerDocument;
return getShadowRoot(SugarElement.fromDom(dom)).fold(function () {
return doc.body.contains(dom);
}, compose1(inBody, getShadowHost));
};
var get = function (element, property) {
var dom = element.dom;
var styles = window.getComputedStyle(dom);
var r = styles.getPropertyValue(property);
return r === '' && !inBody(element) ? getUnsafeProperty(dom, property) : r;
};
var getUnsafeProperty = function (dom, property) {
return isSupported(dom) ? dom.style.getPropertyValue(property) : '';
};
var getDirection = function (element) {
return get(element, 'direction') === 'rtl' ? 'rtl' : 'ltr';
};
var getNodeChangeHandler = function (editor, dir) {
return function (api) {
var nodeChangeHandler = function (e) {
var element = SugarElement.fromDom(e.element);
api.setActive(getDirection(element) === dir);
};
editor.on('NodeChange', nodeChangeHandler);
return function () {
return editor.off('NodeChange', nodeChangeHandler);
};
};
};
var register$1 = function (editor) {
editor.ui.registry.addToggleButton('ltr', {
tooltip: 'Left to right',
icon: 'ltr',
onAction: function () {
return editor.execCommand('mceDirectionLTR');
},
onSetup: getNodeChangeHandler(editor, 'ltr')
});
editor.ui.registry.addToggleButton('rtl', {
tooltip: 'Right to left',
icon: 'rtl',
onAction: function () {
return editor.execCommand('mceDirectionRTL');
},
onSetup: getNodeChangeHandler(editor, 'rtl')
});
};
function Plugin () {
global.add('directionality', function (editor) {
register(editor);
register$1(editor);
});
}
Plugin();
}());
@@ -0,0 +1,9 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
!function(){"use strict";var n,t,e,o,r=tinymce.util.Tools.resolve("tinymce.PluginManager"),u=tinymce.util.Tools.resolve("tinymce.util.Tools"),i=function(n,t){var e,o=n.dom,r=n.selection.getSelectedBlocks();r.length&&(e=o.getAttrib(r[0],"dir"),u.each(r,function(n){o.getParent(n.parentNode,'*[dir="'+t+'"]',o.getRoot())||o.setAttrib(n,"dir",e!==t?t:null)}),n.nodeChanged())},c=function(n){return function(){return n}},f=c(!1),d=c(!0),l=function(){return m},m=(n=function(n){return n.isNone()},{fold:function(n,t){return n()},is:f,isSome:f,isNone:d,getOr:e=function(n){return n},getOrThunk:t=function(n){return n()},getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:c(null),getOrUndefined:c(undefined),or:e,orThunk:t,map:l,each:function(){},bind:l,exists:f,forall:d,filter:l,equals:n,equals_:n,toArray:function(){return[]},toString:c("none()")}),a=function(e){var n=c(e),t=function(){return r},o=function(n){return n(e)},r={fold:function(n,t){return t(e)},is:function(n){return e===n},isSome:d,isNone:f,getOr:n,getOrThunk:n,getOrDie:n,getOrNull:n,getOrUndefined:n,or:t,orThunk:t,map:function(n){return a(n(e))},each:function(n){n(e)},bind:o,exists:o,forall:o,filter:function(n){return n(e)?r:m},toArray:function(){return[e]},toString:function(){return"some("+e+")"},equals:function(n){return n.is(e)},equals_:function(n,t){return n.fold(f,function(n){return t(e,n)})}};return r},s={some:a,none:l,from:function(n){return null===n||n===undefined?m:a(n)}},g=(o="function",function(n){return typeof n===o}),h=function(n){if(null===n||n===undefined)throw new Error("Node cannot be null or undefined");return{dom:n}},y={fromHtml:function(n,t){var e=(t||document).createElement("div");if(e.innerHTML=n,!e.hasChildNodes()||1<e.childNodes.length)throw console.error("HTML does not have a single root node",n),new Error("HTML must have a single root node");return h(e.childNodes[0])},fromTag:function(n,t){var e=(t||document).createElement(n);return h(e)},fromText:function(n,t){var e=(t||document).createTextNode(n);return h(e)},fromDom:h,fromPoint:function(n,t,e){return s.from(n.dom.elementFromPoint(t,e)).map(h)}},v=("undefined"!=typeof window||Function("return this;")(),function(t){return function(n){return n.dom.nodeType===t}}),p=v(3),T=v(9),N=v(11),D=g(Element.prototype.attachShadow)&&g(Node.prototype.getRootNode)?function(n){return y.fromDom(n.dom.getRootNode())}:function(n){return T(n)?n:(t=n,y.fromDom(t.dom.ownerDocument));var t},w=function(n){var t=D(n);return N(t)?s.some(t):s.none()},O=function(n){return y.fromDom(n.dom.host)},C=function(n){var t=p(n)?n.dom.parentNode:n.dom;if(t===undefined||null===t||null===t.ownerDocument)return!1;var e,o,r=t.ownerDocument;return w(y.fromDom(t)).fold(function(){return r.body.contains(t)},(e=C,o=O,function(n){return e(o(n))}))},S=function(n,t){return(e=n).style!==undefined&&g(e.style.getPropertyValue)?n.style.getPropertyValue(t):"";var e},L=function(n){return"rtl"===(e="direction",o=(t=n).dom,""!==(r=window.getComputedStyle(o).getPropertyValue(e))||C(t)?r:S(o,e))?"rtl":"ltr";var t,e,o,r},R=function(t,o){return function(e){var n=function(n){var t=y.fromDom(n.element);e.setActive(L(t)===o)};return t.on("NodeChange",n),function(){return t.off("NodeChange",n)}}};r.add("directionality",function(n){var t,e;(t=n).addCommand("mceDirectionLTR",function(){i(t,"ltr")}),t.addCommand("mceDirectionRTL",function(){i(t,"rtl")}),(e=n).ui.registry.addToggleButton("ltr",{tooltip:"Left to right",icon:"ltr",onAction:function(){return e.execCommand("mceDirectionLTR")},onSetup:R(e,"ltr")}),e.ui.registry.addToggleButton("rtl",{tooltip:"Right to left",icon:"rtl",onAction:function(){return e.execCommand("mceDirectionRTL")},onSetup:R(e,"rtl")})})}();
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,605 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
(function () {
'use strict';
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
var DEFAULT_ID = 'tinymce.plugins.emoticons';
var getEmoticonDatabase = function (editor) {
return editor.getParam('emoticons_database', 'emojis', 'string');
};
var getEmoticonDatabaseUrl = function (editor, pluginUrl) {
var database = getEmoticonDatabase(editor);
return editor.getParam('emoticons_database_url', pluginUrl + '/js/' + database + editor.suffix + '.js', 'string');
};
var getEmoticonDatabaseId = function (editor) {
return editor.getParam('emoticons_database_id', DEFAULT_ID, 'string');
};
var getAppendedEmoticons = function (editor) {
return editor.getParam('emoticons_append', {}, 'object');
};
var getEmotionsImageUrl = function (editor) {
return editor.getParam('emoticons_images_url', 'https://twemoji.maxcdn.com/v/13.0.1/72x72/', 'string');
};
var __assign = function () {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var Cell = function (initial) {
var value = initial;
var get = function () {
return value;
};
var set = function (v) {
value = v;
};
return {
get: get,
set: set
};
};
var hasOwnProperty = Object.prototype.hasOwnProperty;
var shallow = function (old, nu) {
return nu;
};
var baseMerge = function (merger) {
return function () {
var objects = new Array(arguments.length);
for (var i = 0; i < objects.length; i++) {
objects[i] = arguments[i];
}
if (objects.length === 0) {
throw new Error('Can\'t merge zero objects');
}
var ret = {};
for (var j = 0; j < objects.length; j++) {
var curObject = objects[j];
for (var key in curObject) {
if (hasOwnProperty.call(curObject, key)) {
ret[key] = merger(ret[key], curObject[key]);
}
}
}
return ret;
};
};
var merge = baseMerge(shallow);
var noop = function () {
};
var constant = function (value) {
return function () {
return value;
};
};
var never = constant(false);
var always = constant(true);
var none = function () {
return NONE;
};
var NONE = function () {
var eq = function (o) {
return o.isNone();
};
var call = function (thunk) {
return thunk();
};
var id = function (n) {
return n;
};
var me = {
fold: function (n, _s) {
return n();
},
is: never,
isSome: never,
isNone: always,
getOr: id,
getOrThunk: call,
getOrDie: function (msg) {
throw new Error(msg || 'error: getOrDie called on none.');
},
getOrNull: constant(null),
getOrUndefined: constant(undefined),
or: id,
orThunk: call,
map: none,
each: noop,
bind: none,
exists: never,
forall: always,
filter: none,
equals: eq,
equals_: eq,
toArray: function () {
return [];
},
toString: constant('none()')
};
return me;
}();
var some = function (a) {
var constant_a = constant(a);
var self = function () {
return me;
};
var bind = function (f) {
return f(a);
};
var me = {
fold: function (n, s) {
return s(a);
},
is: function (v) {
return a === v;
},
isSome: always,
isNone: never,
getOr: constant_a,
getOrThunk: constant_a,
getOrDie: constant_a,
getOrNull: constant_a,
getOrUndefined: constant_a,
or: self,
orThunk: self,
map: function (f) {
return some(f(a));
},
each: function (f) {
f(a);
},
bind: bind,
exists: bind,
forall: bind,
filter: function (f) {
return f(a) ? me : NONE;
},
toArray: function () {
return [a];
},
toString: function () {
return 'some(' + a + ')';
},
equals: function (o) {
return o.is(a);
},
equals_: function (o, elementEq) {
return o.fold(never, function (b) {
return elementEq(a, b);
});
}
};
return me;
};
var from = function (value) {
return value === null || value === undefined ? NONE : some(value);
};
var Optional = {
some: some,
none: none,
from: from
};
var keys = Object.keys;
var hasOwnProperty$1 = Object.hasOwnProperty;
var each = function (obj, f) {
var props = keys(obj);
for (var k = 0, len = props.length; k < len; k++) {
var i = props[k];
var x = obj[i];
f(x, i);
}
};
var map = function (obj, f) {
return tupleMap(obj, function (x, i) {
return {
k: i,
v: f(x, i)
};
});
};
var tupleMap = function (obj, f) {
var r = {};
each(obj, function (x, i) {
var tuple = f(x, i);
r[tuple.k] = tuple.v;
});
return r;
};
var has = function (obj, key) {
return hasOwnProperty$1.call(obj, key);
};
var checkRange = function (str, substr, start) {
return substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr;
};
var contains = function (str, substr) {
return str.indexOf(substr) !== -1;
};
var startsWith = function (str, prefix) {
return checkRange(str, prefix, 0);
};
var global$1 = tinymce.util.Tools.resolve('tinymce.Resource');
var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay');
var global$3 = tinymce.util.Tools.resolve('tinymce.util.Promise');
var ALL_CATEGORY = 'All';
var categoryNameMap = {
symbols: 'Symbols',
people: 'People',
animals_and_nature: 'Animals and Nature',
food_and_drink: 'Food and Drink',
activity: 'Activity',
travel_and_places: 'Travel and Places',
objects: 'Objects',
flags: 'Flags',
user: 'User Defined'
};
var translateCategory = function (categories, name) {
return has(categories, name) ? categories[name] : name;
};
var getUserDefinedEmoticons = function (editor) {
var userDefinedEmoticons = getAppendedEmoticons(editor);
return map(userDefinedEmoticons, function (value) {
return __assign({
keywords: [],
category: 'user'
}, value);
});
};
var initDatabase = function (editor, databaseUrl, databaseId) {
var categories = Cell(Optional.none());
var all = Cell(Optional.none());
var emojiImagesUrl = getEmotionsImageUrl(editor);
var getEmoji = function (lib) {
if (startsWith(lib.char, '<img')) {
return lib.char.replace(/src="([^"]+)"/, function (match, url) {
return 'src="' + emojiImagesUrl + url + '"';
});
} else {
return lib.char;
}
};
var processEmojis = function (emojis) {
var cats = {};
var everything = [];
each(emojis, function (lib, title) {
var entry = {
title: title,
keywords: lib.keywords,
char: getEmoji(lib),
category: translateCategory(categoryNameMap, lib.category)
};
var current = cats[entry.category] !== undefined ? cats[entry.category] : [];
cats[entry.category] = current.concat([entry]);
everything.push(entry);
});
categories.set(Optional.some(cats));
all.set(Optional.some(everything));
};
editor.on('init', function () {
global$1.load(databaseId, databaseUrl).then(function (emojis) {
var userEmojis = getUserDefinedEmoticons(editor);
processEmojis(merge(emojis, userEmojis));
}, function (err) {
console.log('Failed to load emoticons: ' + err);
categories.set(Optional.some({}));
all.set(Optional.some([]));
});
});
var listCategory = function (category) {
if (category === ALL_CATEGORY) {
return listAll();
}
return categories.get().bind(function (cats) {
return Optional.from(cats[category]);
}).getOr([]);
};
var listAll = function () {
return all.get().getOr([]);
};
var listCategories = function () {
return [ALL_CATEGORY].concat(keys(categories.get().getOr({})));
};
var waitForLoad = function () {
if (hasLoaded()) {
return global$3.resolve(true);
} else {
return new global$3(function (resolve, reject) {
var numRetries = 15;
var interval = global$2.setInterval(function () {
if (hasLoaded()) {
global$2.clearInterval(interval);
resolve(true);
} else {
numRetries--;
if (numRetries < 0) {
console.log('Could not load emojis from url: ' + databaseUrl);
global$2.clearInterval(interval);
reject(false);
}
}
}, 100);
});
}
};
var hasLoaded = function () {
return categories.get().isSome() && all.get().isSome();
};
return {
listCategories: listCategories,
hasLoaded: hasLoaded,
waitForLoad: waitForLoad,
listAll: listAll,
listCategory: listCategory
};
};
var exists = function (xs, pred) {
for (var i = 0, len = xs.length; i < len; i++) {
var x = xs[i];
if (pred(x, i)) {
return true;
}
}
return false;
};
var map$1 = function (xs, f) {
var len = xs.length;
var r = new Array(len);
for (var i = 0; i < len; i++) {
var x = xs[i];
r[i] = f(x, i);
}
return r;
};
var each$1 = function (xs, f) {
for (var i = 0, len = xs.length; i < len; i++) {
var x = xs[i];
f(x, i);
}
};
var setup = function (editor) {
editor.on('PreInit', function () {
editor.parser.addAttributeFilter('data-emoticon', function (nodes) {
each$1(nodes, function (node) {
node.attr('data-mce-resize', 'false');
node.attr('data-mce-placeholder', '1');
});
});
});
};
var emojiMatches = function (emoji, lowerCasePattern) {
return contains(emoji.title.toLowerCase(), lowerCasePattern) || exists(emoji.keywords, function (k) {
return contains(k.toLowerCase(), lowerCasePattern);
});
};
var emojisFrom = function (list, pattern, maxResults) {
var matches = [];
var lowerCasePattern = pattern.toLowerCase();
var reachedLimit = maxResults.fold(function () {
return never;
}, function (max) {
return function (size) {
return size >= max;
};
});
for (var i = 0; i < list.length; i++) {
if (pattern.length === 0 || emojiMatches(list[i], lowerCasePattern)) {
matches.push({
value: list[i].char,
text: list[i].title,
icon: list[i].char
});
if (reachedLimit(matches.length)) {
break;
}
}
}
return matches;
};
var init = function (editor, database) {
editor.ui.registry.addAutocompleter('emoticons', {
ch: ':',
columns: 'auto',
minChars: 2,
fetch: function (pattern, maxResults) {
return database.waitForLoad().then(function () {
var candidates = database.listAll();
return emojisFrom(candidates, pattern, Optional.some(maxResults));
});
},
onAction: function (autocompleteApi, rng, value) {
editor.selection.setRng(rng);
editor.insertContent(value);
autocompleteApi.hide();
}
});
};
var last = function (fn, rate) {
var timer = null;
var cancel = function () {
if (timer !== null) {
clearTimeout(timer);
timer = null;
}
};
var throttle = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (timer !== null) {
clearTimeout(timer);
}
timer = setTimeout(function () {
fn.apply(null, args);
timer = null;
}, rate);
};
return {
cancel: cancel,
throttle: throttle
};
};
var insertEmoticon = function (editor, ch) {
editor.insertContent(ch);
};
var patternName = 'pattern';
var open = function (editor, database) {
var initialState = {
pattern: '',
results: emojisFrom(database.listAll(), '', Optional.some(300))
};
var currentTab = Cell(ALL_CATEGORY);
var scan = function (dialogApi) {
var dialogData = dialogApi.getData();
var category = currentTab.get();
var candidates = database.listCategory(category);
var results = emojisFrom(candidates, dialogData[patternName], category === ALL_CATEGORY ? Optional.some(300) : Optional.none());
dialogApi.setData({ results: results });
};
var updateFilter = last(function (dialogApi) {
scan(dialogApi);
}, 200);
var searchField = {
label: 'Search',
type: 'input',
name: patternName
};
var resultsField = {
type: 'collection',
name: 'results'
};
var getInitialState = function () {
var body = {
type: 'tabpanel',
tabs: map$1(database.listCategories(), function (cat) {
return {
title: cat,
name: cat,
items: [
searchField,
resultsField
]
};
})
};
return {
title: 'Emoticons',
size: 'normal',
body: body,
initialData: initialState,
onTabChange: function (dialogApi, details) {
currentTab.set(details.newTabName);
updateFilter.throttle(dialogApi);
},
onChange: updateFilter.throttle,
onAction: function (dialogApi, actionData) {
if (actionData.name === 'results') {
insertEmoticon(editor, actionData.value);
dialogApi.close();
}
},
buttons: [{
type: 'cancel',
text: 'Close',
primary: true
}]
};
};
var dialogApi = editor.windowManager.open(getInitialState());
dialogApi.focus(patternName);
if (!database.hasLoaded()) {
dialogApi.block('Loading emoticons...');
database.waitForLoad().then(function () {
dialogApi.redial(getInitialState());
updateFilter.throttle(dialogApi);
dialogApi.focus(patternName);
dialogApi.unblock();
}).catch(function (_err) {
dialogApi.redial({
title: 'Emoticons',
body: {
type: 'panel',
items: [{
type: 'alertbanner',
level: 'error',
icon: 'warning',
text: '<p>Could not load emoticons</p>'
}]
},
buttons: [{
type: 'cancel',
text: 'Close',
primary: true
}],
initialData: {
pattern: '',
results: []
}
});
dialogApi.focus(patternName);
dialogApi.unblock();
});
}
};
var register = function (editor, database) {
var onAction = function () {
return open(editor, database);
};
editor.ui.registry.addButton('emoticons', {
tooltip: 'Emoticons',
icon: 'emoji',
onAction: onAction
});
editor.ui.registry.addMenuItem('emoticons', {
text: 'Emoticons...',
icon: 'emoji',
onAction: onAction
});
};
function Plugin () {
global.add('emoticons', function (editor, pluginUrl) {
var databaseUrl = getEmoticonDatabaseUrl(editor, pluginUrl);
var databaseId = getEmoticonDatabaseId(editor);
var database = initDatabase(editor, databaseUrl, databaseId);
register(editor, database);
init(editor, database);
setup(editor);
});
}
Plugin();
}());
File diff suppressed because one or more lines are too long
@@ -0,0 +1,544 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
(function () {
'use strict';
var Cell = function (initial) {
var value = initial;
var get = function () {
return value;
};
var set = function (v) {
value = v;
};
return {
get: get,
set: set
};
};
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
var __assign = function () {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
var global$2 = tinymce.util.Tools.resolve('tinymce.html.DomParser');
var global$3 = tinymce.util.Tools.resolve('tinymce.html.Node');
var global$4 = tinymce.util.Tools.resolve('tinymce.html.Serializer');
var shouldHideInSourceView = function (editor) {
return editor.getParam('fullpage_hide_in_source_view');
};
var getDefaultXmlPi = function (editor) {
return editor.getParam('fullpage_default_xml_pi');
};
var getDefaultEncoding = function (editor) {
return editor.getParam('fullpage_default_encoding');
};
var getDefaultFontFamily = function (editor) {
return editor.getParam('fullpage_default_font_family');
};
var getDefaultFontSize = function (editor) {
return editor.getParam('fullpage_default_font_size');
};
var getDefaultTextColor = function (editor) {
return editor.getParam('fullpage_default_text_color');
};
var getDefaultTitle = function (editor) {
return editor.getParam('fullpage_default_title');
};
var getDefaultDocType = function (editor) {
return editor.getParam('fullpage_default_doctype', '<!DOCTYPE html>');
};
var getProtect = function (editor) {
return editor.getParam('protect');
};
var parseHeader = function (head) {
return global$2({
validate: false,
root_name: '#document'
}).parse(head, { format: 'xhtml' });
};
var htmlToData = function (editor, head) {
var headerFragment = parseHeader(head);
var data = {};
var elm, matches;
function getAttr(elm, name) {
var value = elm.attr(name);
return value || '';
}
data.fontface = getDefaultFontFamily(editor);
data.fontsize = getDefaultFontSize(editor);
elm = headerFragment.firstChild;
if (elm.type === 7) {
data.xml_pi = true;
matches = /encoding="([^"]+)"/.exec(elm.value);
if (matches) {
data.docencoding = matches[1];
}
}
elm = headerFragment.getAll('#doctype')[0];
if (elm) {
data.doctype = '<!DOCTYPE' + elm.value + '>';
}
elm = headerFragment.getAll('title')[0];
if (elm && elm.firstChild) {
data.title = elm.firstChild.value;
}
global$1.each(headerFragment.getAll('meta'), function (meta) {
var name = meta.attr('name');
var httpEquiv = meta.attr('http-equiv');
var matches;
if (name) {
data[name.toLowerCase()] = meta.attr('content');
} else if (httpEquiv === 'Content-Type') {
matches = /charset\s*=\s*(.*)\s*/gi.exec(meta.attr('content'));
if (matches) {
data.docencoding = matches[1];
}
}
});
elm = headerFragment.getAll('html')[0];
if (elm) {
data.langcode = getAttr(elm, 'lang') || getAttr(elm, 'xml:lang');
}
data.stylesheets = [];
global$1.each(headerFragment.getAll('link'), function (link) {
if (link.attr('rel') === 'stylesheet') {
data.stylesheets.push(link.attr('href'));
}
});
elm = headerFragment.getAll('body')[0];
if (elm) {
data.langdir = getAttr(elm, 'dir');
data.style = getAttr(elm, 'style');
data.visited_color = getAttr(elm, 'vlink');
data.link_color = getAttr(elm, 'link');
data.active_color = getAttr(elm, 'alink');
}
return data;
};
var dataToHtml = function (editor, data, head) {
var headElement, elm, value;
var dom = editor.dom;
function setAttr(elm, name, value) {
elm.attr(name, value ? value : undefined);
}
function addHeadNode(node) {
if (headElement.firstChild) {
headElement.insert(node, headElement.firstChild);
} else {
headElement.append(node);
}
}
var headerFragment = parseHeader(head);
headElement = headerFragment.getAll('head')[0];
if (!headElement) {
elm = headerFragment.getAll('html')[0];
headElement = new global$3('head', 1);
if (elm.firstChild) {
elm.insert(headElement, elm.firstChild, true);
} else {
elm.append(headElement);
}
}
elm = headerFragment.firstChild;
if (data.xml_pi) {
value = 'version="1.0"';
if (data.docencoding) {
value += ' encoding="' + data.docencoding + '"';
}
if (elm.type !== 7) {
elm = new global$3('xml', 7);
headerFragment.insert(elm, headerFragment.firstChild, true);
}
elm.value = value;
} else if (elm && elm.type === 7) {
elm.remove();
}
elm = headerFragment.getAll('#doctype')[0];
if (data.doctype) {
if (!elm) {
elm = new global$3('#doctype', 10);
if (data.xml_pi) {
headerFragment.insert(elm, headerFragment.firstChild);
} else {
addHeadNode(elm);
}
}
elm.value = data.doctype.substring(9, data.doctype.length - 1);
} else if (elm) {
elm.remove();
}
elm = null;
global$1.each(headerFragment.getAll('meta'), function (meta) {
if (meta.attr('http-equiv') === 'Content-Type') {
elm = meta;
}
});
if (data.docencoding) {
if (!elm) {
elm = new global$3('meta', 1);
elm.attr('http-equiv', 'Content-Type');
elm.shortEnded = true;
addHeadNode(elm);
}
elm.attr('content', 'text/html; charset=' + data.docencoding);
} else if (elm) {
elm.remove();
}
elm = headerFragment.getAll('title')[0];
if (data.title) {
if (!elm) {
elm = new global$3('title', 1);
addHeadNode(elm);
} else {
elm.empty();
}
elm.append(new global$3('#text', 3)).value = data.title;
} else if (elm) {
elm.remove();
}
global$1.each('keywords,description,author,copyright,robots'.split(','), function (name) {
var nodes = headerFragment.getAll('meta');
var i, meta;
var value = data[name];
for (i = 0; i < nodes.length; i++) {
meta = nodes[i];
if (meta.attr('name') === name) {
if (value) {
meta.attr('content', value);
} else {
meta.remove();
}
return;
}
}
if (value) {
elm = new global$3('meta', 1);
elm.attr('name', name);
elm.attr('content', value);
elm.shortEnded = true;
addHeadNode(elm);
}
});
var currentStyleSheetsMap = {};
global$1.each(headerFragment.getAll('link'), function (stylesheet) {
if (stylesheet.attr('rel') === 'stylesheet') {
currentStyleSheetsMap[stylesheet.attr('href')] = stylesheet;
}
});
global$1.each(data.stylesheets, function (stylesheet) {
if (!currentStyleSheetsMap[stylesheet]) {
elm = new global$3('link', 1);
elm.attr({
rel: 'stylesheet',
text: 'text/css',
href: stylesheet
});
elm.shortEnded = true;
addHeadNode(elm);
}
delete currentStyleSheetsMap[stylesheet];
});
global$1.each(currentStyleSheetsMap, function (stylesheet) {
stylesheet.remove();
});
elm = headerFragment.getAll('body')[0];
if (elm) {
setAttr(elm, 'dir', data.langdir);
setAttr(elm, 'style', data.style);
setAttr(elm, 'vlink', data.visited_color);
setAttr(elm, 'link', data.link_color);
setAttr(elm, 'alink', data.active_color);
dom.setAttribs(editor.getBody(), {
style: data.style,
dir: data.dir,
vLink: data.visited_color,
link: data.link_color,
aLink: data.active_color
});
}
elm = headerFragment.getAll('html')[0];
if (elm) {
setAttr(elm, 'lang', data.langcode);
setAttr(elm, 'xml:lang', data.langcode);
}
if (!headElement.firstChild) {
headElement.remove();
}
var html = global$4({
validate: false,
indent: true,
indent_before: 'head,html,body,meta,title,script,link,style',
indent_after: 'head,html,body,meta,title,script,link,style'
}).serialize(headerFragment);
return html.substring(0, html.indexOf('</body>'));
};
var open = function (editor, headState) {
var data = htmlToData(editor, headState.get());
var defaultData = {
title: '',
keywords: '',
description: '',
robots: '',
author: '',
docencoding: ''
};
var initialData = __assign(__assign({}, defaultData), data);
editor.windowManager.open({
title: 'Metadata and Document Properties',
size: 'normal',
body: {
type: 'panel',
items: [
{
name: 'title',
type: 'input',
label: 'Title'
},
{
name: 'keywords',
type: 'input',
label: 'Keywords'
},
{
name: 'description',
type: 'input',
label: 'Description'
},
{
name: 'robots',
type: 'input',
label: 'Robots'
},
{
name: 'author',
type: 'input',
label: 'Author'
},
{
name: 'docencoding',
type: 'input',
label: 'Encoding'
}
]
},
buttons: [
{
type: 'cancel',
name: 'cancel',
text: 'Cancel'
},
{
type: 'submit',
name: 'save',
text: 'Save',
primary: true
}
],
initialData: initialData,
onSubmit: function (api) {
var nuData = api.getData();
var headHtml = dataToHtml(editor, global$1.extend(data, nuData), headState.get());
headState.set(headHtml);
api.close();
}
});
};
var register = function (editor, headState) {
editor.addCommand('mceFullPageProperties', function () {
open(editor, headState);
});
};
var protectHtml = function (protect, html) {
global$1.each(protect, function (pattern) {
html = html.replace(pattern, function (str) {
return '<!--mce:protected ' + escape(str) + '-->';
});
});
return html;
};
var unprotectHtml = function (html) {
return html.replace(/<!--mce:protected ([\s\S]*?)-->/g, function (a, m) {
return unescape(m);
});
};
var each = global$1.each;
var low = function (s) {
return s.replace(/<\/?[A-Z]+/g, function (a) {
return a.toLowerCase();
});
};
var handleSetContent = function (editor, headState, footState, evt) {
var startPos, endPos, content, styles = '';
var dom = editor.dom;
if (evt.selection) {
return;
}
content = protectHtml(getProtect(editor), evt.content);
if (evt.format === 'raw' && headState.get()) {
return;
}
if (evt.source_view && shouldHideInSourceView(editor)) {
return;
}
if (content.length === 0 && !evt.source_view) {
content = global$1.trim(headState.get()) + '\n' + global$1.trim(content) + '\n' + global$1.trim(footState.get());
}
content = content.replace(/<(\/?)BODY/gi, '<$1body');
startPos = content.indexOf('<body');
if (startPos !== -1) {
startPos = content.indexOf('>', startPos);
headState.set(low(content.substring(0, startPos + 1)));
endPos = content.indexOf('</body', startPos);
if (endPos === -1) {
endPos = content.length;
}
evt.content = global$1.trim(content.substring(startPos + 1, endPos));
footState.set(low(content.substring(endPos)));
} else {
headState.set(getDefaultHeader(editor));
footState.set('\n</body>\n</html>');
}
var headerFragment = parseHeader(headState.get());
each(headerFragment.getAll('style'), function (node) {
if (node.firstChild) {
styles += node.firstChild.value;
}
});
var bodyElm = headerFragment.getAll('body')[0];
if (bodyElm) {
dom.setAttribs(editor.getBody(), {
style: bodyElm.attr('style') || '',
dir: bodyElm.attr('dir') || '',
vLink: bodyElm.attr('vlink') || '',
link: bodyElm.attr('link') || '',
aLink: bodyElm.attr('alink') || ''
});
}
dom.remove('fullpage_styles');
var headElm = editor.getDoc().getElementsByTagName('head')[0];
if (styles) {
var styleElm = dom.add(headElm, 'style', { id: 'fullpage_styles' });
styleElm.appendChild(document.createTextNode(styles));
}
var currentStyleSheetsMap = {};
global$1.each(headElm.getElementsByTagName('link'), function (stylesheet) {
if (stylesheet.rel === 'stylesheet' && stylesheet.getAttribute('data-mce-fullpage')) {
currentStyleSheetsMap[stylesheet.href] = stylesheet;
}
});
global$1.each(headerFragment.getAll('link'), function (stylesheet) {
var href = stylesheet.attr('href');
if (!href) {
return true;
}
if (!currentStyleSheetsMap[href] && stylesheet.attr('rel') === 'stylesheet') {
dom.add(headElm, 'link', {
'rel': 'stylesheet',
'text': 'text/css',
href: href,
'data-mce-fullpage': '1'
});
}
delete currentStyleSheetsMap[href];
});
global$1.each(currentStyleSheetsMap, function (stylesheet) {
stylesheet.parentNode.removeChild(stylesheet);
});
};
var getDefaultHeader = function (editor) {
var header = '', value, styles = '';
if (getDefaultXmlPi(editor)) {
var piEncoding = getDefaultEncoding(editor);
header += '<?xml version="1.0" encoding="' + (piEncoding ? piEncoding : 'ISO-8859-1') + '" ?>\n';
}
header += getDefaultDocType(editor);
header += '\n<html>\n<head>\n';
if (value = getDefaultTitle(editor)) {
header += '<title>' + value + '</title>\n';
}
if (value = getDefaultEncoding(editor)) {
header += '<meta http-equiv="Content-Type" content="text/html; charset=' + value + '" />\n';
}
if (value = getDefaultFontFamily(editor)) {
styles += 'font-family: ' + value + ';';
}
if (value = getDefaultFontSize(editor)) {
styles += 'font-size: ' + value + ';';
}
if (value = getDefaultTextColor(editor)) {
styles += 'color: ' + value + ';';
}
header += '</head>\n<body' + (styles ? ' style="' + styles + '"' : '') + '>\n';
return header;
};
var handleGetContent = function (editor, head, foot, evt) {
if (evt.format === 'html' && !evt.selection && (!evt.source_view || !shouldHideInSourceView(editor))) {
evt.content = unprotectHtml(global$1.trim(head) + '\n' + global$1.trim(evt.content) + '\n' + global$1.trim(foot));
}
};
var setup = function (editor, headState, footState) {
editor.on('BeforeSetContent', function (evt) {
handleSetContent(editor, headState, footState, evt);
});
editor.on('GetContent', function (evt) {
handleGetContent(editor, headState.get(), footState.get(), evt);
});
};
var register$1 = function (editor) {
editor.ui.registry.addButton('fullpage', {
tooltip: 'Metadata and document properties',
icon: 'document-properties',
onAction: function () {
editor.execCommand('mceFullPageProperties');
}
});
editor.ui.registry.addMenuItem('fullpage', {
text: 'Metadata and document properties',
icon: 'document-properties',
onAction: function () {
editor.execCommand('mceFullPageProperties');
}
});
};
function Plugin () {
global.add('fullpage', function (editor) {
var headState = Cell(''), footState = Cell('');
register(editor, headState);
register$1(editor);
setup(editor, headState, footState);
});
}
Plugin();
}());
File diff suppressed because one or more lines are too long
@@ -0,0 +1,979 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
(function () {
'use strict';
var Cell = function (initial) {
var value = initial;
var get = function () {
return value;
};
var set = function (v) {
value = v;
};
return {
get: get,
set: set
};
};
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
var get = function (fullscreenState) {
return {
isFullscreen: function () {
return fullscreenState.get() !== null;
}
};
};
var noop = function () {
};
var compose = function (fa, fb) {
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return fa(fb.apply(null, args));
};
};
var compose1 = function (fbc, fab) {
return function (a) {
return fbc(fab(a));
};
};
var constant = function (value) {
return function () {
return value;
};
};
function curry(fn) {
var initialArgs = [];
for (var _i = 1; _i < arguments.length; _i++) {
initialArgs[_i - 1] = arguments[_i];
}
return function () {
var restArgs = [];
for (var _i = 0; _i < arguments.length; _i++) {
restArgs[_i] = arguments[_i];
}
var all = initialArgs.concat(restArgs);
return fn.apply(null, all);
};
}
var never = constant(false);
var always = constant(true);
var none = function () {
return NONE;
};
var NONE = function () {
var eq = function (o) {
return o.isNone();
};
var call = function (thunk) {
return thunk();
};
var id = function (n) {
return n;
};
var me = {
fold: function (n, _s) {
return n();
},
is: never,
isSome: never,
isNone: always,
getOr: id,
getOrThunk: call,
getOrDie: function (msg) {
throw new Error(msg || 'error: getOrDie called on none.');
},
getOrNull: constant(null),
getOrUndefined: constant(undefined),
or: id,
orThunk: call,
map: none,
each: noop,
bind: none,
exists: never,
forall: always,
filter: none,
equals: eq,
equals_: eq,
toArray: function () {
return [];
},
toString: constant('none()')
};
return me;
}();
var some = function (a) {
var constant_a = constant(a);
var self = function () {
return me;
};
var bind = function (f) {
return f(a);
};
var me = {
fold: function (n, s) {
return s(a);
},
is: function (v) {
return a === v;
},
isSome: always,
isNone: never,
getOr: constant_a,
getOrThunk: constant_a,
getOrDie: constant_a,
getOrNull: constant_a,
getOrUndefined: constant_a,
or: self,
orThunk: self,
map: function (f) {
return some(f(a));
},
each: function (f) {
f(a);
},
bind: bind,
exists: bind,
forall: bind,
filter: function (f) {
return f(a) ? me : NONE;
},
toArray: function () {
return [a];
},
toString: function () {
return 'some(' + a + ')';
},
equals: function (o) {
return o.is(a);
},
equals_: function (o, elementEq) {
return o.fold(never, function (b) {
return elementEq(a, b);
});
}
};
return me;
};
var from = function (value) {
return value === null || value === undefined ? NONE : some(value);
};
var Optional = {
some: some,
none: none,
from: from
};
var revocable = function (doRevoke) {
var subject = Cell(Optional.none());
var revoke = function () {
return subject.get().each(doRevoke);
};
var clear = function () {
revoke();
subject.set(Optional.none());
};
var isSet = function () {
return subject.get().isSome();
};
var set = function (s) {
revoke();
subject.set(Optional.some(s));
};
return {
clear: clear,
isSet: isSet,
set: set
};
};
var unbindable = function () {
return revocable(function (s) {
return s.unbind();
});
};
var value = function () {
var subject = Cell(Optional.none());
var clear = function () {
return subject.set(Optional.none());
};
var set = function (s) {
return subject.set(Optional.some(s));
};
var isSet = function () {
return subject.get().isSome();
};
var on = function (f) {
return subject.get().each(f);
};
return {
clear: clear,
set: set,
isSet: isSet,
on: on
};
};
var typeOf = function (x) {
var t = typeof x;
if (x === null) {
return 'null';
} else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {
return 'array';
} else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {
return 'string';
} else {
return t;
}
};
var isType = function (type) {
return function (value) {
return typeOf(value) === type;
};
};
var isSimpleType = function (type) {
return function (value) {
return typeof value === type;
};
};
var isString = isType('string');
var isArray = isType('array');
var isBoolean = isSimpleType('boolean');
var isNullable = function (a) {
return a === null || a === undefined;
};
var isNonNullable = function (a) {
return !isNullable(a);
};
var isFunction = isSimpleType('function');
var isNumber = isSimpleType('number');
var nativePush = Array.prototype.push;
var map = function (xs, f) {
var len = xs.length;
var r = new Array(len);
for (var i = 0; i < len; i++) {
var x = xs[i];
r[i] = f(x, i);
}
return r;
};
var each = function (xs, f) {
for (var i = 0, len = xs.length; i < len; i++) {
var x = xs[i];
f(x, i);
}
};
var filter = function (xs, pred) {
var r = [];
for (var i = 0, len = xs.length; i < len; i++) {
var x = xs[i];
if (pred(x, i)) {
r.push(x);
}
}
return r;
};
var flatten = function (xs) {
var r = [];
for (var i = 0, len = xs.length; i < len; ++i) {
if (!isArray(xs[i])) {
throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
}
nativePush.apply(r, xs[i]);
}
return r;
};
var bind = function (xs, f) {
return flatten(map(xs, f));
};
var get$1 = function (xs, i) {
return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();
};
var head = function (xs) {
return get$1(xs, 0);
};
var keys = Object.keys;
var each$1 = function (obj, f) {
var props = keys(obj);
for (var k = 0, len = props.length; k < len; k++) {
var i = props[k];
var x = obj[i];
f(x, i);
}
};
var isSupported = function (dom) {
return dom.style !== undefined && isFunction(dom.style.getPropertyValue);
};
var fromHtml = function (html, scope) {
var doc = scope || document;
var div = doc.createElement('div');
div.innerHTML = html;
if (!div.hasChildNodes() || div.childNodes.length > 1) {
console.error('HTML does not have a single root node', html);
throw new Error('HTML must have a single root node');
}
return fromDom(div.childNodes[0]);
};
var fromTag = function (tag, scope) {
var doc = scope || document;
var node = doc.createElement(tag);
return fromDom(node);
};
var fromText = function (text, scope) {
var doc = scope || document;
var node = doc.createTextNode(text);
return fromDom(node);
};
var fromDom = function (node) {
if (node === null || node === undefined) {
throw new Error('Node cannot be null or undefined');
}
return { dom: node };
};
var fromPoint = function (docElm, x, y) {
return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
};
var SugarElement = {
fromHtml: fromHtml,
fromTag: fromTag,
fromText: fromText,
fromDom: fromDom,
fromPoint: fromPoint
};
var Global = typeof window !== 'undefined' ? window : Function('return this;')();
var DOCUMENT = 9;
var DOCUMENT_FRAGMENT = 11;
var ELEMENT = 1;
var TEXT = 3;
var type = function (element) {
return element.dom.nodeType;
};
var isType$1 = function (t) {
return function (element) {
return type(element) === t;
};
};
var isElement = isType$1(ELEMENT);
var isText = isType$1(TEXT);
var isDocument = isType$1(DOCUMENT);
var isDocumentFragment = isType$1(DOCUMENT_FRAGMENT);
var is = function (element, selector) {
var dom = element.dom;
if (dom.nodeType !== ELEMENT) {
return false;
} else {
var elem = dom;
if (elem.matches !== undefined) {
return elem.matches(selector);
} else if (elem.msMatchesSelector !== undefined) {
return elem.msMatchesSelector(selector);
} else if (elem.webkitMatchesSelector !== undefined) {
return elem.webkitMatchesSelector(selector);
} else if (elem.mozMatchesSelector !== undefined) {
return elem.mozMatchesSelector(selector);
} else {
throw new Error('Browser lacks native selectors');
}
}
};
var bypassSelector = function (dom) {
return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT && dom.nodeType !== DOCUMENT_FRAGMENT || dom.childElementCount === 0;
};
var all = function (selector, scope) {
var base = scope === undefined ? document : scope.dom;
return bypassSelector(base) ? [] : map(base.querySelectorAll(selector), SugarElement.fromDom);
};
var eq = function (e1, e2) {
return e1.dom === e2.dom;
};
var owner = function (element) {
return SugarElement.fromDom(element.dom.ownerDocument);
};
var documentOrOwner = function (dos) {
return isDocument(dos) ? dos : owner(dos);
};
var parent = function (element) {
return Optional.from(element.dom.parentNode).map(SugarElement.fromDom);
};
var parents = function (element, isRoot) {
var stop = isFunction(isRoot) ? isRoot : never;
var dom = element.dom;
var ret = [];
while (dom.parentNode !== null && dom.parentNode !== undefined) {
var rawParent = dom.parentNode;
var p = SugarElement.fromDom(rawParent);
ret.push(p);
if (stop(p) === true) {
break;
} else {
dom = rawParent;
}
}
return ret;
};
var siblings = function (element) {
var filterSelf = function (elements) {
return filter(elements, function (x) {
return !eq(element, x);
});
};
return parent(element).map(children).map(filterSelf).getOr([]);
};
var children = function (element) {
return map(element.dom.childNodes, SugarElement.fromDom);
};
var isShadowRoot = function (dos) {
return isDocumentFragment(dos);
};
var supported = isFunction(Element.prototype.attachShadow) && isFunction(Node.prototype.getRootNode);
var isSupported$1 = constant(supported);
var getRootNode = supported ? function (e) {
return SugarElement.fromDom(e.dom.getRootNode());
} : documentOrOwner;
var getShadowRoot = function (e) {
var r = getRootNode(e);
return isShadowRoot(r) ? Optional.some(r) : Optional.none();
};
var getShadowHost = function (e) {
return SugarElement.fromDom(e.dom.host);
};
var getOriginalEventTarget = function (event) {
if (isSupported$1() && isNonNullable(event.target)) {
var el = SugarElement.fromDom(event.target);
if (isElement(el) && isOpenShadowHost(el)) {
if (event.composed && event.composedPath) {
var composedPath = event.composedPath();
if (composedPath) {
return head(composedPath);
}
}
}
}
return Optional.from(event.target);
};
var isOpenShadowHost = function (element) {
return isNonNullable(element.dom.shadowRoot);
};
var inBody = function (element) {
var dom = isText(element) ? element.dom.parentNode : element.dom;
if (dom === undefined || dom === null || dom.ownerDocument === null) {
return false;
}
var doc = dom.ownerDocument;
return getShadowRoot(SugarElement.fromDom(dom)).fold(function () {
return doc.body.contains(dom);
}, compose1(inBody, getShadowHost));
};
var getBody = function (doc) {
var b = doc.dom.body;
if (b === null || b === undefined) {
throw new Error('Body is not available yet');
}
return SugarElement.fromDom(b);
};
var rawSet = function (dom, key, value) {
if (isString(value) || isBoolean(value) || isNumber(value)) {
dom.setAttribute(key, value + '');
} else {
console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom);
throw new Error('Attribute value was not simple');
}
};
var set = function (element, key, value) {
rawSet(element.dom, key, value);
};
var get$2 = function (element, key) {
var v = element.dom.getAttribute(key);
return v === null ? undefined : v;
};
var remove = function (element, key) {
element.dom.removeAttribute(key);
};
var internalSet = function (dom, property, value) {
if (!isString(value)) {
console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);
throw new Error('CSS value must be a string: ' + value);
}
if (isSupported(dom)) {
dom.style.setProperty(property, value);
}
};
var setAll = function (element, css) {
var dom = element.dom;
each$1(css, function (v, k) {
internalSet(dom, k, v);
});
};
var get$3 = function (element, property) {
var dom = element.dom;
var styles = window.getComputedStyle(dom);
var r = styles.getPropertyValue(property);
return r === '' && !inBody(element) ? getUnsafeProperty(dom, property) : r;
};
var getUnsafeProperty = function (dom, property) {
return isSupported(dom) ? dom.style.getPropertyValue(property) : '';
};
var mkEvent = function (target, x, y, stop, prevent, kill, raw) {
return {
target: target,
x: x,
y: y,
stop: stop,
prevent: prevent,
kill: kill,
raw: raw
};
};
var fromRawEvent = function (rawEvent) {
var target = SugarElement.fromDom(getOriginalEventTarget(rawEvent).getOr(rawEvent.target));
var stop = function () {
return rawEvent.stopPropagation();
};
var prevent = function () {
return rawEvent.preventDefault();
};
var kill = compose(prevent, stop);
return mkEvent(target, rawEvent.clientX, rawEvent.clientY, stop, prevent, kill, rawEvent);
};
var handle = function (filter, handler) {
return function (rawEvent) {
if (filter(rawEvent)) {
handler(fromRawEvent(rawEvent));
}
};
};
var binder = function (element, event, filter, handler, useCapture) {
var wrapped = handle(filter, handler);
element.dom.addEventListener(event, wrapped, useCapture);
return { unbind: curry(unbind, element, event, wrapped, useCapture) };
};
var bind$1 = function (element, event, filter, handler) {
return binder(element, event, filter, handler, false);
};
var unbind = function (element, event, handler, useCapture) {
element.dom.removeEventListener(event, handler, useCapture);
};
var filter$1 = always;
var bind$2 = function (element, event, handler) {
return bind$1(element, event, filter$1, handler);
};
var r = function (left, top) {
var translate = function (x, y) {
return r(left + x, top + y);
};
return {
left: left,
top: top,
translate: translate
};
};
var SugarPosition = r;
var get$4 = function (_DOC) {
var doc = _DOC !== undefined ? _DOC.dom : document;
var x = doc.body.scrollLeft || doc.documentElement.scrollLeft;
var y = doc.body.scrollTop || doc.documentElement.scrollTop;
return SugarPosition(x, y);
};
var get$5 = function (_win) {
var win = _win === undefined ? window : _win;
return Optional.from(win['visualViewport']);
};
var bounds = function (x, y, width, height) {
return {
x: x,
y: y,
width: width,
height: height,
right: x + width,
bottom: y + height
};
};
var getBounds = function (_win) {
var win = _win === undefined ? window : _win;
var doc = win.document;
var scroll = get$4(SugarElement.fromDom(doc));
return get$5(win).fold(function () {
var html = win.document.documentElement;
var width = html.clientWidth;
var height = html.clientHeight;
return bounds(scroll.left, scroll.top, width, height);
}, function (visualViewport) {
return bounds(Math.max(visualViewport.pageLeft, scroll.left), Math.max(visualViewport.pageTop, scroll.top), visualViewport.width, visualViewport.height);
});
};
var bind$3 = function (name, callback, _win) {
return get$5(_win).map(function (visualViewport) {
var handler = function (e) {
return callback(fromRawEvent(e));
};
visualViewport.addEventListener(name, handler);
return {
unbind: function () {
return visualViewport.removeEventListener(name, handler);
}
};
}).getOrThunk(function () {
return { unbind: noop };
});
};
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
var global$2 = tinymce.util.Tools.resolve('tinymce.Env');
var global$3 = tinymce.util.Tools.resolve('tinymce.util.Delay');
var fireFullscreenStateChanged = function (editor, state) {
editor.fire('FullscreenStateChanged', { state: state });
};
var getFullscreenNative = function (editor) {
return editor.getParam('fullscreen_native', false, 'boolean');
};
var getFullscreenRoot = function (editor) {
var elem = SugarElement.fromDom(editor.getElement());
return getShadowRoot(elem).map(getShadowHost).getOrThunk(function () {
return getBody(owner(elem));
});
};
var getFullscreenElement = function (root) {
if (root.fullscreenElement !== undefined) {
return root.fullscreenElement;
} else if (root.msFullscreenElement !== undefined) {
return root.msFullscreenElement;
} else if (root.webkitFullscreenElement !== undefined) {
return root.webkitFullscreenElement;
} else {
return null;
}
};
var getFullscreenchangeEventName = function () {
if (document.fullscreenElement !== undefined) {
return 'fullscreenchange';
} else if (document.msFullscreenElement !== undefined) {
return 'MSFullscreenChange';
} else if (document.webkitFullscreenElement !== undefined) {
return 'webkitfullscreenchange';
} else {
return 'fullscreenchange';
}
};
var requestFullscreen = function (sugarElem) {
var elem = sugarElem.dom;
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
} else if (elem.webkitRequestFullScreen) {
elem.webkitRequestFullScreen();
}
};
var exitFullscreen = function (sugarDoc) {
var doc = sugarDoc.dom;
if (doc.exitFullscreen) {
doc.exitFullscreen();
} else if (doc.msExitFullscreen) {
doc.msExitFullscreen();
} else if (doc.webkitCancelFullScreen) {
doc.webkitCancelFullScreen();
}
};
var isFullscreenElement = function (elem) {
return elem.dom === getFullscreenElement(owner(elem).dom);
};
var ancestors = function (scope, predicate, isRoot) {
return filter(parents(scope, isRoot), predicate);
};
var siblings$1 = function (scope, predicate) {
return filter(siblings(scope), predicate);
};
var all$1 = function (selector) {
return all(selector);
};
var ancestors$1 = function (scope, selector, isRoot) {
return ancestors(scope, function (e) {
return is(e, selector);
}, isRoot);
};
var siblings$2 = function (scope, selector) {
return siblings$1(scope, function (e) {
return is(e, selector);
});
};
var attr = 'data-ephox-mobile-fullscreen-style';
var siblingStyles = 'display:none!important;';
var ancestorPosition = 'position:absolute!important;';
var ancestorStyles = 'top:0!important;left:0!important;margin:0!important;padding:0!important;width:100%!important;height:100%!important;overflow:visible!important;';
var bgFallback = 'background-color:rgb(255,255,255)!important;';
var isAndroid = global$2.os.isAndroid();
var matchColor = function (editorBody) {
var color = get$3(editorBody, 'background-color');
return color !== undefined && color !== '' ? 'background-color:' + color + '!important' : bgFallback;
};
var clobberStyles = function (dom, container, editorBody) {
var gatherSiblings = function (element) {
return siblings$2(element, '*:not(.tox-silver-sink)');
};
var clobber = function (clobberStyle) {
return function (element) {
var styles = get$2(element, 'style');
var backup = styles === undefined ? 'no-styles' : styles.trim();
if (backup === clobberStyle) {
return;
} else {
set(element, attr, backup);
setAll(element, dom.parseStyle(clobberStyle));
}
};
};
var ancestors = ancestors$1(container, '*');
var siblings = bind(ancestors, gatherSiblings);
var bgColor = matchColor(editorBody);
each(siblings, clobber(siblingStyles));
each(ancestors, clobber(ancestorPosition + ancestorStyles + bgColor));
var containerStyles = isAndroid === true ? '' : ancestorPosition;
clobber(containerStyles + ancestorStyles + bgColor)(container);
};
var restoreStyles = function (dom) {
var clobberedEls = all$1('[' + attr + ']');
each(clobberedEls, function (element) {
var restore = get$2(element, attr);
if (restore !== 'no-styles') {
setAll(element, dom.parseStyle(restore));
} else {
remove(element, 'style');
}
remove(element, attr);
});
};
var DOM = global$1.DOM;
var getScrollPos = function () {
var vp = getBounds(window);
return {
x: vp.x,
y: vp.y
};
};
var setScrollPos = function (pos) {
window.scrollTo(pos.x, pos.y);
};
var viewportUpdate = get$5().fold(function () {
return {
bind: noop,
unbind: noop
};
}, function (visualViewport) {
var editorContainer = value();
var resizeBinder = unbindable();
var scrollBinder = unbindable();
var refreshScroll = function () {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
};
var refreshVisualViewport = function () {
window.requestAnimationFrame(function () {
editorContainer.on(function (container) {
return setAll(container, {
top: visualViewport.offsetTop + 'px',
left: visualViewport.offsetLeft + 'px',
height: visualViewport.height + 'px',
width: visualViewport.width + 'px'
});
});
});
};
var update = global$3.throttle(function () {
refreshScroll();
refreshVisualViewport();
}, 50);
var bind = function (element) {
editorContainer.set(element);
update();
resizeBinder.set(bind$3('resize', update));
scrollBinder.set(bind$3('scroll', update));
};
var unbind = function () {
editorContainer.on(function () {
resizeBinder.clear();
scrollBinder.clear();
});
editorContainer.clear();
};
return {
bind: bind,
unbind: unbind
};
});
var toggleFullscreen = function (editor, fullscreenState) {
var body = document.body;
var documentElement = document.documentElement;
var editorContainer = editor.getContainer();
var editorContainerS = SugarElement.fromDom(editorContainer);
var fullscreenRoot = getFullscreenRoot(editor);
var fullscreenInfo = fullscreenState.get();
var editorBody = SugarElement.fromDom(editor.getBody());
var isTouch = global$2.deviceType.isTouch();
var editorContainerStyle = editorContainer.style;
var iframe = editor.iframeElement;
var iframeStyle = iframe.style;
var handleClasses = function (handler) {
handler(body, 'tox-fullscreen');
handler(documentElement, 'tox-fullscreen');
handler(editorContainer, 'tox-fullscreen');
getShadowRoot(editorContainerS).map(function (root) {
return getShadowHost(root).dom;
}).each(function (host) {
handler(host, 'tox-fullscreen');
handler(host, 'tox-shadowhost');
});
};
var cleanup = function () {
if (isTouch) {
restoreStyles(editor.dom);
}
handleClasses(DOM.removeClass);
viewportUpdate.unbind();
Optional.from(fullscreenState.get()).each(function (info) {
return info.fullscreenChangeHandler.unbind();
});
};
if (!fullscreenInfo) {
var fullscreenChangeHandler = bind$2(owner(fullscreenRoot), getFullscreenchangeEventName(), function (_evt) {
if (getFullscreenNative(editor)) {
if (!isFullscreenElement(fullscreenRoot) && fullscreenState.get() !== null) {
toggleFullscreen(editor, fullscreenState);
}
}
});
var newFullScreenInfo = {
scrollPos: getScrollPos(),
containerWidth: editorContainerStyle.width,
containerHeight: editorContainerStyle.height,
containerTop: editorContainerStyle.top,
containerLeft: editorContainerStyle.left,
iframeWidth: iframeStyle.width,
iframeHeight: iframeStyle.height,
fullscreenChangeHandler: fullscreenChangeHandler
};
if (isTouch) {
clobberStyles(editor.dom, editorContainerS, editorBody);
}
iframeStyle.width = iframeStyle.height = '100%';
editorContainerStyle.width = editorContainerStyle.height = '';
handleClasses(DOM.addClass);
viewportUpdate.bind(editorContainerS);
editor.on('remove', cleanup);
fullscreenState.set(newFullScreenInfo);
if (getFullscreenNative(editor)) {
requestFullscreen(fullscreenRoot);
}
fireFullscreenStateChanged(editor, true);
} else {
fullscreenInfo.fullscreenChangeHandler.unbind();
if (getFullscreenNative(editor) && isFullscreenElement(fullscreenRoot)) {
exitFullscreen(owner(fullscreenRoot));
}
iframeStyle.width = fullscreenInfo.iframeWidth;
iframeStyle.height = fullscreenInfo.iframeHeight;
editorContainerStyle.width = fullscreenInfo.containerWidth;
editorContainerStyle.height = fullscreenInfo.containerHeight;
editorContainerStyle.top = fullscreenInfo.containerTop;
editorContainerStyle.left = fullscreenInfo.containerLeft;
setScrollPos(fullscreenInfo.scrollPos);
fullscreenState.set(null);
fireFullscreenStateChanged(editor, false);
cleanup();
editor.off('remove', cleanup);
}
};
var register = function (editor, fullscreenState) {
editor.addCommand('mceFullScreen', function () {
toggleFullscreen(editor, fullscreenState);
});
};
var makeSetupHandler = function (editor, fullscreenState) {
return function (api) {
api.setActive(fullscreenState.get() !== null);
var editorEventCallback = function (e) {
return api.setActive(e.state);
};
editor.on('FullscreenStateChanged', editorEventCallback);
return function () {
return editor.off('FullscreenStateChanged', editorEventCallback);
};
};
};
var register$1 = function (editor, fullscreenState) {
editor.ui.registry.addToggleMenuItem('fullscreen', {
text: 'Fullscreen',
icon: 'fullscreen',
shortcut: 'Meta+Shift+F',
onAction: function () {
return editor.execCommand('mceFullScreen');
},
onSetup: makeSetupHandler(editor, fullscreenState)
});
editor.ui.registry.addToggleButton('fullscreen', {
tooltip: 'Fullscreen',
icon: 'fullscreen',
onAction: function () {
return editor.execCommand('mceFullScreen');
},
onSetup: makeSetupHandler(editor, fullscreenState)
});
};
function Plugin () {
global.add('fullscreen', function (editor) {
var fullscreenState = Cell(null);
if (editor.inline) {
return get(fullscreenState);
}
register(editor, fullscreenState);
register$1(editor, fullscreenState);
editor.addShortcut('Meta+Shift+F', '', 'mceFullScreen');
return get(fullscreenState);
});
}
Plugin();
}());
File diff suppressed because one or more lines are too long
@@ -0,0 +1,846 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
(function () {
'use strict';
var Cell = function (initial) {
var value = initial;
var get = function () {
return value;
};
var set = function (v) {
value = v;
};
return {
get: get,
set: set
};
};
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
var get = function (customTabs) {
var addTab = function (spec) {
var currentCustomTabs = customTabs.get();
currentCustomTabs[spec.name] = spec;
customTabs.set(currentCustomTabs);
};
return { addTab: addTab };
};
var register = function (editor, dialogOpener) {
editor.addCommand('mceHelp', dialogOpener);
};
var register$1 = function (editor, dialogOpener) {
editor.ui.registry.addButton('help', {
icon: 'help',
tooltip: 'Help',
onAction: dialogOpener
});
editor.ui.registry.addMenuItem('help', {
text: 'Help',
icon: 'help',
shortcut: 'Alt+0',
onAction: dialogOpener
});
};
var __assign = function () {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var noop = function () {
};
var constant = function (value) {
return function () {
return value;
};
};
var never = constant(false);
var always = constant(true);
var none = function () {
return NONE;
};
var NONE = function () {
var eq = function (o) {
return o.isNone();
};
var call = function (thunk) {
return thunk();
};
var id = function (n) {
return n;
};
var me = {
fold: function (n, _s) {
return n();
},
is: never,
isSome: never,
isNone: always,
getOr: id,
getOrThunk: call,
getOrDie: function (msg) {
throw new Error(msg || 'error: getOrDie called on none.');
},
getOrNull: constant(null),
getOrUndefined: constant(undefined),
or: id,
orThunk: call,
map: none,
each: noop,
bind: none,
exists: never,
forall: always,
filter: none,
equals: eq,
equals_: eq,
toArray: function () {
return [];
},
toString: constant('none()')
};
return me;
}();
var some = function (a) {
var constant_a = constant(a);
var self = function () {
return me;
};
var bind = function (f) {
return f(a);
};
var me = {
fold: function (n, s) {
return s(a);
},
is: function (v) {
return a === v;
},
isSome: always,
isNone: never,
getOr: constant_a,
getOrThunk: constant_a,
getOrDie: constant_a,
getOrNull: constant_a,
getOrUndefined: constant_a,
or: self,
orThunk: self,
map: function (f) {
return some(f(a));
},
each: function (f) {
f(a);
},
bind: bind,
exists: bind,
forall: bind,
filter: function (f) {
return f(a) ? me : NONE;
},
toArray: function () {
return [a];
},
toString: function () {
return 'some(' + a + ')';
},
equals: function (o) {
return o.is(a);
},
equals_: function (o, elementEq) {
return o.fold(never, function (b) {
return elementEq(a, b);
});
}
};
return me;
};
var from = function (value) {
return value === null || value === undefined ? NONE : some(value);
};
var Optional = {
some: some,
none: none,
from: from
};
var nativeIndexOf = Array.prototype.indexOf;
var rawIndexOf = function (ts, t) {
return nativeIndexOf.call(ts, t);
};
var contains = function (xs, x) {
return rawIndexOf(xs, x) > -1;
};
var map = function (xs, f) {
var len = xs.length;
var r = new Array(len);
for (var i = 0; i < len; i++) {
var x = xs[i];
r[i] = f(x, i);
}
return r;
};
var filter = function (xs, pred) {
var r = [];
for (var i = 0, len = xs.length; i < len; i++) {
var x = xs[i];
if (pred(x, i)) {
r.push(x);
}
}
return r;
};
var findUntil = function (xs, pred, until) {
for (var i = 0, len = xs.length; i < len; i++) {
var x = xs[i];
if (pred(x, i)) {
return Optional.some(x);
} else if (until(x, i)) {
break;
}
}
return Optional.none();
};
var find = function (xs, pred) {
return findUntil(xs, pred, never);
};
var keys = Object.keys;
var hasOwnProperty = Object.hasOwnProperty;
var get$1 = function (obj, key) {
return has(obj, key) ? Optional.from(obj[key]) : Optional.none();
};
var has = function (obj, key) {
return hasOwnProperty.call(obj, key);
};
var cat = function (arr) {
var r = [];
var push = function (x) {
r.push(x);
};
for (var i = 0; i < arr.length; i++) {
arr[i].each(push);
}
return r;
};
var getHelpTabs = function (editor) {
return Optional.from(editor.getParam('help_tabs'));
};
var getForcedPlugins = function (editor) {
return editor.getParam('forced_plugins');
};
var description = '<h1>Editor UI keyboard navigation</h1>\n\n<h2>Activating keyboard navigation</h2>\n\n<p>The sections of the outer UI of the editor - the menubar, toolbar, sidebar and footer - are all keyboard navigable. As such, there are multiple ways to activate keyboard navigation:</p>\n<ul>\n <li>Focus the menubar: Alt + F9 (Windows) or &#x2325;F9 (MacOS)</li>\n <li>Focus the toolbar: Alt + F10 (Windows) or &#x2325;F10 (MacOS)</li>\n <li>Focus the footer: Alt + F11 (Windows) or &#x2325;F11 (MacOS)</li>\n</ul>\n\n<p>Focusing the menubar or toolbar will start keyboard navigation at the first item in the menubar or toolbar, which will be highlighted with a gray background. Focusing the footer will start keyboard navigation at the first item in the element path, which will be highlighted with an underline. </p>\n\n<h2>Moving between UI sections</h2>\n\n<p>When keyboard navigation is active, pressing tab will move the focus to the next major section of the UI, where applicable. These sections are:</p>\n<ul>\n <li>the menubar</li>\n <li>each group of the toolbar </li>\n <li>the sidebar</li>\n <li>the element path in the footer </li>\n <li>the wordcount toggle button in the footer </li>\n <li>the branding link in the footer </li>\n</ul>\n\n<p>Pressing shift + tab will move backwards through the same sections, except when moving from the footer to the toolbar. Focusing the element path then pressing shift + tab will move focus to the first toolbar group, not the last.</p>\n\n<h2>Moving within UI sections</h2>\n\n<p>Keyboard navigation within UI sections can usually be achieved using the left and right arrow keys. This includes:</p>\n<ul>\n <li>moving between menus in the menubar</li>\n <li>moving between buttons in a toolbar group</li>\n <li>moving between items in the element path</li>\n</ul>\n\n<p>In all these UI sections, keyboard navigation will cycle within the section. For example, focusing the last button in a toolbar group then pressing right arrow will move focus to the first item in the same toolbar group. </p>\n\n<h1>Executing buttons</h1>\n\n<p>To execute a button, navigate the selection to the desired button and hit space or enter.</p>\n\n<h1>Opening, navigating and closing menus</h1>\n\n<p>When focusing a menubar button or a toolbar button with a menu, pressing space, enter or down arrow will open the menu. When the menu opens the first item will be selected. To move up or down the menu, press the up or down arrow key respectively. This is the same for submenus, which can also be opened and closed using the left and right arrow keys.</p>\n\n<p>To close any active menu, hit the escape key. When a menu is closed the selection will be restored to its previous selection. This also works for closing submenus.</p>\n\n<h1>Context toolbars and menus</h1>\n\n<p>To focus an open context toolbar such as the table context toolbar, press Ctrl + F9 (Windows) or &#x2303;F9 (MacOS).</p>\n\n<p>Context toolbar navigation is the same as toolbar navigation, and context menu navigation is the same as standard menu navigation.</p>\n\n<h1>Dialog navigation</h1>\n\n<p>There are two types of dialog UIs in TinyMCE: tabbed dialogs and non-tabbed dialogs.</p>\n\n<p>When a non-tabbed dialog is opened, the first interactive component in the dialog will be focused. Users can navigate between interactive components by pressing tab. This includes any footer buttons. Navigation will cycle back to the first dialog component if tab is pressed while focusing the last component in the dialog. Pressing shift + tab will navigate backwards.</p>\n\n<p>When a tabbed dialog is opened, the first button in the tab menu is focused. Pressing tab will navigate to the first interactive component in that tab, and will cycle through the tab\u2019s components, the footer buttons, then back to the tab button. To switch to another tab, focus the tab button for the current tab, then use the arrow keys to cycle through the tab buttons.</p>';
var tab = function () {
var body = {
type: 'htmlpanel',
presets: 'document',
html: description
};
return {
name: 'keyboardnav',
title: 'Keyboard Navigation',
items: [body]
};
};
var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
var convertText = function (source) {
var mac = {
alt: '&#x2325;',
ctrl: '&#x2303;',
shift: '&#x21E7;',
meta: '&#x2318;',
access: '&#x2303;&#x2325;'
};
var other = {
meta: 'Ctrl ',
access: 'Shift + Alt '
};
var replace = global$1.mac ? mac : other;
var shortcut = source.split('+');
var updated = map(shortcut, function (segment) {
var search = segment.toLowerCase().trim();
return has(replace, search) ? replace[search] : segment;
});
return global$1.mac ? updated.join('').replace(/\s/, '') : updated.join('+');
};
var shortcuts = [
{
shortcuts: ['Meta + B'],
action: 'Bold'
},
{
shortcuts: ['Meta + I'],
action: 'Italic'
},
{
shortcuts: ['Meta + U'],
action: 'Underline'
},
{
shortcuts: ['Meta + A'],
action: 'Select all'
},
{
shortcuts: [
'Meta + Y',
'Meta + Shift + Z'
],
action: 'Redo'
},
{
shortcuts: ['Meta + Z'],
action: 'Undo'
},
{
shortcuts: ['Access + 1'],
action: 'Heading 1'
},
{
shortcuts: ['Access + 2'],
action: 'Heading 2'
},
{
shortcuts: ['Access + 3'],
action: 'Heading 3'
},
{
shortcuts: ['Access + 4'],
action: 'Heading 4'
},
{
shortcuts: ['Access + 5'],
action: 'Heading 5'
},
{
shortcuts: ['Access + 6'],
action: 'Heading 6'
},
{
shortcuts: ['Access + 7'],
action: 'Paragraph'
},
{
shortcuts: ['Access + 8'],
action: 'Div'
},
{
shortcuts: ['Access + 9'],
action: 'Address'
},
{
shortcuts: ['Alt + 0'],
action: 'Open help dialog'
},
{
shortcuts: ['Alt + F9'],
action: 'Focus to menubar'
},
{
shortcuts: ['Alt + F10'],
action: 'Focus to toolbar'
},
{
shortcuts: ['Alt + F11'],
action: 'Focus to element path'
},
{
shortcuts: ['Ctrl + F9'],
action: 'Focus to contextual toolbar'
},
{
shortcuts: ['Shift + Enter'],
action: 'Open popup menu for split buttons'
},
{
shortcuts: ['Meta + K'],
action: 'Insert link (if link plugin activated)'
},
{
shortcuts: ['Meta + S'],
action: 'Save (if save plugin activated)'
},
{
shortcuts: ['Meta + F'],
action: 'Find (if searchreplace plugin activated)'
},
{
shortcuts: ['Meta + Shift + F'],
action: 'Switch to or from fullscreen mode'
}
];
var tab$1 = function () {
var shortcutList = map(shortcuts, function (shortcut) {
var shortcutText = map(shortcut.shortcuts, convertText).join(' or ');
return [
shortcut.action,
shortcutText
];
});
var tablePanel = {
type: 'table',
header: [
'Action',
'Shortcut'
],
cells: shortcutList
};
return {
name: 'shortcuts',
title: 'Handy Shortcuts',
items: [tablePanel]
};
};
var global$2 = tinymce.util.Tools.resolve('tinymce.util.I18n');
var urls = [
{
key: 'advlist',
name: 'Advanced List'
},
{
key: 'anchor',
name: 'Anchor'
},
{
key: 'autolink',
name: 'Autolink'
},
{
key: 'autoresize',
name: 'Autoresize'
},
{
key: 'autosave',
name: 'Autosave'
},
{
key: 'bbcode',
name: 'BBCode'
},
{
key: 'charmap',
name: 'Character Map'
},
{
key: 'code',
name: 'Code'
},
{
key: 'codesample',
name: 'Code Sample'
},
{
key: 'colorpicker',
name: 'Color Picker'
},
{
key: 'directionality',
name: 'Directionality'
},
{
key: 'emoticons',
name: 'Emoticons'
},
{
key: 'fullpage',
name: 'Full Page'
},
{
key: 'fullscreen',
name: 'Full Screen'
},
{
key: 'help',
name: 'Help'
},
{
key: 'hr',
name: 'Horizontal Rule'
},
{
key: 'image',
name: 'Image'
},
{
key: 'imagetools',
name: 'Image Tools'
},
{
key: 'importcss',
name: 'Import CSS'
},
{
key: 'insertdatetime',
name: 'Insert Date/Time'
},
{
key: 'legacyoutput',
name: 'Legacy Output'
},
{
key: 'link',
name: 'Link'
},
{
key: 'lists',
name: 'Lists'
},
{
key: 'media',
name: 'Media'
},
{
key: 'nonbreaking',
name: 'Nonbreaking'
},
{
key: 'noneditable',
name: 'Noneditable'
},
{
key: 'pagebreak',
name: 'Page Break'
},
{
key: 'paste',
name: 'Paste'
},
{
key: 'preview',
name: 'Preview'
},
{
key: 'print',
name: 'Print'
},
{
key: 'save',
name: 'Save'
},
{
key: 'searchreplace',
name: 'Search and Replace'
},
{
key: 'spellchecker',
name: 'Spell Checker'
},
{
key: 'tabfocus',
name: 'Tab Focus'
},
{
key: 'table',
name: 'Table'
},
{
key: 'template',
name: 'Template'
},
{
key: 'textcolor',
name: 'Text Color'
},
{
key: 'textpattern',
name: 'Text Pattern'
},
{
key: 'toc',
name: 'Table of Contents'
},
{
key: 'visualblocks',
name: 'Visual Blocks'
},
{
key: 'visualchars',
name: 'Visual Characters'
},
{
key: 'wordcount',
name: 'Word Count'
},
{
key: 'advcode',
name: 'Advanced Code Editor*'
},
{
key: 'formatpainter',
name: 'Format Painter*'
},
{
key: 'powerpaste',
name: 'PowerPaste*'
},
{
key: 'tinydrive',
name: 'Tiny Drive*',
slug: 'drive'
},
{
key: 'tinymcespellchecker',
name: 'Spell Checker Pro*'
},
{
key: 'a11ychecker',
name: 'Accessibility Checker*'
},
{
key: 'linkchecker',
name: 'Link Checker*'
},
{
key: 'mentions',
name: 'Mentions*'
},
{
key: 'mediaembed',
name: 'Enhanced Media Embed*'
},
{
key: 'checklist',
name: 'Checklist*'
},
{
key: 'casechange',
name: 'Case Change*'
},
{
key: 'permanentpen',
name: 'Permanent Pen*'
},
{
key: 'pageembed',
name: 'Page Embed*'
},
{
key: 'tinycomments',
name: 'Tiny Comments*',
slug: 'comments'
},
{
key: 'advtable',
name: 'Advanced Tables*'
},
{
key: 'autocorrect',
name: 'Autocorrect*'
}
];
var tab$2 = function (editor) {
var availablePlugins = function () {
var premiumPlugins = [
'Accessibility Checker',
'Advanced Code Editor',
'Advanced Tables',
'Case Change',
'Checklist',
'Tiny Comments',
'Tiny Drive',
'Enhanced Media Embed',
'Format Painter',
'Link Checker',
'Mentions',
'MoxieManager',
'Page Embed',
'Permanent Pen',
'PowerPaste',
'Spell Checker Pro'
];
var premiumPluginList = map(premiumPlugins, function (plugin) {
return '<li>' + global$2.translate(plugin) + '</li>';
}).join('');
return '<div data-mce-tabstop="1" tabindex="-1">' + '<p><b>' + global$2.translate('Premium plugins:') + '</b></p>' + '<ul>' + premiumPluginList + '<li class="tox-help__more-link" "><a href="https://www.tiny.cloud/pricing/?utm_campaign=editor_referral&utm_medium=help_dialog&utm_source=tinymce" target="_blank">' + global$2.translate('Learn more...') + '</a></li>' + '</ul>' + '</div>';
};
var makeLink = function (p) {
return '<a href="' + p.url + '" target="_blank" rel="noopener">' + p.name + '</a>';
};
var maybeUrlize = function (editor, key) {
return find(urls, function (x) {
return x.key === key;
}).fold(function () {
var getMetadata = editor.plugins[key].getMetadata;
return typeof getMetadata === 'function' ? makeLink(getMetadata()) : key;
}, function (x) {
var urlSlug = x.slug || x.key;
return makeLink({
name: x.name,
url: 'https://www.tiny.cloud/docs/plugins/' + urlSlug
});
});
};
var getPluginKeys = function (editor) {
var keys$1 = keys(editor.plugins);
var forced_plugins = getForcedPlugins(editor);
return forced_plugins === undefined ? keys$1 : filter(keys$1, function (k) {
return !contains(forced_plugins, k);
});
};
var pluginLister = function (editor) {
var pluginKeys = getPluginKeys(editor);
var pluginLis = map(pluginKeys, function (key) {
return '<li>' + maybeUrlize(editor, key) + '</li>';
});
var count = pluginLis.length;
var pluginsString = pluginLis.join('');
var html = '<p><b>' + global$2.translate([
'Plugins installed ({0}):',
count
]) + '</b></p>' + '<ul>' + pluginsString + '</ul>';
return html;
};
var installedPlugins = function (editor) {
if (editor == null) {
return '';
}
return '<div data-mce-tabstop="1" tabindex="-1">' + pluginLister(editor) + '</div>';
};
var htmlPanel = {
type: 'htmlpanel',
presets: 'document',
html: [
installedPlugins(editor),
availablePlugins()
].join('')
};
return {
name: 'plugins',
title: 'Plugins',
items: [htmlPanel]
};
};
var global$3 = tinymce.util.Tools.resolve('tinymce.EditorManager');
var tab$3 = function () {
var getVersion = function (major, minor) {
return major.indexOf('@') === 0 ? 'X.X.X' : major + '.' + minor;
};
var version = getVersion(global$3.majorVersion, global$3.minorVersion);
var changeLogLink = '<a href="https://www.tinymce.com/docs/changelog/?utm_campaign=editor_referral&utm_medium=help_dialog&utm_source=tinymce" target="_blank">TinyMCE ' + version + '</a>';
var htmlPanel = {
type: 'htmlpanel',
html: '<p>' + global$2.translate([
'You are using {0}',
changeLogLink
]) + '</p>',
presets: 'document'
};
return {
name: 'versions',
title: 'Version',
items: [htmlPanel]
};
};
var parseHelpTabsSetting = function (tabsFromSettings, tabs) {
var newTabs = {};
var names = map(tabsFromSettings, function (t) {
if (typeof t === 'string') {
if (has(tabs, t)) {
newTabs[t] = tabs[t];
}
return t;
} else {
newTabs[t.name] = t;
return t.name;
}
});
return {
tabs: newTabs,
names: names
};
};
var getNamesFromTabs = function (tabs) {
var names = keys(tabs);
var idx = names.indexOf('versions');
if (idx !== -1) {
names.splice(idx, 1);
names.push('versions');
}
return {
tabs: tabs,
names: names
};
};
var parseCustomTabs = function (editor, customTabs) {
var _a;
var shortcuts = tab$1();
var nav = tab();
var plugins = tab$2(editor);
var versions = tab$3();
var tabs = __assign((_a = {}, _a[shortcuts.name] = shortcuts, _a[nav.name] = nav, _a[plugins.name] = plugins, _a[versions.name] = versions, _a), customTabs.get());
return getHelpTabs(editor).fold(function () {
return getNamesFromTabs(tabs);
}, function (tabsFromSettings) {
return parseHelpTabsSetting(tabsFromSettings, tabs);
});
};
var init = function (editor, customTabs) {
return function () {
var _a = parseCustomTabs(editor, customTabs), tabs = _a.tabs, names = _a.names;
var foundTabs = map(names, function (name) {
return get$1(tabs, name);
});
var dialogTabs = cat(foundTabs);
var body = {
type: 'tabpanel',
tabs: dialogTabs
};
editor.windowManager.open({
title: 'Help',
size: 'medium',
body: body,
buttons: [{
type: 'cancel',
name: 'close',
text: 'Close',
primary: true
}],
initialData: {}
});
};
};
function Plugin () {
global.add('help', function (editor) {
var customTabs = Cell({});
var api = get(customTabs);
var dialogOpener = init(editor, customTabs);
register$1(editor, dialogOpener);
register(editor, dialogOpener);
editor.shortcuts.add('Alt+0', 'Open help dialog', 'mceHelp');
return api;
});
}
Plugin();
}());
File diff suppressed because one or more lines are too long
@@ -0,0 +1,46 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
(function () {
'use strict';
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
var register = function (editor) {
editor.addCommand('InsertHorizontalRule', function () {
editor.execCommand('mceInsertContent', false, '<hr />');
});
};
var register$1 = function (editor) {
editor.ui.registry.addButton('hr', {
icon: 'horizontal-rule',
tooltip: 'Horizontal line',
onAction: function () {
return editor.execCommand('InsertHorizontalRule');
}
});
editor.ui.registry.addMenuItem('hr', {
icon: 'horizontal-rule',
text: 'Horizontal line',
onAction: function () {
return editor.execCommand('InsertHorizontalRule');
}
});
};
function Plugin () {
global.add('hr', function (editor) {
register(editor);
register$1(editor);
});
}
Plugin();
}());
@@ -0,0 +1,9 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
!function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager");n.add("hr",function(n){var o,t;(o=n).addCommand("InsertHorizontalRule",function(){o.execCommand("mceInsertContent",!1,"<hr />")}),(t=n).ui.registry.addButton("hr",{icon:"horizontal-rule",tooltip:"Horizontal line",onAction:function(){return t.execCommand("InsertHorizontalRule")}}),t.ui.registry.addMenuItem("hr",{icon:"horizontal-rule",text:"Horizontal line",onAction:function(){return t.execCommand("InsertHorizontalRule")}})})}();
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,343 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
(function () {
'use strict';
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
var global$2 = tinymce.util.Tools.resolve('tinymce.EditorManager');
var global$3 = tinymce.util.Tools.resolve('tinymce.Env');
var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools');
var shouldMergeClasses = function (editor) {
return editor.getParam('importcss_merge_classes');
};
var shouldImportExclusive = function (editor) {
return editor.getParam('importcss_exclusive');
};
var getSelectorConverter = function (editor) {
return editor.getParam('importcss_selector_converter');
};
var getSelectorFilter = function (editor) {
return editor.getParam('importcss_selector_filter');
};
var getCssGroups = function (editor) {
return editor.getParam('importcss_groups');
};
var shouldAppend = function (editor) {
return editor.getParam('importcss_append');
};
var getFileFilter = function (editor) {
return editor.getParam('importcss_file_filter');
};
var getSkin = function (editor) {
var skin = editor.getParam('skin');
return skin !== false ? skin || 'oxide' : false;
};
var getSkinUrl = function (editor) {
return editor.getParam('skin_url');
};
var typeOf = function (x) {
var t = typeof x;
if (x === null) {
return 'null';
} else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {
return 'array';
} else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {
return 'string';
} else {
return t;
}
};
var isType = function (type) {
return function (value) {
return typeOf(value) === type;
};
};
var isArray = isType('array');
var nativePush = Array.prototype.push;
var map = function (xs, f) {
var len = xs.length;
var r = new Array(len);
for (var i = 0; i < len; i++) {
var x = xs[i];
r[i] = f(x, i);
}
return r;
};
var flatten = function (xs) {
var r = [];
for (var i = 0, len = xs.length; i < len; ++i) {
if (!isArray(xs[i])) {
throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
}
nativePush.apply(r, xs[i]);
}
return r;
};
var bind = function (xs, f) {
return flatten(map(xs, f));
};
var generate = function () {
var ungroupedOrder = [];
var groupOrder = [];
var groups = {};
var addItemToGroup = function (groupTitle, itemInfo) {
if (groups[groupTitle]) {
groups[groupTitle].push(itemInfo);
} else {
groupOrder.push(groupTitle);
groups[groupTitle] = [itemInfo];
}
};
var addItem = function (itemInfo) {
ungroupedOrder.push(itemInfo);
};
var toFormats = function () {
var groupItems = bind(groupOrder, function (g) {
var items = groups[g];
return items.length === 0 ? [] : [{
title: g,
items: items
}];
});
return groupItems.concat(ungroupedOrder);
};
return {
addItemToGroup: addItemToGroup,
addItem: addItem,
toFormats: toFormats
};
};
var removeCacheSuffix = function (url) {
var cacheSuffix = global$3.cacheSuffix;
if (typeof url === 'string') {
url = url.replace('?' + cacheSuffix, '').replace('&' + cacheSuffix, '');
}
return url;
};
var isSkinContentCss = function (editor, href) {
var skin = getSkin(editor);
if (skin) {
var skinUrlBase = getSkinUrl(editor);
var skinUrl = skinUrlBase ? editor.documentBaseURI.toAbsolute(skinUrlBase) : global$2.baseURL + '/skins/ui/' + skin;
var contentSkinUrlPart = global$2.baseURL + '/skins/content/';
return href === skinUrl + '/content' + (editor.inline ? '.inline' : '') + '.min.css' || href.indexOf(contentSkinUrlPart) !== -1;
}
return false;
};
var compileFilter = function (filter) {
if (typeof filter === 'string') {
return function (value) {
return value.indexOf(filter) !== -1;
};
} else if (filter instanceof RegExp) {
return function (value) {
return filter.test(value);
};
}
return filter;
};
var isCssImportRule = function (rule) {
return rule.styleSheet;
};
var isCssPageRule = function (rule) {
return rule.selectorText;
};
var getSelectors = function (editor, doc, fileFilter) {
var selectors = [], contentCSSUrls = {};
function append(styleSheet, imported) {
var href = styleSheet.href, rules;
href = removeCacheSuffix(href);
if (!href || !fileFilter(href, imported) || isSkinContentCss(editor, href)) {
return;
}
global$4.each(styleSheet.imports, function (styleSheet) {
append(styleSheet, true);
});
try {
rules = styleSheet.cssRules || styleSheet.rules;
} catch (e) {
}
global$4.each(rules, function (cssRule) {
if (isCssImportRule(cssRule)) {
append(cssRule.styleSheet, true);
} else if (isCssPageRule(cssRule)) {
global$4.each(cssRule.selectorText.split(','), function (selector) {
selectors.push(global$4.trim(selector));
});
}
});
}
global$4.each(editor.contentCSS, function (url) {
contentCSSUrls[url] = true;
});
if (!fileFilter) {
fileFilter = function (href, imported) {
return imported || contentCSSUrls[href];
};
}
try {
global$4.each(doc.styleSheets, function (styleSheet) {
append(styleSheet);
});
} catch (e) {
}
return selectors;
};
var defaultConvertSelectorToFormat = function (editor, selectorText) {
var format;
var selector = /^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(selectorText);
if (!selector) {
return;
}
var elementName = selector[1];
var classes = selector[2].substr(1).split('.').join(' ');
var inlineSelectorElements = global$4.makeMap('a,img');
if (selector[1]) {
format = { title: selectorText };
if (editor.schema.getTextBlockElements()[elementName]) {
format.block = elementName;
} else if (editor.schema.getBlockElements()[elementName] || inlineSelectorElements[elementName.toLowerCase()]) {
format.selector = elementName;
} else {
format.inline = elementName;
}
} else if (selector[2]) {
format = {
inline: 'span',
title: selectorText.substr(1),
classes: classes
};
}
if (shouldMergeClasses(editor) !== false) {
format.classes = classes;
} else {
format.attributes = { class: classes };
}
return format;
};
var getGroupsBySelector = function (groups, selector) {
return global$4.grep(groups, function (group) {
return !group.filter || group.filter(selector);
});
};
var compileUserDefinedGroups = function (groups) {
return global$4.map(groups, function (group) {
return global$4.extend({}, group, {
original: group,
selectors: {},
filter: compileFilter(group.filter),
item: {
text: group.title,
menu: []
}
});
});
};
var isExclusiveMode = function (editor, group) {
return group === null || shouldImportExclusive(editor) !== false;
};
var isUniqueSelector = function (editor, selector, group, globallyUniqueSelectors) {
return !(isExclusiveMode(editor, group) ? selector in globallyUniqueSelectors : selector in group.selectors);
};
var markUniqueSelector = function (editor, selector, group, globallyUniqueSelectors) {
if (isExclusiveMode(editor, group)) {
globallyUniqueSelectors[selector] = true;
} else {
group.selectors[selector] = true;
}
};
var convertSelectorToFormat = function (editor, plugin, selector, group) {
var selectorConverter;
if (group && group.selector_converter) {
selectorConverter = group.selector_converter;
} else if (getSelectorConverter(editor)) {
selectorConverter = getSelectorConverter(editor);
} else {
selectorConverter = function () {
return defaultConvertSelectorToFormat(editor, selector);
};
}
return selectorConverter.call(plugin, selector, group);
};
var setup = function (editor) {
editor.on('init', function (_e) {
var model = generate();
var globallyUniqueSelectors = {};
var selectorFilter = compileFilter(getSelectorFilter(editor));
var groups = compileUserDefinedGroups(getCssGroups(editor));
var processSelector = function (selector, group) {
if (isUniqueSelector(editor, selector, group, globallyUniqueSelectors)) {
markUniqueSelector(editor, selector, group, globallyUniqueSelectors);
var format = convertSelectorToFormat(editor, editor.plugins.importcss, selector, group);
if (format) {
var formatName = format.name || global$1.DOM.uniqueId();
editor.formatter.register(formatName, format);
return global$4.extend({}, {
title: format.title,
format: formatName
});
}
}
return null;
};
global$4.each(getSelectors(editor, editor.getDoc(), compileFilter(getFileFilter(editor))), function (selector) {
if (selector.indexOf('.mce-') === -1) {
if (!selectorFilter || selectorFilter(selector)) {
var selectorGroups = getGroupsBySelector(groups, selector);
if (selectorGroups.length > 0) {
global$4.each(selectorGroups, function (group) {
var menuItem = processSelector(selector, group);
if (menuItem) {
model.addItemToGroup(group.title, menuItem);
}
});
} else {
var menuItem = processSelector(selector, null);
if (menuItem) {
model.addItem(menuItem);
}
}
}
}
});
var items = model.toFormats();
editor.fire('addStyleModifications', {
items: items,
replace: !shouldAppend(editor)
});
});
};
var get = function (editor) {
var convertSelectorToFormat = function (selectorText) {
return defaultConvertSelectorToFormat(editor, selectorText);
};
return { convertSelectorToFormat: convertSelectorToFormat };
};
function Plugin () {
global.add('importcss', function (editor) {
setup(editor);
return get(editor);
});
}
Plugin();
}());
@@ -0,0 +1,9 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
!function(){"use strict";var n,t=tinymce.util.Tools.resolve("tinymce.PluginManager"),v=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),f=tinymce.util.Tools.resolve("tinymce.EditorManager"),m=tinymce.util.Tools.resolve("tinymce.Env"),h=tinymce.util.Tools.resolve("tinymce.util.Tools"),d=function(t){return t.getParam("importcss_selector_converter")},o=(n="array",function(t){return r=typeof(e=t),(null===e?"null":"object"==r&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"==r&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":r)===n;var e,r}),i=Array.prototype.push,l=function(t,e){return function(t){for(var e=[],r=0,n=t.length;r<n;++r){if(!o(t[r]))throw new Error("Arr.flatten item "+r+" was not an array, input: "+t);i.apply(e,t[r])}return e}(function(t,e){for(var r=t.length,n=new Array(r),o=0;o<r;o++){var i=t[o];n[o]=e(i,o)}return n}(t,e))},p=function(e){return"string"==typeof e?function(t){return-1!==t.indexOf(e)}:e instanceof RegExp?function(t){return e.test(t)}:e},_=function(s,t,a){var u=[],r={};function l(t,e){var r,n,o,i=t.href;if(n=i,o=m.cacheSuffix,"string"==typeof n&&(n=n.replace("?"+o,"").replace("&"+o,"")),(i=n)&&a(i,e)&&!function(t,e){var r,n=!1!==(r=t.getParam("skin"))&&(r||"oxide");if(n){var o=t.getParam("skin_url"),i=o?t.documentBaseURI.toAbsolute(o):f.baseURL+"/skins/ui/"+n,c=f.baseURL+"/skins/content/";return e===i+"/content"+(t.inline?".inline":"")+".min.css"||-1!==e.indexOf(c)}return!1}(s,i)){h.each(t.imports,function(t){l(t,!0)});try{r=t.cssRules||t.rules}catch(c){}h.each(r,function(t){t.styleSheet?l(t.styleSheet,!0):t.selectorText&&h.each(t.selectorText.split(","),function(t){u.push(h.trim(t))})})}}h.each(s.contentCSS,function(t){r[t]=!0}),a=a||function(t,e){return e||r[t]};try{h.each(t.styleSheets,function(t){l(t)})}catch(e){}return u},x=function(t,e){var r,n=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(e);if(n){var o=n[1],i=n[2].substr(1).split(".").join(" "),c=h.makeMap("a,img");return n[1]?(r={title:e},t.schema.getTextBlockElements()[o]?r.block=o:t.schema.getBlockElements()[o]||c[o.toLowerCase()]?r.selector=o:r.inline=o):n[2]&&(r={inline:"span",title:e.substr(1),classes:i}),!1!==t.getParam("importcss_merge_classes")?r.classes=i:r.attributes={"class":i},r}},P=function(t,e){return null===e||!1!==t.getParam("importcss_exclusive")},r=function(y){y.on("init",function(t){var e,r,n,o,i=(e=[],r=[],n={},{addItemToGroup:function(t,e){n[t]?n[t].push(e):(r.push(t),n[t]=[e])},addItem:function(t){e.push(t)},toFormats:function(){return l(r,function(t){var e=n[t];return 0===e.length?[]:[{title:t,items:e}]}).concat(e)}}),g={},c=p(y.getParam("importcss_selector_filter")),s=(o=y.getParam("importcss_groups"),h.map(o,function(t){return h.extend({},t,{original:t,selectors:{},filter:p(t.filter),item:{text:t.title,menu:[]}})})),a=function(t,e){if(f=t,p=g,!(P(y,m=e)?f in p:f in m.selectors)){a=t,l=g,P(y,u=e)?l[a]=!0:u.selectors[a]=!0;var r=(i=(o=y).plugins.importcss,c=t,((s=e)&&s.selector_converter?s.selector_converter:d(o)?d(o):function(){return x(o,c)}).call(i,c,s));if(r){var n=r.name||v.DOM.uniqueId();return y.formatter.register(n,r),h.extend({},{title:r.title,format:n})}}var o,i,c,s,a,u,l,f,m,p;return null};h.each(_(y,y.getDoc(),p(y.getParam("importcss_file_filter"))),function(r){var t,e,n,o;-1===r.indexOf(".mce-")&&(c&&!c(r)||(n=s,o=r,0<(t=h.grep(n,function(t){return!t.filter||t.filter(o)})).length?h.each(t,function(t){var e=a(r,t);e&&i.addItemToGroup(t.title,e)}):(e=a(r,null))&&i.addItem(e)))});var u=i.toFormats();y.fire("addStyleModifications",{items:u,replace:!y.getParam("importcss_append")})})};t.add("importcss",function(t){return r(t),e=t,{convertSelectorToFormat:function(t){return x(e,t)}};var e})}();
@@ -0,0 +1,62 @@
tinymce.PluginManager.add('indent2em', function(editor, url) {
var pluginName='首行缩进';
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
var indent2em_val = editor.getParam('indent2em_val', '2em');
var doAct = function () {
var dom = editor.dom;
var blocks = editor.selection.getSelectedBlocks();
var act = '';
global$1.each(blocks, function (block) {
if(act==''){
act = dom.getStyle(block,'text-indent')==indent2em_val ? 'remove' : 'add';
}
if( act=='add' ){
dom.setStyle(block, 'text-indent', indent2em_val);
}else{
var style=dom.getAttrib(block,'style');
var reg = new RegExp('text-indent:[\\s]*' + indent2em_val + ';', 'ig');
style = style.replace(reg, '');
dom.setAttrib(block,'style',style);
}
});
};
editor.ui.registry.getAll().icons.indent2em || editor.ui.registry.addIcon('indent2em','<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M170.666667 563.2v-102.4H887.466667v102.4zM170.666667 836.266667v-102.4H887.466667v102.4zM512 290.133333v-102.4H887.466667v102.4zM238.933333 341.333333V136.533333l204.8 102.4z" fill="#2c2c2c" p-id="5210"></path></svg>');
var stateSelectorAdapter = function (editor, selector) {
return function (buttonApi) {
return editor.selection.selectorChangedWithUnbind(selector.join(','), buttonApi.setActive).unbind;
};
};
editor.ui.registry.addToggleButton('indent2em', {
icon: 'indent2em',
tooltip: pluginName,
onAction: function () {
doAct();
},
onSetup: stateSelectorAdapter(editor, [
'*[style*="text-indent"]',
'*[data-mce-style*="text-indent"]',
])
});
editor.ui.registry.addMenuItem('indent2em', {
text: pluginName,
onAction: function() {
doAct();
}
});
editor.addCommand('indent2em', doAct );
return {
getMetadata: function () {
return {
name: pluginName,
url: "http://tinymce.ax-z.cn/more-plugins/indent2em.php",
};
}
};
});
@@ -0,0 +1,62 @@
tinymce.PluginManager.add('indent2em', function(editor, url) {
var pluginName='首行缩进';
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
var indent2em_val = editor.getParam('indent2em_val', '2em');
var doAct = function () {
var dom = editor.dom;
var blocks = editor.selection.getSelectedBlocks();
var act = '';
global$1.each(blocks, function (block) {
if(act==''){
act = dom.getStyle(block,'text-indent')==indent2em_val ? 'remove' : 'add';
}
if( act=='add' ){
dom.setStyle(block, 'text-indent', indent2em_val);
}else{
var style=dom.getAttrib(block,'style');
var reg = new RegExp('text-indent:[\\s]*' + indent2em_val + ';', 'ig');
style = style.replace(reg, '');
dom.setAttrib(block,'style',style);
}
});
};
editor.ui.registry.getAll().icons.indent2em || editor.ui.registry.addIcon('indent2em','<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M170.666667 563.2v-102.4H887.466667v102.4zM170.666667 836.266667v-102.4H887.466667v102.4zM512 290.133333v-102.4H887.466667v102.4zM238.933333 341.333333V136.533333l204.8 102.4z" fill="#2c2c2c" p-id="5210"></path></svg>');
var stateSelectorAdapter = function (editor, selector) {
return function (buttonApi) {
return editor.selection.selectorChangedWithUnbind(selector.join(','), buttonApi.setActive).unbind;
};
};
editor.ui.registry.addToggleButton('indent2em', {
icon: 'indent2em',
tooltip: pluginName,
onAction: function () {
doAct();
},
onSetup: stateSelectorAdapter(editor, [
'*[style*="text-indent"]',
'*[data-mce-style*="text-indent"]',
])
});
editor.ui.registry.addMenuItem('indent2em', {
text: pluginName,
onAction: function() {
doAct();
}
});
editor.addCommand('indent2em', doAct );
return {
getMetadata: function () {
return {
name: pluginName,
url: "http://tinymce.ax-z.cn/more-plugins/indent2em.php",
};
}
};
});
@@ -0,0 +1,177 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
(function () {
'use strict';
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
var getDateFormat = function (editor) {
return editor.getParam('insertdatetime_dateformat', editor.translate('%Y-%m-%d'));
};
var getTimeFormat = function (editor) {
return editor.getParam('insertdatetime_timeformat', editor.translate('%H:%M:%S'));
};
var getFormats = function (editor) {
return editor.getParam('insertdatetime_formats', [
'%H:%M:%S',
'%Y-%m-%d',
'%I:%M:%S %p',
'%D'
]);
};
var getDefaultDateTime = function (editor) {
var formats = getFormats(editor);
return formats.length > 0 ? formats[0] : getTimeFormat(editor);
};
var shouldInsertTimeElement = function (editor) {
return editor.getParam('insertdatetime_element', false);
};
var daysShort = 'Sun Mon Tue Wed Thu Fri Sat Sun'.split(' ');
var daysLong = 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday'.split(' ');
var monthsShort = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ');
var monthsLong = 'January February March April May June July August September October November December'.split(' ');
var addZeros = function (value, len) {
value = '' + value;
if (value.length < len) {
for (var i = 0; i < len - value.length; i++) {
value = '0' + value;
}
}
return value;
};
var getDateTime = function (editor, fmt, date) {
date = date || new Date();
fmt = fmt.replace('%D', '%m/%d/%Y');
fmt = fmt.replace('%r', '%I:%M:%S %p');
fmt = fmt.replace('%Y', '' + date.getFullYear());
fmt = fmt.replace('%y', '' + date.getYear());
fmt = fmt.replace('%m', addZeros(date.getMonth() + 1, 2));
fmt = fmt.replace('%d', addZeros(date.getDate(), 2));
fmt = fmt.replace('%H', '' + addZeros(date.getHours(), 2));
fmt = fmt.replace('%M', '' + addZeros(date.getMinutes(), 2));
fmt = fmt.replace('%S', '' + addZeros(date.getSeconds(), 2));
fmt = fmt.replace('%I', '' + ((date.getHours() + 11) % 12 + 1));
fmt = fmt.replace('%p', '' + (date.getHours() < 12 ? 'AM' : 'PM'));
fmt = fmt.replace('%B', '' + editor.translate(monthsLong[date.getMonth()]));
fmt = fmt.replace('%b', '' + editor.translate(monthsShort[date.getMonth()]));
fmt = fmt.replace('%A', '' + editor.translate(daysLong[date.getDay()]));
fmt = fmt.replace('%a', '' + editor.translate(daysShort[date.getDay()]));
fmt = fmt.replace('%%', '%');
return fmt;
};
var updateElement = function (editor, timeElm, computerTime, userTime) {
var newTimeElm = editor.dom.create('time', { datetime: computerTime }, userTime);
timeElm.parentNode.insertBefore(newTimeElm, timeElm);
editor.dom.remove(timeElm);
editor.selection.select(newTimeElm, true);
editor.selection.collapse(false);
};
var insertDateTime = function (editor, format) {
if (shouldInsertTimeElement(editor)) {
var userTime = getDateTime(editor, format);
var computerTime = void 0;
if (/%[HMSIp]/.test(format)) {
computerTime = getDateTime(editor, '%Y-%m-%dT%H:%M');
} else {
computerTime = getDateTime(editor, '%Y-%m-%d');
}
var timeElm = editor.dom.getParent(editor.selection.getStart(), 'time');
if (timeElm) {
updateElement(editor, timeElm, computerTime, userTime);
} else {
editor.insertContent('<time datetime="' + computerTime + '">' + userTime + '</time>');
}
} else {
editor.insertContent(getDateTime(editor, format));
}
};
var register = function (editor) {
editor.addCommand('mceInsertDate', function () {
insertDateTime(editor, getDateFormat(editor));
});
editor.addCommand('mceInsertTime', function () {
insertDateTime(editor, getTimeFormat(editor));
});
};
var Cell = function (initial) {
var value = initial;
var get = function () {
return value;
};
var set = function (v) {
value = v;
};
return {
get: get,
set: set
};
};
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
var register$1 = function (editor) {
var formats = getFormats(editor);
var defaultFormat = Cell(getDefaultDateTime(editor));
editor.ui.registry.addSplitButton('insertdatetime', {
icon: 'insert-time',
tooltip: 'Insert date/time',
select: function (value) {
return value === defaultFormat.get();
},
fetch: function (done) {
done(global$1.map(formats, function (format) {
return {
type: 'choiceitem',
text: getDateTime(editor, format),
value: format
};
}));
},
onAction: function (_api) {
insertDateTime(editor, defaultFormat.get());
},
onItemAction: function (_api, value) {
defaultFormat.set(value);
insertDateTime(editor, value);
}
});
var makeMenuItemHandler = function (format) {
return function () {
defaultFormat.set(format);
insertDateTime(editor, format);
};
};
editor.ui.registry.addNestedMenuItem('insertdatetime', {
icon: 'insert-time',
text: 'Date/time',
getSubmenuItems: function () {
return global$1.map(formats, function (format) {
return {
type: 'menuitem',
text: getDateTime(editor, format),
onAction: makeMenuItemHandler(format)
};
});
}
});
};
function Plugin () {
global.add('insertdatetime', function (editor) {
register(editor);
register$1(editor);
});
}
Plugin();
}());
@@ -0,0 +1,9 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.6.2 (2020-12-08)
*/
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),u=function(e){return e.getParam("insertdatetime_timeformat",e.translate("%H:%M:%S"))},c=function(e){return e.getParam("insertdatetime_formats",["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"])},r="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),a="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),i="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),o="January February March April May June July August September October November December".split(" "),m=function(e,t){if((e=""+e).length<t)for(var n=0;n<t-e.length;n++)e="0"+e;return e},s=function(e,t,n){return n=n||new Date,t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace("%D","%m/%d/%Y")).replace("%r","%I:%M:%S %p")).replace("%Y",""+n.getFullYear())).replace("%y",""+n.getYear())).replace("%m",m(n.getMonth()+1,2))).replace("%d",m(n.getDate(),2))).replace("%H",""+m(n.getHours(),2))).replace("%M",""+m(n.getMinutes(),2))).replace("%S",""+m(n.getSeconds(),2))).replace("%I",""+((n.getHours()+11)%12+1))).replace("%p",n.getHours()<12?"AM":"PM")).replace("%B",""+e.translate(o[n.getMonth()]))).replace("%b",""+e.translate(i[n.getMonth()]))).replace("%A",""+e.translate(a[n.getDay()]))).replace("%a",""+e.translate(r[n.getDay()]))).replace("%%","%")},l=function(e,t){var n,r,a,i,o,u,c,m;e.getParam("insertdatetime_element",!1)?(n=s(e,t),r=void 0,r=/%[HMSIp]/.test(t)?s(e,"%Y-%m-%dT%H:%M"):s(e,"%Y-%m-%d"),(a=e.dom.getParent(e.selection.getStart(),"time"))?(o=a,u=r,c=n,m=(i=e).dom.create("time",{datetime:u},c),o.parentNode.insertBefore(m,o),i.dom.remove(o),i.selection.select(m,!0),i.selection.collapse(!1)):e.insertContent('<time datetime="'+r+'">'+n+"</time>")):e.insertContent(s(e,t))},t=function(t){t.addCommand("mceInsertDate",function(){var e;l(t,(e=t).getParam("insertdatetime_dateformat",e.translate("%Y-%m-%d")))}),t.addCommand("mceInsertTime",function(){l(t,u(t))})},d=tinymce.util.Tools.resolve("tinymce.util.Tools"),n=function(n){var e,t,r,a,i=c(n),o=(a=c(r=n),e=0<a.length?a[0]:u(r),t=e,{get:function(){return t},set:function(e){t=e}});n.ui.registry.addSplitButton("insertdatetime",{icon:"insert-time",tooltip:"Insert date/time",select:function(e){return e===o.get()},fetch:function(e){e(d.map(i,function(e){return{type:"choiceitem",text:s(n,e),value:e}}))},onAction:function(e){l(n,o.get())},onItemAction:function(e,t){o.set(t),l(n,t)}});n.ui.registry.addNestedMenuItem("insertdatetime",{icon:"insert-time",text:"Date/time",getSubmenuItems:function(){return d.map(i,function(e){return{type:"menuitem",text:s(n,e),onAction:(t=e,function(){o.set(t),l(n,t)})};var t})}})};e.add("insertdatetime",function(e){t(e),n(e)})}();
@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<path d="M0.672,33.603c-0.432,0-0.648,0-0.648-0.264c0-0.024,0-0.144,0.24-0.432l12.433-14.569L0,0.96c0-0.264,0-0.72,0.024-0.792 C0.096,0.024,0.12,0,0.672,0h28.371l2.904,6.745h-0.6C30.531,4.8,28.898,3.72,28.298,3.336c-1.896-1.2-3.984-1.608-5.28-1.8 c-0.216-0.048-2.4-0.384-5.617-0.384H4.248l11.185,15.289c0.168,0.24,0.168,0.312,0.168,0.36c0,0.12-0.048,0.192-0.216,0.384 L3.168,31.515h14.474c4.608,0,6.96-0.624,7.464-0.744c2.76-0.72,5.305-2.352,6.241-4.848h0.6l-2.904,7.681H0.672z" fill="black"></path>
</svg>

After

Width:  |  Height:  |  Size: 571 B

@@ -0,0 +1,111 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<link rel="stylesheet" href="kityformula/assets/styles/base.css">
<link rel="stylesheet" href="kityformula/assets/styles/ui.css">
<link rel="stylesheet" href="kityformula/assets/styles/scrollbar.css">
<style>
html, body {
padding: 0;
margin: 0;
}
.kf-editor {
width: 780px;
height: 380px;
}
#loading {
height: 32px;
width: 340px;
line-height: 32px;
position: absolute;
top: 42%;
left: 50%;
margin-left: -170px;
font-family: arial, "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
}
#loading img {
position: absolute;
}
#loading p {
display: block;
position: absolute;
left: 40px;
top: 0px;
margin: 0;
}
</style>
<title></title>
</head>
<body>
<div id="kfEditorContainer" class="kf-editor">
<div id="tips" class="tips">
sorry! Beta版本仅支持IE9及以上版本的浏览器,正式版本将会支持低版本浏览器,谢谢您的关注!
</div>
</div>
<script src="kityformula/js/jquery-3.6.0.min.js"></script>
<script src="kityformula/js/kitygraph.all.js"></script>
<script src="kityformula/js/kity-formula-render.all.js"></script>
<script src="kityformula/js/kity-formula-parser.all.min.js"></script>
<script src="kityformula/js/kityformula-editor.all.min.js"></script>
<script>
//获取url地址栏传参
function getQueryVariable(variable){
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
//处理TinyMCE编辑器的事件
window.addEventListener('message', function (event) {
var data = event.data;
kfe.execCommand('get.image.data', function(data){
var latex = kfe.execCommand('get.source');
window.parent.postMessage({
mceAction: 'insertContent',
content: "<img src=\""+data.img+"\" data-latex=\""+latex+"\">"
}, '*');
window.parent.postMessage({
mceAction: 'close'
}, '*');
});
});
//实例化编辑器
jQuery( function ($) {
if ( document.body.addEventListener ) {
$( "#tips").html('<div id="loading"><img src="kityformula/loading.gif" alt="loading" /><p>正在加载,请耐心等待...</p></div>' );
var factory = kf.EditorFactory.create( $( "#kfEditorContainer" )[ 0 ], {
render: {
fontsize: 24
},
resource: {
path: "./kityformula/resource/"
}
} );
factory.ready( function ( KFEditor ) {
$( "#tips").remove();
//处理地址栏的参数并加载到编辑器中
var c=getQueryVariable("c")
if(c){
this.execCommand( "render",decodeURIComponent(c) );
}else{
this.execCommand( "render","\\placeholder" );
};
this.execCommand( "focus" );
window.kfe = this;
} );
} else {
$( "#tips").css( "color", "black" );
$( "#tips").css( "padding", "10px" );
}
} );
</script>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More