diff --git a/src/plugin/admin/app/controller/RuleController.php b/src/plugin/admin/app/controller/RuleController.php index 76ac1cd4..70750875 100644 --- a/src/plugin/admin/app/controller/RuleController.php +++ b/src/plugin/admin/app/controller/RuleController.php @@ -78,6 +78,8 @@ function get(Request $request): Response $item['name'] = $item['title']; $item['value'] = $item['id']; $item['icon'] = $item['icon'] ? "layui-icon {$item['icon']}" : ''; + $item['openType'] = $item['open_type'] ?? '_iframe'; + $item['isParent'] = !!$item['pid']; $formatted_items[] = $item; } @@ -89,6 +91,9 @@ function get(Request $request): Response } $this->removeNotContain($tree_items, 'type', $types); $menus = $this->empty_filter(Tree::arrayValues($tree_items)); + if ($request->get('original')){ + return json($menus); + } return $this->json(0, 'ok', $menus); } diff --git a/src/plugin/admin/app/controller/TableController.php b/src/plugin/admin/app/controller/TableController.php index 3c337b03..d005408e 100644 --- a/src/plugin/admin/app/controller/TableController.php +++ b/src/plugin/admin/app/controller/TableController.php @@ -401,7 +401,7 @@ public function crud(Request $request): Response $table_basename = strpos($table_name, $prefix) === 0 ? substr($table_name, strlen($prefix)) : $table_name; $inflector = InflectorFactory::create()->build(); $model_class = $inflector->classify($inflector->singularize($table_basename)); - $base_path = '/plugin/admin/app'; + $base_path = '/app/admin'; if ($request->method() === 'GET') { return raw_view('table/crud', [ 'table' => $table_name, @@ -419,6 +419,10 @@ public function crud(Request $request): Response return $this->json(1, '控制器和model不能为空'); } + if (str_starts_with($controller_file, $base_path) && !config('middleware.admin')) { + return $this->json(1, "请先设置鉴权中间件:config('middleware.admin')"); + } + $controller_info = pathinfo($controller_file); $model_info = pathinfo($model_file); $controller_path = Util::filterPath($controller_info['dirname'] ?? ''); @@ -525,6 +529,7 @@ public function crud(Request $request): Response $menu->title = $title; $menu->icon = $icon; $menu->href = "$url_path_base/index"; + $menu->open_type = '_iframe'; $menu->save(); $roles = admin('roles'); @@ -757,10 +762,10 @@ protected function createTemplate($template_file_path, $table, $url_path_base, $ $html
- -
@@ -784,8 +789,7 @@ protected function createTemplate($template_file_path, $table, $url_path_base, $ 浏览页面 - - + @@ -801,24 +805,24 @@ protected function createTemplate($template_file_path, $table, $url_path_base, $ - - + + - + - + - + + + @@ -90,15 +89,15 @@ - - + + - + + - + + - + \ No newline at end of file diff --git a/src/plugin/admin/app/view/config/index.html b/src/plugin/admin/app/view/config/index.html index 10ecef57..fdb1f142 100644 --- a/src/plugin/admin/app/view/config/index.html +++ b/src/plugin/admin/app/view/config/index.html @@ -3,9 +3,7 @@ - - - + "].join(""),O=p(window),P=p(document),i=function(e){this.index=++x.index,this.config=p.extend({},this.config,x.config,e),this.render()},d=(i.prototype.config={limit:10,loading:!0,escape:!0,cellMinWidth:60,cellMaxWidth:Number.MAX_VALUE,editTrigger:"click",defaultToolbar:["filter","exports","print"],defaultContextmenu:!0,autoSort:!0,text:{none:"\u65e0\u6570\u636e"},cols:[]},i.prototype.render=function(e){var t=this,a=t.config,i=(a.elem=p(a.elem),a.where=a.where||{},a.id="id"in a?a.id:a.elem.attr("id")||t.index);if(k.that[i]=t,(k.config[i]=a).request=p.extend({pageName:"page",limitName:"limit"},a.request),a.response=p.extend({statusName:"code",statusCode:0,msgName:"msg",dataName:"data",totalRowName:"totalRow",countName:"count"},a.response),null!==a.page&&"object"==typeof a.page&&(a.limit=a.page.limit||a.limit,a.limits=a.page.limits||a.limits,t.page=a.page.curr=a.page.curr||1,delete a.page.elem,delete a.page.jump),!a.elem[0])return t;if(a.elem.attr("lay-filter")||a.elem.attr("lay-filter",a.id),"reloadData"===e)return t.pullData(t.page,{type:"reloadData"});a.index=t.index,t.key=a.id||a.index,t.setInit(),a.height&&/^full-\d+$/.test(a.height)?(t.fullHeightGap=a.height.split("-")[1],a.height=O.height()-t.fullHeightGap):a.height&&/^#\w+\S*-\d+$/.test(a.height)&&(i=a.height.split("-"),t.parentHeightGap=i.pop(),t.parentDiv=i.join("-"),a.height=p(t.parentDiv).height()-t.parentHeightGap);var l,e=a.elem,i=e.next("."+R),n=t.elem=p("
");n.addClass((l=[R,R+"-"+t.index,"layui-form","layui-border-box"],a.className&&l.push(a.className),l.join(" "))).attr({"lay-filter":"LAY-TABLE-FORM-DF-"+t.index,"lay-id":a.id,style:(l=[],a.width&&l.push("width:"+a.width+"px;"),l.join(""))}).html(m(c,{open:"{{",close:"}}"}).render({data:a,index:t.index})),i[0]&&i.remove(),e.after(n),t.layTool=n.find(".layui-table-tool"),t.layBox=n.find(".layui-table-box"),t.layHeader=n.find(o),t.layMain=n.find(".layui-table-main"),t.layBody=n.find(D),t.layFixed=n.find(".layui-table-fixed"),t.layFixLeft=n.find(".layui-table-fixed-l"),t.layFixRight=n.find(".layui-table-fixed-r"),t.layTotal=n.find(".layui-table-total"),t.layPage=n.find(".layui-table-page"),t.renderToolbar(),t.renderPagebar(),t.fullSize(),t.pullData(t.page),t.events()},i.prototype.initOpts=function(e){this.config;e.checkbox&&(e.type="checkbox"),e.space&&(e.type="space"),e.type||(e.type="normal"),"normal"!==e.type&&(e.unresize=!0,e.width=e.width||{checkbox:50,radio:50,space:30,numbers:60}[e.type])},i.prototype.setInit=function(e){var l,a,d=this,r=d.config;if(r.clientWidth=r.width||(l=function(e){var t,a=(e=e||r.elem.parent()).width();try{t="none"===e.css("display")}catch(i){}return!e[0]||a&&!t?a:l(e.parent())})(),"width"===e)return r.clientWidth;r.height=r.maxHeight||r.height,r.css&&-1===r.css.indexOf(R)&&(a=r.css.split("}"),layui.each(a,function(e,t){t&&(a[e]="."+R+"-"+d.index+" "+t)}),r.css=a.join("}"));var c=function(a,e,i,l){var n,o;l?(l.key=[r.index,a,i].join("-"),l.colspan=l.colspan||0,l.rowspan=l.rowspan||0,d.initOpts(l),(n=a+(parseInt(l.rowspan)||1))','
','
'].join(""),a=this.layTool.find(".layui-table-tool-temp"),i=("default"===e.toolbar?a.html(t):"string"==typeof e.toolbar&&(t=p(e.toolbar).html()||"")&&a.html(m(t).render(e)),{filter:{title:"\u7b5b\u9009\u5217",layEvent:"LAYTABLE_COLS",icon:"layui-icon-cols"},exports:{title:"\u5bfc\u51fa",layEvent:"LAYTABLE_EXPORT",icon:"layui-icon-export"},print:{title:"\u6253\u5370",layEvent:"LAYTABLE_PRINT",icon:"layui-icon-print"}}),l=[];"object"==typeof e.defaultToolbar&&layui.each(e.defaultToolbar,function(e,t){t="string"==typeof t?i[t]:t;t&&l.push('
')}),this.layTool.find(".layui-table-tool-self").html(l.join(""))},i.prototype.renderPagebar=function(){var e,t=this.config,a=this.layPagebar=p('
');t.pagebar&&((e=p(t.pagebar).html()||"")&&a.append(m(e).render(t)),this.layPage.append(a))},i.prototype.setParentCol=function(e,t){var a=this.config,i=this.layHeader.find('th[data-key="'+t+'"]'),l=parseInt(i.attr("colspan"))||0;i[0]&&(t=t.split("-"),t=a.cols[t[1]][t[2]],e?l--:l++,i.attr("colspan",l),i[l?"removeClass":"addClass"](N),t.colspan2=l,t.hide=l<1,(a=i.data("parentkey"))&&this.setParentCol(e,a))},i.prototype.setColsPatch=function(){var a=this,e=a.config;layui.each(e.cols,function(e,t){layui.each(t,function(e,t){t.hide&&a.setParentCol(t.hide,t.parentKey)})})},i.prototype.setGroupWidth=function(i){var e,l=this;l.config.cols.length<=1||((e=l.layHeader.find((i?"th[data-key="+i.data("parentkey")+"]>":"")+"."+H)).css("width",0),layui.each(e.get().reverse(),function(){var e=p(this),t=e.parent().data("key"),a=0;l.layHeader.eq(0).find("th[data-parentkey="+t+"]").width(function(e,t){p(this).hasClass(N)||0 tr:first-child > th:last-child")).data("field")&&e.prev()[0]?t(e.prev()):e})()).data("key"),n.getCssRule(e,function(e){var t=e.style.width||a.outerWidth();e.style.width=parseFloat(t)+l+"px",0'+(e||"Error")+"");a[0]&&(t.layNone.remove(),a.remove()),t.layFixed.addClass(N),t.layMain.find("tbody").html(""),t.layMain.append(t.layNone=e),t.layTotal.addClass(h),t.layPage.find(_).addClass(h),x.cache[t.key]=[],t.syncCheckAll(),t.renderForm(),t.setColsWidth()},i.prototype.page=1,i.prototype.pullData=function(a,t){var e,i,l=this,n=l.config,o=(n.HAS_SET_COLS_PATCH||l.setColsPatch(),n.HAS_SET_COLS_PATCH=!0,n.request),d=n.response,r=function(){"object"==typeof n.initSort&&l.sort({field:n.initSort.field,type:n.initSort.type,reloadType:t.type})},c=function(e,t){l.setColsWidth(),"function"==typeof n.done&&n.done(e,a,e[d.countName],t)};t=t||{},"function"==typeof n.before&&n.before(n),l.startTime=(new Date).getTime(),t.renderData?((e={})[d.dataName]=x.cache[l.key],e[d.countName]=n.url?"object"===layui.type(n.page)?n.page.count:e[d.dataName].length:n.data.length,"object"==typeof n.totalRow&&(e[d.totalRowName]=p.extend({},l.totalRow)),l.renderData({res:e,curr:a,count:e[d.countName],type:t.type}),r(),c(e,"renderData")):n.url?(i={},n.page&&(i[o.pageName]=a,i[o.limitName]=n.limit),o=p.extend(i,n.where),n.contentType&&0==n.contentType.indexOf("application/json")&&(o=JSON.stringify(o)),l.loading(),p.ajax({type:n.method||"get",url:n.url,contentType:n.contentType,data:o,dataType:n.dataType||"json",jsonpCallback:n.jsonpCallback,headers:n.headers||{},success:function(e){(e="function"==typeof n.parseData?n.parseData(e)||e:e)[d.statusName]!=d.statusCode?l.errorView(e[d.msgName]||'\u8fd4\u56de\u7684\u6570\u636e\u4e0d\u7b26\u5408\u89c4\u8303\uff0c\u6b63\u786e\u7684\u6210\u529f\u72b6\u6001\u7801\u5e94\u4e3a\uff1a"'+d.statusName+'": '+d.statusCode):(l.totalRow=e[d.totalRowName],l.renderData({res:e,curr:a,count:e[d.countName],type:t.type}),r(),n.time=(new Date).getTime()-l.startTime+" ms"),c(e)},error:function(e,t){l.errorView("\u8bf7\u6c42\u5f02\u5e38\uff0c\u9519\u8bef\u63d0\u793a\uff1a"+t),"function"==typeof n.error&&n.error(e,t)}})):"array"===layui.type(n.data)&&(e={},i=a*n.limit-n.limit,o=n.data.concat(),e[d.dataName]=n.page?o.splice(i,n.limit):o,e[d.countName]=n.data.length,"object"==typeof n.totalRow&&(e[d.totalRowName]=p.extend({},n.totalRow)),l.totalRow=e[d.totalRowName],l.renderData({res:e,curr:a,count:e[d.countName],type:t.type}),r(),c(e))},i.prototype.eachCols=function(e){return x.eachCols(null,e,this.config.cols),this},i.prototype.col=function(e){try{return e=e.split("-"),this.config.cols[e[1]][e[2]]||{}}catch(t){return y.error(t),{}}},i.prototype.getTrHtml=function(a,l,n,e){var s=this,u=s.config,y=e&&e.trs||[],h=e&&e.trs_fixed||[],f=e&&e.trs_fixed_r||[];return n=n||1,layui.each(a,function(e,o){var i=[],d=[],r=[],c=e+u.limit*(n-1)+1;if("object"!=typeof o){a[e]=o={LAY_KEY:o};try{x.cache[s.key][e]=o}catch(t){}}"array"===layui.type(o)&&0===o.length||(o[x.config.numbersName]=c,l||(o[x.config.indexName]=e),s.eachCols(function(e,l){var t,e=l.field||e,a=l.key,n=o[e];n!==undefined&&null!==n||(n=""),l.colGroup||(t=['','
"+function(){var e,t=p.extend(!0,{LAY_COL:l},o),a=x.config.checkName,i=x.config.disabledName;switch(l.type){case"checkbox":return'';case"radio":return'';case"numbers":return c}return l.toolbar?m(p(l.toolbar).html()||"").render(t):w.call(s,{item3:l,content:n,tplData:t})}(),"
"].join(""),i.push(t),l.fixed&&"right"!==l.fixed&&d.push(t),"right"===l.fixed&&r.push(t))}),e=['data-index="'+e+'"'],o[x.config.checkName]&&e.push('class="'+E+'"'),e=e.join(" "),y.push(""+i.join("")+""),h.push(""+d.join("")+""),f.push(""+r.join("")+""))}),{trs:y,trs_fixed:h,trs_fixed_r:f}},x.getTrHtml=function(e,t){e=C(e);return e.getTrHtml(t,null,e.page)},i.prototype.renderData=function(e){var a=this,i=a.config,t=e.res,l=e.curr,n=a.count=e.count,o=e.sort,d=t[i.response.dataName]||[],t=t[i.response.totalRowName],r=[],c=[],s=[],u=function(){if(!o&&a.sortKey)return a.sort({field:a.sortKey.field,type:a.sortKey.sort,pull:!0,reloadType:e.type});a.getTrHtml(d,o,l,{trs:r,trs_fixed:c,trs_fixed_r:s}),"fixed"===i.scrollPos&&"reloadData"===e.type||a.layBody.scrollTop(0),"reset"===i.scrollPos&&a.layBody.scrollLeft(0),a.layMain.find("."+L).remove(),a.layMain.find("tbody").html(r.join("")),a.layFixLeft.find("tbody").html(c.join("")),a.layFixRight.find("tbody").html(s.join("")),a.syncCheckAll(),a.renderForm(),a.fullSize(),a.haveInit?a.scrollPatch():setTimeout(function(){a.scrollPatch()},50),a.haveInit=!0,f.close(a.tipsIndex)};return x.cache[a.key]=d,a.layTotal[0==d.length?"addClass":"removeClass"](h),a.layPage[i.page||i.pagebar?"removeClass":"addClass"](N),a.layPage.find(_)[!i.page||0==n||0===d.length&&1==l?"addClass":"removeClass"](h),0===d.length?a.errorView(i.text.none):(a.layFixLeft.removeClass(N),o?u():(u(),a.renderTotal(d,t),a.layTotal&&a.layTotal.removeClass(N),void(i.page&&(i.page=p.extend({elem:"layui-table-page"+i.index,count:n,limit:i.limit,limits:i.limits||[10,20,30,40,50,60,70,80,90],groups:3,layout:["prev","page","next","skip","count","limit"],prev:'',next:'',jump:function(e,t){t||(a.page=e.curr,i.limit=e.limit,a.pullData(e.curr))}},i.page),i.page.count=n,z.render(i.page)))))},x.renderData=function(e){e=C(e);e&&e.pullData(e.page,{renderData:!0,type:"reloadData"})},i.prototype.renderTotal=function(e,o){var d,r=this,c=r.config,s={};c.totalRow&&(layui.each(e,function(e,i){"array"===layui.type(i)&&0===i.length||r.eachCols(function(e,t){var e=t.field||e,a=i[e];t.totalRow&&(s[e]=(s[e]||0)+(parseFloat(a)||0))})}),r.dataTotal=[],d=[],r.eachCols(function(e,t){var a,e=t.field||e,i=o&&o[t.field],l="totalRowDecimals"in t?t.totalRowDecimals:2,l=s[e]?parseFloat(s[e]||0).toFixed(l):"",l=(a=t.totalRowText||"",(n={LAY_COL:t})[e]=l,n=t.totalRow&&w.call(r,{item3:t,content:l,tplData:n})||a,i||n),n=(t.field&&r.dataTotal.push({field:t.field,total:p("
"+l+"
").text()}),['','
"+("string"==typeof(a=t.totalRow||c.totalRow)?m(a).render(p.extend({TOTAL_NUMS:i||s[e],TOTAL_ROW:o||{},LAY_COL:t},t)):l),"
"].join(""));d.push(n)}),e=r.layTotal.find(".layui-table-patch"),r.layTotal.find("tbody").html(""+d.join("")+(e.length?e.get(0).outerHTML:"")+""))},i.prototype.getColElem=function(e,t){this.config;return e.eq(0).find(".laytable-cell-"+t+":eq(0)")},i.prototype.renderForm=function(e){this.config;var t=this.elem.attr("lay-filter");v.render(e,t)},i.prototype.syncCheckAll=function(){var a,e=this,i=e.config,t=e.layHeader.find('input[name="layTableCheckbox"]'),l=x.checkStatus(e.key);t[0]&&(a=l.isAll,e.eachCols(function(e,t){"checkbox"===t.type&&(t[i.checkName]=a)}),t.prop({checked:l.isAll,indeterminate:!l.isAll&&l.data.length}),v.render(t))},i.prototype.setRowActive=function(e,t){this.config;this.layBody.find('tr[data-index="'+e+'"]').addClass(t=t||"layui-table-click").siblings("tr").removeClass(t)},i.prototype.setRowChecked=function(a){var e=this,i=e.config,l=e.layBody.find("tr"+("all"===a.index?"":'[data-index="'+a.index+'"]')),t=(a=p.extend({type:"checkbox"},a),x.cache[e.key]),n="checked"in a,o=function(e){return"radio"===a.type||(n?a.checked:!e)},t=(layui.each(t,function(e,t){"array"!==layui.type(t)&&(Number(a.index)===e||"all"===a.index?(e=t[i.checkName]=o(t[i.checkName]),l[e?"addClass":"removeClass"](E),"radio"===a.type&&l.siblings().removeClass(E)):"radio"===a.type&&delete t[i.checkName])}),l.find('input[lay-type="'+({radio:"layTableRadio",checkbox:"layTableCheckbox"}[a.type]||"checkbox")+'"]'));t.prop("checked",o(t.last().prop("checked"))),e.syncCheckAll(),e.renderForm(a.type)},i.prototype.sort=function(l){var e,t=this,a={},i=t.config,n=i.elem.attr("lay-filter"),o=x.cache[t.key];"string"==typeof(l=l||{}).field&&(d=l.field,t.layHeader.find("th").each(function(e,t){var a=p(this),i=a.data("field");if(i===l.field)return l.field=a,d=i,!1}));try{var d=d||l.field.data("field"),r=l.field.data("key");if(t.sortKey&&!l.pull&&d===t.sortKey.field&&l.type===t.sortKey.sort)return;var c=t.layHeader.find("th .laytable-cell-"+r).find(A);t.layHeader.find("th").find(A).removeAttr("lay-sort"),c.attr("lay-sort",l.type||null),t.layFixed.find("th")}catch(s){y.error("Table modules: sort field '"+d+"' not matched")}t.sortKey={field:d,sort:l.type},i.autoSort&&("asc"===l.type?e=layui.sort(o,d,null,!0):"desc"===l.type?e=layui.sort(o,d,!0,!0):(e=layui.sort(o,x.config.indexName,null,!0),delete t.sortKey,delete i.initSort)),a[i.response.dataName]=e||o,t.renderData({res:a,curr:t.page,count:t.count,sort:!0,type:l.reloadType}),l.fromEvent&&(i.initSort={field:d,type:l.type},layui.event.call(l.field,T,"sort("+n+")",p.extend({config:i},i.initSort)))},i.prototype.loading=function(e){var t=this;t.config.loading&&(e?(t.layInit&&t.layInit.remove(),delete t.layInit,t.layBox.find(".layui-table-init").remove()):(t.layInit=p(['
','',"
"].join("")),t.layBox.append(t.layInit)))},i.prototype.getCssRule=function(a,i){var e=this.elem.find("style")[0],e=e.sheet||e.styleSheet||{},e=e.cssRules||e.rules;layui.each(e,function(e,t){if(t.selectorText===".laytable-cell-"+a)return i(t),!0})},i.prototype.fullSize=function(){var e,a,i=this,t=i.config,l=t.height;i.fullHeightGap?(l=O.height()-i.fullHeightGap)<135&&(l=135):i.parentDiv&&i.parentHeightGap&&(l=p(i.parentDiv).height()-i.parentHeightGap)<135&&(l=135),1
')).find("div").css({width:a}),e.find("tr").append(t)):e.find(".layui-table-patch").remove()};n(e.layHeader),n(e.layTotal);n=e.layMain.height()-i;e.layFixed.find(D).css("height",t.height()>=n?n:"auto").scrollTop(e.layMain.scrollTop()),e.layFixRight[x.cache[e.key]&&x.cache[e.key].length&&0');a.html(t),u.height&&a.css("max-height",u.height-(s.layTool.outerHeight()||50)),i.find("."+S)[0]||i.append(a),s.renderForm(),a.on("click",function(e){layui.stope(e)}),e.done&&e.done(a,t)};switch(layui.stope(e),P.trigger("table.tool.panel.remove"),f.close(s.tipsIndex),t){case"LAYTABLE_COLS":l({list:(a=[],s.eachCols(function(e,t){t.field&&"normal"==t.type&&a.push('
  • "+(t.fieldTitle||t.title||t.field)+"").text())+'" lay-filter="LAY_TABLE_TOOL_COLS">
  • ')}),a.join("")),done:function(){v.on("checkbox(LAY_TABLE_TOOL_COLS)",function(e){var e=p(e.elem),t=this.checked,a=e.data("key"),i=s.col(a),l=i.hide,e=e.data("parentkey");i.key&&(i.hide=!t,s.elem.find('*[data-key="'+a+'"]')[t?"removeClass":"addClass"](N),l!=i.hide&&s.setParentCol(!t,e),s.resize(),layui.event.call(this,T,"colToggled("+r+")",{col:i,config:u}))})}});break;case"LAYTABLE_EXPORT":b.ie?f.tips("\u5bfc\u51fa\u529f\u80fd\u4e0d\u652f\u6301 IE\uff0c\u8bf7\u7528 Chrome \u7b49\u9ad8\u7ea7\u6d4f\u89c8\u5668\u5bfc\u51fa",this,{tips:3}):l({list:['
  • \u5bfc\u51fa csv \u683c\u5f0f\u6587\u4ef6
  • ','
  • \u5bfc\u51fa xls \u683c\u5f0f\u6587\u4ef6
  • '].join(""),done:function(e,t){t.on("click",function(){var e=p(this).data("type");x.exportFile.call(s,u.id,null,e)})}});break;case"LAYTABLE_PRINT":var n=window.open("about:blank","_blank"),o=[""].join(""),d=p(s.layHeader.html());d.append(s.layMain.find("table").html()),d.append(s.layTotal.find("table").html()),d.find("th.layui-table-patch").remove(),d.find("thead>tr>th."+M).filter(function(e,t){return!p(t).children("."+H).length}).remove(),d.find("tbody>tr>td."+M).remove(),n.document.write(o+d.prop("outerHTML")),n.document.close(),layui.device("edg").edg?(n.onafterprint=n.close,n.print()):(n.print(),n.close())}layui.event.call(this,T,"toolbar("+r+")",p.extend({event:t,config:u},{}))}),s.layHeader.on("click","*[lay-event]",function(e){var t=p(this),a=t.attr("lay-event"),t=t.closest("th").data("key"),t=s.col(t);layui.event.call(this,T,"colTool("+r+")",p.extend({event:a,config:u,col:t},{}))}),s.layPagebar.on("click","*[lay-event]",function(e){var t=p(this).attr("lay-event");layui.event.call(this,T,"pagebar("+r+")",p.extend({event:t,config:u},{}))}),e.on("mousemove",function(e){var t=p(this),a=t.offset().left,e=e.clientX-a;t.data("unresize")||k.eventMoveElem||(d.allowResize=t.width()-e<=10,o.css("cursor",d.allowResize?"col-resize":""))}).on("mouseleave",function(){p(this);k.eventMoveElem||o.css("cursor","")}).on("mousedown",function(e){var t,a=p(this);d.allowResize&&(t=a.data("key"),e.preventDefault(),d.offset=[e.clientX,e.clientY],s.getCssRule(t,function(e){var t=e.style.width||a.outerWidth();d.rule=e,d.ruleWidth=parseFloat(t),d.minWidth=a.data("minwidth")||u.cellMinWidth,d.maxWidth=a.data("maxwidth")||u.cellMaxWidth}),a.data(I,d),k.eventMoveElem=a)}),k.docEvent||P.on("mousemove",function(e){var t,a;k.eventMoveElem&&(t=k.eventMoveElem.data(I)||{},k.eventMoveElem.data("resizing",1),e.preventDefault(),t.rule&&(e=t.ruleWidth+e.clientX-t.offset[0],a=k.eventMoveElem.closest("."+R).attr("lay-id"),(a=C(a))&&((e=et.maxWidth&&(e=t.maxWidth),t.rule.style.width=e+"px",a.setGroupWidth(k.eventMoveElem),f.close(s.tipsIndex))))}).on("mouseup",function(e){var t,a,i,l,n;k.eventMoveElem&&(i=(t=k.eventMoveElem).closest("."+R).attr("lay-id"),(a=C(i))&&(i=t.data("key"),l=a.col(i),n=a.config.elem.attr("lay-filter"),d={},o.css("cursor",""),a.scrollPatch(),t.removeData(I),delete k.eventMoveElem,a.getCssRule(i,function(e){l.width=parseFloat(e.style.width),layui.event.call(t[0],T,"colResized("+n+")",{col:l,config:a.config})})))}),k.docEvent=!0,e.on("click",function(e){var t=p(this),a=t.find(A),i=a.attr("lay-sort");if(!a[0]||1===t.data("resizing"))return t.removeData("resizing");s.sort({field:t,type:"asc"===i?"desc":"desc"===i?null:"asc",fromEvent:!0})}).find(A+" .layui-edge ").on("click",function(e){var t=p(this),a=t.index(),t=t.parents("th").eq(0).data("field");layui.stope(e),0===a?s.sort({field:t,type:"asc",fromEvent:!0}):s.sort({field:t,type:"desc",fromEvent:!0})}),s.commonMember=function(e){var t=p(this).parents("tr").eq(0).data("index"),r=s.layBody.find('tr[data-index="'+t+'"]'),c=(c=x.cache[s.key]||[])[t]||{},a={tr:r,config:u,data:x.clearCacheKey(c),dataCache:c,index:t,del:function(){x.cache[s.key][t]=[],r.remove(),s.scrollPatch()},update:function(e,d){e=e||{},layui.each(e,function(i,l){var n=r.children('td[data-field="'+i+'"]'),o=n.children(y);c[i]=a.data[i]=l,s.eachCols(function(e,t){var a;t.field==i?(o.html(w.call(s,{item3:t,content:l,tplData:p.extend({LAY_COL:t},c)})),n.data("content",l)):d&&(t.templet||t.toolbar)&&(e=r.children('td[data-field="'+(t.field||e)+'"]'),a=c[t.field],e.children(y).html(w.call(s,{item3:t,content:a,tplData:p.extend({LAY_COL:t},c)})),e.data("content",a))})}),s.renderForm()},setRowChecked:function(e){s.setRowChecked(p.extend({index:t},e))}};return p.extend(a,e)}),a=(s.elem.on("click",'input[name="layTableCheckbox"]+',function(e){var t=p(this),a=t.closest("td"),t=t.prev(),i=(s.layBody.find('input[name="layTableCheckbox"]'),t.parents("tr").eq(0).data("index")),l=t[0].checked,n="layTableAllChoose"===t.attr("lay-filter");t[0].disabled||(n?s.setRowChecked({index:"all",checked:l}):(s.setRowChecked({index:i,checked:l}),layui.stope(e)),layui.event.call(t[0],T,"checkbox("+r+")",c.call(t[0],{checked:l,type:n?"all":"one",getCol:function(){return s.col(a.data("key"))}})))}),s.elem.on("click",'input[lay-type="layTableRadio"]+',function(e){var t=p(this),a=t.closest("td"),t=t.prev(),i=t[0].checked,l=t.parents("tr").eq(0).data("index");if(layui.stope(e),t[0].disabled)return!1;s.setRowChecked({type:"radio",index:l}),layui.event.call(t[0],T,"radio("+r+")",c.call(t[0],{checked:i,getCol:function(){return s.col(a.data("key"))}}))}),s.layBody.on("mouseenter","tr",function(){var e=p(this),t=e.index();e.data("off")||s.layBody.find("tr:eq("+t+")").addClass(j)}).on("mouseleave","tr",function(){var e=p(this),t=e.index();e.data("off")||s.layBody.find("tr:eq("+t+")").removeClass(j)}).on("click","tr",function(e){var t=".layui-form-checkbox,.layui-form-switch,.layui-form-radio,[lay-unrow]";p(e.target).is(t)||p(e.target).closest(t)[0]||a.call(this,"row")}).on("dblclick","tr",function(){a.call(this,"rowDouble")}).on("contextmenu","tr",function(e){u.defaultContextmenu||e.preventDefault(),a.call(this,"rowContextmenu")}),function(e){var t=p(this);t.data("off")||layui.event.call(this,T,e+"("+r+")",c.call(t.children("td")[0]))}),n=function(e,t){var a,i,l,n;(e=p(e)).data("off")||(a=e.data("field"),n=e.data("key"),n=s.col(n),i=e.closest("tr").data("index"),i=x.cache[s.key][i],l=e.children(y),(n="function"==typeof n.edit?n.edit(i):n.edit)&&((n=p("textarea"===n?'':''))[0].value=e.data("content")||i[a]||l.text(),e.find("."+W)[0]||e.append(n),n.focus(),t&&layui.stope(t)))},i=(s.layBody.on("change","."+W,function(){var e=p(this),t=e.parent(),a=this.value,i=e.parent().data("field"),e=e.closest("tr").data("index"),e=x.cache[s.key][e],l=c.call(t[0],{value:a,field:i,oldValue:e[i],td:t,reedit:function(){setTimeout(function(){n(l.td);var e={};e[i]=l.oldValue,l.update(e)})},getCol:function(){return s.col(t.data("key"))}}),e={};e[i]=a,l.update(e),layui.event.call(t[0],T,"edit("+r+")",l)}).on("blur","."+W,function(){p(this).remove()}),s.layBody.on(u.editTrigger,"td",function(e){n(this,e)}).on("mouseenter","td",function(){t.call(this)}).on("mouseleave","td",function(){t.call(this,"hide")}),s.layTotal.on("mouseenter","td",function(){t.call(this)}).on("mouseleave","td",function(){t.call(this,"hide")}),"layui-table-grid-down"),t=function(e){var t=p(this),a=t.children(y);t.data("off")||(e?t.find(".layui-table-grid-down").remove():!(a.prop("scrollWidth")>a.outerWidth()||0'))},l=function(e){var t=p(this).parent().children(y);s.tipsIndex=f.tips(['
    ',t.html(),"
    ",''].join(""),t[0],{tips:[3,""],time:-1,anim:-1,maxWidth:b.ios||b.android?300:s.elem.width()/2,isOutAnim:!1,skin:"layui-table-tips",success:function(e,t){e.find(".layui-table-tips-c").on("click",function(){f.close(t)})}}),layui.stope(e)},h=(s.layBody.on("click","."+i,function(e){l.call(this,e)}),s.layTotal.on("click","."+i,function(e){l.call(this,e)}),function(e){var t=p(this),a=t.closest("td"),i=t.parents("tr").eq(0).data("index");s.setRowActive(i),layui.event.call(this,T,(e||"tool")+"("+r+")",c.call(this,{event:t.attr("lay-event"),getCol:function(){return s.col(a.data("key"))}}))});s.layBody.on("click","*[lay-event]",function(e){h.call(this),layui.stope(e)}).on("dblclick","*[lay-event]",function(e){h.call(this,"toolDouble"),layui.stope(e)}),s.layMain.on("scroll",function(){var e=p(this),t=e.scrollLeft(),e=e.scrollTop();s.layHeader.scrollLeft(t),s.layTotal.scrollLeft(t),s.layFixed.find(D).scrollTop(e),f.close(s.tipsIndex)}),O.on("resize",function(){s.resize()})},P.on("click",function(){P.trigger("table.remove.tool.panel")}),P.on("table.remove.tool.panel",function(){p("."+S).remove()}),x.init=function(i,o){o=o||{};var e="object"==typeof i?i:p("string"==typeof i?'table[lay-filter="'+i+'"]':t+"[lay-data], "+t+"[lay-options]"),d="Table element property lay-data configuration item has a syntax error: ";return e.each(function(){var l,e=p(this),t=e.attr("lay-data"),t=r.options(this,{attr:t?"lay-data":null,errorText:d+(t||e.attr("lay-options"))}),n=p.extend({elem:this,cols:[],data:[],skin:e.attr("lay-skin"),size:e.attr("lay-size"),even:"string"==typeof e.attr("lay-even")},x.config,o,t),a=(i&&e.hide(),e.find("thead>tr").each(function(i){n.cols[i]=[],p(this).children().each(function(e){var t=p(this),a=t.attr("lay-data"),a=r.options(this,{attr:a?"lay-data":null,errorText:d+(a||t.attr("lay-options"))}),t=p.extend({title:t.text(),colspan:parseInt(t.attr("colspan"))||1,rowspan:parseInt(t.attr("rowspan"))||1},a);n.cols[i].push(t)})}),e.find("tbody>tr")),t=x.render(n);!a.length||o.data||t.config.url||(l=0,x.eachCols(t.config.id,function(e,i){a.each(function(e){n.data[e]=n.data[e]||{};var t=p(this),a=i.field;n.data[e][a]=t.children("td").eq(l).html()}),l++}),t.reloadData({data:n.data}))}),this},k.that={},k.config={},function(a,i,e,l){var n,o;l.colGroup&&(n=0,a++,l.CHILD_COLS=[],o=e+(parseInt(l.rowspan)||1),layui.each(i[o],function(e,t){t.parentKey?t.parentKey===l.key&&(t.PARENT_COL_INDEX=a,l.CHILD_COLS.push(t),d(a,i,o,t)):t.PARENT_COL_INDEX||1<=n&&n==(l.colspan||1)||(t.PARENT_COL_INDEX=a,l.CHILD_COLS.push(t),n+=parseInt(1td').filter('[data-field="'+e+'"]')}}})).replace(/"/g,'""'),n.push(a='"'+a+'"')))}),d.push(n.join(","))}),c&&layui.each(c.dataTotal,function(e,t){r[t.field]||i.push('"'+(t.total||"")+'"')}),o.join(",")+"\r\n"+d.join("\r\n")+"\r\n"+i.join(","))),u.download=(a.title||n.title||"table_"+(n.index||""))+"."+l,document.body.appendChild(u),u.click(),document.body.removeChild(u)},x.getOptions=l,x.hideCol=function(e,l){var n=C(e);n&&("boolean"===layui.type(l)?n.eachCols(function(e,t){var a=t.key,i=n.col(a),t=t.parentKey;i.hide!=l&&(i=i.hide=l,n.elem.find('*[data-key="'+a+'"]')[i?"addClass":"removeClass"](N),n.setParentCol(i,t))}):(l=layui.isArray(l)?l:[l],layui.each(l,function(e,l){n.eachCols(function(e,t){var a,i;l.field===t.field&&(a=t.key,i=n.col(a),t=t.parentKey,"hide"in l&&i.hide!=l.hide&&(i=i.hide=!!l.hide,n.elem.find('*[data-key="'+a+'"]')[i?"addClass":"removeClass"](N),n.setParentCol(i,t)))})})),p("."+S).remove(),n.resize())},x.reload=function(e,t,a,i){if(l(e))return e=C(e),e.reload(t,a,i),k.call(e)},x.reloadData=function(){var a=p.extend([],arguments),i=(a[3]="reloadData",new RegExp("^("+["elem","id","cols","width","height","maxHeight","toolbar","defaultToolbar","className","css","totalRow","pagebar"].join("|")+")$"));return layui.each(a[1],function(e,t){i.test(e)&&delete a[1][e]}),x.reload.apply(null,a)},x.render=function(e){e=new i(e);return k.call(e)},x.clearCacheKey=function(e){return delete(e=p.extend({},e))[x.config.checkName],delete e[x.config.indexName],delete e[x.config.numbersName],delete e[x.config.disabledName],e},p(function(){x.init()}),n(T,x)});layui.define(["table"],function(e){"use strict";var B=layui.$,x=layui.form,j=layui.table,y=layui.hint(),P={config:{},on:j.on,eachCols:j.eachCols,index:j.index,set:function(e){var t=this;return t.config=B.extend({},t.config,e),t},resize:j.resize,getOptions:j.getOptions,hideCol:j.hideCol,renderData:j.renderData},i=function(){var a=this,e=a.config,n=e.id||e.index;return{config:e,reload:function(e,t){a.reload.call(a,e,t)},reloadData:function(e,t){P.reloadData(n,e,t)}}},F=function(e){var t=i.that[e];return t||y.error(e?"The treeTable instance with ID '"+e+"' not found":"ID argument required"),t||null},q="layui-hide",L=".layui-table-main",R=".layui-table-fixed-l",Y=".layui-table-fixed-r",l="layui-table-checked",h="layui-table-tree",H="LAY_DATA_INDEX",m="LAY_DATA_INDEX_HISTORY",s="LAY_PARENT_INDEX",b="LAY_CHECKBOX_HALF",X="LAY_EXPAND",z="LAY_HAS_EXPANDED",V="LAY_ASYNC_STATUS",t=function(e){var t=this;t.index=++P.index,t.config=B.extend(!0,{},t.config,P.config,e),t.init(),t.render()},u=function(n,i,e){var l=j.cache[n];layui.each(e||l,function(e,t){var a=t[H];-1!==a.indexOf("-")&&(l[a]=t),t[i]&&u(n,i,t[i])})},r=function(i,a,e){var l=F(i),t=("reloadData"!==e&&(l.status={expand:{}}),B.extend(!0,{},l.getOptions(),a)),n=t.tree,r=n.customName.children,d=n.customName.id,o=(delete a.hasNumberCol,delete a.hasChecboxCol,delete a.hasRadioCol,j.eachCols(null,function(e,t){"numbers"===t.type?a.hasNumberCol=!0:"checkbox"===t.type?a.hasChecboxCol=!0:"radio"===t.type&&(a.hasRadioCol=!0)},t.cols),a.parseData),c=a.done;t.url?e&&(!o||o.mod)||(a.parseData=function(){var e=this,t=arguments,a=t[0],t=("function"===layui.type(o)&&(a=o.apply(e,t)||t[0]),e.response.dataName);return n.data.isSimpleData&&!n["async"].enable&&(a[t]=l.flatToTree(a[t])),f(a[t],function(e){e[X]=X in e?e[X]:e[d]!==undefined&&l.status.expand[e[d]]},r),e.autoSort&&e.initSort&&e.initSort.type&&layui.sort(a[t],e.initSort.field,"desc"===e.initSort.type,!0),l.initData(a[t]),a},a.parseData.mod=!0):(a.data=a.data||[],n.data.isSimpleData&&(a.data=l.flatToTree(a.data)),l.initData(a.data)),e&&(!c||c.mod)||(a.done=function(){var e,t=arguments,a=(t[3]||delete l.isExpandAll,this.elem.next()),n=(l.updateStatus(null,{LAY_HAS_EXPANDED:!1}),u(i,r),a.find('[name="layTableCheckbox"][lay-filter="layTableAllChoose"]'));if(n.length&&(e=P.checkStatus(i),n.prop({checked:e.isAll&&e.data.length,indeterminate:!e.isAll&&e.data.length})),l.renderTreeTable(a),"function"===layui.type(c))return c.apply(this,t)},a.done.mod=!0)};t.prototype.init=function(){var e=this.config,t=e.tree.data.cascade,t=("parent"!==t&&"children"!==t&&(e.tree.data.cascade="all"),j.render(B.extend({},e,{data:[],url:"",done:null}))),a=t.config.id;(i.that[a]=this).tableIns=t,r(a,e)},t.prototype.config={tree:{customName:{children:"children",isParent:"isParent",name:"name",id:"id",pid:"parentId",icon:"icon"},view:{indent:14,flexIconClose:'',flexIconOpen:'',showIcon:!0,icon:"",iconClose:'',iconOpen:'',iconLeaf:'',showFlexIconIfNotParent:!1,dblClickExpand:!0,expandAllDefault:!1},data:{isSimpleData:!1,rootPid:null,cascade:"all"},"async":{enable:!1,url:"",type:null,contentType:null,headers:null,where:null,autoParam:[]},callback:{beforeExpand:null,onExpand:null}}},t.prototype.getOptions=function(){return this.tableIns?j.getOptions(this.tableIns.config.id):this.config},t.prototype.flatToTree=function(e){var a,n,i,t,l,r,d,o=this.getOptions(),c=o.tree,u=c.customName,o=o.id;return e=e||j.cache[o],o=e,a=u.id,n=u.pid,i=u.children,t=c.data.rootPid,a=a||"id",n=n||"parentId",i=i||"children",d={},layui.each(o,function(e,t){l=a+t[a],d[l]=B.extend({},t),d[l][i]=[]}),layui.each(d,function(e,t){(r=a+t[n])&&d[r]&&d[r][i].push(t)}),Object.values(d).filter(function(e){return t?e[n]===t:!e[n]})},t.prototype.treeToFlat=function(e,n,i){var l=this,r=l.getOptions().tree.customName,d=r.children,o=r.pid,c=[];return layui.each(e,function(e,t){var e=(i?i+"-":"")+e,a=B.extend({},t);a[o]=t[o]||n,c.push(a),c=c.concat(l.treeToFlat(t[d],t[r.id],e))}),c},t.prototype.getTreeNode=function(e){var t=this;if(!e)return y.error("\u627e\u4e0d\u5230\u8282\u70b9\u6570\u636e");var a=t.getOptions(),n=a.tree;a.id,n.customName;return{data:e,dataIndex:e[H],getParentNode:function(){return t.getNodeByIndex(e[s])}}},t.prototype.getNodeByIndex=function(t){var e=this,a=e.getNodeDataByIndex(t);if(!a)return y.error("\u627e\u4e0d\u5230\u8282\u70b9\u6570\u636e");var n=e.getOptions(),i=(n.tree.customName.parent,n.id),n={data:a,dataIndex:a[H],getParentNode:function(){return e.getNodeByIndex(a[s])},update:function(e){return P.updateNode(i,t,e)},remove:function(){return P.removeNode(i,t)},expand:function(e){return P.expandNode(i,B.extend({},e,{index:t}))},setChecked:function(e){return P.setRowChecked(i,B.extend({},e,{index:t}))}};return n.dataIndex=t,n},t.prototype.getNodeById=function(a){var e=this.getOptions(),n=e.tree.customName.id,i="",e=P.getData(e.id,!0);if(layui.each(e,function(e,t){if(t[n]===a)return i=t[H],!0}),i)return this.getNodeByIndex(i)},t.prototype.getNodeDataByIndex=function(a,e,t){var n=this.getOptions(),i=n.tree,l=n.id,r=j.cache[l][a];if("delete"!==t&&r)return B.extend(r,t),e?B.extend({},r):r;for(var r=this.getTableData(),d=(a+="").split("-"),o=r,c=n.url||1');var D=function(e){y[V]="success",y[s.children]=e,c.initData(y[s.children],y[H]),J(t,!0,!p&&n,i,l)},T=b.format;if("function"===layui.type(T))return T(y,o,D),h;var k=B.extend({},b.where||o.where),T=b.autoParam,T=(layui.each(T,function(e,t){t=t.split("=");k[t[0].trim()]=y[(t[1]||t[0]).trim()]}),b.contentType||o.contentType),_=(T&&0==T.indexOf("application/json")&&(k=JSON.stringify(k)),b.method||o.method),w=b.dataType||o.dataType,O=b.jsonpCallback||o.jsonpCallback,S=b.headers||o.headers,A=b.parseData||o.parseData,E=b.response||o.response;return B.ajax({type:_||"get",url:I,contentType:T,data:k,dataType:w||"json",jsonpCallback:O,headers:S||{},success:function(e){(e="function"==typeof A?A.call(o,e)||e:e)[E.statusName]!=E.statusCode?(y[V]="error",g.html('')):D(e[E.dataName])},error:function(e,t){y[V]="error","function"==typeof o.error&&o.error(e,t)}}),h}m=y[z]=!0,v.length&&(!o.initSort||o.url&&!o.autoSort||((b=o.initSort).type?layui.sort(v,b.field,"desc"===b.type,!0):layui.sort(v,j.config.indexName,null,!0)),c.initData(y[s.children],y[H]),_=j.getTrHtml(d,v,null,null,e),N={trs:B(_.trs.join("")),trs_fixed:B(_.trs_fixed.join("")),trs_fixed_r:B(_.trs_fixed_r.join(""))},C=(e.split("-").length-1||0)+1,layui.each(v,function(e,t){N.trs.eq(e).attr({"data-index":t[H],"lay-data-index":t[H],"data-level":C}),N.trs_fixed.eq(e).attr({"data-index":t[H],"lay-data-index":t[H],"data-level":C}),N.trs_fixed_r.eq(e).attr({"data-index":t[H],"lay-data-index":t[H],"data-level":C})}),r.find(L).find('tbody tr[lay-data-index="'+e+'"]').after(N.trs),r.find(R).find('tbody tr[lay-data-index="'+e+'"]').after(N.trs_fixed),r.find(Y).find('tbody tr[lay-data-index="'+e+'"]').after(N.trs_fixed_r),c.renderTreeTable(N.trs,C),n&&!p&&layui.each(v,function(e,t){J({dataIndex:t[H],trElem:r.find('tr[lay-data-index="'+t[H]+'"]').first(),tableViewElem:r,tableId:d,options:o},a,n,i,l)}))}else c.isExpandAll=!1,n&&!p?(layui.each(v,function(e,t){J({dataIndex:t[H],trElem:r.find('tr[lay-data-index="'+t[H]+'"]').first(),tableViewElem:r,tableId:d,options:o},a,n,i,l)}),r.find(v.map(function(e,t,a){return'tr[lay-data-index="'+e[H]+'"]'}).join(",")).addClass(q)):(I=c.treeToFlat(v,y[s.id],e),r.find(I.map(function(e,t,a){return'tr[lay-data-index="'+e[H]+'"]'}).join(",")).addClass(q));return U("resize-"+d,function(){P.resize(d)},0)(),l&&"loading"!==y[V]&&(T=u.callback.onExpand,"function"===layui.type(T)&&T(d,y,x)),h},g=(P.expandNode=function(e,t){var a,n,i,e=F(e);if(e)return a=(t=t||{}).index,n=t.expandFlag,i=t.inherit,t=t.callbackFlag,e=e.getOptions().elem.next(),J({trElem:e.find('tr[lay-data-index="'+a+'"]').first()},n,i,null,t)},P.expandAll=function(a,e){if("boolean"!==layui.type(e))return y.error("expandAll \u7684\u5c55\u5f00\u72b6\u6001\u53c2\u6570\u53ea\u63a5\u6536true/false");var t=F(a);if(t){t.isExpandAll=e;var n=t.getOptions(),i=n.tree,l=n.elem.next(),r=i.customName.isParent,d=i.customName.id,o=i.view.showFlexIconIfNotParent;if(e){e=P.getData(a,!0);if(i["async"].enable){var c=!0;if(layui.each(e,function(e,t){if(t[r]&&!t[V])return!(c=!1)}),!c)return void layui.each(P.getData(a),function(e,t){P.expandNode(a,{index:t[H],expandFlag:!0,inherit:!0})})}var u=!0;if(layui.each(e,function(e,t){if(t[r]&&!t[z])return!(u=!1)}),u)t.updateStatus(null,function(e){(e[r]||o)&&(e[X]=!0,e[d]!==undefined&&(t.status.expand[e[d]]=!0))}),l.find('tbody tr[data-level!="0"]').removeClass(q),l.find(".layui-table-tree-flexIcon").html(i.view.flexIconOpen),i.view.showIcon&&l.find(".layui-table-tree-nodeIcon:not(.layui-table-tree-iconCustom,.layui-table-tree-iconLeaf)").html(i.view.iconOpen);else{if(t.updateStatus(null,function(e){(e[r]||o)&&(e[X]=!0,e[z]=!0,e[d]!==undefined&&(t.status.expand[e[d]]=!0))}),n.initSort&&n.initSort.type&&(!n.url||n.autoSort))return P.sort(a);var s,n=j.getTrHtml(a,e),f={trs:B(n.trs.join("")),trs_fixed:B(n.trs_fixed.join("")),trs_fixed_r:B(n.trs_fixed_r.join(""))};layui.each(e,function(e,t){var a=t[H].split("-").length-1;s={"data-index":t[H],"lay-data-index":t[H],"data-level":a},f.trs.eq(e).attr(s),f.trs_fixed.eq(e).attr(s),f.trs_fixed_r.eq(e).attr(s)}),layui.each(["main","fixed-l","fixed-r"],function(e,t){l.find(".layui-table-"+t+" tbody").html(f[["trs","trs_fixed","trs_fixed_r"][e]])}),t.renderTreeTable(l,0,!1)}}else t.updateStatus(null,function(e){(e[r]||o)&&(e[X]=!1,e[d]!==undefined&&(t.status.expand[e[d]]=!1))}),l.find('.layui-table-box tbody tr[data-level!="0"]').addClass(q),l.find(".layui-table-tree-flexIcon").html(i.view.flexIconClose),i.view.showIcon&&l.find(".layui-table-tree-nodeIcon:not(.layui-table-tree-iconCustom,.layui-table-tree-iconLeaf)").html(i.view.iconClose);P.resize(a)}},t.prototype.renderTreeTable=function(e,t,a){var n=this,i=n.getOptions(),l=i.elem.next(),r=(l.hasClass(h)||l.addClass(h),i.id),d=i.tree||{},o=(d.data,d.view||{}),c=d.customName||{},u=c.isParent,s=(l.attr("lay-filter"),n),f=((t=t||0)||(l.find(".layui-table-body tr:not([data-level])").attr("data-level",t),layui.each(j.cache[r],function(e,t){l.find('.layui-table-main tbody tr[data-level="0"]:eq('+e+")").attr("lay-data-index",t[H]),l.find('.layui-table-fixed-l tbody tr[data-level="0"]:eq('+e+")").attr("lay-data-index",t[H]),l.find('.layui-table-fixed-r tbody tr[data-level="0"]:eq('+e+")").attr("lay-data-index",t[H])})),null),y=c.name,p=o.indent||14;if(layui.each(e.find('td[data-field="'+y+'"]'),function(e,t){var a,n,i=(t=B(t)).closest("tr"),t=t.children(".layui-table-cell");t.hasClass("layui-table-tree-item")||(n=i.attr("lay-data-index"))&&(i=l.find('tr[lay-data-index="'+n+'"]'),(a=s.getNodeDataByIndex(n))[X]&&a[u]&&((f=f||{})[n]=!0),a[b]&&i.find('input[type="checkbox"][name="layTableCheckbox"]').prop("indeterminate",!0),n=t.html(),(t=i.find('td[data-field="'+y+'"]>div.layui-table-cell')).addClass("layui-table-tree-item"),t.html(['
    ',a[X]?o.flexIconOpen:o.flexIconClose,"
    ",o.showIcon?'
    '+(a[c.icon]||o.icon||(a[u]?a[X]?o.iconOpen:o.iconClose:o.iconLeaf)||"")+"
    ":"",n].join("")).find(".layui-table-tree-flexIcon").on("click",function(e){layui.stope(e),J({trElem:i},null,null,null,!0)}))}),!t&&d.view.expandAllDefault&&n.isExpandAll===undefined)return P.expandAll(r,!0);!1!==a&&f?layui.each(f,function(e,t){e=l.find('tr[lay-data-index="'+e+'"]');e.find(".layui-table-tree-flexIcon").html(o.flexIconOpen),J({trElem:e.first()},!0)}):U("renderTreeTable-"+r,function(){i.hasNumberCol&&g(n),x.render(B('.layui-table-tree[lay-id="'+r+'"]'))},0)()},function(a){var e=a.getOptions(),t=e.elem.next(),n=0,i=t.find(".layui-table-main tbody tr"),l=t.find(".layui-table-fixed-l tbody tr"),r=t.find(".layui-table-fixed-r tbody tr");layui.each(a.treeToFlat(j.cache[e.id]),function(e,t){a.getNodeDataByIndex(t[H]).LAY_NUM=++n,i.eq(e).find(".laytable-cell-numbers").html(n),l.eq(e).find(".laytable-cell-numbers").html(n),r.eq(e).find(".laytable-cell-numbers").html(n)})}),f=(t.prototype.render=function(e){var t=this;t.tableIns=j["reloadData"===e?"reloadData":"reload"](t.tableIns.config.id,B.extend(!0,{},t.config)),t.config=t.tableIns.config},t.prototype.reload=function(e,t,a){var n=this;e=e||{},delete n.haveInit,layui.each(e,function(e,t){"array"===layui.type(t)&&delete n.config[e]}),r(n.getOptions().id,e,a||!0),n.config=B.extend(t,{},n.config,e),n.render(a)},P.reloadData=function(){var e=B.extend(!0,[],arguments);return e[3]="reloadData",P.reload.apply(null,e)},function(e,a,n,i){var l=[];return layui.each(e,function(e,t){"function"===layui.type(a)?a(t):B.extend(t,a),l.push(B.extend({},t)),i||(l=l.concat(f(t[n],a,n,i)))}),l}),d=(t.prototype.updateStatus=function(e,t,a){var n=this.getOptions(),i=n.tree;return e=e||j.cache[n.id],f(e,t,i.customName.children,a)},t.prototype.getTableData=function(){var e=this.getOptions();return e.url?j.cache[e.id]:e.data},P.updateStatus=function(e,t,a){var e=F(e),n=e.getOptions();return a=a||(n.url?j.cache[n.id]:n.data),e.updateStatus(a,t)},P.sort=function(e){var t,a=F(e);!a||(t=a.getOptions()).url&&!t.autoSort||(a.initData(),P.renderData(e))},function(n){var t=n.config.id,i=F(t),a=n.data=P.getNodeDataByIndex(t,n.index),l=a[H],r=(n.dataIndex=l,n.update);n.update=function(){var e=arguments,t=(B.extend(i.getNodeDataByIndex(l),e[0]),r.apply(this,e)),a=n.config.tree.customName.name;return a in e[0]&&n.tr.find('td[data-field="'+a+'"]').children("div.layui-table-cell").removeClass("layui-table-tree-item"),i.renderTreeTable(n.tr,n.tr.attr("data-level"),!1),t},n.del=function(){P.removeNode(t,a)},n.setRowChecked=function(e){P.setRowChecked(t,{index:a,checked:e})}}),o=(P.updateNode=function(e,a,t){var n,i,l,r,d,o=F(e);o&&((r=o.getOptions()).tree,r=(n=r.elem.next()).find('tr[lay-data-index="'+a+'"]'),i=r.attr("data-index"),l=r.attr("data-level"),t&&(r=o.getNodeDataByIndex(a,!1,t),d=j.getTrHtml(e,[r]),layui.each(["main","fixed-l","fixed-r"],function(e,t){n.find(".layui-table-"+t+' tbody tr[lay-data-index="'+a+'"]').replaceWith(B(d[["trs","trs_fixed","trs_fixed_r"][e]].join("")).attr({"data-index":i,"lay-data-index":a,"data-level":l}))}),o.renderTreeTable(n.find('tr[lay-data-index="'+a+'"]'),l)))},P.removeNode=function(e,t){var a,n,i,l,r,d=F(e);d&&(r=(a=d.getOptions()).tree,n=a.elem.next(),i=[],t=d.getNodeDataByIndex("string"===layui.type(t)?t:t[H],!1,"delete"),l=d.getNodeDataByIndex(t[s]),d.updateCheckStatus(l),l=d.treeToFlat([t],t[r.customName.pid],t[s]),layui.each(l,function(e,t){i.push('tr[lay-data-index="'+t[H]+'"]')}),n.find(i.join(",")).remove(),r=d.initData(),layui.each(d.treeToFlat(r),function(e,t){t[m]&&t[m]!==t[H]&&n.find('tr[lay-data-index="'+t[m]+'"]').attr({"data-index":t[H],"lay-data-index":t[H]})}),layui.each(j.cache[e],function(e,t){n.find('tr[data-level="0"][lay-data-index="'+t[H]+'"]').attr("data-index",e)}),a.hasNumberCol&&g(d))},P.addNodes=function(e,t){var a=F(e);if(a){var n=a.getOptions(),i=n.tree,l=n.elem.next(),r=(t=t||{}).parentIndex,d=t.index,o=t.data,t=t.focus,c=(r="number"===layui.type(r)?r.toString():r)?a.getNodeDataByIndex(r):null,d="number"===layui.type(d)?d:-1,o=B.extend(!0,[],layui.isArray(o)?o:[o]);a.getTableData();if(c){var u=i.customName.isParent,s=i.customName.children;c[u]=!0;var f=(f=c[s])?(y=f.splice(-1===d?f.length:d),c[s]=f.concat(o,y)):c[s]=o,s=(a.updateStatus(f,function(e){(e[u]||i.view.showFlexIconIfNotParent)&&(e[z]=!1)}),a.treeToFlat(f));l.find(s.map(function(e){return'tr[lay-data-index="'+e[H]+'"]'}).join(",")).remove(),a.initData(),c[z]=!1,c[V]="local",J({trElem:l.find('tr[lay-data-index="'+r+'"]')},!0)}else{var y=j.cache[e].splice(-1===d?j.cache[e].length:d);if(j.cache[e]=j.cache[e].concat(o,y),n.url||(n.page?(f=n.page,n.data.splice.apply(n.data,[f.limit*(f.curr-1),f.limit].concat(j.cache[e]))):n.data=j.cache[e]),a.initData(),l.find(".layui-none").length)return j.renderData(e),o;var p,s=j.getTrHtml(e,o),x={trs:B(s.trs.join("")),trs_fixed:B(s.trs_fixed.join("")),trs_fixed_r:B(s.trs_fixed_r.join(""))},r=(layui.each(o,function(e,t){p={"data-index":t[H],"lay-data-index":t[H],"data-level":"0"},x.trs.eq(e).attr(p),x.trs_fixed.eq(e).attr(p),x.trs_fixed_r.eq(e).attr(p)}),parseInt(o[0][H])-1),f=l.find(L),n=l.find(R),s=l.find(Y);-1==r?(f.find('tr[data-level="0"][data-index="0"]').before(x.trs),n.find('tr[data-level="0"][data-index="0"]').before(x.trs_fixed),s.find('tr[data-level="0"][data-index="0"]').before(x.trs_fixed_r)):-1===d?(f.find("tbody").append(x.trs),n.find("tbody").append(x.trs_fixed),s.find("tbody").append(x.trs_fixed_r)):(r=y[0][m],f.find('tr[data-level="0"][data-index="'+r+'"]').before(x.trs),n.find('tr[data-level="0"][data-index="'+r+'"]').before(x.trs_fixed),s.find('tr[data-level="0"][data-index="'+r+'"]').before(x.trs_fixed_r)),layui.each(j.cache[e],function(e,t){l.find('tr[data-level="0"][lay-data-index="'+t[H]+'"]').attr("data-index",e)}),a.renderTreeTable(l.find(o.map(function(e,t,a){return'tr[lay-data-index="'+e[H]+'"]'}).join(",")))}return a.updateCheckStatus(c),P.resize(e),t&&l.find(L).find('tr[lay-data-index="'+o[0][H]+'"]').get(0).scrollIntoViewIfNeeded(),o}},P.checkStatus=function(e,n){var i,t,a,l=F(e);if(l)return l=l.getOptions().tree,i=j.config.checkName,t=P.getData(e,!0).filter(function(e,t,a){return e[i]||n&&e[b]}),a=!0,layui.each("all"===l.data.cascade?j.cache[e]:P.getData(e,!0),function(e,t){if(!t[i])return!(a=!1)}),{data:t,isAll:a}},P.on("sort",function(e){var e=e.config,t=e.elem.next(),e=e.id;t.hasClass(h)&&P.sort(e)}),P.on("row",function(e){e.config.elem.next().hasClass(h)&&d(e)}),P.on("rowDouble",function(e){var t=e.config,a=t.elem.next();t.id;a.hasClass(h)&&(d(e),(t.tree||{}).view.dblClickExpand&&J({trElem:e.tr.first()},null,null,null,!0))}),P.on("rowContextmenu",function(e){var t=e.config,a=t.elem.next();t.id;a.hasClass(h)&&d(e)}),P.on("tool",function(e){var t=e.config,a=t.elem.next();t.id;a.hasClass(h)&&d(e)}),P.on("edit",function(e){var t=e.config,a=t.elem.next();t.id;a.hasClass(h)&&(d(e),e.field===t.tree.customName.name&&((a={})[e.field]=e.value,e.update(a)))}),P.on("radio",function(e){var t=e.config,a=t.elem.next(),t=t.id;a.hasClass(h)&&(a=F(t),d(e),o.call(a,e.tr,e.checked))}),t.prototype.setRowCheckedClass=function(e,t){var a=this.getOptions(),n=(e.data("index"),a.elem.next());e[t?"addClass":"removeClass"](l),e.each(function(){var e=B(this).data("index");n.find('.layui-table-fixed-r tbody tr[data-index="'+e+'"]')[t?"addClass":"removeClass"](l)})},t.prototype.updateCheckStatus=function(e,t){var i=this,a=i.getOptions(),n=a.tree,l=a.id,r=a.elem.next(),d=j.config.checkName,a=n.data.cascade,o=(("all"===a||"parent"===a)&&e&&(a=i.updateParentCheckStatus(e,"boolean"===layui.type(t)?t:null),layui.each(a,function(e,t){var a=r.find('tr[lay-data-index="'+t[H]+'"] input[name="layTableCheckbox"]:not(:disabled)'),n=t[d];i.setRowCheckedClass(a.closest("tr"),n),x.render(a.prop({checked:n,indeterminate:t[b]}))})),!0),c=!1;return layui.each("all"===n.data.cascade?j.cache[l]:P.getData(l,!0),function(e,t){if((t[d]||t[b])&&(c=!0),t[d]||(o=!1),c&&!o)return!0}),c=c&&!o,x.render(r.find('input[name="layTableCheckbox"][lay-filter="layTableAllChoose"]').prop({checked:o,indeterminate:c})),o},t.prototype.updateParentCheckStatus=function(a,n){var i,e=this.getOptions(),t=e.tree,e=e.id,l=j.config.checkName,t=t.customName.children,r=[];return!(a[b]=!1)===n?a[t].length?layui.each(a[t],function(e,t){if(!t[l])return n=!1,a[b]=!0}):n=!1:!1===n?layui.each(a[t],function(e,t){if(t[l]||t[b])return a[b]=!0}):(n=!1,i=0,layui.each(a[t],function(e,t){t[l]&&i++}),n=a[t].length?a[t].length===i:a[l],a[b]=!n&&0')),n=(e.tree(a),i.elem=h(i.elem));if(n[0]){if(e.key=i.id||e.index,e.elem=a,e.elemNone=h('
    '+i.text.none+"
    "),n.html(e.elem),0==e.elem.find(".layui-tree-set").length)return e.elem.append(e.elemNone);i.showCheckbox&&e.renderForm("checkbox"),e.elem.find(".layui-tree-set").each(function(){var e=h(this);e.parent(".layui-tree-pack")[0]||e.addClass("layui-tree-setHide"),!e.next()[0]&&e.parents(".layui-tree-pack").eq(1).hasClass("layui-tree-lineExtend")&&e.addClass(F),e.next()[0]||e.parents(".layui-tree-set").eq(0).next()[0]||e.addClass(F)}),e.events()}},l.prototype.renderForm=function(e){i.render(e,"LAY-tree-"+this.index)},l.prototype.tree=function(l,e){var r=this,c=r.config,e=e||c.data;layui.each(e,function(e,i){var a=i.children&&0"),t=h(['
    ','
    ','
    ',c.showLine?a?'':'':'',c.showCheckbox?'':"",c.isJump&&i.href?''+(i.title||i.label||c.text.defaultNodeName)+"":''+(i.title||i.label||c.text.defaultNodeName)+"","
    ",function(){if(!c.edit)return"";var a={add:'',update:'',del:''},n=['
    '];return!0===c.edit&&(c.edit=["update","del"]),"object"==typeof c.edit?(layui.each(c.edit,function(e,i){n.push(a[i]||"")}),n.join("")+"
    "):void 0}(),"
    "].join(""));a&&(t.append(n),r.tree(n,i.children)),l.append(t),t.prev("."+f)[0]&&t.prev().children(".layui-tree-pack").addClass("layui-tree-showLine"),a||t.parent(".layui-tree-pack").addClass("layui-tree-lineExtend"),r.spread(t,i),c.showCheckbox&&(i.checked&&r.checkids.push(i.id),r.checkClick(t,i)),c.edit&&r.operate(t,i)})},l.prototype.spread=function(n,t){var l=this,r=l.config,e=n.children("."+m),i=e.children("."+x),a=i.find('input[same="layuiTreeCheck"]'),c=e.find("."+k),e=e.find("."+b),d=r.onlyIconControl?c:i,s="";d.on("click",function(e){var i=n.children("."+g),a=(d.children(".layui-icon")[0]?d:d.find(".layui-tree-icon")).children(".layui-icon");i[0]?n.hasClass(w)?(n.removeClass(w),i.slideUp(200),a.removeClass(v).addClass(C),l.updateFieldValue(t,"spread",!1)):(n.addClass(w),i.slideDown(200),a.addClass(v).removeClass(C),l.updateFieldValue(t,"spread",!0),r.accordion&&((i=n.siblings("."+f)).removeClass(w),i.children("."+g).slideUp(200),i.find(".layui-tree-icon").children(".layui-icon").removeClass(v).addClass(C))):s="normal"}),e.on("click",function(){h(this).hasClass(o)||(s=n.hasClass(w)?r.onlyIconControl?"open":"close":r.onlyIconControl?"close":"open",a[0]&&l.updateFieldValue(t,"checked",a.prop("checked")),r.click&&r.click({elem:n,state:s,data:t}))})},l.prototype.updateFieldValue=function(e,i,a){i in e&&(e[i]=a)},l.prototype.setCheckbox=function(e,i,a){var t,n=this,l=(n.config,a.prop("checked"));a.prop("disabled")||("object"!=typeof i.children&&!e.find("."+g)[0]||e.find("."+g).find('input[same="layuiTreeCheck"]').each(function(e){this.disabled||((e=i.children[e])&&n.updateFieldValue(e,"checked",l),n.updateFieldValue(this,"checked",l))}),(t=function(e){var i,a,n;e.parents("."+f)[0]&&(a=(e=e.parent("."+g)).parent(),n=e.prev().find('input[same="layuiTreeCheck"]'),l?n.prop("checked",l):(e.find('input[same="layuiTreeCheck"]').each(function(){this.checked&&(i=!0)}),i||n.prop("checked",!1)),t(a))})(e),n.renderForm("checkbox"))},l.prototype.checkClick=function(a,n){var t=this,l=t.config;a.children("."+m).children("."+x).on("click",'input[same="layuiTreeCheck"]+',function(e){layui.stope(e);var e=h(this).prev(),i=e.prop("checked");e.prop("disabled")||(t.setCheckbox(a,n,e),t.updateFieldValue(n,"checked",i),l.oncheck&&l.oncheck({elem:a,checked:i,data:n}))})},l.prototype.operate=function(c,d){var s=this,o=s.config,e=c.children("."+m),u=e.children("."+x);e.children(".layui-tree-btnGroup").on("click",".layui-icon",function(e){layui.stope(e);var i,e=h(this).data("type"),n=c.children("."+g),t={data:d,type:e,elem:c};if("add"==e){n[0]||(o.showLine?(u.find("."+k).addClass("layui-tree-icon"),u.find("."+k).children(".layui-icon").addClass(C).removeClass("layui-icon-file")):u.find(".layui-tree-iconArrow").removeClass(y),c.append('
    '));var a,l=o.operate&&o.operate(t),r={};if(r.title=o.text.defaultNodeName,r.id=l,s.tree(c.children("."+g),[r]),o.showLine&&(n[0]?(n.hasClass(N)||n.addClass(N),c.find("."+g).each(function(){h(this).children("."+f).last().addClass(F)}),(n.children("."+f).last().prev().hasClass(F)?n.children("."+f).last().prev():n.children("."+f).last()).removeClass(F),!c.parent("."+g)[0]&&c.next()[0]&&n.children("."+f).last().removeClass(F)):(l=c.siblings("."+f),a=1,r=c.parent("."+g),layui.each(l,function(e,i){h(i).children("."+g)[0]||(a=0)}),1==a?(l.children("."+g).addClass(T),l.children("."+g).children("."+f).removeClass(F),c.children("."+g).addClass(T),r.removeClass(N),r.children("."+f).last().children("."+g).children("."+f).last().addClass(F)):c.children("."+g).children("."+f).addClass(F))),!o.showCheckbox)return;u.find('input[same="layuiTreeCheck"]')[0].checked&&(c.children("."+g).children("."+f).last().find('input[same="layuiTreeCheck"]')[0].checked=!0),s.renderForm("checkbox")}else"update"==e?(l=u.children("."+b).html(),u.children("."+b).html(""),u.append(''),u.children(".layui-tree-editInput").val(l).focus(),i=function(e){var i=(i=e.val().trim())||o.text.defaultNodeName;e.remove(),u.children("."+b).html(i),t.data.title=i,o.operate&&o.operate(t)},u.children(".layui-tree-editInput").blur(function(){i(h(this))}),u.children(".layui-tree-editInput").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),i(h(this)))})):p.confirm('\u786e\u8ba4\u5220\u9664\u8be5\u8282\u70b9 "'+(d.title||"")+'" \u5417\uff1f',function(e){if(o.operate&&o.operate(t),t.status="remove",p.close(e),!c.prev("."+f)[0]&&!c.next("."+f)[0]&&!c.parent("."+g)[0])return c.remove(),void s.elem.append(s.elemNone);var l,a,i;c.siblings("."+f).children("."+m)[0]?(o.showCheckbox&&(l=function(e){var i,a,n,t;e.parents("."+f)[0]&&(i=e.siblings("."+f).children("."+m),a=(e=e.parent("."+g).prev()).find('input[same="layuiTreeCheck"]')[0],n=1,(t=0)==a.checked&&(i.each(function(e,i){i=h(i).find('input[same="layuiTreeCheck"]')[0];0!=i.checked||i.disabled||(n=0),i.disabled||(t=1)}),1==n&&1==t&&(a.checked=!0,s.renderForm("checkbox"),l(e.parent("."+f)))))})(c),o.showLine&&(e=c.siblings("."+f),a=1,i=c.parent("."+g),layui.each(e,function(e,i){h(i).children("."+g)[0]||(a=0)}),1==a?(n[0]||(i.removeClass(N),e.children("."+g).addClass(T),e.children("."+g).children("."+f).removeClass(F)),(c.next()[0]?i.children("."+f).last():c.prev()).children("."+g).children("."+f).last().addClass(F),c.next()[0]||c.parents("."+f)[1]||c.parents("."+f).eq(0).next()[0]||c.prev("."+f).addClass(F)):!c.next()[0]&&c.hasClass(F)&&c.prev().addClass(F))):(e=c.parent("."+g).prev(),o.showLine?(e.find("."+k).removeClass("layui-tree-icon"),e.find("."+k).children(".layui-icon").removeClass(v).addClass("layui-icon-file"),(i=e.parents("."+g).eq(0)).addClass(N),i.children("."+f).each(function(){h(this).children("."+g).children("."+f).last().addClass(F)})):e.find(".layui-tree-iconArrow").addClass(y),c.parents("."+f).eq(0).removeClass(w),c.parent("."+g).remove()),c.remove()})})},l.prototype.events=function(){var i=this,t=i.config;i.elem.find(".layui-tree-checkedFirst");i.setChecked(i.checkids),i.elem.find(".layui-tree-search").on("keyup",function(){var e=h(this),a=e.val(),e=e.nextAll(),n=[];e.find("."+b).each(function(){var i,e=h(this).parents("."+m);-1!=h(this).html().indexOf(a)&&(n.push(h(this).parent()),(i=function(e){e.addClass("layui-tree-searchShow"),e.parent("."+g)[0]&&i(e.parent("."+g).parent("."+f))})(e.parent("."+f)))}),e.find("."+m).each(function(){var e=h(this).parent("."+f);e.hasClass("layui-tree-searchShow")||e.addClass(y)}),0==e.find(".layui-tree-searchShow").length&&i.elem.append(i.elemNone),t.onsearch&&t.onsearch({elem:n})}),i.elem.find(".layui-tree-search").on("keydown",function(){h(this).nextAll().find("."+m).each(function(){h(this).parent("."+f).removeClass("layui-tree-searchShow "+y)}),h(".layui-tree-emptyText")[0]&&h(".layui-tree-emptyText").remove()})},l.prototype.getChecked=function(){var t=this,e=t.config,i=[],a=[],l=(t.elem.find(".layui-form-checked").each(function(){i.push(h(this).prev()[0].value)}),function(e,n){layui.each(e,function(e,a){layui.each(i,function(e,i){if(a.id==i)return t.updateFieldValue(a,"checked",!0),delete(i=h.extend({},a)).children,n.push(i),a.children&&(i.children=[],l(a.children,i.children)),!0})})});return l(h.extend({},e.data),a),a},l.prototype.setChecked=function(l){this.config;this.elem.find("."+f).each(function(e,i){var a=h(this).data("id"),n=h(i).children("."+m).find('input[same="layuiTreeCheck"]'),t=n.next();if("number"==typeof l){if(a.toString()==l.toString())return n[0].checked||t.click(),!1}else"object"==typeof l&&layui.each(l,function(e,i){if(i.toString()==a.toString()&&!n[0].checked)return t.click(),!0})})},t.that={},t.config={},n.reload=function(e,i){e=t.that[e];return e.reload(i),t.call(e)},n.getChecked=function(e){return t.that[e].getChecked()},n.setChecked=function(e,i){return t.that[e].setChecked(i)},n.render=function(e){e=new l(e);return t.call(e)},e(a,n)});layui.define(["laytpl","form"],function(e){"use strict";var s=layui.$,n=layui.laytpl,t=layui.form,a="transfer",i={config:{},index:layui[a]?layui[a].index+1e4:0,set:function(e){var t=this;return t.config=s.extend({},t.config,e),t},on:function(e,t){return layui.onevent.call(this,a,e,t)}},l=function(){var t=this,e=t.config,a=e.id||t.index;return l.that[a]=t,{config:l.config[a]=e,reload:function(e){t.reload.call(t,e)},getData:function(){return t.getData.call(t)}}},d="layui-hide",h="layui-btn-disabled",r="layui-none",c="layui-transfer-box",u="layui-transfer-header",o="layui-transfer-search",f="layui-transfer-data",y=function(e){return['
    ','
    ','","
    ","{{# if(d.data.showSearch){ }}",'","{{# } }}",'
      ',"
      "].join("")},p=['
      ',y({index:0,checkAllName:"layTransferLeftCheckAll"}),'
      ','",'","
      ",y({index:1,checkAllName:"layTransferRightCheckAll"}),"
      "].join(""),v=function(e){var t=this;t.index=++i.index,t.config=s.extend({},t.config,i.config,e),t.render()};v.prototype.config={title:["\u5217\u8868\u4e00","\u5217\u8868\u4e8c"],width:200,height:360,data:[],value:[],showSearch:!1,id:"",text:{none:"\u65e0\u6570\u636e",searchNone:"\u65e0\u5339\u914d\u6570\u636e"}},v.prototype.reload=function(e){var t=this;t.config=s.extend({},t.config,e),t.render()},v.prototype.render=function(){var e=this,t=e.config,a=e.elem=s(n(p,{open:"{{",close:"}}"}).render({data:t,index:e.index})),i=t.elem=s(t.elem);i[0]&&(t.data=t.data||[],t.value=t.value||[],t.id="id"in t?t.id:elem.attr("id")||e.index,e.key=t.id,i.html(e.elem),e.layBox=e.elem.find("."+c),e.layHeader=e.elem.find("."+u),e.laySearch=e.elem.find("."+o),e.layData=a.find("."+f),e.layBtn=a.find(".layui-transfer-active .layui-btn"),e.layBox.css({width:t.width,height:t.height}),e.layData.css({height:(i=t.height-e.layHeader.outerHeight(),t.showSearch&&(i-=e.laySearch.outerHeight()),i-2)}),e.renderData(),e.events())},v.prototype.renderData=function(){var e=this,t=e.config,l=[{checkName:"layTransferLeftCheck",views:[]},{checkName:"layTransferRightCheck",views:[]}];e.parseData(function(a){var i=a.selected?1:0,n=["
    • ",'',"
    • "].join("");i?layui.each(t.value,function(e,t){t==a.value&&a.selected&&(l[i].views[e]=n)}):l[i].views.push(n),delete a.selected}),e.layData.eq(0).html(l[0].views.join("")),e.layData.eq(1).html(l[1].views.join("")),e.renderCheckBtn()},v.prototype.renderForm=function(e){t.render(e,"LAY-transfer-"+this.index)},v.prototype.renderCheckBtn=function(r){var c=this,o=c.config;r=r||{},c.layBox.each(function(e){var t=s(this),a=t.find("."+f),t=t.find("."+u).find('input[type="checkbox"]'),i=a.find('input[type="checkbox"]'),n=0,l=!1;i.each(function(){var e=s(this).data("hide");(this.checked||this.disabled||e)&&n++,this.checked&&!e&&(l=!0)}),t.prop("checked",l&&n===i.length),c.layBtn.eq(e)[l?"removeClass":"addClass"](h),r.stopNone||(i=a.children("li:not(."+d+")").length,c.noneView(a,i?"":o.text.none))}),c.renderForm("checkbox")},v.prototype.noneView=function(e,t){var a=s('

      '+(t||"")+"

      ");e.find("."+r)[0]&&e.find("."+r).remove(),t.replace(/\s/g,"")&&e.append(a)},v.prototype.setValue=function(){var e=this.config,t=[];return this.layBox.eq(1).find("."+f+' input[type="checkbox"]').each(function(){s(this).data("hide")||t.push(this.value)}),e.value=t,this},v.prototype.parseData=function(t){var i=this.config,n=[];return layui.each(i.data,function(e,a){a=("function"==typeof i.parseData?i.parseData(a):a)||a,n.push(a=s.extend({},a)),layui.each(i.value,function(e,t){t==a.value&&(a.selected=!0)}),t&&t(a)}),i.data=n,this},v.prototype.getData=function(e){var t=this.config,i=[];return this.setValue(),layui.each(e||t.value,function(e,a){layui.each(t.data,function(e,t){delete t.selected,a==t.value&&i.push(t)})}),i},v.prototype.transfer=function(e,t){var a,i=this,n=i.config,l=i.layBox.eq(e),r=[],t=(t?((a=(t=t).find('input[type="checkbox"]'))[0].checked=!1,l.siblings("."+c).find("."+f).append(t.clone()),t.remove(),r.push(a[0].value),i.setValue()):l.each(function(e){s(this).find("."+f).children("li").each(function(){var e=s(this),t=e.find('input[type="checkbox"]'),a=t.data("hide");t[0].checked&&!a&&(t[0].checked=!1,l.siblings("."+c).find("."+f).append(e.clone()),e.remove(),r.push(t[0].value)),i.setValue()})}),i.renderCheckBtn(),l.siblings("."+c).find("."+o+" input"));""!==t.val()&&t.trigger("keyup"),n.onchange&&n.onchange(i.getData(r),e)},v.prototype.events=function(){var n=this,l=n.config;n.elem.on("click",'input[lay-filter="layTransferCheckbox"]+',function(){var e=s(this).prev(),t=e[0].checked,a=e.parents("."+c).eq(0).find("."+f);e[0].disabled||("all"===e.attr("lay-type")&&a.find('input[type="checkbox"]').each(function(){this.disabled||(this.checked=t)}),setTimeout(function(){n.renderCheckBtn({stopNone:!0})},0))}),n.elem.on("dblclick","."+f+">li",function(e){var t=s(this),a=t.children('input[type="checkbox"]'),i=t.parent().parent();a[0].disabled||n.transfer(i.data("index"),t)}),n.layBtn.on("click",function(){var e=s(this),t=e.data("index");e.hasClass(h)||n.transfer(t)}),n.laySearch.find("input").on("keyup",function(){var i=this.value,e=s(this).parents("."+o).eq(0).siblings("."+f),t=e.children("li"),t=(t.each(function(){var e=s(this),t=e.find('input[type="checkbox"]'),a=t[0].title,a=("cs"!==l.showSearch&&(a=a.toLowerCase(),i=i.toLowerCase()),-1!==a.indexOf(i));e[a?"removeClass":"addClass"](d),t.data("hide",!a)}),n.renderCheckBtn(),t.length===e.children("li."+d).length);n.noneView(e,t?l.text.searchNone:"")})},l.that={},l.config={},i.reload=function(e,t){e=l.that[e];return e.reload(t),l.call(e)},i.getData=function(e){return l.that[e].getData()},i.render=function(e){e=new v(e);return l.call(e)},e(a,i)});layui.define(["jquery","lay"],function(e){"use strict";var a=layui.$,t=layui.lay,o=(layui.hint(),layui.device(),{config:{},set:function(e){var i=this;return i.config=a.extend({},i.config,e),i},on:function(e,i){return layui.onevent.call(this,r,e,i)}}),r="carousel",d="layui-this",s="layui-carousel-left",u="layui-carousel-right",c="layui-carousel-prev",m="layui-carousel-next",l="layui-carousel-arrow",f="layui-carousel-ind",i=function(e){var i=this;i.config=a.extend({},i.config,o.config,e),i.render()};i.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},i.prototype.render=function(){var e=this,i=e.config,n=a(i.elem);if(1*[carousel-item]>*"),i.index<0&&(i.index=0),i.index>=e.elemItem.length&&(i.index=e.elemItem.length-1),i.interval<800&&(i.interval=800),i.full?i.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):i.elem.css({width:i.width,height:i.height}),i.elem.attr("lay-anim",i.anim),e.elemItem.eq(i.index).addClass(d),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},i.prototype.reload=function(e){var i=this;clearInterval(i.timer),i.config=a.extend({},i.config,e),i.render()},i.prototype.prevIndex=function(){var e=this.config.index-1;return e=e<0?this.elemItem.length-1:e},i.prototype.nextIndex=function(){var e=this.config.index+1;return e=e>=this.elemItem.length?0:e},i.prototype.addIndex=function(e){var i=this.config;i.index=i.index+(e=e||1),i.index>=this.elemItem.length&&(i.index=0)},i.prototype.subIndex=function(e){var i=this.config;i.index=i.index-(e=e||1),i.index<0&&(i.index=this.elemItem.length-1)},i.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(clearInterval(e.timer),e.timer=setInterval(function(){e.slide()},i.interval))},i.prototype.arrow=function(){var i=this,e=i.config,n=a(['",'"].join(""));e.elem.attr("lay-arrow",e.arrow),e.elem.find("."+l)[0]&&e.elem.find("."+l).remove(),e.elem.append(n),n.on("click",function(){var e=a(this).attr("lay-type");i.slide(e)})},i.prototype["goto"]=function(e){var i=this,n=i.config;e>n.index?i.slide("add",e-n.index):e
        ',(i=[],layui.each(e.elemItem,function(e){i.push("")}),i.join("")),"
      "].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+f)[0]&&n.elem.find("."+f).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-t.height()/2),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){e["goto"](a(this).index())})},i.prototype.slide=function(e,i){var n=this,t=n.elemItem,a=n.config,o=a.index,l=a.elem.attr("lay-filter");n.haveSlide||("sub"===e?(n.subIndex(i),t.eq(a.index).addClass(c),setTimeout(function(){t.eq(o).addClass(u),t.eq(a.index).addClass(u)},50)):(n.addIndex(i),t.eq(a.index).addClass(m),setTimeout(function(){t.eq(o).addClass(s),t.eq(a.index).addClass(s)},50)),setTimeout(function(){t.removeClass(d+" "+c+" "+m+" "+s+" "+u),t.eq(a.index).addClass(d),n.haveSlide=!1},300),n.elemInd.find("li").eq(a.index).addClass(d).siblings().removeClass(d),n.haveSlide=!0,e={index:a.index,prevIndex:o,item:t.eq(a.index)},"function"==typeof a.change&&a.change(e),layui.event.call(this,r,"change("+l+")",e))},i.prototype.events=function(){var e=this,i=e.config;i.elem.data("haveEvents")||(i.elem.on("mouseenter",function(){"always"!==e.config.autoplay&&clearInterval(e.timer)}).on("mouseleave",function(){"always"!==e.config.autoplay&&e.autoplay()}),i.elem.data("haveEvents",!0))},o.render=function(e){return new i(e)},e(r,o)});layui.define(["jquery","lay"],function(e){"use strict";var s=layui.jquery,r=layui.lay,c={config:{},index:layui.rate?layui.rate.index+1e4:0,set:function(e){var a=this;return a.config=s.extend({},a.config,e),a},on:function(e,a){return layui.onevent.call(this,l,e,a)}},l="rate",f="layui-icon-rate",h="layui-icon-rate-solid",o="layui-icon-rate-half",u="layui-icon-rate-solid layui-icon-rate-half",v="layui-icon-rate layui-icon-rate-half",a=function(e){var a=this;a.index=++c.index,a.config=s.extend({},a.config,c.config,e),a.render()};a.prototype.config={length:5,text:!1,readonly:!1,half:!1,value:0,theme:""},a.prototype.render=function(){var e=this,a=e.config,l=s(a.elem);if(1a.length&&(a.value=a.length),parseInt(a.value)===a.value||a.half||(a.value=Math.ceil(a.value)-a.value<.5?Math.ceil(a.value):Math.floor(a.value)),'
        "),t=1;t<=a.length;t++){var o='
      • ";a.half&&parseInt(a.value)!==a.value&&t==Math.ceil(a.value)?n=n+'
      • ":n+=o}n+="
      "+(a.text?''+a.value+"\u661f":"")+"";var l=a.elem,u=l.next(".layui-rate");u[0]&&u.remove(),e.elemTemp=s(n),a.span=e.elemTemp.next("span"),a.setText&&a.setText(a.value),l.html(e.elemTemp),l.addClass("layui-inline"),a.readonly||e.action()},a.prototype.setvalue=function(e){this.config.value=e,this.render()},a.prototype.action=function(){var i=this.config,n=this.elemTemp,t=n.find("i").width();n.children("li").each(function(e){var a=e+1,l=s(this);l.on("click",function(e){i.value=a,i.half&&e.pageX-s(this).offset().left<=t/2&&(i.value=i.value-.5),i.text&&n.next("span").text(i.value+"\u661f"),i.choose&&i.choose(i.value),i.setText&&i.setText(i.value)}),l.on("mousemove",function(e){n.find("i").each(function(){s(this).addClass(f).removeClass(u)}),n.find("i:lt("+a+")").each(function(){s(this).addClass(h).removeClass(v)}),i.half&&e.pageX-s(this).offset().left<=t/2&&l.children("i").addClass(o).removeClass(h)}),l.on("mouseleave",function(){n.find("i").each(function(){s(this).addClass(f).removeClass(u)}),n.find("i:lt("+Math.floor(i.value)+")").each(function(){s(this).addClass(h).removeClass(v)}),i.half&&parseInt(i.value)!==i.value&&n.children("li:eq("+Math.floor(i.value)+")").children("i").addClass(o).removeClass("layui-icon-rate-solid layui-icon-rate")})})},a.prototype.events=function(){this.config},c.render=function(e){e=new a(e);return function(){var a=this;return{setvalue:function(e){a.setvalue.call(a,e)},config:a.config}}.call(e)},e(l,c)});layui.define("jquery",function(l){"use strict";var g=layui.$,e=function(l){};e.prototype.load=function(l){var t,i,n,e,r,o,a,c,m,s,u,f,y,d=this,p=0,h=g((l=l||{}).elem);if(h[0])return e=g(l.scrollElem||document),r=l.mb||50,o=!("isAuto"in l)||l.isAuto,a=l.end||"\u6ca1\u6709\u66f4\u591a\u4e86",c=l.scrollElem&&l.scrollElem!==document,m="\u52a0\u8f7d\u66f4\u591a",s=g('"),h.find(".layui-flow-more")[0]||h.append(s),u=function(l,e){l=g(l),s.before(l),(e=0==e||null)?s.html(a):s.find("a").html(m),i=e,t=null,y&&y()},f=function(){t=!0,s.find("a").html(''),"function"==typeof l.done&&l.done(++p,u)},f(),s.find("a").on("click",function(){g(this);i||t||f()}),l.isLazyimg&&(y=d.lazyimg({elem:l.elem+" img",scrollElem:l.scrollElem})),o&&e.on("scroll",function(){var e=g(this),o=e.scrollTop();n&&clearTimeout(n),!i&&h.width()&&(n=setTimeout(function(){var l=(c?e:g(window)).height();(c?e.prop("scrollHeight"):document.documentElement.scrollHeight)-o-l<=r&&(t||f())},100))}),d},e.prototype.lazyimg=function(l){var e,c=this,m=0,s=g((l=l||{}).scrollElem||document),u=l.elem||"img",f=l.scrollElem&&l.scrollElem!==document,y=function(e,l){var o,t=s.scrollTop(),l=t+l,i=f?e.offset().top-s.offset().top+t:e.offset().top;t<=i&&i<=l&&e.attr("lay-src")&&(o=e.attr("lay-src"),layui.img(o,function(){var l=c.lazyimg.elem.eq(m);e.attr("src",o).removeAttr("lay-src"),l[0]&&n(l),m++},function(){c.lazyimg.elem.eq(m);e.removeAttr("lay-src")}))},n=function(l,e){var o=(f?e||s:g(window)).height(),t=s.scrollTop(),i=t+o;if(c.lazyimg.elem=g(u),l)y(l,o);else for(var n=0;n"),preview:"Preview"}},I=function(e){return C.trim(e).replace(/^\n|\n$/,"")};e("code",function(e){var _=e=C.extend(!0,{},a,e);e.elem=C(e.elem),e.elem[0]&&layui.each(e.elem.get().reverse(),function(e,a){var t,l,i,o,n,s,c,d,r,u,y,E,p=C(a),f=C.extend(!0,{},_,lay.options(a),(t={},layui.each(["title","height","encode","skin","about"],function(e,a){var i=p.attr("lay-"+a);"string"==typeof i&&(t[a]=i)}),t)),v=p.data("code")||(i=[],p.children("textarea").each(function(){i.push(I(this.value))}),0===i.length&&i.push(I(p.html())),i),a=(p.data("code",v),l=v.join("")),h=("function"==typeof f.codeParse&&(a=l=f.codeParse(a)),{copy:{className:"file-b",title:["\u590d\u5236\u4ee3\u7801"],event:function(e,a){if("function"==typeof f.onCopy)f.onCopy(l);else try{navigator.clipboard.writeText(w.unescape(l)).then(function(){T.msg("\u5df2\u590d\u5236",{icon:1})})}catch(i){T.msg("\u590d\u5236\u5931\u8d25",{icon:2})}}}}),m=(f.preview&&(o="LAY-CODE-DF-"+e,E=f.layout||["code","preview"],n="iframe"===f.preview,u=C('
      '),y=C('
      '),s=C('
      '),c=C('
      '),d=C('
      '),M=p.parent("."+x.ELEM_PREVIEW),m=p.prev("."+x.ELEM_TAB),L=p.next("."+x.ELEM_ITEM+"-preview"),f.id&&u.attr("id",f.id),u.addClass(f.className),y.attr("lay-filter",o),f.encode=!0,layui.each(E,function(e,a){var i=C('
    • ');0===e&&i.addClass("layui-this"),i.html(f.text[a]),s.append(i)}),C.extend(h,{full:{className:"screen-full",title:["\u6700\u5927\u5316\u663e\u793a","\u8fd8\u539f\u663e\u793a"],event:function(e,a){var i=e.closest("."+x.ELEM_PREVIEW),t="layui-icon-"+this.className,l="layui-icon-screen-restore",o=this.title,n=C("html,body"),s="layui-scrollbar-hide";e.hasClass(t)?(i.addClass(x.ELEM_FULL),e.removeClass(t).addClass(l),e.attr("title",o[1]),n.addClass(s)):(i.removeClass(x.ELEM_FULL),e.removeClass(l).addClass(t),e.attr("title",o[0]),n.removeClass(s))}},window:{className:"release",title:["\u5728\u65b0\u7a97\u53e3\u9884\u89c8"],event:function(e,a){w.openWin({content:l})}}}),f.copy&&("array"===layui.type(f.tools)?-1===f.tools.indexOf("copy")&&f.tools.unshift("copy"):f.tools=["copy"]),d.on("click",">i",function(){var e=C(this),a=e.data("type");"function"==typeof h[a].event&&h[a].event(e,a),"function"==typeof f.toolsEvent&&f.toolsEvent(e,a)}),layui.each(f.tools,function(e,a){var i=h[a]&&h[a].className||a,t=h[a].title||[""];d.append('')}),m[0]&&m.remove(),L[0]&&L.remove(),M[0]&&p.unwrap(),y.append(s),f.tools&&y.append(d),p.wrap(u).addClass(x.ELEM_ITEM).before(y),n&&c.html(''),r=function(e){var a=e.children("iframe")[0],i=(n&&a?a.srcdoc=l:e.html(v.join("")),{container:e,render:function(){g.render(e.find(".layui-form")),b.render()}});setTimeout(function(){"function"==typeof f.done&&f.done(i)},3)},"preview"===E[0]?(c.addClass(x.ELEM_SHOW),p.before(c),r(c)):p.addClass(x.ELEM_SHOW).after(c),f.codeStyle=[f.style,f.codeStyle].join(""),f.previewStyle=[f.style,f.previewStyle].join(""),c.attr("style",f.previewStyle),b.on("tab("+o+")",function(e){var a=C(this),i=C(e.elem).closest("."+x.ELEM_PREVIEW).find("."+x.ELEM_ITEM),e=i.eq(e.index);i.removeClass(x.ELEM_SHOW),e.addClass(x.ELEM_SHOW),"preview"===a.attr("lay-id")&&r(e)})),f.ln?"ol":"ul"),L=C("<"+m+' class="layui-code-'+m+'">'),M=C('
      ');p.addClass("layui-code-view layui-box"),f.skin&&("notepad"===f.skin&&(f.skin="dark"),p.removeClass("layui-code-dark layui-code-light"),p.addClass("layui-code-"+f.skin)),a=(a=f.encode?w.escape(a):a).replace(/[\r\t\n]+/g,"
    • "),p.html(L.html("
    • "+a+"
    • ")),f.header&&!p.children("."+x.ELEM_TITLE)[0]&&(M.html((f.title||f.text.code)+(f.about?'
      '+f.about+"
      ":"")),p.prepend(M)),f.elem.length===e+1&&"function"==typeof f.allDone&&f.allDone(),0<(u=Math.floor(L.find("li").length/100))&&L.css("margin-left",u+"px"),f.height&&L.css("max-height",f.height),L.attr("style",f.codeStyle),f.copy&&!f.preview&&(y=C(['','',""].join("")),E=p.children("."+x.ELEM_COPY),(L[0].style.height||L[0].style.maxHeight)&&y.addClass(x.ELEM_COPY+"-offset"),E[0]&&E.remove(),p.append(y),y.on("click",function(){h.copy.event()}))})})}),layui["layui.all"]||layui.addcss("modules/code.css?v=3","skincodecss"); \ No newline at end of file +/** v2.11.2 | MIT Licensed */;!function(h){"use strict";var e,d=h.document,v=h.location,m={timeout:10,debug:!1,version:!1},g={modules:{},status:{},event:{},callback:{}},r=function(){this.v="2.11.2"},t=h.LAYUI_GLOBAL||{},b=(e=d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()?d.currentScript.src:function(){for(var e,t=d.getElementsByTagName("script"),n=t.length-1,r=n;01e3*m.timeout/5?j(o+" is not a valid module","error"):void((i?layui[o]=h[a.api]:g.status[o])?u():setTimeout(t,5))}()},0===n.length||layui["layui.all"]&&E[o]?u():(p=i?a.src:a,y=(E[o]?y+"modules/":p?"":m.base)+(p=(p=p||o).replace(/\s/g,"").replace(/\.js[^\/\.]*$/,""))+".js",!g.modules[o]&&layui[o]&&(g.modules[o]=y),g.modules[o]?c():(l=d.getElementsByTagName("head")[0],(s=d.createElement("script"))["async"]=!0,s.charset="utf-8",s.src=y+((p=!0===m.version?m.v||(new Date).getTime():m.version||"")?"?v="+p:""),l.appendChild(s),N(s,function(){l.removeChild(s),c()},function(){l.removeChild(s)}),g.modules[o]=y))),f},r.prototype.modules=Object.assign({},E),r.prototype.extend=function(e){var t,n,r=m.base||"",o=/^\{\/\}/;for(t in e=e||{})this[t]||this.modules[t]?j("the "+t+" module already exists, extend failure"):("string"==typeof(n=e[t])&&(n=((r=o.test(n)?"":r)+n).replace(o,"")),this.modules[t]=n);return this},r.prototype.disuse=function(e){var n=this;return e=n.isArray(e)?e:[e],n.each(e,function(e,t){delete n[t],delete E[t],delete n.modules[t],delete g.status[t],delete g.modules[t]}),n},r.prototype.getStyle=function(e,t){e=e.currentStyle||h.getComputedStyle(e,null);return e.getPropertyValue?e.getPropertyValue(t):e.getAttribute(t.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():""}))},r.prototype.link=function(n,r,o){var a,i=this,e=d.getElementsByTagName("head")[0],t="function"==typeof r;if("string"==typeof r&&(o=r),"object"==typeof n)return a="array"===i.type(o),i.each(n,function(e,t){i.link(t,e===n.length-1&&r,a&&o[e])});o="layuicss-"+(o=o||n.replace(/^(#|(http(s?)):\/\/|\/\/)|\.|\/|\?.+/g,""));var u=d.getElementById(o);return u||((u=d.createElement("link")).href=n+(m.debug?"?v="+(new Date).getTime():""),u.rel="stylesheet",u.id=o,e.appendChild(u)),"complete"===u.__lay_readyState__?t&&r(u):N(u,function(){u.__lay_readyState__="complete",t&&r(u)},function(){j(n+" load error","error"),e.removeChild(u)}),i},r.prototype.addcss=function(e,t,n){return layui.link(m.dir+"css/"+e,t,n)},r.prototype.factory=function(e){if(layui[e])return"function"==typeof m.callback[e]?m.callback[e]:null},r.prototype.img=function(e,t,n){var r=new Image;if(r.src=e,r.complete)return t(r);r.onload=function(){r.onload=null,"function"==typeof t&&t(r)},r.onerror=function(e){r.onerror=null,"function"==typeof n&&n(e)}},r.prototype.router=r.prototype.hash=function(e){var n={path:[],pathname:[],search:{},hash:((e=e||v.hash).match(/[^#](#.*$)/)||[])[1]||"",href:""};return/^#/.test(e)&&(e=e.replace(/^#/,""),e=(n.href=e).replace(/([^#])(#.*$)/,"$1").split("/")||[],this.each(e,function(e,t){/^\w+=/.test(t)?(t=t.split("="),n.search[t[0]]=t[1]):n.path.push(t)}),n.pathname=n.path),n},r.prototype.url=function(e){var o,t,n=this;return{pathname:(e?((e.match(/\.[^.]+?\/.+/)||[])[0]||"").replace(/^[^\/]+/,"").replace(/\?.+/,""):v.pathname).replace(/^\//,"").split("/"),search:(o={},t=(e?((e.match(/\?.+/)||[])[0]||"").replace(/\#.+/,""):v.search).replace(/^\?+/,"").split("&"),n.each(t,function(e,t){var n=t.indexOf("="),r=n<0?t.substr(0,t.length):0!==n&&t.substr(0,n);r&&(o[r]=0(d.innerHeight||h.documentElement.clientHeight)},p.getStyleRules=function(t,n){if(t)return t=(t=t.sheet||t.styleSheet||{}).cssRules||t.rules,"function"==typeof n&&layui.each(t,function(t,e){if(n(e,t))return!0}),t},p.style=function(t){t=t||{};var e=p.elem("style"),n=t.text||"",i=t.target;if(n)return"styleSheet"in e?(e.setAttribute("type","text/css"),e.styleSheet.cssText=n):e.innerHTML=n,e.id="LAY-STYLE-"+(t.id||(n=p.style.index||0,p.style.index++,"DF-"+n)),i&&((t=p(i).find("#"+e.id))[0]&&t.remove(),p(i).append(e)),e},p.position=function(t,e,n){var i,r,o,c,a,u,s,f,l;e&&(n=n||{},t!==h&&t!==p("body")[0]||(n.clickType="right"),i="right"===n.clickType?{left:(i=n.e||d.event||{}).clientX,top:i.clientY,right:i.clientX,bottom:i.clientY}:t.getBoundingClientRect(),a=e.offsetWidth,u=e.offsetHeight,r=function(t){return h.body[t=t?"scrollLeft":"scrollTop"]|h.documentElement[t]},o=function(t){return h.documentElement[t?"clientWidth":"clientHeight"]},c="margin"in n?n.margin:5,l=i.left,"center"===n.align?l-=(a-t.offsetWidth)/2:"right"===n.align&&(l=l-a+t.offsetWidth),(l=l+a+c>o("width")?o("width")-a-c:l)o()&&(i.top>u+c&&i.top<=o()?a=i.top-u-2*c:n.allowBottomOut||(a=o()-u-2*c)<0&&(a=0)),(u=n.position)&&(e.style.position=u),s=n.offset?n.offset[0]:0,f=n.offset?n.offset[1]:0,e.style.left=l+("fixed"===u?0:r(1))+s+"px",e.style.top=a+("fixed"===u?0:r())+f+"px",p.hasScrollbar()||(l=e.getBoundingClientRect(),!n.SYSTEM_RELOAD&&l.bottom+c>o()&&(n.SYSTEM_RELOAD=!0,setTimeout(function(){p.position(t,e,n)},50))))},p.options=function(t,e){if(e="object"==typeof e?e:{attr:e},t===h)return{};var t=p(t),n=e.attr||"lay-options",t=t.attr(n);try{return new Function("return "+(t||"{}"))()}catch(i){return layui.hint().error(e.errorText||[n+'="'+t+'"',"\n parseerror: "+i].join("\n"),"error"),{}}},p.isTopElem=function(n){var t=[h,p("body")[0]],i=!1;return p.each(t,function(t,e){if(e===n)return i=!0}),i},p.clipboard={writeText:function(n){var i=String(n.text);function t(){var t=h.createElement("textarea");t.value=i,t.style.position="fixed",t.style.opacity="0",t.style.top="0px",t.style.left="0px",h.body.appendChild(t),t.select();try{h.execCommand("copy"),"function"==typeof n.done&&n.done()}catch(e){"function"==typeof n.error&&n.error(e)}finally{t.remove?t.remove():h.body.removeChild(t)}}navigator&&"clipboard"in navigator?navigator.clipboard.writeText(i).then(n.done,function(){t()}):t()}},p.passiveSupported=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});d.addEventListener("test",null,e),d.removeEventListener("test",null,e)}catch(n){}return t}(),p.touchEventsSupported=function(){return"ontouchstart"in d},p.touchSwipe=function(t,e){var n,i,r,o,c=e,a=p(t)[0],u=!("preventDefault"in c)||c.preventDefault;a&&p.touchEventsSupported()&&(n={pointerStart:{x:0,y:0},pointerEnd:{x:0,y:0},distanceX:0,distanceY:0,direction:"none",timeStart:null},e=function(t){1===t.touches.length&&(a.addEventListener("touchmove",i,!!p.passiveSupported&&{passive:!1}),a.addEventListener("touchend",r),a.addEventListener("touchcancel",r),n.timeStart=Date.now(),n.pointerStart.x=n.pointerEnd.x=t.touches[0].clientX,n.pointerStart.y=n.pointerEnd.y=t.touches[0].clientY,n.distanceX=n.distanceY=0,n.direction="none",c.onTouchStart)&&c.onTouchStart(t,n)},i=function(t){u&&t.preventDefault(),n.pointerEnd.x=t.touches[0].clientX,n.pointerEnd.y=t.touches[0].clientY,n.distanceX=n.pointerStart.x-n.pointerEnd.x,n.distanceY=n.pointerStart.y-n.pointerEnd.y,Math.abs(n.distanceX)>Math.abs(n.distanceY)?n.direction=0]|&(?=#?[a-zA-Z0-9]+)/g;return e===undefined||null===e?"":r.test(e+="")?e.replace(r,function(e){return"&#"+e.charCodeAt(0)+";"}):e}},m=function(e,r){return new RegExp(e,r||"g")},g=function(e,r,t){r=r||{};var e="Laytpl "+((r=Object.assign({errorContext:""},r)).type||"")+"Error: "+e,n=r.errorContext;return delete r.errorContext,"object"==typeof console&&console.error(e,"\n",n,"\n",r),"function"==typeof t&&t(r),e},o={open:"{{",close:"}}",cache:!0,condense:!0,tagStyle:""},t=function(e,r){var t=this;r=t.config=Object.assign({template:e},o,r),t.vars=Object.assign({include:function(e,r){e=document.getElementById(e),e=e?e.innerHTML:"";return e?t.render(e,r):""}},n),t.compile(r.template)},r=(t.prototype.render=function(r,t){var n=this,o=n.config,c=r?n.compile(r):n.compilerCache||n.compile(o.template),e=function(){t=t||o.data||{};try{return c(t)}catch(e){return r=r||o.template,g(e,{errorContext:n.extractErrorContext(r,t),template:r,type:"Render"},o.error)}}();return o.cache&&!r&&(n.compilerCache=c),e},t.prototype.compile=function(e){var t=this,o=t.config,c=o.open,a=o.close,i=o.condense,u=m,l="\u2028";if("string"!=typeof e||!e)return function(){return""};var p=function(e,r){e=["(?:"+c+(e[0]||"")+"\\s*)","("+(e[1]||"[\\s\\S]")+"*?)","(?:\\s*"+(e[2]||"")+a+")"];return(r=r||{}).before&&e.unshift(r.before),r.after&&e.push(r.after),u(e.join(""))},r=i?["",""]:["(?:(?:\\n)*\\s*)","(?:\\s*?)"],f={before:r[0],after:r[1]},s=function(e,r){return e=(e=i?e:e.replace(u(l),r?"":"\n")).replace(/\\(\\|")/g,"$1")},n=t.parse=function(e){var n,r,t;return(e=e||"")&&(e=(e=(e=i?e.replace(/\t/g," ").replace(/\s+/g," "):e).replace(u("([}\\]])"+a),"$1 "+a).replace(/(?=\\|")/g,"\\").replace(/\r?\n/g,i?"":l)).replace(p(["!","","!"],f),function(e,r){return r=r.replace(u(c+"|"+a),function(e){return e.replace(/(?=.)/g,"\\")})}),n=function(e){return['";',e,'__laytpl__+="'].join("\n")},r=function(e,r,t){return t&&(r="-"===r?"":"_escape",t=s(t,!0))?n("__laytpl__+="+r+"("+t+");"):""},t=function(e,r){return r?(r=s(r),n(r)):""},e="modern"===o.tagStyle?(e=(e=e.replace(p(["#"],f),"")).replace(p(["(=|-)"]),r)).replace(p([],f),t):(e=e.replace(p(["#"],f),t)).replace(p(["(=|-)*"]),r),i||(e=e.replace(u(l),"\\n"))),e},r=t.createCompiler=function(e,r){return r=r||d(e),new Function("laytpl","return "+r)(t.vars)},d=t.createBuilder=function(e,r){return r=r||["function(d){",'"use strict";','var __laytpl__="",'+function(){var e,r=[];for(e in t.vars)r.push(("escape"===e?"_":"")+e+"=laytpl."+e);return r.join(",")}()+";",'__laytpl__="'+n(e)+'";',"return __laytpl__;","};"].join("\n")};try{return r(e)}catch(y){return delete t.compilerCache,function(){return g(y,{errorContext:t.extractErrorContext(e),template:e,type:"Compile"},o.error)}}},t.prototype.extractErrorContext=function(e,r){var t=1,o=e.split(/\r?\n/g),n=(e=e.replace(/(?=^)/gm,function(){return"/*LINE:"+t+++"*/"}),this.createBuilder(e)),c=n.split(/\r?\n/),a="laytpl.builder.map";try{n+="\n//# sourceURL="+a;var i=this.createCompiler(e,n);r&&i(r)}catch(l){var e=m(a.replace(/\./g,"\\.")+":(\\d+)","i"),n=(l.stack.match(e)||[])[1]||0,u=function(e,r){var r=r?/\/\*LINE:(\d+)\*\/[^*]*$/:/\/\*LINE:(\d+)\*\//;return!(r=(String(c[e-1]).match(r)||[])[1])&&0n.pages?n.curr=n.pages:n.curr<1&&(n.curr=1),r<0?r=1:r>n.pages&&(r=n.pages),n.prev="prev"in n?n.prev:"\u4e0a\u4e00\u9875",n.next="next"in n?n.next:"\u4e0b\u4e00\u9875",n.pages>r?Math.ceil((n.curr+(1'+n.prev+"":"",page:function(){var e=[];if(n.count<1)return"";1'+(n.first||1)+"");var a=Math.floor((r-1)/2),t=1n.pages?n.pages:a:r;for(i-t...');t<=i;t++)t===n.curr?e.push('"+t+""):e.push(''+t+"");return n.pages>r&&n.pages>i&&!1!==n.last&&(i+1...'),0!==r)&&e.push(''+(n.last||n.pages)+""),e.join("")}(),next:n.next?''+n.next+"":"",count:''+(e="object"==typeof n.countText?n.countText:["\u5171 "," \u6761"])[0]+n.count+e[1]+"",limit:(i=['"),refresh:['','',""].join(""),skip:[''+(e="object"==typeof n.skipText?n.skipText:["\u5230\u7b2c","\u9875","\u786e\u5b9a"])[0],'',e[1]+'",""].join("")};return['
      ',(t=[],layui.each(n.layout,function(e,a){l[a]&&t.push(l[a])}),t.join("")),"
      "].join("")},t.prototype.jump=function(e,a){if(e){var t=this,i=t.config,n=e.children,r=e[c]("button")[0],u=e[c]("input")[0],e=e[c]("select")[0],l=function(){var e=Number(u.value.replace(/\s|\D/g,""));e&&(i.curr=e,t.render())};if(a)return l();for(var s=0,p=n.length;si.pages||(i.curr=e,t.render())});e&&o.on(e,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),r&&o.on(r,"click",function(){l()})}},t.prototype.skip=function(t){var i,e;t&&(i=this,e=t[c]("input")[0])&&o.on(e,"keyup",function(e){var a=this.value,e=e.keyCode;/^(37|38|39|40)$/.test(e)||(/\D/.test(a)&&(this.value=a.replace(/\D/,"")),13===e&&i.jump(t,!0))})},t.prototype.render=function(e){var a=this,t=a.config,i=a.type(),n=a.view(),i=(2===i?t.elem&&(t.elem.innerHTML=n):3===i?t.elem.html(n):r[u](t.elem)&&(r[u](t.elem).innerHTML=n),t.jump&&t.jump(t,e),r[u]("layui-laypage-"+t.index));a.jump(i),t.hash&&!e&&(location.hash="!"+t.hash+"="+t.curr),a.skip(i)},{render:function(e){return new t(e).index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(a,e,t){return a.attachEvent?a.attachEvent("on"+e,function(e){e.target=e.srcElement,t.call(a,e)}):a.addEventListener(e,t,!1),this}});e("laypage",o)});!function(i,D){"use strict";var n=i.layui&&layui.define,l={getPath:i.lay&&lay.getPath?lay.getPath:"",link:function(e,t,a){T.path&&i.lay&&lay.layui&&lay.layui.link(T.path+e,t,a)}},e=i.LAYUI_GLOBAL||{},a="laydate",d="lay-"+a+"-id",T={v:"5.6.0",config:{weekStart:0},index:i.laydate&&i.laydate.v?1e5:0,path:e.laydate_dir||l.getPath,set:function(e){var t=this;return t.config=lay.extend({},t.config,e),t},ready:function(e){var t="laydate",a=(n?"modules/":"")+"laydate.css?v="+T.v;return n?layui["layui.all"]?"function"==typeof e&&e():layui.addcss(a,e,t):l.link(a,e,t),this}},s=function(){var t=this,e=t.config.id;return(s.that[e]=t).inst={hint:function(e){t.hint.call(t,e)},reload:function(e){t.reload.call(t,e)},config:t.config}},M="layui-this",C="laydate-disabled",h=[100,2e5],v="layui-laydate-static",b="layui-laydate-list",o="laydate-selected",r="layui-laydate-hint",y="laydate-day-prev",m="laydate-day-next",E=".laydate-btns-confirm",L="laydate-time-text",I="laydate-btns-time",x="layui-laydate-preview",w="layui-laydate-shade",k=function(e){var t,a=this,n=(a.index=++T.index,a.config=lay.extend({},a.config,T.config,e),lay(e.elem||a.config.elem));return 1\u8bf7\u91cd\u65b0\u9009\u62e9",invalidDate:"\u4e0d\u5728\u6709\u6548\u65e5\u671f\u6216\u65f6\u95f4\u8303\u56f4\u5185",formatError:["\u65e5\u671f\u683c\u5f0f\u4e0d\u5408\u6cd5
      \u5fc5\u987b\u9075\u5faa\u4e0b\u8ff0\u683c\u5f0f\uff1a
      ","
      \u5df2\u4e3a\u4f60\u91cd\u7f6e"],preview:"\u5f53\u524d\u9009\u4e2d\u7684\u7ed3\u679c"},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"},timeout:"End time cannot be less than start Time
      Please re-select",invalidDate:"Invalid date",formatError:["The date format error
      Must be followed\uff1a
      ","
      It has been reset"],preview:"The selected result"}};return e[this.config.lang]||e.cn},k.prototype.markerOfChineseFestivals={"0-1-1":"\u5143\u65e6","0-2-14":"\u60c5\u4eba","0-3-8":"\u5987\u5973","0-3-12":"\u690d\u6811","0-4-1":"\u611a\u4eba","0-5-1":"\u52b3\u52a8","0-5-4":"\u9752\u5e74","0-6-1":"\u513f\u7ae5","0-9-10":"\u6559\u5e08","0-10-1":"\u56fd\u5e86","0-12-25":"\u5723\u8bde"},k.prototype.reload=function(e){this.config=lay.extend({},this.config,e),this.init()},k.prototype.init=function(){var r=this,o=r.config,e="static"===o.position,t={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};o.elem=lay(o.elem),o.eventElem=lay(o.eventElem),o.elem[0]&&("array"!==layui.type(o.theme)&&(o.theme=[o.theme]),o.fullPanel&&("datetime"!==o.type||o.range)&&delete o.fullPanel,r.rangeStr=o.range?"string"==typeof o.range?o.range:"-":"",r.rangeLinked=!(!o.range||!o.rangeLinked||"date"!==o.type&&"datetime"!==o.type),r.autoCalendarModel=function(){var e=r.rangeLinked;return r.rangeLinked=o.range&&("date"===o.type||"datetime"===o.type)&&(!r.startDate||!r.endDate||r.startDate&&r.endDate&&r.startDate.year===r.endDate.year&&r.startDate.month===r.endDate.month),lay(r.elem)[r.rangeLinked?"addClass":"removeClass"]("layui-laydate-linkage"),r.rangeLinked!=e},r.autoCalendarModel.auto=r.rangeLinked&&"auto"===o.rangeLinked,"array"===layui.type(o.range)&&(r.rangeElem=[lay(o.range[0]),lay(o.range[1])]),t[o.type]||(i.console&&console.error&&console.error("laydate type error:'"+o.type+"' is not supported"),o.type="date"),o.format===t.date&&(o.format=t[o.type]||t.date),r.format=s.formatArr(o.format),o.weekStart&&!/^[0-6]$/.test(o.weekStart)&&(t=r.lang(),o.weekStart=t.weeks.indexOf(o.weekStart),-1===o.weekStart)&&(o.weekStart=0),r.EXP_IF="",r.EXP_SPLIT="",lay.each(r.format,function(e,t){e=new RegExp(u).test(t)?"\\d{"+(new RegExp(u).test(r.format[0===e?e+1:e-1]||"")?/^yyyy|y$/.test(t)?4:t.length:/^yyyy$/.test(t)?"1,4":/^y$/.test(t)?"1,308":"1,2")+"}":"\\"+t;r.EXP_IF=r.EXP_IF+e,r.EXP_SPLIT=r.EXP_SPLIT+"("+e+")"}),r.EXP_IF_ONE=new RegExp("^"+r.EXP_IF+"$"),r.EXP_IF=new RegExp("^"+(o.range?r.EXP_IF+"\\s\\"+r.rangeStr+"\\s"+r.EXP_IF:r.EXP_IF)+"$"),r.EXP_SPLIT=new RegExp("^"+r.EXP_SPLIT+"$",""),r.isInput(o.elem[0])||"focus"===o.trigger&&(o.trigger="click"),o.elem.attr("lay-key",r.index),o.eventElem.attr("lay-key",r.index),o.elem.attr(d,o.id),lay.each(["min","max"],function(e,t){var a=[],n=[];if("number"==typeof o[t])var i=o[t],l=new Date,l=r.newDate({year:l.getFullYear(),month:l.getMonth(),date:l.getDate(),hours:e?23:0,minutes:e?59:0,seconds:e?59:0}).getTime(),e=new Date(i?i<864e5?l+864e5*i:i:l),a=[e.getFullYear(),e.getMonth()+1,e.getDate()],n=[e.getHours(),e.getMinutes(),e.getSeconds()];else if("string"==typeof o[t])a=(o[t].match(/\d+-\d+-\d+/)||[""])[0].split("-"),n=(o[t].match(/\d+:\d+:\d+/)||[""])[0].split(":");else if("object"==typeof o[t])return o[t];o[t]={year:0|a[0]||(new Date).getFullYear(),month:a[1]?(0|a[1])-1:(new Date).getMonth(),date:0|a[2]||(new Date).getDate(),hours:0|n[0],minutes:0|n[1],seconds:0|n[2]}}),r.elemID="layui-laydate"+o.elem.attr("lay-key"),(o.show||e)&&r.render(),e||r.events(),"function"==typeof o.formatToDisplay&&(r.isInput(o.elem[0])?r.formatToDisplay(o.elem[0],o.formatToDisplay):(t=r.rangeElem)&&(r.formatToDisplay(t[0][0],o.formatToDisplay),r.formatToDisplay(t[1][0],o.formatToDisplay))),o.value)&&o.isInitValue&&("date"===layui.type(o.value)?r.setValue(r.parse(0,r.systemDate(o.value))):r.setValue(o.value))},k.prototype.render=function(){var a,n,i,l,r=this,o=r.config,d=r.lang(),s="static"===o.position,y=r.elem=lay.elem("div",{id:r.elemID,"class":["layui-laydate",o.range?" layui-laydate-range":"",r.rangeLinked?" layui-laydate-linkage":"",s?" "+v:"",o.fullPanel?" laydate-theme-fullpanel":"",(a="",lay.each(o.theme,function(e,t){"default"===t||/^#/.test(t)||(a+=" laydate-theme-"+t)}),a)].join("")}),m=r.elemMain=[],u=r.elemHeader=[],c=r.elemCont=[],h=r.table=[],e=r.footer=lay.elem("div",{"class":"layui-laydate-footer"}),t=r.shortcut=lay.elem("ul",{"class":"layui-laydate-shortcut"}),p=(o.zIndex&&(y.style.zIndex=o.zIndex),lay.each(new Array(2),function(e){if(!o.range&&0'+d.timeTips+""),(o.range||"datetime"!==o.type||o.fullPanel)&&p.push(''),lay.each(o.btns,function(e,t){var a=d.tools[t]||"btn";o.range&&"now"===t||(s&&"clear"===t&&(a="cn"===o.lang?"\u91cd\u7f6e":"Reset"),n.push(''+a+""))}),p.push('"),p.join(""))),o.shortcuts&&(y.appendChild(t),lay(t).html((i=[],lay.each(o.shortcuts,function(e,t){i.push('
    • '+t.text+"
    • ")}),i.join(""))).find("li").on("click",function(e){var t=o.shortcuts[this.dataset.index]||{},t=("function"==typeof t.value?t.value():t.value)||[],n=(layui.isArray(t)||(t=[t]),o.type),t=(lay.each(t,function(e,t){var a=[o.dateTime,r.endDate][e];"time"===n&&"date"!==layui.type(t)?r.EXP_IF.test(t)&&(t=(t.match(r.EXP_SPLIT)||[]).slice(1),lay.extend(a,{hours:0|t[0],minutes:0|t[2],seconds:0|t[4]})):lay.extend(a,r.systemDate("date"===layui.type(t)?t:new Date(t))),"time"!==n&&"datetime"!==n||(r[["startTime","endTime"][e]]={hours:a.hours,minutes:a.minutes,seconds:a.seconds}),0===e?r.startDate=lay.extend({},a):r.endState=!0,"year"===n||"month"===n||"time"===n?r.listYM[e]=[a.year,a.month+1]:e&&r.autoCalendarModel.auto&&r.autoCalendarModel()}),r.checkDate("limit").calendar(null,null,"init"),lay(r.footer).find("."+I).removeClass(C));t&&"date"===t.attr("lay-type")&&t[0].click(),r.done(null,"change"),lay(this).addClass(M),"static"!==o.position&&r.setValue(r.parse()).done().remove()})),lay.each(m,function(e,t){y.appendChild(t)}),o.showBottom&&y.appendChild(e),lay.elem("style")),f=[],g=!0,t=(lay.each(o.theme,function(e,t){g&&/^#/.test(t)?(g=!(l=!0),f.push(["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} li.layui-this,#{{id}} td.layui-this>div{background-color:{{theme}} !important;}",-1!==o.theme.indexOf("circle")?"":"#{{id}} .layui-this{background-color:{{theme}} !important;}","#{{id}} .laydate-day-now{color:{{theme}} !important;}","#{{id}} .laydate-day-now:after{border-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,r.elemID).replace(/{{theme}}/g,t))):!g&&/^#/.test(t)&&f.push(["#{{id}} .laydate-selected>div{background-color:{{theme}} !important;}","#{{id}} .laydate-selected:hover>div{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,r.elemID).replace(/{{theme}}/g,t))}),o.shortcuts&&o.range&&f.push("#{{id}}.layui-laydate-range{width: 628px;}".replace(/{{id}}/g,r.elemID)),f.length&&(f=f.join(""),"styleSheet"in p?(p.setAttribute("type","text/css"),p.styleSheet.cssText=f):p.innerHTML=f,l&&lay(y).addClass("laydate-theme-molv"),y.appendChild(p)),r.remove(k.thisElemDate),T.thisId=o.id,s?o.elem.append(y):(D.body.appendChild(y),r.position()),o.shade?'
      ':"");y.insertAdjacentHTML("beforebegin",t),r.checkDate().calendar(null,0,"init"),r.changeEvent(),k.thisElemDate=r.elemID,r.renderAdditional(),"function"==typeof o.ready&&o.ready(lay.extend({},o.dateTime,{month:o.dateTime.month+1})),r.preview()},k.prototype.remove=function(e){var t=this,a=t.config,n=lay("#"+(e||t.elemID));return n[0]&&(n.hasClass(v)||t.checkDate(function(){n.remove(),delete t.startDate,delete t.endDate,delete t.endState,delete t.startTime,delete t.endTime,delete T.thisId,"function"==typeof a.close&&a.close(t)}),lay("."+w).remove()),t},k.prototype.position=function(){var e=this.config;return lay.position(e.elem[0],this.elem,{position:e.position}),this},k.prototype.hint=function(e){var t=this,a=(t.config,lay.elem("div",{"class":r}));t.elem&&(a.innerHTML=(e="object"==typeof e?e||{}:{content:e}).content||"",lay(t.elem).find("."+r).remove(),t.elem.appendChild(a),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){lay(t.elem).find("."+r).remove()},"ms"in e?e.ms:3e3))},k.prototype.getAsYM=function(e,t,a){return a?t--:t++,t<0&&(t=11,e--),11h[1]&&(e.year=h[1],o=!0),11t)&&(e.date=t,o=!0)},c=function(n,i,l){var r=["startTime","endTime"];i=(i.match(d.EXP_SPLIT)||[]).slice(1),l=l||0,s.range&&(d[r[l]]=d[r[l]]||{}),lay.each(d.format,function(e,t){var a=parseFloat(i[e]);i[e].lengthd.getDateTime(s.max)?(r=s.dateTime=lay.extend({},s.max),i=!0):d.getDateTime(r)d.getDateTime(s.max))&&(d.endDate=lay.extend({},s.max),i=!0),d.startTime={hours:s.dateTime.hours,minutes:s.dateTime.minutes,seconds:s.dateTime.seconds},d.endTime={hours:d.endDate.hours,minutes:d.endDate.minutes,seconds:d.endDate.seconds},"month"===s.type)&&(s.dateTime.date=1,d.endDate.date=1),i&&m&&(d.setValue(d.parse()),d.hint("value "+l.invalidDate+l.formatError[1])),d.startDate=d.startDate||m&&lay.extend({},s.dateTime),d.autoCalendarModel.auto&&d.autoCalendarModel(),d.endState=!s.range||!d.rangeLinked||!(!d.startDate||!d.endDate),e&&e()),d},k.prototype.markRender=function(e,a,t){var n;"object"==typeof t?lay.each(t||{},function(e,t){e=e.split("-");e[0]!=a[0]&&0!=e[0]||e[1]!=a[1]&&0!=e[1]||e[2]!=a[2]||(n=t||a[2])}):"string"==typeof t&&(n=t||a[2]),n&&e.find("div").html(''+n+"")},k.prototype.mark=function(t,a){var n=this,e=n.config,i=function(e){n.markRender(t,a,e)};return e.calendar&&"cn"===e.lang&&i(n.markerOfChineseFestivals),"function"==typeof e.mark?e.mark({year:a[0],month:a[1],date:a[2]},i):"object"==typeof e.mark&&i(e.mark),n},k.prototype.holidaysRender=function(r,o,e){var d=["holidays","workdays"],s=function(e,t,a){e.find("div").html(["",a,""].join(""))};"array"===layui.type(e)?lay.each(e,function(l,e){lay.each(e,function(e,t){var a,n,i;t=t,a=r.attr("lay-ymd"),n=t.split("-"),i=a.split("-"),lay.each(n,function(e,t){n[e]=parseInt(t,10)}),lay.each(i,function(e,t){i[e]=parseInt(t,10)}),n.join("-")===i.join("-")&&s(r,d[l],o[2])})}):"string"==typeof e&&-1!==d.indexOf(e)&&s(r,e,o[2])},k.prototype.holidays=function(t,a){var n=this,e=n.config,i=function(e){n.holidaysRender(t,a,e)};return"function"==typeof e.holidays?e.holidays({year:a[0],month:a[1],date:a[2]},i):"array"===layui.type(e.holidays)&&i(e.holidays),n},k.prototype.cellRender=function(t,e,a){var n=this.config;return"function"==typeof n.cellRender&&n.cellRender(e,function(e){"string"==typeof e?lay(t).html(e):"object"==typeof e&&lay(t).html("").append(lay(e)[0])},{originElem:t,type:a}),this},k.prototype.startOfYear=function(e){e=new Date(e);return e.setFullYear(e.getFullYear(),0,1),e.setHours(0,0,0,0),e},k.prototype.endOfYear=function(e){var e=new Date(e),t=e.getFullYear();return e.setFullYear(t+1,0,0),e.setHours(23,59,59,999),e},k.prototype.startOfMonth=function(e){e=new Date(e);return e.setDate(1),e.setHours(0,0,0,0),e},k.prototype.endOfMonth=function(e){var e=new Date(e),t=e.getMonth();return e.setFullYear(e.getFullYear(),t+1,0),e.setHours(23,59,59,999),e},k.prototype.addDays=function(e,t){e=new Date(e);return t&&e.setDate(e.getDate()+t),e},k.prototype.isDisabledYearOrMonth=function(e,t,a){for(var n=this,i=n.config,l="year"===t?n.startOfYear(e):n.startOfMonth(e),t="year"===t?n.endOfYear(e):n.endOfMonth(e),r=Math.floor((t.getTime()-l.getTime())/864e5)+1,o=0,d=0;d(t.time?0:41)?i.endDate:e.dateTime;return lay.each({now:lay.extend({},a,t.date||{}),min:e.min,max:e.max},function(e,a){var n;l[e]=i.newDate(lay.extend({year:a.year,month:"year"===t.type?0:a.month,date:"year"===t.type||"month"===t.type?1:a.date},(n={},lay.each(t.time,function(e,t){n[t]=a[t]}),n))).getTime()}),a=l.nowh[1]&&(s.year=h[1],d.hint(y.invalidDate)),d.firstDate||(d.firstDate=lay.extend({},s)),n.setFullYear(s.year,s.month,1),l=(n.getDay()+(7-a.weekStart))%7,r=T.getEndDate(s.month||12,s.year),o=T.getEndDate(s.month+1,s.year),lay.each(u,function(e,t){var a,n=[s.year,s.month];(t=lay(t)).removeAttr("class"),e"+n[2]+"
      "),d.mark(t,n).holidays(t,n).limit({elem:t,date:{year:n[0],month:n[1]-1,date:n[2]},index:e,rangeType:i,disabledType:"date"}),d.cellRender(t,{year:n[0],month:n[1],date:n[2]},"date")}),lay(c[0]).attr("lay-ym",s.year+"-"+(s.month+1)),lay(c[1]).attr("lay-ym",s.year+"-"+(s.month+1)),d.panelYM||(d.panelYM={}),d.panelYM[i]={year:s.year,month:s.month},"cn"===a.lang?(lay(c[0]).attr("lay-type","year").html(s.year+" \u5e74"),lay(c[1]).attr("lay-type","month").html(s.month+1+" \u6708")):(lay(c[0]).attr("lay-type","month").html(y.month[s.month]),lay(c[1]).attr("lay-type","year").html(s.year)),m&&(a.range?!e&&"init"===t||(d.listYM=[[(d.startDate||a.dateTime).year,(d.startDate||a.dateTime).month+1],[d.endDate.year,d.endDate.month+1]],d.list(a.type,0).list(a.type,1),"time"===a.type?d.setBtnStatus("\u65f6\u95f4",lay.extend({},d.systemDate(),d.startTime),lay.extend({},d.systemDate(),d.endTime)):d.setBtnStatus(!0)):(d.listYM=[[s.year,s.month+1]],d.list(a.type,0))),a.range&&"init"===t&&(d.rangeLinked?(n=d.getAsYM(s.year,s.month,i?"sub":null),d.calendar(lay.extend({},s,{year:n[0],month:n[1]}),1-i)):d.calendar(null,1-i)),a.range||(u=["hours","minutes","seconds"],d.limit({elem:lay(d.footer).find(".laydate-btns-now"),date:d.systemDate(/^(datetime|time)$/.test(a.type)?new Date:null),index:0,time:u,disabledType:"datetime"}),d.limit({elem:lay(d.footer).find(E),index:0,time:u,disabledType:"datetime"})),d.setBtnStatus(),lay(d.shortcut).find("li."+M).removeClass(M),a.range&&!m&&"init"!==t&&d.stampRange(),d},k.prototype.list=function(n,i){var l,r,e,a,o,d,t,s=this,y=s.config,m=s.rangeLinked?y.dateTime:[y.dateTime,s.endDate][i],u=s.lang(),c=y.range&&"date"!==y.type&&"datetime"!==y.type,h=lay.elem("ul",{"class":b+" "+{year:"laydate-year-list",month:"laydate-month-list",time:"laydate-time-list"}[n]}),p=s.elemHeader[i],f=lay(p[2]).find("span"),g=s.elemCont[i||0],D=lay(g).find("."+b)[0],T="cn"===y.lang,v=T?"\u5e74":"",x=s.listYM[i]||{},w=["hours","minutes","seconds"],k=["startTime","endTime"][i];return x[0]<1&&(x[0]=1),"year"===n?(e=l=x[0]-7,l<1&&(e=l=1),lay.each(new Array(15),function(e){var t=lay.elem("li",{"lay-ym":l}),a={year:l,month:0,date:1};l==x[0]&&lay(t).addClass(M),t.innerHTML=l+v,h.appendChild(t),s.limit({elem:lay(t),date:a,index:i,type:n,rangeType:i,disabledType:"date"}),s.cellRender(t,{year:l,month:1,date:1},"year"),l++}),lay(f[T?0:1]).attr("lay-ym",l-8+"-"+x[1]).html(e+v+" - "+(l-1)+v)):"month"===n?(lay.each(new Array(12),function(e){var t=lay.elem("li",{"lay-ym":e}),a={year:x[0],month:e,date:1};e+1==x[1]&&lay(t).addClass(M),t.innerHTML=u.month[e]+(T?"\u6708":""),h.appendChild(t),s.limit({elem:lay(t),date:a,index:i,type:n,rangeType:i,disabledType:"date"}),s.cellRender(t,{year:x[0],month:e+1,date:1},"month")}),lay(f[T?0:1]).attr("lay-ym",x[0]+"-"+x[1]).html(x[0]+v)):"time"===n&&(r=function(){lay(h).find("ol").each(function(a,e){lay(e).find("li").each(function(e,t){s.limit({elem:lay(t),date:[{hours:e},{hours:s[k].hours,minutes:e},{hours:s[k].hours,minutes:s[k].minutes,seconds:e}][a],index:i,rangeType:i,disabledType:"time",time:[["hours"],["hours","minutes"],["hours","minutes","seconds"]][a]})})}),y.range||s.limit({elem:lay(s.footer).find(E),date:s[k],index:0,time:["hours","minutes","seconds"],disabledType:"datetime"})},y.range?s[k]||(s[k]="startTime"===k?m:s.endDate):s[k]=m,lay.each([24,60,60],function(t,e){var a=lay.elem("li"),n=["

      "+u.time[t]+"

        "];lay.each(new Array(e),function(e){n.push(""+lay.digit(e,2)+"")}),a.innerHTML=n.join("")+"
      ",h.appendChild(a)}),r(),e=-1!==y.format.indexOf("H"),f=-1!==y.format.indexOf("m"),t=-1!==y.format.indexOf("s"),a=h.children,o=0,lay.each([e,f,t],function(e,t){t||(a[e].className+=" layui-hide",o++)}),h.className+=" laydate-time-list-hide-"+o),D&&g.removeChild(D),g.appendChild(h),"year"===n||"month"===n?(lay(s.elemMain[i]).addClass("laydate-ym-show"),lay(h).find("li").on("click",function(){var e,t,a=0|lay(this).attr("lay-ym");lay(this).hasClass(C)||(s.rangeLinked?lay.extend(m,{year:"year"===n?a:x[0],month:"year"===n?x[1]-1:a}):m[n]=a,e=-1!==["year","month"].indexOf(y.type),t="year"===n&&-1!==["date","datetime"].indexOf(y.type),e||t?(lay(h).find("."+M).removeClass(M),lay(this).addClass(M),("month"===y.type&&"year"===n||t)&&(s.listYM[i][0]=a,c&&((i?s.endDate:m).year=a),s.list("month",i))):(s.checkDate("limit").calendar(m,i,"init"),s.closeList()),s.setBtnStatus(),!y.range&&y.autoConfirm&&("month"===y.type&&"month"===n||"year"===y.type&&"year"===n)&&s.setValue(s.parse()).done().remove(),s.autoCalendarModel.auto&&!s.rangeLinked?s.choose(lay(g).find("td.layui-this"),i):s.endState&&s.done(null,"change"),lay(s.footer).find("."+I).removeClass(C))})):(f=lay.elem("span",{"class":L}),d=function(){lay(h).find("ol").each(function(e){var a=this,t=lay(a).find("li");a.scrollTop=30*(s[k][w[e]]-2),a.scrollTop<=0&&t.each(function(e,t){if(!lay(this).hasClass(C))return a.scrollTop=30*(e-2),!0})})},t=lay(p[2]).find("."+L),d(),f.innerHTML=y.range?[u.startTime,u.endTime][i]:u.timeTips,lay(s.elemMain[i]).addClass("laydate-time-show"),t[0]&&t.remove(),p[2].appendChild(f),(D=lay(h).find("ol")).each(function(t){var a=this;lay(a).find("li").on("click",function(){var e=0|this.innerHTML;lay(this).hasClass(C)||(y.range?s[k][w[t]]=e:m[w[t]]=e,lay(a).find("."+M).removeClass(M),lay(this).addClass(M),r(),d(),!s.endDate&&"time"!==y.type&&"datetime"!==y.type||s.done(null,"change"),s.setBtnStatus())})}),layui.device().mobile&&D.css({overflowY:"auto",touchAction:"pan-y"})),s},k.prototype.listYM=[],k.prototype.closeList=function(){var a=this;a.config;lay.each(a.elemCont,function(e,t){lay(this).find("."+b).remove(),lay(a.elemMain[e]).removeClass("laydate-ym-show laydate-time-show")}),lay(a.elem).find("."+L).remove()},k.prototype.setBtnStatus=function(e,t,a){var n=this,i=n.config,l=n.lang(),r=lay(n.footer).find(E),o="datetime"===i.type||"time"===i.type?["hours","minutes","seconds"]:undefined;i.range&&(t=t||(n.rangeLinked?n.startDate:i.dateTime),a=a||n.endDate,i=!n.endState||n.newDate(t).getTime()>n.newDate(a).getTime(),n.limit({date:t,disabledType:"datetime",time:o,rangeType:0})||n.limit({date:a,disabledType:"datetime",time:o,rangeType:1})?r.addClass(C):r[i?"addClass":"removeClass"](C),e)&&i&&n.hint("string"==typeof e?l.timeout.replace(/\u65e5\u671f/g,e):l.timeout)},k.prototype.parse=function(e,t){var a=this,n=a.config,i=a.rangeLinked?a.startDate:n.dateTime,t=t||("end"==e?lay.extend({},a.endDate,a.endTime):n.range?lay.extend({},i||n.dateTime,a.startTime):n.dateTime),i=T.parse(t,a.format,1);return n.range&&e===undefined?i+" "+a.rangeStr+" "+a.parse("end"):i},k.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},k.prototype.getDateTime=function(e){return this.newDate(e).getTime()},k.prototype.formatToDisplay=function(e,t){var a=this,n=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");Object.defineProperty(e,"value",lay.extend({},n,{get:function(){return this.getAttribute("lay-date")},set:function(e){n.set.call(this,t.call(a,e)),this.setAttribute("lay-date",e)}}))},k.prototype.setValue=function(e){var t,a=this,n=a.config,i=n.elem[0];return"static"!==n.position&&(e=e||"",a.isInput(i)?lay(i).val(e):(t=a.rangeElem)?("array"!==layui.type(e)&&(e=e.split(" "+a.rangeStr+" ")),t[0].val(e[0]||""),t[1].val(e[1]||"")):(0===lay(i).find("*").length&&(t="function"==typeof n.formatToDisplay?n.formatToDisplay(e):e,lay(i).html(t)),lay(i).attr("lay-date",e))),a},k.prototype.preview=function(){var e,t=this,a=t.config;a.isPreview&&(e=lay(t.elem).find("."+x),a=!a.range||(t.rangeLinked?t.endState:t.endDate)?t.parse():"",e.html(a),e.html())&&(e.css({color:"#16b777"}),setTimeout(function(){e.css({color:"#777"})},300))},k.prototype.renderAdditional=function(){this.config.fullPanel&&this.list("time",0)},k.prototype.stampRange=function(){var n,i=this,l=i.config,r=i.rangeLinked?i.startDate:l.dateTime,e=lay(i.elem).find("td");l.range&&!i.endState&&lay(i.footer).find(E).addClass(C),r=r&&i.newDate({year:r.year,month:r.month,date:r.date}).getTime(),n=i.endState&&i.endDate&&i.newDate({year:i.endDate.year,month:i.endDate.month,date:i.endDate.date}).getTime(),lay.each(e,function(e,t){var a=lay(t).attr("lay-ymd").split("-"),a=i.newDate({year:a[0],month:a[1]-1,date:a[2]}).getTime();l.rangeLinked&&!i.startDate&&a===i.newDate(i.systemDate()).getTime()&&lay(t).addClass(lay(t).hasClass(y)||lay(t).hasClass(m)?"":"laydate-day-now"),lay(t).removeClass(o+" "+M),a!==r&&a!==n||(i.rangeLinked||!i.rangeLinked&&(e<42?a===r:a===n))&&lay(t).addClass(lay(t).hasClass(y)||lay(t).hasClass(m)?o:M),rn.getDateTime(i.max)&&(n[t]={hours:i.max.hours,minutes:i.max.minutes,seconds:i.max.seconds},lay.extend(l,n[t])))}),a||(n.startDate=lay.extend({},l)),n.endState&&!n.limit({date:n.rangeLinked?n.startDate:n.thisDateTime(1-a),disabledType:"date"})&&(((r=n.endState&&n.autoCalendarModel.auto?n.autoCalendarModel():r)||n.rangeLinked&&n.endState)&&n.newDate(n.startDate)>n.newDate(n.endDate)&&(n.startDate.year===n.endDate.year&&n.startDate.month===n.endDate.month&&n.startDate.date===n.endDate.date&&(o=n.startTime,n.startTime=n.endTime,n.endTime=o),o=n.startDate,n.startDate=lay.extend({},n.endDate,n.startTime),i.dateTime=lay.extend({},n.startDate),n.endDate=lay.extend({},o,n.endTime)),r)&&(i.dateTime=lay.extend({},n.startDate)),n.rangeLinked?(e=n.checkPanelDate(l,t),o=lay.extend({},l),d=r||e&&e.needFullRender?"init":null,e=e?e.index:t,n.calendar(o,e,d)):n.calendar(null,a,r?"init":null),n.endState&&n.done(null,"change")):"static"===i.position?n.calendar().done().done(null,"change"):"date"===i.type?i.autoConfirm?n.setValue(n.parse()).done().remove():n.calendar().done(null,"change"):"datetime"===i.type&&n.calendar().done(null,"change"))},k.prototype.tool=function(t,e){var a=this,n=a.config,i=a.lang(),l=n.dateTime,r="static"===n.position,o={datetime:function(){lay(t).hasClass(C)||(a.list("time",0),n.range&&a.list("time",1),lay(t).attr("lay-type","date").html(a.lang().dateTips))},date:function(){a.closeList(),lay(t).attr("lay-type","datetime").html(a.lang().timeTips)},clear:function(){r&&(lay.extend(l,a.firstDate),a.calendar()),n.range&&(delete n.dateTime,delete a.endDate,delete a.startTime,delete a.endTime),a.setValue(""),a.done(null,"onClear").done(["",{},{}]).remove()},now:function(){var e=new Date;if(lay(t).hasClass(C))return a.hint(i.tools.now+", "+i.invalidDate);lay.extend(l,a.systemDate(),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()}),a.setValue(a.parse()),r&&a.calendar(),a.done(null,"onNow").done().remove()},confirm:function(){if(n.range){if(lay(t).hasClass(C))return("time"===n.type?a.startTime&&a.endTime&&a.newDate(a.startTime)>a.newDate(a.endTime):a.startDate&&a.endDate&&a.newDate(lay.extend({},a.startDate,a.startTime||{}))>a.newDate(lay.extend({},a.endDate,a.endTime||{})))?a.hint("time"===n.type?i.timeout.replace(/\u65e5\u671f/g,"\u65f6\u95f4"):i.timeout):a.hint(i.invalidDate)}else if(lay(t).hasClass(C))return a.hint(i.invalidDate);a.setValue(a.parse()),a.done(null,"onConfirm").done().remove()}};o[e]&&o[e]()},k.prototype.change=function(n){var i=this,l=i.config,r=i.thisDateTime(n),o=l.range&&("year"===l.type||"month"===l.type),d=i.elemCont[n||0],s=i.listYM[n],e=function(e){var t=lay(d).find(".laydate-year-list")[0],a=lay(d).find(".laydate-month-list")[0];return t&&(s[0]=e?s[0]-15:s[0]+15,i.list("year",n)),a&&(e?s[0]--:s[0]++,i.list("month",n)),(t||a)&&(lay.extend(r,{year:s[0]}),o&&(r.year=s[0]),l.range||i.done(null,"change"),l.range||i.limit({elem:lay(i.footer).find(E),date:{year:s[0]},disabledType:"datetime"})),i.setBtnStatus(),t||a};return{prevYear:function(){e("sub")||(i.rangeLinked?(l.dateTime.year--,i.checkDate("limit").calendar(null,null,"init")):(r.year--,i.checkDate("limit").calendar(null,n),i.autoCalendarModel.auto?i.choose(lay(d).find("td.layui-this"),n):i.done(null,"change")))},prevMonth:function(){var e,t;i.rangeLinked?(t=i.panelYM[0],t=i.getAsYM(t.year,t.month,"sub"),e=lay.extend({},l.dateTime,i.panelYM[0],{year:t[0],month:t[1]}),i.checkDate("limit").calendar(e,null,"init")):(t=i.getAsYM(r.year,r.month,"sub"),lay.extend(r,{year:t[0],month:t[1]}),i.checkDate("limit").calendar(null,null,"init"),i.autoCalendarModel.auto?i.choose(lay(d).find("td.layui-this"),n):i.done(null,"change"))},nextMonth:function(){var e,t;i.rangeLinked?(t=i.panelYM[0],t=i.getAsYM(t.year,t.month),e=lay.extend({},l.dateTime,i.panelYM[0],{year:t[0],month:t[1]}),i.checkDate("limit").calendar(e,null,"init")):(t=i.getAsYM(r.year,r.month),lay.extend(r,{year:t[0],month:t[1]}),i.checkDate("limit").calendar(null,null,"init"),i.autoCalendarModel.auto?i.choose(lay(d).find("td.layui-this"),n):i.done(null,"change"))},nextYear:function(){e()||(i.rangeLinked?(l.dateTime.year++,i.checkDate("limit").calendar(null,0,"init")):(r.year++,i.checkDate("limit").calendar(null,n),i.autoCalendarModel.auto?i.choose(lay(d).find("td.layui-this"),n):i.done(null,"change")))}}},k.prototype.changeEvent=function(){var i=this;i.config;lay(i.elem).on("click",function(e){lay.stope(e)}).on("mousedown",function(e){lay.stope(e)}),lay.each(i.elemHeader,function(n,e){lay(e[0]).on("click",function(e){i.change(n).prevYear()}),lay(e[1]).on("click",function(e){i.change(n).prevMonth()}),lay(e[2]).find("span").on("click",function(e){var t=lay(this),a=t.attr("lay-ym"),t=t.attr("lay-type");a&&(a=a.split("-"),i.listYM[n]=[0|a[0],0|a[1]],i.list(t,n),lay(i.footer).find("."+I).addClass(C))}),lay(e[3]).on("click",function(e){i.change(n).nextMonth()}),lay(e[4]).on("click",function(e){i.change(n).nextYear()})}),lay.each(i.table,function(e,t){lay(t).find("td").on("click",function(){i.choose(lay(this),e)})}),lay(i.footer).find("span").on("click",function(){var e=lay(this).attr("lay-type");i.tool(this,e)})},k.prototype.isInput=function(e){return/input|textarea/.test(e.tagName.toLocaleLowerCase())||/INPUT|TEXTAREA/.test(e.tagName)},k.prototype.events=function(){var e,t=this,a=t.config;a.elem[0]&&!a.elem[0].eventHandler&&(a.elem.on(a.trigger,e=function(){T.thisId!==a.id&&t.render()}),a.elem[0].eventHandler=!0,a.eventElem.on(a.trigger,e),t.unbind=function(){t.remove(),a.elem.off(a.trigger,e),a.elem.removeAttr("lay-key"),a.elem.removeAttr(d),a.elem[0].eventHandler=!1,a.eventElem.off(a.trigger,e),a.eventElem.removeAttr("lay-key"),delete s.that[a.id]})},s.that={},s.getThis=function(e){var t=s.that[e];return!t&&n&&layui.hint().error(e?a+" instance with ID '"+e+"' not found":"ID argument required"),t},l.run=function(n){n(D).on("mousedown",function(e){var t,a;T.thisId&&(t=s.getThis(T.thisId))&&(a=t.config,e.target===a.elem[0]||e.target===a.eventElem[0]||e.target===n(a.closeStop)[0]||a.elem[0]&&a.elem[0].contains(e.target)||t.remove())}).on("keydown",function(e){var t;T.thisId&&(t=s.getThis(T.thisId))&&"static"!==t.config.position&&13===e.keyCode&&n("#"+t.elemID)[0]&&t.elemID===k.thisElemDate&&(e.preventDefault(),n(t.footer).find(E)[0].click())}),n(i).on("resize",function(){if(T.thisId){var e=s.getThis(T.thisId);if(e)return!(!e.elem||!n(".layui-laydate")[0])&&void e.position()}})},T.render=function(e){e=new k(e);return s.call(e)},T.reload=function(e,t){e=s.getThis(e);if(e)return e.reload(t)},T.getInst=function(e){e=s.getThis(e);if(e)return e.inst},T.hint=function(e,t){e=s.getThis(e);if(e)return e.hint(t)},T.unbind=function(e){e=s.getThis(e);if(e)return e.unbind()},T.close=function(e){e=s.getThis(e||T.thisId);if(e)return e.remove()},T.parse=function(a,n,i){return a=a||{},n=((n="string"==typeof n?s.formatArr(n):n)||[]).concat(),lay.each(n,function(e,t){/yyyy|y/.test(t)?n[e]=lay.digit(a.year,t.length):/MM|M/.test(t)?n[e]=lay.digit(a.month+(i||0),t.length):/dd|d/.test(t)?n[e]=lay.digit(a.date,t.length):/HH|H/.test(t)?n[e]=lay.digit(a.hours,t.length):/mm|m/.test(t)?n[e]=lay.digit(a.minutes,t.length):/ss|s/.test(t)&&(n[e]=lay.digit(a.seconds,t.length))}),n.join("")},T.getEndDate=function(e,t){var a=new Date;return a.setFullYear(t||a.getFullYear(),e||a.getMonth()+1,1),new Date(a.getTime()-864e5).getDate()},n?(T.ready(),layui.define("lay",function(e){T.path=layui.cache.dir,l.run(lay),e(a,T)})):"function"==typeof define&&define.amd?define(function(){return l.run(lay),T}):(T.ready(),l.run(i.lay),i.laydate=T)}(window,window.document);!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e):function(e){if(e.document)return t(e);throw new Error("jQuery requires a window with a document")}:t(e)}("undefined"!=typeof window?window:this,function(T,M){"use strict";var t=[],R=Object.getPrototypeOf,a=t.slice,I=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},W=t.push,b=t.indexOf,F={},$=F.toString,B=F.hasOwnProperty,_=B.toString,z=_.call(Object),g={},v=function v(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},X=function X(e){return null!=e&&e===e.window},C=T.document,U={type:!0,src:!0,nonce:!0,noModule:!0};function V(e,t,n){var r,i,o=(n=n||C).createElement("script");if(o.text=e,t)for(r in U)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function G(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?F[$.call(e)]||"object":typeof e}var e="3.7.1",Y=/HTML$/i,S=function(e,t){return new S.fn.init(e,t)};function J(e){var t=!!e&&"length"in e&&e.length,n=G(e);return!v(e)&&!X(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+n+")"+n+"*"),xe=new RegExp(n+"|>"),be=new RegExp(s),we=new RegExp("^"+e+"$"),Te={ID:new RegExp("^#("+e+")"),CLASS:new RegExp("^\\.("+e+")"),TAG:new RegExp("^("+e+"|[*])"),ATTR:new RegExp("^"+o),PSEUDO:new RegExp("^"+s),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+n+"*(even|odd|(([+-]|)(\\d*)n|)"+n+"*(?:([+-]|)"+n+"*(\\d+)|))"+n+"*\\)|)","i"),bool:new RegExp("^(?:"+ge+")$","i"),needsContext:new RegExp("^"+n+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+n+"*((?:-\\d)?\\d*)"+n+"*\\)|)(?=[^-]|$)","i")},Ce=/^(?:input|select|textarea|button)$/i,Se=/^h\d$/i,Ee=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ke=/[+~]/,f=new RegExp("\\\\[\\da-fA-F]{1,6}"+n+"?|\\\\([^\\r\\n\\f])","g"),d=function(e,t){e="0x"+e.slice(1)-65536;return t||(e<0?String.fromCharCode(65536+e):String.fromCharCode(e>>10|55296,1023&e|56320))},je=function(){Oe()},Ae=Ie(function(e){return!0===e.disabled&&x(e,"fieldset")},{dir:"parentNode",next:"legend"});try{j.apply(t=a.call(i.childNodes),i.childNodes),t[i.childNodes.length].nodeType}catch(sr){j={apply:function(e,t){ue.apply(e,a.call(t))},call:function(e){ue.apply(e,a.call(arguments,1))}}}function N(e,t,n,r){var i,o,s,a,u,l,c=t&&t.ownerDocument,f=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==f&&9!==f&&11!==f)return n;if(!r&&(Oe(t),t=t||E,k)){if(11!==f&&(a=Ee.exec(e)))if(i=a[1]){if(9===f){if(!(l=t.getElementById(i)))return n;if(l.id===i)return j.call(n,l),n}else if(c&&(l=c.getElementById(i))&&N.contains(t,l)&&l.id===i)return j.call(n,l),n}else{if(a[2])return j.apply(n,t.getElementsByTagName(e)),n;if((i=a[3])&&t.getElementsByClassName)return j.apply(n,t.getElementsByClassName(i)),n}if(!(pe[e+" "]||p&&p.test(e))){if(l=e,c=t,1===f&&(xe.test(e)||ve.test(e))){for((c=ke.test(e)&&He(t.parentNode)||t)==t&&g.scope||((s=t.getAttribute("id"))?s=S.escapeSelector(s):t.setAttribute("id",s=A)),o=(u=Me(e)).length;o--;)u[o]=(s?"#"+s:":scope")+" "+Re(u[o]);l=u.join(",")}try{return j.apply(n,c.querySelectorAll(l)),n}catch(d){pe(e,!0)}finally{s===A&&t.removeAttribute("id")}}}return _e(e.replace(ee,"$1"),t,n,r)}function De(){var n=[];function r(e,t){return n.push(e+" ")>w.cacheLength&&delete r[n.shift()],r[e+" "]=t}return r}function u(e){return e[A]=!0,e}function Ne(e){var t=E.createElement("fieldset");try{return!!e(t)}catch(sr){return!1}finally{t.parentNode&&t.parentNode.removeChild(t)}}function qe(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&Ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function Le(s){return u(function(o){return o=+o,u(function(e,t){for(var n,r=s([],e.length,o),i=r.length;i--;)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function He(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function Oe(e){var e=e?e.ownerDocument||e:i;return e!=E&&9===e.nodeType&&e.documentElement&&(r=(E=e).documentElement,k=!S.isXMLDoc(E),ae=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&i!=E&&(e=E.defaultView)&&e.top!==e&&e.addEventListener("unload",je),g.getById=Ne(function(e){return r.appendChild(e).id=S.expando,!E.getElementsByName||!E.getElementsByName(S.expando).length}),g.disconnectedMatch=Ne(function(e){return ae.call(e,"*")}),g.scope=Ne(function(){return E.querySelectorAll(":scope")}),g.cssHas=Ne(function(){try{E.querySelector(":has(*,:jqfake)")}catch(sr){return 1}}),g.getById?(w.filter.ID=function(e){var t=e.replace(f,d);return function(e){return e.getAttribute("id")===t}},w.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&k)return(e=t.getElementById(e))?[e]:[]}):(w.filter.ID=function(e){var t=e.replace(f,d);return function(e){e="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return e&&e.value===t}},w.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&k){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];for(i=t.getElementsByName(e),r=0;o=i[r++];)if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),w.find.TAG=function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},w.find.CLASS=function(e,t){if("undefined"!=typeof t.getElementsByClassName&&k)return t.getElementsByClassName(e)},p=[],Ne(function(e){var t;r.appendChild(e).innerHTML="",e.querySelectorAll("[selected]").length||p.push("\\["+n+"*(?:value|"+ge+")"),e.querySelectorAll("[id~="+A+"-]").length||p.push("~="),e.querySelectorAll("a#"+A+"+*").length||p.push(".#.+[+~]"),e.querySelectorAll(":checked").length||p.push(":checked"),(t=E.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&p.push(":enabled",":disabled"),(t=E.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||p.push("\\["+n+"*name"+n+"*="+n+"*(?:''|\"\")")}),g.cssHas||p.push(":has"),p=p.length&&new RegExp(p.join("|")),he=function(e,t){var n;return e===t?(se=!0,0):(n=!e.compareDocumentPosition-!t.compareDocumentPosition)||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!g.sortDetached&&t.compareDocumentPosition(e)===n?e===E||e.ownerDocument==i&&N.contains(i,e)?-1:t===E||t.ownerDocument==i&&N.contains(i,t)?1:oe?b.call(oe,e)-b.call(oe,t):0:4&n?-1:1)}),E}for(re in N.matches=function(e,t){return N(e,null,null,t)},N.matchesSelector=function(e,t){if(Oe(e),k&&!pe[t+" "]&&(!p||!p.test(t)))try{var n=ae.call(e,t);if(n||g.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(sr){pe(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(f,d),e[3]=(e[3]||e[4]||e[5]||"").replace(f,d),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||N.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&N.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return Te.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&be.test(n)&&(t=(t=Me(n,!0))&&n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(f,d).toLowerCase();return"*"===e?function(){return!0}:function(e){return x(e,t)}},CLASS:function(e){var t=ce[e+" "];return t||(t=new RegExp("(^|"+n+")"+e+"("+n+"|$)"))&&ce(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(t,n,r){return function(e){e=N.attr(e,t);return null==e?"!="===n:!n||(e+="","="===n?e===r:"!="===n?e!==r:"^="===n?r&&0===e.indexOf(r):"*="===n?r&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function Ge(e,n,r){return v(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/,Ke=((S.fn.init=function(e,t,n){if(e){if(n=n||Ye,"string"!=typeof e)return e.nodeType?(this[0]=e,this.length=1,this):v(e)?n.ready!==undefined?n.ready(e):e(S):S.makeArray(e,this);if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:Je.exec(e))||!r[1]&&t)return(!t||t.jquery?t||n:this.constructor(t)).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),Ve.test(r[1])&&S.isPlainObject(t))for(var r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r])}else(n=C.getElementById(r[2]))&&(this[0]=n,this.length=1)}return this}).prototype=S.fn,Ye=S(C),/^(?:parents|prev(?:Until|All))/),Qe={children:!0,contents:!0,next:!0,prev:!0};function Ze(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,Et=/^$|^module$|\/(?:java|ecma)script/i,h=(o=C.createDocumentFragment().appendChild(C.createElement("div")),(s=C.createElement("input")).setAttribute("type","radio"),s.setAttribute("checked","checked"),s.setAttribute("name","t"),o.appendChild(s),g.checkClone=o.cloneNode(!0).cloneNode(!0).lastChild.checked,o.innerHTML="",g.noCloneChecked=!!o.cloneNode(!0).lastChild.defaultValue,o.innerHTML="",g.option=!!o.lastChild,{thead:[1,"","
      "],col:[2,"","
      "],tr:[2,"","
      "],td:[3,"","
      "],_default:[0,"",""]});function y(e,t){var n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[];return t===undefined||t&&x(e,t)?S.merge([e],n):n}function kt(e,t){for(var n=0,r=e.length;n",""]);var jt=/<|&#?\w+;/;function At(e,t,n,r,i){for(var o,s,a,u,l,c=t.createDocumentFragment(),f=[],d=0,p=e.length;d\s*$/g;function Rt(e,t){return x(e,"table")&&x(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function It(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Wt(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Ft(e,t){var n,r,i,o;if(1===t.nodeType){if(m.hasData(e)&&(o=m.get(e).events))for(i in m.remove(t,"handle events"),o)for(n=0,r=o[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),C.head.appendChild(r[0])},abort:function(){i&&i()}}}),[]),ir=/(=)\?(?=&|$)|\?\?/,or=(S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=rr.pop()||S.expando+"_"+Hn.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,s=!1!==e.jsonp&&(ir.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&ir.test(e.data)&&"data");if(s||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,s?e[s]=e[s].replace(ir,"$1"+r):!1!==e.jsonp&&(e.url+=(On.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=T[r],T[r]=function(){o=arguments},n.always(function(){i===undefined?S(T).removeProp(r):T[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,rr.push(r)),o&&v(i)&&i(o[0]),o=i=undefined}),"script"}),g.createHTMLDocument=((e=C.implementation.createHTMLDocument("").body).innerHTML="
      ",2===e.childNodes.length),S.parseHTML=function(e,t,n){var r;return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(g.createHTMLDocument?((r=(t=C.implementation.createHTMLDocument("")).createElement("base")).href=C.location.href,t.head.appendChild(r)):t=C),r=!n&&[],(n=Ve.exec(e))?[t.createElement(n[1])]:(n=At([e],t,r),r&&r.length&&S(r).remove(),S.merge([],n.childNodes)))},S.fn.load=function(e,t,n){var r,i,o,s=this,a=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){s.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,s,a=S.css(e,"position"),u=S(e),l={};"static"===a&&(e.style.position="relative"),o=u.offset(),r=S.css(e,"top"),s=S.css(e,"left"),a=("absolute"===a||"fixed"===a)&&-1<(r+s).indexOf("auto")?(i=(a=u.position()).top,a.left):(i=parseFloat(r)||0,parseFloat(s)||0),null!=(t=v(t)?t.call(e,n,S.extend({},o)):t).top&&(l.top=t.top-o.top+i),null!=t.left&&(l.left=t.left-o.left+a),"using"in t?t.using.call(e,l):u.css(l)}},S.fn.extend({offset:function(t){var e,n;return arguments.length?t===undefined?this:this.each(function(e){S.offset.setOffset(this,t,e)}):(n=this[0])?n.getClientRects().length?(e=n.getBoundingClientRect(),n=n.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{for(t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position");)e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===S.css(e,"position");)e=e.offsetParent;return e||yt})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return c(this,function(e,t,n){var r;if(X(e)?r=e:9===e.nodeType&&(r=e.defaultView),n===undefined)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=on(g.pixelPosition,function(e,t){if(t)return t=rn(e,n),Jt.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(s,a){S.each({padding:"inner"+s,content:a,"":"outer"+s},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return c(this,function(e,t,n){var r;return X(e)?0===o.indexOf("outer")?e["inner"+s]:e.document.documentElement["client"+s]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+s],r["scroll"+s],e.body["offset"+s],r["offset"+s],r["client"+s])):n===undefined?S.css(e,t,i):S.style(e,t,n,i)},a,n?e:undefined,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.on("mouseenter",e).on("mouseleave",t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0'+(s?a.title[0]:a.title)+"
      ":"";return a.zIndex=o,t([a.shade?'
      ':"",'
      '+(e&&2!=a.type?"":s)+"'+(n=["layui-icon-tips","layui-icon-success","layui-icon-error","layui-icon-question","layui-icon-lock","layui-icon-face-cry","layui-icon-face-smile"],o="layui-anim layui-anim-rotate layui-anim-loop",0==a.type&&-1!==a.icon?'':3==a.type?(i=["layui-icon-loading","layui-icon-loading-1"],2==a.icon?'
      ':''):"")+((1!=a.type||!e)&&a.content||"")+'
      '+(n=[],r&&(n.push(''),n.push('')),a.closeBtn&&n.push(''),n.join(""))+"
      "+(a.btn?function(){var e="";"string"==typeof a.btn&&(a.btn=[a.btn]);for(var t,i=0,n=a.btn.length;i'+a.btn[i]+"";return'
      '+e+"
      "}():"")+(a.resize?'':"")+"
      "],s,h('
      ')),this},t.pt.creat=function(){var e,t,i,n,a=this,o=a.config,s=a.index,r="object"==typeof(d=o.content),l=h("body"),c=function(e){var t;o.shift&&(o.anim=o.shift),u.anim[o.anim]&&(t="layer-anim "+u.anim[o.anim],e.addClass(t).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){h(this).removeClass(t)}))};if(o.id&&h("."+u[0]).find("#"+o.id)[0])e=h("#"+o.id).closest("."+u[0]),t=e.attr("times"),i=e.data("config"),n=h("#"+u.SHADE+t),"min"===(e.data("maxminStatus")||{})?v.restore(t):i.hideOnClose&&(n.show(),e.show(),c(e),setTimeout(function(){n.css({opacity:n.data(y)})},10));else{switch(o.removeFocus&&document.activeElement&&document.activeElement.blur(),"string"==typeof o.area&&(o.area="auto"===o.area?["",""]:[o.area,""]),6==v.ie&&(o.fixed=!1),o.type){case 0:o.btn="btn"in o?o.btn:f.btn[0],v.closeAll("dialog");break;case 2:var d=o.content=r?o.content:[o.content||"","auto"];o.content='';break;case 3:delete o.title,delete o.closeBtn,-1===o.icon&&o.icon,v.closeAll("loading");break;case 4:r||(o.content=[o.content,"body"]),o.follow=o.content[1],o.content=o.content[0]+'',delete o.title,o.tips="object"==typeof o.tips?o.tips:[o.tips,!0],o.tipsMore||v.closeAll("tips")}a.vessel(r,function(e,t,i){l.append(e[0]),r?2==o.type||4==o.type?h("body").append(e[1]):d.parents("."+u[0])[0]||(d.data("display",d.css("display")).show().addClass("layui-layer-wrap").wrap(e[1]),h("#"+u[0]+s).find("."+u[5]).before(t)):l.append(e[1]),h("#"+u.MOVE)[0]||l.append(f.moveElem=i),a.layero=h("#"+u[0]+s),a.shadeo=h("#"+u.SHADE+s),o.scrollbar||f.setScrollbar(s)}).auto(s),a.shadeo.css({"background-color":o.shade[1]||"#000",opacity:o.shade[0]||o.shade,transition:o.shade[2]||""}),a.shadeo.data(y,o.shade[0]||o.shade),2==o.type&&6==v.ie&&a.layero.find("iframe").attr("src",d[0]),4==o.type?a.tips():(a.offset(),parseInt(f.getStyle(document.getElementById(u.MOVE),"z-index"))||(a.layero.css("visibility","hidden"),v.ready(function(){a.offset(),a.layero.css("visibility","visible")}))),!o.fixed||f.events.resize[a.index]||(f.events.resize[a.index]=function(){a.resize()},g.on("resize",f.events.resize[a.index])),a.layero.data("config",o),o.time<=0||setTimeout(function(){v.close(a.index)},o.time),a.move().callback(),c(a.layero)}},t.pt.resize=function(){var e=this,t=e.config;e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(e.index),4==t.type&&e.tips()},t.pt.auto=function(e){var t=this.config,i=h("#"+u[0]+e),n=((""===t.area[0]||"auto"===t.area[0])&&0t.maxWidth)&&i.width(t.maxWidth),[i.innerWidth(),i.innerHeight()]),a=i.find(u[1]).outerHeight()||0,o=i.find("."+u[6]).outerHeight()||0,e=function(e){(e=i.find(e)).height(n[1]-a-o-2*(0|parseFloat(e.css("padding-top"))))};return 2===t.type?e("iframe"):""===t.area[1]||"auto"===t.area[1]?0t.maxHeight?(n[1]=t.maxHeight,e("."+u[5])):t.fixed&&n[1]>=g.height()&&(n[1]=g.height(),e("."+u[5])):e("."+u[5]),this},t.pt.offset=function(){var e=this,t=e.config,i=e.layero,n=[i.outerWidth(),i.outerHeight()],a="object"==typeof t.offset;e.offsetTop=(g.height()-n[1])/2,e.offsetLeft=(g.width()-n[0])/2,a?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=g.width()-n[0]:"b"===t.offset?e.offsetTop=g.height()-n[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=g.height()-n[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=g.width()-n[0]):"rb"===t.offset?(e.offsetTop=g.height()-n[1],e.offsetLeft=g.width()-n[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?g.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?g.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=g.scrollTop(),e.offsetLeft+=g.scrollLeft()),"min"===i.data("maxminStatus")&&(e.offsetTop=g.height()-(i.find(u[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},t.pt.tips=function(){var e=this.config,t=this.layero,i=[t.outerWidth(),t.outerHeight()],n=h(e.follow),a={width:(n=n[0]?n:h("body")).outerWidth(),height:n.outerHeight(),top:n.offset().top,left:n.offset().left},o=t.find(".layui-layer-TipsG"),n=e.tips[0];e.tips[1]||o.remove(),a.autoLeft=function(){0'):e.removeClass("layui-layer-btn-is-loading").removeAttr("disabled").find(".layui-layer-btn-loading-icon").remove()},t.pt.callback=function(){var n=this,a=n.layero,o=n.config;n.openLayer(),o.success&&(2==o.type?a.find("iframe").on("load",function(){o.success(a,n.index,n)}):o.success(a,n.index,n)),6==v.ie&&n.IE6(a),a.find("."+u[6]).children("a").on("click",function(){var e,t=h(this),i=t.index();t.attr("disabled")||(o.btnAsync?(e=0===i?o.yes||o.btn1:o["btn"+(i+1)],n.loading=function(e){n.btnLoading(t,e)},e?f.promiseLikeResolve(e.call(o,n.index,a,n)).then(function(e){!1!==e&&v.close(n.index)},function(e){e!==m&&p.console&&p.console.error("layer error hint: "+e)}):v.close(n.index)):0===i?o.yes?o.yes(n.index,a,n):o.btn1?o.btn1(n.index,a,n):v.close(n.index):!1!==(o["btn"+(i+1)]&&o["btn"+(i+1)](n.index,a,n))&&v.close(n.index))}),a.find("."+u[7]).on("click",function(){!1!==(o.cancel&&o.cancel(n.index,a,n))&&v.close(n.index)}),o.shadeClose&&n.shadeo.on("click",function(){v.close(n.index)}),a.find(".layui-layer-min").on("click",function(){!1!==(o.min&&o.min(a,n.index,n))&&v.min(n.index,o)}),a.find(".layui-layer-max").on("click",function(){h(this).hasClass("layui-layer-maxmin")?(v.restore(n.index),o.restore&&o.restore(a,n.index,n)):(v.full(n.index,o),setTimeout(function(){o.full&&o.full(a,n.index,n)},100))}),o.end&&(f.end[n.index]=o.end),o.beforeEnd&&(f.beforeEnd[n.index]=h.proxy(o.beforeEnd,o,a,n.index,n))},f.reselect=function(){h.each(h("select"),function(e,t){var i=h(this);i.parents("."+u[0])[0]||1==i.attr("layer")&&h("."+u[0]).length<1&&i.removeAttr("layer").show()})},t.pt.IE6=function(e){h("select").each(function(e,t){var i=h(this);i.parents("."+u[0])[0]||"none"!==i.css("display")&&i.attr({layer:"1"}).hide()})},t.pt.openLayer=function(){v.zIndex=this.config.zIndex,v.setTop=function(e){return v.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",function(){v.zIndex++,e.css("z-index",v.zIndex+1)}),v.zIndex}},f.record=function(e){if(!e[0])return p.console&&console.error("index error");var t=e.attr("type"),i=e.find(".layui-layer-content"),t=t===f.type[2]?i.children("iframe"):i,n=[e[0].style.width||f.getStyle(e[0],"width"),e[0].style.height||f.getStyle(e[0],"height"),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:n}),i.data(l,f.getStyle(t[0],"height"))},f.setScrollbar=function(e){u.html.css("overflow","hidden")},f.restScrollbar=function(t){u.html.css("overflow")&&0===h("."+u[0]).filter(function(){var e=h(this);return!1===(e.data("config")||{}).scrollbar&&"min"!==e.data("maxminStatus")&&e.attr("times")!==String(t)}).length&&u.html.css("overflow","")},f.promiseLikeResolve=function(e){var t=h.Deferred();return e&&"function"==typeof e.then?e.then(t.resolve,t.reject):t.resolve(e),t.promise()},(p.layer=v).getChildFrame=function(e,t){return t=t||h("."+u[4]).attr("times"),h("#"+u[0]+t).find("iframe").contents().find(e)},v.getFrameIndex=function(e){if(e)return h("#"+e).parents("."+u[4]).attr("times")},v.iframeAuto=function(e){var t,i,n;e&&(t=v.getChildFrame("html",e).outerHeight(),i=(e=h("#"+u[0]+e)).find(u[1]).outerHeight()||0,n=e.find("."+u[6]).outerHeight()||0,e.css({height:t+i+n}),e.find("iframe").css({height:t}))},v.iframeSrc=function(e,t){h("#"+u[0]+e).find("iframe").attr("src",t)},v.style=function(e,t,i){var e=h("#"+u[0]+e),n=e.find(".layui-layer-content"),a=e.attr("type"),o=e.find(u[1]).outerHeight()||0,s=e.find("."+u[6]).outerHeight()||0;e.attr("minLeft");a!==f.type[3]&&a!==f.type[4]&&(i||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-o-s<=64&&(t.height=64+o+s)),e.css(t),s=e.find("."+u[6]).outerHeight()||0,a===f.type[2]?e.find("iframe").css({height:("number"==typeof t.height?t.height:e.height())-o-s}):n.css({height:("number"==typeof t.height?t.height:e.height())-o-s-parseFloat(n.css("padding-top"))-parseFloat(n.css("padding-bottom"))}))},v.min=function(e,t){var i,n,a,o,s,r,l=h("#"+u[0]+e),c=l.data("maxminStatus");"min"!==c&&("max"===c&&v.restore(e),l.data("maxminStatus","min"),t=t||l.data("config")||{},c=h("#"+u.SHADE+e),i=l.find(".layui-layer-min"),n=l.find(u[1]).outerHeight()||0,o=(a="string"==typeof(o=l.attr("minLeft")))?o:181*f.minStackIndex+"px",s=l.css("position"),r={width:180,height:n,position:"fixed",overflow:"hidden"},f.record(l),0g.width()&&(o=g.width()-180-(f.minStackArr.edgeIndex=f.minStackArr.edgeIndex||0,f.minStackArr.edgeIndex+=3))<0&&(o=0),t.minStack&&(r.left=o,r.top=g.height()-n,a||f.minStackIndex++,l.attr("minLeft",o)),l.attr("position",s),v.style(e,r,!0),i.hide(),"page"===l.attr("type")&&l.find(u[4]).hide(),f.restScrollbar(e),c.hide())},v.restore=function(e){var t=h("#"+u[0]+e),i=h("#"+u.SHADE+e),n=t.find(".layui-layer-content"),a=t.attr("area").split(","),o=t.attr("type"),s=t.data("config")||{},r=n.data(l);t.removeData("maxminStatus"),v.style(e,{width:a[0],height:a[1],top:parseFloat(a[2]),left:parseFloat(a[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===o&&t.find(u[4]).show(),s.scrollbar?f.restScrollbar(e):f.setScrollbar(e),r!==m&&(n.removeData(l),(o===f.type[2]?n.children("iframe"):n).css({height:r})),i.show()},v.full=function(t){var i=h("#"+u[0]+t),e=i.data("maxminStatus");"max"!==e&&("min"===e&&v.restore(t),i.data("maxminStatus","max"),f.record(i),f.setScrollbar(t),setTimeout(function(){var e="fixed"===i.css("position");v.style(t,{top:e?0:g.scrollTop(),left:e?0:g.scrollLeft(),width:"100%",height:"100%"},!0),i.find(".layui-layer-min").hide()},100))},v.title=function(e,t){h("#"+u[0]+(t||v.index)).find(u[1]).html(e)},v.close=function(s,r){var e,t,l=(e=h("."+u[0]).children("#"+s).closest("."+u[0]))[0]?(s=e.attr("times"),e):h("#"+u[0]+s),c=l.attr("type"),i=l.data("config")||{},d=i.id&&i.hideOnClose;l[0]&&(t=function(){var o={slideDown:"layer-anim-slide-down-out",slideLeft:"layer-anim-slide-left-out",slideUp:"layer-anim-slide-up-out",slideRight:"layer-anim-slide-right-out"}[i.anim]||"layer-anim-close",e=function(){var e="layui-layer-wrap";if(d)return l.removeClass("layer-anim "+o),l.hide();if(c===f.type[1]&&"object"===l.attr("conType")){l.children(":not(."+u[5]+")").remove();for(var t=l.find("."+e),i=0;i<2;i++)t.unwrap();t.css("display",t.data("display")).removeClass(e)}else{if(c===f.type[2])try{var n=h("#"+u[4]+s)[0];n.contentWindow.document.write(""),n.contentWindow.close(),l.find("."+u[5])[0].removeChild(n)}catch(a){}l[0].innerHTML="",l.remove()}"function"==typeof f.end[s]&&f.end[s](),delete f.end[s],"function"==typeof r&&r(),f.events.resize[s]&&(g.off("resize",f.events.resize[s]),delete f.events.resize[s])},t=h("#"+u.SHADE+s);v.ie&&v.ie<10||!i.isOutAnim?t[d?"hide":"remove"]():(t.css({opacity:0}),setTimeout(function(){t[d?"hide":"remove"]()},350)),i.isOutAnim&&l.addClass("layer-anim "+o),6==v.ie&&f.reselect(),f.restScrollbar(s),"string"==typeof l.attr("minLeft")&&(f.minStackIndex--,f.minStackArr.push(l.attr("minLeft"))),v.ie&&v.ie<10||!i.isOutAnim?e():setTimeout(function(){e()},200)},d||"function"!=typeof f.beforeEnd[s]?(delete f.beforeEnd[s],t()):f.promiseLikeResolve(f.beforeEnd[s]()).then(function(e){!1!==e&&(delete f.beforeEnd[s],t())},function(e){e!==m&&p.console&&p.console.error("layer error hint: "+e)}))},v.closeAll=function(n,a){"function"==typeof n&&(a=n,n=null);var o=h("."+u[0]);h.each(o,function(e){var t=h(this),i=n?t.attr("type")===n:1;i&&v.close(t.attr("times"),e===o.length-1?a:null)}),0===o.length&&"function"==typeof a&&a()},v.closeLast=function(i,e){var t,n=[],a=h.isArray(i);h("string"==typeof i?".layui-layer-"+i:".layui-layer").each(function(e,t){t=h(t);if(a&&-1===i.indexOf(t.attr("type"))||"none"===t.css("display"))return!0;n.push(Number(t.attr("times")))}),0":'",s=i.success;return delete i.success,v.open(h.extend({type:1,btn:["\u786e\u5b9a","\u53d6\u6d88"],content:o,skin:"layui-layer-prompt"+x("prompt"),maxWidth:g.width(),success:function(e){(a=e.find(".layui-layer-input")).val(i.value||"").focus(),"function"==typeof s&&s(e)},resize:!1,yes:function(e){var t=a.val();t.length>(i.maxlength||500)?v.tips("\u6700\u591a\u8f93\u5165"+(i.maxlength||500)+"\u4e2a\u5b57\u7b26",a,{tips:1}):n&&n(t,e,a)}},i))},v.tab=function(n){var a=(n=n||{}).tab||{},o="layui-this",s=n.success;return delete n.success,v.open(h.extend({type:1,skin:"layui-layer-tab"+x("tab"),resize:!1,title:function(){var e=a.length,t=1,i="";if(0'+a[0].title+"";t"+a[t].title+"";return i}(),content:'
        '+function(){var e=a.length,t=1,i="";if(0'+(a[0].content||"no content")+"";t'+(a[t].content||"no content")+"";return i}()+"
      ",success:function(e){var t=e.find(".layui-layer-title").children(),i=e.find(".layui-layer-tabmain").children();t.on("mousedown",function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0;var e=h(this),t=e.index();e.addClass(o).siblings().removeClass(o),i.eq(t).show().siblings().hide(),"function"==typeof n.change&&n.change(t)}),"function"==typeof s&&s(e)}},n))},v.photos=function(n,e,a){var s={};if((n=h.extend(!0,{toolbar:!0,footer:!0},n)).photos){var t=!("string"==typeof n.photos||n.photos instanceof h),i=t?n.photos:{},o=i.data||[],r=i.start||0,l=n.success;if(s.imgIndex=1+(0|r),n.img=n.img||"img",delete n.success,t){if(0===o.length)return v.msg("\u6ca1\u6709\u56fe\u7247")}else{var c=h(n.photos),d=function(){o=[],c.find(n.img).each(function(e){var t=h(this);t.attr("layer-index",e),o.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("lay-src")||t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(d(),e||c.on("click",n.img,function(){d();var e=h(this).attr("layer-index");v.photos(h.extend(n,{photos:{start:e,data:o,tab:n.tab},full:n.full}),!0)}),!e)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=o.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>o.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){var t;s.end||(t=e.keyCode,e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&v.close(s.index))},s.tabimg=function(e){if(!(o.length<=1))return i.start=s.imgIndex-1,v.close(s.index),v.photos(n,!0,e)},s.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},s.image={},s.getTransform=function(e){var t=[],i=e.rotate,n=e.scaleX,e=e.scale;return s.isNumber(i)&&0!==i&&t.push("rotate("+i+"deg)"),s.isNumber(n)&&1!==n&&t.push("scaleX("+n+")"),s.isNumber(e)&&t.push("scale("+e+")"),t.length?t.join(" "):"none"},s.event=function(e,i,n){var a,o;s.main.find(".layui-layer-photos-prev").on("click",function(e){e.preventDefault(),s.imgprev(!0)}),s.main.find(".layui-layer-photos-next").on("click",function(e){e.preventDefault(),s.imgnext(!0)}),h(document).on("keyup",s.keyup),e.off("click").on("click","*[toolbar-event]",function(){var e=h(this);switch(e.attr("toolbar-event")){case"rotate":s.image.rotate=((s.image.rotate||0)+Number(e.attr("data-option")))%360,s.imgElem.css({transform:s.getTransform(s.image)});break;case"scalex":s.image.scaleX=-1===s.image.scaleX?1:-1,s.imgElem.css({transform:s.getTransform(s.image)});break;case"zoom":var t=Number(e.attr("data-option"));s.image.scale=(s.image.scale||1)+t,t<0&&s.image.scale<0-t&&(s.image.scale=0-t),s.imgElem.css({transform:s.getTransform(s.image)});break;case"reset":s.image.scaleX=1,s.image.scale=1,s.image.rotate=0,s.imgElem.css({transform:"none"});break;case"close":v.close(i)}n.offset(),n.auto(i)}),s.main.on("mousewheel DOMMouseScroll",function(e){var t=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=s.main.find('[toolbar-event="zoom"]');(0n)&&("left"===t.direction?s.imgnext(!0):"right"===t.direction&&s.imgprev(!0))},h.each([n.shadeo,s.main],function(e,t){a.touchSwipe(t,{onTouchEnd:o})}))},s.loadi=v.load(1,{shade:!("shade"in n)&&[.9,m,"unset"],scrollbar:!1});var t=o[r].src,f=function(e){v.close(s.loadi);var t,i=o[r].alt||"";a&&(n.anim=-1),s.index=v.open(h.extend({type:1,id:"layui-layer-photos",area:(e=[e.width,e.height],t=[h(p).width()-100,h(p).height()-100],!n.full&&(t[0]'+i+''+(t=['
      '],1','','',"
      "].join("")),n.toolbar&&t.push(['
      ','','','','','','',"
      "].join("")),n.footer&&t.push(['"].join("")),t.push("
      "),t.join(""))+"",success:function(e,t,i){s.main=e.find(".layer-layer-photos-main"),s.footer=e.find(".layui-layer-photos-footer"),s.imgElem=s.main.children("img"),s.event(e,t,i),n.tab&&n.tab(o[r],e),"function"==typeof l&&l(e)},end:function(){s.end=!0,h(document).off("keyup",s.keyup)}},n))},u=function(){v.close(s.loadi),v.msg("\u5f53\u524d\u56fe\u7247\u5730\u5740\u5f02\u5e38\uff0c
      \u662f\u5426\u7ee7\u7eed\u67e5\u770b\u4e0b\u4e00\u5f20\uff1f",{time:3e4,btn:["\u4e0b\u4e00\u5f20","\u4e0d\u770b\u4e86"],yes:function(){1").addClass(o));layui.each(i.bars,function(t,e){var n=s('
    • ');n.addClass(e.icon).attr({"lay-type":e.type,style:e.style||(i.bgcolor?"background-color: "+i.bgcolor:"")}).html(e.content),n.on("click",function(){var t=s(this).attr("lay-type");"top"===t&&("body"===i.target?s("html,body"):c).animate({scrollTop:0},i.duration),"function"==typeof i.click&&i.click.call(this,t)}),"object"===layui.type(i.on)&&layui.each(i.on,function(t,e){n.on(t,function(){var t=s(this).attr("lay-type");"function"==typeof e&&e.call(this,t)})}),"top"===e.type&&(n.addClass("layui-fixbar-top"),r=n),l.append(n)}),u.find("."+o).remove(),"object"==typeof i.css&&l.css(i.css),u.append(l),r&&(e=function e(){return c.scrollTop()>=i.margin?t||(r.show(),t=1):t&&(r.hide(),t=0),e}()),c.on("scroll",function(){e&&(clearTimeout(n),n=setTimeout(function(){e()},100))})},countdown:function(i){i=s.extend(!0,{date:new Date,now:new Date},i);var r=arguments,o=(1]|&(?=#?[a-zA-Z0-9]+)/g.test(t+="")?t.replace(/&(?=#?[a-zA-Z0-9]+;?)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,"""):t},unescape:function(t){return t===undefined||null===t?"":String(t).replace(/\"/g,'"').replace(/\'/g,"'").replace(/\>/g,">").replace(/\</g,"<").replace(/\&/g,"&")},openWin:function(t){var e=(t=t||{}).window||window.open(t.url||"",t.target,t.specs);t.url||(e.document.open("text/html","replace"),e.document.write(t.content||""),e.document.close())},toVisibleArea:function(t){var e,n,i,r,o,a,u,c;(t=s.extend({margin:160,duration:200,type:"y"},t)).scrollElem[0]&&t.thisElem[0]&&(u=t.thisElem,i=(o="y"===t.type)?"top":"left",r=(e=t.scrollElem)[n=o?"scrollTop":"scrollLeft"](),o=e[o?"height":"width"](),a=e.offset()[i],c={},(u=u.offset()[i]-a)>o-t.margin||u."+v,T=function(e){var i=this;i.index=++h.index,i.config=c.extend({},i.config,h.config,e),i.init()};T.prototype.config={trigger:"click",content:"",className:"",style:"",show:!1,isAllowSpread:!0,isSpreadItem:!0,data:[],delay:[200,300],shade:0,accordion:!1,closeOnClick:!0},T.prototype.reload=function(e,i){var t=this;t.config=c.extend({},t.config,e),t.init(!0,i)},T.prototype.init=function(e,i){var t=this,n=t.config,a=c(n.elem);return 1",(t="href"in i?''+o+"":o,n?'
      '+t+("parent"===l?'':"group"===l&&d.isAllowSpread?'':"")+"
      ":'
      '+t+"
      "),"
    • "].join(""))).data("item",i),n&&(a=c('
      '),t=c("
        "),"parent"===l?(a.append(u(t,i[s.children])),o.append(a)):o.append(u(t,i[s.children]))),r.append(o))}),r},t=['
        ',"
        "].join(""),n=d.content||(n=c('
          '),0\u6682\u65e0\u6570\u636e'),n),a=g.findMainElem(d.id);"reloadData"===e&&a.length?(i=o.mainElem=a).html(n):((i=o.mainElem=c(t)).append(n),i.addClass(d.className),i.attr("style",d.style),o.remove(h.thisId),d.target.append(i),d.elem.data(f,!0),e=d.shade?'
          ':"",i.before(e),"mouseenter"===d.trigger&&i.on("mouseenter",function(){clearTimeout(g.timer)}).on("mouseleave",function(){o.delayRemove()})),o.position(),h.thisId=d.id,i.find(".layui-menu").on(l,function(e){layui.stope(e)}),i.find(".layui-menu li").on("click",function(e){var i=c(this),t=i.data("item")||{},n=t[s.children]&&0n.width()&&(t.addClass(x),(i=t[0].getBoundingClientRect()).left<0)&&t.removeClass(x),i.bottom>n.height())&&t.eq(0).css("margin-top",-(i.bottom-n.height()+5))}).on("mouseleave",t,function(e){var i=c(this).children("."+C);i.removeClass(x),i.css("margin-top",0)}),h.close=function(e){e=g.getThis(e);return e?(e.remove(),g.call(e)):this},h.open=function(e){e=g.getThis(e);return e?(e.render(),g.call(e)):this},h.reload=function(e,i,t){e=g.getThis(e);return e?(e.reload(i,t),g.call(e)):this},h.reloadData=function(){var t=c.extend([],arguments),n=(t[2]="reloadData",new RegExp("^("+["data","templet","content"].join("|")+")$"));return layui.each(t[1],function(e,i){n.test(e)||delete t[1][e]}),h.reload.apply(null,t)},h.render=function(e){e=new T(e);return g.call(e)},e(r,h)});layui.define(["jquery","lay"],function(e){"use strict";var x=layui.$,b=layui.lay,m={config:{},index:layui.slider?layui.slider.index+1e4:0,set:function(e){var t=this;return t.config=x.extend({},t.config,e),t},on:function(e,t){return layui.onevent.call(this,i,e,t)}},i="slider",f="layui-disabled",T="layui-slider-bar",w="layui-slider-wrap",M="layui-slider-wrap-btn",L="layui-slider-tips",E="layui-slider-input-txt",Y="layui-slider-hover",t=function(e){var t=this;t.index=++m.index,t.config=x.extend({},t.config,m.config,e),t.render()};t.prototype.config={type:"default",min:0,max:100,value:0,step:1,showstep:!1,tips:!0,tipsAlways:!1,input:!1,range:!1,height:200,disabled:!1,theme:"#16baaa"},t.prototype.precision=function(){var e=this.config,e=x.map([e.min,e.max,e.step],function(e,t){e=String(e).split(".");return e[1]?e[1].length:0});return Math.max.apply(null,e)},t.prototype.render=function(){var n=this,a=n.config,e=x(a.elem);if(1a.max&&(a.value=a.max),l=(a.value-a.min)/(a.max-a.min)*100+"%");var t,e=a.disabled?"#c2c2c2":a.theme,i='
          '+(a.tips?'
          ":"")+'
          '+(a.range?'
          ':"")+"
          ",l=x(a.elem),s=l.next(".layui-slider");if(s[0]&&s.remove(),n.elemTemp=x(i),a.range?(n.elemTemp.find("."+w).eq(0).data("value",a.value[0]),n.elemTemp.find("."+w).eq(1).data("value",a.value[1])):n.elemTemp.find("."+w).data("value",a.value),l.html(n.elemTemp),"vertical"===a.type&&n.elemTemp.height(a.height+"px"),a.showstep){for(var o=(a.max-a.min)/a.step,r="",u=1;u<1+o;u++){var c=100*u/o;c<100&&(r+='
          ')}n.elemTemp.append(r)}function d(e){e=e.parent().data("value"),e=a.setTips?a.setTips(e):e;n.elemTemp.find("."+L).html(e)}function p(e){var t="vertical"===a.type?a.height:n.elemTemp[0].offsetWidth,i=n.elemTemp.find("."+w);return("vertical"===a.type?t-e.parent()[0].offsetTop-i.height():e.parent()[0].offsetLeft)/t*100}function v(e){"vertical"===a.type?n.elemTemp.find("."+L).css({bottom:e+"%","margin-bottom":"20px",display:"inline-block"}):n.elemTemp.find("."+L).css({left:e+"%",display:"inline-block"})}a.input&&!a.range&&(e=x('
          '),l.css("position","relative"),l.append(e),l.find("."+E).children("input").val(a.value),"vertical"===a.type?e.css({left:0,top:-48}):n.elemTemp.css("margin-right",e.outerWidth()+15)),a.disabled?(n.elemTemp.addClass(f),n.elemTemp.find("."+M).addClass(f)):n.slide(),a.tips&&(a.tipsAlways?(d(s=n.elemTemp.find("."+M)),v(p(s))):n.elemTemp.find("."+M).on("mouseover",function(){d(x(this));var e=p(x(this));clearTimeout(t),t=setTimeout(function(){v(e)},300)}).on("mouseout",function(){clearTimeout(t),a.tipsAlways||n.elemTemp.find("."+L).css("display","none")}))},t.prototype.slide=function(e,t,i){var u=this,c=u.config,d=u.elemTemp,p=function(){return"vertical"===c.type?c.height:d[0].offsetWidth},v=d.find("."+w),o=d.next(".layui-slider-input"),r=o.children("."+E).children("input").val(),m=100/((c.max-c.min)/c.step),f=u.precision(),h=function(e,t,i){e=(e=100<(e=100n[1]&&n.reverse(),u.value=c.range?n:l,c.change&&c.change(u.value),"done"===i&&c.done&&c.done(u.value)},y=function(e){var t=e/p()*100/m,i=Math.round(t)*m;return i=e==p()?Math.ceil(t)*m:i},g=x(['
          p()?p():t)/p()*100/m;h(t,o),r.addClass(Y),d.find("."+L).show(),e.preventDefault()},n=function(e){r.removeClass(Y),c.tipsAlways||setTimeout(function(){d.find("."+L).hide()},e)},a=function(){n&&n(b.touchEventsSupported()?1e3:0),g.remove(),c.done&&c.done(u.value),b.touchEventsSupported()&&(t[0].removeEventListener("touchmove",i,!!b.passiveSupported&&{passive:!1}),t[0].removeEventListener("touchend",a),t[0].removeEventListener("touchcancel",a))},x("#LAY-slider-moving")[0]||x("body").append(g),g.on("mousemove",i),g.on("mouseup",a).on("mouseleave",a),b.touchEventsSupported()&&(t[0].addEventListener("touchmove",i,!!b.passiveSupported&&{passive:!1}),t[0].addEventListener("touchend",a),t[0].addEventListener("touchcancel",a))})}),d.on("click",function(e){var t=x("."+M),i=x(this);!t.is(event.target)&&0===t.has(event.target).length&&t.length&&(i=(t=(t=(t="vertical"===c.type?p()-e.clientY+i.offset().top-x(window).scrollTop():e.clientX-i.offset().left-x(window).scrollLeft())<0?0:t)>p()?p():t)/p()*100/m,t=c.range?"vertical"===c.type?Math.abs(t-parseInt(x(v[0]).css("bottom")))>Math.abs(t-parseInt(x(v[1]).css("bottom")))?1:0:Math.abs(t-v[0].offsetLeft)>Math.abs(t-v[1].offsetLeft)?1:0:0,h(i,t,"done"),e.preventDefault())}),o.children(".layui-slider-input-btn").children("i").each(function(t){x(this).on("click",function(){r=o.children("."+E).children("input").val();var e=((r=1==t?r-c.stepc.max?c.max:Number(r)+c.step)-c.min)/(c.max-c.min)*100/m;h(e,0,"done")})});var n=function(){var e=this.value,e=(e=(e=(e=isNaN(e)?0:e)c.max?c.max:e,((this.value=e)-c.min)/(c.max-c.min)*100/m);h(e,0,"done")};o.children("."+E).children("input").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),n.call(this))}).on("change",n)},t.prototype.events=function(){this.config},m.render=function(e){e=new t(e);return function(){var i=this,n=i.config;return{setValue:function(e,t){return e=(e=e>n.max?n.max:e)',"",'','',"","","
          "].join("")),t=i.elem=x(i.elem);i.size&&o.addClass("layui-colorpicker-"+i.size),t.addClass("layui-inline").html(e.elemColorBox=o),i.id="id"in i?i.id:t.attr("id")||e.index,e.color=e.elemColorBox.find("."+T)[0].style.background,e.events()},s.prototype.renderPicker=function(){var o,e=this,i=e.config,t=e.elemColorBox[0],n=e.elemPicker=x(['
          ','
          ','
          ','
          ','
          ','
          ',"
          ",'
          ','
          ',"
          ","
          ",'
          ','
          ','
          ',"
          ","
          ",i.predefine?(o=['
          '],layui.each(i.colors,function(e,i){o.push(['
          ','
          ',"
          "].join(""))}),o.push("
          "),o.join("")):"",'
          ','
          ','',"
          ",'
          ','','',"","
          "].join(""));e.elemColorBox.find("."+T)[0];x(c)[0]&&x(c).data("index")==e.index?e.removePicker(s.thisElemInd):(e.removePicker(s.thisElemInd),x("body").append(n)),r.thisId=i.id,s.thisElemInd=e.index,s.thisColor=t.style.background,e.position(),e.pickerEvents()},s.prototype.removePicker=function(e){var i=this.config,e=x("#layui-colorpicker"+(e||this.index));return e[0]&&(e.remove(),delete r.thisId,"function"==typeof i.close)&&i.close(this.color),this},s.prototype.position=function(){var e=this,i=e.config;return P.position(e.bindElem||e.elemColorBox[0],e.elemPicker[0],{position:i.position,align:"center"}),e},s.prototype.val=function(){var e,i=this,o=(i.config,i.elemColorBox.find("."+T)),t=i.elemPicker.find("."+X),n=o[0].style.backgroundColor;n?(e=j(L(n)),o=o.attr("lay-type"),i.select(e.h,e.s,e.b),"torgb"===o?t.find("input").val(n):"rgba"===o?(o=L(n),3===(n.match(/[0-9]{1,3}/g)||[]).length?(t.find("input").val("rgba("+o.r+", "+o.g+", "+o.b+", 1)"),i.elemPicker.find("."+Y).css("left",280)):(t.find("input").val(n),n=280*n.slice(n.lastIndexOf(",")+1,n.length-1),i.elemPicker.find("."+Y).css("left",n)),i.elemPicker.find("."+D)[0].style.background="linear-gradient(to right, rgba("+o.r+", "+o.g+", "+o.b+", 0), rgb("+o.r+", "+o.g+", "+o.b+"))"):t.find("input").val("#"+H(e))):(i.select(0,100,100),t.find("input").val(""),i.elemPicker.find("."+D)[0].style.background="",i.elemPicker.find("."+Y).css("left",280))},s.prototype.side=function(){var r=this,l=r.config,c=r.elemColorBox.find("."+T),a=c.attr("lay-type"),s=r.elemPicker.find(".layui-colorpicker-side"),o=r.elemPicker.find("."+I),d=r.elemPicker.find("."+E),t=r.elemPicker.find("."+M),u=r.elemPicker.find("."+D),f=r.elemPicker.find("."+Y),p=o[0].offsetTop/180*360,h=100-t[0].offsetTop/180*100,g=t[0].offsetLeft/260*100,v=Math.round(f[0].offsetLeft/280*100)/100,m=r.elemColorBox.find("."+B),e=r.elemPicker.find(".layui-colorpicker-pre").children("div"),y=function(e,i,o,t){r.select(e,i,o);var n=F({h:e,s:i,b:o}),e=H({h:e,s:i,b:o}),i=r.elemPicker.find("."+X).find("input");m.addClass(C).removeClass(w),c[0].style.background="rgb("+n.r+", "+n.g+", "+n.b+")","torgb"===a?i.val("rgb("+n.r+", "+n.g+", "+n.b+")"):"rgba"===a?(f.css("left",280*t),i.val("rgba("+n.r+", "+n.g+", "+n.b+", "+t+")"),c[0].style.background="rgba("+n.r+", "+n.g+", "+n.b+", "+t+")",u[0].style.background="linear-gradient(to right, rgba("+n.r+", "+n.g+", "+n.b+", 0), rgb("+n.r+", "+n.g+", "+n.b+"))"):i.val("#"+e),l.change&&l.change(x.trim(r.elemPicker.find("."+X).find("input").val()))},i=x(['
          '].join("")),b=function(e){x("#LAY-colorpicker-moving")[0]||x("body").append(i),i.on("mousemove",e),i.on("mouseup",function(){i.remove()}).on("mouseleave",function(){i.remove()})},n=!0,k=!0;o.on("mousedown",function(e,i){var t=this.offsetTop,n=(e.clientY===undefined?i:e).clientY;k&&layui.stope(e),b(function(e){var i=t+(e.clientY-n),o=s[0].offsetHeight,o=(i=o<(i=i<0?0:i)?o:i)/180*360;y(p=o,g,h,v),e.preventDefault()}),e.preventDefault()}),s.on("mousedown",function(e){var i=e.clientY-x(this).offset().top+W.scrollTop(),i=(i=(i=i<0?0:i)>this.offsetHeight?this.offsetHeight:i)/180*360;y(p=i,g,h,v),e.preventDefault(),n&&o.trigger("mousedown",e)}),t.on("mousedown",function(e,i){var r=this.offsetTop,l=this.offsetLeft,c=(e.clientY===undefined?i:e).clientY,a=(e.clientX===undefined?i:e).clientX;k&&layui.stope(e),b(function(e){var i=r+(e.clientY-c),o=l+(e.clientX-a),t=d[0].offsetHeight,n=d[0].offsetWidth,n=(o=n<(o=o<0?0:o)?n:o)/260*100,o=100-(i=t<(i=i<0?0:i)?t:i)/180*100;y(p,g=n,h=o,v),e.preventDefault()}),e.preventDefault()}),d.on("mousedown",function(e){var i=e.clientY-x(this).offset().top+W.scrollTop(),o=e.clientX-x(this).offset().left+W.scrollLeft(),o=((i=i<0?0:i)>this.offsetHeight&&(i=this.offsetHeight),(o=(o=o<0?0:o)>this.offsetWidth?this.offsetWidth:o)/260*100),i=100-i/180*100;y(p,g=o,h=i,v),layui.stope(e),e.preventDefault(),n&&t.trigger("mousedown",e)}),f.on("mousedown",function(e,i){var t=this.offsetLeft,n=(e.clientX===undefined?i:e).clientX;k&&layui.stope(e),b(function(e){var i=t+(e.clientX-n),o=u[0].offsetWidth,o=(o<(i=i<0?0:i)&&(i=o),Math.round(i/280*100)/100);y(p,g,h,v=o),e.preventDefault()}),e.preventDefault()}),u.on("mousedown",function(e){var i=e.clientX-x(this).offset().left,i=((i=i<0?0:i)>this.offsetWidth&&(i=this.offsetWidth),Math.round(i/280*100)/100);y(p,g,h,v=i),e.preventDefault(),n&&f.trigger("mousedown",e)}),e.each(function(){x(this).on("click",function(){x(this).parent(".layui-colorpicker-pre").addClass("selected").siblings().removeClass("selected");var e=this.style.backgroundColor,i=j(L(e)),o=e.slice(e.lastIndexOf(",")+1,e.length-1);p=i.h,g=i.s,h=i.b,3===(e.match(/[0-9]{1,3}/g)||[]).length&&(o=1),v=o,y(i.h,i.s,i.b,o)})}),P.touchEventsSupported()&&layui.each([{elem:s,eventType:"mousedown"},{elem:u,eventType:"mousedown"},{elem:d,eventType:"mousedown"}],function(e,t){P.touchSwipe(t.elem,{onTouchStart:function(){k=n=!1},onTouchMove:function(e){var i,o;e=e,i=t.eventType,e=e.touches[0],(o=document.createEvent("MouseEvent")).initMouseEvent(i,!0,!0,window,1,e.screenX,e.screenY,e.clientX,e.clientY,!1,!1,!1,!1,0,null),e.target.dispatchEvent(o)},onTouchEnd:function(){i.remove(),k=n=!0}})})},s.prototype.select=function(e,i,o,t){this.config;var n=H({h:e,s:100,b:100}),e=(H({h:e,s:i,b:o}),e/360*180),o=180-o/100*180,i=i/100*260,r=this.elemPicker.find("."+E)[0];this.elemPicker.find("."+I).css("top",e),r.style.background="#"+n,this.elemPicker.find("."+M).css({top:o/r.offsetHeight*100+"%",left:i/r.offsetWidth*100+"%"})},s.prototype.pickerEvents=function(){var c=this,a=c.config,s=c.elemColorBox.find("."+T),d=c.elemPicker.find("."+X+" input"),o={clear:function(e){s[0].style.background="",c.elemColorBox.find("."+B).removeClass(C).addClass(w),c.color="",a.done&&a.done(""),c.removePicker()},confirm:function(e,i){var o,t,n,r,l=x.trim(d.val());-1>16,g:(65280&n)>>8,b:255&n},t=j(r),s[0].style.background=o="#"+H(t),c.elemColorBox.find("."+B).removeClass(w).addClass(C)),"change"===i?(c.select(t.h,t.s,t.b,i),a.change&&a.change(o)):(c.color=l,a.done&&a.done(l),c.removePicker())}};c.elemPicker.on("click","*[colorpicker-events]",function(){var e=x(this),i=e.attr("colorpicker-events");o[i]&&o[i].call(this,e)}),d.on("keyup",function(e){var i=x(this);o.confirm.call(this,i,13===e.keyCode?null:"change")})},s.prototype.events=function(){var e=this;e.config;e.elemColorBox.on("click",function(){e.renderPicker(),x(c)[0]&&(e.val(),e.side())})},a.on(i,function(e){var i,o,t;r.thisId&&(i=n.getThis(r.thisId))&&(o=i.config,t=i.elemColorBox.find("."+T),x(e.target).hasClass(l)||x(e.target).parents("."+l)[0]||x(e.target).hasClass(c.replace(/\./g,""))||x(e.target).parents(c)[0]||i.elemPicker&&(i.color?(e=j(L(i.color)),i.select(e.h,e.s,e.b)):i.elemColorBox.find("."+B).removeClass(C).addClass(w),t[0].style.background=i.color||"","function"==typeof o.cancel&&o.cancel(i.color),i.removePicker()))}),W.on("resize",function(){if(r.thisId){var e=n.getThis(r.thisId);if(e)return!(!e.elemPicker||!x(c)[0])&&void e.position()}}),n.that={},n.getThis=function(e){var i=n.that[e];return i||o.error(e?t+" instance with ID '"+e+"' not found":"ID argument required"),i},r.render=function(e){e=new s(e);return n.call(e)},e(t,r)});layui.define("jquery",function(t){"use strict";var u=layui.$,d=(layui.hint(),layui.device()),r="element",y="layui-this",f="layui-show",c=".layui-tab-title",i=function(){this.config={}},h=(i.prototype.set=function(t){return u.extend(!0,this.config,t),this},i.prototype.on=function(t,i){return layui.onevent.call(this,r,t,i)},i.prototype.tabAdd=function(t,i){var a,e=u(".layui-tab[lay-filter="+t+"]"),l=e.children(c),n=l.children(".layui-tab-bar"),s=e.children(".layui-tab-content"),o=""+(i.title||"unnaming")+"";return n[0]?n.before(o):l.append(o),s.append('
          "+(i.content||"")+"
          "),i.change&&this.tabChange(t,i.id),l.data("LAY_TAB_CHANGE",i.change),w.tabAuto(i.change?"change":null,e),this},i.prototype.tabDelete=function(t,i,a){t=u(".layui-tab[lay-filter="+t+"]").children(c).find('>li[lay-id="'+i+'"]');return w.tabDelete.call(t[0],{liElem:t,force:a}),this},i.prototype.tabChange=function(t,i,a){t=u(".layui-tab[lay-filter="+t+"]").children(c).find('>li[lay-id="'+i+'"]');return w.tabClick.call(t[0],{liElem:t,force:a}),this},i.prototype.tab=function(a){a=a||{},e.on("click",a.headerElem,function(t){var i=u(a.headerElem).index(u(this));w.tabClick.call(this,{index:i,options:a})})},i.prototype.progress=function(t,i){var a="layui-progress",t=u("."+a+"[lay-filter="+t+"]").find("."+a+"-bar"),a=t.find("."+a+"-text");return t.css("width",function(){return/^.+\/.+$/.test(i)?100*new Function("return "+i)()+"%":i}).attr("lay-percent",i),a.text(i),this},".layui-nav"),p="layui-nav-item",b="layui-nav-bar",v="layui-nav-tree",m="layui-nav-child",g="layui-nav-more",C="layui-anim layui-anim-upbit",w={tabClick:function(t){var i=(t=t||{}).options||{},a=t.liElem||u(this),e=i.headerElem?a.parent():a.parents(".layui-tab").eq(0),i=i.bodyElem?u(i.bodyElem):e.children(".layui-tab-content").children(".layui-tab-item"),l=a.find("a"),l="javascript:;"!==l.attr("href")&&"_blank"===l.attr("target"),n="string"==typeof a.attr("lay-unselect"),s=e.attr("lay-filter"),o=a.attr("lay-id"),c="index"in t?t.index:a.parent().children("li").index(a);if(!t.force){var t=a.siblings("."+y);if(!1===layui.event.call(this,r,"tabBeforeChange("+s+")",{elem:e,from:{index:a.parent().children("li").index(t),id:t.attr("lay-id")},to:{index:c,id:o}}))return}l||n||(a.addClass(y).siblings().removeClass(y),(o?t=(t=i.filter('[lay-id="'+o+'"]')).length?t:i.eq(c):i.eq(c)).addClass(f).siblings().removeClass(f)),layui.event.call(this,r,"tab("+s+")",{elem:e,index:c,id:o})},tabDelete:function(t){var i=(t=t||{}).liElem||u(this).parent(),a=i.parent().children("li").index(i),e=i.closest(".layui-tab"),l=e.children(".layui-tab-content").children(".layui-tab-item"),n=e.attr("lay-filter"),s=i.attr("lay-id");if(!t.force&&!1===layui.event.call(i[0],r,"tabBeforeDelete("+n+")",{elem:e,index:a,id:s}))return;i.hasClass(y)&&(i.next()[0]&&i.next().is("li")?w.tabClick.call(i.next()[0],{index:a+1}):i.prev()[0]&&i.prev().is("li")&&w.tabClick.call(i.prev()[0],null,a-1)),i.remove(),(s?t=(t=l.filter('[lay-id="'+s+'"]')).length?t:l.eq(a):l.eq(a)).remove(),setTimeout(function(){w.tabAuto(null,e)},50),layui.event.call(this,r,"tabDelete("+n+")",{elem:e,index:a,id:s})},tabAuto:function(l,t){var n="layui-tab-more",s="layui-tab-bar",o="layui-tab-close",c=this;(t||u(".layui-tab")).each(function(){var t=u(this),a=t.children(".layui-tab-title"),i=(t.children(".layui-tab-content").children(".layui-tab-item"),'lay-stope="tabmore"'),i=u(''),e=(c===window&&d.ie,t.attr("lay-allowclose"));e&&"false"!==e&&a.find("li").each(function(){var t,i=u(this);i.find("."+o)[0]||"false"===i.attr("lay-allowclose")||((t=u('')).on("click",function(t){w.tabDelete.call(this,{e:t})}),i.append(t))}),"string"!=typeof t.attr("lay-unauto")&&(a.prop("scrollWidth")>a.outerWidth()+1||a.find("li").length&&a.height()>(e=a.find("li").eq(0).height())+e/2?("change"===l&&a.data("LAY_TAB_CHANGE")&&a.addClass(n),a.find("."+s)[0]||(a.append(i),t.attr("overflow",""),i.on("click",function(t){var i=a.hasClass(n);a[i?"removeClass":"addClass"](n)}))):(a.find("."+s).remove(),t.removeAttr("overflow")))})},hideTabMore:function(t){var i=u(".layui-tab-title");!0!==t&&"tabmore"===u(t.target).attr("lay-stope")||(i.removeClass("layui-tab-more"),i.find(".layui-tab-bar").attr("title",""))},clickThis:function(){var t=u(this),i=t.closest(h),a=i.attr("lay-filter"),e=t.parent(),l=t.siblings("."+m),n="string"==typeof e.attr("lay-unselect");if("javascript:;"!==t.attr("href")&&"_blank"===t.attr("target")||n||l[0]||(i.find("."+y).removeClass(y),e.addClass(y)),i.hasClass(v)){var n=p+"ed",s=!e.hasClass(n),o=function(){u(this).css({display:""}),i.children("."+b).css({opacity:0})};if(l.is(":animated"))return;l.removeClass(C),l[0]&&(s?(l.slideDown(200,o),e.addClass(n)):(e.removeClass(n),l.show().slideUp(200,o)),"string"!=typeof i.attr("lay-accordion")&&"all"!==i.attr("lay-shrink")||((s=e.siblings("."+n)).removeClass(n),s.children("."+m).show().stop().slideUp(200,o)))}layui.event.call(this,r,"nav("+a+")",t)},collapse:function(){var t=u(this),i=t.find(".layui-colla-icon"),a=t.siblings(".layui-colla-content"),e=t.parents(".layui-collapse").eq(0),l=e.attr("lay-filter"),n="none"===a.css("display");"string"==typeof e.attr("lay-accordion")&&((e=e.children(".layui-colla-item").children("."+f)).siblings(".layui-colla-title").children(".layui-colla-icon").html(""),e.removeClass(f)),a[n?"addClass":"removeClass"](f),i.html(n?"":""),layui.event.call(this,r,"collapse("+l+")",{title:t,content:a,show:n})}},a=(i.prototype.render=i.prototype.init=function(t,i){var a="string"==typeof i&&i?'[lay-filter="'+i+'"]':"",e={tab:function(t){t=t||u(".layui-tab"+a);w.tabAuto.call({},null,t)},nav:function(t){var s={},o={},c={},r="layui-nav-title";(t||u(h+a)).each(function(t){var i=u(this),a=u(''),e=i.find("."+p),l=i.find("."+b);l[0]&&l.remove(),i.append(a),(i.hasClass(v)?e.find("dd,>."+r):e).off("mouseenter.lay_nav").on("mouseenter.lay_nav",function(){!function(t,i,a){var e,l=u(this),n=l.find("."+m);i.hasClass(v)?n[0]||(e=l.children("."+r),t.css({top:l.offset().top-i.offset().top,height:(e[0]?e:l).outerHeight(),opacity:1})):(n.addClass(C),n.hasClass("layui-nav-child-c")&&n.css({left:-(n.outerWidth()-l.width())/2}),n[0]?t.css({left:t.position().left+t.width()/2,width:0,opacity:0}):t.css({left:l.position().left+parseFloat(l.css("marginLeft")),top:l.position().top+l.height()-t.height()}),s[a]=setTimeout(function(){t.css({width:n[0]?0:l.width(),opacity:n[0]?0:1})},d.ie&&d.ie<10?0:200),clearTimeout(c[a]),"block"===n.css("display")&&clearTimeout(o[a]),o[a]=setTimeout(function(){n.addClass(f),l.find("."+g).addClass(g+"d")},300))}.call(this,a,i,t)}).off("mouseleave.lay_nav").on("mouseleave.lay_nav",function(){i.hasClass(v)?a.css({height:0,opacity:0}):(clearTimeout(o[t]),o[t]=setTimeout(function(){i.find("."+m).removeClass(f),i.find("."+g).removeClass(g+"d")},300))}),i.off("mouseleave.lay_nav").on("mouseleave.lay_nav",function(){clearTimeout(s[t]),c[t]=setTimeout(function(){i.hasClass(v)||a.css({width:0,left:a.position().left+a.width()/2,opacity:0})},200)}),e.find("a").each(function(){var t=u(this);t.parent();t.siblings("."+m)[0]&&!t.children("."+g)[0]&&t.append(''),t.off("click",w.clickThis).on("click",w.clickThis)})})},breadcrumb:function(t){(t||u(".layui-breadcrumb"+a)).each(function(){var t=u(this),i="lay-separator",a=t.attr(i)||"/",e=t.find("a");e.next("span["+i+"]")[0]||(e.each(function(t){t!==e.length-1&&u(this).after(""+a+"")}),t.css("visibility","visible"))})},progress:function(t){var e="layui-progress";(t||u("."+e+a)).each(function(){var t=u(this),i=t.find(".layui-progress-bar"),a=i.attr("lay-percent");i.css("width",function(){return/^.+\/.+$/.test(a)?100*new Function("return "+a)()+"%":a}),t.attr("lay-showpercent")&&setTimeout(function(){i.html(''+a+"")},350)})},collapse:function(t){(t||u(".layui-collapse"+a)).each(function(){u(this).find(".layui-colla-item").each(function(){var t=u(this),i=t.find(".layui-colla-title"),t="none"===t.find(".layui-colla-content").css("display");i.find(".layui-colla-icon").remove(),i.append(''+(t?"":"")+""),i.off("click",w.collapse).on("click",w.collapse)})})}};return t&&"object"==typeof i&&i instanceof u?e[t](i):e[t]?e[t]():layui.each(e,function(t,i){i()})},new i),e=u(document);u(function(){a.render()}),e.on("click",".layui-tab-title li",w.tabClick),u(window).on("resize",w.tabAuto),t(r,a)});layui.define(["lay","layer"],function(e){"use strict";var F=layui.$,a=layui.lay,t=layui.layer,R=layui.device(),i="upload",s="layui_"+i+"_index",w={config:{},index:layui[i]?layui[i].index+1e4:0,set:function(e){var t=this;return t.config=F.extend({},t.config,e),t},on:function(e,t){return layui.onevent.call(this,i,e,t)}},o=function(){var t=this,e=t.config.id;return{upload:function(e){t.upload.call(t,e)},reload:function(e){t.reload.call(t,e)},config:(o.that[e]=t).config}},r="layui-upload-file",l="layui-upload-form",E="layui-upload-iframe",L="layui-upload-choose",T="UPLOADING",D=function(e){var t=this;t.index=++w.index,t.config=F.extend({},t.config,w.config,e),t.render()};D.prototype.config={accept:"images",exts:"",auto:!0,bindAction:"",url:"",force:"",field:"file",acceptMime:"",method:"post",data:{},drag:!0,size:0,number:0,multiple:!1,text:{"cross-domain":"Cross-domain requests are not supported","data-format-error":"Please return JSON data format","check-error":"",error:"","limit-number":null,"limit-size":null}},D.prototype.reload=function(e){var t=this;t.config=F.extend({},t.config,e),t.render(!0)},D.prototype.render=function(e){var t=this,i=t.config,n=F(i.elem);return 1"].join("")),n=t.elem.next();(n.hasClass(r)||n.hasClass(l))&&n.remove(),R.ie&&R.ie<10&&t.elem.wrap('
          '),e.isFile()?(e.elemFile=t.elem,t.field=t.elem[0].name):t.elem.after(i),R.ie&&R.ie<10&&e.initIE()},D.prototype.initIE=function(){var i,e=this.config,t=F(''),n=F(['
          ',"
          "].join(""));F("#"+E)[0]||F("body").append(t),e.elem.next().hasClass(l)||(this.elemFile.wrap(n),e.elem.next("."+l).append((i=[],layui.each(e.data,function(e,t){t="function"==typeof t?t():t,i.push('')}),i.join(""))))},D.prototype.msg=function(e){return t.msg(e,{icon:2,shift:6})},D.prototype.isFile=function(){var e=this.config.elem[0];if(e)return"input"===e.tagName.toLocaleLowerCase()&&"file"===e.type},D.prototype.preview=function(n){window.FileReader&&layui.each(this.chooseFiles,function(e,t){var i=new FileReader;i.readAsDataURL(t),i.onload=function(){n&&n(e,t,this.result)}})},D.prototype.upload=function(e,t){var i,n,a,o,r,u=this,f=u.config,s=f.text||{},l=u.elemFile[0],c=function(){return e||u.files||u.chooseFiles||l.files},d=function(){var a=0,o=0,r=c(),l=function(){f.multiple&&a+o===u.fileLength&&"function"==typeof f.allDone&&f.allDone({total:u.fileLength,successful:a,failed:o})},i=function(i){var n=new FormData,t=function(e){i.unified?layui.each(r,function(e,t){delete t[T]}):delete e[T]};if(layui.each(f.data,function(e,t){t="function"==typeof t?i.unified?t():t(i.index,i.file):t,n.append(e,t)}),i.unified)layui.each(r,function(e,t){t[T]||(t[T]=!0,n.append(f.field,t))});else{if(i.file[T])return;n.append(f.field,i.file),i.file[T]=!0}var e={url:f.url,type:"post",data:n,dataType:f.dataType||"json",contentType:!1,processData:!1,headers:f.headers||{},success:function(e){f.unified?a+=u.fileLength:a++,m(i.index,e),l(i.index),t(i.file)},error:function(e){f.unified?o+=u.fileLength:o++,u.msg(s.error||["Upload failed, please try again.","status: "+(e.status||"")+" - "+(e.statusText||"error")].join("
          ")),g(i.index,e.responseText,e),l(i.index),t(i.file)}};"function"==typeof f.progress&&(e.xhr=function(){var e=F.ajaxSettings.xhr();return e.upload.addEventListener("progress",function(e){var t;e.lengthComputable&&(t=Math.floor(e.loaded/e.total*100),f.progress(t,(f.item||f.elem)[0],e,i.index))}),e}),F.ajax(e)};f.unified?i({unified:!0,index:0}):layui.each(r,function(e,t){i({index:e,file:t})})},p=function(){var n=F("#"+E);u.elemFile.parent().submit(),clearInterval(D.timer),D.timer=setInterval(function(){var e,t=n.contents().find("body");try{e=t.text()}catch(i){u.msg(s["cross-domain"]),clearInterval(D.timer),g()}e&&(clearInterval(D.timer),t.html(""),m(0,e))},30)},h=function(e){if("json"===f.force&&"object"!=typeof e)try{return{status:"CONVERTED",data:JSON.parse(e)}}catch(t){return u.msg(s["data-format-error"]),{status:"FORMAT_ERROR",data:{}}}return{status:"DO_NOTHING",data:{}}},m=function(e,t){u.elemFile.next("."+L).remove(),l.value="";var i=h(t);switch(i.status){case"CONVERTED":t=i.data;break;case"FORMAT_ERROR":return}"function"==typeof f.done&&f.done(t,e||0,function(e){u.upload(e)})},g=function(e,t,i){f.auto&&(l.value="");var n=h(t);switch(n.status){case"CONVERTED":t=n.data;break;case"FORMAT_ERROR":return}"function"==typeof f.error&&f.error(e||0,function(e){u.upload(e)},t,i)},v=f.exts,y=(n=[],layui.each(e||u.chooseFiles,function(e,t){n.push(t.name)}),n),x={preview:function(e){u.preview(e)},upload:function(e,t){var i={};i[e]=t,u.upload(i)},pushFile:function(){return u.files=u.files||{},layui.each(u.chooseFiles,function(e,t){u.files[e]=t}),u.files},resetFile:function(e,t,i){t=new File([t],i);u.files=u.files||{},u.files[e]=t},getChooseFiles:function(){return u.chooseFiles}},b={file:"\u6587\u4ef6",images:"\u56fe\u7247",video:"\u89c6\u9891",audio:"\u97f3\u9891"}[f.accept]||"\u6587\u4ef6",y=0===y.length?l.value.match(/[^\/\\]+\..+/g)||[]:y;if(0!==y.length){switch(f.accept){case"file":layui.each(y,function(e,t){if(v&&!RegExp(".\\.("+v+")$","i").test(escape(t)))return i=!0});break;case"video":layui.each(y,function(e,t){if(!RegExp(".\\.("+(v||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(t)))return i=!0});break;case"audio":layui.each(y,function(e,t){if(!RegExp(".\\.("+(v||"mp3|wav|mid")+")$","i").test(escape(t)))return i=!0});break;default:layui.each(y,function(e,t){if(!RegExp(".\\.("+(v||"jpg|png|gif|bmp|jpeg|svg|webp")+")$","i").test(escape(t)))return i=!0})}if(i)return u.msg(s["check-error"]||"\u9009\u62e9\u7684"+b+"\u4e2d\u5305\u542b\u4e0d\u652f\u6301\u7684\u683c\u5f0f"),l.value="";if("choose"!==t&&!f.auto||(f.choose&&f.choose(x),"choose"!==t)){if(u.fileLength=(a=0,b=c(),layui.each(b,function(){a++}),a),f.number&&u.fileLength>f.number)return u.msg("function"==typeof s["limit-number"]?s["limit-number"](f,u.fileLength):"\u540c\u65f6\u6700\u591a\u53ea\u80fd\u4e0a\u4f20: "+f.number+" \u4e2a\u6587\u4ef6
          \u60a8\u5f53\u524d\u5df2\u7ecf\u9009\u62e9\u4e86: "+u.fileLength+" \u4e2a\u6587\u4ef6");if(01024*f.size&&(t=1<=(t=f.size/1024)?t.toFixed(2)+"MB":f.size+"KB",l.value="",o=t)}),o)return u.msg("function"==typeof s["limit-size"]?s["limit-size"](f,o):"\u6587\u4ef6\u5927\u5c0f\u4e0d\u80fd\u8d85\u8fc7 "+o);r=function(){if(R.ie)return(9'+e+"")},l=function(i){var n=!0;return layui.each(a.files,function(e,t){if(!(n=!(t.name===i.name)))return!0}),n},u=function(e){var i=function(e){e.ext=e.name.substr(e.name.lastIndexOf(".")+1).toLowerCase(),e.sizes=w.util.parseSize(e.size)};return e instanceof FileList?layui.each(e,function(e,t){i(t)}):i(e),e},f=function(e){var i;return(e=e||[]).length?a.files?(i=[],layui.each(e,function(e,t){l(t)&&i.push(u(t))}),i):u(e):[]};n.elem.off("upload.start").on("upload.start",function(){var e=F(this);a.config.item=e,a.elemFile[0].click()}),R.ie&&R.ie<10||n.elem.off("upload.over").on("upload.over",function(){F(this).attr("lay-over","")}).off("upload.leave").on("upload.leave",function(){F(this).removeAttr("lay-over")}).off("upload.drop").on("upload.drop",function(e,t){var i=F(this),t=f(t.originalEvent.dataTransfer.files);i.removeAttr("lay-over"),o(t),n.auto?a.upload():r(t)}),a.elemFile.on("change",function(){var e=f(this.files);0!==e.length&&(o(e),n.auto?a.upload():r(e))}),n.bindAction.off("upload.action").on("upload.action",function(){a.upload()}),n.elem.data(s)||(n.elem.on("click",function(){a.isFile()||F(this).trigger("upload.start")}),n.drag&&n.elem.on("dragover",function(e){e.preventDefault(),F(this).trigger("upload.over")}).on("dragleave",function(e){F(this).trigger("upload.leave")}).on("drop",function(e){e.preventDefault(),F(this).trigger("upload.drop",e)}),n.bindAction.on("click",function(){F(this).trigger("upload.action")}),n.elem.data(s,n.id))},w.util={parseSize:function(e,t){var i,n;return t=t||2,null!=e&&e?(i="string"==typeof e?parseFloat(e):e,n=Math.floor(Math.log(i)/Math.log(1024)),(e=(e=i/Math.pow(1024,n))%1==0?e:parseFloat(e.toFixed(t)))+["Bytes","Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"][n]):"0"},promiseLikeResolve:function(e){var t=F.Deferred();return e&&"function"==typeof e.then?e.then(t.resolve,t.reject):t.resolve(e),t.promise()}},o.that={},o.getThis=function(e){var t=o.that[e];return t||hint.error(e?i+" instance with ID '"+e+"' not found":"ID argument required"),t},w.render=function(e){e=new D(e);return o.call(e)},e(i,w)});layui.define(["lay","layer","util"],function(e){"use strict";var T=layui.$,h=layui.layer,d=layui.util,l=layui.hint(),_=(layui.device(),"form"),p=".layui-form",E="layui-this",O="layui-hide",A="layui-disabled",y="layui-input-number-invalid",f=lay.ie&&8===parseFloat(lay.ie)||void 0===Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"checked"),t=function(){this.config={verify:{required:function(e){if(!/[\S]+/.test(e)||e===undefined||null===e)return"\u5fc5\u586b\u9879\u4e0d\u80fd\u4e3a\u7a7a"},phone:function(e){if(e&&!/^1\d{10}$/.test(e))return"\u624b\u673a\u53f7\u683c\u5f0f\u4e0d\u6b63\u786e"},email:function(e){if(e&&!/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(e))return"\u90ae\u7bb1\u683c\u5f0f\u4e0d\u6b63\u786e"},url:function(e){if(e&&!/^(#|(http(s?)):\/\/|\/\/)[^\s]+\.[^\s]+$/.test(e))return"\u94fe\u63a5\u683c\u5f0f\u4e0d\u6b63\u786e"},number:function(e){if(e&&isNaN(e))return"\u53ea\u80fd\u586b\u5199\u6570\u5b57"},date:function(e){if(e&&!/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/.test(e))return"\u65e5\u671f\u683c\u5f0f\u4e0d\u6b63\u786e"},identity:function(e){if(e&&!/(^\d{15}$)|(^\d{17}(x|X|\d)$)/.test(e))return"\u8eab\u4efd\u8bc1\u53f7\u683c\u5f0f\u4e0d\u6b63\u786e"}},autocomplete:null}},i=(t.prototype.set=function(e){return T.extend(!0,this.config,e),this},t.prototype.verify=function(e){return T.extend(!0,this.config.verify,e),this},t.prototype.getFormElem=function(e){return T(p+(e?'[lay-filter="'+e+'"]':""))},t.prototype.on=function(e,t){return layui.onevent.call(this,_,e,t)},t.prototype.val=function(e,o){return this.getFormElem(e).each(function(e,t){var i,a,n,l,r=T(this);for(i in o)lay.hasOwn(o,i)&&(n=o[i],(l=r.find('[name="'+i+'"]'))[0])&&("checkbox"===(a=l[0].type)?l[0].checked=n:"radio"===a?l.each(function(){this.checked=this.value==n+""}):l.val(n))}),r.render(null,e),this.getValue(e)},t.prototype.getValue=function(e,t){t=t||this.getFormElem(e);var n={},l={},e=t.find("input,select,textarea");return layui.each(e,function(e,t){var i,a=T(this);t.name=(t.name||"").replace(/^\s*|\s*&/,""),t.name&&(/^.*\[\]$/.test(t.name)&&(i=t.name.match(/^(.*)\[\]$/g)[0],n[i]=0|n[i],i=t.name.replace(/^(.*)\[\]$/,"$1["+n[i]+++"]")),/^(checkbox|radio)$/.test(t.type)&&!t.checked||(l[i||t.name]="SELECT"===this.tagName&&"string"==typeof this.getAttribute("multiple")?a.val()||[]:this.value))}),l},t.prototype.render=function(e,t){var u=this,i=u.config,a=T(p+(t?'[lay-filter="'+t+'"]':"")),n={input:function(e){var e=e||a.find("input,textarea"),h=(i.autocomplete&&e.attr("autocomplete",i.autocomplete),function(e,t){var i=e.val(),a=Number(i),n=Number(e.attr("step"))||1,l=Number(e.attr("min")),r=Number(e.attr("max")),o=Number(e.attr("lay-precision")),s="click"!==t&&""===i,c="init"===t,u=isNaN(a),d="string"==typeof e.attr("lay-step-strictly");if(e.toggleClass(y,u),!u){if("click"===t){if("text"===e[0].type&&"string"==typeof e.attr("readonly"))return;a=!!T(this).index()?a-n:a+n}u=function(e){return((e.toString().match(/\.(\d+$)/)||[])[1]||"").length},o=0<=o?o:Math.max(u(n),u(i));s||(c||r<=(a=(a=d?Math.round(a/n)*n:a)<=l?l:a)&&(a=r),0===o?a=parseInt(a):0'),e=layui.isArray(i.value)?i.value:[i.value],e=T((a=[],layui.each(e,function(e,t){a.push('')}),a.join(""))),n=(t.append(e),i.split&&t.addClass("layui-input-split"),i.className&&t.addClass(i.className),r.next("."+u)),l=(n[0]&&n.remove(),r.parent().hasClass(s)||r.wrap('
          '),r.next("."+c));l[0]?((n=l.find("."+u))[0]&&n.remove(),l.prepend(t),r.css("padding-right",function(){return(r.closest(".layui-input-group")[0]?0:l.outerWidth())+t.outerWidth()})):(t.addClass(c),r.after(t)),"auto"===i.show&&d(t,r.val()),"function"==typeof i.init&&i.init.call(this,r,i),r.on("input propertychange",function(){var e=this.value;"auto"===i.show&&d(t,e)}),r.on("blur",function(){"function"==typeof i.blur&&i.blur.call(this,r,i)}),e.on("click",function(){var e=r.attr("lay-filter");T(this).hasClass(A)||("function"==typeof i.click&&i.click.call(this,r,i),layui.event.call(this,_,"input-affix("+e+")",{elem:r[0],affix:o,options:i}))})},p={eye:{value:"eye-invisible",click:function(e,t){var i="LAY_FORM_INPUT_AFFIX_SHOW",a=e.data(i);e.attr("type",a?"password":"text").data(i,!a),n({value:a?"eye-invisible":"eye"})}},clear:{value:"clear",click:function(e){e.val("").focus(),d(T(this).parent(),null)},show:"auto",disabled:e},number:{value:["up","down"],split:!0,className:"layui-input-number",disabled:r.is("[disabled]"),init:function(a){var e,n,l,t,i,r;"text"!==a.attr("type")&&"text"!==a[0].type||(l=n=!(e=".lay_input_number"),t="string"==typeof a.attr("readonly"),i="string"==typeof a.attr("lay-wheel"),r=a.next(".layui-input-number").children("i"),a.attr("lay-input-mirror",a.val()),a.off(e),a.on("keydown"+e,function(e){n=!1,8!==e.keyCode&&46!==e.keyCode||(n=!0),t||2!==r.length||38!==e.keyCode&&40!==e.keyCode||(e.preventDefault(),r.eq(38===e.keyCode?0:1).click())}),a.on("input"+e+" propertychange"+e,function(e){var t,i;l||"propertychange"===e.type&&"value"!==e.originalEvent.propertyName||(n||""===(e=this.value)||"00"!==e.slice(0,2)&&!e.match(/\s/g)&&!((t=e.match(/\./g))&&1=Math.abs(e.deltaY)?e.deltaX:e.deltaY):"mousewheel"===e.type?t=-e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(t=e.originalEvent.detail),r.eq(0S.height()&&t<=e&&l.addClass(C+"up"),h(),s&&g.off("mousedown.lay_select_ieph").on("mousedown.lay_select_ieph",function(){m[0].__ieph=!0,setTimeout(function(){m[0].__ieph=!1},60)}),n=lay.onClickOutside((a?l:g)[0],function(){p(),k&&m.val(k)},{ignore:v,detectIframe:!0,capture:!1})},p=function(e){v.parent().removeClass(C+"ed "+C+"up"),m.blur(),u&&g.children("."+N).remove(),"function"==typeof n&&(n(),n=null),a&&(l.detach(),T(window).off("resize.lay_select_resize")),e||y(m.val(),function(e){var t=f[0].selectedIndex;e&&(k=T(f[0].options[t]).prop("text"),0===t&&k===m.attr("placeholder")&&(k=""),m.val(k||""))})},h=function(){var e,t,i=g.children("dd."+E);i[0]&&(e=i.position().top,t=g.height(),i=i.height(),t").addClass(N).attr("lay-value",n).text(n),a=(i=g.children().eq(0)).hasClass("layui-select-tips"),i[a?"after":"before"](t)):e?g.find("."+w)[0]||g.append('

          \u65e0\u5339\u914d\u9879

          '):g.find("."+w).remove()},"keyup"),""===n&&(f.val(""),g.find("."+E).removeClass(E),(f[0].options[0]||{}).value||g.children("dd:eq(0)").addClass(E),g.find("."+w).remove(),u)&&g.children("."+N).remove(),void h()))},50)).on("blur",function(e){var t=f[0].selectedIndex;k=T(f[0].options[t]).prop("text"),0===t&&k===m.attr("placeholder")&&(k=""),setTimeout(function(){y(m.val(),function(e){k||m.val("")},"blur")},200)}),g.on("click","dd",function(){var e,t,i=T(this),a=i.attr("lay-value"),n=f.attr("lay-filter");return i.hasClass(A)||(u&&i.hasClass(N)&&(t=(e=T("
          "].join(""));i.after(l),function(t,i){var a=T(this),e=a.attr("lay-skin")||"primary",n="switch"===e,e="primary"===e;t.on("click",function(){var e=a.attr("lay-filter");a[0].disabled||(a[0].indeterminate&&(a[0].indeterminate=!1),a[0].checked=!a[0].checked,layui.event.call(a[0],_,i[2]+"("+e+")",{elem:a[0],value:a[0].value,othis:t}))}),u.syncAppearanceOnPropChanged(this,"checked",function(){var e;n&&(e=(t.next("*[lay-checkbox]")[0]?t.next().html():a.attr("title")||"").split("|"),t.children("div").html(!this.checked&&e[1]||e[0])),t.toggleClass(i[1],this.checked)}),e&&u.syncAppearanceOnPropChanged(this,"indeterminate",function(){this.indeterminate?t.children(".layui-icon-ok").removeClass("layui-icon-ok").addClass(c.SUBTRA):t.children("."+c.SUBTRA).removeClass(c.SUBTRA).addClass("layui-icon-ok")})}.call(this,l,r)})},radio:function(e){var s="layui-form-radio",c=["layui-icon-radio","layui-icon-circle"],e=e||a.find("input[type=radio]");e.each(function(e,t){var i=T(this),a=i.next("."+s),n=this.disabled,l=i.attr("lay-skin");if(i.closest("[lay-ignore]").length)return i.show();f&&v.call(t,"lay-form-sync-checked",t.checked),a[0]&&a.remove();var a=d.escape(t.title||""),r=[],o=(i.next("[lay-radio]")[0]&&(a=(o=i.next()).html()||"",1",'',"
          "+a+"
          ","
          "].join("")));i.after(o),function(i){var a=T(this),n="layui-anim-scaleSpring";i.on("click",function(){var e=a.attr("lay-filter");a[0].disabled||(a[0].checked=!0,layui.event.call(a[0],_,"radio("+e+")",{elem:a[0],value:a[0].value,othis:i}))}),u.syncAppearanceOnPropChanged(this,"checked",function(){var e,t=this;t.checked?(i.addClass(s+"ed"),i.children(".layui-icon").addClass(n+" "+c[0]),e=a.parents(p).find("input[name="+t.name.replace(/(\.|#|\[|\])/g,"\\$1")+"]"),layui.each(e,function(){t!==this&&(this.checked=!1)})):(i.removeClass(s+"ed"),i.children(".layui-icon").removeClass(n+" "+c[0]).addClass(c[1]))})}.call(this,o)})}},t=function(){layui.each(n,function(e,t){t()})};return"object"===layui.type(e)?T(e).is(p)?(a=T(e),t()):e.each(function(e,t){var i=T(t);i.closest(p).length&&("SELECT"===t.tagName?n.select(i):"INPUT"===t.tagName&&("checkbox"===(t=t.type)||"radio"===t?n[t](i):n.input(i)))}):e?n[e]?n[e]():l.error('\u4e0d\u652f\u6301\u7684 "'+e+'" \u8868\u5355\u6e32\u67d3'):t(),u},t.prototype.syncAppearanceOnPropChanged=f?function(e,t,i){var a=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,t);Object.defineProperty(e,t,lay.extend({},a,{get:function(){return"string"==typeof this.getAttribute("lay-form-sync-"+t)},set:function(e){v.call(this,"lay-form-sync-"+t,e),i.call(this)}}))}:function(e,t,i){var a=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,t);Object.defineProperty(e,t,lay.extend({},a,{get:function(){return a.get.call(this)},set:function(e){a.set.call(this,e),i.call(this)}}))},t.prototype.validate=function(e){var u,d=this.config.verify,p="layui-form-danger";return!(e=T(e))[0]||(e.attr("lay-verify")!==undefined||!1!==this.validate(e.find("*[lay-verify]")))&&(layui.each(e,function(e,r){var o=T(this),t=(o.attr("lay-verify")||"").split("|"),s=o.attr("lay-vertype"),c="string"==typeof(c=o.val())?T.trim(c):c;if(o.removeClass(p),layui.each(t,function(e,t){var i="",a=d[t];if(a){var n="function"==typeof a?i=a(c,r):!a[0].test(c),l="select"===r.tagName.toLowerCase()||/^(checkbox|radio)$/.test(r.type),i=i||a[1];if("required"===t&&(i=o.attr("lay-reqtext")||i),n)return"tips"===s?h.tips(i,!o.closest("[lay-ignore]").length&&l?o.next():o,{tips:1}):"alert"===s?h.alert(i,{title:"\u63d0\u793a",shadeClose:!0}):/\b(string|number)\b/.test(typeof i)&&h.msg(i,{icon:5,shift:6}),setTimeout(function(){(l?o.next().find("input"):r).focus()},7),o.addClass(p),u=!0}}),u)return u}),!u)},t.prototype.submit=function(e,t){var i={},a=T(this),e="string"==typeof e?e:a.attr("lay-filter"),n=this.getFormElem?this.getFormElem(e):a.parents(p).eq(0),l=n.find("*[lay-verify]");return!!r.validate(l)&&(i=r.getValue(null,n),l={elem:this.getFormElem?window.event&&window.event.target:this,form:(this.getFormElem?n:a.parents("form"))[0],field:i},"function"==typeof t&&t(l),layui.event.call(this,_,"submit("+e+")",l))});function v(e,t){var i=!!t,t=2===arguments.length&&!t;return null!==this.getAttribute(e)?i||(this.removeAttribute(e),!1):!t&&(this.setAttribute(e,""),!0)}var m=["-",".","e","E","+"];var r=new t,t=T(document),S=T(window);T(function(){r.render()}),t.on("reset",p,function(){var e=T(this).attr("lay-filter");setTimeout(function(){r.render(null,e)},50)}),t.on("submit",p,i).on("click","*[lay-submit]",i),e(_,r)});layui.define(["lay","laytpl","laypage","form","util"],function(s){"use strict";var f=layui.$,r=layui.lay,m=layui.laytpl,p=layui.laypage,g=layui.layer,i=layui.form,v=layui.util,b=layui.hint(),x=layui.device(),k={config:{checkName:"LAY_CHECKED",indexName:"LAY_INDEX",initIndexName:"LAY_INDEX_INIT",numbersName:"LAY_NUM",disabledName:"LAY_DISABLED"},cache:{},index:layui.table?layui.table.index+1e4:0,set:function(e){return this.config=f.extend({},this.config,e),this},on:function(e,t){return layui.onevent.call(this,R,e,t)}},w=function(){var a=this,e=a.config,i=e.id||e.index;return{config:e,reload:function(e,t){a.reload.call(a,e,t)},reloadData:function(e,t){k.reloadData(i,e,t)},setColsWidth:function(){a.setColsWidth.call(a)},resize:function(){a.resize.call(a)}}},C=function(e){var t=w.that[e];return t||b.error(e?"The table instance with ID '"+e+"' not found":"ID argument required"),t||null},l=function(e){var t=w.config[e];return t||b.error(e?"The table instance with ID '"+e+"' not found":"ID argument required"),t||null},T=function(e){var t=this.config||{},a=(e=e||{}).item3,i=e.content;"numbers"===a.type&&(i=e.tplData[k.config.numbersName]);("escape"in a?a:t).escape&&(i=v.escape(i));t=e.text&&a.exportTemplet||a.templet||a.toolbar;return t&&(i="function"==typeof t?t.call(a,e.tplData,e.obj):m(function(e){try{return r(e).html()}catch(t){return e}}(t)||String(i)).render(f.extend({LAY_COL:a},e.tplData))),e.text?f("
          "+i+"
          ").text():i},R="table",N="lay-"+R+"-id",t=".layui-table",W="layui-hide",y="layui-hide-v",h="layui-none",_="layui-table-view",o=".layui-table-header",D=".layui-table-body",I=".layui-table-fixed-r",P=".layui-table-pageview",L=".layui-table-sort",A="layui-table-checked",E="layui-table-edit",M="layui-table-hover",u="laytable-cell-group",F="layui-table-col-special",S="layui-table-tool-panel",H="layui-table-expanded",O="layui-table-disabled-transition",j="LAY_TABLE_MOVE_DICT",e=function(e){return['',"","{{# layui.each(d.data.cols, function(i1, item1){ }}","","{{# layui.each(item1, function(i2, item2){ }}",'{{# if(item2.fixed && item2.fixed !== "right"){ left = true; } }}','{{# if(item2.fixed === "right"){ right = true; } }}',(e=e||{}).fixed&&"right"!==e.fixed?'{{# if(item2.fixed && item2.fixed !== "right"){ }}':"right"===e.fixed?'{{# if(item2.fixed === "right"){ }}':"","{{# var isSort = !(item2.colGroup) && item2.sort; }}",'",e.fixed?"{{# }; }}":"","{{# }); }}","","{{# }); }}","","
          ','
          ','{{# if(item2.type === "checkbox"){ }}','',"{{# } else { }}",'{{-item2.title||""}}',"{{# if(isSort){ }}",'',"{{# } }}","{{# } }}","
          ","
          "].join("")},a=['',"","
          "].join(""),B=[,"{{# if(d.data.toolbar){ }}",'
          ','
          ','
          ',"
          ","{{# } }}",'
          ',"{{# if(d.data.loading){ }}",'
          ','
          ','{{# if(typeof d.data.loading === "string"){ }}',"{{- d.data.loading}}","{{# } else{ }}",'',"{{# } }}","
          ","
          ","{{# } }}","{{# var left, right; }}",'
          ',e(),"
          ",'
          ',a,"
          ","{{# if(left){ }}",'
          ','
          ',e({fixed:!0}),"
          ",'
          ',a,"
          ","
          ","{{# }; }}","{{# if(right){ }}",'
          ','
          ',e({fixed:"right"}),'
          ',"
          ",'
          ',a,"
          ","
          ","{{# }; }}","
          ","{{# if(d.data.totalRow){ }}",'
          ','','',"
          ","
          ","{{# } }}",'
          ','
          ',"
          "].join(""),d=f(window),z=f(document),n=function(e){this.index=++k.index,this.config=f.extend({},this.config,k.config,e),this.render()},c=(n.prototype.config={limit:10,loading:!0,escape:!0,cellMinWidth:60,cellMaxWidth:Number.MAX_VALUE,editTrigger:"click",defaultToolbar:["filter","exports","print"],defaultContextmenu:!0,autoSort:!0,text:{none:"\u65e0\u6570\u636e"},cols:[]},n.prototype.render=function(e){var t=this,a=t.config,i=(a.elem=f(a.elem),a.where=a.where||{},a.id="id"in a?a.id:a.elem.attr("id")||t.index);if(w.that[i]=t,(w.config[i]=a).request=f.extend({pageName:"page",limitName:"limit"},a.request),a.response=f.extend({statusName:"code",statusCode:0,msgName:"msg",dataName:"data",totalRowName:"totalRow",countName:"count"},a.response),null!==a.page&&"object"==typeof a.page&&(a.limit=a.page.limit||a.limit,a.limits=a.page.limits||a.limits,t.page=a.page.curr=a.page.curr||1,delete a.page.elem,delete a.page.jump),!a.elem[0])return t;if(a.elem.attr("lay-filter")||a.elem.attr("lay-filter",a.id),"reloadData"===e)return t.pullData(t.page,{type:"reloadData"});a.index=t.index,t.key=a.id||a.index,t.setInit(),a.height&&/^full-.+$/.test(a.height)?(t.fullHeightGap=a.height.split("-")[1],a.height=d.height()-(parseFloat(t.fullHeightGap)||0)):a.height&&/^#\w+\S*-.+$/.test(a.height)?(i=a.height.split("-"),t.parentHeightGap=i.pop(),t.parentDiv=i.join("-"),a.height=f(t.parentDiv).height()-(parseFloat(t.parentHeightGap)||0)):"function"==typeof a.height&&(t.customHeightFunc=a.height,a.height=t.customHeightFunc());var l,e=a.elem,i=e.next("."+_),n=t.elem=f("
          ");n.addClass((l=[_,_+"-"+t.index,"layui-form","layui-border-box"],a.className&&l.push(a.className),l.join(" "))).attr(((l={"lay-filter":"LAY-TABLE-FORM-DF-"+t.index,style:(l=[],a.width&&l.push("width:"+a.width+"px;"),l.join(""))})[N]=a.id,l)).html(m(B,{open:"{{",close:"}}",tagStyle:"legacy"}).render({data:a,index:t.index})),t.renderStyle(),i[0]&&i.remove(),e.after(n),t.layTool=n.find(".layui-table-tool"),t.layBox=n.find(".layui-table-box"),t.layHeader=n.find(o),t.layMain=n.find(".layui-table-main"),t.layBody=n.find(D),t.layFixed=n.find(".layui-table-fixed"),t.layFixLeft=n.find(".layui-table-fixed-l"),t.layFixRight=n.find(I),t.layTotal=n.find(".layui-table-total"),t.layPage=n.find(".layui-table-page"),t.renderToolbar(),t.renderPagebar(),t.fullSize(),t.setColsWidth({isInit:!0}),t.pullData(t.page),t.events()},n.prototype.initOpts=function(e){this.config;e.checkbox&&(e.type="checkbox"),e.space&&(e.type="space"),e.type||(e.type="normal"),"normal"!==e.type&&(e.unresize=!0,e.width=e.width||{checkbox:50,radio:50,space:30,numbers:60}[e.type])},n.prototype.setInit=function(e){var n,a,d=this,r=d.config;if(r.clientWidth=r.width||(n=function(e){var t,a;e=e||r.elem.parent(),t=d.getContentWidth(e);try{a="none"===e.css("display")}catch(l){}var i=e.parent();return e[0]&&i&&i[0]&&(!t||a)?n(i):t})(),"width"===e)return r.clientWidth;r.height=r.maxHeight||r.height,r.css&&-1===r.css.indexOf(_)&&(a=r.css.split("}"),layui.each(a,function(e,t){t&&(a[e]="."+_+"-"+d.index+" "+t)}),r.css=a.join("}"));var c=function(a,e,i,l){var n,o;l?(l.key=[r.index,a,i].join("-"),l.colspan=l.colspan||0,l.rowspan=l.rowspan||0,d.initOpts(l),(n=a+(parseInt(l.rowspan)||1)) td:hover > .layui-table-cell{overflow: auto;}"].concat(x.ie?[".layui-table-edit{height: "+i+";}","td[data-edit]:hover:after{height: "+i+";}"]:[]),function(e,t){t&&o.push(a+" "+t)})),l.css&&o.push(l.css),r.style({target:this.elem[0],text:o.join(""),id:"DF-table-"+n})},n.prototype.renderToolbar=function(){var l,o=this,e=o.config,d=e.elem.attr("lay-filter"),t=['
          ','
          ','
          '].join(""),a=o.layTool.find(".layui-table-tool-temp"),n=("default"===e.toolbar?a.html(t):"string"==typeof e.toolbar&&(t=f(e.toolbar).html()||"")&&a.html(m(t).render(e)),{filter:{title:"\u7b5b\u9009\u5217",layEvent:"LAYTABLE_COLS",icon:"layui-icon-cols",onClick:function(e){var a,n=e.config;(0,e.openPanel)({list:(a=[],o.eachCols(function(e,t){t.field&&"normal"==t.type&&a.push('
        • "+(t.fieldTitle||t.title||t.field)+"").text())+'" lay-filter="LAY_TABLE_TOOL_COLS">
        • ')}),a.join("")),done:function(){i.on("checkbox(LAY_TABLE_TOOL_COLS)",function(e){var e=f(e.elem),t=this.checked,a=e.data("key"),i=o.col(a),l=i.hide,e=e.data("parentkey");i.key&&(i.hide=!t,o.elem.find('*[data-key="'+a+'"]')[t?"removeClass":"addClass"](W),l!=i.hide&&o.setParentCol(!t,e),o.resize(),layui.event.call(this,R,"colToggled("+d+")",{col:i,config:n}))})}})}},exports:{title:"\u5bfc\u51fa",layEvent:"LAYTABLE_EXPORT",icon:"layui-icon-export",onClick:function(e){var t=e.data,a=e.config,i=e.openPanel,e=e.elem;if(!t.length)return g.tips("\u5f53\u524d\u8868\u683c\u65e0\u6570\u636e",e,{tips:3});x.ie?g.tips("\u5bfc\u51fa\u529f\u80fd\u4e0d\u652f\u6301 IE\uff0c\u8bf7\u7528 Chrome \u7b49\u9ad8\u7ea7\u6d4f\u89c8\u5668\u5bfc\u51fa",e,{tips:3}):i({list:['
        • \u5bfc\u51fa CSV \u6587\u4ef6
        • '].join(""),done:function(e,t){t.on("click",function(){var e=f(this).data("type");k.exportFile.call(o,a.id,null,e)})}})}},print:{title:"\u6253\u5370",layEvent:"LAYTABLE_PRINT",icon:"layui-icon-print",onClick:function(e){var t=e.data;if(!t.length)return g.tips("\u5f53\u524d\u8868\u683c\u65e0\u6570\u636e",e.elem,{tips:3});var t=window.open("about:blank","_blank"),e=[""].join(""),a=f(o.layHeader.html());a.append(o.layMain.find("table").html()),a.append(o.layTotal.find("table").html()),a.find("th.layui-table-patch").remove(),a.find("thead>tr>th."+F).filter(function(e,t){return!f(t).children("."+u).length}).remove(),a.find("tbody>tr>td."+F).remove(),t.document.write(e+a.prop("outerHTML")),t.document.close(),layui.device("edg").edg?(t.onafterprint=t.close,t.print()):(t.print(),t.close())}}});"object"==typeof e.defaultToolbar&&(l=[],e.defaultToolbar=f.map(e.defaultToolbar,function(e,t){var a="string"==typeof e,i=a?n[e]:e;return i&&(!(i=i.name&&n[i.name]?f.extend({},n[i.name],i):i).name&&a&&(i.name=e),l.push('
          ')),i}),o.layTool.find(".layui-table-tool-self").html(l.join("")))},n.prototype.renderPagebar=function(){var e,t=this.config,a=this.layPagebar=f('
          ');t.pagebar&&((e=f(t.pagebar).html()||"")&&a.append(m(e).render(t)),this.layPage.append(a))},n.prototype.setParentCol=function(e,t){var a=this.config,i=this.layHeader.find('th[data-key="'+t+'"]'),l=parseInt(i.attr("colspan"))||0;i[0]&&(t=t.split("-"),t=a.cols[t[1]][t[2]],e?l--:l++,i.attr("colspan",l),i[l?"removeClass":"addClass"](W),t.colspan2=l,t.hide=l<1,a=i.data("parentkey"))&&this.setParentCol(e,a)},n.prototype.setColsPatch=function(){var a=this,e=a.config;layui.each(e.cols,function(e,t){layui.each(t,function(e,t){t.hide&&a.setParentCol(t.hide,t.parentKey)})})},n.prototype.setGroupWidth=function(i){var e,l=this;l.config.cols.length<=1||((e=l.layHeader.find((i?"th[data-key="+i.data("parentkey")+"]>":"")+"."+u)).css("width",0),layui.each(e.get().reverse(),function(){var e=f(this),t=e.parent().data("key"),a=0;l.layHeader.eq(0).find("th[data-parentkey="+t+"]").width(function(e,t){f(this).hasClass(W)||0o.layMain.prop("clientHeight")&&(e.style.width=parseFloat(e.style.width)-i+"px")}),!p&&h?y.width(o.getContentWidth(l)):y.width("auto"),o.setGroupWidth()},n.prototype.resize=function(){var e=this;e.layMain&&("isConnected"in e.layMain[0]?e.layMain[0].isConnected:f.contains(document.body,e.layMain[0]))&&(e.fullSize(),e.setColsWidth(),e.scrollPatch())},n.prototype.reload=function(e,t,a){var i=this;e=e||{},delete i.haveInit,layui.each(e,function(e,t){"array"===layui.type(t)&&delete i.config[e]}),i.config=f.extend(t,{},i.config,e),"reloadData"!==a&&(layui.each(i.config.cols,function(e,t){layui.each(t,function(e,t){delete t.colspan2})}),delete i.config.HAS_SET_COLS_PATCH),i.render(a)},n.prototype.errorView=function(e){var t=this,a=t.layMain.find("."+h),e=f('
          '+(e||"Error")+"
          ");a[0]&&(t.layNone.remove(),a.remove()),t.layFixed.addClass(W),t.layMain.find("tbody").html(""),t.layMain.append(t.layNone=e),t.layTotal.addClass(y),t.layPage.find(P).addClass(y),k.cache[t.key]=[],t.syncCheckAll(),t.renderForm(),t.setColsWidth(),t.loading(!1)},n.prototype.page=1,n.prototype.pullData=function(i,l){var e,t,n=this,o=n.config,a=(o.HAS_SET_COLS_PATCH||n.setColsPatch(),o.HAS_SET_COLS_PATCH=!0,o.request),d=o.response,r=function(){"object"==typeof o.initSort&&n.sort({field:o.initSort.field,type:o.initSort.type,reloadType:l.type})},c=function(e,t){n.setColsWidth(),n.loading(!1),"function"==typeof o.done&&o.done(e,i,e[d.countName],t)};l=l||{},"function"==typeof o.before&&o.before(o),n.startTime=(new Date).getTime(),l.renderData?((e={})[d.dataName]=k.cache[n.key],e[d.countName]=o.url?"object"===layui.type(o.page)?o.page.count:e[d.dataName].length:o.data.length,"object"==typeof o.totalRow&&(e[d.totalRowName]=f.extend({},n.totalRow)),n.renderData({res:e,curr:i,count:e[d.countName],type:l.type,sort:!0}),c(e,"renderData")):o.url?(t={},o.page&&(t[a.pageName]=i,t[a.limitName]=o.limit),a=f.extend(t,o.where),o.contentType&&0==o.contentType.indexOf("application/json")&&(a=JSON.stringify(a)),n.loading(!0),n._xhr&&4!==n._xhr.readyState&&(n._xhrAbort=!0,n._xhr.abort()),n._xhr=f.ajax({type:o.method||"get",url:o.url,contentType:o.contentType,data:a,dataType:o.dataType||"json",jsonpCallback:o.jsonpCallback,headers:o.headers||{},complete:"function"==typeof o.complete?o.complete:undefined,success:function(e){var t,a;(e="function"==typeof o.parseData?o.parseData(e)||e:e)[d.statusName]!=d.statusCode?n.errorView(e[d.msgName]||'\u8fd4\u56de\u7684\u6570\u636e\u4e0d\u7b26\u5408\u89c4\u8303\uff0c\u6b63\u786e\u7684\u6210\u529f\u72b6\u6001\u7801\u5e94\u4e3a\uff1a"'+d.statusName+'": '+d.statusCode):(t=e[d.countName],(a=Math.ceil(t/o.limit)||1)','
          "+function(){var e,t=f.extend(!0,{LAY_COL:l},o),a=k.config.checkName,i=k.config.disabledName;switch(l.type){case"checkbox":return'';case"radio":return'';case"numbers":return c}return l.toolbar?m(f(l.toolbar).html()||"").render(t):T.call(s,{item3:l,content:n,tplData:t})}(),"
          "].join(""),i.push(e),l.fixed&&"right"!==l.fixed&&d.push(e),"right"===l.fixed&&r.push(e))}),e=['data-index="'+e+'"'],o[k.config.checkName]&&e.push('class="'+A+'"'),e=e.join(" "),y.push(""+i.join("")+""),h.push(""+d.join("")+""),p.push(""+r.join("")+""))}),{trs:y,trs_fixed:h,trs_fixed_r:p}},k.getTrHtml=function(e,t){e=C(e);return e.getTrHtml(t,null,e.page)},n.prototype.renderData=function(e){var a=this,i=a.config,t=e.res,l=e.curr,n=a.count=e.count,o=e.sort,d=t[i.response.dataName]||[],t=t[i.response.totalRowName],r=[],c=[],s=[],u=function(){if(!o&&a.sortKey)return a.sort({field:a.sortKey.field,type:a.sortKey.sort,pull:!0,reloadType:e.type});a.getTrHtml(d,o,l,{trs:r,trs_fixed:c,trs_fixed_r:s}),"fixed"===i.scrollPos&&"reloadData"===e.type||a.layBody.scrollTop(0),"reset"===i.scrollPos&&a.layBody.scrollLeft(0),a.layMain.find("."+h).remove(),a.layMain.find("tbody").html(r.join("")),a.layFixLeft.find("tbody").html(c.join("")),a.layFixRight.find("tbody").html(s.join("")),a.syncCheckAll(),a.renderForm(),a.fullSize(),a.haveInit?a.scrollPatch():setTimeout(function(){a.scrollPatch()},50),a.haveInit=!0,g.close(a.tipsIndex)};return k.cache[a.key]=d,a.layTotal[0==d.length?"addClass":"removeClass"](y),a.layPage[i.page||i.pagebar?"removeClass":"addClass"](W),a.layPage.find(P)[!i.page||0==n||0===d.length&&1==l?"addClass":"removeClass"](y),0===d.length?a.errorView(i.text.none):(a.layFixLeft.removeClass(W),o?u():(u(),a.renderTotal(d,t),a.layTotal&&a.layTotal.removeClass(W),void(i.page&&(i.page=f.extend({elem:"layui-table-page"+i.index,count:n,limit:i.limit,limits:i.limits||[10,20,30,40,50,60,70,80,90],groups:3,layout:["prev","page","next","skip","count","limit"],prev:'',next:'',jump:function(e,t){t||(a.page=e.curr,i.limit=e.limit,a.pullData(e.curr))}},i.page),i.page.count=n,p.render(i.page)))))},k.renderData=function(e){e=C(e);e&&e.pullData(e.page,{renderData:!0,type:"reloadData"})},n.prototype.renderTotal=function(e,o){var d,r=this,c=r.config,s={};c.totalRow&&(layui.each(e,function(e,i){"array"===layui.type(i)&&0===i.length||r.eachCols(function(e,t){var e=t.field||e,a=i[e];t.totalRow&&(s[e]=(s[e]||0)+(parseFloat(a)||0))})}),r.dataTotal=[],d=[],r.eachCols(function(e,t){var e=t.field||e,a=o&&o[t.field],i="totalRowDecimals"in t?t.totalRowDecimals:2,i=s[e]?parseFloat(s[e]||0).toFixed(i):"",i=(n=t.totalRowText||"",(l={LAY_COL:t})[e]=i,l=t.totalRow&&T.call(r,{item3:t,content:i,tplData:l})||n,a||l),l="string"==typeof(n=t.totalRow||c.totalRow)?m(n).render(f.extend({TOTAL_NUMS:a||s[e],TOTAL_ROW:o||{},LAY_COL:t},t)):i,n=(t.field&&r.dataTotal.push({field:t.field,total:f("
          "+l+"
          ").text()}),['','
          "+l,"
          "].join(""));d.push(n)}),e=r.layTotal.find(".layui-table-patch"),r.layTotal.find("tbody").html(""+d.join("")+(e.length?e.get(0).outerHTML:"")+""))},n.prototype.getColElem=function(e,t){return e.eq(0).find(".laytable-cell-"+t+":eq(0)")},n.prototype.renderForm=function(e){this.config;var t=this.elem.attr("lay-filter");i.render(e,t)},n.prototype.renderFormByElem=function(a){layui.each(["input","select"],function(e,t){i.render(a.find(t))})},n.prototype.syncCheckAll=function(){var a,e=this,i=e.config,t=e.layHeader.find('input[name="layTableCheckbox"]'),l=k.checkStatus(e.key);t[0]&&(a=l.isAll,e.eachCols(function(e,t){"checkbox"===t.type&&(t[i.checkName]=a)}),t.prop({checked:l.isAll,indeterminate:!l.isAll&&l.data.length}))},n.prototype.setRowActive=function(e,t,a){this.config;e=this.layBody.find('tr[data-index="'+e+'"]');if(t=t||"layui-table-click",a)return e.removeClass(t);e.addClass(t),e.siblings("tr").removeClass(t)},n.prototype.setRowChecked=function(i){var a,e,l,t,n,o,d,r=this,c=r.config,s="all"===i.index,u="array"===layui.type(i.index),y=s||u;c.tree&&c.tree.view||y&&(r.layBox.addClass(O),"radio"===i.type)||(u&&(a={},layui.each(i.index,function(e,t){a[t]=!0}),i.index=a),e=r.layBody.children(".layui-table").children("tbody"),d=y?"tr":'tr[data-index="'+i.index+'"]',d=e.children(d),e=s?d:d.filter(u?function(){var e=f(this).data("index");return i.index[e]}:'[data-index="'+i.index+'"]'),i=f.extend({type:"checkbox"},i),l=k.cache[r.key],t="checked"in i,n=function(e){return"radio"===i.type||(t?i.checked:!e)},e.each(function(){var e=f(this),t=e.attr("data-index"),a=l[t];t&&"array"!==layui.type(a)&&!a[c.disabledName]&&(a=a[c.checkName]=n(e.hasClass(A)),e.toggleClass(A,!!a),"radio"===i.type)&&(o=t,e.siblings().removeClass(A))}),o&&layui.each(l,function(e,t){Number(o)!==Number(e)&&delete t[c.checkName]}),d=(u=(s=e.children("td").children(".layui-table-cell").children('input[lay-type="'+({radio:"layTableRadio",checkbox:"layTableCheckbox"}[i.type]||"checkbox")+'"]:not(:disabled)')).last()).closest(I),("radio"===i.type&&d.hasClass(W)?s.first():s).prop("checked",n(u.prop("checked"))),r.syncCheckAll(),y&&setTimeout(function(){r.layBox.removeClass(O)},100))},n.prototype.sort=function(l){var e,t=this,a={},i=t.config,n=i.elem.attr("lay-filter"),o=k.cache[t.key];"string"==typeof(l=l||{}).field&&(d=l.field,t.layHeader.find("th").each(function(e,t){var a=f(this),i=a.data("field");if(i===l.field)return l.field=a,d=i,!1}));try{var d=d||l.field.data("field"),r=l.field.data("key");if(t.sortKey&&!l.pull&&d===t.sortKey.field&&l.type===t.sortKey.sort)return;var c=t.layHeader.find("th .laytable-cell-"+r).find(L);t.layHeader.find("th").find(L).removeAttr("lay-sort"),c.attr("lay-sort",l.type||null),t.layFixed.find("th")}catch(s){b.error("Table modules: sort field '"+d+"' not matched")}t.sortKey={field:d,sort:l.type},i.autoSort&&("asc"===l.type?e=layui.sort(o,d,null,!0):"desc"===l.type?e=layui.sort(o,d,!0,!0):(e=layui.sort(o,k.config.initIndexName,null,!0),delete t.sortKey,delete i.initSort)),a[i.response.dataName]=e||o,t.renderData({res:a,curr:t.page,count:t.count,sort:!0,type:l.reloadType}),l.fromEvent&&(i.initSort={field:d,type:l.type},layui.event.call(l.field,R,"sort("+n+")",f.extend({config:i},i.initSort)))},n.prototype.loading=function(e){this.config.loading&&this.layBox.find(".layui-table-init").toggleClass(W,!e)},n.prototype.cssRules=function(t,a){var e=this.elem.children("style")[0];r.getStyleRules(e,function(e){if(e.selectorText===".laytable-cell-"+t)return a(e),!0})},n.prototype.fullSize=function(){var e,a,i=this,t=i.config,l=t.height;i.fullHeightGap?(l=d.height()-i.fullHeightGap)<135&&(l=135):i.parentDiv&&i.parentHeightGap?(l=f(i.parentDiv).height()-i.parentHeightGap)<135&&(l=135):i.customHeightFunc&&(l=i.customHeightFunc())<135&&(l=135),1
          ')).find("div").css({width:a}),e.find("tr").append(t)):e.find(".layui-table-patch").remove()};n(e.layHeader),n(e.layTotal);n=e.layMain.height()-i;e.layFixed.find(D).css("height",t.height()>=n?n:"auto").scrollTop(e.layMain.scrollTop()),e.layFixRight[k.cache[e.key]&&k.cache[e.key].length&&0');a.html(t),s.height&&a.css("max-height",s.height-(c.layTool.outerHeight()||50)),i.find("."+S)[0]||i.append(a),c.renderForm(),a.on("click",function(e){layui.stope(e)}),e.done&&e.done(a,t)};layui.stope(e),z.trigger("table.tool.panel.remove"),g.close(c.tipsIndex),layui.each(s.defaultToolbar,function(e,t){if(t.layEvent===a)return"function"==typeof t.onClick&&t.onClick({data:l,config:s,openPanel:n,elem:i}),!0}),layui.event.call(this,R,"toolbar("+o+")",f.extend({event:a,config:s},{}))}),c.layHeader.on("click","*[lay-event]",function(e){var t=f(this),a=t.attr("lay-event"),t=t.closest("th").data("key"),t=c.col(t);layui.event.call(this,R,"colTool("+o+")",f.extend({event:a,config:s,col:t},{}))}),c.layPagebar.on("click","*[lay-event]",function(e){var t=f(this).attr("lay-event");layui.event.call(this,R,"pagebar("+o+")",f.extend({event:t,config:s},{}))}),e.on("mousemove",function(e){var t=f(this),a=t.offset().left,e=e.clientX-a;t.data("unresize")||w.eventMoveElem||(r.allowResize=t.width()-e<=10,d.css("cursor",r.allowResize?"col-resize":""))}).on("mouseleave",function(){f(this);w.eventMoveElem||(r.allowResize=!1,d.css("cursor",""))}).on("mousedown",function(e){var t,a=f(this);r.allowResize&&(t=a.data("key"),e.preventDefault(),r.offset=[e.clientX,e.clientY],c.cssRules(t,function(e){var t=e.style.width||a.outerWidth();r.rule=e,r.ruleWidth=parseFloat(t),r.minWidth=a.data("minwidth")||s.cellMinWidth,r.maxWidth=a.data("maxwidth")||s.cellMaxWidth}),a.data(j,r),w.eventMoveElem=a)}),w.docEvent||z.on("mousemove",function(e){var t,a;w.eventMoveElem&&(t=w.eventMoveElem.data(j)||{},w.eventMoveElem.data("resizing",1),e.preventDefault(),t.rule)&&(e=t.ruleWidth+e.clientX-t.offset[0],a=w.eventMoveElem.closest("."+_).attr(N),a=C(a))&&((e=et.maxWidth&&(e=t.maxWidth),t.rule.style.width=e+"px",a.setGroupWidth(w.eventMoveElem),g.close(c.tipsIndex))}).on("mouseup",function(e){var t,a,i,l,n;w.eventMoveElem&&(i=(t=w.eventMoveElem).closest("."+_).attr(N),a=C(i))&&(i=t.data("key"),l=a.col(i),n=a.config.elem.attr("lay-filter"),r={},d.css("cursor",""),a.scrollPatch(),t.removeData(j),delete w.eventMoveElem,a.cssRules(i,function(e){l.width=parseFloat(e.style.width),layui.event.call(t[0],R,"colResized("+n+")",{col:l,config:a.config})}))}),w.docEvent=!0,e.on("click",function(e){var t=f(this),a=t.find(L),i=a.attr("lay-sort");if(!a[0]||1===t.data("resizing"))return t.removeData("resizing");c.sort({field:t,type:"asc"===i?"desc":"desc"===i?null:"asc",fromEvent:!0})}).find(L+" .layui-edge ").on("click",function(e){var t=f(this),a=t.index(),t=t.parents("th").eq(0).data("field");layui.stope(e),0===a?c.sort({field:t,type:"asc",fromEvent:!0}):c.sort({field:t,type:"desc",fromEvent:!0})}),c.commonMember=function(e){var a=f(this).parents("tr").eq(0).data("index"),t=c.layBody.find('tr[data-index="'+a+'"]'),i=(k.cache[c.key]||[])[a]||{},l={tr:t,config:s,data:k.clearCacheKey(i),dataCache:i,index:a,del:function(){k.cache[c.key][a]=[],t.remove(),c.scrollPatch()},update:function(e,t){c.updateRow({index:a,data:e=e||{},related:t},function(e,t){l.data[e]=t})},setRowChecked:function(e){c.setRowChecked(f.extend({index:a},e))}};return f.extend(l,e)}),t=(c.elem.on("click",'input[name="layTableCheckbox"]+',function(e){var t=f(this),a=t.closest("td"),t=t.prev(),i=(c.layBody.find('input[name="layTableCheckbox"]'),t.parents("tr").eq(0).data("index")),l=t[0].checked,n="layTableAllChoose"===t.attr("lay-filter");t[0].disabled||(n?c.setRowChecked({index:"all",checked:l}):c.setRowChecked({index:i,checked:l}),layui.stope(e),layui.event.call(t[0],R,"checkbox("+o+")",y.call(t[0],{checked:l,type:n?"all":"one",getCol:function(){return c.col(a.data("key"))}})))}),c.elem.on("click",'input[lay-type="layTableRadio"]+',function(e){var t=f(this),a=t.closest("td"),t=t.prev(),i=t[0].checked,l=t.parents("tr").eq(0).data("index");if(layui.stope(e),t[0].disabled)return!1;c.setRowChecked({type:"radio",index:l}),layui.event.call(t[0],R,"radio("+o+")",y.call(t[0],{checked:i,getCol:function(){return c.col(a.data("key"))}}))}),c.layBody.on("mouseenter","tr",function(){var e=f(this),t=e.index();e.data("off")||c.layBody.find("tr:eq("+t+")").addClass(M)}).on("mouseleave","tr",function(){var e=f(this),t=e.index();e.data("off")||c.layBody.find("tr:eq("+t+")").removeClass(M)}).on("click","tr",function(e){t.call(this,"row",e)}).on("dblclick","tr",function(e){t.call(this,"rowDouble",e)}).on("contextmenu","tr",function(e){s.defaultContextmenu||e.preventDefault(),t.call(this,"rowContextmenu",e)}),function(e,t){var a=f(this);if(!a.data("off")){if("rowContextmenu"!==e){var i=[".layui-form-checkbox",".layui-form-switch",".layui-form-radio","[lay-unrow]"].join(",");if(f(t.target).is(i)||f(t.target).closest(i)[0])return}layui.event.call(this,R,e+"("+o+")",y.call(a.children("td")[0],{e:t}))}}),n=function(e,t){var a,i,l;(e=f(e)).data("off")||(l=e.data("field"),i=e.data("key"),i=c.col(i),a=e.closest("tr").data("index"),a=k.cache[c.key][a],e.children(u),(i="function"==typeof i.edit?i.edit(a):i.edit)&&((i=f("textarea"===i?'':''))[0].value=(l=e.data("content")||a[l])===undefined||null===l?"":l,e.find("."+E)[0]||e.append(i),i.focus(),t)&&layui.stope(t))},i=(c.layBody.on("change","."+E,function(){var e=f(this),t=e.parent(),a=this.value,i=e.parent().data("field"),e=e.closest("tr").data("index"),e=k.cache[c.key][e],l=y.call(t[0],{value:a,field:i,oldValue:e[i],td:t,reedit:function(){setTimeout(function(){n(l.td);var e={};e[i]=l.oldValue,l.update(e)})},getCol:function(){return c.col(t.data("key"))}}),e={};e[i]=a,l.update(e),layui.event.call(t[0],R,"edit("+o+")",l)}).on("blur","."+E,function(){f(this).remove()}),c.layBody.on(s.editTrigger,"td",function(e){n(this,e)}).on("mouseenter","td",function(){a.call(this)}).on("mouseleave","td",function(){a.call(this,"hide")}),c.layTotal.on("mouseenter","td",function(){a.call(this)}).on("mouseleave","td",function(){a.call(this,"hide")}),"layui-table-grid-down"),a=function(e){var t=f(this),a=t.children(u);t.data("off")||t.parent().hasClass(H)||(e?t.find(".layui-table-grid-down").remove():!(a.prop("scrollWidth")>a.prop("clientWidth")||0'))},l=function(e,t){var a=f(this),i=a.parent(),l=i.data("key"),n=c.col(l),o=i.parent().data("index"),d=i.children(u),i="layui-table-cell-c",r=f('');"tips"===(t=t||n.expandedMode||s.cellExpandedMode)?c.tipsIndex=g.tips(['
          ',d.html(),"
          ",''].join(""),d[0],{tips:[3,""],time:-1,anim:-1,maxWidth:x.ios||x.android?300:c.elem.width()/2,isOutAnim:!1,skin:"layui-table-tips",success:function(e,t){e.find(".layui-table-tips-c").on("click",function(){g.close(t)})}}):(c.elem.find("."+i).trigger("click"),c.cssRules(l,function(e){var t=e.style.width,a=n.expandedWidth||s.cellExpandedWidth;atr").each(function(i){n.cols[i]=[],f(this).children().each(function(e){var t=f(this),a=t.attr("lay-data"),a=r.options(this,{attr:a?"lay-data":null,errorText:d+(a||t.attr("lay-options"))}),t=f.extend({title:t.text(),colspan:parseInt(t.attr("colspan"))||1,rowspan:parseInt(t.attr("rowspan"))||1},a);n.cols[i].push(t)})}),e.find("tbody>tr")),t=k.render(n);!a.length||o.data||t.config.url||(l=0,k.eachCols(t.config.id,function(e,i){a.each(function(e){n.data[e]=n.data[e]||{};var t=f(this),a=i.field;n.data[e][a]=t.children("td").eq(l).html()}),l++}),t.reloadData({data:n.data}))}),this},w.that={},w.config={},function(a,i,e,l){var n,o;l.colGroup&&(n=0,a++,l.CHILD_COLS=[],o=e+(parseInt(l.rowspan)||1),layui.each(i[o],function(e,t){t.parentKey?t.parentKey===l.key&&(t.PARENT_COL_INDEX=a,l.CHILD_COLS.push(t),c(a,i,o,t)):t.PARENT_COL_INDEX||1<=n&&n==(l.colspan||1)||(t.PARENT_COL_INDEX=a,l.CHILD_COLS.push(t),n+=parseInt(1td').filter('[data-field="'+e+'"]')}}})).replace(/"/g,'""'),n.push(a='"'+a+'"')):t.field&&"normal"!==t.type&&0==i&&(u[t.field]=!0)}),c.push(n.join(","))}),o&&layui.each(o.dataTotal,function(e,t){u[t.field]||s.push('"'+(t.total||"")+'"')}),r.join(",")+"\r\n"+c.join("\r\n")+"\r\n"+s.join(","))),d.download=(a.title||l.title||"table_"+(l.index||""))+"."+i,document.body.appendChild(d),d.click(),document.body.removeChild(d)},k.getOptions=l,k.hideCol=function(e,l){var n=C(e);n&&("boolean"===layui.type(l)?n.eachCols(function(e,t){var a=t.key,i=n.col(a),t=t.parentKey;i.hide!=l&&(i=i.hide=l,n.elem.find('*[data-key="'+a+'"]')[i?"addClass":"removeClass"](W),n.setParentCol(i,t))}):(l=layui.isArray(l)?l:[l],layui.each(l,function(e,l){n.eachCols(function(e,t){var a,i;l.field===t.field&&(a=t.key,i=n.col(a),t=t.parentKey,"hide"in l)&&i.hide!=l.hide&&(i=i.hide=!!l.hide,n.elem.find('*[data-key="'+a+'"]')[i?"addClass":"removeClass"](W),n.setParentCol(i,t))})})),f("."+S).remove(),n.resize())},k.reload=function(e,t,a,i){if(l(e))return(e=C(e)).reload(t,a,i),w.call(e)},k.reloadData=function(){var a=f.extend([],arguments),i=(a[3]="reloadData",new RegExp("^("+["elem","id","cols","width","height","maxHeight","toolbar","defaultToolbar","className","css","pagebar"].join("|")+")$"));return layui.each(a[1],function(e,t){i.test(e)&&delete a[1][e]}),k.reload.apply(null,a)},k.render=function(e){e=new n(e);return w.call(e)},k.clearCacheKey=function(e){return delete(e=f.extend({},e))[k.config.checkName],delete e[k.config.indexName],delete e[k.config.initIndexName],delete e[k.config.numbersName],delete e[k.config.disabledName],e},f(function(){k.init()}),s(R,k)});layui.define(["table"],function(e){"use strict";var A=layui.$,h=layui.form,P=layui.table,y=layui.hint(),B={config:{},on:P.on,eachCols:P.eachCols,index:P.index,set:function(e){var t=this;return t.config=A.extend({},t.config,e),t},resize:P.resize,getOptions:P.getOptions,hideCol:P.hideCol,renderData:P.renderData},i=function(){var a=this,e=a.config,n=e.id||e.index;return{config:e,reload:function(e,t){a.reload.call(a,e,t)},reloadData:function(e,t){B.reloadData(n,e,t)}}},j=function(e){var t=i.that[e];return t||y.error(e?"The treeTable instance with ID '"+e+"' not found":"ID argument required"),t||null},F="lay-table-id",L="layui-hide",s=".layui-table-body",q=".layui-table-main",R=".layui-table-fixed-l",Y=".layui-table-fixed-r",l="layui-table-checked",m="layui-table-tree",z="LAY_DATA_INDEX",b="LAY_DATA_INDEX_HISTORY",f="LAY_PARENT_INDEX",g="LAY_CHECKBOX_HALF",H="LAY_EXPAND",X="LAY_HAS_EXPANDED",V="LAY_ASYNC_STATUS",n=["all","parent","children","none"],t=/<[^>]+?>/,p=["flexIconClose","flexIconOpen","iconClose","iconOpen","iconLeaf","icon"],a=function(e){var t=this;t.index=++B.index,t.config=A.extend(!0,{},t.config,B.config,e),t.init(),t.render()},x=function(n,i,e){var l=P.cache[n];layui.each(e||l,function(e,t){var a=t[z]||"";-1!==a.indexOf("-")&&(l[a]=t),t[i]&&x(n,i,t[i])})},d=function(d,a,e){var r=j(d),o=("reloadData"!==e&&(r.status={expand:{}}),A.extend(!0,{},r.getOptions(),a)),n=o.tree,c=n.customName.children,i=n.customName.id,l=(delete a.hasNumberCol,delete a.hasChecboxCol,delete a.hasRadioCol,P.eachCols(null,function(e,t){"numbers"===t.type?a.hasNumberCol=!0:"checkbox"===t.type?a.hasChecboxCol=!0:"radio"===t.type&&(a.hasRadioCol=!0)},o.cols),a.parseData),u=a.done;"reloadData"===e&&"fixed"===o.scrollPos&&(r.scrollTopCache=r.config.elem.next().find(s).scrollTop()),o.url?e&&(!l||l.mod)||(a.parseData=function(){var e=this,t=arguments,a=t[0],t=("function"===layui.type(l)&&(a=l.apply(e,t)||t[0]),e.response.dataName);return n.data.isSimpleData&&!n["async"].enable&&(a[t]=r.flatToTree(a[t])),N(a[t],function(e){e[H]=H in e?e[H]:e[i]!==undefined&&r.status.expand[e[i]]},c),e.autoSort&&e.initSort&&e.initSort.type&&layui.sort(a[t],e.initSort.field,"desc"===e.initSort.type,!0),r.initData(a[t]),a},a.parseData.mod=!0):a.data!==undefined&&(a.data=a.data||[],n.data.isSimpleData&&(a.data=r.flatToTree(a.data)),r.initData(a.data)),e&&(!u||u.mod)||(a.done=function(){var e,t=arguments,a=t[3],n="renderData"===a,i=(n||delete r.isExpandAll,this.elem.next()),l=(r.updateStatus(null,{LAY_HAS_EXPANDED:!1}),x(d,c),i.find('[name="layTableCheckbox"][lay-filter="layTableAllChoose"]'));if(l.length&&(e=B.checkStatus(d),l.prop({checked:e.isAll&&e.data.length,indeterminate:!e.isAll&&e.data.length})),!n&&o.autoSort&&o.initSort&&o.initSort.type&&B.sort(d),r.renderTreeTable(i),"reloadData"===a&&"fixed"===this.scrollPos&&i.find(s).scrollTop(r.scrollTopCache),"function"===layui.type(u))return u.apply(this,t)},a.done.mod=!0),a&&a.tree&&a.tree.view&&layui.each(p,function(e,t){a.tree.view[t]!==undefined&&(a.tree.view[t]=r.normalizedIcon(a.tree.view[t]))})};a.prototype.init=function(){var e=this.config,t=e.tree.data.cascade,t=(-1===n.indexOf(t)&&(e.tree.data.cascade="all"),P.render(A.extend({},e,{data:[],url:"",done:null}))),a=t.config.id;(i.that[a]=this).tableIns=t,d(a,e)},a.prototype.config={tree:{customName:{children:"children",isParent:"isParent",name:"name",id:"id",pid:"parentId",icon:"icon"},view:{indent:14,flexIconClose:'',flexIconOpen:'',showIcon:!0,icon:"",iconClose:'',iconOpen:'',iconLeaf:'',showFlexIconIfNotParent:!1,dblClickExpand:!0,expandAllDefault:!1},data:{isSimpleData:!1,rootPid:null,cascade:"all"},"async":{enable:!1,url:"",type:null,contentType:null,headers:null,where:null,autoParam:[]},callback:{beforeExpand:null,onExpand:null}}},a.prototype.normalizedIcon=function(e){return e?t.test(e)?e:'':""},a.prototype.getOptions=function(){return this.tableIns?P.getOptions(this.tableIns.config.id):this.config},a.prototype.flatToTree=function(e){var n,i,l,d,r,o,c,u,t=this.getOptions(),a=t.tree,s=a.customName;return e=e||P.cache[t.id],t=e,n=s.id,i=s.pid,l=s.children,d=a.data.rootPid,n=n||"id",i=i||"parentId",l=l||"children",c={},u=[],layui.each(t,function(e,t){r=n+t[n],o=n+t[i],c[r]||(c[r]={},c[r][l]=[]);var a={};a[l]=c[r][l],c[r]=A.extend({},t,a),((d?c[r][i]===d:!c[r][i])?u:(c[o]||(c[o]={},c[o][l]=[]),c[o][l])).push(c[r])}),u},a.prototype.treeToFlat=function(e,n,i){var l=this,d=l.getOptions().tree.customName,r=d.children,o=d.pid,c=[];return layui.each(e,function(e,t){var e=(i?i+"-":"")+e,a=A.extend({},t);a[o]="undefined"!=typeof t[o]?t[o]:n,c.push(a),c=c.concat(l.treeToFlat(t[r],t[d.id],e))}),c},a.prototype.getTreeNode=function(e){var t,a=this;return e?(t=a.getOptions().tree,t.customName,{data:e,dataIndex:e[z],getParentNode:function(){return a.getNodeByIndex(e[f])}}):y.error("\u627e\u4e0d\u5230\u8282\u70b9\u6570\u636e")},a.prototype.getNodeByIndex=function(t){var a,e,n=this,i=n.getNodeDataByIndex(t);return i?((e=n.getOptions()).tree.customName.parent,a=e.id,(e={data:i,dataIndex:i[z],getParentNode:function(){return n.getNodeByIndex(i[f])},update:function(e){return B.updateNode(a,t,e)},remove:function(){return B.removeNode(a,t)},expand:function(e){return B.expandNode(a,A.extend({},e,{index:t}))},setChecked:function(e){return B.setRowChecked(a,A.extend({},e,{index:t}))}}).dataIndex=t,e):y.error("\u627e\u4e0d\u5230\u8282\u70b9\u6570\u636e")},a.prototype.getNodeById=function(a){var e=this.getOptions(),n=e.tree.customName.id,i="",e=B.getData(e.id,!0);if(layui.each(e,function(e,t){if(t[n]===a)return i=t[z],!0}),i)return this.getNodeByIndex(i)},a.prototype.getNodeDataByIndex=function(e,t,a){var n=this.getOptions(),i=n.tree,n=P.cache[n.id],l=n[e];if("delete"!==a&&l)return A.extend(l,a),t?A.extend({},l):l;for(var d=n,r=String(e).split("-"),o=0,c=i.customName.children;o
          '),N=function(e){y[V]="success",y[s.children]=e,c.initData(y[s.children],y[z]),J(t,!0,!p&&n,i,l)},C=m.format,"function"===layui.type(C)?C(y,o,N):(I=A.extend({},m.where||o.where),C=m.autoParam,layui.each(C,function(e,t){t=t.split("=");I[t[0].trim()]=y[(t[1]||t[0]).trim()]}),(C=m.contentType||o.contentType)&&0==C.indexOf("application/json")&&(I=JSON.stringify(I)),O=m.method||o.method,D=m.dataType||o.dataType,T=m.jsonpCallback||o.jsonpCallback,_=m.headers||o.headers,k=m.parseData||o.parseData,w=m.response||o.response,A.ajax({type:O||"get",url:b,contentType:C,data:I,dataType:D||"json",jsonpCallback:T,headers:_||{},success:function(e){(e="function"==typeof k?k.call(o,e)||e:e)[w.statusName]!=w.statusCode?(y[V]="error",y[H]=!1,g.html('')):N(e[w.dataName])},error:function(e,t){y[V]="error",y[H]=!1,"function"==typeof o.error&&o.error(e,t)}})),h;y[X]=!0,v.length&&(!o.initSort||o.url&&!o.autoSort||((m=o.initSort).type?layui.sort(v,m.field,"desc"===m.type,!0):layui.sort(v,P.config.indexName,null,!0)),c.initData(y[s.children],y[z]),O=P.getTrHtml(r,v,null,null,e),S={trs:A(O.trs.join("")),trs_fixed:A(O.trs_fixed.join("")),trs_fixed_r:A(O.trs_fixed_r.join(""))},E=(e.split("-").length-1||0)+1,layui.each(v,function(e,t){S.trs.eq(e).attr({"data-index":t[z],"lay-data-index":t[z],"data-level":E}).data("index",t[z]),S.trs_fixed.eq(e).attr({"data-index":t[z],"lay-data-index":t[z],"data-level":E}).data("index",t[z]),S.trs_fixed_r.eq(e).attr({"data-index":t[z],"lay-data-index":t[z],"data-level":E}).data("index",t[z])}),d.find(q).find('tbody tr[lay-data-index="'+e+'"]').after(S.trs),d.find(R).find('tbody tr[lay-data-index="'+e+'"]').after(S.trs_fixed),d.find(Y).find('tbody tr[lay-data-index="'+e+'"]').after(S.trs_fixed_r),c.renderTreeTable(S.trs,E),n)&&!p&&layui.each(v,function(e,t){J({dataIndex:t[z],trElem:d.find('tr[lay-data-index="'+t[z]+'"]').first(),tableViewElem:d,tableId:r,options:o},a,n,i,l)})}else c.isExpandAll=!1,(n&&!p?(layui.each(v,function(e,t){J({dataIndex:t[z],trElem:d.find('tr[lay-data-index="'+t[z]+'"]').first(),tableViewElem:d,tableId:r,options:o},a,n,i,l)}),d.find(v.map(function(e,t,a){return'tr[lay-data-index="'+e[z]+'"]'}).join(","))):(b=c.treeToFlat(v,y[s.id],e),d.find(b.map(function(e,t,a){return'tr[lay-data-index="'+e[z]+'"]'}).join(",")))).addClass(L);U("resize-"+r,function(){B.resize(r)},0)(),l&&"loading"!==y[V]&&(C=u.callback.onExpand,"function"===layui.type(C))&&C(r,y,x)}return h},v=(B.expandNode=function(e,t){var a,n,i,e=j(e);if(e)return a=(t=t||{}).index,n=t.expandFlag,i=t.inherit,t=t.callbackFlag,e=e.getOptions().elem.next(),J({trElem:e.find('tr[lay-data-index="'+a+'"]').first()},n,i,null,t)},B.expandAll=function(a,e){if("boolean"!==layui.type(e))return y.error("expandAll \u7684\u5c55\u5f00\u72b6\u6001\u53c2\u6570\u53ea\u63a5\u6536true/false");var t=j(a);if(t){t.isExpandAll=e;var n=t.getOptions(),i=n.tree,l=n.elem.next(),d=i.customName.isParent,r=i.customName.id,o=i.view.showFlexIconIfNotParent;if(e){e=B.getData(a,!0);if(i["async"].enable){var c=!0;if(layui.each(e,function(e,t){if(t[d]&&!t[V])return!(c=!1)}),!c)return void layui.each(B.getData(a),function(e,t){B.expandNode(a,{index:t[z],expandFlag:!0,inherit:!0})})}var u=!0;if(layui.each(e,function(e,t){if(t[d]&&!t[X])return!(u=!1)}),u)t.updateStatus(null,function(e){(e[d]||o)&&(e[H]=!0,e[r]!==undefined)&&(t.status.expand[e[r]]=!0)}),l.find('tbody tr[data-level!="0"]').removeClass(L),l.find(".layui-table-tree-flexIcon").html(i.view.flexIconOpen),i.view.showIcon&&l.find(".layui-table-tree-nodeIcon:not(.layui-table-tree-iconCustom,.layui-table-tree-iconLeaf)").html(i.view.iconOpen);else{if(t.updateStatus(null,function(e){(e[d]||o)&&(e[H]=!0,e[X]=!0,e[r]!==undefined)&&(t.status.expand[e[r]]=!0)}),n.initSort&&n.initSort.type&&n.autoSort)return B.sort(a);var s,n=P.getTrHtml(a,e),f={trs:A(n.trs.join("")),trs_fixed:A(n.trs_fixed.join("")),trs_fixed_r:A(n.trs_fixed_r.join(""))};layui.each(e,function(e,t){var a=t[z].split("-").length-1;s={"data-index":t[z],"lay-data-index":t[z],"data-level":a},f.trs.eq(e).attr(s).data("index",t[z]),f.trs_fixed.eq(e).attr(s).data("index",t[z]),f.trs_fixed_r.eq(e).attr(s).data("index",t[z])}),layui.each(["main","fixed-l","fixed-r"],function(e,t){l.find(".layui-table-"+t+" tbody").html(f[["trs","trs_fixed","trs_fixed_r"][e]])}),t.renderTreeTable(l,0,!1)}}else t.updateStatus(null,function(e){(e[d]||o)&&(e[H]=!1,e[r]!==undefined)&&(t.status.expand[e[r]]=!1)}),l.find('.layui-table-box tbody tr[data-level!="0"]').addClass(L),l.find(".layui-table-tree-flexIcon").html(i.view.flexIconClose),i.view.showIcon&&l.find(".layui-table-tree-nodeIcon:not(.layui-table-tree-iconCustom,.layui-table-tree-iconLeaf)").html(i.view.iconClose);B.resize(a)}},a.prototype.updateNodeIcon=function(e){var t=this.getOptions().tree||{},a=e.scopeEl,n=e.isExpand,e=e.isParent;a.find(".layui-table-tree-flexIcon").css("visibility",e||t.view.showFlexIconIfNotParent?"visible":"hidden").html(n?t.view.flexIconOpen:t.view.flexIconClose),t.view.showIcon&&(a=a.find(".layui-table-tree-nodeIcon:not(.layui-table-tree-iconCustom)"),n=e?n?t.view.iconOpen:t.view.iconClose:t.view.iconLeaf,a.toggleClass("layui-table-tree-iconLeaf",!e).html(n))},a.prototype.renderTreeTable=function(e,t,a){var l=this,n=l.getOptions(),d=n.elem.next(),i=(d.hasClass(m)||d.addClass(m),n.id),r=n.tree||{},o=(r.data,r.view||{}),c=r.customName||{},u=c.isParent,s=(d.attr("lay-filter"),l),f=n.data.length,y=((t=t||0)||(d.find(".layui-table-body tr:not([data-level])").attr("data-level",t),layui.each(P.cache[i],function(e,t){f&&(t[z]=String(e));t=t[z];d.find('.layui-table-main tbody tr[data-level="0"]:eq('+e+")").attr("lay-data-index",t),d.find('.layui-table-fixed-l tbody tr[data-level="0"]:eq('+e+")").attr("lay-data-index",t),d.find('.layui-table-fixed-r tbody tr[data-level="0"]:eq('+e+")").attr("lay-data-index",t)})),null),p=c.name,x=o.indent||14;if(layui.each(e.find('td[data-field="'+p+'"]'),function(e,t){var a,n,i=(t=A(t)).closest("tr"),t=t.children(".layui-table-cell");t.hasClass("layui-table-tree-item")||(n=i.attr("lay-data-index"))&&(i=d.find('tr[lay-data-index="'+n+'"]'),(a=s.getNodeDataByIndex(n))[H]&&a[u]&&((y=y||{})[n]=!0),a[g]&&i.find('input[type="checkbox"][name="layTableCheckbox"]').prop("indeterminate",!0),n=t.html(),(t=i.find('td[data-field="'+p+'"]>div.layui-table-cell')).addClass("layui-table-tree-item"),t.html(['
          ',a[H]?o.flexIconOpen:o.flexIconClose,"
          ",o.showIcon?'
          '+(l.normalizedIcon(a[c.icon])||o.icon||(a[u]?a[H]?o.iconOpen:o.iconClose:o.iconLeaf)||"")+"
          ":"",n].join("")).find(".layui-table-tree-flexIcon").on("click",function(e){layui.stope(e),J({trElem:i},null,null,null,!0)}))}),!t&&r.view.expandAllDefault&&l.isExpandAll===undefined)return B.expandAll(i,!0);(!1!==a&&y?(layui.each(y,function(e,t){e=d.find('tr[lay-data-index="'+e+'"]');e.find(".layui-table-tree-flexIcon").html(o.flexIconOpen),J({trElem:e.first()},!0)}),U("renderTreeTable2-"+i,function(){h.render(A(".layui-table-tree["+F+'="'+i+'"]'))},0)):U("renderTreeTable-"+i,function(){n.hasNumberCol&&v(l),h.render(A(".layui-table-tree["+F+'="'+i+'"]'))},0))()},function(a){var e=a.getOptions(),t=e.elem.next(),n=0,i=t.find(".layui-table-main tbody tr"),l=t.find(".layui-table-fixed-l tbody tr"),d=t.find(".layui-table-fixed-r tbody tr");layui.each(a.treeToFlat(P.cache[e.id]),function(e,t){t.LAY_HIDE||(a.getNodeDataByIndex(t[z]).LAY_NUM=++n,i.eq(e).find(".laytable-cell-numbers").html(n),l.eq(e).find(".laytable-cell-numbers").html(n),d.eq(e).find(".laytable-cell-numbers").html(n))})}),N=(a.prototype.render=function(e){var t=this;t.tableIns=P["reloadData"===e?"reloadData":"reload"](t.tableIns.config.id,A.extend(!0,{},t.config)),t.config=t.tableIns.config},a.prototype.reload=function(e,t,a){var n=this;e=e||{},delete n.haveInit,layui.each(e,function(e,t){"array"===layui.type(t)&&delete n.config[e]}),d(n.getOptions().id,e,a||!0),n.config=A.extend(t,{},n.config,e),n.render(a)},B.reloadData=function(){var e=A.extend(!0,[],arguments);return e[3]="reloadData",B.reload.apply(null,e)},function(e,a,n,i){var l=[];return layui.each(e,function(e,t){"function"===layui.type(a)?a(t):A.extend(t,a),l.push(A.extend({},t)),i||(l=l.concat(N(t[n],a,n,i)))}),l}),o=(a.prototype.updateStatus=function(e,t,a){var n=this.getOptions(),i=n.tree;return e=e||P.cache[n.id],N(e,t,i.customName.children,a)},a.prototype.getTableData=function(){var e=this.getOptions();return P.cache[e.id]},B.updateStatus=function(e,t,a){var e=j(e),n=e.getOptions();return a=a||(n.url?P.cache[n.id]:n.data),e.updateStatus(a,t)},B.sort=function(e){var t,a,i,l,n,d=j(e);d&&(n=(t=d.getOptions()).tree,a=B.getData(e),i=n.customName.children,l=function(e,a,n){layui.sort(e,a,n,!0),layui.each(e,function(e,t){l(t[i]||[],a,n)})},t.autoSort)&&((n=t.initSort).type?l(a,n.field,"desc"===n.type):l(a,P.config.indexName,null),P.cache[e]=a,d.initData(a),B.renderData(e))},function(n){var t=n.config.id,i=j(t),a=n.data=B.getNodeDataByIndex(t,n.index),l=a[z],d=(n.dataIndex=l,n.update);n.update=function(){var e=arguments,t=(A.extend(i.getNodeDataByIndex(l),e[0]),d.apply(this,e)),a=n.config.tree.customName.name;return a in e[0]&&n.tr.find('td[data-field="'+a+'"]').children("div.layui-table-cell").removeClass("layui-table-tree-item"),i.renderTreeTable(n.tr,n.tr.attr("data-level"),!1),t},n.del=function(){B.removeNode(t,a)},n.setRowChecked=function(e){B.setRowChecked(t,{index:a,checked:e})}}),u=(B.updateNode=function(e,a,t){var n,i,l,d,r,o=j(e);o&&((d=o.getOptions()).tree,d=(n=d.elem.next()).find('tr[lay-data-index="'+a+'"]'),i=d.attr("data-index"),l=d.attr("data-level"),t)&&(d=o.getNodeDataByIndex(a,!1,t),r=P.getTrHtml(e,[d]),layui.each(["main","fixed-l","fixed-r"],function(e,t){n.find(".layui-table-"+t+' tbody tr[lay-data-index="'+a+'"]').replaceWith(A(r[["trs","trs_fixed","trs_fixed_r"][e]].join("")).attr({"data-index":i,"lay-data-index":a,"data-level":l}).data("index",i))}),o.renderTreeTable(n.find('tr[lay-data-index="'+a+'"]'),l))},B.removeNode=function(e,t,a){var n,i,l,d,r,o,c,u,s=j(e);s&&(i=(u=(n=s.getOptions()).tree).customName.isParent,l=u.customName.children,d=n.elem.next(),r=[],o=P.cache[e],t=s.getNodeDataByIndex("string"===layui.type(t)?t:t[z],!1,"delete"),c=s.getNodeDataByIndex(t[f]),s.updateCheckStatus(c),u=s.treeToFlat([t],t[u.customName.pid],t[f]),layui.each(u,function(e,t){t=t[z];r.push('tr[lay-data-index="'+t+'"]'),-1!==t.indexOf("-")&&delete o[t]}),d.find(r.join(",")).remove(),t=s.initData(),function(){for(var e in o)-1!==e.indexOf("-")&&e!==o[e][z]&&delete o[e]}(),layui.each(s.treeToFlat(t),function(e,t){t[b]&&t[b]!==t[z]&&d.find('tr[lay-data-index="'+t[b]+'"]').attr({"data-index":t[z],"lay-data-index":t[z]}).data("index",t[z])}),layui.each(o,function(e,t){d.find('tr[data-level="0"][lay-data-index="'+t[z]+'"]').attr("data-index",e).data("index",e)}),n.hasNumberCol&&v(s),c&&(u=d.find('tr[lay-data-index="'+c[z]+'"]'),a||(c[i]=!(!c[l]||!c[l].length)),s.updateNodeIcon({scopeEl:u,isExpand:c[H],isParent:c[i]})),B.resize(e))},B.addNodes=function(e,t){var a=j(e);if(a){var n=a.getOptions(),i=n.tree,l=n.elem.next(),d=P.config.checkName,r=(t=t||{}).parentIndex,o=t.index,c=t.data,t=t.focus,u=(r="number"===layui.type(r)?r.toString():r)?a.getNodeDataByIndex(r):null,o="number"===layui.type(o)?o:-1,c=A.extend(!0,[],layui.isArray(c)?c:[c]);layui.each(c,function(e,t){d in t||!u||(t[d]=u[d])}),a.getTableData();if(u){var s=i.customName.isParent,f=i.customName.children;u[s]=!0;var y=(y=u[f])?(p=y.splice(-1===o?y.length:o),u[f]=y.concat(c,p)):u[f]=c,f=(a.updateStatus(y,function(e){(e[s]||i.view.showFlexIconIfNotParent)&&(e[X]=!1)}),a.treeToFlat(y));l.find(f.map(function(e){return'tr[lay-data-index="'+e[z]+'"]'}).join(",")).remove(),a.initData(),u[X]=!1,u[V]="local",J({trElem:l.find('tr[lay-data-index="'+r+'"]')},!0)}else{var p=P.cache[e].splice(-1===o?P.cache[e].length:o);if(P.cache[e]=P.cache[e].concat(c,p),n.url||(n.page?(y=n.page,n.data.splice.apply(n.data,[y.limit*(y.curr-1),y.limit].concat(P.cache[e]))):n.data=P.cache[e]),a.initData(),l.find(".layui-none").length)return P.renderData(e),c;var x,f=P.getTrHtml(e,c),h={trs:A(f.trs.join("")),trs_fixed:A(f.trs_fixed.join("")),trs_fixed_r:A(f.trs_fixed_r.join(""))},r=(layui.each(c,function(e,t){x={"data-index":t[z],"lay-data-index":t[z],"data-level":"0"},h.trs.eq(e).attr(x).data("index",t[z]),h.trs_fixed.eq(e).attr(x).data("index",t[z]),h.trs_fixed_r.eq(e).attr(x).data("index",t[z])}),parseInt(c[0][z])-1),y=l.find(q),n=l.find(R),f=l.find(Y);-1==r?y.find('tr[data-level="0"][data-index="0"]')[0]?(y.find('tr[data-level="0"][data-index="0"]').before(h.trs),n.find('tr[data-level="0"][data-index="0"]').before(h.trs_fixed),f.find('tr[data-level="0"][data-index="0"]').before(h.trs_fixed_r)):(y.find("tbody").prepend(h.trs),n.find("tbody").prepend(h.trs_fixed),f.find("tbody").prepend(h.trs_fixed_r)):-1===o?(y.find("tbody").append(h.trs),n.find("tbody").append(h.trs_fixed),f.find("tbody").append(h.trs_fixed_r)):(r=p[0][b],y.find('tr[data-level="0"][data-index="'+r+'"]').before(h.trs),n.find('tr[data-level="0"][data-index="'+r+'"]').before(h.trs_fixed),f.find('tr[data-level="0"][data-index="'+r+'"]').before(h.trs_fixed_r)),layui.each(P.cache[e],function(e,t){l.find('tr[data-level="0"][lay-data-index="'+t[z]+'"]').attr("data-index",e).data("index",e)}),a.renderTreeTable(l.find(c.map(function(e,t,a){return'tr[lay-data-index="'+e[z]+'"]'}).join(",")))}return a.updateCheckStatus(u),u&&(o=l.find('tr[lay-data-index="'+u[z]+'"]'),a.updateNodeIcon({scopeEl:o,isExpand:u[H],isParent:u[s]})),B.resize(e),t&&l.find(q).find('tr[lay-data-index="'+c[0][z]+'"]').get(0).scrollIntoViewIfNeeded(),c}},B.checkStatus=function(e,n){var i,t,a,l=j(e);if(l)return l=l.getOptions().tree,i=P.config.checkName,t=B.getData(e,!0).filter(function(e,t,a){return e[i]||n&&e[g]}),a=!0,layui.each("all"===l.data.cascade?P.cache[e]:B.getData(e,!0),function(e,t){if(!t[i])return!(a=!1)}),{data:t,isAll:a}},B.on("sort",function(e){var e=e.config,t=e.elem.next(),e=e.id;t.hasClass(m)&&B.sort(e)}),B.on("row",function(e){e.config.elem.next().hasClass(m)&&o(e)}),B.on("rowDouble",function(e){var t=e.config,a=t.elem.next();t.id;a.hasClass(m)&&(o(e),(t.tree||{}).view.dblClickExpand)&&J({trElem:e.tr.first()},null,null,null,!0)}),B.on("rowContextmenu",function(e){var t=e.config,a=t.elem.next();t.id;a.hasClass(m)&&o(e)}),B.on("tool",function(e){var t=e.config,a=t.elem.next();t.id;a.hasClass(m)&&o(e)}),B.on("edit",function(e){var t=e.config,a=t.elem.next();t.id;a.hasClass(m)&&(o(e),e.field===t.tree.customName.name)&&((a={})[e.field]=e.value,e.update(a))}),B.on("radio",function(e){var t=e.config,a=t.elem.next(),t=t.id;a.hasClass(m)&&(a=j(t),o(e),u.call(a,e.tr,e.checked))}),a.prototype.setRowCheckedClass=function(e,t){var a=this.getOptions(),n=(e.data("index"),a.elem.next());e[t?"addClass":"removeClass"](l),e.each(function(){var e=A(this).data("index");n.find('.layui-table-fixed-r tbody tr[data-index="'+e+'"]')[t?"addClass":"removeClass"](l)})},a.prototype.updateCheckStatus=function(e,t){var a,n,i,l,d,r,o,c=this,u=c.getOptions();return!!u.hasChecboxCol&&(a=u.tree,n=u.id,i=u.elem.next(),l=P.config.checkName,"all"!==(d=a.data.cascade)&&"parent"!==d||!e||(d=c.updateParentCheckStatus(e,"boolean"===layui.type(t)?t:null),layui.each(d,function(e,t){var a=i.find('tr[lay-data-index="'+t[z]+'"] input[name="layTableCheckbox"]:not(:disabled)'),n=t[l];c.setRowCheckedClass(a.closest("tr"),n),a.prop({checked:n,indeterminate:t[g]})})),o=!(r=!0),0<(e=(e="all"===a.data.cascade?P.cache[n]:B.getData(n,!0)).filter(function(e){return!e[u.disabledName]})).length?layui.each(e,function(e,t){if((t[l]||t[g])&&(o=!0),t[l]||(r=!1),o&&!r)return!0}):r=!1,o=o&&!r,i.find('input[name="layTableCheckbox"][lay-filter="layTableAllChoose"]').prop({checked:r,indeterminate:o}),r)},a.prototype.updateParentCheckStatus=function(a,n){var i,e=this.getOptions(),t=e.tree,e=e.id,l=P.config.checkName,t=t.customName.children,d=[];return!(a[g]=!1)===n?a[t].length?layui.each(a[t],function(e,t){if(!t[l])return n=!1,a[g]=!0}):n=!1:!1===n?layui.each(a[t],function(e,t){if(t[l]||t[g])return a[g]=!0}):(n=!1,i=0,layui.each(a[t],function(e,t){t[l]&&i++}),n=a[t].length?a[t].length===i:a[l],a[g]=!n&&0li"],n.bodyElem=["."+C.CONST.BODY+":eq(0)",">."+C.CONST.ITEM],n.getContainer=function(){var e=n.documentElem||t.elem;return{header:{elem:e.find(n.headerElem[0]),items:e.find(n.headerElem.join(""))},body:{elem:e.find(n.bodyElem[0]),items:e.find(n.bodyElem.join(""))}}},"array"===layui.type(t.header)?"string"==typeof t.header[0]?(n.headerElem=t.header.concat(),n.documentElem=p(document)):(n.elemView=p('
          '),t.className&&n.elemView.addClass(t.className),a=p('
            '),i=p('
            '),layui.each(t.header,function(e,t){t=n.renderHeaderItem(t);a.append(t)}),layui.each(t.body,function(e,t){t=n.renderBodyItem(t);i.append(t)}),n.elemView.append(a).append(i),t.elem.html(n.elemView)):n.renderClose(),"array"===layui.type(t.body)&&"string"==typeof t.body[0]&&(n.documentElem=p(document),n.bodyElem=t.body.concat()),n.data());"index"in t&&e.index!=t.index?n.change(n.findHeaderItem(t.index),!0):-1===e.index&&n.change(n.findHeaderItem(0),!0),n.roll("auto"),t.elem.hasClass(C.CONST.CLASS_HIDEV)&&t.elem.removeClass(C.CONST.CLASS_HIDEV),"function"==typeof t.afterRender&&t.afterRender(e),layui.event.call(t.elem[0],C.CONST.MOD_NAME,"afterRender("+t.id+")",e)},events:function(){var e,t=this,a=t.config,i=t.getContainer(),n=C.CONST.MOD_NAME,i=(t.documentElem?i.header:a).elem,a=a.trigger+(".lay_"+n+"_trigger"),n=t.documentElem?t.headerElem[1]:t.headerElem.join("");i.off(a).on(a,n,function(){t.change(p(this))}),r.onresize||(p(window).on("resize",function(){clearTimeout(e),e=setTimeout(function(){layui.each(C.cache.id,function(e){e=C.getInst(e);e&&e.roll("init")})},50)}),r.onresize=!0)}}),r={},t=C.Class;t.prototype.add=function(e){var t,a,i=this,n=(i.config,i.getContainer()),r=i.renderHeaderItem(e),d=i.renderBodyItem(e),o=i.data();e=p.extend({active:!0},e),/(before|after)/.test(e.mode)?(a=(t=e.hasOwnProperty("index"))?i.findHeaderItem(e.index):o.thisHeaderItem,t=t?i.findBodyItem(e.index):o.thisHeaderItem,a[e.mode](r),t[e.mode](d)):(a={prepend:"prepend",append:"append"}[e.mode||"append"]||"append",n.header.elem[a](r),n.body.elem[a](d)),e.active?i.change(r,!0):i.roll("auto"),"function"==typeof e.done&&e.done(p.extend(o,{headerItem:r,bodyItem:d}))},t.prototype.close=function(e,t){if(e&&e[0]){var a=this,i=a.config,n=e.index();if(e[0]&&"false"!==e.attr("lay-closable")){var r=a.data();if(!t)if(!1===layui.event.call(e[0],C.CONST.MOD_NAME,"beforeClose("+i.id+")",p.extend(r,{index:e.index()})))return;e.hasClass(C.CONST.CLASS_THIS)&&(e.next()[0]?a.change(e.next(),!0):e.prev()[0]&&a.change(e.prev(),!0)),e.remove(),a.findBodyItem(n).remove(),a.roll("auto",n);r=a.data();layui.event.call(r.thisHeaderItem[0],C.CONST.MOD_NAME,"afterClose("+i.id+")",r)}}},t.prototype.closeMult=function(e,t){var a,i=this,n=i.config,r=i.getContainer(),d=i.data(),o=r.header.items,l=r.body.items,r='[lay-closable="false"]',s=":not("+r+")",d=(t=t===undefined?d.index:t,o.each(function(e){var t=p(this).attr("lay-closable");t&&l.eq(e).attr("lay-closable",t)}),"false"!==d.thisHeaderItem.attr("lay-closable")&&("all"!==e&&e?t!==d.index&&i.change(i.findHeaderItem(t),!0):(a=o.filter(":gt("+d.index+")"+r).eq(0),r=p(o.filter(":lt("+d.index+")"+r).get().reverse()).eq(0),a[0]?i.change(a,!0):r[0]&&i.change(r,!0))),("other"===e?(o.eq(t).siblings(s).remove(),l.eq(t).siblings(s)):"right"===e?(o.filter(":gt("+t+")"+s).remove(),l.filter(":gt("+t+")"+s)):(o.filter(s).remove(),l.filter(s))).remove(),i.roll("auto"),i.data());layui.event.call(d.thisHeaderItem[0],C.CONST.MOD_NAME,"afterClose("+n.id+")",d)},t.prototype.change=function(e,t){if(e&&e[0]){var a=this,i=a.config,n=e.attr("lay-id")||e.index(),r=e.find("a"),r="string"==typeof r.attr("href")&&"_blank"===r.attr("target"),d="string"==typeof e.attr("lay-unselect");if(!r&&!d){r=a.data();if(!t)if(!1===layui.event.call(e[0],C.CONST.MOD_NAME,"beforeChange("+i.id+")",p.extend(r,{from:{index:r.index,headerItem:r.thisHeaderItem},to:{index:e.index(),headerItem:e}})))return;e.addClass(C.CONST.CLASS_THIS).siblings().removeClass(C.CONST.CLASS_THIS),a.findBodyItem(n).addClass(C.CONST.CLASS_SHOW).siblings().removeClass(C.CONST.CLASS_SHOW),a.roll("auto",n);r=a.data();layui.event.call(r.thisHeaderItem[0],C.CONST.MOD_NAME,"afterChange("+i.id+")",r)}}},t.prototype.renderHeaderItem=function(e){var t=this.config,t=p(e.headerItem||t.headerItem||"
          • ");return t.html(e.title||"New Tab").attr("lay-id",e.id),this.appendClose(t,e),t},t.prototype.renderBodyItem=function(e){var t=this.config,t=p(e.bodyItem||t.bodyItem||'
            ');return t.html(e.content||"").attr("lay-id",e.id),t},t.prototype.appendClose=function(e,t){var a=this;a.config.closable&&0!=(t=t||{}).closable&&"false"!==e.attr("lay-closable")&&!e.find("."+C.CONST.CLOSE)[0]&&((t=p('')).on("click",function(){return a.close(p(this).parent()),!1}),e.append(t))},t.prototype.renderClose=function(){var t=this,a=t.config;t.getContainer().header.items.each(function(){var e=p(this);a.closable?t.appendClose(e):e.find("."+C.CONST.CLOSE).remove()})},t.prototype.roll=function(e,i){var n=this,t=n.config,a=n.getContainer(),r=a.header.elem,d=a.header.items,a=r.prop("scrollWidth"),o=Math.ceil(r.outerWidth()),l=r.data("left")||0,s="scroll"===t.headerMode,c="layui-tabs-scroll",f="layui-tabs-bar",u=["layui-icon-prev","layui-icon-next"],m={elem:p('
            '),bar:p(['
            ','','',"
            "].join(""))};if("normal"!==t.headerMode){var h,y=r.parent("."+c);if(s||!s&&o=o-l)return r.css("left",-a).data("left",-a),!1}),l=r.data("left")||0,y.find("."+u[0])[l<0?"removeClass":"addClass"](C.CONST.CLASS_DISABLED),y.find("."+u[1])[0')),n=(e.tree(a),i.elem=p(i.elem));if(n[0]){if(e.key=i.id||e.index,e.elem=a,e.elemNone=p('
            '+i.text.none+"
            "),n.html(e.elem),0==e.elem.find(".layui-tree-set").length)return e.elem.append(e.elemNone);i.showCheckbox&&e.renderForm("checkbox"),e.elem.find(".layui-tree-set").each(function(){var e=p(this);e.parent(".layui-tree-pack")[0]||e.addClass("layui-tree-setHide"),!e.next()[0]&&e.parents(".layui-tree-pack").eq(1).hasClass("layui-tree-lineExtend")&&e.addClass(T),e.next()[0]||e.parents(".layui-tree-set").eq(0).next()[0]||e.addClass(T)}),e.events()}},l.prototype.renderForm=function(e){i.render(e,"LAY-tree-"+this.index)},l.prototype.tree=function(r,e){var d=this,s=d.config,o=s.customName,e=e||s.data;layui.each(e,function(e,i){var a,n,t=i[o.children]&&0"),c=p(['
            ','
            ','
            ',s.showLine?t?'':'':'',s.showCheckbox?'':"",s.isJump&&i.href?''+(i[o.title]||i.label||s.text.defaultNodeName)+"":''+(i[o.title]||i.label||s.text.defaultNodeName)+"","
            ",s.edit?(a={add:'',update:'',del:''},n=['
            '],!0===s.edit&&(s.edit=["update","del"]),"object"==typeof s.edit?(layui.each(s.edit,function(e,i){n.push(a[i]||"")}),n.join("")+"
            "):void 0):"","
            "].join(""));t&&(c.append(l),d.tree(l,i[o.children])),r.append(c),c.prev("."+k)[0]&&c.prev().children(".layui-tree-pack").addClass("layui-tree-showLine"),t||c.parent(".layui-tree-pack").addClass("layui-tree-lineExtend"),d.spread(c,i),s.showCheckbox&&(i.checked&&d.checkids.push(i[o.id]),d.checkClick(c,i)),s.edit&&d.operate(c,i)})},l.prototype.spread=function(n,t){var l=this,c=l.config,e=n.children("."+b),i=e.children("."+g),a=i.find('input[same="layuiTreeCheck"]'),r=e.find("."+C),e=e.find("."+w),d=c.onlyIconControl?r:i,s="";d.on("click",function(e){var i=n.children("."+N),a=(d.children(".layui-icon")[0]?d:d.find(".layui-tree-icon")).children(".layui-icon");i[0]?n.hasClass(F)?(n.removeClass(F),i.slideUp(200),a.removeClass(x).addClass(v),l.updateFieldValue(t,"spread",!1)):(n.addClass(F),i.slideDown(200),a.addClass(x).removeClass(v),l.updateFieldValue(t,"spread",!0),c.accordion&&((i=n.siblings("."+k)).removeClass(F),i.children("."+N).slideUp(200),i.find(".layui-tree-icon").children(".layui-icon").removeClass(x).addClass(v))):s="normal"}),e.on("click",function(){p(this).hasClass(u)||(s=n.hasClass(F)?c.onlyIconControl?"open":"close":c.onlyIconControl?"close":"open",a[0]&&l.updateFieldValue(t,"checked",a.prop("checked")),c.click&&c.click({elem:n,state:s,data:t}))})},l.prototype.updateFieldValue=function(e,i,a){i in e&&(e[i]=a)},l.prototype.setCheckbox=function(e,i,a){var t,n=this,l=n.config.customName,c=a.prop("checked");a.prop("disabled")||("object"!=typeof i[l.children]&&!e.find("."+N)[0]||e.find("."+N).find('input[same="layuiTreeCheck"]').each(function(e){this.disabled||((e=i[l.children][e])&&n.updateFieldValue(e,"checked",c),n.updateFieldValue(this,"checked",c))}),(t=function(e){var i,a,n;e.parents("."+k)[0]&&(a=(e=e.parent("."+N)).parent(),n=e.prev().find('input[same="layuiTreeCheck"]'),c?n.prop("checked",c):(e.find('input[same="layuiTreeCheck"]').each(function(){this.checked&&(i=!0)}),i||n.prop("checked",!1)),t(a))})(e),n.renderForm("checkbox"))},l.prototype.checkClick=function(a,n){var t=this,l=t.config;a.children("."+b).children("."+g).on("click",'input[same="layuiTreeCheck"]+',function(e){layui.stope(e);var e=p(this).prev(),i=e.prop("checked");e.prop("disabled")||(t.setCheckbox(a,n,e),t.updateFieldValue(n,"checked",i),l.oncheck&&l.oncheck({elem:a,checked:i,data:n}))})},l.prototype.operate=function(r,d){var s=this,o=s.config,u=o.customName,e=r.children("."+b),h=e.children("."+g);e.children(".layui-tree-btnGroup").on("click",".layui-icon",function(e){layui.stope(e);var i,e=p(this).data("type"),n=r.children("."+N),t={data:d,type:e,elem:r};if("add"==e){n[0]||(o.showLine?(h.find("."+C).addClass("layui-tree-icon"),h.find("."+C).children(".layui-icon").addClass(v).removeClass("layui-icon-file")):h.find(".layui-tree-iconArrow").removeClass(m),r.append('
            '));var a,l=o.operate&&o.operate(t),c={};if(c[u.title]=o.text.defaultNodeName,c[u.id]=l,s.tree(r.children("."+N),[c]),o.showLine&&(n[0]?(n.hasClass(S)||n.addClass(S),r.find("."+N).each(function(){p(this).children("."+k).last().addClass(T)}),(n.children("."+k).last().prev().hasClass(T)?n.children("."+k).last().prev():n.children("."+k).last()).removeClass(T),!r.parent("."+N)[0]&&r.next()[0]&&n.children("."+k).last().removeClass(T)):(l=r.siblings("."+k),a=1,c=r.parent("."+N),layui.each(l,function(e,i){p(i).children("."+N)[0]||(a=0)}),(1==a?(l.children("."+N).addClass(L),l.children("."+N).children("."+k).removeClass(T),r.children("."+N).addClass(L),c.removeClass(S),c.children("."+k).last().children("."+N).children("."+k).last()):r.children("."+N).children("."+k)).addClass(T))),!o.showCheckbox)return;h.find('input[same="layuiTreeCheck"]')[0].checked&&(r.children("."+N).children("."+k).last().find('input[same="layuiTreeCheck"]')[0].checked=!0),s.renderForm("checkbox")}else"update"==e?(l=h.children("."+w).html(),h.children("."+w).html(""),h.append(''),h.children(".layui-tree-editInput").val(f.unescape(l)).focus(),i=function(e){var i=f.escape(e.val().trim())||o.text.defaultNodeName;e.remove(),h.children("."+w).html(i),t.data[u.title]=i,o.operate&&o.operate(t)},h.children(".layui-tree-editInput").blur(function(){i(p(this))}),h.children(".layui-tree-editInput").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),i(p(this)))})):y.confirm('\u786e\u8ba4\u5220\u9664\u8be5\u8282\u70b9 "'+(d[u.title]||"")+'" \u5417\uff1f',function(e){var l,a,i;o.operate&&o.operate(t),t.status="remove",y.close(e),r.prev("."+k)[0]||r.next("."+k)[0]||r.parent("."+N)[0]?(r.siblings("."+k).children("."+b)[0]?(o.showCheckbox&&(l=function(e){var i,a,n,t;e.parents("."+k)[0]&&(i=e.siblings("."+k).children("."+b),a=(e=e.parent("."+N).prev()).find('input[same="layuiTreeCheck"]')[0],n=1,(t=0)==a.checked)&&(i.each(function(e,i){i=p(i).find('input[same="layuiTreeCheck"]')[0];0!=i.checked||i.disabled||(n=0),i.disabled||(t=1)}),1==n)&&1==t&&(a.checked=!0,s.renderForm("checkbox"),l(e.parent("."+k)))})(r),o.showLine&&(e=r.siblings("."+k),a=1,i=r.parent("."+N),layui.each(e,function(e,i){p(i).children("."+N)[0]||(a=0)}),1==a?(n[0]||(i.removeClass(S),e.children("."+N).addClass(L),e.children("."+N).children("."+k).removeClass(T)),(r.next()[0]?i.children("."+k).last():r.prev()).children("."+N).children("."+k).last().addClass(T),r.next()[0]||r.parents("."+k)[1]||r.parents("."+k).eq(0).next()[0]||r.prev("."+k).addClass(T)):!r.next()[0]&&r.hasClass(T)&&r.prev().addClass(T))):(e=r.parent("."+N).prev(),o.showLine?(e.find("."+C).removeClass("layui-tree-icon"),e.find("."+C).children(".layui-icon").removeClass(x).addClass("layui-icon-file"),(i=e.parents("."+N).eq(0)).addClass(S),i.children("."+k).each(function(){p(this).children("."+N).children("."+k).last().addClass(T)})):e.find(".layui-tree-iconArrow").addClass(m),r.parents("."+k).eq(0).removeClass(F),r.parent("."+N).remove()),r.remove()):(r.remove(),s.elem.append(s.elemNone))})})},l.prototype.events=function(){var i=this,t=i.config;i.elem.find(".layui-tree-checkedFirst");i.setChecked(i.checkids),i.elem.find(".layui-tree-search").on("keyup",function(){var e=p(this),a=e.val(),e=e.nextAll(),n=[];e.find("."+w).each(function(){var i,e=p(this).parents("."+b);-1!=p(this).html().indexOf(a)&&(n.push(p(this).parent()),(i=function(e){e.addClass("layui-tree-searchShow"),e.parent("."+N)[0]&&i(e.parent("."+N).parent("."+k))})(e.parent("."+k)))}),e.find("."+b).each(function(){var e=p(this).parent("."+k);e.hasClass("layui-tree-searchShow")||e.addClass(m)}),0==e.find(".layui-tree-searchShow").length&&i.elem.append(i.elemNone),t.onsearch&&t.onsearch({elem:n})}),i.elem.find(".layui-tree-search").on("keydown",function(){p(this).nextAll().find("."+b).each(function(){p(this).parent("."+k).removeClass("layui-tree-searchShow "+m)}),p(".layui-tree-emptyText")[0]&&p(".layui-tree-emptyText").remove()})},l.prototype.getChecked=function(){var t=this,e=t.config,l=e.customName,i=[],a=[],c=(t.elem.find(".layui-form-checked").each(function(){i.push(p(this).prev()[0].value)}),function(e,n){layui.each(e,function(e,a){layui.each(i,function(e,i){if(a[l.id]==i)return t.updateFieldValue(a,"checked",!0),delete(i=p.extend({},a))[l.children],n.push(i),a[l.children]&&(i[l.children]=[],c(a[l.children],i[l.children])),!0})})});return c(p.extend({},e.data),a),a},l.prototype.setChecked=function(l){this.config;this.elem.find("."+k).each(function(e,i){var a=p(this).data("id"),n=p(i).children("."+b).find('input[same="layuiTreeCheck"]'),t=n.next();if("number"==typeof l){if(a.toString()==l.toString())return n[0].checked||t.click(),!1}else"object"==typeof l&&layui.each(l,function(e,i){if(i.toString()==a.toString()&&!n[0].checked)return t.click(),!0})})},n.that={},n.config={},t.reload=function(e,i){e=n.that[e];return e.reload(i),n.call(e)},t.getChecked=function(e){return n.that[e].getChecked()},t.setChecked=function(e,i){return n.that[e].setChecked(i)},t.render=function(e){e=new l(e);return n.call(e)},e(a,t)});layui.define(["laytpl","form"],function(e){"use strict";var d=layui.$,n=layui.laytpl,t=layui.form,a="transfer",i={config:{},index:layui[a]?layui[a].index+1e4:0,set:function(e){var t=this;return t.config=d.extend({},t.config,e),t},on:function(e,t){return layui.onevent.call(this,a,e,t)}},l=function(){var t=this,e=t.config,a=e.id||t.index;return l.that[a]=t,{config:l.config[a]=e,reload:function(e){t.reload.call(t,e)},getData:function(){return t.getData.call(t)}}},s="layui-hide",u="layui-btn-disabled",c="layui-none",r="layui-transfer-box",h="layui-transfer-header",o="layui-transfer-search",f="layui-transfer-data",y=function(e){return['
            ','
            ','","
            ","{{# if(d.data.showSearch){ }}",'","{{# } }}",'
              ',"
              "].join("")},p=['
              ',y({index:0,checkAllName:"layTransferLeftCheckAll"}),'
              ','",'","
              ",y({index:1,checkAllName:"layTransferRightCheckAll"}),"
              "].join(""),v=function(e){var t=this;t.index=++i.index,t.config=d.extend({},t.config,i.config,e),t.render()};v.prototype.config={title:["\u5217\u8868\u4e00","\u5217\u8868\u4e8c"],width:200,height:360,data:[],value:[],showSearch:!1,id:"",text:{none:"\u65e0\u6570\u636e",searchNone:"\u65e0\u5339\u914d\u6570\u636e"}},v.prototype.reload=function(e){var t=this;t.config=d.extend({},t.config,e),t.render()},v.prototype.render=function(){var e=this,t=e.config,a=e.elem=d(n(p,{open:"{{",close:"}}",tagStyle:"legacy"}).render({data:t,index:e.index})),i=t.elem=d(t.elem);i[0]&&(t.data=t.data||[],t.value=t.value||[],t.id="id"in t?t.id:elem.attr("id")||e.index,e.key=t.id,i.html(e.elem),e.layBox=e.elem.find("."+r),e.layHeader=e.elem.find("."+h),e.laySearch=e.elem.find("."+o),e.layData=a.find("."+f),e.layBtn=a.find(".layui-transfer-active .layui-btn"),e.layBox.css({width:t.width,height:t.height}),e.layData.css({height:(i=t.height-e.layHeader.outerHeight(),t.showSearch&&(i-=e.laySearch.outerHeight()),i-2)}),e.renderData(),e.events())},v.prototype.renderData=function(){var e=this,t=e.config,l=[{checkName:"layTransferLeftCheck",views:[]},{checkName:"layTransferRightCheck",views:[]}];e.parseData(function(a){var i=a.selected?1:0,n=["
            • ",'',"
            • "].join("");i?layui.each(t.value,function(e,t){t==a.value&&a.selected&&(l[i].views[e]=n)}):l[i].views.push(n),delete a.selected}),e.layData.eq(0).html(l[0].views.join("")),e.layData.eq(1).html(l[1].views.join("")),e.renderCheckBtn()},v.prototype.renderForm=function(e){t.render(e,"LAY-transfer-"+this.index)},v.prototype.renderCheckBtn=function(c){var r=this,o=r.config;c=c||{},r.layBox.each(function(e){var t=d(this),a=t.find("."+f),t=t.find("."+h).find('input[type="checkbox"]'),i=a.find('input[type="checkbox"]'),n=0,l=!1;i.each(function(){var e=d(this).data("hide");(this.checked||this.disabled||e)&&n++,this.checked&&!e&&(l=!0)}),t.prop("checked",l&&n===i.length),r.layBtn.eq(e)[l?"removeClass":"addClass"](u),c.stopNone||(i=a.children("li:not(."+s+")").length,r.noneView(a,i?"":o.text.none))}),r.renderForm("checkbox")},v.prototype.noneView=function(e,t){var a=d('

              '+(t||"")+"

              ");e.find("."+c)[0]&&e.find("."+c).remove(),t.replace(/\s/g,"")&&e.append(a)},v.prototype.setValue=function(){var e=this.config,t=[];return this.layBox.eq(1).find("."+f+' input[type="checkbox"]').each(function(){d(this).data("hide")||t.push(this.value)}),e.value=t,this},v.prototype.parseData=function(t){var i=this.config,n=[];return layui.each(i.data,function(e,a){a=("function"==typeof i.parseData?i.parseData(a):a)||a,n.push(a=d.extend({},a)),layui.each(i.value,function(e,t){t==a.value&&(a.selected=!0)}),t&&t(a)}),i.data=n,this},v.prototype.getData=function(e){var t=this.config,i=[];return this.setValue(),layui.each(e||t.value,function(e,a){layui.each(t.data,function(e,t){delete t.selected,a==t.value&&i.push(t)})}),i},v.prototype.transfer=function(e,t){var a,i=this,n=i.config,l=i.layBox.eq(e),c=[],t=(t?((a=(t=t).find('input[type="checkbox"]'))[0].checked=!1,l.siblings("."+r).find("."+f).append(t.clone()),t.remove(),c.push(a[0].value),i.setValue()):l.each(function(e){d(this).find("."+f).children("li").each(function(){var e=d(this),t=e.find('input[type="checkbox"]'),a=t.data("hide");t[0].checked&&!a&&(t[0].checked=!1,l.siblings("."+r).find("."+f).append(e.clone()),e.remove(),c.push(t[0].value)),i.setValue()})}),i.renderCheckBtn(),l.siblings("."+r).find("."+o+" input"));""!==t.val()&&t.trigger("keyup"),n.onchange&&n.onchange(i.getData(c),e)},v.prototype.events=function(){var n=this,l=n.config;n.elem.on("click",'input[lay-filter="layTransferCheckbox"]+',function(){var e=d(this).prev(),t=e[0].checked,a=e.parents("."+r).eq(0).find("."+f);e[0].disabled||("all"===e.attr("lay-type")&&a.find('input[type="checkbox"]').each(function(){this.disabled||(this.checked=t)}),setTimeout(function(){n.renderCheckBtn({stopNone:!0})},0))}),n.elem.on("dblclick","."+f+">li",function(e){var t=d(this),a=t.children('input[type="checkbox"]'),i=t.parent().parent().data("index");a[0].disabled||!1!==("function"==typeof l.dblclick?l.dblclick({elem:t,data:n.getData([a[0].value])[0],index:i}):null)&&n.transfer(i,t)}),n.layBtn.on("click",function(){var e=d(this),t=e.data("index");e.hasClass(u)||n.transfer(t)}),n.laySearch.find("input").on("keyup",function(){var i=this.value,e=d(this).parents("."+o).eq(0).siblings("."+f),t=e.children("li"),t=(t.each(function(){var e=d(this),t=e.find('input[type="checkbox"]'),a=t[0].title,a=("cs"!==l.showSearch&&(a=a.toLowerCase(),i=i.toLowerCase()),-1!==a.indexOf(i));e[a?"removeClass":"addClass"](s),t.data("hide",!a)}),n.renderCheckBtn(),t.length===e.children("li."+s).length);n.noneView(e,t?l.text.searchNone:"")})},l.that={},l.config={},i.reload=function(e,t){e=l.that[e];return e.reload(t),l.call(e)},i.getData=function(e){return l.that[e].getData()},i.render=function(e){e=new v(e);return l.call(e)},e(a,i)});layui.define(["jquery","lay"],function(e){"use strict";var o=layui.$,l=layui.lay,t=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=o.extend({},n.config,e),n},on:function(e,n){return layui.onevent.call(this,r,e,n)}}),r="carousel",s="layui-this",u="layui-carousel-left",c="layui-carousel-right",m="layui-carousel-prev",h="layui-carousel-next",a="layui-carousel-arrow",d="layui-carousel-ind",n=function(e){var n=this;n.config=o.extend({},n.config,t.config,e),n.render()};n.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},n.prototype.render=function(){var e=this,n=e.config,i=o(n.elem);if(1*[carousel-item]>*"),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(s),e.indicator(),e.arrow(),e.autoplay(),1=this.elemItem.length?0:e},n.prototype.addIndex=function(e){var n=this.config;n.index=n.index+(e=e||1),n.index>=this.elemItem.length&&(n.index=0)},n.prototype.subIndex=function(e){var n=this.config;n.index=n.index-(e=e||1),n.index<0&&(n.index=this.elemItem.length-1)},n.prototype.autoplay=function(){var e=this,n=e.config,i=e.elemItem.length;n.autoplay&&(clearInterval(e.timer),1',''].join(""));e.elem.attr("lay-arrow",e.arrow),e.elem.find("."+a)[0]&&e.elem.find("."+a).remove(),1i.index?n.slide("add",e-i.index):e
                ',(n=[],layui.each(e.elemItem,function(e){n.push("")}),n.join("")),"
              "].join(""));i.elem.attr("lay-indicator",i.indicator),i.elem.find("."+d)[0]&&i.elem.find("."+d).remove(),1t[a?"height":"width"]()/3)&&o.slide(0"),i=1;i<=a.length;i++){var n='
            • ";a.half&&parseInt(a.value)!==a.value&&i==Math.ceil(a.value)?t=t+'
            • ":t+=n}t+="",a.text&&(t+=''+a.value+"");var s=a.elem,o=s.next("."+c.ELEM);o[0]&&o.remove(),e.elemTemplate=u(t),a.span=e.elemTemplate.next("span"),a.setText&&a.setText(a.value),s.html(e.elemTemplate),s.addClass("layui-inline"),a.readonly||e.action()},extendsInstance:function(){var a=this,l=a.config;return{setvalue:function(e){l.value=e,a.render()}}}}),c=l.CONST;l.Class.prototype.action=function(){var n=this.config,t=this.elemTemplate,i=t.find("i").width(),l=t.children("li");l.each(function(e){var a=e+1,l=u(this);l.on("click",function(e){n.value=a,n.half&&e.pageX-u(this).offset().left<=i/2&&(n.value=n.value-.5),n.text&&t.next("span").text(n.value),n.choose&&n.choose(n.value),n.setText&&n.setText(n.value)}),l.on("mousemove",function(e){t.find("i").each(function(){u(this).addClass(c.ICON_RATE).removeClass(c.ICON_SOLID_HALF)}),t.find("i:lt("+a+")").each(function(){u(this).addClass(c.ICON_RATE_SOLID).removeClass(c.ICON_HALF_RATE)}),n.half&&e.pageX-u(this).offset().left<=i/2&&l.children("i").addClass(c.ICON_RATE_HALF).removeClass(c.ICON_RATE_SOLID)}),l.on("mouseleave",function(){t.find("i").each(function(){u(this).addClass(c.ICON_RATE).removeClass(c.ICON_SOLID_HALF)}),t.find("i:lt("+Math.floor(n.value)+")").each(function(){u(this).addClass(c.ICON_RATE_SOLID).removeClass(c.ICON_HALF_RATE)}),n.half&&parseInt(n.value)!==n.value&&t.children("li:eq("+Math.floor(n.value)+")").children("i").addClass(c.ICON_RATE_HALF).removeClass(c.ICON_SOLID_RATE)})}),a.touchSwipe(t,{onTouchMove:function(e,a){var i;Date.now()-a.timeStart<=200||(a=e.touches[0].pageX,e=t.width()/n.length,a=(a-t.offset().left)/e,(i=(i=(e=a%1)<=.5&&n.half?.5+(a-e):Math.ceil(a))>n.length?n.length:i)<0&&(i=0),l.each(function(e){var a=u(this).children("i"),l=Math.ceil(i)-e==1,t=Math.ceil(i)>e,e=i-e==.5;t?(a.addClass(c.ICON_RATE_SOLID).removeClass(c.ICON_HALF_RATE),n.half&&e&&a.addClass(c.ICON_RATE_HALF).removeClass(c.ICON_RATE_SOLID)):a.addClass(c.ICON_RATE).removeClass(c.ICON_SOLID_HALF),a.toggleClass("layui-rate-hover",l)}),n.value=i,n.text&&t.next("span").text(n.value),n.setText&&n.setText(n.value))},onTouchEnd:function(e,a){Date.now()-a.timeStart<=200||(t.find("i").removeClass("layui-rate-hover"),n.choose&&n.choose(n.value),n.setText&&n.setText(n.value))}})},e(c.MOD_NAME,l)});layui.define("jquery",function(o){"use strict";var w=layui.$,l=function(o){};l.prototype.load=function(o){var i,n,r,l,c,m,e,t,a,f,s,u,p,d,y,g=this,h=0,v=w((o=o||{}).elem);if(v[0])return c=w(o.scrollElem||document),m="mb"in o?o.mb:50,e=!("isAuto"in o)||o.isAuto,t=o.moreText||"\u52a0\u8f7d\u66f4\u591a",a=o.end||"\u6ca1\u6709\u66f4\u591a\u4e86",f="top"===(o.direction||"bottom"),g._cleanup(v,c),s=o.scrollElem&&o.scrollElem!==document,p=w('"),v.find(".layui-flow-more")[0]||v[f?"prepend":"append"](p),d=function(o,l){var e=s?c.prop("scrollHeight"):document.documentElement.scrollHeight,t=c.scrollTop();o=w(o),p[f?"after":"before"](o),(l=0==l||null)?p.html(a):p.find("a").html(u),n=l,i=null,r&&r(),f&&(o=s?c.prop("scrollHeight"):document.documentElement.scrollHeight,1===h?c.scrollTop(o):1'),"function"==typeof o.done&&o.done(++h,d)})(),p.find("a").on("click.flow",function(){w(this);n||i||y()}),o.isLazyimg&&(r=g.lazyimg({elem:o.elem+" img",scrollElem:o.scrollElem,direction:o.direction})),e&&c.on("scroll.flow",function(){var e=w(this),t=e.scrollTop();l&&clearTimeout(l),!n&&v.width()&&(l=setTimeout(function(){var o=(s?e:w(window)).height(),l=s?e.prop("scrollHeight"):document.documentElement.scrollHeight;(f?t<=m:l-t-o<=m)&&!i&&y()},100))}),g},l.prototype.lazyimg=function(o){var l,m=this,a=0,f=w((o=o||{}).scrollElem||document),s=o.elem||"img",n="top"===(o.direction||"bottom"),u=o.scrollElem&&o.scrollElem!==document,p=function(l,o){var e,t=f.scrollTop(),o=t+o,i=u?l.offset().top-f.offset().top+t:l.offset().top;(n?i+l.height():i)>=t&&i<=o&&l.attr("lay-src")&&(e=l.attr("lay-src"),layui.img(e,function(){var o=m.lazyimg.elem.eq(a);l.attr("src",e).removeAttr("lay-src"),o[0]&&r(o),a++},function(){m.lazyimg.elem.eq(a);l.removeAttr("lay-src")}))},r=function(o,l){var e=(u?l||f:w(window)).height(),t=f.scrollTop(),i=t+e;if(m.lazyimg.elem=w(s),o)p(o,e);else for(var n=0;n"),preview:"Preview"},wordWrap:!0,lang:"text",highlighter:!1,langMarker:!1},R=layui.code?layui.code.index+1e4:0,j=function(e){return String(e).replace(/\s+$/,"").replace(/^\n|\n$/,"")};e("code",function(l,e){var o,i,t,a,n,d,c,s,r,u,y,p,E,f,h,v,m,L,_,M,C,g={config:l=x.extend(!0,{},T,l),reload:function(e){layui.code(this.updateOptions(e))},updateOptions:function(e){return delete(e=e||{}).elem,x.extend(!0,l,e)},reloadCode:function(e){layui.code(this.updateOptions(e),"reloadCode")}},w=x(l.elem);return 1',l.ln?['
              ',D.digit(t+1)+".","
              "].join(""):"",'
              ',e||" ","
              ",""].join("")})}},a=l.code,n=function(e){return"function"==typeof l.codeParse?l.codeParse(e,l):e},"reloadCode"===e?o.children(".layui-code-wrap").html(w(n(a)).html):(d=layui.code.index=++R,o.attr("lay-code-index",d),(M=A.CDDE_DATA_CLASS in o.data())&&o.attr("class",o.data(A.CDDE_DATA_CLASS)||""),M||o.data(A.CDDE_DATA_CLASS,o.attr("class")),c={copy:{className:"file-b",title:["\u590d\u5236\u4ee3\u7801"],event:function(e){var t=D.unescape(n(l.code)),a="function"==typeof l.onCopy;lay.clipboard.writeText({text:t,done:function(){if(a&&!1===l.onCopy(t,!0))return;W.msg("\u5df2\u590d\u5236",{icon:1})},error:function(){if(a&&!1===l.onCopy(t,!1))return;W.msg("\u590d\u5236\u5931\u8d25",{icon:2})}})}}},function b(){var e=o.parent("."+A.ELEM_PREVIEW),t=e.children("."+A.ELEM_TAB),a=e.children("."+A.ELEM_ITEM+"-preview");return t.remove(),a.remove(),e[0]&&o.unwrap(),b}(),l.preview&&(M="LAY-CODE-DF-"+d,f=l.layout||["code","preview"],s="iframe"===l.preview,E=x('
              '),C=x('
              '),r=x('
              '),_=x('
              '),u=x('
              '),l.id&&E.attr("id",l.id),E.addClass(l.className),C.attr("lay-filter",M),layui.each(f,function(e,t){var a=x('
            • ');0===e&&a.addClass("layui-this"),a.html(l.text[t]),r.append(a)}),x.extend(c,{full:{className:"screen-full",title:["\u6700\u5927\u5316\u663e\u793a","\u8fd8\u539f\u663e\u793a"],event:function(e){var e=e.elem,t=e.closest("."+A.ELEM_PREVIEW),a="layui-icon-"+this.className,i="layui-icon-screen-restore",l=this.title,o=x("html,body"),n="layui-scrollbar-hide";e.hasClass(a)?(t.addClass(A.ELEM_FULL),e.removeClass(a).addClass(i),e.attr("title",l[1]),o.addClass(n)):(t.removeClass(A.ELEM_FULL),e.removeClass(i).addClass(a),e.attr("title",l[0]),o.removeClass(n))}},window:{className:"release",title:["\u5728\u65b0\u7a97\u53e3\u9884\u89c8"],event:function(e){D.openWin({content:n(l.code)})}}}),l.copy&&("array"===layui.type(l.tools)?-1===l.tools.indexOf("copy")&&l.tools.unshift("copy"):l.tools=["copy"]),u.on("click",">i",function(){var e=x(this),t=e.data("type"),e={elem:e,type:t,options:l,rawCode:l.code,finalCode:D.unescape(n(l.code))};c[t]&&"function"==typeof c[t].event&&c[t].event(e),"function"==typeof l.toolsEvent&&l.toolsEvent(e)}),l.addTools&&l.tools&&(l.tools=[].concat(l.tools,l.addTools)),layui.each(l.tools,function(e,t){var a="object"==typeof t,i=a?t:c[t]||{className:t,title:[t]},l=i.className||i.type,o=i.title||[""],a=a?i.type||l:t;a&&(c[a]||((t={})[a]=i,x.extend(c,t)),u.append(''))}),o.addClass(A.ELEM_ITEM).wrap(E),C.append(r),l.tools&&C.append(u),o.before(C),s&&_.html(''),y=function(e){var t=e.children("iframe")[0];s&&t?t.srcdoc=n(l.code):e.html(l.code),setTimeout(function(){"function"==typeof l.done&&l.done({container:e,options:l,render:function(){N.render(e.find(".layui-form")),S.render(),I.render({elem:["."+A.ELEM_PREVIEW,".layui-tabs"].join(" ")})}})},3)},"preview"===f[0]?(_.addClass(A.ELEM_SHOW),o.before(_),y(_)):o.addClass(A.ELEM_SHOW).after(_),l.previewStyle=[l.style,l.previewStyle].join(""),_.attr("style",l.previewStyle),S.on("tab("+M+")",function(e){var t=x(this),a=x(e.elem).closest("."+A.ELEM_PREVIEW).find("."+A.ELEM_ITEM),e=a.eq(e.index);a.removeClass(A.ELEM_SHOW),e.addClass(A.ELEM_SHOW),"preview"===t.attr("lay-id")&&y(e),L()})),p=x(''),o.addClass((E=["layui-code-view layui-border-box"],l.wordWrap||E.push("layui-code-nowrap"),E.join(" "))),(C=l.theme||l.skin)&&(o.removeClass("layui-code-theme-dark layui-code-theme-light"),o.addClass("layui-code-theme-"+C)),l.highlighter&&o.addClass([l.highlighter,"language-"+l.lang,"layui-code-hl"].join(" ")),f=w(l.encode?D.escape(n(a)):a),h=f.lines,o.html(p.html(f.html)),l.ln&&o.append('
              '),l.height&&p.css("max-height",l.height),l.codeStyle=[l.style,l.codeStyle].join(""),l.codeStyle&&p.attr("style",function(e,t){return(t||"")+l.codeStyle}),v=[{selector:">.layui-code-wrap>.layui-code-line{}",setValue:function(e,t){e.style["padding-left"]=t+"px"}},{selector:">.layui-code-wrap>.layui-code-line>.layui-code-line-number{}",setValue:function(e,t){e.style.width=t+"px"}},{selector:">.layui-code-ln-side{}",setValue:function(e,t){e.style.width=t+"px"}}],m=lay.style({target:o[0],id:"DF-code-"+d,text:x.map(x.map(v,function(e){return e.selector}),function(e,t){return['.layui-code-view[lay-code-index="'+d+'"]',e].join(" ")}).join("")}),L=function b(){var e,i;return l.ln&&(e=Math.floor(h.length/100),i=p.children("."+A.ELEM_LINE).last().children("."+A.ELEM_LINE_NUM).outerWidth(),o.addClass(A.ELEM_LN_MODE),e)&&A.LINE_RAW_WIDTH
            • ')).html(l.title||l.text.code),o.prepend(_)),M=x('
              '),l.copy&&!l.preview&&((C=x(['','',""].join(""))).on("click",function(){c.copy.event()}),M.append(C)),l.langMarker&&M.append(''+l.lang+""),l.about&&M.append(l.about),o.append(M),l.preview||setTimeout(function(){"function"==typeof l.done&&l.done({})},3),l.elem.length===1+d&&"function"==typeof l.allDone&&l.allDone())),g})}),layui["layui.all"]||layui.addcss("modules/code.css?v=6","skincodecss"); \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/button.css b/src/plugin/admin/public/component/pear/css/module/button.css deleted file mode 100644 index fcc6ba32..00000000 --- a/src/plugin/admin/public/component/pear/css/module/button.css +++ /dev/null @@ -1,169 +0,0 @@ -.pear-btn { - display: inline-block; - line-height: 38px; - white-space: nowrap; - cursor: pointer; - text-align: center; - box-sizing: border-box; - outline: none; - transition: 0.1s; - font-weight: 500; - padding: 0 18px; - height: 38px; - font-size: 14px; - background-color: white; - border: 1px solid #dcdfe6; - border-radius: 2px; -} - -.pear-btn i { - font-size: 13px; -} - -.pear-btn:hover { - opacity: .8; - filter: alpha(opacity=80); - color: #409eff; - background-color: #ECF5FF; -} - -.pear-btn-danger, -.pear-btn-warming, -.pear-btn-success, -.pear-btn-primary { - height: 37px; - line-height: 37px; - color: #fff !important -} - -/** Button 主题 */ -.pear-btn-primary { - border: 1px solid #2D8CF0; - background-color: #2D8CF0 !important; -} -.pear-btn-danger { - border: 1px solid #f56c6c; - background-color: #f56c6c !important; -} -.pear-btn-warming { - border: 1px solid #f6ad55; - background-color: #f6ad55 !important; -} -.pear-btn-success { - border: 1px solid #36b368; - background-color: #36b368 !important; -} - -.pear-btn[round] { - border-radius: 50px; -} - -.pear-btn-primary[plain] { - color: #409eff !important; - background: #ecf5ff 10% !important; -} - -.pear-btn-primary[plain]:hover { - color: #fff !important; - background-color: #2d8cf0!important -} - -.pear-btn-success[plain] { - color: #36b368 !important; - background: #f0f9eb !important; -} - -.pear-btn-success[plain]:hover { - color: white !important; - background-color: #36b368 !important -} - -.pear-btn-warming[plain] { - color: #e6a23c !important; - background: #fdf6ec !important; -} - -.pear-btn-warming[plain]:hover { - color: white !important; - background-color: #e6a23c !important -} - -.pear-btn-danger[plain] { - color: #f56c6c !important; - background: #fef0f0 !important; -} - -.pear-btn-danger[plain]:hover { - color: white !important; - background-color: #f56c6c !important -} - -/** Button Group */ -.pear-btn-group { - display: inline-block; - vertical-align: middle; -} - -.pear-btn-group .pear-btn { - float: left; - position: relative; - border-radius: 0px; - margin-left: 1px; - margin-right: 1px; -} - -.pear-btn-md { - height: 34px; - line-height: 34px; - padding: 0 10px; - font-size: 12.5px; -} - -.pear-btn-group .pear-btn:first-child { - border-top-left-radius: 4px !important; - border-bottom-left-radius: 4px !important; -} - -.pear-btn-group .pear-btn:last-child { - border-top-right-radius: 4px !important; - border-bottom-right-radius: 4px !important; -} - -.pear-btn-group .pear-btn[round]:first-child { - border-top-left-radius: 50px !important; - border-bottom-left-radius: 50px !important; -} - -.pear-btn-group .pear-btn[round]:last-child { - border-top-right-radius: 50px !important; - border-bottom-right-radius: 50px !important; -} - -/** Button Size*/ -.pear-btn-sm { - height: 32px; - line-height: 32px; - padding: 0 10px; - font-size: 12px; -} - -.pear-btn-xs { - height: 28px; - line-height: 28px; - padding: 0 8px; - font-size: 12px; -} - -.pear-btn-md { - height: 34px; - line-height: 34px; - padding: 0 10px; - font-size: 12.5px; -} - -.pear-btn-lg { - height: 44px; - line-height: 44px; - padding: 0 25px; - font-size: 16px; -} diff --git a/src/plugin/admin/public/component/pear/css/module/card.css b/src/plugin/admin/public/component/pear/css/module/card.css deleted file mode 100644 index 39b4ed28..00000000 --- a/src/plugin/admin/public/component/pear/css/module/card.css +++ /dev/null @@ -1,93 +0,0 @@ -.project-list-item { - background-color: #fff; - border-radius: 4px; - cursor: pointer; - transition: all .2s; -} - -.project-list-item:hover { - box-shadow: 2px 0 4px rgba(0, 21, 41, .35); -} - -.project-list-item .project-list-item-cover { - width: 100%; - height: 180px; - display: block; - border-top-left-radius: 4px; - border-top-right-radius: 4px; -} - -.project-list-item-body { - padding: 20px; - border: 1px solid #e8e8e8; -} - -.project-list-item .project-list-item-body>h2 { - font-size: 16px; - color: #333; - margin-bottom: 12px; -} - -.project-list-item .project-list-item-text { - height: 40px; - overflow: hidden; - margin-bottom: 12px; -} - -.project-list-item .project-list-item-desc { - position: relative; -} - -.project-list-item .project-list-item-desc .time { - color: #999; - font-size: 12px; -} - -.project-list-item .project-list-item-desc .ew-head-list { - position: absolute; - right: 0; - top: 0; -} - -.ew-head-list .ew-head-list-item:first-child { - margin-left: 0; -} - -.ew-head-list .ew-head-list-item { - width: 22px; - height: 22px; - border-radius: 50%; - border: 1px solid #fff; - margin-left: -10px; -} - -.ew-head-list .ew-head-list-item { - width: 22px; - height: 22px; - border-radius: 50%; - border: 1px solid #fff; - margin-left: -10px; -} - -.cloud-card-component { - padding: 20px; -} - -.cloud-card-component .layui-table-click { - border-radius: 6px!important; -} - -.ew-table-loading { - padding: 10px 0; - text-align: center; -} -.ew-table-loading > i { - color: #999; - font-size: 30px; -} -.ew-table-loading.ew-loading-float { - position: absolute; - top: 0; - left: 0; - right: 0; -} \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/code.css b/src/plugin/admin/public/component/pear/css/module/code.css deleted file mode 100644 index 4bde0d3d..00000000 --- a/src/plugin/admin/public/component/pear/css/module/code.css +++ /dev/null @@ -1,9 +0,0 @@ -.layui-colla-content{ - padding: 0px; -} -.layui-code-view{ - margin: 0px!important; -} -.layui-code-h3{ - display: none!important; -} \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/cropper.css b/src/plugin/admin/public/component/pear/css/module/cropper.css deleted file mode 100644 index 2c640426..00000000 --- a/src/plugin/admin/public/component/pear/css/module/cropper.css +++ /dev/null @@ -1,272 +0,0 @@ -.cropper-container { - position: relative; - overflow: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - -webkit-tap-highlight-color: transparent; - -webkit-touch-callout: none -} - -.cropper-container img { - display: block; - width: 100%; - min-width: 0 !important; - max-width: none !important; - height: 100%; - min-height: 0 !important; - max-height: none !important; - image-orientation: 0deg !important -} - -.cropper-canvas, -.cropper-crop-box, -.cropper-drag-box, -.cropper-modal { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0 -} - -.cropper-drag-box { - background-color: #fff; - filter: alpha(opacity=0); - opacity: 0 -} - -.cropper-modal { - background-color: #000; - filter: alpha(opacity=50); - opacity: .5 -} - -.cropper-view-box { - display: block; - width: 100%; - height: 100%; - overflow: hidden; - outline: #69f solid 1px; - outline-color: rgba(102, 153, 255, .75) -} - -.cropper-dashed { - position: absolute; - display: block; - filter: alpha(opacity=50); - border: 0 dashed #fff; - opacity: .5 -} - -.cropper-dashed.dashed-h { - top: 33.33333333%; - left: 0; - width: 100%; - height: 33.33333333%; - border-top-width: 1px; - border-bottom-width: 1px -} - -.cropper-dashed.dashed-v { - top: 0; - left: 33.33333333%; - width: 33.33333333%; - height: 100%; - border-right-width: 1px; - border-left-width: 1px -} - -.cropper-face, -.cropper-line, -.cropper-point { - position: absolute; - display: block; - width: 100%; - height: 100%; - filter: alpha(opacity=10); - opacity: .1 -} - -.cropper-face { - top: 0; - left: 0; - cursor: move; - background-color: #fff -} - -.cropper-line { - background-color: #69f -} - -.cropper-line.line-e { - top: 0; - right: -3px; - width: 5px; - cursor: e-resize -} - -.cropper-line.line-n { - top: -3px; - left: 0; - height: 5px; - cursor: n-resize -} - -.cropper-line.line-w { - top: 0; - left: -3px; - width: 5px; - cursor: w-resize -} - -.cropper-line.line-s { - bottom: -3px; - left: 0; - height: 5px; - cursor: s-resize -} - -.cropper-point { - width: 5px; - height: 5px; - background-color: #69f; - filter: alpha(opacity=75); - opacity: .75 -} - -.cropper-point.point-e { - top: 50%; - right: -3px; - margin-top: -3px; - cursor: e-resize -} - -.cropper-point.point-n { - top: -3px; - left: 50%; - margin-left: -3px; - cursor: n-resize -} - -.cropper-point.point-w { - top: 50%; - left: -3px; - margin-top: -3px; - cursor: w-resize -} - -.cropper-point.point-s { - bottom: -3px; - left: 50%; - margin-left: -3px; - cursor: s-resize -} - -.cropper-point.point-ne { - top: -3px; - right: -3px; - cursor: ne-resize -} - -.cropper-point.point-nw { - top: -3px; - left: -3px; - cursor: nw-resize -} - -.cropper-point.point-sw { - bottom: -3px; - left: -3px; - cursor: sw-resize -} - -.cropper-point.point-se { - right: -3px; - bottom: -3px; - width: 20px; - height: 20px; - cursor: se-resize; - filter: alpha(opacity=100); - opacity: 1 -} - -.cropper-point.point-se:before { - position: absolute; - right: -50%; - bottom: -50%; - display: block; - width: 200%; - height: 200%; - content: " "; - background-color: #69f; - filter: alpha(opacity=0); - opacity: 0 -} - -@media (min-width:768px) { - .cropper-point.point-se { - width: 15px; - height: 15px - } -} - -@media (min-width:992px) { - .cropper-point.point-se { - width: 10px; - height: 10px - } -} - -@media (min-width:1200px) { - .cropper-point.point-se { - width: 5px; - height: 5px; - filter: alpha(opacity=75); - opacity: .75 - } -} - -.cropper-bg { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC) -} - -.cropper-invisible { - filter: alpha(opacity=0); - opacity: 0 -} - -.cropper-hide { - position: fixed; - top: 0; - left: 0; - z-index: -1; - width: auto !important; - min-width: 0 !important; - max-width: none !important; - height: auto !important; - min-height: 0 !important; - max-height: none !important; - filter: alpha(opacity=0); - opacity: 0 -} - -.cropper-hidden { - display: none !important -} - -.cropper-move { - cursor: move -} - -.cropper-crop { - cursor: crosshair -} - -.cropper-disabled .cropper-canvas, -.cropper-disabled .cropper-face, -.cropper-disabled .cropper-line, -.cropper-disabled .cropper-point { - cursor: not-allowed -} diff --git a/src/plugin/admin/public/component/pear/css/module/dtree/dtree.css b/src/plugin/admin/public/component/pear/css/module/dtree/dtree.css deleted file mode 100644 index 3e5364d4..00000000 --- a/src/plugin/admin/public/component/pear/css/module/dtree/dtree.css +++ /dev/null @@ -1,112 +0,0 @@ - -/**************** 主题换肤 ****************/ -/* 默认风格*/ -.dtree-theme-item-this{background-color: #d2d2d2!important;} -.dtree-theme-item:hover{background-color: #eaeceb!important;} -.dtree-theme-item cite{font-size:12px!important;} -.dtree-theme-item:hover cite{color:#fe7786!important;} - -.dtree-theme-dtreefont{font-size: 16px!important;} -.dtree-theme-ficon{color:#000!important;} -.dtree-theme-icon{color:orange!important;} -.dtree-theme-checkbox:hover{color:#fe7786!important;} -.dtree-theme-choose{color:#fe7786!important;} - -/* layui主题风格*/ -.dtree-layui-item-this{background: none!important;} -.dtree-layui-item:hover{background: none!important;} -.dtree-layui-item cite{font-size:14px!important;} -.dtree-layui-item:hover cite{opacity:0.5;filter:Alpha(opacity=50);text-decoration: underline;} - -.dtree-layui-dtreefont{font-size: 18px!important;} -.dtree-layui-ficon{font-size: 18px!important;color:#393D49!important;} -.dtree-layui-icon{color:#666!important;} -.dtree-layui-checkbox:hover{color:#5FB878!important;} -.dtree-layui-choose{color:#5FB878!important;} - -/* laySimple主题风格*/ -.dtree-laySimple-item-this{background-color: #d2d2d2!important;} -.dtree-laySimple-item:hover{background-color: #eaeceb!important;} -.dtree-laySimple-item cite{font-size:12px!important;} -.dtree-laySimple-item:hover cite{color:#01AAED!important;} - -.dtree-laySimple-dtreefont{font-size: 16px!important;} -.dtree-laySimple-ficon{font-size: 14px!important;color:#393D49!important;} -.dtree-laySimple-icon{color:#393D49!important;} -.dtree-laySimple-checkbox:hover{color:#01AAED!important;} -.dtree-laySimple-choose{color:#01AAED!important;} -/**************** 树基础 ****************/ -/* 菜单栏*/ -.dtree-menubar {padding-left: 10px;} -.dtree-menubar .layui-btn-group .layui-btn-sm{height: 20px;line-height: 20px;padding: 0 5px;font-size: 12px;} -.dtree-menubar .layui-btn-group .layui-btn-sm i{font-size: 12px!important;} - -/* 工具栏*/ -.dtree-toolbar{position: absolute;z-index: 940520;padding: 0;background-color: #eceaeb;} -.dtree-toolbar .layui-nav-child{position: static;} -.dtree-toolbar .layui-nav-child dd{cursor: pointer;} -.dtree-toolbar .layui-nav-child dd a i{font-size:16px;display: inline-block;margin: 0px 1px;color:#fe7786;} -.dtree-toolbar .layui-nav-child dd a i:hover{font-weight: bold;} -.dtree-toolbar .layui-nav-bar{display: none!important;} -.dtree-toolbar-tool{padding: 30px;} - -.dtree-toolbar-fixed{position: absolute;right: 5px;top: 2px;font-style: normal;transition: all .3s;-webkit-transition: all .3s;} -/*.dtree-toolbar-fixed a{border:1px solid #fe7786;}*/ -.dtree-toolbar-fixed a i{font-size:14px;display: inline-block;margin: 0px 1px;color:#fe7786;} -.dtree-toolbar-fixed a i:hover{opacity:0.8;filter:Alpha(opacity=80);} - -/* 树基本*/ -.dtree{width:260px;} -.dtree-nav-item{line-height:33px;padding-left:16px;} -.dtree-nav-ul-sid{display: none;} -.dtree-none-text{font-size: 12px;text-align: center;color: gray;} - -/* 树线*/ -.dtree-nav-first-line,.dtree-nav-line,.dtree-nav-last-line{position: relative;} -.dtree-nav-first-line:before{content:"";position: absolute;height: 0;border-left: 1px dotted #c0c4cc;} -.dtree-nav-first-line:after{content:"";position: absolute;height: 0;border-top: 1px dotted #c0c4cc;} - -.dtree-nav-line:before{content:"";position: absolute;top: 0;left: 7px;width: 0;height: 100%;border-left: 1px dotted #c0c4cc;} -.dtree-nav-line:after{content:"";position: absolute;top: 16px;left: 8px;width: 9px;height: 0;border-top: 1px dotted #c0c4cc;} - -.dtree-nav-last-line:before{content:"";position: absolute;top: 0;left: 7px;width: 0;height: 17px;border-left: 1px dotted #c0c4cc;} -.dtree-nav-last-line:after{content:"";position: absolute;top: 16px;left: 8px;width: 9px;height: 0;border-top: 1px dotted #c0c4cc;} - - -/* 图标及复选框*/ -.dtreefont{cursor: pointer;} -.dtreefont-special{margin: 0 4px;} -.dtree-nav-checkbox-div{display: inline-block;} -.dtree-nav-checkbox-div>i{display: inline-block;margin: 0px 1px;} -.dtree-nav-checkbox-div>i:last-child{margin-right: 4px;} -.dtree-nav-checkbox-div>i:hover{opacity:0.8;filter:Alpha(opacity=80);} - -/* 行 文字*/ -.dtree-nav-div{display:block;vertical-align:top;position:relative;} -.dtree-nav-div cite{font-style: normal;cursor: pointer;} -.dtree-nav-div:hover cite{opacity:0.7;filter:Alpha(opacity=70);transition: all .3s;-webkit-transition: all .3s;} - -/* 规则属性*/ -.dtree-nav-show {display: block!important;} -.dtree-nav-hide {display: none!important;} -.dtree-nav-this {} -.dtree-icon-hide {opacity:0;filter:Alpha(opacity=0);} -.dtree-icon-null-open,.dtree-icon-null-close,.dtree-icon-null{margin: 0 2px;} -.dtree-disabled{cursor: not-allowed; color:#c2c2c2!important;} -.dtree-disabled:hover{color:#c2c2c2!important;} -.dtree-nav-div cite.dtree-disabled{font-style: normal; cursor: not-allowed; color:#c2c2c2!important;} -.dtree-nav-div>cite.dtree-disabled:hover{color:#c2c2c2!important;} - - -/** 下拉树属性*/ -.dtree-select{position: absolute;max-height: 500px;height: 350px;overflow: auto;width: 99%;z-index: 123;display: none;border:1px solid silver;top: 42px;} -.dtree-select-show{display: block!important;} - -/* 简单适配*/ -@media screen and (max-width:1700px) and (min-width:1300px){ - .dtree-nav-item {padding-left: 15px;} -} - - - - diff --git a/src/plugin/admin/public/component/pear/css/module/dtree/dtree.js b/src/plugin/admin/public/component/pear/css/module/dtree/dtree.js deleted file mode 100644 index a05b22a8..00000000 --- a/src/plugin/admin/public/component/pear/css/module/dtree/dtree.js +++ /dev/null @@ -1,4947 +0,0 @@ -/** - *@Name dtree 树形组件 - *@Author 智慧的小西瓜 - *@DOCS http://www.wisdomelon.com/DTreeHelper/ - *@License https://www.layui.com/ - *@LASTTIME 2019/10/24 - *@VERSION v2.5.6 - */ -layui.define(['jquery','layer','form'], function(exports) { - var $ = layui.$, - layer = layui.layer, - form = layui.form; - - // 树的公共定义样式汇总 - var LI_NAV_CHILD = "dtree-nav-ul-sid", LI_NAV_ITEM = "dtree-nav-item", - LI_DIV_ITEM = "dtree-nav-div", DTREEFONTSPECIAL="dtreefont-special", NONETITLE="dtree-none-text", - LI_DIV_MENUBAR = "dtree-menubar", - LI_DIV_TOOLBAR = "dtree-toolbar", TOOLBAR_TOOL = "dtree-toolbar-tool", TOOLBAR_TOOL_EM = "dtree-toolbar-fixed", - LI_DIV_CHECKBAR = "dtree-nav-checkbox-div", - LI_CLICK_CHECKBAR = "d-click-checkbar", //绑定点击复选框时需要用到 - LI_DIV_TEXT_CLASS = "t-click", UL_ROOT="dtree", - LI_NAV_FIRST_LINE = "dtree-nav-first-line", LI_NAV_LINE = "dtree-nav-line", LI_NAV_LAST_LINE = "dtree-nav-last-line"; - - - // 树的公共指定 - var NAV_THIS = "dtree-nav-this", //当前节点 - NAV_SHOW = "dtree-nav-show", //显示子节点 - NAV_HIDE = "dtree-nav-hide", //隐藏节点 - NAV_DIS = "dtree-disabled", //禁用节点 - ICON_HIDE = "dtree-icon-hide", //隐藏图标 - $BODY = $("body"), //body选择器 - $WIN = $(window), //window窗口 - $DOC = $(document), //当前文档 - MOD_NAME = "dtree", //模块名称 - VERSION = "v2.5.6", //版本 - OPTIONS = {}, //全局属性配置 - DTrees = {}; //当前被实例化的树的集合 - - // 树的自定义图标 - var DTREEFONT = "dtreefont", //默认使用图标字体 - LI_DIV_CHECKBAR_ON = "dtree-icon-fuxuankuangxuanzhong", //复选框选中图标 - LI_DIV_CHECKBAR_OUT = "dtree-icon-fuxuankuang", //复选框未选中图标 - LI_DIV_CHECKBAR_NOALL = "dtree-icon-fuxuankuang-banxuan", //复选框半选图标 - LI_DIV_MENUBAR_DOWN = "dtree-icon-move-down", //menubar的展开全部的图标 - LI_DIV_MENUBAR_UP = "dtree-icon-move-up", //menubar的收缩全部的图标 - LI_DIV_MENUBAR_REFRESH = "dtree-icon-refresh", //menubar的刷新图标 - LI_DIV_MENUBAR_CHECKALL = "dtree-icon-roundcheckfill", //menubar的全选图标 - LI_DIV_MENUBAR_UNCHECKALL = "dtree-icon-roundclosefill", //menubar的全不选图标 - LI_DIV_MENUBAR_INVERTALL = "dtree-icon-roundcheck", //menubar的反选图标 - LI_DIV_MENUBAR_DELETE = "dtree-icon-delete1", //menubar的删除图标 - LI_DIV_MENUBAR_SEARCH = "dtree-icon-search_list_light", //menubar的搜索图标 - LI_DIV_TOOLBAR_PULLDOWN = "dtree-icon-pulldown", //toolbar的展开图标 - LI_DIV_TOOLBAR_PULLUP = "dtree-icon-pullup", //toolbar的收缩图标 - LI_DIV_TOOLBAR_ADD = "dtree-icon-roundadd", //toolbar的新增图标 - LI_DIV_TOOLBAR_EDIT = "dtree-icon-bianji", //toolbar的编辑图标 - LI_DIV_TOOLBAR_DEL = "dtree-icon-roundclose"; //toolbar的删除图标 - - // 树的非叶子节点图标集合 - var nodeIconArray = { - "-1": {"open": "dtree-icon-null-open", "close": "dtree-icon-null-close"}, //未指定 - "0" : {"open": "dtree-icon-wenjianjiazhankai", "close": "dtree-icon-weibiaoti5"}, //文件夹(二级图标默认样式) - "1" : {"open": "dtree-icon-jian", "close": "dtree-icon-jia"}, //+-图标(一级图标默认样式) - "2" : {"open": "dtree-icon-xiangxia1", "close": "dtree-icon-xiangyou"} //箭头图标 - }; - - // 树的叶子节点图标集合 - var leafIconArray = { - "-1": "dtree-icon-null", //未指定 - "0" : "dtree-icon-weibiaoti5", //文件夹 - "1" : "dtree-icon-yonghu", //人员 - "2" : "dtree-icon-fenzhijigou", //机构 - "3" : "dtree-icon-fenguangbaobiao", //报表 - "4" : "dtree-icon-xinxipilu", //信息 - "5" : "dtree-icon-shuye1", //叶子(二级图标默认样式) - "6" : "dtree-icon-caidan_xunzhang", //勋章 - "7" : "dtree-icon-normal-file", //文件 - "8" : "dtree-icon-dian", //小圆点(一级图标默认样式) - "9" : "dtree-icon-set-sm", //齿轮 - "10" : "dtree-icon-rate" //星星 - }; - - // 树的自定义样式 - var DTREE = "dtree-", //自定义样式前缀 - ITEMTHIS = "-item-this", //自定义样式当前行选中后缀 - ITEM = "-item", //自定义样式当前行后缀 - DFONT = "-dtreefont", //自定义样式图标样式后缀 - FICON = "-ficon", //自定义样式一级图标样式后缀 - ICON = "-icon", //自定义样式二级图标样式后缀 - CBOX = "-checkbox", //自定义样式复选框样式后缀 - CHS = "-choose"; //自定义样式复选框选中样式后缀 - - // 树自定义操作事件名称集合 绑定dtree-click的事件 - var eventName = { - checkNodeClick: "checkNodeClick", //点击复选框 - itemNodeClick: "itemNodeClick" //点击子节点div - }; - - // 树默认toolbar提供的功能集合 绑定dtree-tool的事件 - var defaultTool = { - pulldown: "pulldown", //点击展开当前节点下的全部节点 - pullup: "pullup", //点击收缩当前节点下的全部节点 - addTool: "addToolbar", //点击toolbar新增 - editTool: "editToolbar", //点击toolbar编辑 - delTool: "delToolbar" //点击toolbar删除 - }; - - // 树默认menubar提供的功能集合 绑定dtree-menu的事件 - var defaultMenu = { - moveDown: "moveDown", //menubar展开全部节点 - moveUp: "moveUp", //menubar收缩全部节点 - refresh: "refresh", //menubar刷新树 - checkAll: "checkAll", //menubar全选 - unCheckAll: "unCheckAll", //menubar全不选 - invertAll: "invertAll", //menubar反选 - remove: "remove", //menubar删除选中节点 - searchNode: "searchNode" //menubar查询节点 - }; - - // 树的公共事件 - var event = { - getElemId: function(options){ // 根据传入的参数获取ID - var elem = options.elem || ""; - var obj = options.obj || $(elem); - - if (obj.length == 0) { //页面中未找到绑定id - return ""; - } else { - return $(obj)[0].id; - } - }, - escape: function(html){ - if(typeof html !== 'string') return ''; - return html.replace(entityReg.escape, function(match){return entityMap.escape[match];}); - }, - unescape: function(str){ - if(typeof str !== 'string') return ''; - return str.replace(entityReg.unescape, function(match){return entityMap.unescape[match];}); - }, - cloneObj: function (obj, filter) { //深复制对象方法 - var newObj = {}; - if (obj instanceof Array) { - newObj = []; - } - var str = ""; - if(typeof filter !== 'undefined') {str = filter.join(",");} - for (var key in obj) { - if(str.indexOf(key) == -1){ - var val = obj[key]; - newObj[key] = typeof val === 'object' ? event.cloneObj(val, typeof filter !== undefined ? filter : []): val; - } - - } - return newObj; - }, - trimToDot: function(str){ - return str.replace(/ /g, "."); - } - }; - - // 特殊符号转义 - var keys = Object.keys || function(obj) { - obj = Object(obj); - var arr = []; - for(var a in obj) arr.push(a); - return arr; - }; - var invert = function(obj){ - obj = Object(obj); - var result = {}; - for(var a in obj) result[obj[a]] = a; - return result; - }; - var entityMap = { - escape: { - "&" : "&", - "<" : "<", - ">" : ">", - "'" : "&quo;" - } - }; - entityMap.unescape = invert(entityMap.escape); - var entityReg = { - escape: RegExp('[' + keys(entityMap.escape).join('') + ']', 'g'), - unescape: RegExp('(' + keys(entityMap.unescape).join('|') + ')', 'g') - }; - - //异步加载接口 - var AjaxHelper = { - request : function(config) { - var data = config.data ? config.data : {}; - var async = (typeof (config.async) === "boolean") ? config.async : true; - $.ajax({ - type : config.type ? config.type : "POST", - headers : config.headers, - url : config.url, - dataType : config.dataType ? config.dataType : "json", - data : data, - async : async, - contentType : config.contentType, - xhrFields: {withCredentials: config.withCredentials}, - success : config.success, - error : function(XMLHttpRequest, textStatus, errorThrown) { - if (typeof (config.error) === "function") { - config.error(XMLHttpRequest, textStatus, errorThrown); - } else { - layer.msg("异步加载失败: " + textStatus,{icon:5, shift:6}); - } - }, - statusCode : { - 404 : function() { - layer.msg('未找到指定请求,请检查访问路径!',{icon:5, shift:6}); - }, - 500 : function() { - layer.msg('系统错误!',{icon:5, shift:6}); - } - }, - complete : function(XMLHttpRequest, textStatus) { - if (typeof (config.complete) === "function") { - config.complete(XMLHttpRequest, textStatus); - } - } - }); - }, - serialize: function(param){ //json序列化 key=value&key1=value1 - var p = "?"; - for (var key in param) { - p += key + "=" + param[key] + "&"; - } - p = p.substring(0, p.length-1); - return p; - } - }; - - // 树类 - var DTree = function(options){ - var _this = this; - /** 默认赋值**/ - this.formatter = { // 数据过滤 - title: false // 文字,默认不开启 - }; - this.response = { // 树返回的json格式 - statusName: "code", //返回标识 - statusCode: 200, //返回码 - message: "message", //返回信息 - rootName: "data", //根节点名称 - treeId: "id", //节点ID - parentId: "parentId", //父节点ID - title: "title", //节点名称 - ficonClass: "ficonClass", //自定义一级图标 - iconClass: "iconClass", //自定义二级图标 - childName: "children", //子节点名称 - last: "last", //是否最后一级节点 -// level: "level", //层级 - spread: "spread", //展开 - disabled: "disabled", //禁用 - hide: "hide", //隐藏 - checkArr: "checkArr", //复选框列表 - checked: "checked", //是否选中 - type: "type", //复选框标记 - basicData: "basicData" //表示用户自定义需要存储在树节点中的数据 - }; - this.defaultRequest = { // 树的默认发起请求参数格式,最后会将value作为参数名称传递 - nodeId: "nodeId", //节点ID - parentId: "parentId", //父节点ID - context: "context", //节点内容 - leaf: "leaf", //是否叶子节点 - level: "level", //层级 - spread: "spread", //节点展开状态 - dataType: "dataType", //节点标记 - checked: "checked", //节点复选框选中状态 - initchecked: "initchecked", //节点复选框初始状态 - basicData: "basicData", //用户自定义的记录节点数据 - recordData: "recordData", //当前data数据(排除basicData和children字段) - }; - this.toolbarFun = { - addTreeNode: function(param, $div) { //添加树节点后调用的函数,用于用户自定义,如未指定则树不会发生变化 - return ; - }, - editTreeNode: function(param, $div) { //编辑树节点后调用的函数,用于用户自定义,如未指定则树不会发生变化 - return ; - }, - editTreeLoad: function(param){ // 编辑树的数据回显,用于打开编辑时,回填数据 - return ; - }, - delTreeNode: function(param, $div){ //删除树后调用的函数,用于用户自定义,如未指定则树不会发生变化 - return ; - }, - loadToolbarBefore: function(buttons, param, $div){ // 右键菜单加载前的函数 - return buttons; - } - }; - this.toolbarStyle = { - title: "节点", - area: ["60%","80%"] - }; - this.menubarFun = { - remove: function(checkbarNodes){ //删除复选框选中节点,需要用户自定义,如未指定则树只是页面上做了修改 - return true; - } - }; - this.menubarTips = { - toolbar: [], - group: [defaultMenu.moveDown, defaultMenu.moveUp, defaultMenu.refresh, defaultMenu.checkAll, defaultMenu.unCheckAll, defaultMenu.invertAll, defaultMenu.remove, defaultMenu.searchNode], - freedom: [] - }; - this.checkbarFun = { - chooseBefore: function($i, node){ // 复选框点击前回调 - return true; - }, - chooseDone: function(checkbarNodesParam) { //复选框点击事件完毕后,返回该树关于复选框操作的全部信息,用于用户自定义,如未指定则树只是页面上做了修改 - return ; - } - }; - this.iframeDefaultRequest = { //iframe的默认参数,目的是与加载树的参数不一样 - nodeId: "nodeId", //节点ID - parentId: "parentId", //父节点ID - context: "context", //节点内容 - leaf: "leaf", //是否叶子节点 - level: "level", //层级 - spread: "spread", //节点展开状态 - dataType: "dataType", //节点标记 - checked: "checked", //节点复选框选中状态 - initchecked: "initchecked", //节点复选框初始状态 - basicData: "basicData", //用户自定义的记录节点数据 - recordData: "recordData", //当前data数据(排除basicData和children字段) - }; - - this.iframeFun = { - iframeDone: function(iframeParam){ //iframe加载完毕后,用于用户自定义事件 - return ; - } - }; - this.style = { //树最终使用的样式集合 - item: "", //每一项div的样式 - itemThis: "", //选中div的样式 - dfont: "", //一级图标的样式 - icon: "", //二级图标的样式 - cbox: "", //复选框的样式 - chs: "" //复选框选中的样式 - }; - this.usefontStyle = { //树最终使用的图标集合 - fnode:{ //一级节点 - node:{ //非叶子节点 - open:"", //节点展开 - close:"" //节点关闭 - }, - leaf:"" //叶子节点 - }, - snode:{ //二级节点 - node:{ //非叶子节点 - open:"", //节点展开 - close:"" //节点关闭 - }, - leaf:"" //叶子节点 - }, - checkbox:{ //复选框 - on:"", //复选框选中 - out:"", //未选中 - noall:"" //半选 - }, - menubar:{ //菜单栏 - movedown:"", //全部展开 - moveup:"", //全部收缩 - refresh:"", //刷新 - checkAll:"", //全选 - unCheckAll:"", //全不选 - invertAll:"", //反选 - remove:"", //删除 - search:"" //搜索 - }, - menubarExt:"", //扩展菜单栏 - toolbar:{ //工具栏 - menubar:{ //依附在菜单栏的工具栏 - movedown:"", //全部展开 - moveup:"", //全部收缩 - refresh:"", //刷新 - checkAll:"", //全选 - unCheckAll:"", //全不选 - invertAll:"", //反选 - remove:"", //删除 - search:"" //搜索 - }, - menubarExt:"", //依附在菜单栏的扩展菜单栏 - pulldown:"", //展开 - pullup:"", //收缩 - add:"", //添加 - edit:"", //编辑 - del:"" //删除 - }, - toolbarExt:"" //扩展工具栏 - } - - /** 数据绑定**/ - this.node = { // 树节点选中时,包含当前节点的全部信息 - nodeId: "", //节点ID - parentId: "", //父节点ID - context: "", //节点内容 - leaf: "", //是否叶子节点 - level: "", //层级 - spread: "", //节点展开状态 - dataType: "", //节点标记 - checked: "", //节点复选框选中状态 - initchecked: "", //节点复选框初始状态 - basicData: "", //用户自定义的记录节点数据 - recordData: "", //当前data数据(排除basicData和children字段) - }; - - this.toolbarMenu = {}; // 工具栏右键菜单绑定的所有元素 - this.checkbarNode = []; // 复选框标记的全部节点数据 - this.errData = []; // 记录在渲染节点时有问题的数据 - this.checkArrLen = 0; //添加节点的时判断复选框个数 - this.temp = []; // 临时变量 - this.bak = ""; // 临时变量 - this.setting(options); - }; - - /******************** 初始参数加载 ********************/ - // 设置基本参数值 - DTree.prototype.setting = function(options) { - this.options = options || {}; - - /** 绑定元素参数(必填,2个参数项必填一个)**/ - this.elem = this.options.elem || OPTIONS.elem || ""; //树绑定的元素ID:#elem - if(typeof this.options.obj === 'undefined'){ - if(this.elem) { - if($(this.elem).length > 0) { - this.obj = $(this.elem); - } - } - } else { - this.obj = this.options.obj || OPTIONS.obj || this.obj; //树绑定的jquery元素,用于当元素是延迟加载出来的话,可以用这个找到 - this.elem = "#" + this.obj[0].id; - } - - /** 基本参数**/ - this.scroll = this.options.scroll || OPTIONS.scroll || this.elem; //树的上级div容器,让树可以显示滚动条的div容器的ID - this.accordion = (typeof (this.options.accordion) === "boolean") ? this.options.accordion : (typeof (OPTIONS.accordion) === "boolean") ? OPTIONS.accordion : false; //手风琴加载, 默认false - if(this.accordion) { - this.initLevel = 1; //默认展开节点 1节 - } else { - this.initLevel = this.options.initLevel || OPTIONS.initLevel || 2; //默认展开节点 2节 - } - this.type = this.options.type || OPTIONS.type || "load"; //树的加载方式 all,全量树, load,增量树,默认load - this.cache = (typeof (this.options.cache) === "boolean") ? this.options.cache : (typeof (OPTIONS.cache) === "boolean") ? OPTIONS.cache : true; //数据缓存,默认true - this.record = this.options.record || OPTIONS.record || false; //开启数据记录模式,默认false - this.load = (typeof (this.options.load) === "boolean") ? this.options.load : (typeof (OPTIONS.load) === "boolean") ? OPTIONS.load : true; //开启加载动画,默认true - this.none = this.options.none || OPTIONS.nont || "无数据"; //初始加载无记录时显示文字 - this.tempHeight = this.options.height || OPTIONS.height; //临时转换高度变量 - if(this.tempHeight) { // 设置高度 - if(/^full-\d+$/.test(this.tempHeight)) { - this.fullHeightGap = this.tempHeight.split('-')[1]; - this.height = $WIN.height() - this.fullHeightGap; //设置高度 - } else { - this.fullHeightGap = this.tempHeight; - this.height = this.tempHeight; - } - } else { - this.fullHeightGap = ""; - this.height = ""; - } - this.width = this.options.width || OPTIONS.width || "260"; //宽度 - this.obj.css("width", this.width); - - /** 样式相关参数**/ - this.iconfont = this.options.iconfont || OPTIONS.iconfont || DTREEFONT; //默认图标字体 dtreefont - this.iconfontStyle = this.options.iconfontStyle || OPTIONS.iconfontStyle || {}; //用于自定义树的每个关键部位使用的图标 - this.nodeIconArray = $.extend(nodeIconArray, this.options.nodeIconArray || OPTIONS.nodeIconArray) || nodeIconArray; //用户自定义非叶子节点图标集合,node - this.leafIconArray = $.extend(leafIconArray, this.options.leafIconArray || OPTIONS.leafIconArray) || leafIconArray; //用户自定义叶子节点图标集合,leaf - this.skin = this.options.skin || OPTIONS.skin || "theme"; // 自定义样式 - if(this.skin == "layui"){ // layui主题 - this.line = (typeof (this.options.line) === "boolean") ? this.options.line : (typeof (OPTIONS.line) === "boolean") ? OPTIONS.line : true; //开启树线,默认开启 - this.ficon = this.options.ficon || OPTIONS.ficon || "7"; //一级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示一级图标。默认'7' - this.fnodeIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? (this.ficon == "-1" ? "-1" : "1") : this.ficon[0]; //一级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示一级图标,默认'1' - this.fleafIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? this.ficon : this.ficon[1]; //一级图标中的leaf节点图标 - this.icon = this.options.icon || OPTIONS.icon || "-1"; //二级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示二级图标。默认'-1' - this.nodeIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? (this.icon == "-1" ? "-1" : "-1") : this.icon[0]; //二级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示二级图标,默认'-1' - this.leafIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? this.icon : this.icon[1]; //二级图标中的leaf节点图标 - } else if(this.skin == "laySimple"){ // laySimple主题 - this.line = this.options.line || OPTIONS.line || false; //开启树线,默认不开启 - this.ficon = this.options.ficon || OPTIONS.ficon || ["2","-1"]; //一级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示一级图标。默认'-1' - this.fnodeIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? (this.ficon == "-1" ? "-1" : "2") : this.ficon[0]; //一级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示一级图标,默认'2' - this.fleafIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? this.ficon : this.ficon[1]; // 一级图标中的leaf节点图标 - this.icon = this.options.icon || OPTIONS.icon || "-1"; //二级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示二级图标。默认'-1' - this.nodeIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? (this.icon == "-1" ? "-1" : "-1") : this.icon[0]; //二级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示二级图标,默认'-1' - this.leafIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? this.icon : this.icon[1]; //二级图标中的leaf节点图标 - } else { // 默认主题 或者自定义主题 - this.line = this.options.line || OPTIONS.line || false; //开启树线,默认不开启 - this.ficon = this.options.ficon || OPTIONS.ficon || "8"; //一级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示一级图标。默认'8' - this.fnodeIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? (this.ficon == "-1" ? "-1" : "1") : this.ficon[0]; //一级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示一级图标,默认'1' - this.fleafIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? this.ficon : this.ficon[1]; // 一级图标中的leaf节点图标 - this.icon = this.options.icon || OPTIONS.icon || "5"; //二级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示二级图标。默认'5' - this.nodeIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? (this.icon == "-1" ? "-1" : "0") : this.icon[0]; //二级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示二级图标,默认'0' - this.leafIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? this.icon : this.icon[1]; //二级图标中的leaf节点图标 - } - - /** 数据加载参数**/ - this.url = this.options.url || OPTIONS.url || ""; //请求地址 - this.async = (typeof (this.options.async) === "boolean") ? this.options.async : (typeof (OPTIONS.async) === "boolean") ? OPTIONS.async : true; //异步同步加载,默认异步加载 - this.headers = this.options.headers || OPTIONS.headers || {}; //ajax header属性 - this.method = this.options.method || OPTIONS.method || "post"; //请求类型 - this.dataType = this.options.dataType || OPTIONS.dataType || "json"; //参数类型 - this.contentType = this.options.contentType || OPTIONS.contentType || "application/x-www-form-urlencoded"; //发送信息至服务器时内容编码类型 - this.defaultRequest = $.extend(this.defaultRequest, this.options.defaultRequest || OPTIONS.defaultRequest) || this.defaultRequest; //默认请求参数 - this.filterRequest = this.options.filterRequest || OPTIONS.filterRequest || []; //过滤请求参数 - this.request = this.options.request || OPTIONS.request || {}; //用户自定义请求参数 - this.response = $.extend(this.response, this.options.response || OPTIONS.response) || this.response; //返回json格式 - this.data = this.options.data || OPTIONS.data || null; //初始化指定该参数,则不会访问异步接口 - this.dataFormat = this.options.dataFormat || OPTIONS.dataFormat || "levelRelationship"; //用于用户配置的data数据格式,list:列表, levelRelationship:层级关系,默认 - this.dataStyle = this.options.dataStyle || OPTIONS.dataStyle || "defaultStyle"; //用于用户配置layui通用的json数据风格,layuiStyle:layui风格,defaultStyle:默认风格 - this.errDataShow = this.options.errDataShow || OPTIONS.errDataShow || false; //是否在递归数据出现错误后,显示错误信息,默认false - this.withCredentials = this.options.withCredentials || OPTIONS.withCredentials || false; //是否允许跨域请求,默认false - this.success = this.options.success || OPTIONS.success || function(data, obj){}; //树加载完毕后执行解析树之前的回调 - this.done = this.options.done || OPTIONS.done || function(data, obj){}; //树加载完毕后的回调 - this.formatter = $.extend(this.formatter, this.options.formatter || OPTIONS.formatter) || this.formatter; //数据过滤 - this.error = this.options.error || OPTIONS.error || function(XMLHttpRequest, textStatus, errorThrown){}; // 异步加载异常回调 - this.complete = this.options.complete || OPTIONS.complete || function(XMLHttpRequest, textStatus){}; // 异步加载完成回调 - - /** 复选框参数**/ - this.checkbar = this.options.checkbar || OPTIONS.checkbar || false; //是否开启复选框模式 - this.checkbarLoad = this.options.checkbarLoad || OPTIONS.checkbarLoad || "node"; //复选框作用范围,node:所有节点, leaf:最后一级;默认所有节点 - this.checkbarType = this.options.checkbarType || OPTIONS.checkbarType || "all"; //复选框选中形式 all:子集选中父级也选中, no-all:子集选中父级半选中,子集全选父级选中,p-casc:父级选中子集全选,子集无法改变父级选中状态, self:没有任何级联关系,only:只能选中一个复选框。 默认all - this.checkbarData = this.options.checkbarData || OPTIONS.checkbarData || "choose"; //复选框记录数据类型形式, change表示记录变更数据,choose表示记录选中数据,all记录全部数据,halfChoose记录选中和半选中的数据,默认choose - this.checkbarFun = $.extend(this.checkbarFun, this.options.checkbarFun || OPTIONS.checkbarFun) || this.checkbarFun; //checkbar事件加载 - - /** 菜单栏参数**/ - this.menubar = this.options.menubar || OPTIONS.menubar || false; //是否打开菜单栏 - this.menubarTips = $.extend(this.menubarTips, this.options.menubarTips || OPTIONS.menubarTips) || this.menubarTips; //菜单栏吸附, toolbar:依附在工具栏,group:依附在按钮组,freedom,自由 - this.menubarFun = $.extend(this.menubarFun, this.options.menubarFun || OPTIONS.menubarFun) || this.menubarFun; //menubar事件加载 - - /** 工具栏参数**/ - this.toolbar = this.options.toolbar || OPTIONS.toolbar || false; //是否开启可编辑模式 - this.toolbarWay = this.options.toolbarWay || OPTIONS.toolbarWay || "contextmenu"; //工具栏显示方式,contextmenu:右键,follow:跟随节点,fixed:固定在节点右侧 - this.toolbarStyle = $.extend(this.toolbarStyle, this.options.toolbarStyle || OPTIONS.toolbarStyle) || this.toolbarStyle; //toolbar的自定义风格,标题,弹框大小 - this.toolbarLoad = this.options.toolbarLoad || OPTIONS.toolbarLoad || "node"; //toolbar作用范围:node:所有节点,noleaf:非最后一级节点,leaf:最后一级 - this.toolbarShow = this.options.toolbarShow || OPTIONS.toolbarShow || ["add","edit","delete"]; //toolbar三个按钮自定义加载 - this.toolbarBtn = this.options.toolbarBtn || OPTIONS.toolbarBtn || null; //toolbar增删改中内容的自定义加载 - this.toolbarExt = this.options.toolbarExt || OPTIONS.toolbarExt || []; //toolbar按钮扩展 - this.toolbarFun = $.extend(this.toolbarFun, this.options.toolbarFun || OPTIONS.toolbarFun) || this.toolbarFun; //toolbar事件加载 - - /** iframe模式参数**/ - this.useIframe = this.options.useIframe || OPTIONS.useIframe || false; //是否加载iframe 默认false, - this.iframeElem = this.options.iframeElem || OPTIONS.iframeElem || ""; //iframe的ID - this.iframeUrl = this.options.iframeUrl || OPTIONS.iframeUrl || ""; //树关联的iframe地址 - this.iframeLoad = this.options.iframeLoad || OPTIONS.iframeLoad || "leaf"; //点击哪一层加载frame: node:所有节点, leaf:默认,最后一级 - this.iframeDefaultRequest = $.extend(this.iframeDefaultRequest, this.options.iframeDefaultRequest || OPTIONS.iframeDefaultRequest) || this.iframeDefaultRequest; //iframe的默认传递参数 - this.iframeRequest = $.extend(this.iframeRequest, this.options.iframeRequest) || $.extend(this.iframeRequest, OPTIONS.iframeRequest) || this.iframeRequest; //iframe的自定义参数 - this.iframeFun = $.extend(this.iframeFun, this.options.iframeFun) || $.extend(this.iframeFun, OPTIONS.iframeFun) || this.iframeFun; //iframe事件加载 - - /** 下拉树模式参数**/ - this.select = this.options.select || false; - if(this.select) { - // 重置下拉树 - this.selectSetting(); - } - - /** 调用确认最终主题方法*/ - this.ensureTheme(); - }; - - // 设置基本参数值 - DTree.prototype.reloadSetting = function(options) { - this.options = $.extend(this.options, options) || this.options; - - /** 绑定元素参数**/ - this.elem = this.options.elem || this.elem; //树绑定的元素ID:#elem - if(typeof this.options.obj === 'undefined'){ - if(this.elem) { - if($(this.elem).length > 0) { - this.obj = $(this.elem); - } - } - } else { - this.obj = this.options.obj || this.obj; //树绑定的jquery元素,用于当元素是延迟加载出来的话,可以用这个找到 - this.elem = "#" + this.obj[0].id; - } - - /** 基本参数**/ - this.scroll = this.options.scroll || this.scroll; //树的上级div容器,让树可以显示滚动条的div容器 - this.accordion = (typeof (this.options.accordion) === "boolean") ? this.options.accordion : this.accordion; //开启手风琴加载 - if(this.accordion) { - this.initLevel = 1; //默认展开节点 1节 - } else { - this.initLevel = this.options.initLevel || this.initLevel; //默认展开节点 2节 - } - this.type = this.options.type || this.type; //树的加载方式 all,全量树, load,增量树,默认load - this.cache = (typeof (this.options.cache) === "boolean") ? this.options.cache : this.cache; //开启数据缓存 - this.record = (typeof (this.options.record) === "boolean") ? this.options.record : this.record; //开启数据记录模式 - this.load = (typeof (this.options.load) === "boolean") ? this.options.load : this.load; //开启加载动画 - this.none = this.options.none || this.none; //初始节点加载无数据时显示文字 - this.tempHeight = this.options.height || this.height; //临时转换高度变量 - if(this.tempHeight) { //设置高度 - if(/^full-\d+$/.test(this.tempHeight)) { - this.fullHeightGap = this.tempHeight.split('-')[1]; - this.height = $WIN.height() - this.fullHeightGap; - } else { - this.fullHeightGap = this.tempHeight; - this.height = this.tempHeight; - } - } - this.width = this.options.width || this.width; //宽度 - this.obj.css("width", this.width); - - /** 样式相关参数**/ - this.line = (typeof (this.options.line) === "boolean") ? this.options.line : this.line; //开启树线,默认不开启 - this.iconfont = this.options.iconfont || this.iconfont; //默认图标字体 dtreefont - this.iconfontStyle = this.options.iconfontStyle || this.iconfontStyle; //用于自定义树的每个关键部位使用的图标 - this.nodeIconArray = $.extend(nodeIconArray, this.options.nodeIconArray) || this.nodeIconArray; //用户自定义非叶子节点图标集合,node - this.leafIconArray = $.extend(leafIconArray, this.options.leafIconArray) || this.leafIconArray; //用户自定义叶子节点图标集合,leaf - this.skin = this.options.skin || this.skin; //自定义样式 - if(this.skin == "layui"){ //layui主题 - this.line = (typeof (this.options.line) === "boolean") ? this.options.line : true; //开启树线,默认开启 - this.ficon = this.options.ficon || this.ficon; //一级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示一级图标。默认'7' - this.fnodeIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? (this.ficon == "-1" ? "-1" : "1") : this.ficon[0]; //一级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示二级图标,默认'1' - this.fleafIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? this.ficon : this.ficon[1]; //一级图标中的leaf节点图标 - this.icon = this.options.icon || this.icon; //二级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示二级图标。默认'-1' - this.nodeIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? (this.icon == "-1" ? "-1" : "-1") : this.icon[0]; //二级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示二级图标,默认'-1' - this.leafIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? this.icon : this.icon[1]; //二级图标中的leaf节点图标 - } else if(this.skin == "laySimple"){ //laySimple主题 - this.line = (typeof (this.options.line) === "boolean") ? this.options.line : false; //开启树线,默认不开启 - this.ficon = this.options.ficon || this.ficon; //一级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示一级图标。默认'-1' - this.fnodeIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? (this.ficon == "-1" ? "-1" : "2") : this.ficon[0]; //一级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示二级图标,默认'2' - this.fleafIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? this.ficon : this.ficon[1];//一级图标中的leaf节点图标 - this.icon = this.options.icon || this.icon; //二级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示二级图标。默认'-1' - this.nodeIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? (this.icon == "-1" ? "-1" : "-1") : this.icon[0]; //二级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示二级图标,默认'-1' - this.leafIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? this.icon : this.icon[1]; //二级图标中的leaf节点图标 - } else { // 默认主题 或者自定义主题 - this.line = (typeof (this.options.line) === "boolean") ? this.options.line : false; //开启树线,默认不开启 - this.ficon = this.options.ficon || this.ficon; //一级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示一级图标。默认'8' - this.fnodeIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? (this.ficon == "-1" ? "-1" : "1") : this.ficon[0]; //一级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示二级图标,默认'1' - this.fleafIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? this.ficon : this.ficon[1]; // 一级图标中的leaf节点图标 - this.icon = this.options.icon || this.icon; //二级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示二级图标。默认'5' - this.nodeIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? (this.icon == "-1" ? "-1" : "0") : this.icon[0]; //二级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示二级图标,默认'0' - this.leafIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? this.icon : this.icon[1]; //二级图标中的leaf节点图标 - } - - /** 数据加载参数**/ - this.url = this.options.url || this.url; //请求地址 - this.async = (typeof (this.options.async) === "boolean") ? this.options.async : this.async; //异步同步加载,默认异步加载 - this.headers = this.options.headers || this.headers; //ajax header属性 - this.method = this.options.method || this.method; //请求类型 - this.dataType = this.options.dataType || this.dataType; //参数类型 - this.contentType = this.options.contentType || this.contentType; //发送信息至服务器时内容编码类型 - this.defaultRequest = $.extend(this.defaultRequest, this.options.defaultRequest) || this.defaultRequest; //默认请求参数 - this.filterRequest = this.options.filterRequest || this.filterRequest; //过滤请求参数 - this.request = this.options.request || this.request; //用户自定义请求参数 - this.response = $.extend(this.response, this.options.response) || this.response; //返回json格式 - this.data = this.options.data || this.data; //初始化指定该参数,则不会访问异步接口 - this.dataFormat = this.options.dataFormat || this.dataFormat; //用于用户配置的data数据格式,list:列表, levelRelationship:层级关系,默认 - this.dataStyle = this.options.dataStyle || this.dataStyle; //用于用户配置layui通用的json数据风格,layuiStyle:layui风格,defaultStyle:默认风格 - this.errDataShow = (typeof (this.options.errDataShow) === "boolean") ? this.options.errDataShow : this.errDataShow; //是否在使用list模式递归数据出现错误时,显示错误信息 - this.withCredentials = (typeof (this.options.withCredentials) === "boolean") ? this.options.withCredentials : this.withCredentials; //是否允许跨域请求 - this.success = this.options.success || this.success; //树加载完毕后执行解析树之前的回调 - this.done = this.options.done || this.done; //树加载完毕后的回调 - this.formatter = $.extend(this.formatter, this.options.formatter)|| this.formatter; //数据过滤 - this.error = this.options.error || this.error; //异步加载异常回调 - this.complete = this.options.complete || this.complete; //异步加载完成回调 - - /** 复选框参数**/ - this.checkbar = this.options.checkbar || this.checkbar; //是否开启复选框模式 - this.checkbarLoad = this.options.checkbarLoad || this.checkbarLoad; //复选框作用范围,node:所有节点, leaf:最后一级;默认所有节点 - this.checkbarType = this.options.checkbarType || this.checkbarType; //复选框选中形式 all:子集选中父级也选中, no-all:子集选中父级半选中,子集全选父级选中,p-casc:父级选中子集全选,子集无法改变父级选中状态, self:没有任何级联关系,only:只能选中一个复选框。 默认all - this.checkbarData = this.options.checkbarData || this.checkbarData; //复选框记录数据类型形式, change表示记录变更数据,choose表示记录选中数据,all记录全部数据,halfChoose记录选中和半选中的数据,默认choose - this.checkbarFun = $.extend(this.checkbarFun, this.options.checkbarFun)|| this.checkbarFun; //checkbar事件加载 - - /** 菜单栏参数**/ - this.menubar = this.options.menubar || this.menubar; //是否打开菜单栏 - this.menubarTips = $.extend(this.menubarTips, this.options.menubarTips) || this.menubarTips; //菜单栏吸附, toolbar:依附在工具栏,group:依附在按钮组,freedom,自由 - this.menubarFun = $.extend(this.menubarFun, this.options.menubarFun) || this.menubarFun; //menubar事件加载 - - /** 工具栏参数**/ - this.toolbar = this.options.toolbar || this.toolbar; //是否开启工具栏 - this.toolbarWay = this.options.toolbarWay || this.toolbarWay; //工具栏显示方式,contextmenu:右键,follow:跟随节点,fixed:固定在节点右侧 - this.toolbarStyle = $.extend(this.toolbarStyle, this.options.toolbarStyle) || this.toolbarStyle; //toolbar的自定义风格,标题,弹框大小 - this.toolbarLoad = this.options.toolbarLoad || this.toolbarLoad; //toolbar作用范围:node:所有节点,noleaf:非最后一级节点,leaf:最后一级 - this.toolbarShow = this.options.toolbarShow || this.toolbarShow; //toolbar三个按钮 - this.toolbarBtn = this.options.toolbarBtn || this.toolbarBtn; //toolbar增删改中内容的自定义加载 - this.toolbarExt = this.options.toolbarExt || this.toolbarExt; //toolbar按钮扩展 - this.toolbarFun = $.extend(this.toolbarFun, this.options.toolbarFun) || this.toolbarFun; //toolbar事件加载 - - /** iframe模式参数**/ - this.useIframe = this.options.useIframe || this.useIframe;//是否加载iframe 默认false - this.iframeElem = this.options.iframeElem || this.iframeElem; //iframe的ID - this.iframeUrl = this.options.iframeUrl || this.iframeUrl; //树关联的iframe地址 - this.iframeLoad = this.options.iframeLoad || this.iframeLoad; //点击哪一层加载frame: node:所有节点, leaf:默认,最后一级 - this.iframeDefaultRequest = $.extend(this.iframeDefaultRequest, this.options.iframeDefaultRequest) || this.iframeDefaultRequest; //iframe的默认传递参数 - this.iframeRequest = $.extend(this.iframeRequest, this.options.iframeRequest) || this.iframeRequest; //iframe的自定义参数 - this.iframeFun = $.extend(this.iframeFun, this.options.iframeFun) || this.iframeFun; //iframe事件加载 - - /** 下拉树模式参数**/ - if(this.select) { - // 重置下拉树 - this.reloadSelectSetting(); - } - - /** 调用确认最终主题方法*/ - this.ensureTheme(); - - }; - - // 设置下拉树的基本参数值 - DTree.prototype.selectSetting = function() { - /** select模式参数*/ - this.select = true; //配置成select模式 - - this.selectInitVal = this.obj.attr("data-value") || this.options.selectInitVal || ""; //输入框的值 - this.selectTreeDiv = this.obj[0].id + "_tree_div"; // 上级DIV节点 - this.selectCardDiv = this.obj[0].id + "_select_card_div"; // 上级layui卡片节点 - this.selectDiv = this.obj[0].id + "_select_div"; // 模拟的select节点 - this.selectTipsName = this.obj[0].id + "_select_input"; // select的提示输入框名称 - this.selectTips = this.options.selectTips || "请选择"; // 输入框的提示语 - this.selectInputName = this.options.selectInputName || {nodeId: this.obj[0].id + "_select_nodeId"}; // select表单中的元素 - - // 调取下拉树的特殊处理页面元素标识 - this.renderSelectDom(); - } - - // 重新设置下拉树的基本参数值 - DTree.prototype.reloadSelectSetting = function() { - - this.selectInitVal = this.obj.attr("data-value") || this.options.selectInitVal || this.selectInitVal; //输入框的值 - this.selectTips = this.options.selectTips || this.selectTips; // 输入框的提示语 - this.selectInputName = $.extend(this.selectInputName, this.options.selectInputName) || this.selectInputName; // select表单中的元素 - - // 调取下拉树的特殊处理页面元素标识 - this.reloadSelectDom(); - } - - /******************** 下拉树设置区域 ********************/ - // 渲染下拉树的Dom结构 - DTree.prototype.renderSelectDom = function() { - var _this = this; - var rootId = _this.obj[0].id; - - // 设置自定义表单隐藏域 - var selectInputName = _this.selectInputName; - var selectInput = []; - for(var key in selectInputName) { - selectInput.push(''); - } - - // 设置html - var prevHtml = ['
              ', - '
              ', selectInput.join(""), - '', - '', - '
              '].join(''); - - _this.obj.before(prevHtml); - - _this.obj.wrap('
              ').wrap('
              ').wrap('
              '); - - } - - // 重新渲染下拉树的Dom结构 - DTree.prototype.reloadSelectDom = function() { - var _this = this; - var rootId = _this.obj[0].id; - - // 设置自定义表单隐藏域 - var selectInputName = _this.selectInputName; - var selectInput = []; - for(var key in selectInputName) { - selectInput.push(''); - } - - $("div[dtree-id='"+rootId+"'][dtree-select='"+_this.selectDiv+"']").find("div.layui-select-title").html(""); - - // 设置html - var prevHtml = [selectInput.join(""), - '', - ''].join(''); - - $("div[dtree-id='"+rootId+"'][dtree-select='"+_this.selectDiv+"']").find("div.layui-select-title").html(prevHtml); - - } - - // 设置输入框的值 - DTree.prototype.selectVal = function(param) { - var _this = this; - var rootId = _this.obj[0].id; - var selectInputName = _this.selectInputName; - var selectTipsNameValue = ""; - var selectValues = {}; - - // 如果开启了复选框,则此方法用来取值 - if(_this.checkbar) { - $("div[dtree-select='" + _this.selectDiv + "']").find("input[dtree-id='" + rootId + "']").each(function(){ - var name = $(this).attr("name"); - var val = $(this).val(); - selectValues[name] = val; - }); - } else { - if(typeof param === 'undefined') { // 不传,则为当前树中记录的ID - param = _this.getNowParam(); - } - if(typeof param === 'string') { // 传递ID,则查询树节点ID对应的值 - param = _this.getParam(param); - } - - selectTipsNameValue = param["context"]; - for(var key in selectInputName) { - selectValues[selectInputName[key]] = param[key]; - $("div[dtree-select='" + _this.selectDiv + "']").find("input[dtree-id='" + rootId + "'][name='"+selectInputName[key]+"']").val(param[key] || ""); - } - - if(param["nodeId"] && !param["context"]) { - selectTipsNameValue = _this.getParam(param["nodeId"]); - } - - // 返显提示输入框值 - $("div[dtree-select='" + _this.selectDiv + "']").find("input[dtree-id='" + rootId + "'][name='"+_this.selectTipsName+"']").val(selectTipsNameValue || ""); - - } - - - // 返回隐藏域中的值 - return selectValues; - } - - // 设置复选框模式中的下拉树的值 - DTree.prototype.selectCheckboxVal = function() { - var _this = this; - var rootId = _this.obj[0].id; - var selectInputName = _this.selectInputName; - - // 获取全部复选框选中节点 - var param = _this.getCheckbarJsonArrParam(); - - selectTipsNameValue = param["context"]; - var selectValues = {}; - for(var key in selectInputName) { - var value = param[key].join(","); - selectValues[selectInputName[key]] = value; - $("div[dtree-select='" + _this.selectDiv + "']").find("input[dtree-id='" + rootId + "'][name='"+selectInputName[key]+"']").val(value); - } - - $("div[dtree-select='" + _this.selectDiv + "']").find("input[dtree-id='" + rootId + "'][name='"+_this.selectTipsName+"']").val(selectTipsNameValue); - - // 返回隐藏域中的值 - return selectValues; - } - - // 重置下拉树的值 - DTree.prototype.selectResetVal = function() { - var _this = this; - var rootId = _this.obj[0].id; - // 表单清空 - $("input[dtree-id='"+rootId+"']").val(""); - // 节点重置 - _this.cancelNavThis(); - if(_this.checkbar) { - // 复选框重置 - _this.cancelCheckedNode(); - } - } - - - /******************** 字体及图标区域 ********************/ - // 确认最终主题 - DTree.prototype.ensureTheme = function(){ - var _this = this; - - // 确认style - this.style.item = DTREE + this.skin + ITEM; - this.style.itemThis = DTREE + this.skin + ITEMTHIS; - this.style.dfont = DTREE + this.skin + DFONT; - this.style.ficon = DTREE + this.skin + FICON; - this.style.icon = DTREE + this.skin + ICON; - this.style.cbox = DTREE + this.skin + CBOX; - this.style.chs = DTREE + this.skin + CHS; - - // 确认usefontStyle - var iconfont = this.iconfont; - var iconfonts = []; - if(typeof iconfont === 'string') { - iconfonts.push(iconfont); - } else { - iconfonts = iconfont; - } - - var iconfontStyle = this.iconfontStyle; - var iconfontStyles = []; - if(iconfontStyle.length == undefined) { - iconfontStyles.push(iconfontStyle); - } else { - iconfontStyles = iconfontStyle; - } - - for(var i=0; i 0) { - $lis.each(function(){ - _this.showLineLi($(this)); - }); - } else { - _this.obj.find("li[data-id]").each(function(){ - _this.showLineLi($(this)); - }); - } - } - } - - // 真正显示树线的方法 - DTree.prototype.showLineLi = function($li){ - var _this = this; - var $div = $li.children("div"), - $nextLi = $li.next("li"), - $ul = $li.parent("ul"); - if($ul[0].id == _this.obj[0].id) { - // 根节点下的节点 - $li.removeClass(LI_NAV_LINE); - $li.removeClass(LI_NAV_LAST_LINE); - $li.addClass(LI_NAV_FIRST_LINE); - } else { - // 非根节点下的节点 - var $pnextLi = $ul.parent("li").next("li"); - if($pnextLi.length == 0) { - if($nextLi.length == 0){ - $li.removeClass(LI_NAV_LINE); - $li.removeClass(LI_NAV_FIRST_LINE); - $li.addClass(LI_NAV_LAST_LINE); - } else { - $li.removeClass(LI_NAV_FIRST_LINE); - $li.removeClass(LI_NAV_LAST_LINE); - $li.addClass(LI_NAV_LINE); - } - }else { - var $pnextdiv = $pnextLi.children("div"); - if($nextLi.length == 0 && $div.children("cite").attr("data-leaf") == "leaf" && $pnextdiv.children("cite").attr("data-leaf") == "leaf") { - $li.removeClass(LI_NAV_FIRST_LINE); - $li.removeClass(LI_NAV_LINE); - $li.addClass(LI_NAV_LAST_LINE); - } else { - $li.removeClass(LI_NAV_FIRST_LINE); - $li.removeClass(LI_NAV_LAST_LINE); - $li.addClass(LI_NAV_LINE); - } - } - } - } - - /******************** 初始化数据区域 ********************/ - // 设置高度 - DTree.prototype.autoHeight = function(){ - var _this = this; - var height = _this.height; - if(height != "") { - if(_this.elem == _this.scroll){ - _this.obj.parent().css("height", height + "px"); - } else { - var $toolbarDiv = _this.obj.closest(_this.scroll); - $toolbarDiv.css("height", height + "px"); - } - } - }; - - // 重载树 - DTree.prototype.reload = function(options){ - var _this = this; - _this.reloadSetting(options); - _this.init(); - }; - - // 初始化树 - DTree.prototype.init = function(){ - var _this = this; - if (typeof _this !== "object") { - //_this.obj.html(_this.getNoneDom().errText("树组件未成功加载,请检查配置")); - layer.msg("树组件未成功加载,请检查配置", {icon:5}); - return ; - } - - // 设置组件高度 - _this.autoHeight(); - - if(_this.data) { - if(typeof _this.data.length === 'undefined'){ - //_this.obj.html(_this.getNoneDom().errText("数据解析异常,data数据格式不正确")); - layer.msg("数据解析异常,data数据格式不正确", {icon:5}); - return ; - } - - if(_this.data.length == 0) { - _this.obj.html(_this.getNoneDom().text()); - return ; - } - - //先将ul中的元素清空 - _this.obj.html(""); - - setTimeout(function () { - // 加载完毕后执行树解析前的回调 - _this.success(_this.data, _this.obj); - - // 第一次解析树 - if (_this.dataFormat == 'list'){ - //1.识别根节点ul中的data-id标签,判断顶级父节点 - var pid = _this.obj.attr("data-id"); - //2.构建一个存放节点的树组 - var rootListData = _this.queryListTreeByPid(pid, _this.data); - _this.loadListTree(rootListData, _this.data, 1); - } else { - _this.loadTree(_this.data, 1); - } - - // 显示树线 - _this.showLine(); - - // 这种情况下需要一开始就将toolbar显示在页面上 - if(_this.toolbar && _this.toolbarWay != 'contextmenu') { - _this.setToolbarDom().setToolbarPlace(_this.toolbarMenu); - } - - // 判断是否存在错误数据,并是否打印错误数据 - _this.msgErrData(); - - // 设置复选框的初始值 - if(_this.select){ - _this.selectVal(_this.selectInitVal); - } - - // 保存树副本 - _this.bak = _this.obj.html(); - - // 加载完毕后的回调 - _this.done(_this.data, _this.obj); - }, 100); - } else { - if (!_this.url) { - //_this.obj.html(_this.getNoneDom().errText("数据请求异常,url参数未指定")); - layer.msg("数据请求异常,url参数未指定", {icon:5}); - return ; - } - - //先将ul中的元素清空 - _this.obj.html(""); - - var index = _this.load ? layer.load(1) : ""; - - AjaxHelper.request({ - async: _this.async, - headers: _this.headers, - type: _this.method, - url: _this.url, - dataType: _this.dataType, - contentType: _this.contentType, - withCredentials: _this.withCredentials, - data: _this.getFilterRequestParam(_this.getRequestParam()), - success: function(result) { - if (typeof result === 'string') { - result = $.parseJSON(result); - } - - // 加载完毕后执行树解析前的回调 - _this.success(result, _this.obj); - - var code = ""; - if (_this.dataStyle == 'layuiStyle'){ - code = result[_this.response.statusName]; - } else { - code = result.status[_this.response.statusName]; - } - - if (code == _this.response.statusCode) { - var d = result[_this.response.rootName]; - - if(typeof d.length === 'undefined'){ - _this.obj.html(_this.getNoneDom().errText("数据解析异常,url回调后的数据格式不正确")); - //layer.msg("数据解析异常,url回调后的数据格式不正确", {icon:5}); - return ; - } - - if(d.length == 0) { - _this.obj.html(_this.getNoneDom().text()); - return ; - } - - // 第一次解析树 - if (_this.dataFormat == 'list'){ - //1.识别根节点ul中的data-id标签,判断顶级父节点 - var pid = _this.obj.attr("data-id"); - //2.构建一个存放节点的树组 - var rootListData = _this.queryListTreeByPid(pid, d); - _this.loadListTree(rootListData, d, 1); - } else { - _this.loadTree(d, 1); - } - - // 显示树线 - _this.showLine(); - - // 这种情况下需要一开始就将toolbar显示在页面上 - if(_this.toolbar && _this.toolbarWay != 'contextmenu') { - _this.setToolbarDom().setToolbarPlace(_this.toolbarMenu); - } - - // 判断是否存在错误数据,并是否打印错误数据 - _this.msgErrData(); - - // 设置复选框的初始值 - if(_this.select){ - _this.selectVal(_this.selectInitVal); - } - - // 保存树副本 - _this.bak = _this.obj.html(); - - // 加载完毕后的回调 - _this.done(result, _this.obj); - } else { - // 如果打印不出任何信息说明是在这里,用了错误的数据格式, 或返回码不正确 - if (_this.dataStyle == 'layuiStyle'){ - _this.obj.html(_this.getNoneDom().errText(result[_this.response.message])); - _this.error(null, code, result[_this.response.message]); - //layer.msg(result[_this.response.message], {icon:2}); - } else { - _this.obj.html(_this.getNoneDom().errText(result.status[_this.response.message])); - _this.error(null, code, result.status[_this.response.message]); - //layer.msg(result.status[_this.response.message], {icon:2}); - } - } - }, - error: function(XMLHttpRequest, textStatus, errorThrown){// 异步加载异常回调 - _this.obj.html(_this.getNoneDom().errText(textStatus + ": " + errorThrown)); - _this.error(XMLHttpRequest, textStatus, errorThrown); - }, - complete: function(XMLHttpRequest, textStatus){// 异步加载完成回调 - if(_this.load){layer.close(index);} - _this.complete(XMLHttpRequest, textStatus); - } - }); - } - }; - - // 加载子节点 - DTree.prototype.getChild = function($div, data) { - var _this = this, $ul = $div.next("ul"); - - _this.setNodeParam($div); - - if(typeof data !== 'undefined') { - if(typeof data.length === 'undefined'){ - //_this.obj.html(_this.getNoneDom().errText("数据解析异常,data数据格式不正确")); - layer.msg("数据解析异常,data数据格式不正确", {icon:5}); - return ; - } - - //先将ul中的元素清空 - $ul.html(""); - - // 解析树 - if (_this.dataFormat == 'list'){ - var pid = _this.node.nodeId; - var level = parseInt(_this.node.level)+1; - - var listData = _this.queryListTreeByPid(pid, data); - _this.loadListTree(listData, _this.data, level); - } else { - _this.loadTree(data, level); - } - - // 显示树线 - _this.showLine(); - - // 这种情况下需要一开始就将toolbar显示在页面上 - if(_this.toolbar && _this.toolbarWay != 'contextmenu') { - _this.setToolbarDom().setToolbarPlace(_this.toolbarMenu); - } - - // 判断是否存在错误数据,并是否打印错误数据 - _this.msgErrData(); - - // 保存树副本 - _this.bak = _this.obj.html(); - - } else { - if (!_this.url) { - //_this.obj.html(_this.getNoneDom().errText("数据请求异常,url参数未指定")); - layer.msg("数据请求异常,url参数未指定", {icon:5}); - return ; - } - - $ul.html(""); - var index = _this.load ? layer.load(1) : ""; - AjaxHelper.request({ - async: _this.async, - headers: _this.headers, - type: _this.method, - url: _this.url, - dataType: _this.dataType, - withCredentials: _this.withCredentials, - data: _this.getFilterRequestParam(_this.getRequestParam()), - success: function(result) { - if (typeof result === 'string') { - result = $.parseJSON(result); - } - var code = ""; - if (_this.dataStyle == 'layuiStyle'){ - code = result[_this.response.statusName]; - } else { - code = result.status[_this.response.statusName]; - } - - if (code == _this.response.statusCode) { - // 解析树 - var pid = _this.node.nodeId; - var level = parseInt(_this.node.level)+1; - if (_this.dataFormat == 'list'){ - var pListData = _this.queryListTreeByPid(pid, result[_this.response.rootName]); - _this.loadListTree(pListData, result[_this.response.rootName], level, $ul); - } else { - _this.loadTree(result[_this.response.rootName], level, $ul); - } - - // 显示树线 - _this.showLine(); - - // 这种情况下需要一开始就将toolbar显示在页面上 - if(_this.toolbar && _this.toolbarWay != 'contextmenu') { - _this.setToolbarDom().setToolbarPlace(_this.toolbarMenu); - } - - // 判断是否存在错误数据,并是否打印错误数据 - _this.msgErrData(); - - $ul.addClass(NAV_SHOW); - - // 保存树副本 - _this.bak = _this.obj.html(); - } else { - if (_this.dataStyle == 'layuiStyle'){ - _this.obj.html(_this.getNoneDom().errText(result[_this.response.message])); - _this.error(null, code, result[_this.response.message]); - //layer.msg(result[_this.response.message], {icon:2}); - } else { - _this.obj.html(_this.getNoneDom().errText(result.status[_this.response.message])); - _this.error(null, code, result.status[_this.response.message]); - //layer.msg(result.status[_this.response.message], {icon:2}); - } - } - }, - error: function(XMLHttpRequest, textStatus, errorThrown){// 异步加载异常回调 - _this.obj.html(_this.getNoneDom().errText(textStatus + ": " + errorThrown)); - _this.error(XMLHttpRequest, textStatus, errorThrown); - }, - complete: function(XMLHttpRequest, textStatus){// 异步加载完成回调 - if(_this.load){layer.close(index);} - _this.complete(XMLHttpRequest, textStatus); - } - }); - } - }; - - // 初始化树或者拼接树 - DTree.prototype.loadListTree = function(pListData, listData, level, $ul){ - var _this = this; - $ul = $ul || _this.getNodeDom().nowOrRootUl(); //当前选中的节点或根节点 - if (pListData.length > 0){ - for (var i = 0; i < pListData.length; i++) { - // 1.获取已知节点的全部数据 - var data = pListData[i]; - if(typeof data !== "object") continue; - var parseData = _this.parseData(data); - var childListData = _this.queryListTreeByPid(parseData.treeId(), listData); // 根据已知数据的id判断该条数据是否还有子数据 - - // 3. 页面元素加载数据 - $ul.append(_this.getLiItemDom(parseData.treeId(), parseData.parentId(), parseData.title(), parseData.fmtTitle(), parseData.last(childListData.length), parseData.ficonClass(), parseData.iconClass(), parseData.checkArr(), level, parseData.spread(level), parseData.disabled(), parseData.hide(), parseData.basicData(), parseData.recordData(), ($ul.hasClass(UL_ROOT) ? "root" : "item"))); - // 4.有子数据的元素加载子节点 - if(childListData.length > 0){ - var cLevel = parseInt(level)+1; - _this.loadListTree(childListData, listData, cLevel, _this.obj.find("ul[data-id='"+parseData.treeId()+"']")); - } - } - } - }; - - // 根据父ID查找list数据中匹配的元素 - DTree.prototype.queryListTreeByPid = function(pid, listData){ - var _this = this; - var rootListData = []; - if (listData) { - for (var i = 0; i < listData.length; i++) { - var data = listData[i]; - if(typeof data !== "object") continue; - if(pid == "null" || pid == null){ - if(data[_this.response.parentId] == null) { rootListData.push(data); } - } else { - if (data[_this.response.parentId] == pid){ - if (data[_this.response.treeId] == pid){ - _this.errData.push(data); - } else { - rootListData.push(data); - } - } - } - } - } - return rootListData; - }; - - // 初始化树或者拼接树 - DTree.prototype.loadTree = function(root, level, $ul){ - var _this = this; - if (root) { - $ul = $ul || _this.getNodeDom().nowOrRootUl(); //当前选中的节点或根节点 - for (var i = 0; i < root.length; i++) { // 遍历跟节点或追加的跟节点 - var data = root[i]; - if(typeof data !== "object") continue; - if(data[_this.response.treeId] == data[_this.response.parentId]) { _this.errData.push(data); } - var parseData = _this.parseData(data); - var children = parseData.children(); - $ul.append(_this.getLiItemDom(parseData.treeId(), parseData.parentId(), parseData.title(), parseData.fmtTitle(), parseData.last(children.length), parseData.ficonClass(), parseData.iconClass(), parseData.checkArr(), level, parseData.spread(level), parseData.disabled(), parseData.hide(), parseData.basicData(), parseData.recordData(), ($ul.hasClass(UL_ROOT) ? "root" : "item"))); - if (children.length != 0) { - var cLevel = parseInt(level)+1; - _this.loadTree(children, cLevel, _this.obj.find("ul[data-id='"+parseData.treeId()+"']")); - } - } - } - }; - - // 判断在数据加载时是否存在错误数据,并是否打印错误数据 - DTree.prototype.msgErrData = function() { - var _this = this; - if(_this.errData.length > 0 && _this.errDataShow) { - var title = ""; - for(var i=0; i<_this.errData.length; i++) { - var edata = _this.errData[i]; - title += "数据:【"+edata[_this.response.title]+"】中节点id和上级id值一致! \n"; - } - layer.msg(title, {icon:2,time:5000}); - } - // 显示之后,将错误数据制空 - _this.errData = []; - }; - - // 解析data数据 - DTree.prototype.parseData = function(data) { - var _this = this; - - return { - treeId: function(){ - return data[_this.response.treeId]; - }, - parentId: function(){ - return data[_this.response.parentId]; - }, - fmtTitle: function(){ - if(typeof _this.formatter.title === 'function'){ - var ftitle = _this.formatter.title(data); - var tt = data[_this.response.title]; - tt = (ftitle == "" || ftitle == undefined || ftitle == null) ? tt : ftitle; - return tt || ""; - } - return data[_this.response.title]; - }, - title: function(){ - return data[_this.response.title]; - }, - level: function(){ - return data[_this.response.level] || ""; - }, - ficonClass: function(){ - return data[_this.response.ficonClass] || ""; - }, - iconClass: function(){ - return data[_this.response.iconClass] || ""; - }, - last: function(len){ - return ((len == 0) ? - ((typeof (data[_this.response.last]) === "boolean") ? data[_this.response.last] : true) : - ((typeof (data[_this.response.last]) === "boolean") ? data[_this.response.last] : false)); - }, - spread: function(level){ - return ((level < _this.initLevel) ? - ((typeof (data[_this.response.spread]) === "boolean") ? data[_this.response.spread] : true) : - ((typeof (data[_this.response.spread]) === "boolean") ? data[_this.response.spread] : false)); - }, - disabled: function(){ - return (typeof (data[_this.response.disabled]) === "boolean") ? data[_this.response.disabled] : false; - }, - hide: function(){ - return (typeof (data[_this.response.hide]) === "boolean") ? data[_this.response.hide] : false; - }, - checkArr: function(){ - var checkArr = []; - var checkArrData = data[_this.response.checkArr]; - if(typeof checkArrData === 'string'){ - if(checkArrData.indexOf("{") > -1 && checkArrData.indexOf("}") > -1){ - checkArrData = JSON.parse(checkArrData); - } else { - checkArrData = {"type":"0","checked":checkArrData}; - } - } - if(typeof checkArrData === 'object'){ - if(typeof checkArrData.length === 'undefined'){ - checkArr.push(checkArrData); - } else { - checkArr = checkArrData; - } - } - - if(checkArr.length > 0 && checkArr.length > _this.checkArrLen){ - _this.checkArrLen = checkArr.length; // 获取复选框个数 - } - return checkArr; - - }, - children: function(){ - return data[_this.response.childName] || []; - }, - basicData: function(){ - return event.escape(JSON.stringify(data[_this.response.basicData])) || JSON.stringify({}); - }, - recordData: function(){ - var recordData = _this.record ? event.cloneObj(data, [_this.response.treeId, - _this.response.parentId, - _this.response.title, - _this.response.iconClass, - _this.response.childName, - _this.response.last, - _this.response.spread, - _this.response.disabled, - _this.response.hide, - _this.response.checkArr, - _this.response.checked, - _this.response.type, - _this.response.basicData]) : {}; - - return event.escape(JSON.stringify(recordData)); - }, - data: function(){ - return data; - } - } - - }; - - //当无节点数据时显示dom - DTree.prototype.getNoneDom = function(){ - var _this = this, - rootId = _this.obj[0].id, - noneTitle = _this.none; - - return { - text: function(){ - return "
              "+noneTitle+"
              "; - }, - errText: function(errInfo){ - return "
              "+errInfo+"
              "; - } - } - }; - - //新增节点的dom值 - DTree.prototype.getDom = function(treeId, parentId, title, fmtTitle, last, ficonClass, iconClass, checkArr, level, spread, disabled, hide) { - var _this = this, - rootId = _this.obj[0].id, - toolbar = _this.toolbar, - checkbar = _this.checkbar; - - return { - fnode: function() { // + - 图标 - // 获取图标的变量 - var fnodeIcon = _this.fnodeIcon, - fleafIcon = _this.fleafIcon; - - var fleafIconLeaf = _this.usefontStyle.fnode.leaf, - fnodeIconOpen = _this.usefontStyle.fnode.node.open, - fnodeIconClose = _this.usefontStyle.fnode.node.close; - - if(ficonClass){ - var iconfont = _this.iconfont; - if(typeof iconfont === 'string') { - fleafIconLeaf = iconfont + " " + ficonClass; - fnodeIconOpen = iconfont + " " + ficonClass; - fnodeIconClose = iconfont + " " + ficonClass; - } else { - fleafIconLeaf = iconfont[0] + " " + ficonClass; - fnodeIconOpen = iconfont[0] + " " + ficonClass; - fnodeIconClose = iconfont[0] + " " + ficonClass; - } - } - - if(fnodeIcon != "-1" && fleafIcon != "-1"){ // 都加载 - return last ? "" : - (spread ? "" : ""); - } - - if(fnodeIcon != "-1" && fleafIcon == "-1"){ // 加载node 隐藏leaf - return last ? "" : - (spread ? "" : ""); - } - - if(fnodeIcon == "-1" && fleafIcon != "-1"){ // 隐藏node 加载leaf - return last ? "" : - (spread ? "" : ""); - } - - if(fnodeIcon == "-1" && fleafIcon == "-1"){ // 都隐藏 - return last ? "" : - (spread ? "" : ""); - } - }, - node: function() { // 二级图标样式 - // 获取图标的变量 - var nodeIcon = _this.nodeIcon, - leafIcon = _this.leafIcon; - - var sleafIconLeaf = _this.usefontStyle.snode.leaf, - snodeIconOpen = _this.usefontStyle.snode.node.open, - snodeIconClose = _this.usefontStyle.snode.node.close; - if(iconClass){ - var iconfont = _this.iconfont; - if(typeof iconfont === 'string') { - sleafIconLeaf = iconfont + " " + iconClass; - snodeIconOpen = iconfont + " " + iconClass; - snodeIconClose = iconfont + " " + iconClass; - } else { - sleafIconLeaf = iconfont[0] + " " + iconClass; - snodeIconOpen = iconfont[0] + " " + iconClass; - snodeIconClose = iconfont[0] + " " + iconClass; - } - } - - if(nodeIcon != "-1" && leafIcon != "-1"){ // 都加载 - return last ? "" : - (spread ? "" : ""); - } - - if(nodeIcon != "-1" && leafIcon == "-1"){ // 加载node 隐藏leaf - return last ? "" : - (spread ? "" : ""); - } - - if(nodeIcon == "-1" && leafIcon != "-1"){ // 隐藏node 加载leaf - return last ? "" : - (spread ? "" : ""); - } - - if(nodeIcon == "-1" && leafIcon == "-1"){ // 都隐藏 - return last ? "" : - (spread ? "" : ""); - } - }, - checkbox: function() { // 复选框 - var flag = false; - if(_this.checkbarLoad == "node"){if (checkbar) {flag = true;}} else {if (last) {if (checkbar) {flag = true;}}} - - if(flag){ - var result = "
              "; - if(checkArr && checkArr.length > 0){ - - for (var i = 0; i < checkArr.length; i++) { - var checkData = checkArr[i]; - var checked = checkData.checked; - var CHOOSE_CLASS = _this.usefontStyle.checkbox.out; - if (checked == "2") { //半选择 - CHOOSE_CLASS = _this.usefontStyle.checkbox.noall + " " + _this.style.chs; - } else if (checked == "1") { //选择 - CHOOSE_CLASS = _this.usefontStyle.checkbox.on + " " + _this.style.chs; - } else { //未选择或者无值 - CHOOSE_CLASS = _this.usefontStyle.checkbox.out; - } - var disClass = ""; - if(disabled){disClass = NAV_DIS;} - result += ""; - } - } - result += "
              "; - return result; - } - - return ""; - }, - text: function() { // 文字显示 - var disClass = ""; - if(disabled){disClass = NAV_DIS;} - return ""+fmtTitle+""; - }, - ul: function() { //子节点ul - return last ? "
                " : - (spread ? "
                  " : "
                    "); - } - }; - }; - - //替换节点的dom值,或指定值 - DTree.prototype.replaceDom = function($div, treeId, last, spread, disabled, hide) { - var _this = this, - rootId = _this.obj[0].id, - toolbar = _this.toolbar, - checkbar = _this.checkbar; - - return { - fnode: function(ficonClass) { // + - 图标 - var fnode = ""; - - // 获取图标的变量 - var fnodeIcon = _this.fnodeIcon, - fleafIcon = _this.fleafIcon; - - var fleafIconLeaf = _this.usefontStyle.fnode.leaf, - fnodeIconOpen = _this.usefontStyle.fnode.node.open, - fnodeIconClose = _this.usefontStyle.fnode.node.close; - - if(ficonClass){ - var iconfont = _this.iconfont; - if(typeof iconfont === 'string') { - fleafIconLeaf = iconfont + " " + ficonClass; - fnodeIconOpen = iconfont + " " + ficonClass; - fnodeIconClose = iconfont + " " + ficonClass; - } else { - fleafIconLeaf = iconfont[0] + " " + ficonClass; - fnodeIconOpen = iconfont[0] + " " + ficonClass; - fnodeIconClose = iconfont[0] + " " + ficonClass; - } - } - - if(fnodeIcon != "-1" && leafIcon != "-1"){ // 都加载 - fnode = last ? "" : - (spread ? "" : ""); - }else if(nodeIcon != "-1" && leafIcon == "-1"){ // 加载node 隐藏leaf - fnode = last ? "" : - (spread ? "" : ""); - }else if(nodeIcon == "-1" && leafIcon != "-1"){ // 隐藏node 加载leaf - fnode = last ? "" : - (spread ? "" : ""); - }else if(nodeIcon == "-1" && leafIcon == "-1"){ // 都隐藏 - fnode = last ? "" : - (spread ? "" : ""); - } - if(fnode != ""){_this.getNodeDom($div).fnode().replaceWith($(fnode));} - }, - node: function(iconClass) { // 二级图标样式 - var snode = ""; - - // 获取图标的变量 - var nodeIcon = _this.nodeIcon, - leafIcon = _this.leafIcon; - - var sleafIconLeaf = _this.usefontStyle.snode.leaf, - snodeIconOpen = _this.usefontStyle.snode.node.open, - snodeIconClose = _this.usefontStyle.snode.node.close; - if(iconClass){ - var iconfont = _this.iconfont; - if(typeof iconfont === 'string') { - sleafIconLeaf = iconfont + " " + iconClass; - snodeIconOpen = iconfont + " " + iconClass; - snodeIconClose = iconfont + " " + iconClass; - } else { - sleafIconLeaf = iconfont[0] + " " + iconClass; - snodeIconOpen = iconfont[0] + " " + iconClass; - snodeIconClose = iconfont[0] + " " + iconClass; - } - } - - if(nodeIcon != "-1" && leafIcon != "-1"){ // 都加载 - snode = last ? "" : - (spread ? "" : ""); - }else if(nodeIcon != "-1" && leafIcon == "-1"){ // 加载node 隐藏leaf - snode = last ? "" : - (spread ? "" : ""); - }else if(nodeIcon == "-1" && leafIcon != "-1"){ // 隐藏node 加载leaf - snode = last ? "" : - (spread ? "" : ""); - }else if(nodeIcon == "-1" && leafIcon == "-1"){ // 都隐藏 - snode = last ? "" : - (spread ? "" : ""); - } - if(snode != ""){_this.getNodeDom($div).snode().replaceWith($(snode));} - }, - checkbox: function(checkArr) { // 复选框 - var flag = false; - if(_this.checkbarLoad == "node"){if (checkbar) {flag = true;}} else {if (last) {if (checkbar) {flag = true;}}} - - if(flag){ - var result = "
                    "; - if(checkArr && checkArr.length > 0){ - - for (var i = 0; i < checkArr.length; i++) { - var checkData = checkArr[i]; - var checked = checkData.checked; - var CHOOSE_CLASS = _this.usefontStyle.checkbox.out; - if (checked == "2") { //半选择 - CHOOSE_CLASS = _this.usefontStyle.checkbox.noall + " " + _this.style.chs; - } else if (checked == "1") { //选择 - CHOOSE_CLASS = _this.usefontStyle.checkbox.on + " " + _this.style.chs; - } else { //未选择或者无值 - CHOOSE_CLASS = _this.usefontStyle.checkbox.out; - } - var disClass = ""; - if(disabled){disClass = NAV_DIS;} - result += ""; - } - } - result += "
                    "; - _this.getNodeDom($div).snode().next("div").replaceWith($(result)); - } - }, - text: function(title) { // 文字显示 - var disClass = ""; - if(disabled){disClass = NAV_DIS;} - var cite = ""+title+"" - _this.getNodeDom($div).cite().replaceWith($(cite)); - }, - ul: function() { //子节点ul - var ul = last ? "
                      " : - (spread ? "
                        " : "
                          "); - _this.getNodeDom($div).nextUl().replaceWith($(ul)); - }, - div: function(){ - $div.attr("data-id", treeId); - }, - basicData: function(basicData){ - basicData = (basicData == "{}") ? "" : basicData; - $div.attr("data-basic", basicData); - }, - recordData: function(recordData){ - recordData = (recordData == "{}") ? "" : recordData; - $div.attr("data-record", recordData); - }, - p_li: function(pId){ - var $li = $div.parent("li"); - $li.attr("data-id", treeId); - if(pId) { - $li.attr("data-pid", pId); - } - return $li; - } - }; - - }; - - // 获取拼接好的li - DTree.prototype.getLiItemDom = function(treeId, parentId, title, fmtTitle, last, ficonClass, iconClass, checkArr, level, spread, disabled, hide, basicData, recordData, flag) { - var _this = this, - rootId = _this.obj[0].id; - - var dom = _this.getDom(treeId, parentId, title, fmtTitle, last, ficonClass, iconClass, checkArr, level, spread, disabled, hide); - basicData = (basicData == "{}") ? "" : basicData; - recordData = (recordData == "{}") ? "" : recordData; - var div = "
                          " + - div , - dom.fnode(), - dom.node(), - dom.checkbox(), - dom.text(), - "
                          ", dom.ul(), ""].join(""); - - return li; - }; - - // 初始化节点,用于数据回显 - DTree.prototype.dataInit = function(chooseId){ - var _this = this; - var $div = _this.obj.find("div[data-id='"+chooseId+"']"); - _this.getNodeDom($div).parentLi().find("."+NAV_THIS).removeClass(NAV_THIS); - _this.getNodeDom($div).parentLi().find("."+_this.style.itemThis).removeClass(_this.style.itemThis); - $div.addClass(NAV_THIS); - $div.addClass(_this.style.itemThis); - _this.setNodeParam($div); - // 将该节点的父节点全部展开 - var $li_parents = $div.parents("."+LI_NAV_ITEM); - $li_parents.children("ul").addClass(NAV_SHOW); - $li_parents.children("."+LI_DIV_ITEM).children("i[data-spread]."+event.trimToDot(_this.usefontStyle.fnode.node.close)).addClass(_this.usefontStyle.fnode.node.open); - $li_parents.children("."+LI_DIV_ITEM).children("i[data-spread]."+event.trimToDot(_this.usefontStyle.fnode.node.close)).removeClass(_this.usefontStyle.fnode.node.close); - $li_parents.children("."+LI_DIV_ITEM).children("i[data-spread]."+event.trimToDot(_this.usefontStyle.snode.node.close)).addClass(_this.usefontStyle.snode.node.open); - $li_parents.children("."+LI_DIV_ITEM).children("i[data-spread]."+event.trimToDot(_this.usefontStyle.snode.node.close)).removeClass(_this.usefontStyle.snode.node.close); - return _this.getNowParam(); - }; - - // 基于备份的Html数据回滚 - DTree.prototype.rollbackHtml = function(chooseId){ - var _this = this; - if(_this.bak) { - _this.obj.html(_this.bak); - // 取消全部选中状态 - _this.cancelNavThis(); - if(_this.checkbar) { - _this.cancelCheckedNode(); - _this.chooseDataInit(chooseId); - } else { - _this.dataInit(chooseId); - } - - _this.bak = _this.obj.html(); - } - }; - - - /******************** 基础事件区域 ********************/ - // 数据格式化 - DTree.prototype.escape = function(html){ - return event.escape(html); - }; - - // 格式化数据转回正常数据 - DTree.prototype.unescape = function(str){ - return event.unescape(str); - }; - - // 取消选中div - DTree.prototype.cancelNavThis = function(){ - var _this = this; - _this.obj.find("div[data-id]").parent().find("."+NAV_THIS).removeClass(NAV_THIS); - _this.obj.find("div[data-id]").parent().find("."+_this.style.itemThis).removeClass(_this.style.itemThis); - } - - // 选中div - DTree.prototype.navThis = function(id){ - var _this = this; - var $div = (typeof id === 'object') ? id : (_this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']").length == 0) ? null : _this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']"); - if($div != null) { - _this.cancelNavThis(); - $div.addClass(NAV_THIS); - $div.addClass(_this.style.itemThis); - } - } - - // 手风琴模式操作其他节点 - DTree.prototype.accordionUL = function($ul) { - var _this = this; - if(_this.accordion) { - $ul.closest("li[data-index]").siblings("li[data-index]").children("ul[data-id]").removeClass(NAV_SHOW); - var $divs = $ul.closest("li[data-index]").siblings("li[data-index]").children("ul[data-id]").prev("div"); - if($divs.length && $divs.length > 0) { - for (var i=0; i<$divs.length; i++) { - var $div = $($divs[i]); - var $i_spread = _this.getNodeDom($div).fnode(), - $i_node = _this.getNodeDom($div).snode(); - if($i_spread.attr("data-spread") != 'last'){ - _this.operateIcon($i_spread, $i_node).close(); - } - } - } - - } - }; - - // 展开或隐藏节点 作用点: div - DTree.prototype.clickSpread = function($div) { - var _this = this; - var $i_spread = _this.getNodeDom($div).fnode(), - $i_node = _this.getNodeDom($div).snode(), - $cite = _this.getNodeDom($div).cite(), - spread = $i_spread.attr("data-spread"), - $ul = $div.next("ul"); - - if ($ul.length > 0) { - if (spread == "close") { - if (_this.type=="load") { //增加加载 - if (_this.cache) { //开启缓存 - if ($ul.html()) { - $ul.addClass(NAV_SHOW); - _this.accordionUL($ul); - } else { //加载节点 - _this.getChild($div); - _this.accordionUL($ul); - } - }else { //每次取新的数据 - $ul.html(""); - _this.getChild($div); - _this.accordionUL($ul); - } - } else { // 全量加载 - $ul.addClass(NAV_SHOW); - _this.accordionUL($ul); - } - _this.operateIcon($i_spread, $i_node).open(); - } else if (spread == "open") { - $ul.removeClass(NAV_SHOW); - _this.operateIcon($i_spread, $i_node).close(); - } - } - }; - - // 设置节点为disabled - DTree.prototype.setDisabledNodes = function(disabledIds){ - var _this = this; - var disabledId = disabledIds.split(","); - for (var i=0; i 0) { - _this.getChild($div, data); - } else { - var parseData = _this.parseData(data); - - if(parseData.treeId()){ - var level = parseInt($div.parent("li").attr("data-index"))+1; - $ul.append(_this.getLiItemDom(parseData.treeId(), parseData.parentId(), parseData.title(), parseData.fmtTitle(), parseData.last(0), parseData.ficonClass(), parseData.iconClass(), parseData.checkArr(), level, parseData.spread(), parseData.disabled(), parseData.hide(), parseData.basicData(), parseData.recordData(), "item")); - - // 建造完毕后,选中该DIV - $thisDiv = $ul.find("div[data-id='"+parseData.treeId()+"']"); - _this.setNodeParam($thisDiv); - - _this.showLine($ul.find("li")); - } else { - layer.msg("添加失败,节点ID为undefined!",{icon:5}); - // 重新赋值 - _this.setNodeParam($div); - } - } - } else { - _this.getChild($div); - } - } - - // 局部刷新树--编辑当前节点选中节点时 - DTree.prototype.partialRefreshEdit = function($div, data){ - var _this = this; - $ul = $div.next("ul"), - $p_li = $div.parent("li"); - - if(data) { - if(typeof data === 'object') { - var parseData = _this.parseData(data); - - if(parseData.treeId()){ - var replaceDom = _this.replaceDom($div, parseData.treeId(), parseData.last(0), parseData.spread(), parseData.disabled(), parseData.hide()); - replaceDom.div(); - replaceDom.node(parseData.iconClass()); - replaceDom.checkbox(parseData.checkArr()); - replaceDom.text(parseData.title()); - replaceDom.ul(); - replaceDom.basicData(parseData.basicData()); - replaceDom.recordData(parseData.recordData()); - - var parentId = parseData.parentId(); - var oldParentId = $p_li.attr("data-pid"); - if(parentId && parentId != oldParentId) { - // 变更了父节点 - $p_li = replaceDom.p_li(parentId); - - // 根据parentId找到下挂节点的ul - var $goto_div = _this.getNodeDom(parentId).div(), - $goto_ul = _this.getNodeDom(parentId).nextUl(); - // 判断父级ul中是否还存在li,如果不存在,则需要修改节点的样式 - if($goto_ul.children("li").length == 0){ - var $icon_i = $goto_div.find("i[data-spread]"); - _this.operateIcon($icon_i.eq(0), $icon_i.eq(1)).openWithLeaf(); - $goto_ul.addClass(NAV_SHOW); - } - $goto_ul.append($p_li); - } else { - replaceDom.p_li(); - } - _this.setNodeParam($div); - } else { - layer.msg("编辑失败,节点ID为undefined!",{icon:5}); - // 重新赋值 - _this.setNodeParam($div); - } - } else { - _this.getNodeDom($div).cite().html(data); - } - } - } - - // 局部刷新树--当前节点选中被删除时 - DTree.prototype.partialRefreshDel = function($div){ - var _this = this; - $p_li = $div.parent("li"); - $p_ul = _this.getNodeDom($div).parentUl(); - $p_div = _this.getNodeDom($div).parentDiv(); - - $p_li.remove(); - _this.showLine($p_ul.find("li")); - // 判断父级ul中是否还存在li,如果不存在,则需要修改节点的样式 - if($p_ul.children("li").length == 0){ - var $icon_i = $p_div.find("i[data-spread]"); - _this.operateIcon($icon_i.eq(0), $icon_i.eq(1)).closeWithLeaf(); - } - _this.initNodeParam(); - } - - /******************** 复选框区域 ********************/ - // 初始化复选框的值 - DTree.prototype.chooseDataInit = function(chooseIds){ - var _this = this; - var chooseId = chooseIds.split(","); - for (var i=0; i."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - _this.checkStatus($child_li_i).noCheck(); - - // 处理父级节点的选中状态 - for (var i = 1, item = $parent_li; i < item.length; i++) { - var flag = item.eq(i).find(">."+LI_NAV_CHILD+" ."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"'][data-checked='1']").length; - if (flag == 0) { - //把父级去掉选中 - var $item_i = item.eq(i).find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - _this.checkStatus($item_i).noCheck(); - } - } - } else { - // 处理当前节点的选中状态 - _this.checkStatus($i).check(); - - // 处理子级节点的选中状态 - var $child_li_i = $child_li.find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - _this.checkStatus($child_li_i).check(); - - // 处理父级节点的选中状态 - for (var i = 1, item = $parent_li; i < item.length; i++) { - var $item_i = item.eq(i).find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - //把父级选中 - _this.checkStatus($item_i).check(); - } - } - }; - - //实现复选框点击, no-all 子集选中父级半选中,子集全选父级选中 - DTree.prototype.checkAllOrNoallOrNot = function($i) { - var _this = this; - //$i 当前点击的checkbox - var $div = $i.closest("."+LI_DIV_ITEM), - dataPar = $i.attr("data-par"), - dataType = $i.attr("data-type"), - $li = $i.closest(dataPar), //当前checkbox的上级li节点 - $parent_li = $i.parents(dataPar), //当前checkbox的所有父级li节点 - $child_li = $li.find(dataPar); //当前checkbox的上级li节点下的所有子级li节点 - - if ($i.attr("data-checked") == "1") { //当前复选框为选中状态,点击后变为未选中状态 - // 处理当前节点的选中状态 - _this.checkStatus($i).noCheck(); - - // 处理子级节点的选中状态 - var $child_li_i = $child_li.find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - _this.checkStatus($child_li_i).noCheck(); - - // 处理父级节点的选中状态 - for (var i = 1, item = $parent_li; i < item.length; i++) { - var flag = item.eq(i).find(">."+LI_NAV_CHILD+" ."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"'][data-checked='1']").length; - var $item_i = item.eq(i).find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - if (flag == 0) { - //把父级去掉选中 - _this.checkStatus($item_i).noCheck(); - } else { - //把父级半选 - _this.checkStatus($item_i).noallCheck(); - } - } - } else { //当前复选框为未选中状态,点击后变为选中状态 - // 处理当前节点的选中状态 - _this.checkStatus($i).check(); - - // 处理子级节点的选中状态 - var $child_li_i = $child_li.find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - _this.checkStatus($child_li_i).check(); - - // 处理父级节点的选中状态 - for (var i = 1, item = $parent_li; i < item.length; i++) { - var flag1 = item.eq(i).find(">."+LI_NAV_CHILD+" ."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"'][data-checked='1']").length; - var flag2 = item.eq(i).find(">."+LI_NAV_CHILD+" ."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']").length; - var $item_i = item.eq(i).find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - if (flag1 != flag2) { - // 父级复选框半选 - _this.checkStatus($item_i).noallCheck(); - } else { - // 父级复选框全选 - _this.checkStatus($item_i).check(); - } - } - } - }; - - //实现复选框点击,p-casc:父级选中子集全选,子集无法改变父级选中状态 - DTree.prototype.checkAllOrPcascOrNot = function($i) { - var _this = this; - //$i 当前点击的checkbox - var $div = $i.closest("."+LI_DIV_ITEM), - dataPar = $i.attr("data-par"), - dataType = $i.attr("data-type"), - $li = $i.closest(dataPar), //当前checkbox的上级li节点 - $parent_li = $i.parents(dataPar), //当前checkbox的所有父级li节点 - $child_li = $li.find(dataPar); //当前checkbox的上级li节点下的所有子级li节点 - - if ($i.attr("data-checked") == "1") { //当前复选框为选中状态,点击后变为未选中状态 - // 处理当前节点的选中状态 - _this.checkStatus($i).noCheck(); - - // 处理子级节点的选中状态 - var $child_li_i = $child_li.find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - _this.checkStatus($child_li_i).noCheck(); - - } else { //当前复选框为未选中状态,点击后变为选中状态 - // 处理当前节点的选中状态 - _this.checkStatus($i).check(); - - // 处理子级节点的选中状态 - var $child_li_i = $child_li.find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - _this.checkStatus($child_li_i).check(); - } - }; - - //实现复选框点击,self:各自选中互不影响 - DTree.prototype.checkOrNot = function($i) { - var _this = this; - //$i 当前点击的checkbox - var $div = $i.closest("."+LI_DIV_ITEM), - dataPar = $i.attr("data-par"), - dataType = $i.attr("data-type"), - $li = $i.closest(dataPar), //当前checkbox的上级li节点 - $parent_li = $i.parents(dataPar), //当前checkbox的所有父级li节点 - $child_li = $li.find(dataPar); //当前checkbox的上级li节点下的所有子级li节点 - - if ($i.attr("data-checked") == "1") { //当前复选框为选中状态,点击后变为未选中状态 - // 处理当前节点的选中状态 - _this.checkStatus($i).noCheck(); - } else { //当前复选框为未选中状态,点击后变为选中状态 - // 处理当前节点的选中状态 - _this.checkStatus($i).check(); - } - }; - - //实现复选框点击,only:只能选中1个复选框 - DTree.prototype.checkOnly = function($i) { - var _this = this; - //$i 当前点击的checkbox - var $div = $i.closest("."+LI_DIV_ITEM), - dataPar = $i.attr("data-par"), - dataType = $i.attr("data-type"), - $li = $i.closest(dataPar), //当前checkbox的上级li节点 - $parent_li = $i.parents(dataPar), //当前checkbox的所有父级li节点 - $child_li = $li.find(dataPar); //当前checkbox的上级li节点下的所有子级li节点 - - var checked = $i.attr("data-checked"); - // 将全部节点全部设为未选中状态 - var $all_i = _this.obj.find("i[data-checked]"); - _this.checkStatus($all_i).noCheck(); - - if (checked != "1") { //当前复选框为未选中状态,点击后变为选中状态 - // 处理当前节点的选中状态 - _this.checkStatus($i).check(); - } - }; - - //实现复选框点击 - DTree.prototype.changeCheck = function($i) { - var _this = this; - var temp = _this.temp; - if(typeof $i === 'undefined') { - $i = temp[0]; - } - // 复选框选中事件 - if (_this.checkbarType == "all") { - _this.checkAllOrNot($i); - } else if(_this.checkbarType == "no-all") { - _this.checkAllOrNoallOrNot($i); - } else if(_this.checkbarType == "p-casc") { - _this.checkAllOrPcascOrNot($i); - } else if(_this.checkbarType == "self") { - _this.checkOrNot($i); - } else if(_this.checkbarType == "only") { - _this.checkOnly($i); - } else { - _this.checkAllOrNot($i); - } - - if(_this.select) { - // 设置复选框模式中的下拉树的值 - _this.selectCheckboxVal(); - } - - // 获取复选框选中节点的内容 - var checkbarNodes = _this.setAndGetCheckbarNodesParam(true); - - // 用户自定义想做的事情 - _this.checkbarFun.chooseDone(checkbarNodes); - layui.event.call(this, MOD_NAME, "chooseDone("+$(_this.obj)[0].id+")", {"checkbarParams": checkbarNodes}); - _this.temp = []; - }; - - //复选框半选状态初始化设置 - DTree.prototype.initNoAllCheck = function(){ - var _this = this; - //1.获取所有选中节点 - var $is = _this.obj.find("i[data-checked='1']"); - if($is.length > 0){ - for ( var key = 0; key < $is.length; key++) { - var $i = $($is[key]), - dataPar = $i.attr("data-par"), - dataType = $i.attr("data-type"), - $li = $i.closest(dataPar), //当前checkbox的上级li节点 - $parent_li = $i.parents(dataPar), //当前checkbox的所有父级li节点 - $child_li = $li.find(dataPar); //当前checkbox的上级li节点下的所有子级li节点 - - // 处理父级节点的选中状态 - for (var i = 1, item = $parent_li; i < item.length; i++) { - var flag1 = item.eq(i).find(">."+LI_NAV_CHILD+" ."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"'][data-checked='1']").length; - var flag2 = item.eq(i).find(">."+LI_NAV_CHILD+" ."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']").length; - var $item_i = item.eq(i).find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - if (flag1 != flag2) { - // 父级复选框半选 - _this.checkStatus($item_i).noallCheck(); - } else { - // 父级复选框全选 - _this.checkStatus($item_i).check(); - } - } - } - } - }; - - //复选框选中状态初始化设置 - DTree.prototype.initAllCheck = function(){ - var _this = this; - //1.获取所有选中节点 - var $is = _this.obj.find("i[data-checked='1']"); - if($is.length > 0){ - for ( var key = 0; key < $is.length; key++) { - var $i = $($is[key]), - dataPar = $i.attr("data-par"), - dataType = $i.attr("data-type"), - $li = $i.closest(dataPar), //当前checkbox的上级li节点 - $parent_li = $i.parents(dataPar), //当前checkbox的所有父级li节点 - $child_li = $li.find(dataPar); //当前checkbox的上级li节点下的所有子级li节点 - - // 处理父级节点的选中状态 - for (var i = 1, item = $parent_li; i < item.length; i++) { - var $item_i = item.eq(i).find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - // 父级复选框全选 - _this.checkStatus($item_i).check(); - } - } - } - }; - - // 设置复选框选中/未选中/半选 _this.checkStatus($i).check(); _this.checkStatus($i).noCheck(); _this.checkStatus($i).noallCheck(); - DTree.prototype.checkStatus = function($i) { - var _this = this; - return { - check: function(){ - $i.removeClass(_this.usefontStyle.checkbox.out); - $i.removeClass(_this.usefontStyle.checkbox.noall); - $i.addClass(_this.usefontStyle.checkbox.on); - $i.addClass(_this.style.chs); - $i.attr("data-checked","1"); - }, - noCheck: function(){ - $i.removeClass(_this.usefontStyle.checkbox.noall); - $i.removeClass(_this.usefontStyle.checkbox.on); - $i.removeClass(_this.style.chs); - $i.addClass(_this.usefontStyle.checkbox.out); - $i.attr("data-checked","0"); - }, - noallCheck: function(){ - $i.removeClass(_this.usefontStyle.checkbox.out); - $i.removeClass(_this.usefontStyle.checkbox.on); - $i.addClass(_this.usefontStyle.checkbox.noall); - $i.addClass(_this.style.chs); - $i.attr("data-checked","2"); - } - } - }; - - // 设置树的复选框操作值的全部参数,并获取 - DTree.prototype.setAndGetCheckbarNodesParam = function(requestParamFlag) { - var _this = this; - //操作前先清空 - _this.checkbarNode = []; - // 选择所有复选框节点 - if (_this.checkbarData == "change"){ //记录变更数据 - _this.obj.find("i[data-par][dtree-disabled='false']").each(function(){ - var $i = $(this), $div = $i.closest("."+LI_DIV_ITEM); - if ($i.attr("data-checked") != $i.attr("data-initchecked")) { - if(requestParamFlag) { - _this.checkbarNode.push(_this.getRequestParam(_this.getCheckbarNodeParam($div, $i))); - } else { - _this.checkbarNode.push(_this.getCheckbarNodeParam($div, $i)); - } - } - }); - } else if (_this.checkbarData == "all"){ //记录全部数据 - _this.obj.find("i[data-par][data-checked][dtree-disabled='false']").each(function(){ - var $i = $(this), $div = $i.closest("."+LI_DIV_ITEM); - if(requestParamFlag) { - _this.checkbarNode.push(_this.getRequestParam(_this.getCheckbarNodeParam($div, $i))); - } else { - _this.checkbarNode.push(_this.getCheckbarNodeParam($div, $i)); - } - }); - } else if (_this.checkbarData == "choose"){ //记录选中数据 - _this.obj.find("i[data-par][data-checked='1'][dtree-disabled='false']").each(function(){ - var $i = $(this), $div = $i.closest("."+LI_DIV_ITEM); - if(requestParamFlag) { - _this.checkbarNode.push(_this.getRequestParam(_this.getCheckbarNodeParam($div, $i))); - } else { - _this.checkbarNode.push(_this.getCheckbarNodeParam($div, $i)); - } - }); - } else if (_this.checkbarData == "halfChoose"){ //记录选中和半选数据 - _this.obj.find("i[data-par][data-checked='1'][dtree-disabled='false']").each(function(){ - var $i = $(this), $div = $i.closest("."+LI_DIV_ITEM); - if(requestParamFlag) { - _this.checkbarNode.push(_this.getRequestParam(_this.getCheckbarNodeParam($div, $i))); - } else { - _this.checkbarNode.push(_this.getCheckbarNodeParam($div, $i)); - } - }); - _this.obj.find("i[data-par][data-checked='2'][dtree-disabled='false']").each(function(){ - var $i = $(this), $div = $i.closest("."+LI_DIV_ITEM); - if(requestParamFlag) { - _this.checkbarNode.push(_this.getRequestParam(_this.getCheckbarNodeParam($div, $i))); - } else { - _this.checkbarNode.push(_this.getCheckbarNodeParam($div, $i)); - } - }); - } - return _this.checkbarNode; - }; - - // 获取树的复选框操作值的全部参数 - DTree.prototype.getCheckbarNodesParam = function() { - var _this = this; - return _this.setAndGetCheckbarNodesParam(true); - }; - - // 获取树的一个复选框的参数 - DTree.prototype.getCheckbarNodeParam = function($div, $i){ - var _this = this; - var temp_node = {}; - temp_node.nodeId = $div.attr("data-id"); - temp_node.parentId = _this.getNodeDom($div).parentLi().attr("data-pid"); - temp_node.context = (typeof _this.formatter.title === 'function') ? _this.getNodeDom($div).cite().attr("data-title") : _this.getNodeDom($div).cite().text(); - temp_node.leaf = _this.getNodeDom($div).cite().attr("data-leaf") == "leaf" ? true : false; - temp_node.level = _this.getNodeDom($div).parentLi().attr("data-index"); - temp_node.spread = _this.getNodeDom($div).fnode().attr("data-spread") == "open" ? true : false; - - var basicData = $div.attr("data-basic"); - if(basicData) { - basicData = JSON.parse(event.unescape(basicData)); - } - temp_node.basicData = basicData; - var recordData = $div.attr("data-record"); - if(recordData) { - recordData = JSON.parse(event.unescape(recordData)); - } - temp_node.recordData = recordData; - - temp_node.dataType = $i.attr("data-type"); - temp_node.checked = $i.attr("data-checked"); - temp_node.initchecked = $i.attr("data-initchecked"); - return temp_node; - }; - - // 获取基于返回参数的树的复选框参数 - DTree.prototype.getCheckbarJsonArrParam = function(){ - var _this = this; - var checkbarJsonArr = { - nodeId: [], //节点ID - parentId: [], //父节点ID - context: [], //节点内容 - leaf: [], //是否叶子节点 - level: [], //层级 - spread: [], //节点展开状态 - dataType: [], //节点标记 - checked: [], //节点复选框选中状态 - initchecked: [], //节点复选框初始状态 - basicData: [], //用户自定义的记录节点数据 - recordData: [], //当前data数据(排除basicData和children字段) - }; - // 获取全部复选框选中节点 - var params = _this.setAndGetCheckbarNodesParam(false); - if(params && params.length > 0) { - for(var i=0; i 0) { _this.checkStatus($i).check(); } - } - - //取消全部复选框选中 - DTree.prototype.cancelCheckedNode = function(nodeId){ - var _this = this; - var $i = _this.obj.find("i[data-par][data-checked!='0']"); - if($i.length > 0) { _this.checkStatus($i).noCheck(); } - } - - //反选复选框 - DTree.prototype.invertCheckedNode = function(nodeId){ - var _this = this; - if(_this.obj.find("i[data-par]").length > 0) { - var b = false; - _this.obj.find("i[data-par]").each(function(){ - var $i = $(this); - if($i.attr("data-checked") == '2'){ - b = true; - }else if($i.attr("data-checked") == '0') { - _this.checkStatus($i).check(); - }else if($i.attr("data-checked") == '1') { - _this.checkStatus($i).noCheck(); - } - }); - - if(b) { - _this.initNoAllCheck(); - } else { - _this.initAllCheck(); - } - } - } - - //删除选中节点 - DTree.prototype.removeCheckedNode = function(nodeId){ - var _this = this; - var len = _this.obj.find("i[data-par][data-checked='1']").length; - if(len == 0){ - layer.msg("请至少选中一个节点",{icon:2}); - }else{ - //操作前先清空 - _this.checkbarNode = []; - // 选择所有复选框节点 - var i_node = {}; - _this.obj.find("i[data-par][data-checked='1']").each(function(){ - var $i = $(this), $div = $i.closest("."+LI_DIV_ITEM); - - _this.checkbarNode.push(_this.getRequestParam(_this.getCheckbarNodeParam($div, $i))); - }); - - layer.confirm('确定要删除选中节点?', {icon: 3, title:'删除选中节点'}, function(index1){ - var flag = _this.menubarFun.remove(_this.checkbarNode); - if(flag){ - _this.obj.find("i[data-par][data-checked='1']").closest("."+LI_DIV_ITEM).next("ul").remove(); - _this.obj.find("i[data-par][data-checked='1']").closest("."+LI_DIV_ITEM).remove(); - _this.checkbarNode=[]; - } - - layer.close(index1); - }); - } - } - - /******************** 工具栏及菜单栏区域 ********************/ - // 初始化菜单栏和工具栏的div - DTree.prototype.initTreePlus = function(){ - var _this = this; - // 初始化菜单栏和工具栏的div - _this.obj.prevAll('div#dtree_menubar_'+_this.obj[0].id).remove(); - _this.toolbarMenu = {}; - if(_this.menubar && _this.menubarTips.group && _this.menubarTips.group.length > 0) _this.obj.before("
                          "); - if(_this.toolbar){ - if(_this.toolbarWay == "contextmenu") { - _this.obj.prevAll('div#dtree_toolbar_'+_this.obj[0].id).remove(); - _this.obj.before("
                          "); - } - } - - }; - - // 开启工具栏和菜单栏 - DTree.prototype.openTreePlus = function(){ - var _this = this; - // 先对工具栏做处理,因为菜单栏可能会与工具栏产生关联。 - var ggMenu = []; - if(_this.toolbar) _this.getToolbarDom(); - - if(_this.menubar) { - var menubarTips = _this.menubarTips, - mtbar = menubarTips.toolbar, - group = menubarTips.group, - freedom = menubarTips.freedom; - if(mtbar && mtbar.length > 0){ - // 菜单栏吸附工具栏上 - for(var i=0; i 0){ - // 菜单栏吸附在上方的按钮组div中 - for(var i=0; i"; - break; - case defaultMenu.moveUp: - gg = ""; - break; - case defaultMenu.refresh: - gg = ""; - break; - case defaultMenu.checkAll: - gg = (_this.checkbar && _this.checkbarType != 'only') ? "" : ""; - break; - case defaultMenu.unCheckAll: - gg = (_this.checkbar && _this.checkbarType != 'only') ? "" : ""; - break; - case defaultMenu.invertAll: - gg = (_this.checkbar && _this.checkbarType != 'only') ? "" : ""; - break; - case defaultMenu.remove: - gg = (_this.checkbar) ? "" : ""; - break; - case defaultMenu.searchNode: - gg = ""; - break; - } - return gg; - }; - - // 获取扩展菜单栏 - DTree.prototype.getExtMenubarDom = function(menu){ - var _this = this; - return ""; - }; - - // 获取依附在工具栏的菜单栏 - DTree.prototype.getMenubarToolDom = function(menu){ - var _this = this; - var rootId = _this.obj[0].id; - switch (menu) { - case defaultMenu.moveDown: - _this.toolbarMenu[defaultMenu.moveDown] = _this.setToolbarDom().setMenuToolbarOption(defaultMenu.moveDown, _this.toolbarStyle.title, _this.usefontStyle.toolbar.menubar.movedown, "展开全部"); - break; - case defaultMenu.moveUp: - _this.toolbarMenu[defaultMenu.moveUp] = _this.setToolbarDom().setMenuToolbarOption(defaultMenu.moveUp, _this.toolbarStyle.title, _this.usefontStyle.toolbar.menubar.moveup, "收缩全部"); - break; - case defaultMenu.refresh: - _this.toolbarMenu[defaultMenu.refresh] = _this.setToolbarDom().setMenuToolbarOption(defaultMenu.refresh, _this.toolbarStyle.title, _this.usefontStyle.toolbar.menubar.refresh, "刷新"); - break; - case defaultMenu.checkAll: - if(_this.checkbar && _this.checkbarType != 'only') - _this.toolbarMenu[defaultMenu.checkAll] = _this.setToolbarDom().setMenuToolbarOption(defaultMenu.checkAll, _this.toolbarStyle.title, _this.usefontStyle.toolbar.menubar.checkAll, "全选节点"); - break; - case defaultMenu.unCheckAll: - if(_this.checkbar && _this.checkbarType != 'only') - _this.toolbarMenu[defaultMenu.unCheckAll] = _this.setToolbarDom().setMenuToolbarOption(defaultMenu.unCheckAll, _this.toolbarStyle.title, _this.usefontStyle.toolbar.menubar.unCheckAll, "全不选节点"); - break; - case defaultMenu.invertAll: - if(_this.checkbar && _this.checkbarType != 'only') - _this.toolbarMenu[defaultMenu.invertAll] = _this.setToolbarDom().setMenuToolbarOption(defaultMenu.invertAll, _this.toolbarStyle.title, _this.usefontStyle.toolbar.menubar.invertAll, "反选节点"); - break; - case defaultMenu.remove: - if(_this.checkbar) - _this.toolbarMenu[defaultMenu.remove] = _this.setToolbarDom().setMenuToolbarOption(defaultMenu.remove, _this.toolbarStyle.title, _this.usefontStyle.toolbar.menubar.remove, "删除选中"); - break; - case defaultMenu.searchNode: - _this.toolbarMenu[defaultMenu.searchNode] = _this.setToolbarDom().setMenuToolbarOption(defaultMenu.searchNode, _this.toolbarStyle.title, _this.usefontStyle.toolbar.menubar.searchNode, "查询"); - break; - } - }; - - // 获取依附在工具栏的扩展菜单栏 - DTree.prototype.getExtMenubarToolDom = function(menu){ - var _this = this; - _this.toolbarMenu[menu.menubarId] = _this.setToolbarDom().setMenuToolbarOption(menu.menubarId, menu.title, _this.usefontStyle.toolbar.menubarExt+" "+menu.icon, ""); - }; - - // menubar内置方法 - DTree.prototype.menubarMethod = function(){ - var _this = this; - return { - openAllNode: function(obj){ // 展开所有节点 - var $ulNode = obj || _this.obj.children("li").children("ul"); - // 遍历所有ul子节点 - for (var i = 0; i < $ulNode.length; i++) { - // 获取当前节点的信息 - var $ul = $($ulNode[i]), - $div = $ul.prev("div"), - $i_spread = _this.getNodeDom($div).fnode(), - $i_node = _this.getNodeDom($div).snode(), - $cite = _this.getNodeDom($div).cite(), - spread = $i_spread.attr("data-spread"), - leaf = $cite.attr("data-leaf"); - - if (leaf == "leaf") { continue; } // 说明是叶子了,则继续循环下一个 - - if (spread == "open") { - // 说明该节点已经展开了,则进行子节点循环 - } else { - if (_this.type=="load") { //是否全量加载 - if (_this.cache) { //是否开启缓存 - if ($ul.html()) { - $ul.addClass(NAV_SHOW); - } else { //加载节点 - _this.getChild($div); - } - }else { //每次取新的数据 - $ul.html(""); - _this.getChild($div); - } - } else { // 全量加载 - $ul.addClass(NAV_SHOW); - } - _this.operateIcon($i_spread, $i_node).open(); - - } - var $childUl = $ul.children("li").children("ul"); - _this.menubarMethod().openAllNode($childUl); - } - }, - closeAllNode: function(){ //收缩所有节点 - _this.obj.find("."+LI_NAV_CHILD).each(function(){ - // 获取当前节点的信息 - var $ul = $(this), - $div = $ul.prev("div"), - $i_spread = _this.getNodeDom($div).fnode(), - $i_node = _this.getNodeDom($div).snode(), - $cite = _this.getNodeDom($div).cite(), - spread = $i_spread.attr("data-spread"), - leaf = $cite.attr("data-leaf"); - - $ul.removeClass(NAV_SHOW); - _this.operateIcon($i_spread, $i_node).close(); - }); - }, - refreshTree: function(){// 刷新树 - _this.refreshTree(); - }, - checkAll: function(){ // 全选节点 - _this.checkAllNode(); - }, - unCheckAll: function(){ // 全不选节点 - _this.cancelCheckedNode(); - }, - invertAll: function(){ // 反选节点 - _this.invertCheckedNode(); - }, - remove: function(){// 删除选中节点 - _this.removeCheckedNode(); - }, - searchNode: function(){//模糊查询该值,展开该值节点 - layer.prompt({ - formType: 0, - value: "", - title: '查询节点' - }, function(value, index1, elem){ - if (value) { - var flag = _this.searchNode(value); - if (!flag) { - layer.msg("该名称节点不存在!", {icon:5}); - } - } else { - layer.msg("未指定查询节点名称", {icon:5}); - } - layer.close(index1); - }); - }, - extMethod: function(menuId, $div, flag){ - if(_this.menubar && _this.menubarTips.group && _this.menubarTips.group.length > 0 && flag == "group"){ - for(var i=0; i<_this.menubarTips.group.length; i++){ - var ext = _this.menubarTips.group[i]; - if (menuId == ext.menubarId){ - ext.handler(_this.getRequestParam(_this.getNodeParam($div), $div)); - break; - } - } - } - if(_this.menubar && _this.menubarTips.toolbar && _this.menubarTips.toolbar.length > 0 && flag == "toolbar"){ - for(var i=0; i<_this.menubarTips.toolbar.length; i++){ - var ext = _this.menubarTips.toolbar[i]; - if (menuId == ext.menubarId){ - ext.handler(_this.getRequestParam(_this.getNodeParam($div), $div)); - break; - } - } - } - if(_this.menubar && _this.menubarTips.freedom && _this.menubarTips.freedom.length > 0 && flag == "freedom"){ - for(var i=0; i<_this.menubarTips.freedom.length; i++){ - var ext = _this.menubarTips.freedom[i]; - if (menuId == ext.menubarId){ - ext.handler(_this.getRequestParam(_this.getNodeParam($div), $div)); - break; - } - } - } - } - }; - }; - - // menubar监听方法 - DTree.prototype.menubarListener = function(menuId, flag){ - var _this = this; - var $div = _this.getNodeDom().nowDiv(); - switch (menuId) { - case defaultMenu.moveDown: // 展开全部节点 - _this.menubarMethod().openAllNode(); - break; - case defaultMenu.moveUp: // 收缩全部节点 - _this.menubarMethod().closeAllNode(); - break; - case defaultMenu.refresh: - _this.menubarMethod().refreshTree(); // 刷新树 - break; - case defaultMenu.checkAll: - _this.menubarMethod().checkAll(); - break; - case defaultMenu.unCheckAll: - _this.menubarMethod().unCheckAll(); - break; - case defaultMenu.invertAll: - _this.menubarMethod().invertAll(); - break; - case defaultMenu.remove: - _this.menubarMethod().remove(); - break; - case defaultMenu.searchNode: - _this.menubarMethod().searchNode(); - break; - default: - _this.menubarMethod().extMethod(menuId, $div, flag); - break; - } - }; - - //模糊查询该值,展开该值节点 - DTree.prototype.searchNode = function(value){ - var _this = this; - var b = false; - var $lis = []; - _this.obj.find("cite[data-leaf]").each(function(){ - var $nthis = $(this); - var html = $nthis.html(); - if(html.indexOf(value) > -1){ - if($nthis.attr("data-leaf") == "leaf") { - // 叶子节点提供包含父节点的所有信息 - var title = ""; - $nthis.parents("li").each(function(){ - title = "-" + $(this).find("cite[data-leaf]").html() + title; - }); - title = title.substring(1, title.length); - $nthis.attr("title", title); - } - // 保存当前cite所在的li及父li中包含该值,则只保留父的 - var i = 0; - $nthis.parents("li").each(function(){ - var html2 = $(this).find("cite[data-leaf]").html(); - if(html2.indexOf(value) > -1){ - i++; - } - if(i >= 2){ - return true; - } - }); - if (i < 2){ - $lis.push($nthis.closest("li").prop("outerHTML")); - } - } - }); - if($lis.length > 0) { - b = true; - // 1.将树节点清空 - _this.obj.html(""); - // 2.遍历所有cite节点,展开当前cite节点 - for(var i=0; i<$lis.length; i++){ - _this.obj.append($lis[i]); - } - } - return b; - }; - - - /******************** 工具栏区域 ********************/ - // 获取工具栏 - DTree.prototype.getToolbarDom = function(){ - var _this = this; - var toolbarShow = _this.toolbarShow, - toolbarExt = _this.toolbarExt, - toolbarWay = _this.toolbarWay; - - if(toolbarShow.length > 0){ - for(var i=0; i 0){ - for(var i=0; i "+other +title+""; - } else if(toolbarWay == "fixed" || toolbarWay == "follow") { - return ""; - } - }, - setMenuToolbarOption: function(menubarId, title, classId, other){ - var rootId = _this.obj[0].id; - if(toolbarWay == "contextmenu") { - return "
                           "+other +title+"
                          "; - } else if(toolbarWay == "fixed" || toolbarWay == "follow") { - return ""; - } - }, - setToolbarPlace: function(toolbarMenu){ - if(toolbarWay == "contextmenu") { - if(toolbarMenu){ - _this.obj.prevAll('div#dtree_toolbar_'+_this.obj[0].id).find('div.layui-nav-item>dl.layui-nav-child').html(""); - for(var key in toolbarMenu){ - _this.obj.prevAll('div#dtree_toolbar_'+_this.obj[0].id).find('div.layui-nav-item>dl.layui-nav-child').append(toolbarMenu[key]); - } - } - } else if(toolbarWay == "fixed" || toolbarWay == "follow") { - _this.obj.find("cite[data-leaf][dtree-disabled='false']").each(function(){ - var $cite = $(this); - _this.dynamicToolbarDom($cite); - }); - } - } - } - }; - - // 在节点后动态绑定fixed和follow条件的工具栏 - DTree.prototype.dynamicToolbarDom = function($cite){ - var _this = this; - var toolbarWay = _this.toolbarWay; - if($cite.next("em."+TOOLBAR_TOOL_EM).length == 0) { - var $div = $cite.parent("div"); - var param = _this.getRequestParam(_this.getTempNodeParam($div)); - var toolbarMenus = _this.toolbarFun.loadToolbarBefore(event.cloneObj(_this.toolbarMenu), param, $div); - var hideCls = (toolbarWay == "follow") ? NAV_HIDE : ""; - var em = [""]; - if(toolbarMenus){ - for(var key in toolbarMenus){ - em.push(toolbarMenus[key]); - } - } - em.push(""); - $cite.after(em.join('')); - } - } - - // 隐藏toolbar - DTree.prototype.toolbarHide = function() { - var _this = this; - if(_this.toolbar && _this.toolbarWay == "contextmenu") { - var $toolBarDiv = _this.obj.prevAll('div#dtree_toolbar_'+_this.obj[0].id); - $toolBarDiv.find(".layui-nav-child").removeClass('layui-anim-fadein layui-show'); - } - } - - // toolbar内置方法 - DTree.prototype.toolbarMethod = function(){ - var _this = this; - return { - pulldown: function(obj){ // 展开当前点击节点的下面全部节点 - if(!obj) return; - var $ulNode = obj; - // 遍历所有ul子节点 - for (var i = 0; i < $ulNode.length; i++) { - // 获取当前节点的信息 - var $ul = $($ulNode[i]), - $div = $ul.prev("div"), - $i_spread = _this.getNodeDom($div).fnode(), - $i_node = _this.getNodeDom($div).snode(), - $cite = _this.getNodeDom($div).cite(), - spread = $i_spread.attr("data-spread"), - leaf = $cite.attr("data-leaf"); - - if (leaf == "leaf") { continue; } // 说明是叶子了,则继续循环下一个 - - if (spread == "open") { - // 说明该节点已经展开了,则进行子节点循环 - } else { - if (_this.type=="load") { //是否全量加载 - if (_this.cache) { //是否开启缓存 - if ($ul.html()) { - $ul.addClass(NAV_SHOW); - } else { //加载节点 - _this.getChild($div); - } - }else { //每次取新的数据 - $ul.html(""); - _this.getChild($div); - } - } else { // 全量加载 - $ul.addClass(NAV_SHOW); - } - _this.operateIcon($i_spread, $i_node).open(); - - } - var $childUl = $ul.children("li").children("ul"); - _this.toolbarMethod().pulldown($childUl); - } - }, - pullup: function($li){ // 收缩当前点击节点的下面全部节点 - $li.find("."+LI_NAV_CHILD).each(function(){ - // 获取当前节点的信息 - var $ul = $(this), - $div = $ul.prev("div"), - $i_spread = _this.getNodeDom($div).fnode(), - $i_node = _this.getNodeDom($div).snode(), - $cite = _this.getNodeDom($div).cite(), - spread = $i_spread.attr("data-spread"), - leaf = $cite.attr("data-leaf"); - - $ul.removeClass(NAV_SHOW); - _this.operateIcon($i_spread, $i_node).close(); - }); - } - } - }; - - // toolbar监听方法 - DTree.prototype.toolbarListener = function(tool, $div) { - var _this = this; - var $cite = $div.children("cite[data-leaf]"), - $ul = $div.next("ul"), - $p_li = $div.parent("li[data-index]"), //当前选中节点的顶级li节点 - $p_ul = $p_li.parent("ul"), //当前选中节点的顶级li节点的父级ul - $p_div = $p_ul.prev("div"), //当前选中节点的顶级li节点的父级ul的前一个div - title = $cite.html(); - switch (tool) { - case defaultTool.pulldown: - _this.toolbarMethod().pulldown($ul); - break; - case defaultTool.pullup: - _this.toolbarMethod().pullup($p_li); - break; - case defaultTool.addTool: - var content = _this.loadToolBar(title, defaultTool.addTool); - - layer.open({ - title: "新增"+_this.toolbarStyle.title, - type: 1, - area: _this.toolbarStyle.area, - content: content, - success: function(layero, index){ - form.render(); - form.on("submit(dtree_addNode_form)",function(data){ - var data = data.field; - var parentId = $div.attr("data-id"), - id = $div.attr("data-id")+"_node_"+$ul[0].childNodes.length, - leaf = true, - checked = "0", - level = parseInt($p_li.attr("data-index"))+1; - - // 创建子节点的DOM,添加子节点 - var checkArr = []; - if (_this.checkArrLen > 0) { - for (var i = 0; i < _this.checkArrLen; i++) { - checkArr.push({"type":i,"checked":"0"}); - } - } - - $ul.append(_this.getLiItemDom(id, parentId, data.addNodeName, data.addNodeName, true, "", "", checkArr, level, false, false, false, "", "", "item")); - // 先将li节点隐藏 - $ul.find("li[data-id='"+id+"']").hide(); - // 重新赋值 - var $addDiv = $ul.find("div[data-id='"+id+"']"); - node = _this.getNodeParam($addDiv); - - //获取组装后的requestNode,组合参数 - var requestNode = _this.getRequestParam(node); - requestNode = $.extend(requestNode, data); - - _this.temp = [id, $ul, $div, level]; - // 用户自定义想做的事情 - _this.toolbarFun.addTreeNode(requestNode, $div); - - layer.close(index); - return false; - }); - } - }); - break; - case defaultTool.editTool: - var content = _this.loadToolBar(title, defaultTool.editTool); - - layer.open({ - title: "编辑"+_this.toolbarStyle.title, - type: 1, - area: _this.toolbarStyle.area, - content: content, - success: function(layero, index){ - _this.toolbarFun.editTreeLoad(_this.getRequestParam(_this.getNodeParam($div))); - form.render(); - form.on("submit(dtree_editNode_form)",function(data){ - var data = data.field; - $cite.html(data.editNodeName); - node = _this.getNodeParam($div); - var requestNode = _this.getRequestParam(node); - requestNode = $.extend(requestNode, data); - _this.temp = [$cite, $div, title, $p_div]; - _this.toolbarFun.editTreeNode(requestNode, $div); - - layer.close(index); - }); - } - }); - break; - case defaultTool.delTool: - layer.confirm('确定要删除该'+_this.toolbarStyle.title+'?', {icon: 3, title:'删除'+_this.toolbarStyle.title}, function(index){ - var node = _this.getNodeParam($div); - _this.temp = [$p_li, $p_div]; - _this.toolbarFun.delTreeNode(_this.getRequestParam(_this.getNodeParam($div)), $div); - - layer.close(index); - }); - break; - default: - if(_this.toolbarExt.length > 0){ - for(var i=0; i<_this.toolbarExt.length; i++){ - var ext = _this.toolbarExt[i]; - if (tool == ext.toolbarId){ - ext.handler(_this.getRequestParam(_this.getNodeParam($div)), $div); - break; - } - } - } - break; - } - } - - - // 加载toolBar中的内容 - DTree.prototype.loadToolBar = function(title, name){ - var _this = this; - var toolbarShow = _this.toolbarShow; - var nodeBarContents = _this.toolbarBtn; - - var html = ""; - switch (name) { - case defaultTool.addTool: - var addNodeBarDef = [{"label": "当前选中", "name": "nodeTitle", "type": "text", "value": title, "defElem": "nowChoose", "readonly": true}, - {"label": "新增"+_this.toolbarStyle.title, "name": "addNodeName", "type": "text", "value": "", "defElem": "nowChange", "verify": "required"}, - {"type": "submit", "value": "确认添加", "defElem": "btn", "filter": "dtree_addNode_form"}]; - - //2. 用户自定义的节点内容 - var addNodeBar = ['
                          ']; - - if(nodeBarContents != null && nodeBarContents.length > 0){ - if(nodeBarContents[0] != null && nodeBarContents[0] != undefined && nodeBarContents[0].length > 0){ - var addNodeBarContents = nodeBarContents[0]; - // 1. 检查是否包含了now、newly、btn这三个默认项,将其他元素依次排列,将特殊元素至于栈顶 - for(var i=0; i', '
                          ']; - // 3.遍历生成按钮 - for(var j=0; j
                          '); - addNodeBar.push(addBtn.join('')); - addNodeBar.push('
                          '); - html = addNodeBar.join(''); - break; - - case defaultTool.editTool: - var editNodeBarDef = [{"label": "当前选中", "name": "nodeTitle", "type": "text", "value": title, "defElem": "nowChoose", "readonly": true}, - {"label": "编辑"+_this.toolbarStyle.title, "name": "editNodeName", "type": "text", "value": "", "defElem": "nowChange", "verify": "required"}, - {"type": "submit", "value": "确认编辑", "defElem": "btn", "filter": "dtree_editNode_form"}]; - - var editNodeBar = ['
                          ']; - //2. 用户自定义的节点内容 - if(nodeBarContents != null && nodeBarContents.length > 0){ - - if(nodeBarContents[1] != null && nodeBarContents[1] != undefined && nodeBarContents[1].length > 0){ - var editNodeBarContents = nodeBarContents[1]; - // 1. 检查是否包含了now、newly、btn这三个默认项,将其他元素依次排列,将特殊元素至于栈顶 - for(var i=0; i', '
                          ']; - // 3.遍历生成按钮 - for(var j=0; j
                          '); - editNodeBar.push(editBtn.join('')); - editNodeBar.push('
                          '); - html = editNodeBar.join(''); - break; - } - return html; - }; - - // 获取toolbar详细的标签信息 - DTree.prototype.loadToolBarDetail = function(nodeBarContents){ - var _this = this; - var readonly = (typeof (nodeBarContents.readonly) === "boolean") ? nodeBarContents.readonly : false; - var disabled = (typeof (nodeBarContents.disabled) === "boolean") ? nodeBarContents.disabled : false; - var id = nodeBarContents.id ? nodeBarContents.id : ""; - var name = nodeBarContents.name ? nodeBarContents.name : ""; - var val = nodeBarContents.value ? nodeBarContents.value : ""; - var verify = nodeBarContents.verify ? nodeBarContents.verify : ""; - var placeholder = nodeBarContents.placeholder ? nodeBarContents.placeholder : val; - return{ - text: function(){ - return ['
                          ', - '', - '
                          ', - '', - '
                          ', - '
                          '].join(''); - }, - textarea: function(){ - return ['
                          ', - '', - '
                          ', - '', - '
                          ', - '
                          '].join(''); - }, - hidden: function(){ - return [''].join(''); - }, - select: function(){ - var optionsData = (typeof nodeBarContents.optionsData === 'object') ? nodeBarContents.optionsData : nodeBarContents.optionsData(); - var options = ""; - for(var key in optionsData){ - if(val == optionsData[key]){ - options += ""; - } else { - options += ""; - } - } - return ['
                          ', - '', - '
                          ', - '', '
                          ', '
                          '].join(''); - }, - submit: function(){ - var filter = nodeBarContents.filter; - return [''].join(''); - }, - button: function(){ - return [''].join(''); - }, - reset: function(){ - return [''].join(''); - } - } - }; - - // 新增节点后改变节点内容 - DTree.prototype.changeTreeNodeAdd = function(returnID){ - var _this = this; - var temp = _this.temp; - var id = temp[0], $ul = temp[1], $div = temp[2], level = temp[3]; - var flag = false; - if(returnID){ - var $thisDiv = _this.obj.find("[data-id='"+id+"']"); - if(typeof returnID === "object"){ - // 如果是JSON格式数据,则将当前DIV删除,重新建造DIV - $thisDiv.remove(); - var parseData = _this.parseData(returnID); - - if(parseData.treeId()){ - $ul.append(_this.getLiItemDom(parseData.treeId(), parseData.parentId(), parseData.title(), parseData.fmtTitle(), parseData.last(0), parseData.ficonClass(), parseData.iconClass(), parseData.checkArr(), level, parseData.spread(), parseData.disabled(), parseData.hide(), parseData.basicData(), parseData.recordData(), "item")); - - // 建造完毕后,选中该DIV - $thisDiv = $ul.find("div[data-id='"+parseData.treeId()+"']"); - _this.setNodeParam($thisDiv) - } else { - layer.msg("添加失败,节点ID为undefined!",{icon:5}); - // 将li节点删除 - $ul.find("li[data-id='"+id+"']").remove(); - // 重新赋值 - _this.setNodeParam($div); - // 临时变量制空 - _this.temp = []; - return ; - } - }else if(returnID == 'refresh'){ - // 如果是设置为refresh参数,则向后台发送请求,获取新增节点下的真实参数,局部刷新树。 - flag = true; - } else if(typeof returnID === "string" || typeof returnID === 'number' || returnID == true){ - $thisDiv.attr("data-id", returnID); - // 将li节点展示 - $ul.find("li[data-id='"+returnID+"']").show(); - _this.setNodeParam($thisDiv) - } - - // 判断当前点击的节点是否是最后一级节点,如果是,则需要修改节点的样式 - var $icon_i = $div.find("i[data-spread]"); - if ($icon_i.eq(0).attr("data-spread") == "last") { - _this.operateIcon($icon_i.eq(0), $icon_i.eq(1)).openWithLeaf(); - } else { //如果不是,也要修改节点样式 - _this.operateIcon($icon_i.eq(0), $icon_i.eq(1)).open(); - } - $ul.addClass(NAV_SHOW); //展开UL - _this.accordionUL($ul); - if(flag) { - _this.getChild($div); - } else { - // _this.showLine(); - _this.showLine($ul.find("li")); - // 这种情况下需要在新增节点后对节点新增工具栏 - if(_this.toolbar && _this.toolbarWay != 'contextmenu') { - _this.dynamicToolbarDom($thisDiv.find("cite[data-leaf]")); - } - } - - } else { - // 将li节点删除 - $ul.find("li[data-id='"+id+"']").remove(); - // 重新赋值 - _this.setNodeParam($div); - } - - _this.temp = []; // 临时变量制空 - - }; - - // 编辑页打开后显示编辑页内容 - DTree.prototype.changeTreeNodeDone = function(param){ - var _this = this; - form.val('dtree_editNode_form', param); - form.render(); - }; - - // 修改节点后改变节点内容 - DTree.prototype.changeTreeNodeEdit = function(returnID){ - var _this = this; - var temp = _this.temp; - var $cite = temp[0], $div = temp[1], title = temp[2], $p_div = temp[3]; - var flag = false; - if(returnID){ - if(typeof returnID === "object"){ - var parseData = _this.parseData(data); - - if(parseData.treeId()){ - var replaceDom = _this.replaceDom($div, parseData.treeId(), parseData.last(0), parseData.spread(), parseData.disabled(), parseData.hide()); - replaceDom.node(parseData.iconClass()); - replaceDom.checkbox(parseData.checkArr()); - replaceDom.text(parseData.title()); - replaceDom.ul(); - replaceDom.basicData(parseData.basicData()); - replaceDom.recordData(parseData.recordData()); - _this.setNodeParam($div); - } else { - layer.msg("编辑失败,节点ID为undefined!",{icon:5}); - // 重新赋值 - _this.setNodeParam($div); - } - } - } else { - $cite.html(title); - _this.getNodeParam($div); - } - - _this.temp = []; // 临时变量制空 - }; - - // 删除节点后改变节点内容 - DTree.prototype.changeTreeNodeDel = function(flag){ - var _this = this; - var temp = _this.temp; - var $p_li = temp[0], - $p_ul = $p_li.parent("ul"), - $p_div = temp[1]; - - if(flag){ - $p_li.remove(); - _this.showLine($p_ul.find("li")); - // 判断父级ul中是否还存在li,如果不存在,则需要修改节点的样式 - if($p_ul.children("li").length == 0){ - var $icon_i = $p_div.find("i[data-spread]"); - _this.operateIcon($icon_i.eq(0), $icon_i.eq(1)).closeWithLeaf(); - } - _this.initNodeParam(); - } - - _this.temp = []; // 临时变量制空 - }; - - /******************** iframe区域 ********************/ - // 加载iframe - DTree.prototype.loadIframe = function($div, iframeParam) { - var _this = this; - var $cite = _this.getNodeDom($div).cite(); - if (!_this.useIframe) { // 启用iframe - return false; - } - var iframeElem = _this.iframeElem, - iframeUrl = _this.iframeUrl, - iframeLoad = _this.iframeLoad; - - var flag = iframeLoad == "leaf" ? (($cite.attr("data-leaf") == "leaf") ? true : false) : true; - - if (flag) { - if ($(iframeElem).length > 0) { //iframe存在 - if (!iframeUrl) { - layer.msg("数据请求异常,iframeUrl参数未指定", {icon:5}); - return false; - } - var param = AjaxHelper.serialize(iframeParam); - if(iframeUrl.indexOf("?")> -1){ - param = "&"+param.substring(1, param.length); - } - var url = iframeUrl + param; - $(iframeElem).attr("src", url); - } else { - layer.msg("iframe绑定异常,请确认页面中是否有iframe页对应的容器", {icon:5}); - return false; - } - } - return flag; - }; - - // 获取传递出去的参数,根据iframe.iframeDefaultRequest、iframe.iframeRequest和node拼出发出请求的参数 - DTree.prototype.getIframeRequestParam = function(nodes){ - var _this = this; - var request = _this.iframeRequest, - defaultRequestNames = _this.iframeDefaultRequest, - node = nodes || _this.node, - requestParam = {}; - - // 先拼用户自定义的,在拼树生成的,这样的话用户可以自定义当树未生成时的节点的初始值 - for ( var key in request) { - requestParam[key] = request[key]; - } - for ( var key in defaultRequestNames) { - var paramName = defaultRequestNames[key]; - var paramValue = node[key]; - if(typeof paramValue === "boolean"){ - requestParam[paramName] = paramValue; - }else { - if(paramValue){ - requestParam[paramName] = paramValue; - } - } - } - - // 解决传递中文的乱码问题 - var reg = /[\u4E00-\u9FA5\uF900-\uFA2D]/; //正则匹配中文 - for(var key in requestParam){ - if(reg.test(requestParam[key])) { - var str = requestParam[key]; - requestParam[key] = encodeURI(encodeURI(str)); - } - } - - return requestParam; - }; - - /******************** 数据回调区域 ********************/ - // 根据具体的id获取基于当前id的div以及对应的其他dom元素 - DTree.prototype.getNodeDom = function(id){ - var _this = this; - // 获取当前div,如果id就是一个dom,则就是这个,如果不是则进行选择。如果选不中则为null - var $div = (typeof id === 'object') ? id : (_this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']").length == 0) ? null : _this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']"); - return { - div: function(){ // 获取当前div - return $div; - }, - fnode: function(){ // 获取一级图标元素 - return ($div == null) ? null : $div.find("i[data-spread]").eq(0); - }, - snode: function(){ // 获取二级图标元素 - return ($div == null) ? null : $div.find("i[data-spread]").eq(1); - }, - checkbox: function(){ // 获取复选框元素 - return ($div == null) ? null : $div.find("i[data-par]"); - }, - cite: function(){ // 获取cite元素 - return ($div == null) ? null : $div.find("cite[data-leaf]"); - }, - nextUl: function(){ // 获取相邻的ul元素 - return ($div == null) ? null : $div.next("ul"); - }, - parentLi: function(){ // 获取父级li元素 - return ($div == null) ? null : $div.parent("li"); - }, - parentUl: function(){ // 获取基于当前$div的上级$ul - return ($div == null) ? null : $div.parent("li").parent("ul"); - }, - parentDiv: function(){ // 获取基于当前$div的上级$div - return ($div == null) ? null : $div.parent("li").parent("ul").prev("div"); - }, - nowDiv: function(){ // 获取当前选中节点,没有则返回null - return (_this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id]").parent().find("."+NAV_THIS).length == 0) ? null : _this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id]").parent().find("."+NAV_THIS); - }, - nowOrRootDiv: function(){ // 获取当前选中节点,没有则返回根节点下的第一个div - return (_this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id]").parent().find("."+NAV_THIS).length == 0) ? _this.obj.children("li").eq(0).children("div").eq(0) : _this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id]").parent().find("."+NAV_THIS); - }, - nowOrRootUl: function(){ // 获取当前选中节点下一个UL 或根节点。为了将新节点放入ul下 - return (_this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id]").parent().find("."+NAV_THIS).length == 0) ? _this.obj : _this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id]").parent().find("."+NAV_THIS).next("ul"); - } - } - }; - - // 获取当前选中节点下一个UL 或根节点。为了将新节点放入ul下 - DTree.prototype.getNowNodeUl = function() { - var _this = this; - return _this.getNodeDom().nowOrRootUl(); - }; - - // 获取当前选中节点 或第一个根节点。 - DTree.prototype.getNowNode = function() { - var _this = this; - return _this.getNodeDom().nowOrRootDiv(); - }; - - // 获取当前选中节点 无则返回null。 - DTree.prototype.getNowNodeOrNull = function() { - var _this = this; - return _this.getNodeDom().nowDiv(); - }; - - // 获取指定节点。 - DTree.prototype.getNode = function(id) { - var _this = this; - return _this.getNodeDom(id).div(); - }; - - // 设置当前选中节点的全部参数 - DTree.prototype.setNodeParam = function($div) { - var _this = this; - _this.node.nodeId = $div.attr("data-id"); - _this.node.parentId = _this.getNodeDom($div).parentLi().attr("data-pid"); - _this.node.context = (typeof _this.formatter.title === 'function') ? _this.getNodeDom($div).cite().attr("data-title") : _this.getNodeDom($div).cite().text(); - _this.node.leaf = _this.getNodeDom($div).cite().attr("data-leaf") == "leaf" ? true : false; - _this.node.level = _this.getNodeDom($div).parentLi().attr("data-index"); - _this.node.spread = _this.getNodeDom($div).fnode().attr("data-spread") == "open" ? true : false; - - var basicData = $div.attr("data-basic"); - if(basicData) { - basicData = JSON.parse(event.unescape(basicData)); - } - _this.node.basicData = basicData; - - var recordData = $div.attr("data-record"); - if(recordData) { - recordData = JSON.parse(event.unescape(recordData)); - } - _this.node.recordData = recordData; - - if (_this.getNodeDom($div).checkbox()) { - var dataTypes = "", checkeds = "", initcheckeds = ""; - _this.getNodeDom($div).checkbox().each(function(){ - dataTypes += $(this).attr("data-type") + ","; - checkeds += $(this).attr("data-checked") + ","; - initcheckeds += $(this).attr("data-initchecked") + ","; - }); - dataTypes = dataTypes.substring(0, dataTypes.length-1); - checkeds = checkeds.substring(0, checkeds.length-1); - initcheckeds = initcheckeds.substring(0, initcheckeds.length-1); - - _this.node.dataType = dataTypes; - _this.node.checked = checkeds; - _this.node.initchecked = initcheckeds; - } - }; - - // 获取当前选中节点的全部参数 - DTree.prototype.getNodeParam = function($div) { - var _this = this; - if ($div) { - _this.setNodeParam($div); - } else { - if(_this.obj.find("div[data-id]").parent().find("."+NAV_THIS).length == 0){ - _this.initNodeParam(); - } - } - return this.node; - }; - - // 获取一个临时的node参数 - DTree.prototype.getTempNodeParam = function($div) { - var _this = this; - var temp_node = {}; - temp_node.nodeId = $div.attr("data-id"); - temp_node.parentId = _this.getNodeDom($div).parentLi().attr("data-pid"); - temp_node.context = (typeof _this.formatter.title === 'function') ? _this.getNodeDom($div).cite().attr("data-title") : _this.getNodeDom($div).cite().text(); - temp_node.leaf = _this.getNodeDom($div).cite().attr("data-leaf") == "leaf" ? true : false; - temp_node.level = _this.getNodeDom($div).parentLi().attr("data-index"); - temp_node.spread = _this.getNodeDom($div).fnode().attr("data-spread") == "open" ? true : false; - - var basicData = $div.attr("data-basic"); - if(basicData) { - basicData = JSON.parse(event.unescape(basicData)); - } - temp_node.basicData = basicData; - var recordData = $div.attr("data-record"); - if(recordData) { - recordData = JSON.parse(event.unescape(recordData)); - } - temp_node.recordData = recordData; - - if (_this.getNodeDom($div).checkbox()) { - var dataTypes = "", checkeds = "", initcheckeds = ""; - _this.getNodeDom($div).checkbox().each(function(){ - dataTypes += $(this).attr("data-type") + ","; - checkeds += $(this).attr("data-checked") + ","; - initcheckeds += $(this).attr("data-initchecked") + ","; - }); - dataTypes = dataTypes.substring(0, dataTypes.length-1); - checkeds = checkeds.substring(0, checkeds.length-1); - initcheckeds = initcheckeds.substring(0, initcheckeds.length-1); - - temp_node.dataType = dataTypes; - temp_node.checked = checkeds; - temp_node.initchecked = initcheckeds; - } - return temp_node; - }; - - // 重置参数 - DTree.prototype.initNodeParam = function(){ - var _this = this; - _this.node.nodeId = ""; - _this.node.parentId = ""; - _this.node.context = ""; - _this.node.leaf = ""; - _this.node.level = ""; - _this.node.spread = ""; - _this.node.dataType = ""; - _this.node.checked = ""; - _this.node.initchecked = ""; - _this.node.basicData = ""; - _this.node.recordData = ""; - - if(_this.select) { - _this.selectResetVal(); - } - }; - - // 获取传递出去的参数,根据defaultRequest、request和node拼出发出请求的参数 - DTree.prototype.getRequestParam = function(nodes){ - var _this = this; - var request = _this.request, - defaultRequestNames = _this.defaultRequest, - node = nodes || _this.node, - requestParam = {}; - - // 先拼用户自定义的,在拼树生成的,这样的话用户可以自定义当树未生成时的节点的初始值 - for ( var key in request) { - requestParam[key] = request[key]; - } - for ( var key in defaultRequestNames) { - var paramName = defaultRequestNames[key]; - var paramValue = node[key]; - if(typeof paramValue === "boolean"){ - requestParam[paramName] = paramValue; - }else { - if(paramValue){ - requestParam[paramName] = paramValue; - } - } - - } - return requestParam; - }; - - // 获取filterParam过滤后的requestParam - DTree.prototype.getFilterRequestParam = function(requestParam){ - var _this = this; - var filterRequest = _this.filterRequest; - return event.cloneObj(requestParam, filterRequest); - }; - - // 获取当前选中值 - DTree.prototype.getNowParam = function(){ - var _this = this; - - return _this.getRequestParam(_this.getNodeParam()); - }; - - // 获取指定节点选中值 - DTree.prototype.getParam = function(id){ - var _this = this; - - // 获取当前div,如果id就是一个dom,则就是这个,如果不是则进行选择。如果选不中则为null - var $div = (typeof id === 'object') ? id : (_this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']").length == 0) ? null : _this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']"); - if($div != null){ return _this.callbackData().node(_this.getTempNodeParam($div)); } else { return {}; } - }; - - // 获取参数的上级节点 - DTree.prototype.getParentParam = function(id){ - var _this = this; - // 获取当前div,如果id就是一个dom,则就是这个,如果不是则进行选择。如果选不中则为null - var $div = (typeof id === 'object') ? id : (_this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']").length == 0) ? null : _this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']"); - if($div != null){ return _this.callbackData().parentNode($div); } else { return {}; } - }; - - // 获取参数的全部上级节点 - DTree.prototype.getAllParentParam = function(id){ - var _this = this; - // 获取当前div,如果id就是一个dom,则就是这个,如果不是则进行选择。如果选不中则为null - var $div = (typeof id === 'object') ? id : (_this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']").length == 0) ? null : _this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']"); - var arr = []; - if($div != null){ - var level = _this.getTempNodeParam($div).level; - for(var i=1; i 0){ - $childDivs.each(function(){ - var $cDiv = $(this); - childNode.push(_this.getRequestParam(_this.getTempNodeParam($cDiv))); - }); - } - return childNode; - }, - parentNode: function($div){ // 获取上级节点值 - var pId = _this.getNodeDom($div).parentLi().attr("data-pid"); - var $pdiv = _this.obj.find("div[data-id='"+pId+"']"); - if($pdiv.length > 0) {return _this.getRequestParam(_this.getTempNodeParam($pdiv));} else {return {};} - - } - } - }; - - /******************** 事件回调区域 ********************/ - // 绑定浏览器事件 - DTree.prototype.bindBrowserEvent = function(){ - var _this = this; - var rootId = _this.obj[0].id; - - // 绑定文件夹展开/收缩的图标的点击事件,点击时给当前节点的div添加选中class - _this.obj.on("click", "i[data-spread]", function(event) { - event.stopPropagation(); - var $i = $(this), - $div = $i.parent("div"), - node = _this.getNodeParam($div); - - _this.toolbarHide(); - _this.navThis($div); - _this.clickSpread($div); // 展开或隐藏节点 - - // 树状态改变后,用户自定义想做的事情 - layui.event.call(this, MOD_NAME, "changeTree("+$(_this.obj)[0].id+")", { - dom: _this.callbackData().dom($i), - param: _this.callbackData().node(node), - show: _this.callbackData().dom($i).attr("data-spread") == "open" ? true : false - }); - }); - - // 绑定所有子节点div的单击事件,点击时触发加载iframe或用户自定义想做的事情 - _this.obj.on("click", "div[dtree-click='"+eventName.itemNodeClick+"'][dtree-disabled='false']", function(event) { - event.stopPropagation(); - var $div = $(this), - $cite = $div.find("cite"), - node = _this.getNodeParam($div); - _this.toolbarHide(); - _this.navThis($div); - - if(_this.select) { - _this.selectVal(node.nodeId); - $("div[dtree-id='" + rootId + "'][dtree-select='"+_this.selectDiv+"']").click(); - } - - if (_this.useIframe) { - var iframeParam = _this.getFilterRequestParam(_this.getIframeRequestParam(node)); - var flag = _this.loadIframe($div, iframeParam); // 加载iframe - if (flag) { - // iframe加载完毕后,用户自定义想做的事情 - _this.iframeFun.iframeDone(iframeParam); - - layui.event.call(this, MOD_NAME, "iframeDone("+$(_this.obj)[0].id+")", { - "iframeParam": iframeParam, - dom: _this.callbackData().dom($div) - }); - } - } else { - // 单击事件执行完毕后,用户自定义想做的事情 - layui.event.call(this, MOD_NAME, "node("+$(_this.obj)[0].id+")", { - param: _this.callbackData().node(node), - childParams: _this.callbackData().childNode($div), - parentParam: _this.callbackData().parentNode($div), - dom: _this.callbackData().dom($div) - }); - } - }); - - // 绑定所有子节点div的双击事件,暴露on给用户自定义 - _this.obj.on("dblclick", "div[dtree-click='"+eventName.itemNodeClick+"'][dtree-disabled='false']", function(event) { - event.stopPropagation(); - var $div = $(this), - $cite = $div.find("cite"), - node = _this.getNodeParam($div); - _this.toolbarHide(); - _this.navThis($div); - - if(_this.select) { - _this.selectVal(node.nodeId); - $("div[dtree-id='" + rootId + "'][dtree-select='"+_this.selectDiv+"']").click(); - } - - // 双击事件执行完毕后,用户自定义想做的事情 - layui.event.call(this, MOD_NAME, "nodedblclick("+$(_this.obj)[0].id+")", { - param: _this.callbackData().node(node), - childParams: _this.callbackData().childNode($div), - parentParam: _this.callbackData().parentNode($div), - dom: _this.callbackData().dom($div) - }); - }); - - if(_this.checkbar) { - // 绑定cheboxbar的节点复选框 - _this.obj.on("click", "i[dtree-click='"+eventName.checkNodeClick+"'][dtree-disabled='false']", function(event) { - _this.toolbarHide(); - var $i = $(this), - $div = $i.closest("div[dtree-click='"+eventName.itemNodeClick+"']"), - node = _this.getNodeParam($div); - // 复选框选中前的回调 - var flag = _this.checkbarFun.chooseBefore($i, _this.getRequestParam(node)); - _this.temp = [$i]; - if(flag){_this.changeCheck();} - - event.stopPropagation(); - }); - } - - if(_this.menubar) { - // 绑定menubar的点击事件 - _this.obj.prevAll('div#dtree_menubar_'+_this.obj[0].id).on("click", "button[d-menu]", function(event) { - event.stopPropagation(); - _this.toolbarHide(); - _this.menubarListener($(this).attr("d-menu"), "group"); - }); - - // 绑定menubar的点击事件 - _this.obj.prevAll('div#dtree_toolbar_'+_this.obj[0].id).on("click", "a[d-menu]", function(event) { - event.stopPropagation(); - _this.toolbarHide(); - _this.menubarListener($(this).attr("d-menu"), "toolbar"); - }); - - // 绑定menubar的点击按钮事件 - _this.obj.closest('body').find("*[dtree-id='"+_this.obj[0].id+"'][dtree-menu]").on("click", function(event) { - event.stopPropagation(); - _this.toolbarHide(); - _this.menubarListener($(this).attr("dtree-menu"), "freedom"); - }); - } - - if(_this.toolbar) { - if(_this.toolbarWay == "contextmenu") { - //绑定所有子节点div的右键点击事件,用于显示toolbar - _this.obj.on("contextmenu", "div[dtree-click='"+eventName.itemNodeClick+"'][d-contextmenu='true'][dtree-disabled='false']", function(e){ - var $div = $(this), - node = _this.getNodeParam($div); - - _this.toolbarHide(); - // toolbar加载前执行的方法,执行完毕之后创建按钮 - _this.setToolbarDom().setToolbarPlace(_this.toolbarFun.loadToolbarBefore(event.cloneObj(_this.toolbarMenu), _this.getRequestParam(node), $div)); - - var e = e || window.event, - mx = e.pageX - $div.offset().left +45 , - my = $div.offset().top - _this.obj.closest(_this.scroll).offset().top +15; - - _this.navThis($div); - var $toolBarDiv = _this.obj.prevAll('div#dtree_toolbar_'+_this.obj[0].id); - $toolBarDiv.find(".layui-nav-child").addClass('layui-anim-fadein layui-show'); - $toolBarDiv.css({'left':mx+'px','top':my+'px'}); - - e.stopPropagation(); - return false; - }); - - // 绑定装载树的上层出现滚动条的容器,让toolbar隐藏 - _this.obj.closest(_this.scroll).scroll(function() { - _this.toolbarHide(); - }); - - // 绑定toolbar的点击事件 - _this.obj.prevAll('div#dtree_toolbar_'+_this.obj[0].id).on("click", "a[dtree-tool]", function(event) { - event.stopPropagation(); - var $div = _this.getNodeDom().nowOrRootDiv(), - node = _this.getNodeParam($div); - _this.toolbarHide(); - var tool = $(this).attr("dtree-tool"); - _this.toolbarListener(tool, $div); - }); - } else if(_this.toolbarWay == "fixed") { - // 绑定toolbar的点击事件 - _this.obj.on("click", "a[dtree-tool]", function(event) { - event.stopPropagation(); - var $a = $(this), - $cite = $a.parent("em."+TOOLBAR_TOOL_EM).prev("cite"), //当前选中节点的text - $div = $cite.parent("div"), - node = _this.getNodeParam($div); - var tool = $a.attr("dtree-tool"); - - _this.toolbarHide(); - _this.navThis($div); - _this.toolbarListener(tool, $div); - }); - } else if(_this.toolbarWay == "follow") { - //绑定所有子节点div的mouseover mouseout事件,用于显示或隐藏toolbar - _this.obj.on("mouseover mouseout", "div[dtree-click='"+eventName.itemNodeClick+"'][dtree-disabled='false']", function(event){ - var $div = $(this), - $toolBarEm = $div.children("em."+TOOLBAR_TOOL_EM); - if(event.type == "mouseover"){ - $toolBarEm.removeClass(NAV_HIDE); - event.stopPropagation(); - } else if(event.type == "mouseout"){ - $toolBarEm.addClass(NAV_HIDE); - event.stopPropagation(); - } - }); - - // 绑定toolbar的点击事件 - _this.obj.on("click", "a[dtree-tool]", function(event) { - event.stopPropagation(); - var $a = $(this), - $cite = $a.parent("em."+TOOLBAR_TOOL_EM).prev("cite"), //当前选中节点的text - $div = $cite.parent("div"), - node = _this.getNodeParam($div); - var tool = $a.attr("dtree-tool"); - - _this.toolbarHide(); - _this.navThis($div); - _this.toolbarListener(tool, $div); - }); - } - } - - if(_this.select) { - // 绑定select的点击事件 - $("div[dtree-id='" + rootId + "'][dtree-select='"+_this.selectDiv+"']").on("click", function(event){ - event.stopPropagation(); - $(this).toggleClass("layui-form-selected"); - $("div[dtree-id='" + rootId + "'][dtree-card='"+_this.selectCardDiv+"']").toggleClass("dtree-select-show layui-anim layui-anim-upbit"); - - // 下拉树面板开闭状态改变后,用户自定义想做的事情 - layui.event.call(this, MOD_NAME, "changeSelect("+$(_this.obj)[0].id+")", { - show: $(this).hasClass("layui-form-selected"), - param: _this.selectVal() - }); - }); - - } - }; - - // 绑定body的单击,让本页面所有的toolbar隐藏 - $BODY.on("click", function(event){ - $("div."+LI_DIV_TOOLBAR).find(".layui-show").removeClass('layui-anim-fadein layui-show'); - // $("div[dtree-id][dtree-select]").removeClass("layui-form-selected"); - // $("div[dtree-id][dtree-card]").removeClass("dtree-select-show layui-anim layui-anim-upbit"); - - }); - - // 解绑浏览器事件 - DTree.prototype.unbindBrowserEvent = function(){ - var _this = this; - - // 本身事件解绑 - _this.obj.unbind(); - // 菜单栏解绑 - if(_this.menubar){ - _this.obj.prevAll('div#dtree_menubar_'+_this.obj[0].id).unbind(); - if(_this.obj.closest('body').find("*[dtree-id='"+_this.obj[0].id+"'][dtree-menu]").length > 0){ - _this.obj.closest('body').find("*[dtree-id='"+_this.obj[0].id+"'][dtree-menu]").unbind(); - } - } - - // 工具栏解绑 - if(_this.toolbar){ - if(_this.toolbarWay == "contextmenu") { - _this.obj.prevAll('div#dtree_toolbar_'+_this.obj[0].id).unbind(); - if(_this.obj.closest(_this.scroll).length > 0){ - _this.obj.closest(_this.scroll).unbind(); - } - } - } - - // 下拉树解绑 - if(_this.select) { - // 解绑select的点击事件 - $("div[dtree-id='" + _this.obj[0].id + "'][dtree-select='"+_this.selectDiv+"']").removeClass("layui-form-selected"); - $("div[dtree-id='" + _this.obj[0].id + "'][dtree-card='"+_this.selectCardDiv+"']").removeClass("dtree-select-show layui-anim layui-anim-upbit"); - $("div[dtree-id='" + _this.obj[0].id + "'][dtree-select='"+_this.selectDiv+"']").unbind(); - } - }; - - - /** 外部访问 **/ - var dtree = { - set: function(options){ //设置全局属性 - if(typeof options !== 'undefined') { - $.extend(OPTIONS, options); - } - }, - render: function(options){ // 初始化树 - var dTree = null; - var id = event.getElemId(options); - if(id == "") { - layer.msg("页面中未找到绑定id", {icon:5}); - } else { - dTree = DTrees[id]; - if(typeof dTree === 'object'){ - dTree.unbindBrowserEvent(); - } - // 创建树 - dTree = new DTree(options); - // 添加到树数组中去 - DTrees[id] = dTree; - dTree.initTreePlus(); - dTree.openTreePlus(); - dTree.init(); - dTree.bindBrowserEvent(); - } - - return dTree; - }, - renderSelect: function(options){ // 初始化下拉树 - var dTree = null; - var id = event.getElemId(options); - if(id == "") { - layer.msg("页面中未找到绑定id", {icon:5}); - } else { - dTree = DTrees[id]; - if(typeof dTree === 'object'){ - dTree.unbindBrowserEvent(); - } - // 创建下拉树 - dTree = new DTree(options); - dTree.selectSetting(); - // 添加到树数组中去 - DTrees[id] = dTree; - dTree.initTreePlus(); - dTree.openTreePlus(); - dTree.init(); - dTree.bindBrowserEvent(); - } - - return dTree; - }, - reload: function(dTree, options){ // 重新加载树 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - dTree.reloadSetting(options); - dTree.initTreePlus(); - dTree.openTreePlus(); - dTree.initNodeParam(); - dTree.init(); - dTree.unbindBrowserEvent(); - dTree.bindBrowserEvent(); - }, - on: function(events, callback) { // 绑定事件 - if(events.indexOf("'") > 0){ - events = events.replace(/'/g,""); - } - if(events.indexOf('"') > 0) { - events = events.replace(/"/g,""); - } - return layui.onevent.call(this, MOD_NAME, events, callback); - }, - click: function(dTree, id) { // 模拟单击事件 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - $("div[dtree-click='"+eventName.itemNodeClick+"'][dtree-id='"+dTree.obj[0].id+"'][data-id='"+id+"']").click(); - }, - getNowParam: function(dTree){ // 获取当前选中值 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - return dTree.getNowParam(); // 获取当前选中值 - }, - getParam: function(dTree, id){ // 获取指定节点值 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - return dTree.getParam(id); // 获取指定节点值 - }, - getParentParam: function(dTree, id){ // 获取参数的上级节点 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - return dTree.getParentParam(id); - }, - getAllParentParam: function(dTree, id){ // 获取参数的全部上级节点 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - return dTree.getAllParentParam(id); - }, - getChildParam: function(dTree, id){ // 获取参数的全部下级节点 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - return dTree.getChildParam(id); - }, - getCheckbarNodesParam: function(dTree){ // 获取复选框选中值 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return {}; - } - return dTree.getCheckbarNodesParam(); // 获取复选框选中值 - }, - dataInit: function(dTree, chooseId){ // 初始化选中树,针对数据反选 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - if(chooseId){ - return dTree.dataInit(chooseId); - } - }, - chooseDataInit: function(dTree, chooseIds){ // 初始化复选框选中,针对数据反选 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - if(chooseIds){ - return dTree.chooseDataInit(chooseIds); - } - }, - changeCheckbarNodes: function(dTree){ //判断复选框是否发生变更 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - return dTree.changeCheckbarNodes(); - }, - initNoAllCheck: function(dTree) { //复选框半选状态初始化设置 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - return dTree.initNoAllCheck(); - }, - initAllCheck: function(dTree){ // 复选框选中状态初始化设置 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - return dTree.initAllCheck(); - }, - selectVal: function(dTree, param){ // select模式设置输入框选中值 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - return dTree.selectVal(param); // select模式设置输入框选中值 - }, - escape: function(html){ // 字符串格式化 - return event.escape(html); - }, - unescape: function(str){ // 字符串反格式化 - return event.unescape(str); - }, - version: function(){ //获取版本号 - return VERSION; - } - }; - - exports('dtree', dtree); -}); \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/dtree/font/dtreefont.css b/src/plugin/admin/public/component/pear/css/module/dtree/font/dtreefont.css deleted file mode 100644 index df7af653..00000000 --- a/src/plugin/admin/public/component/pear/css/module/dtree/font/dtreefont.css +++ /dev/null @@ -1,229 +0,0 @@ -@font-face { - font-family: 'dtreefont'; - src: url('dtreefont.eot?x3m8fp'); - src: url('dtreefont.eot?x3m8fp#iefix') format('embedded-opentype'), - url('dtreefont.ttf?x3m8fp') format('truetype'), - url('dtreefont.woff?x3m8fp') format('woff'), - url('dtreefont.svg?x3m8fp#dtreefont') format('svg'); - font-weight: normal; - font-style: normal; -} - -[class^="dtree-icon-"], [class*=" dtree-icon-"] { - /* use !important to prevent issues with browser extensions that change font */ - font-family: 'dtreefont' !important; - font-size: 16px; - font-style: normal; - -webkit-font-smoothing: antialiased; -} - -.dtree-icon-xiangxia1:before { - content: "\e771"; -} -.dtree-icon-normal-file:before { - content: "\e60c"; -} -.dtree-icon-xiangyou:before { - content: "\e78f"; -} -.dtree-icon-ok-circle:before { - content: "\1005"; -} -.dtree-icon-close1:before { - content: "\1006"; -} -.dtree-icon-close-fill:before { - content: "\1007"; -} -.dtree-icon-jian1:before { - content: "\e600"; -} -.dtree-icon-jia1:before { - content: "\e601"; -} -.dtree-icon-bianji:before { - content: "\e602"; -} -.dtree-icon-yonghu:before { - content: "\e603"; -} -.dtree-icon-shijian:before { - content: "\e606"; -} -.dtree-icon-fuxuankuang-banxuan:before { - content: "\e607"; -} -.dtree-icon-star:before { - content: "\e608"; -} -.dtree-icon-wenjianjiazhankai:before { - content: "\e60e"; -} -.dtree-icon-xiangmuxiaoxi:before { - content: "\e60f"; -} -.dtree-icon-search2:before { - content: "\e615"; -} -.dtree-icon-weibiaoti5:before { - content: "\e618"; -} -.dtree-icon-layim-theme:before { - content: "\e61b"; -} -.dtree-icon-shuye1:before { - content: "\e61e"; -} -.dtree-icon-add-circle:before { - content: "\e61f"; -} -.dtree-icon-xinxipilu:before { - content: "\e620"; -} -.dtree-icon-set-sm:before { - content: "\e621"; -} -.dtree-icon-about:before { - content: "\e623"; -} -.dtree-icon-chart-screen:before { - content: "\e62a"; -} -.dtree-icon-delete1:before { - content: "\e640"; -} -.dtree-icon-share3:before { - content: "\e641"; -} -.dtree-icon-youjian:before { - content: "\e642"; -} -.dtree-icon-check:before { - content: "\e645"; -} -.dtree-icon-close:before { - content: "\e646"; -} -.dtree-icon-favorfill:before { - content: "\e64b"; -} -.dtree-icon-favor:before { - content: "\e64c"; -} -.dtree-icon-fuxuankuangxuanzhong:before { - content: "\e652"; -} -.dtree-icon-fenguangbaobiao:before { - content: "\e655"; -} -.dtree-icon-jian:before { - content: "\e656"; -} -.dtree-icon-jia:before { - content: "\e657"; -} -.dtree-icon-fenzhijigou:before { - content: "\e658"; -} -.dtree-icon-roundcheckfill:before { - content: "\e659"; -} -.dtree-icon-roundcheck:before { - content: "\e65a"; -} -.dtree-icon-roundclosefill:before { - content: "\e65b"; -} -.dtree-icon-roundclose:before { - content: "\e65c"; -} -.dtree-icon-roundrightfill:before { - content: "\e65d"; -} -.dtree-icon-roundright:before { - content: "\e65e"; -} -.dtree-icon-like:before { - content: "\e66c"; -} -.dtree-icon-samefill:before { - content: "\e671"; -} -.dtree-icon-same:before { - content: "\e672"; -} -.dtree-icon-evaluate:before { - content: "\e674"; -} -.dtree-icon-circle1:before { - content: "\e687"; -} -.dtree-icon-radio:before { - content: "\e688"; -} -.dtree-icon-caidan_xunzhang:before { - content: "\e68e"; -} -.dtree-icon-pulldown:before { - content: "\e6a0"; -} -.dtree-icon-pullup:before { - content: "\e6a1"; -} -.dtree-icon-refresh:before { - content: "\e6a4"; -} -.dtree-icon-qrcode1:before { - content: "\e6b0"; -} -.dtree-icon-profile1:before { - content: "\e6b7"; -} -.dtree-icon-home1:before { - content: "\e6b8"; -} -.dtree-icon-homefill:before { - content: "\e6bb"; -} -.dtree-icon-roundaddfill:before { - content: "\e6d8"; -} -.dtree-icon-roundadd:before { - content: "\e6d9"; -} -.dtree-icon-fuxuankuang:before { - content: "\e6f2"; -} -.dtree-icon-wefill:before { - content: "\e6f5"; -} -.dtree-icon-sort:before { - content: "\e701"; -} -.dtree-icon-repair:before { - content: "\e738"; -} -.dtree-icon-shujudaping:before { - content: "\e742"; -} -.dtree-icon-dian:before { - content: "\e7a5"; -} -.dtree-icon-search_list_light:before { - content: "\e807"; -} -.dtree-icon-round_list_light:before { - content: "\e82b"; -} -.dtree-icon-star-fill:before { - content: "\e832"; -} -.dtree-icon-rate:before { - content: "\e833"; -} -.dtree-icon-move-up:before { - content: "\ea47"; -} -.dtree-icon-move-down:before { - content: "\ea48"; -} diff --git a/src/plugin/admin/public/component/pear/css/module/dtree/font/dtreefont.eot b/src/plugin/admin/public/component/pear/css/module/dtree/font/dtreefont.eot deleted file mode 100644 index 68bf5f2f..00000000 Binary files a/src/plugin/admin/public/component/pear/css/module/dtree/font/dtreefont.eot and /dev/null differ diff --git a/src/plugin/admin/public/component/pear/css/module/dtree/font/dtreefont.svg b/src/plugin/admin/public/component/pear/css/module/dtree/font/dtreefont.svg deleted file mode 100644 index 90fe50f0..00000000 --- a/src/plugin/admin/public/component/pear/css/module/dtree/font/dtreefont.svg +++ /dev/null @@ -1,80 +0,0 @@ - - - -Generated by IcoMoon - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/dtree/font/dtreefont.ttf b/src/plugin/admin/public/component/pear/css/module/dtree/font/dtreefont.ttf deleted file mode 100644 index 78bacd13..00000000 Binary files a/src/plugin/admin/public/component/pear/css/module/dtree/font/dtreefont.ttf and /dev/null differ diff --git a/src/plugin/admin/public/component/pear/css/module/dtree/font/dtreefont.woff b/src/plugin/admin/public/component/pear/css/module/dtree/font/dtreefont.woff deleted file mode 100644 index 2b546450..00000000 Binary files a/src/plugin/admin/public/component/pear/css/module/dtree/font/dtreefont.woff and /dev/null differ diff --git a/src/plugin/admin/public/component/pear/css/module/dtree/font/icons.json b/src/plugin/admin/public/component/pear/css/module/dtree/font/icons.json deleted file mode 100644 index fca47885..00000000 --- a/src/plugin/admin/public/component/pear/css/module/dtree/font/icons.json +++ /dev/null @@ -1,283 +0,0 @@ -{ - "data": [{ - "cls": "dtree-icon-xiangxia1", - "uncode": "e771" - }, - { - "cls": "dtree-icon-xiangyou", - "uncode": "e78f" - }, - { - "cls": "dtree-icon-jian", - "uncode": "e656" - }, - { - "cls": "dtree-icon-jia", - "uncode": "e657" - }, - { - "cls": "dtree-icon-weibiaoti5", - "uncode": "e618" - }, - { - "cls": "dtree-icon-wenjianjiazhankai", - "uncode": "e60e" - }, - { - "cls": "dtree-icon-dian", - "uncode": "e7a5" - }, - { - "cls": "dtree-icon-yonghu", - "uncode": "e603" - }, - { - "cls": "dtree-icon-fenzhijigou", - "uncode": "e658" - }, - { - "cls": "dtree-icon-fenguangbaobiao", - "uncode": "e655" - }, - { - "cls": "dtree-icon-xinxipilu", - "uncode": "e620" - }, - { - "cls": "dtree-icon-shuye1", - "uncode": "e61e" - }, - { - "cls": "dtree-icon-caidan_xunzhang", - "uncode": "e68e" - }, - { - "cls": "dtree-icon-normal-file", - "uncode": "e60c" - }, - { - "cls": "dtree-icon-roundclose", - "uncode": "e65c" - }, - { - "cls": "dtree-icon-bianji", - "uncode": "e602" - }, - { - "cls": "dtree-icon-roundadd", - "uncode": "e6d9" - }, - { - "cls": "dtree-icon-fuxuankuangxuanzhong", - "uncode": "e652" - }, - { - "cls": "dtree-icon-fuxuankuang", - "uncode": "e6f2" - }, - { - "cls": "dtree-icon-fuxuankuang-banxuan", - "uncode": "e607" - }, - { - "cls": "dtree-icon-search_list_light", - "uncode": "e807" - }, - { - "cls": "dtree-icon-move-up", - "uncode": "ea47" - }, - { - "cls": "dtree-icon-move-down", - "uncode": "ea48" - }, - { - "cls": "dtree-icon-delete1", - "uncode": "e640" - }, - { - "cls": "dtree-icon-refresh", - "uncode": "e6a4" - }, - { - "cls": "dtree-icon-roundcheckfill", - "uncode": "e659" - }, - { - "cls": "dtree-icon-roundclosefill", - "uncode": "e65b" - }, - { - "cls": "dtree-icon-roundcheck", - "uncode": "e65a" - }, - { - "cls": "dtree-icon-pulldown", - "uncode": "e6a0" - }, - { - "cls": "dtree-icon-pullup", - "uncode": "e6a1" - }, - { - "cls": "dtree-icon-set-sm", - "uncode": "e621" - }, - { - "cls": "dtree-icon-rate", - "uncode": "e833" - }, - { - "cls": "dtree-icon-jian1", - "uncode": "e600" - }, - { - "cls": "dtree-icon-jia1", - "uncode": "e601" - }, - { - "cls": "dtree-icon-shijian", - "uncode": "e606" - }, - { - "cls": "dtree-icon-check", - "uncode": "e645" - }, - { - "cls": "dtree-icon-close", - "uncode": "e646" - }, - { - "cls": "dtree-icon-favorfill", - "uncode": "e64b" - }, - { - "cls": "dtree-icon-favor", - "uncode": "e64c" - }, - { - "cls": "dtree-icon-roundrightfill", - "uncode": "e65d" - }, - { - "cls": "dtree-icon-roundright", - "uncode": "e65e" - }, - { - "cls": "dtree-icon-samefill", - "uncode": "e671" - }, - { - "cls": "dtree-icon-same", - "uncode": "e672" - }, - { - "cls": "dtree-icon-qrcode1", - "uncode": "e6b0" - }, - { - "cls": "dtree-icon-profile1", - "uncode": "e6b7" - }, - { - "cls": "dtree-icon-home1", - "uncode": "e6b8" - }, - { - "cls": "dtree-icon-homefill", - "uncode": "e6bb" - }, - { - "cls": "dtree-icon-roundaddfill", - "uncode": "e6d8" - }, - { - "cls": "dtree-icon-wefill", - "uncode": "e6f5" - }, - { - "cls": "dtree-icon-sort", - "uncode": "e701" - }, - { - "cls": "dtree-icon-round_list_light", - "uncode": "e82b" - }, - { - "cls": "dtree-icon-search2", - "uncode": "e615" - }, - { - "cls": "dtree-icon-close1", - "uncode": "1006" - }, - { - "cls": "dtree-icon-close-fill", - "uncode": "1007" - }, - { - "cls": "dtree-icon-chart-screen", - "uncode": "e62a" - }, - { - "cls": "dtree-icon-star", - "uncode": "e608" - }, - { - "cls": "dtree-icon-ok-circle", - "uncode": "1005" - }, - { - "cls": "dtree-icon-add-circle", - "uncode": "e61f" - }, - { - "cls": "dtree-icon-about", - "uncode": "e623" - }, - { - "cls": "dtree-icon-circle1", - "uncode": "e687" - }, - { - "cls": "dtree-icon-radio", - "uncode": "e688" - }, - { - "cls": "dtree-icon-star-fill", - "uncode": "e832" - }, - { - "cls": "dtree-icon-shujudaping", - "uncode": "e742" - }, - { - "cls": "dtree-icon-share3", - "uncode": "e641" - }, - { - "cls": "dtree-icon-youjian", - "uncode": "e642" - }, - { - "cls": "dtree-icon-repair", - "uncode": "e738" - }, - { - "cls": "dtree-icon-evaluate", - "uncode": "e674" - }, - { - "cls": "dtree-icon-like", - "uncode": "e66c" - }, - { - "cls": "dtree-icon-layim-theme", - "uncode": "e61b" - }, - { - "cls": "dtree-icon-xiangmuxiaoxi", - "uncode": "e60f" - } - ] -} \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/form.css b/src/plugin/admin/public/component/pear/css/module/form.css deleted file mode 100644 index b6a8c8d3..00000000 --- a/src/plugin/admin/public/component/pear/css/module/form.css +++ /dev/null @@ -1,74 +0,0 @@ -.layui-card-body .layui-form{ - margin-top: 15px; -} - -input::-webkit-input-placeholder, -textarea::-webkit-input-placeholder { - color: #ccc; -} - -.layui-input:hover, -.layui-textarea:hover, -.layui-input:focus, -.layui-textarea:focus { - border-color: #eee; -} - -.layui-input:focus, -.layui-textarea:focus { - border-color: #5FB878 !important; - box-shadow: 0 0 0 3px #f0f9eb !important; -} - -.layui-input[success] { - box-shadow: 0px 0px 0px 3px #f0f9eb !important; - border: #5FB878 1px solid!important; -} - -.layui-input[failure], -.layui-form-item .layui-form-danger:focus { - box-shadow: 0px 0px 0px 3px #fef0f0 !important; - border: #F56C6C 1px solid!important; -} - -.layui-input, -.layui-select, -.layui-textarea { - border-radius: 4px; - border-color: #eee; - transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; -} - -.layui-form-select dl::-webkit-scrollbar { - width: 0px; - height: 0px; -} - -.layui-form-select dl::-webkit-scrollbar { - width: 6px; - height: 6px; -} - -.layui-form-select dl::-webkit-scrollbar-track { - background: white; - border-radius: 3px; -} - -.layui-form-select dl::-webkit-scrollbar-thumb { - background: #E6E6E6; - border-radius: 3px; -} - -.layui-form-select dl::-webkit-scrollbar-thumb:hover { - background: #E6E6E6; -} - -.layui-form-select dl::-webkit-scrollbar-corner { - background: #f6f6f6; -} - -/* layui 2.6.9 样式变化 */ -.layui-form-select dl dd.layui-this{ - background-color: #F6F6F6; - font-weight: 700; -} diff --git a/src/plugin/admin/public/component/pear/css/module/fullscreen.css b/src/plugin/admin/public/component/pear/css/module/fullscreen.css deleted file mode 100644 index 63f77754..00000000 --- a/src/plugin/admin/public/component/pear/css/module/fullscreen.css +++ /dev/null @@ -1,22 +0,0 @@ -html:-moz-full-screen { - background: grey; -} -html:-webkit-full-screen { - background: grey; - width: 100%; - height: 100%; -} -html:fullscreen{ - background: grey; - width: 100% !important; - height: 100% !important; -} - -:not(:root):fullscreen::backdrop{ - background:whitesmoke; -} - -.pear-full-screen { - width: 100% !important; - height: 100% !important; -} \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/layout.css b/src/plugin/admin/public/component/pear/css/module/global.css similarity index 78% rename from src/plugin/admin/public/component/pear/css/module/layout.css rename to src/plugin/admin/public/component/pear/css/module/global.css index 9c4d0822..94d57c79 100644 --- a/src/plugin/admin/public/component/pear/css/module/layout.css +++ b/src/plugin/admin/public/component/pear/css/module/global.css @@ -1,101 +1,40 @@ .pear-container { - margin: 10px; - background-color: whitesmoke; - width: calc(100vw - 20px); -} - -body::-webkit-scrollbar { - width: 0px; - height: 0px; -} - -body::-webkit-scrollbar { - width: 6px; - height: 6px; -} - -body::-webkit-scrollbar-track { - background: white; - border-radius: 2px; -} - -body::-webkit-scrollbar-thumb { - background: #E6E6E6; - border-radius: 2px; -} - -body::-webkit-scrollbar-thumb:hover { - background: #E6E6E6; -} - -body::-webkit-scrollbar-corner { - background: #f6f6f6; + padding: 10px; + margin: 0px; + box-sizing: border-box; + background-color: transparent; + width: 100%; } -.mainBox::-webkit-scrollbar { +*::-webkit-scrollbar { width: 0px; height: 0px; } -.mainBox::-webkit-scrollbar { +*::-webkit-scrollbar { width: 6px; height: 6px; } -.mainBox::-webkit-scrollbar-track { - background: white; - border-radius: 2px; +*::-webkit-scrollbar-track { + background: transparent; } -.mainBox::-webkit-scrollbar-thumb { +*::-webkit-scrollbar-thumb { background: #E6E6E6; - border-radius: 2px; + border-radius: 4px; } -.mainBox::-webkit-scrollbar-thumb:hover { +*::-webkit-scrollbar-thumb:hover { background: #E6E6E6; } -.mainBox::-webkit-scrollbar-corner { +*::-webkit-scrollbar-corner { background: #f6f6f6; } -.mainBox { - width: 100%; - position: absolute; - top: 0px; - left: 0px; - bottom: 50px; - overflow: auto; -} - -.bottom { - width: 100%; - position: absolute; - bottom: 0px; - left: 0px; - height: 50px; - line-height: 50px; - background-color: #F8F8F8; - border-top: 1px solid #eee; -} - -.button-container { - position: absolute; - right: 15px; -} - -.main-container { - margin: 15px; -} - -.main-container .layui-form-item { - margin-bottom: 15px !important; - margin-top: 10px !important; -} - -.pear-row::before, -.pear-row::after { +.pear-row::after, +.pear-row::before { content: ""; display: table; clear: both; @@ -206,103 +145,100 @@ body::-webkit-scrollbar-corner { width: 100%; } -@media all and (min-width:993px) and (max-width:1199px) { - - .pear-col-md-offset1 { - margin-left: 4.16%; - } +.pear-col-md-offset1 { + margin-left: 4.16%; +} - .pear-col-md-offset2 { - margin-left: 8.33%; - } +.pear-col-md-offset2 { + margin-left: 8.33%; +} - .pear-col-md-offset3 { - margin-left: 12.5%; - } +.pear-col-md-offset3 { + margin-left: 12.5%; +} - .pear-col-md-offset4 { - margin-left: 16.66%; - } +.pear-col-md-offset4 { + margin-left: 16.66%; +} - .pear-col-md-offset5 { - margin-left: 20.83%; - } +.pear-col-md-offset5 { + margin-left: 20.83%; +} - .pear-col-md-offset6 { - margin-left: 25%; - } +.pear-col-md-offset6 { + margin-left: 25%; +} - .pear-col-md-offset7 { - margin-left: 29.16%; - } +.pear-col-md-offset7 { + margin-left: 29.16%; +} - .pear-col-md-offset8 { - margin-left: 33.33%; - } +.pear-col-md-offset8 { + margin-left: 33.33%; +} - .pear-col-md-offset9 { - margin-left: 37.5%; - } +.pear-col-md-offset9 { + margin-left: 37.5%; +} - .pear-col-md-offset10 { - margin-left: 41.66%; - } +.pear-col-md-offset10 { + margin-left: 41.66%; +} - .pear-col-md-offset11 { - margin-left: 45.83%; - } +.pear-col-md-offset11 { + margin-left: 45.83%; +} - .pear-col-md-offset12 { - margin-left: 50%; - } +.pear-col-md-offset12 { + margin-left: 50%; +} - .pear-col-md-offset13 { - margin-left: 54.16%; - } +.pear-col-md-offset13 { + margin-left: 54.16%; +} - .pear-col-md-offset14 { - margin-left: 58.33%; - } +.pear-col-md-offset14 { + margin-left: 58.33%; +} - .pear-col-md-offset15 { - margin-left: 62.5%; - } +.pear-col-md-offset15 { + margin-left: 62.5%; +} - .pear-col-md-offset16 { - margin-left: 66.66%; - } +.pear-col-md-offset16 { + margin-left: 66.66%; +} - .pear-col-md-offset17 { - margin-left: 70.83%; - } +.pear-col-md-offset17 { + margin-left: 70.83%; +} - .pear-col-md-offset18 { - margin-left: 75%; - } +.pear-col-md-offset18 { + margin-left: 75%; +} - .pear-col-md-offset19 { - margin-left: 79.16%; - } +.pear-col-md-offset19 { + margin-left: 79.16%; +} - .pear-col-md-offset20 { - margin-left: 83.33%; - } +.pear-col-md-offset20 { + margin-left: 83.33%; +} - .pear-col-md-offset21 { - margin-left: 87.5%; - } +.pear-col-md-offset21 { + margin-left: 87.5%; +} - .pear-col-md-offset22 { - margin-left: 91.66%; - } +.pear-col-md-offset22 { + margin-left: 91.66%; +} - .pear-col-md-offset23 { - margin-left: 95.83%; - } +.pear-col-md-offset23 { + margin-left: 95.83%; +} - .pear-col-md-offset24 { - margin-left: 100%; - } +.pear-col-md-offset24 { + margin-left: 100%; } @@ -1038,4 +974,4 @@ body::-webkit-scrollbar-corner { .pear-col-space30>* { padding: 15px -} +} \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/iconPicker.css b/src/plugin/admin/public/component/pear/css/module/iconPicker.css deleted file mode 100644 index 5d80b0b9..00000000 --- a/src/plugin/admin/public/component/pear/css/module/iconPicker.css +++ /dev/null @@ -1,11 +0,0 @@ -.layui-iconpicker { - width: 295px; -} - -.layui-iconpicker .layui-iconpicker-search .layui-input:focus{ - box-shadow: none!important; -} - -.layui-iconpicker-search .layui-icon { - top: 8px; -} \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/label.css b/src/plugin/admin/public/component/pear/css/module/label.css deleted file mode 100644 index e69de29b..00000000 diff --git a/src/plugin/admin/public/component/pear/css/module/layer.css b/src/plugin/admin/public/component/pear/css/module/layer.css deleted file mode 100644 index 0ca669f5..00000000 --- a/src/plugin/admin/public/component/pear/css/module/layer.css +++ /dev/null @@ -1,324 +0,0 @@ -.layui-layer-msg { - border-color: transparent !important; - box-shadow: 2px 0 6px rgb(0 21 41 / 0.04) !important; -} - -/* 扩展动画开始 */ -.pear-drawer.layui-layer { - border-radius: 0 !important; - overflow: auto; -} - -.pear-drawer.layui-layer.position-absolute { - position: absolute !important; -} -.pear-drawer-anim, -.pear-drawer-anim.layui-anim { - -webkit-animation-duration: .3s; - animation-duration: .3s; - -webkit-animation-timing-function: cubic-bezier(0.7, 0.3, 0.1, 1); - animation-timing-function: cubic-bezier(0.7, 0.3, 0.1, 1); -} - -/* right to left */ -@keyframes layer-rl { - from { - -webkit-transform: translate3d(100%, 0, 0); - -ms-transform: translate3d(100%, 0, 0); - transform: translate3d(100%, 0, 0); - opacity: 1; - - } - - to { - -webkit-transform: translate3d(0, 0, 0); - -ms-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1; - } -} - -@-webkit-keyframes layer-rl { - from { - -webkit-transform: translate3d(100%, 0, 0); - -ms-transform: translate3d(100%, 0, 0); - transform: translate3d(100%, 0, 0); - opacity: 1; - - } - - to { - -webkit-transform: translate3d(0, 0, 0); - -ms-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1; - } -} - -.layer-anim-rl { - -webkit-animation-name: layer-rl; - animation-name: layer-rl; -} - -/* right to left close */ -@keyframes layer-rl-close { - from { - -webkit-transform: translate3d(0, 0, 0); - -ms-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - - to { - -webkit-transform: translate3d(100%, 0, 0); - -ms-transform: translate3d(100%, 0, 0); - transform: translate3d(100%, 0, 0); - } -} - -@-webkit-keyframes layer-rl-close { - from { - -webkit-transform: translate3d(0, 0, 0); - -ms-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - - } - - to { - -webkit-transform: translate3d(100%, 0, 0); - -ms-transform: translate3d(100%, 0, 0); - transform: translate3d(100%, 0, 0); - } -} - -.layer-anim-rl-close, -.layer-anim-rl.layer-anim-close { - -webkit-animation-name: layer-rl-close; - animation-name: layer-rl-close; -} - -/* left to right */ -@-webkit-keyframes layer-lr { - from { - -webkit-transform: translate3d(0, 0, 0); - -ms-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1 - } - - to { - -webkit-transform: translate3d(-100%, 0, 0); - -ms-transform: translate3d(-100%, 0, 0); - transform: translate3d(-100%, 0, 0); - opacity: 1 - } -} - -@keyframes layer-lr { - from { - -webkit-transform: translate3d(-100%, 0, 0); - -ms-transform: translate3d(-100%, 0, 0); - transform: translate3d(-100%, 0, 0); - opacity: 1 - } - - to { - -webkit-transform: translate3d(0, 0, 0); - -ms-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1 - } -} - -.layer-anim-lr { - -webkit-animation-name: layer-lr; - animation-name: layer-lr -} - -/* left to right close */ -@-webkit-keyframes layer-lr-close { - from { - -webkit-transform: translate3d(0, 0, 0); - -ms-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - - to { - -webkit-transform: translate3d(-100%, 0, 0); - -ms-transform: translate3d(-100%, 0, 0); - transform: translate3d(-100%, 0, 0); - } -} - -@keyframes layer-lr-close { - from { - -webkit-transform: translate3d(0, 0, 0); - -ms-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - - to { - -webkit-transform: translate3d(-100%, 0, 0); - -ms-transform: translate3d(-100%, 0, 0); - transform: translate3d(-100%, 0, 0); - } -} - -.layer-anim-lr-close, -.layer-anim-lr.layer-anim-close { - -webkit-animation-name: layer-lr-close; - animation-name: layer-lr-close -} - -/* top to bottom */ -@-webkit-keyframes layer-tb { - from { - -webkit-transform: translate3d(0, -100%, 0); - -ms-transform: translate3d(0, -100%, 0); - transform: translate3d(0, -100%, 0); - opacity: 1; - animation-timing-function: cubic-bezier(0.7, 0.3, 0.1, 1); - } - - to { - -webkit-transform: translate3d(0, 0, 0); - -ms-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1; - animation-timing-function: cubic-bezier(0.7, 0.3, 0.1, 1); - } -} - -@keyframes layer-tb { - from { - -webkit-transform: translate3d(0, -100%, 0); - -ms-transform: translate3d(0, -100%, 0); - transform: translate3d(0, -100%, 0); - opacity: 1; - animation-timing-function: cubic-bezier(0.7, 0.3, 0.1, 1); - } - - to { - -webkit-transform: translate3d(0, 0, 0); - -ms-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1; - animation-timing-function: cubic-bezier(0.7, 0.3, 0.1, 1); - } -} - -.layer-anim-tb { - -webkit-animation-name: layer-tb; - animation-name: layer-tb -} - -/* top to bottom close */ -@-webkit-keyframes layer-tb-close { - from { - -webkit-transform: translate3d(0, 0, 0); - -ms-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - - to { - -webkit-transform: translate3d(0, -100%, 0); - -ms-transform: translate3d(0, -100%, 0); - transform: translate3d(0, -100%, 0); - } -} - -@keyframes layer-tb-close { - from { - -webkit-transform: translate3d(0, 0, 0); - -ms-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - - to { - -webkit-transform: translate3d(0, -100%, 0); - -ms-transform: translate3d(0, -100%, 0); - transform: translate3d(0, -100%, 0); - } -} - -.layer-anim-tb-close, -.layer-anim-tb.layer-anim-close { - -webkit-animation-name: layer-tb-close; - animation-name: layer-tb-close -} - -/* bottom to top */ -@-webkit-keyframes layer-bt { - from { - -webkit-transform: translate3d(0, 100%, 0); - -ms-transform: translate3d(0, 100%, 0); - transform: translate3d(0, 100%, 0); - opacity: 1 - } - - to { - -webkit-transform: translate3d(0, 0, 0); - -ms-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1 - } -} - -@keyframes layer-bt { - from { - -webkit-transform: translate3d(0, 100%, 0); - -ms-transform: translate3d(0, 100%, 0); - transform: translate3d(0, 100%, 0); - opacity: 1 - } - - to { - -webkit-transform: translate3d(0, 0, 0); - -ms-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1 - } -} - -.layer-anim-bt { - -webkit-animation-name: layer-bt; - animation-name: layer-bt -} - -/* bottom to top close */ -@-webkit-keyframes layer-bt-close { - from { - -webkit-transform: translate3d(0, 0, 0); - -ms-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - - to { - -webkit-transform: translate3d(0, 100%, 0); - -ms-transform: translate3d(0, 100%, 0); - transform: translate3d(0, 100%, 0); - } -} - -@keyframes layer-bt-close { - from { - -webkit-transform: translate3d(0, 0, 0); - -ms-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - - } - - to { - -webkit-transform: translate3d(0, 100%, 0); - -ms-transform: translate3d(0, 100%, 0); - transform: translate3d(0, 100%, 0); - - } -} - -.layer-anim-bt-close, -.layer-anim-bt.layer-anim-close { - -webkit-animation-name: layer-bt-close; - animation-name: layer-bt-close -} - -/* 扩展动画结束 */ \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/link.css b/src/plugin/admin/public/component/pear/css/module/link.css deleted file mode 100644 index 380351c5..00000000 --- a/src/plugin/admin/public/component/pear/css/module/link.css +++ /dev/null @@ -1,20 +0,0 @@ -.pear-link{ - font-size: 15px!important; -} - -.pear-link.pear-link-primary{ - color : #5FB878 ; -} - -.pear-link.pear-link-success{ - color : #5FB878 ; -} - -.pear-link .pear-link-warming{ - - -} - -.pear-link .pear-link-danger{ - -} \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/loading.css b/src/plugin/admin/public/component/pear/css/module/loading.css deleted file mode 100644 index 4abb57d3..00000000 --- a/src/plugin/admin/public/component/pear/css/module/loading.css +++ /dev/null @@ -1,987 +0,0 @@ -/*! -* Notiflix ('https://www.notiflix.com') -* Version: 2.0.0 -* Author: Furkan MT ('https://github.com/furcan') -* Copyright 2020 Notiflix, MIT Licence ('https://opensource.org/licenses/MIT') -*/ - -/* Notiflix: Notify wrap on */ -[id^=NotiflixNotifyWrap] { -position: fixed; -z-index:4001; -opacity:1; -right: 10px; -top: 10px; -width: 280px; -max-width:96%; -box-sizing:border-box; -background: transparent;} - -[id^=NotiflixNotifyWrap] * { -box-sizing:border-box;} -/* Notiflix: Notify wrap off */ - -/* Notiflix: Notify content on */ -[id^=NotiflixNotifyWrap] > div { --webkit-user-select: none; --moz-user-select: none; --ms-user-select: none; -user-select: none; -font-family: 'Quicksand', sans-serif; -width:100%; -display: inline-block; -position:relative; -margin:0 0 10px; -border-radius:5px; -background: #1e1e1e; -color: #fff; -padding: 10px 12px; -font-size: 14px; -line-height: 1.4;} - -[id^=NotiflixNotifyWrap] > div:last-child { -margin:0;} - -[id^=NotiflixNotifyWrap] > div.with-callback { -cursor:pointer;} - -[id^=NotiflixNotifyWrap] *::selection { -background:inherit;} - -[id^=NotiflixNotifyWrap] > div.with-icon { -padding: 8px;} - -[id^=NotiflixNotifyWrap] > div.click-to-close { -cursor: pointer;} - -[id^=NotiflixNotifyWrap] > div.with-close-button { -padding: 10px 30px 10px 12px;} -[id^=NotiflixNotifyWrap] > div.with-icon.with-close-button { -padding: 6px 30px 6px 6px;} - -[id^=NotiflixNotifyWrap] > div > span.the-message { -font-weight: 500; -font-family:inherit !important; -word-break: break-all; -word-break: break-word;} - -[id^=NotiflixNotifyWrap] > div > span.notify-close-button { -cursor:pointer; -transition:all .2s ease-in-out; -position: absolute; -right: 8px; -top: 0; -bottom:0; -margin:auto; -color:inherit; -width: 16px; -height: 16px;} -[id^=NotiflixNotifyWrap] > div > span.notify-close-button:hover { -transform:rotate(90deg);} -[id^=NotiflixNotifyWrap] > div > span.notify-close-button > svg { -position: absolute; -width: 16px; -height: 16px; -right: 0; -top: 0;} -/* Notiflix: Notify content off */ - -/* Notiflix: Notify icon on */ -[id^=NotiflixNotifyWrap] > div > .nmi { -position: absolute; -width: 40px; -height: 40px; -font-size: 30px; -line-height: 40px; -text-align: center; -left: 8px; -top: 0; -bottom: 0; -margin: auto; -border-radius: inherit;} - -[id^=NotiflixNotifyWrap] > div > .wfa.shadow { -color: inherit; -background: rgba(0, 0, 0, 0.15); -box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.2); -text-shadow: 0 0 10px rgba(0, 0, 0, 0.3);} - -[id^=NotiflixNotifyWrap] > div > span.with-icon { -position: relative; -float: left; -width: calc(100% - 40px); -margin:0 0 0 40px; -padding:0 0 0 10px; -box-sizing: border-box;} -/* Notiflix: Notify icon off */ - -/* Notiflix: Notify rtl on */ -[id^=NotiflixNotifyWrap] > div.rtl-on > .nmi { -left:auto; -right:8px;} - -[id^=NotiflixNotifyWrap] > div.rtl-on > span.with-icon { -padding:0 10px 0 0; -margin:0 40px 0 0;} - -[id^=NotiflixNotifyWrap] > div.rtl-on > span.notify-close-button { -right: auto; -left: 8px;} - -[id^=NotiflixNotifyWrap] > div.with-icon.with-close-button.rtl-on { -padding: 6px 6px 6px 30px;} - -[id^=NotiflixNotifyWrap] > div.with-close-button.rtl-on { -padding: 10px 12px 10px 30px;} -/* Notiflix: Notify rtl off */ - -/* Notiflix: Notify animation => fade on */ -[id^=NotiflixNotifyOverlay].with-animation, -[id^=NotiflixNotifyWrap] > div.with-animation.nx-fade { -animation: notify-animation-fade .3s ease-in-out 0s normal; --webkit-animation: notify-animation-fade .3s ease-in-out 0s normal;} - -@keyframes notify-animation-fade { -0% {opacity:0;} -100% {opacity:1;} -} - -@-webkit-keyframes notify-animation-fade { -0% {opacity:0;} -100% {opacity:1;} -} -/* Notiflix: Notify animation => fade off */ - -/* Notiflix: Notify animation => zoom on */ -[id^=NotiflixNotifyWrap] > div.with-animation.nx-zoom { -animation: notify-animation-zoom .3s ease-in-out 0s normal; --webkit-animation: notify-animation-zoom .3s ease-in-out 0s normal;} - -@keyframes notify-animation-zoom { -0% {transform:scale(0);} -50% {transform:scale(1.05);} -100% {transform:scale(1);} -} - -@-webkit-keyframes notify-animation-zoom { -0% {transform:scale(0);} -50% {transform:scale(1.05);} -100% {transform:scale(1);} -} -/* Notiflix: Notify animation => zoom off */ - -/* Notiflix: Notify animation => from right on */ -[id^=NotiflixNotifyWrap] > div.with-animation.nx-from-right { -animation: notify-animation-from-right .3s ease-in-out 0s normal; --webkit-animation: notify-animation-from-right .3s ease-in-out 0s normal;} - -@keyframes notify-animation-from-right { -0% {right:-300px; opacity:0;} -50% {right:8px; opacity:1;} -100% {right:0px; opacity:1;} -} - -@-webkit-keyframes notify-animation-from-right { -0% {right:-300px; opacity:0;} -50% {right:8px; opacity:1;} -100% {right:0px; opacity:1;} -} -/* Notiflix: Notify animation => from right off */ - -/* Notiflix: Notify animation => from left on */ -[id^=NotiflixNotifyWrap] > div.with-animation.nx-from-left { -animation: notify-animation-from-left .3s ease-in-out 0s normal; --webkit-animation: notify-animation-from-left .3s ease-in-out 0s normal;} - -@keyframes notify-animation-from-left { -0% {left:-300px; opacity:0;} -50% {left:8px; opacity:1;} -100% {left:0px; opacity:1;} -} - -@-webkit-keyframes notify-animation-from-left { -0% {left:-300px; opacity:0;} -50% {left:8px; opacity:1;} -100% {left:0px; opacity:1;} -} -/* Notiflix: Notify animation => from left off */ - -/* Notiflix: Notify animation => from top on */ -[id^=NotiflixNotifyWrap] > div.with-animation.nx-from-top { -animation: notify-animation-from-top .3s ease-in-out 0s normal; --webkit-animation: notify-animation-from-top .3s ease-in-out 0s normal;} - -@keyframes notify-animation-from-top { -0% {top:-50px; opacity:0;} -50% {top:8px; opacity:1;} -100% {top:0px; opacity:1;} -} - -@-webkit-keyframes notify-animation-from-top { -0% {top:-50px; opacity:0;} -50% {top:8px; opacity:1;} -100% {top:0px; opacity:1;} -} -/* Notiflix: Notify animation => from top off */ - -/* Notiflix: Notify animation => from bottom on */ -[id^=NotiflixNotifyWrap] > div.with-animation.nx-from-bottom { -animation: notify-animation-from-bottom .3s ease-in-out 0s normal; --webkit-animation: notify-animation-from-bottom .3s ease-in-out 0s normal;} - -@keyframes notify-animation-from-bottom { -0% {bottom:-50px; opacity:0;} -50% {bottom:8px; opacity:1;} -100% {bottom:0px; opacity:1;} -} - -@-webkit-keyframes notify-animation-from-bottom { -0% {bottom:-50px; opacity:0;} -50% {bottom:8px; opacity:1;} -100% {bottom:0px; opacity:1;} -} -/* Notiflix: Notify animation => from bottom off */ - -/* Notiflix: Notify animation remove => fade on */ -[id^=NotiflixNotifyOverlay].with-animation.remove, -[id^=NotiflixNotifyWrap] > div.with-animation.nx-fade.remove { -opacity:0; -animation: notify-remove-fade .3s ease-in-out 0s normal; --webkit-animation: notify-remove-fade .3s ease-in-out 0s normal;} - -@keyframes notify-remove-fade { -0% {opacity:1;} -100% {opacity:0;} -} - -@-webkit-keyframes notify-remove-fade { -0% {opacity:1;} -100% {opacity:0;} -} -/* Notiflix: Notify animation remove => fade off */ - -/* Notiflix: Notify animation remove => zoom on */ -[id^=NotiflixNotifyWrap] > div.with-animation.nx-zoom.remove { -transform:scale(0); -animation: notify-remove-zoom .3s ease-in-out 0s normal; --webkit-animation: notify-remove-zoom .3s ease-in-out 0s normal;} - -@keyframes notify-remove-zoom { -0% {transform:scale(1);} -50% {transform:scale(1.05);} -100% {transform:scale(0);} -} - -@-webkit-keyframes notify-remove-zoom { -0% {transform:scale(1);} -50% {transform:scale(1.05);} -100% {transform:scale(0);} -} -/* Notiflix: Notify animation remove => zoom off */ - -/* Notiflix: Notify animation remove => from top on */ -[id^=NotiflixNotifyWrap] > div.with-animation.nx-from-top.remove { -opacity:0; -animation: notify-remove-to-top .3s ease-in-out 0s normal; --webkit-animation: notify-remove-to-top .3s ease-in-out 0s normal;} - -@keyframes notify-remove-to-top { -0% {top:0px; opacity:1;} -50% {top:8px; opacity:1;} -100% {top:-50px; opacity:0;} -} - -@-webkit-keyframes notify-remove-to-top { -0% {top:0px; opacity:1;} -50% {top:8px; opacity:1;} -100% {top:-50px; opacity:0;} -} -/* Notiflix: Notify animation remove => from top off */ - -/* Notiflix: Notify animation remove => from right on */ -[id^=NotiflixNotifyWrap] > div.with-animation.nx-from-right.remove { -opacity:0; -animation: notify-remove-to-right .3s ease-in-out 0s normal; --webkit-animation: notify-remove-to-right .3s ease-in-out 0s normal;} - -@keyframes notify-remove-to-right { -0% {right:0px; opacity:1;} -50% {right:8px; opacity:1;} -100% {right:-300px; opacity:0;} -} - -@-webkit-keyframes notify-remove-to-right { -0% {right:0px; opacity:1;} -50% {right:8px; opacity:1;} -100% {right:-300px; opacity:0;} -} -/* Notiflix: Notify animation remove => from right off */ - -/* Notiflix: Notify animation remove => from bottom on */ -[id^=NotiflixNotifyWrap] > div.with-animation.nx-from-bottom.remove { -opacity:0; -animation: notify-remove-to-bottom .3s ease-in-out 0s normal; --webkit-animation: notify-remove-to-bottom .3s ease-in-out 0s normal;} - -@keyframes notify-remove-to-bottom { -0% {bottom:0px; opacity:1;} -50% {bottom:8px; opacity:1;} -100% {bottom:-50px; opacity:0;} -} - -@-webkit-keyframes notify-remove-to-bottom { -0% {bottom:0px; opacity:1;} -50% {bottom:8px; opacity:1;} -100% {bottom:-50px; opacity:0;} -} -/* Notiflix: Notify animation remove => from bottom off */ - -/* Notiflix: Notify animation remove => from left on */ -[id^=NotiflixNotifyWrap] > div.with-animation.nx-from-left.remove { -opacity:0; -animation: notify-remove-to-left .3s ease-in-out 0s normal; --webkit-animation: notify-remove-to-left .3s ease-in-out 0s normal;} - -@keyframes notify-remove-to-left { -0% {left:0px; opacity:1;} -50% {left:8px; opacity:1;} -100% {left:-300px; opacity:0;} -} - -@-webkit-keyframes notify-remove-to-left { -0% {left:0px; opacity:1;} -50% {left:8px; opacity:1;} -100% {left:-300px; opacity:0;} -} -/* Notiflix: Notify animation remove => from left off */ - - -/* Notiflix: Report wrap on */ -[id^=NotiflixReportWrap] { -position: fixed; -z-index:4002; -width: 320px; -max-width:96%; -box-sizing:border-box; -font-family: "Quicksand", sans-serif; -left: 0; -right: 0; -top: 20px; -color:#1e1e1e; -border-radius: 25px; -background: transparent; -margin: auto;} - -[id^=NotiflixReportWrap] * { -box-sizing:border-box;} -/* Notiflix: Report wrap off */ - -/* Notiflix: Report content on */ -[id^=NotiflixReportWrap] > div[class*="-overlay"] { -width:100%; -height:100%; -left:0; -top:0; -background: rgba(255, 255, 255, .5); -position:fixed; -z-index:0;} - -[id^=NotiflixReportWrap] > div[class*="-content"] { -width:100%; -float:left; -border-radius: inherit; -padding:10px; -filter: drop-shadow(0 0 5px rgba(0,0,0,.1)); -border: 1px solid rgba(0,0,0,.03); -background: #f8f8f8; -position:relative; -z-index:1;} - -[id^=NotiflixReportWrap] > div[class*="-content"] > div[class$="-icon"] { --webkit-user-select: none; --moz-user-select: none; --ms-user-select: none; -user-select: none; -width:110px; -height:110px; -display:block; -margin:6px auto 12px;} - -[id^=NotiflixReportWrap] > div[class*="-content"] > div[class$="-icon"] svg { -min-width:100%; -max-width:100%; -height:auto;} - -[id^=NotiflixReportWrap] > * > h5 { -word-break: break-all; -word-break: break-word; -font-family:inherit !important; -font-size:16px; -font-weight:500; -line-height: 1.4; -margin: 0 0 10px; -padding: 0 0 10px; -border-bottom: 1px solid rgba(0, 0, 0, 0.1); -float: left; -width: 100%; -text-align: center;} - -[id^=NotiflixReportWrap] > * > p { -word-break: break-all; -word-break: break-word; -font-family:inherit !important; -font-size:13px; -line-height: 1.4; -float: left; -width: 100%; -padding:0 10px; -margin: 0 0 10px;} - -[id^=NotiflixReportWrap] a#NXReportButton { -word-break: break-all; -word-break: break-word; --webkit-user-select: none; --moz-user-select: none; --ms-user-select: none; -user-select: none; -font-family:inherit !important; -transition:all .25s ease-in-out; -cursor:pointer; -float: right; -padding: 7px 17px; -background: #32c682; -font-size:14px; -line-height: 1.4; -font-weight: 500; -border-radius: inherit !important; -color: #fff;} - -[id^=NotiflixReportWrap] a#NXReportButton:hover { -box-shadow:inset 0 -60px 5px -5px rgba(0, 0, 0, 0.25);} - -[id^=NotiflixReportWrap].rtl-on a#NXReportButton { -float:left;} -/* Notiflix: Report content off */ - -/* Notiflix: Report overlay animation => fade on */ -[id^=NotiflixReportWrap] > div[class*="-overlay"].with-animation { -animation: report-overlay-animation .3s ease-in-out 0s normal; --webkit-animation: report-overlay-animation .3s ease-in-out 0s normal;} - -@keyframes report-overlay-animation { -0% {opacity:0;} -100% {opacity:1;} -} - -@-webkit-keyframes report-overlay-animation { -0% {opacity:0;} -100% {opacity:1;} -} -/* Notiflix: Report overlay animation => fade off */ - -/* Notiflix: Report content animation => fade on */ -[id^=NotiflixReportWrap] > div[class*="-content"].with-animation.nx-fade { -animation: report-animation-fade .3s ease-in-out 0s normal; --webkit-animation: report-animation-fade .3s ease-in-out 0s normal;} - -@keyframes report-animation-fade { -0% {opacity:0;} -100% {opacity:1;} -} - -@-webkit-keyframes report-animation-fade { -0% {opacity:0;} -100% {opacity:1;} -} -/* Notiflix: Report content animation => fade off */ - -/* Notiflix: Report content animation => zoom on */ -[id^=NotiflixReportWrap] > div[class*="-content"].with-animation.nx-zoom { -animation: report-animation-zoom .3s ease-in-out 0s normal; --webkit-animation: report-animation-zoom .3s ease-in-out 0s normal;} - -@keyframes report-animation-zoom { -0% {opacity:0; transform:scale(0.5);} -50% {opacity:1; transform:scale(1.05);} -100% {opacity:1; transform:scale(1);} -} - -@-webkit-keyframes report-animation-zoom { -0% {opacity:0; transform:scale(0.5);} -50% {opacity:1; transform:scale(1.05);} -100% {opacity:1; transform:scale(1);} -} -/* Notiflix: Report content animation => zoom off */ - -/* Notiflix: Report overlay animation remove => fade on */ -[id^=NotiflixReportWrap].remove > div[class*="-overlay"].with-animation { -opacity:0; -animation: report-overlay-animation-remove .3s ease-in-out 0s normal; --webkit-animation: report-overlay-animation-remove .3s ease-in-out 0s normal;} - -@keyframes report-overlay-animation-remove { -0% {opacity:1;} -100% {opacity:0;} -} - -@-webkit-keyframes report-overlay-animation-remove { -0% {opacity:1;} -100% {opacity:0;} -} -/* Notiflix: Report overlay animation remove => fade off */ - -/* Notiflix: Report content animation remove => fade on */ -[id^=NotiflixReportWrap].remove > div[class*="-content"].with-animation.nx-fade { -opacity:0; -animation: report-animation-fade-remove .3s ease-in-out 0s normal; --webkit-animation: report-animation-fade-remove .3s ease-in-out 0s normal;} - -@keyframes report-animation-fade-remove { -0% {opacity:1;} -100% {opacity:0;} -} - -@-webkit-keyframes report-animation-fade-remove { -0% {opacity:1;} -100% {opacity:0;} -} -/* Notiflix: Report content animation remove => fade off */ - -/* Notiflix: Report content animation remove => zoom on */ -[id^=NotiflixReportWrap].remove > div[class*="-content"].with-animation.nx-zoom { -opacity:0; -animation: report-animation-zoom-remove .3s ease-in-out 0s normal; --webkit-animation: report-animation-zoom-remove .3s ease-in-out 0s normal;} - -@keyframes report-animation-zoom-remove { -0% {opacity:1; transform:scale(1);} -50% {opacity:0.5; transform:scale(1.05);} -100% {opacity:0; transform:scale(0);} -} - -@-webkit-keyframes report-animation-zoom-remove { -0% {opacity:1; transform:scale(1);} -50% {opacity:0.5; transform:scale(1.05);} -100% {opacity:0; transform:scale(0);} -} -/* Notiflix: Report content animation remove => zoom off */ - - -/* Notiflix: Confirm wrap on */ -[id^=NotiflixConfirmWrap] { -position: fixed; -z-index: 4003; -width: 300px; -max-width:98%; -left: 10px; -right: 10px; -top: 10px; -margin:auto; -text-align: center; -box-sizing:border-box; -background:transparent; -font-family: "Quicksand", sans-serif;} - -[id^=NotiflixConfirmWrap] * { -box-sizing:border-box;} -/* Notiflix: Confirm wrap off */ - -/* Notiflix: Confirm content on */ -[id^=NotiflixConfirmWrap] > div[class*="-overlay"] { -width:100%; -height:100%; -left:0; -top:0; -background: rgba(255, 255, 255, .5); -position:fixed; -z-index:0;} - -[id^=NotiflixConfirmWrap] > div[class*="-content"] { -width:100%; -float:left; -border-radius: 25px; -padding:10px; -margin:0; -filter: drop-shadow(0 0 5px rgba(0,0,0,.1)); -background: #f8f8f8; -color:#1e1e1e; -position:relative; -z-index:1;} - -[id^=NotiflixConfirmWrap] > div[class*="-content"] > div[class*="-head"] { -float:left; -width:100%;} - -[id^=NotiflixConfirmWrap] > div[class*="-content"] > div[class*="-head"] > h5 { -float:left; -width:100%; -margin:0; -padding:0 0 10px; -border-bottom:1px solid rgba(0,0,0,0.1); -color: #32c682; -font-family:inherit !important; -font-size:16px; -line-height:1.4; -font-weight:500;} - -[id^=NotiflixConfirmWrap] > div[class*="-content"] > div[class*="-head"] > p { -font-family:inherit !important; -margin: 15px 0 20px; -padding: 0 10px; -float:left; -width:100%; -font-size: 14px; -line-height: 1.4; -color: inherit;} - -[id^=NotiflixConfirmWrap] > div[class*="-content"] > div[class*="-buttons"] { --webkit-user-select: none; --moz-user-select: none; --ms-user-select: none; -user-select: none; -border-radius:inherit; -float:left; -width:100%;} - -[id^=NotiflixConfirmWrap] > div[class*="-content"] > div[class*="-buttons"] > a { -cursor:pointer; -font-family:inherit !important; -transition:all .25s ease-in-out; -float: left; -width: 48%; -padding: 9px 5px; -border-radius:inherit !important; -font-weight: 500; -font-size: 15px; -line-height: 1.4; -color:#f8f8f8;} - -[id^=NotiflixConfirmWrap] > div[class*="-content"] > div[class*="-buttons"] > a.confirm-button-ok { -margin:0 2% 0 0; -background:#32c682;} - -[id^=NotiflixConfirmWrap] > div[class*="-content"] > div[class*="-buttons"] > a.confirm-button-cancel { -margin:0 0 0 2%; -background:#a9a9a9;} - -[id^=NotiflixConfirmWrap] > div[class*="-content"] > div[class*="-buttons"] > a.full { -margin:0; -width:100%;} - -[id^=NotiflixConfirmWrap] > div[class*="-content"] > div[class*="-buttons"] > a:hover { -box-shadow:inset 0 -60px 5px -5px rgba(0, 0, 0, 0.25);} -/* Notiflix: Confirm content off */ - -/* Notiflix: Confirm rtl on */ -[id^=NotiflixConfirmWrap].rtl-on > div[class*="-content"] > div[class*="-buttons"], -[id^=NotiflixConfirmWrap].rtl-on > div[class*="-content"] > div[class*="-buttons"] > a { -transform:rotateY(180deg);} -/* Notiflix: Confirm rtl off */ - -/* Notiflix: Confirm overlay animation => fade on */ -[id^=NotiflixConfirmWrap] > div[class*="-overlay"].with-animation { -animation: confirm-overlay-animation .3s ease-in-out 0s normal; --webkit-animation: confirm-overlay-animation .3s ease-in-out 0s normal;} - -@keyframes confirm-overlay-animation { -0% {opacity:0;} -100% {opacity:1;} -} - -@-webkit-keyframes confirm-overlay-animation { -0% {opacity:0;} -100% {opacity:1;} -} -/* Notiflix: Confirm overlay animation => fade off */ - -/* Notiflix: Confirm overlay animation remove => fade on */ -[id^=NotiflixConfirmWrap].remove > div[class*="-overlay"].with-animation { -opacity:0; -animation: confirm-overlay-animation-remove .3s ease-in-out 0s normal; --webkit-animation: confirm-overlay-animation-remove .3s ease-in-out 0s normal;} - -@keyframes confirm-overlay-animation-remove { -0% {opacity:1;} -100% {opacity:0;} -} - -@-webkit-keyframes confirm-overlay-animation-remove { -0% {opacity:1;} -100% {opacity:0;} -} -/* Notiflix: Confirm overlay animation remove => fade off */ - -/* Notiflix: Confirm content animation => fade on */ -[id^=NotiflixConfirmWrap].with-animation.nx-fade > div[class*="-content"] { -animation: confirm-animation-fade .3s ease-in-out 0s normal; --webkit-animation: confirm-animation-fade .3s ease-in-out 0s normal;} - -@keyframes confirm-animation-fade { -0% {opacity:0;} -100% {opacity:1;} -} - -@-webkit-keyframes confirm-animation-fade { -0% {opacity:0;} -100% {opacity:1;} -} -/* Notiflix: Confirm content animation => fade off */ - -/* Notiflix: Confirm content animation => zoom on */ -[id^=NotiflixConfirmWrap].with-animation.nx-zoom > div[class*="-content"] { -animation: confirm-animation-zoom .3s ease-in-out 0s normal; --webkit-animation: confirm-animation-zoom .3s ease-in-out 0s normal;} - -@keyframes confirm-animation-zoom { -0% {opacity:0; transform:scale(0.5);} -50% {opacity:1; transform:scale(1.05);} -100% {opacity:1; transform:scale(1);} -} - -@-webkit-keyframes confirm-animation-zoom { -0% {opacity:0; transform:scale(0.5);} -50% {opacity:1; transform:scale(1.05);} -100% {opacity:1; transform:scale(1);} -} -/* Notiflix: Confirm content animation => zoom off */ - -/* Notiflix: Confirm content animation remove => fade on */ -[id^=NotiflixConfirmWrap].with-animation.nx-fade.remove > div[class*="-content"] { -opacity:0; -animation: confirm-animation-fade-remove .3s ease-in-out 0s normal; --webkit-animation: confirm-animation-fade-remove .3s ease-in-out 0s normal;} - -@keyframes confirm-animation-fade-remove { -0% {opacity:1;} -100% {opacity:0;} -} - -@-webkit-keyframes confirm-animation-fade-remove { -0% {opacity:1;} -100% {opacity:0;} -} -/* Notiflix: Confirm content animation remove => fade off */ - -/* Notiflix: Confirm content animation remove => zoom on */ -[id^=NotiflixConfirmWrap].with-animation.nx-zoom.remove > div[class*="-content"] { -opacity:0; -animation: confirm-animation-zoom-remove .3s ease-in-out 0s normal; --webkit-animation: confirm-animation-zoom-remove .3s ease-in-out 0s normal;} - -@keyframes confirm-animation-zoom-remove { -0% {opacity:1; transform:scale(1);} -50% {opacity:0.5; transform:scale(1.05);} -100% {opacity:0; transform:scale(0);} -} - -@-webkit-keyframes confirm-animation-zoom-remove { -0% {opacity:1; transform:scale(1);} -50% {opacity:0.5; transform:scale(1.05);} -100% {opacity:0; transform:scale(0);} -} -/* Notiflix: Confirm content animation remove => zoom off */ - - -/* Notiflix: Loading wrap on */ -[id^=NotiflixLoadingWrap] { --webkit-user-select: none; --moz-user-select: none; --ms-user-select: none; -user-select: none; -position: fixed; -z-index: 4000; -width: 100%; -height: 100%; -left: 0; -top: 0; -right:0; -bottom:0; -margin:auto; -text-align: center; -box-sizing:border-box; -background: white!important; -font-family: "Quicksand", sans-serif;} - -[id^=NotiflixLoadingWrap] * { -box-sizing:border-box;} - -[id^=NotiflixLoadingWrap].click-to-close { -cursor:pointer;} -/* Notiflix: Loading wrap off */ - -/* Notiflix: Loading content on */ -[id^=NotiflixLoadingWrap] > div[class*="-icon"] { -width:60px; -height:60px; -position:fixed; -background-color: white!important; -transition:top .2s ease-in-out; -left: 0; -top: 0; -right:0; -bottom:0; -margin:auto;} - -[id^=NotiflixLoadingWrap] > div[class*="-icon"] img, -[id^=NotiflixLoadingWrap] > div[class*="-icon"] svg { -max-width:unset; -max-height:unset; -width: 100%; -height: 100%; -position:absolute; -left: 0; -top: 0;} - -[id^=NotiflixLoadingWrap] > div[class*="-icon"].with-message { -top:-42px;} - -[id^=NotiflixLoadingWrap] > p { -position: fixed; -left: 0; -right: 0; -top: 42px; -bottom: 0; -margin: auto; -font-family: inherit !important; -font-weight: 500; -line-height: 1.4; -padding: 0 10px; -width: 100%; -font-size:15px; -height: 18px;} -/* Notiflix: Loading content off */ - -/* Notiflix: Loading animation => fade on */ -[id^=NotiflixLoadingWrap].with-animation { -animation: loading-animation-fade .3s ease-in-out 0s normal; --webkit-animation: loading-animation-fade .3s ease-in-out 0s normal;} - -@keyframes loading-animation-fade { -0% {opacity:0;} -100% {opacity:1;} -} - -@-webkit-keyframes loading-animation-fade { -0% {opacity:0;} -100% {opacity:1;} -} -/* Notiflix: Loading animation => fade off */ - -/* Notiflix: Loading animation remove => fade on */ -[id^=NotiflixLoadingWrap].with-animation.remove { -opacity:0; -animation: loading-animation-fade-remove .3s ease-in-out 0s normal; --webkit-animation: loading-animation-fade-remove .3s ease-in-out 0s normal;} - -@keyframes loading-animation-fade-remove { -0% {opacity:1;} -100% {opacity:0;} -} - -@-webkit-keyframes loading-animation-fade-remove { -0% {opacity:1;} -100% {opacity:0;} -} -/* Notiflix: Loading animation remove => fade off */ - -/* Notiflix: Loading animation new message => fade on */ -[id^=NotiflixLoadingWrap] > p.new { -animation: loading-new-message-fade .3s ease-in-out 0s normal; --webkit-animation: loading-new-message-fade .3s ease-in-out 0s normal;} - -@keyframes loading-new-message-fade { -0% {opacity:0;} -100% {opacity:1;} -} - -@-webkit-keyframes loading-new-message-fade { -0% {opacity:0;} -100% {opacity:1;} -} -/* Notiflix: Loading animation new message => fade off */ - - -/* Notiflix: Block wrap on */ -[id^=NotiflixBlockWrap] { --webkit-user-select: none; --moz-user-select: none; --ms-user-select: none; -user-select: none; -box-sizing: border-box; -position: absolute; -z-index: 1000; -font-family: "Quicksand", sans-serif; -background: rgba(255, 255, 255, 0.9); -text-align: center; -animation-duration: 400ms; -width: 100%; -height: 100%; -left: 0; -top: 0; -border-radius: inherit;} - -[id^=NotiflixBlockWrap] * { -box-sizing: border-box;} -/* Notiflix: Block wrap off */ - -/* Notiflix: Block content on */ -[id^=NotiflixBlockWrap] > span[class*="-icon"] { -width: 45px; -height: 45px; -position: absolute; -left: 0; -top: 0; -right: 0; -bottom: 0; -margin: auto;} - -[id^=NotiflixBlockWrap] > span[class*="-message"] { -position: absolute; -left: 0; -right: 0; -top: 50px; -bottom: 0; -margin: auto; -font-family: inherit !important; -font-weight: 500; -font-size: 14px; -line-height: 1.4; -padding: 0 10px; -width: 100%; -height: 20px; -overflow: hidden;} -/* Notiflix: Block content off */ - -/* Notiflix: Block animation => fade on */ -[id^=NotiflixBlockWrap].with-animation { -animation: block-animation-fade .3s ease-in-out 0s normal; --webkit-animation: block-animation-fade .3s ease-in-out 0s normal;} - -@keyframes block-animation-fade { -0% {opacity: 0;} -100% {opacity: 1;} -} - -@-webkit-keyframes block-animation-fade { -0% {opacity: 0;} -100% {opacity: 1;} -} -/* Notiflix: Block animation => fade off */ - -/* Notiflix: Block animation remove => fade on */ -[id^=NotiflixBlockWrap].with-animation.remove { -opacity: 0; -animation: block-animation-fade-remove .3s ease-in-out 0s normal; --webkit-animation: block-animation-fade-remove .3s ease-in-out 0s normal;} - -@keyframes block-animation-fade-remove { -0% {opacity: 1;} -100% {opacity: 0;} -} - -@-webkit-keyframes block-animation-fade-remove { -0% {opacity: 1;} -100% {opacity: 0;} -} -/* Notiflix: Block animation remove => fade off */ - diff --git a/src/plugin/admin/public/component/pear/css/module/menu.css b/src/plugin/admin/public/component/pear/css/module/menu.css index a62b60d7..9c59c64b 100644 --- a/src/plugin/admin/public/component/pear/css/module/menu.css +++ b/src/plugin/admin/public/component/pear/css/module/menu.css @@ -1,7 +1,7 @@ .pear-nav-tree { - width: 230px; + width: 230px !important; border-radius: 0px; - background-color: #001529; + background-color: #28333E; } .pear-nav-tree .layui-nav-item>a { @@ -16,7 +16,7 @@ line-height: 48px; } -.pear-nav-tree .layui-nav-item>a .layui-nav-more { +.pear-nav-tree .layui-nav-item>a .layui-nav-more { padding: 0px; } @@ -24,7 +24,8 @@ width: 0px; height: 0px; } -.pear-side-scroll{ + +.pear-side-scroll { width: 230px; } @@ -33,7 +34,7 @@ .layui-nav-tree .layui-this, .layui-nav-tree .layui-this>a, .layui-nav-tree .layui-this>a:hover { - background-color: #5FB878; + background-color: var(--global-primary-color); } .pear-nav-tree .toast { @@ -100,7 +101,7 @@ font-size: 14px; } -.pear-nav-control.pc li{ +.pear-nav-control.pc li { display: inline-block; } @@ -112,15 +113,15 @@ background-color: whitesmoke; } -.pear-nav-control.pc *{ - color: darkslategray!important; +.pear-nav-control.pc * { + color: darkslategray !important; } -.pear-nav-control.pc .layui-nav-bar{ - display: none!important; +.pear-nav-control.pc .layui-nav-bar { + display: none !important; } -.pear-nav-control .layui-nav-child{ +.pear-nav-control .layui-nav-child { border: 1px solid whitesmoke; border-radius: 6px; width: 150px; @@ -134,6 +135,7 @@ display: block !important; background: transparent !important; } + .pear-nav-tree .layui-nav-hover:before { content: ''; position: absolute; @@ -143,70 +145,77 @@ top: 0; border-radius: 4px; overflow: hidden; - background-color: #001529; + background-color: #28333E; display: block; box-shadow: 0px 0px 3px lightgray; } + .pear-nav-tree .layui-nav-hover a span { display: inline-block !important; } + .pear-nav-tree .layui-nav-hover a i { display: none; } + .pear-nav-tree .layui-nav-child dd a span { margin-left: 26px !important; } + .pear-nav-tree .layui-nav-child dd a i { display: none; } + .pear-nav-tree .layui-nav-hover dd a span { margin-left: 0px !important; } + .pear-nav-tree dl { padding-top: 0; padding-bottom: 0; } + /** 亮 样 式*/ -.dark-theme .layui-nav-tree{ - background-color: #001529!important; +.dark-theme .layui-nav-tree { + background-color: #28333E !important; } -.light-theme{ - background-color: white!important; +.light-theme { + background-color: white !important; } .light-theme .pear-nav-tree, .light-theme .pear-nav-tree .layui-nav-hover:before, -.light-theme .pear-nav-tree .layui-nav-child{ - background-color: white!important; +.light-theme .pear-nav-tree .layui-nav-child { + background-color: white !important; } .light-theme .pear-nav-tree a, -.light-theme .pear-nav-tree .layui-nav-more{ - color: dimgray!important; +.light-theme .pear-nav-tree .layui-nav-more { + color: dimgray !important; border-top-color: dimgray; } -.light-theme .pear-nav-tree .layui-nav-itemed>a>.layui-nav-more{ - border-top-color: white!important; - border-bottom-color: dimgray!important; +.light-theme .pear-nav-tree .layui-nav-itemed>a>.layui-nav-more { + border-top-color: white !important; + border-bottom-color: dimgray !important; } .light-theme .pear-nav-tree .layui-this a, -.light-theme .pear-nav-tree .layui-this{ - color: white!important; - background-color: #5FB878!important; - +.light-theme .pear-nav-tree .layui-this { + color: white !important; + background-color: var(--global-primary-color) !important; + } -.light-theme .pear-nav-tree .layui-this a:hover{ - background-color: #5FB878!important; - +.light-theme .pear-nav-tree .layui-this a:hover { + background-color: var(--global-primary-color) !important; + } - -.light-theme .pear-nav-tree .layui-nav-bar{ + +.light-theme .pear-nav-tree .layui-nav-bar { display: none; - + } /** 下 拉 图 标 */ @@ -247,6 +256,7 @@ width: 12px; text-align: center; } + .pear-nav-tree.arrow .layui-nav-child.layui-nav-hover>dd>a>.layui-nav-more { display: inline-block !important; transform: rotate(270deg); @@ -264,20 +274,4 @@ content: '\e61a'; display: inline-block; vertical-align: middle; -} - -/* 显示子菜单图标并增加缩进 */ -.pear-nav-tree .layui-nav-child dd a i { - display: inline; - margin-left: 12px; - margin-right: 6px; -} -.pear-nav-tree .layui-nav-child dd a i[class=''] { - margin-right: 0; -} -.pear-nav-tree .layui-nav-child dd dl { - margin-left: 12px; -} -.pear-nav-tree .layui-nav-child dd a span { - margin-left: 0 !important; } \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/menuSearch.css b/src/plugin/admin/public/component/pear/css/module/menuSearch.css new file mode 100644 index 00000000..e4f5b54c --- /dev/null +++ b/src/plugin/admin/public/component/pear/css/module/menuSearch.css @@ -0,0 +1,90 @@ +/* 搜索面板 */ +.menu-search-content .layui-input { + padding-left: 30px; +} + +.menu-search-content .layui-input:focus { + border: 1px solid var(--global-primary-color)!important; + box-shadow: none; +} + +.menu-search-content { + display: flex; + flex-wrap: wrap; + justify-content: center; +} + +.menu-search-input-wrapper { + width: 100%; + padding: 15px 15px; +} + +.menu-search-no-data { + display: flex; + justify-content: center; + width: 100%; + height: 122px; + align-items: center; +} + +.menu-search-list { + width: 100%; + padding: 5px 15px; +} + +.menu-search-list li { + position: relative; + display: flex; + justify-content: space-between; + align-items: center; + flex-wrap: nowrap; + height: 50px; + margin-bottom: 8px; + padding: 0px 10px; + color: currentColor; + font-size: 14px; + border-radius: 4px; + box-shadow: 0 1px 3px #d4d9e1; + cursor: pointer; + background-color: #fff; +} + +.menu-search-list li.this, +.menu-search-list li:hover { + background-color: var(--global-primary-color); + color: white; +} +.menu-search-tips { + margin-bottom: 15px; + padding: 0 15px; + width: 100% +} + +.menu-search-tips>div { + display: flex; + align-items: center; + justify-content: flex-end; + font-size: 12px; +} + +.menu-search-tips .mr-1 { + margin-right: 4px; +} + +.menu-search-tips .mr-5 { + margin-right: 20px; +} + +.menu-search-tips .w-5 { + width: 14px; +} + +.menu-search-tips kbd { + line-height: 1.5; + border: 1px solid #e5e7eb; + font-size: 10px; + text-align: center; + padding: 2px 6px; + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace; + border-radius: 5px; +} \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/message.css b/src/plugin/admin/public/component/pear/css/module/message.css deleted file mode 100644 index 0a61d092..00000000 --- a/src/plugin/admin/public/component/pear/css/module/message.css +++ /dev/null @@ -1,133 +0,0 @@ -.pear-notice .layui-this { - color: #5FB878 !important; - font-weight: 500; -} - -.pear-notice { - box-shadow: 0 6px 16px -8px rgb(0 0 0 / 8%), 0 9px 28px 0 rgb(0 0 0 / 5%), 0 12px 48px 16px rgb(0 0 0 / 3%)!important; -} - -.pear-notice .layui-tab-title { - display: flex; - text-align: center; - border-right: 1px solid whitesmoke; -} - -.pear-notice .layui-tab-title li { - flex: 1; - text-align: center; - border-right: 1px solid whitesmoke; -} -/*排除最后一个 li 右边框*/ -.pear-notice .layui-tab-title li:last-child { - border-right: none; -} - -.pear-notice * { - color: dimgray !important; -} - -.pear-notice { - width: 360px !important; -} - -.pear-notice img { - margin-left: 8px; - width: 33px !important; - height: 33px !important; - border-radius: 50px; - margin-right: 15px; -} - -.pear-notice-item { - height: 45px !important; - line-height: 45px !important; - padding-right: 20px; - padding-left: 20px; - border-bottom: 1px solid whitesmoke; - padding-top: 10px; - padding-bottom: 15px; -} -.pear-notice-end { - float: right; - right: 10px; -} - -.pear-notice-item span{ - height: 40px; - line-height: 40px; -} - -/** 滚动条样式 */ -.pear-notice *::-webkit-scrollbar { - width: 0px; - height: 0px; -} - -.pear-notice *::-webkit-scrollbar-track { - background: white; - border-radius: 2px; -} - -.pear-notice *::-webkit-scrollbar-thumb { - background: #E6E6E6; - border-radius: 2px; -} - -.pear-notice *::-webkit-scrollbar-thumb:hover { - background: #E6E6E6; -} - -.pear-notice *::-webkit-scrollbar-corner { - background: #f6f6f6; -} -/** 增加 empty 样式 */ -.pear-empty { - font-size: 14px; - line-height: 1.5715; - min-height: 200px; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} -.pear-empty-normal { - margin: 32px 0; - color: #00000040; -} -.pear-empty-normal .pear-empty-image { - height: 40px; -} - -.pear-empty-image { - height: 100px; - margin-bottom: 8px; -} -.pear-empty-image svg { - height: 100%; - margin: auto; -} - -.pear-empty-img-simple-g { - stroke: #d9d9d9; -} -.pear-empty-img-default-g { - fill: #fff; -} -.pear-empty-img-simple-path { - fill: #fafafa; -} -.pear-empty-img-default-path-1 { - fill: #aeb8c2; -} -.pear-empty-img-default-path-2 { - fill: url(#linearGradient-1); -} -.pear-empty-img-default-path-3 { - fill: #f5f5f7; -} -.pear-empty-img-default-path-4, .pear-empty-img-default-path-5 { - fill: #dce0e6; -} - - diff --git a/src/plugin/admin/public/component/pear/css/module/messageCenter.css b/src/plugin/admin/public/component/pear/css/module/messageCenter.css new file mode 100644 index 00000000..0ab9ef3a --- /dev/null +++ b/src/plugin/admin/public/component/pear/css/module/messageCenter.css @@ -0,0 +1,39 @@ +.pear-message-center { + width: 360px; + height: 100%; +} + +.pear-message-center .layui-tab .layui-tab-title{ + display: flex; +} + +.pear-message-center .layui-tab .layui-tab-title .layui-this::after { + display: none; +} + +.pear-message-center .layui-tab .layui-tab-title li { + flex: 1; +} + +.pear-message-center .message-item img { + margin-left: 8px; + width: 33px !important; + height: 33px !important; + border-radius: 50px; + margin-right: 15px; +} + +.pear-message-center .message-item { + height: 64px !important; + line-height: 45px !important; + padding-right: 20px; + padding-left: 20px; + border-bottom: 1px solid whitesmoke; + padding-top: 10px; + padding-bottom: 15px; +} + +.pear-message-center .message-item .extra { + float: right; + right: 10px; +} \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/muti-upload.css b/src/plugin/admin/public/component/pear/css/module/muti-upload.css deleted file mode 100644 index 480991ef..00000000 --- a/src/plugin/admin/public/component/pear/css/module/muti-upload.css +++ /dev/null @@ -1,33 +0,0 @@ -.uploader-list .handle { - position: relative; - background-color: black; - color: white; - filter: alpha(Opacity=80); - -moz-opacity: 0.6; - opacity: 0.6; - text-align: right; - height: 20px; - margin-bottom: -20px; - display: none; -} - -.uploader-list .handle i { - display: grid; - place-items: center; - height: 20px; -} - -.uploader-list .handle i:hover { - cursor: pointer; -} - -.uploader-list .file-iteme { - margin: 12px 0 0 15px; - padding: 1px; - float: left; -} - -.uploader-list .file-iteme img{ - height: 128px; - width: 128px; -} \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/notice.css b/src/plugin/admin/public/component/pear/css/module/notice.css deleted file mode 100644 index 65c9feac..00000000 --- a/src/plugin/admin/public/component/pear/css/module/notice.css +++ /dev/null @@ -1,228 +0,0 @@ -.toast-title { - font-weight: bold; -} -.toast-message { - -ms-word-wrap: break-word; - word-wrap: break-word; -} -.toast-message a, -.toast-message label { - color: #FFFFFF; -} -.toast-message a:hover { - color: #CCCCCC; - text-decoration: none; -} -.toast-close-button { - position: relative; - right: -0.3em; - top: -0.3em; - float: right; - font-size: 20px; - font-weight: bold; - color: #FFFFFF; - -webkit-text-shadow: 0 1px 0 #ffffff; - text-shadow: 0 1px 0 #ffffff; - opacity: 0.8; - -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80); - filter: alpha(opacity=80); - line-height: 1; -} -.toast-close-button:hover, -.toast-close-button:focus { - color: #000000; - text-decoration: none; - cursor: pointer; - opacity: 0.4; - -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40); - filter: alpha(opacity=40); -} -.rtl .toast-close-button { - left: -0.3em; - float: left; - right: 0.3em; -} -/*Additional properties for button version - iOS requires the button element instead of an anchor tag. - If you want the anchor version, it requires `href="#"`.*/ -button.toast-close-button { - padding: 0; - cursor: pointer; - background: transparent; - border: 0; - -webkit-appearance: none; -} -.toast-top-center { - top: 0; - right: 0; - width: 100%; -} -.toast-bottom-center { - bottom: 0; - right: 0; - width: 100%; -} -.toast-top-full-width { - top: 0; - right: 0; - width: 100%; -} -.toast-bottom-full-width { - bottom: 0; - right: 0; - width: 100%; -} -.toast-top-left { - top: 12px; - left: 12px; -} -.toast-top-right { - top: 12px; - right: 12px; -} -.toast-bottom-right { - right: 12px; - bottom: 12px; -} -.toast-bottom-left { - bottom: 12px; - left: 12px; -} -#toast-container { - position: fixed; - z-index: 999999; - pointer-events: none; - /*overrides*/ -} -#toast-container * { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; -} -#toast-container > div { - position: relative; - pointer-events: auto; - overflow: hidden; - margin: 0 0 6px; - padding: 15px 15px 15px 50px; - width: 300px; - -moz-border-radius: 3px 3px 3px 3px; - -webkit-border-radius: 3px 3px 3px 3px; - border-radius: 3px 3px 3px 3px; - background-position: 15px center; - background-repeat: no-repeat; - -moz-box-shadow: 0 0 12px #999999; - -webkit-box-shadow: 0 0 12px #999999; - box-shadow: 0 0 12px #999999; - color: #FFFFFF; - opacity: 0.8; - -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80); - filter: alpha(opacity=80); -} -#toast-container > div.rtl { - direction: rtl; - padding: 15px 50px 15px 15px; - background-position: right 15px center; -} -#toast-container > div:hover { - -moz-box-shadow: 0 0 12px #000000; - -webkit-box-shadow: 0 0 12px #000000; - box-shadow: 0 0 12px #000000; - opacity: 1; - -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); - filter: alpha(opacity=100); - cursor: pointer; -} -#toast-container > .toast-info { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=") !important; -} -#toast-container > .toast-error { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHOSURBVEhLrZa/SgNBEMZzh0WKCClSCKaIYOED+AAKeQQLG8HWztLCImBrYadgIdY+gIKNYkBFSwu7CAoqCgkkoGBI/E28PdbLZmeDLgzZzcx83/zZ2SSXC1j9fr+I1Hq93g2yxH4iwM1vkoBWAdxCmpzTxfkN2RcyZNaHFIkSo10+8kgxkXIURV5HGxTmFuc75B2RfQkpxHG8aAgaAFa0tAHqYFfQ7Iwe2yhODk8+J4C7yAoRTWI3w/4klGRgR4lO7Rpn9+gvMyWp+uxFh8+H+ARlgN1nJuJuQAYvNkEnwGFck18Er4q3egEc/oO+mhLdKgRyhdNFiacC0rlOCbhNVz4H9FnAYgDBvU3QIioZlJFLJtsoHYRDfiZoUyIxqCtRpVlANq0EU4dApjrtgezPFad5S19Wgjkc0hNVnuF4HjVA6C7QrSIbylB+oZe3aHgBsqlNqKYH48jXyJKMuAbiyVJ8KzaB3eRc0pg9VwQ4niFryI68qiOi3AbjwdsfnAtk0bCjTLJKr6mrD9g8iq/S/B81hguOMlQTnVyG40wAcjnmgsCNESDrjme7wfftP4P7SP4N3CJZdvzoNyGq2c/HWOXJGsvVg+RA/k2MC/wN6I2YA2Pt8GkAAAAASUVORK5CYII=") !important; -} -#toast-container > .toast-success { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADsSURBVEhLY2AYBfQMgf///3P8+/evAIgvA/FsIF+BavYDDWMBGroaSMMBiE8VC7AZDrIFaMFnii3AZTjUgsUUWUDA8OdAH6iQbQEhw4HyGsPEcKBXBIC4ARhex4G4BsjmweU1soIFaGg/WtoFZRIZdEvIMhxkCCjXIVsATV6gFGACs4Rsw0EGgIIH3QJYJgHSARQZDrWAB+jawzgs+Q2UO49D7jnRSRGoEFRILcdmEMWGI0cm0JJ2QpYA1RDvcmzJEWhABhD/pqrL0S0CWuABKgnRki9lLseS7g2AlqwHWQSKH4oKLrILpRGhEQCw2LiRUIa4lwAAAABJRU5ErkJggg==") !important; -} -#toast-container > .toast-warning { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGYSURBVEhL5ZSvTsNQFMbXZGICMYGYmJhAQIJAICYQPAACiSDB8AiICQQJT4CqQEwgJvYASAQCiZiYmJhAIBATCARJy+9rTsldd8sKu1M0+dLb057v6/lbq/2rK0mS/TRNj9cWNAKPYIJII7gIxCcQ51cvqID+GIEX8ASG4B1bK5gIZFeQfoJdEXOfgX4QAQg7kH2A65yQ87lyxb27sggkAzAuFhbbg1K2kgCkB1bVwyIR9m2L7PRPIhDUIXgGtyKw575yz3lTNs6X4JXnjV+LKM/m3MydnTbtOKIjtz6VhCBq4vSm3ncdrD2lk0VgUXSVKjVDJXJzijW1RQdsU7F77He8u68koNZTz8Oz5yGa6J3H3lZ0xYgXBK2QymlWWA+RWnYhskLBv2vmE+hBMCtbA7KX5drWyRT/2JsqZ2IvfB9Y4bWDNMFbJRFmC9E74SoS0CqulwjkC0+5bpcV1CZ8NMej4pjy0U+doDQsGyo1hzVJttIjhQ7GnBtRFN1UarUlH8F3xict+HY07rEzoUGPlWcjRFRr4/gChZgc3ZL2d8oAAAAASUVORK5CYII=") !important; -} -#toast-container.toast-top-center > div, -#toast-container.toast-bottom-center > div { - width: 300px; - margin-left: auto; - margin-right: auto; -} -#toast-container.toast-top-full-width > div, -#toast-container.toast-bottom-full-width > div { - width: 96%; - margin-left: auto; - margin-right: auto; -} -.toast { - background-color: #030303; -} -.toast-success { - background-color: #51A351; -} -.toast-error { - background-color: #BD362F; -} -.toast-info { - background-color: #2F96B4; -} -.toast-warning { - background-color: #F89406; -} -.toast-progress { - position: absolute; - left: 0; - bottom: 0; - height: 4px; - background-color: #000000; - opacity: 0.4; - -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40); - filter: alpha(opacity=40); -} -/*Responsive Design*/ -@media all and (max-width: 240px) { - #toast-container > div { - padding: 8px 8px 8px 50px; - width: 11em; - } - #toast-container > div.rtl { - padding: 8px 50px 8px 8px; - } - #toast-container .toast-close-button { - right: -0.2em; - top: -0.2em; - } - #toast-container .rtl .toast-close-button { - left: -0.2em; - right: 0.2em; - } -} -@media all and (min-width: 241px) and (max-width: 480px) { - #toast-container > div { - padding: 8px 8px 8px 50px; - width: 18em; - } - #toast-container > div.rtl { - padding: 8px 50px 8px 8px; - } - #toast-container .toast-close-button { - right: -0.2em; - top: -0.2em; - } - #toast-container .rtl .toast-close-button { - left: -0.2em; - right: 0.2em; - } -} -@media all and (min-width: 481px) and (max-width: 768px) { - #toast-container > div { - padding: 15px 15px 15px 50px; - width: 25em; - } - #toast-container > div.rtl { - padding: 15px 50px 15px 15px; - } -} \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/nprogress.css b/src/plugin/admin/public/component/pear/css/module/nprogress.css index 24c5cf19..a78f1c94 100644 --- a/src/plugin/admin/public/component/pear/css/module/nprogress.css +++ b/src/plugin/admin/public/component/pear/css/module/nprogress.css @@ -4,7 +4,7 @@ } #nprogress .bar { - background: #29d; + background: var(--global-primary-color); position: fixed; z-index: 999999; @@ -22,7 +22,7 @@ right: 0px; width: 100px; height: 100%; - box-shadow: 0 0 10px #29d, 0 0 5px #29d; + box-shadow: 0 0 10px var(--global-primary-color), 0 0 5px var(--global-primary-color); opacity: 1.0; -webkit-transform: rotate(3deg) translate(0px, -4px); @@ -45,8 +45,8 @@ box-sizing: border-box; border: solid 2px transparent; - border-top-color: #29d; - border-left-color: #29d; + border-top-color: var(--global-primary-color); + border-left-color: var(--global-primary-color); border-radius: 50%; -webkit-animation: nprogress-spinner 400ms linear infinite; diff --git a/src/plugin/admin/public/component/pear/css/module/frame.css b/src/plugin/admin/public/component/pear/css/module/page.css similarity index 87% rename from src/plugin/admin/public/component/pear/css/module/frame.css rename to src/plugin/admin/public/component/pear/css/module/page.css index 09a1423f..2131056b 100644 --- a/src/plugin/admin/public/component/pear/css/module/frame.css +++ b/src/plugin/admin/public/component/pear/css/module/page.css @@ -1,11 +1,11 @@ -.pear-frame { +.pear-page { width: 100%; - height: 100%; position: relative; - overflow: hidden; + overflow-y: auto; + height: 100%; } -.pear-frame .dot { +.pear-page .dot { width: 5px; height: 24px; background-color: #5FB878; @@ -15,38 +15,34 @@ display: inline-block; } -.pear-frame .title { - position: absolute; - margin-top: 0px; - margin-left: 12px; - color: dimgray; - display: inline-block; - letter-spacing: 2px; -} - -.pear-frame .pear-frame-title { +.pear-page .pear-page-title { height: 40px; line-height: 40px; background-color: white; border: whitesmoke 1px solid; } -.pear-frame .pear-frame-content { +.pear-page .pear-page-content, +.pear-page .pear-page-content iframe { width: 100%; height: calc(100% - 0px) !important; } -.pear-frame-loading { +.pear-page .pear-page-content iframe { + height: calc(100% - 4px) !important; +} + +.pear-page-loading { position: absolute; display: none; width: 100%; height: calc(100% - 0px) !important; + background-color: #fff; top: 0px; z-index: 19; - background-color: #fff } -.pear-frame-loading.close { +.pear-page-loading.close { animation: close 1s; -webkit-animation: close 1s; animation-fill-mode: forwards; diff --git a/src/plugin/admin/public/component/pear/css/module/popover.min.css b/src/plugin/admin/public/component/pear/css/module/popover.min.css deleted file mode 100644 index 453a50fa..00000000 --- a/src/plugin/admin/public/component/pear/css/module/popover.min.css +++ /dev/null @@ -1 +0,0 @@ -.webui-popover-content{display:none}.webui-popover-rtl{direction:rtl;text-align:right}.webui-popover{position:absolute;top:0;left:0;z-index:9999;display:none;min-width:50px;min-height:32px;padding:1px;text-align:left;white-space:normal;background-color:#fff;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2)}.webui-popover.top,.webui-popover.top-left,.webui-popover.top-right{margin-top:-10px}.webui-popover.right,.webui-popover.right-top,.webui-popover.right-bottom{margin-left:10px}.webui-popover.bottom,.webui-popover.bottom-left,.webui-popover.bottom-right{margin-top:10px}.webui-popover.left,.webui-popover.left-top,.webui-popover.left-bottom{margin-left:-10px}.webui-popover.pop{-webkit-transform:scale(0.8);-o-transform:scale(0.8);transform:scale(0.8);-webkit-transition:transform .15s cubic-bezier(0.3,0,0,1.5);-o-transition:transform .15s cubic-bezier(0.3,0,0,1.5);transition:transform .15s cubic-bezier(0.3,0,0,1.5);opacity:0;filter:alpha(opacity=0)}.webui-popover.pop-out{-webkit-transition-property:"opacity,transform";-o-transition-property:"opacity,transform";transition-property:"opacity,transform";-webkit-transition:.15s linear;-o-transition:.15s linear;transition:.15s linear;opacity:0;filter:alpha(opacity=0)}.webui-popover.fade,.webui-popover.fade-out{-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear;opacity:0;filter:alpha(opacity=0)}.webui-popover.out{opacity:0;filter:alpha(opacity=0)}.webui-popover.in{-webkit-transform:none;-o-transform:none;transform:none;opacity:1;filter:alpha(opacity=100)}.webui-popover .webui-popover-content{padding:9px 14px;overflow:auto;display:block}.webui-popover .webui-popover-content>div:first-child{width:99%}.webui-popover-inner .close{font-family:arial;margin:8px 10px 0 0;float:right;font-size:16px;font-weight:700;line-height:16px;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20);text-decoration:none}.webui-popover-inner .close:hover,.webui-popover-inner .close:focus{opacity:.5;filter:alpha(opacity=50)}.webui-popover-inner .close:after{content:"\00D7";width:.8em;height:.8em;padding:4px;position:relative}.webui-popover-title{padding:8px 14px;margin:0;font-size:14px;font-weight:700;line-height:18px;background-color:#fff;border-bottom:1px solid #f2f2f2;border-radius:5px 5px 0 0}.webui-popover-content{padding:9px 14px;overflow:auto;display:none}.webui-popover-inverse{background-color:#333;color:#eee}.webui-popover-inverse .webui-popover-title{background:#333;border-bottom:1px solid #3b3b3b;color:#eee}.webui-no-padding .webui-popover-content{padding:0}.webui-no-padding .list-group-item{border-right:none;border-left:none}.webui-no-padding .list-group-item:first-child{border-top:0}.webui-no-padding .list-group-item:last-child{border-bottom:0}.webui-popover>.webui-arrow,.webui-popover>.webui-arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.webui-popover>.webui-arrow{border-width:11px}.webui-popover>.webui-arrow:after{border-width:10px;content:""}.webui-popover.top>.webui-arrow,.webui-popover.top-right>.webui-arrow,.webui-popover.top-left>.webui-arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.webui-popover.top>.webui-arrow:after,.webui-popover.top-right>.webui-arrow:after,.webui-popover.top-left>.webui-arrow:after{content:" ";bottom:1px;margin-left:-10px;border-top-color:#fff;border-bottom-width:0}.webui-popover.right>.webui-arrow,.webui-popover.right-top>.webui-arrow,.webui-popover.right-bottom>.webui-arrow{top:50%;left:-11px;margin-top:-11px;border-left-width:0;border-right-color:#999;border-right-color:rgba(0,0,0,.25)}.webui-popover.right>.webui-arrow:after,.webui-popover.right-top>.webui-arrow:after,.webui-popover.right-bottom>.webui-arrow:after{content:" ";left:1px;bottom:-10px;border-left-width:0;border-right-color:#fff}.webui-popover.bottom>.webui-arrow,.webui-popover.bottom-right>.webui-arrow,.webui-popover.bottom-left>.webui-arrow{top:-11px;left:50%;margin-left:-11px;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25);border-top-width:0}.webui-popover.bottom>.webui-arrow:after,.webui-popover.bottom-right>.webui-arrow:after,.webui-popover.bottom-left>.webui-arrow:after{content:" ";top:1px;margin-left:-10px;border-bottom-color:#fff;border-top-width:0}.webui-popover.left>.webui-arrow,.webui-popover.left-top>.webui-arrow,.webui-popover.left-bottom>.webui-arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.webui-popover.left>.webui-arrow:after,.webui-popover.left-top>.webui-arrow:after,.webui-popover.left-bottom>.webui-arrow:after{content:" ";right:1px;border-right-width:0;border-left-color:#fff;bottom:-10px}.webui-popover-inverse.top>.webui-arrow,.webui-popover-inverse.top-left>.webui-arrow,.webui-popover-inverse.top-right>.webui-arrow,.webui-popover-inverse.top>.webui-arrow:after,.webui-popover-inverse.top-left>.webui-arrow:after,.webui-popover-inverse.top-right>.webui-arrow:after{border-top-color:#333}.webui-popover-inverse.right>.webui-arrow,.webui-popover-inverse.right-top>.webui-arrow,.webui-popover-inverse.right-bottom>.webui-arrow,.webui-popover-inverse.right>.webui-arrow:after,.webui-popover-inverse.right-top>.webui-arrow:after,.webui-popover-inverse.right-bottom>.webui-arrow:after{border-right-color:#333}.webui-popover-inverse.bottom>.webui-arrow,.webui-popover-inverse.bottom-left>.webui-arrow,.webui-popover-inverse.bottom-right>.webui-arrow,.webui-popover-inverse.bottom>.webui-arrow:after,.webui-popover-inverse.bottom-left>.webui-arrow:after,.webui-popover-inverse.bottom-right>.webui-arrow:after{border-bottom-color:#333}.webui-popover-inverse.left>.webui-arrow,.webui-popover-inverse.left-top>.webui-arrow,.webui-popover-inverse.left-bottom>.webui-arrow,.webui-popover-inverse.left>.webui-arrow:after,.webui-popover-inverse.left-top>.webui-arrow:after,.webui-popover-inverse.left-bottom>.webui-arrow:after{border-left-color:#333}.webui-popover i.icon-refresh:before{content:""}.webui-popover i.icon-refresh{display:block;width:30px;height:30px;font-size:20px;top:50%;left:50%;position:absolute;margin-left:-15px;margin-right:-15px;background:url(../img/loading.gif) no-repeat}@-webkit-keyframes rotate{100%{-webkit-transform:rotate(360deg)}}@keyframes rotate{100%{transform:rotate(360deg)}}.webui-popover-backdrop{background-color:rgba(0,0,0,.65);width:100%;height:100%;position:fixed;top:0;left:0;z-index:9998}.webui-popover .dropdown-menu{display:block;position:relative;top:0;border:none;box-shadow:none;float:none} \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/select.css b/src/plugin/admin/public/component/pear/css/module/select.css deleted file mode 100644 index 53285a68..00000000 --- a/src/plugin/admin/public/component/pear/css/module/select.css +++ /dev/null @@ -1,822 +0,0 @@ -/* formSelects多选css */ -select[xm-select] { - display: none !important; -} - -.xm-select-parent * { - margin: 0; - padding: 0; - font-family: "Helvetica Neue", Helvetica, "PingFang SC", 微软雅黑, Tahoma, Arial, sans-serif; - box-sizing: initial; -} - -.xm-select-parent { - text-align: left; -} - -.xm-select-parent select { - display: none; -} - -.xm-select-parent .xm-select-title { - position: relative; - min-height: 36px; -} - -.xm-select-parent .xm-input { - cursor: pointer; - border-radius: 2px; - border-width: 1px; - border-style: solid; - border-color: #E6E6E6; - display: block; - width: 100%; - box-sizing: border-box; - background-color: #FFF; - height: 36px; - line-height: 1.3; - padding-left: 10px; - outline: 0 -} - -.xm-select-parent .xm-select-sj { - display: inline-block; - width: 0; - height: 0; - border-style: dashed; - border-color: transparent; - overflow: hidden; - position: absolute; - right: 10px; - top: 50%; - margin-top: -3px; - cursor: pointer; - border-width: 6px; - border-top-color: #C2C2C2; - border-top-style: solid; - transition: all .3s; - -webkit-transition: all .3s -} - -.xm-select-parent .xm-form-selected .xm-select-sj { - margin-top: -9px; - transform: rotate(180deg) -} - -.xm-select-parent .xm-form-select dl { - display: none; - position: absolute; - left: 0; - top: 42px; - padding: 5px 0; - z-index: 999; - 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; - animation-fill-mode: both; - -webkit-animation-name: layui-upbit; - animation-name: layui-upbit; - -webkit-animation-duration: .3s; - animation-duration: .3s; - -webkit-animation-fill-mode: both; - animation-fill-mode: both -} - -@-webkit-keyframes layui-upbit { - from { - -webkit-transform: translate3d(0, 30px, 0); - opacity: .3 - } - - to { - -webkit-transform: translate3d(0, 0, 0); - opacity: 1 - } -} - -@keyframes layui-upbit { - from { - transform: translate3d(0, 30px, 0); - opacity: .3 - } - - to { - transform: translate3d(0, 0, 0); - opacity: 1 - } -} - -.xm-select-parent .xm-form-selected dl { - display: block -} - -.xm-select-parent .xm-form-select dl dd, -.xm-select-parent .xm-form-select dl dt { - padding: 0 10px; - line-height: 36px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis -} - -.xm-select-parent .xm-form-select dl dd { - cursor: pointer; - height: 36px; -} - -.xm-select-parent .xm-form-select dl dd:hover { - background-color: #f2f2f2 -} - -.xm-select-parent .xm-form-select dl dt { - font-size: 12px; - color: #999 -} - -.layui-select-disabled .xm-dis-disabled { - border-color: #eee !important -} - -.xm-select-parent .xm-form-select dl .xm-select-tips { - padding-left: 10px !important; - color: #999; - font-size: 14px -} - -.xm-unselect { - -moz-user-select: none; - -webkit-user-select: none; - -ms-user-select: none -} - -.xm-form-checkbox { - position: relative; - display: block; - vertical-align: middle; - cursor: pointer; - font-size: 0; - -webkit-transition: .1s linear; - transition: .1s linear; - box-sizing: border-box; - height: auto !important; - line-height: normal !important; - border: none !important; - margin-right: 0; - padding-right: 0; - background: 0 0; -} - -.xm-form-checkbox>i { - color: #FFF; - font-size: 16px; - width: 16px; - height: 16px; - position: absolute; - top: 9px; - border: 1px solid #5FB878; - border-radius: 3px; - z-index: 2; -} - -.xm-form-checkbox:hover>i { - border-color: #5FB878; -} - -.xm-form-checkbox>span { - display: block; - position: relative; - padding: 0 15px 0 30px; - height: 100%; - font-size: 14px; - border-radius: 2px 0 0 2px; - background-color: #d2d2d2; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - background: 0 0; - color: #666; - line-height: 36px; -} - -.xm-select-parent dl { - width: 100%; -} - -.xm-select-parent dl dd { - position: relative; -} - -.xm-select-parent dl dd>i:not(.icon-sousuo) { - position: absolute; - right: 10px; - top: 0; - color: #AAAAAA; -} - -.xm-select-parent dl dd.xm-select-this div i { - border: none; - color: #5FB878; - font-size: 18px; -} - -.xm-select-parent dl dd.xm-select-this div i:after { - content: '\e613'; -} - -.xm-select-parent dl dd.xm-dis-disabled div i { - border-color: #C2C2C2; -} - -.xm-select-parent dl dd.xm-dis-disabled.xm-select-this div i { - color: #C2C2C2; -} - -.xm-select-radio div.xm-form-checkbox>i { - border-radius: 20px; -} - -.xm-select-parent dl.xm-select-radio dd.xm-select-this div i:after { - content: '\e62b'; -} - -.xm-dis-disabled, -.xm-dis-disabled:hover { - cursor: not-allowed !important -} - -.xm-form-select dl dd.xm-dis-disabled { - background-color: #fff !important -} - -.xm-form-select dl dd.xm-dis-disabled span { - color: #C2C2C2 -} - -.xm-form-select dl dd.xm-dis-disabled .xm-icon-yes { - border-color: #C2C2C2 -} - -.xm-select-parent { - position: relative; - -moz-user-select: none; - -ms-user-select: none; - -webkit-user-select: none -} - -.xm-select-parent .xm-select { - line-height: normal; - height: auto; - padding: 4px 10px 1px 10px; - overflow: hidden; - min-height: 36px; - left: 0; - z-index: 99; - position: absolute; - background: 0 0; - padding-right: 20px -} - -.xm-select-parent .xm-select:hover { - border-color: #C0C4CC -} - -.xm-select-parent .xm-select .xm-select-label { - display: inline-block; - margin: 0; - vertical-align: middle -} - -.xm-select-parent .xm-select-title div.xm-select-label>span { - position: relative; - padding: 2px 5px; - background-color: #5FB878; - border-radius: 2px; - color: #FFF; - display: inline-block; - line-height: 18px; - height: 18px; - margin: 2px 5px 2px 0; - cursor: initial; - user-select: none; - font-size: 14px; - padding-right: 25px; - -webkit-user-select: none; -} - -.xm-select-parent .xm-select-title div.xm-select-label>span i { - position: absolute; - margin-left: 8px; - font-size: 12px; - cursor: pointer; - line-height: 20px; -} - -.xm-select-parent .xm-select .xm-select-input { - border: none; - height: 28px; - background-color: transparent; - padding: 0; - vertical-align: middle; - display: inline-block; - width: 50px -} - -.xm-select-parent .xm-select--suffix input { - border: none -} - -.xm-form-selected .xm-select, -.xm-form-selected .xm-select:hover { - border-color: #67c23a !important -} - -.xm-select--suffix+div { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0 -} - -.xm-select-dis .xm-select--suffix+div { - z-index: 100; - cursor: no-drop !important; - opacity: .2; - background-color: #FFF; -} - -.xm-select-disabled, -.xm-select-disabled:hover { - color: #d2d2d2 !important; - cursor: not-allowed !important; - background-color: #fff -} - -.xm-select-none { - display: none; - margin: 5px 0; - text-align: center; -} - -.xm-select-none:hover { - background-color: #FFF !important -} - -.xm-select-empty { - display: block -} - -.xm-span-hide { - display: none !important; -} - -.layui-form-pane .xm-select, -.layui-form-pane .xm-select:hover { - border: none !important; - top: 0px -} - -.layui-form-pane .xm-select-title { - border: 1px solid #e6e6e6 !important -} - -.xm-select-hide { - display: none !important; -} - -div[xm-hg] .xm-select-label { - white-space: nowrap; - overflow: hidden; - position: absolute; - right: 30px; - left: 0; - padding-left: 10px; -} - -/* 颜色相关 */ -div[xm-select-skin] .xm-select-title div.xm-select-label>span { - border: 1px solid #67c23a -} - -div[xm-select-skin] .xm-select-title div.xm-select-label>span i:hover { - opacity: .8; - filter: alpha(opacity=80); - cursor: pointer -} - -div[xm-select-skin=default] .xm-select-title div.xm-select-label>span { - background-color: #F0F2F5; - color: #909399; - border: 1px solid #F0F2F5 -} - -div[xm-select-skin=default] .xm-select-title div.xm-select-label>span i { - color: #C0C4CC -} - -div[xm-select-skin=default] .xm-select-title div.xm-select-label>span i:before { - content: '\e60b'; - font-size: 16px; - margin-left: -3px; -} - -div[xm-select-skin=default] dl dd:not(.xm-dis-disabled) i { - border-color: #5FB878 -} - -div[xm-select-skin=default] dl dd.xm-select-this:not(.xm-dis-disabled) i { - color: #5FB878 -} - -div[xm-select-skin=default].xm-form-selected .xm-select, -div[xm-select-skin=default].xm-form-selected .xm-select:hover { - border-color: #C0C4CC!important -} - -div[xm-select-skin=primary] .xm-select-title div.xm-select-label>span { - background-color: #5FB878!important; - color: #FFF; - border: 1px solid #5FB878!important -} - -div[xm-select-skin=primary] .xm-select-title div.xm-select-label>span i { - background-color: #5FB878!important; - color: #FFF -} - -div[xm-select-skin=primary] dl dd:not(.xm-dis-disabled) i { - border-color: #5FB878!important -} - -div[xm-select-skin=primary] dl dd.xm-select-this:not(.xm-dis-disabled) i { - color: #5FB878!important -} - -div[xm-select-skin=primary].xm-form-selected .xm-select, -div[xm-select-skin=primary].xm-form-selected .xm-select:hover { - border-color: #5FB878!important -} - -div[xm-select-skin=normal] .xm-select-title div.xm-select-label>span { - background-color: #2D8CF0!important; - color: #FFF; - border: 1px solid #2D8CF0!important; -} - -div[xm-select-skin=normal] .xm-select-title div.xm-select-label>span i { - background-color: #2D8CF0!important; - color: #FFF -} - -div[xm-select-skin=normal] dl dd:not(.xm-dis-disabled) i { - border-color: #2D8CF0!important; -} - -div[xm-select-skin=normal] dl dd.xm-select-this:not(.xm-dis-disabled) i { - color:#2D8CF0 !important; -} - -div[xm-select-skin=normal].xm-form-selected .xm-select, -div[xm-select-skin=normal].xm-form-selected .xm-select:hover { - border-color:#2D8CF0!important; -} - -div[xm-select-skin=warm] .xm-select-title div.xm-select-label>span { - background-color: #e6a23c!important; - color: #FFF; - border: 1px solid #e6a23c!important; -} - -div[xm-select-skin=warm] .xm-select-title div.xm-select-label>span i { - background-color: #e6a23c!important; - color: #FFF -} - -div[xm-select-skin=warm] dl dd:not(.xm-dis-disabled) i { - border-color:#e6a23c!important -} - -div[xm-select-skin=warm] dl dd.xm-select-this:not(.xm-dis-disabled) i { - color:#e6a23c!important -} - -div[xm-select-skin=warm].xm-form-selected .xm-select, -div[xm-select-skin=warm].xm-form-selected .xm-select:hover { - border-color: #e6a23c!important -} - -div[xm-select-skin=danger] .xm-select-title div.xm-select-label>span { - background-color: #f56c6c!important; - color: #FFF; - border: 1px solid #f56c6c!important; -} - -div[xm-select-skin=danger] .xm-select-title div.xm-select-label>span i { - background-color:#f56c6c!important; - color: #FFF -} - -div[xm-select-skin=danger] dl dd:not(.xm-dis-disabled) i { - border-color: #f56c6c!important -} - -div[xm-select-skin=danger] dl dd.xm-select-this:not(.xm-dis-disabled) i { - color: #f56c6c!important -} - -div[xm-select-skin=danger].xm-form-selected .xm-select, -div[xm-select-skin=danger].xm-form-selected .xm-select:hover { - border-color: #f56c6c!important -} - - -/* 多选联动 */ -.xm-select-parent .layui-form-danger+.xm-select-title .xm-select { - border-color: #f56c6c!important -} - -.xm-select-linkage li { - padding: 10px 0px; - cursor: pointer; -} - -.xm-select-linkage li span { - padding-left: 20px; - padding-right: 30px; - display: inline-block; - height: 20px; - overflow: hidden; - text-overflow: ellipsis; -} - -.xm-select-linkage li.xm-select-this span { - border-left: 5px solid #009688; - color: #009688; - padding-left: 15px; -} - -.xm-select-linkage-group { - position: absolute; - left: 0; - top: 0; - right: 0; - bottom: 0; - overflow-x: hidden; - overflow-y: auto; -} - -.xm-select-linkage-group li:hover { - border-left: 1px solid #009688; -} - -.xm-select-linkage-group li:hover span { - padding-left: 19px; -} - -.xm-select-linkage-group li.xm-select-this:hover span { - padding-left: 15px; - border-left-width: 4px; -} - -.xm-select-linkage-group:nth-child(4n+1) { - background-color: #EFEFEF; - left: 0; -} - -.xm-select-linkage-group:nth-child(4n+1) li.xm-select-active { - background-color: #F5F5F5; -} - -.xm-select-linkage-group:nth-child(4n+2) { - background-color: #F5F5F5; - left: 100px; -} - -.xm-select-linkage-group:nth-child(4n+3) li.xm-select-active { - background-color: #FAFAFA; -} - -.xm-select-linkage-group:nth-child(4n+3) { - background-color: #FAFAFA; - left: 200px; -} - -.xm-select-linkage-group:nth-child(4n+3) li.xm-select-active { - background-color: #FFFFFF; -} - -.xm-select-linkage-group:nth-child(4n+4) { - background-color: #FFFFFF; - left: 300px; -} - -.xm-select-linkage-group:nth-child(4n+4) li.xm-select-active { - background-color: #EFEFEF; -} - -.xm-select-linkage li { - list-style: none; -} - -.xm-select-linkage-hide { - display: none; -} - -.xm-select-linkage-show { - display: block; -} - -div[xm-select-skin='default'] .xm-select-linkage li.xm-select-this span { - border-left-color: #5FB878; - color: #5FB878; -} - -div[xm-select-skin='default'] .xm-select-linkage-group li:hover { - border-left-color: #5FB878; -} - -div[xm-select-skin='primary'] .xm-select-linkage li.xm-select-this span { - border-left-color: #1E9FFF; - color: #1E9FFF; -} - -div[xm-select-skin='primary'] .xm-select-linkage-group li:hover { - border-left-color: #1E9FFF; -} - -div[xm-select-skin='normal'] .xm-select-linkage li.xm-select-this span { - border-left-color: #1E9FFF; - color: #1E9FFF; -} - -div[xm-select-skin='normal'] .xm-select-linkage-group li:hover { - border-left-color: #1E9FFF; -} - -div[xm-select-skin='warm'] .xm-select-linkage li.xm-select-this span { - border-left-color: #FFB800; - color: #FFB800; -} - -div[xm-select-skin='warm'] .xm-select-linkage-group li:hover { - border-left-color: #FFB800; -} - -div[xm-select-skin='danger'] .xm-select-linkage li.xm-select-this span { - border-left-color: #FF5722; - color: #FF5722; -} - -div[xm-select-skin='danger'] .xm-select-linkage-group li:hover { - border-left-color: #FF5722; -} - - -/* 快捷操作 */ -.xm-select-tips[style]:hover { - background-color: #FFF !important; -} - -.xm-select-parent dd>.xm-cz { - position: absolute; - top: 0px; - right: 10px; -} - -.xm-select-parent dd>.xm-cz-group { - margin-right: 30px; - border-right: 2px solid #ddd; - height: 16px; - margin-top: 10px; - line-height: 16px; - overflow: hidden; -} - -.xm-select-parent dd>.xm-cz-group .xm-cz { - display: inline-block; - margin-right: 30px; -} - -.xm-select-parent dd>.xm-cz-group .xm-cz i { - margin-right: 10px; -} - -.xm-select-parent dd>.xm-cz-group[show='name'] .xm-cz i { - display: none; -} - -.xm-select-parent dd>.xm-cz-group[show='icon'] .xm-cz span { - display: none; -} - -.xm-select-parent dd .xm-cz:hover { - color: #009688; -} - -div[xm-select-skin='default'] dd .xm-cz:hover { - color: #C0C4CC; -} - -div[xm-select-skin='primary'] dd .xm-cz:hover { - color: #009688; -} - -div[xm-select-skin='normal'] dd .xm-cz:hover { - color: #1E9FFF; -} - -div[xm-select-skin='warm'] dd .xm-cz:hover { - color: #FFB800; -} - -div[xm-select-skin='danger'] dd .xm-cz:hover { - color: #FF5722; -} - -.xm-select-tips .xm-input { - border: none; - border-bottom: 1px solid #E6E6E6; - padding-left: 27px; -} - -.xm-select-tips .icon-sousuo { - position: absolute; -} - -.xm-select-tips.xm-dl-input { - display: none; -} - -div[xm-select-search-type="1"] .xm-select-tips.xm-dl-input { - display: block; -} - -div[xm-select-search-type="1"] .xm-select .xm-select-input { - display: none !important; -} - -@font-face { - font-family: "xm-iconfont"; - src: url('//at.alicdn.com/t/font_792691_qxv28s6g1l9.eot?t=1534240067831'); - /* IE9*/ - src: url('//at.alicdn.com/t/font_792691_qxv28s6g1l9.eot?t=1534240067831#iefix') format('embedded-opentype'), - /* IE6-IE8 */ - url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAsYAAsAAAAAEQwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFY8ukovY21hcAAAAYAAAACrAAACPBtV6wxnbHlmAAACLAAABnEAAAmMovtEvWhlYWQAAAigAAAAMQAAADYSctBCaGhlYQAACNQAAAAgAAAAJAgBA69obXR4AAAI9AAAABsAAAAwMCX//WxvY2EAAAkQAAAAGgAAABoN8gwubWF4cAAACSwAAAAeAAAAIAEiAM9uYW1lAAAJTAAAAUUAAAJtPlT+fXBvc3QAAAqUAAAAhAAAALJ1LunfeJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2BkYWacwMDKwMHUyXSGgYGhH0IzvmYwYuRgYGBiYGVmwAoC0lxTGByeMbwwZ27438AQw9zMcAQozAiSAwDk4AxmeJzlks0JwzAMhZ8bN/1xD4GU0h2Se26BbJMJOkkn6KmTPbJF8mT5UGg3qMRn0EPIRs8A9gAq0YsIhDcCLF5SQ9YrnLMe8VB9RSMlMjCxYcueIyfOy7CuAFHU7lP9iqApt5L3ksBJbzlgZ9PVkXDUvbWa6x8T/i0u+XyWKtmmHW0NDI55yeRok2DjaKdg65jX7Bzzm71jXnN08vzJkQvg7Ng/WAYH9Qb3wzM/AHicjVVvbFzFEd/Zfbv7/vn9uXf33vl8Pt/dO99BHOzEZ9/DKTImRS0KjUoLDUFCjtpCMGkT1D9qldQmhkiUSv2G1BBB1VYqilGREOIDViWEGzttqkpI/cAXqyL5gFRALVIF+VCJe9fZd+fEpR/o6d3s7G9mZ2dmZ3aJIKR3h0ZYmVgkIjGZJV8mDxECtenOTDOu1UU+hJoD+TCqzcNMk2V8O5OCbDVRPgZhEt4JCNTZ/4HA3+DfuWIxl8pcFFErG3K7oD7fvev8UaMUmEu259lrRjBsfs6cLhYbRfzSbSjGRVAkfQYihUXsyPkHTVyyZDNmXzSHg3Tl+aPKxpJFqbWGdtLl8w8iYDxuDTQIx7yc1YCdIx7Jk3HSwbwQwGBcyMKZVtG0ZCuJxjFJBb+foMSfhJaPOSr4FYgwSwqIx2MHJALtAdBi/7xcSMJL+fxmmBS2guD61tZm96X02mgcj0J1NAaIR9UMmhXIV24FuLUC71+r1AEmK1AYrQHUK/Tly/m8MrOZz2+FSf7jzc3NK9XR9F2lVq+gmRp0r+HK9B+VJmR263Rgd7ALwR/FOFfx/FeJS0YxQh9drakgMJhaBVizkwgqWxLD6eQ0Qo8f7p44fJziSH9x+PjLZUO+/jZ9+K35X37ljn/Rv+yW4Ziuf2nl4PfS5/LrP47OHTsFJULYjf369UZAEBmSqEOSJmG4Me6LeznA0BFkcDoJlGynVzmH2vY21DhPr25v9DjvbfTp2TXG1s5mlK0q4S7lT++6obbRox/s6CHF2LMEsHvoFfSFQIKnKQMZJVFCD6WH0p0PVvvcRx8uph8eUks0jOFNtskOkpDsJ18k9+NqVRg3qqMCSSerjyRuYUi1/vFH7YIqikGVcD+ehFl/pqPSPKZ6DG6mHisljFhBFvU/PoRkSNd/JHO6Ja5JOXcfwIGJbm/igBq/hn8Kfb57YbYUxyX4cwkLKH1u4gD9GVSL6USxCjjCO2p8VdcvH9XRYIQWqUblu3pR/v2BvXMAc3tTmJiDAQ895B9NL0C9BFdKqqRKczDX/Whg7O1irVbcqZ8/sbfYBOZwihC+6wSDzszUf+dF7rRO1O+fKaDO+nXOr6+vf8L5J44Qe4UvnlyRntwrxMoKzpFdeRJBNb9dGyiur1+nE59R+uwi9M1G395jb9KP0bcK2YM9nJB5cojcS75OFskxclzdc+pW699z8iYbtf14BGKf77ruZNyXKC0e50OEBI+V/Aug5Dex/9WjJfipuqnS00gfybjXbNe1f762tXmRPp3Bdl/l6g5JXyqXR0bK8J3PR+jvwYs8/GBnTM+kr8FX4ZknwC16XtG9iH9QfNn1vDHPe2GAj3ieV3XdF2+IPdeteh62Ra+HfQrsKWKSBtlHSOBgM7KkKQBLWnZoq1mVwotCLRGhOtSkMzMuqq2ml3SqUehdnZtynbtPLB88/Dy9dDrYVzoy/MTT6Svnlpd/AHueon5wpnGsEae/PZm+d3Jp6SSUTy7R3xw4f9/B5RN3O+5t3VNncjm6Cnt+uLx8DpedGj4yvD84HceNxTcG6ku4VPmZ9n6nNdj95BHyB3IJKxBPsKm6rpn4QopmqzlFm1MwqdxO5rPGnIc7aSfCGg1Vqyo6nUlQhnh7WiFhXzgGhVC4qjPRki9xdGCc4zXeSWb9BG1ktlqz2Q5Y7S2sIJfivkpVKCCDpyCWdbQzECj76qMVqvyJ/LxyI2rTv1bTC25lSM9xAUJ4Lc+U0wXTsKXDmaA8tHX+hvDt4Wa9IHLcMUBz9VwpL4xi2aGasAPPKNUbbmD/2jAtk0uXY4eJx8zRgj9iAnVNt5X+BL5vlHTOaiOmG7g6+7ZBNUOaefNXuJF3u25RjVvBLeW8E4wV7ZJBpbAXXGnqrwgupWVTAKqZjq5HbW44fMguNJhgwmw8oOk8GCqE8F3GhLB0uS/UDVt4lgjtqGxK/rpwuaDAqKHZNuWmJjVKuWUxbpg2B9DtoRdN3TKF9B0hw4p41C5i3CI9w4civP3aQLlmLMK3wpJpaI7BvmlhPtH3nPWCKQAdE2hK9zyuUeAm921qCA2kvqY8N1yDMq4beJlG+4XQqHDCQnqPlJIyyN579S4tIGcRv/82BbFfK9SgnVHkZzMeaSQjqR5/fP5XF2Chh+sW0g0gn27snqXv3/bsszsfJbCAIiTdjRTVCBL6jV0K5D8H/8xVAAAAeJxjYGRgYADi16c/vIvnt/nKwM3CAALXZxxzhtH///23YVFhbgZyORiYQKIAm34OJQAAAHicY2BkYGBu+N/AEMOi/P/f//8sKgxAERTAAwCmuAa3eJxjYWBgYAFhRiiNFf//z6L8/x+IDQAkCQRQAAAAAAAAjAEAATgBfgGaAiACbgMMA2AEhATGAAB4nGNgZGBg4GE4DMQgwATEXEDIwPAfzGcAAB2tAfIAAHicZY9NTsMwEIVf+gekEqqoYIfkBWIBKP0Rq25YVGr3XXTfpk6bKokjx63UA3AejsAJOALcgDvwSCebNpbH37x5Y08A3OAHHo7fLfeRPVwyO3INF7gXrlN/EG6QX4SbaONVuEX9TdjHM6bCbXRheYPXuGL2hHdhDx18CNdwjU/hOvUv4Qb5W7iJO/wKt9Dx6sI+5l5XuI1HL/bHVi+cXqnlQcWhySKTOb+CmV7vkoWt0uqca1vEJlODoF9JU51pW91T7NdD5yIVWZOqCas6SYzKrdnq0AUb5/JRrxeJHoQm5Vhj/rbGAo5xBYUlDowxQhhkiMro6DtVZvSvsUPCXntWPc3ndFsU1P9zhQEC9M9cU7qy0nk6T4E9XxtSdXQrbsuelDSRXs1JErJCXta2VELqATZlV44RelzRiT8oZ0j/AAlabsgAAAB4nG2L3QqCQBCFZ9RWU7sOfAeh8IFi3N10EHYUG1p8+gSjqz44F+cPEjgo4T81Jphihic0mGOBZyyxwhovUCxKIe4ylthRuDqV+I22UcLQ6+QH4ubWdZZkU3m4o/0tUqtSvT33TPLits12fzc+zhRcvoquo0o281OLhcMw7Q+AD8sULE0=') format('woff'), - url('//at.alicdn.com/t/font_792691_qxv28s6g1l9.ttf?t=1534240067831') format('truetype'), - /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ - url('//at.alicdn.com/t/font_792691_qxv28s6g1l9.svg?t=1534240067831#iconfont') format('svg'); - /* iOS 4.1- */ -} - -.xm-iconfont { - font-family: "xm-iconfont" !important; - font-size: 16px; - font-style: normal; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -.icon-quanxuan:before { - content: "\e62c"; -} - -.icon-caidan:before { - content: "\e610"; -} - -.icon-fanxuan:before { - content: "\e837"; -} - -.icon-pifu:before { - content: "\e668"; -} - -.icon-qingkong:before { - content: "\e63e"; -} - -.icon-sousuo:before { - content: "\e600"; -} - -.icon-danx:before { - content: "\e62b"; -} - -.icon-duox:before { - content: "\e613"; -} - -.icon-close:before { - content: "\e601"; -} - -.icon-expand:before { - content: "\e641"; -} diff --git a/src/plugin/admin/public/component/pear/css/module/step.css b/src/plugin/admin/public/component/pear/css/module/step.css deleted file mode 100644 index da5bbce7..00000000 --- a/src/plugin/admin/public/component/pear/css/module/step.css +++ /dev/null @@ -1,88 +0,0 @@ -.lay-step { - font-size: 0; - margin: 0 auto; - max-width: 100%; - width: 60%; - padding-left: 15%; - -} - -.step-item { - display: inline-block; - line-height: 35px; - position: relative; - font-size: 15px; - vertical-align: top; -} - -.step-item-tail { - width: 100%; - padding: 0 10px; - position: absolute; - left: 0; - top: 13px; -} - -.step-item-tail i { - display: inline-block; - width: 100%; - height: 3px; - margin-top: 4px; - vertical-align: top; - background: #5FB878; - position: relative; -} - -.step-item-tail .step-item-tail-done { - /**background: #5FB878; */ - height: 3px; - margin-top: 4px; -} - -.step-item-head { - position: relative; - display: inline-block; - height: 35px; - width: 35px; - text-align: center; - vertical-align: top; - color: #5FB878; - border: 3px solid #5FB878; - border-radius: 50%; - background: #ffffff; -} - -.step-item-head.step-item-head-active { - background: #5FB878; - color: #ffffff; -} - -.step-item-main { - display: block; - position: relative; - margin-left: -50%; - margin-right: 50%; - padding-left: 26px; - text-align: center; -} - -.step-item-main-title { - font-weight: bolder; - color: #555555; -} - -.step-item-main-desc { - color: #aaaaaa; -} - -.step-item-main-time { - color: #aaaaaa; -} - -.lay-step + [carousel-item]:before { - display: none; -} - -.lay-step + [carousel-item] > * { - background-color: transparent; -} \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/tab.css b/src/plugin/admin/public/component/pear/css/module/tabPage.css similarity index 61% rename from src/plugin/admin/public/component/pear/css/module/tab.css rename to src/plugin/admin/public/component/pear/css/module/tabPage.css index 3161f3e4..3792a6bf 100644 --- a/src/plugin/admin/public/component/pear/css/module/tab.css +++ b/src/plugin/admin/public/component/pear/css/module/tabPage.css @@ -1,24 +1,26 @@ -.pear-tab { +.pear-tab-page { margin: 0px; overflow: hidden; height: 100% !important; } -.pear-tab .layui-tab-content { +.pear-tab-page .layui-tab-content { height: calc(100% - 42px) !important; } -.pear-tab .layui-tab-content .layui-tab-item { +.pear-tab-page .layui-tab-content .layui-tab-item { + overflow-y: auto; height: 100%; } -.pear-tab-menu{ - box-shadow: 0 2px 8px #f0f1f2!important; - border: 1px solid whitesmoke!important; +.pear-tab-page-menu{ + box-shadow: none; border-radius: 4px!important; + overflow: hidden; + box-shadow: 2px 0 6px rgba(0, 21, 41, .10); } -.pear-tab-menu .item{ +.pear-tab-page-menu .item{ height: 20px; padding-left: 18px; padding-top: 7px; @@ -28,135 +30,128 @@ line-height: 20px; cursor:pointer; } -.pear-tab-menu .item:hover{ - background: #36b368; +.pear-tab-page-menu .item:hover{ + background: var(--global-primary-color); color: white; } -.pear-tab .layui-tab-content { +.pear-tab-page .layui-tab-content { padding: 0px; } -.pear-tab .layui-tab-title { +.pear-tab-page > .layui-tab-title { border: none; border: 1px solid whitesmoke; background-color: white; } -.pear-tab .layui-tab-title li { +.pear-tab-page > .layui-tab-title li { border-right: 1px solid whitesmoke; color: dimgray; font-size: 13.5px; } -.pear-tab .layui-tab-title .layui-tab-bar { - display: none; -} - -.pear-tab .layui-tab-title .layui-this:after { +.pear-tab-page .layui-nav-more, +.pear-tab-page .layui-tab-title:after, +.pear-tab-page .layui-tab-control .layui-tab-tool, +.pear-tab-page .layui-tab-control .layui-tab-prev, +.pear-tab-page .layui-tab-control .layui-tab-next, +.pear-tab-page > .layui-tab-title .disable-close+.layui-tab-close, +.pear-tab-page > .layui-tab-title .layui-this:after, +.pear-tab-page > .layui-tab-title .layui-tab-bar { display: none; } -.pear-tab .layui-tab-title .pear-tab-active { +.pear-tab-page > .layui-tab-title .pear-tab-page-active { display: inline-block; background-color: lightgray; - width: 8px; - height: 8px; border-radius: 30px; margin-right: 12px; + height: 8px; + width: 8px; } -.pear-tab .layui-tab-title .layui-this .pear-tab-active { - background-color: #5FB878; +.pear-tab-page > .layui-tab-title .layui-this .pear-tab-page-active { + background-color: var(--global-primary-color) !important; } -.pear-tab .layui-tab-title .layui-tab-close:hover { +.pear-tab-page > .layui-tab-title .layui-tab-close:hover { background-color: white; line-height: 19px; color: gray; } -.pear-tab .layui-tab-title .disable-close+.layui-tab-close { - display: none; -} - -.pear-tab .layui-tab-title .able-close+.layui-tab-close { +.pear-tab-page > .layui-tab-title .able-close+.layui-tab-close { display: inline-block; } -.pear-tab .layui-tab-close{ +.pear-tab-page .layui-tab-close{ font-size: 13px; } -.pear-tab .layui-tab-control>li { +.pear-tab-page .layui-tab-control>li { position: absolute; top: 0px; height: 40px; line-height: 40px; width: 40px; - text-align: center; background-color: white; border-top: whitesmoke 1px solid; border-bottom: whitesmoke 1px solid; + text-align: center; } -.pear-tab .layui-tab-prev { +.pear-tab-page .layui-tab-prev { left: 0px; border-right: whitesmoke 1px solid; } -.pear-tab .layui-tab-next { +.pear-tab-page .layui-tab-next { right: 40px; border-left: 1px solid whitesmoke; } -.pear-tab .layui-tab-tool { +.pear-tab-page .layui-tab-tool { right: 0px; border-left: 1px solid whitesmoke; } -.pear-tab .layui-tab-control .layui-tab-tool, -.pear-tab .layui-tab-control .layui-tab-prev, -.pear-tab .layui-tab-control .layui-tab-next { - display: none; -} - -.pear-tab.layui-tab-roll .layui-tab-control .layui-tab-prev, -.pear-tab.layui-tab-roll .layui-tab-control .layui-tab-next { +.pear-tab-page.layui-tab-roll .layui-tab-control .layui-tab-prev, +.pear-tab-page.layui-tab-roll .layui-tab-control .layui-tab-next { display: block; } -.pear-tab.layui-tab-roll .layui-tab-control .layui-tab-next { +.pear-tab-page.layui-tab-roll .layui-tab-control .layui-tab-next { right: 0px; border-right: 1px solid whitesmoke; } -.pear-tab.layui-tab-roll .layui-tab-title { +.pear-tab-page.layui-tab-roll .layui-tab-title { padding-left: 40px; padding-right: 40px; } -.pear-tab.layui-tab-tool .layui-tab-control .layui-tab-tool { +.pear-tab-page.layui-tab-tool .layui-tab-control .layui-tab-tool { display: block; } -.pear-tab.layui-tab-tool .layui-tab-title { +.pear-tab-page.layui-tab-tool .layui-tab-title { padding-left: 0px; padding-right: 40px; } -.pear-tab.layui-tab-rollTool .layui-tab-title { +.pear-tab-page.layui-tab-rollTool > .layui-tab-title { padding-left: 40px; padding-right: 80px; } -.pear-tab.layui-tab-rollTool .layui-tab-control .layui-tab-prev, -.pear-tab.layui-tab-rollTool .layui-tab-control .layui-tab-next, -.pear-tab.layui-tab-rollTool .layui-tab-control .layui-tab-tool { +.pear-tab-page.layui-tab-rollTool .layui-tab-control .layui-tab-prev, +.pear-tab-page.layui-tab-rollTool .layui-tab-control .layui-tab-next, +.pear-tab-page.layui-tab-rollTool .layui-tab-control .layui-tab-tool { display: block; } -.pear-tab .layui-tab-tool .layui-nav { +.pear-tab-page .layui-tab-tool .layui-nav { position: absolute; height: 43px !important; top: 0; @@ -166,15 +161,15 @@ background: 0 0; } -.pear-tab .layui-tab-tool .layui-nav-item { +.pear-tab-page .layui-tab-tool .layui-nav-item { height: 40px; } -.pear-tab .layui-tab-tool .layui-nav-bar { +.pear-tab-page .layui-tab-tool .layui-nav-bar { display: none; } -.pear-tab .layui-tab-tool .layui-nav-child { +.pear-tab-page .layui-tab-tool .layui-nav-child { left: auto; top: 45px; right: 3px; @@ -182,11 +177,11 @@ border: 1px solid whitesmoke; } -.pear-tab .layui-tab-tool .layui-this a { +.pear-tab-page .layui-tab-tool .layui-this a { background-color: #009688; } -.pear-tab-loading { +.pear-tab-page-loading { position: absolute; display: none; width: 100%; @@ -196,7 +191,7 @@ background-color: #fff } -.pear-tab-loading.close { +.pear-tab-page-loading.close { animation: close 1s; -webkit-animation: close 1s; animation-fill-mode: forwards; @@ -213,7 +208,7 @@ .ball-loader>span, .signal-loader>span { - background-color: #4aca85 !important; + background-color: var(--global-primary-color) !important; display: inline-block } diff --git a/src/plugin/admin/public/component/pear/css/module/table.css b/src/plugin/admin/public/component/pear/css/module/table.css deleted file mode 100644 index c4f5d4ca..00000000 --- a/src/plugin/admin/public/component/pear/css/module/table.css +++ /dev/null @@ -1,108 +0,0 @@ -.layui-table-tool-panel { - margin-top: 10px !important; -} - -.layui-table-tool { - background-color: white !important; - border-bottom: none !important; - padding-bottom: 10px !important; -} - -.layui-table-header, -.layui-table-header th { - background-color: white !important; -} - -.layui-table-view { - border: none !important; -} - -/** 兼容 layui 2.7.0 升级 table cell 单元格边距的调整 */ -.layui-table-view .layui-table td, .layui-table-view .layui-table th { - padding: 5px 0px; -} - -.layui-table-cell { - height: 34px; - line-height: 34px; -} - -.layui-table .layui-laypage .layui-laypage-curr .layui-laypage-em { - border-radius: 50px !important; - border-radius: 4px!important; - background-color: #5FB878 !important; -} - -.layui-table-view .layui-table{ - width: 100%; -} - -.layui-table tr { - height: 34px; - line-height: 34px; -} - -.layui-table-cell { - padding-top: 1px !important; -} - -.layui-table-box * { - font-size: 13px !important; -} - -.layui-table-page .layui-laypage input { - width: 40px; - height: 26.5px!important; -} - -.layui-table-box button { - font-size: 15px !important; -} - -.layui-table-page { - height: 45px !important; - padding-top: 10px !important; -} - -.layui-table-tool .layui-inline { - border-radius: 3px !important; - width: 30px !important; - height: 30px !important; - line-height: 20px !important; -} - -.layui-table-view .layui-table[lay-skin=line] { - border: none !important; -} - -.layui-table-init .layui-icon{ - font-size: 40px !important; - margin: -15px 0 0 -15px; -} - -.layui-table-body::-webkit-scrollbar { - width: 0px; - height: 0px; -} - -.layui-table-body::-webkit-scrollbar { - width: 6px; - height: 6px; -} -.layui-table-body::-webkit-scrollbar-track { - background: white; - border-radius: 2px; -} - -.layui-table-body::-webkit-scrollbar-thumb { - background: #E6E6E6; - border-radius: 2px; -} - -.layui-table-body::-webkit-scrollbar-thumb:hover { - background: #E6E6E6; -} - -.layui-table-body::-webkit-scrollbar-corner { - background: #f6f6f6; -} diff --git a/src/plugin/admin/public/component/pear/css/module/tag.css b/src/plugin/admin/public/component/pear/css/module/tag.css deleted file mode 100644 index 7c244bc2..00000000 --- a/src/plugin/admin/public/component/pear/css/module/tag.css +++ /dev/null @@ -1,85 +0,0 @@ -.input-new-tag { - width: 90px; -} - -.input-new-tag input { - height: 100%!important; - border: none; - padding-left: 0px; -} - -.tag .layui-btn .tag-close:hover { - border-radius: 2px; - color: #fff; -} - -.tag .layui-btn .tag-close { - margin-left: 8px; - transition: all .2s; - -webkit-transition: all .2s; -} -.tag-item { - background-color: #5FB878; - color: white; - border: none; -} - -.tag-item:hover { - - color: white; - -} -.tag-item-normal { - background-color: #5FB878; - color: white; - border: none; -} - -.tag-item-warm { - background-color: #f6ad55; - color: white; - border: none; -} - -.tag-item-danger { - background-color: #f56c6c; - color: white; - border: none; -} - -.tag-item-dark { - background-color: #525252; - color: white; - border: none; -} - -.tag-item-primary { - background-color: white !important; - color: dimgray; - border: 1px solid dimgray; -} - -.tag-item-normal:hover { - - color: white !important; -} - -.tag-item-warm:hover { - - color: white; -} - -.tag-item-danger:hover { - - color: white; -} - -.tag-item-dark:hover { - - color: white; -} - -.tag-item-primary:hover { - color: dimgray; - border: 1px solid dimgray; -} \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/css/module/topBar.css b/src/plugin/admin/public/component/pear/css/module/topBar.css deleted file mode 100644 index c3d5beca..00000000 --- a/src/plugin/admin/public/component/pear/css/module/topBar.css +++ /dev/null @@ -1,5 +0,0 @@ -.layui-fixbar li { - border-radius: 4px; - background-color: #5FB878; - color: white; -} diff --git a/src/plugin/admin/public/component/pear/css/module/treetable.css b/src/plugin/admin/public/component/pear/css/module/treetable.css deleted file mode 100644 index da849b89..00000000 --- a/src/plugin/admin/public/component/pear/css/module/treetable.css +++ /dev/null @@ -1,25 +0,0 @@ -.treeTable-icon i:last-child{ - display: none!important; -} - -.treeTable-empty{ - margin-left: -3px; -} -.treeTable-empty { - width: 20px; - display: inline-block; -} - -.treeTable-icon { - cursor: pointer; -} - -.treeTable-icon .layui-icon-triangle-d:before { - content: "\e623"; -} - -.treeTable-icon.open .layui-icon-triangle-d:before { - content: "\e625"; - background-color: transparent; -} - diff --git a/src/plugin/admin/public/component/pear/css/pear.css b/src/plugin/admin/public/component/pear/css/pear.css index 24128c61..62b55bf3 100644 --- a/src/plugin/admin/public/component/pear/css/pear.css +++ b/src/plugin/admin/public/component/pear/css/pear.css @@ -1,31 +1,10 @@ @import url("../../layui/css/layui.css"); @import url("../font/iconfont.css"); - -@import url("module/dtree/font/dtreefont.css"); -@import url("module/dtree/dtree.css"); -@import url("module/iconPicker.css"); -@import url("module/treetable.css"); @import url("module/nprogress.css"); -@import url("module/message.css"); -@import url("module/cropper.css"); -@import url("module/loading.css"); -@import url("module/topBar.css"); -@import url("module/select.css"); -@import url("module/layout.css"); -@import url("module/notice.css"); -@import url("module/button.css"); -/*@import url("module/table.css");//变更*/ -@import url("module/frame.css"); -@import url("module/layer.css"); -@import url("module/toast.css"); +@import url("module/messageCenter.css"); +@import url("module/global.css"); @import url("module/menu.css"); -@import url("module/form.css"); -@import url("module/link.css"); -@import url("module/code.css"); -@import url("module/step.css"); -@import url("module/card.css"); -@import url("module/tab.css"); -@import url("module/tag.css"); -@import url("module/fullscreen.css"); -@import url("module/popover.min.css"); -@import url("module/muti-upload.css"); \ No newline at end of file +@import url("module/menuSearch.css"); +@import url("module/page.css"); +@import url("module/tabPage.css"); +@import url("module/toast.css"); \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/module/admin.js b/src/plugin/admin/public/component/pear/module/admin.js index 33d600c0..e6a44a19 100644 --- a/src/plugin/admin/public/component/pear/module/admin.js +++ b/src/plugin/admin/public/component/pear/module/admin.js @@ -1,184 +1,314 @@ -layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'menu', 'frame', 'theme', 'convert','fullscreen'], - function(exports) { +layui.define(['jquery', 'tools', 'element', 'yaml', 'form', 'tabPage', 'menu', 'page', 'fullscreen', 'messageCenter', 'menuSearch'], + function (exports) { "use strict"; var $ = layui.jquery, form = layui.form, - element = layui.element, yaml = layui.yaml, - pearTab = layui.tab, - convert = layui.convert, - pearMenu = layui.menu, - pearFrame = layui.frame, - pearTheme = layui.theme, - message = layui.message, - fullscreen=layui.fullscreen; - - var bodyFrame; - var sideMenu; - var bodyTab; - var config; - var logout = function() {}; - var msgInstance; - var body = $('body'); + page = layui.page, + menu = layui.menu, + tabPage = layui.tabPage, + messageCenter = layui.messageCenter, + menuSearch = layui.menuSearch, + fullscreen = layui.fullscreen, + tools = layui.tools; - var pearAdmin = new function() { + var configurationCache; - var configType = 'yml'; - var configPath = 'pear.config.yml'; + var logout = function () { }; - this.setConfigPath = function(path) { - configPath = path; - } + var body = $('body'); - this.setConfigType = function(type) { - configType = type; + var pearAdmin = new function () { + + this.configuration = {}; + + this.configurationPath = "pear.config.yml"; + + this.instances = {}; + + /** + * @since Pear Admin 4.0 + * + * 获取 pear.config 实现 [ default ] + */ + this.configurationProvider = () => { + return new Promise((resolve) => { + if (this.configurationPath.indexOf("yml") == -1) { + $.ajax({ + type: 'get', + url: this.configurationPath, + dataType: 'json', + async: false, + success: (result) => { + resolve(result); + } + }); + } else { + resolve(yaml.load(this.configurationPath)); + } + }) } - this.render = function(initConfig) { - if (initConfig !== undefined) { - applyConfig(initConfig); + /** + * @since Pear Admin 4.0 + * + * 配置 pear.config 路径 + */ + this.setConfigurationPath = (path) => { + this.configurationPath = path; + } + + /** + * @since Pear Admin 4.0 + * + * 获取 pear.config 实现 [ implement ] + */ + this.setConfigurationProvider = (provider) => { + this.configurationProvider = provider; + } + + /** + * @since Pear Admin 4.0 + * + * 获取 pear.config 配置 + */ + this.getConfiguration = () => { + return this.configuration; + } + + /** + * @since Pear Admin 4.0 + * + * Core Function. + * + * @param {*} options + */ + this.render = (options) => { + if (options !== undefined) { + pearAdmin.apply(options); } else { - applyConfig(pearAdmin.readConfig()); + this.configurationProvider().then((result) => { + pearAdmin.apply(result); + }) } } - 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; + /** + * @since Pear Admin 4.0 + * + * 启动构建 + */ + this.apply = function (configuration) { + configurationCache = configuration; + pearAdmin.logoRender(configuration); + pearAdmin.menuRender(configuration); + pearAdmin.menuSearchRender(configuration); + pearAdmin.bodyRender(configuration); + pearAdmin.messageCenterRender(configuration); + pearAdmin.themeRender(configuration); + pearAdmin.keepLoad(configuration); + window.PearAdmin = pearAdmin; + } + + /** + * @since Pear Admin 4.0 + * + * 菜单搜索 + */ + this.menuSearchRender = function (options) { + menuSearch.render({ + elem: ".menuSearch", + dataProvider: () => pearAdmin.instances.menu.cache(), + select: (node) => { + if (node.type == "1") { + pearAdmin.instances.menu.selectItem(node.id); + if (node.openType === "_layer") { + layer.open({ + type: 2, + title: data.title, + content: data.url, + area: ['80%', '80%'], + maxmin: true + }) + } else { + if (isMuiltTab(options) === "true" || + isMuiltTab(options) === true) { + pearAdmin.instances.tabPage.changePage({ + id: node.id, + title: node.title, + type: node.openType, + url: node.url, + close: true + }); + } else { + pearAdmin.instances.page.changePage({ + href: node.url, + type: node.openType + }); + } + } } - }) - return data; - } + } + }) } - this.messageRender = function(option) { - var option = { + /** + * @since Pear Admin 4.0 + * + * 消息中心 + */ + this.messageCenterRender = function (options) { + messageCenter.render({ elem: '.message', - url: option.header.message, + url: options.header.message, height: '250px' - }; - msgInstance = message.render(option); + }); } - this.logoRender = function(param) { + this.logoRender = function (param) { $(".layui-logo .logo").attr("src", param.logo.image); $(".layui-logo .title").html(param.logo.title); - $("title").html(param.logo.title); //变更 } - this.menuRender = function(param) { - sideMenu = pearMenu.render({ - elem: 'sideMenu', - async: param.menu.async !== undefined ? param.menu.async : true, - theme: "dark-theme", - height: '100%', + /** + * @since Pear Admin 4.0 + * + * 侧边菜单 + */ + this.menuRender = function (param) { + pearAdmin.instances.menu = menu.render({ + elem: 'side', + async: param.menu.async, method: param.menu.method, - control: isControl(param) === 'true' || isControl(param) === true ? 'control' : false, // control + control: isControl(param) === 'true' || isControl(param) === true ? 'control' : false, controlWidth: param.menu.controlWidth, - defaultMenu: 0, accordion: param.menu.accordion, - url: param.menu.data, data: param.menu.data, + url: param.menu.data, parseData: false, - change: function() { + defaultMenu: 0, + change: function () { compatible(); }, - done: function() { - sideMenu.isCollapse = param.menu.collapse; - sideMenu.selectItem(param.menu.select); - pearAdmin.collapse(param); + done: function () { + pearAdmin.instances.menu.isCollapse = param.menu.collapse; + pearAdmin.instances.menu.selectItem(param.menu.select); + if (param.menu.collapse) { + if ($(window).width() >= 768) { + collapse() + } + } } }); } - this.bodyRender = function(param) { + /** + * @since Pear Admin 4.0 + * + * 视图容器 + */ + this.bodyRender = function (param) { - body.on("click", ".refresh", function() { - refresh(); + body.on("click", ".refresh", function () { + pearAdmin.refresh(); }) if (isMuiltTab(param) === "true" || isMuiltTab(param) === true) { - bodyTab = pearTab.render({ + + pearAdmin.instances.tabPage = tabPage.render({ elem: 'content', - roll: true, - tool: true, - width: '100%', - height: '100%', session: param.tab.session, index: 0, tabMax: param.tab.max, preload: param.tab.preload, - closeEvent: function(id) { - sideMenu.selectItem(id); + closeEvent: function (id) { + pearAdmin.instances.menu.selectItem(id); }, data: [{ id: param.tab.index.id, url: param.tab.index.href, title: param.tab.index.title, + type: '_iframe', close: false }], - success: function(id) { + success: function (id) { if (param.tab.session) { - setTimeout(function() { - sideMenu.selectItem(id); - bodyTab.positionTab(); + setTimeout(function () { + pearAdmin.instances.menu.selectItem(id); + pearAdmin.instances.tabPage.positionTab(); }, 500) } } }); - bodyTab.click(function(id) { + pearAdmin.instances.tabPage.click(function (id) { if (!param.tab.keepState) { - bodyTab.refresh(false); + pearAdmin.instances.tabPage.refresh(false); } - bodyTab.positionTab(); - sideMenu.selectItem(id); + pearAdmin.instances.tabPage.positionTab(); + pearAdmin.instances.menu.selectItem(id); }) - sideMenu.click(function(dom, data) { - bodyTab.addTabOnly({ - id: data.menuId, - title: data.menuTitle, - url: data.menuUrl, - icon: data.menuIcon, - close: true - }, 300); + pearAdmin.instances.menu.click(function (dom, data) { + if (data.menuOpenType === "_layer") { + layer.open({ type: 2, title: data.menuTitle, content: data.menuUrl, area: ['80%', '80%'], maxmin: true }) + } else { + pearAdmin.instances.tabPage.changePage({ + id: data.menuId, + title: data.menuTitle, + type: data.menuOpenType, + url: data.menuUrl, + close: true + }); + } compatible(); }) + } else { - bodyFrame = pearFrame.render({ + + pearAdmin.instances.page = page.render({ elem: 'content', title: '首页', url: param.tab.index.href, - width: '100%', - height: '100%' + type: '_iframe', }); - sideMenu.click(function(dom, data) { - bodyFrame.changePage(data.menuUrl, true); + pearAdmin.instances.menu.click(function (dom, data) { + if (data.menuOpenType === "_layer") { + layer.open({ type: 2, title: data.menuTitle, content: data.menuUrl, area: ['80%', '80%'], maxmin: true }) + } else { + pearAdmin.instances.page.changePage({ href: data.menuUrl, type: data.menuOpenType }); + } compatible() }) } } - this.keepLoad = function(param) { + this.keepLoad = function (param) { compatible() - setTimeout(function() { - $(".loader-main").fadeOut(200); + setTimeout(function () { + $(".loader-wrapper").fadeOut(200); }, param.other.keepLoad) } - this.themeRender = function(option) { + /*** + * @since Pear Admin 4.0 + * + * 切换主题色 + */ + this.changeTheme = function () { + const variableKey = "--global-primary-color"; + const variableVal = localStorage.getItem("theme-color-color"); + document.documentElement.style.setProperty(variableKey, variableVal); + } + + /** + * @since Pear Admin 4.0 + * + * 主题配置 + */ + this.themeRender = function (option) { if (option.theme.allowCustom === false) { $(".setting").remove(); } @@ -187,7 +317,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm localStorage.setItem("theme-color", currentColor.id); localStorage.setItem("theme-color-color", currentColor.color); localStorage.setItem("theme-color-second", currentColor.second); - pearTheme.changeTheme(window, isAutoHead(config)); + pearAdmin.changeTheme(); var menu = localStorage.getItem("theme-menu"); if (menu === null) { @@ -244,40 +374,51 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm } var footer = localStorage.getItem("footer"); - if( footer === null) { + if (footer === null) { footer = option.other.footer; - }else{ + } else { if (option.theme.allowCustom === false) { footer = option.other.footer; } } + var dark = localStorage.getItem("dark"); + if (dark === null) { + dark = option.theme.dark; + } else { + if (option.theme.allowCustom === false) { + dark = option.theme.dark; + } + } + localStorage.setItem("muilt-tab", muiltTab); localStorage.setItem("theme-banner", banner); localStorage.setItem("theme-menu", menu); + localStorage.setItem("footer", footer); + localStorage.setItem("control", control); localStorage.setItem("theme-header", header); localStorage.setItem("auto-head", autoHead); - localStorage.setItem("control", control); - localStorage.setItem("footer", footer); + localStorage.setItem("dark", dark); this.menuSkin(menu); this.headerSkin(header); this.bannerSkin(banner); + this.switchTheme(dark); this.footer(footer); } - this.footer = function(footer){ + this.footer = function (footer) { var bodyDOM = $(".pear-admin .layui-body"); var footerDOM = $(".pear-admin .layui-footer"); if (footer === true || footer === "true") { footerDOM.removeClass("close"); - bodyDOM.css("bottom", footerDOM.outerHeight()); + bodyDOM.css("height", "calc(100% - 105px)"); } else { footerDOM.addClass("close"); - bodyDOM.css("bottom", ""); + bodyDOM.css("height", "calc(100% - 60px)"); } } - this.bannerSkin = function(theme) { + this.bannerSkin = function (theme) { var pearAdmin = $(".pear-admin"); pearAdmin.removeClass("banner-layout"); if (theme === true || theme === "true") { @@ -285,158 +426,81 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm } } - this.collapse = function(param) { - if (param.menu.collapse) { - if ($(window).width() >= 768) { - collapse() - } + this.switchTheme = function (checked) { + var $pearAdmin = $(".pear-admin"); + $pearAdmin.removeClass("pear-admin-dark"); + if (checked === true || checked === "true") { + $pearAdmin.addClass("pear-admin-dark"); } } - this.menuSkin = function(theme) { + this.menuSkin = function (theme) { var pearAdmin = $(".pear-admin .layui-side"); pearAdmin.removeClass("light-theme"); pearAdmin.removeClass("dark-theme"); pearAdmin.addClass(theme); } - this.headerSkin = function(theme) { + this.headerSkin = function (theme) { var pearAdmin = $(".pear-admin .layui-header"); - pearAdmin.removeClass("light-theme"); pearAdmin.removeClass("dark-theme"); + pearAdmin.removeClass("light-theme"); + pearAdmin.removeClass("auto-theme"); pearAdmin.addClass(theme); } - this.logout = function(callback) { - logout = callback; - } - - this.message = function(callback) { - if (callback != null) { - msgInstance.click(callback); - } - } - - this.collapseSide = function() { - collapse() - } - - this.refreshThis = function() { - refresh() - } - - this.refresh = function(id) { - $("iframe[id='"+ id +"']").attr('src', $("iframe[id='"+ id +"']").attr('src')); - } - - this.addTab = function(id, title, url) { - if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) { - bodyTab.addTabOnly({ - id: id, - title: title, - url: url, - icon: null, - close: true - }, 400); - } else { - return; + /** + * 设置注销逻辑 + * + * @param callback 实现 + */ + this.logout = function (callback) { + if (callback != undefined) { + logout = callback; } } - this.closeTab = function(id) { - if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) { - pearTab.delTabByElem('content', id, function(currentId){ - sideMenu.selectItem(currentId); - }); + /** + * @since Pear Admin 4.0.3 + * + * 刷新当前页面 + */ + this.refresh = function () { + var refreshBtn = $(".refresh a"); + refreshBtn.addClass("layui-anim layui-anim-rotate layui-anim-loop layui-icon-loading"); + refreshBtn.removeClass("layui-icon-refresh-1"); + if (isMuiltTab(configurationCache) === "true" || isMuiltTab(configurationCache) === true) pearAdmin.instances.tabPage.refresh(true); + else pearAdmin.instances.page.refresh(true); + setTimeout(function () { + refreshBtn.removeClass("layui-anim layui-anim-rotate layui-anim-loop layui-icon-loading"); + refreshBtn.addClass("layui-icon-refresh-1"); + }, 600) + } + + /** + * @since Pear Admin 4.0.3 + * + * 切换内容页面 + * + * PS: tabPages 模式下,如果页面不存在则新增,反则仅做切换。 + */ + this.changePage = function (data) { + if (isMuiltTab(configurationCache) === "true" || isMuiltTab(configurationCache) === true) { + pearAdmin.instances.tabPage.changePage({ id: data.id, title: data.title, url: data.url, type: data.type, close: true }); } else { - return; + pearAdmin.instances.page.changePage({ href: data.url, type: data.type }); } } - this.closeCurrentTab = function() { - if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) { - pearTab.delCurrentTabByElem('content', function(id){ - sideMenu.selectItem(id); - }); - } else { - return; - } - } - - this.closeOtherTab = function() { - if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) { - pearTab.delOtherTabByElem('content', function(id){ - sideMenu.selectItem(id); - }); - } else { - return; - } - } - - this.closeAllTab = function() { - if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) { - pearTab.delAllTabByElem('content', function(id){ - sideMenu.selectItem(id); - }); - } else { - return; - } - } - - this.changeTabTitle = function(id, title) { - pearTab.changeTabTitleById('content', id ,title); - } - - this.changeIframe = function(id, title, url) { - if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) { - return; - } else { - sideMenu.selectItem(id); - bodyFrame.changePage(url, true); - } - } - - this.jump = function(id, title, url) { - if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) { - pearAdmin.addTab(id, title, url) - } else { - pearAdmin.changeIframe(id, title, url) - } - } - - this.fullScreen = function() { - if ($(".fullScreen").hasClass("layui-icon-screen-restore")) { - screenFun(2).then(function() { - $(".fullScreen").eq(0).removeClass("layui-icon-screen-restore"); - }); - } else { - screenFun(1).then(function() { - $(".fullScreen").eq(0).addClass("layui-icon-screen-restore"); - }); - } - } }; - function refresh() { - var refreshA = $(".refresh a"); - refreshA.removeClass("layui-icon-refresh-1"); - refreshA.addClass("layui-anim"); - refreshA.addClass("layui-anim-rotate"); - refreshA.addClass("layui-anim-loop"); - refreshA.addClass("layui-icon-loading"); - if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) bodyTab.refresh(true); - else bodyFrame.refresh(true); - setTimeout(function() { - refreshA.addClass("layui-icon-refresh-1"); - refreshA.removeClass("layui-anim"); - refreshA.removeClass("layui-anim-rotate"); - refreshA.removeClass("layui-anim-loop"); - refreshA.removeClass("layui-icon-loading"); - }, 600) - } - + /** + * @since Pear Admin 4.0 + * + * 菜单折叠 + */ function collapse() { - sideMenu.collapse(); + pearAdmin.instances.menu.collapse(); var admin = $(".pear-admin"); var left = $(".layui-icon-spread-left") var right = $(".layui-icon-shrink-right") @@ -444,246 +508,75 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm left.addClass("layui-icon-shrink-right") left.removeClass("layui-icon-spread-left") admin.removeClass("pear-mini"); - sideMenu.isCollapse = false; + pearAdmin.instances.menu.isCollapse = false; } else { right.addClass("layui-icon-spread-left") right.removeClass("layui-icon-shrink-right") admin.addClass("pear-mini"); - sideMenu.isCollapse = true; + pearAdmin.instances.menu.isCollapse = true; } } - body.on("click", ".logout", function() { - if (logout() && bodyTab) { - bodyTab.clear(); - } - }) - - body.on("click", ".collapse,.pear-cover", function() { - collapse(); - }); - - body.on("click", ".menuSearch", function () { - // 过滤菜单 - var filterHandle = function (filterData, val) { - if (!val) return []; - var filteredMenus = []; - filterData = $.extend(true, {}, filterData); - $.each(filterData, function (index, item) { - if (item.children && item.children.length) { - var children = filterHandle(item.children, val) - var obj = $.extend({}, item, { children: children }); - if (children && children.length) { - filteredMenus.push(obj); - } else if (item.title.indexOf(val) >= 0) { - item.children = []; // 父级匹配但子级不匹配,就去除子级 - filteredMenus.push($.extend({}, item)); + /** + * @since Pear Admin 4.0 + * + * 使用 admin.logout(Function) 实现注销 + * + * Promise 作为返回值类型时,泛型内容为 true 时视为注销成功,则清除 pearAdmin.instances.tabPage 缓存 + * + * 否则视为注销失败,不做任何处置。 + */ + body.on("click", ".logout", function () { + var promise = logout(); + if (promise != undefined) { + promise.then((asyncResult) => { + if (asyncResult) { + if (pearAdmin.instances.tabPage != undefined) { + pearAdmin.instances.tabPage.clear(); } - } else if (item.title.indexOf(val) >= 0) { - filteredMenus.push(item); } }) - return filteredMenus; - } - - // 树转路径 - var tiledHandle = function (data) { - var tiledMenus = []; - var treeTiled = function (data, content) { - var path = ""; - var separator = " / "; - // 上级路径 - if (!content) content = ""; - $.each(data, function (index, item) { - if (item.children && item.children.length) { - path += content + item.title + separator; - var childPath = treeTiled(item.children, path); - path += childPath; - if (!childPath) path = ""; // 重置路径 - } else { - path += content + item.title - tiledMenus.push({ path: path, info: item }); - path = ""; //重置路径 - } - }) - return path; - }; - treeTiled(data); - - return tiledMenus; + } else { + if (pearAdmin.instances.tabPage != undefined) { + pearAdmin.instances.tabPage.clear(); + } } + }) - // 创建搜索列表 - var createList = function (data) { - var _listHtml = ''; - $.each(data, function (index, item) { - _listHtml += '
                        • '; - _listHtml += ' ' + item.path + ''; - _listHtml += ' '; - _listHtml += '
                        • ' - }) - return _listHtml; - } - - var _html = [ - '' - ].join(''); - - layer.open({ - type: 1, - offset: "10%", - area: ['600px'], - title: false, - closeBtn: 0, - shadeClose: true, - anim: 0, - move: false, - content: _html, - success: function(layero,layeridx){ - var $layer = layero; - var $content = $(layero).children('.layui-layer-content'); - var $input = $(".menu-search-input-wrapper input"); - var $noData = $(".menu-search-no-data"); - var $list = $(".menu-search-list"); - var menuData = sideMenu.option.data; - - - $layer.css("border-radius", "6px"); - $input.off("focus").focus(); - // 搜索菜单 - $input.off("input").on("input", debounce(function(){ - var keywords = $input.val().trim(); - var filteredMenus = filterHandle(menuData, keywords); - - if(filteredMenus.length){ - var tiledMenus = tiledHandle(filteredMenus); - var listHtml = createList(tiledMenus); - $noData.css("display", "none"); - $list.html("").append(listHtml).children(":first").addClass("this") - }else{ - $list.html(""); - $noData.css("display", "flex"); - } - var currentHeight = $(".menu-search-content").outerHeight() - $layer.css("height", currentHeight); - $content.css("height", currentHeight); - }, 500) - ) - // 搜索列表点击事件 - $list.off("click").on("click", "li", function () { - var menuId = $(this).attr("smenu-id"); - var menuUrl = $(this).attr("smenu-url"); - var menuIcon = $(this).attr("smenu-icon"); - var menuTitle = $(this).attr("smenu-title"); - var menuType = $(this).attr("smenu-type"); - var openableWindow = menuType === "1" || menuType === 1; - - if(sideMenu.isCollapse){ - collapse(); - } - if (openableWindow) { - pearAdmin.jump(menuId, menuTitle, menuUrl) - } else { - sideMenu.selectItem(menuId); - } - compatible(); - layer.close(layeridx); - }) - - $list.off('mouseenter').on("mouseenter", "li", function () { - $(".menu-search-list li.this").removeClass("this"); - $(this).addClass("this"); - }).off("mouseleave").on("mouseleave", "li", function(){ - $(this).removeClass("this"); - }) - - // 监听键盘事件 - // Enter:13 Spacebar:32 UpArrow:38 DownArrow:40 Esc:27 - $(document).off("keydown").keydown(function (e) { - if (e.keyCode === 13 || e.keyCode === 32) { - e.preventDefault(); - var menuId = $(".menu-search-list li.this").attr("smenu-id"); - var menuUrl = $(".menu-search-list li.this").attr("smenu-url"); - var menuTitle = $(".menu-search-list li.this").attr("smenu-title"); - var menuType = $(".menu-search-list li.this").attr("smenu-type"); - var openableWindow = menuType === "1" || menuType === 1; - if (sideMenu.isCollapse) { - collapse(); - } - if (openableWindow) { - pearAdmin.jump(menuId, menuTitle, menuUrl) - } else { - sideMenu.selectItem(menuId); - } - compatible(); - layer.close(layeridx); - }else if(e.keyCode === 38){ - e.preventDefault(); - var prevEl = $(".menu-search-list li.this").prev(); - $(".menu-search-list li.this").removeClass("this"); - if(prevEl.length !== 0){ - prevEl.addClass("this"); - }else{ - $list.children().last().addClass("this"); - } - }else if(e.keyCode === 40){ - e.preventDefault(); - var nextEl = $(".menu-search-list li.this").next(); - $(".menu-search-list li.this").removeClass("this"); - if(nextEl.length !== 0){ - nextEl.addClass("this"); - }else{ - $list.children().first().addClass("this"); - } - }else if(e.keyCode === 27){ - e.preventDefault(); - layer.close(layeridx); - } - }) - } - }) + body.on("click", ".collapse,.pear-cover", function () { + collapse(); }); - - body.on("click", ".fullScreen", function() { + body.on("click", ".fullScreen", function () { if ($(this).hasClass("layui-icon-screen-restore")) { - fullscreen.fullClose().then(function() { + fullscreen.fullClose().then(function () { $(".fullScreen").eq(0).removeClass("layui-icon-screen-restore"); }); } else { - fullscreen.fullScreen().then(function() { + fullscreen.fullScreen().then(function () { $(".fullScreen").eq(0).addClass("layui-icon-screen-restore"); }); } }); - body.on("click", '[user-menu-id]', function() { - if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) { - bodyTab.addTabOnly({ + body.on("click", '[user-menu-id]', function () { + if (isMuiltTab(configurationCache) === "true" || isMuiltTab(configurationCache) === true) { + pearAdmin.instances.tabPage.changePage({ id: $(this).attr("user-menu-id"), title: $(this).attr("user-menu-title"), url: $(this).attr("user-menu-url"), - icon: "", + type: $(this).attr("user-menu-type"), close: true }, 300); } else { - bodyFrame.changePage($(this).attr("user-menu-url"), true); + pearAdmin.instances.page.changePage({ + href: $(this).attr("user-menu-url"), + type: $(this).attr("user-menu-type"), + }, true); } }); - body.on("click", ".setting", function() { + body.on("click", ".setting", function () { var menuItem = '
                        • ' + @@ -725,28 +618,36 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm '' + '
                        • '; + headItem += + '
                        • ' + + '' + + '
                          ' + + '
                          ' + + '
                          ' + + '
                        • '; + var headHtml = '
                          \n' + - '
                          顶部风格
                          \n' + + '
                          顶栏风格
                          \n' + '
                          \n' + '
                            \n' + headItem + '
                          \n' + '
                          \n' + '
                          '; var moreItem = - '
                          菜单
                          '; + '
                          菜单分割
                          '; moreItem += - '
                          视图
                          '; + '
                          多选项卡
                          '; moreItem += - '
                          通栏
                          '; + '
                          通栏布局
                          '; moreItem += - '
                          通色
                          '; + '
                          开启页脚
                          '; moreItem += - '
                          页脚
                          '; + '
                          夜间模式
                          '; var moreHtml = '
                          \n' + '
                          更多设置
                          \n' + @@ -767,7 +668,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm skin: 'layer-anim-right', move: false, content: menuHtml + headHtml + buildColorHtml() + moreHtml, - success: function(layero, index) { + success: function (layero, index) { form.render(); @@ -790,31 +691,31 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm $("[data-select-header='" + header + "']").addClass("layui-this"); } - $('#layui-layer-shade' + index).click(function() { + $('#layui-layer-shade' + index).click(function () { var $layero = $('#layui-layer' + index); $layero.animate({ left: $layero.offset().left + $layero.width() - }, 200, function() { + }, 200, function () { layer.close(index); }); }) - form.on('switch(control)', function(data) { + form.on('switch(control)', function (data) { localStorage.setItem("control", this.checked); window.location.reload(); }) - form.on('switch(muilt-tab)', function(data) { + form.on('switch(muilt-tab)', function (data) { localStorage.setItem("muilt-tab", this.checked); window.location.reload(); }) - form.on('switch(auto-head)', function(data) { + form.on('switch(auto-head)', function (data) { localStorage.setItem("auto-head", this.checked); - pearTheme.changeTheme(window, this.checked); + pearAdmin.changeTheme(); }) - form.on('switch(banner)', function(data) { + form.on('switch(banner)', function (data) { localStorage.setItem("theme-banner", this.checked); pearAdmin.bannerSkin(this.checked); }) @@ -824,6 +725,11 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm pearAdmin.footer(this.checked); }) + form.on('switch(dark)', function (data) { + localStorage.setItem("dark", this.checked); + pearAdmin.switchTheme(this.checked); + }) + if (localStorage.getItem('theme-banner') === 'true') { $('input[name="banner"]').attr('checked', 'checked') } else { @@ -842,24 +748,24 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm $('input[name="muilt-tab"]').removeAttr('checked') } - if (localStorage.getItem('auto-head') === 'true') { - $('input[name="auto-head"]').attr('checked', 'checked') - } else { - $('input[name="auto-head"]').removeAttr('checked') - } - if (localStorage.getItem('footer') === 'true') { $('input[name="footer"]').attr('checked', 'checked') } else { $('input[name="footer"]').removeAttr('checked') } + if (localStorage.getItem('dark') === 'true') { + $('input[name="dark"]').attr('checked', 'checked') + } else { + $('input[name="dark"]').removeAttr('checked') + } + form.render('checkbox'); } }); }); - body.on('click', '[data-select-bgcolor]', function() { + body.on('click', '[data-select-bgcolor]', function () { var theme = $(this).attr('data-select-bgcolor'); $('[data-select-bgcolor]').removeClass("layui-this"); $(this).addClass("layui-this"); @@ -867,15 +773,22 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm pearAdmin.menuSkin(theme); }); - body.on('click', '[data-select-header]', function() { - var theme = $(this).attr('data-select-header'); + body.on('click', '[data-select-header]', function () { + var headerColor = $(this).attr('data-select-header'); $('[data-select-header]').removeClass("layui-this"); $(this).addClass("layui-this"); - localStorage.setItem("theme-header", theme); - pearAdmin.headerSkin(theme); + localStorage.setItem("theme-header", headerColor); + if (headerColor == "auto-theme") { + localStorage.setItem("auto-head", true); + pearAdmin.changeTheme(); + } else { + localStorage.setItem("auto-head", false); + pearAdmin.changeTheme(); + } + pearAdmin.headerSkin(headerColor); }); - body.on('click', '.select-color-item', function() { + body.on('click', '.select-color-item', function () { $(".select-color-item").removeClass("layui-icon").removeClass("layui-icon-ok"); $(this).addClass("layui-icon").addClass("layui-icon-ok"); var colorId = $(".select-color-item.layui-icon-ok").attr("color-id"); @@ -883,33 +796,21 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm localStorage.setItem("theme-color", currentColor.id); localStorage.setItem("theme-color-color", currentColor.color); localStorage.setItem("theme-color-second", currentColor.second); - pearTheme.changeTheme(window, isAutoHead(config)); + pearAdmin.changeTheme(); }); - function applyConfig(param) { - config = param; - pearAdmin.logoRender(param); - pearAdmin.menuRender(param); - pearAdmin.bodyRender(param); - pearAdmin.themeRender(param); - pearAdmin.keepLoad(param); - if (param.header.message != false) { - pearAdmin.messageRender(param); - } - } - function getColorById(id) { var color; var flag = false; - $.each(config.colors, function(i, value) { + $.each(configurationCache.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) { + if (flag === false || configurationCache.theme.allowCustom === false) { + $.each(configurationCache.colors, function (i, value) { + if (value.id === configurationCache.theme.defaultColor) { color = value; } }) @@ -919,11 +820,11 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm function buildColorHtml() { var colors = ""; - $.each(config.colors, function(i, value) { + $.each(configurationCache.colors, function (i, value) { colors += ""; }) - return "
                          主题配色
                          " + + return "
                          主题颜色
                          " + colors + "
                          " } @@ -945,18 +846,6 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm } } - function isAutoHead(option) { - if (option.theme.allowCustom) { - if (localStorage.getItem("auto-head") != null) { - return localStorage.getItem("auto-head"); - } else { - return option.other.autoHead; - } - } else { - return option.other.autoHead; - } - } - function isMuiltTab(option) { if (option.theme.allowCustom) { if (localStorage.getItem("muilt-tab") != null) { @@ -969,29 +858,17 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm } } - window.onresize = function() { + window.onresize = function () { if (!fullscreen.isFullscreen()) { $(".fullScreen").eq(0).removeClass("layui-icon-screen-restore"); } } - $(window).on('resize', debounce(function () { - if (sideMenu && !sideMenu.isCollapse && $(window).width() <= 768) { + $(window).on('resize', tools.debounce(function () { + if (pearAdmin.instances.menu && !pearAdmin.instances.menu.isCollapse && $(window).width() <= 768) { collapse(); } - },50)); + }, 50)); - function debounce(fn, awaitTime) { - var timerID = null - return function () { - var arg = arguments[0] - if (timerID) { - clearTimeout(timerID) - } - timerID = setTimeout(function () { - fn(arg) - }, awaitTime) - } - } exports('admin', pearAdmin); - }) + }) \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/module/area.js b/src/plugin/admin/public/component/pear/module/area.js deleted file mode 100644 index 604c91e9..00000000 --- a/src/plugin/admin/public/component/pear/module/area.js +++ /dev/null @@ -1,4070 +0,0 @@ -layui.define(['layer', 'form', 'laytpl'], function (exports) { - "use strict"; - - let $ = layui.$ - , form = layui.form - , layarea = { - _id: 0 - , config: {} - , set: function (options) { - let that = this; - that.config = $.extend({}, that.config, options); - return that; - } - , on: function (events, callback) { - return layui.onevent.call(this, 'layarea', events, callback); - } - } - , thisArea = function () { - let that = this; - return { - layarea: function (files) { - that.layarea.call(that, files); - } - , config: that.config - , reload: that.reload - , events: that.events - } - } - , Class = function (options) { - let that = this; - that.config = $.extend({}, { - elem: '', - data: { - province: '', - city: '', - county: '', - provinceCode: 0, - cityCode: 0, - countyCode: 0, - } - }, options); - that.render(); - }; - - let areaList = { - province_list: { - 110000: '北京市', - 120000: '天津市', - 130000: '河北省', - 140000: '山西省', - 150000: '内蒙古自治区', - 210000: '辽宁省', - 220000: '吉林省', - 230000: '黑龙江省', - 310000: '上海市', - 320000: '江苏省', - 330000: '浙江省', - 340000: '安徽省', - 350000: '福建省', - 360000: '江西省', - 370000: '山东省', - 410000: '河南省', - 420000: '湖北省', - 430000: '湖南省', - 440000: '广东省', - 450000: '广西壮族自治区', - 460000: '海南省', - 500000: '重庆市', - 510000: '四川省', - 520000: '贵州省', - 530000: '云南省', - 540000: '西藏自治区', - 610000: '陕西省', - 620000: '甘肃省', - 630000: '青海省', - 640000: '宁夏回族自治区', - 650000: '新疆维吾尔自治区', - 710000: '台湾省', - 810000: '香港特别行政区', - 820000: '澳门特别行政区', - 900000: '海外' - }, - city_list: { - 110100: '北京市', - 120100: '天津市', - 130100: '石家庄市', - 130200: '唐山市', - 130300: '秦皇岛市', - 130400: '邯郸市', - 130500: '邢台市', - 130600: '保定市', - 130700: '张家口市', - 130800: '承德市', - 130900: '沧州市', - 131000: '廊坊市', - 131100: '衡水市', - 139000: '省直辖县', - 140100: '太原市', - 140200: '大同市', - 140300: '阳泉市', - 140400: '长治市', - 140500: '晋城市', - 140600: '朔州市', - 140700: '晋中市', - 140800: '运城市', - 140900: '忻州市', - 141000: '临汾市', - 141100: '吕梁市', - 150100: '呼和浩特市', - 150200: '包头市', - 150300: '乌海市', - 150400: '赤峰市', - 150500: '通辽市', - 150600: '鄂尔多斯市', - 150700: '呼伦贝尔市', - 150800: '巴彦淖尔市', - 150900: '乌兰察布市', - 152200: '兴安盟', - 152500: '锡林郭勒盟', - 152900: '阿拉善盟', - 210100: '沈阳市', - 210200: '大连市', - 210300: '鞍山市', - 210400: '抚顺市', - 210500: '本溪市', - 210600: '丹东市', - 210700: '锦州市', - 210800: '营口市', - 210900: '阜新市', - 211000: '辽阳市', - 211100: '盘锦市', - 211200: '铁岭市', - 211300: '朝阳市', - 211400: '葫芦岛市', - 220100: '长春市', - 220200: '吉林市', - 220300: '四平市', - 220400: '辽源市', - 220500: '通化市', - 220600: '白山市', - 220700: '松原市', - 220800: '白城市', - 222400: '延边朝鲜族自治州', - 230100: '哈尔滨市', - 230200: '齐齐哈尔市', - 230300: '鸡西市', - 230400: '鹤岗市', - 230500: '双鸭山市', - 230600: '大庆市', - 230700: '伊春市', - 230800: '佳木斯市', - 230900: '七台河市', - 231000: '牡丹江市', - 231100: '黑河市', - 231200: '绥化市', - 232700: '大兴安岭地区', - 310100: '上海市', - 320100: '南京市', - 320200: '无锡市', - 320300: '徐州市', - 320400: '常州市', - 320500: '苏州市', - 320600: '南通市', - 320700: '连云港市', - 320800: '淮安市', - 320900: '盐城市', - 321000: '扬州市', - 321100: '镇江市', - 321200: '泰州市', - 321300: '宿迁市', - 330100: '杭州市', - 330200: '宁波市', - 330300: '温州市', - 330400: '嘉兴市', - 330500: '湖州市', - 330600: '绍兴市', - 330700: '金华市', - 330800: '衢州市', - 330900: '舟山市', - 331000: '台州市', - 331100: '丽水市', - 340100: '合肥市', - 340200: '芜湖市', - 340300: '蚌埠市', - 340400: '淮南市', - 340500: '马鞍山市', - 340600: '淮北市', - 340700: '铜陵市', - 340800: '安庆市', - 341000: '黄山市', - 341100: '滁州市', - 341200: '阜阳市', - 341300: '宿州市', - 341500: '六安市', - 341600: '亳州市', - 341700: '池州市', - 341800: '宣城市', - 350100: '福州市', - 350200: '厦门市', - 350300: '莆田市', - 350400: '三明市', - 350500: '泉州市', - 350600: '漳州市', - 350700: '南平市', - 350800: '龙岩市', - 350900: '宁德市', - 360100: '南昌市', - 360200: '景德镇市', - 360300: '萍乡市', - 360400: '九江市', - 360500: '新余市', - 360600: '鹰潭市', - 360700: '赣州市', - 360800: '吉安市', - 360900: '宜春市', - 361000: '抚州市', - 361100: '上饶市', - 370100: '济南市', - 370200: '青岛市', - 370300: '淄博市', - 370400: '枣庄市', - 370500: '东营市', - 370600: '烟台市', - 370700: '潍坊市', - 370800: '济宁市', - 370900: '泰安市', - 371000: '威海市', - 371100: '日照市', - 371200: '莱芜市', - 371300: '临沂市', - 371400: '德州市', - 371500: '聊城市', - 371600: '滨州市', - 371700: '菏泽市', - 410100: '郑州市', - 410200: '开封市', - 410300: '洛阳市', - 410400: '平顶山市', - 410500: '安阳市', - 410600: '鹤壁市', - 410700: '新乡市', - 410800: '焦作市', - 410900: '濮阳市', - 411000: '许昌市', - 411100: '漯河市', - 411200: '三门峡市', - 411300: '南阳市', - 411400: '商丘市', - 411500: '信阳市', - 411600: '周口市', - 411700: '驻马店市', - 419000: '省直辖县', - 420100: '武汉市', - 420200: '黄石市', - 420300: '十堰市', - 420500: '宜昌市', - 420600: '襄阳市', - 420700: '鄂州市', - 420800: '荆门市', - 420900: '孝感市', - 421000: '荆州市', - 421100: '黄冈市', - 421200: '咸宁市', - 421300: '随州市', - 422800: '恩施土家族苗族自治州', - 429000: '省直辖县', - 430100: '长沙市', - 430200: '株洲市', - 430300: '湘潭市', - 430400: '衡阳市', - 430500: '邵阳市', - 430600: '岳阳市', - 430700: '常德市', - 430800: '张家界市', - 430900: '益阳市', - 431000: '郴州市', - 431100: '永州市', - 431200: '怀化市', - 431300: '娄底市', - 433100: '湘西土家族苗族自治州', - 440100: '广州市', - 440200: '韶关市', - 440300: '深圳市', - 440400: '珠海市', - 440500: '汕头市', - 440600: '佛山市', - 440700: '江门市', - 440800: '湛江市', - 440900: '茂名市', - 441200: '肇庆市', - 441300: '惠州市', - 441400: '梅州市', - 441500: '汕尾市', - 441600: '河源市', - 441700: '阳江市', - 441800: '清远市', - 441900: '东莞市', - 442000: '中山市', - 445100: '潮州市', - 445200: '揭阳市', - 445300: '云浮市', - 450100: '南宁市', - 450200: '柳州市', - 450300: '桂林市', - 450400: '梧州市', - 450500: '北海市', - 450600: '防城港市', - 450700: '钦州市', - 450800: '贵港市', - 450900: '玉林市', - 451000: '百色市', - 451100: '贺州市', - 451200: '河池市', - 451300: '来宾市', - 451400: '崇左市', - 460100: '海口市', - 460200: '三亚市', - 460300: '三沙市', - 460400: '儋州市', - 469000: '省直辖县', - 500100: '重庆市', - 500200: '县', - 510100: '成都市', - 510300: '自贡市', - 510400: '攀枝花市', - 510500: '泸州市', - 510600: '德阳市', - 510700: '绵阳市', - 510800: '广元市', - 510900: '遂宁市', - 511000: '内江市', - 511100: '乐山市', - 511300: '南充市', - 511400: '眉山市', - 511500: '宜宾市', - 511600: '广安市', - 511700: '达州市', - 511800: '雅安市', - 511900: '巴中市', - 512000: '资阳市', - 513200: '阿坝藏族羌族自治州', - 513300: '甘孜藏族自治州', - 513400: '凉山彝族自治州', - 520100: '贵阳市', - 520200: '六盘水市', - 520300: '遵义市', - 520400: '安顺市', - 520500: '毕节市', - 520600: '铜仁市', - 522300: '黔西南布依族苗族自治州', - 522600: '黔东南苗族侗族自治州', - 522700: '黔南布依族苗族自治州', - 530100: '昆明市', - 530300: '曲靖市', - 530400: '玉溪市', - 530500: '保山市', - 530600: '昭通市', - 530700: '丽江市', - 530800: '普洱市', - 530900: '临沧市', - 532300: '楚雄彝族自治州', - 532500: '红河哈尼族彝族自治州', - 532600: '文山壮族苗族自治州', - 532800: '西双版纳傣族自治州', - 532900: '大理白族自治州', - 533100: '德宏傣族景颇族自治州', - 533300: '怒江傈僳族自治州', - 533400: '迪庆藏族自治州', - 540100: '拉萨市', - 540200: '日喀则市', - 540300: '昌都市', - 540400: '林芝市', - 540500: '山南市', - 540600: '那曲市', - 542500: '阿里地区', - 610100: '西安市', - 610200: '铜川市', - 610300: '宝鸡市', - 610400: '咸阳市', - 610500: '渭南市', - 610600: '延安市', - 610700: '汉中市', - 610800: '榆林市', - 610900: '安康市', - 611000: '商洛市', - 620100: '兰州市', - 620200: '嘉峪关市', - 620300: '金昌市', - 620400: '白银市', - 620500: '天水市', - 620600: '武威市', - 620700: '张掖市', - 620800: '平凉市', - 620900: '酒泉市', - 621000: '庆阳市', - 621100: '定西市', - 621200: '陇南市', - 622900: '临夏回族自治州', - 623000: '甘南藏族自治州', - 630100: '西宁市', - 630200: '海东市', - 632200: '海北藏族自治州', - 632300: '黄南藏族自治州', - 632500: '海南藏族自治州', - 632600: '果洛藏族自治州', - 632700: '玉树藏族自治州', - 632800: '海西蒙古族藏族自治州', - 640100: '银川市', - 640200: '石嘴山市', - 640300: '吴忠市', - 640400: '固原市', - 640500: '中卫市', - 650100: '乌鲁木齐市', - 650200: '克拉玛依市', - 650400: '吐鲁番市', - 650500: '哈密市', - 652300: '昌吉回族自治州', - 652700: '博尔塔拉蒙古自治州', - 652800: '巴音郭楞蒙古自治州', - 652900: '阿克苏地区', - 653000: '克孜勒苏柯尔克孜自治州', - 653100: '喀什地区', - 653200: '和田地区', - 654000: '伊犁哈萨克自治州', - 654200: '塔城地区', - 654300: '阿勒泰地区', - 659000: '自治区直辖县级行政区划', - 710100: '台北市', - 710200: '高雄市', - 710300: '台南市', - 710400: '台中市', - 710500: '金门县', - 710600: '南投县', - 710700: '基隆市', - 710800: '新竹市', - 710900: '嘉义市', - 711100: '新北市', - 711200: '宜兰县', - 711300: '新竹县', - 711400: '桃园县', - 711500: '苗栗县', - 711700: '彰化县', - 711900: '嘉义县', - 712100: '云林县', - 712400: '屏东县', - 712500: '台东县', - 712600: '花莲县', - 712700: '澎湖县', - 712800: '连江县', - 810100: '香港岛', - 810200: '九龙', - 810300: '新界', - 820100: '澳门半岛', - 820200: '离岛', - 912400: '加拿大', - 941000: '韩国', - 984000: '美国' - }, - county_list: { - 110101: '东城区', - 110102: '西城区', - 110105: '朝阳区', - 110106: '丰台区', - 110107: '石景山区', - 110108: '海淀区', - 110109: '门头沟区', - 110111: '房山区', - 110112: '通州区', - 110113: '顺义区', - 110114: '昌平区', - 110115: '大兴区', - 110116: '怀柔区', - 110117: '平谷区', - 110118: '密云区', - 110119: '延庆区', - 120101: '和平区', - 120102: '河东区', - 120103: '河西区', - 120104: '南开区', - 120105: '河北区', - 120106: '红桥区', - 120110: '东丽区', - 120111: '西青区', - 120112: '津南区', - 120113: '北辰区', - 120114: '武清区', - 120115: '宝坻区', - 120116: '滨海新区', - 120117: '宁河区', - 120118: '静海区', - 120119: '蓟州区', - 130102: '长安区', - 130104: '桥西区', - 130105: '新华区', - 130107: '井陉矿区', - 130108: '裕华区', - 130109: '藁城区', - 130110: '鹿泉区', - 130111: '栾城区', - 130121: '井陉县', - 130123: '正定县', - 130125: '行唐县', - 130126: '灵寿县', - 130127: '高邑县', - 130128: '深泽县', - 130129: '赞皇县', - 130130: '无极县', - 130131: '平山县', - 130132: '元氏县', - 130133: '赵县', - 130181: '辛集市', - 130183: '晋州市', - 130184: '新乐市', - 130202: '路南区', - 130203: '路北区', - 130204: '古冶区', - 130205: '开平区', - 130207: '丰南区', - 130208: '丰润区', - 130209: '曹妃甸区', - 130223: '滦县', - 130224: '滦南县', - 130225: '乐亭县', - 130227: '迁西县', - 130229: '玉田县', - 130281: '遵化市', - 130283: '迁安市', - 130302: '海港区', - 130303: '山海关区', - 130304: '北戴河区', - 130306: '抚宁区', - 130321: '青龙满族自治县', - 130322: '昌黎县', - 130324: '卢龙县', - 130390: '经济技术开发区', - 130402: '邯山区', - 130403: '丛台区', - 130404: '复兴区', - 130406: '峰峰矿区', - 130407: '肥乡区', - 130408: '永年区', - 130423: '临漳县', - 130424: '成安县', - 130425: '大名县', - 130426: '涉县', - 130427: '磁县', - 130430: '邱县', - 130431: '鸡泽县', - 130432: '广平县', - 130433: '馆陶县', - 130434: '魏县', - 130435: '曲周县', - 130481: '武安市', - 130502: '桥东区', - 130503: '桥西区', - 130521: '邢台县', - 130522: '临城县', - 130523: '内丘县', - 130524: '柏乡县', - 130525: '隆尧县', - 130526: '任县', - 130527: '南和县', - 130528: '宁晋县', - 130529: '巨鹿县', - 130530: '新河县', - 130531: '广宗县', - 130532: '平乡县', - 130533: '威县', - 130534: '清河县', - 130535: '临西县', - 130581: '南宫市', - 130582: '沙河市', - 130602: '竞秀区', - 130606: '莲池区', - 130607: '满城区', - 130608: '清苑区', - 130609: '徐水区', - 130623: '涞水县', - 130624: '阜平县', - 130626: '定兴县', - 130627: '唐县', - 130628: '高阳县', - 130629: '容城县', - 130630: '涞源县', - 130631: '望都县', - 130632: '安新县', - 130633: '易县', - 130634: '曲阳县', - 130635: '蠡县', - 130636: '顺平县', - 130637: '博野县', - 130638: '雄县', - 130681: '涿州市', - 130682: '定州市', - 130683: '安国市', - 130684: '高碑店市', - 130702: '桥东区', - 130703: '桥西区', - 130705: '宣化区', - 130706: '下花园区', - 130708: '万全区', - 130709: '崇礼区', - 130722: '张北县', - 130723: '康保县', - 130724: '沽源县', - 130725: '尚义县', - 130726: '蔚县', - 130727: '阳原县', - 130728: '怀安县', - 130730: '怀来县', - 130731: '涿鹿县', - 130732: '赤城县', - 130802: '双桥区', - 130803: '双滦区', - 130804: '鹰手营子矿区', - 130821: '承德县', - 130822: '兴隆县', - 130824: '滦平县', - 130825: '隆化县', - 130826: '丰宁满族自治县', - 130827: '宽城满族自治县', - 130828: '围场满族蒙古族自治县', - 130881: '平泉市', - 130902: '新华区', - 130903: '运河区', - 130921: '沧县', - 130922: '青县', - 130923: '东光县', - 130924: '海兴县', - 130925: '盐山县', - 130926: '肃宁县', - 130927: '南皮县', - 130928: '吴桥县', - 130929: '献县', - 130930: '孟村回族自治县', - 130981: '泊头市', - 130982: '任丘市', - 130983: '黄骅市', - 130984: '河间市', - 131002: '安次区', - 131003: '广阳区', - 131022: '固安县', - 131023: '永清县', - 131024: '香河县', - 131025: '大城县', - 131026: '文安县', - 131028: '大厂回族自治县', - 131081: '霸州市', - 131082: '三河市', - 131090: '开发区', - 131102: '桃城区', - 131103: '冀州区', - 131121: '枣强县', - 131122: '武邑县', - 131123: '武强县', - 131124: '饶阳县', - 131125: '安平县', - 131126: '故城县', - 131127: '景县', - 131128: '阜城县', - 131182: '深州市', - 140105: '小店区', - 140106: '迎泽区', - 140107: '杏花岭区', - 140108: '尖草坪区', - 140109: '万柏林区', - 140110: '晋源区', - 140121: '清徐县', - 140122: '阳曲县', - 140123: '娄烦县', - 140181: '古交市', - 140202: '城区', - 140203: '矿区', - 140211: '南郊区', - 140212: '新荣区', - 140221: '阳高县', - 140222: '天镇县', - 140223: '广灵县', - 140224: '灵丘县', - 140225: '浑源县', - 140226: '左云县', - 140227: '大同县', - 140302: '城区', - 140303: '矿区', - 140311: '郊区', - 140321: '平定县', - 140322: '盂县', - 140402: '城区', - 140411: '郊区', - 140421: '长治县', - 140423: '襄垣县', - 140424: '屯留县', - 140425: '平顺县', - 140426: '黎城县', - 140427: '壶关县', - 140428: '长子县', - 140429: '武乡县', - 140430: '沁县', - 140431: '沁源县', - 140481: '潞城市', - 140502: '城区', - 140521: '沁水县', - 140522: '阳城县', - 140524: '陵川县', - 140525: '泽州县', - 140581: '高平市', - 140602: '朔城区', - 140603: '平鲁区', - 140621: '山阴县', - 140622: '应县', - 140623: '右玉县', - 140624: '怀仁县', - 140702: '榆次区', - 140721: '榆社县', - 140722: '左权县', - 140723: '和顺县', - 140724: '昔阳县', - 140725: '寿阳县', - 140726: '太谷县', - 140727: '祁县', - 140728: '平遥县', - 140729: '灵石县', - 140781: '介休市', - 140802: '盐湖区', - 140821: '临猗县', - 140822: '万荣县', - 140823: '闻喜县', - 140824: '稷山县', - 140825: '新绛县', - 140826: '绛县', - 140827: '垣曲县', - 140828: '夏县', - 140829: '平陆县', - 140830: '芮城县', - 140881: '永济市', - 140882: '河津市', - 140902: '忻府区', - 140921: '定襄县', - 140922: '五台县', - 140923: '代县', - 140924: '繁峙县', - 140925: '宁武县', - 140926: '静乐县', - 140927: '神池县', - 140928: '五寨县', - 140929: '岢岚县', - 140930: '河曲县', - 140931: '保德县', - 140932: '偏关县', - 140981: '原平市', - 141002: '尧都区', - 141021: '曲沃县', - 141022: '翼城县', - 141023: '襄汾县', - 141024: '洪洞县', - 141025: '古县', - 141026: '安泽县', - 141027: '浮山县', - 141028: '吉县', - 141029: '乡宁县', - 141030: '大宁县', - 141031: '隰县', - 141032: '永和县', - 141033: '蒲县', - 141034: '汾西县', - 141081: '侯马市', - 141082: '霍州市', - 141102: '离石区', - 141121: '文水县', - 141122: '交城县', - 141123: '兴县', - 141124: '临县', - 141125: '柳林县', - 141126: '石楼县', - 141127: '岚县', - 141128: '方山县', - 141129: '中阳县', - 141130: '交口县', - 141181: '孝义市', - 141182: '汾阳市', - 150102: '新城区', - 150103: '回民区', - 150104: '玉泉区', - 150105: '赛罕区', - 150121: '土默特左旗', - 150122: '托克托县', - 150123: '和林格尔县', - 150124: '清水河县', - 150125: '武川县', - 150202: '东河区', - 150203: '昆都仑区', - 150204: '青山区', - 150205: '石拐区', - 150206: '白云鄂博矿区', - 150207: '九原区', - 150221: '土默特右旗', - 150222: '固阳县', - 150223: '达尔罕茂明安联合旗', - 150302: '海勃湾区', - 150303: '海南区', - 150304: '乌达区', - 150402: '红山区', - 150403: '元宝山区', - 150404: '松山区', - 150421: '阿鲁科尔沁旗', - 150422: '巴林左旗', - 150423: '巴林右旗', - 150424: '林西县', - 150425: '克什克腾旗', - 150426: '翁牛特旗', - 150428: '喀喇沁旗', - 150429: '宁城县', - 150430: '敖汉旗', - 150502: '科尔沁区', - 150521: '科尔沁左翼中旗', - 150522: '科尔沁左翼后旗', - 150523: '开鲁县', - 150524: '库伦旗', - 150525: '奈曼旗', - 150526: '扎鲁特旗', - 150581: '霍林郭勒市', - 150602: '东胜区', - 150603: '康巴什区', - 150621: '达拉特旗', - 150622: '准格尔旗', - 150623: '鄂托克前旗', - 150624: '鄂托克旗', - 150625: '杭锦旗', - 150626: '乌审旗', - 150627: '伊金霍洛旗', - 150702: '海拉尔区', - 150703: '扎赉诺尔区', - 150721: '阿荣旗', - 150722: '莫力达瓦达斡尔族自治旗', - 150723: '鄂伦春自治旗', - 150724: '鄂温克族自治旗', - 150725: '陈巴尔虎旗', - 150726: '新巴尔虎左旗', - 150727: '新巴尔虎右旗', - 150781: '满洲里市', - 150782: '牙克石市', - 150783: '扎兰屯市', - 150784: '额尔古纳市', - 150785: '根河市', - 150802: '临河区', - 150821: '五原县', - 150822: '磴口县', - 150823: '乌拉特前旗', - 150824: '乌拉特中旗', - 150825: '乌拉特后旗', - 150826: '杭锦后旗', - 150902: '集宁区', - 150921: '卓资县', - 150922: '化德县', - 150923: '商都县', - 150924: '兴和县', - 150925: '凉城县', - 150926: '察哈尔右翼前旗', - 150927: '察哈尔右翼中旗', - 150928: '察哈尔右翼后旗', - 150929: '四子王旗', - 150981: '丰镇市', - 152201: '乌兰浩特市', - 152202: '阿尔山市', - 152221: '科尔沁右翼前旗', - 152222: '科尔沁右翼中旗', - 152223: '扎赉特旗', - 152224: '突泉县', - 152501: '二连浩特市', - 152502: '锡林浩特市', - 152522: '阿巴嘎旗', - 152523: '苏尼特左旗', - 152524: '苏尼特右旗', - 152525: '东乌珠穆沁旗', - 152526: '西乌珠穆沁旗', - 152527: '太仆寺旗', - 152528: '镶黄旗', - 152529: '正镶白旗', - 152530: '正蓝旗', - 152531: '多伦县', - 152921: '阿拉善左旗', - 152922: '阿拉善右旗', - 152923: '额济纳旗', - 210102: '和平区', - 210103: '沈河区', - 210104: '大东区', - 210105: '皇姑区', - 210106: '铁西区', - 210111: '苏家屯区', - 210112: '浑南区', - 210113: '沈北新区', - 210114: '于洪区', - 210115: '辽中区', - 210123: '康平县', - 210124: '法库县', - 210181: '新民市', - 210190: '经济技术开发区', - 210202: '中山区', - 210203: '西岗区', - 210204: '沙河口区', - 210211: '甘井子区', - 210212: '旅顺口区', - 210213: '金州区', - 210214: '普兰店区', - 210224: '长海县', - 210281: '瓦房店市', - 210283: '庄河市', - 210302: '铁东区', - 210303: '铁西区', - 210304: '立山区', - 210311: '千山区', - 210321: '台安县', - 210323: '岫岩满族自治县', - 210381: '海城市', - 210390: '高新区', - 210402: '新抚区', - 210403: '东洲区', - 210404: '望花区', - 210411: '顺城区', - 210421: '抚顺县', - 210422: '新宾满族自治县', - 210423: '清原满族自治县', - 210502: '平山区', - 210503: '溪湖区', - 210504: '明山区', - 210505: '南芬区', - 210521: '本溪满族自治县', - 210522: '桓仁满族自治县', - 210602: '元宝区', - 210603: '振兴区', - 210604: '振安区', - 210624: '宽甸满族自治县', - 210681: '东港市', - 210682: '凤城市', - 210702: '古塔区', - 210703: '凌河区', - 210711: '太和区', - 210726: '黑山县', - 210727: '义县', - 210781: '凌海市', - 210782: '北镇市', - 210793: '经济技术开发区', - 210802: '站前区', - 210803: '西市区', - 210804: '鲅鱼圈区', - 210811: '老边区', - 210881: '盖州市', - 210882: '大石桥市', - 210902: '海州区', - 210903: '新邱区', - 210904: '太平区', - 210905: '清河门区', - 210911: '细河区', - 210921: '阜新蒙古族自治县', - 210922: '彰武县', - 211002: '白塔区', - 211003: '文圣区', - 211004: '宏伟区', - 211005: '弓长岭区', - 211011: '太子河区', - 211021: '辽阳县', - 211081: '灯塔市', - 211102: '双台子区', - 211103: '兴隆台区', - 211104: '大洼区', - 211122: '盘山县', - 211202: '银州区', - 211204: '清河区', - 211221: '铁岭县', - 211223: '西丰县', - 211224: '昌图县', - 211281: '调兵山市', - 211282: '开原市', - 211302: '双塔区', - 211303: '龙城区', - 211321: '朝阳县', - 211322: '建平县', - 211324: '喀喇沁左翼蒙古族自治县', - 211381: '北票市', - 211382: '凌源市', - 211402: '连山区', - 211403: '龙港区', - 211404: '南票区', - 211421: '绥中县', - 211422: '建昌县', - 211481: '兴城市', - 215090: '工业园区', - 220102: '南关区', - 220103: '宽城区', - 220104: '朝阳区', - 220105: '二道区', - 220106: '绿园区', - 220112: '双阳区', - 220113: '九台区', - 220122: '农安县', - 220182: '榆树市', - 220183: '德惠市', - 220192: '经济技术开发区', - 220202: '昌邑区', - 220203: '龙潭区', - 220204: '船营区', - 220211: '丰满区', - 220221: '永吉县', - 220281: '蛟河市', - 220282: '桦甸市', - 220283: '舒兰市', - 220284: '磐石市', - 220302: '铁西区', - 220303: '铁东区', - 220322: '梨树县', - 220323: '伊通满族自治县', - 220381: '公主岭市', - 220382: '双辽市', - 220402: '龙山区', - 220403: '西安区', - 220421: '东丰县', - 220422: '东辽县', - 220502: '东昌区', - 220503: '二道江区', - 220521: '通化县', - 220523: '辉南县', - 220524: '柳河县', - 220581: '梅河口市', - 220582: '集安市', - 220602: '浑江区', - 220605: '江源区', - 220621: '抚松县', - 220622: '靖宇县', - 220623: '长白朝鲜族自治县', - 220681: '临江市', - 220702: '宁江区', - 220721: '前郭尔罗斯蒙古族自治县', - 220722: '长岭县', - 220723: '乾安县', - 220781: '扶余市', - 220802: '洮北区', - 220821: '镇赉县', - 220822: '通榆县', - 220881: '洮南市', - 220882: '大安市', - 221090: '工业园区', - 222401: '延吉市', - 222402: '图们市', - 222403: '敦化市', - 222404: '珲春市', - 222405: '龙井市', - 222406: '和龙市', - 222424: '汪清县', - 222426: '安图县', - 230102: '道里区', - 230103: '南岗区', - 230104: '道外区', - 230108: '平房区', - 230109: '松北区', - 230110: '香坊区', - 230111: '呼兰区', - 230112: '阿城区', - 230113: '双城区', - 230123: '依兰县', - 230124: '方正县', - 230125: '宾县', - 230126: '巴彦县', - 230127: '木兰县', - 230128: '通河县', - 230129: '延寿县', - 230183: '尚志市', - 230184: '五常市', - 230202: '龙沙区', - 230203: '建华区', - 230204: '铁锋区', - 230205: '昂昂溪区', - 230206: '富拉尔基区', - 230207: '碾子山区', - 230208: '梅里斯达斡尔族区', - 230221: '龙江县', - 230223: '依安县', - 230224: '泰来县', - 230225: '甘南县', - 230227: '富裕县', - 230229: '克山县', - 230230: '克东县', - 230231: '拜泉县', - 230281: '讷河市', - 230302: '鸡冠区', - 230303: '恒山区', - 230304: '滴道区', - 230305: '梨树区', - 230306: '城子河区', - 230307: '麻山区', - 230321: '鸡东县', - 230381: '虎林市', - 230382: '密山市', - 230402: '向阳区', - 230403: '工农区', - 230404: '南山区', - 230405: '兴安区', - 230406: '东山区', - 230407: '兴山区', - 230421: '萝北县', - 230422: '绥滨县', - 230502: '尖山区', - 230503: '岭东区', - 230505: '四方台区', - 230506: '宝山区', - 230521: '集贤县', - 230522: '友谊县', - 230523: '宝清县', - 230524: '饶河县', - 230602: '萨尔图区', - 230603: '龙凤区', - 230604: '让胡路区', - 230605: '红岗区', - 230606: '大同区', - 230621: '肇州县', - 230622: '肇源县', - 230623: '林甸县', - 230624: '杜尔伯特蒙古族自治县', - 230702: '伊春区', - 230703: '南岔区', - 230704: '友好区', - 230705: '西林区', - 230706: '翠峦区', - 230707: '新青区', - 230708: '美溪区', - 230709: '金山屯区', - 230710: '五营区', - 230711: '乌马河区', - 230712: '汤旺河区', - 230713: '带岭区', - 230714: '乌伊岭区', - 230715: '红星区', - 230716: '上甘岭区', - 230722: '嘉荫县', - 230781: '铁力市', - 230803: '向阳区', - 230804: '前进区', - 230805: '东风区', - 230811: '郊区', - 230822: '桦南县', - 230826: '桦川县', - 230828: '汤原县', - 230881: '同江市', - 230882: '富锦市', - 230883: '抚远市', - 230902: '新兴区', - 230903: '桃山区', - 230904: '茄子河区', - 230921: '勃利县', - 231002: '东安区', - 231003: '阳明区', - 231004: '爱民区', - 231005: '西安区', - 231025: '林口县', - 231081: '绥芬河市', - 231083: '海林市', - 231084: '宁安市', - 231085: '穆棱市', - 231086: '东宁市', - 231102: '爱辉区', - 231121: '嫩江县', - 231123: '逊克县', - 231124: '孙吴县', - 231181: '北安市', - 231182: '五大连池市', - 231202: '北林区', - 231221: '望奎县', - 231222: '兰西县', - 231223: '青冈县', - 231224: '庆安县', - 231225: '明水县', - 231226: '绥棱县', - 231281: '安达市', - 231282: '肇东市', - 231283: '海伦市', - 232721: '呼玛县', - 232722: '塔河县', - 232723: '漠河县', - 232790: '松岭区', - 232791: '呼中区', - 232792: '加格达奇区', - 232793: '新林区', - 310101: '黄浦区', - 310104: '徐汇区', - 310105: '长宁区', - 310106: '静安区', - 310107: '普陀区', - 310109: '虹口区', - 310110: '杨浦区', - 310112: '闵行区', - 310113: '宝山区', - 310114: '嘉定区', - 310115: '浦东新区', - 310116: '金山区', - 310117: '松江区', - 310118: '青浦区', - 310120: '奉贤区', - 310151: '崇明区', - 320102: '玄武区', - 320104: '秦淮区', - 320105: '建邺区', - 320106: '鼓楼区', - 320111: '浦口区', - 320113: '栖霞区', - 320114: '雨花台区', - 320115: '江宁区', - 320116: '六合区', - 320117: '溧水区', - 320118: '高淳区', - 320205: '锡山区', - 320206: '惠山区', - 320211: '滨湖区', - 320213: '梁溪区', - 320214: '新吴区', - 320281: '江阴市', - 320282: '宜兴市', - 320302: '鼓楼区', - 320303: '云龙区', - 320305: '贾汪区', - 320311: '泉山区', - 320312: '铜山区', - 320321: '丰县', - 320322: '沛县', - 320324: '睢宁县', - 320381: '新沂市', - 320382: '邳州市', - 320391: '工业园区', - 320402: '天宁区', - 320404: '钟楼区', - 320411: '新北区', - 320412: '武进区', - 320413: '金坛区', - 320481: '溧阳市', - 320505: '虎丘区', - 320506: '吴中区', - 320507: '相城区', - 320508: '姑苏区', - 320509: '吴江区', - 320581: '常熟市', - 320582: '张家港市', - 320583: '昆山市', - 320585: '太仓市', - 320590: '工业园区', - 320591: '高新区', - 320602: '崇川区', - 320611: '港闸区', - 320612: '通州区', - 320621: '海安县', - 320623: '如东县', - 320681: '启东市', - 320682: '如皋市', - 320684: '海门市', - 320691: '高新区', - 320703: '连云区', - 320706: '海州区', - 320707: '赣榆区', - 320722: '东海县', - 320723: '灌云县', - 320724: '灌南县', - 320803: '淮安区', - 320804: '淮阴区', - 320812: '清江浦区', - 320813: '洪泽区', - 320826: '涟水县', - 320830: '盱眙县', - 320831: '金湖县', - 320890: '经济开发区', - 320902: '亭湖区', - 320903: '盐都区', - 320904: '大丰区', - 320921: '响水县', - 320922: '滨海县', - 320923: '阜宁县', - 320924: '射阳县', - 320925: '建湖县', - 320981: '东台市', - 321002: '广陵区', - 321003: '邗江区', - 321012: '江都区', - 321023: '宝应县', - 321081: '仪征市', - 321084: '高邮市', - 321090: '经济开发区', - 321102: '京口区', - 321111: '润州区', - 321112: '丹徒区', - 321181: '丹阳市', - 321182: '扬中市', - 321183: '句容市', - 321202: '海陵区', - 321203: '高港区', - 321204: '姜堰区', - 321281: '兴化市', - 321282: '靖江市', - 321283: '泰兴市', - 321302: '宿城区', - 321311: '宿豫区', - 321322: '沭阳县', - 321323: '泗阳县', - 321324: '泗洪县', - 330102: '上城区', - 330103: '下城区', - 330104: '江干区', - 330105: '拱墅区', - 330106: '西湖区', - 330108: '滨江区', - 330109: '萧山区', - 330110: '余杭区', - 330111: '富阳区', - 330112: '临安区', - 330122: '桐庐县', - 330127: '淳安县', - 330182: '建德市', - 330203: '海曙区', - 330205: '江北区', - 330206: '北仑区', - 330211: '镇海区', - 330212: '鄞州区', - 330213: '奉化区', - 330225: '象山县', - 330226: '宁海县', - 330281: '余姚市', - 330282: '慈溪市', - 330302: '鹿城区', - 330303: '龙湾区', - 330304: '瓯海区', - 330305: '洞头区', - 330324: '永嘉县', - 330326: '平阳县', - 330327: '苍南县', - 330328: '文成县', - 330329: '泰顺县', - 330381: '瑞安市', - 330382: '乐清市', - 330402: '南湖区', - 330411: '秀洲区', - 330421: '嘉善县', - 330424: '海盐县', - 330481: '海宁市', - 330482: '平湖市', - 330483: '桐乡市', - 330502: '吴兴区', - 330503: '南浔区', - 330521: '德清县', - 330522: '长兴县', - 330523: '安吉县', - 330602: '越城区', - 330603: '柯桥区', - 330604: '上虞区', - 330624: '新昌县', - 330681: '诸暨市', - 330683: '嵊州市', - 330702: '婺城区', - 330703: '金东区', - 330723: '武义县', - 330726: '浦江县', - 330727: '磐安县', - 330781: '兰溪市', - 330782: '义乌市', - 330783: '东阳市', - 330784: '永康市', - 330802: '柯城区', - 330803: '衢江区', - 330822: '常山县', - 330824: '开化县', - 330825: '龙游县', - 330881: '江山市', - 330902: '定海区', - 330903: '普陀区', - 330921: '岱山县', - 330922: '嵊泗县', - 331002: '椒江区', - 331003: '黄岩区', - 331004: '路桥区', - 331022: '三门县', - 331023: '天台县', - 331024: '仙居县', - 331081: '温岭市', - 331082: '临海市', - 331083: '玉环市', - 331102: '莲都区', - 331121: '青田县', - 331122: '缙云县', - 331123: '遂昌县', - 331124: '松阳县', - 331125: '云和县', - 331126: '庆元县', - 331127: '景宁畲族自治县', - 331181: '龙泉市', - 340102: '瑶海区', - 340103: '庐阳区', - 340104: '蜀山区', - 340111: '包河区', - 340121: '长丰县', - 340122: '肥东县', - 340123: '肥西县', - 340124: '庐江县', - 340181: '巢湖市', - 340190: '高新技术开发区', - 340191: '经济技术开发区', - 340202: '镜湖区', - 340203: '弋江区', - 340207: '鸠江区', - 340208: '三山区', - 340221: '芜湖县', - 340222: '繁昌县', - 340223: '南陵县', - 340225: '无为县', - 340302: '龙子湖区', - 340303: '蚌山区', - 340304: '禹会区', - 340311: '淮上区', - 340321: '怀远县', - 340322: '五河县', - 340323: '固镇县', - 340402: '大通区', - 340403: '田家庵区', - 340404: '谢家集区', - 340405: '八公山区', - 340406: '潘集区', - 340421: '凤台县', - 340422: '寿县', - 340503: '花山区', - 340504: '雨山区', - 340506: '博望区', - 340521: '当涂县', - 340522: '含山县', - 340523: '和县', - 340602: '杜集区', - 340603: '相山区', - 340604: '烈山区', - 340621: '濉溪县', - 340705: '铜官区', - 340706: '义安区', - 340711: '郊区', - 340722: '枞阳县', - 340802: '迎江区', - 340803: '大观区', - 340811: '宜秀区', - 340822: '怀宁县', - 340824: '潜山县', - 340825: '太湖县', - 340826: '宿松县', - 340827: '望江县', - 340828: '岳西县', - 340881: '桐城市', - 341002: '屯溪区', - 341003: '黄山区', - 341004: '徽州区', - 341021: '歙县', - 341022: '休宁县', - 341023: '黟县', - 341024: '祁门县', - 341102: '琅琊区', - 341103: '南谯区', - 341122: '来安县', - 341124: '全椒县', - 341125: '定远县', - 341126: '凤阳县', - 341181: '天长市', - 341182: '明光市', - 341202: '颍州区', - 341203: '颍东区', - 341204: '颍泉区', - 341221: '临泉县', - 341222: '太和县', - 341225: '阜南县', - 341226: '颍上县', - 341282: '界首市', - 341302: '埇桥区', - 341321: '砀山县', - 341322: '萧县', - 341323: '灵璧县', - 341324: '泗县', - 341390: '经济开发区', - 341502: '金安区', - 341503: '裕安区', - 341504: '叶集区', - 341522: '霍邱县', - 341523: '舒城县', - 341524: '金寨县', - 341525: '霍山县', - 341602: '谯城区', - 341621: '涡阳县', - 341622: '蒙城县', - 341623: '利辛县', - 341702: '贵池区', - 341721: '东至县', - 341722: '石台县', - 341723: '青阳县', - 341802: '宣州区', - 341821: '郎溪县', - 341822: '广德县', - 341823: '泾县', - 341824: '绩溪县', - 341825: '旌德县', - 341881: '宁国市', - 350102: '鼓楼区', - 350103: '台江区', - 350104: '仓山区', - 350105: '马尾区', - 350111: '晋安区', - 350112: '长乐区', - 350121: '闽侯县', - 350122: '连江县', - 350123: '罗源县', - 350124: '闽清县', - 350125: '永泰县', - 350128: '平潭县', - 350181: '福清市', - 350203: '思明区', - 350205: '海沧区', - 350206: '湖里区', - 350211: '集美区', - 350212: '同安区', - 350213: '翔安区', - 350302: '城厢区', - 350303: '涵江区', - 350304: '荔城区', - 350305: '秀屿区', - 350322: '仙游县', - 350402: '梅列区', - 350403: '三元区', - 350421: '明溪县', - 350423: '清流县', - 350424: '宁化县', - 350425: '大田县', - 350426: '尤溪县', - 350427: '沙县', - 350428: '将乐县', - 350429: '泰宁县', - 350430: '建宁县', - 350481: '永安市', - 350502: '鲤城区', - 350503: '丰泽区', - 350504: '洛江区', - 350505: '泉港区', - 350521: '惠安县', - 350524: '安溪县', - 350525: '永春县', - 350526: '德化县', - 350527: '金门县', - 350581: '石狮市', - 350582: '晋江市', - 350583: '南安市', - 350602: '芗城区', - 350603: '龙文区', - 350622: '云霄县', - 350623: '漳浦县', - 350624: '诏安县', - 350625: '长泰县', - 350626: '东山县', - 350627: '南靖县', - 350628: '平和县', - 350629: '华安县', - 350681: '龙海市', - 350702: '延平区', - 350703: '建阳区', - 350721: '顺昌县', - 350722: '浦城县', - 350723: '光泽县', - 350724: '松溪县', - 350725: '政和县', - 350781: '邵武市', - 350782: '武夷山市', - 350783: '建瓯市', - 350802: '新罗区', - 350803: '永定区', - 350821: '长汀县', - 350823: '上杭县', - 350824: '武平县', - 350825: '连城县', - 350881: '漳平市', - 350902: '蕉城区', - 350921: '霞浦县', - 350922: '古田县', - 350923: '屏南县', - 350924: '寿宁县', - 350925: '周宁县', - 350926: '柘荣县', - 350981: '福安市', - 350982: '福鼎市', - 360102: '东湖区', - 360103: '西湖区', - 360104: '青云谱区', - 360105: '湾里区', - 360111: '青山湖区', - 360112: '新建区', - 360121: '南昌县', - 360123: '安义县', - 360124: '进贤县', - 360190: '经济技术开发区', - 360192: '高新区', - 360202: '昌江区', - 360203: '珠山区', - 360222: '浮梁县', - 360281: '乐平市', - 360302: '安源区', - 360313: '湘东区', - 360321: '莲花县', - 360322: '上栗县', - 360323: '芦溪县', - 360402: '濂溪区', - 360403: '浔阳区', - 360404: '柴桑区', - 360423: '武宁县', - 360424: '修水县', - 360425: '永修县', - 360426: '德安县', - 360428: '都昌县', - 360429: '湖口县', - 360430: '彭泽县', - 360481: '瑞昌市', - 360482: '共青城市', - 360483: '庐山市', - 360490: '经济技术开发区', - 360502: '渝水区', - 360521: '分宜县', - 360602: '月湖区', - 360622: '余江县', - 360681: '贵溪市', - 360702: '章贡区', - 360703: '南康区', - 360704: '赣县区', - 360722: '信丰县', - 360723: '大余县', - 360724: '上犹县', - 360725: '崇义县', - 360726: '安远县', - 360727: '龙南县', - 360728: '定南县', - 360729: '全南县', - 360730: '宁都县', - 360731: '于都县', - 360732: '兴国县', - 360733: '会昌县', - 360734: '寻乌县', - 360735: '石城县', - 360781: '瑞金市', - 360802: '吉州区', - 360803: '青原区', - 360821: '吉安县', - 360822: '吉水县', - 360823: '峡江县', - 360824: '新干县', - 360825: '永丰县', - 360826: '泰和县', - 360827: '遂川县', - 360828: '万安县', - 360829: '安福县', - 360830: '永新县', - 360881: '井冈山市', - 360902: '袁州区', - 360921: '奉新县', - 360922: '万载县', - 360923: '上高县', - 360924: '宜丰县', - 360925: '靖安县', - 360926: '铜鼓县', - 360981: '丰城市', - 360982: '樟树市', - 360983: '高安市', - 361002: '临川区', - 361003: '东乡区', - 361021: '南城县', - 361022: '黎川县', - 361023: '南丰县', - 361024: '崇仁县', - 361025: '乐安县', - 361026: '宜黄县', - 361027: '金溪县', - 361028: '资溪县', - 361030: '广昌县', - 361102: '信州区', - 361103: '广丰区', - 361121: '上饶县', - 361123: '玉山县', - 361124: '铅山县', - 361125: '横峰县', - 361126: '弋阳县', - 361127: '余干县', - 361128: '鄱阳县', - 361129: '万年县', - 361130: '婺源县', - 361181: '德兴市', - 370102: '历下区', - 370103: '市中区', - 370104: '槐荫区', - 370105: '天桥区', - 370112: '历城区', - 370113: '长清区', - 370114: '章丘区', - 370124: '平阴县', - 370125: '济阳县', - 370126: '商河县', - 370190: '高新区', - 370202: '市南区', - 370203: '市北区', - 370211: '黄岛区', - 370212: '崂山区', - 370213: '李沧区', - 370214: '城阳区', - 370215: '即墨区', - 370281: '胶州市', - 370283: '平度市', - 370285: '莱西市', - 370290: '开发区', - 370302: '淄川区', - 370303: '张店区', - 370304: '博山区', - 370305: '临淄区', - 370306: '周村区', - 370321: '桓台县', - 370322: '高青县', - 370323: '沂源县', - 370402: '市中区', - 370403: '薛城区', - 370404: '峄城区', - 370405: '台儿庄区', - 370406: '山亭区', - 370481: '滕州市', - 370502: '东营区', - 370503: '河口区', - 370505: '垦利区', - 370522: '利津县', - 370523: '广饶县', - 370602: '芝罘区', - 370611: '福山区', - 370612: '牟平区', - 370613: '莱山区', - 370634: '长岛县', - 370681: '龙口市', - 370682: '莱阳市', - 370683: '莱州市', - 370684: '蓬莱市', - 370685: '招远市', - 370686: '栖霞市', - 370687: '海阳市', - 370690: '开发区', - 370702: '潍城区', - 370703: '寒亭区', - 370704: '坊子区', - 370705: '奎文区', - 370724: '临朐县', - 370725: '昌乐县', - 370781: '青州市', - 370782: '诸城市', - 370783: '寿光市', - 370784: '安丘市', - 370785: '高密市', - 370786: '昌邑市', - 370790: '开发区', - 370791: '高新区', - 370811: '任城区', - 370812: '兖州区', - 370826: '微山县', - 370827: '鱼台县', - 370828: '金乡县', - 370829: '嘉祥县', - 370830: '汶上县', - 370831: '泗水县', - 370832: '梁山县', - 370881: '曲阜市', - 370883: '邹城市', - 370890: '高新区', - 370902: '泰山区', - 370911: '岱岳区', - 370921: '宁阳县', - 370923: '东平县', - 370982: '新泰市', - 370983: '肥城市', - 371002: '环翠区', - 371003: '文登区', - 371082: '荣成市', - 371083: '乳山市', - 371091: '经济技术开发区', - 371102: '东港区', - 371103: '岚山区', - 371121: '五莲县', - 371122: '莒县', - 371202: '莱城区', - 371203: '钢城区', - 371302: '兰山区', - 371311: '罗庄区', - 371312: '河东区', - 371321: '沂南县', - 371322: '郯城县', - 371323: '沂水县', - 371324: '兰陵县', - 371325: '费县', - 371326: '平邑县', - 371327: '莒南县', - 371328: '蒙阴县', - 371329: '临沭县', - 371402: '德城区', - 371403: '陵城区', - 371422: '宁津县', - 371423: '庆云县', - 371424: '临邑县', - 371425: '齐河县', - 371426: '平原县', - 371427: '夏津县', - 371428: '武城县', - 371481: '乐陵市', - 371482: '禹城市', - 371502: '东昌府区', - 371521: '阳谷县', - 371522: '莘县', - 371523: '茌平县', - 371524: '东阿县', - 371525: '冠县', - 371526: '高唐县', - 371581: '临清市', - 371602: '滨城区', - 371603: '沾化区', - 371621: '惠民县', - 371622: '阳信县', - 371623: '无棣县', - 371625: '博兴县', - 371626: '邹平县', - 371702: '牡丹区', - 371703: '定陶区', - 371721: '曹县', - 371722: '单县', - 371723: '成武县', - 371724: '巨野县', - 371725: '郓城县', - 371726: '鄄城县', - 371728: '东明县', - 410102: '中原区', - 410103: '二七区', - 410104: '管城回族区', - 410105: '金水区', - 410106: '上街区', - 410108: '惠济区', - 410122: '中牟县', - 410181: '巩义市', - 410182: '荥阳市', - 410183: '新密市', - 410184: '新郑市', - 410185: '登封市', - 410190: '高新技术开发区', - 410191: '经济技术开发区', - 410202: '龙亭区', - 410203: '顺河回族区', - 410204: '鼓楼区', - 410205: '禹王台区', - 410212: '祥符区', - 410221: '杞县', - 410222: '通许县', - 410223: '尉氏县', - 410225: '兰考县', - 410302: '老城区', - 410303: '西工区', - 410304: '瀍河回族区', - 410305: '涧西区', - 410306: '吉利区', - 410311: '洛龙区', - 410322: '孟津县', - 410323: '新安县', - 410324: '栾川县', - 410325: '嵩县', - 410326: '汝阳县', - 410327: '宜阳县', - 410328: '洛宁县', - 410329: '伊川县', - 410381: '偃师市', - 410402: '新华区', - 410403: '卫东区', - 410404: '石龙区', - 410411: '湛河区', - 410421: '宝丰县', - 410422: '叶县', - 410423: '鲁山县', - 410425: '郏县', - 410481: '舞钢市', - 410482: '汝州市', - 410502: '文峰区', - 410503: '北关区', - 410505: '殷都区', - 410506: '龙安区', - 410522: '安阳县', - 410523: '汤阴县', - 410526: '滑县', - 410527: '内黄县', - 410581: '林州市', - 410590: '开发区', - 410602: '鹤山区', - 410603: '山城区', - 410611: '淇滨区', - 410621: '浚县', - 410622: '淇县', - 410702: '红旗区', - 410703: '卫滨区', - 410704: '凤泉区', - 410711: '牧野区', - 410721: '新乡县', - 410724: '获嘉县', - 410725: '原阳县', - 410726: '延津县', - 410727: '封丘县', - 410728: '长垣县', - 410781: '卫辉市', - 410782: '辉县市', - 410802: '解放区', - 410803: '中站区', - 410804: '马村区', - 410811: '山阳区', - 410821: '修武县', - 410822: '博爱县', - 410823: '武陟县', - 410825: '温县', - 410882: '沁阳市', - 410883: '孟州市', - 410902: '华龙区', - 410922: '清丰县', - 410923: '南乐县', - 410926: '范县', - 410927: '台前县', - 410928: '濮阳县', - 411002: '魏都区', - 411003: '建安区', - 411024: '鄢陵县', - 411025: '襄城县', - 411081: '禹州市', - 411082: '长葛市', - 411102: '源汇区', - 411103: '郾城区', - 411104: '召陵区', - 411121: '舞阳县', - 411122: '临颍县', - 411202: '湖滨区', - 411203: '陕州区', - 411221: '渑池县', - 411224: '卢氏县', - 411281: '义马市', - 411282: '灵宝市', - 411302: '宛城区', - 411303: '卧龙区', - 411321: '南召县', - 411322: '方城县', - 411323: '西峡县', - 411324: '镇平县', - 411325: '内乡县', - 411326: '淅川县', - 411327: '社旗县', - 411328: '唐河县', - 411329: '新野县', - 411330: '桐柏县', - 411381: '邓州市', - 411402: '梁园区', - 411403: '睢阳区', - 411421: '民权县', - 411422: '睢县', - 411423: '宁陵县', - 411424: '柘城县', - 411425: '虞城县', - 411426: '夏邑县', - 411481: '永城市', - 411502: '浉河区', - 411503: '平桥区', - 411521: '罗山县', - 411522: '光山县', - 411523: '新县', - 411524: '商城县', - 411525: '固始县', - 411526: '潢川县', - 411527: '淮滨县', - 411528: '息县', - 411602: '川汇区', - 411621: '扶沟县', - 411622: '西华县', - 411623: '商水县', - 411624: '沈丘县', - 411625: '郸城县', - 411626: '淮阳县', - 411627: '太康县', - 411628: '鹿邑县', - 411681: '项城市', - 411690: '经济开发区', - 411702: '驿城区', - 411721: '西平县', - 411722: '上蔡县', - 411723: '平舆县', - 411724: '正阳县', - 411725: '确山县', - 411726: '泌阳县', - 411727: '汝南县', - 411728: '遂平县', - 411729: '新蔡县', - 419001: '济源市', - 420102: '江岸区', - 420103: '江汉区', - 420104: '硚口区', - 420105: '汉阳区', - 420106: '武昌区', - 420107: '青山区', - 420111: '洪山区', - 420112: '东西湖区', - 420113: '汉南区', - 420114: '蔡甸区', - 420115: '江夏区', - 420116: '黄陂区', - 420117: '新洲区', - 420202: '黄石港区', - 420203: '西塞山区', - 420204: '下陆区', - 420205: '铁山区', - 420222: '阳新县', - 420281: '大冶市', - 420302: '茅箭区', - 420303: '张湾区', - 420304: '郧阳区', - 420322: '郧西县', - 420323: '竹山县', - 420324: '竹溪县', - 420325: '房县', - 420381: '丹江口市', - 420502: '西陵区', - 420503: '伍家岗区', - 420504: '点军区', - 420505: '猇亭区', - 420506: '夷陵区', - 420525: '远安县', - 420526: '兴山县', - 420527: '秭归县', - 420528: '长阳土家族自治县', - 420529: '五峰土家族自治县', - 420581: '宜都市', - 420582: '当阳市', - 420583: '枝江市', - 420590: '经济开发区', - 420602: '襄城区', - 420606: '樊城区', - 420607: '襄州区', - 420624: '南漳县', - 420625: '谷城县', - 420626: '保康县', - 420682: '老河口市', - 420683: '枣阳市', - 420684: '宜城市', - 420702: '梁子湖区', - 420703: '华容区', - 420704: '鄂城区', - 420802: '东宝区', - 420804: '掇刀区', - 420821: '京山县', - 420822: '沙洋县', - 420881: '钟祥市', - 420902: '孝南区', - 420921: '孝昌县', - 420922: '大悟县', - 420923: '云梦县', - 420981: '应城市', - 420982: '安陆市', - 420984: '汉川市', - 421002: '沙市区', - 421003: '荆州区', - 421022: '公安县', - 421023: '监利县', - 421024: '江陵县', - 421081: '石首市', - 421083: '洪湖市', - 421087: '松滋市', - 421102: '黄州区', - 421121: '团风县', - 421122: '红安县', - 421123: '罗田县', - 421124: '英山县', - 421125: '浠水县', - 421126: '蕲春县', - 421127: '黄梅县', - 421181: '麻城市', - 421182: '武穴市', - 421202: '咸安区', - 421221: '嘉鱼县', - 421222: '通城县', - 421223: '崇阳县', - 421224: '通山县', - 421281: '赤壁市', - 421303: '曾都区', - 421321: '随县', - 421381: '广水市', - 422801: '恩施市', - 422802: '利川市', - 422822: '建始县', - 422823: '巴东县', - 422825: '宣恩县', - 422826: '咸丰县', - 422827: '来凤县', - 422828: '鹤峰县', - 429004: '仙桃市', - 429005: '潜江市', - 429006: '天门市', - 429021: '神农架林区', - 430102: '芙蓉区', - 430103: '天心区', - 430104: '岳麓区', - 430105: '开福区', - 430111: '雨花区', - 430112: '望城区', - 430121: '长沙县', - 430181: '浏阳市', - 430182: '宁乡市', - 430202: '荷塘区', - 430203: '芦淞区', - 430204: '石峰区', - 430211: '天元区', - 430221: '株洲县', - 430223: '攸县', - 430224: '茶陵县', - 430225: '炎陵县', - 430281: '醴陵市', - 430302: '雨湖区', - 430304: '岳塘区', - 430321: '湘潭县', - 430381: '湘乡市', - 430382: '韶山市', - 430405: '珠晖区', - 430406: '雁峰区', - 430407: '石鼓区', - 430408: '蒸湘区', - 430412: '南岳区', - 430421: '衡阳县', - 430422: '衡南县', - 430423: '衡山县', - 430424: '衡东县', - 430426: '祁东县', - 430481: '耒阳市', - 430482: '常宁市', - 430502: '双清区', - 430503: '大祥区', - 430511: '北塔区', - 430521: '邵东县', - 430522: '新邵县', - 430523: '邵阳县', - 430524: '隆回县', - 430525: '洞口县', - 430527: '绥宁县', - 430528: '新宁县', - 430529: '城步苗族自治县', - 430581: '武冈市', - 430602: '岳阳楼区', - 430603: '云溪区', - 430611: '君山区', - 430621: '岳阳县', - 430623: '华容县', - 430624: '湘阴县', - 430626: '平江县', - 430681: '汨罗市', - 430682: '临湘市', - 430702: '武陵区', - 430703: '鼎城区', - 430721: '安乡县', - 430722: '汉寿县', - 430723: '澧县', - 430724: '临澧县', - 430725: '桃源县', - 430726: '石门县', - 430781: '津市市', - 430802: '永定区', - 430811: '武陵源区', - 430821: '慈利县', - 430822: '桑植县', - 430902: '资阳区', - 430903: '赫山区', - 430921: '南县', - 430922: '桃江县', - 430923: '安化县', - 430981: '沅江市', - 431002: '北湖区', - 431003: '苏仙区', - 431021: '桂阳县', - 431022: '宜章县', - 431023: '永兴县', - 431024: '嘉禾县', - 431025: '临武县', - 431026: '汝城县', - 431027: '桂东县', - 431028: '安仁县', - 431081: '资兴市', - 431102: '零陵区', - 431103: '冷水滩区', - 431121: '祁阳县', - 431122: '东安县', - 431123: '双牌县', - 431124: '道县', - 431125: '江永县', - 431126: '宁远县', - 431127: '蓝山县', - 431128: '新田县', - 431129: '江华瑶族自治县', - 431202: '鹤城区', - 431221: '中方县', - 431222: '沅陵县', - 431223: '辰溪县', - 431224: '溆浦县', - 431225: '会同县', - 431226: '麻阳苗族自治县', - 431227: '新晃侗族自治县', - 431228: '芷江侗族自治县', - 431229: '靖州苗族侗族自治县', - 431230: '通道侗族自治县', - 431281: '洪江市', - 431302: '娄星区', - 431321: '双峰县', - 431322: '新化县', - 431381: '冷水江市', - 431382: '涟源市', - 433101: '吉首市', - 433122: '泸溪县', - 433123: '凤凰县', - 433124: '花垣县', - 433125: '保靖县', - 433126: '古丈县', - 433127: '永顺县', - 433130: '龙山县', - 440103: '荔湾区', - 440104: '越秀区', - 440105: '海珠区', - 440106: '天河区', - 440111: '白云区', - 440112: '黄埔区', - 440113: '番禺区', - 440114: '花都区', - 440115: '南沙区', - 440117: '从化区', - 440118: '增城区', - 440203: '武江区', - 440204: '浈江区', - 440205: '曲江区', - 440222: '始兴县', - 440224: '仁化县', - 440229: '翁源县', - 440232: '乳源瑶族自治县', - 440233: '新丰县', - 440281: '乐昌市', - 440282: '南雄市', - 440303: '罗湖区', - 440304: '福田区', - 440305: '南山区', - 440306: '宝安区', - 440307: '龙岗区', - 440308: '盐田区', - 440309: '龙华区', - 440310: '坪山区', - 440402: '香洲区', - 440403: '斗门区', - 440404: '金湾区', - 440507: '龙湖区', - 440511: '金平区', - 440512: '濠江区', - 440513: '潮阳区', - 440514: '潮南区', - 440515: '澄海区', - 440523: '南澳县', - 440604: '禅城区', - 440605: '南海区', - 440606: '顺德区', - 440607: '三水区', - 440608: '高明区', - 440703: '蓬江区', - 440704: '江海区', - 440705: '新会区', - 440781: '台山市', - 440783: '开平市', - 440784: '鹤山市', - 440785: '恩平市', - 440802: '赤坎区', - 440803: '霞山区', - 440804: '坡头区', - 440811: '麻章区', - 440823: '遂溪县', - 440825: '徐闻县', - 440881: '廉江市', - 440882: '雷州市', - 440883: '吴川市', - 440890: '经济技术开发区', - 440902: '茂南区', - 440904: '电白区', - 440981: '高州市', - 440982: '化州市', - 440983: '信宜市', - 441202: '端州区', - 441203: '鼎湖区', - 441204: '高要区', - 441223: '广宁县', - 441224: '怀集县', - 441225: '封开县', - 441226: '德庆县', - 441284: '四会市', - 441302: '惠城区', - 441303: '惠阳区', - 441322: '博罗县', - 441323: '惠东县', - 441324: '龙门县', - 441402: '梅江区', - 441403: '梅县区', - 441422: '大埔县', - 441423: '丰顺县', - 441424: '五华县', - 441426: '平远县', - 441427: '蕉岭县', - 441481: '兴宁市', - 441502: '城区', - 441521: '海丰县', - 441523: '陆河县', - 441581: '陆丰市', - 441602: '源城区', - 441621: '紫金县', - 441622: '龙川县', - 441623: '连平县', - 441624: '和平县', - 441625: '东源县', - 441702: '江城区', - 441704: '阳东区', - 441721: '阳西县', - 441781: '阳春市', - 441802: '清城区', - 441803: '清新区', - 441821: '佛冈县', - 441823: '阳山县', - 441825: '连山壮族瑶族自治县', - 441826: '连南瑶族自治县', - 441881: '英德市', - 441882: '连州市', - 441901: '中堂镇', - 441903: '南城区', - 441904: '长安镇', - 441905: '东坑镇', - 441906: '樟木头镇', - 441907: '莞城区', - 441908: '石龙镇', - 441909: '桥头镇', - 441910: '万江区', - 441911: '麻涌镇', - 441912: '虎门镇', - 441913: '谢岗镇', - 441914: '石碣镇', - 441915: '茶山镇', - 441916: '东城区', - 441917: '洪梅镇', - 441918: '道滘镇', - 441919: '高埗镇', - 441920: '企石镇', - 441921: '凤岗镇', - 441922: '大岭山镇', - 441923: '松山湖', - 441924: '清溪镇', - 441925: '望牛墩镇', - 441926: '厚街镇', - 441927: '常平镇', - 441928: '寮步镇', - 441929: '石排镇', - 441930: '横沥镇', - 441931: '塘厦镇', - 441932: '黄江镇', - 441933: '大朗镇', - 441990: '沙田镇', - 442001: '南头镇', - 442002: '神湾镇', - 442003: '东凤镇', - 442004: '五桂山镇', - 442005: '黄圃镇', - 442006: '小榄镇', - 442007: '石岐区街道', - 442008: '横栏镇', - 442009: '三角镇', - 442010: '三乡镇', - 442011: '港口镇', - 442012: '沙溪镇', - 442013: '板芙镇', - 442014: '沙朗镇', - 442015: '东升镇', - 442016: '阜沙镇', - 442017: '民众镇', - 442018: '东区街道', - 442019: '火炬开发区', - 442020: '西区街道', - 442021: '南区街道', - 442022: '古镇', - 442023: '坦洲镇', - 442024: '大涌镇', - 442025: '南朗镇', - 445102: '湘桥区', - 445103: '潮安区', - 445122: '饶平县', - 445202: '榕城区', - 445203: '揭东区', - 445222: '揭西县', - 445224: '惠来县', - 445281: '普宁市', - 445302: '云城区', - 445303: '云安区', - 445321: '新兴县', - 445322: '郁南县', - 445381: '罗定市', - 450102: '兴宁区', - 450103: '青秀区', - 450105: '江南区', - 450107: '西乡塘区', - 450108: '良庆区', - 450109: '邕宁区', - 450110: '武鸣区', - 450123: '隆安县', - 450124: '马山县', - 450125: '上林县', - 450126: '宾阳县', - 450127: '横县', - 450202: '城中区', - 450203: '鱼峰区', - 450204: '柳南区', - 450205: '柳北区', - 450206: '柳江区', - 450222: '柳城县', - 450223: '鹿寨县', - 450224: '融安县', - 450225: '融水苗族自治县', - 450226: '三江侗族自治县', - 450302: '秀峰区', - 450303: '叠彩区', - 450304: '象山区', - 450305: '七星区', - 450311: '雁山区', - 450312: '临桂区', - 450321: '阳朔县', - 450323: '灵川县', - 450324: '全州县', - 450325: '兴安县', - 450326: '永福县', - 450327: '灌阳县', - 450328: '龙胜各族自治县', - 450329: '资源县', - 450330: '平乐县', - 450331: '荔浦县', - 450332: '恭城瑶族自治县', - 450403: '万秀区', - 450405: '长洲区', - 450406: '龙圩区', - 450421: '苍梧县', - 450422: '藤县', - 450423: '蒙山县', - 450481: '岑溪市', - 450502: '海城区', - 450503: '银海区', - 450512: '铁山港区', - 450521: '合浦县', - 450602: '港口区', - 450603: '防城区', - 450621: '上思县', - 450681: '东兴市', - 450702: '钦南区', - 450703: '钦北区', - 450721: '灵山县', - 450722: '浦北县', - 450802: '港北区', - 450803: '港南区', - 450804: '覃塘区', - 450821: '平南县', - 450881: '桂平市', - 450902: '玉州区', - 450903: '福绵区', - 450921: '容县', - 450922: '陆川县', - 450923: '博白县', - 450924: '兴业县', - 450981: '北流市', - 451002: '右江区', - 451021: '田阳县', - 451022: '田东县', - 451023: '平果县', - 451024: '德保县', - 451026: '那坡县', - 451027: '凌云县', - 451028: '乐业县', - 451029: '田林县', - 451030: '西林县', - 451031: '隆林各族自治县', - 451081: '靖西市', - 451102: '八步区', - 451103: '平桂区', - 451121: '昭平县', - 451122: '钟山县', - 451123: '富川瑶族自治县', - 451202: '金城江区', - 451203: '宜州区', - 451221: '南丹县', - 451222: '天峨县', - 451223: '凤山县', - 451224: '东兰县', - 451225: '罗城仫佬族自治县', - 451226: '环江毛南族自治县', - 451227: '巴马瑶族自治县', - 451228: '都安瑶族自治县', - 451229: '大化瑶族自治县', - 451302: '兴宾区', - 451321: '忻城县', - 451322: '象州县', - 451323: '武宣县', - 451324: '金秀瑶族自治县', - 451381: '合山市', - 451402: '江州区', - 451421: '扶绥县', - 451422: '宁明县', - 451423: '龙州县', - 451424: '大新县', - 451425: '天等县', - 451481: '凭祥市', - 460105: '秀英区', - 460106: '龙华区', - 460107: '琼山区', - 460108: '美兰区', - 460202: '海棠区', - 460203: '吉阳区', - 460204: '天涯区', - 460205: '崖州区', - 460321: '西沙群岛', - 460322: '南沙群岛', - 460323: '中沙群岛的岛礁及其海域', - 460401: '那大镇', - 460402: '和庆镇', - 460403: '南丰镇', - 460404: '大成镇', - 460405: '雅星镇', - 460406: '兰洋镇', - 460407: '光村镇', - 460408: '木棠镇', - 460409: '海头镇', - 460410: '峨蔓镇', - 460411: '王五镇', - 460412: '白马井镇', - 460413: '中和镇', - 460414: '排浦镇', - 460415: '东成镇', - 460416: '新州镇', - 469001: '五指山市', - 469002: '琼海市', - 469005: '文昌市', - 469006: '万宁市', - 469007: '东方市', - 469021: '定安县', - 469022: '屯昌县', - 469023: '澄迈县', - 469024: '临高县', - 469025: '白沙黎族自治县', - 469026: '昌江黎族自治县', - 469027: '乐东黎族自治县', - 469028: '陵水黎族自治县', - 469029: '保亭黎族苗族自治县', - 469030: '琼中黎族苗族自治县', - 500101: '万州区', - 500102: '涪陵区', - 500103: '渝中区', - 500104: '大渡口区', - 500105: '江北区', - 500106: '沙坪坝区', - 500107: '九龙坡区', - 500108: '南岸区', - 500109: '北碚区', - 500110: '綦江区', - 500111: '大足区', - 500112: '渝北区', - 500113: '巴南区', - 500114: '黔江区', - 500115: '长寿区', - 500116: '江津区', - 500117: '合川区', - 500118: '永川区', - 500119: '南川区', - 500120: '璧山区', - 500151: '铜梁区', - 500152: '潼南区', - 500153: '荣昌区', - 500154: '开州区', - 500155: '梁平区', - 500156: '武隆区', - 500229: '城口县', - 500230: '丰都县', - 500231: '垫江县', - 500233: '忠县', - 500235: '云阳县', - 500236: '奉节县', - 500237: '巫山县', - 500238: '巫溪县', - 500240: '石柱土家族自治县', - 500241: '秀山土家族苗族自治县', - 500242: '酉阳土家族苗族自治县', - 500243: '彭水苗族土家族自治县', - 510104: '锦江区', - 510105: '青羊区', - 510106: '金牛区', - 510107: '武侯区', - 510108: '成华区', - 510112: '龙泉驿区', - 510113: '青白江区', - 510114: '新都区', - 510115: '温江区', - 510116: '双流区', - 510117: '郫都区', - 510121: '金堂县', - 510129: '大邑县', - 510131: '蒲江县', - 510132: '新津县', - 510181: '都江堰市', - 510182: '彭州市', - 510183: '邛崃市', - 510184: '崇州市', - 510185: '简阳市', - 510191: '高新区', - 510302: '自流井区', - 510303: '贡井区', - 510304: '大安区', - 510311: '沿滩区', - 510321: '荣县', - 510322: '富顺县', - 510402: '东区', - 510403: '西区', - 510411: '仁和区', - 510421: '米易县', - 510422: '盐边县', - 510502: '江阳区', - 510503: '纳溪区', - 510504: '龙马潭区', - 510521: '泸县', - 510522: '合江县', - 510524: '叙永县', - 510525: '古蔺县', - 510603: '旌阳区', - 510604: '罗江区', - 510623: '中江县', - 510681: '广汉市', - 510682: '什邡市', - 510683: '绵竹市', - 510703: '涪城区', - 510704: '游仙区', - 510705: '安州区', - 510722: '三台县', - 510723: '盐亭县', - 510725: '梓潼县', - 510726: '北川羌族自治县', - 510727: '平武县', - 510781: '江油市', - 510791: '高新区', - 510802: '利州区', - 510811: '昭化区', - 510812: '朝天区', - 510821: '旺苍县', - 510822: '青川县', - 510823: '剑阁县', - 510824: '苍溪县', - 510903: '船山区', - 510904: '安居区', - 510921: '蓬溪县', - 510922: '射洪县', - 510923: '大英县', - 511002: '市中区', - 511011: '东兴区', - 511024: '威远县', - 511025: '资中县', - 511083: '隆昌市', - 511102: '市中区', - 511111: '沙湾区', - 511112: '五通桥区', - 511113: '金口河区', - 511123: '犍为县', - 511124: '井研县', - 511126: '夹江县', - 511129: '沐川县', - 511132: '峨边彝族自治县', - 511133: '马边彝族自治县', - 511181: '峨眉山市', - 511302: '顺庆区', - 511303: '高坪区', - 511304: '嘉陵区', - 511321: '南部县', - 511322: '营山县', - 511323: '蓬安县', - 511324: '仪陇县', - 511325: '西充县', - 511381: '阆中市', - 511402: '东坡区', - 511403: '彭山区', - 511421: '仁寿县', - 511423: '洪雅县', - 511424: '丹棱县', - 511425: '青神县', - 511502: '翠屏区', - 511503: '南溪区', - 511521: '宜宾县', - 511523: '江安县', - 511524: '长宁县', - 511525: '高县', - 511526: '珙县', - 511527: '筠连县', - 511528: '兴文县', - 511529: '屏山县', - 511602: '广安区', - 511603: '前锋区', - 511621: '岳池县', - 511622: '武胜县', - 511623: '邻水县', - 511681: '华蓥市', - 511702: '通川区', - 511703: '达川区', - 511722: '宣汉县', - 511723: '开江县', - 511724: '大竹县', - 511725: '渠县', - 511781: '万源市', - 511802: '雨城区', - 511803: '名山区', - 511822: '荥经县', - 511823: '汉源县', - 511824: '石棉县', - 511825: '天全县', - 511826: '芦山县', - 511827: '宝兴县', - 511902: '巴州区', - 511903: '恩阳区', - 511921: '通江县', - 511922: '南江县', - 511923: '平昌县', - 512002: '雁江区', - 512021: '安岳县', - 512022: '乐至县', - 513201: '马尔康市', - 513221: '汶川县', - 513222: '理县', - 513223: '茂县', - 513224: '松潘县', - 513225: '九寨沟县', - 513226: '金川县', - 513227: '小金县', - 513228: '黑水县', - 513230: '壤塘县', - 513231: '阿坝县', - 513232: '若尔盖县', - 513233: '红原县', - 513301: '康定市', - 513322: '泸定县', - 513323: '丹巴县', - 513324: '九龙县', - 513325: '雅江县', - 513326: '道孚县', - 513327: '炉霍县', - 513328: '甘孜县', - 513329: '新龙县', - 513330: '德格县', - 513331: '白玉县', - 513332: '石渠县', - 513333: '色达县', - 513334: '理塘县', - 513335: '巴塘县', - 513336: '乡城县', - 513337: '稻城县', - 513338: '得荣县', - 513401: '西昌市', - 513422: '木里藏族自治县', - 513423: '盐源县', - 513424: '德昌县', - 513425: '会理县', - 513426: '会东县', - 513427: '宁南县', - 513428: '普格县', - 513429: '布拖县', - 513430: '金阳县', - 513431: '昭觉县', - 513432: '喜德县', - 513433: '冕宁县', - 513434: '越西县', - 513435: '甘洛县', - 513436: '美姑县', - 513437: '雷波县', - 520102: '南明区', - 520103: '云岩区', - 520111: '花溪区', - 520112: '乌当区', - 520113: '白云区', - 520115: '观山湖区', - 520121: '开阳县', - 520122: '息烽县', - 520123: '修文县', - 520181: '清镇市', - 520201: '钟山区', - 520203: '六枝特区', - 520221: '水城县', - 520281: '盘州市', - 520302: '红花岗区', - 520303: '汇川区', - 520304: '播州区', - 520322: '桐梓县', - 520323: '绥阳县', - 520324: '正安县', - 520325: '道真仡佬族苗族自治县', - 520326: '务川仡佬族苗族自治县', - 520327: '凤冈县', - 520328: '湄潭县', - 520329: '余庆县', - 520330: '习水县', - 520381: '赤水市', - 520382: '仁怀市', - 520402: '西秀区', - 520403: '平坝区', - 520422: '普定县', - 520423: '镇宁布依族苗族自治县', - 520424: '关岭布依族苗族自治县', - 520425: '紫云苗族布依族自治县', - 520502: '七星关区', - 520521: '大方县', - 520522: '黔西县', - 520523: '金沙县', - 520524: '织金县', - 520525: '纳雍县', - 520526: '威宁彝族回族苗族自治县', - 520527: '赫章县', - 520602: '碧江区', - 520603: '万山区', - 520621: '江口县', - 520622: '玉屏侗族自治县', - 520623: '石阡县', - 520624: '思南县', - 520625: '印江土家族苗族自治县', - 520626: '德江县', - 520627: '沿河土家族自治县', - 520628: '松桃苗族自治县', - 522301: '兴义市', - 522322: '兴仁县', - 522323: '普安县', - 522324: '晴隆县', - 522325: '贞丰县', - 522326: '望谟县', - 522327: '册亨县', - 522328: '安龙县', - 522601: '凯里市', - 522622: '黄平县', - 522623: '施秉县', - 522624: '三穗县', - 522625: '镇远县', - 522626: '岑巩县', - 522627: '天柱县', - 522628: '锦屏县', - 522629: '剑河县', - 522630: '台江县', - 522631: '黎平县', - 522632: '榕江县', - 522633: '从江县', - 522634: '雷山县', - 522635: '麻江县', - 522636: '丹寨县', - 522701: '都匀市', - 522702: '福泉市', - 522722: '荔波县', - 522723: '贵定县', - 522725: '瓮安县', - 522726: '独山县', - 522727: '平塘县', - 522728: '罗甸县', - 522729: '长顺县', - 522730: '龙里县', - 522731: '惠水县', - 522732: '三都水族自治县', - 530102: '五华区', - 530103: '盘龙区', - 530111: '官渡区', - 530112: '西山区', - 530113: '东川区', - 530114: '呈贡区', - 530115: '晋宁区', - 530124: '富民县', - 530125: '宜良县', - 530126: '石林彝族自治县', - 530127: '嵩明县', - 530128: '禄劝彝族苗族自治县', - 530129: '寻甸回族彝族自治县', - 530181: '安宁市', - 530302: '麒麟区', - 530303: '沾益区', - 530321: '马龙县', - 530322: '陆良县', - 530323: '师宗县', - 530324: '罗平县', - 530325: '富源县', - 530326: '会泽县', - 530381: '宣威市', - 530402: '红塔区', - 530403: '江川区', - 530422: '澄江县', - 530423: '通海县', - 530424: '华宁县', - 530425: '易门县', - 530426: '峨山彝族自治县', - 530427: '新平彝族傣族自治县', - 530428: '元江哈尼族彝族傣族自治县', - 530502: '隆阳区', - 530521: '施甸县', - 530523: '龙陵县', - 530524: '昌宁县', - 530581: '腾冲市', - 530602: '昭阳区', - 530621: '鲁甸县', - 530622: '巧家县', - 530623: '盐津县', - 530624: '大关县', - 530625: '永善县', - 530626: '绥江县', - 530627: '镇雄县', - 530628: '彝良县', - 530629: '威信县', - 530630: '水富县', - 530702: '古城区', - 530721: '玉龙纳西族自治县', - 530722: '永胜县', - 530723: '华坪县', - 530724: '宁蒗彝族自治县', - 530802: '思茅区', - 530821: '宁洱哈尼族彝族自治县', - 530822: '墨江哈尼族自治县', - 530823: '景东彝族自治县', - 530824: '景谷傣族彝族自治县', - 530825: '镇沅彝族哈尼族拉祜族自治县', - 530826: '江城哈尼族彝族自治县', - 530827: '孟连傣族拉祜族佤族自治县', - 530828: '澜沧拉祜族自治县', - 530829: '西盟佤族自治县', - 530902: '临翔区', - 530921: '凤庆县', - 530922: '云县', - 530923: '永德县', - 530924: '镇康县', - 530925: '双江拉祜族佤族布朗族傣族自治县', - 530926: '耿马傣族佤族自治县', - 530927: '沧源佤族自治县', - 532301: '楚雄市', - 532322: '双柏县', - 532323: '牟定县', - 532324: '南华县', - 532325: '姚安县', - 532326: '大姚县', - 532327: '永仁县', - 532328: '元谋县', - 532329: '武定县', - 532331: '禄丰县', - 532501: '个旧市', - 532502: '开远市', - 532503: '蒙自市', - 532504: '弥勒市', - 532523: '屏边苗族自治县', - 532524: '建水县', - 532525: '石屏县', - 532527: '泸西县', - 532528: '元阳县', - 532529: '红河县', - 532530: '金平苗族瑶族傣族自治县', - 532531: '绿春县', - 532532: '河口瑶族自治县', - 532601: '文山市', - 532622: '砚山县', - 532623: '西畴县', - 532624: '麻栗坡县', - 532625: '马关县', - 532626: '丘北县', - 532627: '广南县', - 532628: '富宁县', - 532801: '景洪市', - 532822: '勐海县', - 532823: '勐腊县', - 532901: '大理市', - 532922: '漾濞彝族自治县', - 532923: '祥云县', - 532924: '宾川县', - 532925: '弥渡县', - 532926: '南涧彝族自治县', - 532927: '巍山彝族回族自治县', - 532928: '永平县', - 532929: '云龙县', - 532930: '洱源县', - 532931: '剑川县', - 532932: '鹤庆县', - 533102: '瑞丽市', - 533103: '芒市', - 533122: '梁河县', - 533123: '盈江县', - 533124: '陇川县', - 533301: '泸水市', - 533323: '福贡县', - 533324: '贡山独龙族怒族自治县', - 533325: '兰坪白族普米族自治县', - 533401: '香格里拉市', - 533422: '德钦县', - 533423: '维西傈僳族自治县', - 540102: '城关区', - 540103: '堆龙德庆区', - 540104: '达孜区', - 540121: '林周县', - 540122: '当雄县', - 540123: '尼木县', - 540124: '曲水县', - 540127: '墨竹工卡县', - 540202: '桑珠孜区', - 540221: '南木林县', - 540222: '江孜县', - 540223: '定日县', - 540224: '萨迦县', - 540225: '拉孜县', - 540226: '昂仁县', - 540227: '谢通门县', - 540228: '白朗县', - 540229: '仁布县', - 540230: '康马县', - 540231: '定结县', - 540232: '仲巴县', - 540233: '亚东县', - 540234: '吉隆县', - 540235: '聂拉木县', - 540236: '萨嘎县', - 540237: '岗巴县', - 540302: '卡若区', - 540321: '江达县', - 540322: '贡觉县', - 540323: '类乌齐县', - 540324: '丁青县', - 540325: '察雅县', - 540326: '八宿县', - 540327: '左贡县', - 540328: '芒康县', - 540329: '洛隆县', - 540330: '边坝县', - 540402: '巴宜区', - 540421: '工布江达县', - 540422: '米林县', - 540423: '墨脱县', - 540424: '波密县', - 540425: '察隅县', - 540426: '朗县', - 540502: '乃东区', - 540521: '扎囊县', - 540522: '贡嘎县', - 540523: '桑日县', - 540524: '琼结县', - 540525: '曲松县', - 540526: '措美县', - 540527: '洛扎县', - 540528: '加查县', - 540529: '隆子县', - 540530: '错那县', - 540531: '浪卡子县', - 540602: '色尼区', - 542421: '那曲县', - 542422: '嘉黎县', - 542423: '比如县', - 542424: '聂荣县', - 542425: '安多县', - 542426: '申扎县', - 542427: '索县', - 542428: '班戈县', - 542429: '巴青县', - 542430: '尼玛县', - 542431: '双湖县', - 542521: '普兰县', - 542522: '札达县', - 542523: '噶尔县', - 542524: '日土县', - 542525: '革吉县', - 542526: '改则县', - 542527: '措勤县', - 610102: '新城区', - 610103: '碑林区', - 610104: '莲湖区', - 610111: '灞桥区', - 610112: '未央区', - 610113: '雁塔区', - 610114: '阎良区', - 610115: '临潼区', - 610116: '长安区', - 610117: '高陵区', - 610118: '鄠邑区', - 610122: '蓝田县', - 610124: '周至县', - 610202: '王益区', - 610203: '印台区', - 610204: '耀州区', - 610222: '宜君县', - 610302: '渭滨区', - 610303: '金台区', - 610304: '陈仓区', - 610322: '凤翔县', - 610323: '岐山县', - 610324: '扶风县', - 610326: '眉县', - 610327: '陇县', - 610328: '千阳县', - 610329: '麟游县', - 610330: '凤县', - 610331: '太白县', - 610402: '秦都区', - 610403: '杨陵区', - 610404: '渭城区', - 610422: '三原县', - 610423: '泾阳县', - 610424: '乾县', - 610425: '礼泉县', - 610426: '永寿县', - 610427: '彬县', - 610428: '长武县', - 610429: '旬邑县', - 610430: '淳化县', - 610431: '武功县', - 610481: '兴平市', - 610502: '临渭区', - 610503: '华州区', - 610522: '潼关县', - 610523: '大荔县', - 610524: '合阳县', - 610525: '澄城县', - 610526: '蒲城县', - 610527: '白水县', - 610528: '富平县', - 610581: '韩城市', - 610582: '华阴市', - 610602: '宝塔区', - 610603: '安塞区', - 610621: '延长县', - 610622: '延川县', - 610623: '子长县', - 610625: '志丹县', - 610626: '吴起县', - 610627: '甘泉县', - 610628: '富县', - 610629: '洛川县', - 610630: '宜川县', - 610631: '黄龙县', - 610632: '黄陵县', - 610702: '汉台区', - 610703: '南郑区', - 610722: '城固县', - 610723: '洋县', - 610724: '西乡县', - 610725: '勉县', - 610726: '宁强县', - 610727: '略阳县', - 610728: '镇巴县', - 610729: '留坝县', - 610730: '佛坪县', - 610802: '榆阳区', - 610803: '横山区', - 610822: '府谷县', - 610824: '靖边县', - 610825: '定边县', - 610826: '绥德县', - 610827: '米脂县', - 610828: '佳县', - 610829: '吴堡县', - 610830: '清涧县', - 610831: '子洲县', - 610881: '神木市', - 610902: '汉滨区', - 610921: '汉阴县', - 610922: '石泉县', - 610923: '宁陕县', - 610924: '紫阳县', - 610925: '岚皋县', - 610926: '平利县', - 610927: '镇坪县', - 610928: '旬阳县', - 610929: '白河县', - 611002: '商州区', - 611021: '洛南县', - 611022: '丹凤县', - 611023: '商南县', - 611024: '山阳县', - 611025: '镇安县', - 611026: '柞水县', - 620102: '城关区', - 620103: '七里河区', - 620104: '西固区', - 620105: '安宁区', - 620111: '红古区', - 620121: '永登县', - 620122: '皋兰县', - 620123: '榆中县', - 620201: '市辖区', - 620290: '雄关区', - 620291: '长城区', - 620292: '镜铁区', - 620293: '新城镇', - 620294: '峪泉镇', - 620295: '文殊镇', - 620302: '金川区', - 620321: '永昌县', - 620402: '白银区', - 620403: '平川区', - 620421: '靖远县', - 620422: '会宁县', - 620423: '景泰县', - 620502: '秦州区', - 620503: '麦积区', - 620521: '清水县', - 620522: '秦安县', - 620523: '甘谷县', - 620524: '武山县', - 620525: '张家川回族自治县', - 620602: '凉州区', - 620621: '民勤县', - 620622: '古浪县', - 620623: '天祝藏族自治县', - 620702: '甘州区', - 620721: '肃南裕固族自治县', - 620722: '民乐县', - 620723: '临泽县', - 620724: '高台县', - 620725: '山丹县', - 620802: '崆峒区', - 620821: '泾川县', - 620822: '灵台县', - 620823: '崇信县', - 620824: '华亭县', - 620825: '庄浪县', - 620826: '静宁县', - 620902: '肃州区', - 620921: '金塔县', - 620922: '瓜州县', - 620923: '肃北蒙古族自治县', - 620924: '阿克塞哈萨克族自治县', - 620981: '玉门市', - 620982: '敦煌市', - 621002: '西峰区', - 621021: '庆城县', - 621022: '环县', - 621023: '华池县', - 621024: '合水县', - 621025: '正宁县', - 621026: '宁县', - 621027: '镇原县', - 621102: '安定区', - 621121: '通渭县', - 621122: '陇西县', - 621123: '渭源县', - 621124: '临洮县', - 621125: '漳县', - 621126: '岷县', - 621202: '武都区', - 621221: '成县', - 621222: '文县', - 621223: '宕昌县', - 621224: '康县', - 621225: '西和县', - 621226: '礼县', - 621227: '徽县', - 621228: '两当县', - 622901: '临夏市', - 622921: '临夏县', - 622922: '康乐县', - 622923: '永靖县', - 622924: '广河县', - 622925: '和政县', - 622926: '东乡族自治县', - 622927: '积石山保安族东乡族撒拉族自治县', - 623001: '合作市', - 623021: '临潭县', - 623022: '卓尼县', - 623023: '舟曲县', - 623024: '迭部县', - 623025: '玛曲县', - 623026: '碌曲县', - 623027: '夏河县', - 630102: '城东区', - 630103: '城中区', - 630104: '城西区', - 630105: '城北区', - 630121: '大通回族土族自治县', - 630122: '湟中县', - 630123: '湟源县', - 630202: '乐都区', - 630203: '平安区', - 630222: '民和回族土族自治县', - 630223: '互助土族自治县', - 630224: '化隆回族自治县', - 630225: '循化撒拉族自治县', - 632221: '门源回族自治县', - 632222: '祁连县', - 632223: '海晏县', - 632224: '刚察县', - 632321: '同仁县', - 632322: '尖扎县', - 632323: '泽库县', - 632324: '河南蒙古族自治县', - 632521: '共和县', - 632522: '同德县', - 632523: '贵德县', - 632524: '兴海县', - 632525: '贵南县', - 632621: '玛沁县', - 632622: '班玛县', - 632623: '甘德县', - 632624: '达日县', - 632625: '久治县', - 632626: '玛多县', - 632701: '玉树市', - 632722: '杂多县', - 632723: '称多县', - 632724: '治多县', - 632725: '囊谦县', - 632726: '曲麻莱县', - 632801: '格尔木市', - 632802: '德令哈市', - 632821: '乌兰县', - 632822: '都兰县', - 632823: '天峻县', - 640104: '兴庆区', - 640105: '西夏区', - 640106: '金凤区', - 640121: '永宁县', - 640122: '贺兰县', - 640181: '灵武市', - 640202: '大武口区', - 640205: '惠农区', - 640221: '平罗县', - 640302: '利通区', - 640303: '红寺堡区', - 640323: '盐池县', - 640324: '同心县', - 640381: '青铜峡市', - 640402: '原州区', - 640422: '西吉县', - 640423: '隆德县', - 640424: '泾源县', - 640425: '彭阳县', - 640502: '沙坡头区', - 640521: '中宁县', - 640522: '海原县', - 650102: '天山区', - 650103: '沙依巴克区', - 650104: '新市区', - 650105: '水磨沟区', - 650106: '头屯河区', - 650107: '达坂城区', - 650109: '米东区', - 650121: '乌鲁木齐县', - 650202: '独山子区', - 650203: '克拉玛依区', - 650204: '白碱滩区', - 650205: '乌尔禾区', - 650402: '高昌区', - 650421: '鄯善县', - 650422: '托克逊县', - 650502: '伊州区', - 650521: '巴里坤哈萨克自治县', - 650522: '伊吾县', - 652301: '昌吉市', - 652302: '阜康市', - 652323: '呼图壁县', - 652324: '玛纳斯县', - 652325: '奇台县', - 652327: '吉木萨尔县', - 652328: '木垒哈萨克自治县', - 652701: '博乐市', - 652702: '阿拉山口市', - 652722: '精河县', - 652723: '温泉县', - 652801: '库尔勒市', - 652822: '轮台县', - 652823: '尉犁县', - 652824: '若羌县', - 652825: '且末县', - 652826: '焉耆回族自治县', - 652827: '和静县', - 652828: '和硕县', - 652829: '博湖县', - 652901: '阿克苏市', - 652922: '温宿县', - 652923: '库车县', - 652924: '沙雅县', - 652925: '新和县', - 652926: '拜城县', - 652927: '乌什县', - 652928: '阿瓦提县', - 652929: '柯坪县', - 653001: '阿图什市', - 653022: '阿克陶县', - 653023: '阿合奇县', - 653024: '乌恰县', - 653101: '喀什市', - 653121: '疏附县', - 653122: '疏勒县', - 653123: '英吉沙县', - 653124: '泽普县', - 653125: '莎车县', - 653126: '叶城县', - 653127: '麦盖提县', - 653128: '岳普湖县', - 653129: '伽师县', - 653130: '巴楚县', - 653131: '塔什库尔干塔吉克自治县', - 653201: '和田市', - 653221: '和田县', - 653222: '墨玉县', - 653223: '皮山县', - 653224: '洛浦县', - 653225: '策勒县', - 653226: '于田县', - 653227: '民丰县', - 654002: '伊宁市', - 654003: '奎屯市', - 654004: '霍尔果斯市', - 654021: '伊宁县', - 654022: '察布查尔锡伯自治县', - 654023: '霍城县', - 654024: '巩留县', - 654025: '新源县', - 654026: '昭苏县', - 654027: '特克斯县', - 654028: '尼勒克县', - 654201: '塔城市', - 654202: '乌苏市', - 654221: '额敏县', - 654223: '沙湾县', - 654224: '托里县', - 654225: '裕民县', - 654226: '和布克赛尔蒙古自治县', - 654301: '阿勒泰市', - 654321: '布尔津县', - 654322: '富蕴县', - 654323: '福海县', - 654324: '哈巴河县', - 654325: '青河县', - 654326: '吉木乃县', - 659001: '石河子市', - 659002: '阿拉尔市', - 659003: '图木舒克市', - 659004: '五家渠市', - 659005: '北屯市', - 659006: '铁门关市', - 659007: '双河市', - 659008: '可克达拉市', - 659009: '昆玉市', - 710101: '中正区', - 710102: '大同区', - 710103: '中山区', - 710104: '松山区', - 710105: '大安区', - 710106: '万华区', - 710107: '信义区', - 710108: '士林区', - 710109: '北投区', - 710110: '内湖区', - 710111: '南港区', - 710112: '文山区', - 710199: '其它区', - 710201: '新兴区', - 710202: '前金区', - 710203: '芩雅区', - 710204: '盐埕区', - 710205: '鼓山区', - 710206: '旗津区', - 710207: '前镇区', - 710208: '三民区', - 710209: '左营区', - 710210: '楠梓区', - 710211: '小港区', - 710241: '苓雅区', - 710242: '仁武区', - 710243: '大社区', - 710244: '冈山区', - 710245: '路竹区', - 710246: '阿莲区', - 710247: '田寮区', - 710248: '燕巢区', - 710249: '桥头区', - 710250: '梓官区', - 710251: '弥陀区', - 710252: '永安区', - 710253: '湖内区', - 710254: '凤山区', - 710255: '大寮区', - 710256: '林园区', - 710257: '鸟松区', - 710258: '大树区', - 710259: '旗山区', - 710260: '美浓区', - 710261: '六龟区', - 710262: '内门区', - 710263: '杉林区', - 710264: '甲仙区', - 710265: '桃源区', - 710266: '那玛夏区', - 710267: '茂林区', - 710268: '茄萣区', - 710299: '其它区', - 710301: '中西区', - 710302: '东区', - 710303: '南区', - 710304: '北区', - 710305: '安平区', - 710306: '安南区', - 710339: '永康区', - 710340: '归仁区', - 710341: '新化区', - 710342: '左镇区', - 710343: '玉井区', - 710344: '楠西区', - 710345: '南化区', - 710346: '仁德区', - 710347: '关庙区', - 710348: '龙崎区', - 710349: '官田区', - 710350: '麻豆区', - 710351: '佳里区', - 710352: '西港区', - 710353: '七股区', - 710354: '将军区', - 710355: '学甲区', - 710356: '北门区', - 710357: '新营区', - 710358: '后壁区', - 710359: '白河区', - 710360: '东山区', - 710361: '六甲区', - 710362: '下营区', - 710363: '柳营区', - 710364: '盐水区', - 710365: '善化区', - 710366: '大内区', - 710367: '山上区', - 710368: '新市区', - 710369: '安定区', - 710399: '其它区', - 710401: '中区', - 710402: '东区', - 710403: '南区', - 710404: '西区', - 710405: '北区', - 710406: '北屯区', - 710407: '西屯区', - 710408: '南屯区', - 710431: '太平区', - 710432: '大里区', - 710433: '雾峰区', - 710434: '乌日区', - 710435: '丰原区', - 710436: '后里区', - 710437: '石冈区', - 710438: '东势区', - 710439: '和平区', - 710440: '新社区', - 710441: '潭子区', - 710442: '大雅区', - 710443: '神冈区', - 710444: '大肚区', - 710445: '沙鹿区', - 710446: '龙井区', - 710447: '梧栖区', - 710448: '清水区', - 710449: '大甲区', - 710450: '外埔区', - 710451: '大安区', - 710499: '其它区', - 710507: '金沙镇', - 710508: '金湖镇', - 710509: '金宁乡', - 710510: '金城镇', - 710511: '烈屿乡', - 710512: '乌坵乡', - 710614: '南投市', - 710615: '中寮乡', - 710616: '草屯镇', - 710617: '国姓乡', - 710618: '埔里镇', - 710619: '仁爱乡', - 710620: '名间乡', - 710621: '集集镇', - 710622: '水里乡', - 710623: '鱼池乡', - 710624: '信义乡', - 710625: '竹山镇', - 710626: '鹿谷乡', - 710701: '仁爱区', - 710702: '信义区', - 710703: '中正区', - 710704: '中山区', - 710705: '安乐区', - 710706: '暖暖区', - 710707: '七堵区', - 710799: '其它区', - 710801: '东区', - 710802: '北区', - 710803: '香山区', - 710899: '其它区', - 710901: '东区', - 710902: '西区', - 710999: '其它区', - 711130: '万里区', - 711132: '板桥区', - 711133: '汐止区', - 711134: '深坑区', - 711136: '瑞芳区', - 711137: '平溪区', - 711138: '双溪区', - 711140: '新店区', - 711141: '坪林区', - 711142: '乌来区', - 711143: '永和区', - 711144: '中和区', - 711145: '土城区', - 711146: '三峡区', - 711147: '树林区', - 711149: '三重区', - 711150: '新庄区', - 711151: '泰山区', - 711152: '林口区', - 711154: '五股区', - 711155: '八里区', - 711156: '淡水区', - 711157: '三芝区', - 711287: '宜兰市', - 711288: '头城镇', - 711289: '礁溪乡', - 711290: '壮围乡', - 711291: '员山乡', - 711292: '罗东镇', - 711293: '三星乡', - 711294: '大同乡', - 711295: '五结乡', - 711296: '冬山乡', - 711297: '苏澳镇', - 711298: '南澳乡', - 711299: '钓鱼台', - 711387: '竹北市', - 711388: '湖口乡', - 711389: '新丰乡', - 711390: '新埔镇', - 711391: '关西镇', - 711392: '芎林乡', - 711393: '宝山乡', - 711394: '竹东镇', - 711395: '五峰乡', - 711396: '横山乡', - 711397: '尖石乡', - 711398: '北埔乡', - 711399: '峨眉乡', - 711487: '中坜市', - 711488: '平镇市', - 711489: '龙潭乡', - 711490: '杨梅市', - 711491: '新屋乡', - 711492: '观音乡', - 711493: '桃园市', - 711494: '龟山乡', - 711495: '八德市', - 711496: '大溪镇', - 711497: '复兴乡', - 711498: '大园乡', - 711499: '芦竹乡', - 711582: '竹南镇', - 711583: '头份镇', - 711584: '三湾乡', - 711585: '南庄乡', - 711586: '狮潭乡', - 711587: '后龙镇', - 711588: '通霄镇', - 711589: '苑里镇', - 711590: '苗栗市', - 711591: '造桥乡', - 711592: '头屋乡', - 711593: '公馆乡', - 711594: '大湖乡', - 711595: '泰安乡', - 711596: '铜锣乡', - 711597: '三义乡', - 711598: '西湖乡', - 711599: '卓兰镇', - 711774: '彰化市', - 711775: '芬园乡', - 711776: '花坛乡', - 711777: '秀水乡', - 711778: '鹿港镇', - 711779: '福兴乡', - 711780: '线西乡', - 711781: '和美镇', - 711782: '伸港乡', - 711783: '员林镇', - 711784: '社头乡', - 711785: '永靖乡', - 711786: '埔心乡', - 711787: '溪湖镇', - 711788: '大村乡', - 711789: '埔盐乡', - 711790: '田中镇', - 711791: '北斗镇', - 711792: '田尾乡', - 711793: '埤头乡', - 711794: '溪州乡', - 711795: '竹塘乡', - 711796: '二林镇', - 711797: '大城乡', - 711798: '芳苑乡', - 711799: '二水乡', - 711982: '番路乡', - 711983: '梅山乡', - 711984: '竹崎乡', - 711985: '阿里山乡', - 711986: '中埔乡', - 711987: '大埔乡', - 711988: '水上乡', - 711989: '鹿草乡', - 711990: '太保市', - 711991: '朴子市', - 711992: '东石乡', - 711993: '六脚乡', - 711994: '新港乡', - 711995: '民雄乡', - 711996: '大林镇', - 711997: '溪口乡', - 711998: '义竹乡', - 711999: '布袋镇', - 712180: '斗南镇', - 712181: '大埤乡', - 712182: '虎尾镇', - 712183: '土库镇', - 712184: '褒忠乡', - 712185: '东势乡', - 712186: '台西乡', - 712187: '仑背乡', - 712188: '麦寮乡', - 712189: '斗六市', - 712190: '林内乡', - 712191: '古坑乡', - 712192: '莿桐乡', - 712193: '西螺镇', - 712194: '二仑乡', - 712195: '北港镇', - 712196: '水林乡', - 712197: '口湖乡', - 712198: '四湖乡', - 712199: '元长乡', - 712467: '屏东市', - 712468: '三地门乡', - 712469: '雾台乡', - 712470: '玛家乡', - 712471: '九如乡', - 712472: '里港乡', - 712473: '高树乡', - 712474: '盐埔乡', - 712475: '长治乡', - 712476: '麟洛乡', - 712477: '竹田乡', - 712478: '内埔乡', - 712479: '万丹乡', - 712480: '潮州镇', - 712481: '泰武乡', - 712482: '来义乡', - 712483: '万峦乡', - 712484: '莰顶乡', - 712485: '新埤乡', - 712486: '南州乡', - 712487: '林边乡', - 712488: '东港镇', - 712489: '琉球乡', - 712490: '佳冬乡', - 712491: '新园乡', - 712492: '枋寮乡', - 712493: '枋山乡', - 712494: '春日乡', - 712495: '狮子乡', - 712496: '车城乡', - 712497: '牡丹乡', - 712498: '恒春镇', - 712499: '满州乡', - 712584: '台东市', - 712585: '绿岛乡', - 712586: '兰屿乡', - 712587: '延平乡', - 712588: '卑南乡', - 712589: '鹿野乡', - 712590: '关山镇', - 712591: '海端乡', - 712592: '池上乡', - 712593: '东河乡', - 712594: '成功镇', - 712595: '长滨乡', - 712596: '金峰乡', - 712597: '大武乡', - 712598: '达仁乡', - 712599: '太麻里乡', - 712686: '花莲市', - 712687: '新城乡', - 712688: '太鲁阁', - 712689: '秀林乡', - 712690: '吉安乡', - 712691: '寿丰乡', - 712692: '凤林镇', - 712693: '光复乡', - 712694: '丰滨乡', - 712695: '瑞穗乡', - 712696: '万荣乡', - 712697: '玉里镇', - 712698: '卓溪乡', - 712699: '富里乡', - 712794: '马公市', - 712795: '西屿乡', - 712796: '望安乡', - 712797: '七美乡', - 712798: '白沙乡', - 712799: '湖西乡', - 712896: '南竿乡', - 712897: '北竿乡', - 712898: '东引乡', - 712899: '莒光乡', - 810101: '中西区', - 810102: '湾仔', - 810103: '东区', - 810104: '南区', - 810201: '九龙城区', - 810202: '油尖旺区', - 810203: '深水埗区', - 810204: '黄大仙区', - 810205: '观塘区', - 810301: '北区', - 810302: '大埔区', - 810303: '沙田区', - 810304: '西贡区', - 810305: '元朗区', - 810306: '屯门区', - 810307: '荃湾区', - 810308: '葵青区', - 810309: '离岛区', - 820101: '澳门半岛', - 820201: '离岛' - } - }; - - - Class.prototype.config = { - elem: '', - data: { - province: '', - city: '', - county: '', - provinceCode: 0, - cityCode: 0, - countyCode: 0, - }, - change: function(result){} - }; - - Class.prototype.index = 0; - - Class.prototype.render = function () { - let that = this, options = that.config; - options.elem = $(options.elem); - - that.events(); - }; - - Class.prototype.reload = function (op) { - let options = this.config; - options.data = $.extend(options.data, op.data || {}); - this.events(true); - }; - - Class.prototype.events = function (reload = false) { - let that = this, options = that.config; - let provinceFilter = 'province-' + layarea._id; - let cityFilter = 'city-' + layarea._id; - let countyFilter = 'county-' + layarea._id; - - let provinceEl = options.elem.find('.province-selector'); - let cityEl = options.elem.find('.city-selector'); - let countyEl = options.elem.find('.county-selector'); - - if (reload){ - options.data.provinceCode = getCode('province', options.data.province); - let code = getCode('city', options.data.city, options.data.provinceCode.slice(0, 2)); - options.data.cityCode = code; - options.data.countyCode = getCode('county', options.data.county, options.data.cityCode.slice(0, 4)); - renderProvince(); - return; - } - //filter - if(provinceEl.attr('lay-filter')){ - provinceFilter = provinceEl.attr('lay-filter'); - } - if(cityEl.attr('lay-filter')){ - cityFilter = cityEl.attr('lay-filter'); - } - if(countyEl.attr('lay-filter')){ - countyFilter = countyEl.attr('lay-filter'); - } - provinceEl.attr('lay-filter', provinceFilter); - cityEl.attr('lay-filter', cityFilter); - countyEl.attr('lay-filter', countyFilter); - - //获取默认值 - if(provinceEl.data('value')){ - options.data.province = provinceEl.data('value'); - options.data.provinceCode = getCode('province', options.data.province); - } else if (!options.data.province) { - options.data.province = ''; - } - if(cityEl.data('value')){ - options.data.city = cityEl.data('value'); - let code = getCode('city', options.data.city, options.data.provinceCode.slice(0, 2)); - options.data.cityCode = code; - } else if (!options.data.city) { - options.data.city = ''; - } - if(countyEl.data('value')){ - options.data.county = countyEl.data('value'); - options.data.countyCode = getCode('county', options.data.county, options.data.cityCode.slice(0, 4)); - } else if (!options.data.county) { - options.data.county = ''; - } - provinceEl.attr('lay-filter', provinceFilter); - cityEl.attr('lay-filter', cityFilter); - countyEl.attr('lay-filter', countyFilter); - - //监听结果 - form.on('select('+provinceFilter+')', function(data){ - options.data.province = data.value; - options.data.provinceCode = getCode('province', data.value); - renderCity(options.data.provinceCode); - - options.change(options.data); - }); - form.on('select('+cityFilter+')', function(data){ - options.data.city = data.value; - if(options.data.provinceCode){ - options.data.cityCode = getCode('city', data.value, options.data.provinceCode.slice(0, 2)); - renderCounty(options.data.cityCode); - } - - options.change(options.data); - }); - form.on('select('+countyFilter+')', function(data){ - options.data.county = data.value; - if(options.data.cityCode){ - options.data.countyCode = getCode('county', data.value, options.data.cityCode.slice(0, 4)); - } - options.change(options.data); - }); - - renderProvince(); - - //查找province - function renderProvince(){ - let tpl = ''; - let provinceList = getList("province"); - let currentCode = ''; - let currentName = ''; - provinceList.forEach(function(_item){ - // if (!currentCode){ - // currentCode = _item.code; - // currentName = _item.name; - // } - if(_item.name === options.data.province){ - currentCode = _item.code; - currentName = _item.name; - } - tpl += ''; - }); - provinceEl.html(tpl); - provinceEl.val(options.data.province); - form.render('select'); - renderCity(currentCode); - } - - function renderCity(provinceCode){ - let tpl = ''; - let cityList = getList('city', provinceCode.slice(0, 2)); - let currentCode = ''; - let currentName = ''; - cityList.forEach(function(_item){ - // if (!currentCode){ - // currentCode = _item.code; - // currentName = _item.name; - // } - if(_item.name === options.data.city){ - currentCode = _item.code; - currentName = _item.name; - } - tpl += ''; - }); - options.data.city = currentName; - cityEl.html(tpl); - cityEl.val(options.data.city); - form.render('select'); - renderCounty(currentCode); - } - - function renderCounty(cityCode){ - let tpl = ''; - let countyList = getList('county', cityCode.slice(0, 4)); - let currentCode = ''; - let currentName = ''; - countyList.forEach(function(_item){ - // if (!currentCode){ - // currentCode = _item.code; - // currentName = _item.name; - // } - if(_item.name === options.data.county){ - currentCode = _item.code; - currentName = _item.name; - } - tpl += ''; - }); - options.data.county = currentName; - countyEl.html(tpl); - countyEl.val(options.data.county); - - form.render('select'); - } - - function getList(type, code) { - let result = []; - - if (type !== 'province' && !code) { - return result; - } - - let list = areaList[type + "_list"] || {}; - result = Object.keys(list).map(function (code) { - return { - code: code, - name: list[code] - }; - }); - - if (code) { - // oversea code - if (code[0] === '9' && type === 'city') { - code = '9'; - } - - result = result.filter(function (item) { - return item.code.indexOf(code) === 0; - }); - } - - return result; - } - - function getCode(type, name, parentCode = 0){ - let code = ''; - let list = areaList[type + "_list"] || {}; - let result = {}; - Object.keys(list).map(function (_code) { - if(parentCode){ - if(_code.indexOf(parentCode) === 0){ - result[_code] = list[_code]; - } - }else{ - result[_code] = list[_code]; - } - }); - layui.each(result, function(_code, _name){ - if(_name === name){ - code = _code; - } - }); - - return code; - } - }; - - layarea.render = function (options) { - let inst = new Class(options); - layarea._id++; - return thisArea.call(inst); - }; - - exports('area', layarea); - }); \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/module/button.js b/src/plugin/admin/public/component/pear/module/button.js index d77c18d2..29555cf6 100644 --- a/src/plugin/admin/public/component/pear/module/button.js +++ b/src/plugin/admin/public/component/pear/module/button.js @@ -1,53 +1,59 @@ -layui.define(['jquery'], function(exports) { +layui.define(['jquery'], function (exports) { "use strict"; /** + * @since Pear Admin 4.0 + * * Button component * */ var MOD_NAME = 'button', $ = layui.jquery; - var button = function(opt) { + var button = function (opt) { this.option = opt; }; - /** + /** + * @since Pear Admin 4.0 + * * Button start loading * */ - button.prototype.load = function(opt) { - - var option = { + button.prototype.load = function (opt) { + + var options = { elem: opt.elem, time: opt.time ? opt.time : false, - done: opt.done ? opt.done : function(){} + done: opt.done ? opt.done : function () { } } - var text = $(option.elem).html(); - - $(option.elem).html(""); - - $(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); + + var text = $(options.elem).html(); + + $(options.elem).html(""); + $(options.elem).attr("disabled", "disabled"); + + var $button = $(options.elem); + + if (options.time != "" || options.time != false) { + setTimeout(function () { + $button.attr("disabled", false); + $button.html(text); + options.done(); + }, options.time); } - option.text = text; - return new button(option); + options.text = text; + return new button(options); } - + /** + * @since Pear Admin 4.0 + * * Button stop loaded * */ - button.prototype.stop = function(success) { + 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()); }); diff --git a/src/plugin/admin/public/component/pear/module/card.js b/src/plugin/admin/public/component/pear/module/card.js deleted file mode 100644 index c8d4aeb0..00000000 --- a/src/plugin/admin/public/component/pear/module/card.js +++ /dev/null @@ -1,267 +0,0 @@ -layui.define(['table', 'laypage','jquery', 'element'], 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: 4, //每行数量 2,3,4,6 - currentPage: 1,//当前页 - data:[], //静态数据 - limits:[], //页码 - page: true, //是否分页 - layout: ['count', 'prev', 'page', 'next','limit', 'skip'],//分页控件 - 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 - }, - 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 ? '
                          ' : '
                          '; - html += ''; - html += '
                          '; - $(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) { - for (let key in option.where) { - url = url + '&' + key + '=' + option.where[key]; - } - } - getData(url).then(function(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); - html += "
                          "; - } - else { - html = "

                          没有数据

                          "; - } - $(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 0) { - html = createComponent(option.elem.substring(1), option.linenum, option.data); - html += "
                          "; - } - else { - html = "

                          没有数据

                          "; - } - $(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) { - var html = "
                          " - var content = createCards(elem, linenum,data); - var page = ""; - content = content + page; - html += content + "
                          " - return html; - } - - function createCards(elem, linenum,data) { - var content = "
                          "; - for (var i = 0; i < data.length; i++) { - content += createCard(elem, linenum,data[i],i); - } - content += "
                          "; - return content; - } - - function createCard(elem, linenum, item, no) { - var line = 12 / linenum; - var card = - '

                          ' + item.title + '

                          ' + item.remark + '
                          ' +item.time + '
                          ' - return card; - } - - function initData(tempData, option) { - 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]; - data.data = []; - for (var i = 0; i < dataList.length; i++) { - var item = {}; - 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.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.id].option.checkedItem = item; - _instances[elem.id].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; - }, - } - - exports(MOD_NAME, tt); -}) \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/module/context.js b/src/plugin/admin/public/component/pear/module/context.js deleted file mode 100644 index a803e02b..00000000 --- a/src/plugin/admin/public/component/pear/module/context.js +++ /dev/null @@ -1,19 +0,0 @@ -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){ - localStorage.setItem(key,value); - } - - this.get = function(key){ - return localStorage.getItem(key); - } - } - exports(MOD_NAME, context); -}); diff --git a/src/plugin/admin/public/component/pear/module/convert.js b/src/plugin/admin/public/component/pear/module/convert.js deleted file mode 100644 index 1f86ba5a..00000000 --- a/src/plugin/admin/public/component/pear/module/convert.js +++ /dev/null @@ -1,27 +0,0 @@ -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); -}); diff --git a/src/plugin/admin/public/component/pear/module/cropper.js b/src/plugin/admin/public/component/pear/module/cropper.js deleted file mode 100644 index 6d774977..00000000 --- a/src/plugin/admin/public/component/pear/module/cropper.js +++ /dev/null @@ -1,3087 +0,0 @@ -/*! - * Cropper v3.0.0 - */ - -layui.define(['jquery'], function (exports) { - var $ = layui.jquery; - $ = $ && $.hasOwnProperty('default') ? $['default'] : $; - - var DEFAULTS = { - // Define the view mode of the cropper - viewMode: 0, // 0, 1, 2, 3 - - // Define the dragging mode of the cropper - dragMode: 'crop', // 'crop', 'move' or 'none' - - // Define the aspect ratio of the crop box - aspectRatio: NaN, - - // An object with the previous cropping result data - data: null, - - // A selector for adding extra containers to preview - preview: '', - - // Re-render the cropper when resize the window - responsive: true, - - // Restore the cropped area after resize the window - restore: true, - - // Check if the current image is a cross-origin image - checkCrossOrigin: true, - - // Check the current image's Exif Orientation information - checkOrientation: true, - - // Show the black modal - modal: true, - - // Show the dashed lines for guiding - guides: true, - - // Show the center indicator for guiding - center: true, - - // Show the white modal to highlight the crop box - highlight: true, - - // Show the grid background - background: true, - - // Enable to crop the image automatically when initialize - autoCrop: true, - - // Define the percentage of automatic cropping area when initializes - autoCropArea: 0.8, - - // Enable to move the image - movable: true, - - // Enable to rotate the image - rotatable: true, - - // Enable to scale the image - scalable: true, - - // Enable to zoom the image - zoomable: true, - - // Enable to zoom the image by dragging touch - zoomOnTouch: true, - - // Enable to zoom the image by wheeling mouse - zoomOnWheel: true, - - // Define zoom ratio when zoom the image by wheeling mouse - wheelZoomRatio: 0.1, - - // Enable to move the crop box - cropBoxMovable: true, - - // Enable to resize the crop box - cropBoxResizable: true, - - // Toggle drag mode between "crop" and "move" when click twice on the cropper - toggleDragModeOnDblclick: true, - - // Size limitation - minCanvasWidth: 0, - minCanvasHeight: 0, - minCropBoxWidth: 0, - minCropBoxHeight: 0, - minContainerWidth: 200, - minContainerHeight: 100, - - // Shortcuts of events - ready: null, - cropstart: null, - cropmove: null, - cropend: null, - crop: null, - zoom: null - }; - - var TEMPLATE = '
                          ' + '
                          ' + '
                          ' + '
                          ' + '
                          ' + '
                          ' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
                          ' + '
                          '; - - var REGEXP_DATA_URL_HEAD = /^data:.*,/; - var REGEXP_USERAGENT = /(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i; - var navigator = typeof window !== 'undefined' ? window.navigator : null; - var IS_SAFARI_OR_UIWEBVIEW = navigator && REGEXP_USERAGENT.test(navigator.userAgent); - var fromCharCode = String.fromCharCode; - - function isNumber(n) { - return typeof n === 'number' && !isNaN(n); - } - - function isUndefined(n) { - return typeof n === 'undefined'; - } - - function toArray(obj, offset) { - var args = []; - - // This is necessary for IE8 - if (isNumber(offset)) { - args.push(offset); - } - - return args.slice.apply(obj, args); - } - - // Custom proxy to avoid jQuery's guid - function proxy(fn, context) { - for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { - args[_key - 2] = arguments[_key]; - } - - return function () { - for (var _len2 = arguments.length, args2 = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args2[_key2] = arguments[_key2]; - } - - return fn.apply(context, args.concat(toArray(args2))); - }; - } - - function objectKeys(obj) { - var keys = []; - - $.each(obj, function (key) { - keys.push(key); - }); - - return keys; - } - - function isCrossOriginURL(url) { - var parts = url.match(/^(https?:)\/\/([^:/?#]+):?(\d*)/i); - - return parts && (parts[1] !== location.protocol || parts[2] !== location.hostname || parts[3] !== location.port); - } - - function addTimestamp(url) { - var timestamp = 'timestamp=' + new Date().getTime(); - - return url + (url.indexOf('?') === -1 ? '?' : '&') + timestamp; - } - - function getImageSize(image, callback) { - // Modern browsers (ignore Safari, #120 & #509) - if (image.naturalWidth && !IS_SAFARI_OR_UIWEBVIEW) { - callback(image.naturalWidth, image.naturalHeight); - return; - } - - // IE8: Don't use `new Image()` here (#319) - var newImage = document.createElement('img'); - - newImage.onload = function load() { - callback(this.width, this.height); - }; - - newImage.src = image.src; - } - - function getTransform(options) { - var transforms = []; - var translateX = options.translateX; - var translateY = options.translateY; - var rotate = options.rotate; - var scaleX = options.scaleX; - var scaleY = options.scaleY; - - if (isNumber(translateX) && translateX !== 0) { - transforms.push('translateX(' + translateX + 'px)'); - } - - if (isNumber(translateY) && translateY !== 0) { - transforms.push('translateY(' + translateY + 'px)'); - } - - // Rotate should come first before scale to match orientation transform - if (isNumber(rotate) && rotate !== 0) { - transforms.push('rotate(' + rotate + 'deg)'); - } - - if (isNumber(scaleX) && scaleX !== 1) { - transforms.push('scaleX(' + scaleX + ')'); - } - - if (isNumber(scaleY) && scaleY !== 1) { - transforms.push('scaleY(' + scaleY + ')'); - } - - return transforms.length ? transforms.join(' ') : 'none'; - } - - function getRotatedSizes(data, isReversed) { - var deg = Math.abs(data.degree) % 180; - var arc = (deg > 90 ? 180 - deg : deg) * Math.PI / 180; - var sinArc = Math.sin(arc); - var cosArc = Math.cos(arc); - var width = data.width; - var height = data.height; - var aspectRatio = data.aspectRatio; - var newWidth = void 0; - var newHeight = void 0; - - if (!isReversed) { - newWidth = width * cosArc + height * sinArc; - newHeight = width * sinArc + height * cosArc; - } else { - newWidth = width / (cosArc + sinArc / aspectRatio); - newHeight = newWidth / aspectRatio; - } - - return { - width: newWidth, - height: newHeight - }; - } - - function getSourceCanvas(image, data, options) { - var canvas = $('')[0]; - var context = canvas.getContext('2d'); - var dstX = 0; - var dstY = 0; - var dstWidth = data.naturalWidth; - var dstHeight = data.naturalHeight; - var rotate = data.rotate; - var scaleX = data.scaleX; - var scaleY = data.scaleY; - var scalable = isNumber(scaleX) && isNumber(scaleY) && (scaleX !== 1 || scaleY !== 1); - var rotatable = isNumber(rotate) && rotate !== 0; - var advanced = rotatable || scalable; - var canvasWidth = dstWidth * Math.abs(scaleX || 1); - var canvasHeight = dstHeight * Math.abs(scaleY || 1); - var translateX = void 0; - var translateY = void 0; - var rotated = void 0; - - if (scalable) { - translateX = canvasWidth / 2; - translateY = canvasHeight / 2; - } - - if (rotatable) { - rotated = getRotatedSizes({ - width: canvasWidth, - height: canvasHeight, - degree: rotate - }); - - canvasWidth = rotated.width; - canvasHeight = rotated.height; - translateX = canvasWidth / 2; - translateY = canvasHeight / 2; - } - - canvas.width = canvasWidth; - canvas.height = canvasHeight; - - if (options.fillColor) { - context.fillStyle = options.fillColor; - context.fillRect(0, 0, canvasWidth, canvasHeight); - } - - if (advanced) { - dstX = -dstWidth / 2; - dstY = -dstHeight / 2; - - context.save(); - context.translate(translateX, translateY); - } - - // Rotate should come first before scale as in the "getTransform" function - if (rotatable) { - context.rotate(rotate * Math.PI / 180); - } - - if (scalable) { - context.scale(scaleX, scaleY); - } - - context.imageSmoothingEnabled = !!options.imageSmoothingEnabled; - - if (options.imageSmoothingQuality) { - context.imageSmoothingQuality = options.imageSmoothingQuality; - } - - context.drawImage(image, Math.floor(dstX), Math.floor(dstY), Math.floor(dstWidth), Math.floor(dstHeight)); - - if (advanced) { - context.restore(); - } - - return canvas; - } - - function getStringFromCharCode(dataView, start, length) { - var str = ''; - var i = void 0; - - for (i = start, length += start; i < length; i += 1) { - str += fromCharCode(dataView.getUint8(i)); - } - - return str; - } - - function getOrientation(arrayBuffer) { - var dataView = new DataView(arrayBuffer); - var length = dataView.byteLength; - var orientation = void 0; - var exifIDCode = void 0; - var tiffOffset = void 0; - var firstIFDOffset = void 0; - var littleEndian = void 0; - var endianness = void 0; - var app1Start = void 0; - var ifdStart = void 0; - var offset = void 0; - var i = void 0; - - // Only handle JPEG image (start by 0xFFD8) - if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) { - offset = 2; - - while (offset < length) { - if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) { - app1Start = offset; - break; - } - - offset += 1; - } - } - - if (app1Start) { - exifIDCode = app1Start + 4; - tiffOffset = app1Start + 10; - - if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') { - endianness = dataView.getUint16(tiffOffset); - littleEndian = endianness === 0x4949; - - if (littleEndian || endianness === 0x4D4D /* bigEndian */) { - if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) { - firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian); - - if (firstIFDOffset >= 0x00000008) { - ifdStart = tiffOffset + firstIFDOffset; - } - } - } - } - } - - if (ifdStart) { - length = dataView.getUint16(ifdStart, littleEndian); - - for (i = 0; i < length; i += 1) { - offset = ifdStart + i * 12 + 2; - - if (dataView.getUint16(offset, littleEndian) === 0x0112 /* Orientation */) { - // 8 is the offset of the current tag's value - offset += 8; - - // Get the original orientation value - orientation = dataView.getUint16(offset, littleEndian); - - // Override the orientation with its default value for Safari (#120) - if (IS_SAFARI_OR_UIWEBVIEW) { - dataView.setUint16(offset, 1, littleEndian); - } - - break; - } - } - } - - return orientation; - } - - function dataURLToArrayBuffer(dataURL) { - var base64 = dataURL.replace(REGEXP_DATA_URL_HEAD, ''); - var binary = atob(base64); - var length = binary.length; - var arrayBuffer = new ArrayBuffer(length); - var dataView = new Uint8Array(arrayBuffer); - var i = void 0; - - for (i = 0; i < length; i += 1) { - dataView[i] = binary.charCodeAt(i); - } - - return arrayBuffer; - } - - // Only available for JPEG image - function arrayBufferToDataURL(arrayBuffer) { - var dataView = new Uint8Array(arrayBuffer); - var length = dataView.length; - var base64 = ''; - var i = void 0; - - for (i = 0; i < length; i += 1) { - base64 += fromCharCode(dataView[i]); - } - - return 'data:image/jpeg;base64,' + btoa(base64); - } - - var render = { - render: function render() { - var self = this; - - self.initContainer(); - self.initCanvas(); - self.initCropBox(); - - self.renderCanvas(); - - if (self.cropped) { - self.renderCropBox(); - } - }, - initContainer: function initContainer() { - var self = this; - var options = self.options; - var $this = self.$element; - var $container = self.$container; - var $cropper = self.$cropper; - var hidden = 'cropper-hidden'; - - $cropper.addClass(hidden); - $this.removeClass(hidden); - - $cropper.css(self.container = { - width: Math.max($container.width(), Number(options.minContainerWidth) || 200), - height: Math.max($container.height(), Number(options.minContainerHeight) || 100) - }); - - $this.addClass(hidden); - $cropper.removeClass(hidden); - }, - - - // Canvas (image wrapper) - initCanvas: function initCanvas() { - var self = this; - var viewMode = self.options.viewMode; - var container = self.container; - var containerWidth = container.width; - var containerHeight = container.height; - var image = self.image; - var imageNaturalWidth = image.naturalWidth; - var imageNaturalHeight = image.naturalHeight; - var is90Degree = Math.abs(image.rotate) % 180 === 90; - var naturalWidth = is90Degree ? imageNaturalHeight : imageNaturalWidth; - var naturalHeight = is90Degree ? imageNaturalWidth : imageNaturalHeight; - var aspectRatio = naturalWidth / naturalHeight; - var canvasWidth = containerWidth; - var canvasHeight = containerHeight; - - if (containerHeight * aspectRatio > containerWidth) { - if (viewMode === 3) { - canvasWidth = containerHeight * aspectRatio; - } else { - canvasHeight = containerWidth / aspectRatio; - } - } else if (viewMode === 3) { - canvasHeight = containerWidth / aspectRatio; - } else { - canvasWidth = containerHeight * aspectRatio; - } - - var canvas = { - naturalWidth: naturalWidth, - naturalHeight: naturalHeight, - aspectRatio: aspectRatio, - width: canvasWidth, - height: canvasHeight - }; - - canvas.left = (containerWidth - canvasWidth) / 2; - canvas.top = (containerHeight - canvasHeight) / 2; - canvas.oldLeft = canvas.left; - canvas.oldTop = canvas.top; - - self.canvas = canvas; - self.limited = viewMode === 1 || viewMode === 2; - self.limitCanvas(true, true); - self.initialImage = $.extend({}, image); - self.initialCanvas = $.extend({}, canvas); - }, - limitCanvas: function limitCanvas(isSizeLimited, isPositionLimited) { - var self = this; - var options = self.options; - var viewMode = options.viewMode; - var container = self.container; - var containerWidth = container.width; - var containerHeight = container.height; - var canvas = self.canvas; - var aspectRatio = canvas.aspectRatio; - var cropBox = self.cropBox; - var cropped = self.cropped && cropBox; - - if (isSizeLimited) { - var minCanvasWidth = Number(options.minCanvasWidth) || 0; - var minCanvasHeight = Number(options.minCanvasHeight) || 0; - - if (viewMode) { - if (viewMode > 1) { - minCanvasWidth = Math.max(minCanvasWidth, containerWidth); - minCanvasHeight = Math.max(minCanvasHeight, containerHeight); - - if (viewMode === 3) { - if (minCanvasHeight * aspectRatio > minCanvasWidth) { - minCanvasWidth = minCanvasHeight * aspectRatio; - } else { - minCanvasHeight = minCanvasWidth / aspectRatio; - } - } - } else if (minCanvasWidth) { - minCanvasWidth = Math.max(minCanvasWidth, cropped ? cropBox.width : 0); - } else if (minCanvasHeight) { - minCanvasHeight = Math.max(minCanvasHeight, cropped ? cropBox.height : 0); - } else if (cropped) { - minCanvasWidth = cropBox.width; - minCanvasHeight = cropBox.height; - - if (minCanvasHeight * aspectRatio > minCanvasWidth) { - minCanvasWidth = minCanvasHeight * aspectRatio; - } else { - minCanvasHeight = minCanvasWidth / aspectRatio; - } - } - } - - if (minCanvasWidth && minCanvasHeight) { - if (minCanvasHeight * aspectRatio > minCanvasWidth) { - minCanvasHeight = minCanvasWidth / aspectRatio; - } else { - minCanvasWidth = minCanvasHeight * aspectRatio; - } - } else if (minCanvasWidth) { - minCanvasHeight = minCanvasWidth / aspectRatio; - } else if (minCanvasHeight) { - minCanvasWidth = minCanvasHeight * aspectRatio; - } - - canvas.minWidth = minCanvasWidth; - canvas.minHeight = minCanvasHeight; - canvas.maxWidth = Infinity; - canvas.maxHeight = Infinity; - } - - if (isPositionLimited) { - if (viewMode) { - var newCanvasLeft = containerWidth - canvas.width; - var newCanvasTop = containerHeight - canvas.height; - - canvas.minLeft = Math.min(0, newCanvasLeft); - canvas.minTop = Math.min(0, newCanvasTop); - canvas.maxLeft = Math.max(0, newCanvasLeft); - canvas.maxTop = Math.max(0, newCanvasTop); - - if (cropped && self.limited) { - canvas.minLeft = Math.min(cropBox.left, cropBox.left + cropBox.width - canvas.width); - canvas.minTop = Math.min(cropBox.top, cropBox.top + cropBox.height - canvas.height); - canvas.maxLeft = cropBox.left; - canvas.maxTop = cropBox.top; - - if (viewMode === 2) { - if (canvas.width >= containerWidth) { - canvas.minLeft = Math.min(0, newCanvasLeft); - canvas.maxLeft = Math.max(0, newCanvasLeft); - } - - if (canvas.height >= containerHeight) { - canvas.minTop = Math.min(0, newCanvasTop); - canvas.maxTop = Math.max(0, newCanvasTop); - } - } - } - } else { - canvas.minLeft = -canvas.width; - canvas.minTop = -canvas.height; - canvas.maxLeft = containerWidth; - canvas.maxTop = containerHeight; - } - } - }, - renderCanvas: function renderCanvas(isChanged) { - var self = this; - var canvas = self.canvas; - var image = self.image; - var rotate = image.rotate; - var naturalWidth = image.naturalWidth; - var naturalHeight = image.naturalHeight; - - if (self.rotated) { - self.rotated = false; - - // Computes rotated sizes with image sizes - var rotated = getRotatedSizes({ - width: image.width, - height: image.height, - degree: rotate - }); - var aspectRatio = rotated.width / rotated.height; - var isSquareImage = image.aspectRatio === 1; - - if (isSquareImage || aspectRatio !== canvas.aspectRatio) { - canvas.left -= (rotated.width - canvas.width) / 2; - canvas.top -= (rotated.height - canvas.height) / 2; - canvas.width = rotated.width; - canvas.height = rotated.height; - canvas.aspectRatio = aspectRatio; - canvas.naturalWidth = naturalWidth; - canvas.naturalHeight = naturalHeight; - - // Computes rotated sizes with natural image sizes - if (isSquareImage && rotate % 90 || rotate % 180) { - var rotated2 = getRotatedSizes({ - width: naturalWidth, - height: naturalHeight, - degree: rotate - }); - - canvas.naturalWidth = rotated2.width; - canvas.naturalHeight = rotated2.height; - } - - self.limitCanvas(true, false); - } - } - - if (canvas.width > canvas.maxWidth || canvas.width < canvas.minWidth) { - canvas.left = canvas.oldLeft; - } - - if (canvas.height > canvas.maxHeight || canvas.height < canvas.minHeight) { - canvas.top = canvas.oldTop; - } - - canvas.width = Math.min(Math.max(canvas.width, canvas.minWidth), canvas.maxWidth); - canvas.height = Math.min(Math.max(canvas.height, canvas.minHeight), canvas.maxHeight); - - self.limitCanvas(false, true); - - canvas.left = Math.min(Math.max(canvas.left, canvas.minLeft), canvas.maxLeft); - canvas.top = Math.min(Math.max(canvas.top, canvas.minTop), canvas.maxTop); - canvas.oldLeft = canvas.left; - canvas.oldTop = canvas.top; - - self.$canvas.css({ - width: canvas.width, - height: canvas.height, - transform: getTransform({ - translateX: canvas.left, - translateY: canvas.top - }) - }); - - self.renderImage(); - - if (self.cropped && self.limited) { - self.limitCropBox(true, true); - } - - if (isChanged) { - self.output(); - } - }, - renderImage: function renderImage(isChanged) { - var self = this; - var canvas = self.canvas; - var image = self.image; - var reversed = void 0; - - if (image.rotate) { - reversed = getRotatedSizes({ - width: canvas.width, - height: canvas.height, - degree: image.rotate, - aspectRatio: image.aspectRatio - }, true); - } - - $.extend(image, reversed ? { - width: reversed.width, - height: reversed.height, - left: (canvas.width - reversed.width) / 2, - top: (canvas.height - reversed.height) / 2 - } : { - width: canvas.width, - height: canvas.height, - left: 0, - top: 0 - }); - - self.$clone.css({ - width: image.width, - height: image.height, - transform: getTransform($.extend({ - translateX: image.left, - translateY: image.top - }, image)) - }); - - if (isChanged) { - self.output(); - } - }, - initCropBox: function initCropBox() { - var self = this; - var options = self.options; - var canvas = self.canvas; - var aspectRatio = options.aspectRatio; - var autoCropArea = Number(options.autoCropArea) || 0.8; - var cropBox = { - width: canvas.width, - height: canvas.height - }; - - if (aspectRatio) { - if (canvas.height * aspectRatio > canvas.width) { - cropBox.height = cropBox.width / aspectRatio; - } else { - cropBox.width = cropBox.height * aspectRatio; - } - } - - self.cropBox = cropBox; - self.limitCropBox(true, true); - - // Initialize auto crop area - cropBox.width = Math.min(Math.max(cropBox.width, cropBox.minWidth), cropBox.maxWidth); - cropBox.height = Math.min(Math.max(cropBox.height, cropBox.minHeight), cropBox.maxHeight); - - // The width of auto crop area must large than "minWidth", and the height too. (#164) - cropBox.width = Math.max(cropBox.minWidth, cropBox.width * autoCropArea); - cropBox.height = Math.max(cropBox.minHeight, cropBox.height * autoCropArea); - cropBox.left = canvas.left + (canvas.width - cropBox.width) / 2; - cropBox.top = canvas.top + (canvas.height - cropBox.height) / 2; - cropBox.oldLeft = cropBox.left; - cropBox.oldTop = cropBox.top; - - self.initialCropBox = $.extend({}, cropBox); - }, - limitCropBox: function limitCropBox(isSizeLimited, isPositionLimited) { - var self = this; - var options = self.options; - var aspectRatio = options.aspectRatio; - var container = self.container; - var containerWidth = container.width; - var containerHeight = container.height; - var canvas = self.canvas; - var cropBox = self.cropBox; - var limited = self.limited; - - if (isSizeLimited) { - var minCropBoxWidth = Number(options.minCropBoxWidth) || 0; - var minCropBoxHeight = Number(options.minCropBoxHeight) || 0; - var maxCropBoxWidth = Math.min(containerWidth, limited ? canvas.width : containerWidth); - var maxCropBoxHeight = Math.min(containerHeight, limited ? canvas.height : containerHeight); - - // The min/maxCropBoxWidth/Height must be less than containerWidth/Height - minCropBoxWidth = Math.min(minCropBoxWidth, containerWidth); - minCropBoxHeight = Math.min(minCropBoxHeight, containerHeight); - - if (aspectRatio) { - if (minCropBoxWidth && minCropBoxHeight) { - if (minCropBoxHeight * aspectRatio > minCropBoxWidth) { - minCropBoxHeight = minCropBoxWidth / aspectRatio; - } else { - minCropBoxWidth = minCropBoxHeight * aspectRatio; - } - } else if (minCropBoxWidth) { - minCropBoxHeight = minCropBoxWidth / aspectRatio; - } else if (minCropBoxHeight) { - minCropBoxWidth = minCropBoxHeight * aspectRatio; - } - - if (maxCropBoxHeight * aspectRatio > maxCropBoxWidth) { - maxCropBoxHeight = maxCropBoxWidth / aspectRatio; - } else { - maxCropBoxWidth = maxCropBoxHeight * aspectRatio; - } - } - - // The minWidth/Height must be less than maxWidth/Height - cropBox.minWidth = Math.min(minCropBoxWidth, maxCropBoxWidth); - cropBox.minHeight = Math.min(minCropBoxHeight, maxCropBoxHeight); - cropBox.maxWidth = maxCropBoxWidth; - cropBox.maxHeight = maxCropBoxHeight; - } - - if (isPositionLimited) { - if (limited) { - cropBox.minLeft = Math.max(0, canvas.left); - cropBox.minTop = Math.max(0, canvas.top); - cropBox.maxLeft = Math.min(containerWidth, canvas.left + canvas.width) - cropBox.width; - cropBox.maxTop = Math.min(containerHeight, canvas.top + canvas.height) - cropBox.height; - } else { - cropBox.minLeft = 0; - cropBox.minTop = 0; - cropBox.maxLeft = containerWidth - cropBox.width; - cropBox.maxTop = containerHeight - cropBox.height; - } - } - }, - renderCropBox: function renderCropBox() { - var self = this; - var options = self.options; - var container = self.container; - var containerWidth = container.width; - var containerHeight = container.height; - var cropBox = self.cropBox; - - if (cropBox.width > cropBox.maxWidth || cropBox.width < cropBox.minWidth) { - cropBox.left = cropBox.oldLeft; - } - - if (cropBox.height > cropBox.maxHeight || cropBox.height < cropBox.minHeight) { - cropBox.top = cropBox.oldTop; - } - - cropBox.width = Math.min(Math.max(cropBox.width, cropBox.minWidth), cropBox.maxWidth); - cropBox.height = Math.min(Math.max(cropBox.height, cropBox.minHeight), cropBox.maxHeight); - - self.limitCropBox(false, true); - - cropBox.left = Math.min(Math.max(cropBox.left, cropBox.minLeft), cropBox.maxLeft); - cropBox.top = Math.min(Math.max(cropBox.top, cropBox.minTop), cropBox.maxTop); - cropBox.oldLeft = cropBox.left; - cropBox.oldTop = cropBox.top; - - if (options.movable && options.cropBoxMovable) { - // Turn to move the canvas when the crop box is equal to the container - self.$face.data('action', cropBox.width === containerWidth && cropBox.height === containerHeight ? 'move' : 'all'); - } - - self.$cropBox.css({ - width: cropBox.width, - height: cropBox.height, - transform: getTransform({ - translateX: cropBox.left, - translateY: cropBox.top - }) - }); - - if (self.cropped && self.limited) { - self.limitCanvas(true, true); - } - - if (!self.disabled) { - self.output(); - } - }, - output: function output() { - var self = this; - - self.preview(); - - if (self.completed) { - self.trigger('crop', self.getData()); - } - } - }; - - var DATA_PREVIEW = 'preview'; - - var preview = { - initPreview: function initPreview() { - var self = this; - var crossOrigin = self.crossOrigin; - var url = crossOrigin ? self.crossOriginUrl : self.url; - var image = document.createElement('img'); - - if (crossOrigin) { - image.crossOrigin = crossOrigin; - } - - image.src = url; - - var $clone2 = $(image); - - self.$preview = $(self.options.preview); - self.$clone2 = $clone2; - self.$viewBox.html($clone2); - self.$preview.each(function (i, element) { - var $this = $(element); - var img = document.createElement('img'); - - // Save the original size for recover - $this.data(DATA_PREVIEW, { - width: $this.width(), - height: $this.height(), - html: $this.html() - }); - - if (crossOrigin) { - img.crossOrigin = crossOrigin; - } - - img.src = url; - - /** - * Override img element styles - * Add `display:block` to avoid margin top issue - * Add `height:auto` to override `height` attribute on IE8 - * (Occur only when margin-top <= -height) - */ - img.style.cssText = 'display:block;' + 'width:100%;' + 'height:auto;' + 'min-width:0!important;' + 'min-height:0!important;' + 'max-width:none!important;' + 'max-height:none!important;' + 'image-orientation:0deg!important;"'; - - $this.html(img); - }); - }, - resetPreview: function resetPreview() { - this.$preview.each(function (i, element) { - var $this = $(element); - var data = $this.data(DATA_PREVIEW); - - $this.css({ - width: data.width, - height: data.height - }).html(data.html).removeData(DATA_PREVIEW); - }); - }, - preview: function preview() { - var self = this; - var image = self.image; - var canvas = self.canvas; - var cropBox = self.cropBox; - var cropBoxWidth = cropBox.width; - var cropBoxHeight = cropBox.height; - var width = image.width; - var height = image.height; - var left = cropBox.left - canvas.left - image.left; - var top = cropBox.top - canvas.top - image.top; - - if (!self.cropped || self.disabled) { - return; - } - - self.$clone2.css({ - width: width, - height: height, - transform: getTransform($.extend({ - translateX: -left, - translateY: -top - }, image)) - }); - - self.$preview.each(function (i, element) { - var $this = $(element); - var data = $this.data(DATA_PREVIEW); - var originalWidth = data.width; - var originalHeight = data.height; - var newWidth = originalWidth; - var newHeight = originalHeight; - var ratio = 1; - - if (cropBoxWidth) { - ratio = originalWidth / cropBoxWidth; - newHeight = cropBoxHeight * ratio; - } - - if (cropBoxHeight && newHeight > originalHeight) { - ratio = originalHeight / cropBoxHeight; - newWidth = cropBoxWidth * ratio; - newHeight = originalHeight; - } - - $this.css({ - width: newWidth, - height: newHeight - }).find('img').css({ - width: width * ratio, - height: height * ratio, - transform: getTransform($.extend({ - translateX: -left * ratio, - translateY: -top * ratio - }, image)) - }); - }); - } - }; - - // Globals - var PointerEvent = typeof window !== 'undefined' ? window.PointerEvent : null; - - // Events - var EVENT_POINTER_DOWN = PointerEvent ? 'pointerdown' : 'touchstart mousedown'; - var EVENT_POINTER_MOVE = PointerEvent ? 'pointermove' : 'touchmove mousemove'; - var EVENT_POINTER_UP = PointerEvent ? ' pointerup pointercancel' : 'touchend touchcancel mouseup'; - var EVENT_WHEEL = 'wheel mousewheel DOMMouseScroll'; - var EVENT_DBLCLICK = 'dblclick'; - var EVENT_RESIZE = 'resize'; - var EVENT_CROP_START = 'cropstart'; - var EVENT_CROP_MOVE = 'cropmove'; - var EVENT_CROP_END = 'cropend'; - var EVENT_CROP = 'crop'; - var EVENT_ZOOM = 'zoom'; - - var events = { - bind: function bind() { - var self = this; - var options = self.options; - var $this = self.$element; - var $cropper = self.$cropper; - - if ($.isFunction(options.cropstart)) { - $this.on(EVENT_CROP_START, options.cropstart); - } - - if ($.isFunction(options.cropmove)) { - $this.on(EVENT_CROP_MOVE, options.cropmove); - } - - if ($.isFunction(options.cropend)) { - $this.on(EVENT_CROP_END, options.cropend); - } - - if ($.isFunction(options.crop)) { - $this.on(EVENT_CROP, options.crop); - } - - if ($.isFunction(options.zoom)) { - $this.on(EVENT_ZOOM, options.zoom); - } - - $cropper.on(EVENT_POINTER_DOWN, proxy(self.cropStart, this)); - - if (options.zoomable && options.zoomOnWheel) { - $cropper.on(EVENT_WHEEL, proxy(self.wheel, this)); - } - - if (options.toggleDragModeOnDblclick) { - $cropper.on(EVENT_DBLCLICK, proxy(self.dblclick, this)); - } - - $(document).on(EVENT_POINTER_MOVE, self.onCropMove = proxy(self.cropMove, this)).on(EVENT_POINTER_UP, self.onCropEnd = proxy(self.cropEnd, this)); - - if (options.responsive) { - $(window).on(EVENT_RESIZE, self.onResize = proxy(self.resize, this)); - } - }, - unbind: function unbind() { - var self = this; - var options = self.options; - var $this = self.$element; - var $cropper = self.$cropper; - - if ($.isFunction(options.cropstart)) { - $this.off(EVENT_CROP_START, options.cropstart); - } - - if ($.isFunction(options.cropmove)) { - $this.off(EVENT_CROP_MOVE, options.cropmove); - } - - if ($.isFunction(options.cropend)) { - $this.off(EVENT_CROP_END, options.cropend); - } - - if ($.isFunction(options.crop)) { - $this.off(EVENT_CROP, options.crop); - } - - if ($.isFunction(options.zoom)) { - $this.off(EVENT_ZOOM, options.zoom); - } - - $cropper.off(EVENT_POINTER_DOWN, self.cropStart); - - if (options.zoomable && options.zoomOnWheel) { - $cropper.off(EVENT_WHEEL, self.wheel); - } - - if (options.toggleDragModeOnDblclick) { - $cropper.off(EVENT_DBLCLICK, self.dblclick); - } - - $(document).off(EVENT_POINTER_MOVE, self.onCropMove).off(EVENT_POINTER_UP, self.onCropEnd); - - if (options.responsive) { - $(window).off(EVENT_RESIZE, self.onResize); - } - } - }; - - var REGEXP_ACTIONS = /^(e|w|s|n|se|sw|ne|nw|all|crop|move|zoom)$/; - - function getPointer(_ref, endOnly) { - var pageX = _ref.pageX, - pageY = _ref.pageY; - - var end = { - endX: pageX, - endY: pageY - }; - - if (endOnly) { - return end; - } - - return $.extend({ - startX: pageX, - startY: pageY - }, end); - } - - var handlers = { - resize: function resize() { - var self = this; - var options = self.options; - var $container = self.$container; - var container = self.container; - var minContainerWidth = Number(options.minContainerWidth) || 200; - var minContainerHeight = Number(options.minContainerHeight) || 100; - - if (self.disabled || container.width === minContainerWidth || container.height === minContainerHeight) { - return; - } - - var ratio = $container.width() / container.width; - - // Resize when width changed or height changed - if (ratio !== 1 || $container.height() !== container.height) { - var canvasData = void 0; - var cropBoxData = void 0; - - if (options.restore) { - canvasData = self.getCanvasData(); - cropBoxData = self.getCropBoxData(); - } - - self.render(); - - if (options.restore) { - self.setCanvasData($.each(canvasData, function (i, n) { - canvasData[i] = n * ratio; - })); - self.setCropBoxData($.each(cropBoxData, function (i, n) { - cropBoxData[i] = n * ratio; - })); - } - } - }, - dblclick: function dblclick() { - var self = this; - - if (self.disabled || self.options.dragMode === 'none') { - return; - } - - self.setDragMode(self.$dragBox.hasClass('cropper-crop') ? 'move' : 'crop'); - }, - wheel: function wheel(event) { - var self = this; - var e = event.originalEvent || event; - var ratio = Number(self.options.wheelZoomRatio) || 0.1; - - if (self.disabled) { - return; - } - - event.preventDefault(); - - // Limit wheel speed to prevent zoom too fast - if (self.wheeling) { - return; - } - - self.wheeling = true; - - setTimeout(function () { - self.wheeling = false; - }, 50); - - var delta = 1; - - if (e.deltaY) { - delta = e.deltaY > 0 ? 1 : -1; - } else if (e.wheelDelta) { - delta = -e.wheelDelta / 120; - } else if (e.detail) { - delta = e.detail > 0 ? 1 : -1; - } - - self.zoom(-delta * ratio, event); - }, - cropStart: function cropStart(e) { - var self = this; - - if (self.disabled) { - return; - } - - var options = self.options; - var pointers = self.pointers; - var originalEvent = e.originalEvent; - var action = void 0; - - if (originalEvent && originalEvent.changedTouches) { - // Handle touch event - $.each(originalEvent.changedTouches, function (i, touch) { - pointers[touch.identifier] = getPointer(touch); - }); - } else { - // Handle mouse event and pointer event - pointers[originalEvent && originalEvent.pointerId || 0] = getPointer(originalEvent || e); - } - - if (objectKeys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) { - action = 'zoom'; - } else { - action = $(e.target).data('action'); - } - - if (!REGEXP_ACTIONS.test(action)) { - return; - } - - if (self.trigger('cropstart', { - originalEvent: originalEvent, - action: action - }).isDefaultPrevented()) { - return; - } - - e.preventDefault(); - - self.action = action; - self.cropping = false; - - if (action === 'crop') { - self.cropping = true; - self.$dragBox.addClass('cropper-modal'); - } - }, - cropMove: function cropMove(e) { - var self = this; - var action = self.action; - - if (self.disabled || !action) { - return; - } - - var pointers = self.pointers; - var originalEvent = e.originalEvent; - - e.preventDefault(); - - if (self.trigger('cropmove', { - originalEvent: originalEvent, - action: action - }).isDefaultPrevented()) { - return; - } - - if (originalEvent && originalEvent.changedTouches) { - $.each(originalEvent.changedTouches, function (i, touch) { - $.extend(pointers[touch.identifier], getPointer(touch, true)); - }); - } else { - $.extend(pointers[originalEvent && originalEvent.pointerId || 0], getPointer(originalEvent || e, true)); - } - - self.change(e); - }, - cropEnd: function cropEnd(e) { - var self = this; - - if (self.disabled) { - return; - } - - var action = self.action; - var pointers = self.pointers; - var originalEvent = e.originalEvent; - - if (originalEvent && originalEvent.changedTouches) { - $.each(originalEvent.changedTouches, function (i, touch) { - delete pointers[touch.identifier]; - }); - } else { - delete pointers[originalEvent && originalEvent.pointerId || 0]; - } - - if (!action) { - return; - } - - e.preventDefault(); - - if (!objectKeys(pointers).length) { - self.action = ''; - } - - if (self.cropping) { - self.cropping = false; - self.$dragBox.toggleClass('cropper-modal', self.cropped && self.options.modal); - } - - self.trigger('cropend', { - originalEvent: originalEvent, - action: action - }); - } - }; - - // Actions - var ACTION_EAST = 'e'; - var ACTION_WEST = 'w'; - var ACTION_SOUTH = 's'; - var ACTION_NORTH = 'n'; - var ACTION_SOUTH_EAST = 'se'; - var ACTION_SOUTH_WEST = 'sw'; - var ACTION_NORTH_EAST = 'ne'; - var ACTION_NORTH_WEST = 'nw'; - - function getMaxZoomRatio(pointers) { - var pointers2 = $.extend({}, pointers); - var ratios = []; - - $.each(pointers, function (pointerId, pointer) { - delete pointers2[pointerId]; - - $.each(pointers2, function (pointerId2, pointer2) { - var x1 = Math.abs(pointer.startX - pointer2.startX); - var y1 = Math.abs(pointer.startY - pointer2.startY); - var x2 = Math.abs(pointer.endX - pointer2.endX); - var y2 = Math.abs(pointer.endY - pointer2.endY); - var z1 = Math.sqrt(x1 * x1 + y1 * y1); - var z2 = Math.sqrt(x2 * x2 + y2 * y2); - var ratio = (z2 - z1) / z1; - - ratios.push(ratio); - }); - }); - - ratios.sort(function (a, b) { - return Math.abs(a) < Math.abs(b); - }); - - return ratios[0]; - } - - var change = { - change: function change(e) { - var self = this; - var options = self.options; - var pointers = self.pointers; - var pointer = pointers[objectKeys(pointers)[0]]; - var container = self.container; - var canvas = self.canvas; - var cropBox = self.cropBox; - var action = self.action; - var aspectRatio = options.aspectRatio; - var width = cropBox.width; - var height = cropBox.height; - var left = cropBox.left; - var top = cropBox.top; - var right = left + width; - var bottom = top + height; - var minLeft = 0; - var minTop = 0; - var maxWidth = container.width; - var maxHeight = container.height; - var renderable = true; - var offset = void 0; - - // Locking aspect ratio in "free mode" by holding shift key (#259) - if (!aspectRatio && e.shiftKey) { - aspectRatio = width && height ? width / height : 1; - } - - if (self.limited) { - minLeft = cropBox.minLeft; - minTop = cropBox.minTop; - maxWidth = minLeft + Math.min(container.width, canvas.width, canvas.left + canvas.width); - maxHeight = minTop + Math.min(container.height, canvas.height, canvas.top + canvas.height); - } - - var range = { - x: pointer.endX - pointer.startX, - y: pointer.endY - pointer.startY - }; - - switch (action) { - // Move crop box - case 'all': - left += range.x; - top += range.y; - break; - - // Resize crop box - case ACTION_EAST: - if (range.x >= 0 && (right >= maxWidth || aspectRatio && (top <= minTop || bottom >= maxHeight))) { - renderable = false; - break; - } - - if (right + range.x > maxWidth) { - range.x = maxWidth - right; - } - - width += range.x; - - if (aspectRatio) { - height = width / aspectRatio; - top -= range.x / aspectRatio / 2; - } - - if (width < 0) { - action = ACTION_WEST; - width = 0; - } - - break; - - case ACTION_NORTH: - if (range.y <= 0 && (top <= minTop || aspectRatio && (left <= minLeft || right >= maxWidth))) { - renderable = false; - break; - } - - if (top + range.y < minTop) { - range.y = minTop - top; - } - - height -= range.y; - top += range.y; - - if (aspectRatio) { - width = height * aspectRatio; - left += range.y * aspectRatio / 2; - } - - if (height < 0) { - action = ACTION_SOUTH; - height = 0; - } - - break; - - case ACTION_WEST: - if (range.x <= 0 && (left <= minLeft || aspectRatio && (top <= minTop || bottom >= maxHeight))) { - renderable = false; - break; - } - - if (left + range.x < minLeft) { - range.x = minLeft - left; - } - - width -= range.x; - left += range.x; - - if (aspectRatio) { - height = width / aspectRatio; - top += range.x / aspectRatio / 2; - } - - if (width < 0) { - action = ACTION_EAST; - width = 0; - } - - break; - - case ACTION_SOUTH: - if (range.y >= 0 && (bottom >= maxHeight || aspectRatio && (left <= minLeft || right >= maxWidth))) { - renderable = false; - break; - } - - if (bottom + range.y > maxHeight) { - range.y = maxHeight - bottom; - } - - height += range.y; - - if (aspectRatio) { - width = height * aspectRatio; - left -= range.y * aspectRatio / 2; - } - - if (height < 0) { - action = ACTION_NORTH; - height = 0; - } - - break; - - case ACTION_NORTH_EAST: - if (aspectRatio) { - if (range.y <= 0 && (top <= minTop || right >= maxWidth)) { - renderable = false; - break; - } - - height -= range.y; - top += range.y; - width = height * aspectRatio; - } else { - if (range.x >= 0) { - if (right < maxWidth) { - width += range.x; - } else if (range.y <= 0 && top <= minTop) { - renderable = false; - } - } else { - width += range.x; - } - - if (range.y <= 0) { - if (top > minTop) { - height -= range.y; - top += range.y; - } - } else { - height -= range.y; - top += range.y; - } - } - - if (width < 0 && height < 0) { - action = ACTION_SOUTH_WEST; - height = 0; - width = 0; - } else if (width < 0) { - action = ACTION_NORTH_WEST; - width = 0; - } else if (height < 0) { - action = ACTION_SOUTH_EAST; - height = 0; - } - - break; - - case ACTION_NORTH_WEST: - if (aspectRatio) { - if (range.y <= 0 && (top <= minTop || left <= minLeft)) { - renderable = false; - break; - } - - height -= range.y; - top += range.y; - width = height * aspectRatio; - left += range.y * aspectRatio; - } else { - if (range.x <= 0) { - if (left > minLeft) { - width -= range.x; - left += range.x; - } else if (range.y <= 0 && top <= minTop) { - renderable = false; - } - } else { - width -= range.x; - left += range.x; - } - - if (range.y <= 0) { - if (top > minTop) { - height -= range.y; - top += range.y; - } - } else { - height -= range.y; - top += range.y; - } - } - - if (width < 0 && height < 0) { - action = ACTION_SOUTH_EAST; - height = 0; - width = 0; - } else if (width < 0) { - action = ACTION_NORTH_EAST; - width = 0; - } else if (height < 0) { - action = ACTION_SOUTH_WEST; - height = 0; - } - - break; - - case ACTION_SOUTH_WEST: - if (aspectRatio) { - if (range.x <= 0 && (left <= minLeft || bottom >= maxHeight)) { - renderable = false; - break; - } - - width -= range.x; - left += range.x; - height = width / aspectRatio; - } else { - if (range.x <= 0) { - if (left > minLeft) { - width -= range.x; - left += range.x; - } else if (range.y >= 0 && bottom >= maxHeight) { - renderable = false; - } - } else { - width -= range.x; - left += range.x; - } - - if (range.y >= 0) { - if (bottom < maxHeight) { - height += range.y; - } - } else { - height += range.y; - } - } - - if (width < 0 && height < 0) { - action = ACTION_NORTH_EAST; - height = 0; - width = 0; - } else if (width < 0) { - action = ACTION_SOUTH_EAST; - width = 0; - } else if (height < 0) { - action = ACTION_NORTH_WEST; - height = 0; - } - - break; - - case ACTION_SOUTH_EAST: - if (aspectRatio) { - if (range.x >= 0 && (right >= maxWidth || bottom >= maxHeight)) { - renderable = false; - break; - } - - width += range.x; - height = width / aspectRatio; - } else { - if (range.x >= 0) { - if (right < maxWidth) { - width += range.x; - } else if (range.y >= 0 && bottom >= maxHeight) { - renderable = false; - } - } else { - width += range.x; - } - - if (range.y >= 0) { - if (bottom < maxHeight) { - height += range.y; - } - } else { - height += range.y; - } - } - - if (width < 0 && height < 0) { - action = ACTION_NORTH_WEST; - height = 0; - width = 0; - } else if (width < 0) { - action = ACTION_SOUTH_WEST; - width = 0; - } else if (height < 0) { - action = ACTION_NORTH_EAST; - height = 0; - } - - break; - - // Move canvas - case 'move': - self.move(range.x, range.y); - renderable = false; - break; - - // Zoom canvas - case 'zoom': - self.zoom(getMaxZoomRatio(pointers), e.originalEvent); - renderable = false; - break; - - // Create crop box - case 'crop': - if (!range.x || !range.y) { - renderable = false; - break; - } - - offset = self.$cropper.offset(); - left = pointer.startX - offset.left; - top = pointer.startY - offset.top; - width = cropBox.minWidth; - height = cropBox.minHeight; - - if (range.x > 0) { - action = range.y > 0 ? ACTION_SOUTH_EAST : ACTION_NORTH_EAST; - } else if (range.x < 0) { - left -= width; - action = range.y > 0 ? ACTION_SOUTH_WEST : ACTION_NORTH_WEST; - } - - if (range.y < 0) { - top -= height; - } - - // Show the crop box if is hidden - if (!self.cropped) { - self.$cropBox.removeClass('cropper-hidden'); - self.cropped = true; - - if (self.limited) { - self.limitCropBox(true, true); - } - } - - break; - - default: - } - - if (renderable) { - cropBox.width = width; - cropBox.height = height; - cropBox.left = left; - cropBox.top = top; - self.action = action; - self.renderCropBox(); - } - - // Override - $.each(pointers, function (i, p) { - p.startX = p.endX; - p.startY = p.endY; - }); - } - }; - - function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length) ; i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - - function getPointersCenter(pointers) { - var pageX = 0; - var pageY = 0; - var count = 0; - - $.each(pointers, function (i, _ref) { - var startX = _ref.startX, - startY = _ref.startY; - - pageX += startX; - pageY += startY; - count += 1; - }); - - pageX /= count; - pageY /= count; - - return { - pageX: pageX, - pageY: pageY - }; - } - - var methods = { - // Show the crop box manually - crop: function crop() { - var self = this; - - if (!self.ready || self.disabled) { - return; - } - - if (!self.cropped) { - self.cropped = true; - self.limitCropBox(true, true); - - if (self.options.modal) { - self.$dragBox.addClass('cropper-modal'); - } - - self.$cropBox.removeClass('cropper-hidden'); - } - - self.setCropBoxData(self.initialCropBox); - }, - - - // Reset the image and crop box to their initial states - reset: function reset() { - var self = this; - - if (!self.ready || self.disabled) { - return; - } - - self.image = $.extend({}, self.initialImage); - self.canvas = $.extend({}, self.initialCanvas); - self.cropBox = $.extend({}, self.initialCropBox); - - self.renderCanvas(); - - if (self.cropped) { - self.renderCropBox(); - } - }, - - - // Clear the crop box - clear: function clear() { - var self = this; - - if (!self.cropped || self.disabled) { - return; - } - - $.extend(self.cropBox, { - left: 0, - top: 0, - width: 0, - height: 0 - }); - - self.cropped = false; - self.renderCropBox(); - - self.limitCanvas(true, true); - - // Render canvas after crop box rendered - self.renderCanvas(); - - self.$dragBox.removeClass('cropper-modal'); - self.$cropBox.addClass('cropper-hidden'); - }, - - - /** - * Replace the image's src and rebuild the cropper - * - * @param {String} url - * @param {Boolean} onlyColorChanged (optional) - */ - replace: function replace(url, onlyColorChanged) { - var self = this; - - if (!self.disabled && url) { - if (self.isImg) { - self.$element.attr('src', url); - } - - if (onlyColorChanged) { - self.url = url; - self.$clone.attr('src', url); - - if (self.ready) { - self.$preview.find('img').add(self.$clone2).attr('src', url); - } - } else { - if (self.isImg) { - self.replaced = true; - } - - // Clear previous data - self.options.data = null; - self.load(url); - } - } - }, - - - // Enable (unfreeze) the cropper - enable: function enable() { - var self = this; - - if (self.ready) { - self.disabled = false; - self.$cropper.removeClass('cropper-disabled'); - } - }, - - - // Disable (freeze) the cropper - disable: function disable() { - var self = this; - - if (self.ready) { - self.disabled = true; - self.$cropper.addClass('cropper-disabled'); - } - }, - - - // Destroy the cropper and remove the instance from the image - destroy: function destroy() { - var self = this; - var $this = self.$element; - - if (self.loaded) { - if (self.isImg && self.replaced) { - $this.attr('src', self.originalUrl); - } - - self.unbuild(); - $this.removeClass('cropper-hidden'); - } else if (self.isImg) { - $this.off('load', self.start); - } else if (self.$clone) { - self.$clone.remove(); - } - - $this.removeData('cropper'); - }, - - - /** - * Move the canvas with relative offsets - * - * @param {Number} offsetX - * @param {Number} offsetY (optional) - */ - move: function move(offsetX, offsetY) { - var self = this; - var canvas = self.canvas; - - self.moveTo(isUndefined(offsetX) ? offsetX : canvas.left + Number(offsetX), isUndefined(offsetY) ? offsetY : canvas.top + Number(offsetY)); - }, - - - /** - * Move the canvas to an absolute point - * - * @param {Number} x - * @param {Number} y (optional) - */ - moveTo: function moveTo(x, y) { - var self = this; - var canvas = self.canvas; - var changed = false; - - // If "y" is not present, its default value is "x" - if (isUndefined(y)) { - y = x; - } - - x = Number(x); - y = Number(y); - - if (self.ready && !self.disabled && self.options.movable) { - if (isNumber(x)) { - canvas.left = x; - changed = true; - } - - if (isNumber(y)) { - canvas.top = y; - changed = true; - } - - if (changed) { - self.renderCanvas(true); - } - } - }, - - - /** - * Zoom the canvas with a relative ratio - * - * @param {Number} ratio - * @param {jQuery Event} _event (private) - */ - zoom: function zoom(ratio, _event) { - var self = this; - var canvas = self.canvas; - - ratio = Number(ratio); - - if (ratio < 0) { - ratio = 1 / (1 - ratio); - } else { - ratio = 1 + ratio; - } - - self.zoomTo(canvas.width * ratio / canvas.naturalWidth, _event); - }, - - - /** - * Zoom the canvas to an absolute ratio - * - * @param {Number} ratio - * @param {jQuery Event} _event (private) - */ - zoomTo: function zoomTo(ratio, _event) { - var self = this; - var options = self.options; - var pointers = self.pointers; - var canvas = self.canvas; - var width = canvas.width; - var height = canvas.height; - var naturalWidth = canvas.naturalWidth; - var naturalHeight = canvas.naturalHeight; - - ratio = Number(ratio); - - if (ratio >= 0 && self.ready && !self.disabled && options.zoomable) { - var newWidth = naturalWidth * ratio; - var newHeight = naturalHeight * ratio; - var originalEvent = void 0; - - if (_event) { - originalEvent = _event.originalEvent; - } - - if (self.trigger('zoom', { - originalEvent: originalEvent, - oldRatio: width / naturalWidth, - ratio: newWidth / naturalWidth - }).isDefaultPrevented()) { - return; - } - - if (originalEvent) { - var offset = self.$cropper.offset(); - var center = pointers && objectKeys(pointers).length ? getPointersCenter(pointers) : { - pageX: _event.pageX || originalEvent.pageX || 0, - pageY: _event.pageY || originalEvent.pageY || 0 - }; - - // Zoom from the triggering point of the event - canvas.left -= (newWidth - width) * ((center.pageX - offset.left - canvas.left) / width); - canvas.top -= (newHeight - height) * ((center.pageY - offset.top - canvas.top) / height); - } else { - // Zoom from the center of the canvas - canvas.left -= (newWidth - width) / 2; - canvas.top -= (newHeight - height) / 2; - } - - canvas.width = newWidth; - canvas.height = newHeight; - self.renderCanvas(true); - } - }, - - - /** - * Rotate the canvas with a relative degree - * - * @param {Number} degree - */ - rotate: function rotate(degree) { - var self = this; - - self.rotateTo((self.image.rotate || 0) + Number(degree)); - }, - - - /** - * Rotate the canvas to an absolute degree - * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function#rotate() - * - * @param {Number} degree - */ - rotateTo: function rotateTo(degree) { - var self = this; - - degree = Number(degree); - - if (isNumber(degree) && self.ready && !self.disabled && self.options.rotatable) { - self.image.rotate = degree % 360; - self.rotated = true; - self.renderCanvas(true); - } - }, - - - /** - * Scale the image - * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function#scale() - * - * @param {Number} scaleX - * @param {Number} scaleY (optional) - */ - scale: function scale(scaleX, scaleY) { - var self = this; - var image = self.image; - var changed = false; - - // If "scaleY" is not present, its default value is "scaleX" - if (isUndefined(scaleY)) { - scaleY = scaleX; - } - - scaleX = Number(scaleX); - scaleY = Number(scaleY); - - if (self.ready && !self.disabled && self.options.scalable) { - if (isNumber(scaleX)) { - image.scaleX = scaleX; - changed = true; - } - - if (isNumber(scaleY)) { - image.scaleY = scaleY; - changed = true; - } - - if (changed) { - self.renderImage(true); - } - } - }, - - - /** - * Scale the abscissa of the image - * - * @param {Number} scaleX - */ - scaleX: function scaleX(_scaleX) { - var self = this; - var scaleY = self.image.scaleY; - - self.scale(_scaleX, isNumber(scaleY) ? scaleY : 1); - }, - - - /** - * Scale the ordinate of the image - * - * @param {Number} scaleY - */ - scaleY: function scaleY(_scaleY) { - var self = this; - var scaleX = self.image.scaleX; - - self.scale(isNumber(scaleX) ? scaleX : 1, _scaleY); - }, - - - /** - * Get the cropped area position and size data (base on the original image) - * - * @param {Boolean} isRounded (optional) - * @return {Object} data - */ - getData: function getData(isRounded) { - var self = this; - var options = self.options; - var image = self.image; - var canvas = self.canvas; - var cropBox = self.cropBox; - var ratio = void 0; - var data = void 0; - - if (self.ready && self.cropped) { - data = { - x: cropBox.left - canvas.left, - y: cropBox.top - canvas.top, - width: cropBox.width, - height: cropBox.height - }; - - ratio = image.width / image.naturalWidth; - - $.each(data, function (i, n) { - n /= ratio; - data[i] = isRounded ? Math.round(n) : n; - }); - } else { - data = { - x: 0, - y: 0, - width: 0, - height: 0 - }; - } - - if (options.rotatable) { - data.rotate = image.rotate || 0; - } - - if (options.scalable) { - data.scaleX = image.scaleX || 1; - data.scaleY = image.scaleY || 1; - } - - return data; - }, - - - /** - * Set the cropped area position and size with new data - * - * @param {Object} data - */ - setData: function setData(data) { - var self = this; - var options = self.options; - var image = self.image; - var canvas = self.canvas; - var cropBoxData = {}; - var rotated = void 0; - var isScaled = void 0; - var ratio = void 0; - - if ($.isFunction(data)) { - data = data.call(self.element); - } - - if (self.ready && !self.disabled && $.isPlainObject(data)) { - if (options.rotatable) { - if (isNumber(data.rotate) && data.rotate !== image.rotate) { - image.rotate = data.rotate; - rotated = true; - self.rotated = rotated; - } - } - - if (options.scalable) { - if (isNumber(data.scaleX) && data.scaleX !== image.scaleX) { - image.scaleX = data.scaleX; - isScaled = true; - } - - if (isNumber(data.scaleY) && data.scaleY !== image.scaleY) { - image.scaleY = data.scaleY; - isScaled = true; - } - } - - if (rotated) { - self.renderCanvas(); - } else if (isScaled) { - self.renderImage(); - } - - ratio = image.width / image.naturalWidth; - - if (isNumber(data.x)) { - cropBoxData.left = data.x * ratio + canvas.left; - } - - if (isNumber(data.y)) { - cropBoxData.top = data.y * ratio + canvas.top; - } - - if (isNumber(data.width)) { - cropBoxData.width = data.width * ratio; - } - - if (isNumber(data.height)) { - cropBoxData.height = data.height * ratio; - } - - self.setCropBoxData(cropBoxData); - } - }, - - - /** - * Get the container size data - * - * @return {Object} data - */ - getContainerData: function getContainerData() { - return this.ready ? this.container : {}; - }, - - - /** - * Get the image position and size data - * - * @return {Object} data - */ - getImageData: function getImageData() { - return this.loaded ? this.image : {}; - }, - - - /** - * Get the canvas position and size data - * - * @return {Object} data - */ - getCanvasData: function getCanvasData() { - var self = this; - var canvas = self.canvas; - var data = {}; - - if (self.ready) { - $.each(['left', 'top', 'width', 'height', 'naturalWidth', 'naturalHeight'], function (i, n) { - data[n] = canvas[n]; - }); - } - - return data; - }, - - - /** - * Set the canvas position and size with new data - * - * @param {Object} data - */ - setCanvasData: function setCanvasData(data) { - var self = this; - var canvas = self.canvas; - var aspectRatio = canvas.aspectRatio; - - if ($.isFunction(data)) { - data = data.call(self.$element); - } - - if (self.ready && !self.disabled && $.isPlainObject(data)) { - if (isNumber(data.left)) { - canvas.left = data.left; - } - - if (isNumber(data.top)) { - canvas.top = data.top; - } - - if (isNumber(data.width)) { - canvas.width = data.width; - canvas.height = data.width / aspectRatio; - } else if (isNumber(data.height)) { - canvas.height = data.height; - canvas.width = data.height * aspectRatio; - } - - self.renderCanvas(true); - } - }, - - - /** - * Get the crop box position and size data - * - * @return {Object} data - */ - getCropBoxData: function getCropBoxData() { - var self = this; - var cropBox = self.cropBox; - - return self.ready && self.cropped ? { - left: cropBox.left, - top: cropBox.top, - width: cropBox.width, - height: cropBox.height - } : {}; - }, - - - /** - * Set the crop box position and size with new data - * - * @param {Object} data - */ - setCropBoxData: function setCropBoxData(data) { - var self = this; - var cropBox = self.cropBox; - var aspectRatio = self.options.aspectRatio; - var widthChanged = void 0; - var heightChanged = void 0; - - if ($.isFunction(data)) { - data = data.call(self.$element); - } - - if (self.ready && self.cropped && !self.disabled && $.isPlainObject(data)) { - if (isNumber(data.left)) { - cropBox.left = data.left; - } - - if (isNumber(data.top)) { - cropBox.top = data.top; - } - - if (isNumber(data.width) && data.width !== cropBox.width) { - widthChanged = true; - cropBox.width = data.width; - } - - if (isNumber(data.height) && data.height !== cropBox.height) { - heightChanged = true; - cropBox.height = data.height; - } - - if (aspectRatio) { - if (widthChanged) { - cropBox.height = cropBox.width / aspectRatio; - } else if (heightChanged) { - cropBox.width = cropBox.height * aspectRatio; - } - } - - self.renderCropBox(); - } - }, - - - /** - * Get a canvas drawn the cropped image - * - * @param {Object} options (optional) - * @return {HTMLCanvasElement} canvas - */ - getCroppedCanvas: function getCroppedCanvas(options) { - var self = this; - - if (!self.ready || !window.HTMLCanvasElement) { - return null; - } - - if (!$.isPlainObject(options)) { - options = {}; - } - - if (!self.cropped) { - return getSourceCanvas(self.$clone[0], self.image, options); - } - - var data = self.getData(); - var originalWidth = data.width; - var originalHeight = data.height; - var aspectRatio = originalWidth / originalHeight; - var scaledWidth = void 0; - var scaledHeight = void 0; - var scaledRatio = void 0; - - if ($.isPlainObject(options)) { - scaledWidth = options.width; - scaledHeight = options.height; - - if (scaledWidth) { - scaledHeight = scaledWidth / aspectRatio; - scaledRatio = scaledWidth / originalWidth; - } else if (scaledHeight) { - scaledWidth = scaledHeight * aspectRatio; - scaledRatio = scaledHeight / originalHeight; - } - } - - // The canvas element will use `Math.Math.floor` on a float number, so Math.floor first - var canvasWidth = Math.floor(scaledWidth || originalWidth); - var canvasHeight = Math.floor(scaledHeight || originalHeight); - - var canvas = $('')[0]; - var context = canvas.getContext('2d'); - - canvas.width = canvasWidth; - canvas.height = canvasHeight; - - if (options.fillColor) { - context.fillStyle = options.fillColor; - context.fillRect(0, 0, canvasWidth, canvasHeight); - } - - // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.drawImage - var parameters = function () { - var source = getSourceCanvas(self.$clone[0], self.image, options); - var sourceWidth = source.width; - var sourceHeight = source.height; - var canvasData = self.canvas; - var params = [source]; - - // Source canvas - var srcX = data.x + canvasData.naturalWidth * (Math.abs(data.scaleX || 1) - 1) / 2; - var srcY = data.y + canvasData.naturalHeight * (Math.abs(data.scaleY || 1) - 1) / 2; - var srcWidth = void 0; - var srcHeight = void 0; - - // Destination canvas - var dstX = void 0; - var dstY = void 0; - var dstWidth = void 0; - var dstHeight = void 0; - - if (srcX <= -originalWidth || srcX > sourceWidth) { - srcX = 0; - srcWidth = 0; - dstX = 0; - dstWidth = 0; - } else if (srcX <= 0) { - dstX = -srcX; - srcX = 0; - dstWidth = Math.min(sourceWidth, originalWidth + srcX); - srcWidth = dstWidth; - } else if (srcX <= sourceWidth) { - dstX = 0; - dstWidth = Math.min(originalWidth, sourceWidth - srcX); - srcWidth = dstWidth; - } - - if (srcWidth <= 0 || srcY <= -originalHeight || srcY > sourceHeight) { - srcY = 0; - srcHeight = 0; - dstY = 0; - dstHeight = 0; - } else if (srcY <= 0) { - dstY = -srcY; - srcY = 0; - dstHeight = Math.min(sourceHeight, originalHeight + srcY); - srcHeight = dstHeight; - } else if (srcY <= sourceHeight) { - dstY = 0; - dstHeight = Math.min(originalHeight, sourceHeight - srcY); - srcHeight = dstHeight; - } - - // All the numerical parameters should be integer for `drawImage` (#476) - params.push(Math.floor(srcX), Math.floor(srcY), Math.floor(srcWidth), Math.floor(srcHeight)); - - // Scale destination sizes - if (scaledRatio) { - dstX *= scaledRatio; - dstY *= scaledRatio; - dstWidth *= scaledRatio; - dstHeight *= scaledRatio; - } - - // Avoid "IndexSizeError" in IE and Firefox - if (dstWidth > 0 && dstHeight > 0) { - params.push(Math.floor(dstX), Math.floor(dstY), Math.floor(dstWidth), Math.floor(dstHeight)); - } - - return params; - }(); - - context.imageSmoothingEnabled = !!options.imageSmoothingEnabled; - - if (options.imageSmoothingQuality) { - context.imageSmoothingQuality = options.imageSmoothingQuality; - } - - context.drawImage.apply(context, _toConsumableArray(parameters)); - - return canvas; - }, - - - /** - * Change the aspect ratio of the crop box - * - * @param {Number} aspectRatio - */ - setAspectRatio: function setAspectRatio(aspectRatio) { - var self = this; - var options = self.options; - - if (!self.disabled && !isUndefined(aspectRatio)) { - // 0 -> NaN - options.aspectRatio = Math.max(0, aspectRatio) || NaN; - - if (self.ready) { - self.initCropBox(); - - if (self.cropped) { - self.renderCropBox(); - } - } - } - }, - - - /** - * Change the drag mode - * - * @param {String} mode (optional) - */ - setDragMode: function setDragMode(mode) { - var self = this; - var options = self.options; - var croppable = void 0; - var movable = void 0; - - if (self.loaded && !self.disabled) { - croppable = mode === 'crop'; - movable = options.movable && mode === 'move'; - mode = croppable || movable ? mode : 'none'; - - self.$dragBox.data('action', mode).toggleClass('cropper-crop', croppable).toggleClass('cropper-move', movable); - - if (!options.cropBoxMovable) { - // Sync drag mode to crop box when it is not movable(#300) - self.$face.data('action', mode).toggleClass('cropper-crop', croppable).toggleClass('cropper-move', movable); - } - } - } - }; - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var CLASS_HIDDEN = 'cropper-hidden'; - var REGEXP_DATA_URL = /^data:/; - var REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/; - - var Cropper = function () { - function Cropper(element, options) { - _classCallCheck(this, Cropper); - - var self = this; - - self.$element = $(element); - self.options = $.extend({}, DEFAULTS, $.isPlainObject(options) && options); - self.loaded = false; - self.ready = false; - self.completed = false; - self.rotated = false; - self.cropped = false; - self.disabled = false; - self.replaced = false; - self.limited = false; - self.wheeling = false; - self.isImg = false; - self.originalUrl = ''; - self.canvas = null; - self.cropBox = null; - self.pointers = {}; - self.init(); - } - - _createClass(Cropper, [{ - key: 'init', - value: function init() { - var self = this; - var $this = self.$element; - var url = void 0; - - if ($this.is('img')) { - self.isImg = true; - - // Should use `$.fn.attr` here. e.g.: "img/picture.jpg" - url = $this.attr('src'); - self.originalUrl = url; - - // Stop when it's a blank image - if (!url) { - return; - } - - // Should use `$.fn.prop` here. e.g.: "http://example.com/img/picture.jpg" - url = $this.prop('src'); - } else if ($this.is('canvas') && window.HTMLCanvasElement) { - url = $this[0].toDataURL(); - } - - self.load(url); - } - - // A shortcut for triggering custom events - - }, { - key: 'trigger', - value: function trigger(type, data) { - var e = $.Event(type, data); - - this.$element.trigger(e); - - return e; - } - }, { - key: 'load', - value: function load(url) { - var self = this; - var options = self.options; - var $this = self.$element; - - if (!url) { - return; - } - - self.url = url; - self.image = {}; - - if (!options.checkOrientation || !window.ArrayBuffer) { - self.clone(); - return; - } - - // XMLHttpRequest disallows to open a Data URL in some browsers like IE11 and Safari - if (REGEXP_DATA_URL.test(url)) { - if (REGEXP_DATA_URL_JPEG.test(url)) { - self.read(dataURLToArrayBuffer(url)); - } else { - self.clone(); - } - return; - } - - var xhr = new XMLHttpRequest(); - - xhr.onerror = $.proxy(function () { - self.clone(); - }, this); - - xhr.onload = function load() { - self.read(this.response); - }; - - if (options.checkCrossOrigin && isCrossOriginURL(url) && $this.prop('crossOrigin')) { - url = addTimestamp(url); - } - - xhr.open('get', url); - xhr.responseType = 'arraybuffer'; - xhr.withCredentials = $this.prop('crossOrigin') === 'use-credentials'; - xhr.send(); - } - }, { - key: 'read', - value: function read(arrayBuffer) { - var self = this; - var options = self.options; - var orientation = getOrientation(arrayBuffer); - var image = self.image; - var rotate = 0; - var scaleX = 1; - var scaleY = 1; - - if (orientation > 1) { - self.url = arrayBufferToDataURL(arrayBuffer); - - switch (orientation) { - // flip horizontal - case 2: - scaleX = -1; - break; - - // rotate left 180° - case 3: - rotate = -180; - break; - - // flip vertical - case 4: - scaleY = -1; - break; - - // flip vertical + rotate right 90° - case 5: - rotate = 90; - scaleY = -1; - break; - - // rotate right 90° - case 6: - rotate = 90; - break; - - // flip horizontal + rotate right 90° - case 7: - rotate = 90; - scaleX = -1; - break; - - // rotate left 90° - case 8: - rotate = -90; - break; - - default: - } - } - - if (options.rotatable) { - image.rotate = rotate; - } - - if (options.scalable) { - image.scaleX = scaleX; - image.scaleY = scaleY; - } - - self.clone(); - } - }, { - key: 'clone', - value: function clone() { - var self = this; - var options = self.options; - var $this = self.$element; - var url = self.url; - var crossOrigin = ''; - var crossOriginUrl = void 0; - - if (options.checkCrossOrigin && isCrossOriginURL(url)) { - crossOrigin = $this.prop('crossOrigin'); - - if (crossOrigin) { - crossOriginUrl = url; - } else { - crossOrigin = 'anonymous'; - - // Bust cache (#148) when there is not a "crossOrigin" property - crossOriginUrl = addTimestamp(url); - } - } - - self.crossOrigin = crossOrigin; - self.crossOriginUrl = crossOriginUrl; - - var image = document.createElement('img'); - - if (crossOrigin) { - image.crossOrigin = crossOrigin; - } - - image.src = crossOriginUrl || url; - - var $clone = $(image); - - self.$clone = $clone; - - if (self.isImg) { - if ($this[0].complete) { - self.start(); - } else { - $this.one('load', $.proxy(self.start, this)); - } - } else { - $clone.one('load', $.proxy(self.start, this)).one('error', $.proxy(self.stop, this)).addClass('cropper-hide').insertAfter($this); - } - } - }, { - key: 'start', - value: function start() { - var self = this; - var $clone = self.$clone; - var $image = self.$element; - - if (!self.isImg) { - $clone.off('error', self.stop); - $image = $clone; - } - - getImageSize($image[0], function (naturalWidth, naturalHeight) { - $.extend(self.image, { - naturalWidth: naturalWidth, - naturalHeight: naturalHeight, - aspectRatio: naturalWidth / naturalHeight - }); - - self.loaded = true; - self.build(); - }); - } - }, { - key: 'stop', - value: function stop() { - var self = this; - - self.$clone.remove(); - self.$clone = null; - } - }, { - key: 'build', - value: function build() { - var self = this; - var options = self.options; - var $this = self.$element; - var $clone = self.$clone; - - if (!self.loaded) { - return; - } - - // Unbuild first when replace - if (self.ready) { - self.unbuild(); - } - - var $cropper = $(TEMPLATE); - var $cropBox = $cropper.find('.cropper-crop-box'); - var $face = $cropBox.find('.cropper-face'); - - // Create cropper elements - self.$container = $this.parent(); - self.$cropper = $cropper; - self.$canvas = $cropper.find('.cropper-canvas').append($clone); - self.$dragBox = $cropper.find('.cropper-drag-box'); - self.$cropBox = $cropBox; - self.$viewBox = $cropper.find('.cropper-view-box'); - self.$face = $face; - - // Hide the original image - $this.addClass(CLASS_HIDDEN).after($cropper); - - // Show the clone image if is hidden - if (!self.isImg) { - $clone.removeClass('cropper-hide'); - } - - self.initPreview(); - self.bind(); - - options.aspectRatio = Math.max(0, options.aspectRatio) || NaN; - options.viewMode = Math.max(0, Math.min(3, Math.round(options.viewMode))) || 0; - - self.cropped = options.autoCrop; - - if (options.autoCrop) { - if (options.modal) { - self.$dragBox.addClass('cropper-modal'); - } - } else { - $cropBox.addClass(CLASS_HIDDEN); - } - - if (!options.guides) { - $cropBox.find('.cropper-dashed').addClass(CLASS_HIDDEN); - } - - if (!options.center) { - $cropBox.find('.cropper-center').addClass(CLASS_HIDDEN); - } - - if (options.cropBoxMovable) { - $face.addClass('cropper-move').data('action', 'all'); - } - - if (!options.highlight) { - $face.addClass('cropper-invisible'); - } - - if (options.background) { - $cropper.addClass('cropper-bg'); - } - - if (!options.cropBoxResizable) { - $cropBox.find('.cropper-line, .cropper-point').addClass(CLASS_HIDDEN); - } - - self.setDragMode(options.dragMode); - self.render(); - self.ready = true; - self.setData(options.data); - - // Trigger the ready event asynchronously to keep `data('cropper')` is defined - self.completing = setTimeout(function () { - if ($.isFunction(options.ready)) { - $this.one('ready', options.ready); - } - - self.trigger('ready'); - self.trigger('crop', self.getData()); - self.completed = true; - }, 0); - } - }, { - key: 'unbuild', - value: function unbuild() { - var self = this; - - if (!self.ready) { - return; - } - - if (!self.completed) { - clearTimeout(self.completing); - } - - self.ready = false; - self.completed = false; - self.initialImage = null; - - // Clear `initialCanvas` is necessary when replace - self.initialCanvas = null; - self.initialCropBox = null; - self.container = null; - self.canvas = null; - - // Clear `cropBox` is necessary when replace - self.cropBox = null; - self.unbind(); - - self.resetPreview(); - self.$preview = null; - - self.$viewBox = null; - self.$cropBox = null; - self.$dragBox = null; - self.$canvas = null; - self.$container = null; - - self.$cropper.remove(); - self.$cropper = null; - } - }], [{ - key: 'setDefaults', - value: function setDefaults(options) { - $.extend(DEFAULTS, $.isPlainObject(options) && options); - } - }]); - - return Cropper; - }(); - - $.extend(Cropper.prototype, render); - $.extend(Cropper.prototype, preview); - $.extend(Cropper.prototype, events); - $.extend(Cropper.prototype, handlers); - $.extend(Cropper.prototype, change); - $.extend(Cropper.prototype, methods); - - var NAMESPACE = 'cropper'; - var OtherCropper = $.fn.cropper; - - $.fn.cropper = function jQueryCropper(option) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - var result = void 0; - - this.each(function (i, element) { - var $this = $(element); - var data = $this.data(NAMESPACE); - - if (!data) { - if (/destroy/.test(option)) { - return; - } - - var options = $.extend({}, $this.data(), $.isPlainObject(option) && option); - $this.data(NAMESPACE, data = new Cropper(element, options)); - } - - if (typeof option === 'string') { - var fn = data[option]; - - if ($.isFunction(fn)) { - result = fn.apply(data, args); - } - } - }); - - return typeof result !== 'undefined' ? result : this; - }; - - $.fn.cropper.Constructor = Cropper; - $.fn.cropper.setDefaults = Cropper.setDefaults; - - // No conflict - $.fn.cropper.noConflict = function noConflict() { - $.fn.cropper = OtherCropper; - return this; - }; - - exports('cropper', $.fn.cropper); -}); \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/module/design.js b/src/plugin/admin/public/component/pear/module/design.js index 5029d997..31b3f356 100644 --- a/src/plugin/admin/public/component/pear/module/design.js +++ b/src/plugin/admin/public/component/pear/module/design.js @@ -329,10 +329,10 @@ layui.define(['layer', 'form'], function(exports) { '
                          \n' + ' \n' + ' \n' + - ' \n' + - ' \n' + '
                          \n' + @@ -348,10 +348,10 @@ layui.define(['layer', 'form'], function(exports) { '
                          \n' + ' \n' + ' \n' + - ' \n' + - ' \n' + '
                          \n' + @@ -434,8 +434,8 @@ layui.define(['layer', 'form'], function(exports) { function submits(size) { var html = '
                          \n' + '
                          \n' + - ' \n' + //变更 - ' \n' + //变更 + ' \n' + //变更 + ' \n' + //变更 '
                          \n' + '
                          \n'; return html; diff --git a/src/plugin/admin/public/component/pear/module/drawer.js b/src/plugin/admin/public/component/pear/module/drawer.js deleted file mode 100644 index a95e41ac..00000000 --- a/src/plugin/admin/public/component/pear/module/drawer.js +++ /dev/null @@ -1,420 +0,0 @@ -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 = "pear-drawer pear-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 - }, 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; - d.opts.callback && d.opts.callback() - }, 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); diff --git a/src/plugin/admin/public/component/pear/module/dtree.js b/src/plugin/admin/public/component/pear/module/dtree.js deleted file mode 100644 index 21fcbabe..00000000 --- a/src/plugin/admin/public/component/pear/module/dtree.js +++ /dev/null @@ -1,5530 +0,0 @@ -layui.define(['jquery','layer','form'], function(exports) { - var $ = layui.$, - layer = layui.layer, - form = layui.form; - - // 树的公共定义样式汇总 - var LI_NAV_CHILD = "dtree-nav-ul-sid", LI_NAV_ITEM = "dtree-nav-item", - LI_DIV_ITEM = "dtree-nav-div", DTREEFONTSPECIAL="dtreefont-special", NONETITLE="dtree-none-text", - LI_DIV_MENUBAR = "dtree-menubar", - LI_DIV_TOOLBAR = "dtree-toolbar", TOOLBAR_TOOL = "dtree-toolbar-tool", TOOLBAR_TOOL_EM = "dtree-toolbar-fixed", - LI_DIV_CHECKBAR = "dtree-nav-checkbox-div", - LI_CLICK_CHECKBAR = "d-click-checkbar", //绑定点击复选框时需要用到 - LI_DIV_TEXT_CLASS = "t-click", UL_ROOT="dtree", - LI_NAV_FIRST_LINE = "dtree-nav-first-line", LI_NAV_LINE = "dtree-nav-line", LI_NAV_LAST_LINE = "dtree-nav-last-line"; - - - // 树的公共指定 - var NAV_THIS = "dtree-nav-this", //当前节点 - NAV_SHOW = "dtree-nav-show", //显示子节点 - NAV_HIDE = "dtree-nav-hide", //隐藏节点 - NAV_DIS = "dtree-disabled", //禁用节点 - ICON_HIDE = "dtree-icon-hide", //隐藏图标 - $BODY = $("body"), //body选择器 - $WIN = $(window), //window窗口 - $DOC = $(document), //当前文档 - MOD_NAME = "dtree", //模块名称 - VERSION = "v2.5.8", //版本 - OPTIONS = {}, //全局属性配置 - DTrees = {}; //当前被实例化的树的集合 - - // 树的自定义图标 - var DTREEFONT = "dtreefont", //默认使用图标字体 - LI_DIV_CHECKBAR_ON = "dtree-icon-fuxuankuangxuanzhong", //复选框选中图标 - LI_DIV_CHECKBAR_OUT = "dtree-icon-fuxuankuang", //复选框未选中图标 - LI_DIV_CHECKBAR_NOALL = "dtree-icon-fuxuankuang-banxuan", //复选框半选图标 - LI_DIV_MENUBAR_DOWN = "dtree-icon-move-down", //menubar的展开全部的图标 - LI_DIV_MENUBAR_UP = "dtree-icon-move-up", //menubar的收缩全部的图标 - LI_DIV_MENUBAR_REFRESH = "dtree-icon-refresh", //menubar的刷新图标 - LI_DIV_MENUBAR_CHECKALL = "dtree-icon-roundcheckfill", //menubar的全选图标 - LI_DIV_MENUBAR_UNCHECKALL = "dtree-icon-roundclosefill", //menubar的全不选图标 - LI_DIV_MENUBAR_INVERTALL = "dtree-icon-roundcheck", //menubar的反选图标 - LI_DIV_MENUBAR_DELETE = "dtree-icon-delete1", //menubar的删除图标 - LI_DIV_MENUBAR_SEARCH = "dtree-icon-search_list_light", //menubar的搜索图标 - LI_DIV_TOOLBAR_PULLDOWN = "dtree-icon-pulldown", //toolbar的展开图标 - LI_DIV_TOOLBAR_PULLUP = "dtree-icon-pullup", //toolbar的收缩图标 - LI_DIV_TOOLBAR_ADD = "dtree-icon-roundadd", //toolbar的新增图标 - LI_DIV_TOOLBAR_EDIT = "dtree-icon-bianji", //toolbar的编辑图标 - LI_DIV_TOOLBAR_DEL = "dtree-icon-roundclose"; //toolbar的删除图标 - - // 树的非叶子节点图标集合 - var nodeIconArray = { - "-1": {"open": "dtree-icon-null-open", "close": "dtree-icon-null-close"}, //未指定 - "0" : {"open": "dtree-icon-wenjianjiazhankai", "close": "dtree-icon-weibiaoti5"}, //文件夹(二级图标默认样式) - "1" : {"open": "dtree-icon-jian", "close": "dtree-icon-jia"}, //+-图标(一级图标默认样式) - "2" : {"open": "dtree-icon-xiangxia1", "close": "dtree-icon-xiangyou"} //箭头图标 - }; - - // 树的叶子节点图标集合 - var leafIconArray = { - "-1": "dtree-icon-null", //未指定 - "0" : "dtree-icon-weibiaoti5", //文件夹 - "1" : "dtree-icon-yonghu", //人员 - "2" : "dtree-icon-fenzhijigou", //机构 - "3" : "dtree-icon-fenguangbaobiao", //报表 - "4" : "dtree-icon-xinxipilu", //信息 - "5" : "dtree-icon-shuye1", //叶子(二级图标默认样式) - "6" : "dtree-icon-caidan_xunzhang", //勋章 - "7" : "dtree-icon-normal-file", //文件 - "8" : "dtree-icon-dian", //小圆点(一级图标默认样式) - "9" : "dtree-icon-set-sm", //齿轮 - "10" : "dtree-icon-rate" //星星 - }; - - // 树的自定义样式 - var DTREE = "dtree-", //自定义样式前缀 - ITEMTHIS = "-item-this", //自定义样式当前行选中后缀 - ITEM = "-item", //自定义样式当前行后缀 - DFONT = "-dtreefont", //自定义样式图标样式后缀 - FICON = "-ficon", //自定义样式一级图标样式后缀 - ICON = "-icon", //自定义样式二级图标样式后缀 - CBOX = "-checkbox", //自定义样式复选框样式后缀 - CHS = "-choose"; //自定义样式复选框选中样式后缀 - - // 树自定义操作事件名称集合 绑定dtree-click的事件 - var eventName = { - checkNodeClick: "checkNodeClick", //点击复选框 - itemNodeClick: "itemNodeClick" //点击子节点div - }; - - // 树默认toolbar提供的功能集合 绑定dtree-tool的事件 - var defaultTool = { - pulldown: "pulldown", //点击展开当前节点下的全部节点 - pullup: "pullup", //点击收缩当前节点下的全部节点 - addTool: "addToolbar", //点击toolbar新增 - editTool: "editToolbar", //点击toolbar编辑 - delTool: "delToolbar" //点击toolbar删除 - }; - - // 树默认menubar提供的功能集合 绑定dtree-menu的事件 - var defaultMenu = { - moveDown: "moveDown", //menubar展开全部节点 - moveUp: "moveUp", //menubar收缩全部节点 - refresh: "refresh", //menubar刷新树 - checkAll: "checkAll", //menubar全选 - unCheckAll: "unCheckAll", //menubar全不选 - invertAll: "invertAll", //menubar反选 - remove: "remove", //menubar删除选中节点 - searchNode: "searchNode" //menubar查询节点 - }; - - // 树的公共事件 - var event = { - getElemId: function(options){ // 根据传入的参数获取ID - var elem = options.elem || ""; - var obj = options.obj || $(elem); - - if (obj.length == 0) { //页面中未找到绑定id - return ""; - } else { - return $(obj)[0].id; - } - }, - escape: function(html){ // 编码 - if(typeof html !== 'string') return ''; - return html.replace(entityReg.escape, function(match){return entityMap.escape[match];}); - }, - unescape: function(str){ // 解码 - if(typeof str !== 'string') return ''; - return str.replace(entityReg.unescape, function(match){return entityMap.unescape[match];}); - }, - cloneObj: function (obj, filter) { //深复制对象方法 - var newObj = {}; - if (obj instanceof Array) { - newObj = []; - } - var str = ""; - if(typeof filter !== 'undefined') {str = filter.join(",");} - for (var key in obj) { - if(str.indexOf(key) == -1){ - var val = obj[key]; - newObj[key] = typeof val === 'object' ? event.cloneObj(val, typeof filter !== undefined ? filter : []): val; - } - - } - return newObj; - }, - trimToDot: function(str){ - return str.replace(/ /g, "."); - } - }; - - // 特殊符号转义 - var keys = Object.keys || function(obj) { - obj = Object(obj); - var arr = []; - for(var a in obj) arr.push(a); - return arr; - }; - var invert = function(obj){ - obj = Object(obj); - var result = {}; - for(var a in obj) result[obj[a]] = a; - return result; - }; - var entityMap = { - escape: { - "&" : "&", - "<" : "<", - ">" : ">", - "'" : "&quo;" - } - }; - entityMap.unescape = invert(entityMap.escape); - var entityReg = { - escape: RegExp('[' + keys(entityMap.escape).join('') + ']', 'g'), - unescape: RegExp('(' + keys(entityMap.unescape).join('|') + ')', 'g') - }; - - //异步加载接口 - var AjaxHelper = { - request : function(config) { - var data = config.data ? config.data : {}; - var async = (typeof (config.async) === "boolean") ? config.async : true; - $.ajax({ - type : config.type ? config.type : "POST", - headers : config.headers, - url : config.url, - dataType : config.dataType ? config.dataType : "json", - data : data, - async : async, - contentType : config.contentType, - xhrFields: {withCredentials: config.withCredentials}, - beforeSend: function (XMLHttpRequest, self) { - if (typeof (config.beforeSend) === "function") { - return config.beforeSend(XMLHttpRequest, self); - } - return true; - }, - success : config.success, - error : function(XMLHttpRequest, textStatus, errorThrown) { - if (typeof (config.error) === "function") { - config.error(XMLHttpRequest, textStatus, errorThrown); - } else { - layer.msg("异步加载失败: " + textStatus,{icon:5, shift:6}); - } - }, - statusCode : { - 404 : function() { - layer.msg('未找到指定请求,请检查访问路径!',{icon:5, shift:6}); - }, - 500 : function() { - layer.msg('系统错误!',{icon:5, shift:6}); - } - }, - complete : function(XMLHttpRequest, textStatus) { - if (typeof (config.complete) === "function") { - config.complete(XMLHttpRequest, textStatus); - } - } - }); - }, - serialize: function(first, param){ //json序列化 key=value&key1=value1 - var p = first; - for (var key in param) { - p += key + "=" + param[key] + "&"; - } - p = p.substring(0, p.length-1); - return p; - } - }; - - /** 树类 Class定义 */ - var DTree = function(options){ - var _this = this; - /** 默认赋值**/ - this.formatter = { // 数据过滤 - title: false // 文字,默认不开启 - }; - this.response = { // 树返回的json格式 - statusName: "code", //返回标识 - statusCode: 200, //返回码 - message: "message", //返回信息 - rootName: "data", //根节点名称 - treeId: "id", //节点ID - parentId: "parentId", //父节点ID - title: "title", //节点名称 - ficonClass: "ficonClass", //自定义一级图标 - iconClass: "iconClass", //自定义二级图标 - childName: "children", //子节点名称 - last: "last", //是否最后一级节点 -// level: "level", //层级 - spread: "spread", //展开 - disabled: "disabled", //禁用 - hide: "hide", //隐藏 - checkArr: "checkArr", //复选框列表 - checked: "checked", //是否选中 - type: "type", //复选框标记 - basicData: "basicData" //表示用户自定义需要存储在树节点中的数据 - }; - this.defaultRequest = { // 树的默认发起请求参数格式,最后会将value作为参数名称传递 - nodeId: "nodeId", //节点ID - parentId: "parentId", //父节点ID - context: "context", //节点内容 - leaf: "leaf", //是否叶子节点 - level: "level", //层级 - spread: "spread", //节点展开状态 - dataType: "dataType", //节点标记 - checked: "checked", //节点复选框选中状态 - initchecked: "initchecked", //节点复选框初始状态 - basicData: "basicData", //用户自定义的记录节点数据 - recordData: "recordData", //当前data数据(排除basicData和children字段) - }; - this.toolbarFun = { - addTreeNode: function(param, $div) { //添加树节点后调用的函数,用于用户自定义,如未指定则树不会发生变化 - return ; - }, - editTreeNode: function(param, $div) { //编辑树节点后调用的函数,用于用户自定义,如未指定则树不会发生变化 - return ; - }, - editTreeLoad: function(param){ // 编辑树的数据回显,用于打开编辑时,回填数据 - return ; - }, - delTreeNode: function(param, $div){ //删除树后调用的函数,用于用户自定义,如未指定则树不会发生变化 - return ; - }, - loadToolbarBefore: function(buttons, param, $div){ // 右键菜单加载前的函数 - return buttons; - } - }; - this.toolbarStyle = { // 工具栏弹出层的自定义样式 - title: "节点", - area: ["60%","80%"] - }; - this.menubarFun = { - remove: function(checkbarNodes){ //删除复选框选中节点,需要用户自定义,如未指定则树只是页面上做了修改 - return true; - } - }; - this.menubarTips = { // 菜单栏的默认显示 - toolbar: [], - group: [defaultMenu.moveDown, defaultMenu.moveUp, defaultMenu.refresh, defaultMenu.checkAll, defaultMenu.unCheckAll, defaultMenu.invertAll, defaultMenu.remove, defaultMenu.searchNode], - freedom: [] - }; - this.checkbarFun = { - chooseBefore: function($i, node){ // 复选框点击前回调 - return true; - }, - chooseDone: function(checkbarNodesParam) { //复选框点击事件完毕后,返回该树关于复选框操作的全部信息,用于用户自定义,如未指定则树只是页面上做了修改 - return ; - } - }; - this.iframeDefaultRequest = { //iframe的默认参数,目的是与加载树的参数不一样 - nodeId: "nodeId", //节点ID - parentId: "parentId", //父节点ID - context: "context", //节点内容 - leaf: "leaf", //是否叶子节点 - level: "level", //层级 - spread: "spread", //节点展开状态 - dataType: "dataType", //节点标记 - checked: "checked", //节点复选框选中状态 - initchecked: "initchecked", //节点复选框初始状态 - basicData: "basicData", //用户自定义的记录节点数据 - recordData: "recordData", //当前data数据(排除basicData和children字段) - }; - - this.iframeFun = { - iframeDone: function(iframeParam){ //iframe加载完毕后,用于用户自定义事件 - return ; - } - }; - this.style = { //树最终使用的样式集合 - item: "", //每一项div的样式 - itemThis: "", //选中div的样式 - dfont: "", //一级图标的样式 - icon: "", //二级图标的样式 - cbox: "", //复选框的样式 - chs: "" //复选框选中的样式 - }; - this.usefontStyle = { //树最终使用的图标集合 - fnode:{ //一级节点 - node:{ //非叶子节点 - open:"", //节点展开 - close:"" //节点关闭 - }, - leaf:"" //叶子节点 - }, - snode:{ //二级节点 - node:{ //非叶子节点 - open:"", //节点展开 - close:"" //节点关闭 - }, - leaf:"" //叶子节点 - }, - checkbox:{ //复选框 - on:"", //复选框选中 - out:"", //未选中 - noall:"" //半选 - }, - menubar:{ //菜单栏 - movedown:"", //全部展开 - moveup:"", //全部收缩 - refresh:"", //刷新 - checkAll:"", //全选 - unCheckAll:"", //全不选 - invertAll:"", //反选 - remove:"", //删除 - search:"" //搜索 - }, - menubarExt:"", //扩展菜单栏 - toolbar:{ //工具栏 - menubar:{ //依附在菜单栏的工具栏 - movedown:"", //全部展开 - moveup:"", //全部收缩 - refresh:"", //刷新 - checkAll:"", //全选 - unCheckAll:"", //全不选 - invertAll:"", //反选 - remove:"", //删除 - search:"" //搜索 - }, - menubarExt:"", //依附在菜单栏的扩展菜单栏 - pulldown:"", //展开 - pullup:"", //收缩 - add:"", //添加 - edit:"", //编辑 - del:"" //删除 - }, - toolbarExt:"" //扩展工具栏 - } - - /** 数据绑定**/ - this.node = { // 树节点选中时,包含当前节点的全部信息 - nodeId: "", //节点ID - parentId: "", //父节点ID - context: "", //节点内容 - leaf: "", //是否叶子节点 - level: "", //层级 - spread: "", //节点展开状态 - dataType: "", //节点标记 - checked: "", //节点复选框选中状态 - initchecked: "", //节点复选框初始状态 - basicData: "", //用户自定义的记录节点数据 - recordData: "", //当前data数据(排除basicData和children字段) - }; - - this.toolbarMenu = {}; // 工具栏右键菜单绑定的所有元素 - this.checkbarNode = []; // 复选框标记的全部节点数据 - this.errData = []; // 记录在渲染节点时有问题的数据 - this.checkArrLen = 0; // 添加节点的时判断复选框个数 - this.temp = []; // 临时变量 - this.bak = ""; // 临时变量 - this.setting(options); - }; - - /******************** 初始参数加载 ********************/ - /** - * @Desc: 设置基本属性值 - * @Param: options:JSON对象,初始设置dtree所需的全部属性 - */ - DTree.prototype.setting = function(options) { - this.options = options || {}; - - /** 绑定元素参数(必填,2个参数项必填一个)**/ - this.elem = this.options.elem || OPTIONS.elem || ""; //树绑定的元素ID:#elem - if(typeof this.options.obj === 'undefined'){ - if(this.elem) { - if($(this.elem).length > 0) { - this.obj = $(this.elem); - } - } - } else { - this.obj = this.options.obj || OPTIONS.obj || this.obj; //树绑定的jquery元素,用于当元素是延迟加载出来的话,可以用这个找到 - this.elem = "#" + this.obj[0].id; - } - - /** 基本参数**/ - this.scroll = this.options.scroll || OPTIONS.scroll || this.elem; //树的上级div容器,让树可以显示滚动条的div容器的ID - this.accordion = (typeof (this.options.accordion) === "boolean") ? this.options.accordion : (typeof (OPTIONS.accordion) === "boolean") ? OPTIONS.accordion : false; //手风琴加载, 默认false - if(this.accordion) { - this.initLevel = 1; //默认展开节点 1节 - } else { - this.initLevel = this.options.initLevel || OPTIONS.initLevel || 2; //默认展开节点 2节 - } - this.type = this.options.type || OPTIONS.type || "load"; //树的加载方式 all,全量树, load,增量树,默认load - this.cache = (typeof (this.options.cache) === "boolean") ? this.options.cache : (typeof (OPTIONS.cache) === "boolean") ? OPTIONS.cache : true; //数据缓存,默认true - this.record = this.options.record || OPTIONS.record || false; //开启数据记录模式,默认false - this.load = (typeof (this.options.load) === "boolean") ? this.options.load : (typeof (OPTIONS.load) === "boolean") ? OPTIONS.load : true; //开启加载动画,默认true - this.none = this.options.none || OPTIONS.nont || "无数据"; //初始加载无记录时显示文字 - this.tempHeight = this.options.height || OPTIONS.height; //临时转换高度变量 - if(this.tempHeight) { // 设置高度 - if(/^full-\d+$/.test(this.tempHeight)) { - this.fullHeightGap = this.tempHeight.split('-')[1]; - this.height = $WIN.height() - this.fullHeightGap; //设置高度 - } else { - this.fullHeightGap = this.tempHeight; - this.height = this.tempHeight; - } - } else { - this.fullHeightGap = ""; - this.height = ""; - } - this.width = this.options.width || OPTIONS.width || "260"; //宽度 - this.obj.css("width", this.width); - - /** 样式相关参数**/ - this.iconfont = this.options.iconfont || OPTIONS.iconfont || DTREEFONT; //默认图标字体 dtreefont - this.iconfontStyle = this.options.iconfontStyle || OPTIONS.iconfontStyle || {}; //用于自定义树的每个关键部位使用的图标 - this.nodeIconArray = $.extend(nodeIconArray, this.options.nodeIconArray || OPTIONS.nodeIconArray) || nodeIconArray; //用户自定义非叶子节点图标集合,node - this.leafIconArray = $.extend(leafIconArray, this.options.leafIconArray || OPTIONS.leafIconArray) || leafIconArray; //用户自定义叶子节点图标集合,leaf - this.skin = this.options.skin || OPTIONS.skin || "theme"; // 自定义样式 - if(this.skin == "layui"){ // layui主题 - this.line = (typeof (this.options.line) === "boolean") ? this.options.line : (typeof (OPTIONS.line) === "boolean") ? OPTIONS.line : true; //开启树线,默认开启 - this.ficon = this.options.ficon || OPTIONS.ficon || "7"; //一级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示一级图标。默认'7' - this.fnodeIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? (this.ficon == "-1" ? "-1" : "1") : this.ficon[0]; //一级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示一级图标,默认'1' - this.fleafIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? this.ficon : this.ficon[1]; //一级图标中的leaf节点图标 - this.icon = this.options.icon || OPTIONS.icon || "-1"; //二级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示二级图标。默认'-1' - this.nodeIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? (this.icon == "-1" ? "-1" : "-1") : this.icon[0]; //二级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示二级图标,默认'-1' - this.leafIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? this.icon : this.icon[1]; //二级图标中的leaf节点图标 - } else if(this.skin == "laySimple"){ // laySimple主题 - this.line = this.options.line || OPTIONS.line || false; //开启树线,默认不开启 - this.ficon = this.options.ficon || OPTIONS.ficon || ["2","-1"]; //一级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示一级图标。默认'-1' - this.fnodeIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? (this.ficon == "-1" ? "-1" : "2") : this.ficon[0]; //一级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示一级图标,默认'2' - this.fleafIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? this.ficon : this.ficon[1]; // 一级图标中的leaf节点图标 - this.icon = this.options.icon || OPTIONS.icon || "-1"; //二级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示二级图标。默认'-1' - this.nodeIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? (this.icon == "-1" ? "-1" : "-1") : this.icon[0]; //二级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示二级图标,默认'-1' - this.leafIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? this.icon : this.icon[1]; //二级图标中的leaf节点图标 - } else { // 默认主题 或者自定义主题 - this.line = this.options.line || OPTIONS.line || false; //开启树线,默认不开启 - this.ficon = this.options.ficon || OPTIONS.ficon || "8"; //一级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示一级图标。默认'8' - this.fnodeIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? (this.ficon == "-1" ? "-1" : "1") : this.ficon[0]; //一级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示一级图标,默认'1' - this.fleafIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? this.ficon : this.ficon[1]; // 一级图标中的leaf节点图标 - this.icon = this.options.icon || OPTIONS.icon || "5"; //二级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示二级图标。默认'5' - this.nodeIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? (this.icon == "-1" ? "-1" : "0") : this.icon[0]; //二级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示二级图标,默认'0' - this.leafIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? this.icon : this.icon[1]; //二级图标中的leaf节点图标 - } - - /** 数据加载参数**/ - this.url = this.options.url || OPTIONS.url || ""; //请求地址 - this.async = (typeof (this.options.async) === "boolean") ? this.options.async : (typeof (OPTIONS.async) === "boolean") ? OPTIONS.async : true; //异步同步加载,默认异步加载 - this.asyncLoad = this.options.asyncLoad || OPTIONS.asyncLoad || []; //初始异步加载层级数据 - this.headers = this.options.headers || OPTIONS.headers || {}; //ajax header属性 - this.method = this.options.method || OPTIONS.method || "post"; //请求类型 - this.dataType = this.options.dataType || OPTIONS.dataType || "json"; //参数类型 - this.contentType = this.options.contentType || OPTIONS.contentType || "application/x-www-form-urlencoded"; //发送信息至服务器时内容编码类型 - this.defaultRequest = $.extend(this.defaultRequest, this.options.defaultRequest || OPTIONS.defaultRequest) || this.defaultRequest; //默认请求参数 - this.filterRequest = this.options.filterRequest || OPTIONS.filterRequest || []; //过滤请求参数 - this.request = this.options.request || OPTIONS.request || {}; //用户自定义请求参数 - this.response = $.extend(this.response, this.options.response || OPTIONS.response) || this.response; //返回json格式 - this.data = this.options.data || OPTIONS.data || null; //初始化指定该参数,则不会访问异步接口 - this.dataFormat = this.options.dataFormat || OPTIONS.dataFormat || "levelRelationship"; //用于用户配置的data数据格式,list:列表, levelRelationship:层级关系,默认 - this.dataStyle = this.options.dataStyle || OPTIONS.dataStyle || "defaultStyle"; //用于用户配置layui通用的json数据风格,layuiStyle:layui风格,defaultStyle:默认风格 - this.errDataShow = this.options.errDataShow || OPTIONS.errDataShow || false; //是否在递归数据出现错误后,显示错误信息,默认false - this.withCredentials = this.options.withCredentials || OPTIONS.withCredentials || false; //是否允许跨域请求,默认false - this.beforeSend = this.options.beforeSend || OPTIONS.beforeSend || function(ajax, XMLHttpRequest, self){return true}; //异步加载之前的回调 - this.success = this.options.success || OPTIONS.success || function(data, obj, first){}; //树加载完毕后执行解析树之前的回调 - this.done = this.options.done || OPTIONS.done || function(data, obj, first){}; //树加载完毕后的回调 - this.formatter = $.extend(this.formatter, this.options.formatter || OPTIONS.formatter) || this.formatter; //数据过滤 - this.error = this.options.error || OPTIONS.error || function(XMLHttpRequest, textStatus, errorThrown){}; // 异步加载异常回调 - this.complete = this.options.complete || OPTIONS.complete || function(XMLHttpRequest, textStatus){}; // 异步加载完成回调 - - /** 复选框参数**/ - this.checkbar = this.options.checkbar || OPTIONS.checkbar || false; //是否开启复选框模式 - this.checkbarLoad = this.options.checkbarLoad || OPTIONS.checkbarLoad || "node"; //复选框作用范围,node:所有节点, leaf:最后一级;默认所有节点 - this.checkbarType = this.options.checkbarType || OPTIONS.checkbarType || "all"; //复选框选中形式 all:子集选中父级也选中, no-all:子集选中父级半选中,子集全选父级选中,p-casc:父级选中子集全选,子集无法改变父级选中状态, self:没有任何级联关系,only:只能选中一个复选框。 默认all - this.checkbarData = this.options.checkbarData || OPTIONS.checkbarData || "choose"; //复选框记录数据类型形式, change表示记录变更数据,choose表示记录选中数据,all记录全部数据,halfChoose记录选中和半选中的数据,默认choose - this.checkbarFun = $.extend(this.checkbarFun, this.options.checkbarFun || OPTIONS.checkbarFun) || this.checkbarFun; //checkbar事件加载 - - /** 菜单栏参数**/ - this.menubar = this.options.menubar || OPTIONS.menubar || false; //是否打开菜单栏 - this.menubarTips = $.extend(this.menubarTips, this.options.menubarTips || OPTIONS.menubarTips) || this.menubarTips; //菜单栏吸附, toolbar:依附在工具栏,group:依附在按钮组,freedom,自由 - this.menubarFun = $.extend(this.menubarFun, this.options.menubarFun || OPTIONS.menubarFun) || this.menubarFun; //menubar事件加载 - - /** 工具栏参数**/ - this.toolbar = this.options.toolbar || OPTIONS.toolbar || false; //是否开启可编辑模式 - this.toolbarWay = this.options.toolbarWay || OPTIONS.toolbarWay || "contextmenu"; //工具栏显示方式,contextmenu:右键,follow:跟随节点,fixed:固定在节点右侧 - this.toolbarStyle = $.extend(this.toolbarStyle, this.options.toolbarStyle || OPTIONS.toolbarStyle) || this.toolbarStyle; //toolbar的自定义风格,标题,弹框大小 - this.toolbarLoad = this.options.toolbarLoad || OPTIONS.toolbarLoad || "node"; //toolbar作用范围:node:所有节点,noleaf:非最后一级节点,leaf:最后一级 - this.toolbarShow = this.options.toolbarShow || OPTIONS.toolbarShow || ["add","edit","delete"]; //toolbar三个按钮自定义加载 - this.toolbarBtn = this.options.toolbarBtn || OPTIONS.toolbarBtn || null; //toolbar增删改中内容的自定义加载 - this.toolbarExt = this.options.toolbarExt || OPTIONS.toolbarExt || []; //toolbar按钮扩展 - this.toolbarFun = $.extend(this.toolbarFun, this.options.toolbarFun || OPTIONS.toolbarFun) || this.toolbarFun; //toolbar事件加载 - - /** iframe模式参数**/ - this.useIframe = this.options.useIframe || OPTIONS.useIframe || false; //是否加载iframe 默认false, - this.iframeElem = this.options.iframeElem || OPTIONS.iframeElem || ""; //iframe的ID - this.iframeUrl = this.options.iframeUrl || OPTIONS.iframeUrl || ""; //树关联的iframe地址 - this.iframeLoad = this.options.iframeLoad || OPTIONS.iframeLoad || "leaf"; //点击哪一层加载frame: node:所有节点, leaf:默认,最后一级 - this.iframeDefaultRequest = $.extend(this.iframeDefaultRequest, this.options.iframeDefaultRequest || OPTIONS.iframeDefaultRequest) || this.iframeDefaultRequest; //iframe的默认传递参数 - this.iframeRequest = $.extend(this.iframeRequest, this.options.iframeRequest) || $.extend(this.iframeRequest, OPTIONS.iframeRequest) || this.iframeRequest; //iframe的自定义参数 - this.iframeFun = $.extend(this.iframeFun, this.options.iframeFun) || $.extend(this.iframeFun, OPTIONS.iframeFun) || this.iframeFun; //iframe事件加载 - - /** 下拉树模式参数**/ - this.select = this.options.select || false; - if(this.select) { - // 重置下拉树 - this.selectSetting(); - } - - /** 调用确认最终主题方法*/ - this.ensureTheme(); - }; - - /** - * @Desc: 重置基本属性值 - * @Param: options:JSON对象,重置dtree所需的全部属性 - */ - DTree.prototype.reloadSetting = function(options) { - this.options = $.extend(this.options, options) || this.options; - - /** 绑定元素参数**/ - this.elem = this.options.elem || this.elem; //树绑定的元素ID:#elem - if(typeof this.options.obj === 'undefined'){ - if(this.elem) { - if($(this.elem).length > 0) { - this.obj = $(this.elem); - } - } - } else { - this.obj = this.options.obj || this.obj; //树绑定的jquery元素,用于当元素是延迟加载出来的话,可以用这个找到 - this.elem = "#" + this.obj[0].id; - } - - /** 基本参数**/ - this.scroll = this.options.scroll || this.scroll; //树的上级div容器,让树可以显示滚动条的div容器 - this.accordion = (typeof (this.options.accordion) === "boolean") ? this.options.accordion : this.accordion; //开启手风琴加载 - if(this.accordion) { - this.initLevel = 1; //默认展开节点 1节 - } else { - this.initLevel = this.options.initLevel || this.initLevel; //默认展开节点 2节 - } - this.type = this.options.type || this.type; //树的加载方式 all,全量树, load,增量树,默认load - this.cache = (typeof (this.options.cache) === "boolean") ? this.options.cache : this.cache; //开启数据缓存 - this.record = (typeof (this.options.record) === "boolean") ? this.options.record : this.record; //开启数据记录模式 - this.load = (typeof (this.options.load) === "boolean") ? this.options.load : this.load; //开启加载动画 - this.none = this.options.none || this.none; //初始节点加载无数据时显示文字 - this.tempHeight = this.options.height || this.height; //临时转换高度变量 - if(this.tempHeight) { //设置高度 - if(/^full-\d+$/.test(this.tempHeight)) { - this.fullHeightGap = this.tempHeight.split('-')[1]; - this.height = $WIN.height() - this.fullHeightGap; - } else { - this.fullHeightGap = this.tempHeight; - this.height = this.tempHeight; - } - } - this.width = this.options.width || this.width; //宽度 - this.obj.css("width", this.width); - - /** 样式相关参数**/ - this.line = (typeof (this.options.line) === "boolean") ? this.options.line : this.line; //开启树线,默认不开启 - this.iconfont = this.options.iconfont || this.iconfont; //默认图标字体 dtreefont - this.iconfontStyle = this.options.iconfontStyle || this.iconfontStyle; //用于自定义树的每个关键部位使用的图标 - this.nodeIconArray = $.extend(nodeIconArray, this.options.nodeIconArray) || this.nodeIconArray; //用户自定义非叶子节点图标集合,node - this.leafIconArray = $.extend(leafIconArray, this.options.leafIconArray) || this.leafIconArray; //用户自定义叶子节点图标集合,leaf - this.skin = this.options.skin || this.skin; //自定义样式 - if(this.skin == "layui"){ //layui主题 - this.line = (typeof (this.options.line) === "boolean") ? this.options.line : true; //开启树线,默认开启 - this.ficon = this.options.ficon || this.ficon; //一级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示一级图标。默认'7' - this.fnodeIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? (this.ficon == "-1" ? "-1" : "1") : this.ficon[0]; //一级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示二级图标,默认'1' - this.fleafIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? this.ficon : this.ficon[1]; //一级图标中的leaf节点图标 - this.icon = this.options.icon || this.icon; //二级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示二级图标。默认'-1' - this.nodeIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? (this.icon == "-1" ? "-1" : "-1") : this.icon[0]; //二级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示二级图标,默认'-1' - this.leafIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? this.icon : this.icon[1]; //二级图标中的leaf节点图标 - } else if(this.skin == "laySimple"){ //laySimple主题 - this.line = (typeof (this.options.line) === "boolean") ? this.options.line : false; //开启树线,默认不开启 - this.ficon = this.options.ficon || this.ficon; //一级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示一级图标。默认'-1' - this.fnodeIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? (this.ficon == "-1" ? "-1" : "2") : this.ficon[0]; //一级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示二级图标,默认'2' - this.fleafIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? this.ficon : this.ficon[1];//一级图标中的leaf节点图标 - this.icon = this.options.icon || this.icon; //二级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示二级图标。默认'-1' - this.nodeIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? (this.icon == "-1" ? "-1" : "-1") : this.icon[0]; //二级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示二级图标,默认'-1' - this.leafIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? this.icon : this.icon[1]; //二级图标中的leaf节点图标 - } else { // 默认主题 或者自定义主题 - this.line = (typeof (this.options.line) === "boolean") ? this.options.line : false; //开启树线,默认不开启 - this.ficon = this.options.ficon || this.ficon; //一级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示一级图标。默认'8' - this.fnodeIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? (this.ficon == "-1" ? "-1" : "1") : this.ficon[0]; //一级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示二级图标,默认'1' - this.fleafIcon = (typeof this.ficon === 'string' || typeof this.ficon === 'number') ? this.ficon : this.ficon[1]; // 一级图标中的leaf节点图标 - this.icon = this.options.icon || this.icon; //二级图标样式,0:文件夹,1:人员,2:机构,3:报表,4:信息,5:叶子,6:勋章,7:文件,8:小圆点,9:齿轮,10:星星, -1:不显示二级图标。默认'5' - this.nodeIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? (this.icon == "-1" ? "-1" : "0") : this.icon[0]; //二级图标中的node节点图标。0:文件夹,1:+、-,2:三角形, -1:不显示二级图标,默认'0' - this.leafIcon = (typeof this.icon === 'string' || typeof this.icon === 'number') ? this.icon : this.icon[1]; //二级图标中的leaf节点图标 - } - - /** 数据加载参数**/ - this.url = this.options.url || this.url; //请求地址 - this.async = (typeof (this.options.async) === "boolean") ? this.options.async : this.async; //异步同步加载,默认异步加载 - this.asyncLoad = this.options.asyncLoad || this.asyncLoad; //初始异步加载层级数据 - this.headers = this.options.headers || this.headers; //ajax header属性 - this.method = this.options.method || this.method; //请求类型 - this.dataType = this.options.dataType || this.dataType; //参数类型 - this.contentType = this.options.contentType || this.contentType; //发送信息至服务器时内容编码类型 - this.defaultRequest = $.extend(this.defaultRequest, this.options.defaultRequest) || this.defaultRequest; //默认请求参数 - this.filterRequest = this.options.filterRequest || this.filterRequest; //过滤请求参数 - this.request = this.options.request || this.request; //用户自定义请求参数 - this.response = $.extend(this.response, this.options.response) || this.response; //返回json格式 - this.data = this.options.data || this.data; //初始化指定该参数,则不会访问异步接口 - this.dataFormat = this.options.dataFormat || this.dataFormat; //用于用户配置的data数据格式,list:列表, levelRelationship:层级关系,默认 - this.dataStyle = this.options.dataStyle || this.dataStyle; //用于用户配置layui通用的json数据风格,layuiStyle:layui风格,defaultStyle:默认风格 - this.errDataShow = (typeof (this.options.errDataShow) === "boolean") ? this.options.errDataShow : this.errDataShow; //是否在使用list模式递归数据出现错误时,显示错误信息 - this.withCredentials = (typeof (this.options.withCredentials) === "boolean") ? this.options.withCredentials : this.withCredentials; //是否允许跨域请求 - this.beforeSend = this.options.beforeSend || this.beforeSend; //异步加载之前的回调 - this.success = this.options.success || this.success; //树加载完毕后执行解析树之前的回调 - this.done = this.options.done || this.done; //树加载完毕后的回调 - this.formatter = $.extend(this.formatter, this.options.formatter)|| this.formatter; //数据过滤 - this.error = this.options.error || this.error; //异步加载异常回调 - this.complete = this.options.complete || this.complete; //异步加载完成回调 - - /** 复选框参数**/ - this.checkbar = this.options.checkbar || this.checkbar; //是否开启复选框模式 - this.checkbarLoad = this.options.checkbarLoad || this.checkbarLoad; //复选框作用范围,node:所有节点, leaf:最后一级;默认所有节点 - this.checkbarType = this.options.checkbarType || this.checkbarType; //复选框选中形式 all:子集选中父级也选中, no-all:子集选中父级半选中,子集全选父级选中,p-casc:父级选中子集全选,子集无法改变父级选中状态, self:没有任何级联关系,only:只能选中一个复选框。 默认all - this.checkbarData = this.options.checkbarData || this.checkbarData; //复选框记录数据类型形式, change表示记录变更数据,choose表示记录选中数据,all记录全部数据,halfChoose记录选中和半选中的数据,默认choose - this.checkbarFun = $.extend(this.checkbarFun, this.options.checkbarFun)|| this.checkbarFun; //checkbar事件加载 - - /** 菜单栏参数**/ - this.menubar = this.options.menubar || this.menubar; //是否打开菜单栏 - this.menubarTips = $.extend(this.menubarTips, this.options.menubarTips) || this.menubarTips; //菜单栏吸附, toolbar:依附在工具栏,group:依附在按钮组,freedom,自由 - this.menubarFun = $.extend(this.menubarFun, this.options.menubarFun) || this.menubarFun; //menubar事件加载 - - /** 工具栏参数**/ - this.toolbar = this.options.toolbar || this.toolbar; //是否开启工具栏 - this.toolbarWay = this.options.toolbarWay || this.toolbarWay; //工具栏显示方式,contextmenu:右键,follow:跟随节点,fixed:固定在节点右侧 - this.toolbarStyle = $.extend(this.toolbarStyle, this.options.toolbarStyle) || this.toolbarStyle; //toolbar的自定义风格,标题,弹框大小 - this.toolbarLoad = this.options.toolbarLoad || this.toolbarLoad; //toolbar作用范围:node:所有节点,noleaf:非最后一级节点,leaf:最后一级 - this.toolbarShow = this.options.toolbarShow || this.toolbarShow; //toolbar三个按钮 - this.toolbarBtn = this.options.toolbarBtn || this.toolbarBtn; //toolbar增删改中内容的自定义加载 - this.toolbarExt = this.options.toolbarExt || this.toolbarExt; //toolbar按钮扩展 - this.toolbarFun = $.extend(this.toolbarFun, this.options.toolbarFun) || this.toolbarFun; //toolbar事件加载 - - /** iframe模式参数**/ - this.useIframe = this.options.useIframe || this.useIframe;//是否加载iframe 默认false - this.iframeElem = this.options.iframeElem || this.iframeElem; //iframe的ID - this.iframeUrl = this.options.iframeUrl || this.iframeUrl; //树关联的iframe地址 - this.iframeLoad = this.options.iframeLoad || this.iframeLoad; //点击哪一层加载frame: node:所有节点, leaf:默认,最后一级 - this.iframeDefaultRequest = $.extend(this.iframeDefaultRequest, this.options.iframeDefaultRequest) || this.iframeDefaultRequest; //iframe的默认传递参数 - this.iframeRequest = $.extend(this.iframeRequest, this.options.iframeRequest) || this.iframeRequest; //iframe的自定义参数 - this.iframeFun = $.extend(this.iframeFun, this.options.iframeFun) || this.iframeFun; //iframe事件加载 - - /** 下拉树模式参数**/ - if(this.select) { - // 重置下拉树 - this.reloadSelectSetting(); - } - - /** 调用确认最终主题方法*/ - this.ensureTheme(); - - }; - - /** - * @Desc: 设置下拉树的基本参数值 - */ - DTree.prototype.selectSetting = function() { - /** select模式参数*/ - this.select = true; //配置成select模式 - - this.selectInitVal = this.obj.attr("data-value") || this.options.selectInitVal || ""; //输入框的值 - this.selectTreeDiv = this.obj[0].id + "_tree_div"; // 上级DIV节点 - this.selectCardDiv = this.obj[0].id + "_select_card_div"; // 上级layui卡片节点 - this.selectDiv = this.obj[0].id + "_select_div"; // 模拟的select节点 - this.selectTipsName = this.obj[0].id + "_select_input"; // select的提示输入框名称 - this.selectTips = this.options.selectTips || "请选择"; // 输入框的提示语 - this.selectCardHeight = this.options.selectCardHeight || "350"; // 下拉面板的高度 - this.selectInputName = this.options.selectInputName || {nodeId: this.obj[0].id + "_select_nodeId"}; // select表单中的元素 - - // 调取下拉树的特殊处理页面元素标识 - this.renderSelectDom(); - } - - /** - * @Desc: 重置下拉树的基本参数值 - */ - DTree.prototype.reloadSelectSetting = function() { - - this.selectInitVal = this.obj.attr("data-value") || this.options.selectInitVal || this.selectInitVal; //输入框的值 - this.selectTips = this.options.selectTips || this.selectTips; // 输入框的提示语 - this.selectCardHeight = this.options.selectCardHeight || this.selectCardHeight; // 下拉面板的高度 - this.selectInputName = $.extend(this.selectInputName, this.options.selectInputName) || this.selectInputName; // select表单中的元素 - - // 调取下拉树的特殊处理页面元素标识 - this.reloadSelectDom(); - } - - /******************** 下拉树设置区域 ********************/ - /** - * @Desc: 渲染下拉树的Dom结构 - */ - DTree.prototype.renderSelectDom = function() { - var _this = this; - var rootId = _this.obj[0].id; - - // 设置自定义表单隐藏域 - var selectInputName = _this.selectInputName; - var selectInput = []; - for(var key in selectInputName) { - selectInput.push(''); - } - - // 设置html - var prevHtml = ['
                          ', - '
                          ', selectInput.join(""), - '', - '', - '
                          '].join(''); - - _this.obj.before(prevHtml); - - var cardStyle = "style="; - if(this.selectCardHeight) { - cardStyle += "'height:"+_this.selectCardHeight+"px'"; - } - _this.obj.wrap('
                          ').wrap('
                          ').wrap('
                          '); - - } - - /** - * @Desc: 重新渲染下拉树的Dom结构 - */ - DTree.prototype.reloadSelectDom = function() { - var _this = this; - var rootId = _this.obj[0].id; - - // 设置自定义表单隐藏域 - var selectInputName = _this.selectInputName; - var selectInput = []; - for(var key in selectInputName) { - selectInput.push(''); - } - - $("div[dtree-id='"+rootId+"'][dtree-select='"+_this.selectDiv+"']").find("div.layui-select-title").html(""); - - // 设置html - var prevHtml = [selectInput.join(""), - '', - ''].join(''); - - $("div[dtree-id='"+rootId+"'][dtree-select='"+_this.selectDiv+"']").find("div.layui-select-title").html(prevHtml); - - var cardStyle = "style="; - if(this.selectCardHeight) { - cardStyle += "'height:"+_this.selectCardHeight+"px'"; - } - $("div[dtree-id='"+rootId+"'][dtree-card='"+_this.selectCardDiv+"']").attr("style", cardStyle); - } - - /** - * @Desc: 设置下拉树模式中,input输入框的值 - * @Param: param: input中的值对应树数据的ID值\当前树选中的数据JSON对象,可不传,不传的话则树内部读取 - */ - DTree.prototype.selectVal = function(param) { - var _this = this; - var rootId = _this.obj[0].id; - var selectInputName = _this.selectInputName; - var selectTipsNameValue = ""; - var selectValues = {}; - - // 如果开启了复选框,则此方法用来取值 - if(_this.checkbar) { - return _this.selectCheckboxVal(); - } - - if(typeof param === 'undefined') { // 不传,则为当前树中记录的ID - param = _this.getNowParam(); - } - if(typeof param === 'string') { // 传递ID,则查询树节点ID对应的值 - param = _this.getParam(param); - } - - selectTipsNameValue = param["context"]; - for(var key in selectInputName) { - selectValues[selectInputName[key]] = param[key]; - $("div[dtree-select='" + _this.selectDiv + "']").find("input[dtree-id='" + rootId + "'][name='"+selectInputName[key]+"']").val(param[key] || ""); - } - - if(param["nodeId"] && !param["context"]) { - selectTipsNameValue = _this.getParam(param["nodeId"]); - } - - // 返显提示输入框值 - $("div[dtree-select='" + _this.selectDiv + "']").find("input[dtree-id='" + rootId + "'][name='"+_this.selectTipsName+"']").val(selectTipsNameValue || ""); - - // 返回隐藏域中的值 - return selectValues; - } - - /** - * @Desc: 设置复选框模式中的下拉树的选中值 - */ - DTree.prototype.selectCheckboxVal = function() { - var _this = this; - var rootId = _this.obj[0].id; - var selectInputName = _this.selectInputName; - - // 获取全部复选框选中节点 - var param = _this.getCheckbarJsonArrParam(); - - selectTipsNameValue = param["context"]; - var selectValues = {}; - for(var key in selectInputName) { - var value = param[key].join(","); - selectValues[selectInputName[key]] = value; - $("div[dtree-select='" + _this.selectDiv + "']").find("input[dtree-id='" + rootId + "'][name='"+selectInputName[key]+"']").val(value); - } - - $("div[dtree-select='" + _this.selectDiv + "']").find("input[dtree-id='" + rootId + "'][name='"+_this.selectTipsName+"']").val(selectTipsNameValue); - - // 返回隐藏域中的值 - return selectValues; - } - - /** - * @Desc: 重置下拉树的值,1.表单清空;2.节点重置;3.复选框重置 - */ - DTree.prototype.selectResetVal = function() { - var _this = this; - var rootId = _this.obj[0].id; - // 表单清空 - $("input[dtree-id='"+rootId+"']").val(""); - // 节点重置 - _this.cancelNavThis(); - if(_this.checkbar) { - // 复选框重置 - _this.cancelCheckedNode(); - } - } - - - /******************** 字体及图标区域 ********************/ - /** - * @Desc: 树使用的最终主题方案 - */ - DTree.prototype.ensureTheme = function(){ - var _this = this; - - // 确认style - this.style.item = DTREE + this.skin + ITEM; - this.style.itemThis = DTREE + this.skin + ITEMTHIS; - this.style.dfont = DTREE + this.skin + DFONT; - this.style.ficon = DTREE + this.skin + FICON; - this.style.icon = DTREE + this.skin + ICON; - this.style.cbox = DTREE + this.skin + CBOX; - this.style.chs = DTREE + this.skin + CHS; - - // 确认usefontStyle - var iconfont = this.iconfont; - var iconfonts = []; - if(typeof iconfont === 'string') { - iconfonts.push(iconfont); - } else { - iconfonts = iconfont; - } - - var iconfontStyle = this.iconfontStyle; - var iconfontStyles = []; - if(iconfontStyle.length == undefined) { - iconfontStyles.push(iconfontStyle); - } else { - iconfontStyles = iconfontStyle; - } - - for(var i=0; i 0) { - $lis.each(function(){ - _this.showLineLi($(this)); - }); - } else { - _this.obj.find("li[data-id]").each(function(){ - _this.showLineLi($(this)); - }); - } - } - } - - /** - * @Desc: 真正显示树线的方法 - * @Param: $li: JQuery对象,表示组成树的li节点 - */ - DTree.prototype.showLineLi = function($li){ - var _this = this; - var $div = $li.children("div"), - $nextLi = $li.next("li"), - $ul = $li.parent("ul"); - if($ul[0].id == _this.obj[0].id) { - // 根节点下的节点 - $li.removeClass(LI_NAV_LINE); - $li.removeClass(LI_NAV_LAST_LINE); - $li.addClass(LI_NAV_FIRST_LINE); - } else { - // 非根节点下的节点 - var $pnextLi = $ul.parent("li").next("li"); - if($pnextLi.length == 0) { - if($nextLi.length == 0){ - $li.removeClass(LI_NAV_LINE); - $li.removeClass(LI_NAV_FIRST_LINE); - $li.addClass(LI_NAV_LAST_LINE); - } else { - $li.removeClass(LI_NAV_FIRST_LINE); - $li.removeClass(LI_NAV_LAST_LINE); - $li.addClass(LI_NAV_LINE); - } - }else { - var $pnextdiv = $pnextLi.children("div"); - if($nextLi.length == 0 && $div.children("cite").attr("data-leaf") == "leaf" && $pnextdiv.children("cite").attr("data-leaf") == "leaf") { - $li.removeClass(LI_NAV_FIRST_LINE); - $li.removeClass(LI_NAV_LINE); - $li.addClass(LI_NAV_LAST_LINE); - } else { - $li.removeClass(LI_NAV_FIRST_LINE); - $li.removeClass(LI_NAV_LAST_LINE); - $li.addClass(LI_NAV_LINE); - } - } - } - } - - /******************** 初始化数据区域 ********************/ - /** - * @Desc: 设置高度 - */ - DTree.prototype.autoHeight = function(){ - var _this = this; - var height = _this.height; - if(height != "") { - if(_this.elem == _this.scroll){ - _this.obj.parent().css("height", height + "px"); - } else { - var $toolbarDiv = _this.obj.closest(_this.scroll); - $toolbarDiv.css("height", height + "px"); - } - } - }; - - /** - * @Desc: 重载树 - * @Param: options: dtree的所有属性的json对象 - */ - DTree.prototype.reload = function(options){ - var _this = this; - _this.reloadSetting(options); - _this.init(); - }; - - /** - * @Desc: 初始化加载 - */ - DTree.prototype.loadTreeInit = function(){ - var _this = this; - var asyncLoad = _this.asyncLoad; - // 初始化加载 - _this.init(function(){ - // ajax加载之后的回调 - if(asyncLoad && asyncLoad.length > 0) { - _this.obj.addClass(NAV_SHOW); - - // 说明此时要异步加载子节点 - _this.loadChildTreeInit(asyncLoad, 0); - } - }) - } - - /** - * @Desc: 初始化加载子节点 - * @Param: asyncLoad: 需异步加载的层级,在基础属性中配置 - * @Param: i: 已经加载到的层级 - */ - DTree.prototype.loadChildTreeInit = function(asyncLoad, i){ - var _this = this; - if(i == asyncLoad.length) { // 满足条件,终止递归 - return ; - } - - var $div = _this.getNode(asyncLoad[i]); - - if($div && $div.length > 0) { - // 设置节点状态 - var $ul = $div.next("ul"), - $i_fnode = _this.getNodeDom($div).fnode(), - $i_snode = _this.getNodeDom($div).snode(); - - $ul.addClass(NAV_SHOW); - _this.accordionUL($ul); - _this.operateIcon($i_fnode, $i_snode).open(); - // 加载子节点 - _this.getChild($div, undefined, function(){ - // 继续递归 - _this.loadChildTreeInit(asyncLoad, ++i); - }); - } - - } - - /** - * @Desc: 初始化树 - * @Param: callback: 异步加载完成之后的回调函数 - */ - DTree.prototype.init = function(callback){ - var _this = this; - if (typeof _this !== "object") { - layer.msg("树组件未成功加载,请检查配置", {icon:5}); - return ; - } - - // 设置组件高度 - _this.autoHeight(); - - if(_this.data) { - _this.dataLoadTree(true, _this.obj, _this.data); - } else { - _this.asyncLoadTree(true, _this.obj, callback); - } - }; - - /** - * @Desc: 加载子节点 - * @Param: $div: JQuery对象,代表当前子节点的父节点div - * @Param: data: data方式加载的数据 - * @Param: callback: 子节点加载完成之后的回调喊出 - */ - DTree.prototype.getChild = function($div, data, callback) { - var _this = this, $ul = $div.next("ul"); - - _this.setNodeParam($div); - - if(typeof data !== 'undefined') { - _this.dataLoadTree(false, $ul, data); - } else { - _this.asyncLoadTree(false, $ul, callback); - } - }; - - /** - * @Desc: 用data加载树 - * @Param: first: 表示是否第一次加载 - * @Param: $ul: JQuery对象,代表当前数据加载到的ul标签里 - * @Param: data: data加载的数据 - */ - DTree.prototype.dataLoadTree = function(first, $ul, data){ - var _this = this; - - if(typeof data.length === 'undefined'){ - layer.msg("数据解析异常,data数据格式不正确", {icon:5}); - return ; - } - - if(first && data.length == 0) { - $ul.html(_this.getNoneDom().text()); - return ; - } - - //先将ul中的元素清空 - $ul.html(""); - - var index = _this.load ? layer.load(1) : ""; - - setTimeout(function () { - // 加载完毕后执行树解析前的回调 - var returnData = _this.success(data, $ul, first); - if(returnData) { - data = returnData; - } - - var pid = (first == true) ? $ul.attr("data-id") : _this.node.nodeId; - var level = (first == true) ? 1 : parseInt(_this.node.level)+1; - - // 解析树 - if (_this.dataFormat == 'list'){ - //1.构建一个存放节点的树组 - var rootListData = _this.queryListTreeByPid(pid, data); - _this.loadListTree(rootListData, _this.data, level); - } else { - _this.loadTree(data, level); - } - - // 显示树线 - _this.showLine(); - - // 这种情况下需要一开始就将toolbar显示在页面上 - if(_this.toolbar && _this.toolbarWay != 'contextmenu') { - _this.setToolbarDom().setToolbarPlace(_this.toolbarMenu); - } - - // 判断是否存在错误数据,并是否打印错误数据 - _this.msgErrData(); - - // 设置下拉树的初始值 - if(first && _this.select && _this.selectInitVal){ - if(_this.checkbar) { // 复选框模式下 - _this.chooseDataInit(_this.selectInitVal); - _this.selectCheckboxVal(_this.selectInitVal); - } else { // 普通模式下 - _this.dataInit(_this.selectInitVal); - _this.selectVal(_this.selectInitVal); - } - } - - // 保存树副本 - _this.bak = _this.obj.html(); - - // 加载完毕后的回调 - _this.done(_this.data, $ul, first); - - if(_this.load){layer.close(index);} - }, 100); - } - - /** - * @Desc: 异步加载树 - * @Param: first: 表示是否第一次加载 - * @Param: $ul: JQuery对象,代表当前数据加载到的ul标签里 - * @Param: callback: 异步加载完成之后的回调函数 - */ - DTree.prototype.asyncLoadTree = function(first, $ul, callback){ - var _this = this; - - if (!_this.url) { - layer.msg("数据请求异常,url参数未指定", {icon:5}); - return ; - } - - //先将ul中的元素清空 - $ul.html(""); - - var index = ""; - - AjaxHelper.request({ - async: _this.async, - headers: _this.headers, - type: _this.method, - url: _this.url, - dataType: _this.dataType, - contentType: _this.contentType, - withCredentials: _this.withCredentials, - data: _this.getFilterRequestParam(_this.getRequestParam()), - beforeSend: function(XMLHttpRequest, self){ - index = _this.load ? layer.load(1) : ""; - var returnFlag = _this.beforeSend(this, XMLHttpRequest, self); - if(!returnFlag) { - if(_this.load){layer.close(index);} - } - return returnFlag; - }, - success: function(result) { - if (typeof result === 'string') { - result = $.parseJSON(result); - } - - // 加载完毕后执行树解析前的回调 - var returnData = _this.success(result, $ul, first); - if(returnData) { - result = returnData; - } - - var code = ""; - if (_this.dataStyle == 'layuiStyle'){ - code = result[_this.response.statusName]; - } else { - code = result.status[_this.response.statusName]; - } - - if (code == _this.response.statusCode) { - - var d = result[_this.response.rootName]; - - if(first && typeof d.length === 'undefined'){ - $ul.html(_this.getNoneDom().errText("数据解析异常,url回调后的数据格式不正确")); - //layer.msg("数据解析异常,url回调后的数据格式不正确", {icon:5}); - return ; - } - - if(first && d.length == 0) { - $ul.html(_this.getNoneDom().text()); - return ; - } - - //1.识别根节点ul中的data-id标签,判断顶级父节点 - var pid = (first == true) ? $ul.attr("data-id") : _this.node.nodeId; - var level = (first == true) ? 1 : parseInt(_this.node.level)+1; - - // 第一次解析树 - if (_this.dataFormat == 'list'){ - //1.构建一个存放节点的树组 - var rootListData = _this.queryListTreeByPid(pid, d); - if(first) { - _this.loadListTree(rootListData, d, level); - } else { - _this.loadListTree(rootListData, d, level, $ul); - } - } else { - if(first) { - _this.loadTree(d, level); - } else { - _this.loadTree(d, level, $ul); - } - } - - // 显示树线 - _this.showLine(); - - // 这种情况下需要一开始就将toolbar显示在页面上 - if(_this.toolbar && _this.toolbarWay != 'contextmenu') { - _this.setToolbarDom().setToolbarPlace(_this.toolbarMenu); - } - - // 判断是否存在错误数据,并是否打印错误数据 - _this.msgErrData(); - - if(!first) { - $ul.addClass(NAV_SHOW); - } - - // 设置下拉树的初始值 - if(first && _this.select && _this.selectInitVal){ - if(_this.checkbar) { // 复选框模式下 - _this.chooseDataInit(_this.selectInitVal); - _this.selectCheckboxVal(_this.selectInitVal); - } else { // 普通模式下 - _this.dataInit(_this.selectInitVal); - _this.selectVal(_this.selectInitVal); - } - } - - // 保存树副本 - _this.bak = _this.obj.html(); - - // 加载完毕后的回调 - _this.done(result, $ul, first); - - callback && callback(); - } else { - // 如果打印不出任何信息说明是在这里,用了错误的数据格式, 或返回码不正确 - if (_this.dataStyle == 'layuiStyle'){ - _this.obj.html(_this.getNoneDom().errText(result[_this.response.message])); - _this.error(null, code, result[_this.response.message]); - } else { - _this.obj.html(_this.getNoneDom().errText(result.status[_this.response.message])); - _this.error(null, code, result.status[_this.response.message]); - } - } - }, - error: function(XMLHttpRequest, textStatus, errorThrown){// 异步加载异常回调 - _this.obj.html(_this.getNoneDom().errText(textStatus + ": " + errorThrown)); - _this.error(XMLHttpRequest, textStatus, errorThrown); - }, - complete: function(XMLHttpRequest, textStatus){// 异步加载完成回调 - if(_this.load){layer.close(index);} - _this.complete(XMLHttpRequest, textStatus); - } - }); - - } - - /** - * @Desc: 初始化渲染树或者拼接渲染树,list模式下 - * @Param: nowListData: 表示当前需要被渲染的数据 - * @Param: listData: 表示全部数据 - * @Param: level: 当前渲染的层级 - * @Param: $ul: JQuery对象,代表当前数据加载到的ul标签里 - */ - DTree.prototype.loadListTree = function(nowListData, listData, level, $ul){ - var _this = this; - $ul = $ul || _this.getNodeDom().nowOrRootUl(); //当前选中的节点或根节点 - if (nowListData.length > 0){ - for (var i = 0; i < nowListData.length; i++) { - // 1.获取已知节点的全部数据 - var data = nowListData[i]; - if(typeof data !== "object") continue; - var parseData = _this.parseData(data); - var childListData = _this.queryListTreeByPid(parseData.treeId(), listData); // 根据已知数据的id判断该条数据是否还有子数据 - - // 3. 页面元素加载数据 - $ul.append(_this.getLiItemDom(parseData.treeId(), parseData.parentId(), parseData.title(), parseData.fmtTitle(), parseData.last(childListData.length), parseData.ficonClass(), parseData.iconClass(), parseData.checkArr(), level, parseData.spread(level), parseData.disabled(), parseData.hide(), parseData.basicData(), parseData.recordData(), ($ul.hasClass(UL_ROOT) ? "root" : "item"))); - // 4.有子数据的元素加载子节点 - if(childListData.length > 0){ - var cLevel = parseInt(level)+1; - _this.loadListTree(childListData, listData, cLevel, _this.obj.find("ul[data-id='"+parseData.treeId()+"']")); - } - } - } - }; - - /** - * @Desc: 根据父ID查找list数据中匹配的元素 - * @Param: pid: 表示父ID - * @Param: listData: 表示全部数据 - */ - DTree.prototype.queryListTreeByPid = function(pid, listData){ - var _this = this; - var rootListData = []; - if (listData) { - for (var i = 0; i < listData.length; i++) { - var data = listData[i]; - if(typeof data !== "object") continue; - if(pid == "null" || pid == null){ - if(data[_this.response.parentId] == null) { rootListData.push(data); } - } else { - if (data[_this.response.parentId] == pid){ - if (data[_this.response.treeId] == pid){ - _this.errData.push(data); - } else { - rootListData.push(data); - } - } - } - } - } - return rootListData; - }; - - /** - * @Desc: 初始化渲染树或者拼接渲染树,层级关系模式下 - * @Param: listData: 表示全部数据 - * @Param: level: 当前渲染的层级 - * @Param: $ul: JQuery对象,代表当前数据加载到的ul标签里 - */ - DTree.prototype.loadTree = function(listData, level, $ul){ - var _this = this; - if (listData) { - $ul = $ul || _this.getNodeDom().nowOrRootUl(); //当前选中的节点或根节点 - for (var i = 0; i < listData.length; i++) { // 遍历跟节点或追加的跟节点 - var data = listData[i]; - if(typeof data !== "object") continue; - if(data[_this.response.treeId] == data[_this.response.parentId]) { _this.errData.push(data); } - var parseData = _this.parseData(data); - var children = parseData.children(); - $ul.append(_this.getLiItemDom(parseData.treeId(), parseData.parentId(), parseData.title(), parseData.fmtTitle(), parseData.last(children.length), parseData.ficonClass(), parseData.iconClass(), parseData.checkArr(), level, parseData.spread(level), parseData.disabled(), parseData.hide(), parseData.basicData(), parseData.recordData(), ($ul.hasClass(UL_ROOT) ? "root" : "item"))); - if (children.length != 0) { - var cLevel = parseInt(level)+1; - _this.loadTree(children, cLevel, _this.obj.find("ul[data-id='"+parseData.treeId()+"']")); - } - } - } - }; - - /** - * @Desc: 判断在数据加载时是否存在错误数据,并是否打印错误数据 - * @Param: - */ - DTree.prototype.msgErrData = function() { - var _this = this; - if(_this.errData.length > 0 && _this.errDataShow) { - var title = ""; - for(var i=0; i<_this.errData.length; i++) { - var edata = _this.errData[i]; - title += "数据:【"+edata[_this.response.title]+"】中节点id和上级id值一致! \n"; - } - layer.msg(title, {icon:2,time:5000}); - } - // 显示之后,将错误数据制空 - _this.errData = []; - }; - - /** - * @Desc: 解析单个数据 - * @Param: data: 被解析的单个数据对象 - */ - DTree.prototype.parseData = function(data) { - var _this = this; - - return { - treeId: function(){ - return data[_this.response.treeId]; - }, - parentId: function(){ - return data[_this.response.parentId]; - }, - fmtTitle: function(){ - if(typeof _this.formatter.title === 'function'){ - var ftitle = _this.formatter.title(data); - var tt = data[_this.response.title]; - tt = (ftitle == "" || ftitle == undefined || ftitle == null) ? tt : ftitle; - return tt || ""; - } - return data[_this.response.title]; - }, - title: function(){ - return data[_this.response.title]; - }, - level: function(){ - return data[_this.response.level] || ""; - }, - ficonClass: function(){ - return data[_this.response.ficonClass] || ""; - }, - iconClass: function(){ - return data[_this.response.iconClass] || ""; - }, - last: function(len){ - return ((len == 0) ? - ((typeof (data[_this.response.last]) === "boolean") ? data[_this.response.last] : true) : - ((typeof (data[_this.response.last]) === "boolean") ? data[_this.response.last] : false)); - }, - spread: function(level){ - return ((level < _this.initLevel) ? - ((typeof (data[_this.response.spread]) === "boolean") ? data[_this.response.spread] : true) : - ((typeof (data[_this.response.spread]) === "boolean") ? data[_this.response.spread] : false)); - }, - disabled: function(){ - return (typeof (data[_this.response.disabled]) === "boolean") ? data[_this.response.disabled] : false; - }, - hide: function(){ - return (typeof (data[_this.response.hide]) === "boolean") ? data[_this.response.hide] : false; - }, - checkArr: function(){ - var checkArr = []; - var checkArrData = data[_this.response.checkArr]; - if(typeof checkArrData === 'string'){ - if(checkArrData.indexOf("{") > -1 && checkArrData.indexOf("}") > -1){ - checkArrData = JSON.parse(checkArrData); - } else { - checkArrData = {"type":"0","checked":checkArrData}; - } - } - if((typeof checkArrData === 'object') && (checkArrData !== null)){ - if(typeof checkArrData.length === 'undefined'){ - checkArr.push(checkArrData); - } else { - checkArr = checkArrData; - } - } - - if(checkArr.length > 0 && checkArr.length > _this.checkArrLen){ - _this.checkArrLen = checkArr.length; // 获取复选框个数 - } - return checkArr; - - }, - children: function(){ - return data[_this.response.childName] || []; - }, - basicData: function(){ - return event.escape(JSON.stringify(data[_this.response.basicData])) || JSON.stringify({}); - }, - recordData: function(){ - var recordData = _this.record ? event.cloneObj(data, [_this.response.treeId, - _this.response.parentId, - _this.response.title, - _this.response.iconClass, - _this.response.childName, - _this.response.last, - _this.response.spread, - _this.response.disabled, - _this.response.hide, - _this.response.checkArr, - _this.response.checked, - _this.response.type, - _this.response.basicData]) : {}; - - return event.escape(JSON.stringify(recordData)); - }, - data: function(){ - return data; - } - } - - }; - - /** - * @Desc: 无节点数据、节点数据异常时显示dom - */ - DTree.prototype.getNoneDom = function(){ - var _this = this, - rootId = _this.obj[0].id, - noneTitle = _this.none; - - return { - text: function(){ - return "
                          "+noneTitle+"
                          "; - }, - errText: function(errInfo){ - return "
                          "+errInfo+"
                          "; - } - } - }; - - /** - * @Desc: 新增节点的dom值 - * @Param: treeId: 节点ID - * @Param: parentId: 节点父ID - * @Param: title: 节点标题 - * @Param: fmtTitle: 节点附加标题 - * @Param: last: 是否最后一级节点 - * @Param: ficonClass: 一级图标class - * @Param: iconClass: 二级图标class - * @Param: checkArr: 复选框 - * @Param: spread: 是否展开 - * @Param: disabled: 是否禁用 - * @Param: hide: 是否隐藏 - */ - DTree.prototype.getDom = function(treeId, parentId, title, fmtTitle, last, ficonClass, iconClass, checkArr, level, spread, disabled, hide) { - var _this = this, - rootId = _this.obj[0].id, - toolbar = _this.toolbar, - checkbar = _this.checkbar; - - return { - fnode: function() { // + - 图标 - // 获取图标的变量 - var fnodeIcon = _this.fnodeIcon, - fleafIcon = _this.fleafIcon; - - var fleafIconLeaf = _this.usefontStyle.fnode.leaf, - fnodeIconOpen = _this.usefontStyle.fnode.node.open, - fnodeIconClose = _this.usefontStyle.fnode.node.close; - - if(ficonClass){ - var iconfont = _this.iconfont; - if(typeof iconfont === 'string') { - fleafIconLeaf = iconfont + " " + ficonClass; - fnodeIconOpen = iconfont + " " + ficonClass; - fnodeIconClose = iconfont + " " + ficonClass; - } else { - fleafIconLeaf = iconfont[0] + " " + ficonClass; - fnodeIconOpen = iconfont[0] + " " + ficonClass; - fnodeIconClose = iconfont[0] + " " + ficonClass; - } - } - - if(fnodeIcon != "-1" && fleafIcon != "-1"){ // 都加载 - return last ? "" : - (spread ? "" : ""); - } - - if(fnodeIcon != "-1" && fleafIcon == "-1"){ // 加载node 隐藏leaf - return last ? "" : - (spread ? "" : ""); - } - - if(fnodeIcon == "-1" && fleafIcon != "-1"){ // 隐藏node 加载leaf - return last ? "" : - (spread ? "" : ""); - } - - if(fnodeIcon == "-1" && fleafIcon == "-1"){ // 都隐藏 - return last ? "" : - (spread ? "" : ""); - } - }, - node: function() { // 二级图标样式 - // 获取图标的变量 - var nodeIcon = _this.nodeIcon, - leafIcon = _this.leafIcon; - - var sleafIconLeaf = _this.usefontStyle.snode.leaf, - snodeIconOpen = _this.usefontStyle.snode.node.open, - snodeIconClose = _this.usefontStyle.snode.node.close; - if(iconClass){ - var iconfont = _this.iconfont; - if(typeof iconfont === 'string') { - sleafIconLeaf = iconfont + " " + iconClass; - snodeIconOpen = iconfont + " " + iconClass; - snodeIconClose = iconfont + " " + iconClass; - } else { - sleafIconLeaf = iconfont[0] + " " + iconClass; - snodeIconOpen = iconfont[0] + " " + iconClass; - snodeIconClose = iconfont[0] + " " + iconClass; - } - } - - if(nodeIcon != "-1" && leafIcon != "-1"){ // 都加载 - return last ? "" : - (spread ? "" : ""); - } - - if(nodeIcon != "-1" && leafIcon == "-1"){ // 加载node 隐藏leaf - return last ? "" : - (spread ? "" : ""); - } - - if(nodeIcon == "-1" && leafIcon != "-1"){ // 隐藏node 加载leaf - return last ? "" : - (spread ? "" : ""); - } - - if(nodeIcon == "-1" && leafIcon == "-1"){ // 都隐藏 - return last ? "" : - (spread ? "" : ""); - } - }, - checkbox: function() { // 复选框 - var flag = false; - if(_this.checkbarLoad == "node"){if (checkbar) {flag = true;}} else {if (last) {if (checkbar) {flag = true;}}} - - if(flag){ - var result = "
                          "; - if(checkArr && checkArr.length > 0){ - - for (var i = 0; i < checkArr.length; i++) { - var checkData = checkArr[i]; - var checked = checkData[_this.response.checked]; - var type = checkData[_this.response.type]; - var CHOOSE_CLASS = _this.usefontStyle.checkbox.out; - if (checked == "2") { //半选择 - CHOOSE_CLASS = _this.usefontStyle.checkbox.noall + " " + _this.style.chs; - } else if (checked == "1") { //选择 - CHOOSE_CLASS = _this.usefontStyle.checkbox.on + " " + _this.style.chs; - } else { //未选择或者无值 - CHOOSE_CLASS = _this.usefontStyle.checkbox.out; - } - var disClass = ""; - if(disabled){disClass = NAV_DIS;} - result += ""; - } - } - result += "
                          "; - return result; - } - - return ""; - }, - text: function() { // 文字显示 - var disClass = ""; - if(disabled){disClass = NAV_DIS;} - return ""+fmtTitle+""; - }, - ul: function() { //子节点ul - return last ? "
                            " : - (spread ? "
                              " : "
                                "); - } - }; - }; - - /** - * @Desc: 替换节点的dom值,或指定这些值 - * @Param: $div: JQuery对象,表示当前被操作的节点 - * @Param: treeId: 节点ID - * @Param: last: 是否最后一级节点 - * @Param: spread: 是否展开 - * @Param: disabled: 是否禁用 - * @Param: hide: 是否隐藏 - */ - DTree.prototype.replaceDom = function($div, treeId, last, spread, disabled, hide) { - var _this = this, - rootId = _this.obj[0].id, - toolbar = _this.toolbar, - checkbar = _this.checkbar; - - return { - fnode: function(ficonClass) { // + - 图标 - var fnode = ""; - - // 获取图标的变量 - var fnodeIcon = _this.fnodeIcon, - fleafIcon = _this.fleafIcon; - - var fleafIconLeaf = _this.usefontStyle.fnode.leaf, - fnodeIconOpen = _this.usefontStyle.fnode.node.open, - fnodeIconClose = _this.usefontStyle.fnode.node.close; - - if(ficonClass){ - var iconfont = _this.iconfont; - if(typeof iconfont === 'string') { - fleafIconLeaf = iconfont + " " + ficonClass; - fnodeIconOpen = iconfont + " " + ficonClass; - fnodeIconClose = iconfont + " " + ficonClass; - } else { - fleafIconLeaf = iconfont[0] + " " + ficonClass; - fnodeIconOpen = iconfont[0] + " " + ficonClass; - fnodeIconClose = iconfont[0] + " " + ficonClass; - } - } - - if(fnodeIcon != "-1" && leafIcon != "-1"){ // 都加载 - fnode = last ? "" : - (spread ? "" : ""); - }else if(nodeIcon != "-1" && leafIcon == "-1"){ // 加载node 隐藏leaf - fnode = last ? "" : - (spread ? "" : ""); - }else if(nodeIcon == "-1" && leafIcon != "-1"){ // 隐藏node 加载leaf - fnode = last ? "" : - (spread ? "" : ""); - }else if(nodeIcon == "-1" && leafIcon == "-1"){ // 都隐藏 - fnode = last ? "" : - (spread ? "" : ""); - } - if(fnode != ""){_this.getNodeDom($div).fnode().replaceWith($(fnode));} - }, - node: function(iconClass) { // 二级图标样式 - var snode = ""; - - // 获取图标的变量 - var nodeIcon = _this.nodeIcon, - leafIcon = _this.leafIcon; - - var sleafIconLeaf = _this.usefontStyle.snode.leaf, - snodeIconOpen = _this.usefontStyle.snode.node.open, - snodeIconClose = _this.usefontStyle.snode.node.close; - if(iconClass){ - var iconfont = _this.iconfont; - if(typeof iconfont === 'string') { - sleafIconLeaf = iconfont + " " + iconClass; - snodeIconOpen = iconfont + " " + iconClass; - snodeIconClose = iconfont + " " + iconClass; - } else { - sleafIconLeaf = iconfont[0] + " " + iconClass; - snodeIconOpen = iconfont[0] + " " + iconClass; - snodeIconClose = iconfont[0] + " " + iconClass; - } - } - - if(nodeIcon != "-1" && leafIcon != "-1"){ // 都加载 - snode = last ? "" : - (spread ? "" : ""); - }else if(nodeIcon != "-1" && leafIcon == "-1"){ // 加载node 隐藏leaf - snode = last ? "" : - (spread ? "" : ""); - }else if(nodeIcon == "-1" && leafIcon != "-1"){ // 隐藏node 加载leaf - snode = last ? "" : - (spread ? "" : ""); - }else if(nodeIcon == "-1" && leafIcon == "-1"){ // 都隐藏 - snode = last ? "" : - (spread ? "" : ""); - } - if(snode != ""){_this.getNodeDom($div).snode().replaceWith($(snode));} - }, - checkbox: function(checkArr) { // 复选框 - var flag = false; - if(_this.checkbarLoad == "node"){if (checkbar) {flag = true;}} else {if (last) {if (checkbar) {flag = true;}}} - - if(flag){ - var result = "
                                "; - if(checkArr && checkArr.length > 0){ - - for (var i = 0; i < checkArr.length; i++) { - var checkData = checkArr[i]; - var checked = checkData[_this.response.checked]; - var type = checkData[_this.response.type]; - var CHOOSE_CLASS = _this.usefontStyle.checkbox.out; - if (checked == "2") { //半选择 - CHOOSE_CLASS = _this.usefontStyle.checkbox.noall + " " + _this.style.chs; - } else if (checked == "1") { //选择 - CHOOSE_CLASS = _this.usefontStyle.checkbox.on + " " + _this.style.chs; - } else { //未选择或者无值 - CHOOSE_CLASS = _this.usefontStyle.checkbox.out; - } - var disClass = ""; - if(disabled){disClass = NAV_DIS;} - result += ""; - } - } - result += "
                                "; - _this.getNodeDom($div).snode().next("div").replaceWith($(result)); - } - }, - text: function(title) { // 文字显示 - var disClass = ""; - if(disabled){disClass = NAV_DIS;} - var cite = ""+title+"" - _this.getNodeDom($div).cite().replaceWith($(cite)); - }, - ul: function() { //子节点ul - var ul = last ? "
                                  " : - (spread ? "
                                    " : "
                                      "); - _this.getNodeDom($div).nextUl().replaceWith($(ul)); - }, - div: function(){ - $div.attr("data-id", treeId); - }, - basicData: function(basicData){ - basicData = (basicData == "{}") ? "" : basicData; - $div.attr("data-basic", basicData); - }, - recordData: function(recordData){ - recordData = (recordData == "{}") ? "" : recordData; - $div.attr("data-record", recordData); - }, - p_li: function(pId){ - var $li = $div.parent("li"); - $li.attr("data-id", treeId); - if(pId) { - $li.attr("data-pid", pId); - } - return $li; - } - }; - - }; - - /** - * @Desc: 获取拼接好的li的dom - * @Param: treeId: 节点ID - * @Param: parentId: 节点父ID - * @Param: title: 节点标题 - * @Param: fmtTitle: 节点附加标题 - * @Param: last: 是否最后一级节点 - * @Param: ficonClass: 一级图标class - * @Param: iconClass: 二级图标class - * @Param: checkArr: 复选框 - * @Param: level: 当前li的层级 - * @Param: spread: 是否展开 - * @Param: disabled: 是否禁用 - * @Param: hide: 是否隐藏 - * @Param: basicData: 自定义的扩展字段值(转义后的JSON字符) - * @Param: recordData: 开启记录模式的记录值(转义后的JSON字符) - * @Param: isRoot: 当前节点是否是根节点下的节点 - */ - DTree.prototype.getLiItemDom = function(treeId, parentId, title, fmtTitle, last, ficonClass, iconClass, checkArr, level, spread, disabled, hide, basicData, recordData, isRoot) { - var _this = this, - rootId = _this.obj[0].id; - - var dom = _this.getDom(treeId, parentId, title, fmtTitle, last, ficonClass, iconClass, checkArr, level, spread, disabled, hide); - basicData = (basicData == "{}") ? "" : basicData; - recordData = (recordData == "{}") ? "" : recordData; - var div = "
                                      " + - div , - dom.fnode(), - dom.node(), - dom.checkbox(), - dom.text(), - "
                                      ", dom.ul(), ""].join(""); - - return li; - }; - - /** - * @Desc: 初始化节点,用于数据回显 - * @Param: chooseId: 节点ID - */ - DTree.prototype.dataInit = function(chooseId){ - var _this = this; - var $div = _this.obj.find("div[data-id='"+chooseId+"']"); - if($div && $div.length > 0) { - _this.obj.find("."+NAV_THIS).removeClass(NAV_THIS); - _this.obj.find("."+_this.style.itemThis).removeClass(_this.style.itemThis); - $div.addClass(NAV_THIS); - $div.addClass(_this.style.itemThis); - _this.setNodeParam($div); - // 将该节点的父节点全部展开 - var $li_parents = $div.parents("."+LI_NAV_ITEM); - $li_parents.children("ul").addClass(NAV_SHOW); - $li_parents.children("."+LI_DIV_ITEM).children("i[data-spread]."+event.trimToDot(_this.usefontStyle.fnode.node.close)).addClass(_this.usefontStyle.fnode.node.open); - $li_parents.children("."+LI_DIV_ITEM).children("i[data-spread]."+event.trimToDot(_this.usefontStyle.fnode.node.close)).removeClass(_this.usefontStyle.fnode.node.close); - $li_parents.children("."+LI_DIV_ITEM).children("i[data-spread]."+event.trimToDot(_this.usefontStyle.snode.node.close)).addClass(_this.usefontStyle.snode.node.open); - $li_parents.children("."+LI_DIV_ITEM).children("i[data-spread]."+event.trimToDot(_this.usefontStyle.snode.node.close)).removeClass(_this.usefontStyle.snode.node.close); - } - return _this.getNowParam(); - }; - - /** - * @Desc: 基于备份的Html数据回滚 - * @Param: chooseId: 节点ID - */ - DTree.prototype.rollbackHtml = function(chooseId){ - var _this = this; - if(_this.bak) { - _this.obj.html(_this.bak); - // 取消全部选中状态 - _this.cancelNavThis(); - if(_this.checkbar) { - _this.cancelCheckedNode(); - _this.chooseDataInit(chooseId); - } else { - _this.dataInit(chooseId); - } - - _this.bak = _this.obj.html(); - } - }; - - - /******************** 基础事件区域 ********************/ - /** - * @Desc: 数据格式化 - * @Param: html: 需要格式化的数据 - */ - DTree.prototype.escape = function(html){ - return event.escape(html); - }; - - /** - * @Desc: 格式化数据转回正常数据 - * @Param: str: 需要转回的数据 - */ - DTree.prototype.unescape = function(str){ - return event.unescape(str); - }; - - /** - * @Desc: 取消选中当前选中的div - */ - DTree.prototype.cancelNavThis = function(){ - var _this = this; - _this.obj.find("div[data-id]").parent().find("."+NAV_THIS).removeClass(NAV_THIS); - _this.obj.find("div[data-id]").parent().find("."+_this.style.itemThis).removeClass(_this.style.itemThis); - } - - /** - * @Desc: 选中div - * @Param: id: 当前div本身 / 当前选中div的id值 - */ - DTree.prototype.navThis = function(id){ - var _this = this; - var $div = (typeof id === 'object') ? id : (_this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']").length == 0) ? null : _this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']"); - if($div != null) { - _this.cancelNavThis(); - $div.addClass(NAV_THIS); - $div.addClass(_this.style.itemThis); - } - } - - /** - * @Desc: 手风琴模式操作其他节点 - * @Param: $ul: JQuery对象,表示dtree中的ul节点 - */ - DTree.prototype.accordionUL = function($ul) { - var _this = this; - if(_this.accordion) { - $ul.closest("li[data-index]").siblings("li[data-index]").children("ul[data-id]").removeClass(NAV_SHOW); - var $divs = $ul.closest("li[data-index]").siblings("li[data-index]").children("ul[data-id]").prev("div"); - if($divs.length && $divs.length > 0) { - for (var i=0; i<$divs.length; i++) { - var $div = $($divs[i]); - var $i_fnode = _this.getNodeDom($div).fnode(), - $i_snode = _this.getNodeDom($div).snode(); - if($i_fnode.attr("data-spread") != 'last'){ - _this.operateIcon($i_fnode, $i_snode).close(); - } - } - } - - } - }; - - /** - * @Desc: 展开或隐藏节点 作用点: div - * @Param: $div: JQuery对象,表示当前操作的div节点 - */ - DTree.prototype.clickSpread = function($div) { - var _this = this; - var $i_fnode = _this.getNodeDom($div).fnode(), - $i_snode = _this.getNodeDom($div).snode(), - $cite = _this.getNodeDom($div).cite(), - spread = $i_fnode.attr("data-spread"), - $ul = $div.next("ul"); - - if ($ul.length > 0) { - if (spread == "close") { - if (_this.type=="load") { //增加加载 - if (_this.cache) { //开启缓存 - if ($ul.html()) { - $ul.addClass(NAV_SHOW); - _this.accordionUL($ul); - } else { //加载节点 - _this.getChild($div); - _this.accordionUL($ul); - } - }else { //每次取新的数据 - $ul.html(""); - _this.getChild($div); - _this.accordionUL($ul); - } - } else { // 全量加载 - $ul.addClass(NAV_SHOW); - _this.accordionUL($ul); - } - _this.operateIcon($i_fnode, $i_snode).open(); - } else if (spread == "open") { - $ul.removeClass(NAV_SHOW); - _this.operateIcon($i_fnode, $i_snode).close(); - } - } - }; - - /** - * @Desc: 设置节点为disabled - * @Param: disabledIds: 需要设置禁用的节点id字符串集合(用,分割)/id数组 - */ - DTree.prototype.setDisabledNodes = function(disabledIds){ - var _this = this; - var disabledId = []; - if(typeof disabledIds === "string") { - disabledId = disabledIds.split(","); - } else { - disabledId = disabledIds; - } - - if(disabledIds.length) { - for (var i=0; i 0) { - _this.getChild($div, data); - } else { - var parseData = _this.parseData(data); - - if(parseData.treeId()){ - var level = parseInt($div.parent("li").attr("data-index"))+1; - $ul.append(_this.getLiItemDom(parseData.treeId(), parseData.parentId(), parseData.title(), parseData.fmtTitle(), parseData.last(0), parseData.ficonClass(), parseData.iconClass(), parseData.checkArr(), level, parseData.spread(), parseData.disabled(), parseData.hide(), parseData.basicData(), parseData.recordData(), "item")); - - // 建造完毕后,选中该DIV - $thisDiv = $ul.find("div[data-id='"+parseData.treeId()+"']"); - _this.setNodeParam($thisDiv); - - _this.showLine($ul.find("li")); - } else { - layer.msg("添加失败,节点ID为undefined!",{icon:5}); - // 重新赋值 - _this.setNodeParam($div); - } - } - } else { - _this.getChild($div); - } - } - - /** - * @Desc: 局部刷新树--编辑当前节点选中节点时 - * @Param: $div: JQuery对象,当前编辑节点的Div - * @Param: data: 当前需要渲染的数据,JSON对象、字符串 - */ - DTree.prototype.partialRefreshEdit = function($div, data){ - var _this = this; - $ul = $div.next("ul"), - $p_li = $div.parent("li"); - - if(data) { - if(typeof data === 'object') { - var parseData = _this.parseData(data); - - if(parseData.treeId()){ - var replaceDom = _this.replaceDom($div, parseData.treeId(), parseData.last(0), parseData.spread(), parseData.disabled(), parseData.hide()); - replaceDom.div(); - replaceDom.node(parseData.iconClass()); - replaceDom.checkbox(parseData.checkArr()); - replaceDom.text(parseData.title()); - replaceDom.ul(); - replaceDom.basicData(parseData.basicData()); - replaceDom.recordData(parseData.recordData()); - - var parentId = parseData.parentId(); - var oldParentId = $p_li.attr("data-pid"); - if(parentId && parentId != oldParentId) { - // 变更了父节点 - $p_li = replaceDom.p_li(parentId); - - // 根据parentId找到下挂节点的ul - var $goto_div = _this.getNodeDom(parentId).div(), - $goto_ul = _this.getNodeDom(parentId).nextUl(); - // 判断父级ul中是否还存在li,如果不存在,则需要修改节点的样式 - if($goto_ul.children("li").length == 0){ - var $icon_i = $goto_div.find("i[data-spread]"); - _this.operateIcon($icon_i.eq(0), $icon_i.eq(1)).openWithLeaf(); - $goto_ul.addClass(NAV_SHOW); - } - $goto_ul.append($p_li); - } else { - replaceDom.p_li(); - } - _this.setNodeParam($div); - } else { - layer.msg("编辑失败,节点ID为undefined!",{icon:5}); - // 重新赋值 - _this.setNodeParam($div); - } - } else { - _this.getNodeDom($div).cite().html(data); - } - } - } - - /** - * @Desc: 局部刷新树--当前节点选中被删除时 - * @Param: $div: JQuery对象,当前被删除节点的Div - */ - DTree.prototype.partialRefreshDel = function($div){ - var _this = this; - $p_li = $div.parent("li"); - $p_ul = _this.getNodeDom($div).parentUl(); - $p_div = _this.getNodeDom($div).parentDiv(); - - $p_li.remove(); - _this.showLine($p_ul.find("li")); - // 判断父级ul中是否还存在li,如果不存在,则需要修改节点的样式 - if($p_ul.children("li").length == 0){ - var $icon_i = $p_div.find("i[data-spread]"); - _this.operateIcon($icon_i.eq(0), $icon_i.eq(1)).closeWithLeaf(); - } - _this.initNodeParam(); - } - - /*** - * @Desc: 搜索节点,保留上级节点 - * @param: value: 传入的节点名称 - * layui-dtree群友: 没水平的水瓶提供。 - */ - DTree.prototype.fuzzySearch = function (value) { - var _this = this; - // - if (value.trim() == '') { - _this.obj.find("li").removeClass("layui-hide").attr("dtree-hide", false) - return - } - _this.obj.find("li").addClass("layui-hide").attr("dtree-hide", true) - - var cites = [] - var filterMode = _this.filterMode - /*if (filterMode == 'default') { - cites = _this.obj.find("li>div cite:contains('" + value + "')"); - }*/ - cites = _this.obj.find("li>div cite:contains('" + value + "')"); - cites.each(function (index, cite) { - var li = $(cite).parent().parent(); - var curNode = _this.getParam(li.attr("data-id")); - li.removeClass("layui-hide").attr("dtree-hide", false); - // 显示所有子级 - li.find('ul li').removeClass("layui-hide").attr("dtree-hide", false); - // 显示所有父级 - li.parents('li').removeClass("layui-hide").attr("dtree-hide", false); - }) - } - - /******************** 复选框区域 ********************/ - /** - * @Desc: 初始化复选框的值 - * @Param: chooseIds: 需要被选中的节点id字符串集合(用,分割)/id数组/id二维数组(多级复选框) - */ - DTree.prototype.chooseDataInit = function(chooseIds){ - var _this = this; - // 多级复选框二维数组 - var chooseIdArrs = []; - var chooseId = []; - if(typeof chooseIds === "string") { - chooseId = chooseIds.split(","); - } else { - chooseId = chooseIds; - } - if(chooseId.length) { - // 说明是数组 - for (var i=0; i."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - _this.checkStatus($child_li_i).noCheck(); - - // 处理父级节点的选中状态 - for (var i = 1, item = $parent_li; i < item.length; i++) { - var flag = item.eq(i).find(">."+LI_NAV_CHILD+" ."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"'][data-checked='1']").length; - if (flag == 0) { - //把父级去掉选中 - var $item_i = item.eq(i).find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - _this.checkStatus($item_i).noCheck(); - } - } - } else { - // 处理当前节点的选中状态 - _this.checkStatus($i).check(); - - // 处理子级节点的选中状态 - var $child_li_i = $child_li.find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - _this.checkStatus($child_li_i).check(); - - // 处理父级节点的选中状态 - for (var i = 1, item = $parent_li; i < item.length; i++) { - var $item_i = item.eq(i).find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - //把父级选中 - _this.checkStatus($item_i).check(); - } - } - }; - - /** - * @Desc: 实现复选框点击, no-all 子集选中父级半选中,子集全选父级选中 - * @Param: $i: JQuery对象,表示当前点击的checkbox节点 - */ - DTree.prototype.checkAllOrNoallOrNot = function($i) { - var _this = this; - //$i 当前点击的checkbox - var $div = $i.closest("."+LI_DIV_ITEM), - dataPar = $i.attr("data-par"), - dataType = $i.attr("data-type"), - $li = $i.closest(dataPar), //当前checkbox的上级li节点 - $parent_li = $i.parents(dataPar), //当前checkbox的所有父级li节点 - $child_li = $li.find(dataPar); //当前checkbox的上级li节点下的所有子级li节点 - - if ($i.attr("data-checked") == "1") { //当前复选框为选中状态,点击后变为未选中状态 - // 处理当前节点的选中状态 - _this.checkStatus($i).noCheck(); - - // 处理子级节点的选中状态 - var $child_li_i = $child_li.find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - _this.checkStatus($child_li_i).noCheck(); - - // 处理父级节点的选中状态 - for (var i = 1, item = $parent_li; i < item.length; i++) { - var flag = item.eq(i).find(">."+LI_NAV_CHILD+" ."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"'][data-checked='1']").length; - var $item_i = item.eq(i).find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - if (flag == 0) { - //把父级去掉选中 - _this.checkStatus($item_i).noCheck(); - } else { - //把父级半选 - _this.checkStatus($item_i).noallCheck(); - } - } - } else { //当前复选框为未选中状态,点击后变为选中状态 - // 处理当前节点的选中状态 - _this.checkStatus($i).check(); - - // 处理子级节点的选中状态 - var $child_li_i = $child_li.find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - _this.checkStatus($child_li_i).check(); - - // 处理父级节点的选中状态 - for (var i = 1, item = $parent_li; i < item.length; i++) { - var flag1 = item.eq(i).find(">."+LI_NAV_CHILD+" ."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"'][data-checked='1']").length; - var flag2 = item.eq(i).find(">."+LI_NAV_CHILD+" ."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']").length; - var $item_i = item.eq(i).find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - if (flag1 != flag2) { - // 父级复选框半选 - _this.checkStatus($item_i).noallCheck(); - } else { - // 父级复选框全选 - _this.checkStatus($item_i).check(); - } - } - } - }; - - /** - * @Desc: 实现复选框点击,p-casc:父级选中子集全选,子集无法改变父级选中状态 - * @Param: $i: JQuery对象,表示当前点击的checkbox节点 - */ - DTree.prototype.checkAllOrPcascOrNot = function($i) { - var _this = this; - //$i 当前点击的checkbox - var $div = $i.closest("."+LI_DIV_ITEM), - dataPar = $i.attr("data-par"), - dataType = $i.attr("data-type"), - $li = $i.closest(dataPar), //当前checkbox的上级li节点 - $parent_li = $i.parents(dataPar), //当前checkbox的所有父级li节点 - $child_li = $li.find(dataPar); //当前checkbox的上级li节点下的所有子级li节点 - - if ($i.attr("data-checked") == "1") { //当前复选框为选中状态,点击后变为未选中状态 - // 处理当前节点的选中状态 - _this.checkStatus($i).noCheck(); - - // 处理子级节点的选中状态 - var $child_li_i = $child_li.find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - _this.checkStatus($child_li_i).noCheck(); - - } else { //当前复选框为未选中状态,点击后变为选中状态 - // 处理当前节点的选中状态 - _this.checkStatus($i).check(); - - // 处理子级节点的选中状态 - var $child_li_i = $child_li.find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - _this.checkStatus($child_li_i).check(); - } - }; - - /** - * @Desc: 实现复选框点击,self:各自选中互不影响 - * @Param: $i: JQuery对象,表示当前点击的checkbox节点 - */ - DTree.prototype.checkOrNot = function($i) { - var _this = this; - //$i 当前点击的checkbox - var $div = $i.closest("."+LI_DIV_ITEM), - dataPar = $i.attr("data-par"), - dataType = $i.attr("data-type"), - $li = $i.closest(dataPar), //当前checkbox的上级li节点 - $parent_li = $i.parents(dataPar), //当前checkbox的所有父级li节点 - $child_li = $li.find(dataPar); //当前checkbox的上级li节点下的所有子级li节点 - - if ($i.attr("data-checked") == "1") { //当前复选框为选中状态,点击后变为未选中状态 - // 处理当前节点的选中状态 - _this.checkStatus($i).noCheck(); - } else { //当前复选框为未选中状态,点击后变为选中状态 - // 处理当前节点的选中状态 - _this.checkStatus($i).check(); - } - }; - - /** - * @Desc: 实现复选框点击,only:只能选中1个复选框 - * @Param: $i: JQuery对象,表示当前点击的checkbox节点 - */ - DTree.prototype.checkOnly = function($i) { - var _this = this; - //$i 当前点击的checkbox - var $div = $i.closest("."+LI_DIV_ITEM), - dataPar = $i.attr("data-par"), - dataType = $i.attr("data-type"), - $li = $i.closest(dataPar), //当前checkbox的上级li节点 - $parent_li = $i.parents(dataPar), //当前checkbox的所有父级li节点 - $child_li = $li.find(dataPar); //当前checkbox的上级li节点下的所有子级li节点 - - var checked = $i.attr("data-checked"); - // 将全部节点全部设为未选中状态 - var $all_i = _this.obj.find("i[data-checked]"); - _this.checkStatus($all_i).noCheck(); - - if (checked != "1") { //当前复选框为未选中状态,点击后变为选中状态 - // 处理当前节点的选中状态 - _this.checkStatus($i).check(); - } - }; - - /** - * @Desc: 实现复选框点击汇总,分派具体的点击方式 - * @Param: $i: JQuery对象,表示当前点击的checkbox节点 - */ - DTree.prototype.changeCheck = function($i) { - var _this = this; - var temp = _this.temp; - if(typeof $i === 'undefined') { - $i = temp[0]; - } - // 复选框选中事件 - if (_this.checkbarType == "all") { - _this.checkAllOrNot($i); - } else if(_this.checkbarType == "no-all") { - _this.checkAllOrNoallOrNot($i); - } else if(_this.checkbarType == "p-casc") { - _this.checkAllOrPcascOrNot($i); - } else if(_this.checkbarType == "self") { - _this.checkOrNot($i); - } else if(_this.checkbarType == "only") { - _this.checkOnly($i); - } else { - _this.checkAllOrNot($i); - } - - if(_this.select) { - // 设置复选框模式中的下拉树的值 - _this.selectCheckboxVal(); - } - - // 获取复选框选中节点的内容 - var checkbarNodes = _this.setAndGetCheckbarNodesParam(true); - - // 用户自定义想做的事情 - _this.checkbarFun.chooseDone(checkbarNodes); - layui.event.call(this, MOD_NAME, "chooseDone("+$(_this.obj)[0].id+")", {"checkbarParams": checkbarNodes}); - _this.temp = []; - }; - - /** - * @Desc: 复选框半选状态初始化设置,树节点渲染完毕后重置半选状态 - */ - DTree.prototype.initNoAllCheck = function(){ - var _this = this; - //1.获取所有选中节点 - var $is = _this.obj.find("i[data-checked='1']"); - if($is.length > 0){ - for ( var key = 0; key < $is.length; key++) { - var $i = $($is[key]), - dataPar = $i.attr("data-par"), - dataType = $i.attr("data-type"), - $li = $i.closest(dataPar), //当前checkbox的上级li节点 - $parent_li = $i.parents(dataPar), //当前checkbox的所有父级li节点 - $child_li = $li.find(dataPar); //当前checkbox的上级li节点下的所有子级li节点 - - // 处理父级节点的选中状态 - for (var i = 1, item = $parent_li; i < item.length; i++) { - var flag1 = item.eq(i).find(">."+LI_NAV_CHILD+" ."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"'][data-checked='1']").length; - var flag2 = item.eq(i).find(">."+LI_NAV_CHILD+" ."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']").length; - var $item_i = item.eq(i).find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - if (flag1 != flag2) { - // 父级复选框半选 - _this.checkStatus($item_i).noallCheck(); - } else { - // 父级复选框全选 - _this.checkStatus($item_i).check(); - } - } - } - } - }; - - /** - * @Desc: 复选框选中状态初始化设置,树节点渲染完毕后重置选中状态 - */ - DTree.prototype.initAllCheck = function(){ - var _this = this; - //1.获取所有选中节点 - var $is = _this.obj.find("i[data-checked='1']"); - if($is.length > 0){ - for ( var key = 0; key < $is.length; key++) { - var $i = $($is[key]), - dataPar = $i.attr("data-par"), - dataType = $i.attr("data-type"), - $li = $i.closest(dataPar), //当前checkbox的上级li节点 - $parent_li = $i.parents(dataPar), //当前checkbox的所有父级li节点 - $child_li = $li.find(dataPar); //当前checkbox的上级li节点下的所有子级li节点 - - // 处理父级节点的选中状态 - for (var i = 1, item = $parent_li; i < item.length; i++) { - var $item_i = item.eq(i).find(">."+LI_DIV_ITEM+">."+LI_DIV_CHECKBAR+">i[data-type='"+dataType+"']"); - // 父级复选框全选 - _this.checkStatus($item_i).check(); - } - } - } - }; - - /** - * @Desc: 设置复选框选中/未选中/半选 _this.checkStatus($i).check(); _this.checkStatus($i).noCheck(); _this.checkStatus($i).noallCheck(); - * @Param: $i: JQuery对象,表示当前点击的checkbox节点 - */ - DTree.prototype.checkStatus = function($i) { - var _this = this; - return { - check: function(){ - $i.removeClass(_this.usefontStyle.checkbox.out); - $i.removeClass(_this.usefontStyle.checkbox.noall); - $i.addClass(_this.usefontStyle.checkbox.on); - $i.addClass(_this.style.chs); - $i.attr("data-checked","1"); - }, - noCheck: function(){ - $i.removeClass(_this.usefontStyle.checkbox.noall); - $i.removeClass(_this.usefontStyle.checkbox.on); - $i.removeClass(_this.style.chs); - $i.addClass(_this.usefontStyle.checkbox.out); - $i.attr("data-checked","0"); - }, - noallCheck: function(){ - $i.removeClass(_this.usefontStyle.checkbox.out); - $i.removeClass(_this.usefontStyle.checkbox.on); - $i.addClass(_this.usefontStyle.checkbox.noall); - $i.addClass(_this.style.chs); - $i.attr("data-checked","2"); - } - } - }; - - /** - * @Desc: 设置树的复选框操作值的全部参数,并获取 - * @Param: requestParamFlag: 设置复选框返回值的数据结构, true:基于请求类型的返回对象数组, false:原始的节点返回对象数组 - */ - DTree.prototype.setAndGetCheckbarNodesParam = function(requestParamFlag) { - var _this = this; - //操作前先清空 - _this.checkbarNode = []; - // 选择所有复选框节点 - if (_this.checkbarData == "change"){ //记录变更数据 - _this.obj.find("i[data-par][dtree-disabled='false']").each(function(){ - var $i = $(this), $div = $i.closest("."+LI_DIV_ITEM); - if ($i.attr("data-checked") != $i.attr("data-initchecked")) { - if(requestParamFlag) { - _this.checkbarNode.push(_this.getRequestParam(_this.getCheckbarNodeParam($div, $i))); - } else { - _this.checkbarNode.push(_this.getCheckbarNodeParam($div, $i)); - } - } - }); - } else if (_this.checkbarData == "all"){ //记录全部数据 - _this.obj.find("i[data-par][data-checked][dtree-disabled='false']").each(function(){ - var $i = $(this), $div = $i.closest("."+LI_DIV_ITEM); - if(requestParamFlag) { - _this.checkbarNode.push(_this.getRequestParam(_this.getCheckbarNodeParam($div, $i))); - } else { - _this.checkbarNode.push(_this.getCheckbarNodeParam($div, $i)); - } - }); - } else if (_this.checkbarData == "choose"){ //记录选中数据 - _this.obj.find("i[data-par][data-checked='1'][dtree-disabled='false']").each(function(){ - var $i = $(this), $div = $i.closest("."+LI_DIV_ITEM); - if(requestParamFlag) { - _this.checkbarNode.push(_this.getRequestParam(_this.getCheckbarNodeParam($div, $i))); - } else { - _this.checkbarNode.push(_this.getCheckbarNodeParam($div, $i)); - } - }); - } else if (_this.checkbarData == "halfChoose"){ //记录选中和半选数据 - _this.obj.find("i[data-par][data-checked='1'][dtree-disabled='false']").each(function(){ - var $i = $(this), $div = $i.closest("."+LI_DIV_ITEM); - if(requestParamFlag) { - _this.checkbarNode.push(_this.getRequestParam(_this.getCheckbarNodeParam($div, $i))); - } else { - _this.checkbarNode.push(_this.getCheckbarNodeParam($div, $i)); - } - }); - _this.obj.find("i[data-par][data-checked='2'][dtree-disabled='false']").each(function(){ - var $i = $(this), $div = $i.closest("."+LI_DIV_ITEM); - if(requestParamFlag) { - _this.checkbarNode.push(_this.getRequestParam(_this.getCheckbarNodeParam($div, $i))); - } else { - _this.checkbarNode.push(_this.getCheckbarNodeParam($div, $i)); - } - }); - } - return _this.checkbarNode; - }; - - /** - * @Desc: 获取树的复选框操作值的全部参数 - */ - DTree.prototype.getCheckbarNodesParam = function() { - var _this = this; - return _this.setAndGetCheckbarNodesParam(true); - }; - - /** - * @Desc: 获取树的一个复选框的参数 - * @Param: $div: JQuery对象,表示当前选中节点 - * @Param: $i: JQuery对象,表示当前选中的复选框节点 - */ - DTree.prototype.getCheckbarNodeParam = function($div, $i){ - var _this = this; - var temp_node = {}; - temp_node.nodeId = $div.attr("data-id"); - temp_node.parentId = _this.getNodeDom($div).parentLi().attr("data-pid"); - temp_node.context = (typeof _this.formatter.title === 'function') ? _this.getNodeDom($div).cite().attr("data-title") : _this.getNodeDom($div).cite().text(); - temp_node.leaf = _this.getNodeDom($div).cite().attr("data-leaf") == "leaf" ? true : false; - temp_node.level = _this.getNodeDom($div).parentLi().attr("data-index"); - temp_node.spread = _this.getNodeDom($div).fnode().attr("data-spread") == "open" ? true : false; - - var basicData = $div.attr("data-basic"); - if(basicData) { - basicData = JSON.parse(event.unescape(basicData)); - } - temp_node.basicData = basicData; - var recordData = $div.attr("data-record"); - if(recordData) { - recordData = JSON.parse(event.unescape(recordData)); - } - temp_node.recordData = recordData; - - temp_node.dataType = $i.attr("data-type"); - temp_node.checked = $i.attr("data-checked"); - temp_node.initchecked = $i.attr("data-initchecked"); - return temp_node; - }; - - /** - * @Desc: 获取基于返回参数的树的复选框参数,选中数据横向存储 - */ - DTree.prototype.getCheckbarJsonArrParam = function(){ - var _this = this; - var checkbarJsonArr = { - nodeId: [], //节点ID - parentId: [], //父节点ID - context: [], //节点内容 - leaf: [], //是否叶子节点 - level: [], //层级 - spread: [], //节点展开状态 - dataType: [], //节点标记 - checked: [], //节点复选框选中状态 - initchecked: [], //节点复选框初始状态 - basicData: [], //用户自定义的记录节点数据 - recordData: [], //当前data数据(排除basicData和children字段) - }; - // 获取全部复选框选中节点 - var params = _this.setAndGetCheckbarNodesParam(false); - if(params && params.length > 0) { - for(var i=0; i 0) { _this.checkStatus($i).check(); } - } - - /** - * @Desc: 取消全部复选框选中 - */ - DTree.prototype.cancelCheckedNode = function(){ - var _this = this; - var $i = _this.obj.find("i[data-par][data-checked!='0']"); - if($i.length > 0) { _this.checkStatus($i).noCheck(); } - } - - /** - * @Desc: 反选复选框 - */ - DTree.prototype.invertCheckedNode = function(){ - var _this = this; - if(_this.obj.find("i[data-par]").length > 0) { - var flag = false; - _this.obj.find("i[data-par]").each(function(){ - var $i = $(this); - if($i.attr("data-checked") == '2'){ - flag = true; - }else if($i.attr("data-checked") == '0') { - _this.checkStatus($i).check(); - }else if($i.attr("data-checked") == '1') { - _this.checkStatus($i).noCheck(); - } - }); - - if(flag) { - _this.initNoAllCheck(); - } else { - _this.initAllCheck(); - } - } - } - - /** - * @Desc: 删除选中节点 - */ - DTree.prototype.removeCheckedNode = function(){ - var _this = this; - var len = _this.obj.find("i[data-par][data-checked='1']").length; - if(len == 0){ - layer.msg("请至少选中一个节点",{icon:2}); - }else{ - //操作前先清空 - _this.checkbarNode = []; - // 选择所有复选框节点 - var i_node = {}; - _this.obj.find("i[data-par][data-checked='1']").each(function(){ - var $i = $(this), $div = $i.closest("."+LI_DIV_ITEM); - - _this.checkbarNode.push(_this.getRequestParam(_this.getCheckbarNodeParam($div, $i))); - }); - - layer.confirm('确定要删除选中节点?', {icon: 3, title:'删除选中节点'}, function(index1){ - var flag = _this.menubarFun.remove(_this.checkbarNode); - if(flag){ - _this.obj.find("i[data-par][data-checked='1']").closest("."+LI_DIV_ITEM).next("ul").remove(); - _this.obj.find("i[data-par][data-checked='1']").closest("."+LI_DIV_ITEM).remove(); - _this.checkbarNode=[]; - } - - layer.close(index1); - }); - } - } - - /******************** 工具栏及菜单栏区域 ********************/ - /** - * @Desc: 初始化菜单栏和工具栏的div - */ - DTree.prototype.initTreePlus = function(){ - var _this = this; - // 初始化菜单栏和工具栏的div - _this.obj.prevAll('div#dtree_menubar_'+_this.obj[0].id).remove(); - _this.toolbarMenu = {}; - if(_this.menubar && _this.menubarTips.group && _this.menubarTips.group.length > 0) _this.obj.before("
                                      "); - if(_this.toolbar){ - if(_this.toolbarWay == "contextmenu") { - _this.obj.prevAll('div#dtree_toolbar_'+_this.obj[0].id).remove(); - if(_this.toolbarShow && _this.toolbarShow.length > 0) { - _this.obj.before("
                                      "); - } - } - } - - }; - - /** - * @Desc: 开启工具栏和菜单栏 - */ - DTree.prototype.openTreePlus = function(){ - var _this = this; - // 先对工具栏做处理,因为菜单栏可能会与工具栏产生关联。 - var ggMenu = []; - if(_this.toolbar) _this.getToolbarDom(); - - if(_this.menubar) { - var menubarTips = _this.menubarTips, - mtbar = menubarTips.toolbar, - group = menubarTips.group, - freedom = menubarTips.freedom; - if(mtbar && mtbar.length > 0){ - // 菜单栏吸附工具栏上 - for(var i=0; i 0){ - // 菜单栏吸附在上方的按钮组div中 - for(var i=0; i"; - break; - case defaultMenu.moveUp: - gg = ""; - break; - case defaultMenu.refresh: - gg = ""; - break; - case defaultMenu.checkAll: - gg = (_this.checkbar && _this.checkbarType != 'only') ? "" : ""; - break; - case defaultMenu.unCheckAll: - gg = (_this.checkbar && _this.checkbarType != 'only') ? "" : ""; - break; - case defaultMenu.invertAll: - gg = (_this.checkbar && _this.checkbarType != 'only') ? "" : ""; - break; - case defaultMenu.remove: - gg = (_this.checkbar) ? "" : ""; - break; - case defaultMenu.searchNode: - gg = ""; - break; - } - return gg; - }; - - /** - * @Desc: 获取扩展菜单栏 - * @Param: menu: 扩展菜单栏的Json对象 - */ - DTree.prototype.getExtMenubarDom = function(menu){ - var _this = this; - return ""; - }; - - /** - * @Desc: 获取依附在工具栏的菜单栏 - * @Param: menu: 菜单栏的具体操作字符串 - */ - DTree.prototype.getMenubarToolDom = function(menu){ - var _this = this; - var rootId = _this.obj[0].id; - switch (menu) { - case defaultMenu.moveDown: - _this.toolbarMenu[defaultMenu.moveDown] = _this.setToolbarDom().setMenuToolbarOption(defaultMenu.moveDown, _this.toolbarStyle.title, _this.usefontStyle.toolbar.menubar.movedown, "展开全部"); - break; - case defaultMenu.moveUp: - _this.toolbarMenu[defaultMenu.moveUp] = _this.setToolbarDom().setMenuToolbarOption(defaultMenu.moveUp, _this.toolbarStyle.title, _this.usefontStyle.toolbar.menubar.moveup, "收缩全部"); - break; - case defaultMenu.refresh: - _this.toolbarMenu[defaultMenu.refresh] = _this.setToolbarDom().setMenuToolbarOption(defaultMenu.refresh, _this.toolbarStyle.title, _this.usefontStyle.toolbar.menubar.refresh, "刷新"); - break; - case defaultMenu.checkAll: - if(_this.checkbar && _this.checkbarType != 'only') - _this.toolbarMenu[defaultMenu.checkAll] = _this.setToolbarDom().setMenuToolbarOption(defaultMenu.checkAll, _this.toolbarStyle.title, _this.usefontStyle.toolbar.menubar.checkAll, "全选节点"); - break; - case defaultMenu.unCheckAll: - if(_this.checkbar && _this.checkbarType != 'only') - _this.toolbarMenu[defaultMenu.unCheckAll] = _this.setToolbarDom().setMenuToolbarOption(defaultMenu.unCheckAll, _this.toolbarStyle.title, _this.usefontStyle.toolbar.menubar.unCheckAll, "全不选节点"); - break; - case defaultMenu.invertAll: - if(_this.checkbar && _this.checkbarType != 'only') - _this.toolbarMenu[defaultMenu.invertAll] = _this.setToolbarDom().setMenuToolbarOption(defaultMenu.invertAll, _this.toolbarStyle.title, _this.usefontStyle.toolbar.menubar.invertAll, "反选节点"); - break; - case defaultMenu.remove: - if(_this.checkbar) - _this.toolbarMenu[defaultMenu.remove] = _this.setToolbarDom().setMenuToolbarOption(defaultMenu.remove, _this.toolbarStyle.title, _this.usefontStyle.toolbar.menubar.remove, "删除选中"); - break; - case defaultMenu.searchNode: - _this.toolbarMenu[defaultMenu.searchNode] = _this.setToolbarDom().setMenuToolbarOption(defaultMenu.searchNode, _this.toolbarStyle.title, _this.usefontStyle.toolbar.menubar.searchNode, "查询"); - break; - } - }; - - /** - * @Desc: 获取依附在工具栏的扩展菜单栏 - * @Param: menu: 扩展菜单栏的Json对象 - */ - DTree.prototype.getExtMenubarToolDom = function(menu){ - var _this = this; - _this.toolbarMenu[menu.menubarId] = _this.setToolbarDom().setMenuToolbarOption(menu.menubarId, menu.title, _this.usefontStyle.toolbar.menubarExt+" "+menu.icon, ""); - }; - - /** - * @Desc: menubar内置方法 - */ - DTree.prototype.menubarMethod = function(){ - var _this = this; - return { - openAllNode: function(obj){ // 展开所有节点 - var $ulNode = obj || _this.obj.children("li").children("ul"); - // 遍历所有ul子节点 - for (var i = 0; i < $ulNode.length; i++) { - // 获取当前节点的信息 - var $ul = $($ulNode[i]), - $div = $ul.prev("div"), - $i_fnode = _this.getNodeDom($div).fnode(), - $i_snode = _this.getNodeDom($div).snode(), - $cite = _this.getNodeDom($div).cite(), - spread = $i_fnode.attr("data-spread"), - leaf = $cite.attr("data-leaf"); - - if (leaf == "leaf") { - continue; - } // 说明是叶子了,则继续循环下一个 - - if (spread == "open") { - // 说明该节点已经展开了,则进行子节点循环 - } else { - if (_this.type=="load") { //是否全量加载 - if (_this.cache) { //是否开启缓存 - if ($ul.html()) { - $ul.addClass(NAV_SHOW); - } else { //加载节点 - _this.getChild($div); - } - }else { //每次取新的数据 - $ul.html(""); - _this.getChild($div); - } - } else { // 全量加载 - $ul.addClass(NAV_SHOW); - } - _this.operateIcon($i_fnode, $i_snode).open(); - - } - var $childUl = $ul.children("li").children("ul"); - _this.menubarMethod().openAllNode($childUl); - } - }, - closeAllNode: function(){ //收缩所有节点 - _this.obj.find("."+LI_NAV_CHILD).each(function(){ - // 获取当前节点的信息 - var $ul = $(this), - $div = $ul.prev("div"), - $i_fnode = _this.getNodeDom($div).fnode(), - $i_snode = _this.getNodeDom($div).snode(), - $cite = _this.getNodeDom($div).cite(), - spread = $i_fnode.attr("data-spread"), - leaf = $cite.attr("data-leaf"); - - $ul.removeClass(NAV_SHOW); - if(leaf !== "leaf") { - _this.operateIcon($i_fnode, $i_snode).close(); - } - }); - }, - refreshTree: function(){// 刷新树 - _this.refreshTree(); - }, - checkAll: function(){ // 全选节点 - _this.checkAllNode(); - }, - unCheckAll: function(){ // 全不选节点 - _this.cancelCheckedNode(); - }, - invertAll: function(){ // 反选节点 - _this.invertCheckedNode(); - }, - remove: function(){// 删除选中节点 - _this.removeCheckedNode(); - }, - searchNode: function(){//模糊查询该值,展开该值节点 - layer.prompt({ - formType: 0, - value: "", - title: '查询节点' - }, function(value, index1, elem){ - if (value) { - var flag = _this.searchNode(value); - if (!flag) { - layer.msg("该名称节点不存在!", {icon:5}); - } - } else { - layer.msg("未指定查询节点名称", {icon:5}); - } - layer.close(index1); - }); - }, - extMethod: function(menuId, $div, flag){ - if(_this.menubar && _this.menubarTips.group && _this.menubarTips.group.length > 0 && flag == "group"){ - for(var i=0; i<_this.menubarTips.group.length; i++){ - var ext = _this.menubarTips.group[i]; - if (menuId == ext.menubarId){ - ext.handler(_this.getRequestParam(_this.getNodeParam($div), $div)); - break; - } - } - } - if(_this.menubar && _this.menubarTips.toolbar && _this.menubarTips.toolbar.length > 0 && flag == "toolbar"){ - for(var i=0; i<_this.menubarTips.toolbar.length; i++){ - var ext = _this.menubarTips.toolbar[i]; - if (menuId == ext.menubarId){ - ext.handler(_this.getRequestParam(_this.getNodeParam($div), $div)); - break; - } - } - } - if(_this.menubar && _this.menubarTips.freedom && _this.menubarTips.freedom.length > 0 && flag == "freedom"){ - for(var i=0; i<_this.menubarTips.freedom.length; i++){ - var ext = _this.menubarTips.freedom[i]; - if (menuId == ext.menubarId){ - ext.handler(_this.getRequestParam(_this.getNodeParam($div), $div)); - break; - } - } - } - } - }; - }; - - /** - * @Desc: menubar监听方法 - * @Param: menuId:菜单栏的具体操作字符串 - * @Param: flag:菜单栏的显示方式 - */ - DTree.prototype.menubarListener = function(menuId, flag){ - var _this = this; - var $div = _this.getNodeDom().nowDiv(); - switch (menuId) { - case defaultMenu.moveDown: // 展开全部节点 - _this.menubarMethod().openAllNode(); - break; - case defaultMenu.moveUp: // 收缩全部节点 - _this.menubarMethod().closeAllNode(); - break; - case defaultMenu.refresh: - _this.menubarMethod().refreshTree(); // 刷新树 - break; - case defaultMenu.checkAll: - _this.menubarMethod().checkAll(); - break; - case defaultMenu.unCheckAll: - _this.menubarMethod().unCheckAll(); - break; - case defaultMenu.invertAll: - _this.menubarMethod().invertAll(); - break; - case defaultMenu.remove: - _this.menubarMethod().remove(); - break; - case defaultMenu.searchNode: - _this.menubarMethod().searchNode(); - break; - default: - _this.menubarMethod().extMethod(menuId, $div, flag); - break; - } - }; - - /** - * @Desc: 模糊查询该值,展开该值节点 - * @Param: value: 模糊查询的值 - */ - DTree.prototype.searchNode = function(value){ - var _this = this; - var b = false; - var $lis = []; - _this.obj.find("cite[data-leaf]").each(function(){ - var $nthis = $(this); - var html = $nthis.html(); - if(html.indexOf(value) > -1){ - if($nthis.attr("data-leaf") == "leaf") { - // 叶子节点提供包含父节点的所有信息 - var title = ""; - $nthis.parents("li").each(function(){ - title = "-" + $(this).find("cite[data-leaf]").html() + title; - }); - title = title.substring(1, title.length); - $nthis.attr("title", title); - } - // 保存当前cite所在的li及父li中包含该值,则只保留父的 - var i = 0; - $nthis.parents("li").each(function(){ - var html2 = $(this).find("cite[data-leaf]").html(); - if(html2.indexOf(value) > -1){ - i++; - } - if(i >= 2){ - return true; - } - }); - if (i < 2){ - $lis.push($nthis.closest("li").prop("outerHTML")); - } - } - }); - if($lis.length > 0) { - b = true; - // 1.将树节点清空 - _this.obj.html(""); - // 2.遍历所有cite节点,展开当前cite节点 - for(var i=0; i<$lis.length; i++){ - _this.obj.append($lis[i]); - } - } - return b; - }; - - - /******************** 工具栏区域 ********************/ - /** - * @Desc: 获取工具栏 - */ - DTree.prototype.getToolbarDom = function(){ - var _this = this; - var toolbarShow = _this.toolbarShow, - toolbarExt = _this.toolbarExt, - toolbarWay = _this.toolbarWay; - - if(toolbarShow.length > 0){ - for(var i=0; i 0){ - for(var i=0; i "+other +title+""; - } else if(toolbarWay == "fixed" || toolbarWay == "follow") { - return ""; - } - }, - setMenuToolbarOption: function(menubarId, title, classId, other){ - var rootId = _this.obj[0].id; - if(toolbarWay == "contextmenu") { - return "
                                       "+other +title+"
                                      "; - } else if(toolbarWay == "fixed" || toolbarWay == "follow") { - return ""; - } - }, - setToolbarPlace: function(toolbarMenu){ - if(toolbarWay == "contextmenu") { - if(toolbarMenu){ - _this.obj.prevAll('div#dtree_toolbar_'+_this.obj[0].id).find('div.layui-nav-item>dl.layui-nav-child').html(""); - for(var key in toolbarMenu){ - _this.obj.prevAll('div#dtree_toolbar_'+_this.obj[0].id).find('div.layui-nav-item>dl.layui-nav-child').append(toolbarMenu[key]); - } - } - } else if(toolbarWay == "fixed" || toolbarWay == "follow") { - _this.obj.find("cite[data-leaf][dtree-disabled='false']").each(function(){ - var $cite = $(this); - _this.dynamicToolbarDom($cite); - }); - } - } - } - }; - - /** - * @Desc: 在节点后动态绑定fixed和follow条件的工具栏 - * @Param: $cite: JQuery对象,表示当前文本节点 - */ - DTree.prototype.dynamicToolbarDom = function($cite){ - var _this = this; - var toolbarWay = _this.toolbarWay; - if($cite.next("em."+TOOLBAR_TOOL_EM).length == 0) { - var $div = $cite.parent("div"); - var param = _this.getRequestParam(_this.getTempNodeParam($div)); - var toolbarMenus = _this.toolbarFun.loadToolbarBefore(event.cloneObj(_this.toolbarMenu), param, $div); - var hideCls = (toolbarWay == "follow") ? NAV_HIDE : ""; - var em = [""]; - if(toolbarMenus){ - for(var key in toolbarMenus){ - em.push(toolbarMenus[key]); - } - } - em.push(""); - $cite.after(em.join('')); - } - } - - /** - * @Desc: 隐藏toolbar - */ - DTree.prototype.toolbarHide = function() { - var _this = this; - if(_this.toolbar && _this.toolbarWay == "contextmenu") { - var $toolBarDiv = _this.obj.prevAll('div#dtree_toolbar_'+_this.obj[0].id); - $toolBarDiv.find(".layui-nav-child").removeClass('layui-anim-fadein layui-show'); - } - } - - /** - * @Desc: toolbar内置方法 - */ - DTree.prototype.toolbarMethod = function(){ - var _this = this; - return { - pulldown: function(obj){ // 展开当前点击节点的下面全部节点 - if(!obj) return; - var $ulNode = obj; - // 遍历所有ul子节点 - for (var i = 0; i < $ulNode.length; i++) { - // 获取当前节点的信息 - var $ul = $($ulNode[i]), - $div = $ul.prev("div"), - $i_fnode = _this.getNodeDom($div).fnode(), - $i_snode = _this.getNodeDom($div).snode(), - $cite = _this.getNodeDom($div).cite(), - spread = $i_fnode.attr("data-spread"), - leaf = $cite.attr("data-leaf"); - - if (leaf == "leaf") { continue; } // 说明是叶子了,则继续循环下一个 - - if (spread == "open") { - // 说明该节点已经展开了,则进行子节点循环 - } else { - if (_this.type=="load") { //是否全量加载 - if (_this.cache) { //是否开启缓存 - if ($ul.html()) { - $ul.addClass(NAV_SHOW); - } else { //加载节点 - _this.getChild($div); - } - }else { //每次取新的数据 - $ul.html(""); - _this.getChild($div); - } - } else { // 全量加载 - $ul.addClass(NAV_SHOW); - } - _this.operateIcon($i_fnode, $i_snode).open(); - - } - var $childUl = $ul.children("li").children("ul"); - _this.toolbarMethod().pulldown($childUl); - } - }, - pullup: function($li){ // 收缩当前点击节点的下面全部节点 - $li.find("."+LI_NAV_CHILD).each(function(){ - // 获取当前节点的信息 - var $ul = $(this), - $div = $ul.prev("div"), - $i_fnode = _this.getNodeDom($div).fnode(), - $i_snode = _this.getNodeDom($div).snode(), - $cite = _this.getNodeDom($div).cite(), - spread = $i_fnode.attr("data-spread"), - leaf = $cite.attr("data-leaf"); - - $ul.removeClass(NAV_SHOW); - if(leaf !== "leaf") { - _this.operateIcon($i_fnode, $i_snode).close(); - } - }); - } - } - }; - - /** - * @Desc: toolbar监听方法 - * @Param: tool: 工具栏的具体操作字符串 - * @Param: $div: JQuery对象,表示当前操作节点 - */ - DTree.prototype.toolbarListener = function(tool, $div) { - var _this = this; - var $cite = $div.children("cite[data-leaf]"), - $ul = $div.next("ul"), - $p_li = $div.parent("li[data-index]"), //当前选中节点的顶级li节点 - $p_ul = $p_li.parent("ul"), //当前选中节点的顶级li节点的父级ul - $p_div = $p_ul.prev("div"), //当前选中节点的顶级li节点的父级ul的前一个div - title = (typeof _this.formatter.title === 'function') ? $cite.attr("data-title") : $cite.text(); - - switch (tool) { - case defaultTool.pulldown: - _this.toolbarMethod().pulldown($ul); - break; - case defaultTool.pullup: - _this.toolbarMethod().pullup($p_li); - break; - case defaultTool.addTool: - var content = _this.loadToolBar(title, defaultTool.addTool); - - layer.open({ - title: "新增"+_this.toolbarStyle.title, - type: 1, - area: _this.toolbarStyle.area, - content: content, - success: function(layero, index){ - form.render(); - form.on("submit(dtree_addNode_" + _this.obj[0].id + "_form)",function(data){ - var data = data.field; - var parentId = $div.attr("data-id"), - id = $div.attr("data-id")+"_node_"+$ul[0].childNodes.length, - leaf = true, - checked = "0", - level = parseInt($p_li.attr("data-index"))+1; - - var type = _this.response.type; - var checked = _this.response.checked; - // 创建子节点的DOM,添加子节点 - var checkArr = []; - if (_this.checkArrLen > 0) { - for (var i = 0; i < _this.checkArrLen; i++) { - checkArr.push({type: i, checked: "0"}); - } - } - - $ul.append(_this.getLiItemDom(id, parentId, data.addNodeName, data.addNodeName, true, "", "", checkArr, level, false, false, false, "", "", "item")); - // 先将li节点隐藏 - $ul.find("li[data-id='"+id+"']").hide(); - // 重新赋值 - var $addDiv = $ul.find("div[data-id='"+id+"']"); - node = _this.getNodeParam($addDiv); - - //获取组装后的requestNode,组合参数 - var requestNode = _this.getRequestParam(node); - requestNode = $.extend(requestNode, data); - - _this.temp = [id, $ul, $div, level]; - // 用户自定义想做的事情 - _this.toolbarFun.addTreeNode(requestNode, $div); - - layer.close(index); - return false; - }); - } - }); - break; - case defaultTool.editTool: - var content = _this.loadToolBar(title, defaultTool.editTool); - - layer.open({ - title: "编辑"+_this.toolbarStyle.title, - type: 1, - area: _this.toolbarStyle.area, - content: content, - success: function(layero, index){ - _this.toolbarFun.editTreeLoad(_this.getRequestParam(_this.getNodeParam($div))); - form.render(); - form.on("submit(dtree_editNode_" + _this.obj[0].id + "_form)",function(data){ - var data = data.field; - $cite.html(data.editNodeName); - node = _this.getNodeParam($div); - var requestNode = _this.getRequestParam(node); - requestNode = $.extend(requestNode, data); - _this.temp = [$cite, $div, title, $p_div]; - _this.toolbarFun.editTreeNode(requestNode, $div); - - layer.close(index); - }); - } - }); - break; - case defaultTool.delTool: - layer.confirm('确定要删除该'+_this.toolbarStyle.title+'?', {icon: 3, title:'删除'+_this.toolbarStyle.title}, function(index){ - var node = _this.getNodeParam($div); - _this.temp = [$p_li, $p_div]; - _this.toolbarFun.delTreeNode(_this.getRequestParam(_this.getNodeParam($div)), $div); - - layer.close(index); - }); - break; - default: - if(_this.toolbarExt.length > 0){ - for(var i=0; i<_this.toolbarExt.length; i++){ - var ext = _this.toolbarExt[i]; - if (tool == ext.toolbarId){ - ext.handler(_this.getRequestParam(_this.getNodeParam($div)), $div); - break; - } - } - } - break; - } - } - - - /** - * @Desc: 加载toolbar中的内容 - * @Param: title: 默认操作中的input输入框的值 - * @Param: name: 工具栏的具体操作字符串 - */ - DTree.prototype.loadToolBar = function(title, name){ - var _this = this; - var toolbarShow = _this.toolbarShow; - var nodeBarContents = _this.toolbarBtn; - - var html = ""; - switch (name) { - case defaultTool.addTool: - var addNodeBarDef = [{"label": "当前选中", "name": "nodeTitle", "type": "text", "value": title, "defElem": "nowChoose", "readonly": true}, - {"label": "新增"+_this.toolbarStyle.title, "name": "addNodeName", "type": "text", "value": "", "defElem": "nowChange", "verify": "required"}, - {"type": "submit", "value": "确认添加", "defElem": "btn", "filter": "dtree_addNode_" + _this.obj[0].id + "_form"}]; - - //2. 用户自定义的节点内容 - var addNodeBar = ['
                                      ']; - - if(nodeBarContents != null && nodeBarContents.length > 0){ - if(nodeBarContents[0] != null && nodeBarContents[0] != undefined && nodeBarContents[0].length > 0){ - var addNodeBarContents = nodeBarContents[0]; - // 1. 检查是否包含了now、newly、btn这三个默认项,将其他元素依次排列,将特殊元素至于栈顶 - for(var i=0; i', '
                                      ']; - // 3.遍历生成按钮 - for(var j=0; j
                                      '); - addNodeBar.push(addBtn.join('')); - addNodeBar.push('
                                      '); - html = addNodeBar.join(''); - break; - - case defaultTool.editTool: - var editNodeBarDef = [{"label": "当前选中", "name": "nodeTitle", "type": "text", "value": title, "defElem": "nowChoose", "readonly": true}, - {"label": "编辑"+_this.toolbarStyle.title, "name": "editNodeName", "type": "text", "value": "", "defElem": "nowChange", "verify": "required"}, - {"type": "submit", "value": "确认编辑", "defElem": "btn", "filter": "dtree_editNode_" + _this.obj[0].id + "_form"}]; - - var editNodeBar = ['
                                      ']; - //2. 用户自定义的节点内容 - if(nodeBarContents != null && nodeBarContents.length > 0){ - - if(nodeBarContents[1] != null && nodeBarContents[1] != undefined && nodeBarContents[1].length > 0){ - var editNodeBarContents = nodeBarContents[1]; - // 1. 检查是否包含了now、newly、btn这三个默认项,将其他元素依次排列,将特殊元素至于栈顶 - for(var i=0; i', '
                                      ']; - // 3.遍历生成按钮 - for(var j=0; j
                                      '); - editNodeBar.push(editBtn.join('')); - editNodeBar.push('
                                      '); - html = editNodeBar.join(''); - break; - } - return html; - }; - - /** - * @Desc: 获取toolbar详细的标签信息 - * @Param: nodeBarContents: 工具栏中的数据渲染内容JSON对象 - */ - DTree.prototype.loadToolBarDetail = function(nodeBarContents){ - var _this = this; - var readonly = (typeof (nodeBarContents.readonly) === "boolean") ? nodeBarContents.readonly : false; - var disabled = (typeof (nodeBarContents.disabled) === "boolean") ? nodeBarContents.disabled : false; - var id = nodeBarContents.id ? nodeBarContents.id : ""; - var name = nodeBarContents.name ? nodeBarContents.name : ""; - var val = nodeBarContents.value ? nodeBarContents.value : ""; - var verify = nodeBarContents.verify ? nodeBarContents.verify : ""; - var placeholder = nodeBarContents.placeholder ? nodeBarContents.placeholder : val; - return{ - text: function(){ - return ['
                                      ', - '', - '
                                      ', - '', - '
                                      ', - '
                                      '].join(''); - }, - textarea: function(){ - return ['
                                      ', - '', - '
                                      ', - '', - '
                                      ', - '
                                      '].join(''); - }, - hidden: function(){ - return [''].join(''); - }, - select: function(){ - var optionsData = (typeof nodeBarContents.optionsData === 'object') ? nodeBarContents.optionsData : nodeBarContents.optionsData(); - var options = ""; - for(var key in optionsData){ - if(val == optionsData[key]){ - options += ""; - } else { - options += ""; - } - } - return ['
                                      ', - '', - '
                                      ', - '', '
                                      ', '
                                      '].join(''); - }, - submit: function(){ - var filter = nodeBarContents.filter; - return [''].join(''); - }, - button: function(){ - return [''].join(''); - }, - reset: function(){ - return [''].join(''); - } - } - }; - - /** - * @Desc: 新增节点后改变节点内容 - * @Param: returnID: 当前需要加载的内容,JSON对象、字符串、指定字符串("refresh")、true - */ - DTree.prototype.changeTreeNodeAdd = function(returnID){ - var _this = this; - var temp = _this.temp; - var id = temp[0], $ul = temp[1], $div = temp[2], level = temp[3]; - var flag = false; - if(returnID){ - var $thisDiv = _this.obj.find("[data-id='"+id+"']"); - if(typeof returnID === "object"){ - // 如果是JSON格式数据,则将当前DIV删除,重新建造DIV - $thisDiv.remove(); - var parseData = _this.parseData(returnID); - - if(parseData.treeId()){ - $ul.append(_this.getLiItemDom(parseData.treeId(), parseData.parentId(), parseData.title(), parseData.fmtTitle(), parseData.last(0), parseData.ficonClass(), parseData.iconClass(), parseData.checkArr(), level, parseData.spread(), parseData.disabled(), parseData.hide(), parseData.basicData(), parseData.recordData(), "item")); - - // 建造完毕后,选中该DIV - $thisDiv = $ul.find("div[data-id='"+parseData.treeId()+"']"); - _this.setNodeParam($thisDiv) - } else { - layer.msg("添加失败,节点ID为undefined!",{icon:5}); - // 将li节点删除 - $ul.find("li[data-id='"+id+"']").remove(); - // 重新赋值 - _this.setNodeParam($div); - // 临时变量制空 - _this.temp = []; - return ; - } - }else if(returnID == 'refresh' || returnID == true){ - // 如果是设置为refresh参数,则向后台发送请求,获取新增节点下的真实参数,局部刷新树。 - flag = true; - } else if(typeof returnID === "string" || typeof returnID === 'number'){ - $thisDiv.attr("data-id", returnID); - // 将li节点展示 - $ul.find("li[data-id='"+returnID+"']").show(); - _this.setNodeParam($thisDiv) - } - - // 判断当前点击的节点是否是最后一级节点,如果是,则需要修改节点的样式 - var $icon_i = $div.find("i[data-spread]"); - if ($icon_i.eq(0).attr("data-spread") == "last") { - _this.operateIcon($icon_i.eq(0), $icon_i.eq(1)).openWithLeaf(); - } else { //如果不是,也要修改节点样式 - _this.operateIcon($icon_i.eq(0), $icon_i.eq(1)).open(); - } - $ul.addClass(NAV_SHOW); //展开UL - _this.accordionUL($ul); - if(flag) { - _this.getChild($div); - } else { - // _this.showLine(); - _this.showLine($ul.find("li")); - // 这种情况下需要在新增节点后对节点新增工具栏 - if(_this.toolbar && _this.toolbarWay != 'contextmenu') { - _this.dynamicToolbarDom($thisDiv.find("cite[data-leaf]")); - } - } - - } else { - // 将li节点删除 - $ul.find("li[data-id='"+id+"']").remove(); - // 重新赋值 - _this.setNodeParam($div); - } - - _this.temp = []; // 临时变量制空 - - }; - - /** - * @Desc: 编辑页打开后显示编辑页内容 - * @Param: param: 编辑页打开之后回显的数据集 - */ - DTree.prototype.changeTreeNodeDone = function(param){ - var _this = this; - form.val('dtree_editNode_' + _this.obj[0].id + '_form', param); - form.render(); - }; - - /** - * @Desc: 修改节点后改变节点内容 - * @Param: returnID: 当前需要变更的内容,JSON对象 - */ - DTree.prototype.changeTreeNodeEdit = function(returnID){ - var _this = this; - var temp = _this.temp; - var $cite = temp[0], $div = temp[1], title = temp[2], $p_div = temp[3]; - var flag = false; - if(returnID){ - if(typeof returnID === "object"){ - var parseData = _this.parseData(data); - - if(parseData.treeId()){ - var replaceDom = _this.replaceDom($div, parseData.treeId(), parseData.last(0), parseData.spread(), parseData.disabled(), parseData.hide()); - replaceDom.node(parseData.iconClass()); - replaceDom.checkbox(parseData.checkArr()); - replaceDom.text(parseData.title()); - replaceDom.ul(); - replaceDom.basicData(parseData.basicData()); - replaceDom.recordData(parseData.recordData()); - _this.setNodeParam($div); - } else { - layer.msg("编辑失败,节点ID为undefined!",{icon:5}); - // 重新赋值 - _this.setNodeParam($div); - } - } - } else { - $cite.html(title); - _this.getNodeParam($div); - } - - _this.temp = []; // 临时变量制空 - }; - - /** - * @Desc: 删除节点后改变节点内容 - * @Param: flag: 是否要删除节点 - */ - DTree.prototype.changeTreeNodeDel = function(flag){ - var _this = this; - var temp = _this.temp; - var $p_li = temp[0], - $p_ul = $p_li.parent("ul"), - $p_div = temp[1]; - - if(flag){ - $p_li.remove(); - _this.showLine($p_ul.find("li")); - // 判断父级ul中是否还存在li,如果不存在,则需要修改节点的样式 - if($p_ul.children("li").length == 0){ - var $icon_i = $p_div.find("i[data-spread]"); - _this.operateIcon($icon_i.eq(0), $icon_i.eq(1)).closeWithLeaf(); - } - _this.initNodeParam(); - } - - _this.temp = []; // 临时变量制空 - }; - - /******************** iframe区域 ********************/ - /** - * @Desc: 加载iframe - * @Param: $div: JQuery对象,表示当前节点 - * @Param: iframeParam: iframe加载的参数 - */ - DTree.prototype.loadIframe = function($div, iframeParam) { - var _this = this; - var $cite = _this.getNodeDom($div).cite(); - if (!_this.useIframe) { // 启用iframe - return false; - } - var iframeElem = _this.iframeElem, - iframeUrl = _this.iframeUrl, - iframeLoad = _this.iframeLoad; - - var flag = iframeLoad == "leaf" ? (($cite.attr("data-leaf") == "leaf") ? true : false) : true; - - if (flag) { - if ($(iframeElem).length > 0) { //iframe存在 - if (!iframeUrl) { - layer.msg("数据请求异常,iframeUrl参数未指定", {icon:5}); - return false; - } - var param = AjaxHelper.serialize("?", iframeParam); - if(iframeUrl.indexOf("?")> -1){ - param = "&"+param.substring(1, param.length); - } - var url = iframeUrl + param; - $(iframeElem).attr("src", url); - } else { - layer.msg("iframe绑定异常,请确认页面中是否有iframe页对应的容器", {icon:5}); - return false; - } - } - return flag; - }; - - /** - * @Desc: 获取传递出去的参数,根据iframe.iframeDefaultRequest、iframe.iframeRequest和node拼出发出请求的参数 - * @Param: nodes: 需要传递出去的参数 - */ - DTree.prototype.getIframeRequestParam = function(nodes){ - var _this = this; - var request = _this.iframeRequest, - defaultRequestNames = _this.iframeDefaultRequest, - node = nodes || _this.node, - requestParam = {}; - - // 先拼用户自定义的,在拼树生成的,这样的话用户可以自定义当树未生成时的节点的初始值 - for ( var key in request) { - requestParam[key] = request[key]; - } - for ( var key in defaultRequestNames) { - var paramName = defaultRequestNames[key]; - var paramValue = node[key]; - if(typeof paramValue === "boolean"){ - requestParam[paramName] = paramValue; - }else { - if(paramValue){ - requestParam[paramName] = paramValue; - } - } - } - - // 解决传递中文的乱码问题 - var reg = /[\u4E00-\u9FA5\uF900-\uFA2D]/; //正则匹配中文 - for(var key in requestParam){ - if(reg.test(requestParam[key])) { - var str = requestParam[key]; - requestParam[key] = encodeURI(encodeURI(str)); - } - } - - return requestParam; - }; - - /******************** 数据回调区域 ********************/ - /** - * @Desc: 根据具体的id获取基于当前id的div以及对应的其他dom元素 - * @Param: id: 节点的ID值 - */ - DTree.prototype.getNodeDom = function(id){ - var _this = this; - // 获取当前div,如果id就是一个dom,则就是这个,如果不是则进行选择。如果选不中则为null - var $div = (typeof id === 'object') ? id : (_this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']").length == 0) ? null : _this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']"); - return { - div: function(){ // 获取当前div - return $div; - }, - fnode: function(){ // 获取一级图标元素 - return ($div == null) ? null : $div.find("i[data-spread]").eq(0); - }, - snode: function(){ // 获取二级图标元素 - return ($div == null) ? null : $div.find("i[data-spread]").eq(1); - }, - checkbox: function(){ // 获取复选框元素 - return ($div == null) ? null : $div.find("i[data-par]"); - }, - cite: function(){ // 获取cite元素 - return ($div == null) ? null : $div.find("cite[data-leaf]"); - }, - nextUl: function(){ // 获取相邻的ul元素 - return ($div == null) ? null : $div.next("ul"); - }, - parentLi: function(){ // 获取父级li元素 - return ($div == null) ? null : $div.parent("li"); - }, - parentUl: function(){ // 获取基于当前$div的上级$ul - return ($div == null) ? null : $div.parent("li").parent("ul"); - }, - parentDiv: function(){ // 获取基于当前$div的上级$div - return ($div == null) ? null : $div.parent("li").parent("ul").prev("div"); - }, - nowDiv: function(){ // 获取当前选中节点,没有则返回null - return (_this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id]").parent().find("."+NAV_THIS).length == 0) ? null : _this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id]").parent().find("."+NAV_THIS); - }, - nowOrRootDiv: function(){ // 获取当前选中节点,没有则返回根节点下的第一个div - return (_this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id]").parent().find("."+NAV_THIS).length == 0) ? _this.obj.children("li").eq(0).children("div").eq(0) : _this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id]").parent().find("."+NAV_THIS); - }, - nowOrRootUl: function(){ // 获取当前选中节点下一个UL 或根节点。为了将新节点放入ul下 - return (_this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id]").parent().find("."+NAV_THIS).length == 0) ? _this.obj : _this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id]").parent().find("."+NAV_THIS).next("ul"); - } - } - }; - - /** - * @Desc: 获取当前选中节点下一个ul节点 或根节点。为了将新节点放入ul下 - */ - DTree.prototype.getNowNodeUl = function() { - var _this = this; - return _this.getNodeDom().nowOrRootUl(); - }; - - /** - * @Desc: 获取当前选中div节点 或第一个根div节点。 - */ - DTree.prototype.getNowNode = function() { - var _this = this; - return _this.getNodeDom().nowOrRootDiv(); - }; - - /** - * @Desc: 获取当前选中div节点 无则返回null。 - */ - DTree.prototype.getNowNodeOrNull = function() { - var _this = this; - return _this.getNodeDom().nowDiv(); - }; - - /** - * @Desc: 根据获取指定div节点。 - * @Param: id: 指定节点的ID - */ - DTree.prototype.getNode = function(id) { - var _this = this; - return _this.getNodeDom(id).div(); - }; - - /** - * @Desc: 设置当前选中节点的全部参数 - * @Param: $div: 当前选中的节点 - */ - DTree.prototype.setNodeParam = function($div) { - var _this = this; - _this.node.nodeId = $div.attr("data-id"); - _this.node.parentId = _this.getNodeDom($div).parentLi().attr("data-pid"); - _this.node.context = (typeof _this.formatter.title === 'function') ? _this.getNodeDom($div).cite().attr("data-title") : _this.getNodeDom($div).cite().text(); - _this.node.leaf = _this.getNodeDom($div).cite().attr("data-leaf") == "leaf" ? true : false; - _this.node.level = _this.getNodeDom($div).parentLi().attr("data-index"); - _this.node.spread = _this.getNodeDom($div).fnode().attr("data-spread") == "open" ? true : false; - - var basicData = $div.attr("data-basic"); - if(basicData) { - basicData = JSON.parse(event.unescape(basicData)); - } - _this.node.basicData = basicData; - - var recordData = $div.attr("data-record"); - if(recordData) { - recordData = JSON.parse(event.unescape(recordData)); - } - _this.node.recordData = recordData; - - if (_this.getNodeDom($div).checkbox()) { - var dataTypes = "", checkeds = "", initcheckeds = ""; - _this.getNodeDom($div).checkbox().each(function(){ - dataTypes += $(this).attr("data-type") + ","; - checkeds += $(this).attr("data-checked") + ","; - initcheckeds += $(this).attr("data-initchecked") + ","; - }); - dataTypes = dataTypes.substring(0, dataTypes.length-1); - checkeds = checkeds.substring(0, checkeds.length-1); - initcheckeds = initcheckeds.substring(0, initcheckeds.length-1); - - _this.node.dataType = dataTypes; - _this.node.checked = checkeds; - _this.node.initchecked = initcheckeds; - } - }; - - /** - * @Desc: 获取当前选中节点的全部参数 - * @Param: $div: 当前选中的节点 - */ - DTree.prototype.getNodeParam = function($div) { - var _this = this; - if ($div) { - _this.setNodeParam($div); - } else { - if(_this.obj.find("div[data-id]").parent().find("."+NAV_THIS).length == 0){ - _this.initNodeParam(); - } - } - return this.node; - }; - - /** - * @Desc: 获取一个临时的node参数 - * @Param: $div: 当前选中的节点 - */ - DTree.prototype.getTempNodeParam = function($div) { - var _this = this; - var temp_node = {}; - temp_node.nodeId = $div.attr("data-id"); - temp_node.parentId = _this.getNodeDom($div).parentLi().attr("data-pid"); - temp_node.context = (typeof _this.formatter.title === 'function') ? _this.getNodeDom($div).cite().attr("data-title") : _this.getNodeDom($div).cite().text(); - temp_node.leaf = _this.getNodeDom($div).cite().attr("data-leaf") == "leaf" ? true : false; - temp_node.level = _this.getNodeDom($div).parentLi().attr("data-index"); - temp_node.spread = _this.getNodeDom($div).fnode().attr("data-spread") == "open" ? true : false; - - var basicData = $div.attr("data-basic"); - if(basicData) { - basicData = JSON.parse(event.unescape(basicData)); - } - temp_node.basicData = basicData; - var recordData = $div.attr("data-record"); - if(recordData) { - recordData = JSON.parse(event.unescape(recordData)); - } - temp_node.recordData = recordData; - - if (_this.getNodeDom($div).checkbox()) { - var dataTypes = "", checkeds = "", initcheckeds = ""; - _this.getNodeDom($div).checkbox().each(function(){ - dataTypes += $(this).attr("data-type") + ","; - checkeds += $(this).attr("data-checked") + ","; - initcheckeds += $(this).attr("data-initchecked") + ","; - }); - dataTypes = dataTypes.substring(0, dataTypes.length-1); - checkeds = checkeds.substring(0, checkeds.length-1); - initcheckeds = initcheckeds.substring(0, initcheckeds.length-1); - - temp_node.dataType = dataTypes; - temp_node.checked = checkeds; - temp_node.initchecked = initcheckeds; - } - return temp_node; - }; - - /** - * @Desc: 重置内置参数 - */ - DTree.prototype.initNodeParam = function(){ - var _this = this; - _this.node.nodeId = ""; - _this.node.parentId = ""; - _this.node.context = ""; - _this.node.leaf = ""; - _this.node.level = ""; - _this.node.spread = ""; - _this.node.dataType = ""; - _this.node.checked = ""; - _this.node.initchecked = ""; - _this.node.basicData = ""; - _this.node.recordData = ""; - - if(_this.select) { - _this.selectResetVal(); - } - }; - - /** - * @Desc: 获取传递出去的参数,根据defaultRequest、request和node拼出发出请求的参数 - * @Param: nodes:需要传递出去的参数 - */ - DTree.prototype.getRequestParam = function(nodes){ - var _this = this; - var request = _this.request, - defaultRequestNames = _this.defaultRequest, - node = nodes || _this.node, - requestParam = {}; - - // 先拼用户自定义的,在拼树生成的,这样的话用户可以自定义当树未生成时的节点的初始值 - for ( var key in request) { - requestParam[key] = request[key]; - } - for ( var key in defaultRequestNames) { - var paramName = defaultRequestNames[key]; - var paramValue = node[key]; - if(typeof paramValue === "boolean"){ - requestParam[paramName] = paramValue; - }else { - if(paramValue){ - requestParam[paramName] = paramValue; - } - } - - } - return requestParam; - }; - - /** - * @Desc: 获取filterParam过滤后的requestParam - * @Param: requestParam:请求参数 - */ - DTree.prototype.getFilterRequestParam = function(requestParam){ - var _this = this; - var filterRequest = _this.filterRequest; - return event.cloneObj(requestParam, filterRequest); - }; - - /** - * @Desc: 获取当前选中的请求参数 - */ - DTree.prototype.getNowParam = function(){ - var _this = this; - - return _this.getRequestParam(_this.getNodeParam()); - }; - - /** - * @Desc: 根据id获取指定div节点选中参数 - * @Param: id:节点的ID值 - */ - DTree.prototype.getParam = function(id){ - var _this = this; - - // 获取当前div,如果id就是一个dom,则就是这个,如果不是则进行选择。如果选不中则为null - var $div = (typeof id === 'object') ? id : (_this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']").length == 0) ? null : _this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']"); - if($div != null){ return _this.callbackData().node(_this.getTempNodeParam($div)); } else { return {}; } - }; - - /** - * @Desc: 根据id获取节点上级节点参数 - * @Param: id:节点的ID值 - */ - DTree.prototype.getParentParam = function(id){ - var _this = this; - // 获取当前div,如果id就是一个dom,则就是这个,如果不是则进行选择。如果选不中则为null - var $div = (typeof id === 'object') ? id : (_this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']").length == 0) ? null : _this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']"); - if($div != null){ return _this.callbackData().parentNode($div); } else { return {}; } - }; - - /** - * @Desc: 根据id获取节点的全部上级节点参数值 - * @Param: id:节点的ID值 - */ - DTree.prototype.getAllParentParam = function(id){ - var _this = this; - // 获取当前div,如果id就是一个dom,则就是这个,如果不是则进行选择。如果选不中则为null - var $div = (typeof id === 'object') ? id : (_this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']").length == 0) ? null : _this.obj.find("div[dtree-click='"+eventName.itemNodeClick+"'][data-id='"+id+"']"); - var arr = []; - if($div != null){ - var level = _this.getTempNodeParam($div).level; - for(var i=1; i 0){ - $childDivs.each(function(){ - var $cDiv = $(this); - childNode.push(_this.getRequestParam(_this.getTempNodeParam($cDiv))); - }); - } - return childNode; - }, - parentNode: function($div){ // 获取上级节点值 - var pId = _this.getNodeDom($div).parentLi().attr("data-pid"); - var $pdiv = _this.obj.find("div[data-id='"+pId+"']"); - if($pdiv.length > 0) {return _this.getRequestParam(_this.getTempNodeParam($pdiv));} else {return {};} - - } - } - }; - - /******************** 事件回调区域 ********************/ - /** - * @Desc: 绑定浏览器事件 - */ - DTree.prototype.bindBrowserEvent = function(){ - var _this = this; - var rootId = _this.obj[0].id; - - // 绑定文件夹展开/收缩的图标的点击事件,点击时给当前节点的div添加选中class - _this.obj.on("click", "i[data-spread]", function(event) { - event.stopPropagation(); - var $i = $(this), - $div = $i.parent("div"), - node = _this.getNodeParam($div); - - _this.toolbarHide(); - _this.navThis($div); - _this.clickSpread($div); // 展开或隐藏节点 - - // 树状态改变后,用户自定义想做的事情 - layui.event.call(this, MOD_NAME, "changeTree("+$(_this.obj)[0].id+")", { - dom: _this.callbackData().dom($i), - param: _this.callbackData().node(node), - show: _this.callbackData().dom($i).attr("data-spread") == "open" ? true : false - }); - }); - - // 绑定所有子节点div的单击事件,点击时触发加载iframe或用户自定义想做的事情 - _this.obj.on("click", "div[dtree-click='"+eventName.itemNodeClick+"'][dtree-disabled='false']", function(event) { - event.stopPropagation(); - var $div = $(this), - $cite = $div.find("cite"), - node = _this.getNodeParam($div); - _this.toolbarHide(); - _this.navThis($div); - - if(_this.select) { - _this.selectVal(node.nodeId); - $("div[dtree-id='" + rootId + "'][dtree-select='"+_this.selectDiv+"']").click(); - } - - if (_this.useIframe) { - var iframeParam = _this.getFilterRequestParam(_this.getIframeRequestParam(node)); - var flag = _this.loadIframe($div, iframeParam); // 加载iframe - if (flag) { - // iframe加载完毕后,用户自定义想做的事情 - _this.iframeFun.iframeDone(iframeParam); - - layui.event.call(this, MOD_NAME, "iframeDone("+$(_this.obj)[0].id+")", { - "iframeParam": iframeParam, - dom: _this.callbackData().dom($div) - }); - } - } else { - // 单击事件执行完毕后,用户自定义想做的事情 - layui.event.call(this, MOD_NAME, "node("+$(_this.obj)[0].id+")", { - param: _this.callbackData().node(node), - childParams: _this.callbackData().childNode($div), - parentParam: _this.callbackData().parentNode($div), - dom: _this.callbackData().dom($div) - }); - } - }); - - // 绑定所有子节点div的双击事件,暴露on给用户自定义 - _this.obj.on("dblclick", "div[dtree-click='"+eventName.itemNodeClick+"'][dtree-disabled='false']", function(event) { - event.stopPropagation(); - var $div = $(this), - $cite = $div.find("cite"), - node = _this.getNodeParam($div); - _this.toolbarHide(); - _this.navThis($div); - - if(_this.select) { - _this.selectVal(node.nodeId); - $("div[dtree-id='" + rootId + "'][dtree-select='"+_this.selectDiv+"']").click(); - } - - // 双击事件执行完毕后,用户自定义想做的事情 - layui.event.call(this, MOD_NAME, "nodedblclick("+$(_this.obj)[0].id+")", { - param: _this.callbackData().node(node), - childParams: _this.callbackData().childNode($div), - parentParam: _this.callbackData().parentNode($div), - dom: _this.callbackData().dom($div) - }); - }); - - if(_this.checkbar) { - // 绑定cheboxbar的节点复选框 - _this.obj.on("click", "i[dtree-click='"+eventName.checkNodeClick+"'][dtree-disabled='false']", function(event) { - _this.toolbarHide(); - var $i = $(this), - $div = $i.closest("div[dtree-click='"+eventName.itemNodeClick+"']"), - node = _this.getNodeParam($div); - // 复选框选中前的回调 - var flag = _this.checkbarFun.chooseBefore($i, _this.getRequestParam(node)); - _this.temp = [$i]; - if(flag){_this.changeCheck();} - - event.stopPropagation(); - }); - } - - if(_this.menubar) { - // 绑定menubar的点击事件 - _this.obj.prevAll('div#dtree_menubar_'+_this.obj[0].id).on("click", "button[d-menu]", function(event) { - event.stopPropagation(); - _this.toolbarHide(); - _this.menubarListener($(this).attr("d-menu"), "group"); - }); - - // 绑定menubar的点击事件 - _this.obj.prevAll('div#dtree_toolbar_'+_this.obj[0].id).on("click", "a[d-menu]", function(event) { - event.stopPropagation(); - _this.toolbarHide(); - _this.menubarListener($(this).attr("d-menu"), "toolbar"); - }); - - // 绑定menubar的点击按钮事件 - _this.obj.closest('body').find("*[dtree-id='"+_this.obj[0].id+"'][dtree-menu]").on("click", function(event) { - event.stopPropagation(); - _this.toolbarHide(); - _this.menubarListener($(this).attr("dtree-menu"), "freedom"); - }); - } - - if(_this.toolbar) { - if(_this.toolbarWay == "contextmenu") { - //绑定所有子节点div的右键点击事件,用于显示toolbar - _this.obj.on("contextmenu", "div[dtree-click='"+eventName.itemNodeClick+"'][d-contextmenu='true'][dtree-disabled='false']", function(e){ - var $div = $(this), - node = _this.getNodeParam($div); - - _this.toolbarHide(); - // toolbar加载前执行的方法,执行完毕之后创建按钮 - _this.setToolbarDom().setToolbarPlace(_this.toolbarFun.loadToolbarBefore(event.cloneObj(_this.toolbarMenu), _this.getRequestParam(node), $div)); - - var e = e || window.event, - mx = e.pageX - $div.offset().left +45 , - my = $div.offset().top - _this.obj.closest(_this.scroll).offset().top +15; - - _this.navThis($div); - var $toolBarDiv = _this.obj.prevAll('div#dtree_toolbar_'+_this.obj[0].id); - $toolBarDiv.find(".layui-nav-child").addClass('layui-anim-fadein layui-show'); - $toolBarDiv.css({'left':mx+'px','top':my+'px'}); - - e.stopPropagation(); - return false; - }); - - // 绑定装载树的上层出现滚动条的容器,让toolbar隐藏 - _this.obj.closest(_this.scroll).scroll(function() { - _this.toolbarHide(); - }); - - // 绑定toolbar的点击事件 - _this.obj.prevAll('div#dtree_toolbar_'+_this.obj[0].id).on("click", "a[dtree-tool]", function(event) { - event.stopPropagation(); - var $div = _this.getNodeDom().nowOrRootDiv(), - node = _this.getNodeParam($div); - _this.toolbarHide(); - var tool = $(this).attr("dtree-tool"); - _this.toolbarListener(tool, $div); - }); - } else if(_this.toolbarWay == "fixed") { - // 绑定toolbar的点击事件 - _this.obj.on("click", "a[dtree-tool]", function(event) { - event.stopPropagation(); - var $a = $(this), - $cite = $a.parent("em."+TOOLBAR_TOOL_EM).prev("cite"), //当前选中节点的text - $div = $cite.parent("div"), - node = _this.getNodeParam($div); - var tool = $a.attr("dtree-tool"); - - _this.toolbarHide(); - _this.navThis($div); - _this.toolbarListener(tool, $div); - }); - } else if(_this.toolbarWay == "follow") { - //绑定所有子节点div的mouseover mouseout事件,用于显示或隐藏toolbar - _this.obj.on("mouseover mouseout", "div[dtree-click='"+eventName.itemNodeClick+"'][dtree-disabled='false']", function(event){ - var $div = $(this), - $toolBarEm = $div.children("em."+TOOLBAR_TOOL_EM); - if(event.type == "mouseover"){ - $toolBarEm.removeClass(NAV_HIDE); - event.stopPropagation(); - } else if(event.type == "mouseout"){ - $toolBarEm.addClass(NAV_HIDE); - event.stopPropagation(); - } - }); - - // 绑定toolbar的点击事件 - _this.obj.on("click", "a[dtree-tool]", function(event) { - event.stopPropagation(); - var $a = $(this), - $cite = $a.parent("em."+TOOLBAR_TOOL_EM).prev("cite"), //当前选中节点的text - $div = $cite.parent("div"), - node = _this.getNodeParam($div); - var tool = $a.attr("dtree-tool"); - - _this.toolbarHide(); - _this.navThis($div); - _this.toolbarListener(tool, $div); - }); - } - } - - if(_this.select) { - // 绑定select的点击事件 - $("div[dtree-id='" + rootId + "'][dtree-select='"+_this.selectDiv+"']").on("click", function(event){ - event.stopPropagation(); - var dl = $(this).find('dl'); - //debugger; - $(this).toggleClass("layui-form-selected"); - - var $card = $("div[dtree-id='" + rootId + "'][dtree-card='"+_this.selectCardDiv+"']"); - - $card.toggleClass("dtree-select-show layui-anim layui-anim-upbit"); - var top = $(this).offset().top + $(this).outerHeight() - $WIN.scrollTop() - 5, - cardHeight = $card.height(), - winHeight = $WIN.height(); -// console.log("top = $(this).offset().top: " + $(this).offset().top + " + $(this).outerHeight(): " + $(this).outerHeight() + " - $WIN.scrollTop(): " + $WIN.scrollTop() + " - 5 =" + top); -// console.log("winHeight = " + winHeight); - if($card.hasClass('dtree-select-up')) { - $card.removeClass('dtree-select-up'); - } - - //上下定位识别 - if(top + cardHeight > $WIN.height() && top >= cardHeight){ - console.log(" top + cardHeight : "+ top + " + " + cardHeight + " > $WIN.height() :" + $WIN.height() + " && top >= cardHeight :" + top + " > " + cardHeight); - if($card.hasClass('dtree-select-up')) { - $card.removeClass('dtree-select-up'); - } else { - $card.addClass('dtree-select-up'); - } - } else { - $card.removeClass('dtree-select-up'); - } - - // 下拉树面板开闭状态改变后,用户自定义想做的事情 - layui.event.call(this, MOD_NAME, "changeSelect("+$(_this.obj)[0].id+")", { - show: $(this).hasClass("layui-form-selected"), - param: _this.selectVal() - }); - }); - - } - }; - - // 绑定body的单击,让本页面所有的toolbar隐藏 - $BODY.on("click", function(event){ - $("div."+LI_DIV_TOOLBAR).find(".layui-show").removeClass('layui-anim-fadein layui-show'); - // $("div[dtree-id][dtree-select]").removeClass("layui-form-selected"); - // $("div[dtree-id][dtree-card]").removeClass("dtree-select-show layui-anim layui-anim-upbit"); - - }); - - // 解绑浏览器事件 - DTree.prototype.unbindBrowserEvent = function(){ - var _this = this; - - // 本身事件解绑 - _this.obj.unbind(); - // 菜单栏解绑 - if(_this.menubar){ - _this.obj.prevAll('div#dtree_menubar_'+_this.obj[0].id).unbind(); - if(_this.obj.closest('body').find("*[dtree-id='"+_this.obj[0].id+"'][dtree-menu]").length > 0){ - _this.obj.closest('body').find("*[dtree-id='"+_this.obj[0].id+"'][dtree-menu]").unbind(); - } - } - - // 工具栏解绑 - if(_this.toolbar){ - if(_this.toolbarWay == "contextmenu") { - _this.obj.prevAll('div#dtree_toolbar_'+_this.obj[0].id).unbind(); - if(_this.obj.closest(_this.scroll).length > 0){ - _this.obj.closest(_this.scroll).unbind(); - } - } - } - - // 下拉树解绑 - if(_this.select) { - // 解绑select的点击事件 - $("div[dtree-id='" + _this.obj[0].id + "'][dtree-select='"+_this.selectDiv+"']").removeClass("layui-form-selected"); - $("div[dtree-id='" + _this.obj[0].id + "'][dtree-card='"+_this.selectCardDiv+"']").removeClass("dtree-select-show layui-anim layui-anim-upbit"); - $("div[dtree-id='" + _this.obj[0].id + "'][dtree-select='"+_this.selectDiv+"']").unbind(); - } - }; - - - /** 外部访问 **/ - var dtree = { - set: function(options){ //设置全局属性 - if(typeof options !== 'undefined') { - $.extend(OPTIONS, options); - } - }, - render: function(options){ // 初始化树 - var dTree = null; - var id = event.getElemId(options); - if(id == "") { - layer.msg("页面中未找到绑定id", {icon:5}); - } else { - dTree = DTrees[id]; - if(typeof dTree === 'object'){ - dTree.unbindBrowserEvent(); - } - // 创建树 - dTree = new DTree(options); - // 添加到树数组中去 - DTrees[id] = dTree; - dTree.initTreePlus(); - dTree.openTreePlus(); - dTree.loadTreeInit(); - dTree.bindBrowserEvent(); - } - - return dTree; - }, - renderSelect: function(options){ // 初始化下拉树 - var dTree = null; - var id = event.getElemId(options); - if(id == "") { - layer.msg("页面中未找到绑定id", {icon:5}); - } else { - dTree = DTrees[id]; - if(typeof dTree === 'object'){ - dTree.unbindBrowserEvent(); - } - // 创建下拉树 - dTree = new DTree(options); - dTree.selectSetting(); - // 添加到树数组中去 - DTrees[id] = dTree; - dTree.initTreePlus(); - dTree.openTreePlus(); - dTree.loadTreeInit(); - dTree.bindBrowserEvent(); - } - - return dTree; - }, - reload: function(dTree, options){ // 重新加载树 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - dTree.reloadSetting(options); - dTree.initTreePlus(); - dTree.openTreePlus(); - dTree.initNodeParam(); - dTree.loadTreeInit(); - dTree.unbindBrowserEvent(); - dTree.bindBrowserEvent(); - }, - on: function(events, callback) { // 绑定事件 - if(events.indexOf("'") > 0){ - events = events.replace(/'/g,""); - } - if(events.indexOf('"') > 0) { - events = events.replace(/"/g,""); - } - return layui.onevent.call(this, MOD_NAME, events, callback); - }, - click: function(dTree, id) { // 模拟单击事件 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - $("div[dtree-click='"+eventName.itemNodeClick+"'][dtree-id='"+dTree.obj[0].id+"'][data-id='"+id+"']").click(); - }, - getNowParam: function(dTree){ // 获取当前选中值 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - return dTree.getNowParam(); // 获取当前选中值 - }, - getParam: function(dTree, id){ // 获取指定节点值 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - return dTree.getParam(id); // 获取指定节点值 - }, - getParentParam: function(dTree, id){ // 获取参数的上级节点 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - return dTree.getParentParam(id); - }, - getAllParentParam: function(dTree, id){ // 获取参数的全部上级节点 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - return dTree.getAllParentParam(id); - }, - getChildParam: function(dTree, id){ // 获取参数的全部下级节点 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - return dTree.getChildParam(id); - }, - getCheckbarNodesParam: function(dTree){ // 获取复选框选中值 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return {}; - } - return dTree.getCheckbarNodesParam(); // 获取复选框选中值 - }, - getCheckbarJsonArrParam: function(dTree){ // 获取复选框选中值 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return {}; - } - return dTree.getCheckbarJsonArrParam(); // 获取复选框选中值 - }, - dataInit: function(dTree, chooseId){ // 初始化选中树,针对数据反选 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - if(chooseId){ - return dTree.dataInit(chooseId); - } - }, - chooseDataInit: function(dTree, chooseIds){ // 初始化复选框选中,针对数据反选 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - if(chooseIds){ - return dTree.chooseDataInit(chooseIds); - } - }, - changeCheckbarNodes: function(dTree){ //判断复选框是否发生变更 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - return dTree.changeCheckbarNodes(); - }, - initNoAllCheck: function(dTree) { //复选框半选状态初始化设置 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - return dTree.initNoAllCheck(); - }, - initAllCheck: function(dTree){ // 复选框选中状态初始化设置 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - return dTree.initAllCheck(); - }, - selectVal: function(dTree, param){ // select模式设置输入框选中值 - if(typeof dTree === "string"){ - dTree = DTrees[dTree]; - } - if(typeof dTree === "undefined"){ - layer.msg("方法获取失败,请检查ID或对象传递是否正确",{icon:2}); - return ; - } - return dTree.selectVal(param); // select模式设置输入框选中值 - }, - escape: function(html){ // 字符串格式化 - return event.escape(html); - }, - unescape: function(str){ // 字符串反格式化 - return event.unescape(str); - }, - serialize: function(first, param) { // 序列化JSON对象 - return AjaxHelper.serialize(first, param); - }, - version: function(){ //获取版本号 - return VERSION; - } - }; - - exports('dtree', dtree); -}); \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/module/encrypt.js b/src/plugin/admin/public/component/pear/module/encrypt.js deleted file mode 100644 index 9594f1a0..00000000 --- a/src/plugin/admin/public/component/pear/module/encrypt.js +++ /dev/null @@ -1,1775 +0,0 @@ -/** - layui hash extend -**/ - -layui.define(function (exports) { - /** - * jshashes - https://github.com/h2non/jshashes - * Released under the "New BSD" license - * - * Algorithms specification: - * - * MD5 - http://www.ietf.org/rfc/rfc1321.txt - * RIPEMD-160 - http://homes.esat.kuleuven.be/~bosselae/ripemd160.html - * SHA1 - http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf - * SHA256 - http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf - * SHA512 - http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf - * HMAC - http://www.ietf.org/rfc/rfc2104.txt - */ - var pearHash; - - function utf8Encode(str) { - var x, y, output = '', - i = -1, - l; - - if (str && str.length) { - l = str.length; - while ((i += 1) < l) { - /* Decode utf-16 surrogate pairs */ - x = str.charCodeAt(i); - y = i + 1 < l ? str.charCodeAt(i + 1) : 0; - if (0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF) { - x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF); - i += 1; - } - /* Encode output as utf-8 */ - if (x <= 0x7F) { - output += String.fromCharCode(x); - } else if (x <= 0x7FF) { - output += String.fromCharCode(0xC0 | ((x >>> 6) & 0x1F), - 0x80 | (x & 0x3F)); - } else if (x <= 0xFFFF) { - output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F), - 0x80 | ((x >>> 6) & 0x3F), - 0x80 | (x & 0x3F)); - } else if (x <= 0x1FFFFF) { - output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07), - 0x80 | ((x >>> 12) & 0x3F), - 0x80 | ((x >>> 6) & 0x3F), - 0x80 | (x & 0x3F)); - } - } - } - return output; - } - - function utf8Decode(str) { - var i, ac, c1, c2, c3, arr = [], - l; - i = ac = c1 = c2 = c3 = 0; - - if (str && str.length) { - l = str.length; - str += ''; - - while (i < l) { - c1 = str.charCodeAt(i); - ac += 1; - if (c1 < 128) { - arr[ac] = String.fromCharCode(c1); - i += 1; - } else if (c1 > 191 && c1 < 224) { - c2 = str.charCodeAt(i + 1); - arr[ac] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63)); - i += 2; - } else { - c2 = str.charCodeAt(i + 1); - c3 = str.charCodeAt(i + 2); - arr[ac] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); - i += 3; - } - } - } - return arr.join(''); - } - - /** - * Add integers, wrapping at 2^32. This uses 16-bit operations internally - * to work around bugs in some JS interpreters. - */ - - function safe_add(x, y) { - var lsw = (x & 0xFFFF) + (y & 0xFFFF), - msw = (x >> 16) + (y >> 16) + (lsw >> 16); - return (msw << 16) | (lsw & 0xFFFF); - } - - /** - * Bitwise rotate a 32-bit number to the left. - */ - - function bit_rol(num, cnt) { - return (num << cnt) | (num >>> (32 - cnt)); - } - - /** - * Convert a raw string to a hex string - */ - - function rstr2hex(input, hexcase) { - var hex_tab = hexcase ? '0123456789ABCDEF' : '0123456789abcdef', - output = '', - x, i = 0, - l = input.length; - for (; i < l; i += 1) { - x = input.charCodeAt(i); - output += hex_tab.charAt((x >>> 4) & 0x0F) + hex_tab.charAt(x & 0x0F); - } - return output; - } - - /** - * Encode a string as utf-16 - */ - - function str2rstr_utf16le(input) { - var i, l = input.length, - output = ''; - for (i = 0; i < l; i += 1) { - output += String.fromCharCode(input.charCodeAt(i) & 0xFF, (input.charCodeAt(i) >>> 8) & 0xFF); - } - return output; - } - - function str2rstr_utf16be(input) { - var i, l = input.length, - output = ''; - for (i = 0; i < l; i += 1) { - output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF, input.charCodeAt(i) & 0xFF); - } - return output; - } - - /** - * Convert an array of big-endian words to a string - */ - - function binb2rstr(input) { - var i, l = input.length * 32, - output = ''; - for (i = 0; i < l; i += 8) { - output += String.fromCharCode((input[i >> 5] >>> (24 - i % 32)) & 0xFF); - } - return output; - } - - /** - * Convert an array of little-endian words to a string - */ - - function binl2rstr(input) { - var i, l = input.length * 32, - output = ''; - for (i = 0; i < l; i += 8) { - output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF); - } - return output; - } - - /** - * Convert a raw string to an array of little-endian words - * Characters >255 have their high-byte silently ignored. - */ - - function rstr2binl(input) { - var i, l = input.length * 8, - output = Array(input.length >> 2), - lo = output.length; - for (i = 0; i < lo; i += 1) { - output[i] = 0; - } - for (i = 0; i < l; i += 8) { - output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32); - } - return output; - } - - /** - * Convert a raw string to an array of big-endian words - * Characters >255 have their high-byte silently ignored. - */ - - function rstr2binb(input) { - var i, l = input.length * 8, - output = Array(input.length >> 2), - lo = output.length; - for (i = 0; i < lo; i += 1) { - output[i] = 0; - } - for (i = 0; i < l; i += 8) { - output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32); - } - return output; - } - - /** - * Convert a raw string to an arbitrary string encoding - */ - - function rstr2any(input, encoding) { - var divisor = encoding.length, - remainders = Array(), - i, q, x, ld, quotient, dividend, output, full_length; - - /* Convert to an array of 16-bit big-endian values, forming the dividend */ - dividend = Array(Math.ceil(input.length / 2)); - ld = dividend.length; - for (i = 0; i < ld; i += 1) { - dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1); - } - - /** - * Repeatedly perform a long division. The binary array forms the dividend, - * the length of the encoding is the divisor. Once computed, the quotient - * forms the dividend for the next step. We stop when the dividend is zerHashes. - * All remainders are stored for later use. - */ - while (dividend.length > 0) { - quotient = Array(); - x = 0; - for (i = 0; i < dividend.length; i += 1) { - x = (x << 16) + dividend[i]; - q = Math.floor(x / divisor); - x -= q * divisor; - if (quotient.length > 0 || q > 0) { - quotient[quotient.length] = q; - } - } - remainders[remainders.length] = x; - dividend = quotient; - } - - /* Convert the remainders to the output string */ - output = ''; - for (i = remainders.length - 1; i >= 0; i--) { - output += encoding.charAt(remainders[i]); - } - - /* Append leading zero equivalents */ - full_length = Math.ceil(input.length * 8 / (Math.log(encoding.length) / Math.log(2))); - for (i = output.length; i < full_length; i += 1) { - output = encoding[0] + output; - } - return output; - } - - /** - * Convert a raw string to a base-64 string - */ - - function rstr2b64(input, b64pad) { - var tab = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', - output = '', - len = input.length, - i, j, triplet; - b64pad = b64pad || '='; - for (i = 0; i < len; i += 3) { - triplet = (input.charCodeAt(i) << 16) | (i + 1 < len ? input.charCodeAt(i + 1) << 8 : 0) | (i + 2 < len ? input.charCodeAt(i + 2) : 0); - for (j = 0; j < 4; j += 1) { - if (i * 8 + j * 6 > input.length * 8) { - output += b64pad; - } else { - output += tab.charAt((triplet >>> 6 * (3 - j)) & 0x3F); - } - } - } - return output; - } - - pearHash = { - /** - * @property {String} version - * @readonly - */ - VERSION: '1.0.6', - /** - * @member Hashes - * @class Base64 - * @constructor - */ - Base64: function () { - // private properties - var tab = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', - pad = '=', // default pad according with the RFC standard - url = false, // URL encoding support @todo - utf8 = true; // by default enable UTF-8 support encoding - - // public method for encoding - this.encode = function (input) { - var i, j, triplet, - output = '', - len = input.length; - - pad = pad || '='; - input = (utf8) ? utf8Encode(input) : input; - - for (i = 0; i < len; i += 3) { - triplet = (input.charCodeAt(i) << 16) | (i + 1 < len ? input.charCodeAt(i + 1) << 8 : 0) | (i + 2 < len ? input.charCodeAt(i + 2) : 0); - for (j = 0; j < 4; j += 1) { - if (i * 8 + j * 6 > len * 8) { - output += pad; - } else { - output += tab.charAt((triplet >>> 6 * (3 - j)) & 0x3F); - } - } - } - return output; - }; - - // public method for decoding - this.decode = function (input) { - // var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; - var i, o1, o2, o3, h1, h2, h3, h4, bits, ac, - dec = '', - arr = []; - if (!input) { - return input; - } - - i = ac = 0; - input = input.replace(new RegExp('\\' + pad, 'gi'), ''); // use '=' - //input += ''; - - do { // unpack four hexets into three octets using index points in b64 - h1 = tab.indexOf(input.charAt(i += 1)); - h2 = tab.indexOf(input.charAt(i += 1)); - h3 = tab.indexOf(input.charAt(i += 1)); - h4 = tab.indexOf(input.charAt(i += 1)); - - bits = h1 << 18 | h2 << 12 | h3 << 6 | h4; - - o1 = bits >> 16 & 0xff; - o2 = bits >> 8 & 0xff; - o3 = bits & 0xff; - ac += 1; - - if (h3 === 64) { - arr[ac] = String.fromCharCode(o1); - } else if (h4 === 64) { - arr[ac] = String.fromCharCode(o1, o2); - } else { - arr[ac] = String.fromCharCode(o1, o2, o3); - } - } while (i < input.length); - - dec = arr.join(''); - dec = (utf8) ? utf8Decode(dec) : dec; - - return dec; - }; - - // set custom pad string - this.setPad = function (str) { - pad = str || pad; - return this; - }; - // set custom tab string characters - this.setTab = function (str) { - tab = str || tab; - return this; - }; - this.setUTF8 = function (bool) { - if (typeof bool === 'boolean') { - utf8 = bool; - } - return this; - }; - }, - - /** - * CRC-32 calculation - * @member Hashes - * @method CRC32 - * @static - * @param {String} str Input String - * @return {String} - */ - CRC32: function (str) { - var crc = 0, - x = 0, - y = 0, - table, i, iTop; - str = utf8Encode(str); - - table = [ - '00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 ', - '79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 ', - '84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F ', - '63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD ', - 'A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC ', - '51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 ', - 'B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 ', - '06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 ', - 'E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 ', - '12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 ', - 'D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 ', - '33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 ', - 'CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 ', - '9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E ', - '7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D ', - '806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 ', - '60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA ', - 'AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 ', - '5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 ', - 'B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 ', - '05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 ', - 'F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA ', - '11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 ', - 'D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F ', - '30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E ', - 'C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D' - ].join(''); - - crc = crc ^ (-1); - for (i = 0, iTop = str.length; i < iTop; i += 1) { - y = (crc ^ str.charCodeAt(i)) & 0xFF; - x = '0x' + table.substr(y * 9, 8); - crc = (crc >>> 8) ^ x; - } - // always return a positive number (that's what >>> 0 does) - return (crc ^ (-1)) >>> 0; - }, - /** - * @member Hashes - * @class MD5 - * @constructor - * @param {Object} [config] - * - * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message - * Digest Algorithm, as defined in RFC 1321. - * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009 - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * See for more infHashes. - */ - MD5: function (options) { - /** - * Private config properties. You may need to tweak these to be compatible with - * the server-side, but the defaults work in most cases. - * See {@link Hashes.MD5#method-setUpperCase} and {@link Hashes.SHA1#method-setUpperCase} - */ - var hexcase = (options && typeof options.uppercase === 'boolean') ? options.uppercase : false, // hexadecimal output case format. false - lowercase; true - uppercase - b64pad = (options && typeof options.pad === 'string') ? options.pad : '=', // base-64 pad character. Defaults to '=' for strict RFC compliance - utf8 = (options && typeof options.utf8 === 'boolean') ? options.utf8 : true; // enable/disable utf8 encoding - - // privileged (public) methods - this.hex = function (s) { - return rstr2hex(rstr(s, utf8), hexcase); - }; - this.b64 = function (s) { - return rstr2b64(rstr(s), b64pad); - }; - this.any = function (s, e) { - return rstr2any(rstr(s, utf8), e); - }; - this.raw = function (s) { - return rstr(s, utf8); - }; - this.hex_hmac = function (k, d) { - return rstr2hex(rstr_hmac(k, d), hexcase); - }; - this.b64_hmac = function (k, d) { - return rstr2b64(rstr_hmac(k, d), b64pad); - }; - this.any_hmac = function (k, d, e) { - return rstr2any(rstr_hmac(k, d), e); - }; - /** - * Perform a simple self-test to see if the VM is working - * @return {String} Hexadecimal hash sample - */ - this.vm_test = function () { - return hex('abc').toLowerCase() === '900150983cd24fb0d6963f7d28e17f72'; - }; - /** - * Enable/disable uppercase hexadecimal returned string - * @param {Boolean} - * @return {Object} this - */ - this.setUpperCase = function (a) { - if (typeof a === 'boolean') { - hexcase = a; - } - return this; - }; - /** - * Defines a base64 pad string - * @param {String} Pad - * @return {Object} this - */ - this.setPad = function (a) { - b64pad = a || b64pad; - return this; - }; - /** - * Defines a base64 pad string - * @param {Boolean} - * @return {Object} [this] - */ - this.setUTF8 = function (a) { - if (typeof a === 'boolean') { - utf8 = a; - } - return this; - }; - - // private methods - - /** - * Calculate the MD5 of a raw string - */ - - function rstr(s) { - s = (utf8) ? utf8Encode(s) : s; - return binl2rstr(binl(rstr2binl(s), s.length * 8)); - } - - /** - * Calculate the HMAC-MD5, of a key and some data (raw strings) - */ - - function rstr_hmac(key, data) { - var bkey, ipad, opad, hash, i; - - key = (utf8) ? utf8Encode(key) : key; - data = (utf8) ? utf8Encode(data) : data; - bkey = rstr2binl(key); - if (bkey.length > 16) { - bkey = binl(bkey, key.length * 8); - } - - ipad = Array(16), opad = Array(16); - for (i = 0; i < 16; i += 1) { - ipad[i] = bkey[i] ^ 0x36363636; - opad[i] = bkey[i] ^ 0x5C5C5C5C; - } - hash = binl(ipad.concat(rstr2binl(data)), 512 + data.length * 8); - return binl2rstr(binl(opad.concat(hash), 512 + 128)); - } - - /** - * Calculate the MD5 of an array of little-endian words, and a bit length. - */ - - function binl(x, len) { - var i, olda, oldb, oldc, oldd, - a = 1732584193, - b = -271733879, - c = -1732584194, - d = 271733878; - - /* append padding */ - x[len >> 5] |= 0x80 << ((len) % 32); - x[(((len + 64) >>> 9) << 4) + 14] = len; - - for (i = 0; i < x.length; i += 16) { - olda = a; - oldb = b; - oldc = c; - oldd = d; - - a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936); - d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586); - c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819); - b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330); - a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897); - d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426); - c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341); - b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983); - a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416); - d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417); - c = md5_ff(c, d, a, b, x[i + 10], 17, -42063); - b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162); - a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682); - d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101); - c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290); - b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329); - - a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510); - d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632); - c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713); - b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302); - a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691); - d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083); - c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335); - b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848); - a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438); - d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690); - c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961); - b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501); - a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467); - d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784); - c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473); - b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734); - - a = md5_hh(a, b, c, d, x[i + 5], 4, -378558); - d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463); - c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562); - b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556); - a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060); - d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353); - c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632); - b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640); - a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174); - d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222); - c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979); - b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189); - a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487); - d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835); - c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520); - b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651); - - a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844); - d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415); - c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905); - b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055); - a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571); - d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606); - c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523); - b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799); - a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359); - d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744); - c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380); - b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649); - a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070); - d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379); - c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259); - b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551); - - a = safe_add(a, olda); - b = safe_add(b, oldb); - c = safe_add(c, oldc); - d = safe_add(d, oldd); - } - return Array(a, b, c, d); - } - - /** - * These functions implement the four basic operations the algorithm uses. - */ - - function md5_cmn(q, a, b, x, s, t) { - return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b); - } - - function md5_ff(a, b, c, d, x, s, t) { - return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); - } - - function md5_gg(a, b, c, d, x, s, t) { - return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); - } - - function md5_hh(a, b, c, d, x, s, t) { - return md5_cmn(b ^ c ^ d, a, b, x, s, t); - } - - function md5_ii(a, b, c, d, x, s, t) { - return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); - } - }, - /** - * @member Hashes - * @class Hashes.SHA1 - * @param {Object} [config] - * @constructor - * - * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined in FIPS 180-1 - * Version 2.2 Copyright Paul Johnston 2000 - 2009. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * See http://pajhome.org.uk/crypt/md5 for details. - */ - SHA1: function (options) { - /** - * Private config properties. You may need to tweak these to be compatible with - * the server-side, but the defaults work in most cases. - * See {@link Hashes.MD5#method-setUpperCase} and {@link Hashes.SHA1#method-setUpperCase} - */ - var hexcase = (options && typeof options.uppercase === 'boolean') ? options.uppercase : false, // hexadecimal output case format. false - lowercase; true - uppercase - b64pad = (options && typeof options.pad === 'string') ? options.pad : '=', // base-64 pad character. Defaults to '=' for strict RFC compliance - utf8 = (options && typeof options.utf8 === 'boolean') ? options.utf8 : true; // enable/disable utf8 encoding - - // public methods - this.hex = function (s) { - return rstr2hex(rstr(s, utf8), hexcase); - }; - this.b64 = function (s) { - return rstr2b64(rstr(s, utf8), b64pad); - }; - this.any = function (s, e) { - return rstr2any(rstr(s, utf8), e); - }; - this.raw = function (s) { - return rstr(s, utf8); - }; - this.hex_hmac = function (k, d) { - return rstr2hex(rstr_hmac(k, d)); - }; - this.b64_hmac = function (k, d) { - return rstr2b64(rstr_hmac(k, d), b64pad); - }; - this.any_hmac = function (k, d, e) { - return rstr2any(rstr_hmac(k, d), e); - }; - /** - * Perform a simple self-test to see if the VM is working - * @return {String} Hexadecimal hash sample - * @public - */ - this.vm_test = function () { - return hex('abc').toLowerCase() === '900150983cd24fb0d6963f7d28e17f72'; - }; - /** - * @description Enable/disable uppercase hexadecimal returned string - * @param {boolean} - * @return {Object} this - * @public - */ - this.setUpperCase = function (a) { - if (typeof a === 'boolean') { - hexcase = a; - } - return this; - }; - /** - * @description Defines a base64 pad string - * @param {string} Pad - * @return {Object} this - * @public - */ - this.setPad = function (a) { - b64pad = a || b64pad; - return this; - }; - /** - * @description Defines a base64 pad string - * @param {boolean} - * @return {Object} this - * @public - */ - this.setUTF8 = function (a) { - if (typeof a === 'boolean') { - utf8 = a; - } - return this; - }; - - // private methods - - /** - * Calculate the SHA-512 of a raw string - */ - - function rstr(s) { - s = (utf8) ? utf8Encode(s) : s; - return binb2rstr(binb(rstr2binb(s), s.length * 8)); - } - - /** - * Calculate the HMAC-SHA1 of a key and some data (raw strings) - */ - - function rstr_hmac(key, data) { - var bkey, ipad, opad, i, hash; - key = (utf8) ? utf8Encode(key) : key; - data = (utf8) ? utf8Encode(data) : data; - bkey = rstr2binb(key); - - if (bkey.length > 16) { - bkey = binb(bkey, key.length * 8); - } - ipad = Array(16), opad = Array(16); - for (i = 0; i < 16; i += 1) { - ipad[i] = bkey[i] ^ 0x36363636; - opad[i] = bkey[i] ^ 0x5C5C5C5C; - } - hash = binb(ipad.concat(rstr2binb(data)), 512 + data.length * 8); - return binb2rstr(binb(opad.concat(hash), 512 + 160)); - } - - /** - * Calculate the SHA-1 of an array of big-endian words, and a bit length - */ - - function binb(x, len) { - var i, j, t, olda, oldb, oldc, oldd, olde, - w = Array(80), - a = 1732584193, - b = -271733879, - c = -1732584194, - d = 271733878, - e = -1009589776; - - /* append padding */ - x[len >> 5] |= 0x80 << (24 - len % 32); - x[((len + 64 >> 9) << 4) + 15] = len; - - for (i = 0; i < x.length; i += 16) { - olda = a; - oldb = b; - oldc = c; - oldd = d; - olde = e; - - for (j = 0; j < 80; j += 1) { - if (j < 16) { - w[j] = x[i + j]; - } else { - w[j] = bit_rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1); - } - t = safe_add(safe_add(bit_rol(a, 5), sha1_ft(j, b, c, d)), - safe_add(safe_add(e, w[j]), sha1_kt(j))); - e = d; - d = c; - c = bit_rol(b, 30); - b = a; - a = t; - } - - a = safe_add(a, olda); - b = safe_add(b, oldb); - c = safe_add(c, oldc); - d = safe_add(d, oldd); - e = safe_add(e, olde); - } - return Array(a, b, c, d, e); - } - - /** - * Perform the appropriate triplet combination function for the current - * iteration - */ - - function sha1_ft(t, b, c, d) { - if (t < 20) { - return (b & c) | ((~b) & d); - } - if (t < 40) { - return b ^ c ^ d; - } - if (t < 60) { - return (b & c) | (b & d) | (c & d); - } - return b ^ c ^ d; - } - - /** - * Determine the appropriate additive constant for the current iteration - */ - - function sha1_kt(t) { - return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : - (t < 60) ? -1894007588 : -899497514; - } - }, - /** - * @class Hashes.SHA256 - * @param {config} - * - * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined in FIPS 180-2 - * Version 2.2 Copyright Angel Marin, Paul Johnston 2000 - 2009. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * See http://pajhome.org.uk/crypt/md5 for details. - * Also http://anmar.eu.org/projects/jssha2/ - */ - SHA256: function (options) { - /** - * Private properties configuration variables. You may need to tweak these to be compatible with - * the server-side, but the defaults work in most cases. - * @see this.setUpperCase() method - * @see this.setPad() method - */ - var hexcase = (options && typeof options.uppercase === 'boolean') ? options.uppercase : false, // hexadecimal output case format. false - lowercase; true - uppercase */ - b64pad = (options && typeof options.pad === 'string') ? options.pad : '=', - /* base-64 pad character. Default '=' for strict RFC compliance */ - utf8 = (options && typeof options.utf8 === 'boolean') ? options.utf8 : true, - /* enable/disable utf8 encoding */ - sha256_K; - - /* privileged (public) methods */ - this.hex = function (s) { - return rstr2hex(rstr(s, utf8)); - }; - this.b64 = function (s) { - return rstr2b64(rstr(s, utf8), b64pad); - }; - this.any = function (s, e) { - return rstr2any(rstr(s, utf8), e); - }; - this.raw = function (s) { - return rstr(s, utf8); - }; - this.hex_hmac = function (k, d) { - return rstr2hex(rstr_hmac(k, d)); - }; - this.b64_hmac = function (k, d) { - return rstr2b64(rstr_hmac(k, d), b64pad); - }; - this.any_hmac = function (k, d, e) { - return rstr2any(rstr_hmac(k, d), e); - }; - /** - * Perform a simple self-test to see if the VM is working - * @return {String} Hexadecimal hash sample - * @public - */ - this.vm_test = function () { - return hex('abc').toLowerCase() === '900150983cd24fb0d6963f7d28e17f72'; - }; - /** - * Enable/disable uppercase hexadecimal returned string - * @param {boolean} - * @return {Object} this - * @public - */ - this.setUpperCase = function (a) { - if (typeof a === 'boolean') { - hexcase = a; - } - return this; - }; - /** - * @description Defines a base64 pad string - * @param {string} Pad - * @return {Object} this - * @public - */ - this.setPad = function (a) { - b64pad = a || b64pad; - return this; - }; - /** - * Defines a base64 pad string - * @param {boolean} - * @return {Object} this - * @public - */ - this.setUTF8 = function (a) { - if (typeof a === 'boolean') { - utf8 = a; - } - return this; - }; - - // private methods - - /** - * Calculate the SHA-512 of a raw string - */ - - function rstr(s, utf8) { - s = (utf8) ? utf8Encode(s) : s; - return binb2rstr(binb(rstr2binb(s), s.length * 8)); - } - - /** - * Calculate the HMAC-sha256 of a key and some data (raw strings) - */ - - function rstr_hmac(key, data) { - key = (utf8) ? utf8Encode(key) : key; - data = (utf8) ? utf8Encode(data) : data; - var hash, i = 0, - bkey = rstr2binb(key), - ipad = Array(16), - opad = Array(16); - - if (bkey.length > 16) { - bkey = binb(bkey, key.length * 8); - } - - for (; i < 16; i += 1) { - ipad[i] = bkey[i] ^ 0x36363636; - opad[i] = bkey[i] ^ 0x5C5C5C5C; - } - - hash = binb(ipad.concat(rstr2binb(data)), 512 + data.length * 8); - return binb2rstr(binb(opad.concat(hash), 512 + 256)); - } - - /* - * Main sha256 function, with its support functions - */ - - function sha256_S(X, n) { - return (X >>> n) | (X << (32 - n)); - } - - function sha256_R(X, n) { - return (X >>> n); - } - - function sha256_Ch(x, y, z) { - return ((x & y) ^ ((~x) & z)); - } - - function sha256_Maj(x, y, z) { - return ((x & y) ^ (x & z) ^ (y & z)); - } - - function sha256_Sigma0256(x) { - return (sha256_S(x, 2) ^ sha256_S(x, 13) ^ sha256_S(x, 22)); - } - - function sha256_Sigma1256(x) { - return (sha256_S(x, 6) ^ sha256_S(x, 11) ^ sha256_S(x, 25)); - } - - function sha256_Gamma0256(x) { - return (sha256_S(x, 7) ^ sha256_S(x, 18) ^ sha256_R(x, 3)); - } - - function sha256_Gamma1256(x) { - return (sha256_S(x, 17) ^ sha256_S(x, 19) ^ sha256_R(x, 10)); - } - - function sha256_Sigma0512(x) { - return (sha256_S(x, 28) ^ sha256_S(x, 34) ^ sha256_S(x, 39)); - } - - function sha256_Sigma1512(x) { - return (sha256_S(x, 14) ^ sha256_S(x, 18) ^ sha256_S(x, 41)); - } - - function sha256_Gamma0512(x) { - return (sha256_S(x, 1) ^ sha256_S(x, 8) ^ sha256_R(x, 7)); - } - - function sha256_Gamma1512(x) { - return (sha256_S(x, 19) ^ sha256_S(x, 61) ^ sha256_R(x, 6)); - } - - sha256_K = [ - 1116352408, 1899447441, -1245643825, -373957723, 961987163, 1508970993, -1841331548, -1424204075, -670586216, 310598401, 607225278, 1426881987, - 1925078388, -2132889090, -1680079193, -1046744716, -459576895, -272742522, - 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, -1740746414, -1473132947, -1341970488, -1084653625, -958395405, -710438585, - 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, - 1695183700, 1986661051, -2117940946, -1838011259, -1564481375, -1474664885, -1035236496, -949202525, -778901479, -694614492, -200395387, 275423344, - 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, - 1537002063, 1747873779, 1955562222, 2024104815, -2067236844, -1933114872, -1866530822, -1538233109, -1090935817, -965641998 - ]; - - function binb(m, l) { - var HASH = [1779033703, -1150833019, 1013904242, -1521486534, - 1359893119, -1694144372, 528734635, 1541459225 - ]; - var W = new Array(64); - var a, b, c, d, e, f, g, h; - var i, j, T1, T2; - - /* append padding */ - m[l >> 5] |= 0x80 << (24 - l % 32); - m[((l + 64 >> 9) << 4) + 15] = l; - - for (i = 0; i < m.length; i += 16) { - a = HASH[0]; - b = HASH[1]; - c = HASH[2]; - d = HASH[3]; - e = HASH[4]; - f = HASH[5]; - g = HASH[6]; - h = HASH[7]; - - for (j = 0; j < 64; j += 1) { - if (j < 16) { - W[j] = m[j + i]; - } else { - W[j] = safe_add(safe_add(safe_add(sha256_Gamma1256(W[j - 2]), W[j - 7]), - sha256_Gamma0256(W[j - 15])), W[j - 16]); - } - - T1 = safe_add(safe_add(safe_add(safe_add(h, sha256_Sigma1256(e)), sha256_Ch(e, f, g)), - sha256_K[j]), W[j]); - T2 = safe_add(sha256_Sigma0256(a), sha256_Maj(a, b, c)); - h = g; - g = f; - f = e; - e = safe_add(d, T1); - d = c; - c = b; - b = a; - a = safe_add(T1, T2); - } - - HASH[0] = safe_add(a, HASH[0]); - HASH[1] = safe_add(b, HASH[1]); - HASH[2] = safe_add(c, HASH[2]); - HASH[3] = safe_add(d, HASH[3]); - HASH[4] = safe_add(e, HASH[4]); - HASH[5] = safe_add(f, HASH[5]); - HASH[6] = safe_add(g, HASH[6]); - HASH[7] = safe_add(h, HASH[7]); - } - return HASH; - } - - }, - - /** - * @class Hashes.SHA512 - * @param {config} - * - * A JavaScript implementation of the Secure Hash Algorithm, SHA-512, as defined in FIPS 180-2 - * Version 2.2 Copyright Anonymous Contributor, Paul Johnston 2000 - 2009. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * See http://pajhome.org.uk/crypt/md5 for details. - */ - SHA512: function (options) { - /** - * Private properties configuration variables. You may need to tweak these to be compatible with - * the server-side, but the defaults work in most cases. - * @see this.setUpperCase() method - * @see this.setPad() method - */ - var hexcase = (options && typeof options.uppercase === 'boolean') ? options.uppercase : false, - /* hexadecimal output case format. false - lowercase; true - uppercase */ - b64pad = (options && typeof options.pad === 'string') ? options.pad : '=', - /* base-64 pad character. Default '=' for strict RFC compliance */ - utf8 = (options && typeof options.utf8 === 'boolean') ? options.utf8 : true, - /* enable/disable utf8 encoding */ - sha512_k; - - /* privileged (public) methods */ - this.hex = function (s) { - return rstr2hex(rstr(s)); - }; - this.b64 = function (s) { - return rstr2b64(rstr(s), b64pad); - }; - this.any = function (s, e) { - return rstr2any(rstr(s), e); - }; - this.raw = function (s) { - return rstr(s, utf8); - }; - this.hex_hmac = function (k, d) { - return rstr2hex(rstr_hmac(k, d)); - }; - this.b64_hmac = function (k, d) { - return rstr2b64(rstr_hmac(k, d), b64pad); - }; - this.any_hmac = function (k, d, e) { - return rstr2any(rstr_hmac(k, d), e); - }; - /** - * Perform a simple self-test to see if the VM is working - * @return {String} Hexadecimal hash sample - * @public - */ - this.vm_test = function () { - return hex('abc').toLowerCase() === '900150983cd24fb0d6963f7d28e17f72'; - }; - /** - * @description Enable/disable uppercase hexadecimal returned string - * @param {boolean} - * @return {Object} this - * @public - */ - this.setUpperCase = function (a) { - if (typeof a === 'boolean') { - hexcase = a; - } - return this; - }; - /** - * @description Defines a base64 pad string - * @param {string} Pad - * @return {Object} this - * @public - */ - this.setPad = function (a) { - b64pad = a || b64pad; - return this; - }; - /** - * @description Defines a base64 pad string - * @param {boolean} - * @return {Object} this - * @public - */ - this.setUTF8 = function (a) { - if (typeof a === 'boolean') { - utf8 = a; - } - return this; - }; - - /* private methods */ - - /** - * Calculate the SHA-512 of a raw string - */ - - function rstr(s) { - s = (utf8) ? utf8Encode(s) : s; - return binb2rstr(binb(rstr2binb(s), s.length * 8)); - } - /* - * Calculate the HMAC-SHA-512 of a key and some data (raw strings) - */ - - function rstr_hmac(key, data) { - key = (utf8) ? utf8Encode(key) : key; - data = (utf8) ? utf8Encode(data) : data; - - var hash, i = 0, - bkey = rstr2binb(key), - ipad = Array(32), - opad = Array(32); - - if (bkey.length > 32) { - bkey = binb(bkey, key.length * 8); - } - - for (; i < 32; i += 1) { - ipad[i] = bkey[i] ^ 0x36363636; - opad[i] = bkey[i] ^ 0x5C5C5C5C; - } - - hash = binb(ipad.concat(rstr2binb(data)), 1024 + data.length * 8); - return binb2rstr(binb(opad.concat(hash), 1024 + 512)); - } - - /** - * Calculate the SHA-512 of an array of big-endian dwords, and a bit length - */ - - function binb(x, len) { - var j, i, l, - W = new Array(80), - hash = new Array(16), - //Initial hash values - H = [ - new int64(0x6a09e667, -205731576), - new int64(-1150833019, -2067093701), - new int64(0x3c6ef372, -23791573), - new int64(-1521486534, 0x5f1d36f1), - new int64(0x510e527f, -1377402159), - new int64(-1694144372, 0x2b3e6c1f), - new int64(0x1f83d9ab, -79577749), - new int64(0x5be0cd19, 0x137e2179) - ], - T1 = new int64(0, 0), - T2 = new int64(0, 0), - a = new int64(0, 0), - b = new int64(0, 0), - c = new int64(0, 0), - d = new int64(0, 0), - e = new int64(0, 0), - f = new int64(0, 0), - g = new int64(0, 0), - h = new int64(0, 0), - //Temporary variables not specified by the document - s0 = new int64(0, 0), - s1 = new int64(0, 0), - Ch = new int64(0, 0), - Maj = new int64(0, 0), - r1 = new int64(0, 0), - r2 = new int64(0, 0), - r3 = new int64(0, 0); - - if (sha512_k === undefined) { - //SHA512 constants - sha512_k = [ - new int64(0x428a2f98, -685199838), new int64(0x71374491, 0x23ef65cd), - new int64(-1245643825, -330482897), new int64(-373957723, -2121671748), - new int64(0x3956c25b, -213338824), new int64(0x59f111f1, -1241133031), - new int64(-1841331548, -1357295717), new int64(-1424204075, -630357736), - new int64(-670586216, -1560083902), new int64(0x12835b01, 0x45706fbe), - new int64(0x243185be, 0x4ee4b28c), new int64(0x550c7dc3, -704662302), - new int64(0x72be5d74, -226784913), new int64(-2132889090, 0x3b1696b1), - new int64(-1680079193, 0x25c71235), new int64(-1046744716, -815192428), - new int64(-459576895, -1628353838), new int64(-272742522, 0x384f25e3), - new int64(0xfc19dc6, -1953704523), new int64(0x240ca1cc, 0x77ac9c65), - new int64(0x2de92c6f, 0x592b0275), new int64(0x4a7484aa, 0x6ea6e483), - new int64(0x5cb0a9dc, -1119749164), new int64(0x76f988da, -2096016459), - new int64(-1740746414, -295247957), new int64(-1473132947, 0x2db43210), - new int64(-1341970488, -1728372417), new int64(-1084653625, -1091629340), - new int64(-958395405, 0x3da88fc2), new int64(-710438585, -1828018395), - new int64(0x6ca6351, -536640913), new int64(0x14292967, 0xa0e6e70), - new int64(0x27b70a85, 0x46d22ffc), new int64(0x2e1b2138, 0x5c26c926), - new int64(0x4d2c6dfc, 0x5ac42aed), new int64(0x53380d13, -1651133473), - new int64(0x650a7354, -1951439906), new int64(0x766a0abb, 0x3c77b2a8), - new int64(-2117940946, 0x47edaee6), new int64(-1838011259, 0x1482353b), - new int64(-1564481375, 0x4cf10364), new int64(-1474664885, -1136513023), - new int64(-1035236496, -789014639), new int64(-949202525, 0x654be30), - new int64(-778901479, -688958952), new int64(-694614492, 0x5565a910), - new int64(-200395387, 0x5771202a), new int64(0x106aa070, 0x32bbd1b8), - new int64(0x19a4c116, -1194143544), new int64(0x1e376c08, 0x5141ab53), - new int64(0x2748774c, -544281703), new int64(0x34b0bcb5, -509917016), - new int64(0x391c0cb3, -976659869), new int64(0x4ed8aa4a, -482243893), - new int64(0x5b9cca4f, 0x7763e373), new int64(0x682e6ff3, -692930397), - new int64(0x748f82ee, 0x5defb2fc), new int64(0x78a5636f, 0x43172f60), - new int64(-2067236844, -1578062990), new int64(-1933114872, 0x1a6439ec), - new int64(-1866530822, 0x23631e28), new int64(-1538233109, -561857047), - new int64(-1090935817, -1295615723), new int64(-965641998, -479046869), - new int64(-903397682, -366583396), new int64(-779700025, 0x21c0c207), - new int64(-354779690, -840897762), new int64(-176337025, -294727304), - new int64(0x6f067aa, 0x72176fba), new int64(0xa637dc5, -1563912026), - new int64(0x113f9804, -1090974290), new int64(0x1b710b35, 0x131c471b), - new int64(0x28db77f5, 0x23047d84), new int64(0x32caab7b, 0x40c72493), - new int64(0x3c9ebe0a, 0x15c9bebc), new int64(0x431d67c4, -1676669620), - new int64(0x4cc5d4be, -885112138), new int64(0x597f299c, -60457430), - new int64(0x5fcb6fab, 0x3ad6faec), new int64(0x6c44198c, 0x4a475817) - ]; - } - - for (i = 0; i < 80; i += 1) { - W[i] = new int64(0, 0); - } - - // append padding to the source string. The format is described in the FIPS. - x[len >> 5] |= 0x80 << (24 - (len & 0x1f)); - x[((len + 128 >> 10) << 5) + 31] = len; - l = x.length; - for (i = 0; i < l; i += 32) { //32 dwords is the block size - int64copy(a, H[0]); - int64copy(b, H[1]); - int64copy(c, H[2]); - int64copy(d, H[3]); - int64copy(e, H[4]); - int64copy(f, H[5]); - int64copy(g, H[6]); - int64copy(h, H[7]); - - for (j = 0; j < 16; j += 1) { - W[j].h = x[i + 2 * j]; - W[j].l = x[i + 2 * j + 1]; - } - - for (j = 16; j < 80; j += 1) { - //sigma1 - int64rrot(r1, W[j - 2], 19); - int64revrrot(r2, W[j - 2], 29); - int64shr(r3, W[j - 2], 6); - s1.l = r1.l ^ r2.l ^ r3.l; - s1.h = r1.h ^ r2.h ^ r3.h; - //sigma0 - int64rrot(r1, W[j - 15], 1); - int64rrot(r2, W[j - 15], 8); - int64shr(r3, W[j - 15], 7); - s0.l = r1.l ^ r2.l ^ r3.l; - s0.h = r1.h ^ r2.h ^ r3.h; - - int64add4(W[j], s1, W[j - 7], s0, W[j - 16]); - } - - for (j = 0; j < 80; j += 1) { - //Ch - Ch.l = (e.l & f.l) ^ (~e.l & g.l); - Ch.h = (e.h & f.h) ^ (~e.h & g.h); - - //Sigma1 - int64rrot(r1, e, 14); - int64rrot(r2, e, 18); - int64revrrot(r3, e, 9); - s1.l = r1.l ^ r2.l ^ r3.l; - s1.h = r1.h ^ r2.h ^ r3.h; - - //Sigma0 - int64rrot(r1, a, 28); - int64revrrot(r2, a, 2); - int64revrrot(r3, a, 7); - s0.l = r1.l ^ r2.l ^ r3.l; - s0.h = r1.h ^ r2.h ^ r3.h; - - //Maj - Maj.l = (a.l & b.l) ^ (a.l & c.l) ^ (b.l & c.l); - Maj.h = (a.h & b.h) ^ (a.h & c.h) ^ (b.h & c.h); - - int64add5(T1, h, s1, Ch, sha512_k[j], W[j]); - int64add(T2, s0, Maj); - - int64copy(h, g); - int64copy(g, f); - int64copy(f, e); - int64add(e, d, T1); - int64copy(d, c); - int64copy(c, b); - int64copy(b, a); - int64add(a, T1, T2); - } - int64add(H[0], H[0], a); - int64add(H[1], H[1], b); - int64add(H[2], H[2], c); - int64add(H[3], H[3], d); - int64add(H[4], H[4], e); - int64add(H[5], H[5], f); - int64add(H[6], H[6], g); - int64add(H[7], H[7], h); - } - - //represent the hash as an array of 32-bit dwords - for (i = 0; i < 8; i += 1) { - hash[2 * i] = H[i].h; - hash[2 * i + 1] = H[i].l; - } - return hash; - } - - //A constructor for 64-bit numbers - - function int64(h, l) { - this.h = h; - this.l = l; - //this.toString = int64toString; - } - - //Copies src into dst, assuming both are 64-bit numbers - - function int64copy(dst, src) { - dst.h = src.h; - dst.l = src.l; - } - - //Right-rotates a 64-bit number by shift - //Won't handle cases of shift>=32 - //The function revrrot() is for that - - function int64rrot(dst, x, shift) { - dst.l = (x.l >>> shift) | (x.h << (32 - shift)); - dst.h = (x.h >>> shift) | (x.l << (32 - shift)); - } - - //Reverses the dwords of the source and then rotates right by shift. - //This is equivalent to rotation by 32+shift - - function int64revrrot(dst, x, shift) { - dst.l = (x.h >>> shift) | (x.l << (32 - shift)); - dst.h = (x.l >>> shift) | (x.h << (32 - shift)); - } - - //Bitwise-shifts right a 64-bit number by shift - //Won't handle shift>=32, but it's never needed in SHA512 - - function int64shr(dst, x, shift) { - dst.l = (x.l >>> shift) | (x.h << (32 - shift)); - dst.h = (x.h >>> shift); - } - - //Adds two 64-bit numbers - //Like the original implementation, does not rely on 32-bit operations - - function int64add(dst, x, y) { - var w0 = (x.l & 0xffff) + (y.l & 0xffff); - var w1 = (x.l >>> 16) + (y.l >>> 16) + (w0 >>> 16); - var w2 = (x.h & 0xffff) + (y.h & 0xffff) + (w1 >>> 16); - var w3 = (x.h >>> 16) + (y.h >>> 16) + (w2 >>> 16); - dst.l = (w0 & 0xffff) | (w1 << 16); - dst.h = (w2 & 0xffff) | (w3 << 16); - } - - //Same, except with 4 addends. Works faster than adding them one by one. - - function int64add4(dst, a, b, c, d) { - var w0 = (a.l & 0xffff) + (b.l & 0xffff) + (c.l & 0xffff) + (d.l & 0xffff); - var w1 = (a.l >>> 16) + (b.l >>> 16) + (c.l >>> 16) + (d.l >>> 16) + (w0 >>> 16); - var w2 = (a.h & 0xffff) + (b.h & 0xffff) + (c.h & 0xffff) + (d.h & 0xffff) + (w1 >>> 16); - var w3 = (a.h >>> 16) + (b.h >>> 16) + (c.h >>> 16) + (d.h >>> 16) + (w2 >>> 16); - dst.l = (w0 & 0xffff) | (w1 << 16); - dst.h = (w2 & 0xffff) | (w3 << 16); - } - - //Same, except with 5 addends - - function int64add5(dst, a, b, c, d, e) { - var w0 = (a.l & 0xffff) + (b.l & 0xffff) + (c.l & 0xffff) + (d.l & 0xffff) + (e.l & 0xffff), - w1 = (a.l >>> 16) + (b.l >>> 16) + (c.l >>> 16) + (d.l >>> 16) + (e.l >>> 16) + (w0 >>> 16), - w2 = (a.h & 0xffff) + (b.h & 0xffff) + (c.h & 0xffff) + (d.h & 0xffff) + (e.h & 0xffff) + (w1 >>> 16), - w3 = (a.h >>> 16) + (b.h >>> 16) + (c.h >>> 16) + (d.h >>> 16) + (e.h >>> 16) + (w2 >>> 16); - dst.l = (w0 & 0xffff) | (w1 << 16); - dst.h = (w2 & 0xffff) | (w3 << 16); - } - }, - /** - * @class Hashes.RMD160 - * @constructor - * @param {Object} [config] - * - * A JavaScript implementation of the RIPEMD-160 Algorithm - * Version 2.2 Copyright Jeremy Lin, Paul Johnston 2000 - 2009. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * See http://pajhome.org.uk/crypt/md5 for details. - * Also http://www.ocf.berkeley.edu/~jjlin/jsotp/ - */ - RMD160: function (options) { - /** - * Private properties configuration variables. You may need to tweak these to be compatible with - * the server-side, but the defaults work in most cases. - * @see this.setUpperCase() method - * @see this.setPad() method - */ - var hexcase = (options && typeof options.uppercase === 'boolean') ? options.uppercase : false, - /* hexadecimal output case format. false - lowercase; true - uppercase */ - b64pad = (options && typeof options.pad === 'string') ? options.pa : '=', - /* base-64 pad character. Default '=' for strict RFC compliance */ - utf8 = (options && typeof options.utf8 === 'boolean') ? options.utf8 : true, - /* enable/disable utf8 encoding */ - rmd160_r1 = [ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, - 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, - 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, - 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 - ], - rmd160_r2 = [ - 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, - 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, - 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, - 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, - 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 - ], - rmd160_s1 = [ - 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, - 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, - 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, - 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, - 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 - ], - rmd160_s2 = [ - 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, - 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, - 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, - 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, - 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 - ]; - - /* privileged (public) methods */ - this.hex = function (s) { - return rstr2hex(rstr(s, utf8)); - }; - this.b64 = function (s) { - return rstr2b64(rstr(s, utf8), b64pad); - }; - this.any = function (s, e) { - return rstr2any(rstr(s, utf8), e); - }; - this.raw = function (s) { - return rstr(s, utf8); - }; - this.hex_hmac = function (k, d) { - return rstr2hex(rstr_hmac(k, d)); - }; - this.b64_hmac = function (k, d) { - return rstr2b64(rstr_hmac(k, d), b64pad); - }; - this.any_hmac = function (k, d, e) { - return rstr2any(rstr_hmac(k, d), e); - }; - /** - * Perform a simple self-test to see if the VM is working - * @return {String} Hexadecimal hash sample - * @public - */ - this.vm_test = function () { - return hex('abc').toLowerCase() === '900150983cd24fb0d6963f7d28e17f72'; - }; - /** - * @description Enable/disable uppercase hexadecimal returned string - * @param {boolean} - * @return {Object} this - * @public - */ - this.setUpperCase = function (a) { - if (typeof a === 'boolean') { - hexcase = a; - } - return this; - }; - /** - * @description Defines a base64 pad string - * @param {string} Pad - * @return {Object} this - * @public - */ - this.setPad = function (a) { - if (typeof a !== 'undefined') { - b64pad = a; - } - return this; - }; - /** - * @description Defines a base64 pad string - * @param {boolean} - * @return {Object} this - * @public - */ - this.setUTF8 = function (a) { - if (typeof a === 'boolean') { - utf8 = a; - } - return this; - }; - - /* private methods */ - - /** - * Calculate the rmd160 of a raw string - */ - - function rstr(s) { - s = (utf8) ? utf8Encode(s) : s; - return binl2rstr(binl(rstr2binl(s), s.length * 8)); - } - - /** - * Calculate the HMAC-rmd160 of a key and some data (raw strings) - */ - - function rstr_hmac(key, data) { - key = (utf8) ? utf8Encode(key) : key; - data = (utf8) ? utf8Encode(data) : data; - var i, hash, - bkey = rstr2binl(key), - ipad = Array(16), - opad = Array(16); - - if (bkey.length > 16) { - bkey = binl(bkey, key.length * 8); - } - - for (i = 0; i < 16; i += 1) { - ipad[i] = bkey[i] ^ 0x36363636; - opad[i] = bkey[i] ^ 0x5C5C5C5C; - } - hash = binl(ipad.concat(rstr2binl(data)), 512 + data.length * 8); - return binl2rstr(binl(opad.concat(hash), 512 + 160)); - } - - /** - * Convert an array of little-endian words to a string - */ - - function binl2rstr(input) { - var i, output = '', - l = input.length * 32; - for (i = 0; i < l; i += 8) { - output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF); - } - return output; - } - - /** - * Calculate the RIPE-MD160 of an array of little-endian words, and a bit length. - */ - - function binl(x, len) { - var T, j, i, l, - h0 = 0x67452301, - h1 = 0xefcdab89, - h2 = 0x98badcfe, - h3 = 0x10325476, - h4 = 0xc3d2e1f0, - A1, B1, C1, D1, E1, - A2, B2, C2, D2, E2; - - /* append padding */ - x[len >> 5] |= 0x80 << (len % 32); - x[(((len + 64) >>> 9) << 4) + 14] = len; - l = x.length; - - for (i = 0; i < l; i += 16) { - A1 = A2 = h0; - B1 = B2 = h1; - C1 = C2 = h2; - D1 = D2 = h3; - E1 = E2 = h4; - for (j = 0; j <= 79; j += 1) { - T = safe_add(A1, rmd160_f(j, B1, C1, D1)); - T = safe_add(T, x[i + rmd160_r1[j]]); - T = safe_add(T, rmd160_K1(j)); - T = safe_add(bit_rol(T, rmd160_s1[j]), E1); - A1 = E1; - E1 = D1; - D1 = bit_rol(C1, 10); - C1 = B1; - B1 = T; - T = safe_add(A2, rmd160_f(79 - j, B2, C2, D2)); - T = safe_add(T, x[i + rmd160_r2[j]]); - T = safe_add(T, rmd160_K2(j)); - T = safe_add(bit_rol(T, rmd160_s2[j]), E2); - A2 = E2; - E2 = D2; - D2 = bit_rol(C2, 10); - C2 = B2; - B2 = T; - } - - T = safe_add(h1, safe_add(C1, D2)); - h1 = safe_add(h2, safe_add(D1, E2)); - h2 = safe_add(h3, safe_add(E1, A2)); - h3 = safe_add(h4, safe_add(A1, B2)); - h4 = safe_add(h0, safe_add(B1, C2)); - h0 = T; - } - return [h0, h1, h2, h3, h4]; - } - - // specific algorithm methods - - function rmd160_f(j, x, y, z) { - return (0 <= j && j <= 15) ? (x ^ y ^ z) : - (16 <= j && j <= 31) ? (x & y) | (~x & z) : - (32 <= j && j <= 47) ? (x | ~y) ^ z : - (48 <= j && j <= 63) ? (x & z) | (y & ~z) : - (64 <= j && j <= 79) ? x ^ (y | ~z) : - 'rmd160_f: j out of range'; - } - - function rmd160_K1(j) { - return (0 <= j && j <= 15) ? 0x00000000 : - (16 <= j && j <= 31) ? 0x5a827999 : - (32 <= j && j <= 47) ? 0x6ed9eba1 : - (48 <= j && j <= 63) ? 0x8f1bbcdc : - (64 <= j && j <= 79) ? 0xa953fd4e : - 'rmd160_K1: j out of range'; - } - - function rmd160_K2(j) { - return (0 <= j && j <= 15) ? 0x50a28be6 : - (16 <= j && j <= 31) ? 0x5c4dd124 : - (32 <= j && j <= 47) ? 0x6d703ef3 : - (48 <= j && j <= 63) ? 0x7a6d76e9 : - (64 <= j && j <= 79) ? 0x00000000 : - 'rmd160_K2: j out of range'; - } - } - }; - - // new MD5 instance - var MD5 = new pearHash.MD5 - // new SHA1 instance - var SHA1 = new pearHash.SHA1 - // new SHA256 instance - var SHA256 = new pearHash.SHA256 - // new SHA512 instace - var SHA512 = new pearHash.SHA512 - // new RIPEMD-160 instace - var RMD160 = new pearHash.RMD160 - var Base64 = new pearHash.Base64 - - pearHash.md5 = function (str) { - return MD5.hex(str); - } - pearHash.sha1 = function (str) { - return SHA1.hex(str); - } - pearHash.sha256 = function (str) { - return SHA256.hex(str); - } - pearHash.sha512 = function (str) { - return SHA512.hex(str); - } - pearHash.crc32 = pearHash.CRC32; - pearHash.rmd160 = function (str) { - return RMD160.hex(str); - } - pearHash.Base64Encode = function (str) { - return Base64.encode(str); - } - pearHash.Base64Decode = function (str) { - return Base64.decode(str); - } - exports('encrypt', pearHash); -}); \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/module/count.js b/src/plugin/admin/public/component/pear/module/extends/count.js similarity index 99% rename from src/plugin/admin/public/component/pear/module/count.js rename to src/plugin/admin/public/component/pear/module/extends/count.js index c9a659f0..fed58932 100644 --- a/src/plugin/admin/public/component/pear/module/count.js +++ b/src/plugin/admin/public/component/pear/module/extends/count.js @@ -34,4 +34,4 @@ layui.define(['jquery', 'element'], function(exports) { } exports(MOD_NAME, count); -}); +}); \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/module/echarts.js b/src/plugin/admin/public/component/pear/module/extends/echarts.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/echarts.js rename to src/plugin/admin/public/component/pear/module/extends/echarts.js diff --git a/src/plugin/admin/public/component/pear/module/echartsTheme.js b/src/plugin/admin/public/component/pear/module/extends/echartsTheme.js similarity index 87% rename from src/plugin/admin/public/component/pear/module/echartsTheme.js rename to src/plugin/admin/public/component/pear/module/extends/echartsTheme.js index 2cf0bfae..c0c029ba 100644 --- a/src/plugin/admin/public/component/pear/module/echartsTheme.js +++ b/src/plugin/admin/public/component/pear/module/extends/echartsTheme.js @@ -1,4 +1,4 @@ -layui.define(function(exports) { +layui.define(function (exports) { exports('echartsTheme', { "color": [ @@ -21,10 +21,10 @@ layui.define(function(exports) { }, "line": { "itemStyle": { - "borderWidth": "3" + "borderWidth": "3" }, "lineStyle": { - "width": "4" + "width": "4" }, "symbolSize": "10", "symbol": "emptyCircle", @@ -32,10 +32,10 @@ layui.define(function(exports) { }, "radar": { "itemStyle": { - "borderWidth": "3" + "borderWidth": "3" }, "lineStyle": { - "width": "4" + "width": "4" }, "symbolSize": "10", "symbol": "emptyCircle", @@ -43,8 +43,8 @@ layui.define(function(exports) { }, "bar": { "itemStyle": { - "barBorderWidth": 0, - "barBorderColor": "#ccc" + "barBorderWidth": 0, + "barBorderColor": "#ccc" }, "emphasis": { "itemStyle": { @@ -55,8 +55,8 @@ layui.define(function(exports) { }, "pie": { "itemStyle": { - "borderWidth": 0, - "borderColor": "#ccc" + "borderWidth": 0, + "borderColor": "#ccc" }, "emphasis": { "itemStyle": { @@ -67,8 +67,8 @@ layui.define(function(exports) { }, "scatter": { "itemStyle": { - "borderWidth": 0, - "borderColor": "#ccc" + "borderWidth": 0, + "borderColor": "#ccc" }, "emphasis": { "itemStyle": { @@ -81,7 +81,7 @@ layui.define(function(exports) { "itemStyle": { "borderWidth": 0, "borderColor": "#ccc" - + }, "emphasis": { "itemStyle": { @@ -92,8 +92,8 @@ layui.define(function(exports) { }, "parallel": { "itemStyle": { - "borderWidth": 0, - "borderColor": "#ccc" + "borderWidth": 0, + "borderColor": "#ccc" }, "emphasis": { "itemStyle": { @@ -153,8 +153,8 @@ layui.define(function(exports) { "borderColor": "#ccc" }, "lineStyle": { - "width": "1", - "color": "#cccccc" + "width": "1", + "color": "#cccccc" }, "symbolSize": "10", "symbol": "emptyCircle", @@ -167,8 +167,8 @@ layui.define(function(exports) { "#c4ebad", "#96dee8" ], - "label": { - "color": "#ffffff" + "label": { + "color": "#ffffff" } }, "map": { @@ -177,7 +177,7 @@ layui.define(function(exports) { "borderColor": "#aaaaaa", "borderWidth": 0.5 }, - "label": { + "label": { "color": "#ffffff" }, "emphasis": { @@ -186,7 +186,7 @@ layui.define(function(exports) { "borderColor": "#3fb1e3", "borderWidth": 1 }, - "label":{ + "label": { "color": "rgb(63,177,227)" } } @@ -206,7 +206,7 @@ layui.define(function(exports) { "borderColor": "#3fb1e3", "borderWidth": 1 }, - "label":{ + "label": { "color": "rgb(63,177,227)" } } @@ -226,9 +226,9 @@ layui.define(function(exports) { }, "axisLabel": { "show": true, - + "color": "#999999" - + }, "splitLine": { "show": true, @@ -262,9 +262,9 @@ layui.define(function(exports) { } }, "axisLabel": { - "show": true, + "show": true, "color": "#999999" - + }, "splitLine": { "show": true, @@ -298,9 +298,9 @@ layui.define(function(exports) { } }, "axisLabel": { - "show": true, + "show": true, "color": "#999999" - + }, "splitLine": { "show": true, @@ -335,9 +335,9 @@ layui.define(function(exports) { }, "axisLabel": { "show": true, - + "color": "#999999" - + }, "splitLine": { "show": true, @@ -359,7 +359,7 @@ layui.define(function(exports) { }, "toolbox": { "iconStyle": { - "borderColor": "#999999" + "borderColor": "#999999" }, "emphasis": { "iconStyle": { @@ -389,33 +389,33 @@ layui.define(function(exports) { "color": "#626c91", "width": 1 }, - "itemStyle": { + "itemStyle": { "color": "#626c91", - "borderWidth": 1 - - }, - "controlStyle": { + "borderWidth": 1 + + }, + "controlStyle": { "color": "#626c91", "borderColor": "#626c91", - "borderWidth": 0.5 + "borderWidth": 0.5 }, "checkpointStyle": { "color": "#3fb1e3", "borderColor": "rgba(63,177,227,0.15)" }, - "label": { - "color": "#626c91" + "label": { + "color": "#626c91" }, "emphasis": { "itemStyle": { "color": "#626c91" }, - "controlStyle":{ + "controlStyle": { "color": "#626c91", "borderColor": "#626c91", "borderWidth": 0.5 }, - "label":{ + "label": { "color": "#626c91" } } @@ -437,8 +437,8 @@ layui.define(function(exports) { } }, "markPoint": { - "label": { - "color": "#ffffff" + "label": { + "color": "#ffffff" }, "emphasis": { "label": { diff --git a/src/plugin/admin/public/component/pear/module/nprogress.js b/src/plugin/admin/public/component/pear/module/extends/nprogress.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/nprogress.js rename to src/plugin/admin/public/component/pear/module/extends/nprogress.js diff --git a/src/plugin/admin/public/component/pear/module/popup.js b/src/plugin/admin/public/component/pear/module/extends/popup.js similarity index 81% rename from src/plugin/admin/public/component/pear/module/popup.js rename to src/plugin/admin/public/component/pear/module/extends/popup.js index 376edaf6..769ed930 100644 --- a/src/plugin/admin/public/component/pear/module/popup.js +++ b/src/plugin/admin/public/component/pear/module/extends/popup.js @@ -1,10 +1,8 @@ -layui.define(['layer', 'jquery', 'element'], function(exports) { +layui.define(['layer'], function(exports) { "use strict"; var MOD_NAME = 'popup', - $ = layui.jquery, - layer = layui.layer, - element = layui.element; + layer = layui.layer; var popup = new function() { @@ -35,13 +33,13 @@ layui.define(['layer', 'jquery', 'element'], function(exports) { this.failure = function(msg, callback) { layer.msg(msg, { icon: 2, - time: 3000 + time: 1000 }, callback); }, this.warming = function(msg, callback) { layer.msg(msg, { icon: 3, - time: 2000 + time: 1000 }, callback); } }; diff --git a/src/plugin/admin/public/component/pear/module/toast.js b/src/plugin/admin/public/component/pear/module/extends/toast.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/toast.js rename to src/plugin/admin/public/component/pear/module/extends/toast.js diff --git a/src/plugin/admin/public/component/pear/module/yaml.js b/src/plugin/admin/public/component/pear/module/extends/yaml.js similarity index 90% rename from src/plugin/admin/public/component/pear/module/yaml.js rename to src/plugin/admin/public/component/pear/module/extends/yaml.js index bb448bc5..77eefb84 100644 --- a/src/plugin/admin/public/component/pear/module/yaml.js +++ b/src/plugin/admin/public/component/pear/module/extends/yaml.js @@ -1,15 +1,13 @@ -layui.define(['jquery', 'element'], function(exports) { +layui.define(['jquery', 'element'], function (exports) { "use strict"; - var MOD_NAME = 'yaml', - $ = layui.jquery, - element = layui.element; + var MOD_NAME = 'yaml'; - var yaml = new function() { - this.parse = function(str){ - return YAML.parse(yamlString); + var yaml = new function () { + this.parse = function (yamlStr) { + return YAML.parse(yamlStr); } - this.load = function(path){ + this.load = function (path) { return YAML.load(path); } } @@ -17,7 +15,7 @@ layui.define(['jquery', 'element'], function(exports) { }); -(function() { +(function () { function r(e, n, t) { function o(i, f) { if (!n[i]) { @@ -31,7 +29,7 @@ layui.define(['jquery', 'element'], function(exports) { var p = n[i] = { exports: {} }; - e[i][0].call(p.exports, function(r) { + e[i][0].call(p.exports, function (r) { var n = e[i][1][r]; return o(n || r) }, p, p.exports, r, e, n, t) @@ -43,19 +41,19 @@ layui.define(['jquery', 'element'], function(exports) { } return r })()({ - 1: [function(require, module, exports) { + 1: [function (require, module, exports) { var Dumper, Inline, Utils; Utils = require('./Utils'); Inline = require('./Inline'); - Dumper = (function() { - function Dumper() {} + Dumper = (function () { + function Dumper() { } Dumper.indentation = 4; - Dumper.prototype.dump = function(input, inline, indent, exceptionOnInvalidType, objectEncoder) { + Dumper.prototype.dump = function (input, inline, indent, exceptionOnInvalidType, objectEncoder) { var i, key, len, output, prefix, value, willBeInlined; if (inline == null) { inline = 0; @@ -90,7 +88,7 @@ layui.define(['jquery', 'element'], function(exports) { willBeInlined = inline - 1 <= 0 || typeof value !== 'object' || Utils.isEmpty(value); output += prefix + Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' + (willBeInlined ? ' ' : "\n") + this.dump(value, inline - 1, (willBeInlined ? 0 : indent + this.indentation), - exceptionOnInvalidType, objectEncoder) + (willBeInlined ? "\n" : ''); + exceptionOnInvalidType, objectEncoder) + (willBeInlined ? "\n" : ''); } } } @@ -108,20 +106,20 @@ layui.define(['jquery', 'element'], function(exports) { "./Inline": 6, "./Utils": 10 }], - 2: [function(require, module, exports) { + 2: [function (require, module, exports) { var Escaper, Pattern; Pattern = require('./Pattern'); - Escaper = (function() { + Escaper = (function () { var ch; - function Escaper() {} + function Escaper() { } Escaper.LIST_ESCAPEES = ['\\', '\\\\', '\\"', '"', "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", (ch = String.fromCharCode) - (0x0085), ch(0x00A0), ch(0x2028), ch(0x2029) + (0x0085), ch(0x00A0), ch(0x2028), ch(0x2029) ]; Escaper.LIST_ESCAPED = ['\\\\', '\\"', '\\"', '\\"', "\\0", "\\x01", "\\x02", "\\x03", "\\x04", "\\x05", @@ -130,7 +128,7 @@ layui.define(['jquery', 'element'], function(exports) { "\\x1f", "\\N", "\\_", "\\L", "\\P" ]; - Escaper.MAPPING_ESCAPEES_TO_ESCAPED = (function() { + Escaper.MAPPING_ESCAPEES_TO_ESCAPED = (function () { var i, j, mapping, ref; mapping = {}; for (i = j = 0, ref = Escaper.LIST_ESCAPEES.length; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) { @@ -145,25 +143,25 @@ layui.define(['jquery', 'element'], function(exports) { Escaper.PATTERN_SINGLE_QUOTING = new Pattern('[\\s\'":{}[\\],&*#?]|^[-?|<>=!%@`]'); - Escaper.requiresDoubleQuoting = function(value) { + Escaper.requiresDoubleQuoting = function (value) { return this.PATTERN_CHARACTERS_TO_ESCAPE.test(value); }; - Escaper.escapeWithDoubleQuotes = function(value) { + Escaper.escapeWithDoubleQuotes = function (value) { var result; - result = this.PATTERN_MAPPING_ESCAPEES.replace(value, (function(_this) { - return function(str) { + result = this.PATTERN_MAPPING_ESCAPEES.replace(value, (function (_this) { + return function (str) { return _this.MAPPING_ESCAPEES_TO_ESCAPED[str]; }; })(this)); return '"' + result + '"'; }; - Escaper.requiresSingleQuoting = function(value) { + Escaper.requiresSingleQuoting = function (value) { return this.PATTERN_SINGLE_QUOTING.test(value); }; - Escaper.escapeWithSingleQuotes = function(value) { + Escaper.escapeWithSingleQuotes = function (value) { return "'" + value.replace(/'/g, "''") + "'"; }; @@ -177,9 +175,9 @@ layui.define(['jquery', 'element'], function(exports) { }, { "./Pattern": 8 }], - 3: [function(require, module, exports) { + 3: [function (require, module, exports) { var DumpException, - extend = function(child, parent) { + extend = function (child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } @@ -194,7 +192,7 @@ layui.define(['jquery', 'element'], function(exports) { }, hasProp = {}.hasOwnProperty; - DumpException = (function(superClass) { + DumpException = (function (superClass) { extend(DumpException, superClass); function DumpException(message, parsedLine, snippet) { @@ -204,7 +202,7 @@ layui.define(['jquery', 'element'], function(exports) { this.snippet = snippet; } - DumpException.prototype.toString = function() { + DumpException.prototype.toString = function () { if ((this.parsedLine != null) && (this.snippet != null)) { return ' ' + this.message + ' (line ' + this.parsedLine + ': \'' + this.snippet + '\')'; } else { @@ -220,9 +218,9 @@ layui.define(['jquery', 'element'], function(exports) { }, {}], - 4: [function(require, module, exports) { + 4: [function (require, module, exports) { var ParseException, - extend = function(child, parent) { + extend = function (child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } @@ -237,7 +235,7 @@ layui.define(['jquery', 'element'], function(exports) { }, hasProp = {}.hasOwnProperty; - ParseException = (function(superClass) { + ParseException = (function (superClass) { extend(ParseException, superClass); function ParseException(message, parsedLine, snippet) { @@ -247,7 +245,7 @@ layui.define(['jquery', 'element'], function(exports) { this.snippet = snippet; } - ParseException.prototype.toString = function() { + ParseException.prototype.toString = function () { if ((this.parsedLine != null) && (this.snippet != null)) { return ' ' + this.message + ' (line ' + this.parsedLine + ': \'' + this.snippet + '\')'; } else { @@ -263,9 +261,9 @@ layui.define(['jquery', 'element'], function(exports) { }, {}], - 5: [function(require, module, exports) { + 5: [function (require, module, exports) { var ParseMore, - extend = function(child, parent) { + extend = function (child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } @@ -280,7 +278,7 @@ layui.define(['jquery', 'element'], function(exports) { }, hasProp = {}.hasOwnProperty; - ParseMore = (function(superClass) { + ParseMore = (function (superClass) { extend(ParseMore, superClass); function ParseMore(message, parsedLine, snippet) { @@ -290,7 +288,7 @@ layui.define(['jquery', 'element'], function(exports) { this.snippet = snippet; } - ParseMore.prototype.toString = function() { + ParseMore.prototype.toString = function () { if ((this.parsedLine != null) && (this.snippet != null)) { return ' ' + this.message + ' (line ' + this.parsedLine + ': \'' + this.snippet + '\')'; } else { @@ -306,9 +304,9 @@ layui.define(['jquery', 'element'], function(exports) { }, {}], - 6: [function(require, module, exports) { + 6: [function (require, module, exports) { var DumpException, Escaper, Inline, ParseException, ParseMore, Pattern, Unescaper, Utils, - indexOf = [].indexOf || function(item) { + indexOf = [].indexOf || function (item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } @@ -329,8 +327,8 @@ layui.define(['jquery', 'element'], function(exports) { DumpException = require('./Exception/DumpException'); - Inline = (function() { - function Inline() {} + Inline = (function () { + function Inline() { } Inline.REGEX_QUOTED_STRING = '(?:"(?:[^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'(?:[^\']*(?:\'\'[^\']*)*)\')'; @@ -344,7 +342,7 @@ layui.define(['jquery', 'element'], function(exports) { Inline.settings = {}; - Inline.configure = function(exceptionOnInvalidType, objectDecoder) { + Inline.configure = function (exceptionOnInvalidType, objectDecoder) { if (exceptionOnInvalidType == null) { exceptionOnInvalidType = null; } @@ -355,7 +353,7 @@ layui.define(['jquery', 'element'], function(exports) { this.settings.objectDecoder = objectDecoder; }; - Inline.parse = function(value, exceptionOnInvalidType, objectDecoder) { + Inline.parse = function (value, exceptionOnInvalidType, objectDecoder) { var context, result; if (exceptionOnInvalidType == null) { exceptionOnInvalidType = false; @@ -395,7 +393,7 @@ layui.define(['jquery', 'element'], function(exports) { return result; }; - Inline.dump = function(value, exceptionOnInvalidType, objectEncoder) { + Inline.dump = function (value, exceptionOnInvalidType, objectEncoder) { var ref, result, type; if (exceptionOnInvalidType == null) { exceptionOnInvalidType = false; @@ -448,7 +446,7 @@ layui.define(['jquery', 'element'], function(exports) { return value; }; - Inline.dumpObject = function(value, exceptionOnInvalidType, objectSupport) { + Inline.dumpObject = function (value, exceptionOnInvalidType, objectSupport) { var j, key, len1, output, val; if (objectSupport == null) { objectSupport = null; @@ -470,7 +468,7 @@ layui.define(['jquery', 'element'], function(exports) { } }; - Inline.parseScalar = function(scalar, delimiters, stringDelimiters, context, evaluate) { + Inline.parseScalar = function (scalar, delimiters, stringDelimiters, context, evaluate) { var i, joinedDelimiters, match, output, pattern, ref, ref1, strpos, tmp; if (delimiters == null) { delimiters = null; @@ -531,7 +529,7 @@ layui.define(['jquery', 'element'], function(exports) { return output; }; - Inline.parseQuotedScalar = function(scalar, context) { + Inline.parseQuotedScalar = function (scalar, context) { var i, match, output; i = context.i; if (!(match = this.PATTERN_QUOTED_SCALAR.exec(scalar.slice(i)))) { @@ -548,7 +546,7 @@ layui.define(['jquery', 'element'], function(exports) { return output; }; - Inline.parseSequence = function(sequence, context) { + Inline.parseSequence = function (sequence, context) { var e, error, i, isQuoted, len, output, ref, value; output = []; len = sequence.length; @@ -590,7 +588,7 @@ layui.define(['jquery', 'element'], function(exports) { throw new ParseMore('Malformed inline YAML string ' + sequence); }; - Inline.parseMapping = function(mapping, context) { + Inline.parseMapping = function (mapping, context) { var done, i, key, len, output, shouldContinueWhileLoop, value; output = {}; len = mapping.length; @@ -658,7 +656,7 @@ layui.define(['jquery', 'element'], function(exports) { throw new ParseMore('Malformed inline YAML string ' + mapping); }; - Inline.evaluateScalar = function(scalar, context) { + Inline.evaluateScalar = function (scalar, context) { var cast, date, exceptionOnInvalidType, firstChar, firstSpace, firstWord, objectDecoder, raw, scalarLower, subValue, trimmedScalar; scalar = Utils.trim(scalar); @@ -808,7 +806,7 @@ layui.define(['jquery', 'element'], function(exports) { "./Unescaper": 9, "./Utils": 10 }], - 7: [function(require, module, exports) { + 7: [function (require, module, exports) { var Inline, ParseException, ParseMore, Parser, Pattern, Utils; Inline = require('./Inline'); @@ -821,7 +819,7 @@ layui.define(['jquery', 'element'], function(exports) { ParseMore = require('./Exception/ParseMore'); - Parser = (function() { + Parser = (function () { Parser.prototype.PATTERN_FOLDED_SCALAR_ALL = new Pattern( '^(?:(?![^\\|>]*)\\s+)?(?\\||>)(?\\+|\\-|\\d+|\\+\\d+|\\-\\d+|\\d+\\+|\\d+\\-)?(? +#.*)?$' ); @@ -869,7 +867,7 @@ layui.define(['jquery', 'element'], function(exports) { this.refs = {}; } - Parser.prototype.parse = function(value, exceptionOnInvalidType, objectDecoder) { + Parser.prototype.parse = function (value, exceptionOnInvalidType, objectDecoder) { var alias, allowOverwrite, block, c, context, data, e, error, error1, error2, first, i, indent, isRef, j, k, key, l, lastKey, len, len1, len2, len3, lineCount, m, matches, mergeNode, n, name, parsed, parsedItem, parser, ref, ref1, ref2, refName, refValue, val, values; @@ -907,7 +905,7 @@ layui.define(['jquery', 'element'], function(exports) { values.value = matches.value; } if (!(values.value != null) || '' === Utils.trim(values.value, ' ') || Utils.ltrim(values.value, ' ').indexOf( - '#') === 0) { + '#') === 0) { if (this.currentLineNb < this.lines.length - 1 && !this.isNextLineUnIndentedCollection()) { c = this.getRealCurrentLineNb() + 1; parser = new Parser(c); @@ -918,7 +916,7 @@ layui.define(['jquery', 'element'], function(exports) { } } else { if (((ref = values.leadspaces) != null ? ref.length : void 0) && (matches = this.PATTERN_COMPACT_NOTATION.exec( - values.value))) { + values.value))) { c = this.getRealCurrentLineNb(); parser = new Parser(c); parser.refs = this.refs; @@ -1112,15 +1110,15 @@ layui.define(['jquery', 'element'], function(exports) { } }; - Parser.prototype.getRealCurrentLineNb = function() { + Parser.prototype.getRealCurrentLineNb = function () { return this.currentLineNb + this.offset; }; - Parser.prototype.getCurrentLineIndentation = function() { + Parser.prototype.getCurrentLineIndentation = function () { return this.currentLine.length - Utils.ltrim(this.currentLine, ' ').length; }; - Parser.prototype.getNextEmbedBlock = function(indentation, includeUnindentedCollection) { + Parser.prototype.getNextEmbedBlock = function (indentation, includeUnindentedCollection) { var data, indent, isItUnindentedCollection, newIndent, removeComments, removeCommentsPattern, unindentedEmbedBlock; if (indentation == null) { @@ -1176,7 +1174,7 @@ layui.define(['jquery', 'element'], function(exports) { return data.join("\n"); }; - Parser.prototype.moveToNextLine = function() { + Parser.prototype.moveToNextLine = function () { if (this.currentLineNb >= this.lines.length - 1) { return false; } @@ -1184,11 +1182,11 @@ layui.define(['jquery', 'element'], function(exports) { return true; }; - Parser.prototype.moveToPreviousLine = function() { + Parser.prototype.moveToPreviousLine = function () { this.currentLine = this.lines[--this.currentLineNb]; }; - Parser.prototype.parseValue = function(value, exceptionOnInvalidType, objectDecoder) { + Parser.prototype.parseValue = function (value, exceptionOnInvalidType, objectDecoder) { var e, error, foldedIndent, matches, modifiers, pos, ref, ref1, val; if (0 === value.indexOf('*')) { pos = value.indexOf('#'); @@ -1239,7 +1237,7 @@ layui.define(['jquery', 'element'], function(exports) { } }; - Parser.prototype.parseFoldedScalar = function(separator, indicator, indentation) { + Parser.prototype.parseFoldedScalar = function (separator, indicator, indentation) { var isCurrentLineBlank, j, len, line, matches, newText, notEOF, pattern, ref, text; if (indicator == null) { indicator = ''; @@ -1311,7 +1309,7 @@ layui.define(['jquery', 'element'], function(exports) { return text; }; - Parser.prototype.isNextLineIndented = function(ignoreComments) { + Parser.prototype.isNextLineIndented = function (ignoreComments) { var EOF, currentIndentation, ret; if (ignoreComments == null) { ignoreComments = true; @@ -1338,23 +1336,23 @@ layui.define(['jquery', 'element'], function(exports) { return ret; }; - Parser.prototype.isCurrentLineEmpty = function() { + Parser.prototype.isCurrentLineEmpty = function () { var trimmedLine; trimmedLine = Utils.trim(this.currentLine, ' '); return trimmedLine.length === 0 || trimmedLine.charAt(0) === '#'; }; - Parser.prototype.isCurrentLineBlank = function() { + Parser.prototype.isCurrentLineBlank = function () { return '' === Utils.trim(this.currentLine, ' '); }; - Parser.prototype.isCurrentLineComment = function() { + Parser.prototype.isCurrentLineComment = function () { var ltrimmedLine; ltrimmedLine = Utils.ltrim(this.currentLine, ' '); return ltrimmedLine.charAt(0) === '#'; }; - Parser.prototype.cleanup = function(value) { + Parser.prototype.cleanup = function (value) { var count, i, indent, j, l, len, len1, line, lines, ref, ref1, ref2, smallestIndent, trimmedValue; if (value.indexOf("\r") !== -1) { value = value.split("\r\n").join("\n").split("\r").join("\n"); @@ -1395,7 +1393,7 @@ layui.define(['jquery', 'element'], function(exports) { return value; }; - Parser.prototype.isNextLineUnIndentedCollection = function(currentIndentation) { + Parser.prototype.isNextLineUnIndentedCollection = function (currentIndentation) { var notEOF, ret; if (currentIndentation == null) { currentIndentation = null; @@ -1418,7 +1416,7 @@ layui.define(['jquery', 'element'], function(exports) { return ret; }; - Parser.prototype.isStringUnIndentedCollectionItem = function() { + Parser.prototype.isStringUnIndentedCollectionItem = function () { return this.currentLine === '-' || this.currentLine.slice(0, 2) === '- '; }; @@ -1436,10 +1434,10 @@ layui.define(['jquery', 'element'], function(exports) { "./Pattern": 8, "./Utils": 10 }], - 8: [function(require, module, exports) { + 8: [function (require, module, exports) { var Pattern; - Pattern = (function() { + Pattern = (function () { Pattern.prototype.regex = null; Pattern.prototype.rawRegex = null; @@ -1508,7 +1506,7 @@ layui.define(['jquery', 'element'], function(exports) { this.mapping = mapping; } - Pattern.prototype.exec = function(str) { + Pattern.prototype.exec = function (str) { var index, matches, name, ref; this.regex.lastIndex = 0; matches = this.regex.exec(str); @@ -1525,17 +1523,17 @@ layui.define(['jquery', 'element'], function(exports) { return matches; }; - Pattern.prototype.test = function(str) { + Pattern.prototype.test = function (str) { this.regex.lastIndex = 0; return this.regex.test(str); }; - Pattern.prototype.replace = function(str, replacement) { + Pattern.prototype.replace = function (str, replacement) { this.regex.lastIndex = 0; return str.replace(this.regex, replacement); }; - Pattern.prototype.replaceAll = function(str, replacement, limit) { + Pattern.prototype.replaceAll = function (str, replacement, limit) { var count; if (limit == null) { limit = 0; @@ -1558,27 +1556,27 @@ layui.define(['jquery', 'element'], function(exports) { }, {}], - 9: [function(require, module, exports) { + 9: [function (require, module, exports) { var Pattern, Unescaper, Utils; Utils = require('./Utils'); Pattern = require('./Pattern'); - Unescaper = (function() { - function Unescaper() {} + Unescaper = (function () { + function Unescaper() { } Unescaper.PATTERN_ESCAPED_CHARACTER = new Pattern( '\\\\([0abt\tnvfre "\\/\\\\N_LP]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})'); - Unescaper.unescapeSingleQuotedString = function(value) { + Unescaper.unescapeSingleQuotedString = function (value) { return value.replace(/\'\'/g, '\''); }; - Unescaper.unescapeDoubleQuotedString = function(value) { + Unescaper.unescapeDoubleQuotedString = function (value) { if (this._unescapeCallback == null) { - this._unescapeCallback = (function(_this) { - return function(str) { + this._unescapeCallback = (function (_this) { + return function (str) { return _this.unescapeCharacter(str); }; })(this); @@ -1586,7 +1584,7 @@ layui.define(['jquery', 'element'], function(exports) { return this.PATTERN_ESCAPED_CHARACTER.replace(value, this._unescapeCallback); }; - Unescaper.unescapeCharacter = function(value) { + Unescaper.unescapeCharacter = function (value) { var ch; ch = String.fromCharCode; switch (value.charAt(1)) { @@ -1648,14 +1646,14 @@ layui.define(['jquery', 'element'], function(exports) { "./Pattern": 8, "./Utils": 10 }], - 10: [function(require, module, exports) { + 10: [function (require, module, exports) { var Pattern, Utils, hasProp = {}.hasOwnProperty; Pattern = require('./Pattern'); - Utils = (function() { - function Utils() {} + Utils = (function () { + function Utils() { } Utils.REGEX_LEFT_TRIM_BY_CHAR = {}; @@ -1677,7 +1675,7 @@ layui.define(['jquery', 'element'], function(exports) { Utils.LOCAL_TIMEZONE_OFFSET = new Date().getTimezoneOffset() * 60 * 1000; - Utils.trim = function(str, _char) { + Utils.trim = function (str, _char) { var regexLeft, regexRight; if (_char == null) { _char = '\\s'; @@ -1695,7 +1693,7 @@ layui.define(['jquery', 'element'], function(exports) { return str.replace(regexLeft, '').replace(regexRight, ''); }; - Utils.ltrim = function(str, _char) { + Utils.ltrim = function (str, _char) { var regexLeft; if (_char == null) { _char = '\\s'; @@ -1708,7 +1706,7 @@ layui.define(['jquery', 'element'], function(exports) { return str.replace(regexLeft, ''); }; - Utils.rtrim = function(str, _char) { + Utils.rtrim = function (str, _char) { var regexRight; if (_char == null) { _char = '\\s'; @@ -1721,14 +1719,14 @@ layui.define(['jquery', 'element'], function(exports) { return str.replace(regexRight, ''); }; - Utils.isEmpty = function(value) { + Utils.isEmpty = function (value) { return !value || value === '' || value === '0' || (value instanceof Array && value.length === 0) || this.isEmptyObject( value); }; - Utils.isEmptyObject = function(value) { + Utils.isEmptyObject = function (value) { var k; - return value instanceof Object && ((function() { + return value instanceof Object && ((function () { var results; results = []; for (k in value) { @@ -1739,7 +1737,7 @@ layui.define(['jquery', 'element'], function(exports) { })()).length === 0; }; - Utils.subStrCount = function(string, subString, start, length) { + Utils.subStrCount = function (string, subString, start, length) { var c, i, j, len, ref, sublen; c = 0; string = '' + string; @@ -1761,17 +1759,17 @@ layui.define(['jquery', 'element'], function(exports) { return c; }; - Utils.isDigits = function(input) { + Utils.isDigits = function (input) { this.REGEX_DIGITS.lastIndex = 0; return this.REGEX_DIGITS.test(input); }; - Utils.octDec = function(input) { + Utils.octDec = function (input) { this.REGEX_OCTAL.lastIndex = 0; return parseInt((input + '').replace(this.REGEX_OCTAL, ''), 8); }; - Utils.hexDec = function(input) { + Utils.hexDec = function (input) { this.REGEX_HEXADECIMAL.lastIndex = 0; input = this.trim(input); if ((input + '').slice(0, 2) === '0x') { @@ -1780,7 +1778,7 @@ layui.define(['jquery', 'element'], function(exports) { return parseInt((input + '').replace(this.REGEX_HEXADECIMAL, ''), 16); }; - Utils.utf8chr = function(c) { + Utils.utf8chr = function (c) { var ch; ch = String.fromCharCode; if (0x80 > (c %= 0x200000)) { @@ -1795,7 +1793,7 @@ layui.define(['jquery', 'element'], function(exports) { return ch(0xF0 | c >> 18) + ch(0x80 | c >> 12 & 0x3F) + ch(0x80 | c >> 6 & 0x3F) + ch(0x80 | c & 0x3F); }; - Utils.parseBoolean = function(input, strict) { + Utils.parseBoolean = function (input, strict) { var lowerInput; if (strict == null) { strict = true; @@ -1821,13 +1819,13 @@ layui.define(['jquery', 'element'], function(exports) { return !!input; }; - Utils.isNumeric = function(input) { + Utils.isNumeric = function (input) { this.REGEX_SPACES.lastIndex = 0; return typeof input === 'number' || typeof input === 'string' && !isNaN(input) && input.replace(this.REGEX_SPACES, '') !== ''; }; - Utils.stringToDate = function(str) { + Utils.stringToDate = function (str) { var date, day, fraction, hour, info, minute, month, second, tz_hour, tz_minute, tz_offset, year; if (!(str != null ? str.length : void 0)) { return null; @@ -1874,7 +1872,7 @@ layui.define(['jquery', 'element'], function(exports) { return date; }; - Utils.strRepeat = function(str, number) { + Utils.strRepeat = function (str, number) { var i, res; res = ''; i = 0; @@ -1885,7 +1883,7 @@ layui.define(['jquery', 'element'], function(exports) { return res; }; - Utils.getStringFromFile = function(path, callback) { + Utils.getStringFromFile = function (path, callback) { var data, fs, j, len1, name, ref, req, xhr; if (callback == null) { callback = null; @@ -1900,13 +1898,13 @@ layui.define(['jquery', 'element'], function(exports) { name = ref[j]; try { xhr = new ActiveXObject(name); - } catch (undefined) {} + } catch (undefined) { } } } } if (xhr != null) { if (callback != null) { - xhr.onreadystatechange = function() { + xhr.onreadystatechange = function () { if (xhr.readyState === 4) { if (xhr.status === 200 || xhr.status === 0) { return callback(xhr.responseText); @@ -1929,7 +1927,7 @@ layui.define(['jquery', 'element'], function(exports) { req = require; fs = req('fs'); if (callback != null) { - return fs.readFile(path, function(err, data) { + return fs.readFile(path, function (err, data) { if (err) { return callback(null); } else { @@ -1956,7 +1954,7 @@ layui.define(['jquery', 'element'], function(exports) { }, { "./Pattern": 8 }], - 11: [function(require, module, exports) { + 11: [function (require, module, exports) { var Dumper, Parser, Utils, Yaml; Parser = require('./Parser'); @@ -1965,10 +1963,10 @@ layui.define(['jquery', 'element'], function(exports) { Utils = require('./Utils'); - Yaml = (function() { - function Yaml() {} + Yaml = (function () { + function Yaml() { } - Yaml.parse = function(input, exceptionOnInvalidType, objectDecoder) { + Yaml.parse = function (input, exceptionOnInvalidType, objectDecoder) { if (exceptionOnInvalidType == null) { exceptionOnInvalidType = false; } @@ -1978,7 +1976,7 @@ layui.define(['jquery', 'element'], function(exports) { return new Parser().parse(input, exceptionOnInvalidType, objectDecoder); }; - Yaml.parseFile = function(path, callback, exceptionOnInvalidType, objectDecoder) { + Yaml.parseFile = function (path, callback, exceptionOnInvalidType, objectDecoder) { var input; if (callback == null) { callback = null; @@ -1990,8 +1988,8 @@ layui.define(['jquery', 'element'], function(exports) { objectDecoder = null; } if (callback != null) { - return Utils.getStringFromFile(path, (function(_this) { - return function(input) { + return Utils.getStringFromFile(path, (function (_this) { + return function (input) { var result; result = null; if (input != null) { @@ -2009,7 +2007,7 @@ layui.define(['jquery', 'element'], function(exports) { } }; - Yaml.dump = function(input, inline, indent, exceptionOnInvalidType, objectEncoder) { + Yaml.dump = function (input, inline, indent, exceptionOnInvalidType, objectEncoder) { var yaml; if (inline == null) { inline = 2; @@ -2028,11 +2026,11 @@ layui.define(['jquery', 'element'], function(exports) { return yaml.dump(input, inline, 0, exceptionOnInvalidType, objectEncoder); }; - Yaml.stringify = function(input, inline, indent, exceptionOnInvalidType, objectEncoder) { + Yaml.stringify = function (input, inline, indent, exceptionOnInvalidType, objectEncoder) { return this.dump(input, inline, indent, exceptionOnInvalidType, objectEncoder); }; - Yaml.load = function(path, callback, exceptionOnInvalidType, objectDecoder) { + Yaml.load = function (path, callback, exceptionOnInvalidType, objectDecoder) { return this.parseFile(path, callback, exceptionOnInvalidType, objectDecoder); }; diff --git a/src/plugin/admin/public/component/pear/module/frame.js b/src/plugin/admin/public/component/pear/module/frame.js deleted file mode 100644 index 3f5af191..00000000 --- a/src/plugin/admin/public/component/pear/module/frame.js +++ /dev/null @@ -1,67 +0,0 @@ -layui.define(['jquery', 'element'], function (exports) { - "use strict"; - - var $ = layui.jquery; - - var pearFrame = function (opt) { - this.option = opt; - }; - - pearFrame.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("菜单渲染成功"); } - } - createFrameHTML(option); - $("#" + option.elem).width(option.width); - $("#" + option.elem).height(option.height); - return new pearFrame(option); - } - - pearFrame.prototype.changePage = function (url, loading) { - var $frameLoad = $("#" + this.option.elem).find(".pear-frame-loading"); - var $frame = $("#" + this.option.elem + " iframe"); - $frame.attr("src", url); - frameLoading($frame, $frameLoad, loading); - } - - pearFrame.prototype.changePageByElement = function (elem, url, title, loading) { - var $frameLoad = $("#" + elem).find(".pear-frame-loading"); - var $frame = $("#" + elem + " iframe"); - $frame.attr("src", url); - $("#" + elem + " .title").html(title); - frameLoading($frame, $frameLoad, loading); - } - - pearFrame.prototype.refresh = function (loading) { - var $frameLoad = $("#" + this.option.elem).find(".pear-frame-loading"); - var $frame = $("#" + this.option.elem).find("iframe"); - $frame.attr("src", $frame.attr("src")); - frameLoading($frame, $frameLoad, loading); - } - - function createFrameHTML(option) { - var iframe = ""; - var loading = '
                                      ' + - '
                                      ' + - '' + - '
                                      ' + - '
                                      '; - $("#" + option.elem).html("
                                      " + iframe + loading + "
                                      "); - } - - function frameLoading(iframeEl, loadingEl, isLoading) { - if (isLoading) { - loadingEl.css({ display: 'block' }); - $(iframeEl).on('load', function () { - loadingEl.fadeOut(1000); - }) - } - } - - exports('frame', new pearFrame()); -}); diff --git a/src/plugin/admin/public/component/pear/module/fullscreen.js b/src/plugin/admin/public/component/pear/module/fullscreen.js index a0f3b4dd..ff8a192a 100644 --- a/src/plugin/admin/public/component/pear/module/fullscreen.js +++ b/src/plugin/admin/public/component/pear/module/fullscreen.js @@ -1,35 +1,39 @@ -layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'menu', 'frame', 'theme', 'convert'], - function(exports) { - "use strict"; +layui.define(['jquery', 'element'], + function (exports) { + var $ = layui.jquery; var defer = $.Deferred(); - var fullScreen = new function() { + var fullScreen = new function () { + this.func = null; - this.onFullchange = function(func){ + + this.onFullchange = function (func) { this.func = func; - var evts = ['fullscreenchange','webkitfullscreenchange','mozfullscreenchange','MSFullscreenChange']; - for(var i=0;i display || 0 => delay - }, - - // Display Loading: Hourglass - Hourglass: function (message) { - NotiflixLoading(message, 'hourglass', true, 0); // true => display || 0 => delay - }, - - // Display Loading: Circle - Circle: function (message) { - NotiflixLoading(message, 'circle', true, 0); // true => display || 0 => delay - }, - - // Display Loading: Arrows - Arrows: function (message) { - NotiflixLoading(message, 'arrows', true, 0); // true => display || 0 => delay - }, - - // Display Loading: Dots - Dots: function (message) { - NotiflixLoading(message, 'dots', true, 0); // true => display || 0 => delay - }, - - // Display Loading: Pulse - Pulse: function (message) { - NotiflixLoading(message, 'pulse', true, 0); // true => display || 0 => delay - }, - - // Display Loading: Custom - Custom: function (message) { - NotiflixLoading(message, 'custom', true, 0); // true => display || 0 => delay - }, - - // Display Loading: Notiflix - Notiflix: function (message) { - NotiflixLoading(message, 'notiflix', true, 0); // true => display || 0 => delay - }, - - // Remove Loading - Remove: function (theDelay) { - if (!theDelay) { theDelay = 0; } - NotiflixLoading(false, false, false, theDelay); // false = Remove - }, - - // Change The Message - Change: function (newMessage) { - NotiflixLoadingChange(newMessage); - }, - }, - // Loading off - - // Block on - Block: { - - // Initialize - Init: function (userBlockOpt) { - // extend options - newBlockSettings = extendNotiflix(true, blockSettings, userBlockOpt); - // use GoogleFonts if "Quicksand" - notiflixGoogleFont(newBlockSettings.useGoogleFont, newBlockSettings.fontFamily); - }, - - // Merge First Initialize - Merge: function (userBlockExtend) { - // if initialized already - if (newBlockSettings) { - newBlockSettings = extendNotiflix(true, newBlockSettings, userBlockExtend); - } - // initialize first - else { - notiflixConsoleError('Notiflix Error', 'You have to initialize the "Notiflix.Block" module before call Merge function.'); - return false; - } - }, - - // Display Block: Standard - Standard: function (selector, message) { - var block = true; - var theIcon = 'standard'; - NotiflixBlockUnblockElement(block, selector, theIcon, message); - }, - - // Display Block: Hourglass - Hourglass: function (selector, message) { - var block = true; - var theIcon = 'hourglass'; - NotiflixBlockUnblockElement(block, selector, theIcon, message); - }, - - // Display Block: Circle - Circle: function (selector, message) { - var block = true; - var theIcon = 'circle'; - NotiflixBlockUnblockElement(block, selector, theIcon, message); - }, - - // Display Block: Arrows - Arrows: function (selector, message) { - var block = true; - var theIcon = 'arrows'; - NotiflixBlockUnblockElement(block, selector, theIcon, message); - }, - - // Display Block: Dots - Dots: function (selector, message) { - var block = true; - var theIcon = 'dots'; - NotiflixBlockUnblockElement(block, selector, theIcon, message); - }, - - // Display Block: Pulse - Pulse: function (selector, message) { - var block = true; - var theIcon = 'pulse'; - NotiflixBlockUnblockElement(block, selector, theIcon, message); - }, - - // Remove Block - Remove: function (selector, delay) { - var block = false; - var theIcon = null; - var message = null; - NotiflixBlockUnblockElement(block, selector, theIcon, message, delay); - }, - }, - // Block off - }; - // Notiflix: Main off - - - // Notiflix: Notify Single on - var notiflixNotifyCount = 0; - var NotiflixNotify = function (message, callback, theType, staticType) { - if (arguments && arguments.length === 4) { - - // notify counter on - notiflixNotifyCount++; - // notify counter off - - // if no message on - if (!message) { - message = 'Notiflix ' + staticType; - } - // if no message off - - // if plainText true = HTML tags not allowed on - if (newNotifySettings.plainText) { - message = notiflixPlaintext(message); // message plain text - } - // if plainText true = HTML tags not allowed off - - // if plainText false but the message length more than messageMaxLength = HTML tags error on - if (!newNotifySettings.plainText && message.length > newNotifySettings.messageMaxLength) { - Notiflix.Notify.Merge({ closeButton: true, plainText: false, }); - message = 'HTML Tags Error: Your content length is more than "messageMaxLength" option.'; // message html error - } - // if plainText false but the message length more than messageMaxLength = HTML tags error off - - // message max length substring on - if (message.length > newNotifySettings.messageMaxLength) { - message = message.substring(0, newNotifySettings.messageMaxLength) + '...'; - } - // message max length substring off - - // font awesome icon style on - if (newNotifySettings.fontAwesomeIconStyle === 'shadow') { - theType.fontAwesomeIconColor = theType.background; - } - // font awesome icon style off - - // if cssAnimaion false -> duration on - if (!newNotifySettings.cssAnimation) { - newNotifySettings.cssAnimationDuration = 0; - } - // if cssAnimaion false -> duration off - - // notify wrap on - var docBody = document.body; - var ntflxNotifyWrap = document.createElement('div'); - ntflxNotifyWrap.id = notifySettings.wrapID; - ntflxNotifyWrap.style.width = newNotifySettings.width; - ntflxNotifyWrap.style.zIndex = newNotifySettings.zindex; - ntflxNotifyWrap.style.opacity = newNotifySettings.opacity; - - // wrap position on - if (newNotifySettings.position === 'right-bottom') { - ntflxNotifyWrap.style.right = newNotifySettings.distance; - ntflxNotifyWrap.style.bottom = newNotifySettings.distance; - ntflxNotifyWrap.style.top = 'auto'; - ntflxNotifyWrap.style.left = 'auto'; - } else if (newNotifySettings.position === 'left-top') { - ntflxNotifyWrap.style.left = newNotifySettings.distance; - ntflxNotifyWrap.style.top = newNotifySettings.distance; - ntflxNotifyWrap.style.right = 'auto'; - ntflxNotifyWrap.style.bottom = 'auto'; - } else if (newNotifySettings.position === 'left-bottom') { - ntflxNotifyWrap.style.left = newNotifySettings.distance; - ntflxNotifyWrap.style.bottom = newNotifySettings.distance; - ntflxNotifyWrap.style.top = 'auto'; - ntflxNotifyWrap.style.right = 'auto'; - } else { // 'right-top' or else - ntflxNotifyWrap.style.right = newNotifySettings.distance; - ntflxNotifyWrap.style.top = newNotifySettings.distance; - ntflxNotifyWrap.style.left = 'auto'; - ntflxNotifyWrap.style.bottom = 'auto'; - } - // wrap position off - - // if background overlay true on - var notifyOverlay; - if (newNotifySettings.backOverlay) { - notifyOverlay = document.createElement('div'); - notifyOverlay.id = newNotifySettings.ID + 'Overlay'; - notifyOverlay.style.width = '100%'; - notifyOverlay.style.height = '100%'; - notifyOverlay.style.position = 'fixed'; - notifyOverlay.style.zIndex = newNotifySettings.zindex; - notifyOverlay.style.left = 0; - notifyOverlay.style.top = 0; - notifyOverlay.style.right = 0; - notifyOverlay.style.bottom = 0; - notifyOverlay.style.background = newNotifySettings.backOverlayColor; - notifyOverlay.className = (newNotifySettings.cssAnimation ? 'with-animation' : ''); - notifyOverlay.style.animationDuration = (newNotifySettings.cssAnimation) ? newNotifySettings.cssAnimationDuration + 'ms' : ''; - if (!document.getElementById(notifyOverlay.id)) { - docBody.appendChild(notifyOverlay); - } - } - // if background overlay true off - - if (!document.getElementById(ntflxNotifyWrap.id)) { - docBody.appendChild(ntflxNotifyWrap); - } - // notify wrap off - - // notify content on - var ntflxNotify = document.createElement('div'); - ntflxNotify.id = newNotifySettings.ID + '-' + notiflixNotifyCount; - ntflxNotify.className = newNotifySettings.className + ' ' + theType.childClassName + ' ' + (newNotifySettings.cssAnimation ? 'with-animation' : '') + ' ' + (newNotifySettings.useIcon ? 'with-icon' : '') + ' nx-' + newNotifySettings.cssAnimationStyle + ' ' + (newNotifySettings.closeButton && !callback ? 'with-close-button' : '') + ' ' + (callback && typeof callback === 'function' ? 'with-callback' : '') + ' ' + (newNotifySettings.clickToClose ? 'click-to-close' : ''); - ntflxNotify.style.fontSize = newNotifySettings.fontSize; - ntflxNotify.style.color = theType.textColor; - ntflxNotify.style.background = theType.background; - ntflxNotify.style.borderRadius = newNotifySettings.borderRadius; - - // rtl on - if (newNotifySettings.rtl) { - ntflxNotify.setAttribute('dir', 'rtl'); - ntflxNotify.classList.add('rtl-on'); - } - // rtl off - - // font-family on - ntflxNotify.style.fontFamily = '"' + newNotifySettings.fontFamily + '"' + ', sans-serif'; - // font-family off - - // use css animation on - if (newNotifySettings.cssAnimation) { - ntflxNotify.style.animationDuration = newNotifySettings.cssAnimationDuration + 'ms'; - } - // use css animation off - - // close button element on - var closeButtonHTML = ''; - if (newNotifySettings.closeButton && !callback) { - closeButtonHTML = ''; - } - // close buttpon element off - - // use icon on - if (newNotifySettings.useIcon) { - // use font awesome - if (newNotifySettings.useFontAwesome) { - ntflxNotify.innerHTML = '' + message + '' + (newNotifySettings.closeButton ? closeButtonHTML : ''); - } - // use notiflix icon - else { - var svgIcon; - if (staticType === 'Success') { // success - svgIcon = ''; - } else if (staticType === 'Failure') { // failure - svgIcon = ''; - } else if (staticType === 'Warning') { // warning - svgIcon = ''; - } else if (staticType === 'Info') { // info - svgIcon = ''; - } else { - svgIcon = ''; - } - ntflxNotify.innerHTML = svgIcon + '' + message + '' + (newNotifySettings.closeButton ? closeButtonHTML : ''); - } - } - // without icon - else { - ntflxNotify.innerHTML = '' + message + '' + (newNotifySettings.closeButton ? closeButtonHTML : ''); - } - // use icon off - // notify content off - - // notify append or prepend on - if (newNotifySettings.position === 'left-bottom' || newNotifySettings.position === 'right-bottom') { // the new one will be first - var notifyWrap = document.getElementById(ntflxNotifyWrap.id); - notifyWrap.insertBefore(ntflxNotify, notifyWrap.firstChild); - } else { - document.getElementById(ntflxNotifyWrap.id).appendChild(ntflxNotify); - } - - if (newNotifySettings.useIcon) { // if useIcon, dynamically vertical align the contents - var messageIcon = document.getElementById(ntflxNotify.id).querySelectorAll('.nmi')[0]; - var messageIconH = 40; - // if font awesome - if (newNotifySettings.useFontAwesome) { - messageIconH = Math.round(parseInt(messageIcon.offsetHeight)); - } - // if notiflix SVG - else { - var SvgBBox = messageIcon.getBBox(); - messageIconH = Math.round(parseInt(SvgBBox.width)); - } - var messageText = document.getElementById(ntflxNotify.id).querySelectorAll('span')[0]; - var messageTextH = Math.round(messageText.offsetHeight); - if (messageTextH <= messageIconH) { - messageText.style.paddingTop = (messageIconH - messageTextH) / 2 + 'px'; - messageText.style.paddingBottom = (messageIconH - messageTextH) / 2 + 'px'; - } - } - // notify append or prepend off - - // remove by timeout or click on - if (document.getElementById(ntflxNotify.id)) { - // set elements on - var removeDiv = document.getElementById(ntflxNotify.id); - var removeWrap = document.getElementById(ntflxNotifyWrap.id); - var removeOverlay; - if (newNotifySettings.backOverlay) { - removeOverlay = document.getElementById(notifyOverlay.id); - } - // set elements on - - // timeout vars on - var timeoutHide; - var timeoutRemove; - // timeout vars off - - // hide notify elm and hide overlay on - var hideNotifyElementsAndOverlay = function () { - removeDiv.classList.add('remove'); - if (newNotifySettings.backOverlay && removeWrap.childElementCount <= 0) { - removeOverlay.classList.add('remove'); - } - clearTimeout(timeoutHide); - }; - // hide notify elm and hide overlay off - - // remove notify elm and wrapper on - var removeNotifyElmentsAndWrapper = function () { - var notifyExist = document.getElementById(ntflxNotify.id); - if (notifyExist && removeDiv.parentNode !== null) { - removeDiv.parentNode.removeChild(removeDiv); - } - if (removeWrap.childElementCount <= 0 && removeWrap.parentNode !== null) { // if childs count === 0 remove wrap - removeWrap.parentNode.removeChild(removeWrap); - if (newNotifySettings.backOverlay && removeOverlay.parentNode !== null) { - removeOverlay.parentNode.removeChild(removeOverlay); - } - } - clearTimeout(timeoutRemove); - }; - // remove notify elm and wrapper off - - // if close button and callback undefined on - if (newNotifySettings.closeButton && !callback) { - var closeButtonElm = document.getElementById(ntflxNotify.id).querySelectorAll('span.notify-close-button')[0]; - closeButtonElm.addEventListener('click', function () { - hideNotifyElementsAndOverlay(); - var clickToCloseTimeout = setTimeout(function () { - removeNotifyElmentsAndWrapper(); - clearTimeout(clickToCloseTimeout); - }, newNotifySettings.cssAnimationDuration); - }); - } - // if close button and callback undefined off - - // if callback or click to close on - if ((callback && typeof callback === 'function') || newNotifySettings.clickToClose) { - removeDiv.addEventListener('click', function (e) { - if (callback && typeof callback === 'function') { - callback(); - } - hideNotifyElementsAndOverlay(); - var callbackTimeout = setTimeout(function () { - removeNotifyElmentsAndWrapper(); - clearTimeout(callbackTimeout); - }, newNotifySettings.cssAnimationDuration); - }); - } - // if callback or click to close off - - // else auto remove on - if (!newNotifySettings.closeButton && !callback) { - timeoutHide = setTimeout(function () { - hideNotifyElementsAndOverlay(); - }, newNotifySettings.timeout); - timeoutRemove = setTimeout(function () { - removeNotifyElmentsAndWrapper(); - }, newNotifySettings.timeout + newNotifySettings.cssAnimationDuration); - } - // else auto remove off - } - // remove by timeout or click off - - // notify - show only the last one on - if (newNotifySettings.showOnlyTheLastOne && notiflixNotifyCount > 0) { - var allNotifyElmNotTheLastOne = document.querySelectorAll('[id^=' + newNotifySettings.ID + '-]:not([id=' + newNotifySettings.ID + '-' + notiflixNotifyCount + '])'); - for (var i = 0; i < allNotifyElmNotTheLastOne.length; i++) { - var eachNotifyElmNotLastOne = allNotifyElmNotTheLastOne[i]; - if (eachNotifyElmNotLastOne.parentNode !== null) { - eachNotifyElmNotLastOne.parentNode.removeChild(eachNotifyElmNotLastOne); - } - } - } - // notify - show only the last one off - - } else { - notiflixConsoleError('Notiflix Error', 'Where is the arguments?'); - } - }; - // Notiflix: Notify Single off - - - // Notiflix: Report Single on - var NotiflixReport = function (title, message, buttonText, buttonCallback, theType, staticType) { - - // check the arguments on - if (!title) { title = 'Notiflix ' + staticType; } - if (!message) { - if (staticType === 'Success') { - message = '"Do not try to become a person of success but try to become a person of value."

                                      - Albert Einstein'; - } - else if (staticType === 'Failure') { - message = '"Failure is simply the opportunity to begin again, this time more intelligently."

                                      - Henry Ford'; - } - else if (staticType === 'Warning') { - message = '"The peoples who want to live comfortably without producing and fatigue; they are doomed to lose their dignity, then liberty, and then independence and destiny."

                                      - Mustafa Kemal Ataturk'; - } - else if (staticType === 'Info') { - message = '"Knowledge rests not upon truth alone, but upon error also."

                                      - Carl Gustav Jung'; - } - } - if (!buttonText) { buttonText = 'Okay'; } - if (!buttonCallback) { buttonCallback = undefined; } - // check the arguments off - - // if plainText true = HTML tags not allowed on - if (newReportSettings.plainText) { - title = notiflixPlaintext(title); - message = notiflixPlaintext(message); - buttonText = notiflixPlaintext(buttonText); - } - // if plainText true = HTML tags not allowed off - - // if plainText false but the contents length more than *MaxLength = HTML tags error on - if (!newReportSettings.plainText) { - if (title.length > newReportSettings.titleMaxLength) { - title = 'HTML Tags Error'; // title html error - message = 'Your Title content length is more than "titleMaxLength" option.'; // message html error - buttonText = 'Okay'; // button html error - } - if (message.length > newReportSettings.messageMaxLength) { - title = 'HTML Tags Error'; // title html error - message = 'Your Message content length is more than "messageMaxLength" option.'; // message html error - buttonText = 'Okay'; // button html error - } - if (buttonText.length > newReportSettings.buttonMaxLength) { - title = 'HTML Tags Error'; // title html error - message = 'Your Button content length is more than "buttonMaxLength" option.'; // message html error - buttonText = 'Okay'; // button html error - } - } - // if plainText false but the contents length more than *MaxLength = HTML tags error off - - // max length on - if (title.length > newReportSettings.titleMaxLength) { - title = title.substring(0, newReportSettings.titleMaxLength) + '...'; - } - if (message.length > newReportSettings.messageMaxLength) { - message = message.substring(0, newReportSettings.messageMaxLength) + '...'; - } - if (buttonText.length > newReportSettings.buttonMaxLength) { - buttonText = buttonText.substring(0, newReportSettings.buttonMaxLength) + '...'; - } - // max length off - - // if cssAnimaion false -> duration on - if (!newReportSettings.cssAnimation) { - newReportSettings.cssAnimationDuration = 0; - } - // if cssAnimaion false -> duration off - - // report wrap on - var docBody = document.body; - var ntflxReportWrap = document.createElement('div'); - ntflxReportWrap.id = reportSettings.ID; - ntflxReportWrap.className = newReportSettings.className; - ntflxReportWrap.style.width = newReportSettings.width; - ntflxReportWrap.style.zIndex = newReportSettings.zindex; - ntflxReportWrap.style.borderRadius = newReportSettings.borderRadius; - ntflxReportWrap.style.fontFamily = '"' + newReportSettings.fontFamily + '"' + ', sans-serif'; - - // rtl on - if (newReportSettings.rtl) { - ntflxReportWrap.setAttribute('dir', 'rtl'); - ntflxReportWrap.classList.add('rtl-on'); - } - // rtl off - - // overlay on - var reportOverlay = ''; - if (newReportSettings.backOverlay) { - reportOverlay = '
                                      '; - } - // overlay off - - // svg icon on - var svgIcon = ''; - if (staticType === 'Success') { - svgIcon = notiflixReportSvgSuccess(newReportSettings.svgSize, theType.svgColor); - } else if (staticType === 'Failure') { - svgIcon = notiflixReportSvgFailure(newReportSettings.svgSize, theType.svgColor); - } else if (staticType === 'Warning') { - svgIcon = notiflixReportSvgWarning(newReportSettings.svgSize, theType.svgColor); - } else if (staticType === 'Info') { - svgIcon = notiflixReportSvgInfo(newReportSettings.svgSize, theType.svgColor); - } - // svg icon off - - ntflxReportWrap.innerHTML = reportOverlay + '
                                      ' + - '
                                      ' + svgIcon + '
                                      ' + - '
                                      ' + title + '
                                      ' + - '

                                      ' + message + '

                                      ' + - '' + buttonText + '' + - '
                                      '; - - // if there is no report element - if (!document.getElementById(ntflxReportWrap.id)) { - // append - docBody.appendChild(ntflxReportWrap); - - // vertical align on - var windowH = Math.round(window.innerHeight); - var reportH = Math.round(document.getElementById(ntflxReportWrap.id).offsetHeight); - ntflxReportWrap.style.top = (windowH - reportH) / 2 + 'px'; - // vertical align off - - // callback on - var getReportWrap = document.getElementById(ntflxReportWrap.id); - var reportButton = document.getElementById('NXReportButton'); - reportButton.addEventListener('click', function () { - // if callback on - if (buttonCallback && typeof buttonCallback === 'function') { - buttonCallback(); - } - // if callback off - - // remove element on - getReportWrap.classList.add('remove'); - var timeout = setTimeout(function () { - if (getReportWrap.parentNode !== null) { - getReportWrap.parentNode.removeChild(getReportWrap); - } - clearTimeout(timeout); - }, newReportSettings.cssAnimationDuration); - // remove element off - }); - // callback off - - } - // report wrap off - - }; - // Notiflix: Report Single off - - - // Notiflix: Confirm Single on - var NotiflixConfirm = function (title, message, okButtonText, cancelButtonText, okButtonCallback, cancelButtonCallback) { - // if not initialized pretend like init - if (!newConfirmSettings) { - Notiflix.Confirm.Init({}); - } - - // if plainText true => HTML tags not allowed on - if (newConfirmSettings.plainText) { - title = notiflixPlaintext(title); - message = notiflixPlaintext(message); - okButtonText = notiflixPlaintext(okButtonText); - cancelButtonText = notiflixPlaintext(cancelButtonText); - } - // if plainText true => HTML tags not allowed off - - // if plainText false but the contents length more than *MaxLength = HTML tags error on - if (!newConfirmSettings.plainText) { - if (title.length > newConfirmSettings.titleMaxLength) { - title = 'HTML Tags Error'; // title html error - message = 'Your Title content length is more than "titleMaxLength" option.'; // message html error - okButtonText = 'Okay'; // button html error - cancelButtonText = '...'; // button html error - } - if (message.length > newConfirmSettings.messageMaxLength) { - title = 'HTML Tags Error'; // title html error - message = 'Your Message content length is more than "messageMaxLength" option.'; // message html error - okButtonText = 'Okay'; // button html error - cancelButtonText = '...'; // button html error - } - if ((okButtonText.length || cancelButtonText.length) > newConfirmSettings.buttonsMaxLength) { - title = 'HTML Tags Error'; // title html error - message = 'Your Buttons contents length is more than "buttonsMaxLength" option.'; // message html error - okButtonText = 'Okay'; // button html error - cancelButtonText = '...'; // button html error - } - } - // if plainText false but the contents length more than *MaxLength = HTML tags error off - - // max length on - if (title.length > newConfirmSettings.titleMaxLength) { - title = title.substring(0, newConfirmSettings.titleMaxLength) + '...'; - } - if (message.length > newConfirmSettings.messageMaxLength) { - message = message.substring(0, newConfirmSettings.messageMaxLength) + '...'; - } - if (okButtonText.length > newConfirmSettings.buttonsMaxLength) { - okButtonText = okButtonText.substring(0, newConfirmSettings.buttonsMaxLength) + '...'; - } - if (cancelButtonText.length > newConfirmSettings.buttonsMaxLength) { - cancelButtonText = cancelButtonText.substring(0, newConfirmSettings.buttonsMaxLength) + '...'; - } - // max length off - - // if cssAnimaion false -> duration on - if (!newConfirmSettings.cssAnimation) { - newConfirmSettings.cssAnimationDuration = 0; - } - // if cssAnimaion false -> duration off - - // confirm wrap on - var docBody = document.body; - var ntflxConfirmWrap = document.createElement('div'); - ntflxConfirmWrap.id = confirmSettings.ID; - ntflxConfirmWrap.className = newConfirmSettings.className + (newConfirmSettings.cssAnimation ? ' with-animation nx-' + newConfirmSettings.cssAnimationStyle : ''); - ntflxConfirmWrap.style.width = newConfirmSettings.width; - ntflxConfirmWrap.style.zIndex = newConfirmSettings.zindex; - - // rtl on - if (newConfirmSettings.rtl) { - ntflxConfirmWrap.setAttribute('dir', 'rtl'); - ntflxConfirmWrap.classList.add('rtl-on'); - } - // rtl off - - // font-family on - ntflxConfirmWrap.style.fontFamily = '"' + newConfirmSettings.fontFamily + '"' + ', sans-serif'; - // font-family off - - // if background overlay true on - var confirmOverlay = ''; - if (newConfirmSettings.backOverlay) { - confirmOverlay = '
                                      '; - } - // if background overlay true off - - // if have a callback => add cancel button on - var cancelButtonHTML = ''; - if (okButtonCallback) { - cancelButtonHTML = '' + cancelButtonText + ''; - } - // if have a callback => add cancel button off - - ntflxConfirmWrap.innerHTML = confirmOverlay + - '
                                      ' + - '
                                      ' + - '
                                      ' + title + '
                                      ' + - '

                                      ' + message + '

                                      ' + - '
                                      ' + - '
                                      ' + - '' + okButtonText + '' + - cancelButtonHTML + - '
                                      ' + - '
                                      '; - // confirm wrap off - - // if there is no confirm box on - if (!document.getElementById(ntflxConfirmWrap.id)) { - docBody.appendChild(ntflxConfirmWrap); - - // position on - if (newConfirmSettings.position === 'center') { // if center-center - var windowH = Math.round(window.innerHeight); - var confirmH = Math.round(document.getElementById(ntflxConfirmWrap.id).offsetHeight); - ntflxConfirmWrap.style.top = (windowH - confirmH) / 2 + 'px'; - ntflxConfirmWrap.style.left = newConfirmSettings.distance; - ntflxConfirmWrap.style.right = newConfirmSettings.distance; - ntflxConfirmWrap.style.bottom = 'auto'; - ntflxConfirmWrap.style.margin = 'auto'; - } else if (newConfirmSettings.position === 'right-top') { // if right-top - ntflxConfirmWrap.style.right = newConfirmSettings.distance; - ntflxConfirmWrap.style.top = newConfirmSettings.distance; - ntflxConfirmWrap.style.bottom = 'auto'; - ntflxConfirmWrap.style.left = 'auto'; - ntflxConfirmWrap.style.margin = 'auto'; - } else if (newConfirmSettings.position === 'right-bottom') { // if right-bottom - ntflxConfirmWrap.style.right = newConfirmSettings.distance; - ntflxConfirmWrap.style.bottom = newConfirmSettings.distance; - ntflxConfirmWrap.style.top = 'auto'; - ntflxConfirmWrap.style.left = 'auto'; - ntflxConfirmWrap.style.margin = 'auto'; - } else if (newConfirmSettings.position === 'left-top') { // if left-top - ntflxConfirmWrap.style.left = newConfirmSettings.distance; - ntflxConfirmWrap.style.top = newConfirmSettings.distance; - ntflxConfirmWrap.style.right = 'auto'; - ntflxConfirmWrap.style.bottom = 'auto'; - ntflxConfirmWrap.style.margin = 'auto'; - } else if (newConfirmSettings.position === 'left-bottom') { // if left-bottom - ntflxConfirmWrap.style.left = newConfirmSettings.distance; - ntflxConfirmWrap.style.bottom = newConfirmSettings.distance; - ntflxConfirmWrap.style.top = 'auto'; - ntflxConfirmWrap.style.right = 'auto'; - ntflxConfirmWrap.style.margin = 'auto'; - } else { // if center-top - ntflxConfirmWrap.style.top = newConfirmSettings.distance; - ntflxConfirmWrap.style.left = 0; - ntflxConfirmWrap.style.right = 0; - ntflxConfirmWrap.style.bottom = 'auto'; - ntflxConfirmWrap.style.margin = 'auto'; - } - // position off - - // buttons listener on - var confirmCloseWrap = document.getElementById(ntflxConfirmWrap.id); - var okButton = document.getElementById('NXConfirmButtonOk'); - - // ok button listener on - okButton.addEventListener('click', function () { - // if ok callback && if ok callback is a function - if (okButtonCallback && typeof okButtonCallback === 'function') { - okButtonCallback(); - } - confirmCloseWrap.classList.add('remove'); - - var timeout = setTimeout(function () { - if (confirmCloseWrap.parentNode !== null) { - confirmCloseWrap.parentNode.removeChild(confirmCloseWrap); - clearTimeout(timeout); - } - }, newConfirmSettings.cssAnimationDuration); - }); - // ok button listener off - - // if ok callback && if ok callback a function => add Cancel Button listener on - if (okButtonCallback && typeof okButtonCallback === 'function') { - // cancel button listener on - var cancelButton = document.getElementById('NXConfirmButtonCancel'); - cancelButton.addEventListener('click', function () { - // if cancel callback && if cancel callback a function - if (cancelButtonCallback && typeof cancelButtonCallback === 'function') { - cancelButtonCallback(); - } - confirmCloseWrap.classList.add('remove'); - - var timeout = setTimeout(function () { - if (confirmCloseWrap.parentNode !== null) { - confirmCloseWrap.parentNode.removeChild(confirmCloseWrap); - clearTimeout(timeout); - } - }, newConfirmSettings.cssAnimationDuration); - }); - // cancel button listener off - } - // if ok callback && if ok callback a function => add Cancel Button listener off - // buttons listener off - } - // if there is no confirm box off - }; - // Notiflix: Confirm Single off - - - // Notiflix: Loading Single on - var NotiflixLoading = function (message, iconType, display, theDelay) { - // if not initialized pretend like init - if (!newLoadingSettings) { - Notiflix.Loading.Init({}); - } - // check the message - if (!message) { - message = ''; - } - // show loading - if (display) { - - // if message settings on - if (message.toString().length > newLoadingSettings.messageMaxLength) { - message = notiflixPlaintext(message).toString().substring(0, newLoadingSettings.messageMaxLength) + '...'; - } else { - message = notiflixPlaintext(message).toString(); - } - var intSvgSize = parseInt(newLoadingSettings.svgSize); - var messageHTML = ''; - if (message.length > 0) { - var messagePosTop = Math.round(intSvgSize - (intSvgSize / 4)).toString() + 'px'; - var messageHeight = (parseInt(newLoadingSettings.messageFontSize) * 1.4).toString() + 'px'; - messageHTML = '

                                      ' + message + '

                                      '; - } - // if message settings off - - // if cssAnimaion false -> duration on - if (!newLoadingSettings.cssAnimation) { - newLoadingSettings.cssAnimationDuration = 0; - } - // if cssAnimaion false -> duration off - - // svgIcon on - var svgIcon = ''; - if (iconType === 'standard') { - svgIcon = notiflixIndicatorSvgStandard(newLoadingSettings.svgSize, newLoadingSettings.svgColor); - } else if (iconType === 'hourglass') { - svgIcon = notiflixIndicatorSvgHourglass(newLoadingSettings.svgSize, newLoadingSettings.svgColor); - } else if (iconType === 'circle') { - svgIcon = notiflixIndicatorSvgCircle(newLoadingSettings.svgSize, newLoadingSettings.svgColor); - } else if (iconType === 'arrows') { - svgIcon = notiflixIndicatorSvgArrows(newLoadingSettings.svgSize, newLoadingSettings.svgColor); - } else if (iconType === 'dots') { - svgIcon = notiflixIndicatorSvgDots(newLoadingSettings.svgSize, newLoadingSettings.svgColor); - } else if (iconType === 'pulse') { - svgIcon = notiflixIndicatorSvgPulse(newLoadingSettings.svgSize, newLoadingSettings.svgColor); - } else if (iconType === 'custom' && newLoadingSettings.customSvgUrl !== null) { - svgIcon = 'Notiflix'; - } else if (iconType === 'custom' && newLoadingSettings.customSvgUrl == null) { - notiflixConsoleError('Notiflix Error', 'You have to set a static SVG url to "customSvgUrl" option to use Loading Custom.'); - return false; - } else if (iconType === 'notiflix') { - svgIcon = notiflixIndicatorSvgNotiflix(newLoadingSettings.svgSize, '#f8f8f8', '#32c682'); - } - var svgPosTop = 0; - if (message.length > 0) { - svgPosTop = '-' + Math.round(intSvgSize - (intSvgSize / 4)).toString() + 'px'; - } - var svgIconHTML = '
                                      ' + svgIcon + '
                                      '; - // svgIcon off - - // loading wrap on - var docBody = document.body; - var ntflxLoadingWrap = document.createElement('div'); - ntflxLoadingWrap.id = loadingSettings.ID; - ntflxLoadingWrap.className = newLoadingSettings.className + (newLoadingSettings.cssAnimation ? ' with-animation' : '') + (newLoadingSettings.clickToClose ? ' click-to-close' : ''); - ntflxLoadingWrap.style.zIndex = newLoadingSettings.zindex; - ntflxLoadingWrap.style.background = newLoadingSettings.backgroundColor; - ntflxLoadingWrap.style.animationDuration = newLoadingSettings.cssAnimationDuration + 'ms'; - ntflxLoadingWrap.style.fontFamily = '"' + newLoadingSettings.fontFamily + '"' + ', sans-serif'; - - // rtl on - if (newLoadingSettings.rtl) { - ntflxLoadingWrap.setAttribute('dir', 'rtl'); - ntflxLoadingWrap.classList.add('rtl-on'); - } - // rtl off - - // append on - ntflxLoadingWrap.innerHTML = svgIconHTML + messageHTML; - - // if there is no loading element - if (!document.getElementById(ntflxLoadingWrap.id)) { - // append - docBody.appendChild(ntflxLoadingWrap); - - // if click to close - if (newLoadingSettings.clickToClose) { - var loadingWrapElm = document.getElementById(ntflxLoadingWrap.id); - loadingWrapElm.addEventListener('click', function () { - ntflxLoadingWrap.classList.add('remove'); - var timeout = setTimeout(function () { - if (ntflxLoadingWrap.parentNode !== null) { - ntflxLoadingWrap.parentNode.removeChild(ntflxLoadingWrap); - clearTimeout(timeout); - } - }, newLoadingSettings.cssAnimationDuration); - }); - } - } - // append off - - } - // remove loading - else { - // if there is a loading element - if (document.getElementById(loadingSettings.ID)) { - var loadingElm = document.getElementById(loadingSettings.ID); - var timeout = setTimeout(function () { - loadingElm.classList.add('remove'); - var timeout2 = setTimeout(function () { - if (loadingElm.parentNode !== null) { - loadingElm.parentNode.removeChild(loadingElm); - clearTimeout(timeout2); - } - }, newLoadingSettings.cssAnimationDuration); - clearTimeout(timeout); - }, theDelay); - } - } - }; - // Notiflix: Loading Single off - - // Notiflix: Loading Change Message on - var NotiflixLoadingChange = function (newMessage) { - // check the new message - if (!newMessage) { - newMessage = ''; - } - // if has any loading - if (document.getElementById(loadingSettings.ID)) { - // if there is a new message - if (newMessage.length > 0) { - // max length on - if (newMessage.length > newLoadingSettings.messageMaxLength) { - newMessage = notiflixPlaintext(newMessage).toString().substring(0, newLoadingSettings.messageMaxLength) + '...'; - } else { - newMessage = notiflixPlaintext(newMessage).toString(); - } - // max length off - - // there is a message element - var oldMessageElm = document.getElementById(loadingSettings.ID).getElementsByTagName('p')[0]; - if (oldMessageElm) { - oldMessageElm.innerHTML = newMessage; // change the message - } - // there is no message element - else { - // create a new message element on - var newMessageHTML = document.createElement('p'); - newMessageHTML.id = newLoadingSettings.messageID; - newMessageHTML.className = 'loading-message new'; - newMessageHTML.style.color = newLoadingSettings.messageColor; - newMessageHTML.style.fontSize = newLoadingSettings.messageFontSize; - var intSvgSize = parseInt(newLoadingSettings.svgSize); - var messagePosTop = Math.round(intSvgSize - (intSvgSize / 4)).toString() + 'px'; - newMessageHTML.style.top = messagePosTop; - var messageHeight = (parseInt(newLoadingSettings.messageFontSize) * 1.4).toString() + 'px'; - newMessageHTML.style.height = messageHeight; - newMessageHTML.innerHTML = newMessage; - var messageWrap = document.getElementById(loadingSettings.ID); - messageWrap.appendChild(newMessageHTML); - // create a new message element off - - // vertical align svg on - var svgDivElm = document.getElementById(loadingSettings.ID).getElementsByTagName('div')[0]; - var svgNewPosTop = '-' + Math.round(intSvgSize - (intSvgSize / 4)).toString() + 'px'; - svgDivElm.style.top = svgNewPosTop; - // vertical align svg off - } - } - // if no message - else { - notiflixConsoleError('Notiflix Error', 'Where is the new message?'); - } - } - }; - // Notiflix: Loading Change Message off - - - // Notiflix: Block or Unblock Element on - var notiflixBlockElementCounter = 0; - var NotiflixBlockUnblockElement = function (block, selector, iconType, message, theDelay) { - - // check typeof selector on - if (typeof selector !== 'string') { - notiflixConsoleError('Notiflix Error', 'The selector must be a String.'); - return false; - } - // check typeof selector off - - // check the delay on - if (typeof theDelay !== 'number') { - theDelay = 0; - } - // check the delay off - - // check the selector on - var getSelector = document.querySelectorAll(selector); - if (getSelector.length > 0) { - - // if not initialized pretend like init on - if (!newBlockSettings) { - Notiflix.Block.Init({}); - } - // if not initialized pretend like init off - - // check the message on - if (!message || (message && typeof message !== 'string')) { - message = undefined; - } - // check the message off - - } else { - notiflixConsoleError('Notiflix Error', 'You called the "Notiflix.Block..." function with "' + selector + '" selector, but there is no such element(s) on the document.'); - return false; - } - // check the selector off - - // if cssAnimaion false => duration on - if (!newBlockSettings.cssAnimation) { - newBlockSettings.cssAnimationDuration = 0; - } - // if cssAnimaion false => duration off - - // check the class name on - var blockClassName = 'notiflix-block'; - if (newBlockSettings.className && typeof newBlockSettings.className === 'string') { - blockClassName = newBlockSettings.className.trim(); - } - // check the class name off - - // check query limit on - var getQueryLimit = (typeof newBlockSettings.querySelectorLimit === 'number' ? newBlockSettings.querySelectorLimit : 200); - var checkQueryLimit = (getSelector.length >= getQueryLimit ? getQueryLimit : getSelector.length); - // check query limit off - - // block - if (block) { - - // add element(s) and style on - for (var i = 0; i < checkQueryLimit; i++) { - var eachSelector = getSelector[i]; - - // check block element exist on - var eachBlockElement = eachSelector.querySelectorAll('[id^=' + blockSettings.ID + ']'); - if (eachBlockElement.length < 1) { - - // check the icon on - var icon = ''; - if (iconType) { - if (iconType === 'hourglass') { - icon = notiflixIndicatorSvgHourglass(newBlockSettings.svgSize, newBlockSettings.svgColor); - } else if (iconType === 'circle') { - icon = notiflixIndicatorSvgCircle(newBlockSettings.svgSize, newBlockSettings.svgColor); - } else if (iconType === 'arrows') { - icon = notiflixIndicatorSvgArrows(newBlockSettings.svgSize, newBlockSettings.svgColor); - } else if (iconType === 'dots') { - icon = notiflixIndicatorSvgDots(newBlockSettings.svgSize, newBlockSettings.svgColor); - } else if (iconType === 'pulse') { - icon = notiflixIndicatorSvgPulse(newBlockSettings.svgSize, newBlockSettings.svgColor); - } else { - icon = notiflixIndicatorSvgStandard(newBlockSettings.svgSize, newBlockSettings.svgColor); - } - } - var intSvgSize = parseInt(newBlockSettings.svgSize); - var posRatio = Math.round(intSvgSize - (intSvgSize / 5)).toString() + 'px'; - var svgPosTop = (message && message.length > 0 ? '-' + posRatio : 0); - var iconElement = '' + icon + ''; - // check the icon off - - // check the message on - var messageElement = ''; - var messageHeight = 0; - if (message) { - if (message.length > newBlockSettings.messageMaxLength) { - message = notiflixPlaintext(message).toString().substring(0, newBlockSettings.messageMaxLength) + '...'; - } else { - message = notiflixPlaintext(message).toString(); - } - messageHeight = Math.round(parseInt(newBlockSettings.messageFontSize) * 1.4).toString() + 'px'; - messageElement = '' + message + ''; - } - // check the message off - - // block element on - notiflixBlockElementCounter++; - var notiflixBlockWrap = document.createElement('div'); - notiflixBlockWrap.id = blockSettings.ID + '-' + notiflixBlockElementCounter; - notiflixBlockWrap.className = blockClassName + '-wrap' + (newBlockSettings.cssAnimation ? ' with-animation' : ''); - notiflixBlockWrap.style.position = newBlockSettings.position; - notiflixBlockWrap.style.zIndex = newBlockSettings.zindex; - notiflixBlockWrap.style.background = newBlockSettings.backgroundColor; - notiflixBlockWrap.style.animationDuration = newBlockSettings.cssAnimationDuration + 'ms'; - notiflixBlockWrap.style.fontFamily = '"' + newBlockSettings.fontFamily + '"' + ', sans-serif'; - // block element off - - // block element rtl on - if (newBlockSettings.rtl) { - notiflixBlockWrap.setAttribute('dir', 'rtl'); - notiflixBlockWrap.classList.add('rtl-on'); - } - // block element rtl off - - // block element data on - notiflixBlockWrap.innerHTML = iconElement + messageElement; - // block element data off - - // append block element on - var eachSelectorPos = getComputedStyle(eachSelector).getPropertyValue('position'); - eachSelectorPos = eachSelectorPos && typeof eachSelectorPos === 'string' ? eachSelectorPos.toLowerCase() : 'relative'; - - // selector internal style on - var eachSelectorIdOrClass = ''; - if (eachSelector.getAttribute('id')) { - eachSelectorIdOrClass = '#' + eachSelector.getAttribute('id'); - } else if (eachSelector.classList[0]) { - eachSelectorIdOrClass = '.' + eachSelector.classList[0]; - } - - var positions = ['absolute', 'relative', 'fixed', 'sticky']; - if (positions.indexOf(eachSelectorPos) <= -1) { - var minHeight = Math.round((parseInt(messageHeight) + intSvgSize) * 1.5).toString() + 'px'; - var style = ''; - var styleRange = document.createRange(); - styleRange.selectNode(document.head); - var styleFragment = styleRange.createContextualFragment(style); - document.head.appendChild(styleFragment); - eachSelector.classList.add(blockClassName + '-position'); - } - // selector internal style off - - // append - eachSelector.appendChild(notiflixBlockWrap); - // append block element off - } - // check block element exist off - } - // add element(s) and style off - } - // unblock/remove - else { - - // Step 3 => Remove each block element on - var removeBlockElements = function (eachOne) { - var timeout = setTimeout(function () { - // remove element - eachOne.remove(); - - // remove this selector internal style - var eachOneId = eachOne.getAttribute('id'); - var eachOneStyle = document.getElementById('Style-' + eachOneId); - if (eachOneStyle) { - eachOneStyle.remove(); - } - - // clear timeout - clearTimeout(timeout); - }, newBlockSettings.cssAnimationDuration); - } - // Step 3 => Remove each block element off - - // Step 2A => Remove each block element on - var removeClassBlockElements = function (eachBlockElement) { - // if elements exist - if (eachBlockElement && eachBlockElement.length > 0) { - for (var i = 0; i < eachBlockElement.length; i++) { - var eachOne = eachBlockElement[i]; - if (eachOne) { - // add remove class - eachOne.classList.add('remove'); - // remove block elements - removeBlockElements(eachOne); - } - } - } - // not exist - else { - notiflixConsoleLog('Notiflix Info', '"Notiflix.Block.Remove();" function called with "' + selector + '" selector, but this selector does not have a "Notiflix.Block..." element to remove.'); - } - } - // Step 2A => Remove each block element on - - // Step 2B => Remove each selector class name on - var removeEachSelectorClassName = function (eachSelector) { - var timeout = setTimeout(function () { - // remove class name - var positionClass = blockClassName + '-position'; - eachSelector.classList.remove(positionClass); - - // clear timeout - clearTimeout(timeout); - }, newBlockSettings.cssAnimationDuration + 300); - } - // Step 2B => Remove each selector class name off - - // Step 1 => Remove selector class name on - var selectorTimeout = setTimeout(function () { - for (var i = 0; i < checkQueryLimit; i++) { - var eachSelector = getSelector[i]; - - // remove each selector class name - removeEachSelectorClassName(eachSelector); - - // remove each block element - eachBlockElement = eachSelector.querySelectorAll('[id^=' + blockSettings.ID + ']'); - removeClassBlockElements(eachBlockElement); - } - // clear timeout - clearTimeout(selectorTimeout); - }, theDelay); - // Step 1 => Remove selector class name off - } - }; - // Notiflix: Block or Unblock Element off - - - // Notiflix: Report SVG Success on - var notiflixReportSvgSuccess = function (width, color) { - if (!width) { width = '110px'; } - if (!color) { color = '#32c682'; } - var reportSvgSuccess = ''; - return reportSvgSuccess; - }; - // Notiflix: Report SVG Success off - - // Notiflix: Report SVG Failure on - var notiflixReportSvgFailure = function (width, color) { - if (!width) { width = '110px'; } - if (!color) { color = '#ff5549'; } - var reportSvgFailure = ''; - return reportSvgFailure; - }; - // Notiflix: Report SVG Failure off - - // Notiflix: Report SVG Warning on - var notiflixReportSvgWarning = function (width, color) { - if (!width) { width = '110px'; } - if (!color) { color = '#eebf31'; } - var reportSvgWarning = ''; - return reportSvgWarning; - }; - // Notiflix: Report SVG Warning off - - // Notiflix: Report SVG Info on - var notiflixReportSvgInfo = function (width, color) { - if (!width) { width = '110px'; } - if (!color) { color = '#26c0d3'; } - var reportSvgInfo = ''; - return reportSvgInfo; - }; - // Notiflix: Report SVG Info off - - - // Notiflix: Indicator SVG standard on - var notiflixIndicatorSvgStandard = function (width, color) { - if (!width) { width = '60px'; } - if (!color) { color = '#32c682'; } - var standard = ''; - return standard; - }; - // Notiflix: Indicator SVG standard off - - // Notiflix: Indicator SVG hourglass on - var notiflixIndicatorSvgHourglass = function (width, color) { - if (!width) { width = '60px'; } - if (!color) { color = '#32c682'; } - var hourglass = ' '; - return hourglass; - }; - // Notiflix: Indicator SVG hourglass off - - // Notiflix: Indicator SVG circle on - var notiflixIndicatorSvgCircle = function (width, color) { - if (!width) { width = '60px'; } - if (!color) { color = '#32c682'; } - var circle = ''; - return circle; - }; - // Notiflix: Indicator SVG circle off - - // Notiflix: Indicator SVG arrows on - var notiflixIndicatorSvgArrows = function (width, color) { - if (!width) { width = '60px'; } - if (!color) { color = '#32c682'; } - var arrows = ''; - return arrows; - }; - // Notiflix: Indicator SVG arrows off - - // Notiflix: Indicator SVG dots on - var notiflixIndicatorSvgDots = function (width, color) { - if (!width) { width = '60px'; } - if (!color) { color = '#32c682'; } - var dots = ' '; - return dots; - }; - // Notiflix: Indicator SVG dots off - - // Notiflix: Indicator SVG pulse on - var notiflixIndicatorSvgPulse = function (width, color) { - if (!width) { width = '60px'; } - if (!color) { color = '#32c682'; } - var pulse = ''; - return pulse; - }; - // Notiflix: Indicator SVG pulse off - - // Notiflix: Indicator SVG notiflix on - var notiflixIndicatorSvgNotiflix = function (width, white, green) { - if (!width) { width = '60px'; } - if (!white) { white = '#f8f8f8'; } - if (!green) { green = '#32c682'; } - var notiflixIcon = ''; - return notiflixIcon; - }; - // Notiflix: Indicator SVG notiflix off - - - /* - * 侧边滑出弹层插件 mSlider.js - * DH (https://denghao.me) - * 2018-07 - */ - // (function(b, c) { - // function a(d) { - // this.opts = { - // "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.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 - // } - // 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("body")[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 = "fixed"; - // g.wrap.style.top = "0"; - // g.wrap.style.left = "0"; - // g.wrap.style.width = "100%"; - // g.wrap.style.height = "100%"; - // g.wrap.style.zIndex = 99; - // 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.height; - // 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 = 100; - // g.mask.style.width = "100%"; - // g.mask.style.height = "100%"; - // g.mask.style.opacity = "0"; - // g.mask.style.backgroundColor = "black"; - // g.mask.style.zIndex = "98"; - // g.mask.style.webkitTransition = "all .2s ease-out"; - // g.mask.style.transition = "all .2s ease-out"; - // 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.5 - // }, 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; - // d.opts.callback && d.opts.callback() - // }, 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); - - exports(MOD_NAME,pearOper); -}) - diff --git a/src/plugin/admin/public/component/pear/module/menu.js b/src/plugin/admin/public/component/pear/module/menu.js index 3b9dec3d..bde57b7a 100644 --- a/src/plugin/admin/public/component/pear/module/menu.js +++ b/src/plugin/admin/public/component/pear/module/menu.js @@ -5,15 +5,15 @@ layui.define(['table', 'jquery', 'element'], function (exports) { $ = layui.jquery, element = layui.element; - var pearMenu = function (opt) { + var menu = function (opt) { this.option = opt; }; - pearMenu.prototype.render = function (opt) { + menu.prototype.render = function (opt) { var option = { elem: opt.elem, - async: opt.async, + async: typeof opt.async === 'undefined' ? true : opt.async, parseData: opt.parseData, url: opt.url, method: opt.method ? opt.method : "GET", @@ -21,16 +21,18 @@ layui.define(['table', 'jquery', 'element'], function (exports) { defaultSelect: opt.defaultSelect, control: opt.control, controlWidth: opt.controlWidth ? opt.controlWidth : "auto", - defaultMenu: opt.defaultMenu, + defaultMenu: opt.defaultMenu || 0, accordion: opt.accordion, - height: opt.height, - theme: opt.theme, + height: opt.height || "100%", + theme: opt.theme || "dark-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(){ + + option.done = function () { if (option.control) { rationalizeHeaderControlWidthAuto(option); } @@ -40,21 +42,19 @@ layui.define(['table', 'jquery', 'element'], function (exports) { if (option.async) { if (option.method === "GET") { getData(option.url).then(function (data) { - option.data = data.data; //变更 + option.data = data; renderMenu(option); }); } else { postData(option.url).then(function (data) { - option.data = data.data; //变更 + option.data = data; renderMenu(option); }); } } else { - // 延时返回,和 javascript 执行时序关联 window.setTimeout(function () { renderMenu(option); }, 500); } - // 处理高度 $("#" + opt.elem).height(option.height) setTimeout(function () { @@ -83,10 +83,14 @@ layui.define(['table', 'jquery', 'element'], function (exports) { }); }, 1000) - return new pearMenu(option); + return new menu(option); + } + + menu.prototype.cache = function () { + return this.option.data; } - pearMenu.prototype.click = function (clickEvent) { + menu.prototype.click = function (clickEvent) { var _this = this; $("body").on("click", "#" + _this.option.elem + " .site-demo-active", function () { var dom = $(this); @@ -96,7 +100,8 @@ layui.define(['table', 'jquery', 'element'], function (exports) { menuPath: dom.attr("menu-title"), menuIcon: dom.attr("menu-icon"), menuUrl: dom.attr("menu-url"), - openType: dom.attr("open-type") + menuType: dom.attr("menu-type"), + menuOpenType: dom.attr("menu-open-type") }; var doms = hash(dom); if (doms != null) { @@ -139,14 +144,14 @@ layui.define(['table', 'jquery', 'element'], function (exports) { return d; } - pearMenu.prototype.skin = function (skin) { + menu.prototype.skin = function (skin) { var menu = $(".pear-nav-tree[lay-filter='" + this.option.elem + "']").parent(); menu.removeClass("dark-theme"); menu.removeClass("light-theme"); menu.addClass(skin); } - pearMenu.prototype.selectItem = function (pearId) { + menu.prototype.selectItem = function (pearId) { if (this.option.control != false) { $("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents(".layui-side-scroll ").find("ul").css({ display: "none" @@ -209,7 +214,7 @@ layui.define(['table', 'jquery', 'element'], function (exports) { } var activeMenus; - pearMenu.prototype.collapse = function (time) { + menu.prototype.collapse = function (time) { var elem = this.option.elem; var config = this.option; if ($("#" + this.option.elem).is(".pear-nav-mini")) { @@ -223,12 +228,12 @@ layui.define(['table', 'jquery', 'element'], function (exports) { isHoverMenu(false, config); var that = this; $("#" + this.option.elem) - .promise() - .done(function () { - if (that.option.control) { - rationalizeHeaderControlWidth(that.option); - } - }) + .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"); @@ -238,13 +243,13 @@ layui.define(['table', 'jquery', 'element'], function (exports) { }, 400); var that = this; $("#" + this.option.elem) - .promise() - .done(function () { - isHoverMenu(true, config); - if (that.option.control) { - rationalizeHeaderControlWidth(that.option); - } - }) + .promise() + .done(function () { + isHoverMenu(true, config); + if (that.option.control) { + rationalizeHeaderControlWidth(that.option); + } + }) } } @@ -278,13 +283,12 @@ layui.define(['table', 'jquery', 'element'], function (exports) { } } element.init(); - downShow(option); option.done(); } function createMenu(option) { var menuHtml = '
                                        ' + '" class="layui-nav arrow pear-menu layui-nav-tree pear-nav-tree" ' + (option.accordion ? "lay-accordion" : "") + '>' $.each(option.data, function (i, item) { var content = '
                                      • '; if (i == option.defaultOpen) { @@ -304,7 +308,7 @@ layui.define(['table', 'jquery', 'element'], function (exports) { '" ' + target + '>' + item.title + ''; } else if (item.type == 1) { - content += '' + item.title + ''; @@ -322,7 +326,7 @@ layui.define(['table', 'jquery', 'element'], function (exports) { } function createMenuAndControl(option) { - var control = '
                                          '; + var control = '
                                            '; var controlPe = '
                                              '; // 声 明 头 部 var menu = '
                                              ' @@ -374,7 +378,7 @@ layui.define(['table', 'jquery', 'element'], function (exports) { ''; } else if (note.type == 1) { // 创 建 菜 单 结 构 - content += '' + note.title + ''; @@ -433,7 +437,7 @@ layui.define(['table', 'jquery', 'element'], function (exports) { '">' + note.title + ''; } else if (note.type == 1) { // 创 建 菜 单 结 构 - content += '' + note.title + ''; } @@ -450,49 +454,6 @@ layui.define(['table', 'jquery', 'element'], function (exports) { return content; } - function downShow(option) { - $("body #" + option.elem).on("click", "a[menu-type='0']", function () { - if (!$("#" + option.elem).is(".pear-nav-mini")) { - var superEle = $(this).parent(); - var ele = $(this).next('.layui-nav-child'); - var heights = ele.children("dd").length * 48; - - if ($(this).parent().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"); - }); - } - ele.height(0); - ele.animate({ - height: heights + "px" - }, 240, function () { - ele.css({ - height: "auto" - }); - }); - } else { - $(this).parent().addClass("layui-nav-itemed"); - ele.animate({ - height: "0px" - }, 240, function () { - ele.css({ - height: "auto" - }); - $(this).parent().removeClass("layui-nav-itemed"); - }); - } - } - }) - } - /** 二 级 悬 浮 菜 单*/ function isHoverMenu(b, option) { if (b) { @@ -557,15 +518,16 @@ layui.define(['table', 'jquery', 'element'], function (exports) { $("#" + option.control + " .control").css({ "width": rationalizeWidth, "transition": "width .15s" }); } - function rationalizeHeaderControlWidthAuto(option){ + function rationalizeHeaderControlWidthAuto(option) { $(window).on('resize', function () { rationalizeHeaderControlWidth(option); }) - $(document).ready(function () { - rationalizeHeaderControlWidth(option); + setTimeout(() => { + rationalizeHeaderControlWidth(option); + }, 1000); }); } - exports(MOD_NAME, new pearMenu()); -}) + exports(MOD_NAME, new menu()); +}) \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/module/menuSearch.js b/src/plugin/admin/public/component/pear/module/menuSearch.js new file mode 100644 index 00000000..41775ba8 --- /dev/null +++ b/src/plugin/admin/public/component/pear/module/menuSearch.js @@ -0,0 +1,233 @@ +layui.define(['jquery', 'tools'], function (exports) { + "use strict"; + + /** + * @since Pear Admin 4.0 + * + * Button component + * */ + var MOD_NAME = 'menuSearch', + tools = layui.tools, + $ = layui.jquery; + + var menuSearch = function (opt) { + this.option = opt; + }; + + /** + * @since Pear Admin 4.0 + * + * Button start loading + * */ + menuSearch.prototype.render = function (opt) { + + var options = { + select: opt.select, + elem: opt.elem, + dataProvider: opt.dataProvider, + } + + $('body').on("click", options.elem, function () { + + var _html = [ + `` + ].join(''); + + layer.open({ + type: 1, + offset: "10%", + area: ['600px'], + title: false, + closeBtn: 0, + shadeClose: true, + anim: 0, + move: false, + content: _html, + success: function (layero, layeridx) { + + var $layer = layero; + var $content = $(layero).children('.layui-layer-content'); + var $input = $(".menu-search-input-wrapper input"); + var $noData = $(".menu-search-no-data"); + var $list = $(".menu-search-list"); + var menuData = options.dataProvider(); + + $layer.css("border-radius", "6px"); + $input.off("focus").focus(); + + // 搜索输入事件 + $input.off("input").on("input", tools.debounce(function () { + var keywords = $input.val().trim(); + var filteredMenus = filterHandle(menuData, keywords); + + if (filteredMenus.length) { + var tiledMenus = tiledHandle(filteredMenus); + var listHtml = createList(tiledMenus); + $noData.css("display", "none"); + $list.html("").append(listHtml).children(":first").addClass("this") + } else { + $list.html(""); + $noData.css("display", "flex"); + } + var currentHeight = $(".menu-search-content").outerHeight() + $layer.css("height", currentHeight); + $content.css("height", currentHeight); + }, 500) + ) + + // 列表点击事件 + $list.off("click").on("click", "li", function () { + var id = $(this).attr("smenu-id"); + var title = $(this).attr("smenu-title"); + var url = $(this).attr("smenu-url"); + var type = $(this).attr("smenu-type"); + var openType = $(this).attr("smenu-open-type"); + + options.select({ id, title, url, type, openType }); + + layer.close(layeridx); + }) + + $list.off('mouseenter').on("mouseenter", "li", function () { + $(".menu-search-list li.this").removeClass("this"); + $(this).addClass("this"); + }).off("mouseleave").on("mouseleave", "li", function () { + $(this).removeClass("this"); + }) + + // 监听键盘事件 + $('.menu-search-content').off("keydown").keydown(function (e) { + if (e.keyCode === 13 || e.keyCode === 32) { + e.preventDefault(); + var that = $(".menu-search-list li.this"); + var id = that.attr("smenu-id"); + var title = that.attr("smenu-title"); + var url = that.attr("smenu-url"); + var type = that.attr("smenu-type"); + var openType = that.attr("smenu-open-type"); + + options.select({ id, title, url, type, openType }); + + layer.close(layeridx); + } else if (e.keyCode === 38) { + e.preventDefault(); + var prevEl = $(".menu-search-list li.this").prev(); + $(".menu-search-list li.this").removeClass("this"); + if (prevEl.length !== 0) { + prevEl.addClass("this"); + } else { + $list.children().last().addClass("this"); + } + } else if (e.keyCode === 40) { + e.preventDefault(); + var nextEl = $(".menu-search-list li.this").next(); + $(".menu-search-list li.this").removeClass("this"); + if (nextEl.length !== 0) { + nextEl.addClass("this"); + } else { + $list.children().first().addClass("this"); + } + } else if (e.keyCode === 27) { + e.preventDefault(); + layer.close(layeridx); + } + }) + } + }) + }); + + return new menuSearch(options); + } + + /** + * @since Pear Admin 4.0 + * + * 创建结果列表 + */ + var createList = function (data) { + var listHtml = ''; + $.each(data, function (index, item) { + listHtml += `
                                            • + ${item.path} + +
                                            • ` + }) + return listHtml; + } + + /** + * @since Pear Admin 4.0 + * + * Tree 转 path 列表 + */ + var tiledHandle = function (data) { + var tiledMenus = []; + var treeTiled = function (data, content) { + var path = ""; + var separator = " / "; + if (!content) content = ""; + $.each(data, function (index, item) { + if (item.children && item.children.length) { + path += content + item.title + separator; + var childPath = treeTiled(item.children, path); + path += childPath; + if (!childPath) path = ""; // 重置路径 + } else { + path += content + item.title + tiledMenus.push({ path: path, info: item }); + path = ""; //重置路径 + } + }) + return path; + }; + treeTiled(data); + + return tiledMenus; + } + + /** + * @since Pear Admin 4.0 + * + * 查询匹配算法 + */ + var filterHandle = function (filterData, val) { + if (!val) return []; + var filteredMenus = []; + filterData = $.extend(true, {}, filterData); + $.each(filterData, function (index, item) { + if (item.children && item.children.length) { + var children = filterHandle(item.children, val) + var obj = $.extend({}, item, { children: children }); + if (children && children.length) { + filteredMenus.push(obj); + } else if (item.title.indexOf(val) >= 0) { + item.children = []; // 父级匹配但子级不匹配,就去除子级 + filteredMenus.push($.extend({}, item)); + } + } else if (item.title.indexOf(val) >= 0) { + filteredMenus.push(item); + } + }) + return filteredMenus; + } + + exports(MOD_NAME, new menuSearch()); +}); diff --git a/src/plugin/admin/public/component/pear/module/message.js b/src/plugin/admin/public/component/pear/module/message.js deleted file mode 100644 index 48374cb4..00000000 --- a/src/plugin/admin/public/component/pear/module/message.js +++ /dev/null @@ -1,132 +0,0 @@ -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 + ' .pear-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('pear-this'); - $(this).addClass('pear-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 = '
                                                '; - var noticeContent = '
                                                '; - - - // 根据 data 便利数据 - $.each(option.data, function (i, item) { - - if (i === 0) { - noticeTitle += '
                                              • ' + item.title + '
                                              • '; - noticeContent += '
                                                '; - } else { - noticeTitle += '
                                              • ' + item.title + '
                                              • '; - noticeContent += '
                                                '; - } - - $.each(item.children, function (i, note) { - noticeContent += '
                                                ' ; - - if (note.avatar) - noticeContent +=''; - - noticeContent +='
                                                ' + note.title + '
                                                ' + - '
                                                ' + note.time + '
                                                ' + - '
                                                '; - }) - - // 空内容 - if(item.children.length==0){ - noticeContent +='

                                                暂无数据

                                                '; - } - noticeContent += '
                                                '; - }) - - var notice = '
                                              • ' + - '
                                              • ' + - '
                                                '; - - noticeTitle += '
                                              '; - noticeContent += '
                                              '; - notice += noticeTitle; - notice += noticeContent; - notice += '
                                          '; - return notice; - } - - exports(MOD_NAME, new message()); -}) diff --git a/src/plugin/admin/public/component/pear/module/messageCenter.js b/src/plugin/admin/public/component/pear/module/messageCenter.js new file mode 100644 index 00000000..c7535cb3 --- /dev/null +++ b/src/plugin/admin/public/component/pear/module/messageCenter.js @@ -0,0 +1,85 @@ +layui.define(['table', 'jquery', 'element', 'dropdown'], function (exports) { + "use strict"; + + var MOD_NAME = 'messageCenter', + $ = layui.jquery, + dropdown = layui.dropdown; + + 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) { + $.get(option.url, function (result) { + const { code, success, data } = result; + $(`${opt.elem}`).append(`
                                        • + +
                                        • `); + if (code == 200 || success) { + option.data = data; + dropdown.render({ + elem: option.elem, + align: "center", + content: createHtml(option), + }) + } + }); + } + 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); + }) + } + + function createHtml(option) { + + var count = 0; + var notice = '
                                          ' + var noticeTitle = '
                                            '; + var noticeContent = '
                                            '; + + $.each(option.data, function (i, item) { + + noticeTitle += `
                                          • ${item.title}
                                          • `; + noticeContent += '
                                            '; + + + $.each(item.children, function (i, note) { + count++; + noticeContent += '
                                            '; + + noticeContent += '
                                            ' + note.title + '
                                            ' + + '
                                            ' + note.time + '
                                            ' + + '
                                            '; + }) + + noticeContent += '
                                            '; + }) + + noticeTitle += '
                                          '; + noticeContent += '
                                          '; + notice += noticeTitle; + notice += noticeContent; + notice += "
                                        " + + return notice; + } + + exports(MOD_NAME, new message()); +}) \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/module/notice.js b/src/plugin/admin/public/component/pear/module/notice.js deleted file mode 100644 index 4ea67ec8..00000000 --- a/src/plugin/admin/public/component/pear/module/notice.js +++ /dev/null @@ -1,489 +0,0 @@ - -(function(define) { - define(['jquery'], function($) { - return (function() { - var $container; - var listener; - var toastId = 0; - var toastType = { - error: 'error', - info: 'info', - success: 'success', - warning: 'warning' - }; - - var cssStyle = $( - '' - ); - $("body").append(cssStyle); - - var toastr = { - clear: clear, - remove: remove, - error: error, - getContainer: getContainer, - info: info, - options: {}, - subscribe: subscribe, - success: success, - version: '2.1.4', - warning: warning - }; - - var previousToast; - - return toastr; - - function error(message, title, optionsOverride) { - return notify({ - type: toastType.error, - iconClass: getOptions().iconClasses.error, - message: message, - optionsOverride: optionsOverride, - title: title - }); - } - - function getContainer(options, create) { - if (!options) { - options = getOptions(); - } - $container = $('#' + options.containerId); - if ($container.length) { - return $container; - } - if (create) { - $container = createContainer(options); - } - return $container; - } - - function info(message, title, optionsOverride) { - return notify({ - type: toastType.info, - iconClass: getOptions().iconClasses.info, - message: message, - optionsOverride: optionsOverride, - title: title - }); - } - - function subscribe(callback) { - listener = callback; - } - - function success(message, title, optionsOverride) { - return notify({ - type: toastType.success, - iconClass: getOptions().iconClasses.success, - message: message, - optionsOverride: optionsOverride, - title: title - }); - } - - function warning(message, title, optionsOverride) { - return notify({ - type: toastType.warning, - iconClass: getOptions().iconClasses.warning, - message: message, - optionsOverride: optionsOverride, - title: title - }); - } - - function clear($toastElement, clearOptions) { - var options = getOptions(); - if (!$container) { - getContainer(options); - } - if (!clearToast($toastElement, options, clearOptions)) { - clearContainer(options); - } - } - - function remove($toastElement) { - var options = getOptions(); - if (!$container) { - getContainer(options); - } - if ($toastElement && $(':focus', $toastElement).length === 0) { - removeToast($toastElement); - return; - } - if ($container.children().length) { - $container.remove(); - } - } - - // internal functions - - function clearContainer(options) { - var toastsToClear = $container.children(); - for (var i = toastsToClear.length - 1; i >= 0; i--) { - clearToast($(toastsToClear[i]), options); - } - } - - function clearToast($toastElement, options, clearOptions) { - var force = clearOptions && clearOptions.force ? clearOptions.force : false; - if ($toastElement && (force || $(':focus', $toastElement).length === 0)) { - $toastElement[options.hideMethod]({ - duration: options.hideDuration, - easing: options.hideEasing, - complete: function() { - removeToast($toastElement); - } - }); - return true; - } - return false; - } - - function createContainer(options) { - $container = $('
                                        ') - .attr('id', options.containerId) - .addClass(options.positionClass); - - $container.appendTo($(options.target)); - return $container; - } - - function getDefaults() { - return { - tapToDismiss: true, - toastClass: 'toast', - containerId: 'toast-container', - debug: false, - - showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery - showDuration: 300, - showEasing: 'swing', //swing and linear are built into jQuery - onShown: undefined, - hideMethod: 'fadeOut', - hideDuration: 1000, - hideEasing: 'swing', - onHidden: undefined, - closeMethod: false, - closeDuration: false, - closeEasing: false, - closeOnHover: true, - - extendedTimeOut: 1000, - iconClasses: { - error: 'toast-error', - info: 'toast-info', - success: 'toast-success', - warning: 'toast-warning' - }, - iconClass: 'toast-info', - positionClass: 'toast-top-right', - timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky - titleClass: 'toast-title', - messageClass: 'toast-message', - escapeHtml: false, - target: 'body', - closeHtml: '', - closeClass: 'toast-close-button', - newestOnTop: true, - preventDuplicates: false, - progressBar: false, - progressClass: 'toast-progress', - rtl: false - }; - } - - function publish(args) { - if (!listener) { - return; - } - listener(args); - } - - function notify(map) { - var options = getOptions(); - var iconClass = map.iconClass || options.iconClass; - - if (typeof(map.optionsOverride) !== 'undefined') { - options = $.extend(options, map.optionsOverride); - iconClass = map.optionsOverride.iconClass || iconClass; - } - - if (shouldExit(options, map)) { - return; - } - - toastId++; - - $container = getContainer(options, true); - - var intervalId = null; - var $toastElement = $('
                                        '); - var $titleElement = $('
                                        '); - var $messageElement = $('
                                        '); - var $progressElement = $('
                                        '); - var $closeElement = $(options.closeHtml); - var progressBar = { - intervalId: null, - hideEta: null, - maxHideTime: null - }; - var response = { - toastId: toastId, - state: 'visible', - startTime: new Date(), - options: options, - map: map - }; - - personalizeToast(); - - displayToast(); - - handleEvents(); - - publish(response); - - if (options.debug && console) { - console.log(response); - } - - return $toastElement; - - function escapeHtml(source) { - if (source == null) { - source = ''; - } - - return source - .replace(/&/g, '&') - .replace(/"/g, '"') - .replace(/'/g, ''') - .replace(//g, '>'); - } - - function personalizeToast() { - setIcon(); - setTitle(); - setMessage(); - setCloseButton(); - setProgressBar(); - setRTL(); - setSequence(); - setAria(); - } - - function setAria() { - var ariaValue = ''; - switch (map.iconClass) { - case 'toast-success': - case 'toast-info': - ariaValue = 'polite'; - break; - default: - ariaValue = 'assertive'; - } - $toastElement.attr('aria-live', ariaValue); - } - - function handleEvents() { - if (options.closeOnHover) { - $toastElement.hover(stickAround, delayedHideToast); - } - - if (!options.onclick && options.tapToDismiss) { - $toastElement.click(hideToast); - } - - if (options.closeButton && $closeElement) { - $closeElement.click(function(event) { - if (event.stopPropagation) { - event.stopPropagation(); - } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) { - event.cancelBubble = true; - } - - if (options.onCloseClick) { - options.onCloseClick(event); - } - - hideToast(true); - }); - } - - if (options.onclick) { - $toastElement.click(function(event) { - options.onclick(event); - hideToast(); - }); - } - } - - function displayToast() { - $toastElement.hide(); - - $toastElement[options.showMethod]({ - duration: options.showDuration, - easing: options.showEasing, - complete: options.onShown - }); - - if (options.timeOut > 0) { - intervalId = setTimeout(hideToast, options.timeOut); - progressBar.maxHideTime = parseFloat(options.timeOut); - progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime; - if (options.progressBar) { - progressBar.intervalId = setInterval(updateProgress, 10); - } - } - } - - function setIcon() { - if (map.iconClass) { - $toastElement.addClass(options.toastClass).addClass(iconClass); - } - } - - function setSequence() { - if (options.newestOnTop) { - $container.prepend($toastElement); - } else { - $container.append($toastElement); - } - } - - function setTitle() { - if (map.title) { - var suffix = map.title; - if (options.escapeHtml) { - suffix = escapeHtml(map.title); - } - $titleElement.append(suffix).addClass(options.titleClass); - $toastElement.append($titleElement); - } - } - - function setMessage() { - if (map.message) { - var suffix = map.message; - if (options.escapeHtml) { - suffix = escapeHtml(map.message); - } - $messageElement.append(suffix).addClass(options.messageClass); - $toastElement.append($messageElement); - } - } - - function setCloseButton() { - if (options.closeButton) { - $closeElement.addClass(options.closeClass).attr('role', 'button'); - $toastElement.prepend($closeElement); - } - } - - function setProgressBar() { - if (options.progressBar) { - $progressElement.addClass(options.progressClass); - $toastElement.prepend($progressElement); - } - } - - function setRTL() { - if (options.rtl) { - $toastElement.addClass('rtl'); - } - } - - function shouldExit(options, map) { - if (options.preventDuplicates) { - if (map.message === previousToast) { - return true; - } else { - previousToast = map.message; - } - } - return false; - } - - function hideToast(override) { - var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod; - var duration = override && options.closeDuration !== false ? - options.closeDuration : options.hideDuration; - var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing; - if ($(':focus', $toastElement).length && !override) { - return; - } - clearTimeout(progressBar.intervalId); - return $toastElement[method]({ - duration: duration, - easing: easing, - complete: function() { - removeToast($toastElement); - clearTimeout(intervalId); - if (options.onHidden && response.state !== 'hidden') { - options.onHidden(); - } - response.state = 'hidden'; - response.endTime = new Date(); - publish(response); - } - }); - } - - function delayedHideToast() { - if (options.timeOut > 0 || options.extendedTimeOut > 0) { - intervalId = setTimeout(hideToast, options.extendedTimeOut); - progressBar.maxHideTime = parseFloat(options.extendedTimeOut); - progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime; - } - } - - function stickAround() { - clearTimeout(intervalId); - progressBar.hideEta = 0; - $toastElement.stop(true, true)[options.showMethod]({ - duration: options.showDuration, - easing: options.showEasing - }); - } - - function updateProgress() { - var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100; - $progressElement.width(percentage + '%'); - } - } - - function getOptions() { - return $.extend({}, getDefaults(), toastr.options); - } - - function removeToast($toastElement) { - if (!$container) { - $container = getContainer(); - } - if ($toastElement.is(':visible')) { - return; - } - $toastElement.remove(); - $toastElement = null; - if ($container.children().length === 0) { - $container.remove(); - previousToast = undefined; - } - } - - })(); - }); -}(typeof define === 'function' && define.amd ? define : function(deps, factory) { - if (typeof module !== 'undefined' && module.exports) { //Node - module.exports = factory(require('jquery')); - } else if (window.layui && layui.define) { - layui.define('jquery', function(exports) { //layui加载 - exports('toastr', factory(layui.jquery)); - exports('notice', factory(layui.jquery)); - }); - } else { - window.toastr = factory(window.jQuery); - } -})); diff --git a/src/plugin/admin/public/component/pear/module/page.js b/src/plugin/admin/public/component/pear/module/page.js new file mode 100644 index 00000000..b98c2773 --- /dev/null +++ b/src/plugin/admin/public/component/pear/module/page.js @@ -0,0 +1,138 @@ +layui.define(['jquery', 'element'], function (exports) { + "use strict"; + + var $ = layui.jquery; + var element = layui.element; + + var page = function (opt) { + this.option = opt; + }; + + /** + * @since Pear Admin 4.0 + * + * 创建 Page 页面 + */ + page.prototype.render = function (opt) { + var option = { + elem: opt.elem, + url: opt.url, + width: opt.width || "100%", + height: opt.height || "100%", + title: opt.title, + type: opt.type || "_iframe" + } + renderContent(option); + return new page(option); + } + + /** + * @since Pear Admin 4.0 + * + * 切换 Page 页面 + */ + page.prototype.changePage = function (options) { + const $frame = $(`#${this.option.elem} .pear-page-content`); + if (options.type === "_iframe") { + const iframeLoad = $("#" + this.option.elem).find(".pear-page-loading"); + iframeLoad.show(); + $frame.html(``); + $frame.find("iframe").on("load", () => { + iframeLoad.fadeOut(1000, function () { + iframeLoad.css({ + display: "none" + }); + }); + }); + } else { + $.ajax({ + url: options.href, + type: 'get', + dataType: 'html', + success: function (data) { + $frame.html(data) + }, + error: function (xhr) { + return layer.msg('Status:' + xhr.status + ',' + xhr.statusText + ',请稍后再试!'); + } + }); + } + $frame.attr("type", options.type); + $frame.attr("href", options.href); + } + + page.prototype.refresh = function (loading) { + var $frameLoad = $(`#${this.option.elem} .pear-page-loading`); + var $frame = $(`#${this.option.elem} .pear-page-content`); + if (loading) { + $frameLoad.css({ + display: 'block' + }); + } + if ($frame.attr("type") === "_iframe") { + $frame.html(``); + const $contentFrame = $frame.find("iframe"); + $contentFrame.on("load", () => { + $frameLoad.fadeOut(1000); + }) + } else { + $.ajax({ + type: 'get', + url: $frame.attr("href"), + dataType: 'html', + success: function (data) { + $frame.html(data) + $frameLoad.fadeOut(1000); + element.init(); + }, + error: function (xhr) { + return layer.msg('Status:' + xhr.status + ',' + xhr.statusText + ',请稍后再试!'); + } + }); + } + } + + function renderContent(option) { + $("#" + option.elem).html(` +
                                        +
                                        +
                                        +
                                        + + + + +
                                        +
                                        +
                                        `); + + var $frame = $("#" + option.elem).find(".pear-page-content"); + + if (option.type === "_iframe") { + const iframeLoad = $("#" + option.elem).find(".pear-page-loading"); + iframeLoad.show(); + $frame.html(``); + $frame.find("iframe").on("load", () => { + iframeLoad.fadeOut(1000, function () { + iframeLoad.css({ + display: "none" + }); + }); + }); + } else { + $.ajax({ + url: option.url, + type: 'get', + dataType: 'html', + success: function (data) { + $frame.html(data); + }, + error: function (xhr) { + return layer.msg('Status:' + xhr.status + ',' + xhr.statusText + ',请稍后再试!'); + } + }); + } + } + + exports('page', new page()); +}); \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/module/popover/popover.js b/src/plugin/admin/public/component/pear/module/popover/popover.js deleted file mode 100644 index 7f2e9bd7..00000000 --- a/src/plugin/admin/public/component/pear/module/popover/popover.js +++ /dev/null @@ -1,1219 +0,0 @@ -/* - * webui popover plugin - v1.2.17 - * A lightWeight popover plugin with jquery ,enchance the popover plugin of bootstrap with some awesome new features. It works well with bootstrap ,but bootstrap is not necessary! - * https://github.com/sandywalker/webui-popover - * - * Made by Sandy Duan - * Under MIT License - */ - -layui.define(['jquery', 'element'], function(exports) { - var $=layui.$; - // Create the defaults once - var pluginName = 'webuiPopover'; - var pluginClass = 'webui-popover'; - var pluginType = 'webui.popover'; - var defaults = { - placement: 'auto', - container: null, - width: 'auto', - height: 'auto', - trigger: 'click', //hover,click,sticky,manual - style: '', - opacity:null, - selector: false, // jQuery selector, if a selector is provided, popover objects will be delegated to the specified. - delay: { - show: null, - hide: 300 - }, - async: { - type: 'GET', - before: null, //function(that, xhr, settings){} - success: null, //function(that, xhr){} - error: null //function(that, xhr, data){} - }, - cache: true, - multi: false, - arrow: true, - title: '', - content: '', - closeable: false, - padding: true, - url: '', - type: 'html', - direction: '', // ltr,rtl - animation: null, - template: '
                                        ' + - '
                                        ' + - '
                                        ' + - '' + - '

                                        ' + - '

                                         

                                        ' + - '
                                        ' + - '
                                        ', - backdrop: false, - dismissible: true, - onShow: null, - onHide: null, - abortXHR: true, - autoHide: false, - offsetTop: 0, - offsetLeft: 0, - iframeOptions: { - frameborder: '0', - allowtransparency: 'true', - id: '', - name: '', - scrolling: '', - onload: '', - height: '', - width: '' - }, - hideEmpty: false - }; - - var rtlClass = pluginClass + '-rtl'; - var _srcElements = []; - var backdrop = $('
                                        '); - var _globalIdSeed = 0; - var _isBodyEventHandled = false; - var _offsetOut = -2000; // the value offset out of the screen - var $document = $(document); - - var toNumber = function (numeric, fallback) { - return isNaN(numeric) ? (fallback || 0) : Number(numeric); - }; - - var getPopFromElement = function ($element) { - return $element.data('plugin_' + pluginName); - }; - - var hideAllPop = function () { - var pop = null; - for (var i = 0; i < _srcElements.length; i++) { - pop = getPopFromElement(_srcElements[i]); - if (pop) { - pop.hide(true); - } - } - $document.trigger('hiddenAll.' + pluginType); - }; - - var hideOtherPops = function (currentPop) { - var pop = null; - for (var i = 0; i < _srcElements.length; i++) { - pop = getPopFromElement(_srcElements[i]); - if (pop && pop.id !== currentPop.id) { - pop.hide(true); - } - } - $document.trigger('hiddenAll.' + pluginType); - }; - - var isMobile = ('ontouchstart' in document.documentElement) && (/Mobi/.test(navigator.userAgent)); - - var pointerEventToXY = function (e) { - var out = { - x: 0, - y: 0 - }; - if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') { - var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; - out.x = touch.pageX; - out.y = touch.pageY; - } else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'click') { - out.x = e.pageX; - out.y = e.pageY; - } - return out; - }; - - - // The actual plugin constructor - function WebuiPopover(element, options) { - this.$element = $(element); - if (options) { - if ($.type(options.delay) === 'string' || $.type(options.delay) === 'number') { - options.delay = { - show: options.delay, - hide: options.delay - }; // bc break fix - } - } - this.options = $.extend({}, defaults, options); - this._defaults = defaults; - this._name = pluginName; - this._targetclick = false; - this.init(); - _srcElements.push(this.$element); - return this; - - } - - WebuiPopover.prototype = { - //init webui popover - init: function () { - if (this.$element[0] instanceof document.constructor && !this.options.selector) { - throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!'); - } - - if (this.getTrigger() !== 'manual') { - //init the event handlers - if (isMobile) { - this.$element.off('touchend', this.options.selector).on('touchend', this.options.selector, $.proxy(this.toggle, this)); - } else if (this.getTrigger() === 'click') { - this.$element.off('click', this.options.selector).on('click', this.options.selector, $.proxy(this.toggle, this)); - } else if (this.getTrigger() === 'hover') { - this.$element - .off('mouseenter mouseleave click', this.options.selector) - .on('mouseenter', this.options.selector, $.proxy(this.mouseenterHandler, this)) - .on('mouseleave', this.options.selector, $.proxy(this.mouseleaveHandler, this)); - } - } - this._poped = false; - this._inited = true; - this._opened = false; - this._idSeed = _globalIdSeed; - this.id = pluginName + this._idSeed; - // normalize container - this.options.container = $(this.options.container || document.body).first(); - - if (this.options.backdrop) { - backdrop.appendTo(this.options.container).hide(); - } - _globalIdSeed++; - if (this.getTrigger() === 'sticky') { - this.show(); - } - - if (this.options.selector) { - this._options = $.extend({}, this.options, { - selector: '' - }); - } - - }, - /* api methods and actions */ - destroy: function () { - var index = -1; - - for (var i = 0; i < _srcElements.length; i++) { - if (_srcElements[i] === this.$element) { - index = i; - break; - } - } - - _srcElements.splice(index, 1); - - - this.hide(); - this.$element.data('plugin_' + pluginName, null); - if (this.getTrigger() === 'click') { - this.$element.off('click'); - } else if (this.getTrigger() === 'hover') { - this.$element.off('mouseenter mouseleave'); - } - if (this.$target) { - this.$target.remove(); - } - }, - getDelegateOptions: function () { - var options = {}; - - this._options && $.each(this._options, function (key, value) { - if (defaults[key] !== value) { - options[key] = value; - } - }); - return options; - }, - /* - param: force boolean value, if value is true then force hide the popover - param: event dom event, - */ - hide: function (force, event) { - - if (!force && this.getTrigger() === 'sticky') { - return; - } - if (!this._opened) { - return; - } - if (event) { - event.preventDefault(); - event.stopPropagation(); - } - - if (this.xhr && this.options.abortXHR === true) { - this.xhr.abort(); - this.xhr = null; - } - - - var e = $.Event('hide.' + pluginType); - this.$element.trigger(e, [this.$target]); - if (this.$target) { - this.$target.removeClass('in').addClass(this.getHideAnimation()); - var that = this; - setTimeout(function () { - that.$target.hide(); - if (!that.getCache()) { - that.$target.remove(); - //that.getTriggerElement.removeAttr('data-target'); - } - }, that.getHideDelay()); - } - if (this.options.backdrop) { - backdrop.hide(); - } - this._opened = false; - this.$element.trigger('hidden.' + pluginType, [this.$target]); - - if (this.options.onHide) { - this.options.onHide(this.$target); - } - - }, - resetAutoHide: function () { - var that = this; - var autoHide = that.getAutoHide(); - if (autoHide) { - if (that.autoHideHandler) { - clearTimeout(that.autoHideHandler); - } - that.autoHideHandler = setTimeout(function () { - that.hide(); - }, autoHide); - } - }, - delegate: function (eventTarget) { - var self = $(eventTarget).data('plugin_' + pluginName); - if (!self) { - self = new WebuiPopover(eventTarget, this.getDelegateOptions()); - $(eventTarget).data('plugin_' + pluginName, self); - } - return self; - }, - toggle: function (e) { - var self = this; - if (e) { - e.preventDefault(); - e.stopPropagation(); - if (this.options.selector) { - self = this.delegate(e.currentTarget); - } - } - self[self.getTarget().hasClass('in') ? 'hide' : 'show'](); - }, - hideAll: function () { - hideAllPop(); - }, - hideOthers: function () { - hideOtherPops(this); - }, - /*core method ,show popover */ - show: function () { - if (this._opened) { - return; - } - //removeAllTargets(); - var - $target = this.getTarget().removeClass().addClass(pluginClass).addClass(this._customTargetClass); - if (!this.options.multi) { - this.hideOthers(); - } - - // use cache by default, if not cache setted , reInit the contents - if (!this.getCache() || !this._poped || this.content === '') { - this.content = ''; - this.setTitle(this.getTitle()); - if (!this.options.closeable) { - $target.find('.close').off('click').remove(); - } - if (!this.isAsync()) { - this.setContent(this.getContent()); - } else { - this.setContentASync(this.options.content); - } - - if (this.canEmptyHide() && this.content === '') { - return; - } - $target.show(); - } - - this.displayContent(); - - if (this.options.onShow) { - this.options.onShow($target); - } - - this.bindBodyEvents(); - if (this.options.backdrop) { - backdrop.show(); - } - this._opened = true; - this.resetAutoHide(); - }, - displayContent: function () { - var - //element postion - elementPos = this.getElementPosition(), - //target postion - $target = this.getTarget().removeClass().addClass(pluginClass).addClass(this._customTargetClass), - //target content - $targetContent = this.getContentElement(), - //target Width - targetWidth = $target[0].offsetWidth, - //target Height - targetHeight = $target[0].offsetHeight, - //placement - placement = 'bottom', - e = $.Event('show.' + pluginType); - - if (this.canEmptyHide()) { - - var content = $targetContent.children().html(); - if (content !== null && content.trim().length === 0) { - return; - } - } - - //if (this.hasContent()){ - this.$element.trigger(e, [$target]); - //} - // support width as data attribute - var optWidth = this.$element.data('width') || this.options.width; - if (optWidth === '') { - optWidth = this._defaults.width; - } - - if (optWidth !== 'auto') { - $target.width(optWidth); - } - - // support height as data attribute - var optHeight = this.$element.data('height') || this.options.height; - if (optHeight === '') { - optHeight = this._defaults.height; - } - - if (optHeight !== 'auto') { - $targetContent.height(optHeight); - } - - if (this.options.style) { - this.$target.addClass(pluginClass + '-' + this.options.style); - } - - //check rtl - if (this.options.direction === 'rtl' && !$targetContent.hasClass(rtlClass)) { - $targetContent.addClass(rtlClass); - } - - //init the popover and insert into the document body - if (!this.options.arrow) { - $target.find('.webui-arrow').remove(); - } - $target.detach().css({ - top: _offsetOut, - left: _offsetOut, - display: 'block', - opacity:this.options.opacity || 1 - }); - - if (this.getAnimation()) { - $target.addClass(this.getAnimation()); - } - $target.appendTo(this.options.container); - - - placement = this.getPlacement(elementPos); - - //This line is just for compatible with knockout custom binding - this.$element.trigger('added.' + pluginType); - - this.initTargetEvents(); - - if (!this.options.padding) { - if (this.options.height !== 'auto') { - $targetContent.css('height', $targetContent.outerHeight()); - } - this.$target.addClass('webui-no-padding'); - } - - // add maxHeight and maxWidth support by limodou@gmail.com 2016/10/1 - if (this.options.maxHeight) { - $targetContent.css('maxHeight', this.options.maxHeight); - } - - if (this.options.maxWidth) { - $targetContent.css('maxWidth', this.options.maxWidth); - } - // end - - targetWidth = $target[0].offsetWidth; - targetHeight = $target[0].offsetHeight; - - var postionInfo = this.getTargetPositin(elementPos, placement, targetWidth, targetHeight); - - this.$target.css(postionInfo.position).addClass(placement).addClass('in'); - - if (this.options.type === 'iframe') { - var $iframe = $target.find('iframe'); - var iframeWidth = $target.width(); - var iframeHeight = $iframe.parent().height(); - - if (this.options.iframeOptions.width !== '' && this.options.iframeOptions.width !== 'auto') { - iframeWidth = this.options.iframeOptions.width; - } - - if (this.options.iframeOptions.height !== '' && this.options.iframeOptions.height !== 'auto') { - iframeHeight = this.options.iframeOptions.height; - } - - $iframe.width(iframeWidth).height(iframeHeight); - } - - if (!this.options.arrow) { - this.$target.css({ - 'margin': 0 - }); - } - if (this.options.arrow) { - var $arrow = this.$target.find('.webui-arrow'); - $arrow.removeAttr('style'); - - //prevent arrow change by content size - if (placement === 'left' || placement === 'right') { - $arrow.css({ - top: this.$target.height() / 2 - }); - } else if (placement === 'top' || placement === 'bottom') { - $arrow.css({ - left: this.$target.width() / 2 - }); - } - - if (postionInfo.arrowOffset) { - //hide the arrow if offset is negative - if (postionInfo.arrowOffset.left === -1 || postionInfo.arrowOffset.top === -1) { - $arrow.hide(); - } else { - $arrow.css(postionInfo.arrowOffset); - } - } - - } - this._poped = true; - this.$element.trigger('shown.' + pluginType, [this.$target]); - }, - - isTargetLoaded: function () { - return this.getTarget().find('i.glyphicon-refresh').length === 0; - }, - - /*getter setters */ - getTriggerElement: function () { - return this.$element; - }, - getTarget: function () { - if (!this.$target) { - var id = pluginName + this._idSeed; - this.$target = $(this.options.template) - .attr('id', id); - this._customTargetClass = this.$target.attr('class') !== pluginClass ? this.$target.attr('class') : null; - this.getTriggerElement().attr('data-target', id); - } - if (!this.$target.data('trigger-element')) { - this.$target.data('trigger-element', this.getTriggerElement()); - } - return this.$target; - }, - removeTarget: function () { - this.$target.remove(); - this.$target = null; - this.$contentElement = null; - }, - getTitleElement: function () { - return this.getTarget().find('.' + pluginClass + '-title'); - }, - getContentElement: function () { - if (!this.$contentElement) { - this.$contentElement = this.getTarget().find('.' + pluginClass + '-content'); - } - return this.$contentElement; - }, - getTitle: function () { - return this.$element.attr('data-title') || this.options.title || this.$element.attr('title'); - }, - getUrl: function () { - return this.$element.attr('data-url') || this.options.url; - }, - getAutoHide: function () { - return this.$element.attr('data-auto-hide') || this.options.autoHide; - }, - getOffsetTop: function () { - return toNumber(this.$element.attr('data-offset-top')) || this.options.offsetTop; - }, - getOffsetLeft: function () { - return toNumber(this.$element.attr('data-offset-left')) || this.options.offsetLeft; - }, - getCache: function () { - var dataAttr = this.$element.attr('data-cache'); - if (typeof (dataAttr) !== 'undefined') { - switch (dataAttr.toLowerCase()) { - case 'true': - case 'yes': - case '1': - return true; - case 'false': - case 'no': - case '0': - return false; - } - } - return this.options.cache; - }, - getTrigger: function () { - return this.$element.attr('data-trigger') || this.options.trigger; - }, - getDelayShow: function () { - var dataAttr = this.$element.attr('data-delay-show'); - if (typeof (dataAttr) !== 'undefined') { - return dataAttr; - } - return this.options.delay.show === 0 ? 0 : this.options.delay.show || 100; - }, - getHideDelay: function () { - var dataAttr = this.$element.attr('data-delay-hide'); - if (typeof (dataAttr) !== 'undefined') { - return dataAttr; - } - return this.options.delay.hide === 0 ? 0 : this.options.delay.hide || 100; - }, - getAnimation: function () { - var dataAttr = this.$element.attr('data-animation'); - return dataAttr || this.options.animation; - }, - getHideAnimation: function () { - var ani = this.getAnimation(); - return ani ? ani + '-out' : 'out'; - }, - setTitle: function (title) { - var $titleEl = this.getTitleElement(); - if (title) { - //check rtl - if (this.options.direction === 'rtl' && !$titleEl.hasClass(rtlClass)) { - $titleEl.addClass(rtlClass); - } - $titleEl.html(title); - } else { - $titleEl.remove(); - } - }, - hasContent: function () { - return this.getContent(); - }, - canEmptyHide: function () { - return this.options.hideEmpty && this.options.type === 'html'; - }, - getIframe: function () { - var $iframe = $('').attr('src', this.getUrl()); - var self = this; - $.each(this._defaults.iframeOptions, function (opt) { - if (typeof self.options.iframeOptions[opt] !== 'undefined') { - $iframe.attr(opt, self.options.iframeOptions[opt]); - } - }); - - return $iframe; - }, - getContent: function () { - if (this.getUrl()) { - switch (this.options.type) { - case 'iframe': - this.content = this.getIframe(); - break; - case 'html': - try { - this.content = $(this.getUrl()); - if (!this.content.is(':visible')) { - this.content.show(); - } - } catch (error) { - throw new Error('Unable to get popover content. Invalid selector specified.'); - } - break; - } - } else if (!this.content) { - var content = ''; - if ($.isFunction(this.options.content)) { - content = this.options.content.apply(this.$element[0], [this]); - } else { - content = this.options.content; - } - this.content = this.$element.attr('data-content') || content; - if (!this.content) { - var $next = this.$element.next(); - - if ($next && $next.hasClass(pluginClass + '-content')) { - this.content = $next; - } - } - } - return this.content; - }, - setContent: function (content) { - var $target = this.getTarget(); - var $ct = this.getContentElement(); - if (typeof content === 'string') { - $ct.html(content); - } else if (content instanceof $) { - $ct.html(''); - //Don't want to clone too many times. - if (!this.options.cache) { - content.clone(true, true).removeClass(pluginClass + '-content').appendTo($ct); - } else { - content.removeClass(pluginClass + '-content').appendTo($ct); - } - } - this.$target = $target; - }, - isAsync: function () { - return this.options.type === 'async'; - }, - setContentASync: function (content) { - var that = this; - if (this.xhr) { - return; - } - this.xhr = $.ajax({ - url: this.getUrl(), - type: this.options.async.type, - cache: this.getCache(), - beforeSend: function (xhr, settings) { - if (that.options.async.before) { - that.options.async.before(that, xhr, settings); - } - }, - success: function (data) { - that.bindBodyEvents(); - if (content && $.isFunction(content)) { - that.content = content.apply(that.$element[0], [data]); - } else { - that.content = data; - } - that.setContent(that.content); - var $targetContent = that.getContentElement(); - $targetContent.removeAttr('style'); - that.displayContent(); - if (that.options.async.success) { - that.options.async.success(that, data); - } - }, - complete: function () { - that.xhr = null; - }, - error: function (xhr, data) { - if (that.options.async.error) { - that.options.async.error(that, xhr, data); - } - } - }); - }, - - bindBodyEvents: function () { - if (_isBodyEventHandled) { - return; - } - if (this.options.dismissible && this.getTrigger() === 'click') { - if (isMobile) { - $document.off('touchstart.webui-popover').on('touchstart.webui-popover', $.proxy(this.bodyTouchStartHandler, this)); - } else { - $document.off('keyup.webui-popover').on('keyup.webui-popover', $.proxy(this.escapeHandler, this)); - $document.off('click.webui-popover').on('click.webui-popover', $.proxy(this.bodyClickHandler, this)); - } - } else if (this.getTrigger() === 'hover') { - $document.off('touchend.webui-popover') - .on('touchend.webui-popover', $.proxy(this.bodyClickHandler, this)); - } - }, - - /* event handlers */ - mouseenterHandler: function (e) { - var self = this; - - if (e && this.options.selector) { - self = this.delegate(e.currentTarget); - } - - if (self._timeout) { - clearTimeout(self._timeout); - } - self._enterTimeout = setTimeout(function () { - if (!self.getTarget().is(':visible')) { - self.show(); - } - }, this.getDelayShow()); - }, - mouseleaveHandler: function () { - var self = this; - clearTimeout(self._enterTimeout); - //key point, set the _timeout then use clearTimeout when mouse leave - self._timeout = setTimeout(function () { - self.hide(); - }, this.getHideDelay()); - }, - escapeHandler: function (e) { - if (e.keyCode === 27) { - this.hideAll(); - } - }, - bodyTouchStartHandler: function (e) { - var self = this; - var $eventEl = $(e.currentTarget); - $eventEl.on('touchend', function (e) { - self.bodyClickHandler(e); - $eventEl.off('touchend'); - }); - $eventEl.on('touchmove', function () { - $eventEl.off('touchend'); - }); - }, - bodyClickHandler: function (e) { - _isBodyEventHandled = true; - var canHide = true; - for (var i = 0; i < _srcElements.length; i++) { - var pop = getPopFromElement(_srcElements[i]); - if (pop && pop._opened) { - var offset = pop.getTarget().offset(); - var popX1 = offset.left; - var popY1 = offset.top; - var popX2 = offset.left + pop.getTarget().width(); - var popY2 = offset.top + pop.getTarget().height(); - var pt = pointerEventToXY(e); - var inPop = pt.x >= popX1 && pt.x <= popX2 && pt.y >= popY1 && pt.y <= popY2; - if (inPop) { - canHide = false; - break; - } - } - } - if (canHide) { - hideAllPop(); - } - }, - - /* - targetClickHandler: function() { - this._targetclick = true; - }, - */ - - //reset and init the target events; - initTargetEvents: function () { - if (this.getTrigger() === 'hover') { - this.$target - .off('mouseenter mouseleave') - .on('mouseenter', $.proxy(this.mouseenterHandler, this)) - .on('mouseleave', $.proxy(this.mouseleaveHandler, this)); - } - this.$target.find('.close').off('click').on('click', $.proxy(this.hide, this, true)); - //this.$target.off('click.webui-popover').on('click.webui-popover', $.proxy(this.targetClickHandler, this)); - }, - /* utils methods */ - //caculate placement of the popover - getPlacement: function (pos) { - var - placement, - container = this.options.container, - clientWidth = container.innerWidth(), - clientHeight = container.innerHeight(), - scrollTop = container.scrollTop(), - scrollLeft = container.scrollLeft(), - pageX = Math.max(0, pos.left - scrollLeft), - pageY = Math.max(0, pos.top - scrollTop); - //arrowSize = 20; - - //if placement equals auto,caculate the placement by element information; - if (typeof (this.options.placement) === 'function') { - placement = this.options.placement.call(this, this.getTarget()[0], this.$element[0]); - } else { - placement = this.$element.data('placement') || this.options.placement; - } - - var isH = placement === 'horizontal'; - var isV = placement === 'vertical'; - var detect = placement === 'auto' || isH || isV; - - if (detect) { - if (pageX < clientWidth / 3) { - if (pageY < clientHeight / 3) { - placement = isH ? 'right-bottom' : 'bottom-right'; - } else if (pageY < clientHeight * 2 / 3) { - if (isV) { - placement = pageY <= clientHeight / 2 ? 'bottom-right' : 'top-right'; - } else { - placement = 'right'; - } - } else { - placement = isH ? 'right-top' : 'top-right'; - } - //placement= pageY>targetHeight+arrowSize?'top-right':'bottom-right'; - } else if (pageX < clientWidth * 2 / 3) { - if (pageY < clientHeight / 3) { - if (isH) { - placement = pageX <= clientWidth / 2 ? 'right-bottom' : 'left-bottom'; - } else { - placement = 'bottom'; - } - } else if (pageY < clientHeight * 2 / 3) { - if (isH) { - placement = pageX <= clientWidth / 2 ? 'right' : 'left'; - } else { - placement = pageY <= clientHeight / 2 ? 'bottom' : 'top'; - } - } else { - if (isH) { - placement = pageX <= clientWidth / 2 ? 'right-top' : 'left-top'; - } else { - placement = 'top'; - } - } - } else { - //placement = pageY>targetHeight+arrowSize?'top-left':'bottom-left'; - if (pageY < clientHeight / 3) { - placement = isH ? 'left-bottom' : 'bottom-left'; - } else if (pageY < clientHeight * 2 / 3) { - if (isV) { - placement = pageY <= clientHeight / 2 ? 'bottom-left' : 'top-left'; - } else { - placement = 'left'; - } - } else { - placement = isH ? 'left-top' : 'top-left'; - } - } - } else if (placement === 'auto-top') { - if (pageX < clientWidth / 3) { - placement = 'top-right'; - } else if (pageX < clientWidth * 2 / 3) { - placement = 'top'; - } else { - placement = 'top-left'; - } - } else if (placement === 'auto-bottom') { - if (pageX < clientWidth / 3) { - placement = 'bottom-right'; - } else if (pageX < clientWidth * 2 / 3) { - placement = 'bottom'; - } else { - placement = 'bottom-left'; - } - } else if (placement === 'auto-left') { - if (pageY < clientHeight / 3) { - placement = 'left-top'; - } else if (pageY < clientHeight * 2 / 3) { - placement = 'left'; - } else { - placement = 'left-bottom'; - } - } else if (placement === 'auto-right') { - if (pageY < clientHeight / 3) { - placement = 'right-bottom'; - } else if (pageY < clientHeight * 2 / 3) { - placement = 'right'; - } else { - placement = 'right-top'; - } - } - return placement; - }, - getElementPosition: function () { - // If the container is the body or normal conatiner, just use $element.offset() - var elRect = this.$element[0].getBoundingClientRect(); - var container = this.options.container; - var cssPos = container.css('position'); - - if (container.is(document.body) || cssPos === 'static') { - return $.extend({}, this.$element.offset(), { - width: this.$element[0].offsetWidth || elRect.width, - height: this.$element[0].offsetHeight || elRect.height - }); - // Else fixed container need recalculate the position - } else if (cssPos === 'fixed') { - var containerRect = container[0].getBoundingClientRect(); - return { - top: elRect.top - containerRect.top + container.scrollTop(), - left: elRect.left - containerRect.left + container.scrollLeft(), - width: elRect.width, - height: elRect.height - }; - } else if (cssPos === 'relative') { - return { - top: this.$element.offset().top - container.offset().top, - left: this.$element.offset().left - container.offset().left, - width: this.$element[0].offsetWidth || elRect.width, - height: this.$element[0].offsetHeight || elRect.height - }; - } - }, - - getTargetPositin: function (elementPos, placement, targetWidth, targetHeight) { - var pos = elementPos, - container = this.options.container, - //clientWidth = container.innerWidth(), - //clientHeight = container.innerHeight(), - elementW = this.$element.outerWidth(), - elementH = this.$element.outerHeight(), - scrollTop = document.documentElement.scrollTop + container.scrollTop(), - scrollLeft = document.documentElement.scrollLeft + container.scrollLeft(), - position = {}, - arrowOffset = null, - arrowSize = this.options.arrow ? 20 : 0, - padding = 10, - fixedW = elementW < arrowSize + padding ? arrowSize : 0, - fixedH = elementH < arrowSize + padding ? arrowSize : 0, - refix = 0, - pageH = document.documentElement.clientHeight + scrollTop, - pageW = document.documentElement.clientWidth + scrollLeft; - - var validLeft = pos.left + pos.width / 2 - fixedW > 0; - var validRight = pos.left + pos.width / 2 + fixedW < pageW; - var validTop = pos.top + pos.height / 2 - fixedH > 0; - var validBottom = pos.top + pos.height / 2 + fixedH < pageH; - - - switch (placement) { - case 'bottom': - position = { - top: pos.top + pos.height, - left: pos.left + pos.width / 2 - targetWidth / 2 - }; - break; - case 'top': - position = { - top: pos.top - targetHeight, - left: pos.left + pos.width / 2 - targetWidth / 2 - }; - break; - case 'left': - position = { - top: pos.top + pos.height / 2 - targetHeight / 2, - left: pos.left - targetWidth - }; - break; - case 'right': - position = { - top: pos.top + pos.height / 2 - targetHeight / 2, - left: pos.left + pos.width - }; - break; - case 'top-right': - position = { - top: pos.top - targetHeight, - left: validLeft ? pos.left - fixedW : padding - }; - arrowOffset = { - left: validLeft ? Math.min(elementW, targetWidth) / 2 + fixedW : _offsetOut - }; - break; - case 'top-left': - refix = validRight ? fixedW : -padding; - position = { - top: pos.top - targetHeight, - left: pos.left - targetWidth + pos.width + refix - }; - arrowOffset = { - left: validRight ? targetWidth - Math.min(elementW, targetWidth) / 2 - fixedW : _offsetOut - }; - break; - case 'bottom-right': - position = { - top: pos.top + pos.height, - left: validLeft ? pos.left - fixedW : padding - }; - arrowOffset = { - left: validLeft ? Math.min(elementW, targetWidth) / 2 + fixedW : _offsetOut - }; - break; - case 'bottom-left': - refix = validRight ? fixedW : -padding; - position = { - top: pos.top + pos.height, - left: pos.left - targetWidth + pos.width + refix - }; - arrowOffset = { - left: validRight ? targetWidth - Math.min(elementW, targetWidth) / 2 - fixedW : _offsetOut - }; - break; - case 'right-top': - refix = validBottom ? fixedH : -padding; - position = { - top: pos.top - targetHeight + pos.height + refix, - left: pos.left + pos.width - }; - arrowOffset = { - top: validBottom ? targetHeight - Math.min(elementH, targetHeight) / 2 - fixedH : _offsetOut - }; - break; - case 'right-bottom': - position = { - top: validTop ? pos.top - fixedH : padding, - left: pos.left + pos.width - }; - arrowOffset = { - top: validTop ? Math.min(elementH, targetHeight) / 2 + fixedH : _offsetOut - }; - break; - case 'left-top': - refix = validBottom ? fixedH : -padding; - position = { - top: pos.top - targetHeight + pos.height + refix, - left: pos.left - targetWidth - }; - arrowOffset = { - top: validBottom ? targetHeight - Math.min(elementH, targetHeight) / 2 - fixedH : _offsetOut - }; - break; - case 'left-bottom': - position = { - top: validTop ? pos.top - fixedH : padding, - left: pos.left - targetWidth - }; - arrowOffset = { - top: validTop ? Math.min(elementH, targetHeight) / 2 + fixedH : _offsetOut - }; - break; - - } - position.top += this.getOffsetTop(); - position.left += this.getOffsetLeft(); - - return { - position: position, - arrowOffset: arrowOffset - }; - } - }; - $.fn[pluginName] = function (options, noInit) { - var results = []; - var $result = this.each(function () { - - var webuiPopover = $.data(this, 'plugin_' + pluginName); - if (!webuiPopover) { - if (!options) { - webuiPopover = new WebuiPopover(this, null); - } else if (typeof options === 'string') { - if (options !== 'destroy') { - if (!noInit) { - webuiPopover = new WebuiPopover(this, null); - results.push(webuiPopover[options]()); - } - } - } else if (typeof options === 'object') { - webuiPopover = new WebuiPopover(this, options); - } - $.data(this, 'plugin_' + pluginName, webuiPopover); - } else { - if (options === 'destroy') { - webuiPopover.destroy(); - } else if (typeof options === 'string') { - results.push(webuiPopover[options]()); - } - } - }); - return (results.length) ? results : $result; - }; - - //Global object exposes to window. - var webuiPopovers = (function () { - var _hideAll = function () { - hideAllPop(); - }; - var _create = function (selector, options) { - options = options || {}; - $(selector).webuiPopover(options); - }; - var _isCreated = function (selector) { - var created = true; - $(selector).each(function (i, item) { - created = created && $(item).data('plugin_' + pluginName) !== undefined; - }); - return created; - }; - var _show = function (selector, options) { - if (options) { - $(selector).webuiPopover(options).webuiPopover('show'); - } else { - $(selector).webuiPopover('show'); - } - }; - var _hide = function (selector) { - $(selector).webuiPopover('hide'); - }; - - var _setDefaultOptions = function (options) { - defaults = $.extend({}, defaults, options); - }; - - var _updateContent = function (selector, content) { - var pop = $(selector).data('plugin_' + pluginName); - if (pop) { - var cache = pop.getCache(); - pop.options.cache = false; - pop.options.content = content; - if (pop._opened) { - pop._opened = false; - pop.show(); - } else { - if (pop.isAsync()) { - pop.setContentASync(content); - } else { - pop.setContent(content); - } - } - pop.options.cache = cache; - } - }; - - var _updateContentAsync = function (selector, url) { - var pop = $(selector).data('plugin_' + pluginName); - if (pop) { - var cache = pop.getCache(); - var type = pop.options.type; - pop.options.cache = false; - pop.options.url = url; - - if (pop._opened) { - pop._opened = false; - pop.show(); - } else { - pop.options.type = 'async'; - pop.setContentASync(pop.content); - } - pop.options.cache = cache; - pop.options.type = type; - } - }; - - return { - show: _show, - hide: _hide, - create: _create, - isCreated: _isCreated, - hideAll: _hideAll, - updateContent: _updateContent, - updateContentAsync: _updateContentAsync, - setDefaultOptions: _setDefaultOptions - }; - })(); - window.WebuiPopovers = webuiPopovers; - exports("popover",WebuiPopovers); -}) - - - - diff --git a/src/plugin/admin/public/component/pear/module/select.js b/src/plugin/admin/public/component/pear/module/select.js deleted file mode 100644 index 3b095f72..00000000 --- a/src/plugin/admin/public/component/pear/module/select.js +++ /dev/null @@ -1,1740 +0,0 @@ -/** - * name: formSelects - * 基于Layui Select多选 - * version: 4.0.0.0910 - * http://sun.faysunshine.com/layui/formSelects-v4/dist/formSelects-v4.js - */ -(function(layui, window, factory) { - if(typeof exports === 'object') { // 支持 CommonJS - module.exports = factory(); - } else if(typeof define === 'function' && define.amd) { // 支持 AMD - define(factory); - } else if(window.layui && layui.define) { //layui加载 - layui.define(['jquery'], function(exports) { - exports('select', factory()); - }); - } else { - window.formSelects = factory(); - } -})(typeof layui == 'undefined' ? null : layui, window, function() { - let v = '4.0.0.0910', - NAME = 'xm-select', - PNAME = 'xm-select-parent', - INPUT = 'xm-select-input', - TDIV = 'xm-select--suffix', - THIS = 'xm-select-this', - LABEL = 'xm-select-label', - SEARCH = 'xm-select-search', - SEARCH_TYPE = 'xm-select-search-type', - SHOW_COUNT = 'xm-select-show-count', - CREATE = 'xm-select-create', - CREATE_LONG = 'xm-select-create-long', - MAX = 'xm-select-max', - SKIN = 'xm-select-skin', - DIRECTION = "xm-select-direction", - HEIGHT = 'xm-select-height', - DISABLED = 'xm-dis-disabled', - DIS = 'xm-select-dis', - TEMP = 'xm-select-temp', - RADIO = 'xm-select-radio', - LINKAGE= 'xm-select-linkage', - DL = 'xm-select-dl', - DD_HIDE = 'xm-select-hide', - HIDE_INPUT = 'xm-hide-input', - SANJIAO = 'xm-select-sj', - ICON_CLOSE = 'xm-icon-close', - FORM_TITLE = 'xm-select-title', - FORM_SELECT = 'xm-form-select', - FORM_SELECTED = 'xm-form-selected', - FORM_NONE = 'xm-select-none', - FORM_EMPTY = 'xm-select-empty', - FORM_INPUT = 'xm-input', - FORM_DL_INPUT = 'xm-dl-input', - FORM_SELECT_TIPS = 'xm-select-tips', - CHECKBOX_YES = 'xm-iconfont', - FORM_TEAM_PID = 'XM_PID_VALUE', - CZ = 'xm-cz', - CZ_GROUP = 'xm-cz-group', - TIPS = '请选择', - data = {}, - events = { - on: {}, - endOn: {}, - filter: {}, - maxTips: {}, - opened: {}, - closed: {} - }, - ajax = { - type: 'get', - header: { - - }, - first: true, - data: {}, - searchUrl: '', - searchName: 'keyword', - searchVal: null, - keyName: 'name', - keyVal: 'value', - keySel: 'selected', - keyDis: 'disabled', - keyChildren: 'children', - dataType: '', - delay: 500, - beforeSuccess: null, - success: null, - error: null, - beforeSearch: null, - response: { - statusCode: 0, - statusName: 'code', - msgName: 'msg', - dataName: 'data' - }, - tree: { - nextClick: function(id, item, callback){ - callback([]); - }, - folderChoose: true, - lazy: true - } - }, - quickBtns = [ - {icon: 'xm-iconfont icon-quanxuan', name: '全选', click: function(id, cm){ - cm.selectAll(id, true, true); - }}, - {icon: 'xm-iconfont icon-qingkong', name: '清空', click: function(id, cm){ - cm.removeAll(id, true, true); - }}, - {icon: 'xm-iconfont icon-fanxuan', name: '反选', click: function(id, cm){ - cm.reverse(id, true, true); - }}, - {icon: 'xm-iconfont icon-pifu', name: '换肤', click: function(id, cm){ - cm.skin(id); - }} - ], - $ = window.$ || (window.layui && window.layui.jquery), - $win = $(window), - ajaxs = {}, - fsConfig = {}, - fsConfigs = {}, - FormSelects = function(options) { - this.config = { - name: null, //xm-select="xxx" - max: null, - maxTips: (id, vals, val, max) => { - let ipt = $(`[xid="${this.config.name}"]`).prev().find(`.${NAME}`); - if(ipt.parents('.layui-form-item[pane]').length) { - ipt = ipt.parents('.layui-form-item[pane]'); - } - ipt.attr('style', 'border-color: red !important'); - setTimeout(() => { - ipt.removeAttr('style'); - }, 300); - }, - init: null, //初始化的选择值, - on: null, //select值发生变化 - opened: null, - closed: null, - filter: (id, inputVal, val, isDisabled) => { - return val.name.indexOf(inputVal) == -1; - }, - clearid: -1, - direction: 'auto', - height: null, - isEmpty: false, - btns: [quickBtns[0], quickBtns[1], quickBtns[2]], - searchType: 0, - create: (id, name) => { - return Date.now(); - }, - template: (id, item) => { - return item.name; - }, - showCount: 0, - isCreate: false, - placeholder: TIPS, - clearInput: false, - }; - this.select = null; - this.values = []; - $.extend(this.config, options, { - searchUrl: options.isSearch ? options.searchUrl : null, - placeholder: options.optionsFirst ? ( - options.optionsFirst.value ? TIPS : (options.optionsFirst.innerHTML || TIPS) - ) : TIPS, - btns: options.radio ? [quickBtns[1]] : [quickBtns[0], quickBtns[1], quickBtns[2]], - }, fsConfigs[options.name] || fsConfig); - if(isNaN(this.config.showCount) || this.config.showCount <= 0) { - this.config.showCount = 19921012; - } - }; - - //一些简单的处理方法 - let Common = function(){ - this.appender(); - this.on(); - this.onreset(); - }; - - Common.prototype.appender = function(){//针对IE做的一些拓展 - //拓展Array map方法 - if(!Array.prototype.map){Array.prototype.map=function(i,h){var b,a,c,e=Object(this),f=e.length>>>0;if(h){b=h}a=new Array(f);c=0;while(c>>0;if(typeof g!=="function"){throw new TypeError(g+" is not a function")}if(arguments.length>1){d=b}c=0;while(c>>0;if(typeof b!=="function"){throw new TypeError()}var e=[];var d=arguments[1];for(var c=0;c { - let othis = $(select), - id = othis.attr(NAME), - hasLayuiRender = othis.next(`.layui-form-select`), - hasRender = othis.next(`.${PNAME}`), - options = { - name: id, - disabled: select.disabled, - max: othis.attr(MAX) - 0, - isSearch: othis.attr(SEARCH) != undefined, - searchUrl: othis.attr(SEARCH), - isCreate: othis.attr(CREATE) != undefined, - radio: othis.attr(RADIO) != undefined, - skin: othis.attr(SKIN), - direction: othis.attr(DIRECTION), - optionsFirst: select.options[0], - height: othis.attr(HEIGHT), - formname: othis.attr('name') || othis.attr('_name'), - layverify: othis.attr('lay-verify') || othis.attr('_lay-verify'), - layverType: othis.attr('lay-verType'), - searchType: othis.attr(SEARCH_TYPE) == 'dl' ? 1 : 0, - showCount: othis.attr(SHOW_COUNT) - 0, - }, - value = othis.find('option[selected]').toArray().map((option) => {//获取已选中的数据 - return { - name: option.innerHTML, - value: option.value, - } - }), - fs = new FormSelects(options); - - fs.values = value; - - if(fs.config.init) { - fs.values = fs.config.init.map(item => { - if(typeof item == 'object') { - return item; - } - return { - name: othis.find(`option[value="${item}"]`).text(), - value: item - } - }).filter(item => { - return item.name; - }); - fs.config.init = fs.values.concat([]); - }else{ - fs.config.init = value.concat([]); - } - - !fs.values && (fs.values = []); - - data[id] = fs; - - //先取消layui对select的渲染 - hasLayuiRender[0] && hasLayuiRender.remove(); - hasRender[0] && hasRender.remove(); - - //构造渲染div - let dinfo = this.renderSelect(id, fs.config.placeholder, select); - let heightStyle = !fs.config.height || fs.config.height == 'auto' ? '' : `xm-hg style="height: 34px;"`; - let inputHtml = [ - `
                                        `, - ``, - `
                                        ` - ]; - let reElem = - $(`
                                        - -
                                        -
                                        - ${inputHtml.join('')} - -
                                        -
                                        - -
                                        -
                                        -
                                        -
                                        ${dinfo}
                                        -
                                        `); - - var $parent = $(`
                                        `); - $parent.append(reElem) - othis.after($parent); - othis.attr('lay-ignore', ''); - othis.removeAttr('name') && othis.attr('_name', fs.config.formname); - othis.removeAttr('lay-verify') && othis.attr('_lay-verify', fs.config.layverify); - - //如果可搜索, 加上事件 - if(fs.config.isSearch){ - ajaxs[id] = $.extend({}, ajax, {searchUrl: fs.config.searchUrl}, ajaxs[id]); - $(document).on('input', `div.${PNAME}[FS_ID="${id}"] .${INPUT}`, (e) => { - this.search(id, e, fs.config.searchUrl); - }); - if(fs.config.searchUrl){//触发第一次请求事件 - this.triggerSearch(reElem, true); - } - }else{//隐藏第二个dl - reElem.find(`dl dd.${FORM_DL_INPUT}`).css('display', 'none'); - } - }); - } - - Common.prototype.search = function(id, e, searchUrl, call){ - let input; - if(call){ - input = call; - }else{ - input = e.target; - let keyCode = e.keyCode; - if(keyCode === 9 || keyCode === 13 || keyCode === 37 || keyCode === 38 || keyCode === 39 || keyCode === 40) { - return false; - } - } - let inputValue = $.trim(input.value); - //过滤一下tips - this.changePlaceHolder($(input)); - - let ajaxConfig = ajaxs[id] ? ajaxs[id] : ajax; - searchUrl = ajaxConfig.searchUrl || searchUrl; - let fs = data[id], - isCreate = fs.config.isCreate, - reElem = $(`dl[xid="${id}"]`).parents(`.${FORM_SELECT}`); - //如果开启了远程搜索 - if(searchUrl){ - if(ajaxConfig.searchVal){ - inputValue = ajaxConfig.searchVal; - ajaxConfig.searchVal = ''; - } - if(!ajaxConfig.beforeSearch || (ajaxConfig.beforeSearch && ajaxConfig.beforeSearch instanceof Function && ajaxConfig.beforeSearch(id, searchUrl, inputValue))){ - let delay = ajaxConfig.delay; - if(ajaxConfig.first){ - ajaxConfig.first = false; - delay = 10; - } - clearTimeout(fs.clearid); - fs.clearid = setTimeout(() => { - reElem.find(`dl > *:not(.${FORM_SELECT_TIPS})`).remove(); - reElem.find(`dd.${FORM_NONE}`).addClass(FORM_EMPTY).text('请求中'); - this.ajax(id, searchUrl, inputValue, false, null, true); - }, delay); - } - }else{ - reElem.find(`dl .${DD_HIDE}`).removeClass(DD_HIDE); - //遍历选项, 选择可以显示的值 - reElem.find(`dl dd:not(.${FORM_SELECT_TIPS})`).each((idx, item) => { - let _item = $(item); - let searchFun = events.filter[id] || data[id].config.filter; - if(searchFun && searchFun(id, inputValue, this.getItem(id, _item), _item.hasClass(DISABLED)) == true){ - _item.addClass(DD_HIDE); - } - }); - //控制分组名称 - reElem.find('dl dt').each((index, item) => { - if(!$(item).nextUntil('dt', `:not(.${DD_HIDE})`).length) { - $(item).addClass(DD_HIDE); - } - }); - //动态创建 - this.create(id, isCreate, inputValue); - let shows = reElem.find(`dl dd:not(.${FORM_SELECT_TIPS}):not(.${DD_HIDE})`); - if(!shows.length){ - reElem.find(`dd.${FORM_NONE}`).addClass(FORM_EMPTY).text('无匹配项'); - }else{ - reElem.find(`dd.${FORM_NONE}`).removeClass(FORM_EMPTY); - } - } - } - - Common.prototype.isArray = function(obj){ - return Object.prototype.toString.call(obj) == "[object Array]"; - } - - Common.prototype.triggerSearch = function(div, isCall){ - (div ? [div] : $(`.${FORM_SELECT}`).toArray()).forEach((reElem, index) => { - reElem = $(reElem); - let id = reElem.find('dl').attr('xid') - if((id && data[id] && data[id].config.isEmpty) || isCall){ - this.search(id, null, null, data[id].config.searchType == 0 ? reElem.find(`.${LABEL} .${INPUT}`) : reElem.find(`dl .${FORM_DL_INPUT} .${INPUT}`)); - } - }); - } - - Common.prototype.clearInput = function(id){ - let div = $(`.${PNAME}[fs_id="${id}"]`); - let input = data[id].config.searchType == 0 ? div.find(`.${LABEL} .${INPUT}`) : div.find(`dl .${FORM_DL_INPUT} .${INPUT}`); - input.val(''); - } - - Common.prototype.ajax = function(id, searchUrl, inputValue, isLinkage, linkageWidth, isSearch, successCallback, isReplace){ - let reElem = $(`.${PNAME} dl[xid="${id}"]`).parents(`.${FORM_SELECT}`); - if(!reElem[0] || !searchUrl){ - return ; - } - let ajaxConfig = ajaxs[id] ? ajaxs[id] : ajax; - let ajaxData = $.extend(true, {}, ajaxConfig.data); - ajaxData[ajaxConfig.searchName] = inputValue; - //是否需要对ajax添加随机时间 - //ajaxData['_'] = Date.now(); - $.ajax({ - type: ajaxConfig.type, - headers: ajaxConfig.header, - url: searchUrl, - data: ajaxConfig.dataType == 'json' ? JSON.stringify(ajaxData) : ajaxData, - success: (res) => { - if(typeof res == 'string'){ - res = JSON.parse(res); - } - ajaxConfig.beforeSuccess && ajaxConfig.beforeSuccess instanceof Function && (res = ajaxConfig.beforeSuccess(id, searchUrl, inputValue, res)); - if(this.isArray(res)){ - let newRes = {}; - newRes[ajaxConfig.response.statusName] = ajaxConfig.response.statusCode; - newRes[ajaxConfig.response.msgName] = ""; - newRes[ajaxConfig.response.dataName] = res; - res = newRes; - } - if(res[ajaxConfig.response.statusName] != ajaxConfig.response.statusCode) { - reElem.find(`dd.${FORM_NONE}`).addClass(FORM_EMPTY).text(res[ajaxConfig.response.msgName]); - }else{ - reElem.find(`dd.${FORM_NONE}`).removeClass(FORM_EMPTY); - this.renderData(id, res[ajaxConfig.response.dataName], isLinkage, linkageWidth, isSearch, isReplace); - data[id].config.isEmpty = res[ajaxConfig.response.dataName].length == 0; - } - successCallback && successCallback(id); - ajaxConfig.success && ajaxConfig.success instanceof Function && ajaxConfig.success(id, searchUrl, inputValue, res); - }, - error: (err) => { - reElem.find(`dd[lay-value]:not(.${FORM_SELECT_TIPS})`).remove(); - reElem.find(`dd.${FORM_NONE}`).addClass(FORM_EMPTY).text('服务异常'); - ajaxConfig.error && ajaxConfig.error instanceof Function && ajaxConfig.error(id, searchUrl, inputValue, err); - } - }); - } - - Common.prototype.renderData = function(id, dataArr, linkage, linkageWidth, isSearch, isReplace){ - if(linkage){//渲染多级联动 - this.renderLinkage(id, dataArr, linkageWidth); - return; - } - if(isReplace){ - this.renderReplace(id, dataArr); - return; - } - - let reElem = $(`.${PNAME} dl[xid="${id}"]`).parents(`.${FORM_SELECT}`); - let ajaxConfig = ajaxs[id] ? ajaxs[id] : ajax; - let pcInput = reElem.find(`.${TDIV} input`); - - dataArr = this.exchangeData(id, dataArr); - let values = []; - reElem.find('dl').html(this.renderSelect(id, pcInput.attr('placeholder') || pcInput.attr('back'), dataArr.map((item) => { - let itemVal = $.extend({}, item, { - innerHTML: item[ajaxConfig.keyName], - value: item[ajaxConfig.keyVal], - sel: item[ajaxConfig.keySel], - disabled: item[ajaxConfig.keyDis], - type: item.type, - name: item[ajaxConfig.keyName] - }); - if(itemVal.sel){ - values.push(itemVal); - } - return itemVal; - }))); - - let label = reElem.find(`.${LABEL}`); - let dl = reElem.find('dl[xid]'); - if(isSearch){//如果是远程搜索, 这里需要判重 - let oldVal = data[id].values; - oldVal.forEach((item, index) => { - dl.find(`dd[lay-value="${item.value}"]`).addClass(THIS); - }); - values.forEach((item, index) => { - if(this.indexOf(oldVal, item) == -1){ - this.addLabel(id, label, item); - dl.find(`dd[lay-value="${item.value}"]`).addClass(THIS); - oldVal.push(item); - } - }); - }else{ - values.forEach((item, index) => { - this.addLabel(id, label, item); - dl.find(`dd[lay-value="${item.value}"]`).addClass(THIS); - }); - data[id].values = values; - } - this.commonHandler(id, label); - } - - Common.prototype.renderLinkage = function(id, dataArr, linkageWidth){ - let result = [], - index = 0, - temp = {"0": dataArr}, - ajaxConfig = ajaxs[id] ? ajaxs[id] : ajax; - db[id] = {}; - do{ - let group = result[index ++] = [], - _temp = temp; - temp = {}; - $.each(_temp, (pid, arr) => { - $.each(arr, (idx, item) => { - let val = { - pid: pid, - name: item[ajaxConfig.keyName], - value: item[ajaxConfig.keyVal], - }; - db[id][val.value] = $.extend(item, val); - group.push(val); - let children = item[ajaxConfig.keyChildren]; - if(children && children.length){ - temp[val.value] = children; - } - }); - }); - }while(Object.getOwnPropertyNames(temp).length); - - let reElem = $(`.${PNAME} dl[xid="${id}"]`).parents(`.${FORM_SELECT}`); - let html = ['
                                        ']; - - $.each(result, (idx, arr) => { - let groupDiv = [`
                                        `]; - $.each(arr, (idx2, item) => { - let span = `
                                      • ${item.name}
                                      • `; - groupDiv.push(span); - }); - groupDiv.push(`
                                      `); - html = html.concat(groupDiv); - }); - html.push('
                                      '); - html.push('
                                      '); - reElem.find('dl').html(html.join('')); - reElem.find(`.${INPUT}`).css('display', 'none');//联动暂时不支持搜索 - } - - Common.prototype.renderReplace = function(id, dataArr){ - let dl = $(`.${PNAME} dl[xid="${id}"]`); - let ajaxConfig = ajaxs[id] ? ajaxs[id] : ajax; - - dataArr = this.exchangeData(id, dataArr); - db[id] = dataArr; - - let html = dataArr.map((item) => { - let itemVal = $.extend({}, item, { - innerHTML: item[ajaxConfig.keyName], - value: item[ajaxConfig.keyVal], - sel: item[ajaxConfig.keySel], - disabled: item[ajaxConfig.keyDis], - type: item.type, - name: item[ajaxConfig.keyName] - }); - return this.createDD(id, itemVal); - }).join(''); - - dl.find(`dd:not(.${FORM_SELECT_TIPS}),dt:not([style])`).remove(); - dl.find(`dt[style]`).after($(html)); - } - - Common.prototype.exchangeData = function(id, arr){//这里处理树形结构 - let ajaxConfig = ajaxs[id] ? ajaxs[id] : ajax; - let childrenName = ajaxConfig['keyChildren']; - let disabledName = ajaxConfig['keyDis']; - db[id] = {}; - let result = this.getChildrenList(arr, childrenName, disabledName, [], false); - return result; - } - - Common.prototype.getChildrenList = function(arr, childrenName, disabledName, pid, disabled){ - let result = [], offset = 0; - for(let a = 0; a < arr.length; a ++){ - let item = arr[a]; - if(item.type && item.type == 'optgroup'){ - result.push(item); - continue; - }else{ - offset ++; - } - let parentIds = pid.concat([]); - parentIds.push(`${offset - 1}_E`); - item[FORM_TEAM_PID] = JSON.stringify(parentIds); - item[disabledName] = item[disabledName] || disabled; - result.push(item); - let child = item[childrenName]; - if(child && common.isArray(child) && child.length){ - item['XM_TREE_FOLDER'] = true; - let pidArr = parentIds.concat([]); - let childResult = this.getChildrenList(child, childrenName, disabledName, pidArr, item[disabledName]); - result = result.concat(childResult); - } - } - return result; - } - - Common.prototype.create = function(id, isCreate, inputValue){ - if(isCreate && inputValue){ - let fs = data[id], - dl = $(`[xid="${id}"]`), - tips= dl.find(`dd.${FORM_SELECT_TIPS}.${FORM_DL_INPUT}`), - tdd = null, - temp = dl.find(`dd.${TEMP}`); - dl.find(`dd:not(.${FORM_SELECT_TIPS}):not(.${TEMP})`).each((index, item) => { - if(inputValue == $(item).find('span').attr('name')){ - tdd = item; - } - }); - if(!tdd){//如果不存在, 则创建 - let val = fs.config.create(id, inputValue); - if(temp[0]){ - temp.attr('lay-value', val); - temp.find('span').text(inputValue); - temp.find('span').attr("name", inputValue); - temp.removeClass(DD_HIDE); - }else{ - tips.after($(this.createDD(id, { - name: inputValue, - innerHTML: inputValue, - value: val - }, `${TEMP} ${CREATE_LONG}`))); - } - } - }else{ - $(`[xid=${id}] dd.${TEMP}`).remove(); - } - } - - Common.prototype.createDD = function(id, item, clz){ - let ajaxConfig = ajaxs[id] ? ajaxs[id] : ajax; - let name = $.trim(item.innerHTML); - db[id][item.value] = $(item).is('option') ? (item = function(){ - let resultItem = {}; - resultItem[ajaxConfig.keyName] = name; - resultItem[ajaxConfig.keyVal] = item.value; - resultItem[ajaxConfig.keyDis] = item.disabled; - return resultItem; - }()) : item; - let template = data[id].config.template(id, item); - let pid = item[FORM_TEAM_PID]; - pid ? (pid = JSON.parse(pid)) : (pid = [-1]); - let attr = pid[0] == -1 ? '' : `tree-id="${pid.join('-')}" tree-folder="${!!item['XM_TREE_FOLDER']}"`; - return `
                                      -
                                      - - ${template} -
                                      -
                                      `; - } - - Common.prototype.createQuickBtn = function(obj, right){ - return `
                                      ${obj.name}
                                      ` - } - - Common.prototype.renderBtns = function(id, show, right){ - let quickBtn = []; - let dl = $(`dl[xid="${id}"]`); - quickBtn.push(`
                                      `); - $.each(data[id].config.btns, (index, item) => { - quickBtn.push(this.createQuickBtn(item, right)); - }); - quickBtn.push(`
                                      `); - quickBtn.push(this.createQuickBtn({icon: 'xm-iconfont icon-caidan', name: ''})); - return quickBtn.join(''); - } - - Common.prototype.renderSelect = function(id, tips, select){ - db[id] = {}; - let arr = []; - if(data[id].config.btns.length){ - setTimeout(() => { - let dl = $(`dl[xid="${id}"]`); - dl.parents(`.${FORM_SELECT}`).attr(SEARCH_TYPE, data[id].config.searchType); - dl.find(`.${CZ_GROUP}`).css('max-width', `${dl.prev().width() - 54}px`); - }, 10) - arr.push([ - `
                                      `, - this.renderBtns(id, null, '30px'), - `
                                      `, - `
                                      `, - ``, - ``, - `
                                      ` - ].join('')); - }else{ - arr.push(`
                                      ${tips}
                                      `); - } - if(this.isArray(select)){ - $(select).each((index, item) => { - if(item){ - if(item.type && item.type === 'optgroup') { - arr.push(`
                                      ${item.name}
                                      `); - } else { - arr.push(this.createDD(id, item)); - } - } - }); - }else{ - $(select).find('*').each((index, item) => { - if(item.tagName.toLowerCase() == 'option' && index == 0 && !item.value){ - return ; - } - if(item.tagName.toLowerCase() === 'optgroup') { - arr.push(`
                                      ${item.label}
                                      `); - } else { - arr.push(this.createDD(id, item)); - } - }); - } - arr.push('
                                      '); - arr.push(`
                                      没有选项
                                      `); - return arr.join(''); - } - - Common.prototype.on = function(){//事件绑定 - this.one(); - - $(document).on('click', (e) => { - if(!$(e.target).parents(`.${FORM_TITLE}`)[0]){//清空input中的值 - $(`.${PNAME} dl .${DD_HIDE}`).removeClass(DD_HIDE); - $(`.${PNAME} dl dd.${FORM_EMPTY}`).removeClass(FORM_EMPTY); - $(`.${PNAME} dl dd.${TEMP}`).remove(); - $.each(data, (key, fs) => { - this.clearInput(key); - if(!fs.values.length){ - this.changePlaceHolder($(`div[FS_ID="${key}"] .${LABEL}`)); - } - }); - } - $(`.${PNAME} .${FORM_SELECTED}`).each((index, item) => { - this.changeShow($(item).find(`.${FORM_TITLE}`), false); - }) ; - }); - } - - Common.prototype.calcLabelLeft = function(label, w, call){ - let pos = this.getPosition(label[0]); - pos.y = pos.x + label[0].clientWidth; - let left = label[0].offsetLeft; - if(!label.find('span').length){ - left = 0; - }else if(call){//校正归位 - let span = label.find('span:last'); - span.css('display') == 'none' ? (span = span.prev()[0]) : (span = span[0]); - let spos = this.getPosition(span); - spos.y = spos.x + span.clientWidth; - - if(spos.y > pos.y){ - left = left - (spos.y - pos.y) - 5; - }else{ - left = 0; - } - }else{ - if(w < 0){ - let span = label.find(':last'); - span.css('display') == 'none' ? (span = span.prev()[0]) : (span = span[0]); - let spos = this.getPosition(span); - spos.y = spos.x + span.clientWidth; - if(spos.y > pos.y){ - left -= 10; - } - }else{ - if(left < 0){ - left += 10; - } - if(left > 0){ - left = 0; - } - } - } - label.css('left', left + 'px'); - } - - Common.prototype.one = function(target){//一次性事件绑定 - $(target ? target : document).off('click', `.${FORM_TITLE}`).on('click', `.${FORM_TITLE}`, (e) => { - let othis = $(e.target), - title = othis.is(FORM_TITLE) ? othis : othis.parents(`.${FORM_TITLE}`), - dl = title.next(), - id = dl.attr('xid'); - - //清空非本select的input val - $(`dl[xid]`).not(dl).each((index, item) => { - this.clearInput($(item).attr('xid')); - }); - $(`dl[xid]`).not(dl).find(`dd.${DD_HIDE}`).removeClass(DD_HIDE); - - //如果是disabled select - if(title.hasClass(DIS)){ - return false; - } - //如果点击的是右边的三角或者只读的input - if(othis.is(`.${SANJIAO}`) || othis.is(`.${INPUT}[readonly]`)){ - this.changeShow(title, !title.parents(`.${FORM_SELECT}`).hasClass(FORM_SELECTED)); - return false; - } - //如果点击的是input的右边, focus一下 - if(title.find(`.${INPUT}:not(readonly)`)[0]){ - let input = title.find(`.${INPUT}`), - epos = {x: e.pageX, y: e.pageY}, - pos = this.getPosition(title[0]), - width = title.width(); - while(epos.x > pos.x){ - if($(document.elementFromPoint(epos.x, epos.y)).is(input)){ - input.focus(); - this.changeShow(title, true); - return false; - } - epos.x -= 50; - } - } - - //如果点击的是可搜索的input - if(othis.is(`.${INPUT}`)){ - this.changeShow(title, true); - return false; - } - //如果点击的是x按钮 - if(othis.is(`i[fsw="${NAME}"]`)){ - let val = this.getItem(id, othis), - dd = dl.find(`dd[lay-value='${val.value}']`); - if(dd.hasClass(DISABLED)){//如果是disabled状态, 不可选, 不可删 - return false; - } - this.handlerLabel(id, dd, false, val); - return false; - } - - this.changeShow(title, !title.parents(`.${FORM_SELECT}`).hasClass(FORM_SELECTED)); - return false; - }); - $(target ? target : document).off('click', `dl.${DL}`).on('click', `dl.${DL}`, (e) => { - let othis = $(e.target); - if(othis.is(`.${LINKAGE}`) || othis.parents(`.${LINKAGE}`)[0]){//linkage的处理 - othis = othis.is('li') ? othis : othis.parents('li[xm-value]'); - let group = othis.parents('.xm-select-linkage-group'), - id = othis.parents('dl').attr('xid'); - if(!id){ - return false; - } - //激活li - group.find('.xm-select-active').removeClass('xm-select-active'); - othis.addClass('xm-select-active'); - //激活下一个group, 激活前显示对应数据 - group.nextAll('.xm-select-linkage-group').addClass('xm-select-linkage-hide'); - let nextGroup = group.next('.xm-select-linkage-group'); - nextGroup.find('li').addClass('xm-select-linkage-hide'); - nextGroup.find(`li[pid="${othis.attr('xm-value')}"]`).removeClass('xm-select-linkage-hide'); - //如果没有下一个group, 或没有对应的值 - if(!nextGroup[0] || nextGroup.find(`li:not(.xm-select-linkage-hide)`).length == 0){ - let vals = [], - index = 0, - isAdd = !othis.hasClass('xm-select-this'); - if(data[id].config.radio){ - othis.parents('.xm-select-linkage').find('.xm-select-this').removeClass('xm-select-this'); - } - do{ - vals[index ++] = { - name: othis.find('span').text(), - value: othis.attr('xm-value') - } - othis = othis.parents('.xm-select-linkage-group').prev().find(`li[xm-value="${othis.attr('pid')}"]`); - }while(othis.length); - vals.reverse(); - let val = { - name: vals.map((item) => { - return item.name; - }).join('/'), - value: vals.map((item) => { - return item.value; - }).join('/'), - } - this.handlerLabel(id, null, isAdd, val); - }else{ - nextGroup.removeClass('xm-select-linkage-hide'); - } - return false; - } - - if(othis.is('dl')){ - return false; - } - - if(othis.is('dt')){ - othis.nextUntil(`dt`).each((index, item) => { - item = $(item); - if(item.hasClass(DISABLED) || item.hasClass(THIS)){ - - }else{ - item.find('i:not(.icon-expand)').click(); - } - }); - return false; - } - let dd = othis.is('dd') ? othis : othis.parents('dd'); - let id = dd.parent('dl').attr('xid'); - - if(dd.hasClass(DISABLED)){//被禁用选项的处理 - return false; - } - - //菜单功效 - if(othis.is('i.icon-caidan')){ - let opens = [], closes = []; - othis.parents('dl').find('dd[tree-folder="true"]').each((index, item) => { - $(item).attr('xm-tree-hidn') == undefined ? opens.push(item) : closes.push(item); - }); - let arr = closes.length ? closes : opens; - arr.forEach(item => item.click()); - return false; - } - //树状结构的选择 - let treeId = dd.attr('tree-id'); - if(treeId){ - //忽略右边的图标 - if(othis.is('i:not(.icon-expand)')){ - this.handlerLabel(id, dd, !dd.hasClass(THIS)); - return false; - } - let ajaxConfig = ajaxs[id] || ajax; - let treeConfig = ajaxConfig.tree; - let childrens = dd.nextAll(`dd[tree-id^="${treeId}"]`); - if(childrens && childrens.length){ - let len = childrens[0].clientHeight; - len ? ( - this.addTreeHeight(dd, len), - len = 0 - ) : ( - len = dd.attr('xm-tree-hidn') || 36, - dd.removeAttr('xm-tree-hidn'), - dd.find('>i').remove(), - (childrens = childrens.filter((index, item) => $(item).attr('tree-id').split('-').length - 1 == treeId.split('-').length)) - ); - childrens.animate({ - height: len - }, 150) - return false; - }else{ - if(treeConfig.nextClick && treeConfig.nextClick instanceof Function){ - treeConfig.nextClick(id, this.getItem(id, dd), (res) => { - if(!res || !res.length){ - this.handlerLabel(id, dd, !dd.hasClass(THIS)); - }else{ - dd.attr('tree-folder', 'true'); - let ddChilds = []; - res.forEach((item, idx) => { - item.innerHTML = item[ajaxConfig.keyName]; - item[FORM_TEAM_PID] = JSON.stringify(treeId.split('-').concat([idx])); - ddChilds.push(this.createDD(id, item)); - db[id][item[ajaxConfig.keyVal]] = item; - }); - dd.after(ddChilds.join('')); - } - }); - return false; - } - } - } - - if(dd.hasClass(FORM_SELECT_TIPS)){//tips的处理 - let btn = othis.is(`.${CZ}`) ? othis : othis.parents(`.${CZ}`); - if(!btn[0]){ - return false; - } - let method = btn.attr('method'); - let obj = data[id].config.btns.filter(bean => bean.name == method)[0]; - obj && obj.click && obj.click instanceof Function && obj.click(id, this); - return false; - } - this.handlerLabel(id, dd, !dd.hasClass(THIS)); - return false; - }); - } - - Common.prototype.addTreeHeight = function(dd, len){ - let treeId = dd.attr('tree-id'); - let childrens = dd.nextAll(`dd[tree-id^="${treeId}"]`); - if(childrens.length){ - dd.append(''); - dd.attr('xm-tree-hidn', len); - childrens.each((index, item) => { - let that = $(item); - this.addTreeHeight(that, len); - }) - } - } - - let db = {}; - Common.prototype.getItem = function(id, value){ - if(value instanceof $){ - if(value.is(`i[fsw="${NAME}"]`)){ - let span = value.parent(); - return db[id][value] || { - name: span.find('font').text(), - value: span.attr('value') - } - } - let val = value.attr('lay-value'); - return !db[id][val] ? (db[id][val] = { - name: value.find('span[name]').attr('name'), - value: val - }) : db[id][val]; - }else if(typeof(value) == 'string' && value.indexOf('/') != -1){ - return db[id][value] || { - name: this.valToName(id, value), - value: value - } - } - return db[id][value]; - } - - Common.prototype.linkageAdd = function(id, val){ - let dl = $(`dl[xid="${id}"]`); - dl.find('.xm-select-active').removeClass('xm-select-active'); - let vs = val.value.split('/'); - let pid, li, index = 0; - let lis = []; - do{ - pid = vs[index]; - li = dl.find(`.xm-select-linkage-group${index + 1} li[xm-value="${pid}"]`); - li[0] && lis.push(li); - index ++; - }while(li.length && pid != undefined); - if(lis.length == vs.length){ - $.each(lis, (idx, item) => { - item.addClass('xm-select-this'); - }); - } - } - - Common.prototype.linkageDel = function(id, val){ - let dl = $(`dl[xid="${id}"]`); - let vs = val.value.split('/'); - let pid, li, index = vs.length - 1; - do{ - pid = vs[index]; - li = dl.find(`.xm-select-linkage-group${index + 1} li[xm-value="${pid}"]`); - if(!li.parent().next().find(`li[pid=${pid}].xm-select-this`).length){ - li.removeClass('xm-select-this'); - } - index --; - }while(li.length && pid != undefined); - } - - Common.prototype.valToName = function(id, val){ - let dl = $(`dl[xid="${id}"]`); - let vs = (val + "").split('/'); - if(!vs.length){ - return null; - } - let names = []; - $.each(vs, (idx, item) => { - let name = dl.find(`.xm-select-linkage-group${idx + 1} li[xm-value="${item}"] span`).text(); - names.push(name); - }); - return names.length == vs.length ? names.join('/') : null; - } - - Common.prototype.commonHandler = function(key, label){ - if(!label || !label[0]){ - return ; - } - this.checkHideSpan(key, label); - //计算input的提示语 - this.changePlaceHolder(label); - //计算高度 - this.retop(label.parents(`.${FORM_SELECT}`)); - this.calcLabelLeft(label, 0, true); - //表单默认值 - this.setHidnVal(key, label); - //title值 - label.parents(`.${FORM_TITLE} .${NAME}`).attr('title', data[key].values.map((val) => { - return val.name; - }).join(',')); - } - - Common.prototype.initVal = function(id){ - let target = {}; - if(id){ - target[id] = data[id]; - }else{ - target = data; - } - $.each(target, (key, val) => { - let values = val.values, - div = $(`dl[xid="${key}"]`).parent(), - label = div.find(`.${LABEL}`), - dl = div.find('dl'); - dl.find(`dd.${THIS}`).removeClass(THIS); - - let _vals = values.concat([]); - _vals.concat([]).forEach((item, index) => { - this.addLabel(key, label, item); - dl.find(`dd[lay-value="${item.value}"]`).addClass(THIS); - }); - if(val.config.radio){ - _vals.length && values.push(_vals[_vals.length - 1]); - } - this.commonHandler(key, label); - }); - } - - Common.prototype.setHidnVal = function(key, label) { - if(!label || !label[0]) { - return; - } - label.parents(`.${PNAME}`).find(`.${HIDE_INPUT}`).val(data[key].values.map((val) => { - return val.value; - }).join(',')); - } - - Common.prototype.handlerLabel = function(id, dd, isAdd, oval, notOn){ - let div = $(`[xid="${id}"]`).prev().find(`.${LABEL}`), - val = dd && this.getItem(id, dd), - vals = data[id].values, - on = data[id].config.on || events.on[id], - endOn = data[id].config.endOn || events.endOn[id]; - if(oval){ - val = oval; - } - let fs = data[id]; - if(isAdd && fs.config.max && fs.values.length >= fs.config.max){ - let maxTipsFun = events.maxTips[id] || data[id].config.maxTips; - maxTipsFun && maxTipsFun(id, vals.concat([]), val, fs.config.max); - return ; - } - if(!notOn){ - if(on && on instanceof Function && on(id, vals.concat([]), val, isAdd, dd && dd.hasClass(DISABLED)) == false) { - return ; - } - } - let dl = $(`dl[xid="${id}"]`); - isAdd ? ( - (dd && dd[0] ? ( - dd.addClass(THIS), - dd.removeClass(TEMP) - ) : ( - dl.find('.xm-select-linkage')[0] && this.linkageAdd(id, val) - )), - this.addLabel(id, div, val), - vals.push(val) - ) : ( - (dd && dd[0] ? ( - dd.removeClass(THIS) - ) : ( - dl.find('.xm-select-linkage')[0] && this.linkageDel(id, val) - )), - this.delLabel(id, div, val), - this.remove(vals, val) - ); - if(!div[0]) return ; - //单选选完后直接关闭选择域 - if(fs.config.radio){ - this.changeShow(div, false); - } - //移除表单验证的红色边框 - div.parents(`.${FORM_TITLE}`).prev().removeClass('layui-form-danger'); - - //清空搜索值 - fs.config.clearInput && this.clearInput(id); - - this.commonHandler(id, div); - - !notOn && endOn && endOn instanceof Function && endOn(id, vals.concat([]), val, isAdd, dd && dd.hasClass(DISABLED)); - } - - Common.prototype.addLabel = function(id, div, val){ - if(!val) return ; - let tips = `fsw="${NAME}"`; - let [$label, $close] = [ - $(`${val.name}`), - $(``) - ]; - $label.append($close); - //如果是radio模式 - let fs = data[id]; - if(fs.config.radio){ - fs.values.length = 0; - $(`dl[xid="${id}"]`).find(`dd.${THIS}:not([lay-value="${val.value}"])`).removeClass(THIS); - div.find('span').remove(); - } - //如果是固定高度 - div.find('input').css('width', '50px'); - div.find('input').before($label); - } - - Common.prototype.delLabel = function(id, div, val){ - if(!val) return ; - div.find(`span[value="${val.value}"]:first`).remove(); - } - - Common.prototype.checkHideSpan = function(id, div){ - let parentHeight = div.parents(`.${NAME}`)[0].offsetHeight + 5; - div.find('span.xm-span-hide').removeClass('xm-span-hide'); - div.find('span[style]').remove(); - - let count = data[id].config.showCount; - div.find('span').each((index, item) => { - if(index >= count){ - $(item).addClass('xm-span-hide'); - } - }); - - let prefix = div.find(`span:eq(${count})`); - prefix[0] && prefix.before($(` + ${div.find('span').length - count}`)) - } - - Common.prototype.retop = function(div){//计算dl显示的位置 - let dl = div.find('dl'), - top = div.offset().top + div.outerHeight() + 5 - $win.scrollTop(), - dlHeight = dl.outerHeight(); - let up = div.hasClass('layui-form-selectup') || dl.css('top').indexOf('-') != -1 || (top + dlHeight > $win.height() && top >= dlHeight); - div = div.find(`.${NAME}`); - - let fs = data[dl.attr('xid')]; - let base = dl.parents('.layui-form-pane')[0] && dl.prev()[0].clientHeight > 38 ? 14 : 10; - if((fs && fs.config.direction == 'up') || up){ - up = true; - if((fs && fs.config.direction == 'down')){ - up = false; - } - } - let reHeight = div[0].offsetTop + div.height() + base; - if(up) { - dl.css({ - top: 'auto', - bottom: reHeight + 3 + 'px', - }); - } else { - dl.css({ - top: reHeight + 'px', - bottom: 'auto' - }); - } - } - - Common.prototype.changeShow = function(children, isShow){//显示于隐藏 - $('.layui-form-selected').removeClass('layui-form-selected'); - let top = children.parents(`.${FORM_SELECT}`), - realShow = top.hasClass(FORM_SELECTED), - id = top.find('dl').attr('xid'); - $(`.${PNAME} .${FORM_SELECT}`).not(top).removeClass(FORM_SELECTED); - if(isShow){ - this.retop(top); - top.addClass(FORM_SELECTED); - top.find(`.${INPUT}`).focus(); - if(!top.find(`dl dd[lay-value]:not(.${FORM_SELECT_TIPS})`).length){ - top.find(`dl .${FORM_NONE}`).addClass(FORM_EMPTY); - } - }else{ - top.removeClass(FORM_SELECTED); - this.clearInput(id); - top.find(`dl .${FORM_EMPTY}`).removeClass(FORM_EMPTY); - top.find(`dl dd.${DD_HIDE}`).removeClass(DD_HIDE); - top.find(`dl dd.${TEMP}`).remove(); - //计算ajax数据是否为空, 然后重新请求数据 - if(id && data[id] && data[id].config.isEmpty){ - this.triggerSearch(top); - } - this.changePlaceHolder(top.find(`.${LABEL}`)); - } - if(isShow != realShow){ - let openFun = data[id].config.opened || events.opened[id]; - isShow && openFun && openFun instanceof Function && openFun(id); - let closeFun = data[id].config.closed || events.closed[id]; - !isShow && closeFun && closeFun instanceof Function && closeFun(id); - } - } - - Common.prototype.changePlaceHolder = function(div){//显示于隐藏提示语 - //调整pane模式下的高度 - let title = div.parents(`.${FORM_TITLE}`); - title[0] || (title = div.parents(`dl`).prev()); - if(!title[0]){ - return ; - } - - let id = div.parents(`.${PNAME}`).find(`dl[xid]`).attr('xid'); - if(data[id] && data[id].config.height){//既然固定高度了, 那就看着办吧 - - }else{ - let height = title.find(`.${NAME}`)[0].clientHeight; - title.css('height' , (height > 36 ? height + 4 : height) + 'px'); - //如果是layui pane模式, 处理label的高度 - let label = title.parents(`.${PNAME}`).parent().prev(); - if(label.is('.layui-form-label') && title.parents('.layui-form-pane')[0]){ - height = height > 36 ? height + 4 : height; - title.css('height' , height + 'px'); - label.css({ - height: height + 2 + 'px', - lineHeight: (height - 18) + 'px' - }) - } - } - - let input = title.find(`.${TDIV} input`), - isShow = !div.find('span:last')[0] && !title.find(`.${INPUT}`).val(); - if(isShow){ - let ph = input.attr('back'); - input.removeAttr('back'); - input.attr('placeholder', ph); - }else{ - let ph = input.attr('placeholder'); - input.removeAttr('placeholder'); - input.attr('back', ph) - } - } - - Common.prototype.indexOf = function(arr, val){ - for(let i = 0; i < arr.length; i++) { - if(arr[i].value == val || arr[i].value == (val ? val.value : val) || arr[i] == val || JSON.stringify(arr[i]) == JSON.stringify(val)) { - return i; - } - } - return -1; - } - - Common.prototype.remove = function(arr, val){ - let idx = this.indexOf(arr, val ? val.value : val); - if(idx > -1) { - arr.splice(idx, 1); - return true; - } - return false; - } - - Common.prototype.selectAll = function(id, isOn, skipDis){ - let dl = $(`[xid="${id}"]`); - if(!dl[0]){ - return ; - } - if(dl.find('.xm-select-linkage')[0]){ - return ; - } - dl.find(`dd[lay-value]:not(.${FORM_SELECT_TIPS}):not(.${THIS})${skipDis ? ':not(.'+DISABLED+')' :''}`).each((index, item) => { - item = $(item); - let val = this.getItem(id, item); - this.handlerLabel(id, dl.find(`dd[lay-value="${val.value}"]`), true, val, !isOn); - }); - } - - Common.prototype.removeAll = function(id, isOn, skipDis){ - let dl = $(`[xid="${id}"]`); - if(!dl[0]){ - return ; - } - if(dl.find('.xm-select-linkage')[0]){//针对多级联动的处理 - data[id].values.concat([]).forEach((item, idx) => { - let vs = item.value.split('/'); - let pid, li, index = 0; - do{ - pid = vs[index ++]; - li = dl.find(`.xm-select-linkage-group${index}:not(.xm-select-linkage-hide) li[xm-value="${pid}"]`); - li.click(); - }while(li.length && pid != undefined); - }); - return ; - } - data[id].values.concat([]).forEach((item, index) => { - if(skipDis && dl.find(`dd[lay-value="${item.value}"]`).hasClass(DISABLED)){ - - }else{ - this.handlerLabel(id, dl.find(`dd[lay-value="${item.value}"]`), false, item, !isOn); - } - }); - } - - Common.prototype.reverse = function(id, isOn, skipDis){ - let dl = $(`[xid="${id}"]`); - if(!dl[0]){ - return ; - } - if(dl.find('.xm-select-linkage')[0]){ - return ; - } - dl.find(`dd[lay-value]:not(.${FORM_SELECT_TIPS})${skipDis ? ':not(.'+DISABLED+')' :''}`).each((index, item) => { - item = $(item); - let val = this.getItem(id, item); - this.handlerLabel(id, dl.find(`dd[lay-value="${val.value}"]`), !item.hasClass(THIS), val, !isOn); - }); - } - - Common.prototype.skin = function(id){ - let skins = ['default' ,'primary', 'normal', 'warm', 'danger']; - let skin = skins[Math.floor(Math.random() * skins.length)]; - $(`dl[xid="${id}"]`).parents(`.${PNAME}`).find(`.${FORM_SELECT}`).attr('xm-select-skin', skin); - this.check(id) && this.commonHandler(id, $(`dl[xid="${id}"]`).parents(`.${PNAME}`).find(`.${LABEL}`)); - } - - Common.prototype.getPosition = function(e){ - let x = 0, y = 0; - while (e != null) { - x += e.offsetLeft; - y += e.offsetTop; - e = e.offsetParent; - } - return { x: x, y: y }; - }; - - Common.prototype.onreset = function(){//监听reset按钮, 然后重置多选 - $(document).on('click', '[type=reset]', (e) => { - $(e.target).parents('form').find(`.${PNAME} dl[xid]`).each((index, item) => { - let id = item.getAttribute('xid'), - dl = $(item), - dd, - temp = {}; - common.removeAll(id); - data[id].config.init.forEach((val, idx) => { - if(val && (!temp[val] || data[id].config.repeat) && (dd = dl.find(`dd[lay-value="${val.value}"]`))[0]){ - common.handlerLabel(id, dd, true); - temp[val] = 1; - } - }); - }) - }); - } - - Common.prototype.bindEvent = function(name, id, fun){ - if(id && id instanceof Function){ - fun = id; - id = null; - } - if(fun && fun instanceof Function){ - if(!id){ - $.each(data, (id, val) => { - data[id] ? (data[id].config[name] = fun) : (events[name][id] = fun) - }) - }else{ - data[id] ? (data[id].config[name] = fun, delete events[name][id]) : (events[name][id] = fun) - } - } - } - - Common.prototype.check = function(id, notAutoRender){ - if($(`dl[xid="${id}"]`).length) { - return true; - }else if($(`select[xm-select="${id}"]`).length){ - if(!notAutoRender){ - this.render(id, $(`select[xm-select="${id}"]`)); - return true; - } - }else{ - delete data[id]; - return false; - } - } - - Common.prototype.render = function(id, select){ - common.init(select); - common.one($(`dl[xid="${id}"]`).parents(`.${PNAME}`)); - common.initVal(id); - } - - Common.prototype.log = function(obj){ - console.log(obj); - } - - let Select4 = function(){ - this.v = v; - this.render(); - }; - let common = new Common(); - - Select4.prototype.value = function(id, type, isAppend){ - if(typeof id != 'string'){ - return []; - } - let fs = data[id]; - if(!common.check(id)){ - return []; - } - if(typeof type == 'string' || type == undefined){ - let arr = fs.values.concat([]) || []; - if(type == 'val') { - return arr.map((val) => { - return val.value; - }); - } - if(type == 'valStr') { - return arr.map((val) => { - return val.value; - }).join(','); - } - if(type == 'name') { - return arr.map((val) => { - return val.name; - }); - } - if(type == 'nameStr') { - return arr.map((val) => { - return val.name; - }).join(','); - } - return arr; - } - if(common.isArray(type)) { - let dl = $(`[xid="${id}"]`), - temp = {}, - dd, - isAdd = true; - if(isAppend == false){//删除传入的数组 - isAdd = false; - }else if(isAppend == true){//追加模式 - isAdd = true; - }else{//删除原有的数据 - common.removeAll(id); - } - if(isAdd){ - fs.values.forEach((val, index) => { - temp[val.value] = 1; - }); - } - type.forEach((val, index) => { - if(val && (!temp[val] || fs.config.repeat)){ - if((dd = dl.find(`dd[lay-value="${val}"]`))[0]){ - common.handlerLabel(id, dd, isAdd, null, true); - temp[val] = 1; - }else{ - let name = common.valToName(id, val); - if(name){ - common.handlerLabel(id, dd, isAdd, common.getItem(id, val), true); - temp[val] = 1; - } - } - } - }); - } - } - - Select4.prototype.on = function(id, fun, isEnd) { - common.bindEvent(isEnd ? 'endOn' : 'on', id, fun); - return this; - } - - Select4.prototype.filter = function(id, fun){ - common.bindEvent('filter', id, fun); - return this; - } - - Select4.prototype.maxTips = function(id, fun){ - common.bindEvent('maxTips', id, fun); - return this; - } - - Select4.prototype.opened = function(id, fun){ - common.bindEvent('opened', id, fun); - return this; - } - - Select4.prototype.closed = function(id, fun){ - common.bindEvent('closed', id, fun); - return this; - } - - Select4.prototype.config = function(id, config, isJson){ - if(id && typeof id == 'object'){ - isJson = config == true; - config = id; - id = null; - } - if(config && typeof config== 'object'){ - if(isJson){ - config.header || (config.header = {}); - config.header['Content-Type'] = 'application/json; charset=UTF-8'; - config.dataType = 'json'; - } - id ? ( - ajaxs[id] = $.extend(true, {}, ajaxs[id] || ajax, config), !common.check(id) && this.render(id), - data[id] && config.direction && (data[id].config.direction = config.direction), - data[id] && config.clearInput && (data[id].config.clearInput = true), - config.searchUrl && data[id] && common.triggerSearch($(`.${PNAME} dl[xid="${id}"]`).parents(`.${FORM_SELECT}`), true) - ) : ( - $.extend(true, ajax, config), - $.each(ajaxs, (key, item) => { - $.extend(true, item, config) - }) - ); - } - return this; - } - - Select4.prototype.render = function(id, options){ - if(id && typeof id == 'object'){ - options = id; - id = null; - } - let config = options ? { - init: options.init, - disabled: options.disabled, - max: options.max, - isSearch: options.isSearch, - searchUrl: options.searchUrl, - isCreate: options.isCreate, - radio: options.radio, - skin: options.skin, - direction: options.direction, - height: options.height, - formname: options.formname, - layverify: options.layverify, - layverType: options.layverType, - showCount: options.showCount, - placeholder: options.placeholder, - create: options.create, - filter: options.filter, - maxTips: options.maxTips, - on: options.on, - on: options.on, - opened: options.opened, - closed: options.closed, - template: options.template, - clearInput: options.clearInput, - } : {}; - - options && options.searchType != undefined && (config.searchType = options.searchType == 'dl' ? 1 : 0); - - if(id){ - fsConfigs[id] = {}; - $.extend(fsConfigs[id], data[id] ? data[id].config : {}, config); - }else{ - $.extend(fsConfig, config); - } - - ($(`select[${NAME}="${id}"]`)[0] ? $(`select[${NAME}="${id}"]`) : $(`select[${NAME}]`)).each((index, select) => { - let sid = select.getAttribute(NAME); - common.render(sid, select); - setTimeout(() => common.setHidnVal(sid, $(`select[xm-select="${sid}"] + div.${PNAME} .${LABEL}`)), 10); - }); - return this; - } - - Select4.prototype.disabled = function(id){ - let target = {}; - id ? (common.check(id) && (target[id] = data[id])) : (target = data); - - $.each(target, (key, val) => { - $(`dl[xid="${key}"]`).prev().addClass(DIS); - }); - return this; - } - - Select4.prototype.undisabled = function(id){ - let target = {}; - id ? (common.check(id) && (target[id] = data[id])) : (target = data); - - $.each(target, (key, val) => { - $(`dl[xid="${key}"]`).prev().removeClass(DIS); - }); - return this; - } - - Select4.prototype.data = function(id, type, config){ - if(!id || !type || !config){ - common.log(`id: ${id} param error !!!`) - return this; - } - if(!common.check(id)){ - common.log(`id: ${id} not render !!!`) - return this; - } - this.value(id, []); - this.config(id, config); - if(type == 'local'){ - common.renderData(id, config.arr, config.linkage == true, config.linkageWidth ? config.linkageWidth : '100'); - }else if(type == 'server'){ - common.ajax(id, config.url, config.keyword, config.linkage == true, config.linkageWidth ? config.linkageWidth : '100'); - } - return this; - } - - Select4.prototype.btns = function(id, btns, config){ - if(id && common.isArray(id)){ - btns = id; - id = null; - } - if(!btns || !common.isArray(btns)) { - return this; - }; - let target = {}; - id ? (common.check(id) && (target[id] = data[id])) : (target = data); - - btns = btns.map((obj) => { - if(typeof obj == 'string'){ - if(obj == 'select'){ - return quickBtns[0]; - } - if(obj == 'remove'){ - return quickBtns[1]; - } - if(obj == 'reverse'){ - return quickBtns[2]; - } - if(obj == 'skin'){ - return quickBtns[3]; - } - } - return obj; - }); - - $.each(target, (key, val) => { - val.config.btns = btns; - let dd = $(`dl[xid="${key}"]`).find(`.${FORM_SELECT_TIPS}:first`); - if(btns.length){ - let show = config && config.show && (config.show == 'name' || config.show == 'icon') ? config.show : ''; - let html = common.renderBtns(key, show, config && config.space ? config.space : '30px'); - dd.html(html); - }else{ - let pcInput = dd.parents(`.${FORM_SELECT}`).find(`.${TDIV} input`); - let html = pcInput.attr('placeholder') || pcInput.attr('back'); - dd.html(html); - dd.removeAttr('style'); - } - }); - - return this; - } - - Select4.prototype.search = function(id, val){ - if(id && common.check(id)){ - ajaxs[id] = $.extend(true, {}, ajaxs[id] || ajax, { - first: true, - searchVal: val - }); - common.triggerSearch($(`dl[xid="${id}"]`).parents(`.${FORM_SELECT}`), true); - } - return this; - } - - Select4.prototype.replace = function(id, type, config){ - if(!id || !type || !config){ - common.log(`id: ${id} param error !!!`) - return this; - } - if(!common.check(id, true)){ - common.log(`id: ${id} not render !!!`) - return this; - } - let oldVals = this.value(id, 'val'); - this.value(id, []); - this.config(id, config); - if(type == 'local'){ - common.renderData(id, config.arr, config.linkage == true, config.linkageWidth ? config.linkageWidth : '100', false, true); - this.value(id, oldVals, true); - }else if(type == 'server'){ - common.ajax(id, config.url, config.keyword, config.linkage == true, config.linkageWidth ? config.linkageWidth : '100', false, (id) => { - this.value(id, oldVals, true); - }, true); - } - } - - return new Select4(); -}); \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/module/step.js b/src/plugin/admin/public/component/pear/module/step.js deleted file mode 100644 index 4c96d178..00000000 --- a/src/plugin/admin/public/component/pear/module/step.js +++ /dev/null @@ -1,80 +0,0 @@ -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 = '
                                      '; - for (var i = 0; i < stepItems.length; i++) { - stepDiv += '
                                      '; - if (i < (stepItems.length - 1)) { - if (i < postion) { - stepDiv += '
                                      '; - } else { - stepDiv += '
                                      '; - } - } - var number = stepItems[i].number; - if (!number) { - number = i + 1; - } - if (i == postion) { - stepDiv += '
                                      ' + number + '
                                      '; - } else if (i < postion) { - stepDiv += '
                                      '; - } else { - stepDiv += '
                                      ' + number + '
                                      '; - } - var title = stepItems[i].title; - var desc = stepItems[i].desc; - var time = stepItems[i].time; - if (title || desc || time) { - stepDiv += '
                                      '; - if (title) { - stepDiv += '
                                      ' + title + '
                                      '; - } - if (desc) { - stepDiv += '
                                      ' + desc + '
                                      '; - } - if (time) { - stepDiv += '
                                      ' + time + '
                                      '; - } - stepDiv += '
                                      '; - } - stepDiv += '
                                      '; - } - stepDiv += '
                                      '; - $(elem).prepend(stepDiv); - var bfb = 100 / stepItems.length; - $('.step-item').css('width', bfb + '%'); - }; - - var pearStep = { - 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', pearStep); -}); \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/module/tab.js b/src/plugin/admin/public/component/pear/module/tab.js deleted file mode 100644 index 4284f45d..00000000 --- a/src/plugin/admin/public/component/pear/module/tab.js +++ /dev/null @@ -1,663 +0,0 @@ -layui.define(['jquery', 'element'], function(exports) { - "use strict"; - - var MOD_NAME = 'tab', - $ = layui.jquery, - element = layui.element; - - var pearTab = function(opt) { - this.option = opt; - }; - - var tabData = new Array(); - var tabDataCurrent = 0; - var contextTabDOM; - - pearTab.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, - preload: opt.preload ? opt.preload : false, - closeEvent: opt.closeEvent, - success: opt.success ? opt.success : function(id) {} - } - - if (option.session) { - if (sessionStorage.getItem(option.elem + "-pear-tab-data") != null) { - tabData = JSON.parse(sessionStorage.getItem(option.elem + "-pear-tab-data")); - option.data = JSON.parse(sessionStorage.getItem(option.elem + "-pear-tab-data")); - tabDataCurrent = sessionStorage.getItem(option.elem + "-pear-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 + "-pear-tab-data-current")); - - $("body .layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title").on("contextmenu", "li", - function(e) { - // 获取当前元素位置 - var top = e.clientY; - var left = e.clientX; - var menuWidth = 100; - var currentId = $(this).attr("lay-id"); - var menu = "
                                      • 关闭当前
                                      • 关闭其他
                                      • 关闭所有
                                      "; - - contextTabDOM = $(this); - var isOutsideBounds = (left + menuWidth) > $(window).width(); - if (isOutsideBounds) { - left = $(window).width() - menuWidth; - } - // 初始化 - layer.open({ - type: 1, - title: false, - shade: false, - skin: 'pear-tab-menu', - closeBtn: false, - area: [menuWidth + 'px', '108px'], - fixed: true, - anim: false, - isOutAnim: false, - 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; - }) - - mousewheelAndTouchmoveHandler(option) - return new pearTab(option); - } - - pearTab.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 + "-pear-tab-data-current", id); - if (!option.preload) { - var $iframe = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-content").find( - "iframe[id='" + id + "']"); - var iframeUrl = $iframe.attr("src"); - if (!iframeUrl || iframeUrl === "about:blank") { - // 获取 url 并重载 - tabData.forEach(function(item, index) { - if (item.id === id) { - iframeUrl = item.url; - } - }) - tabIframeLoading(elem); - $iframe.attr("src", iframeUrl); - } - } - callback(id); - }); - } - - pearTab.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); - } - - pearTab.prototype.clear = function() { - sessionStorage.removeItem(this.option.elem + "-pear-tab-data"); - sessionStorage.removeItem(this.option.elem + "-pear-tab-data-current"); - } - - pearTab.prototype.addTab = function(opt) { - var title = ''; - if (opt.close) { - title += '' + opt.title + - ''; - } else { - title += '' + opt.title + - ''; - } - element.tabAdd(this.option.elem, { - title: title, - content: '', - id: opt.id - }); - if (time != false && time != 0) { - tabIframeLoading(elem, opt.id); - } - tabData.push(opt); - sessionStorage.setItem(elem + "-pear-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) { - element.tabAdd(elem, { - title: title, - content: '', - id: opt.id - }); - if (time != false && time != 0) { - tabIframeLoading(this.option.elem, opt.id); - } - tabData.push(opt); - sessionStorage.setItem(elem + "-pear-tab-data", JSON.stringify(tabData)); - - } - } - sessionStorage.setItem(elem + "-pear-tab-data-current", opt.id); - element.tabChange(elem, opt.id); - } - - /** 添 加 唯 一 选 项 卡 */ - pearTab.prototype.addTabOnly = function(opt, time) { - var title = ''; - if (opt.close) { - title += '' + opt.title + - ''; - } else { - title += '' + opt.title + - ''; - } - if ($(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-title li[lay-id]").length <= - 0) { - element.tabAdd(this.option.elem, { - title: title, - content: '', - id: opt.id - }); - if (time != false && time != 0) { - tabIframeLoading(this.option.elem, opt.id); - } - tabData.push(opt); - sessionStorage.setItem(this.option.elem + "-pear-tab-data", JSON.stringify(tabData)); - sessionStorage.setItem(this.option.elem + "-pear-tab-data-current", opt.id); - } else { - var isData = 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 (this.option.tabMax != 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; - } - } - - element.tabAdd(this.option.elem, { - title: title, - content: '', - id: opt.id - }); - if (time != false && time != 0) { - tabIframeLoading(this.option.elem, opt.id); - } - tabData.push(opt); - sessionStorage.setItem(this.option.elem + "-pear-tab-data", JSON.stringify(tabData)); - sessionStorage.setItem(this.option.elem + "-pear-tab-data-current", opt.id); - } - } - element.tabChange(this.option.elem, opt.id); - sessionStorage.setItem(this.option.elem + "-pear-tab-data-current", opt.id); - } - - // 刷 新 指 定 的 选 项 卡 - pearTab.prototype.refresh = function(time) { - // 刷 新 指 定 的 选 项 卡 - var $iframe = $(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-content .layui-show") - .find("iframe"); - if (time != false && time != 0) { - tabIframeLoading(this.option.elem); - } - $iframe.attr("src", $iframe.attr("src")); - } - - function tabIframeLoading(elem, id) { - var load = '
                                      ' + - '
                                      ' + - '' + - '
                                      ' + - '
                                      ' - var $iframe = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-content .layui-show").find("iframe"); - if (id) { - $iframe = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-content").find("iframe[id='" + id + - "']"); - } - $iframe.parent().append(load); - var pearLoad = $("#" + elem).find("#pear-tab-loading" + index); - pearLoad.css({ - display: "block" - }); - index++; - $iframe.on("load", function() { - pearLoad.fadeOut(1000, function() { - pearLoad.remove(); - }); - }) - } - - 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 + "-pear-tab-data")); - tabDataCurrent = sessionStorage.getItem(elem + "-pear-tab-data-current"); - tabData = tabData.filter(function(item) { - return item.id != id; - }) - sessionStorage.setItem(elem + "-pear-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 + "-pear-tab-data")); - tabDataCurrent = sessionStorage.getItem(elem + "-pear-tab-data-current"); - tabData = tabData.filter(function(item) { - return item.id != id; - }) - sessionStorage.setItem(elem + "-pear-tab-data", JSON.stringify(tabData)); - sessionStorage.setItem(elem + "-pear-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 = '
                                      '; - var title = '
                                        '; - var content = '
                                        '; - var control = - '
                                        • '; - - // 处 理 选 项 卡 头 部 - var index = 0; - $.each(option.data, function(i, item) { - var TitleItem = ''; - if (option.index == index) { - TitleItem += '
                                        • '; - } else { - TitleItem += '
                                        • '; - } - - if (item.close) { - // 当 前 选 项 卡 可 以 关 闭 - TitleItem += '' + item.title + ''; - } else { - // 当 前 选 项 卡 不 允 许 关 闭 - TitleItem += '' + item.title + ''; - } - TitleItem += '
                                        • '; - title += TitleItem; - if (option.index == index) { - - // 处 理 显 示 内 容 - content += '
                                          ' - } else { - if (!option.preload) { - item.url = "about:blank"; - } - // 处 理 显 示 内 容 - content += '
                                          ' - } - index++; - }); - - title += '
                                        '; - content += '
                                      • '; - control += '
                                        关 闭 当 前
                                        ' - control += '
                                        关 闭 其 他
                                        ' - control += '
                                        关 闭 全 部
                                        ' - control += '
                                      '; - - tab += title; - tab += control; - tab += content; - tab += '
                                      '; - 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 = contextTabDOM; - - 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 = contextTabDOM.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 = contextTabDOM.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); - } - }) - }) - } - - function mousewheelAndTouchmoveHandler(option) { - var $bodyTab = $("body .layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title") - var $tabTitle = $('#' + option.elem + ' .layui-tab-title'); - var mouseScrollStep = 100 - // 鼠标滚轮 - $bodyTab.on("mousewheel DOMMouseScroll", function(e) { - e.originalEvent.preventDefault() - var delta = (e.originalEvent.wheelDelta && (e.originalEvent.wheelDelta > 0 ? "top" : - "down")) || // chrome & ie - (e.originalEvent.detail && (e.originalEvent.detail > 0 ? "down" : "top")); // firefox - var scrollLeft = $tabTitle.scrollLeft(); - - if (delta === "top") { - scrollLeft -= mouseScrollStep - } else if (delta === "down") { - scrollLeft += mouseScrollStep - } - $tabTitle.scrollLeft(scrollLeft) - }); - - // 触摸移动 - var touchX = 0; - $bodyTab.on("touchstart", function(e) { - var touch = e.originalEvent.targetTouches[0]; - touchX = touch.pageX - }) - $bodyTab.on("touchmove", function(e) { - var event = e.originalEvent; - if (event.targetTouches.length > 1) return; - event.preventDefault(); - var touch = event.targetTouches[0]; - var distanceX = touchX - touch.pageX - var scrollLeft = $tabTitle.scrollLeft(); - touchX = touch.pageX - $tabTitle.scrollLeft(scrollLeft += distanceX) - }); - } - - exports(MOD_NAME, new pearTab()); -}) diff --git a/src/plugin/admin/public/component/pear/module/tabPage.js b/src/plugin/admin/public/component/pear/module/tabPage.js new file mode 100644 index 00000000..e1c91404 --- /dev/null +++ b/src/plugin/admin/public/component/pear/module/tabPage.js @@ -0,0 +1,673 @@ +layui.define(['jquery', 'element', 'dropdown'], function (exports) { + "use strict"; + + var MOD_NAME = 'tabPage', + $ = layui.jquery, + dropdown = layui.dropdown, + element = layui.element; + + var tabPage = function (opt) { + this.option = opt; + }; + + var tabData = new Array(); + var tabDataCurrent = 0; + var contextTabDOM; + + tabPage.prototype.render = function (opt) { + + var option = { + elem: opt.elem, + data: opt.data, + index: opt.index, + tool: opt.tool || true, + roll: opt.roll || true, + success: opt.success ? opt.success : function (id) { }, + session: opt.session ? opt.session : false, + preload: opt.preload ? opt.preload : false, + height: opt.height || "100%", + width: opt.width || "100%", + closeEvent: opt.closeEvent, + tabMax: opt.tabMax, + } + + if (option.session) { + if (sessionStorage.getItem(option.elem + "-pear-tab-page-data") != null) { + tabData = JSON.parse(sessionStorage.getItem(option.elem + "-pear-tab-page-data")); + option.data = JSON.parse(sessionStorage.getItem(option.elem + "-pear-tab-page-data")); + tabDataCurrent = sessionStorage.getItem(option.elem + "-pear-tab-page-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(); + + $("#" + option.elem).width(opt.width); + $("#" + option.elem).height(opt.height); + $("#" + option.elem).css({ + position: "relative" + }); + + closeEvent(option); + + option.success(sessionStorage.getItem(option.elem + "-pear-tab-page-data-current")); + + dropdown.render({ + elem: `#${option.elem} .layui-tab-control > .layui-icon-down`, + trigger: 'hover', + data: [{ + title: '关 闭 当 前', + id: 1 + }, { + title: '关 闭 其 他', + id: 2 + }, { + title: '关 闭 全 部', + id: 3 + }], + click: function (obj) { + + const id = obj.id; + + if (id === 1) { + 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: 1000 + }) + } + } else if (id === 2) { + 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); + } + } + }) + } else { + 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); + } + }) + } + + } + }) + + $("body .layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title").on("contextmenu", "li", + function (e) { + var top = e.clientY; + var left = e.clientX; + var menuWidth = 100; + var menu = `
                                        +
                                      • 关闭当前
                                      • +
                                      • 关闭其他
                                      • +
                                      • 关闭所有
                                      • +
                                      `; + + contextTabDOM = $(this); + var isOutsideBounds = (left + menuWidth) > $(window).width(); + if (isOutsideBounds) { + left = $(window).width() - menuWidth; + } + + layer.open({ + type: 1, + title: false, + shade: false, + skin: 'pear-tab-page-menu', + closeBtn: false, + area: [menuWidth + 'px', '108px'], + fixed: true, + anim: false, + isOutAnim: false, + offset: [top, left], + content: menu, + 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); + }); + + $(layero).on('contextmenu', function () { + return false; + }) + } + }); + return false; + }) + + mousewheelAndTouchmoveHandler(option) + return new tabPage(option); + } + + tabPage.prototype.click = function (callback) { + var option = this.option; + var elem = this.option.elem; + element.on('tab(' + this.option.elem + ')', function (data) { + var id = $("#" + elem + " .layui-tab-title .layui-this").attr("lay-id"); + sessionStorage.setItem(option.elem + "-pear-tab-page-data-current", id); + callback(id); + }); + } + + tabPage.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); + } + + tabPage.prototype.clear = function () { + sessionStorage.removeItem(this.option.elem + "-pear-tab-page-data"); + sessionStorage.removeItem(this.option.elem + "-pear-tab-page-data-current"); + } + + tabPage.prototype.changeTabTitleById = function (id, title) { + var currentTab = $(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-title [lay-id='" + id + "'] .title"); + currentTab.html(title); + } + + /** + * @since Pear Admin 4.0 + * + * 删除指定选项卡 + * + * @param id 编号 + */ + tabPage.prototype.removeTab = function (id) { + var elem = this.option.elem; + if (id != undefined) { + var currentTab = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title [lay-id='" + id + "']"); + if (currentTab.find("span").is(".able-close")) { + tabDelete(elem, id, () => { }); + } + } else { + var tabtitle = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title li"); + $.each(tabtitle, function () { + if ($(this).find("span").is(".able-close")) { + tabDelete(elem, $(this).attr("lay-id"), () => { }); + } + }) + } + } + + /** + * @since Pear Admin 4.0 + * + * 删除其他选项卡 + */ + tabPage.prototype.removeOtherTab = function () { + var elem = this.option.elem; + 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 () { + if ($(this).attr("lay-id") != currentId) { + if ($(this).find("span").is(".able-close")) { + tabDelete(elem, $(this).attr("lay-id"), () => { }); + } + } + }) + } + + /** + * @since Pear Admin 4.0 + * + * 删除选中选项卡 + */ + tabPage.prototype.removeCurrentTab = function () { + var currentTab = $(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-title .layui-this"); + if (currentTab.find("span").is(".able-close")) { + var currentId = currentTab.attr("lay-id"); + tabDelete(this.option.elem, currentId, () => { }); + } + } + + /** + * @since Pear Admin 4.0 + * + * 切换选项卡 + * + * @param opt 内容 + */ + tabPage.prototype.changePage = function (opt) { + + var title = ` + ${opt.title} + `; + + if ($(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-title li[lay-id]").length <= + 0) { + + var that = this; + + if (opt.type === "_iframe") { + const iframeLoad = $("#" + this.option.elem).find(".pear-tab-page-loading"); + iframeLoad.show(); + element.tabAdd(this.option.elem, { + id: opt.id, + title: title, + content: `` + }); + $(`#${opt.id}`).on("load", function () { + iframeLoad.fadeOut(1000, function () { + iframeLoad.css({ + display: "none" + }); + }); + }); + } else { + + $.ajax({ + url: opt.url, + type: 'get', + dataType: 'html', + async: false, + success: function (data) { + element.tabAdd(that.option.elem, { + id: opt.id, + title: title, + content: `
                                      ${data}
                                      `, + }); + }, + error: function (xhr, textstatus, thrown) { + return layer.msg('Status:' + xhr.status + ',' + xhr.statusText + ',请稍后再试!'); + } + }); + } + + tabData.push(opt); + sessionStorage.setItem(that.option.elem + "-pear-tab-page-data", JSON.stringify(tabData)); + sessionStorage.setItem(that.option.elem + "-pear-tab-page-data-current", opt.id); + + } else { + + var isData = 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 (this.option.tabMax != 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; + } + } + + var that = this; + if (opt.type === "_iframe") { + const iframeLoad = $("#" + this.option.elem).find(".pear-tab-page-loading"); + iframeLoad.show(); + element.tabAdd(this.option.elem, { + id: opt.id, + title: title, + content: `` + }); + $(`#${opt.id}`).on("load", function () { + iframeLoad.fadeOut(1000, function () { + iframeLoad.css({ + display: "none" + }); + }); + }); + } else { + $.ajax({ + url: opt.url, + type: 'get', + dataType: 'html', + async: false, + success: function (data) { + element.tabAdd(that.option.elem, { + id: opt.id, + title: title, + content: `
                                      ${data}
                                      `, + }); + }, + error: function (xhr, textstatus, thrown) { + return layer.msg('Status:' + xhr.status + ',' + xhr.statusText + ',请稍后再试!'); + } + }); + } + tabData.push(opt); + sessionStorage.setItem(that.option.elem + "-pear-tab-page-data", JSON.stringify(tabData)); + sessionStorage.setItem(that.option.elem + "-pear-tab-page-data-current", opt.id); + } + } + element.tabChange(this.option.elem, opt.id); + sessionStorage.setItem(this.option.elem + "-pear-tab-page-data-current", opt.id); + } + + /** + * 刷新当前选型卡 + * + * @param time 动画时长 + */ + tabPage.prototype.refresh = function (time) { + + var $iframe = $(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-content .layui-show > div[data-frameid], " + + ".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-content .layui-show > iframe[data-frameid]"); + var $iframeLoad; + + if (time != false && time != 0) { + $iframeLoad = $("#" + this.option.elem).find(".pear-tab-page-loading"); + $iframeLoad.css({ + display: "block" + }); + } + + if ($iframe.attr("type") === "_iframe") { + $iframe.attr("src", $iframe.attr("src")); + $iframe.on("load", function () { + $iframeLoad.fadeOut(1000, function () { + $iframeLoad.css({ + display: "none" + }); + }); + }) + } else { + $.ajax({ + url: $iframe.attr("src"), + type: 'get', + dataType: 'html', + success: function (data) { + $iframe.html(data); + if ($iframeLoad != undefined) { + $iframeLoad.fadeOut(1000, function () { + $iframeLoad.css({ + display: "none" + }); + }); + } + }, + error: function (xhr) { + return layer.msg('Status:' + xhr.status + ',' + xhr.statusText + ',请稍后再试!'); + } + }); + } + } + + function tabDelete(elem, id, callback) { + var tabTitle = $(".layui-tab[lay-filter='" + elem + "']").find(".layui-tab-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("*[id='" + id + "']") + .parent(); + tabContent.remove(); + + tabData = JSON.parse(sessionStorage.getItem(elem + "-pear-tab-page-data")); + tabDataCurrent = sessionStorage.getItem(elem + "-pear-tab-page-data-current"); + tabData = tabData.filter(function (item) { + return item.id != id; + }) + sessionStorage.setItem(elem + "-pear-tab-page-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 + "-pear-tab-page-data")); + tabDataCurrent = sessionStorage.getItem(elem + "-pear-tab-page-data-current"); + tabData = tabData.filter(function (item) { + return item.id != id; + }) + sessionStorage.setItem(elem + "-pear-tab-page-data", JSON.stringify(tabData)); + sessionStorage.setItem(elem + "-pear-tab-page-data-current", currId); + removeTab.remove(); + var tabContent = $(".layui-tab[lay-filter='" + elem + "']").find("*[id='" + id + "']").parent(); + tabContent.remove(); + } + + /** + * @since Pear Admin 4.0 + */ + function createTab(option) { + + var 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 = '
                                      '; + + var headers = '
                                        '; + var content = '
                                        '; + var loading = '
                                        ' + var control = `
                                        +
                                      • +
                                      • +
                                      • +
                                        `; + + // 处 理 选 项 卡 头 部 + var index = 0; + + $.each(option.data, function (i, item) { + + var titleItem = `
                                      • + + + ${item.title} + +
                                      • + `; + + headers += titleItem; + + if (item.type === "_iframe") { + + content += `
                                        ` + + } else { + + $.ajax({ + url: item.url, + type: 'get', + dataType: 'html', + async: false, + success: function (data) { + content += `
                                        ${data}
                                        `; + }, + error: function (xhr) { + return layer.msg('Status:' + xhr.status + ',' + xhr.statusText + ',请稍后再试!'); + } + }); + } + + index++; + }); + + headers += '
                                      '; + content += '
                                      '; + + tab += headers; + tab += control; + tab += content; + tab += loading; + tab += '
                                      '; + 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); + }) + .on("mousedown", ".layui-tab-title li", function (e) { + if (e.buttons === 4 && $(this).find("span").is(".able-close")) { + tabDelete(option.elem, $(this).attr("lay-id"), option.closeEvent, option); + } + }); + } + + function menuEvent(option, index) { + + $("#" + option.elem + "closeThis").click(function () { + var currentTab = contextTabDOM; + + 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 = contextTabDOM.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 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 mousewheelAndTouchmoveHandler(option) { + var $bodyTab = $("body .layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title") + var $tabTitle = $('#' + option.elem + ' .layui-tab-title'); + var mouseScrollStep = 100 + // 鼠标滚轮 + $bodyTab.on("mousewheel DOMMouseScroll", function (e) { + e.originalEvent.preventDefault() + var delta = (e.originalEvent.wheelDelta && (e.originalEvent.wheelDelta > 0 ? "top" : + "down")) || // chrome & ie + (e.originalEvent.detail && (e.originalEvent.detail > 0 ? "down" : "top")); // firefox + var scrollLeft = $tabTitle.scrollLeft(); + + if (delta === "top") { + scrollLeft -= mouseScrollStep + } else if (delta === "down") { + scrollLeft += mouseScrollStep + } + $tabTitle.scrollLeft(scrollLeft) + }); + + // 触摸移动 + var touchX = 0; + $bodyTab.on("touchstart", function (e) { + var touch = e.originalEvent.targetTouches[0]; + touchX = touch.pageX + }) + + $bodyTab.on("touchmove", function (e) { + var event = e.originalEvent; + if (event.targetTouches.length > 1) return; + event.preventDefault(); + var touch = event.targetTouches[0]; + var distanceX = touchX - touch.pageX + var scrollLeft = $tabTitle.scrollLeft(); + touchX = touch.pageX + $tabTitle.scrollLeft(scrollLeft += distanceX) + }); + } + + exports(MOD_NAME, new tabPage()); +}) diff --git a/src/plugin/admin/public/component/pear/module/tag.js b/src/plugin/admin/public/component/pear/module/tag.js deleted file mode 100644 index b7222ce2..00000000 --- a/src/plugin/admin/public/component/pear/module/tag.js +++ /dev/null @@ -1,159 +0,0 @@ -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 = ''; - 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 = $('
                                      '); - 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 = $(''); - close.on('click', call.delete); - li.append(close); - } - }); - } - //允许新增标签 - if(othis.attr('lay-newTag') && buttonNewTag.length === 0){ - buttonNewTag = $(''); - 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); -}); - diff --git a/src/plugin/admin/public/component/pear/module/theme.js b/src/plugin/admin/public/component/pear/module/theme.js deleted file mode 100644 index c7b3abfd..00000000 --- a/src/plugin/admin/public/component/pear/module/theme.js +++ /dev/null @@ -1,110 +0,0 @@ -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"); - this.colorSet(color, second); - 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) { - var style = ''; - style += '.light-theme .pear-nav-tree .layui-this a:hover,.light-theme .pear-nav-tree .layui-this,.light-theme .pear-nav-tree .layui-this a,.pear-nav-tree .layui-this a,.pear-nav-tree .layui-this{background-color: ' +color + '!important;}'; - style += '.pear-admin .layui-logo .title{color:' + color + '!important;}'; - style += '.pear-frame-title .dot,.pear-tab .layui-this .pear-tab-active{background-color: ' + color +'!important;}'; - style += '.bottom-nav li a:hover{background-color:' + color + '!important;}'; - style += '.pear-btn-primary {border: 1px solid ' + color + '!important;}'; - style += '.pear-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 += '.pearone-color .color-content li.layui-this:after, .pearone-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 += '.pear-social-entrance {background-color:' + color + '!important}'; - style += '.pear-admin .pe-collapse {background-color:' + color + '!important}'; - style += '.layui-fixbar li {background-color:' + color + '!important}'; - style += '.pear-btn-primary {background-color:' + color + '!important}'; - style += '.layui-input:focus,.layui-textarea:focus {border-color: ' + color + '!important;box-shadow: 0 0 0 3px ' + second + ' !important;}' - 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 + ';}' - 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-onswitch { border-color: ' + color + '; background-color: ' + color + ';}' - 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+'}'; - style += '.layui-elem-quote{border-left: 5px solid '+ color +'}'; - style += '.layui-timeline-axis{color:' + color + '}'; - style += '.layui-laydate .layui-this, .layui-laydate .layui-this div{background-color:'+color+'!important}';//变更 - style += 'xm-select .xm-label .xm-label-block{background-color:'+color+'!important}';//变更 - style += 'xm-select{border-color:#EEE !important}';//变更 - style += 'xm-select .xm-body .xm-option.selected .xm-option-icon{border-color:'+color+'!important;color:'+color+'!important;}';//变更 - style += 'xm-select .xm-body .xm-option .xm-option-icon{border-color:'+color+'!important;}';//变更 - style += 'xm-select > .xm-body .xm-option.selected.hide-icon{background-color:'+color+'!important;}';//变更 - style += 'xm-select > .xm-body .xm-toolbar .toolbar-tag:hover{color:'+color+'!important;}';//变更 - style += '.layui-layer-dialog .layui-layer-content .layui-icon-ok{color:'+color+'!important;}';//变更 - style += '.layui-layer-dialog .layui-layer-content .layui-icon-ok{color:'+color+'!important;}';//变更 - style += 'a{color:'+color+';opacity:.8}';//变更 - style += 'a:hover{color:'+color+';opacity:1}';//变更 - style += '.pear-this,.pear-text{color:' + color + '!important}'; - style += '.pear-back{background-color:'+ color +'!important}'; - style += '.pear-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 += '.pear-tab-menu .item:hover{background-color:'+color+'!important}' - style += '.layui-form-danger:focus {border-color:#FF5722 !important}' - style += '.pear-admin .user .layui-this a:hover{color:white!important}' - style += '.pear-admin .user a:hover{color:'+color+'!important}' - style += '.pear-notice .layui-this{color:'+color+'!important}' - style += '.layui-form-radio:hover *, .layui-form-radioed, .layui-form-radioed>i{color:' + color + ' !important}'; - style += '.pear-btn:hover {color: '+color+';background-color: ' + second + ';}' - style += '.pear-btn-primary[plain] {color: '+ color +' !important;background: ' + second + ' !important;}' - style += '.pear-btn-primary[plain]:hover {background-color: ' + color + '!important}' - style += '.light-theme .pear-nav-tree .layui-this a:hover,.light-theme .pear-nav-tree .layui-this,.light-theme .pear-nav-tree .layui-this a {background-color:'+second+'!important;color:'+color+'!important;}' - style += '.light-theme .pear-nav-tree .layui-this{ border-right: 3px solid '+color+'!important}' - style += '.loader:after {background:'+color+'}' - if(this.autoHead === true || this.autoHead === "true"){ - style += '.pear-admin.banner-layout .layui-header .layui-logo,.pear-admin .layui-header{border:none;background-color:' + color + '!important;}.pear-admin.banner-layout .layui-header .layui-logo .title,.pear-admin .layui-header .layui-nav .layui-nav-item>a{color:whitesmoke!important;}'; - style += '.pear-admin.banner-layout .layui-header{ box-shadow: 2px 0 6px rgb(0 21 41 / 35%) }' - style += '.pear-admin .layui-header .layui-layout-control .layui-this *,.pear-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 +'}' - var colorPane = $("#pear-admin-color"); - if(colorPane.length>0){ - colorPane.html(style); - }else{ - $("head").append("") - } - } - - exports(MOD_NAME, theme); -}); \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/module/tinymce.js b/src/plugin/admin/public/component/pear/module/tinymce.js new file mode 100644 index 00000000..edf993cd --- /dev/null +++ b/src/plugin/admin/public/component/pear/module/tinymce.js @@ -0,0 +1,219 @@ +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 + , relative_urls: false + , remove_script_host: true + , 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]["url"]); + } else { + failFun(res[this.response.msgName]["url"]); + } + } + }; + + // ---------------- 以下代码无需修改 ---------------- + + 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.relative_urls = isset(option.relative_urls) ? option.relative_urls : settings.relative_urls + + option.remove_script_host = isset(option.remove_script_host) ? option.remove_script_host : settings.remove_script_host + + 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); + +}); diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/icons/default/icons.js b/src/plugin/admin/public/component/pear/module/tinymce/icons/default/icons.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/icons/default/icons.js rename to src/plugin/admin/public/component/pear/module/tinymce/icons/default/icons.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/icons/default/icons.min.js b/src/plugin/admin/public/component/pear/module/tinymce/icons/default/icons.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/icons/default/icons.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/icons/default/icons.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/langs/readme.md b/src/plugin/admin/public/component/pear/module/tinymce/langs/readme.md similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/langs/readme.md rename to src/plugin/admin/public/component/pear/module/tinymce/langs/readme.md diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/langs/zh_CN.js b/src/plugin/admin/public/component/pear/module/tinymce/langs/zh_CN.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/langs/zh_CN.js rename to src/plugin/admin/public/component/pear/module/tinymce/langs/zh_CN.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/advlist/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/advlist/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/advlist/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/advlist/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/advlist/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/advlist/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/advlist/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/advlist/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/anchor/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/anchor/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/anchor/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/anchor/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/anchor/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/anchor/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/anchor/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/anchor/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/autolink/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/autolink/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/autolink/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/autolink/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/autolink/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/autolink/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/autolink/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/autolink/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/autoresize/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/autoresize/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/autoresize/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/autoresize/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/autoresize/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/autoresize/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/autoresize/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/autoresize/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/autosave/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/autosave/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/autosave/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/autosave/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/autosave/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/autosave/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/autosave/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/autosave/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/bbcode/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/bbcode/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/bbcode/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/bbcode/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/bbcode/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/bbcode/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/bbcode/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/bbcode/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/charmap/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/charmap/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/charmap/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/charmap/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/charmap/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/charmap/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/charmap/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/charmap/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/code/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/code/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/code/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/code/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/code/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/code/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/code/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/code/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/codesample/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/codesample/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/codesample/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/codesample/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/codesample/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/codesample/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/codesample/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/codesample/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/colorpicker/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/colorpicker/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/colorpicker/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/colorpicker/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/colorpicker/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/colorpicker/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/colorpicker/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/colorpicker/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/contextmenu/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/contextmenu/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/contextmenu/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/contextmenu/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/contextmenu/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/contextmenu/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/contextmenu/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/contextmenu/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/directionality/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/directionality/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/directionality/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/directionality/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/directionality/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/directionality/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/directionality/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/directionality/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/emoticons/js/emojiimages.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/emoticons/js/emojiimages.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/emoticons/js/emojiimages.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/emoticons/js/emojiimages.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/emoticons/js/emojiimages.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/emoticons/js/emojiimages.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/emoticons/js/emojiimages.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/emoticons/js/emojiimages.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/emoticons/js/emojis.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/emoticons/js/emojis.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/emoticons/js/emojis.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/emoticons/js/emojis.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/emoticons/js/emojis.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/emoticons/js/emojis.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/emoticons/js/emojis.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/emoticons/js/emojis.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/emoticons/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/emoticons/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/emoticons/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/emoticons/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/emoticons/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/emoticons/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/emoticons/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/emoticons/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/fullpage/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/fullpage/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/fullpage/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/fullpage/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/fullpage/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/fullpage/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/fullpage/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/fullpage/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/fullscreen/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/fullscreen/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/fullscreen/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/fullscreen/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/fullscreen/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/fullscreen/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/fullscreen/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/fullscreen/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/help/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/help/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/help/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/help/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/help/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/help/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/help/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/help/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/hr/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/hr/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/hr/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/hr/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/hr/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/hr/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/hr/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/hr/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/image/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/image/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/image/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/image/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/image/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/image/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/image/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/image/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/imagetools/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/imagetools/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/imagetools/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/imagetools/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/imagetools/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/imagetools/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/imagetools/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/imagetools/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/importcss/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/importcss/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/importcss/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/importcss/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/importcss/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/importcss/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/importcss/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/importcss/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/indent2em/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/indent2em/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/indent2em/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/indent2em/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/indent2em/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/indent2em/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/indent2em/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/indent2em/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/insertdatetime/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/insertdatetime/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/insertdatetime/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/insertdatetime/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/insertdatetime/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/insertdatetime/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/insertdatetime/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/insertdatetime/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/icon.svg b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/icon.svg similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/icon.svg rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/icon.svg diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityFormula.html b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityFormula.html similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityFormula.html rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityFormula.html diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/bar-bg.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/bar-bg.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/bar-bg.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/bar-bg.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/bar.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/bar.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/bar.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/bar.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/bg.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/bg.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/bg.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/bg.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/bottom.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/bottom.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/bottom.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/bottom.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/btn.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/btn.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/btn.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/btn.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/down.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/down.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/down.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/down.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/top.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/top.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/top.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/top.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/up.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/up.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/up.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/custom/up.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/bar-bg.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/bar-bg.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/bar-bg.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/bar-bg.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/bar-left.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/bar-left.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/bar-left.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/bar-left.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/bar-right.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/bar-right.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/bar-right.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/bar-right.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/thumb-bg.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/thumb-bg.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/thumb-bg.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/thumb-bg.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/thumb-left.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/thumb-left.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/thumb-left.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/thumb-left.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/thumb-right.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/thumb-right.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/thumb-right.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/scrollbar/edit/thumb-right.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/aleph.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/aleph.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/aleph.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/aleph.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/bbbk.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/bbbk.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/bbbk.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/bbbk.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/beth.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/beth.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/beth.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/beth.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/circleds.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/circleds.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/circleds.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/circleds.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/complement.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/complement.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/complement.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/complement.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/daleth.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/daleth.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/daleth.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/daleth.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/ell.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/ell.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/ell.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/ell.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/eth.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/eth.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/eth.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/eth.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/finv.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/finv.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/finv.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/finv.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/game.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/game.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/game.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/game.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/gimel.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/gimel.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/gimel.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/gimel.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/hbar.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/hbar.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/hbar.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/hbar.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/hslash.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/hslash.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/hslash.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/hslash.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/im.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/im.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/im.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/im.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/mho.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/mho.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/mho.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/mho.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/partial.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/partial.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/partial.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/partial.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/re.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/re.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/re.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/re.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/wp.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/wp.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/wp.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/alphabetic/wp.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/circlearrowleft.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/circlearrowleft.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/circlearrowleft.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/circlearrowleft.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/circlearrowright.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/circlearrowright.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/circlearrowright.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/circlearrowright.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/curvearrowleft.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/curvearrowleft.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/curvearrowleft.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/curvearrowleft.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/curvearrowright.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/curvearrowright.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/curvearrowright.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/curvearrowright.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/downarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/downarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/downarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/downarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/downdownarrows.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/downdownarrows.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/downdownarrows.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/downdownarrows.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/downharpoonleft.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/downharpoonleft.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/downharpoonleft.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/downharpoonleft.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/downharpoonright.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/downharpoonright.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/downharpoonright.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/downharpoonright.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/gets.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/gets.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/gets.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/gets.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftarrowtail.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftarrowtail.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftarrowtail.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftarrowtail.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftharpoondown.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftharpoondown.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftharpoondown.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftharpoondown.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftharpoonup.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftharpoonup.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftharpoonup.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftharpoonup.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftleftarrows.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftleftarrows.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftleftarrows.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftleftarrows.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftrightarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftrightarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftrightarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftrightarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftrightarrows.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftrightarrows.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftrightarrows.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftrightarrows.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftrightharpoons.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftrightharpoons.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftrightharpoons.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftrightharpoons.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftrightsquigarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftrightsquigarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftrightsquigarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/leftrightsquigarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/longleftarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/longleftarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/longleftarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/longleftarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/longleftrightarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/longleftrightarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/longleftrightarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/longleftrightarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/longrightarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/longrightarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/longrightarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/longrightarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/looparrowleft.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/looparrowleft.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/looparrowleft.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/looparrowleft.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/looparrowright.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/looparrowright.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/looparrowright.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/looparrowright.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/multimap.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/multimap.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/multimap.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/multimap.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/nearrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/nearrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/nearrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/nearrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/nleftarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/nleftarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/nleftarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/nleftarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/nrightarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/nrightarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/nrightarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/nrightarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/nwarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/nwarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/nwarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/nwarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightarrowtail.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightarrowtail.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightarrowtail.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightarrowtail.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightharpoondown.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightharpoondown.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightharpoondown.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightharpoondown.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightharpoonup.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightharpoonup.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightharpoonup.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightharpoonup.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightleftarrows.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightleftarrows.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightleftarrows.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightleftarrows.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightleftharpoons.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightleftharpoons.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightleftharpoons.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightleftharpoons.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightrightarrows.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightrightarrows.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightrightarrows.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightrightarrows.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightsquigarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightsquigarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightsquigarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/rightsquigarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/searrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/searrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/searrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/searrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/swarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/swarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/swarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/swarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/to.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/to.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/to.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/to.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/twoheadleftarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/twoheadleftarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/twoheadleftarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/twoheadleftarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/twoheadrightarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/twoheadrightarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/twoheadrightarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/twoheadrightarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-downarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-downarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-downarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-downarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-leftarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-leftarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-leftarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-leftarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-leftrightarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-leftrightarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-leftrightarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-leftrightarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-lftarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-lftarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-lftarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-lftarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-lleftarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-lleftarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-lleftarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-lleftarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-longleftarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-longleftarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-longleftarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-longleftarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-longleftrightarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-longleftrightarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-longleftrightarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-longleftrightarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-longrightarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-longrightarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-longrightarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-longrightarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-lsh.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-lsh.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-lsh.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-lsh.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-nleftarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-nleftarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-nleftarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-nleftarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-nleftrightarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-nleftrightarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-nleftrightarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-nleftrightarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-nrightarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-nrightarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-nrightarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-nrightarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-rightarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-rightarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-rightarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-rightarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-rrightarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-rrightarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-rrightarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-rrightarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-rsh.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-rsh.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-rsh.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-rsh.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-uparrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-uparrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-uparrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-uparrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-updownarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-updownarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-updownarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/u-updownarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/uparrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/uparrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/uparrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/uparrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/updownarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/updownarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/updownarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/updownarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/upharpoonleft.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/upharpoonleft.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/upharpoonleft.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/upharpoonleft.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/upharpoonright.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/upharpoonright.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/upharpoonright.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/upharpoonright.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/upuparrows.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/upuparrows.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/upuparrows.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/arrow/upuparrows.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/brackets/1.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/brackets/1.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/brackets/1.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/brackets/1.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/brackets/2.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/brackets/2.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/brackets/2.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/brackets/2.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/brackets/3.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/brackets/3.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/brackets/3.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/brackets/3.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/brackets/4.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/brackets/4.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/brackets/4.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/brackets/4.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/btn.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/btn.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/btn.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/btn.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/brackets.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/brackets.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/brackets.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/brackets.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/down.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/down.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/down.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/down.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/frac.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/frac.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/frac.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/frac.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/fx.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/fx.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/fx.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/fx.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/int.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/int.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/int.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/int.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/lim.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/lim.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/lim.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/lim.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/open.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/open.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/open.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/open.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/script.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/script.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/script.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/script.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/sin.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/sin.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/sin.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/sin.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/sqrt.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/sqrt.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/sqrt.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/sqrt.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/sum.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/sum.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/sum.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/sum.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/tick.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/tick.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/tick.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/tick.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/up.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/up.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/up.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/button/up.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/a.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/a.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/a.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/a.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/b.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/b.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/b.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/b.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/c.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/c.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/c.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/c.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/d.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/d.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/d.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/d.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/e.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/e.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/e.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/e.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/f.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/f.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/f.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/f.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/g.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/g.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/g.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/g.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/h.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/h.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/h.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/h.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/i.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/i.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/i.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/i.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/j.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/j.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/j.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/j.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/k.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/k.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/k.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/k.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/l.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/l.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/l.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/l.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/m.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/m.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/m.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/m.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/n.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/n.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/n.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/n.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/o.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/o.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/o.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/o.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/p.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/p.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/p.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/p.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/q.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/q.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/q.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/q.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/r.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/r.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/r.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/r.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/s.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/s.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/s.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/s.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/t.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/t.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/t.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/t.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/u.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/u.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/u.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/u.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/v.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/v.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/v.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/v.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/w.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/w.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/w.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/w.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/x.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/x.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/x.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/x.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/y.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/y.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/y.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/y.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/z.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/z.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/z.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/bb/z.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/a.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/a.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/a.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/a.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/b.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/b.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/b.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/b.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/c.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/c.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/c.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/c.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/d.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/d.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/d.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/d.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/e.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/e.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/e.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/e.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/f.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/f.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/f.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/f.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/g.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/g.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/g.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/g.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/h.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/h.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/h.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/h.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/i.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/i.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/i.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/i.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/j.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/j.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/j.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/j.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/k.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/k.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/k.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/k.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/l.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/l.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/l.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/l.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/m.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/m.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/m.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/m.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/n.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/n.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/n.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/n.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/o.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/o.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/o.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/o.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/p.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/p.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/p.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/p.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/q.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/q.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/q.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/q.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/r.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/r.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/r.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/r.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/s.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/s.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/s.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/s.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/t.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/t.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/t.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/t.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/u.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/u.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/u.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/u.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/v.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/v.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/v.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/v.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/w.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/w.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/w.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/w.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/x.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/x.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/x.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/x.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/y.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/y.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/y.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/y.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/z.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/z.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/z.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/cal/z.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/a.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/a.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/a.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/a.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/b.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/b.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/b.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/b.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/c.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/c.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/c.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/c.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/d.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/d.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/d.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/d.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/e.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/e.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/e.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/e.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/f.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/f.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/f.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/f.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/g.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/g.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/g.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/g.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/h.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/h.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/h.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/h.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/i.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/i.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/i.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/i.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/j.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/j.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/j.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/j.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/k.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/k.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/k.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/k.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/l.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/l.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/l.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/l.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/m.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/m.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/m.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/m.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/n.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/n.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/n.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/n.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/o.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/o.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/o.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/o.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/p.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/p.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/p.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/p.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/q.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/q.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/q.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/q.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/r.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/r.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/r.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/r.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/s.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/s.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/s.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/s.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/t.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/t.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/t.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/t.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/u.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/u.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/u.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/u.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ua.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ua.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ua.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ua.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ub.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ub.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ub.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ub.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uc.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uc.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uc.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uc.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ud.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ud.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ud.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ud.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ue.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ue.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ue.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ue.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uf.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uf.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uf.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uf.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ug.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ug.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ug.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ug.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uh.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uh.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uh.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uh.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ui.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ui.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ui.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ui.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uj.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uj.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uj.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uj.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uk.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uk.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uk.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uk.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ul.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ul.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ul.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ul.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/um.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/um.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/um.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/um.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/un.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/un.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/un.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/un.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uo.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uo.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uo.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uo.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/up.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/up.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/up.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/up.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uq.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uq.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uq.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uq.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ur.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ur.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ur.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ur.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/us.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/us.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/us.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/us.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ut.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ut.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ut.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ut.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uu.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uu.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uu.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uu.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uv.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uv.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uv.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uv.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uw.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uw.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uw.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uw.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ux.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ux.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ux.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/ux.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uy.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uy.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uy.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uy.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uz.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uz.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uz.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/uz.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/v.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/v.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/v.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/v.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/w.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/w.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/w.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/w.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/x.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/x.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/x.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/x.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/y.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/y.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/y.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/y.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/z.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/z.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/z.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/frak/z.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/alpha.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/alpha.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/alpha.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/alpha.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/beta.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/beta.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/beta.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/beta.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/chi.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/chi.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/chi.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/chi.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/delta.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/delta.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/delta.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/delta.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/epsilon.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/epsilon.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/epsilon.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/epsilon.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/eta.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/eta.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/eta.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/eta.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/gamma.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/gamma.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/gamma.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/gamma.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/iota.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/iota.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/iota.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/iota.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/kappa.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/kappa.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/kappa.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/kappa.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/lambda.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/lambda.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/lambda.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/lambda.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/mu.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/mu.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/mu.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/mu.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/nu.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/nu.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/nu.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/nu.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/omega.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/omega.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/omega.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/omega.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/omicron.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/omicron.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/omicron.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/omicron.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/phi.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/phi.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/phi.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/phi.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/pi.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/pi.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/pi.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/pi.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/psi.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/psi.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/psi.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/psi.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/rho.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/rho.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/rho.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/rho.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/sigma.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/sigma.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/sigma.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/sigma.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/tau.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/tau.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/tau.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/tau.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/theta.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/theta.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/theta.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/theta.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/upsilon.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/upsilon.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/upsilon.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/upsilon.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/xi.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/xi.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/xi.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/xi.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/zeta.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/zeta.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/zeta.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/lower/zeta.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/digamma.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/digamma.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/digamma.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/digamma.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varepsilon.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varepsilon.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varepsilon.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varepsilon.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varkappa.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varkappa.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varkappa.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varkappa.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varphi.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varphi.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varphi.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varphi.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varpi.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varpi.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varpi.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varpi.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varrho.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varrho.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varrho.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varrho.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varsigma.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varsigma.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varsigma.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/varsigma.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/vartheta.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/vartheta.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/vartheta.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/misc/vartheta.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/alpha.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/alpha.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/alpha.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/alpha.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/beta.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/beta.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/beta.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/beta.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/chi.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/chi.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/chi.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/chi.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/delta.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/delta.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/delta.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/delta.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/epsilon.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/epsilon.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/epsilon.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/epsilon.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/eta.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/eta.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/eta.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/eta.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/gamma.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/gamma.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/gamma.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/gamma.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/iota.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/iota.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/iota.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/iota.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/kappa.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/kappa.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/kappa.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/kappa.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/lambda.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/lambda.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/lambda.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/lambda.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/mu.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/mu.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/mu.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/mu.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/nu.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/nu.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/nu.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/nu.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/omega.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/omega.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/omega.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/omega.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/omicron.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/omicron.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/omicron.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/omicron.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/phi.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/phi.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/phi.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/phi.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/pi.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/pi.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/pi.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/pi.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/psi.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/psi.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/psi.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/psi.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/rho.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/rho.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/rho.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/rho.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/sigma.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/sigma.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/sigma.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/sigma.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/tau.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/tau.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/tau.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/tau.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/theta.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/theta.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/theta.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/theta.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/upsilon.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/upsilon.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/upsilon.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/upsilon.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/xi.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/xi.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/xi.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/xi.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/zeta.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/zeta.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/zeta.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/greek/upper/zeta.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/aleph.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/aleph.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/aleph.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/aleph.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/approx.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/approx.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/approx.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/approx.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/ast.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/ast.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/ast.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/ast.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/baifenhao.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/baifenhao.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/baifenhao.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/baifenhao.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/because.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/because.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/because.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/because.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/beth.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/beth.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/beth.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/beth.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/blacksquare.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/blacksquare.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/blacksquare.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/blacksquare.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/cap.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/cap.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/cap.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/cap.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/cdot.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/cdot.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/cdot.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/cdot.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/circ.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/circ.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/circ.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/circ.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/cong.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/cong.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/cong.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/cong.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/cup.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/cup.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/cup.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/cup.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/ddots.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/ddots.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/ddots.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/ddots.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/div.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/div.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/div.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/div.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/downarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/downarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/downarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/downarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/eq.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/eq.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/eq.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/eq.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/equiv.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/equiv.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/equiv.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/equiv.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/exists.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/exists.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/exists.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/exists.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/forall.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/forall.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/forall.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/forall.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/geq.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/geq.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/geq.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/geq.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/gets.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/gets.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/gets.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/gets.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/gg.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/gg.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/gg.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/gg.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/gt.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/gt.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/gt.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/gt.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/in.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/in.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/in.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/in.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/infty.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/infty.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/infty.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/infty.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/leftrightarrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/leftrightarrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/leftrightarrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/leftrightarrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/leq.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/leq.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/leq.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/leq.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/ll.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/ll.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/ll.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/ll.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/lt.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/lt.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/lt.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/lt.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/minus.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/minus.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/minus.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/minus.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/mp.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/mp.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/mp.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/mp.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/neg.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/neg.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/neg.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/neg.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/nexists.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/nexists.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/nexists.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/nexists.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/ni.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/ni.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/ni.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/ni.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/partial.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/partial.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/partial.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/partial.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/plus.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/plus.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/plus.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/plus.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/pm.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/pm.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/pm.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/pm.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/propto.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/propto.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/propto.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/propto.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/sim.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/sim.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/sim.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/sim.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/simeq.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/simeq.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/simeq.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/simeq.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/surd.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/surd.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/surd.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/surd.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/tanhao.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/tanhao.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/tanhao.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/tanhao.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/therefore.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/therefore.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/therefore.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/therefore.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/times.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/times.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/times.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/times.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/to.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/to.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/to.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/to.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/uparrow.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/uparrow.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/uparrow.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/uparrow.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/varnothing.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/varnothing.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/varnothing.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/varnothing.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/vdots.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/vdots.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/vdots.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/math/vdots.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/gneqq.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/gneqq.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/gneqq.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/gneqq.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/gnsim.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/gnsim.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/gnsim.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/gnsim.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/lneqq.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/lneqq.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/lneqq.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/lneqq.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/lnsim.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/lnsim.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/lnsim.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/lnsim.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nbdash-1.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nbdash-1.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nbdash-1.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nbdash-1.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ncong.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ncong.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ncong.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ncong.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/neq.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/neq.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/neq.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/neq.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nequiv.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nequiv.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nequiv.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nequiv.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nexists.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nexists.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nexists.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nexists.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ngeq.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ngeq.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ngeq.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ngeq.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ngtr.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ngtr.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ngtr.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ngtr.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nleq.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nleq.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nleq.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nleq.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nless.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nless.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nless.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nless.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nmid.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nmid.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nmid.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nmid.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/notin.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/notin.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/notin.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/notin.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nparallel.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nparallel.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nparallel.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nparallel.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nprec.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nprec.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nprec.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nprec.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nsim.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nsim.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nsim.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nsim.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nsubseteq.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nsubseteq.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nsubseteq.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nsubseteq.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nsucc.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nsucc.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nsucc.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nsucc.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nsupseteq.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nsupseteq.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nsupseteq.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nsupseteq.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ntriangleleft.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ntriangleleft.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ntriangleleft.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ntriangleleft.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ntrianglelefteq.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ntrianglelefteq.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ntrianglelefteq.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ntrianglelefteq.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ntriangleright.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ntriangleright.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ntriangleright.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ntriangleright.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ntrianglerighteq.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ntrianglerighteq.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ntrianglerighteq.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/ntrianglerighteq.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nvdash-1.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nvdash-1.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nvdash-1.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nvdash-1.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nvdash-2.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nvdash-2.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nvdash-2.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nvdash-2.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nvdash-3.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nvdash-3.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nvdash-3.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nvdash-3.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nvdash.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nvdash.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nvdash.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/nvdash.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/precnsim.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/precnsim.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/precnsim.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/precnsim.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/subsetneq.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/subsetneq.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/subsetneq.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/subsetneq.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/succnsim.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/succnsim.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/succnsim.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/succnsim.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/supsetneq.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/supsetneq.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/supsetneq.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/not/supsetneq.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/a.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/a.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/a.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/a.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/b.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/b.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/b.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/b.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/c.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/c.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/c.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/c.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/d.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/d.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/d.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/d.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/e.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/e.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/e.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/e.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/f.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/f.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/f.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/f.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/g.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/g.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/g.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/g.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/h.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/h.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/h.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/h.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/i.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/i.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/i.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/i.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/j.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/j.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/j.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/j.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/k.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/k.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/k.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/k.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/l.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/l.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/l.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/l.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/m.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/m.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/m.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/m.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/n.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/n.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/n.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/n.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/o.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/o.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/o.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/o.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/p.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/p.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/p.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/p.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/q.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/q.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/q.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/q.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/r.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/r.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/r.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/r.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/s.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/s.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/s.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/s.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/t.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/t.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/t.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/t.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/u.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/u.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/u.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/u.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ua.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ua.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ua.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ua.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ub.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ub.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ub.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ub.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uc.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uc.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uc.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uc.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ud.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ud.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ud.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ud.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ue.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ue.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ue.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ue.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uf.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uf.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uf.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uf.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ug.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ug.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ug.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ug.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uh.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uh.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uh.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uh.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ui.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ui.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ui.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ui.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uj.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uj.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uj.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uj.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uk.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uk.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uk.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uk.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ul.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ul.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ul.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ul.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/um.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/um.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/um.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/um.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/un.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/un.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/un.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/un.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uo.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uo.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uo.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uo.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/up.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/up.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/up.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/up.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uq.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uq.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uq.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uq.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ur.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ur.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ur.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ur.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/us.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/us.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/us.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/us.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ut.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ut.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ut.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ut.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uu.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uu.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uu.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uu.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uv.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uv.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uv.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uv.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uw.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uw.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uw.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uw.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ux.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ux.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ux.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/ux.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uy.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uy.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uy.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uy.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uz.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uz.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uz.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/uz.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/v.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/v.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/v.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/v.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/w.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/w.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/w.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/w.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/x.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/x.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/x.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/x.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/y.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/y.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/y.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/y.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/z.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/z.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/z.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/char/rm/z.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/1.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/1.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/1.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/1.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/2.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/2.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/2.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/2.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/3.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/3.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/3.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/3.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/c1.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/c1.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/c1.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/c1.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/c2.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/c2.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/c2.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/c2.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/c4.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/c4.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/c4.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/c4.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/c5.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/c5.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/c5.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/frac/c5.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/1.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/1.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/1.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/1.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/2.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/2.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/2.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/2.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/3.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/3.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/3.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/3.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/4.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/4.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/4.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/4.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/5.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/5.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/5.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/5.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/6.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/6.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/6.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/6.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/c1.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/c1.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/c1.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/c1.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/c2.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/c2.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/c2.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/c2.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/c3.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/c3.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/c3.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/func/c3.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/1.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/1.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/1.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/1.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/2.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/2.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/2.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/2.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/3.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/3.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/3.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/3.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/4.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/4.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/4.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/4.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/5.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/5.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/5.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/5.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/6.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/6.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/6.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/int/6.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/large/1.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/large/1.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/large/1.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/large/1.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/large/2.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/large/2.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/large/2.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/large/2.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/large/3.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/large/3.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/large/3.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/large/3.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/other.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/other.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/other.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/other.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/1.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/1.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/1.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/1.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/2.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/2.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/2.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/2.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/3.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/3.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/3.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/3.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/4.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/4.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/4.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/4.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/c1.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/c1.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/c1.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/c1.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/c2.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/c2.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/c2.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/c2.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/c3.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/c3.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/c3.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/script/c3.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/1.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/1.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/1.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/1.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/2.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/2.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/2.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/2.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/3.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/3.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/3.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/3.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/4.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/4.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/4.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/4.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/c1.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/c1.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/c1.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/c1.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/c2.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/c2.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/c2.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/sqrt/c2.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/ys/1.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/ys/1.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/ys/1.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/ys/1.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/ys/2.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/ys/2.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/ys/2.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/ys/2.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/ys/3.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/ys/3.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/ys/3.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/images/toolbar/ys/3.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/styles/base.css b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/styles/base.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/styles/base.css rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/styles/base.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/styles/page.css b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/styles/page.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/styles/page.css rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/styles/page.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/styles/scrollbar.css b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/styles/scrollbar.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/styles/scrollbar.css rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/styles/scrollbar.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/styles/ui.css b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/styles/ui.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/styles/ui.css rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/styles/ui.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/fui.css b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/fui.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/fui.css rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/fui.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/fui.min.css b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/fui.min.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/fui.min.css rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/fui.min.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/images/close.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/images/close.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/images/close.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/images/close.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/images/down.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/images/down.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/images/down.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/images/down.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/images/open.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/images/open.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/images/open.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/images/open.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/images/up.png b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/images/up.png similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/images/up.png rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/assets/theme/default/images/up.png diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/js/jquery-3.6.0.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/js/jquery-3.6.0.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/js/jquery-3.6.0.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/js/jquery-3.6.0.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/js/kity-formula-parser.all.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/js/kity-formula-parser.all.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/js/kity-formula-parser.all.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/js/kity-formula-parser.all.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/js/kity-formula-render.all.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/js/kity-formula-render.all.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/js/kity-formula-render.all.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/js/kity-formula-render.all.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/js/kityformula-editor.all.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/js/kityformula-editor.all.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/js/kityformula-editor.all.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/js/kityformula-editor.all.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/js/kitygraph.all.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/js/kitygraph.all.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/js/kitygraph.all.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/js/kitygraph.all.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/loading.gif b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/loading.gif similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/loading.gif rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/loading.gif diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_BB.woff b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_BB.woff similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_BB.woff rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_BB.woff diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_CAL.woff b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_CAL.woff similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_CAL.woff rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_CAL.woff diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_FRAK.woff b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_FRAK.woff similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_FRAK.woff rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_FRAK.woff diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_MAIN.woff b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_MAIN.woff similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_MAIN.woff rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_MAIN.woff diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_ROMAN.woff b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_ROMAN.woff similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_ROMAN.woff rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/kityformula/resource/KF_AMS_ROMAN.woff diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/kityformula-editor/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/kityformula-editor/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/legacyoutput/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/legacyoutput/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/legacyoutput/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/legacyoutput/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/legacyoutput/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/legacyoutput/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/legacyoutput/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/legacyoutput/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/link/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/link/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/link/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/link/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/link/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/link/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/link/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/link/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/lists/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/lists/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/lists/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/lists/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/lists/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/lists/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/lists/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/lists/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/media/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/media/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/media/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/media/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/media/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/media/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/media/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/media/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/nonbreaking/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/nonbreaking/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/nonbreaking/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/nonbreaking/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/nonbreaking/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/nonbreaking/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/nonbreaking/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/nonbreaking/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/noneditable/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/noneditable/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/noneditable/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/noneditable/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/noneditable/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/noneditable/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/noneditable/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/noneditable/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/pagebreak/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/pagebreak/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/pagebreak/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/pagebreak/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/pagebreak/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/pagebreak/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/pagebreak/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/pagebreak/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/paste/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/paste/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/paste/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/paste/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/paste/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/paste/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/paste/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/paste/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/preview/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/preview/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/preview/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/preview/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/preview/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/preview/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/preview/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/preview/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/print/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/print/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/print/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/print/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/print/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/print/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/print/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/print/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/quickbars/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/quickbars/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/quickbars/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/quickbars/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/quickbars/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/quickbars/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/quickbars/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/quickbars/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/save/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/save/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/save/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/save/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/save/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/save/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/save/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/save/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/searchreplace/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/searchreplace/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/searchreplace/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/searchreplace/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/searchreplace/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/searchreplace/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/searchreplace/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/searchreplace/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/spellchecker/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/spellchecker/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/spellchecker/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/spellchecker/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/spellchecker/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/spellchecker/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/spellchecker/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/spellchecker/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/tabfocus/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/tabfocus/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/tabfocus/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/tabfocus/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/tabfocus/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/tabfocus/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/tabfocus/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/tabfocus/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/table/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/table/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/table/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/table/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/table/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/table/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/table/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/table/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/template/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/template/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/template/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/template/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/template/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/template/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/template/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/template/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/textcolor/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/textcolor/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/textcolor/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/textcolor/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/textcolor/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/textcolor/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/textcolor/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/textcolor/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/textpattern/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/textpattern/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/textpattern/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/textpattern/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/textpattern/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/textpattern/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/textpattern/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/textpattern/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/toc/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/toc/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/toc/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/toc/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/toc/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/toc/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/toc/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/toc/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/visualblocks/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/visualblocks/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/visualblocks/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/visualblocks/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/visualblocks/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/visualblocks/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/visualblocks/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/visualblocks/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/visualchars/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/visualchars/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/visualchars/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/visualchars/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/visualchars/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/visualchars/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/visualchars/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/visualchars/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/wordcount/plugin.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/wordcount/plugin.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/wordcount/plugin.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/wordcount/plugin.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/wordcount/plugin.min.js b/src/plugin/admin/public/component/pear/module/tinymce/plugins/wordcount/plugin.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/plugins/wordcount/plugin.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/plugins/wordcount/plugin.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/dark/content.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/content/dark/content.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/dark/content.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/content/dark/content.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/dark/content.min.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/content/dark/content.min.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/dark/content.min.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/content/dark/content.min.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/dark/content.min.css.map b/src/plugin/admin/public/component/pear/module/tinymce/skins/content/dark/content.min.css.map similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/dark/content.min.css.map rename to src/plugin/admin/public/component/pear/module/tinymce/skins/content/dark/content.min.css.map diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/default/content.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/content/default/content.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/default/content.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/content/default/content.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/default/content.min.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/content/default/content.min.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/default/content.min.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/content/default/content.min.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/default/content.min.css.map b/src/plugin/admin/public/component/pear/module/tinymce/skins/content/default/content.min.css.map similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/default/content.min.css.map rename to src/plugin/admin/public/component/pear/module/tinymce/skins/content/default/content.min.css.map diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/document/content.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/content/document/content.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/document/content.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/content/document/content.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/document/content.min.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/content/document/content.min.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/document/content.min.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/content/document/content.min.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/document/content.min.css.map b/src/plugin/admin/public/component/pear/module/tinymce/skins/content/document/content.min.css.map similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/document/content.min.css.map rename to src/plugin/admin/public/component/pear/module/tinymce/skins/content/document/content.min.css.map diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/writer/content.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/content/writer/content.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/writer/content.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/content/writer/content.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/writer/content.min.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/content/writer/content.min.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/writer/content.min.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/content/writer/content.min.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/writer/content.min.css.map b/src/plugin/admin/public/component/pear/module/tinymce/skins/content/writer/content.min.css.map similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/content/writer/content.min.css.map rename to src/plugin/admin/public/component/pear/module/tinymce/skins/content/writer/content.min.css.map diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/content.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/content.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/content.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/content.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/content.inline.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/content.inline.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/content.inline.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/content.inline.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/content.inline.min.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/content.inline.min.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/content.inline.min.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/content.inline.min.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/content.inline.min.css.map b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/content.inline.min.css.map similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/content.inline.min.css.map rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/content.inline.min.css.map diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/content.min.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/content.min.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/content.min.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/content.min.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/content.min.css.map b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/content.min.css.map similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/content.min.css.map rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/content.min.css.map diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/content.mobile.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/content.mobile.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/content.mobile.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/content.mobile.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/content.mobile.min.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/content.mobile.min.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/content.mobile.min.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/content.mobile.min.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/content.mobile.min.css.map b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/content.mobile.min.css.map similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/content.mobile.min.css.map rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/content.mobile.min.css.map diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/fonts/tinymce-mobile.woff b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/fonts/tinymce-mobile.woff similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/fonts/tinymce-mobile.woff rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/fonts/tinymce-mobile.woff diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/skin.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/skin.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/skin.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/skin.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/skin.min.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/skin.min.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/skin.min.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/skin.min.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/skin.min.css.map b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/skin.min.css.map similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/skin.min.css.map rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/skin.min.css.map diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/skin.mobile.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/skin.mobile.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/skin.mobile.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/skin.mobile.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/skin.mobile.min.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/skin.mobile.min.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/skin.mobile.min.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/skin.mobile.min.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/skin.mobile.min.css.map b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/skin.mobile.min.css.map similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/skin.mobile.min.css.map rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/skin.mobile.min.css.map diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/skin.shadowdom.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/skin.shadowdom.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/skin.shadowdom.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/skin.shadowdom.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css.map b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css.map similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css.map rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css.map diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/content.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/content.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/content.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/content.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/content.inline.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/content.inline.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/content.inline.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/content.inline.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/content.inline.min.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/content.inline.min.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/content.inline.min.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/content.inline.min.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/content.inline.min.css.map b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/content.inline.min.css.map similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/content.inline.min.css.map rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/content.inline.min.css.map diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/content.min.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/content.min.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/content.min.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/content.min.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/content.min.css.map b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/content.min.css.map similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/content.min.css.map rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/content.min.css.map diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/content.mobile.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/content.mobile.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/content.mobile.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/content.mobile.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/content.mobile.min.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/content.mobile.min.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/content.mobile.min.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/content.mobile.min.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/content.mobile.min.css.map b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/content.mobile.min.css.map similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/content.mobile.min.css.map rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/content.mobile.min.css.map diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/fonts/tinymce-mobile.woff b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/fonts/tinymce-mobile.woff similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/fonts/tinymce-mobile.woff rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/fonts/tinymce-mobile.woff diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/skin.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/skin.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/skin.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/skin.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/skin.min.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/skin.min.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/skin.min.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/skin.min.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/skin.min.css.map b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/skin.min.css.map similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/skin.min.css.map rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/skin.min.css.map diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/skin.mobile.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/skin.mobile.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/skin.mobile.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/skin.mobile.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/skin.mobile.min.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/skin.mobile.min.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/skin.mobile.min.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/skin.mobile.min.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/skin.mobile.min.css.map b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/skin.mobile.min.css.map similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/skin.mobile.min.css.map rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/skin.mobile.min.css.map diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/skin.shadowdom.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/skin.shadowdom.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/skin.shadowdom.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/skin.shadowdom.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/skin.shadowdom.min.css b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/skin.shadowdom.min.css similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/skin.shadowdom.min.css rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/skin.shadowdom.min.css diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/skin.shadowdom.min.css.map b/src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/skin.shadowdom.min.css.map similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/skins/ui/oxide/skin.shadowdom.min.css.map rename to src/plugin/admin/public/component/pear/module/tinymce/skins/ui/oxide/skin.shadowdom.min.css.map diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/themes/mobile/theme.js b/src/plugin/admin/public/component/pear/module/tinymce/themes/mobile/theme.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/themes/mobile/theme.js rename to src/plugin/admin/public/component/pear/module/tinymce/themes/mobile/theme.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/themes/mobile/theme.min.js b/src/plugin/admin/public/component/pear/module/tinymce/themes/mobile/theme.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/themes/mobile/theme.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/themes/mobile/theme.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/themes/silver/theme.js b/src/plugin/admin/public/component/pear/module/tinymce/themes/silver/theme.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/themes/silver/theme.js rename to src/plugin/admin/public/component/pear/module/tinymce/themes/silver/theme.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/themes/silver/theme.min.js b/src/plugin/admin/public/component/pear/module/tinymce/themes/silver/theme.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/themes/silver/theme.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/themes/silver/theme.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce.js b/src/plugin/admin/public/component/pear/module/tinymce/tinymce.js index edf993cd..aac0a417 100644 --- a/src/plugin/admin/public/component/pear/module/tinymce/tinymce.js +++ b/src/plugin/admin/public/component/pear/module/tinymce/tinymce.js @@ -1,219 +1,29786 @@ -layui.define(['jquery'],function (exports) { - var $ = layui.$ +/** + * 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 modFile = layui.cache.modules['tinymce']; - - var modPath = modFile.substr(0, modFile.lastIndexOf('.')) - - var setter = layui.setter || {} + var typeOf = function (x) { + if (x === null) { + return 'null'; + } + if (x === undefined) { + return 'undefined'; + } + var t = typeof x; + if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) { + return 'array'; + } + if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) { + return 'string'; + } + return t; + }; + var isEquatableType = function (x) { + return [ + 'undefined', + 'boolean', + 'number', + 'string', + 'function', + 'xml', + 'null' + ].indexOf(x) !== -1; + }; - var response = setter.response || {} + var sort = function (xs, compareFn) { + var clone = Array.prototype.slice.call(xs); + return clone.sort(compareFn); + }; - var plugin_filename = 'tinymce.min.js'//插件路径,不包含base_url部分 + var contramap = function (eqa, f) { + return eq(function (x, y) { + return eqa.eq(f(x), f(y)); + }); + }; + var eq = function (f) { + return { eq: f }; + }; + var tripleEq = eq(function (x, y) { + return x === y; + }); + var eqString = tripleEq; + var eqArray = function (eqa) { + return eq(function (x, y) { + if (x.length !== y.length) { + return false; + } + var len = x.length; + for (var i = 0; i < len; i++) { + if (!eqa.eq(x[i], y[i])) { + return false; + } + } + return true; + }); + }; + var eqSortedArray = function (eqa, compareFn) { + return contramap(eqArray(eqa), function (xs) { + return sort(xs, compareFn); + }); + }; + var eqRecord = function (eqa) { + return eq(function (x, y) { + var kx = Object.keys(x); + var ky = Object.keys(y); + if (!eqSortedArray(eqString).eq(kx, ky)) { + return false; + } + var len = kx.length; + for (var i = 0; i < len; i++) { + var q = kx[i]; + if (!eqa.eq(x[q], y[q])) { + return false; + } + } + return true; + }); + }; + var eqAny = eq(function (x, y) { + if (x === y) { + return true; + } + var tx = typeOf(x); + var ty = typeOf(y); + if (tx !== ty) { + return false; + } + if (isEquatableType(tx)) { + return x === y; + } else if (tx === 'array') { + return eqArray(eqAny).eq(x, y); + } else if (tx === 'object') { + return eqRecord(eqAny).eq(x, y); + } + return false; + }); - var settings = { - base_url: modPath - , relative_urls: false - , remove_script_host: true - , 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//数据正常 - } + var noop = function () { + }; + var compose = function (fa, fb) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; } - , success: function (res, succFun, failFun) {//图片上传完成回调 根据自己需要修改 - if (res[this.response.statusName] == this.response.statusCode.ok) { - succFun(res[this.response.dataName]["url"]); - } else { - failFun(res[this.response.msgName]["url"]); - } + 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; + }; + }; + var identity = function (x) { + return x; + }; + 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 not = function (f) { + return function (t) { + return !f(t); + }; + }; + var die = function (msg) { + return function () { + throw new Error(msg); + }; }; + var call = function (f) { + f(); + }; + 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 t = {}; + var typeOf$1 = 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$1(value) === type; + }; + }; + var isSimpleType = function (type) { + return function (value) { + return typeof value === type; + }; + }; + var eq$1 = function (t) { + return function (a) { + return t === a; + }; + }; + var isString = isType('string'); + var isObject = isType('object'); + var isArray = isType('array'); + var isNull = eq$1(null); + var isBoolean = isSimpleType('boolean'); + var isUndefined = eq$1(undefined); + var isNullable = function (a) { + return a === null || a === undefined; + }; + var isNonNullable = function (a) { + return !isNullable(a); + }; + var isFunction = isSimpleType('function'); + var isNumber = isSimpleType('number'); - //初始化 - t.render = function (options,callback) { + var nativeSlice = Array.prototype.slice; + var nativeIndexOf = Array.prototype.indexOf; + var nativePush = Array.prototype.push; + var rawIndexOf = function (ts, t) { + return nativeIndexOf.call(ts, t); + }; + var indexOf = function (xs, x) { + var r = rawIndexOf(xs, x); + return r === -1 ? Optional.none() : Optional.some(r); + }; + var contains = function (xs, x) { + return rawIndexOf(xs, x) > -1; + }; + 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 = 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 eachr = function (xs, f) { + for (var i = xs.length - 1; i >= 0; i--) { + var x = xs[i]; + f(x, i); + } + }; + var partition = function (xs, pred) { + var pass = []; + var fail = []; + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + var arr = pred(x, i) ? pass : fail; + arr.push(x); + } + return { + pass: pass, + fail: fail + }; + }; + 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 foldr = function (xs, f, acc) { + eachr(xs, function (x) { + acc = f(acc, x); + }); + return acc; + }; + var foldl = function (xs, f, acc) { + each(xs, function (x) { + acc = f(acc, x); + }); + return acc; + }; + 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 findIndex = function (xs, pred) { + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + if (pred(x, i)) { + return Optional.some(i); + } + } + return Optional.none(); + }; + 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 forall = function (xs, pred) { + for (var i = 0, len = xs.length; i < len; ++i) { + var x = xs[i]; + if (pred(x, i) !== true) { + return false; + } + } + return true; + }; + var reverse = function (xs) { + var r = nativeSlice.call(xs, 0); + r.reverse(); + return r; + }; + var difference = function (a1, a2) { + return filter(a1, function (x) { + return !contains(a2, x); + }); + }; + var mapToObject = function (xs, f) { + var r = {}; + for (var i = 0, len = xs.length; i < len; i++) { + var x = xs[i]; + r[String(x)] = f(x, i); + } + return r; + }; + var sort$1 = function (xs, comparator) { + var copy = nativeSlice.call(xs, 0); + copy.sort(comparator); + return copy; + }; + var get = function (xs, i) { + return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none(); + }; + var head = function (xs) { + return get(xs, 0); + }; + var last = function (xs) { + return get(xs, xs.length - 1); + }; + var from$1 = isFunction(Array.from) ? Array.from : function (x) { + return nativeSlice.call(x); + }; + var findMap = function (arr, f) { + for (var i = 0; i < arr.length; i++) { + var r = f(arr[i], i); + if (r.isSome()) { + return r; + } + } + return Optional.none(); + }; - initTinymce(); + var keys = Object.keys; + var hasOwnProperty = Object.hasOwnProperty; + 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 map$1 = function (obj, f) { + return tupleMap(obj, function (x, i) { + return { + k: i, + v: f(x, i) + }; + }); + }; + var tupleMap = function (obj, f) { + var r = {}; + each$1(obj, function (x, i) { + var tuple = f(x, i); + r[tuple.k] = tuple.v; + }); + return r; + }; + var objAcc = function (r) { + return function (x, i) { + r[i] = x; + }; + }; + var internalFilter = function (obj, pred, onTrue, onFalse) { + var r = {}; + each$1(obj, function (x, i) { + (pred(x, i) ? onTrue : onFalse)(x, i); + }); + return r; + }; + var bifilter = function (obj, pred) { + var t = {}; + var f = {}; + internalFilter(obj, pred, objAcc(t), objAcc(f)); + return { + t: t, + f: f + }; + }; + var filter$1 = function (obj, pred) { + var t = {}; + internalFilter(obj, pred, objAcc(t), noop); + return t; + }; + var mapToArray = function (obj, f) { + var r = []; + each$1(obj, function (value, name) { + r.push(f(value, name)); + }); + return r; + }; + var values = function (obj) { + return mapToArray(obj, function (v) { + return v; + }); + }; + 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 hasNonNullableKey = function (obj, key) { + return has(obj, key) && obj[key] !== undefined && obj[key] !== null; + }; + var equal = function (a1, a2, eq) { + if (eq === void 0) { + eq = eqAny; + } + return eqRecord(eq).eq(a1, a2); + }; - var option = initOptions(options,callback) + var isArray$1 = Array.isArray; + var toArray = function (obj) { + if (!isArray$1(obj)) { + var array = []; + for (var i = 0, l = obj.length; i < l; i++) { + array[i] = obj[i]; + } + return array; + } else { + return obj; + } + }; + var each$2 = function (o, cb, s) { + var n, l; + if (!o) { + return false; + } + s = s || o; + if (o.length !== undefined) { + for (n = 0, l = o.length; n < l; n++) { + if (cb.call(s, o[n], n, o) === false) { + return false; + } + } + } else { + for (n in o) { + if (o.hasOwnProperty(n)) { + if (cb.call(s, o[n], n, o) === false) { + return false; + } + } + } + } + return true; + }; + var map$2 = function (array, callback) { + var out = []; + each$2(array, function (item, index) { + out.push(callback(item, index, array)); + }); + return out; + }; + var filter$2 = function (a, f) { + var o = []; + each$2(a, function (v, index) { + if (!f || f(v, index, a)) { + o.push(v); + } + }); + return o; + }; + var indexOf$1 = function (a, v) { + if (a) { + for (var i = 0, l = a.length; i < l; i++) { + if (a[i] === v) { + return i; + } + } + } + return -1; + }; + var reduce = function (collection, iteratee, accumulator, thisArg) { + var acc = isUndefined(accumulator) ? collection[0] : accumulator; + for (var i = 0; i < collection.length; i++) { + acc = iteratee.call(thisArg, acc, collection[i], i); + } + return acc; + }; + var findIndex$1 = function (array, predicate, thisArg) { + var i, l; + for (i = 0, l = array.length; i < l; i++) { + if (predicate.call(thisArg, array[i], i, array)) { + return i; + } + } + return -1; + }; + var last$1 = function (collection) { + return collection[collection.length - 1]; + }; - ,edit = t.get(option.elem); + 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); + }; + function __rest(s, e) { + var t = {}; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === 'function') + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + } + function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) + s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + } - if (edit) { - edit.destroy(); + var cached = function (f) { + var called = false; + var r; + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; } + if (!called) { + called = true; + r = f.apply(null, args); + } + return r; + }; + }; - tinymce.init(option); + var DeviceType = function (os, browser, userAgent, mediaMatch) { + var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true; + var isiPhone = os.isiOS() && !isiPad; + var isMobile = os.isiOS() || os.isAndroid(); + var isTouch = isMobile || mediaMatch('(pointer:coarse)'); + var isTablet = isiPad || !isiPhone && isMobile && mediaMatch('(min-device-width:768px)'); + var isPhone = isiPhone || isMobile && !isTablet; + var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false; + var isDesktop = !isPhone && !isTablet && !iOSwebview; + return { + isiPad: constant(isiPad), + isiPhone: constant(isiPhone), + isTablet: constant(isTablet), + isPhone: constant(isPhone), + isTouch: constant(isTouch), + isAndroid: os.isAndroid, + isiOS: os.isiOS, + isWebView: constant(iOSwebview), + isDesktop: constant(isDesktop) + }; + }; - return t.get(option.elem); + var firstMatch = function (regexes, s) { + for (var i = 0; i < regexes.length; i++) { + var x = regexes[i]; + if (x.test(s)) { + return x; + } + } + return undefined; + }; + var find$1 = function (regexes, agent) { + var r = firstMatch(regexes, agent); + if (!r) { + return { + major: 0, + minor: 0 + }; + } + var group = function (i) { + return Number(agent.replace(r, '$' + i)); + }; + return nu(group(1), group(2)); + }; + var detect = function (versionRegexes, agent) { + var cleanedAgent = String(agent).toLowerCase(); + if (versionRegexes.length === 0) { + return unknown(); + } + return find$1(versionRegexes, cleanedAgent); + }; + var unknown = function () { + return nu(0, 0); + }; + var nu = function (major, minor) { + return { + major: major, + minor: minor + }; + }; + var Version = { + nu: nu, + detect: detect, + unknown: unknown }; - t.init = t.render + var detect$1 = function (candidates, userAgent) { + var agent = String(userAgent).toLowerCase(); + return find(candidates, function (candidate) { + return candidate.search(agent); + }); + }; + var detectBrowser = function (browsers, userAgent) { + return detect$1(browsers, userAgent).map(function (browser) { + var version = Version.detect(browser.versionRegexes, userAgent); + return { + current: browser.name, + version: version + }; + }); + }; + var detectOs = function (oses, userAgent) { + return detect$1(oses, userAgent).map(function (os) { + var version = Version.detect(os.versionRegexes, userAgent); + return { + current: os.name, + version: version + }; + }); + }; + var UaString = { + detectBrowser: detectBrowser, + detectOs: detectOs + }; - // 获取ID对应的编辑器对象 - t.get = function (elem) { + var removeFromStart = function (str, numChars) { + return str.substring(numChars); + }; - initTinymce(); + var checkRange = function (str, substr, start) { + return substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr; + }; + var removeLeading = function (str, prefix) { + return startsWith(str, prefix) ? removeFromStart(str, prefix.length) : str; + }; + var contains$1 = function (str, substr) { + return str.indexOf(substr) !== -1; + }; + var startsWith = function (str, prefix) { + return checkRange(str, prefix, 0); + }; + var blank = function (r) { + return function (s) { + return s.replace(r, ''); + }; + }; + var trim = blank(/^\s+|\s+$/g); + var lTrim = blank(/^\s+/g); + var rTrim = blank(/\s+$/g); - if (elem && /^#|\./.test(elem)) { - var id = elem.substr(1); - var edit = tinymce.editors[id]; - return edit - } else { - return false; + var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/; + var checkContains = function (target) { + return function (uastring) { + return contains$1(uastring, target); + }; + }; + var browsers = [ + { + name: 'Edge', + versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/], + search: function (uastring) { + return contains$1(uastring, 'edge/') && contains$1(uastring, 'chrome') && contains$1(uastring, 'safari') && contains$1(uastring, 'applewebkit'); } - } - - //重载 - 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 - } + }, + { + name: 'Chrome', + versionRegexes: [ + /.*?chrome\/([0-9]+)\.([0-9]+).*/, + normalVersionRegex + ], + search: function (uastring) { + return contains$1(uastring, 'chrome') && !contains$1(uastring, 'chromeframe'); + } + }, + { + name: 'IE', + versionRegexes: [ + /.*?msie\ ?([0-9]+)\.([0-9]+).*/, + /.*?rv:([0-9]+)\.([0-9]+).*/ + ], + search: function (uastring) { + return contains$1(uastring, 'msie') || contains$1(uastring, 'trident'); + } + }, + { + name: 'Opera', + versionRegexes: [ + normalVersionRegex, + /.*?opera\/([0-9]+)\.([0-9]+).*/ + ], + search: checkContains('opera') + }, + { + name: 'Firefox', + versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/], + search: checkContains('firefox') + }, + { + name: 'Safari', + versionRegexes: [ + normalVersionRegex, + /.*?cpu os ([0-9]+)_([0-9]+).*/ + ], + search: function (uastring) { + return (contains$1(uastring, 'safari') || contains$1(uastring, 'mobile/')) && contains$1(uastring, 'applewebkit'); + } + } + ]; + var oses = [ + { + name: 'Windows', + search: checkContains('win'), + versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/] + }, + { + name: 'iOS', + search: function (uastring) { + return contains$1(uastring, 'iphone') || contains$1(uastring, 'ipad'); + }, + versionRegexes: [ + /.*?version\/\ ?([0-9]+)\.([0-9]+).*/, + /.*cpu os ([0-9]+)_([0-9]+).*/, + /.*cpu iphone os ([0-9]+)_([0-9]+).*/ + ] + }, + { + name: 'Android', + search: checkContains('android'), + versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/] + }, + { + name: 'OSX', + search: checkContains('mac os x'), + versionRegexes: [/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/] + }, + { + name: 'Linux', + search: checkContains('linux'), + versionRegexes: [] + }, + { + name: 'Solaris', + search: checkContains('sunos'), + versionRegexes: [] + }, + { + name: 'FreeBSD', + search: checkContains('freebsd'), + versionRegexes: [] + }, + { + name: 'ChromeOS', + search: checkContains('cros'), + versionRegexes: [/.*?chrome\/([0-9]+)\.([0-9]+).*/] + } + ]; + var PlatformInfo = { + browsers: constant(browsers), + oses: constant(oses) + }; - var optionCache = layui.sessionData('layui-tinymce')[options.elem] + var edge = 'Edge'; + var chrome = 'Chrome'; + var ie = 'IE'; + var opera = 'Opera'; + var firefox = 'Firefox'; + var safari = 'Safari'; + var unknown$1 = function () { + return nu$1({ + current: undefined, + version: Version.unknown() + }); + }; + var nu$1 = function (info) { + var current = info.current; + var version = info.version; + var isBrowser = function (name) { + return function () { + return current === name; + }; + }; + return { + current: current, + version: version, + isEdge: isBrowser(edge), + isChrome: isBrowser(chrome), + isIE: isBrowser(ie), + isOpera: isBrowser(opera), + isFirefox: isBrowser(firefox), + isSafari: isBrowser(safari) + }; + }; + var Browser = { + unknown: unknown$1, + nu: nu$1, + edge: constant(edge), + chrome: constant(chrome), + ie: constant(ie), + opera: constant(opera), + firefox: constant(firefox), + safari: constant(safari) + }; - delete optionCache.init_instance_callback + var windows = 'Windows'; + var ios = 'iOS'; + var android = 'Android'; + var linux = 'Linux'; + var osx = 'OSX'; + var solaris = 'Solaris'; + var freebsd = 'FreeBSD'; + var chromeos = 'ChromeOS'; + var unknown$2 = function () { + return nu$2({ + current: undefined, + version: Version.unknown() + }); + }; + var nu$2 = function (info) { + var current = info.current; + var version = info.version; + var isOS = function (name) { + return function () { + return current === name; + }; + }; + return { + current: current, + version: version, + isWindows: isOS(windows), + isiOS: isOS(ios), + isAndroid: isOS(android), + isOSX: isOS(osx), + isLinux: isOS(linux), + isSolaris: isOS(solaris), + isFreeBSD: isOS(freebsd), + isChromeOS: isOS(chromeos) + }; + }; + var OperatingSystem = { + unknown: unknown$2, + nu: nu$2, + windows: constant(windows), + ios: constant(ios), + android: constant(android), + linux: constant(linux), + osx: constant(osx), + solaris: constant(solaris), + freebsd: constant(freebsd), + chromeos: constant(chromeos) + }; - $.extend(optionCache,options) + var detect$2 = function (userAgent, mediaMatch) { + var browsers = PlatformInfo.browsers(); + var oses = PlatformInfo.oses(); + var browser = UaString.detectBrowser(browsers, userAgent).fold(Browser.unknown, Browser.nu); + var os = UaString.detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu); + var deviceType = DeviceType(os, browser, userAgent, mediaMatch); + return { + browser: browser, + os: os, + deviceType: deviceType + }; + }; + var PlatformDetection = { detect: detect$2 }; - return t.render(optionCache,callback) - } + var mediaMatch = function (query) { + return window.matchMedia(query).matches; + }; + var platform = cached(function () { + return PlatformDetection.detect(navigator.userAgent, mediaMatch); + }); + var detect$3 = function () { + return platform(); + }; - function initOptions(option,callback) { - - var admin = layui.admin || {} + var userAgent = navigator.userAgent; + var platform$1 = detect$3(); + var browser = platform$1.browser; + var os = platform$1.os; + var deviceType = platform$1.deviceType; + var webkit = /WebKit/.test(userAgent) && !browser.isEdge(); + var fileApi = 'FormData' in window && 'FileReader' in window && 'URL' in window && !!URL.createObjectURL; + var windowsPhone = userAgent.indexOf('Windows Phone') !== -1; + var Env = { + opera: browser.isOpera(), + webkit: webkit, + ie: browser.isIE() || browser.isEdge() ? browser.version.major : false, + gecko: browser.isFirefox(), + mac: os.isOSX() || os.isiOS(), + iOS: deviceType.isiPad() || deviceType.isiPhone(), + android: os.isAndroid(), + contentEditable: true, + transparentSrc: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7', + caretAfter: true, + range: window.getSelection && 'Range' in window, + documentMode: browser.isIE() ? document.documentMode || 7 : 10, + fileApi: fileApi, + ceFalse: true, + cacheSuffix: null, + container: null, + experimentalShadowDom: false, + canHaveCSP: !browser.isIE(), + desktop: deviceType.isDesktop(), + windowsPhone: windowsPhone, + browser: { + current: browser.current, + version: browser.version, + isChrome: browser.isChrome, + isEdge: browser.isEdge, + isFirefox: browser.isFirefox, + isIE: browser.isIE, + isOpera: browser.isOpera, + isSafari: browser.isSafari + }, + os: { + current: os.current, + version: os.version, + isAndroid: os.isAndroid, + isChromeOS: os.isChromeOS, + isFreeBSD: os.isFreeBSD, + isiOS: os.isiOS, + isLinux: os.isLinux, + isOSX: os.isOSX, + isSolaris: os.isSolaris, + isWindows: os.isWindows + }, + deviceType: { + isDesktop: deviceType.isDesktop, + isiPad: deviceType.isiPad, + isiPhone: deviceType.isiPhone, + isPhone: deviceType.isPhone, + isTablet: deviceType.isTablet, + isTouch: deviceType.isTouch, + isWebView: deviceType.isWebView + } + }; - var form = option.form || {} + var whiteSpaceRegExp = /^\s*|\s*$/g; + var trim$1 = function (str) { + return str === null || str === undefined ? '' : ('' + str).replace(whiteSpaceRegExp, ''); + }; + var is = function (obj, type) { + if (!type) { + return obj !== undefined; + } + if (type === 'array' && isArray$1(obj)) { + return true; + } + return typeof obj === type; + }; + var makeMap = function (items, delim, map) { + var i; + items = items || []; + delim = delim || ','; + if (typeof items === 'string') { + items = items.split(delim); + } + map = map || {}; + i = items.length; + while (i--) { + map[items[i]] = {}; + } + return map; + }; + var hasOwnProperty$1 = function (obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); + }; + var create = function (s, p, root) { + var self = this; + var sp, scn, c, de = 0; + s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s); + var cn = s[3].match(/(^|\.)(\w+)$/i)[2]; + var ns = self.createNS(s[3].replace(/\.\w+$/, ''), root); + if (ns[cn]) { + return; + } + if (s[2] === 'static') { + ns[cn] = p; + if (this.onCreate) { + this.onCreate(s[2], s[3], ns[cn]); + } + return; + } + if (!p[cn]) { + p[cn] = function () { + }; + de = 1; + } + ns[cn] = p[cn]; + self.extend(ns[cn].prototype, p); + if (s[5]) { + sp = self.resolve(s[5]).prototype; + scn = s[5].match(/\.(\w+)$/i)[1]; + c = ns[cn]; + if (de) { + ns[cn] = function () { + return sp[scn].apply(this, arguments); + }; + } else { + ns[cn] = function () { + this.parent = sp[scn]; + return c.apply(this, arguments); + }; + } + ns[cn].prototype[cn] = ns[cn]; + self.each(sp, function (f, n) { + ns[cn].prototype[n] = sp[n]; + }); + self.each(p, function (f, n) { + if (sp[n]) { + ns[cn].prototype[n] = function () { + this.parent = sp[n]; + return f.apply(this, arguments); + }; + } else { + if (n !== cn) { + ns[cn].prototype[n] = f; + } + } + }); + } + self.each(p.static, function (f, n) { + ns[cn][n] = f; + }); + }; + var extend = function (obj) { + var exts = []; + for (var _i = 1; _i < arguments.length; _i++) { + exts[_i - 1] = arguments[_i]; + } + for (var i = 0; i < exts.length; i++) { + var ext = exts[i]; + for (var name_1 in ext) { + if (ext.hasOwnProperty(name_1)) { + var value = ext[name_1]; + if (value !== undefined) { + obj[name_1] = value; + } + } + } + } + return obj; + }; + var walk = function (o, f, n, s) { + s = s || this; + if (o) { + if (n) { + o = o[n]; + } + each$2(o, function (o, i) { + if (f.call(s, o, i, n) === false) { + return false; + } + walk(o, f, n, s); + }); + } + }; + var createNS = function (n, o) { + var i, v; + o = o || window; + n = n.split('.'); + for (i = 0; i < n.length; i++) { + v = n[i]; + if (!o[v]) { + o[v] = {}; + } + o = o[v]; + } + return o; + }; + var resolve = function (n, o) { + var i, l; + o = o || window; + n = n.split('.'); + for (i = 0, l = n.length; i < l; i++) { + o = o[n[i]]; + if (!o) { + break; + } + } + return o; + }; + var explode = function (s, d) { + if (!s || is(s, 'array')) { + return s; + } + return map$2(s.split(d || ','), trim$1); + }; + var _addCacheSuffix = function (url) { + var cacheSuffix = Env.cacheSuffix; + if (cacheSuffix) { + url += (url.indexOf('?') === -1 ? '?' : '&') + cacheSuffix; + } + return url; + }; + var Tools = { + trim: trim$1, + isArray: isArray$1, + is: is, + toArray: toArray, + makeMap: makeMap, + each: each$2, + map: map$2, + grep: filter$2, + inArray: indexOf$1, + hasOwn: hasOwnProperty$1, + extend: extend, + create: create, + walk: walk, + createNS: createNS, + resolve: resolve, + explode: explode, + _addCacheSuffix: _addCacheSuffix + }; - var file_field = form.name || 'edit' //文件字段名 + 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 form_data = form.data || {} //其他表单数据 {key:value, ...} + var toArray$1 = function (target, f) { + var r = []; + var recurse = function (e) { + r.push(e); + return f(e); + }; + var cur = f(target); + do { + cur = cur.bind(recurse); + } while (cur.isSome()); + return r; + }; - option.suffix= isset(option.suffix) ? option.suffix : (plugin_filename.indexOf('.min')>-1 ? '.min' : '') + var compareDocumentPosition = function (a, b, match) { + return (a.compareDocumentPosition(b) & match) !== 0; + }; + var documentPositionContainedBy = function (a, b) { + return compareDocumentPosition(a, b, Node.DOCUMENT_POSITION_CONTAINED_BY); + }; - option.base_url = isset(option.base_url) ? option.base_url : settings.base_url + var COMMENT = 8; + var DOCUMENT = 9; + var DOCUMENT_FRAGMENT = 11; + var ELEMENT = 1; + var TEXT = 3; - option.relative_urls = isset(option.relative_urls) ? option.relative_urls : settings.relative_urls + var is$1 = 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 one = function (selector, scope) { + var base = scope === undefined ? document : scope.dom; + return bypassSelector(base) ? Optional.none() : Optional.from(base.querySelector(selector)).map(SugarElement.fromDom); + }; - option.remove_script_host = isset(option.remove_script_host) ? option.remove_script_host : settings.remove_script_host + var eq$2 = function (e1, e2) { + return e1.dom === e2.dom; + }; + var regularContains = function (e1, e2) { + var d1 = e1.dom; + var d2 = e2.dom; + return d1 === d2 ? false : d1.contains(d2); + }; + var ieContains = function (e1, e2) { + return documentPositionContainedBy(e1.dom, e2.dom); + }; + var contains$2 = function (e1, e2) { + return detect$3().browser.isIE() ? ieContains(e1, e2) : regularContains(e1, e2); + }; - option.language = isset(option.language) ? option.language : settings.language + var Global = typeof window !== 'undefined' ? window : Function('return this;')(); - option.selector = isset(option.selector) ? option.selector : option.elem + var name = function (element) { + var r = element.dom.nodeName; + return r.toLowerCase(); + }; + var type = function (element) { + return element.dom.nodeType; + }; + var isType$1 = function (t) { + return function (element) { + return type(element) === t; + }; + }; + var isComment = function (element) { + return type(element) === COMMENT || name(element) === '#comment'; + }; + var isElement = isType$1(ELEMENT); + var isText = isType$1(TEXT); + var isDocument = isType$1(DOCUMENT); + var isDocumentFragment = isType$1(DOCUMENT_FRAGMENT); - option.quickbars_selection_toolbar = isset(option.quickbars_selection_toolbar) ? option.quickbars_selection_toolbar : 'cut copy | bold italic underline strikethrough ' + var owner = function (element) { + return SugarElement.fromDom(element.dom.ownerDocument); + }; + var documentOrOwner = function (dos) { + return isDocument(dos) ? dos : owner(dos); + }; + var documentElement = function (element) { + return SugarElement.fromDom(documentOrOwner(element).dom.documentElement); + }; + var defaultView = function (element) { + return SugarElement.fromDom(documentOrOwner(element).dom.defaultView); + }; + 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$2(element, x); + }); + }; + return parent(element).map(children).map(filterSelf).getOr([]); + }; + var prevSibling = function (element) { + return Optional.from(element.dom.previousSibling).map(SugarElement.fromDom); + }; + var nextSibling = function (element) { + return Optional.from(element.dom.nextSibling).map(SugarElement.fromDom); + }; + var prevSiblings = function (element) { + return reverse(toArray$1(element, prevSibling)); + }; + var nextSiblings = function (element) { + return toArray$1(element, nextSibling); + }; + var children = function (element) { + return map(element.dom.childNodes, SugarElement.fromDom); + }; + var child = function (element, index) { + var cs = element.dom.childNodes; + return Optional.from(cs[index]).map(SugarElement.fromDom); + }; + var firstChild = function (element) { + return child(element, 0); + }; + var lastChild = function (element) { + return child(element, element.dom.childNodes.length - 1); + }; + var childNodesCount = function (element) { + return element.dom.childNodes.length; + }; - 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'; + var getHead = function (doc) { + var b = doc.dom.head; + if (b === null || b === undefined) { + throw new Error('Head is not available yet'); + } + return SugarElement.fromDom(b); + }; - 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'; + var isShadowRoot = function (dos) { + return isDocumentFragment(dos); + }; + var supported = isFunction(Element.prototype.attachShadow) && isFunction(Node.prototype.getRootNode); + var isSupported = constant(supported); + var getRootNode = supported ? function (e) { + return SugarElement.fromDom(e.dom.getRootNode()); + } : documentOrOwner; + var getStyleContainer = function (dos) { + return isShadowRoot(dos) ? dos : getHead(documentOrOwner(dos)); + }; + 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() && 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); + }; - option.resize = isset(option.resize) ? option.resize : false; + var before = function (marker, element) { + var parent$1 = parent(marker); + parent$1.each(function (v) { + v.dom.insertBefore(element.dom, marker.dom); + }); + }; + var after = function (marker, element) { + var sibling = nextSibling(marker); + sibling.fold(function () { + var parent$1 = parent(marker); + parent$1.each(function (v) { + append(v, element); + }); + }, function (v) { + before(v, element); + }); + }; + var prepend = function (parent, element) { + var firstChild$1 = firstChild(parent); + firstChild$1.fold(function () { + append(parent, element); + }, function (v) { + parent.dom.insertBefore(element.dom, v.dom); + }); + }; + var append = function (parent, element) { + parent.dom.appendChild(element.dom); + }; + var wrap = function (element, wrapper) { + before(element, wrapper); + append(wrapper, element); + }; - option.elementpath = isset(option.elementpath) ? option.elementpath : false; + var before$1 = function (marker, elements) { + each(elements, function (x) { + before(marker, x); + }); + }; + var append$1 = function (parent, elements) { + each(elements, function (x) { + append(parent, x); + }); + }; - option.branding = isset(option.branding) ? option.branding : false; + var empty = function (element) { + element.dom.textContent = ''; + each(children(element), function (rogue) { + remove(rogue); + }); + }; + var remove = function (element) { + var dom = element.dom; + if (dom.parentNode !== null) { + dom.parentNode.removeChild(dom); + } + }; + var unwrap = function (wrapper) { + var children$1 = children(wrapper); + if (children$1.length > 0) { + before$1(wrapper, children$1); + } + remove(wrapper); + }; - option.contextmenu_never_use_native = isset(option.contextmenu_never_use_native) ? option.contextmenu_never_use_native : true; + 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)); + }; - option.menubar = isset(option.menubar) ? option.menubar : 'file edit insert format table'; + 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; - 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'}, - }; + var boxPosition = function (dom) { + var box = dom.getBoundingClientRect(); + return SugarPosition(box.left, box.top); + }; + var firstDefinedOrZero = function (a, b) { + if (a !== undefined) { + return a; + } else { + return b !== undefined ? b : 0; + } + }; + var absolute = function (element) { + var doc = element.dom.ownerDocument; + var body = doc.body; + var win = doc.defaultView; + var html = doc.documentElement; + if (body === element.dom) { + return SugarPosition(body.offsetLeft, body.offsetTop); + } + var scrollTop = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageYOffset, html.scrollTop); + var scrollLeft = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageXOffset, html.scrollLeft); + var clientTop = firstDefinedOrZero(html.clientTop, body.clientTop); + var clientLeft = firstDefinedOrZero(html.clientLeft, body.clientLeft); + return viewport(element).translate(scrollLeft - clientLeft, scrollTop - clientTop); + }; + var viewport = function (element) { + var dom = element.dom; + var doc = dom.ownerDocument; + var body = doc.body; + if (body === dom) { + return SugarPosition(body.offsetLeft, body.offsetTop); + } + if (!inBody(element)) { + return SugarPosition(0, 0); + } + return boxPosition(dom); + }; - option.init_instance_callback =isset(option.init_instance_callback) ? option.init_instance_callback : function(inst) { - if(typeof callback == 'function') callback(option,inst) - }; + var get$2 = 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 to = function (x, y, _DOC) { + var doc = _DOC !== undefined ? _DOC.dom : document; + var win = doc.defaultView; + if (win) { + win.scrollTo(x, y); + } + }; + var intoView = function (element, alignToTop) { + var isSafari = detect$3().browser.isSafari(); + if (isSafari && isFunction(element.dom.scrollIntoViewIfNeeded)) { + element.dom.scrollIntoViewIfNeeded(false); + } else { + element.dom.scrollIntoView(alignToTop); + } + }; - option.images_upload_url = isset(option.images_upload_url) ? option.images_upload_url : settings.images_upload_url; + var get$3 = 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$2(SugarElement.fromDom(doc)); + return get$3(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); + }); + }; - 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 isNodeType = function (type) { + return function (node) { + return !!node && node.nodeType === type; + }; + }; + var isRestrictedNode = function (node) { + return !!node && !Object.getPrototypeOf(node); + }; + var isElement$1 = isNodeType(1); + var matchNodeNames = function (names) { + var lowercasedNames = names.map(function (s) { + return s.toLowerCase(); + }); + return function (node) { + if (node && node.nodeName) { + var nodeName = node.nodeName.toLowerCase(); + return contains(lowercasedNames, nodeName); + } + return false; + }; + }; + var matchStyleValues = function (name, values) { + var items = values.toLowerCase().split(' '); + return function (node) { + var i, cssValue; + if (isElement$1(node)) { + for (i = 0; i < items.length; i++) { + var computed = node.ownerDocument.defaultView.getComputedStyle(node, null); + cssValue = computed ? computed.getPropertyValue(name) : null; + if (cssValue === items[i]) { + return true; } - 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); + } + } + return false; + }; + }; + var hasAttribute = function (attrName) { + return function (node) { + return isElement$1(node) && node.hasAttribute(attrName); + }; + }; + var hasAttributeValue = function (attrName, attrValue) { + return function (node) { + return isElement$1(node) && node.getAttribute(attrName) === attrValue; + }; + }; + var isBogus = function (node) { + return isElement$1(node) && node.hasAttribute('data-mce-bogus'); + }; + var isBogusAll = function (node) { + return isElement$1(node) && node.getAttribute('data-mce-bogus') === 'all'; + }; + var isTable = function (node) { + return isElement$1(node) && node.tagName === 'TABLE'; + }; + var hasContentEditableState = function (value) { + return function (node) { + if (isElement$1(node)) { + if (node.contentEditable === value) { + return true; + } + if (node.getAttribute('data-mce-contenteditable') === value) { + return true; + } + } + return false; + }; + }; + var isTextareaOrInput = matchNodeNames([ + 'textarea', + 'input' + ]); + var isText$1 = isNodeType(3); + var isComment$1 = isNodeType(8); + var isDocument$1 = isNodeType(9); + var isDocumentFragment$1 = isNodeType(11); + var isBr = matchNodeNames(['br']); + var isImg = matchNodeNames(['img']); + var isContentEditableTrue = hasContentEditableState('true'); + var isContentEditableFalse = hasContentEditableState('false'); + var isTableCell = matchNodeNames([ + 'td', + 'th' + ]); + var isMedia = matchNodeNames([ + 'video', + 'audio', + 'object', + 'embed' + ]); + + var isSupported$1 = function (dom) { + return dom.style !== undefined && isFunction(dom.style.getPropertyValue); + }; + + 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 setAll = function (element, attrs) { + var dom = element.dom; + each$1(attrs, function (v, k) { + rawSet(dom, k, v); + }); + }; + var get$4 = function (element, key) { + var v = element.dom.getAttribute(key); + return v === null ? undefined : v; + }; + var getOpt = function (element, key) { + return Optional.from(get$4(element, key)); + }; + var has$1 = function (element, key) { + var dom = element.dom; + return dom && dom.hasAttribute ? dom.hasAttribute(key) : false; + }; + var remove$1 = function (element, key) { + element.dom.removeAttribute(key); + }; + var clone = function (element) { + return foldl(element.dom.attributes, function (acc, attr) { + acc[attr.name] = attr.value; + return acc; + }, {}); + }; + + 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$1(dom)) { + dom.style.setProperty(property, value); + } + }; + var setAll$1 = function (element, css) { + var dom = element.dom; + each$1(css, function (v, k) { + internalSet(dom, k, v); + }); + }; + var get$5 = 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$1(dom) ? dom.style.getPropertyValue(property) : ''; + }; + var getRaw = function (element, property) { + var dom = element.dom; + var raw = getUnsafeProperty(dom, property); + return Optional.from(raw).filter(function (r) { + return r.length > 0; + }); + }; + var getAllRaw = function (element) { + var css = {}; + var dom = element.dom; + if (isSupported$1(dom)) { + for (var i = 0; i < dom.style.length; i++) { + var ruleName = dom.style.item(i); + css[ruleName] = dom.style[ruleName]; + } + } + return css; + }; + var reflow = function (e) { + return e.dom.offsetWidth; + }; + + var browser$1 = detect$3().browser; + var firstElement = function (nodes) { + return find(nodes, isElement); + }; + var getTableCaptionDeltaY = function (elm) { + if (browser$1.isFirefox() && name(elm) === 'table') { + return firstElement(children(elm)).filter(function (elm) { + return name(elm) === 'caption'; + }).bind(function (caption) { + return firstElement(nextSiblings(caption)).map(function (body) { + var bodyTop = body.dom.offsetTop; + var captionTop = caption.dom.offsetTop; + var captionHeight = caption.dom.offsetHeight; + return bodyTop <= captionTop ? -captionHeight : 0; + }); + }).getOr(0); + } else { + return 0; + } + }; + var hasChild = function (elm, child) { + return elm.children && contains(elm.children, child); + }; + var getPos = function (body, elm, rootElm) { + var x = 0, y = 0, offsetParent; + var doc = body.ownerDocument; + var pos; + rootElm = rootElm ? rootElm : body; + if (elm) { + if (rootElm === body && elm.getBoundingClientRect && get$5(SugarElement.fromDom(body), 'position') === 'static') { + pos = elm.getBoundingClientRect(); + x = pos.left + (doc.documentElement.scrollLeft || body.scrollLeft) - doc.documentElement.clientLeft; + y = pos.top + (doc.documentElement.scrollTop || body.scrollTop) - doc.documentElement.clientTop; + return { + x: x, + y: y + }; + } + offsetParent = elm; + while (offsetParent && offsetParent !== rootElm && offsetParent.nodeType && !hasChild(offsetParent, rootElm)) { + x += offsetParent.offsetLeft || 0; + y += offsetParent.offsetTop || 0; + offsetParent = offsetParent.offsetParent; + } + offsetParent = elm.parentNode; + while (offsetParent && offsetParent !== rootElm && offsetParent.nodeType && !hasChild(offsetParent, rootElm)) { + x -= offsetParent.scrollLeft || 0; + y -= offsetParent.scrollTop || 0; + offsetParent = offsetParent.parentNode; + } + y += getTableCaptionDeltaY(SugarElement.fromDom(elm)); + } + return { + x: x, + y: y + }; + }; + + var exports$1 = {}, module$1 = { exports: exports$1 }; + (function (define, exports, module, require) { + (function (f) { + if (typeof exports === 'object' && typeof module !== 'undefined') { + module.exports = f(); + } else if (typeof define === 'function' && define.amd) { + define([], f); + } else { + var g; + if (typeof window !== 'undefined') { + g = window; + } else if (typeof global !== 'undefined') { + g = global; + } else if (typeof self !== 'undefined') { + g = self; + } else { + g = this; + } + g.EphoxContactWrapper = f(); + } + }(function () { + return function () { + function r(e, n, t) { + function o(i, f) { + if (!n[i]) { + if (!e[i]) { + var c = 'function' == typeof require && require; + if (!f && c) + return c(i, !0); + if (u) + return u(i, !0); + var a = new Error('Cannot find module \'' + i + '\''); + throw a.code = 'MODULE_NOT_FOUND', a; + } + var p = n[i] = { exports: {} }; + e[i][0].call(p.exports, function (r) { + var n = e[i][1][r]; + return o(n || r); + }, p, p.exports, r, e, n, t); + } + return n[i].exports; + } + for (var u = 'function' == typeof require && require, i = 0; i < t.length; i++) + o(t[i]); + return o; + } + return r; + }()({ + 1: [ + function (require, module, exports) { + var process = module.exports = {}; + var cachedSetTimeout; + var cachedClearTimeout; + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + function defaultClearTimeout() { + throw new Error('clearTimeout has not been defined'); + } + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + }()); + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + return setTimeout(fun, 0); + } + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + return cachedSetTimeout(fun, 0); + } catch (e) { + try { + return cachedSetTimeout.call(null, fun, 0); + } catch (e) { + return cachedSetTimeout.call(this, fun, 0); + } + } + } + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + return clearTimeout(marker); + } + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + return cachedClearTimeout(marker); + } catch (e) { + try { + return cachedClearTimeout.call(null, marker); + } catch (e) { + return cachedClearTimeout.call(this, marker); + } + } + } + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } + } + function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + var len = queue.length; + while (len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; + process.versions = {}; + function noop() { + } + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + process.prependListener = noop; + process.prependOnceListener = noop; + process.listeners = function (name) { + return []; + }; + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + process.cwd = function () { + return '/'; + }; + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + process.umask = function () { + return 0; + }; + }, + {} + ], + 2: [ + function (require, module, exports) { + (function (setImmediate) { + (function (root) { + var setTimeoutFunc = setTimeout; + function noop() { + } + function bind(fn, thisArg) { + return function () { + fn.apply(thisArg, arguments); + }; + } + function Promise(fn) { + if (typeof this !== 'object') + throw new TypeError('Promises must be constructed via new'); + if (typeof fn !== 'function') + throw new TypeError('not a function'); + this._state = 0; + this._handled = false; + this._value = undefined; + this._deferreds = []; + doResolve(fn, this); + } + function handle(self, deferred) { + while (self._state === 3) { + self = self._value; + } + if (self._state === 0) { + self._deferreds.push(deferred); + return; + } + self._handled = true; + Promise._immediateFn(function () { + var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected; + if (cb === null) { + (self._state === 1 ? resolve : reject)(deferred.promise, self._value); + return; + } + var ret; + try { + ret = cb(self._value); + } catch (e) { + reject(deferred.promise, e); + return; + } + resolve(deferred.promise, ret); + }); + } + function resolve(self, newValue) { + try { + if (newValue === self) + throw new TypeError('A promise cannot be resolved with itself.'); + if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) { + var then = newValue.then; + if (newValue instanceof Promise) { + self._state = 3; + self._value = newValue; + finale(self); + return; + } else if (typeof then === 'function') { + doResolve(bind(then, newValue), self); + return; + } + } + self._state = 1; + self._value = newValue; + finale(self); + } catch (e) { + reject(self, e); + } + } + function reject(self, newValue) { + self._state = 2; + self._value = newValue; + finale(self); + } + function finale(self) { + if (self._state === 2 && self._deferreds.length === 0) { + Promise._immediateFn(function () { + if (!self._handled) { + Promise._unhandledRejectionFn(self._value); + } + }); + } + for (var i = 0, len = self._deferreds.length; i < len; i++) { + handle(self, self._deferreds[i]); + } + self._deferreds = null; + } + function Handler(onFulfilled, onRejected, promise) { + this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; + this.onRejected = typeof onRejected === 'function' ? onRejected : null; + this.promise = promise; + } + function doResolve(fn, self) { + var done = false; + try { + fn(function (value) { + if (done) + return; + done = true; + resolve(self, value); + }, function (reason) { + if (done) + return; + done = true; + reject(self, reason); + }); + } catch (ex) { + if (done) + return; + done = true; + reject(self, ex); + } + } + Promise.prototype['catch'] = function (onRejected) { + return this.then(null, onRejected); + }; + Promise.prototype.then = function (onFulfilled, onRejected) { + var prom = new this.constructor(noop); + handle(this, new Handler(onFulfilled, onRejected, prom)); + return prom; + }; + Promise.all = function (arr) { + var args = Array.prototype.slice.call(arr); + return new Promise(function (resolve, reject) { + if (args.length === 0) + return resolve([]); + var remaining = args.length; + function res(i, val) { + try { + if (val && (typeof val === 'object' || typeof val === 'function')) { + var then = val.then; + if (typeof then === 'function') { + then.call(val, function (val) { + res(i, val); + }, reject); + return; + } + } + args[i] = val; + if (--remaining === 0) { + resolve(args); + } + } catch (ex) { + reject(ex); + } + } + for (var i = 0; i < args.length; i++) { + res(i, args[i]); + } + }); + }; + Promise.resolve = function (value) { + if (value && typeof value === 'object' && value.constructor === Promise) { + return value; + } + return new Promise(function (resolve) { + resolve(value); + }); + }; + Promise.reject = function (value) { + return new Promise(function (resolve, reject) { + reject(value); + }); + }; + Promise.race = function (values) { + return new Promise(function (resolve, reject) { + for (var i = 0, len = values.length; i < len; i++) { + values[i].then(resolve, reject); + } + }); + }; + Promise._immediateFn = typeof setImmediate === 'function' ? function (fn) { + setImmediate(fn); + } : function (fn) { + setTimeoutFunc(fn, 0); + }; + Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) { + if (typeof console !== 'undefined' && console) { + console.warn('Possible Unhandled Promise Rejection:', err); + } + }; + Promise._setImmediateFn = function _setImmediateFn(fn) { + Promise._immediateFn = fn; + }; + Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) { + Promise._unhandledRejectionFn = fn; + }; + if (typeof module !== 'undefined' && module.exports) { + module.exports = Promise; + } else if (!root.Promise) { + root.Promise = Promise; + } + }(this)); + }.call(this, require('timers').setImmediate)); + }, + { 'timers': 3 } + ], + 3: [ + function (require, module, exports) { + (function (setImmediate, clearImmediate) { + var nextTick = require('process/browser.js').nextTick; + var apply = Function.prototype.apply; + var slice = Array.prototype.slice; + var immediateIds = {}; + var nextImmediateId = 0; + exports.setTimeout = function () { + return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); + }; + exports.setInterval = function () { + return new Timeout(apply.call(setInterval, window, arguments), clearInterval); + }; + exports.clearTimeout = exports.clearInterval = function (timeout) { + timeout.close(); + }; + function Timeout(id, clearFn) { + this._id = id; + this._clearFn = clearFn; + } + Timeout.prototype.unref = Timeout.prototype.ref = function () { + }; + Timeout.prototype.close = function () { + this._clearFn.call(window, this._id); + }; + exports.enroll = function (item, msecs) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = msecs; + }; + exports.unenroll = function (item) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = -1; + }; + exports._unrefActive = exports.active = function (item) { + clearTimeout(item._idleTimeoutId); + var msecs = item._idleTimeout; + if (msecs >= 0) { + item._idleTimeoutId = setTimeout(function onTimeout() { + if (item._onTimeout) + item._onTimeout(); + }, msecs); + } + }; + exports.setImmediate = typeof setImmediate === 'function' ? setImmediate : function (fn) { + var id = nextImmediateId++; + var args = arguments.length < 2 ? false : slice.call(arguments, 1); + immediateIds[id] = true; + nextTick(function onNextTick() { + if (immediateIds[id]) { + if (args) { + fn.apply(null, args); + } else { + fn.call(null); + } + exports.clearImmediate(id); + } + }); + return id; + }; + exports.clearImmediate = typeof clearImmediate === 'function' ? clearImmediate : function (id) { + delete immediateIds[id]; + }; + }.call(this, require('timers').setImmediate, require('timers').clearImmediate)); + }, + { + 'process/browser.js': 1, + 'timers': 3 + } + ], + 4: [ + function (require, module, exports) { + var promisePolyfill = require('promise-polyfill'); + var Global = function () { + if (typeof window !== 'undefined') { + return window; + } else { + return Function('return this;')(); + } + }(); + module.exports = { boltExport: Global.Promise || promisePolyfill }; + }, + { 'promise-polyfill': 2 } + ] + }, {}, [4])(4); + })); + }(undefined, exports$1, module$1, undefined)); + var Promise = module$1.exports.boltExport; + + var nu$3 = function (baseFn) { + var data = Optional.none(); + var callbacks = []; + var map = function (f) { + return nu$3(function (nCallback) { + get(function (data) { + nCallback(f(data)); + }); + }); + }; + var get = function (nCallback) { + if (isReady()) { + call(nCallback); + } else { + callbacks.push(nCallback); + } + }; + var set = function (x) { + if (!isReady()) { + data = Optional.some(x); + run(callbacks); + callbacks = []; + } + }; + var isReady = function () { + return data.isSome(); + }; + var run = function (cbs) { + each(cbs, call); + }; + var call = function (cb) { + data.each(function (x) { + setTimeout(function () { + cb(x); + }, 0); + }); + }; + baseFn(set); + return { + get: get, + map: map, + isReady: isReady + }; + }; + var pure = function (a) { + return nu$3(function (callback) { + callback(a); + }); + }; + var LazyValue = { + nu: nu$3, + pure: pure + }; + + var errorReporter = function (err) { + setTimeout(function () { + throw err; + }, 0); + }; + var make = function (run) { + var get = function (callback) { + run().then(callback, errorReporter); + }; + var map = function (fab) { + return make(function () { + return run().then(fab); + }); + }; + var bind = function (aFutureB) { + return make(function () { + return run().then(function (v) { + return aFutureB(v).toPromise(); + }); + }); + }; + var anonBind = function (futureB) { + return make(function () { + return run().then(function () { + return futureB.toPromise(); + }); + }); + }; + var toLazy = function () { + return LazyValue.nu(get); + }; + var toCached = function () { + var cache = null; + return make(function () { + if (cache === null) { + cache = run(); + } + return cache; + }); + }; + var toPromise = run; + return { + map: map, + bind: bind, + anonBind: anonBind, + toLazy: toLazy, + toCached: toCached, + toPromise: toPromise, + get: get + }; + }; + var nu$4 = function (baseFn) { + return make(function () { + return new Promise(baseFn); + }); + }; + var pure$1 = function (a) { + return make(function () { + return Promise.resolve(a); + }); + }; + var Future = { + nu: nu$4, + pure: pure$1 + }; + + var par = function (asyncValues, nu) { + return nu(function (callback) { + var r = []; + var count = 0; + var cb = function (i) { + return function (value) { + r[i] = value; + count++; + if (count >= asyncValues.length) { + callback(r); + } + }; + }; + if (asyncValues.length === 0) { + callback([]); + } else { + each(asyncValues, function (asyncValue, i) { + asyncValue.get(cb(i)); + }); + } + }); + }; + + var par$1 = function (futures) { + return par(futures, Future.nu); + }; + + var value = function (o) { + var is = function (v) { + return o === v; + }; + var or = function (_opt) { + return value(o); + }; + var orThunk = function (_f) { + return value(o); + }; + var map = function (f) { + return value(f(o)); + }; + var mapError = function (_f) { + return value(o); + }; + var each = function (f) { + f(o); + }; + var bind = function (f) { + return f(o); + }; + var fold = function (_, onValue) { + return onValue(o); + }; + var exists = function (f) { + return f(o); + }; + var forall = function (f) { + return f(o); + }; + var toOptional = function () { + return Optional.some(o); + }; + return { + is: is, + isValue: always, + isError: never, + getOr: constant(o), + getOrThunk: constant(o), + getOrDie: constant(o), + or: or, + orThunk: orThunk, + fold: fold, + map: map, + mapError: mapError, + each: each, + bind: bind, + exists: exists, + forall: forall, + toOptional: toOptional + }; + }; + var error = function (message) { + var getOrThunk = function (f) { + return f(); + }; + var getOrDie = function () { + return die(String(message))(); + }; + var or = function (opt) { + return opt; + }; + var orThunk = function (f) { + return f(); + }; + var map = function (_f) { + return error(message); + }; + var mapError = function (f) { + return error(f(message)); + }; + var bind = function (_f) { + return error(message); + }; + var fold = function (onError, _) { + return onError(message); + }; + return { + is: never, + isValue: never, + isError: always, + getOr: identity, + getOrThunk: getOrThunk, + getOrDie: getOrDie, + or: or, + orThunk: orThunk, + fold: fold, + map: map, + mapError: mapError, + each: noop, + bind: bind, + exists: never, + forall: always, + toOptional: Optional.none + }; + }; + var fromOption = function (opt, err) { + return opt.fold(function () { + return error(err); + }, value); + }; + var Result = { + value: value, + error: error, + fromOption: fromOption + }; + + var generate = function (cases) { + if (!isArray(cases)) { + throw new Error('cases must be an array'); + } + if (cases.length === 0) { + throw new Error('there must be at least one case'); + } + var constructors = []; + var adt = {}; + each(cases, function (acase, count) { + var keys$1 = keys(acase); + if (keys$1.length !== 1) { + throw new Error('one and only one name per case'); + } + var key = keys$1[0]; + var value = acase[key]; + if (adt[key] !== undefined) { + throw new Error('duplicate key detected:' + key); + } else if (key === 'cata') { + throw new Error('cannot have a case named cata (sorry)'); + } else if (!isArray(value)) { + throw new Error('case arguments must be an array'); + } + constructors.push(key); + adt[key] = function () { + var argLength = arguments.length; + if (argLength !== value.length) { + throw new Error('Wrong number of arguments to case ' + key + '. Expected ' + value.length + ' (' + value + '), got ' + argLength); + } + var args = new Array(argLength); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + var match = function (branches) { + var branchKeys = keys(branches); + if (constructors.length !== branchKeys.length) { + throw new Error('Wrong number of arguments to match. Expected: ' + constructors.join(',') + '\nActual: ' + branchKeys.join(',')); + } + var allReqd = forall(constructors, function (reqKey) { + return contains(branchKeys, reqKey); + }); + if (!allReqd) { + throw new Error('Not all branches were specified when using match. Specified: ' + branchKeys.join(', ') + '\nRequired: ' + constructors.join(', ')); + } + return branches[key].apply(null, args); + }; + return { + fold: function () { + if (arguments.length !== cases.length) { + throw new Error('Wrong number of arguments to fold. Expected ' + cases.length + ', got ' + arguments.length); + } + var target = arguments[count]; + return target.apply(null, args); + }, + match: match, + log: function (label) { + console.log(label, { + constructors: constructors, + constructor: key, + params: args + }); + } + }; + }; + }); + return adt; + }; + var Adt = { generate: generate }; + + var comparison = Adt.generate([ + { + bothErrors: [ + 'error1', + 'error2' + ] + }, + { + firstError: [ + 'error1', + 'value2' + ] + }, + { + secondError: [ + 'value1', + 'error2' + ] + }, + { + bothValues: [ + 'value1', + 'value2' + ] + } + ]); + var unite = function (result) { + return result.fold(identity, identity); + }; + + function ClosestOrAncestor (is, ancestor, scope, a, isRoot) { + if (is(scope, a)) { + return Optional.some(scope); + } else if (isFunction(isRoot) && isRoot(scope)) { + return Optional.none(); + } else { + return ancestor(scope, a, isRoot); + } + } + + var ancestor = function (scope, predicate, isRoot) { + var element = scope.dom; + var stop = isFunction(isRoot) ? isRoot : never; + while (element.parentNode) { + element = element.parentNode; + var el = SugarElement.fromDom(element); + if (predicate(el)) { + return Optional.some(el); + } else if (stop(el)) { + break; + } + } + return Optional.none(); + }; + var closest = function (scope, predicate, isRoot) { + var is = function (s, test) { + return test(s); + }; + return ClosestOrAncestor(is, ancestor, scope, predicate, isRoot); + }; + var sibling = function (scope, predicate) { + var element = scope.dom; + if (!element.parentNode) { + return Optional.none(); + } + return child$1(SugarElement.fromDom(element.parentNode), function (x) { + return !eq$2(scope, x) && predicate(x); + }); + }; + var child$1 = function (scope, predicate) { + var pred = function (node) { + return predicate(SugarElement.fromDom(node)); + }; + var result = find(scope.dom.childNodes, pred); + return result.map(SugarElement.fromDom); + }; + + var ancestor$1 = function (scope, selector, isRoot) { + return ancestor(scope, function (e) { + return is$1(e, selector); + }, isRoot); + }; + var descendant = function (scope, selector) { + return one(selector, scope); + }; + var closest$1 = function (scope, selector, isRoot) { + var is = function (element, selector) { + return is$1(element, selector); + }; + return ClosestOrAncestor(is, ancestor$1, scope, selector, isRoot); + }; + + var promise = function () { + function bind(fn, thisArg) { + return function () { + fn.apply(thisArg, arguments); + }; + } + var isArray = Array.isArray || function (value) { + return Object.prototype.toString.call(value) === '[object Array]'; + }; + var Promise = function (fn) { + if (typeof this !== 'object') { + throw new TypeError('Promises must be constructed via new'); + } + if (typeof fn !== 'function') { + throw new TypeError('not a function'); + } + this._state = null; + this._value = null; + this._deferreds = []; + doResolve(fn, bind(resolve, this), bind(reject, this)); + }; + var asap = Promise.immediateFn || typeof setImmediate === 'function' && setImmediate || function (fn) { + setTimeout(fn, 1); + }; + function handle(deferred) { + var me = this; + if (this._state === null) { + this._deferreds.push(deferred); + return; + } + asap(function () { + var cb = me._state ? deferred.onFulfilled : deferred.onRejected; + if (cb === null) { + (me._state ? deferred.resolve : deferred.reject)(me._value); + return; + } + var ret; + try { + ret = cb(me._value); + } catch (e) { + deferred.reject(e); + return; + } + deferred.resolve(ret); + }); + } + function resolve(newValue) { + try { + if (newValue === this) { + throw new TypeError('A promise cannot be resolved with itself.'); + } + if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) { + var then = newValue.then; + if (typeof then === 'function') { + doResolve(bind(then, newValue), bind(resolve, this), bind(reject, this)); + return; + } + } + this._state = true; + this._value = newValue; + finale.call(this); + } catch (e) { + reject.call(this, e); + } + } + function reject(newValue) { + this._state = false; + this._value = newValue; + finale.call(this); + } + function finale() { + for (var i = 0, len = this._deferreds.length; i < len; i++) { + handle.call(this, this._deferreds[i]); + } + this._deferreds = null; + } + function Handler(onFulfilled, onRejected, resolve, reject) { + this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; + this.onRejected = typeof onRejected === 'function' ? onRejected : null; + this.resolve = resolve; + this.reject = reject; + } + function doResolve(fn, onFulfilled, onRejected) { + var done = false; + try { + fn(function (value) { + if (done) { + return; + } + done = true; + onFulfilled(value); + }, function (reason) { + if (done) { + return; + } + done = true; + onRejected(reason); + }); + } catch (ex) { + if (done) { + return; + } + done = true; + onRejected(ex); + } + } + Promise.prototype.catch = function (onRejected) { + return this.then(null, onRejected); + }; + Promise.prototype.then = function (onFulfilled, onRejected) { + var me = this; + return new Promise(function (resolve, reject) { + handle.call(me, new Handler(onFulfilled, onRejected, resolve, reject)); + }); + }; + Promise.all = function () { + var args = Array.prototype.slice.call(arguments.length === 1 && isArray(arguments[0]) ? arguments[0] : arguments); + return new Promise(function (resolve, reject) { + if (args.length === 0) { + return resolve([]); + } + var remaining = args.length; + function res(i, val) { + try { + if (val && (typeof val === 'object' || typeof val === 'function')) { + var then = val.then; + if (typeof then === 'function') { + then.call(val, function (val) { + res(i, val); + }, reject); + return; + } + } + args[i] = val; + if (--remaining === 0) { + resolve(args); + } + } catch (ex) { + reject(ex); + } + } + for (var i = 0; i < args.length; i++) { + res(i, args[i]); + } + }); + }; + Promise.resolve = function (value) { + if (value && typeof value === 'object' && value.constructor === Promise) { + return value; + } + return new Promise(function (resolve) { + resolve(value); + }); + }; + Promise.reject = function (value) { + return new Promise(function (resolve, reject) { + reject(value); + }); + }; + Promise.race = function (values) { + return new Promise(function (resolve, reject) { + for (var i = 0, len = values.length; i < len; i++) { + values[i].then(resolve, reject); + } + }); + }; + return Promise; + }; + var promiseObj = window.Promise ? window.Promise : promise(); + + var requestAnimationFramePromise; + var requestAnimationFrame = function (callback, element) { + var i, requestAnimationFrameFunc = window.requestAnimationFrame; + var vendors = [ + 'ms', + 'moz', + 'webkit' + ]; + var featurefill = function (callback) { + window.setTimeout(callback, 0); + }; + for (i = 0; i < vendors.length && !requestAnimationFrameFunc; i++) { + requestAnimationFrameFunc = window[vendors[i] + 'RequestAnimationFrame']; + } + if (!requestAnimationFrameFunc) { + requestAnimationFrameFunc = featurefill; + } + requestAnimationFrameFunc(callback, element); + }; + var wrappedSetTimeout = function (callback, time) { + if (typeof time !== 'number') { + time = 0; + } + return setTimeout(callback, time); + }; + var wrappedSetInterval = function (callback, time) { + if (typeof time !== 'number') { + time = 1; + } + return setInterval(callback, time); + }; + var wrappedClearTimeout = function (id) { + return clearTimeout(id); + }; + var wrappedClearInterval = function (id) { + return clearInterval(id); + }; + var debounce = function (callback, time) { + var timer; + var func = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + clearTimeout(timer); + timer = wrappedSetTimeout(function () { + callback.apply(this, args); + }, time); + }; + func.stop = function () { + clearTimeout(timer); + }; + return func; + }; + var Delay = { + requestAnimationFrame: function (callback, element) { + if (requestAnimationFramePromise) { + requestAnimationFramePromise.then(callback); + return; + } + requestAnimationFramePromise = new promiseObj(function (resolve) { + if (!element) { + element = document.body; + } + requestAnimationFrame(resolve, element); + }).then(callback); + }, + setTimeout: wrappedSetTimeout, + setInterval: wrappedSetInterval, + setEditorTimeout: function (editor, callback, time) { + return wrappedSetTimeout(function () { + if (!editor.removed) { + callback(); + } + }, time); + }, + setEditorInterval: function (editor, callback, time) { + var timer = wrappedSetInterval(function () { + if (!editor.removed) { + callback(); + } else { + clearInterval(timer); + } + }, time); + return timer; + }, + debounce: debounce, + throttle: debounce, + clearInterval: wrappedClearInterval, + clearTimeout: wrappedClearTimeout + }; + + function StyleSheetLoader(documentOrShadowRoot, settings) { + if (settings === void 0) { + settings = {}; + } + var idCount = 0; + var loadedStates = {}; + var edos = SugarElement.fromDom(documentOrShadowRoot); + var doc = documentOrOwner(edos); + var maxLoadTime = settings.maxLoadTime || 5000; + var _setReferrerPolicy = function (referrerPolicy) { + settings.referrerPolicy = referrerPolicy; + }; + var addStyle = function (element) { + append(getStyleContainer(edos), element); + }; + var removeStyle = function (id) { + var styleContainer = getStyleContainer(edos); + descendant(styleContainer, '#' + id).each(remove); + }; + var getOrCreateState = function (url) { + return get$1(loadedStates, url).getOrThunk(function () { + return { + id: 'mce-u' + idCount++, + passed: [], + failed: [], + count: 0 + }; + }); + }; + var load = function (url, success, failure) { + var link; + var urlWithSuffix = Tools._addCacheSuffix(url); + var state = getOrCreateState(urlWithSuffix); + loadedStates[urlWithSuffix] = state; + state.count++; + var resolve = function (callbacks, status) { + var i = callbacks.length; + while (i--) { + callbacks[i](); + } + state.status = status; + state.passed = []; + state.failed = []; + if (link) { + link.onload = null; + link.onerror = null; + link = null; + } + }; + var passed = function () { + return resolve(state.passed, 2); + }; + var failed = function () { + return resolve(state.failed, 3); + }; + var wait = function (testCallback, waitCallback) { + if (!testCallback()) { + if (Date.now() - startTime < maxLoadTime) { + Delay.setTimeout(waitCallback); + } else { + failed(); + } + } + }; + var waitForWebKitLinkLoaded = function () { + wait(function () { + var styleSheets = documentOrShadowRoot.styleSheets; + var i = styleSheets.length; + while (i--) { + var styleSheet = styleSheets[i]; + var owner = styleSheet.ownerNode; + if (owner && owner.id === link.id) { + passed(); + return true; + } + } + return false; + }, waitForWebKitLinkLoaded); + }; + if (success) { + state.passed.push(success); + } + if (failure) { + state.failed.push(failure); + } + if (state.status === 1) { + return; + } + if (state.status === 2) { + passed(); + return; + } + if (state.status === 3) { + failed(); + return; + } + state.status = 1; + var linkElem = SugarElement.fromTag('link', doc.dom); + setAll(linkElem, { + rel: 'stylesheet', + type: 'text/css', + id: state.id + }); + var startTime = Date.now(); + if (settings.contentCssCors) { + set(linkElem, 'crossOrigin', 'anonymous'); + } + if (settings.referrerPolicy) { + set(linkElem, 'referrerpolicy', settings.referrerPolicy); + } + link = linkElem.dom; + link.onload = waitForWebKitLinkLoaded; + link.onerror = failed; + addStyle(linkElem); + set(linkElem, 'href', urlWithSuffix); + }; + var loadF = function (url) { + return Future.nu(function (resolve) { + load(url, compose(resolve, constant(Result.value(url))), compose(resolve, constant(Result.error(url)))); + }); + }; + var loadAll = function (urls, success, failure) { + par$1(map(urls, loadF)).get(function (result) { + var parts = partition(result, function (r) { + return r.isValue(); + }); + if (parts.fail.length > 0) { + failure(parts.fail.map(unite)); + } else { + success(parts.pass.map(unite)); + } + }); + }; + var unload = function (url) { + var urlWithSuffix = Tools._addCacheSuffix(url); + get$1(loadedStates, urlWithSuffix).each(function (state) { + var count = --state.count; + if (count === 0) { + delete loadedStates[urlWithSuffix]; + removeStyle(state.id); + } + }); + }; + var unloadAll = function (urls) { + each(urls, function (url) { + unload(url); + }); + }; + return { + load: load, + loadAll: loadAll, + unload: unload, + unloadAll: unloadAll, + _setReferrerPolicy: _setReferrerPolicy + }; + } + + var create$1 = function () { + var map = new WeakMap(); + var forElement = function (referenceElement, settings) { + var root = getRootNode(referenceElement); + var rootDom = root.dom; + return Optional.from(map.get(rootDom)).getOrThunk(function () { + var sl = StyleSheetLoader(rootDom, settings); + map.set(rootDom, sl); + return sl; + }); + }; + return { forElement: forElement }; + }; + var instance = create$1(); + + var DomTreeWalker = function () { + function DomTreeWalker(startNode, rootNode) { + this.node = startNode; + this.rootNode = rootNode; + this.current = this.current.bind(this); + this.next = this.next.bind(this); + this.prev = this.prev.bind(this); + this.prev2 = this.prev2.bind(this); + } + DomTreeWalker.prototype.current = function () { + return this.node; + }; + DomTreeWalker.prototype.next = function (shallow) { + this.node = this.findSibling(this.node, 'firstChild', 'nextSibling', shallow); + return this.node; + }; + DomTreeWalker.prototype.prev = function (shallow) { + this.node = this.findSibling(this.node, 'lastChild', 'previousSibling', shallow); + return this.node; + }; + DomTreeWalker.prototype.prev2 = function (shallow) { + this.node = this.findPreviousNode(this.node, 'lastChild', 'previousSibling', shallow); + return this.node; + }; + DomTreeWalker.prototype.findSibling = function (node, startName, siblingName, shallow) { + var sibling, parent; + if (node) { + if (!shallow && node[startName]) { + return node[startName]; + } + if (node !== this.rootNode) { + sibling = node[siblingName]; + if (sibling) { + return sibling; + } + for (parent = node.parentNode; parent && parent !== this.rootNode; parent = parent.parentNode) { + sibling = parent[siblingName]; + if (sibling) { + return sibling; + } + } + } + } + }; + DomTreeWalker.prototype.findPreviousNode = function (node, startName, siblingName, shallow) { + var sibling, parent, child; + if (node) { + sibling = node[siblingName]; + if (this.rootNode && sibling === this.rootNode) { + return; + } + if (sibling) { + if (!shallow) { + for (child = sibling[startName]; child; child = child[startName]) { + if (!child[startName]) { + return child; + } + } + } + return sibling; + } + parent = node.parentNode; + if (parent && parent !== this.rootNode) { + return parent; + } + } + }; + return DomTreeWalker; + }(); + + var blocks = [ + 'article', + 'aside', + 'details', + 'div', + 'dt', + 'figcaption', + 'footer', + 'form', + 'fieldset', + 'header', + 'hgroup', + 'html', + 'main', + 'nav', + 'section', + 'summary', + 'body', + 'p', + 'dl', + 'multicol', + 'dd', + 'figure', + 'address', + 'center', + 'blockquote', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'listing', + 'xmp', + 'pre', + 'plaintext', + 'menu', + 'dir', + 'ul', + 'ol', + 'li', + 'hr', + 'table', + 'tbody', + 'thead', + 'tfoot', + 'th', + 'tr', + 'td', + 'caption' + ]; + var tableCells = [ + 'td', + 'th' + ]; + var tableSections = [ + 'thead', + 'tbody', + 'tfoot' + ]; + var textBlocks = [ + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'p', + 'div', + 'address', + 'pre', + 'form', + 'blockquote', + 'center', + 'dir', + 'fieldset', + 'header', + 'footer', + 'article', + 'section', + 'hgroup', + 'aside', + 'nav', + 'figure' + ]; + var headings = [ + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6' + ]; + var listItems = [ + 'li', + 'dd', + 'dt' + ]; + var lists = [ + 'ul', + 'ol', + 'dl' + ]; + var wsElements = [ + 'pre', + 'script', + 'textarea', + 'style' + ]; + var lazyLookup = function (items) { + var lookup; + return function (node) { + lookup = lookup ? lookup : mapToObject(items, always); + return lookup.hasOwnProperty(name(node)); + }; + }; + var isHeading = lazyLookup(headings); + var isBlock = lazyLookup(blocks); + var isTable$1 = function (node) { + return name(node) === 'table'; + }; + var isInline = function (node) { + return isElement(node) && !isBlock(node); + }; + var isBr$1 = function (node) { + return isElement(node) && name(node) === 'br'; + }; + var isTextBlock = lazyLookup(textBlocks); + var isList = lazyLookup(lists); + var isListItem = lazyLookup(listItems); + var isTableSection = lazyLookup(tableSections); + var isTableCell$1 = lazyLookup(tableCells); + var isWsPreserveElement = lazyLookup(wsElements); + + var ancestor$2 = function (scope, selector, isRoot) { + return ancestor$1(scope, selector, isRoot).isSome(); + }; + + var zeroWidth = '\uFEFF'; + var nbsp = '\xA0'; + var isZwsp = function (char) { + return char === zeroWidth; + }; + var removeZwsp = function (s) { + return s.replace(/\uFEFF/g, ''); + }; + + var ZWSP = zeroWidth; + var isZwsp$1 = isZwsp; + var trim$2 = removeZwsp; + + var isElement$2 = isElement$1; + var isText$2 = isText$1; + var isCaretContainerBlock = function (node) { + if (isText$2(node)) { + node = node.parentNode; + } + return isElement$2(node) && node.hasAttribute('data-mce-caret'); + }; + var isCaretContainerInline = function (node) { + return isText$2(node) && isZwsp$1(node.data); + }; + var isCaretContainer = function (node) { + return isCaretContainerBlock(node) || isCaretContainerInline(node); + }; + var hasContent = function (node) { + return node.firstChild !== node.lastChild || !isBr(node.firstChild); + }; + var insertInline = function (node, before) { + var sibling; + var doc = node.ownerDocument; + var textNode = doc.createTextNode(ZWSP); + var parentNode = node.parentNode; + if (!before) { + sibling = node.nextSibling; + if (isText$2(sibling)) { + if (isCaretContainer(sibling)) { + return sibling; + } + if (startsWithCaretContainer(sibling)) { + sibling.splitText(1); + return sibling; + } + } + if (node.nextSibling) { + parentNode.insertBefore(textNode, node.nextSibling); + } else { + parentNode.appendChild(textNode); + } + } else { + sibling = node.previousSibling; + if (isText$2(sibling)) { + if (isCaretContainer(sibling)) { + return sibling; + } + if (endsWithCaretContainer(sibling)) { + return sibling.splitText(sibling.data.length - 1); + } + } + parentNode.insertBefore(textNode, node); + } + return textNode; + }; + var isBeforeInline = function (pos) { + var container = pos.container(); + if (!isText$1(container)) { + return false; + } + return container.data.charAt(pos.offset()) === ZWSP || pos.isAtStart() && isCaretContainerInline(container.previousSibling); + }; + var isAfterInline = function (pos) { + var container = pos.container(); + if (!isText$1(container)) { + return false; + } + return container.data.charAt(pos.offset() - 1) === ZWSP || pos.isAtEnd() && isCaretContainerInline(container.nextSibling); + }; + var createBogusBr = function () { + var br = document.createElement('br'); + br.setAttribute('data-mce-bogus', '1'); + return br; + }; + var insertBlock = function (blockName, node, before) { + var doc = node.ownerDocument; + var blockNode = doc.createElement(blockName); + blockNode.setAttribute('data-mce-caret', before ? 'before' : 'after'); + blockNode.setAttribute('data-mce-bogus', 'all'); + blockNode.appendChild(createBogusBr()); + var parentNode = node.parentNode; + if (!before) { + if (node.nextSibling) { + parentNode.insertBefore(blockNode, node.nextSibling); + } else { + parentNode.appendChild(blockNode); + } + } else { + parentNode.insertBefore(blockNode, node); + } + return blockNode; + }; + var startsWithCaretContainer = function (node) { + return isText$2(node) && node.data[0] === ZWSP; + }; + var endsWithCaretContainer = function (node) { + return isText$2(node) && node.data[node.data.length - 1] === ZWSP; + }; + var trimBogusBr = function (elm) { + var brs = elm.getElementsByTagName('br'); + var lastBr = brs[brs.length - 1]; + if (isBogus(lastBr)) { + lastBr.parentNode.removeChild(lastBr); + } + }; + var showCaretContainerBlock = function (caretContainer) { + if (caretContainer && caretContainer.hasAttribute('data-mce-caret')) { + trimBogusBr(caretContainer); + caretContainer.removeAttribute('data-mce-caret'); + caretContainer.removeAttribute('data-mce-bogus'); + caretContainer.removeAttribute('style'); + caretContainer.removeAttribute('_moz_abspos'); + return caretContainer; + } + return null; + }; + var isRangeInCaretContainerBlock = function (range) { + return isCaretContainerBlock(range.startContainer); + }; + + var isContentEditableTrue$1 = isContentEditableTrue; + var isContentEditableFalse$1 = isContentEditableFalse; + var isBr$2 = isBr; + var isText$3 = isText$1; + var isInvalidTextElement = matchNodeNames([ + 'script', + 'style', + 'textarea' + ]); + var isAtomicInline = matchNodeNames([ + 'img', + 'input', + 'textarea', + 'hr', + 'iframe', + 'video', + 'audio', + 'object', + 'embed' + ]); + var isTable$2 = matchNodeNames(['table']); + var isCaretContainer$1 = isCaretContainer; + var isCaretCandidate = function (node) { + if (isCaretContainer$1(node)) { + return false; + } + if (isText$3(node)) { + return !isInvalidTextElement(node.parentNode); + } + return isAtomicInline(node) || isBr$2(node) || isTable$2(node) || isNonUiContentEditableFalse(node); + }; + var isUnselectable = function (node) { + return isElement$1(node) && node.getAttribute('unselectable') === 'true'; + }; + var isNonUiContentEditableFalse = function (node) { + return isUnselectable(node) === false && isContentEditableFalse$1(node); + }; + var isInEditable = function (node, root) { + for (node = node.parentNode; node && node !== root; node = node.parentNode) { + if (isNonUiContentEditableFalse(node)) { + return false; + } + if (isContentEditableTrue$1(node)) { + return true; + } + } + return true; + }; + var isAtomicContentEditableFalse = function (node) { + if (!isNonUiContentEditableFalse(node)) { + return false; + } + return foldl(from$1(node.getElementsByTagName('*')), function (result, elm) { + return result || isContentEditableTrue$1(elm); + }, false) !== true; + }; + var isAtomic = function (node) { + return isAtomicInline(node) || isAtomicContentEditableFalse(node); + }; + var isEditableCaretCandidate = function (node, root) { + return isCaretCandidate(node) && isInEditable(node, root); + }; + + var whiteSpaceRegExp$1 = /^[ \t\r\n]*$/; + var isWhitespaceText = function (text) { + return whiteSpaceRegExp$1.test(text); + }; + + var hasWhitespacePreserveParent = function (node, rootNode) { + var rootElement = SugarElement.fromDom(rootNode); + var startNode = SugarElement.fromDom(node); + return ancestor$2(startNode, 'pre,code', curry(eq$2, rootElement)); + }; + var isWhitespace = function (node, rootNode) { + return isText$1(node) && isWhitespaceText(node.data) && hasWhitespacePreserveParent(node, rootNode) === false; + }; + var isNamedAnchor = function (node) { + return isElement$1(node) && node.nodeName === 'A' && !node.hasAttribute('href') && (node.hasAttribute('name') || node.hasAttribute('id')); + }; + var isContent = function (node, rootNode) { + return isCaretCandidate(node) && isWhitespace(node, rootNode) === false || isNamedAnchor(node) || isBookmark(node); + }; + var isBookmark = hasAttribute('data-mce-bookmark'); + var isBogus$1 = hasAttribute('data-mce-bogus'); + var isBogusAll$1 = hasAttributeValue('data-mce-bogus', 'all'); + var isEmptyNode = function (targetNode, skipBogus) { + var node, brCount = 0; + if (isContent(targetNode, targetNode)) { + return false; + } else { + node = targetNode.firstChild; + if (!node) { + return true; + } + var walker = new DomTreeWalker(node, targetNode); + do { + if (skipBogus) { + if (isBogusAll$1(node)) { + node = walker.next(true); + continue; + } + if (isBogus$1(node)) { + node = walker.next(); + continue; + } + } + if (isBr(node)) { + brCount++; + node = walker.next(); + continue; + } + if (isContent(node, targetNode)) { + return false; + } + node = walker.next(); + } while (node); + return brCount <= 1; + } + }; + var isEmpty = function (elm, skipBogus) { + if (skipBogus === void 0) { + skipBogus = true; + } + return isEmptyNode(elm.dom, skipBogus); + }; + + var isSpan = function (node) { + return node.nodeName.toLowerCase() === 'span'; + }; + var isInlineContent = function (node, root) { + return isNonNullable(node) && (isContent(node, root) || isInline(SugarElement.fromDom(node))); + }; + var surroundedByInlineContent = function (node, root) { + var prev = new DomTreeWalker(node, root).prev(false); + var next = new DomTreeWalker(node, root).next(false); + var prevIsInline = isUndefined(prev) || isInlineContent(prev, root); + var nextIsInline = isUndefined(next) || isInlineContent(next, root); + return prevIsInline && nextIsInline; + }; + var isBookmarkNode = function (node) { + return isSpan(node) && node.getAttribute('data-mce-type') === 'bookmark'; + }; + var isKeepTextNode = function (node, root) { + return isText$1(node) && node.data.length > 0 && surroundedByInlineContent(node, root); + }; + var isKeepElement = function (node) { + return isElement$1(node) ? node.childNodes.length > 0 : false; + }; + var isDocument$2 = function (node) { + return isDocumentFragment$1(node) || isDocument$1(node); + }; + var trimNode = function (dom, node, root) { + var rootNode = root || node; + if (isElement$1(node) && isBookmarkNode(node)) { + return node; + } + var children = node.childNodes; + for (var i = children.length - 1; i >= 0; i--) { + trimNode(dom, children[i], rootNode); + } + if (isElement$1(node)) { + var currentChildren = node.childNodes; + if (currentChildren.length === 1 && isBookmarkNode(currentChildren[0])) { + node.parentNode.insertBefore(currentChildren[0], node); + } + } + if (!isDocument$2(node) && !isContent(node, rootNode) && !isKeepElement(node) && !isKeepTextNode(node, rootNode)) { + dom.remove(node); + } + return node; + }; + + var makeMap$1 = Tools.makeMap; + var attrsCharsRegExp = /[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g; + var textCharsRegExp = /[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g; + var rawCharsRegExp = /[<>&\"\']/g; + var entityRegExp = /&#([a-z0-9]+);?|&([a-z0-9]+);/gi; + var asciiMap = { + 128: '\u20AC', + 130: '\u201A', + 131: '\u0192', + 132: '\u201E', + 133: '\u2026', + 134: '\u2020', + 135: '\u2021', + 136: '\u02c6', + 137: '\u2030', + 138: '\u0160', + 139: '\u2039', + 140: '\u0152', + 142: '\u017d', + 145: '\u2018', + 146: '\u2019', + 147: '\u201C', + 148: '\u201D', + 149: '\u2022', + 150: '\u2013', + 151: '\u2014', + 152: '\u02DC', + 153: '\u2122', + 154: '\u0161', + 155: '\u203A', + 156: '\u0153', + 158: '\u017e', + 159: '\u0178' + }; + var baseEntities = { + '"': '"', + '\'': ''', + '<': '<', + '>': '>', + '&': '&', + '`': '`' + }; + var reverseEntities = { + '<': '<', + '>': '>', + '&': '&', + '"': '"', + ''': '\'' + }; + var nativeDecode = function (text) { + var elm = SugarElement.fromTag('div').dom; + elm.innerHTML = text; + return elm.textContent || elm.innerText || text; + }; + var buildEntitiesLookup = function (items, radix) { + var i, chr, entity; + var lookup = {}; + if (items) { + items = items.split(','); + radix = radix || 10; + for (i = 0; i < items.length; i += 2) { + chr = String.fromCharCode(parseInt(items[i], radix)); + if (!baseEntities[chr]) { + entity = '&' + items[i + 1] + ';'; + lookup[chr] = entity; + lookup[entity] = chr; + } + } + return lookup; + } + }; + var namedEntities = buildEntitiesLookup('50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,' + '5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,' + '5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,' + '5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,' + '68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,' + '6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,' + '6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,' + '75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,' + '7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,' + '7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,' + 'sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,' + 'st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,' + 't9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,' + 'tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,' + 'u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,' + '81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,' + '8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,' + '8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,' + '8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,' + '8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,' + 'nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,' + 'rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,' + 'Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,' + '80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,' + '811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro', 32); + var encodeRaw = function (text, attr) { + return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) { + return baseEntities[chr] || chr; + }); + }; + var encodeAllRaw = function (text) { + return ('' + text).replace(rawCharsRegExp, function (chr) { + return baseEntities[chr] || chr; + }); + }; + var encodeNumeric = function (text, attr) { + return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) { + if (chr.length > 1) { + return '&#' + ((chr.charCodeAt(0) - 55296) * 1024 + (chr.charCodeAt(1) - 56320) + 65536) + ';'; + } + return baseEntities[chr] || '&#' + chr.charCodeAt(0) + ';'; + }); + }; + var encodeNamed = function (text, attr, entities) { + entities = entities || namedEntities; + return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) { + return baseEntities[chr] || entities[chr] || chr; + }); + }; + var getEncodeFunc = function (name, entities) { + var entitiesMap = buildEntitiesLookup(entities) || namedEntities; + var encodeNamedAndNumeric = function (text, attr) { + return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) { + if (baseEntities[chr] !== undefined) { + return baseEntities[chr]; + } + if (entitiesMap[chr] !== undefined) { + return entitiesMap[chr]; + } + if (chr.length > 1) { + return '&#' + ((chr.charCodeAt(0) - 55296) * 1024 + (chr.charCodeAt(1) - 56320) + 65536) + ';'; + } + return '&#' + chr.charCodeAt(0) + ';'; + }); + }; + var encodeCustomNamed = function (text, attr) { + return encodeNamed(text, attr, entitiesMap); + }; + var nameMap = makeMap$1(name.replace(/\+/g, ',')); + if (nameMap.named && nameMap.numeric) { + return encodeNamedAndNumeric; + } + if (nameMap.named) { + if (entities) { + return encodeCustomNamed; + } + return encodeNamed; + } + if (nameMap.numeric) { + return encodeNumeric; + } + return encodeRaw; + }; + var decode = function (text) { + return text.replace(entityRegExp, function (all, numeric) { + if (numeric) { + if (numeric.charAt(0).toLowerCase() === 'x') { + numeric = parseInt(numeric.substr(1), 16); + } else { + numeric = parseInt(numeric, 10); + } + if (numeric > 65535) { + numeric -= 65536; + return String.fromCharCode(55296 + (numeric >> 10), 56320 + (numeric & 1023)); + } + return asciiMap[numeric] || String.fromCharCode(numeric); + } + return reverseEntities[all] || namedEntities[all] || nativeDecode(all); + }); + }; + var Entities = { + encodeRaw: encodeRaw, + encodeAllRaw: encodeAllRaw, + encodeNumeric: encodeNumeric, + encodeNamed: encodeNamed, + getEncodeFunc: getEncodeFunc, + decode: decode + }; + + var mapCache = {}, dummyObj = {}; + var makeMap$2 = Tools.makeMap, each$3 = Tools.each, extend$1 = Tools.extend, explode$1 = Tools.explode, inArray = Tools.inArray; + var split = function (items, delim) { + items = Tools.trim(items); + return items ? items.split(delim || ' ') : []; + }; + var compileSchema = function (type) { + var schema = {}; + var globalAttributes, blockContent; + var phrasingContent, flowContent, html4BlockContent, html4PhrasingContent; + var add = function (name, attributes, children) { + var ni, attributesOrder, element; + var arrayToMap = function (array, obj) { + var map = {}; + var i, l; + for (i = 0, l = array.length; i < l; i++) { + map[array[i]] = obj || {}; + } + return map; + }; + children = children || []; + attributes = attributes || ''; + if (typeof children === 'string') { + children = split(children); + } + var names = split(name); + ni = names.length; + while (ni--) { + attributesOrder = split([ + globalAttributes, + attributes + ].join(' ')); + element = { + attributes: arrayToMap(attributesOrder), + attributesOrder: attributesOrder, + children: arrayToMap(children, dummyObj) + }; + schema[names[ni]] = element; + } + }; + var addAttrs = function (name, attributes) { + var ni, schemaItem, i, l; + var names = split(name); + ni = names.length; + var attrs = split(attributes); + while (ni--) { + schemaItem = schema[names[ni]]; + for (i = 0, l = attrs.length; i < l; i++) { + schemaItem.attributes[attrs[i]] = {}; + schemaItem.attributesOrder.push(attrs[i]); + } + } + }; + if (mapCache[type]) { + return mapCache[type]; + } + globalAttributes = 'id accesskey class dir lang style tabindex title role'; + blockContent = 'address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul'; + phrasingContent = 'a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd ' + 'label map noscript object q s samp script select small span strong sub sup ' + 'textarea u var #text #comment'; + if (type !== 'html4') { + globalAttributes += ' contenteditable contextmenu draggable dropzone ' + 'hidden spellcheck translate'; + blockContent += ' article aside details dialog figure main header footer hgroup section nav'; + phrasingContent += ' audio canvas command datalist mark meter output picture ' + 'progress time wbr video ruby bdi keygen'; + } + if (type !== 'html5-strict') { + globalAttributes += ' xml:lang'; + html4PhrasingContent = 'acronym applet basefont big font strike tt'; + phrasingContent = [ + phrasingContent, + html4PhrasingContent + ].join(' '); + each$3(split(html4PhrasingContent), function (name) { + add(name, '', phrasingContent); + }); + html4BlockContent = 'center dir isindex noframes'; + blockContent = [ + blockContent, + html4BlockContent + ].join(' '); + flowContent = [ + blockContent, + phrasingContent + ].join(' '); + each$3(split(html4BlockContent), function (name) { + add(name, '', flowContent); + }); + } + flowContent = flowContent || [ + blockContent, + phrasingContent + ].join(' '); + add('html', 'manifest', 'head body'); + add('head', '', 'base command link meta noscript script style title'); + add('title hr noscript br'); + add('base', 'href target'); + add('link', 'href rel media hreflang type sizes hreflang'); + add('meta', 'name http-equiv content charset'); + add('style', 'media type scoped'); + add('script', 'src async defer type charset'); + add('body', 'onafterprint onbeforeprint onbeforeunload onblur onerror onfocus ' + 'onhashchange onload onmessage onoffline ononline onpagehide onpageshow ' + 'onpopstate onresize onscroll onstorage onunload', flowContent); + add('address dt dd div caption', '', flowContent); + add('h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn', '', phrasingContent); + add('blockquote', 'cite', flowContent); + add('ol', 'reversed start type', 'li'); + add('ul', '', 'li'); + add('li', 'value', flowContent); + add('dl', '', 'dt dd'); + add('a', 'href target rel media hreflang type', phrasingContent); + add('q', 'cite', phrasingContent); + add('ins del', 'cite datetime', flowContent); + add('img', 'src sizes srcset alt usemap ismap width height'); + add('iframe', 'src name width height', flowContent); + add('embed', 'src type width height'); + add('object', 'data type typemustmatch name usemap form width height', [ + flowContent, + 'param' + ].join(' ')); + add('param', 'name value'); + add('map', 'name', [ + flowContent, + 'area' + ].join(' ')); + add('area', 'alt coords shape href target rel media hreflang type'); + add('table', 'border', 'caption colgroup thead tfoot tbody tr' + (type === 'html4' ? ' col' : '')); + add('colgroup', 'span', 'col'); + add('col', 'span'); + add('tbody thead tfoot', '', 'tr'); + add('tr', '', 'td th'); + add('td', 'colspan rowspan headers', flowContent); + add('th', 'colspan rowspan headers scope abbr', flowContent); + add('form', 'accept-charset action autocomplete enctype method name novalidate target', flowContent); + add('fieldset', 'disabled form name', [ + flowContent, + 'legend' + ].join(' ')); + add('label', 'form for', phrasingContent); + add('input', 'accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate ' + 'formtarget height list max maxlength min multiple name pattern readonly required size src step type value width'); + add('button', 'disabled form formaction formenctype formmethod formnovalidate formtarget name type value', type === 'html4' ? flowContent : phrasingContent); + add('select', 'disabled form multiple name required size', 'option optgroup'); + add('optgroup', 'disabled label', 'option'); + add('option', 'disabled label selected value'); + add('textarea', 'cols dirname disabled form maxlength name readonly required rows wrap'); + add('menu', 'type label', [ + flowContent, + 'li' + ].join(' ')); + add('noscript', '', flowContent); + if (type !== 'html4') { + add('wbr'); + add('ruby', '', [ + phrasingContent, + 'rt rp' + ].join(' ')); + add('figcaption', '', flowContent); + add('mark rt rp summary bdi', '', phrasingContent); + add('canvas', 'width height', flowContent); + add('video', 'src crossorigin poster preload autoplay mediagroup loop ' + 'muted controls width height buffered', [ + flowContent, + 'track source' + ].join(' ')); + add('audio', 'src crossorigin preload autoplay mediagroup loop muted controls ' + 'buffered volume', [ + flowContent, + 'track source' + ].join(' ')); + add('picture', '', 'img source'); + add('source', 'src srcset type media sizes'); + add('track', 'kind src srclang label default'); + add('datalist', '', [ + phrasingContent, + 'option' + ].join(' ')); + add('article section nav aside main header footer', '', flowContent); + add('hgroup', '', 'h1 h2 h3 h4 h5 h6'); + add('figure', '', [ + flowContent, + 'figcaption' + ].join(' ')); + add('time', 'datetime', phrasingContent); + add('dialog', 'open', flowContent); + add('command', 'type label icon disabled checked radiogroup command'); + add('output', 'for form name', phrasingContent); + add('progress', 'value max', phrasingContent); + add('meter', 'value min max low high optimum', phrasingContent); + add('details', 'open', [ + flowContent, + 'summary' + ].join(' ')); + add('keygen', 'autofocus challenge disabled form keytype name'); + } + if (type !== 'html5-strict') { + addAttrs('script', 'language xml:space'); + addAttrs('style', 'xml:space'); + addAttrs('object', 'declare classid code codebase codetype archive standby align border hspace vspace'); + addAttrs('embed', 'align name hspace vspace'); + addAttrs('param', 'valuetype type'); + addAttrs('a', 'charset name rev shape coords'); + addAttrs('br', 'clear'); + addAttrs('applet', 'codebase archive code object alt name width height align hspace vspace'); + addAttrs('img', 'name longdesc align border hspace vspace'); + addAttrs('iframe', 'longdesc frameborder marginwidth marginheight scrolling align'); + addAttrs('font basefont', 'size color face'); + addAttrs('input', 'usemap align'); + addAttrs('select'); + addAttrs('textarea'); + addAttrs('h1 h2 h3 h4 h5 h6 div p legend caption', 'align'); + addAttrs('ul', 'type compact'); + addAttrs('li', 'type'); + addAttrs('ol dl menu dir', 'compact'); + addAttrs('pre', 'width xml:space'); + addAttrs('hr', 'align noshade size width'); + addAttrs('isindex', 'prompt'); + addAttrs('table', 'summary width frame rules cellspacing cellpadding align bgcolor'); + addAttrs('col', 'width align char charoff valign'); + addAttrs('colgroup', 'width align char charoff valign'); + addAttrs('thead', 'align char charoff valign'); + addAttrs('tr', 'align char charoff valign bgcolor'); + addAttrs('th', 'axis align char charoff valign nowrap bgcolor width height'); + addAttrs('form', 'accept'); + addAttrs('td', 'abbr axis scope align char charoff valign nowrap bgcolor width height'); + addAttrs('tfoot', 'align char charoff valign'); + addAttrs('tbody', 'align char charoff valign'); + addAttrs('area', 'nohref'); + addAttrs('body', 'background bgcolor text link vlink alink'); + } + if (type !== 'html4') { + addAttrs('input button select textarea', 'autofocus'); + addAttrs('input textarea', 'placeholder'); + addAttrs('a', 'download'); + addAttrs('link script img', 'crossorigin'); + addAttrs('img', 'loading'); + addAttrs('iframe', 'sandbox seamless allowfullscreen loading'); + } + each$3(split('a form meter progress dfn'), function (name) { + if (schema[name]) { + delete schema[name].children[name]; + } + }); + delete schema.caption.children.table; + delete schema.script; + mapCache[type] = schema; + return schema; + }; + var compileElementMap = function (value, mode) { + var styles; + if (value) { + styles = {}; + if (typeof value === 'string') { + value = { '*': value }; + } + each$3(value, function (value, key) { + styles[key] = styles[key.toUpperCase()] = mode === 'map' ? makeMap$2(value, /[, ]/) : explode$1(value, /[, ]/); + }); + } + return styles; + }; + function Schema(settings) { + var elements = {}; + var children = {}; + var patternElements = []; + var customElementsMap = {}, specialElements = {}; + var createLookupTable = function (option, defaultValue, extendWith) { + var value = settings[option]; + if (!value) { + value = mapCache[option]; + if (!value) { + value = makeMap$2(defaultValue, ' ', makeMap$2(defaultValue.toUpperCase(), ' ')); + value = extend$1(value, extendWith); + mapCache[option] = value; + } + } else { + value = makeMap$2(value, /[, ]/, makeMap$2(value.toUpperCase(), /[, ]/)); + } + return value; + }; + settings = settings || {}; + var schemaItems = compileSchema(settings.schema); + if (settings.verify_html === false) { + settings.valid_elements = '*[*]'; + } + var validStyles = compileElementMap(settings.valid_styles); + var invalidStyles = compileElementMap(settings.invalid_styles, 'map'); + var validClasses = compileElementMap(settings.valid_classes, 'map'); + var whiteSpaceElementsMap = createLookupTable('whitespace_elements', 'pre script noscript style textarea video audio iframe object code'); + var selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li option p td tfoot th thead tr'); + var shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link ' + 'meta param embed source wbr track'); + var boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize ' + 'noshade nowrap readonly selected autoplay loop controls'); + var nonEmptyOrMoveCaretBeforeOnEnter = 'td th iframe video audio object script code'; + var nonEmptyElementsMap = createLookupTable('non_empty_elements', nonEmptyOrMoveCaretBeforeOnEnter + ' pre', shortEndedElementsMap); + var moveCaretBeforeOnEnterElementsMap = createLookupTable('move_caret_before_on_enter_elements', nonEmptyOrMoveCaretBeforeOnEnter + ' table', shortEndedElementsMap); + var textBlockElementsMap = createLookupTable('text_block_elements', 'h1 h2 h3 h4 h5 h6 p div address pre form ' + 'blockquote center dir fieldset header footer article section hgroup aside main nav figure'); + var blockElementsMap = createLookupTable('block_elements', 'hr table tbody thead tfoot ' + 'th tr td li ol ul caption dl dt dd noscript menu isindex option ' + 'datalist select optgroup figcaption details summary', textBlockElementsMap); + var textInlineElementsMap = createLookupTable('text_inline_elements', 'span strong b em i font strike u var cite ' + 'dfn code mark q sup sub samp'); + each$3((settings.special || 'script noscript iframe noframes noembed title style textarea xmp').split(' '), function (name) { + specialElements[name] = new RegExp(']*>', 'gi'); + }); + var patternToRegExp = function (str) { + return new RegExp('^' + str.replace(/([?+*])/g, '.$1') + '$'); + }; + var addValidElements = function (validElements) { + var ei, el, ai, al, matches, element, attr, attrData, elementName, attrName, attrType, attributes, attributesOrder, prefix, outputName, globalAttributes, globalAttributesOrder, value; + var elementRuleRegExp = /^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)])?$/, attrRuleRegExp = /^([!\-])?(\w+[\\:]:\w+|[^=:<]+)?(?:([=:<])(.*))?$/, hasPatternsRegExp = /[*?+]/; + if (validElements) { + var validElementsArr = split(validElements, ','); + if (elements['@']) { + globalAttributes = elements['@'].attributes; + globalAttributesOrder = elements['@'].attributesOrder; + } + for (ei = 0, el = validElementsArr.length; ei < el; ei++) { + matches = elementRuleRegExp.exec(validElementsArr[ei]); + if (matches) { + prefix = matches[1]; + elementName = matches[2]; + outputName = matches[3]; + attrData = matches[5]; + attributes = {}; + attributesOrder = []; + element = { + attributes: attributes, + attributesOrder: attributesOrder + }; + if (prefix === '#') { + element.paddEmpty = true; + } + if (prefix === '-') { + element.removeEmpty = true; + } + if (matches[4] === '!') { + element.removeEmptyAttrs = true; + } + if (globalAttributes) { + each$1(globalAttributes, function (value, key) { + attributes[key] = value; + }); + attributesOrder.push.apply(attributesOrder, globalAttributesOrder); + } + if (attrData) { + attrData = split(attrData, '|'); + for (ai = 0, al = attrData.length; ai < al; ai++) { + matches = attrRuleRegExp.exec(attrData[ai]); + if (matches) { + attr = {}; + attrType = matches[1]; + attrName = matches[2].replace(/[\\:]:/g, ':'); + prefix = matches[3]; + value = matches[4]; + if (attrType === '!') { + element.attributesRequired = element.attributesRequired || []; + element.attributesRequired.push(attrName); + attr.required = true; + } + if (attrType === '-') { + delete attributes[attrName]; + attributesOrder.splice(inArray(attributesOrder, attrName), 1); + continue; + } + if (prefix) { + if (prefix === '=') { + element.attributesDefault = element.attributesDefault || []; + element.attributesDefault.push({ + name: attrName, + value: value + }); + attr.defaultValue = value; + } + if (prefix === ':') { + element.attributesForced = element.attributesForced || []; + element.attributesForced.push({ + name: attrName, + value: value + }); + attr.forcedValue = value; + } + if (prefix === '<') { + attr.validValues = makeMap$2(value, '?'); + } + } + if (hasPatternsRegExp.test(attrName)) { + element.attributePatterns = element.attributePatterns || []; + attr.pattern = patternToRegExp(attrName); + element.attributePatterns.push(attr); + } else { + if (!attributes[attrName]) { + attributesOrder.push(attrName); + } + attributes[attrName] = attr; + } + } + } + } + if (!globalAttributes && elementName === '@') { + globalAttributes = attributes; + globalAttributesOrder = attributesOrder; + } + if (outputName) { + element.outputName = elementName; + elements[outputName] = element; + } + if (hasPatternsRegExp.test(elementName)) { + element.pattern = patternToRegExp(elementName); + patternElements.push(element); + } else { + elements[elementName] = element; + } + } + } + } + }; + var setValidElements = function (validElements) { + elements = {}; + patternElements = []; + addValidElements(validElements); + each$3(schemaItems, function (element, name) { + children[name] = element.children; + }); + }; + var addCustomElements = function (customElements) { + var customElementRegExp = /^(~)?(.+)$/; + if (customElements) { + mapCache.text_block_elements = mapCache.block_elements = null; + each$3(split(customElements, ','), function (rule) { + var matches = customElementRegExp.exec(rule), inline = matches[1] === '~', cloneName = inline ? 'span' : 'div', name = matches[2]; + children[name] = children[cloneName]; + customElementsMap[name] = cloneName; + if (!inline) { + blockElementsMap[name.toUpperCase()] = {}; + blockElementsMap[name] = {}; + } + if (!elements[name]) { + var customRule = elements[cloneName]; + customRule = extend$1({}, customRule); + delete customRule.removeEmptyAttrs; + delete customRule.removeEmpty; + elements[name] = customRule; + } + each$3(children, function (element, elmName) { + if (element[cloneName]) { + children[elmName] = element = extend$1({}, children[elmName]); + element[name] = element[cloneName]; + } + }); + }); + } + }; + var addValidChildren = function (validChildren) { + var childRuleRegExp = /^([+\-]?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)\[([^\]]+)]$/; + mapCache[settings.schema] = null; + if (validChildren) { + each$3(split(validChildren, ','), function (rule) { + var matches = childRuleRegExp.exec(rule); + var parent, prefix; + if (matches) { + prefix = matches[1]; + if (prefix) { + parent = children[matches[2]]; + } else { + parent = children[matches[2]] = { '#comment': {} }; + } + parent = children[matches[2]]; + each$3(split(matches[3], '|'), function (child) { + if (prefix === '-') { + delete parent[child]; + } else { + parent[child] = {}; + } + }); + } + }); + } + }; + var getElementRule = function (name) { + var element = elements[name], i; + if (element) { + return element; + } + i = patternElements.length; + while (i--) { + element = patternElements[i]; + if (element.pattern.test(name)) { + return element; + } + } + }; + if (!settings.valid_elements) { + each$3(schemaItems, function (element, name) { + elements[name] = { + attributes: element.attributes, + attributesOrder: element.attributesOrder + }; + children[name] = element.children; + }); + if (settings.schema !== 'html5') { + each$3(split('strong/b em/i'), function (item) { + var items = split(item, '/'); + elements[items[1]].outputName = items[0]; + }); + } + each$3(split('ol ul sub sup blockquote span font a table tbody strong em b i'), function (name) { + if (elements[name]) { + elements[name].removeEmpty = true; + } + }); + each$3(split('p h1 h2 h3 h4 h5 h6 th td pre div address caption li'), function (name) { + elements[name].paddEmpty = true; + }); + each$3(split('span'), function (name) { + elements[name].removeEmptyAttrs = true; + }); + } else { + setValidElements(settings.valid_elements); + } + addCustomElements(settings.custom_elements); + addValidChildren(settings.valid_children); + addValidElements(settings.extended_valid_elements); + addValidChildren('+ol[ul|ol],+ul[ul|ol]'); + each$3({ + dd: 'dl', + dt: 'dl', + li: 'ul ol', + td: 'tr', + th: 'tr', + tr: 'tbody thead tfoot', + tbody: 'table', + thead: 'table', + tfoot: 'table', + legend: 'fieldset', + area: 'map', + param: 'video audio object' + }, function (parents, item) { + if (elements[item]) { + elements[item].parentsRequired = split(parents); + } + }); + if (settings.invalid_elements) { + each$3(explode$1(settings.invalid_elements), function (item) { + if (elements[item]) { + delete elements[item]; + } + }); + } + if (!getElementRule('span')) { + addValidElements('span[!data-mce-type|*]'); + } + var getValidStyles = function () { + return validStyles; + }; + var getInvalidStyles = function () { + return invalidStyles; + }; + var getValidClasses = function () { + return validClasses; + }; + var getBoolAttrs = function () { + return boolAttrMap; + }; + var getBlockElements = function () { + return blockElementsMap; + }; + var getTextBlockElements = function () { + return textBlockElementsMap; + }; + var getTextInlineElements = function () { + return textInlineElementsMap; + }; + var getShortEndedElements = function () { + return shortEndedElementsMap; + }; + var getSelfClosingElements = function () { + return selfClosingElementsMap; + }; + var getNonEmptyElements = function () { + return nonEmptyElementsMap; + }; + var getMoveCaretBeforeOnEnterElements = function () { + return moveCaretBeforeOnEnterElementsMap; + }; + var getWhiteSpaceElements = function () { + return whiteSpaceElementsMap; + }; + var getSpecialElements = function () { + return specialElements; + }; + var isValidChild = function (name, child) { + var parent = children[name.toLowerCase()]; + return !!(parent && parent[child.toLowerCase()]); + }; + var isValid = function (name, attr) { + var attrPatterns, i; + var rule = getElementRule(name); + if (rule) { + if (attr) { + if (rule.attributes[attr]) { + return true; + } + attrPatterns = rule.attributePatterns; + if (attrPatterns) { + i = attrPatterns.length; + while (i--) { + if (attrPatterns[i].pattern.test(name)) { + return true; + } + } + } + } else { + return true; + } + } + return false; + }; + var getCustomElements = function () { + return customElementsMap; + }; + return { + children: children, + elements: elements, + getValidStyles: getValidStyles, + getValidClasses: getValidClasses, + getBlockElements: getBlockElements, + getInvalidStyles: getInvalidStyles, + getShortEndedElements: getShortEndedElements, + getTextBlockElements: getTextBlockElements, + getTextInlineElements: getTextInlineElements, + getBoolAttrs: getBoolAttrs, + getElementRule: getElementRule, + getSelfClosingElements: getSelfClosingElements, + getNonEmptyElements: getNonEmptyElements, + getMoveCaretBeforeOnEnterElements: getMoveCaretBeforeOnEnterElements, + getWhiteSpaceElements: getWhiteSpaceElements, + getSpecialElements: getSpecialElements, + isValidChild: isValidChild, + isValid: isValid, + getCustomElements: getCustomElements, + addValidElements: addValidElements, + setValidElements: setValidElements, + addCustomElements: addCustomElements, + addValidChildren: addValidChildren + }; + } + + var toHex = function (match, r, g, b) { + var hex = function (val) { + val = parseInt(val, 10).toString(16); + return val.length > 1 ? val : '0' + val; + }; + return '#' + hex(r) + hex(g) + hex(b); + }; + var Styles = function (settings, schema) { + var rgbRegExp = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi; + var urlOrStrRegExp = /(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi; + var styleRegExp = /\s*([^:]+):\s*([^;]+);?/g; + var trimRightRegExp = /\s+$/; + var i; + var encodingLookup = {}; + var validStyles; + var invalidStyles; + var invisibleChar = zeroWidth; + settings = settings || {}; + if (schema) { + validStyles = schema.getValidStyles(); + invalidStyles = schema.getInvalidStyles(); + } + var encodingItems = ('\\" \\\' \\; \\: ; : ' + invisibleChar).split(' '); + for (i = 0; i < encodingItems.length; i++) { + encodingLookup[encodingItems[i]] = invisibleChar + i; + encodingLookup[invisibleChar + i] = encodingItems[i]; + } + return { + toHex: function (color) { + return color.replace(rgbRegExp, toHex); + }, + parse: function (css) { + var styles = {}; + var matches, name, value, isEncoded; + var urlConverter = settings.url_converter; + var urlConverterScope = settings.url_converter_scope || this; + var compress = function (prefix, suffix, noJoin) { + var top = styles[prefix + '-top' + suffix]; + if (!top) { + return; + } + var right = styles[prefix + '-right' + suffix]; + if (!right) { + return; + } + var bottom = styles[prefix + '-bottom' + suffix]; + if (!bottom) { + return; + } + var left = styles[prefix + '-left' + suffix]; + if (!left) { + return; + } + var box = [ + top, + right, + bottom, + left + ]; + i = box.length - 1; + while (i--) { + if (box[i] !== box[i + 1]) { + break; + } + } + if (i > -1 && noJoin) { + return; + } + styles[prefix + suffix] = i === -1 ? box[0] : box.join(' '); + delete styles[prefix + '-top' + suffix]; + delete styles[prefix + '-right' + suffix]; + delete styles[prefix + '-bottom' + suffix]; + delete styles[prefix + '-left' + suffix]; + }; + var canCompress = function (key) { + var value = styles[key], i; + if (!value) { + return; + } + value = value.split(' '); + i = value.length; + while (i--) { + if (value[i] !== value[0]) { + return false; + } + } + styles[key] = value[0]; + return true; + }; + var compress2 = function (target, a, b, c) { + if (!canCompress(a)) { + return; + } + if (!canCompress(b)) { + return; + } + if (!canCompress(c)) { + return; + } + styles[target] = styles[a] + ' ' + styles[b] + ' ' + styles[c]; + delete styles[a]; + delete styles[b]; + delete styles[c]; + }; + var encode = function (str) { + isEncoded = true; + return encodingLookup[str]; + }; + var decode = function (str, keepSlashes) { + if (isEncoded) { + str = str.replace(/\uFEFF[0-9]/g, function (str) { + return encodingLookup[str]; + }); + } + if (!keepSlashes) { + str = str.replace(/\\([\'\";:])/g, '$1'); + } + return str; + }; + var decodeSingleHexSequence = function (escSeq) { + return String.fromCharCode(parseInt(escSeq.slice(1), 16)); + }; + var decodeHexSequences = function (value) { + return value.replace(/\\[0-9a-f]+/gi, decodeSingleHexSequence); + }; + var processUrl = function (match, url, url2, url3, str, str2) { + str = str || str2; + if (str) { + str = decode(str); + return '\'' + str.replace(/\'/g, '\\\'') + '\''; + } + url = decode(url || url2 || url3); + if (!settings.allow_script_urls) { + var scriptUrl = url.replace(/[\s\r\n]+/g, ''); + if (/(java|vb)script:/i.test(scriptUrl)) { + return ''; + } + if (!settings.allow_svg_data_urls && /^data:image\/svg/i.test(scriptUrl)) { + return ''; + } + } + if (urlConverter) { + url = urlConverter.call(urlConverterScope, url, 'style'); + } + return 'url(\'' + url.replace(/\'/g, '\\\'') + '\')'; + }; + if (css) { + css = css.replace(/[\u0000-\u001F]/g, ''); + css = css.replace(/\\[\"\';:\uFEFF]/g, encode).replace(/\"[^\"]+\"|\'[^\']+\'/g, function (str) { + return str.replace(/[;:]/g, encode); + }); + while (matches = styleRegExp.exec(css)) { + styleRegExp.lastIndex = matches.index + matches[0].length; + name = matches[1].replace(trimRightRegExp, '').toLowerCase(); + value = matches[2].replace(trimRightRegExp, ''); + if (name && value) { + name = decodeHexSequences(name); + value = decodeHexSequences(value); + if (name.indexOf(invisibleChar) !== -1 || name.indexOf('"') !== -1) { + continue; + } + if (!settings.allow_script_urls && (name === 'behavior' || /expression\s*\(|\/\*|\*\//.test(value))) { + continue; + } + if (name === 'font-weight' && value === '700') { + value = 'bold'; + } else if (name === 'color' || name === 'background-color') { + value = value.toLowerCase(); + } + value = value.replace(rgbRegExp, toHex); + value = value.replace(urlOrStrRegExp, processUrl); + styles[name] = isEncoded ? decode(value, true) : value; + } + } + compress('border', '', true); + compress('border', '-width'); + compress('border', '-color'); + compress('border', '-style'); + compress('padding', ''); + compress('margin', ''); + compress2('border', 'border-width', 'border-style', 'border-color'); + if (styles.border === 'medium none') { + delete styles.border; + } + if (styles['border-image'] === 'none') { + delete styles['border-image']; + } + } + return styles; + }, + serialize: function (styles, elementName) { + var css = ''; + var serializeStyles = function (name) { + var value; + var styleList = validStyles[name]; + if (styleList) { + for (var i_1 = 0, l = styleList.length; i_1 < l; i_1++) { + name = styleList[i_1]; + value = styles[name]; + if (value) { + css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';'; + } + } + } + }; + var isValid = function (name, elementName) { + var styleMap = invalidStyles['*']; + if (styleMap && styleMap[name]) { + return false; + } + styleMap = invalidStyles[elementName]; + return !(styleMap && styleMap[name]); + }; + if (elementName && validStyles) { + serializeStyles('*'); + serializeStyles(elementName); + } else { + each$1(styles, function (value, name) { + if (value && (!invalidStyles || isValid(name, elementName))) { + css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';'; + } + }); + } + return css; + } + }; + }; + + var eventExpandoPrefix = 'mce-data-'; + var mouseEventRe = /^(?:mouse|contextmenu)|click/; + var deprecated = { + keyLocation: 1, + layerX: 1, + layerY: 1, + returnValue: 1, + webkitMovementX: 1, + webkitMovementY: 1, + keyIdentifier: 1, + mozPressure: 1 + }; + var hasIsDefaultPrevented = function (event) { + return event.isDefaultPrevented === returnTrue || event.isDefaultPrevented === returnFalse; + }; + var returnFalse = function () { + return false; + }; + var returnTrue = function () { + return true; + }; + var addEvent = function (target, name, callback, capture) { + if (target.addEventListener) { + target.addEventListener(name, callback, capture || false); + } else if (target.attachEvent) { + target.attachEvent('on' + name, callback); + } + }; + var removeEvent = function (target, name, callback, capture) { + if (target.removeEventListener) { + target.removeEventListener(name, callback, capture || false); + } else if (target.detachEvent) { + target.detachEvent('on' + name, callback); + } + }; + var isMouseEvent = function (event) { + return mouseEventRe.test(event.type); + }; + var fix = function (originalEvent, data) { + var name; + var event = data || {}; + for (name in originalEvent) { + if (!deprecated[name]) { + event[name] = originalEvent[name]; + } + } + if (!event.target) { + event.target = event.srcElement || document; + } + if (event.composedPath) { + event.composedPath = function () { + return originalEvent.composedPath(); + }; + } + if (originalEvent && isMouseEvent(originalEvent) && originalEvent.pageX === undefined && originalEvent.clientX !== undefined) { + var eventDoc = event.target.ownerDocument || document; + var doc = eventDoc.documentElement; + var body = eventDoc.body; + event.pageX = originalEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); + event.pageY = originalEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); + } + event.preventDefault = function () { + event.isDefaultPrevented = returnTrue; + if (originalEvent) { + if (originalEvent.preventDefault) { + originalEvent.preventDefault(); + } else { + originalEvent.returnValue = false; + } + } + }; + event.stopPropagation = function () { + event.isPropagationStopped = returnTrue; + if (originalEvent) { + if (originalEvent.stopPropagation) { + originalEvent.stopPropagation(); + } else { + originalEvent.cancelBubble = true; + } + } + }; + event.stopImmediatePropagation = function () { + event.isImmediatePropagationStopped = returnTrue; + event.stopPropagation(); + }; + if (hasIsDefaultPrevented(event) === false) { + event.isDefaultPrevented = returnFalse; + event.isPropagationStopped = returnFalse; + event.isImmediatePropagationStopped = returnFalse; + } + if (typeof event.metaKey === 'undefined') { + event.metaKey = false; + } + return event; + }; + var bindOnReady = function (win, callback, eventUtils) { + var doc = win.document, event = { type: 'ready' }; + if (eventUtils.domLoaded) { + callback(event); + return; + } + var isDocReady = function () { + return doc.readyState === 'complete' || doc.readyState === 'interactive' && doc.body; + }; + var readyHandler = function () { + removeEvent(win, 'DOMContentLoaded', readyHandler); + removeEvent(win, 'load', readyHandler); + if (!eventUtils.domLoaded) { + eventUtils.domLoaded = true; + callback(event); + } + win = null; + }; + if (isDocReady()) { + readyHandler(); + } else { + addEvent(win, 'DOMContentLoaded', readyHandler); + } + if (!eventUtils.domLoaded) { + addEvent(win, 'load', readyHandler); + } + }; + var EventUtils = function () { + function EventUtils() { + this.domLoaded = false; + this.events = {}; + this.count = 1; + this.expando = eventExpandoPrefix + (+new Date()).toString(32); + this.hasMouseEnterLeave = 'onmouseenter' in document.documentElement; + this.hasFocusIn = 'onfocusin' in document.documentElement; + this.count = 1; + } + EventUtils.prototype.bind = function (target, names, callback, scope) { + var self = this; + var id, callbackList, i, name, fakeName, nativeHandler, capture; + var win = window; + var defaultNativeHandler = function (evt) { + self.executeHandlers(fix(evt || win.event), id); + }; + if (!target || target.nodeType === 3 || target.nodeType === 8) { + return; + } + if (!target[self.expando]) { + id = self.count++; + target[self.expando] = id; + self.events[id] = {}; + } else { + id = target[self.expando]; + } + scope = scope || target; + var namesList = names.split(' '); + i = namesList.length; + while (i--) { + name = namesList[i]; + nativeHandler = defaultNativeHandler; + fakeName = capture = false; + if (name === 'DOMContentLoaded') { + name = 'ready'; + } + if (self.domLoaded && name === 'ready' && target.readyState === 'complete') { + callback.call(scope, fix({ type: name })); + continue; + } + if (!self.hasMouseEnterLeave) { + fakeName = self.mouseEnterLeave[name]; + if (fakeName) { + nativeHandler = function (evt) { + var current = evt.currentTarget; + var related = evt.relatedTarget; + if (related && current.contains) { + related = current.contains(related); + } else { + while (related && related !== current) { + related = related.parentNode; + } + } + if (!related) { + evt = fix(evt || win.event); + evt.type = evt.type === 'mouseout' ? 'mouseleave' : 'mouseenter'; + evt.target = current; + self.executeHandlers(evt, id); + } + }; + } + } + if (!self.hasFocusIn && (name === 'focusin' || name === 'focusout')) { + capture = true; + fakeName = name === 'focusin' ? 'focus' : 'blur'; + nativeHandler = function (evt) { + evt = fix(evt || win.event); + evt.type = evt.type === 'focus' ? 'focusin' : 'focusout'; + self.executeHandlers(evt, id); + }; + } + callbackList = self.events[id][name]; + if (!callbackList) { + self.events[id][name] = callbackList = [{ + func: callback, + scope: scope + }]; + callbackList.fakeName = fakeName; + callbackList.capture = capture; + callbackList.nativeHandler = nativeHandler; + if (name === 'ready') { + bindOnReady(target, nativeHandler, self); + } else { + addEvent(target, fakeName || name, nativeHandler, capture); + } + } else { + if (name === 'ready' && self.domLoaded) { + callback(fix({ type: name })); + } else { + callbackList.push({ + func: callback, + scope: scope + }); + } + } + } + target = callbackList = null; + return callback; + }; + EventUtils.prototype.unbind = function (target, names, callback) { + var callbackList, i, ci, name, eventMap; + if (!target || target.nodeType === 3 || target.nodeType === 8) { + return this; + } + var id = target[this.expando]; + if (id) { + eventMap = this.events[id]; + if (names) { + var namesList = names.split(' '); + i = namesList.length; + while (i--) { + name = namesList[i]; + callbackList = eventMap[name]; + if (callbackList) { + if (callback) { + ci = callbackList.length; + while (ci--) { + if (callbackList[ci].func === callback) { + var nativeHandler = callbackList.nativeHandler; + var fakeName = callbackList.fakeName, capture = callbackList.capture; + callbackList = callbackList.slice(0, ci).concat(callbackList.slice(ci + 1)); + callbackList.nativeHandler = nativeHandler; + callbackList.fakeName = fakeName; + callbackList.capture = capture; + eventMap[name] = callbackList; + } + } + } + if (!callback || callbackList.length === 0) { + delete eventMap[name]; + removeEvent(target, callbackList.fakeName || name, callbackList.nativeHandler, callbackList.capture); + } + } + } + } else { + each$1(eventMap, function (callbackList, name) { + removeEvent(target, callbackList.fakeName || name, callbackList.nativeHandler, callbackList.capture); + }); + eventMap = {}; + } + for (name in eventMap) { + if (has(eventMap, name)) { + return this; + } + } + delete this.events[id]; + try { + delete target[this.expando]; + } catch (ex) { + target[this.expando] = null; + } + } + return this; + }; + EventUtils.prototype.fire = function (target, name, args) { + var id; + if (!target || target.nodeType === 3 || target.nodeType === 8) { + return this; + } + var event = fix(null, args); + event.type = name; + event.target = target; + do { + id = target[this.expando]; + if (id) { + this.executeHandlers(event, id); + } + target = target.parentNode || target.ownerDocument || target.defaultView || target.parentWindow; + } while (target && !event.isPropagationStopped()); + return this; + }; + EventUtils.prototype.clean = function (target) { + var i, children; + if (!target || target.nodeType === 3 || target.nodeType === 8) { + return this; + } + if (target[this.expando]) { + this.unbind(target); + } + if (!target.getElementsByTagName) { + target = target.document; + } + if (target && target.getElementsByTagName) { + this.unbind(target); + children = target.getElementsByTagName('*'); + i = children.length; + while (i--) { + target = children[i]; + if (target[this.expando]) { + this.unbind(target); + } + } + } + return this; + }; + EventUtils.prototype.destroy = function () { + this.events = {}; + }; + EventUtils.prototype.cancel = function (e) { + if (e) { + e.preventDefault(); + e.stopImmediatePropagation(); + } + return false; + }; + EventUtils.prototype.executeHandlers = function (evt, id) { + var container = this.events[id]; + var callbackList = container && container[evt.type]; + if (callbackList) { + for (var i = 0, l = callbackList.length; i < l; i++) { + var callback = callbackList[i]; + if (callback && callback.func.call(callback.scope, evt) === false) { + evt.preventDefault(); + } + if (evt.isImmediatePropagationStopped()) { + return; + } + } + } + }; + EventUtils.Event = new EventUtils(); + return EventUtils; + }(); + + var support, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, setDocument, document$1, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains$3, expando = 'sizzle' + -new Date(), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), sortOrder = function (a, b) { + if (a === b) { + hasDuplicate = true; + } + return 0; + }, strundefined = typeof undefined, MAX_NEGATIVE = 1 << 31, hasOwn = {}.hasOwnProperty, arr = [], pop = arr.pop, push_native = arr.push, push = arr.push, slice = arr.slice, indexOf$2 = arr.indexOf || function (elem) { + var i = 0, len = this.length; + for (; i < len; i++) { + if (this[i] === elem) { + return i; + } + } + return -1; + }, booleans = 'checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped', whitespace = '[\\x20\\t\\r\\n\\f]', identifier = '(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+', attributes = '\\[' + whitespace + '*(' + identifier + ')(?:' + whitespace + '*([*^$|!~]?=)' + whitespace + '*(?:\'((?:\\\\.|[^\\\\\'])*)\'|"((?:\\\\.|[^\\\\"])*)"|(' + identifier + '))|)' + whitespace + '*\\]', pseudos = ':(' + identifier + ')(?:\\((' + '(\'((?:\\\\.|[^\\\\\'])*)\'|"((?:\\\\.|[^\\\\"])*)")|' + '((?:\\\\.|[^\\\\()[\\]]|' + attributes + ')*)|' + '.*' + ')\\)|)', rtrim = new RegExp('^' + whitespace + '+|((?:^|[^\\\\])(?:\\\\.)*)' + whitespace + '+$', 'g'), rcomma = new RegExp('^' + whitespace + '*,' + whitespace + '*'), rcombinators = new RegExp('^' + whitespace + '*([>+~]|' + whitespace + ')' + whitespace + '*'), rattributeQuotes = new RegExp('=' + whitespace + '*([^\\]\'"]*?)' + whitespace + '*\\]', 'g'), rpseudo = new RegExp(pseudos), ridentifier = new RegExp('^' + identifier + '$'), matchExpr = { + ID: new RegExp('^#(' + identifier + ')'), + CLASS: new RegExp('^\\.(' + identifier + ')'), + TAG: new RegExp('^(' + identifier + '|[*])'), + ATTR: new RegExp('^' + attributes), + PSEUDO: new RegExp('^' + pseudos), + CHILD: new RegExp('^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(' + whitespace + '*(even|odd|(([+-]|)(\\d*)n|)' + whitespace + '*(?:([+-]|)' + whitespace + '*(\\d+)|))' + whitespace + '*\\)|)', 'i'), + bool: new RegExp('^(?:' + booleans + ')$', 'i'), + needsContext: new RegExp('^' + whitespace + '*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(' + whitespace + '*((?:-\\d)?\\d*)' + whitespace + '*\\)|)(?=[^-]|$)', 'i') + }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rnative = /^[^{]+\{\s*\[native \w/, rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, rescape = /'|\\/g, runescape = new RegExp('\\\\([\\da-f]{1,6}' + whitespace + '?|(' + whitespace + ')|.)', 'ig'), funescape = function (_, escaped, escapedWhitespace) { + var high = '0x' + escaped - 65536; + return high !== high || escapedWhitespace ? escaped : high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320); + }; + try { + push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes); + arr[preferredDoc.childNodes.length].nodeType; + } catch (e) { + push = { + apply: arr.length ? function (target, els) { + push_native.apply(target, slice.call(els)); + } : function (target, els) { + var j = target.length, i = 0; + while (target[j++] = els[i++]) { + } + target.length = j - 1; + } + }; + } + var Sizzle = function (selector, context, results, seed) { + var match, elem, m, nodeType, i, groups, old, nid, newContext, newSelector; + if ((context ? context.ownerDocument || context : preferredDoc) !== document$1) { + setDocument(context); + } + context = context || document$1; + results = results || []; + if (!selector || typeof selector !== 'string') { + return results; + } + if ((nodeType = context.nodeType) !== 1 && nodeType !== 9) { + return []; + } + if (documentIsHTML && !seed) { + if (match = rquickExpr.exec(selector)) { + if (m = match[1]) { + if (nodeType === 9) { + elem = context.getElementById(m); + if (elem && elem.parentNode) { + if (elem.id === m) { + results.push(elem); + return results; + } + } else { + return results; + } + } else { + if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) && contains$3(context, elem) && elem.id === m) { + results.push(elem); + return results; + } + } + } else if (match[2]) { + push.apply(results, context.getElementsByTagName(selector)); + return results; + } else if ((m = match[3]) && support.getElementsByClassName) { + push.apply(results, context.getElementsByClassName(m)); + return results; + } + } + if (support.qsa && (!rbuggyQSA || !rbuggyQSA.test(selector))) { + nid = old = expando; + newContext = context; + newSelector = nodeType === 9 && selector; + if (nodeType === 1 && context.nodeName.toLowerCase() !== 'object') { + groups = tokenize(selector); + if (old = context.getAttribute('id')) { + nid = old.replace(rescape, '\\$&'); + } else { + context.setAttribute('id', nid); + } + nid = '[id=\'' + nid + '\'] '; + i = groups.length; + while (i--) { + groups[i] = nid + toSelector(groups[i]); + } + newContext = rsibling.test(selector) && testContext(context.parentNode) || context; + newSelector = groups.join(','); + } + if (newSelector) { + try { + push.apply(results, newContext.querySelectorAll(newSelector)); + return results; + } catch (qsaError) { + } finally { + if (!old) { + context.removeAttribute('id'); + } + } + } + } + } + return select(selector.replace(rtrim, '$1'), context, results, seed); + }; + function createCache() { + var keys = []; + function cache(key, value) { + if (keys.push(key + ' ') > Expr.cacheLength) { + delete cache[keys.shift()]; + } + return cache[key + ' '] = value; + } + return cache; + } + function markFunction(fn) { + fn[expando] = true; + return fn; + } + function siblingCheck(a, b) { + var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && (~b.sourceIndex || MAX_NEGATIVE) - (~a.sourceIndex || MAX_NEGATIVE); + if (diff) { + return diff; + } + if (cur) { + while (cur = cur.nextSibling) { + if (cur === b) { + return -1; + } + } + } + return a ? 1 : -1; + } + function createInputPseudo(type) { + return function (elem) { + var name = elem.nodeName.toLowerCase(); + return name === 'input' && elem.type === type; + }; + } + function createButtonPseudo(type) { + return function (elem) { + var name = elem.nodeName.toLowerCase(); + return (name === 'input' || name === 'button') && elem.type === type; + }; + } + function createPositionalPseudo(fn) { + return markFunction(function (argument) { + argument = +argument; + return markFunction(function (seed, matches) { + var j, matchIndexes = fn([], seed.length, argument), i = matchIndexes.length; + while (i--) { + if (seed[j = matchIndexes[i]]) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); + } + function testContext(context) { + return context && typeof context.getElementsByTagName !== strundefined && context; + } + support = Sizzle.support = {}; + isXML = Sizzle.isXML = function (elem) { + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== 'HTML' : false; + }; + setDocument = Sizzle.setDocument = function (node) { + var hasCompare, doc = node ? node.ownerDocument || node : preferredDoc, parent = doc.defaultView; + function getTop(win) { + try { + return win.top; + } catch (ex) { + } + return null; + } + if (doc === document$1 || doc.nodeType !== 9 || !doc.documentElement) { + return document$1; + } + document$1 = doc; + docElem = doc.documentElement; + documentIsHTML = !isXML(doc); + if (parent && parent !== getTop(parent)) { + if (parent.addEventListener) { + parent.addEventListener('unload', function () { + setDocument(); + }, false); + } else if (parent.attachEvent) { + parent.attachEvent('onunload', function () { + setDocument(); + }); + } + } + support.attributes = true; + support.getElementsByTagName = true; + support.getElementsByClassName = rnative.test(doc.getElementsByClassName); + support.getById = true; + Expr.find.ID = function (id, context) { + if (typeof context.getElementById !== strundefined && documentIsHTML) { + var m = context.getElementById(id); + return m && m.parentNode ? [m] : []; + } + }; + Expr.filter.ID = function (id) { + var attrId = id.replace(runescape, funescape); + return function (elem) { + return elem.getAttribute('id') === attrId; + }; + }; + Expr.find.TAG = support.getElementsByTagName ? function (tag, context) { + if (typeof context.getElementsByTagName !== strundefined) { + return context.getElementsByTagName(tag); + } + } : function (tag, context) { + var elem, tmp = [], i = 0, results = context.getElementsByTagName(tag); + if (tag === '*') { + while (elem = results[i++]) { + if (elem.nodeType === 1) { + tmp.push(elem); + } + } + return tmp; + } + return results; + }; + Expr.find.CLASS = support.getElementsByClassName && function (className, context) { + if (documentIsHTML) { + return context.getElementsByClassName(className); + } + }; + rbuggyMatches = []; + rbuggyQSA = []; + support.disconnectedMatch = true; + rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join('|')); + rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join('|')); + hasCompare = rnative.test(docElem.compareDocumentPosition); + contains$3 = hasCompare || rnative.test(docElem.contains) ? function (a, b) { + var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; + return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16)); + } : function (a, b) { + if (b) { + while (b = b.parentNode) { + if (b === a) { + return true; + } + } + } + return false; + }; + sortOrder = hasCompare ? function (a, b) { + if (a === b) { + hasDuplicate = true; + return 0; + } + var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; + if (compare) { + return compare; + } + compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1; + if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) { + if (a === doc || a.ownerDocument === preferredDoc && contains$3(preferredDoc, a)) { + return -1; + } + if (b === doc || b.ownerDocument === preferredDoc && contains$3(preferredDoc, b)) { + return 1; + } + return sortInput ? indexOf$2.call(sortInput, a) - indexOf$2.call(sortInput, b) : 0; + } + return compare & 4 ? -1 : 1; + } : function (a, b) { + if (a === b) { + hasDuplicate = true; + return 0; + } + var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [a], bp = [b]; + if (!aup || !bup) { + return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf$2.call(sortInput, a) - indexOf$2.call(sortInput, b) : 0; + } else if (aup === bup) { + return siblingCheck(a, b); + } + cur = a; + while (cur = cur.parentNode) { + ap.unshift(cur); + } + cur = b; + while (cur = cur.parentNode) { + bp.unshift(cur); + } + while (ap[i] === bp[i]) { + i++; + } + return i ? siblingCheck(ap[i], bp[i]) : ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0; + }; + return doc; + }; + Sizzle.matches = function (expr, elements) { + return Sizzle(expr, null, null, elements); + }; + Sizzle.matchesSelector = function (elem, expr) { + if ((elem.ownerDocument || elem) !== document$1) { + setDocument(elem); + } + expr = expr.replace(rattributeQuotes, '=\'$1\']'); + if (support.matchesSelector && documentIsHTML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) { + try { + var ret = matches.call(elem, expr); + if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) { + return ret; + } + } catch (e) { + } + } + return Sizzle(expr, document$1, null, [elem]).length > 0; + }; + Sizzle.contains = function (context, elem) { + if ((context.ownerDocument || context) !== document$1) { + setDocument(context); + } + return contains$3(context, elem); + }; + Sizzle.attr = function (elem, name) { + if ((elem.ownerDocument || elem) !== document$1) { + setDocument(elem); + } + var fn = Expr.attrHandle[name.toLowerCase()], val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined; + return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null; + }; + Sizzle.error = function (msg) { + throw new Error('Syntax error, unrecognized expression: ' + msg); + }; + Sizzle.uniqueSort = function (results) { + var elem, duplicates = [], j = 0, i = 0; + hasDuplicate = !support.detectDuplicates; + sortInput = !support.sortStable && results.slice(0); + results.sort(sortOrder); + if (hasDuplicate) { + while (elem = results[i++]) { + if (elem === results[i]) { + j = duplicates.push(i); + } + } + while (j--) { + results.splice(duplicates[j], 1); + } + } + sortInput = null; + return results; + }; + getText = Sizzle.getText = function (elem) { + var node, ret = '', i = 0, nodeType = elem.nodeType; + if (!nodeType) { + while (node = elem[i++]) { + ret += getText(node); + } + } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) { + if (typeof elem.textContent === 'string') { + return elem.textContent; + } else { + for (elem = elem.firstChild; elem; elem = elem.nextSibling) { + ret += getText(elem); + } + } + } else if (nodeType === 3 || nodeType === 4) { + return elem.nodeValue; + } + return ret; + }; + Expr = Sizzle.selectors = { + cacheLength: 50, + createPseudo: markFunction, + match: matchExpr, + attrHandle: {}, + find: {}, + relative: { + '>': { + dir: 'parentNode', + first: true + }, + ' ': { dir: 'parentNode' }, + '+': { + dir: 'previousSibling', + first: true + }, + '~': { dir: 'previousSibling' } + }, + preFilter: { + ATTR: function (match) { + match[1] = match[1].replace(runescape, funescape); + match[3] = (match[3] || match[4] || match[5] || '').replace(runescape, funescape); + if (match[2] === '~=') { + match[3] = ' ' + match[3] + ' '; + } + return match.slice(0, 4); + }, + CHILD: function (match) { + match[1] = match[1].toLowerCase(); + if (match[1].slice(0, 3) === 'nth') { + if (!match[3]) { + Sizzle.error(match[0]); + } + match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === 'even' || match[3] === 'odd')); + match[5] = +(match[7] + match[8] || match[3] === 'odd'); + } else if (match[3]) { + Sizzle.error(match[0]); + } + return match; + }, + PSEUDO: function (match) { + var excess, unquoted = !match[6] && match[2]; + if (matchExpr.CHILD.test(match[0])) { + return null; + } + if (match[3]) { + match[2] = match[4] || match[5] || ''; + } else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(')', unquoted.length - excess) - unquoted.length)) { + match[0] = match[0].slice(0, excess); + match[2] = unquoted.slice(0, excess); + } + return match.slice(0, 3); + } + }, + filter: { + TAG: function (nodeNameSelector) { + var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase(); + return nodeNameSelector === '*' ? function () { + return true; + } : function (elem) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + CLASS: function (className) { + var pattern = classCache[className + ' ']; + return pattern || (pattern = new RegExp('(^|' + whitespace + ')' + className + '(' + whitespace + '|$)')) && classCache(className, function (elem) { + return pattern.test(typeof elem.className === 'string' && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute('class') || ''); + }); + }, + ATTR: function (name, operator, check) { + return function (elem) { + var result = Sizzle.attr(elem, name); + if (result == null) { + return operator === '!='; + } + if (!operator) { + return true; + } + result += ''; + return operator === '=' ? result === check : operator === '!=' ? result !== check : operator === '^=' ? check && result.indexOf(check) === 0 : operator === '*=' ? check && result.indexOf(check) > -1 : operator === '$=' ? check && result.slice(-check.length) === check : operator === '~=' ? (' ' + result + ' ').indexOf(check) > -1 : operator === '|=' ? result === check || result.slice(0, check.length + 1) === check + '-' : false; + }; + }, + CHILD: function (type, what, argument, first, last) { + var simple = type.slice(0, 3) !== 'nth', forward = type.slice(-4) !== 'last', ofType = what === 'of-type'; + return first === 1 && last === 0 ? function (elem) { + return !!elem.parentNode; + } : function (elem, context, xml) { + var cache, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? 'nextSibling' : 'previousSibling', parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType; + if (parent) { + if (simple) { + while (dir) { + node = elem; + while (node = node[dir]) { + if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) { + return false; + } + } + start = dir = type === 'only' && !start && 'nextSibling'; + } + return true; + } + start = [forward ? parent.firstChild : parent.lastChild]; + if (forward && useCache) { + outerCache = parent[expando] || (parent[expando] = {}); + cache = outerCache[type] || []; + nodeIndex = cache[0] === dirruns && cache[1]; + diff = cache[0] === dirruns && cache[2]; + node = nodeIndex && parent.childNodes[nodeIndex]; + while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) { + if (node.nodeType === 1 && ++diff && node === elem) { + outerCache[type] = [ + dirruns, + nodeIndex, + diff + ]; + break; + } + } + } else if (useCache && (cache = (elem[expando] || (elem[expando] = {}))[type]) && cache[0] === dirruns) { + diff = cache[1]; + } else { + while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) { + if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) { + if (useCache) { + (node[expando] || (node[expando] = {}))[type] = [ + dirruns, + diff + ]; + } + if (node === elem) { + break; + } + } + } + } + diff -= last; + return diff === first || diff % first === 0 && diff / first >= 0; + } + }; + }, + PSEUDO: function (pseudo, argument) { + var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error('unsupported pseudo: ' + pseudo); + if (fn[expando]) { + return fn(argument); + } + if (fn.length > 1) { + args = [ + pseudo, + pseudo, + '', + argument + ]; + return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) { + var idx, matched = fn(seed, argument), i = matched.length; + while (i--) { + idx = indexOf$2.call(seed, matched[i]); + seed[idx] = !(matches[idx] = matched[i]); + } + }) : function (elem) { + return fn(elem, 0, args); + }; + } + return fn; + } + }, + pseudos: { + not: markFunction(function (selector) { + var input = [], results = [], matcher = compile(selector.replace(rtrim, '$1')); + return matcher[expando] ? markFunction(function (seed, matches, context, xml) { + var elem, unmatched = matcher(seed, null, xml, []), i = seed.length; + while (i--) { + if (elem = unmatched[i]) { + seed[i] = !(matches[i] = elem); + } + } + }) : function (elem, context, xml) { + input[0] = elem; + matcher(input, null, xml, results); + return !results.pop(); + }; + }), + has: markFunction(function (selector) { + return function (elem) { + return Sizzle(selector, elem).length > 0; + }; + }), + contains: markFunction(function (text) { + text = text.replace(runescape, funescape); + return function (elem) { + return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1; + }; + }), + lang: markFunction(function (lang) { + if (!ridentifier.test(lang || '')) { + Sizzle.error('unsupported lang: ' + lang); + } + lang = lang.replace(runescape, funescape).toLowerCase(); + return function (elem) { + var elemLang; + do { + if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute('xml:lang') || elem.getAttribute('lang')) { + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf(lang + '-') === 0; + } + } while ((elem = elem.parentNode) && elem.nodeType === 1); + return false; + }; + }), + target: function (elem) { + var hash = window.location && window.location.hash; + return hash && hash.slice(1) === elem.id; + }, + root: function (elem) { + return elem === docElem; + }, + focus: function (elem) { + return elem === document$1.activeElement && (!document$1.hasFocus || document$1.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + enabled: function (elem) { + return elem.disabled === false; + }, + disabled: function (elem) { + return elem.disabled === true; + }, + checked: function (elem) { + var nodeName = elem.nodeName.toLowerCase(); + return nodeName === 'input' && !!elem.checked || nodeName === 'option' && !!elem.selected; + }, + selected: function (elem) { + if (elem.parentNode) { + elem.parentNode.selectedIndex; + } + return elem.selected === true; + }, + empty: function (elem) { + for (elem = elem.firstChild; elem; elem = elem.nextSibling) { + if (elem.nodeType < 6) { + return false; + } + } + return true; + }, + parent: function (elem) { + return !Expr.pseudos.empty(elem); + }, + header: function (elem) { + return rheader.test(elem.nodeName); + }, + input: function (elem) { + return rinputs.test(elem.nodeName); + }, + button: function (elem) { + var name = elem.nodeName.toLowerCase(); + return name === 'input' && elem.type === 'button' || name === 'button'; + }, + text: function (elem) { + var attr; + return elem.nodeName.toLowerCase() === 'input' && elem.type === 'text' && ((attr = elem.getAttribute('type')) == null || attr.toLowerCase() === 'text'); + }, + first: createPositionalPseudo(function () { + return [0]; + }), + last: createPositionalPseudo(function (matchIndexes, length) { + return [length - 1]; + }), + eq: createPositionalPseudo(function (matchIndexes, length, argument) { + return [argument < 0 ? argument + length : argument]; + }), + even: createPositionalPseudo(function (matchIndexes, length) { + var i = 0; + for (; i < length; i += 2) { + matchIndexes.push(i); + } + return matchIndexes; + }), + odd: createPositionalPseudo(function (matchIndexes, length) { + var i = 1; + for (; i < length; i += 2) { + matchIndexes.push(i); + } + return matchIndexes; + }), + lt: createPositionalPseudo(function (matchIndexes, length, argument) { + var i = argument < 0 ? argument + length : argument; + for (; --i >= 0;) { + matchIndexes.push(i); + } + return matchIndexes; + }), + gt: createPositionalPseudo(function (matchIndexes, length, argument) { + var i = argument < 0 ? argument + length : argument; + for (; ++i < length;) { + matchIndexes.push(i); + } + return matchIndexes; + }) + } + }; + Expr.pseudos.nth = Expr.pseudos.eq; + each([ + 'radio', + 'checkbox', + 'file', + 'password', + 'image' + ], function (i) { + Expr.pseudos[i] = createInputPseudo(i); + }); + each([ + 'submit', + 'reset' + ], function (i) { + Expr.pseudos[i] = createButtonPseudo(i); + }); + function setFilters() { + } + setFilters.prototype = Expr.filters = Expr.pseudos; + Expr.setFilters = new setFilters(); + tokenize = Sizzle.tokenize = function (selector, parseOnly) { + var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + ' ']; + if (cached) { + return parseOnly ? 0 : cached.slice(0); + } + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + while (soFar) { + if (!matched || (match = rcomma.exec(soFar))) { + if (match) { + soFar = soFar.slice(match[0].length) || soFar; + } + groups.push(tokens = []); + } + matched = false; + if (match = rcombinators.exec(soFar)) { + matched = match.shift(); + tokens.push({ + value: matched, + type: match[0].replace(rtrim, ' ') + }); + soFar = soFar.slice(matched.length); + } + for (type in Expr.filter) { + if (!Expr.filter.hasOwnProperty(type)) { + continue; + } + if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) { + matched = match.shift(); + tokens.push({ + value: matched, + type: type, + matches: match + }); + soFar = soFar.slice(matched.length); + } + } + if (!matched) { + break; + } + } + return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) : tokenCache(selector, groups).slice(0); + }; + function toSelector(tokens) { + var i = 0, len = tokens.length, selector = ''; + for (; i < len; i++) { + selector += tokens[i].value; + } + return selector; + } + function addCombinator(matcher, combinator, base) { + var dir = combinator.dir, checkNonElements = base && dir === 'parentNode', doneName = done++; + return combinator.first ? function (elem, context, xml) { + while (elem = elem[dir]) { + if (elem.nodeType === 1 || checkNonElements) { + return matcher(elem, context, xml); + } + } + } : function (elem, context, xml) { + var oldCache, outerCache, newCache = [ + dirruns, + doneName + ]; + if (xml) { + while (elem = elem[dir]) { + if (elem.nodeType === 1 || checkNonElements) { + if (matcher(elem, context, xml)) { + return true; + } + } + } + } else { + while (elem = elem[dir]) { + if (elem.nodeType === 1 || checkNonElements) { + outerCache = elem[expando] || (elem[expando] = {}); + if ((oldCache = outerCache[dir]) && oldCache[0] === dirruns && oldCache[1] === doneName) { + return newCache[2] = oldCache[2]; + } else { + outerCache[dir] = newCache; + if (newCache[2] = matcher(elem, context, xml)) { + return true; + } + } + } + } + } + }; + } + function elementMatcher(matchers) { + return matchers.length > 1 ? function (elem, context, xml) { + var i = matchers.length; + while (i--) { + if (!matchers[i](elem, context, xml)) { + return false; + } + } + return true; + } : matchers[0]; + } + function multipleContexts(selector, contexts, results) { + var i = 0, len = contexts.length; + for (; i < len; i++) { + Sizzle(selector, contexts[i], results); + } + return results; + } + function condense(unmatched, map, filter, context, xml) { + var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; + for (; i < len; i++) { + if (elem = unmatched[i]) { + if (!filter || filter(elem, context, xml)) { + newUnmatched.push(elem); + if (mapped) { + map.push(i); + } + } + } + } + return newUnmatched; + } + function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) { + if (postFilter && !postFilter[expando]) { + postFilter = setMatcher(postFilter); + } + if (postFinder && !postFinder[expando]) { + postFinder = setMatcher(postFinder, postSelector); + } + return markFunction(function (seed, results, context, xml) { + var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, elems = seed || multipleContexts(selector || '*', context.nodeType ? [context] : context, []), matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems, matcherOut = matcher ? postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results : matcherIn; + if (matcher) { + matcher(matcherIn, matcherOut, context, xml); + } + if (postFilter) { + temp = condense(matcherOut, postMap); + postFilter(temp, [], context, xml); + i = temp.length; + while (i--) { + if (elem = temp[i]) { + matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem); + } + } + } + if (seed) { + if (postFinder || preFilter) { + if (postFinder) { + temp = []; + i = matcherOut.length; + while (i--) { + if (elem = matcherOut[i]) { + temp.push(matcherIn[i] = elem); + } + } + postFinder(null, matcherOut = [], temp, xml); + } + i = matcherOut.length; + while (i--) { + if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf$2.call(seed, elem) : preMap[i]) > -1) { + seed[temp] = !(results[temp] = elem); + } + } + } + } else { + matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut); + if (postFinder) { + postFinder(null, results, matcherOut, xml); + } else { + push.apply(results, matcherOut); + } + } + }); + } + function matcherFromTokens(tokens) { + var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[' '], i = leadingRelative ? 1 : 0, matchContext = addCombinator(function (elem) { + return elem === checkContext; + }, implicitRelative, true), matchAnyContext = addCombinator(function (elem) { + return indexOf$2.call(checkContext, elem) > -1; + }, implicitRelative, true), matchers = [function (elem, context, xml) { + return !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml)); + }]; + for (; i < len; i++) { + if (matcher = Expr.relative[tokens[i].type]) { + matchers = [addCombinator(elementMatcher(matchers), matcher)]; + } else { + matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches); + if (matcher[expando]) { + j = ++i; + for (; j < len; j++) { + if (Expr.relative[tokens[j].type]) { + break; + } + } + return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === ' ' ? '*' : '' })).replace(rtrim, '$1'), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens)); + } + matchers.push(matcher); + } + } + return elementMatcher(matchers); + } + function matcherFromGroupMatchers(elementMatchers, setMatchers) { + var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function (seed, context, xml, results, outermost) { + var elem, j, matcher, matchedCount = 0, i = '0', unmatched = seed && [], setMatched = [], contextBackup = outermostContext, elems = seed || byElement && Expr.find.TAG('*', outermost), dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1, len = elems.length; + if (outermost) { + outermostContext = context !== document$1 && context; + } + for (; i !== len && (elem = elems[i]) != null; i++) { + if (byElement && elem) { + j = 0; + while (matcher = elementMatchers[j++]) { + if (matcher(elem, context, xml)) { + results.push(elem); + break; + } + } + if (outermost) { + dirruns = dirrunsUnique; + } + } + if (bySet) { + if (elem = !matcher && elem) { + matchedCount--; + } + if (seed) { + unmatched.push(elem); + } + } + } + matchedCount += i; + if (bySet && i !== matchedCount) { + j = 0; + while (matcher = setMatchers[j++]) { + matcher(unmatched, setMatched, context, xml); + } + if (seed) { + if (matchedCount > 0) { + while (i--) { + if (!(unmatched[i] || setMatched[i])) { + setMatched[i] = pop.call(results); + } + } + } + setMatched = condense(setMatched); + } + push.apply(results, setMatched); + if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) { + Sizzle.uniqueSort(results); + } + } + if (outermost) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + return unmatched; + }; + return bySet ? markFunction(superMatcher) : superMatcher; + } + compile = Sizzle.compile = function (selector, match) { + var i, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + ' ']; + if (!cached) { + if (!match) { + match = tokenize(selector); + } + i = match.length; + while (i--) { + cached = matcherFromTokens(match[i]); + if (cached[expando]) { + setMatchers.push(cached); + } else { + elementMatchers.push(cached); + } + } + cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers)); + cached.selector = selector; + } + return cached; + }; + select = Sizzle.select = function (selector, context, results, seed) { + var i, tokens, token, type, find, compiled = typeof selector === 'function' && selector, match = !seed && tokenize(selector = compiled.selector || selector); + results = results || []; + if (match.length === 1) { + tokens = match[0] = match[0].slice(0); + if (tokens.length > 2 && (token = tokens[0]).type === 'ID' && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) { + context = (Expr.find.ID(token.matches[0].replace(runescape, funescape), context) || [])[0]; + if (!context) { + return results; + } else if (compiled) { + context = context.parentNode; + } + selector = selector.slice(tokens.shift().value.length); + } + i = matchExpr.needsContext.test(selector) ? 0 : tokens.length; + while (i--) { + token = tokens[i]; + if (Expr.relative[type = token.type]) { + break; + } + if (find = Expr.find[type]) { + if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) { + tokens.splice(i, 1); + selector = seed.length && toSelector(tokens); + if (!selector) { + push.apply(results, seed); + return results; + } + break; + } + } + } + } + (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, rsibling.test(selector) && testContext(context.parentNode) || context); + return results; + }; + support.sortStable = expando.split('').sort(sortOrder).join('') === expando; + support.detectDuplicates = !!hasDuplicate; + setDocument(); + support.sortDetached = true; + + var doc = document, push$1 = Array.prototype.push, slice$1 = Array.prototype.slice; + var rquickExpr$1 = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/; + var Event = EventUtils.Event; + var skipUniques = Tools.makeMap('children,contents,next,prev'); + var isDefined = function (obj) { + return typeof obj !== 'undefined'; + }; + var isString$1 = function (obj) { + return typeof obj === 'string'; + }; + var isWindow = function (obj) { + return obj && obj === obj.window; + }; + var createFragment = function (html, fragDoc) { + fragDoc = fragDoc || doc; + var container = fragDoc.createElement('div'); + var frag = fragDoc.createDocumentFragment(); + container.innerHTML = html; + var node; + while (node = container.firstChild) { + frag.appendChild(node); + } + return frag; + }; + var domManipulate = function (targetNodes, sourceItem, callback, reverse) { + var i; + if (isString$1(sourceItem)) { + sourceItem = createFragment(sourceItem, getElementDocument(targetNodes[0])); + } else if (sourceItem.length && !sourceItem.nodeType) { + sourceItem = DomQuery.makeArray(sourceItem); + if (reverse) { + for (i = sourceItem.length - 1; i >= 0; i--) { + domManipulate(targetNodes, sourceItem[i], callback, reverse); + } + } else { + for (i = 0; i < sourceItem.length; i++) { + domManipulate(targetNodes, sourceItem[i], callback, reverse); + } + } + return targetNodes; + } + if (sourceItem.nodeType) { + i = targetNodes.length; + while (i--) { + callback.call(targetNodes[i], sourceItem); + } + } + return targetNodes; + }; + var hasClass = function (node, className) { + return node && className && (' ' + node.className + ' ').indexOf(' ' + className + ' ') !== -1; + }; + var wrap$1 = function (elements, wrapper, all) { + var lastParent, newWrapper; + wrapper = DomQuery(wrapper)[0]; + elements.each(function () { + var self = this; + if (!all || lastParent !== self.parentNode) { + lastParent = self.parentNode; + newWrapper = wrapper.cloneNode(false); + self.parentNode.insertBefore(newWrapper, self); + newWrapper.appendChild(self); + } else { + newWrapper.appendChild(self); + } + }); + return elements; + }; + var numericCssMap = Tools.makeMap('fillOpacity fontWeight lineHeight opacity orphans widows zIndex zoom', ' '); + var booleanMap = Tools.makeMap('checked compact declare defer disabled ismap multiple nohref noshade nowrap readonly selected', ' '); + var propFix = { + for: 'htmlFor', + class: 'className', + readonly: 'readOnly' + }; + var cssFix = { float: 'cssFloat' }; + var attrHooks = {}, cssHooks = {}; + var DomQueryConstructor = function (selector, context) { + return new DomQuery.fn.init(selector, context); + }; + var inArray$1 = function (item, array) { + var i; + if (array.indexOf) { + return array.indexOf(item); + } + i = array.length; + while (i--) { + if (array[i] === item) { + return i; + } + } + return -1; + }; + var whiteSpaceRegExp$2 = /^\s*|\s*$/g; + var trim$3 = function (str) { + return str === null || str === undefined ? '' : ('' + str).replace(whiteSpaceRegExp$2, ''); + }; + var each$4 = function (obj, callback) { + var length, key, i, value; + if (obj) { + length = obj.length; + if (length === undefined) { + for (key in obj) { + if (obj.hasOwnProperty(key)) { + value = obj[key]; + if (callback.call(value, key, value) === false) { + break; + } + } + } + } else { + for (i = 0; i < length; i++) { + value = obj[i]; + if (callback.call(value, i, value) === false) { + break; + } + } + } + } + return obj; + }; + var grep = function (array, callback) { + var out = []; + each$4(array, function (i, item) { + if (callback(item, i)) { + out.push(item); + } + }); + return out; + }; + var getElementDocument = function (element) { + if (!element) { + return doc; + } + if (element.nodeType === 9) { + return element; + } + return element.ownerDocument; + }; + DomQueryConstructor.fn = DomQueryConstructor.prototype = { + constructor: DomQueryConstructor, + selector: '', + context: null, + length: 0, + init: function (selector, context) { + var self = this; + var match, node; + if (!selector) { + return self; + } + if (selector.nodeType) { + self.context = self[0] = selector; + self.length = 1; + return self; + } + if (context && context.nodeType) { + self.context = context; + } else { + if (context) { + return DomQuery(selector).attr(context); + } + self.context = context = document; + } + if (isString$1(selector)) { + self.selector = selector; + if (selector.charAt(0) === '<' && selector.charAt(selector.length - 1) === '>' && selector.length >= 3) { + match = [ + null, + selector, + null + ]; + } else { + match = rquickExpr$1.exec(selector); + } + if (match) { + if (match[1]) { + node = createFragment(selector, getElementDocument(context)).firstChild; + while (node) { + push$1.call(self, node); + node = node.nextSibling; + } + } else { + node = getElementDocument(context).getElementById(match[2]); + if (!node) { + return self; + } + if (node.id !== match[2]) { + return self.find(selector); + } + self.length = 1; + self[0] = node; + } + } else { + return DomQuery(context).find(selector); + } + } else { + this.add(selector, false); + } + return self; + }, + toArray: function () { + return Tools.toArray(this); + }, + add: function (items, sort) { + var self = this; + var nodes, i; + if (isString$1(items)) { + return self.add(DomQuery(items)); + } + if (sort !== false) { + nodes = DomQuery.unique(self.toArray().concat(DomQuery.makeArray(items))); + self.length = nodes.length; + for (i = 0; i < nodes.length; i++) { + self[i] = nodes[i]; + } + } else { + push$1.apply(self, DomQuery.makeArray(items)); + } + return self; + }, + attr: function (name, value) { + var self = this; + var hook; + if (typeof name === 'object') { + each$4(name, function (name, value) { + self.attr(name, value); + }); + } else if (isDefined(value)) { + this.each(function () { + var hook; + if (this.nodeType === 1) { + hook = attrHooks[name]; + if (hook && hook.set) { + hook.set(this, value); + return; + } + if (value === null) { + this.removeAttribute(name, 2); + } else { + this.setAttribute(name, value, 2); + } + } + }); + } else { + if (self[0] && self[0].nodeType === 1) { + hook = attrHooks[name]; + if (hook && hook.get) { + return hook.get(self[0], name); + } + if (booleanMap[name]) { + return self.prop(name) ? name : undefined; + } + value = self[0].getAttribute(name, 2); + if (value === null) { + value = undefined; + } + } + return value; + } + return self; + }, + removeAttr: function (name) { + return this.attr(name, null); + }, + prop: function (name, value) { + var self = this; + name = propFix[name] || name; + if (typeof name === 'object') { + each$4(name, function (name, value) { + self.prop(name, value); + }); + } else if (isDefined(value)) { + this.each(function () { + if (this.nodeType === 1) { + this[name] = value; + } + }); + } else { + if (self[0] && self[0].nodeType && name in self[0]) { + return self[0][name]; + } + return value; + } + return self; + }, + css: function (name, value) { + var self = this; + var elm, hook; + var camel = function (name) { + return name.replace(/-(\D)/g, function (a, b) { + return b.toUpperCase(); + }); + }; + var dashed = function (name) { + return name.replace(/[A-Z]/g, function (a) { + return '-' + a; + }); + }; + if (typeof name === 'object') { + each$4(name, function (name, value) { + self.css(name, value); + }); + } else { + if (isDefined(value)) { + name = camel(name); + if (typeof value === 'number' && !numericCssMap[name]) { + value = value.toString() + 'px'; + } + self.each(function () { + var style = this.style; + hook = cssHooks[name]; + if (hook && hook.set) { + hook.set(this, value); + return; + } + try { + this.style[cssFix[name] || name] = value; + } catch (ex) { + } + if (value === null || value === '') { + if (style.removeProperty) { + style.removeProperty(dashed(name)); + } else { + style.removeAttribute(name); + } + } + }); + } else { + elm = self[0]; + hook = cssHooks[name]; + if (hook && hook.get) { + return hook.get(elm); + } + if (elm.ownerDocument.defaultView) { + try { + return elm.ownerDocument.defaultView.getComputedStyle(elm, null).getPropertyValue(dashed(name)); + } catch (ex) { + return undefined; + } + } else if (elm.currentStyle) { + return elm.currentStyle[camel(name)]; + } else { + return ''; + } + } + } + return self; + }, + remove: function () { + var self = this; + var node, i = this.length; + while (i--) { + node = self[i]; + Event.clean(node); + if (node.parentNode) { + node.parentNode.removeChild(node); + } + } + return this; + }, + empty: function () { + var self = this; + var node, i = this.length; + while (i--) { + node = self[i]; + while (node.firstChild) { + node.removeChild(node.firstChild); + } + } + return this; + }, + html: function (value) { + var self = this; + var i; + if (isDefined(value)) { + i = self.length; + try { + while (i--) { + self[i].innerHTML = value; + } + } catch (ex) { + DomQuery(self[i]).empty().append(value); + } + return self; + } + return self[0] ? self[0].innerHTML : ''; + }, + text: function (value) { + var self = this; + var i; + if (isDefined(value)) { + i = self.length; + while (i--) { + if ('innerText' in self[i]) { + self[i].innerText = value; + } else { + self[0].textContent = value; + } + } + return self; + } + return self[0] ? self[0].innerText || self[0].textContent : ''; + }, + append: function () { + return domManipulate(this, arguments, function (node) { + if (this.nodeType === 1 || this.host && this.host.nodeType === 1) { + this.appendChild(node); + } + }); + }, + prepend: function () { + return domManipulate(this, arguments, function (node) { + if (this.nodeType === 1 || this.host && this.host.nodeType === 1) { + this.insertBefore(node, this.firstChild); + } + }, true); + }, + before: function () { + var self = this; + if (self[0] && self[0].parentNode) { + return domManipulate(self, arguments, function (node) { + this.parentNode.insertBefore(node, this); + }); + } + return self; + }, + after: function () { + var self = this; + if (self[0] && self[0].parentNode) { + return domManipulate(self, arguments, function (node) { + this.parentNode.insertBefore(node, this.nextSibling); + }, true); + } + return self; + }, + appendTo: function (val) { + DomQuery(val).append(this); + return this; + }, + prependTo: function (val) { + DomQuery(val).prepend(this); + return this; + }, + replaceWith: function (content) { + return this.before(content).remove(); + }, + wrap: function (content) { + return wrap$1(this, content); + }, + wrapAll: function (content) { + return wrap$1(this, content, true); + }, + wrapInner: function (content) { + this.each(function () { + DomQuery(this).contents().wrapAll(content); + }); + return this; + }, + unwrap: function () { + return this.parent().each(function () { + DomQuery(this).replaceWith(this.childNodes); + }); + }, + clone: function () { + var result = []; + this.each(function () { + result.push(this.cloneNode(true)); + }); + return DomQuery(result); + }, + addClass: function (className) { + return this.toggleClass(className, true); + }, + removeClass: function (className) { + return this.toggleClass(className, false); + }, + toggleClass: function (className, state) { + var self = this; + if (typeof className !== 'string') { + return self; + } + if (className.indexOf(' ') !== -1) { + each$4(className.split(' '), function () { + self.toggleClass(this, state); + }); + } else { + self.each(function (index, node) { + var classState = hasClass(node, className); + if (classState !== state) { + var existingClassName = node.className; + if (classState) { + node.className = trim$3((' ' + existingClassName + ' ').replace(' ' + className + ' ', ' ')); + } else { + node.className += existingClassName ? ' ' + className : className; + } + } + }); + } + return self; + }, + hasClass: function (className) { + return hasClass(this[0], className); + }, + each: function (callback) { + return each$4(this, callback); + }, + on: function (name, callback) { + return this.each(function () { + Event.bind(this, name, callback); + }); + }, + off: function (name, callback) { + return this.each(function () { + Event.unbind(this, name, callback); + }); + }, + trigger: function (name) { + return this.each(function () { + if (typeof name === 'object') { + Event.fire(this, name.type, name); + } else { + Event.fire(this, name); + } + }); + }, + show: function () { + return this.css('display', ''); + }, + hide: function () { + return this.css('display', 'none'); + }, + slice: function () { + return new DomQuery(slice$1.apply(this, arguments)); + }, + eq: function (index) { + return index === -1 ? this.slice(index) : this.slice(index, +index + 1); + }, + first: function () { + return this.eq(0); + }, + last: function () { + return this.eq(-1); + }, + find: function (selector) { + var i, l; + var ret = []; + for (i = 0, l = this.length; i < l; i++) { + DomQuery.find(selector, this[i], ret); + } + return DomQuery(ret); + }, + filter: function (selector) { + if (typeof selector === 'function') { + return DomQuery(grep(this.toArray(), function (item, i) { + return selector(i, item); + })); + } + return DomQuery(DomQuery.filter(selector, this.toArray())); + }, + closest: function (selector) { + var result = []; + if (selector instanceof DomQuery) { + selector = selector[0]; + } + this.each(function (i, node) { + while (node) { + if (typeof selector === 'string' && DomQuery(node).is(selector)) { + result.push(node); + break; + } else if (node === selector) { + result.push(node); + break; + } + node = node.parentNode; + } + }); + return DomQuery(result); + }, + offset: function (offset) { + var elm, doc, docElm; + var x = 0, y = 0, pos; + if (!offset) { + elm = this[0]; + if (elm) { + doc = elm.ownerDocument; + docElm = doc.documentElement; + if (elm.getBoundingClientRect) { + pos = elm.getBoundingClientRect(); + x = pos.left + (docElm.scrollLeft || doc.body.scrollLeft) - docElm.clientLeft; + y = pos.top + (docElm.scrollTop || doc.body.scrollTop) - docElm.clientTop; + } + } + return { + left: x, + top: y + }; + } + return this.css(offset); + }, + push: push$1, + sort: Array.prototype.sort, + splice: Array.prototype.splice + }; + Tools.extend(DomQueryConstructor, { + extend: Tools.extend, + makeArray: function (object) { + if (isWindow(object) || object.nodeType) { + return [object]; + } + return Tools.toArray(object); + }, + inArray: inArray$1, + isArray: Tools.isArray, + each: each$4, + trim: trim$3, + grep: grep, + find: Sizzle, + expr: Sizzle.selectors, + unique: Sizzle.uniqueSort, + text: Sizzle.getText, + contains: Sizzle.contains, + filter: function (expr, elems, not) { + var i = elems.length; + if (not) { + expr = ':not(' + expr + ')'; + } + while (i--) { + if (elems[i].nodeType !== 1) { + elems.splice(i, 1); + } + } + if (elems.length === 1) { + elems = DomQuery.find.matchesSelector(elems[0], expr) ? [elems[0]] : []; + } else { + elems = DomQuery.find.matches(expr, elems); + } + return elems; + } + }); + var dir = function (el, prop, until) { + var matched = []; + var cur = el[prop]; + if (typeof until !== 'string' && until instanceof DomQuery) { + until = until[0]; + } + while (cur && cur.nodeType !== 9) { + if (until !== undefined) { + if (cur === until) { + break; + } + if (typeof until === 'string' && DomQuery(cur).is(until)) { + break; + } + } + if (cur.nodeType === 1) { + matched.push(cur); + } + cur = cur[prop]; + } + return matched; + }; + var sibling$1 = function (node, siblingName, nodeType, until) { + var result = []; + if (until instanceof DomQuery) { + until = until[0]; + } + for (; node; node = node[siblingName]) { + if (nodeType && node.nodeType !== nodeType) { + continue; + } + if (until !== undefined) { + if (node === until) { + break; + } + if (typeof until === 'string' && DomQuery(node).is(until)) { + break; + } + } + result.push(node); + } + return result; + }; + var firstSibling = function (node, siblingName, nodeType) { + for (node = node[siblingName]; node; node = node[siblingName]) { + if (node.nodeType === nodeType) { + return node; + } + } + return null; + }; + each$4({ + parent: function (node) { + var parent = node.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function (node) { + return dir(node, 'parentNode'); + }, + next: function (node) { + return firstSibling(node, 'nextSibling', 1); + }, + prev: function (node) { + return firstSibling(node, 'previousSibling', 1); + }, + children: function (node) { + return sibling$1(node.firstChild, 'nextSibling', 1); + }, + contents: function (node) { + return Tools.toArray((node.nodeName === 'iframe' ? node.contentDocument || node.contentWindow.document : node).childNodes); + } + }, function (name, fn) { + DomQueryConstructor.fn[name] = function (selector) { + var self = this; + var result = []; + self.each(function () { + var nodes = fn.call(result, this, selector, result); + if (nodes) { + if (DomQuery.isArray(nodes)) { + result.push.apply(result, nodes); + } else { + result.push(nodes); + } + } + }); + if (this.length > 1) { + if (!skipUniques[name]) { + result = DomQuery.unique(result); + } + if (name.indexOf('parents') === 0) { + result = result.reverse(); + } + } + var wrappedResult = DomQuery(result); + if (selector) { + return wrappedResult.filter(selector); + } + return wrappedResult; + }; + }); + each$4({ + parentsUntil: function (node, until) { + return dir(node, 'parentNode', until); + }, + nextUntil: function (node, until) { + return sibling$1(node, 'nextSibling', 1, until).slice(1); + }, + prevUntil: function (node, until) { + return sibling$1(node, 'previousSibling', 1, until).slice(1); + } + }, function (name, fn) { + DomQueryConstructor.fn[name] = function (selector, filter) { + var self = this; + var result = []; + self.each(function () { + var nodes = fn.call(result, this, selector, result); + if (nodes) { + if (DomQuery.isArray(nodes)) { + result.push.apply(result, nodes); + } else { + result.push(nodes); + } + } + }); + if (this.length > 1) { + result = DomQuery.unique(result); + if (name.indexOf('parents') === 0 || name === 'prevUntil') { + result = result.reverse(); + } + } + var wrappedResult = DomQuery(result); + if (filter) { + return wrappedResult.filter(filter); + } + return wrappedResult; + }; + }); + DomQueryConstructor.fn.is = function (selector) { + return !!selector && this.filter(selector).length > 0; + }; + DomQueryConstructor.fn.init.prototype = DomQueryConstructor.fn; + DomQueryConstructor.overrideDefaults = function (callback) { + var defaults; + var sub = function (selector, context) { + defaults = defaults || callback(); + if (arguments.length === 0) { + selector = defaults.element; + } + if (!context) { + context = defaults.context; + } + return new sub.fn.init(selector, context); + }; + DomQuery.extend(sub, this); + return sub; + }; + DomQueryConstructor.attrHooks = attrHooks; + DomQueryConstructor.cssHooks = cssHooks; + var DomQuery = DomQueryConstructor; + + var each$5 = Tools.each; + var grep$1 = Tools.grep; + var isIE = Env.ie; + var simpleSelectorRe = /^([a-z0-9],?)+$/i; + var setupAttrHooks = function (styles, settings, getContext) { + var keepValues = settings.keep_values; + var keepUrlHook = { + set: function ($elm, value, name) { + if (settings.url_converter) { + value = settings.url_converter.call(settings.url_converter_scope || getContext(), value, name, $elm[0]); + } + $elm.attr('data-mce-' + name, value).attr(name, value); + }, + get: function ($elm, name) { + return $elm.attr('data-mce-' + name) || $elm.attr(name); + } + }; + var attrHooks = { + style: { + set: function ($elm, value) { + if (value !== null && typeof value === 'object') { + $elm.css(value); + return; + } + if (keepValues) { + $elm.attr('data-mce-style', value); + } + if (value !== null && typeof value === 'string') { + $elm.removeAttr('style'); + $elm.css(styles.parse(value)); + } else { + $elm.attr('style', value); + } + }, + get: function ($elm) { + var value = $elm.attr('data-mce-style') || $elm.attr('style'); + value = styles.serialize(styles.parse(value), $elm[0].nodeName); + return value; + } + } + }; + if (keepValues) { + attrHooks.href = attrHooks.src = keepUrlHook; + } + return attrHooks; + }; + var updateInternalStyleAttr = function (styles, $elm) { + var rawValue = $elm.attr('style'); + var value = styles.serialize(styles.parse(rawValue), $elm[0].nodeName); + if (!value) { + value = null; + } + $elm.attr('data-mce-style', value); + }; + var findNodeIndex = function (node, normalized) { + var idx = 0, lastNodeType, nodeType; + if (node) { + for (lastNodeType = node.nodeType, node = node.previousSibling; node; node = node.previousSibling) { + nodeType = node.nodeType; + if (normalized && nodeType === 3) { + if (nodeType === lastNodeType || !node.nodeValue.length) { + continue; + } + } + idx++; + lastNodeType = nodeType; + } + } + return idx; + }; + function DOMUtils(doc, settings) { + var _this = this; + if (settings === void 0) { + settings = {}; + } + var addedStyles = {}; + var win = window; + var files = {}; + var counter = 0; + var stdMode = true; + var boxModel = true; + var styleSheetLoader = instance.forElement(SugarElement.fromDom(doc), { + contentCssCors: settings.contentCssCors, + referrerPolicy: settings.referrerPolicy + }); + var boundEvents = []; + var schema = settings.schema ? settings.schema : Schema({}); + var styles = Styles({ + url_converter: settings.url_converter, + url_converter_scope: settings.url_converter_scope + }, settings.schema); + var events = settings.ownEvents ? new EventUtils() : EventUtils.Event; + var blockElementsMap = schema.getBlockElements(); + var $ = DomQuery.overrideDefaults(function () { + return { + context: doc, + element: self.getRoot() + }; + }); + var isBlock = function (node) { + if (typeof node === 'string') { + return !!blockElementsMap[node]; + } else if (node) { + var type = node.nodeType; + if (type) { + return !!(type === 1 && blockElementsMap[node.nodeName]); + } + } + return false; + }; + var get = function (elm) { + return elm && doc && isString(elm) ? doc.getElementById(elm) : elm; + }; + var $$ = function (elm) { + return $(typeof elm === 'string' ? get(elm) : elm); + }; + var getAttrib = function (elm, name, defaultVal) { + var hook, value; + var $elm = $$(elm); + if ($elm.length) { + hook = attrHooks[name]; + if (hook && hook.get) { + value = hook.get($elm, name); + } else { + value = $elm.attr(name); + } + } + if (typeof value === 'undefined') { + value = defaultVal || ''; + } + return value; + }; + var getAttribs = function (elm) { + var node = get(elm); + if (!node) { + return []; + } + return node.attributes; + }; + var setAttrib = function (elm, name, value) { + if (value === '') { + value = null; + } + var $elm = $$(elm); + var originalValue = $elm.attr(name); + if (!$elm.length) { + return; + } + var hook = attrHooks[name]; + if (hook && hook.set) { + hook.set($elm, value, name); + } else { + $elm.attr(name, value); + } + if (originalValue !== value && settings.onSetAttrib) { + settings.onSetAttrib({ + attrElm: $elm, + attrName: name, + attrValue: value + }); + } + }; + var clone = function (node, deep) { + if (!isIE || node.nodeType !== 1 || deep) { + return node.cloneNode(deep); + } else { + var clone_1 = doc.createElement(node.nodeName); + each$5(getAttribs(node), function (attr) { + setAttrib(clone_1, attr.nodeName, getAttrib(node, attr.nodeName)); + }); + return clone_1; + } + }; + var getRoot = function () { + return settings.root_element || doc.body; + }; + var getViewPort = function (argWin) { + var vp = getBounds(argWin); + return { + x: vp.x, + y: vp.y, + w: vp.width, + h: vp.height + }; + }; + var getPos$1 = function (elm, rootElm) { + return getPos(doc.body, get(elm), rootElm); + }; + var setStyle = function (elm, name, value) { + var $elm = isString(name) ? $$(elm).css(name, value) : $$(elm).css(name); + if (settings.update_styles) { + updateInternalStyleAttr(styles, $elm); + } + }; + var setStyles = function (elm, stylesArg) { + var $elm = $$(elm).css(stylesArg); + if (settings.update_styles) { + updateInternalStyleAttr(styles, $elm); + } + }; + var getStyle = function (elm, name, computed) { + var $elm = $$(elm); + if (computed) { + return $elm.css(name); + } + name = name.replace(/-(\D)/g, function (a, b) { + return b.toUpperCase(); + }); + if (name === 'float') { + name = Env.browser.isIE() ? 'styleFloat' : 'cssFloat'; + } + return $elm[0] && $elm[0].style ? $elm[0].style[name] : undefined; + }; + var getSize = function (elm) { + var w, h; + elm = get(elm); + w = getStyle(elm, 'width'); + h = getStyle(elm, 'height'); + if (w.indexOf('px') === -1) { + w = 0; + } + if (h.indexOf('px') === -1) { + h = 0; + } + return { + w: parseInt(w, 10) || elm.offsetWidth || elm.clientWidth, + h: parseInt(h, 10) || elm.offsetHeight || elm.clientHeight + }; + }; + var getRect = function (elm) { + elm = get(elm); + var pos = getPos$1(elm); + var size = getSize(elm); + return { + x: pos.x, + y: pos.y, + w: size.w, + h: size.h + }; + }; + var is = function (elm, selector) { + var i; + if (!elm) { + return false; + } + if (!Array.isArray(elm)) { + if (selector === '*') { + return elm.nodeType === 1; + } + if (simpleSelectorRe.test(selector)) { + var selectors = selector.toLowerCase().split(/,/); + var elmName = elm.nodeName.toLowerCase(); + for (i = selectors.length - 1; i >= 0; i--) { + if (selectors[i] === elmName) { + return true; + } + } + return false; + } + if (elm.nodeType && elm.nodeType !== 1) { + return false; + } + } + var elms = !Array.isArray(elm) ? [elm] : elm; + return Sizzle(selector, elms[0].ownerDocument || elms[0], null, elms).length > 0; + }; + var getParents = function (elm, selector, root, collect) { + var result = []; + var selectorVal; + var node = get(elm); + collect = collect === undefined; + root = root || (getRoot().nodeName !== 'BODY' ? getRoot().parentNode : null); + if (Tools.is(selector, 'string')) { + selectorVal = selector; + if (selector === '*') { + selector = function (node) { + return node.nodeType === 1; + }; + } else { + selector = function (node) { + return is(node, selectorVal); + }; + } + } + while (node) { + if (node === root || isNullable(node.nodeType) || isDocument$1(node) || isDocumentFragment$1(node)) { + break; + } + if (!selector || typeof selector === 'function' && selector(node)) { + if (collect) { + result.push(node); + } else { + return [node]; + } + } + node = node.parentNode; + } + return collect ? result : null; + }; + var getParent = function (node, selector, root) { + var parents = getParents(node, selector, root, false); + return parents && parents.length > 0 ? parents[0] : null; + }; + var _findSib = function (node, selector, name) { + var func = selector; + if (node) { + if (typeof selector === 'string') { + func = function (node) { + return is(node, selector); + }; + } + for (node = node[name]; node; node = node[name]) { + if (typeof func === 'function' && func(node)) { + return node; + } + } + } + return null; + }; + var getNext = function (node, selector) { + return _findSib(node, selector, 'nextSibling'); + }; + var getPrev = function (node, selector) { + return _findSib(node, selector, 'previousSibling'); + }; + var select = function (selector, scope) { + return Sizzle(selector, get(scope) || settings.root_element || doc, []); + }; + var run = function (elm, func, scope) { + var result; + var node = typeof elm === 'string' ? get(elm) : elm; + if (!node) { + return false; + } + if (Tools.isArray(node) && (node.length || node.length === 0)) { + result = []; + each$5(node, function (elm, i) { + if (elm) { + result.push(func.call(scope, typeof elm === 'string' ? get(elm) : elm, i)); + } + }); + return result; + } + var context = scope ? scope : _this; + return func.call(context, node); + }; + var setAttribs = function (elm, attrs) { + $$(elm).each(function (i, node) { + each$5(attrs, function (value, name) { + setAttrib(node, name, value); + }); + }); + }; + var setHTML = function (elm, html) { + var $elm = $$(elm); + if (isIE) { + $elm.each(function (i, target) { + if (target.canHaveHTML === false) { + return; + } + while (target.firstChild) { + target.removeChild(target.firstChild); + } + try { + target.innerHTML = '
                                      ' + html; + target.removeChild(target.firstChild); + } catch (ex) { + DomQuery('
                                      ').html('
                                      ' + html).contents().slice(1).appendTo(target); + } + return html; + }); + } else { + $elm.html(html); + } + }; + var add = function (parentElm, name, attrs, html, create) { + return run(parentElm, function (parentElm) { + var newElm = typeof name === 'string' ? doc.createElement(name) : name; + setAttribs(newElm, attrs); + if (html) { + if (typeof html !== 'string' && html.nodeType) { + newElm.appendChild(html); + } else if (typeof html === 'string') { + setHTML(newElm, html); + } + } + return !create ? parentElm.appendChild(newElm) : newElm; + }); + }; + var create = function (name, attrs, html) { + return add(doc.createElement(name), name, attrs, html, true); + }; + var decode = Entities.decode; + var encode = Entities.encodeAllRaw; + var createHTML = function (name, attrs, html) { + var outHtml = '', key; + outHtml += '<' + name; + for (key in attrs) { + if (attrs.hasOwnProperty(key) && attrs[key] !== null && typeof attrs[key] !== 'undefined') { + outHtml += ' ' + key + '="' + encode(attrs[key]) + '"'; + } + } + if (typeof html !== 'undefined') { + return outHtml + '>' + html + ''; + } + return outHtml + ' />'; + }; + var createFragment = function (html) { + var node; + var container = doc.createElement('div'); + var frag = doc.createDocumentFragment(); + frag.appendChild(container); + if (html) { + container.innerHTML = html; + } + while (node = container.firstChild) { + frag.appendChild(node); + } + frag.removeChild(container); + return frag; + }; + var remove = function (node, keepChildren) { + var $node = $$(node); + if (keepChildren) { + $node.each(function () { + var child; + while (child = this.firstChild) { + if (child.nodeType === 3 && child.data.length === 0) { + this.removeChild(child); + } else { + this.parentNode.insertBefore(child, this); + } + } + }).remove(); + } else { + $node.remove(); + } + return $node.length > 1 ? $node.toArray() : $node[0]; + }; + var removeAllAttribs = function (e) { + return run(e, function (e) { + var i; + var attrs = e.attributes; + for (i = attrs.length - 1; i >= 0; i--) { + e.removeAttributeNode(attrs.item(i)); + } + }); + }; + var parseStyle = function (cssText) { + return styles.parse(cssText); + }; + var serializeStyle = function (stylesArg, name) { + return styles.serialize(stylesArg, name); + }; + var addStyle = function (cssText) { + var head, styleElm; + if (self !== DOMUtils.DOM && doc === document) { + if (addedStyles[cssText]) { + return; + } + addedStyles[cssText] = true; + } + styleElm = doc.getElementById('mceDefaultStyles'); + if (!styleElm) { + styleElm = doc.createElement('style'); + styleElm.id = 'mceDefaultStyles'; + styleElm.type = 'text/css'; + head = doc.getElementsByTagName('head')[0]; + if (head.firstChild) { + head.insertBefore(styleElm, head.firstChild); + } else { + head.appendChild(styleElm); + } + } + if (styleElm.styleSheet) { + styleElm.styleSheet.cssText += cssText; + } else { + styleElm.appendChild(doc.createTextNode(cssText)); + } + }; + var loadCSS = function (urls) { + if (!urls) { + urls = ''; + } + each(urls.split(','), function (url) { + files[url] = true; + styleSheetLoader.load(url, noop); + }); + }; + var toggleClass = function (elm, cls, state) { + $$(elm).toggleClass(cls, state).each(function () { + if (this.className === '') { + DomQuery(this).attr('class', null); + } + }); + }; + var addClass = function (elm, cls) { + $$(elm).addClass(cls); + }; + var removeClass = function (elm, cls) { + toggleClass(elm, cls, false); + }; + var hasClass = function (elm, cls) { + return $$(elm).hasClass(cls); + }; + var show = function (elm) { + $$(elm).show(); + }; + var hide = function (elm) { + $$(elm).hide(); + }; + var isHidden = function (elm) { + return $$(elm).css('display') === 'none'; + }; + var uniqueId = function (prefix) { + return (!prefix ? 'mce_' : prefix) + counter++; + }; + var getOuterHTML = function (elm) { + var node = typeof elm === 'string' ? get(elm) : elm; + return isElement$1(node) ? node.outerHTML : DomQuery('
                                      ').append(DomQuery(node).clone()).html(); + }; + var setOuterHTML = function (elm, html) { + $$(elm).each(function () { + try { + if ('outerHTML' in this) { + this.outerHTML = html; + return; + } + } catch (ex) { + } + remove(DomQuery(this).html(html), true); + }); + }; + var insertAfter = function (node, reference) { + var referenceNode = get(reference); + return run(node, function (node) { + var parent = referenceNode.parentNode; + var nextSibling = referenceNode.nextSibling; + if (nextSibling) { + parent.insertBefore(node, nextSibling); + } else { + parent.appendChild(node); + } + return node; + }); + }; + var replace = function (newElm, oldElm, keepChildren) { + return run(oldElm, function (oldElm) { + if (Tools.is(oldElm, 'array')) { + newElm = newElm.cloneNode(true); + } + if (keepChildren) { + each$5(grep$1(oldElm.childNodes), function (node) { + newElm.appendChild(node); + }); + } + return oldElm.parentNode.replaceChild(newElm, oldElm); + }); + }; + var rename = function (elm, name) { + var newElm; + if (elm.nodeName !== name.toUpperCase()) { + newElm = create(name); + each$5(getAttribs(elm), function (attrNode) { + setAttrib(newElm, attrNode.nodeName, getAttrib(elm, attrNode.nodeName)); + }); + replace(newElm, elm, true); + } + return newElm || elm; + }; + var findCommonAncestor = function (a, b) { + var ps = a, pe; + while (ps) { + pe = b; + while (pe && ps !== pe) { + pe = pe.parentNode; + } + if (ps === pe) { + break; + } + ps = ps.parentNode; + } + if (!ps && a.ownerDocument) { + return a.ownerDocument.documentElement; + } + return ps; + }; + var toHex = function (rgbVal) { + return styles.toHex(Tools.trim(rgbVal)); + }; + var isNonEmptyElement = function (node) { + if (isElement$1(node)) { + var isNamedAnchor = node.nodeName.toLowerCase() === 'a' && !getAttrib(node, 'href') && getAttrib(node, 'id'); + if (getAttrib(node, 'name') || getAttrib(node, 'data-mce-bookmark') || isNamedAnchor) { + return true; + } + } + return false; + }; + var isEmpty = function (node, elements) { + var type, name, brCount = 0; + if (isNonEmptyElement(node)) { + return false; + } + node = node.firstChild; + if (node) { + var walker = new DomTreeWalker(node, node.parentNode); + var whitespace = schema ? schema.getWhiteSpaceElements() : {}; + elements = elements || (schema ? schema.getNonEmptyElements() : null); + do { + type = node.nodeType; + if (isElement$1(node)) { + var bogusVal = node.getAttribute('data-mce-bogus'); + if (bogusVal) { + node = walker.next(bogusVal === 'all'); + continue; + } + name = node.nodeName.toLowerCase(); + if (elements && elements[name]) { + if (name === 'br') { + brCount++; + node = walker.next(); + continue; + } + return false; + } + if (isNonEmptyElement(node)) { + return false; + } + } + if (type === 8) { + return false; + } + if (type === 3 && !isWhitespaceText(node.nodeValue)) { + return false; + } + if (type === 3 && node.parentNode && whitespace[node.parentNode.nodeName] && isWhitespaceText(node.nodeValue)) { + return false; + } + node = walker.next(); + } while (node); + } + return brCount <= 1; + }; + var createRng = function () { + return doc.createRange(); + }; + var split = function (parentElm, splitElm, replacementElm) { + var range = createRng(); + var beforeFragment; + var afterFragment; + var parentNode; + if (parentElm && splitElm) { + range.setStart(parentElm.parentNode, findNodeIndex(parentElm)); + range.setEnd(splitElm.parentNode, findNodeIndex(splitElm)); + beforeFragment = range.extractContents(); + range = createRng(); + range.setStart(splitElm.parentNode, findNodeIndex(splitElm) + 1); + range.setEnd(parentElm.parentNode, findNodeIndex(parentElm) + 1); + afterFragment = range.extractContents(); + parentNode = parentElm.parentNode; + parentNode.insertBefore(trimNode(self, beforeFragment), parentElm); + if (replacementElm) { + parentNode.insertBefore(replacementElm, parentElm); + } else { + parentNode.insertBefore(splitElm, parentElm); + } + parentNode.insertBefore(trimNode(self, afterFragment), parentElm); + remove(parentElm); + return replacementElm || splitElm; + } + }; + var bind = function (target, name, func, scope) { + if (Tools.isArray(target)) { + var i = target.length; + var rv = []; + while (i--) { + rv[i] = bind(target[i], name, func, scope); + } + return rv; + } + if (settings.collect && (target === doc || target === win)) { + boundEvents.push([ + target, + name, + func, + scope + ]); + } + var output = events.bind(target, name, func, scope || self); + return output; + }; + var unbind = function (target, name, func) { + if (Tools.isArray(target)) { + var i = target.length; + var rv = []; + while (i--) { + rv[i] = unbind(target[i], name, func); + } + return rv; + } else { + if (boundEvents.length > 0 && (target === doc || target === win)) { + var i = boundEvents.length; + while (i--) { + var item = boundEvents[i]; + if (target === item[0] && (!name || name === item[1]) && (!func || func === item[2])) { + events.unbind(item[0], item[1], item[2]); + } + } + } + return events.unbind(target, name, func); + } + }; + var fire = function (target, name, evt) { + return events.fire(target, name, evt); + }; + var getContentEditable = function (node) { + if (node && isElement$1(node)) { + var contentEditable = node.getAttribute('data-mce-contenteditable'); + if (contentEditable && contentEditable !== 'inherit') { + return contentEditable; + } + return node.contentEditable !== 'inherit' ? node.contentEditable : null; + } else { + return null; + } + }; + var getContentEditableParent = function (node) { + var root = getRoot(); + var state = null; + for (; node && node !== root; node = node.parentNode) { + state = getContentEditable(node); + if (state !== null) { + break; + } + } + return state; + }; + var destroy = function () { + if (boundEvents.length > 0) { + var i = boundEvents.length; + while (i--) { + var item = boundEvents[i]; + events.unbind(item[0], item[1], item[2]); + } + } + each$1(files, function (_, url) { + styleSheetLoader.unload(url); + delete files[url]; + }); + if (Sizzle.setDocument) { + Sizzle.setDocument(); + } + }; + var isChildOf = function (node, parent) { + while (node) { + if (parent === node) { + return true; + } + node = node.parentNode; + } + return false; + }; + var dumpRng = function (r) { + return 'startContainer: ' + r.startContainer.nodeName + ', startOffset: ' + r.startOffset + ', endContainer: ' + r.endContainer.nodeName + ', endOffset: ' + r.endOffset; + }; + var self = { + doc: doc, + settings: settings, + win: win, + files: files, + stdMode: stdMode, + boxModel: boxModel, + styleSheetLoader: styleSheetLoader, + boundEvents: boundEvents, + styles: styles, + schema: schema, + events: events, + isBlock: isBlock, + $: $, + $$: $$, + root: null, + clone: clone, + getRoot: getRoot, + getViewPort: getViewPort, + getRect: getRect, + getSize: getSize, + getParent: getParent, + getParents: getParents, + get: get, + getNext: getNext, + getPrev: getPrev, + select: select, + is: is, + add: add, + create: create, + createHTML: createHTML, + createFragment: createFragment, + remove: remove, + setStyle: setStyle, + getStyle: getStyle, + setStyles: setStyles, + removeAllAttribs: removeAllAttribs, + setAttrib: setAttrib, + setAttribs: setAttribs, + getAttrib: getAttrib, + getPos: getPos$1, + parseStyle: parseStyle, + serializeStyle: serializeStyle, + addStyle: addStyle, + loadCSS: loadCSS, + addClass: addClass, + removeClass: removeClass, + hasClass: hasClass, + toggleClass: toggleClass, + show: show, + hide: hide, + isHidden: isHidden, + uniqueId: uniqueId, + setHTML: setHTML, + getOuterHTML: getOuterHTML, + setOuterHTML: setOuterHTML, + decode: decode, + encode: encode, + insertAfter: insertAfter, + replace: replace, + rename: rename, + findCommonAncestor: findCommonAncestor, + toHex: toHex, + run: run, + getAttribs: getAttribs, + isEmpty: isEmpty, + createRng: createRng, + nodeIndex: findNodeIndex, + split: split, + bind: bind, + unbind: unbind, + fire: fire, + getContentEditable: getContentEditable, + getContentEditableParent: getContentEditableParent, + destroy: destroy, + isChildOf: isChildOf, + dumpRng: dumpRng + }; + var attrHooks = setupAttrHooks(styles, settings, function () { + return self; + }); + return self; + } + (function (DOMUtils) { + DOMUtils.DOM = DOMUtils(document); + DOMUtils.nodeIndex = findNodeIndex; + }(DOMUtils || (DOMUtils = {}))); + var DOMUtils$1 = DOMUtils; + + var DOM = DOMUtils$1.DOM; + var each$6 = Tools.each, grep$2 = Tools.grep; + var QUEUED = 0; + var LOADING = 1; + var LOADED = 2; + var FAILED = 3; + var ScriptLoader = function () { + function ScriptLoader(settings) { + if (settings === void 0) { + settings = {}; + } + this.states = {}; + this.queue = []; + this.scriptLoadedCallbacks = {}; + this.queueLoadedCallbacks = []; + this.loading = 0; + this.settings = settings; + } + ScriptLoader.prototype._setReferrerPolicy = function (referrerPolicy) { + this.settings.referrerPolicy = referrerPolicy; + }; + ScriptLoader.prototype.loadScript = function (url, success, failure) { + var dom = DOM; + var elm; + var cleanup = function () { + dom.remove(id); + if (elm) { + elm.onerror = elm.onload = elm = null; + } + }; + var done = function () { + cleanup(); + success(); + }; + var error = function () { + cleanup(); + if (isFunction(failure)) { + failure(); + } else { + if (typeof console !== 'undefined' && console.log) { + console.log('Failed to load script: ' + url); + } + } + }; + var id = dom.uniqueId(); + elm = document.createElement('script'); + elm.id = id; + elm.type = 'text/javascript'; + elm.src = Tools._addCacheSuffix(url); + if (this.settings.referrerPolicy) { + dom.setAttrib(elm, 'referrerpolicy', this.settings.referrerPolicy); + } + elm.onload = done; + elm.onerror = error; + (document.getElementsByTagName('head')[0] || document.body).appendChild(elm); + }; + ScriptLoader.prototype.isDone = function (url) { + return this.states[url] === LOADED; + }; + ScriptLoader.prototype.markDone = function (url) { + this.states[url] = LOADED; + }; + ScriptLoader.prototype.add = function (url, success, scope, failure) { + var state = this.states[url]; + this.queue.push(url); + if (state === undefined) { + this.states[url] = QUEUED; + } + if (success) { + if (!this.scriptLoadedCallbacks[url]) { + this.scriptLoadedCallbacks[url] = []; + } + this.scriptLoadedCallbacks[url].push({ + success: success, + failure: failure, + scope: scope || this + }); + } + }; + ScriptLoader.prototype.load = function (url, success, scope, failure) { + return this.add(url, success, scope, failure); + }; + ScriptLoader.prototype.remove = function (url) { + delete this.states[url]; + delete this.scriptLoadedCallbacks[url]; + }; + ScriptLoader.prototype.loadQueue = function (success, scope, failure) { + this.loadScripts(this.queue, success, scope, failure); + }; + ScriptLoader.prototype.loadScripts = function (scripts, success, scope, failure) { + var self = this; + var failures = []; + var execCallbacks = function (name, url) { + each$6(self.scriptLoadedCallbacks[url], function (callback) { + if (isFunction(callback[name])) { + callback[name].call(callback.scope); + } + }); + self.scriptLoadedCallbacks[url] = undefined; + }; + self.queueLoadedCallbacks.push({ + success: success, + failure: failure, + scope: scope || this + }); + var loadScripts = function () { + var loadingScripts = grep$2(scripts); + scripts.length = 0; + each$6(loadingScripts, function (url) { + if (self.states[url] === LOADED) { + execCallbacks('success', url); + return; + } + if (self.states[url] === FAILED) { + execCallbacks('failure', url); + return; + } + if (self.states[url] !== LOADING) { + self.states[url] = LOADING; + self.loading++; + self.loadScript(url, function () { + self.states[url] = LOADED; + self.loading--; + execCallbacks('success', url); + loadScripts(); + }, function () { + self.states[url] = FAILED; + self.loading--; + failures.push(url); + execCallbacks('failure', url); + loadScripts(); + }); + } + }); + if (!self.loading) { + var notifyCallbacks = self.queueLoadedCallbacks.slice(0); + self.queueLoadedCallbacks.length = 0; + each$6(notifyCallbacks, function (callback) { + if (failures.length === 0) { + if (isFunction(callback.success)) { + callback.success.call(callback.scope); + } + } else { + if (isFunction(callback.failure)) { + callback.failure.call(callback.scope, failures); + } + } + }); + } + }; + loadScripts(); + }; + ScriptLoader.ScriptLoader = new ScriptLoader(); + return ScriptLoader; + }(); + + var Cell = function (initial) { + var value = initial; + var get = function () { + return value; + }; + var set = function (v) { + value = v; + }; + return { + get: get, + set: set + }; + }; + + var isRaw = function (str) { + return isObject(str) && has(str, 'raw'); + }; + var isTokenised = function (str) { + return isArray(str) && str.length > 1; + }; + var data = {}; + var currentCode = Cell('en'); + var getLanguageData = function () { + return get$1(data, currentCode.get()); + }; + var getData = function () { + return map$1(data, function (value) { + return __assign({}, value); + }); + }; + var setCode = function (newCode) { + if (newCode) { + currentCode.set(newCode); + } + }; + var getCode = function () { + return currentCode.get(); + }; + var add = function (code, items) { + var langData = data[code]; + if (!langData) { + data[code] = langData = {}; + } + each$1(items, function (translation, name) { + langData[name.toLowerCase()] = translation; + }); + }; + var translate = function (text) { + var langData = getLanguageData().getOr({}); + var toString = function (obj) { + if (isFunction(obj)) { + return Object.prototype.toString.call(obj); + } + return !isEmpty(obj) ? '' + obj : ''; + }; + var isEmpty = function (text) { + return text === '' || text === null || text === undefined; + }; + var getLangData = function (text) { + var textstr = toString(text); + return get$1(langData, textstr.toLowerCase()).map(toString).getOr(textstr); + }; + var removeContext = function (str) { + return str.replace(/{context:\w+}$/, ''); + }; + if (isEmpty(text)) { + return ''; + } + if (isRaw(text)) { + return toString(text.raw); + } + if (isTokenised(text)) { + var values_1 = text.slice(1); + var substitued = getLangData(text[0]).replace(/\{([0-9]+)\}/g, function ($1, $2) { + return has(values_1, $2) ? toString(values_1[$2]) : $1; + }); + return removeContext(substitued); + } + return removeContext(getLangData(text)); + }; + var isRtl = function () { + return getLanguageData().bind(function (items) { + return get$1(items, '_dir'); + }).exists(function (dir) { + return dir === 'rtl'; + }); + }; + var hasCode = function (code) { + return has(data, code); + }; + var I18n = { + getData: getData, + setCode: setCode, + getCode: getCode, + add: add, + translate: translate, + isRtl: isRtl, + hasCode: hasCode + }; + + function AddOnManager() { + var _this = this; + var items = []; + var urls = {}; + var lookup = {}; + var _listeners = []; + var runListeners = function (name, state) { + var matchedListeners = filter(_listeners, function (listener) { + return listener.name === name && listener.state === state; + }); + each(matchedListeners, function (listener) { + return listener.callback(); + }); + }; + var get = function (name) { + if (lookup[name]) { + return lookup[name].instance; + } + return undefined; + }; + var dependencies = function (name) { + var result; + if (lookup[name]) { + result = lookup[name].dependencies; + } + return result || []; + }; + var requireLangPack = function (name, languages) { + if (AddOnManager.languageLoad !== false) { + waitFor(name, function () { + var language = I18n.getCode(); + var wrappedLanguages = ',' + (languages || '') + ','; + if (!language || languages && wrappedLanguages.indexOf(',' + language + ',') === -1) { + return; + } + ScriptLoader.ScriptLoader.add(urls[name] + '/langs/' + language + '.js'); + }, 'loaded'); + } + }; + var add = function (id, addOn, dependencies) { + var addOnConstructor = addOn; + items.push(addOnConstructor); + lookup[id] = { + instance: addOnConstructor, + dependencies: dependencies + }; + runListeners(id, 'added'); + return addOnConstructor; + }; + var remove = function (name) { + delete urls[name]; + delete lookup[name]; + }; + var createUrl = function (baseUrl, dep) { + if (typeof dep === 'object') { + return dep; + } + return typeof baseUrl === 'string' ? { + prefix: '', + resource: dep, + suffix: '' + } : { + prefix: baseUrl.prefix, + resource: dep, + suffix: baseUrl.suffix + }; + }; + var addComponents = function (pluginName, scripts) { + var pluginUrl = _this.urls[pluginName]; + each(scripts, function (script) { + ScriptLoader.ScriptLoader.add(pluginUrl + '/' + script); + }); + }; + var loadDependencies = function (name, addOnUrl, success, scope) { + var deps = dependencies(name); + each(deps, function (dep) { + var newUrl = createUrl(addOnUrl, dep); + load(newUrl.resource, newUrl, undefined, undefined); + }); + if (success) { + if (scope) { + success.call(scope); + } else { + success.call(ScriptLoader); + } + } + }; + var load = function (name, addOnUrl, success, scope, failure) { + if (urls[name]) { + return; + } + var urlString = typeof addOnUrl === 'string' ? addOnUrl : addOnUrl.prefix + addOnUrl.resource + addOnUrl.suffix; + if (urlString.indexOf('/') !== 0 && urlString.indexOf('://') === -1) { + urlString = AddOnManager.baseURL + '/' + urlString; + } + urls[name] = urlString.substring(0, urlString.lastIndexOf('/')); + var done = function () { + runListeners(name, 'loaded'); + loadDependencies(name, addOnUrl, success, scope); + }; + if (lookup[name]) { + done(); + } else { + ScriptLoader.ScriptLoader.add(urlString, done, scope, failure); + } + }; + var waitFor = function (name, callback, state) { + if (state === void 0) { + state = 'added'; + } + if (has(lookup, name) && state === 'added') { + callback(); + } else if (has(urls, name) && state === 'loaded') { + callback(); + } else { + _listeners.push({ + name: name, + state: state, + callback: callback + }); + } + }; + return { + items: items, + urls: urls, + lookup: lookup, + _listeners: _listeners, + get: get, + dependencies: dependencies, + requireLangPack: requireLangPack, + add: add, + remove: remove, + createUrl: createUrl, + addComponents: addComponents, + load: load, + waitFor: waitFor + }; + } + (function (AddOnManager) { + AddOnManager.PluginManager = AddOnManager(); + AddOnManager.ThemeManager = AddOnManager(); + }(AddOnManager || (AddOnManager = {}))); + var AddOnManager$1 = AddOnManager; + + var first = 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) { + timer = setTimeout(function () { + fn.apply(null, args); + timer = null; + }, rate); + } + }; + return { + cancel: cancel, + throttle: throttle + }; + }; + var last$2 = 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 read = function (element, attr) { + var value = get$4(element, attr); + return value === undefined || value === '' ? [] : value.split(' '); + }; + var add$1 = function (element, attr, id) { + var old = read(element, attr); + var nu = old.concat([id]); + set(element, attr, nu.join(' ')); + return true; + }; + var remove$2 = function (element, attr, id) { + var nu = filter(read(element, attr), function (v) { + return v !== id; + }); + if (nu.length > 0) { + set(element, attr, nu.join(' ')); + } else { + remove$1(element, attr); + } + return false; + }; + + var supports = function (element) { + return element.dom.classList !== undefined; + }; + var get$6 = function (element) { + return read(element, 'class'); + }; + var add$2 = function (element, clazz) { + return add$1(element, 'class', clazz); + }; + var remove$3 = function (element, clazz) { + return remove$2(element, 'class', clazz); + }; + + var add$3 = function (element, clazz) { + if (supports(element)) { + element.dom.classList.add(clazz); + } else { + add$2(element, clazz); + } + }; + var cleanClass = function (element) { + var classList = supports(element) ? element.dom.classList : get$6(element); + if (classList.length === 0) { + remove$1(element, 'class'); + } + }; + var remove$4 = function (element, clazz) { + if (supports(element)) { + var classList = element.dom.classList; + classList.remove(clazz); + } else { + remove$3(element, clazz); + } + cleanClass(element); + }; + var has$2 = function (element, clazz) { + return supports(element) && element.dom.classList.contains(clazz); + }; + + var descendants = function (scope, predicate) { + var result = []; + each(children(scope), function (x) { + if (predicate(x)) { + result = result.concat([x]); + } + result = result.concat(descendants(x, predicate)); + }); + return result; + }; + + var descendants$1 = function (scope, selector) { + return all(selector, scope); + }; + + var annotation = constant('mce-annotation'); + var dataAnnotation = constant('data-mce-annotation'); + var dataAnnotationId = constant('data-mce-annotation-uid'); + + var identify = function (editor, annotationName) { + var rng = editor.selection.getRng(); + var start = SugarElement.fromDom(rng.startContainer); + var root = SugarElement.fromDom(editor.getBody()); + var selector = annotationName.fold(function () { + return '.' + annotation(); + }, function (an) { + return '[' + dataAnnotation() + '="' + an + '"]'; + }); + var newStart = child(start, rng.startOffset).getOr(start); + var closest = closest$1(newStart, selector, function (n) { + return eq$2(n, root); + }); + var getAttr = function (c, property) { + if (has$1(c, property)) { + return Optional.some(get$4(c, property)); + } else { + return Optional.none(); + } + }; + return closest.bind(function (c) { + return getAttr(c, '' + dataAnnotationId()).bind(function (uid) { + return getAttr(c, '' + dataAnnotation()).map(function (name) { + var elements = findMarkers(editor, uid); + return { + uid: uid, + name: name, + elements: elements + }; + }); + }); + }); + }; + var isAnnotation = function (elem) { + return isElement(elem) && has$2(elem, annotation()); + }; + var findMarkers = function (editor, uid) { + var body = SugarElement.fromDom(editor.getBody()); + return descendants$1(body, '[' + dataAnnotationId() + '="' + uid + '"]'); + }; + var findAll = function (editor, name) { + var body = SugarElement.fromDom(editor.getBody()); + var markers = descendants$1(body, '[' + dataAnnotation() + '="' + name + '"]'); + var directory = {}; + each(markers, function (m) { + var uid = get$4(m, dataAnnotationId()); + var nodesAlready = directory.hasOwnProperty(uid) ? directory[uid] : []; + directory[uid] = nodesAlready.concat([m]); + }); + return directory; + }; + + var setup = function (editor, _registry) { + var changeCallbacks = Cell({}); + var initData = function () { + return { + listeners: [], + previous: Cell(Optional.none()) + }; + }; + var withCallbacks = function (name, f) { + updateCallbacks(name, function (data) { + f(data); + return data; + }); + }; + var updateCallbacks = function (name, f) { + var callbackMap = changeCallbacks.get(); + var data = callbackMap.hasOwnProperty(name) ? callbackMap[name] : initData(); + var outputData = f(data); + callbackMap[name] = outputData; + changeCallbacks.set(callbackMap); + }; + var fireCallbacks = function (name, uid, elements) { + withCallbacks(name, function (data) { + each(data.listeners, function (f) { + return f(true, name, { + uid: uid, + nodes: map(elements, function (elem) { + return elem.dom; + }) + }); + }); + }); + }; + var fireNoAnnotation = function (name) { + withCallbacks(name, function (data) { + each(data.listeners, function (f) { + return f(false, name); + }); + }); + }; + var onNodeChange = last$2(function () { + var callbackMap = changeCallbacks.get(); + var annotations = sort$1(keys(callbackMap)); + each(annotations, function (name) { + updateCallbacks(name, function (data) { + var prev = data.previous.get(); + identify(editor, Optional.some(name)).fold(function () { + if (prev.isSome()) { + fireNoAnnotation(name); + data.previous.set(Optional.none()); + } + }, function (_a) { + var uid = _a.uid, name = _a.name, elements = _a.elements; + if (!prev.is(uid)) { + fireCallbacks(name, uid, elements); + data.previous.set(Optional.some(uid)); + } + }); + return { + previous: data.previous, + listeners: data.listeners + }; + }); + }); + }, 30); + editor.on('remove', function () { + onNodeChange.cancel(); + }); + editor.on('NodeChange', function () { + onNodeChange.throttle(); + }); + var addListener = function (name, f) { + updateCallbacks(name, function (data) { + return { + previous: data.previous, + listeners: data.listeners.concat([f]) + }; + }); + }; + return { addListener: addListener }; + }; + + var setup$1 = function (editor, registry) { + var identifyParserNode = function (span) { + return Optional.from(span.attr(dataAnnotation())).bind(registry.lookup); + }; + editor.on('init', function () { + editor.serializer.addNodeFilter('span', function (spans) { + each(spans, function (span) { + identifyParserNode(span).each(function (settings) { + if (settings.persistent === false) { + span.unwrap(); + } + }); + }); + }); + }); + }; + + var create$2 = function () { + var annotations = {}; + var register = function (name, settings) { + annotations[name] = { + name: name, + settings: settings + }; + }; + var lookup = function (name) { + return annotations.hasOwnProperty(name) ? Optional.from(annotations[name]).map(function (a) { + return a.settings; + }) : Optional.none(); + }; + return { + register: register, + lookup: lookup + }; + }; + + var unique = 0; + var generate$1 = function (prefix) { + var date = new Date(); + var time = date.getTime(); + var random = Math.floor(Math.random() * 1000000000); + unique++; + return prefix + '_' + random + unique + String(time); + }; + + var add$4 = function (element, classes) { + each(classes, function (x) { + add$3(element, x); + }); + }; + + var fromHtml$1 = function (html, scope) { + var doc = scope || document; + var div = doc.createElement('div'); + div.innerHTML = html; + return children(SugarElement.fromDom(div)); + }; + + var get$7 = function (element) { + return element.dom.innerHTML; + }; + var set$1 = function (element, content) { + var owner$1 = owner(element); + var docDom = owner$1.dom; + var fragment = SugarElement.fromDom(docDom.createDocumentFragment()); + var contentElements = fromHtml$1(content, docDom); + append$1(fragment, contentElements); + empty(element); + append(element, fragment); + }; + + var clone$1 = function (original, isDeep) { + return SugarElement.fromDom(original.dom.cloneNode(isDeep)); + }; + var shallow = function (original) { + return clone$1(original, false); + }; + var deep = function (original) { + return clone$1(original, true); + }; + + var TextWalker = function (startNode, rootNode, isBoundary) { + if (isBoundary === void 0) { + isBoundary = never; + } + var walker = new DomTreeWalker(startNode, rootNode); + var walk = function (direction) { + var next; + do { + next = walker[direction](); + } while (next && !isText$1(next) && !isBoundary(next)); + return Optional.from(next).filter(isText$1); + }; + return { + current: function () { + return Optional.from(walker.current()).filter(isText$1); + }, + next: function () { + return walk('next'); + }, + prev: function () { + return walk('prev'); + }, + prev2: function () { + return walk('prev2'); + } + }; + }; + + var TextSeeker = function (dom, isBoundary) { + var isBlockBoundary = isBoundary ? isBoundary : function (node) { + return dom.isBlock(node) || isBr(node) || isContentEditableFalse(node); + }; + var walk = function (node, offset, walker, process) { + if (isText$1(node)) { + var newOffset = process(node, offset, node.data); + if (newOffset !== -1) { + return Optional.some({ + container: node, + offset: newOffset + }); + } + } + return walker().bind(function (next) { + return walk(next.container, next.offset, walker, process); + }); + }; + var backwards = function (node, offset, process, root) { + var walker = TextWalker(node, root, isBlockBoundary); + return walk(node, offset, function () { + return walker.prev().map(function (prev) { + return { + container: prev, + offset: prev.length + }; + }); + }, process).getOrNull(); + }; + var forwards = function (node, offset, process, root) { + var walker = TextWalker(node, root, isBlockBoundary); + return walk(node, offset, function () { + return walker.next().map(function (next) { + return { + container: next, + offset: 0 + }; + }); + }, process).getOrNull(); + }; + return { + backwards: backwards, + forwards: forwards + }; + }; + + 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 lift2 = function (oa, ob, f) { + return oa.isSome() && ob.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie())) : Optional.none(); + }; + var lift3 = function (oa, ob, oc, f) { + return oa.isSome() && ob.isSome() && oc.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie(), oc.getOrDie())) : Optional.none(); + }; + var someIf = function (b, a) { + return b ? Optional.some(a) : Optional.none(); + }; + + var round = Math.round; + var clone$2 = function (rect) { + if (!rect) { + return { + left: 0, + top: 0, + bottom: 0, + right: 0, + width: 0, + height: 0 + }; + } + return { + left: round(rect.left), + top: round(rect.top), + bottom: round(rect.bottom), + right: round(rect.right), + width: round(rect.width), + height: round(rect.height) + }; + }; + var collapse = function (rect, toStart) { + rect = clone$2(rect); + if (toStart) { + rect.right = rect.left; + } else { + rect.left = rect.left + rect.width; + rect.right = rect.left; + } + rect.width = 0; + return rect; + }; + var isEqual = function (rect1, rect2) { + return rect1.left === rect2.left && rect1.top === rect2.top && rect1.bottom === rect2.bottom && rect1.right === rect2.right; + }; + var isValidOverflow = function (overflowY, rect1, rect2) { + return overflowY >= 0 && overflowY <= Math.min(rect1.height, rect2.height) / 2; + }; + var isAbove = function (rect1, rect2) { + var halfHeight = Math.min(rect2.height / 2, rect1.height / 2); + if (rect1.bottom - halfHeight < rect2.top) { + return true; + } + if (rect1.top > rect2.bottom) { + return false; + } + return isValidOverflow(rect2.top - rect1.bottom, rect1, rect2); + }; + var isBelow = function (rect1, rect2) { + if (rect1.top > rect2.bottom) { + return true; + } + if (rect1.bottom < rect2.top) { + return false; + } + return isValidOverflow(rect2.bottom - rect1.top, rect1, rect2); + }; + var containsXY = function (rect, clientX, clientY) { + return clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom; + }; + + var getSelectedNode = function (range) { + var startContainer = range.startContainer, startOffset = range.startOffset; + if (startContainer.hasChildNodes() && range.endOffset === startOffset + 1) { + return startContainer.childNodes[startOffset]; + } + return null; + }; + var getNode = function (container, offset) { + if (container.nodeType === 1 && container.hasChildNodes()) { + if (offset >= container.childNodes.length) { + offset = container.childNodes.length - 1; + } + container = container.childNodes[offset]; + } + return container; + }; + + var extendingChars = new RegExp('[\u0300-\u036f\u0483-\u0487\u0488-\u0489\u0591-\u05bd\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u0610-\u061a' + '\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0' + '\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e3-\u0902\u093a\u093c' + '\u0941-\u0948\u094d\u0951-\u0957\u0962-\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2-\u09e3' + '\u0a01-\u0a02\u0a3c\u0a41-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a51\u0a70-\u0a71\u0a75\u0a81-\u0a82\u0abc' + '\u0ac1-\u0ac5\u0ac7-\u0ac8\u0acd\u0ae2-\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57' + '\u0b62-\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c00\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56' + '\u0c62-\u0c63\u0c81\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc-\u0ccd\u0cd5-\u0cd6\u0ce2-\u0ce3\u0d01\u0d3e\u0d41-\u0d44' + '\u0d4d\u0d57\u0d62-\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9' + '\u0ebb-\u0ebc\u0ec8-\u0ecd\u0f18-\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86-\u0f87\u0f8d-\u0f97' + '\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039-\u103a\u103d-\u103e\u1058-\u1059\u105e-\u1060\u1071-\u1074' + '\u1082\u1085-\u1086\u108d\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17b4-\u17b5' + '\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193b\u1a17-\u1a18' + '\u1a1b\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1ab0-\u1abd\u1ABE\u1b00-\u1b03\u1b34' + '\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80-\u1b81\u1ba2-\u1ba5\u1ba8-\u1ba9\u1bab-\u1bad\u1be6\u1be8-\u1be9' + '\u1bed\u1bef-\u1bf1\u1c2c-\u1c33\u1c36-\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1cf4\u1cf8-\u1cf9' + '\u1dc0-\u1df5\u1dfc-\u1dff\u200c-\u200d\u20d0-\u20dc\u20DD-\u20E0\u20e1\u20E2-\u20E4\u20e5-\u20f0\u2cef-\u2cf1' + '\u2d7f\u2de0-\u2dff\u302a-\u302d\u302e-\u302f\u3099-\u309a\ua66f\uA670-\uA672\ua674-\ua67d\ua69e-\ua69f\ua6f0-\ua6f1' + '\ua802\ua806\ua80b\ua825-\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc' + '\ua9e5\uaa29-\uaa2e\uaa31-\uaa32\uaa35-\uaa36\uaa43\uaa4c\uaa7c\uaab0\uaab2-\uaab4\uaab7-\uaab8\uaabe-\uaabf\uaac1' + '\uaaec-\uaaed\uaaf6\uabe5\uabe8\uabed\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\uff9e-\uff9f]'); + var isExtendingChar = function (ch) { + return typeof ch === 'string' && ch.charCodeAt(0) >= 768 && extendingChars.test(ch); + }; + + var or = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return function (x) { + for (var i = 0; i < args.length; i++) { + if (args[i](x)) { + return true; + } + } + return false; + }; + }; + var and = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return function (x) { + for (var i = 0; i < args.length; i++) { + if (!args[i](x)) { + return false; + } + } + return true; + }; + }; + + var isElement$3 = isElement$1; + var isCaretCandidate$1 = isCaretCandidate; + var isBlock$1 = matchStyleValues('display', 'block table'); + var isFloated = matchStyleValues('float', 'left right'); + var isValidElementCaretCandidate = and(isElement$3, isCaretCandidate$1, not(isFloated)); + var isNotPre = not(matchStyleValues('white-space', 'pre pre-line pre-wrap')); + var isText$4 = isText$1; + var isBr$3 = isBr; + var nodeIndex = DOMUtils$1.nodeIndex; + var resolveIndex = getNode; + var createRange = function (doc) { + return 'createRange' in doc ? doc.createRange() : DOMUtils$1.DOM.createRng(); + }; + var isWhiteSpace = function (chr) { + return chr && /[\r\n\t ]/.test(chr); + }; + var isRange = function (rng) { + return !!rng.setStart && !!rng.setEnd; + }; + var isHiddenWhiteSpaceRange = function (range) { + var container = range.startContainer; + var offset = range.startOffset; + var text; + if (isWhiteSpace(range.toString()) && isNotPre(container.parentNode) && isText$1(container)) { + text = container.data; + if (isWhiteSpace(text[offset - 1]) || isWhiteSpace(text[offset + 1])) { + return true; + } + } + return false; + }; + var getBrClientRect = function (brNode) { + var doc = brNode.ownerDocument; + var rng = createRange(doc); + var nbsp$1 = doc.createTextNode(nbsp); + var parentNode = brNode.parentNode; + parentNode.insertBefore(nbsp$1, brNode); + rng.setStart(nbsp$1, 0); + rng.setEnd(nbsp$1, 1); + var clientRect = clone$2(rng.getBoundingClientRect()); + parentNode.removeChild(nbsp$1); + return clientRect; + }; + var getBoundingClientRectWebKitText = function (rng) { + var sc = rng.startContainer; + var ec = rng.endContainer; + var so = rng.startOffset; + var eo = rng.endOffset; + if (sc === ec && isText$1(ec) && so === 0 && eo === 1) { + var newRng = rng.cloneRange(); + newRng.setEndAfter(ec); + return getBoundingClientRect(newRng); + } else { + return null; + } + }; + var isZeroRect = function (r) { + return r.left === 0 && r.right === 0 && r.top === 0 && r.bottom === 0; + }; + var getBoundingClientRect = function (item) { + var clientRect; + var clientRects = item.getClientRects(); + if (clientRects.length > 0) { + clientRect = clone$2(clientRects[0]); + } else { + clientRect = clone$2(item.getBoundingClientRect()); + } + if (!isRange(item) && isBr$3(item) && isZeroRect(clientRect)) { + return getBrClientRect(item); + } + if (isZeroRect(clientRect) && isRange(item)) { + return getBoundingClientRectWebKitText(item); + } + return clientRect; + }; + var collapseAndInflateWidth = function (clientRect, toStart) { + var newClientRect = collapse(clientRect, toStart); + newClientRect.width = 1; + newClientRect.right = newClientRect.left + 1; + return newClientRect; + }; + var getCaretPositionClientRects = function (caretPosition) { + var clientRects = []; + var beforeNode, node; + var addUniqueAndValidRect = function (clientRect) { + if (clientRect.height === 0) { + return; + } + if (clientRects.length > 0) { + if (isEqual(clientRect, clientRects[clientRects.length - 1])) { + return; + } + } + clientRects.push(clientRect); + }; + var addCharacterOffset = function (container, offset) { + var range = createRange(container.ownerDocument); + if (offset < container.data.length) { + if (isExtendingChar(container.data[offset])) { + return clientRects; + } + if (isExtendingChar(container.data[offset - 1])) { + range.setStart(container, offset); + range.setEnd(container, offset + 1); + if (!isHiddenWhiteSpaceRange(range)) { + addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(range), false)); + return clientRects; + } + } + } + if (offset > 0) { + range.setStart(container, offset - 1); + range.setEnd(container, offset); + if (!isHiddenWhiteSpaceRange(range)) { + addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(range), false)); + } + } + if (offset < container.data.length) { + range.setStart(container, offset); + range.setEnd(container, offset + 1); + if (!isHiddenWhiteSpaceRange(range)) { + addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(range), true)); + } + } + }; + if (isText$4(caretPosition.container())) { + addCharacterOffset(caretPosition.container(), caretPosition.offset()); + return clientRects; + } + if (isElement$3(caretPosition.container())) { + if (caretPosition.isAtEnd()) { + node = resolveIndex(caretPosition.container(), caretPosition.offset()); + if (isText$4(node)) { + addCharacterOffset(node, node.data.length); + } + if (isValidElementCaretCandidate(node) && !isBr$3(node)) { + addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(node), false)); + } + } else { + node = resolveIndex(caretPosition.container(), caretPosition.offset()); + if (isText$4(node)) { + addCharacterOffset(node, 0); + } + if (isValidElementCaretCandidate(node) && caretPosition.isAtEnd()) { + addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(node), false)); + return clientRects; + } + beforeNode = resolveIndex(caretPosition.container(), caretPosition.offset() - 1); + if (isValidElementCaretCandidate(beforeNode) && !isBr$3(beforeNode)) { + if (isBlock$1(beforeNode) || isBlock$1(node) || !isValidElementCaretCandidate(node)) { + addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(beforeNode), false)); + } + } + if (isValidElementCaretCandidate(node)) { + addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(node), true)); + } + } + } + return clientRects; + }; + function CaretPosition(container, offset, clientRects) { + var isAtStart = function () { + if (isText$4(container)) { + return offset === 0; + } + return offset === 0; + }; + var isAtEnd = function () { + if (isText$4(container)) { + return offset >= container.data.length; + } + return offset >= container.childNodes.length; + }; + var toRange = function () { + var range = createRange(container.ownerDocument); + range.setStart(container, offset); + range.setEnd(container, offset); + return range; + }; + var getClientRects = function () { + if (!clientRects) { + clientRects = getCaretPositionClientRects(CaretPosition(container, offset)); + } + return clientRects; + }; + var isVisible = function () { + return getClientRects().length > 0; + }; + var isEqual = function (caretPosition) { + return caretPosition && container === caretPosition.container() && offset === caretPosition.offset(); + }; + var getNode = function (before) { + return resolveIndex(container, before ? offset - 1 : offset); + }; + return { + container: constant(container), + offset: constant(offset), + toRange: toRange, + getClientRects: getClientRects, + isVisible: isVisible, + isAtStart: isAtStart, + isAtEnd: isAtEnd, + isEqual: isEqual, + getNode: getNode + }; + } + (function (CaretPosition) { + CaretPosition.fromRangeStart = function (range) { + return CaretPosition(range.startContainer, range.startOffset); + }; + CaretPosition.fromRangeEnd = function (range) { + return CaretPosition(range.endContainer, range.endOffset); + }; + CaretPosition.after = function (node) { + return CaretPosition(node.parentNode, nodeIndex(node) + 1); + }; + CaretPosition.before = function (node) { + return CaretPosition(node.parentNode, nodeIndex(node)); + }; + CaretPosition.isAbove = function (pos1, pos2) { + return lift2(head(pos2.getClientRects()), last(pos1.getClientRects()), isAbove).getOr(false); + }; + CaretPosition.isBelow = function (pos1, pos2) { + return lift2(last(pos2.getClientRects()), head(pos1.getClientRects()), isBelow).getOr(false); + }; + CaretPosition.isAtStart = function (pos) { + return pos ? pos.isAtStart() : false; + }; + CaretPosition.isAtEnd = function (pos) { + return pos ? pos.isAtEnd() : false; + }; + CaretPosition.isTextPosition = function (pos) { + return pos ? isText$1(pos.container()) : false; + }; + CaretPosition.isElementPosition = function (pos) { + return CaretPosition.isTextPosition(pos) === false; + }; + }(CaretPosition || (CaretPosition = {}))); + var CaretPosition$1 = CaretPosition; + + var trimEmptyTextNode = function (dom, node) { + if (isText$1(node) && node.data.length === 0) { + dom.remove(node); + } + }; + var insertNode = function (dom, rng, node) { + rng.insertNode(node); + trimEmptyTextNode(dom, node.previousSibling); + trimEmptyTextNode(dom, node.nextSibling); + }; + var insertFragment = function (dom, rng, frag) { + var firstChild = Optional.from(frag.firstChild); + var lastChild = Optional.from(frag.lastChild); + rng.insertNode(frag); + firstChild.each(function (child) { + return trimEmptyTextNode(dom, child.previousSibling); + }); + lastChild.each(function (child) { + return trimEmptyTextNode(dom, child.nextSibling); + }); + }; + var rangeInsertNode = function (dom, rng, node) { + if (isDocumentFragment$1(node)) { + insertFragment(dom, rng, node); + } else { + insertNode(dom, rng, node); + } + }; + + var isText$5 = isText$1; + var isBogus$2 = isBogus; + var nodeIndex$1 = DOMUtils$1.nodeIndex; + var normalizedParent = function (node) { + var parentNode = node.parentNode; + if (isBogus$2(parentNode)) { + return normalizedParent(parentNode); + } + return parentNode; + }; + var getChildNodes = function (node) { + if (!node) { + return []; + } + return reduce(node.childNodes, function (result, node) { + if (isBogus$2(node) && node.nodeName !== 'BR') { + result = result.concat(getChildNodes(node)); + } else { + result.push(node); + } + return result; + }, []); + }; + var normalizedTextOffset = function (node, offset) { + while (node = node.previousSibling) { + if (!isText$5(node)) { + break; + } + offset += node.data.length; + } + return offset; + }; + var equal$1 = function (a) { + return function (b) { + return a === b; + }; + }; + var normalizedNodeIndex = function (node) { + var nodes, index; + nodes = getChildNodes(normalizedParent(node)); + index = findIndex$1(nodes, equal$1(node), node); + nodes = nodes.slice(0, index + 1); + var numTextFragments = reduce(nodes, function (result, node, i) { + if (isText$5(node) && isText$5(nodes[i - 1])) { + result++; + } + return result; + }, 0); + nodes = filter$2(nodes, matchNodeNames([node.nodeName])); + index = findIndex$1(nodes, equal$1(node), node); + return index - numTextFragments; + }; + var createPathItem = function (node) { + var name; + if (isText$5(node)) { + name = 'text()'; + } else { + name = node.nodeName.toLowerCase(); + } + return name + '[' + normalizedNodeIndex(node) + ']'; + }; + var parentsUntil = function (root, node, predicate) { + var parents = []; + for (node = node.parentNode; node !== root; node = node.parentNode) { + if (predicate && predicate(node)) { + break; + } + parents.push(node); + } + return parents; + }; + var create$3 = function (root, caretPosition) { + var container, offset, path = [], outputOffset, childNodes, parents; + container = caretPosition.container(); + offset = caretPosition.offset(); + if (isText$5(container)) { + outputOffset = normalizedTextOffset(container, offset); + } else { + childNodes = container.childNodes; + if (offset >= childNodes.length) { + outputOffset = 'after'; + offset = childNodes.length - 1; + } else { + outputOffset = 'before'; + } + container = childNodes[offset]; + } + path.push(createPathItem(container)); + parents = parentsUntil(root, container); + parents = filter$2(parents, not(isBogus)); + path = path.concat(map$2(parents, function (node) { + return createPathItem(node); + })); + return path.reverse().join('/') + ',' + outputOffset; + }; + var resolvePathItem = function (node, name, index) { + var nodes = getChildNodes(node); + nodes = filter$2(nodes, function (node, index) { + return !isText$5(node) || !isText$5(nodes[index - 1]); + }); + nodes = filter$2(nodes, matchNodeNames([name])); + return nodes[index]; + }; + var findTextPosition = function (container, offset) { + var node = container, targetOffset = 0, dataLen; + while (isText$5(node)) { + dataLen = node.data.length; + if (offset >= targetOffset && offset <= targetOffset + dataLen) { + container = node; + offset = offset - targetOffset; + break; + } + if (!isText$5(node.nextSibling)) { + container = node; + offset = dataLen; + break; + } + targetOffset += dataLen; + node = node.nextSibling; + } + if (isText$5(container) && offset > container.data.length) { + offset = container.data.length; + } + return CaretPosition$1(container, offset); + }; + var resolve$1 = function (root, path) { + var offset; + if (!path) { + return null; + } + var parts = path.split(','); + var paths = parts[0].split('/'); + offset = parts.length > 1 ? parts[1] : 'before'; + var container = reduce(paths, function (result, value) { + var match = /([\w\-\(\)]+)\[([0-9]+)\]/.exec(value); + if (!match) { + return null; + } + if (match[1] === 'text()') { + match[1] = '#text'; + } + return resolvePathItem(result, match[1], parseInt(match[2], 10)); + }, root); + if (!container) { + return null; + } + if (!isText$5(container)) { + if (offset === 'after') { + offset = nodeIndex$1(container) + 1; + } else { + offset = nodeIndex$1(container); + } + return CaretPosition$1(container.parentNode, offset); + } + return findTextPosition(container, parseInt(offset, 10)); + }; + + var isContentEditableFalse$2 = isContentEditableFalse; + var getNormalizedTextOffset = function (trim, container, offset) { + var node, trimmedOffset; + trimmedOffset = trim(container.data.slice(0, offset)).length; + for (node = container.previousSibling; node && isText$1(node); node = node.previousSibling) { + trimmedOffset += trim(node.data).length; + } + return trimmedOffset; + }; + var getPoint = function (dom, trim, normalized, rng, start) { + var container = rng[start ? 'startContainer' : 'endContainer']; + var offset = rng[start ? 'startOffset' : 'endOffset']; + var point = []; + var childNodes, after = 0; + var root = dom.getRoot(); + if (isText$1(container)) { + point.push(normalized ? getNormalizedTextOffset(trim, container, offset) : offset); + } else { + childNodes = container.childNodes; + if (offset >= childNodes.length && childNodes.length) { + after = 1; + offset = Math.max(0, childNodes.length - 1); + } + point.push(dom.nodeIndex(childNodes[offset], normalized) + after); + } + for (; container && container !== root; container = container.parentNode) { + point.push(dom.nodeIndex(container, normalized)); + } + return point; + }; + var getLocation = function (trim, selection, normalized, rng) { + var dom = selection.dom, bookmark = {}; + bookmark.start = getPoint(dom, trim, normalized, rng, true); + if (!selection.isCollapsed()) { + bookmark.end = getPoint(dom, trim, normalized, rng, false); + } + return bookmark; + }; + var findIndex$2 = function (dom, name, element) { + var count = 0; + Tools.each(dom.select(name), function (node) { + if (node.getAttribute('data-mce-bogus') === 'all') { + return; + } + if (node === element) { + return false; + } + count++; + }); + return count; + }; + var moveEndPoint = function (rng, start) { + var container, offset, childNodes; + var prefix = start ? 'start' : 'end'; + container = rng[prefix + 'Container']; + offset = rng[prefix + 'Offset']; + if (isElement$1(container) && container.nodeName === 'TR') { + childNodes = container.childNodes; + container = childNodes[Math.min(start ? offset : offset - 1, childNodes.length - 1)]; + if (container) { + offset = start ? 0 : container.childNodes.length; + rng['set' + (start ? 'Start' : 'End')](container, offset); + } + } + }; + var normalizeTableCellSelection = function (rng) { + moveEndPoint(rng, true); + moveEndPoint(rng, false); + return rng; + }; + var findSibling = function (node, offset) { + var sibling; + if (isElement$1(node)) { + node = getNode(node, offset); + if (isContentEditableFalse$2(node)) { + return node; + } + } + if (isCaretContainer(node)) { + if (isText$1(node) && isCaretContainerBlock(node)) { + node = node.parentNode; + } + sibling = node.previousSibling; + if (isContentEditableFalse$2(sibling)) { + return sibling; + } + sibling = node.nextSibling; + if (isContentEditableFalse$2(sibling)) { + return sibling; + } + } + }; + var findAdjacentContentEditableFalseElm = function (rng) { + return findSibling(rng.startContainer, rng.startOffset) || findSibling(rng.endContainer, rng.endOffset); + }; + var getOffsetBookmark = function (trim, normalized, selection) { + var element = selection.getNode(); + var name = element ? element.nodeName : null; + var rng = selection.getRng(); + if (isContentEditableFalse$2(element) || name === 'IMG') { + return { + name: name, + index: findIndex$2(selection.dom, name, element) + }; + } + var sibling = findAdjacentContentEditableFalseElm(rng); + if (sibling) { + name = sibling.tagName; + return { + name: name, + index: findIndex$2(selection.dom, name, sibling) + }; + } + return getLocation(trim, selection, normalized, rng); + }; + var getCaretBookmark = function (selection) { + var rng = selection.getRng(); + return { + start: create$3(selection.dom.getRoot(), CaretPosition$1.fromRangeStart(rng)), + end: create$3(selection.dom.getRoot(), CaretPosition$1.fromRangeEnd(rng)) + }; + }; + var getRangeBookmark = function (selection) { + return { rng: selection.getRng() }; + }; + var createBookmarkSpan = function (dom, id, filled) { + var args = { + 'data-mce-type': 'bookmark', + id: id, + 'style': 'overflow:hidden;line-height:0px' + }; + return filled ? dom.create('span', args, '') : dom.create('span', args); + }; + var getPersistentBookmark = function (selection, filled) { + var dom = selection.dom; + var rng = selection.getRng(); + var id = dom.uniqueId(); + var collapsed = selection.isCollapsed(); + var element = selection.getNode(); + var name = element.nodeName; + if (name === 'IMG') { + return { + name: name, + index: findIndex$2(dom, name, element) + }; + } + var rng2 = normalizeTableCellSelection(rng.cloneRange()); + if (!collapsed) { + rng2.collapse(false); + var endBookmarkNode = createBookmarkSpan(dom, id + '_end', filled); + rangeInsertNode(dom, rng2, endBookmarkNode); + } + rng = normalizeTableCellSelection(rng); + rng.collapse(true); + var startBookmarkNode = createBookmarkSpan(dom, id + '_start', filled); + rangeInsertNode(dom, rng, startBookmarkNode); + selection.moveToBookmark({ + id: id, + keep: true + }); + return { id: id }; + }; + var getBookmark = function (selection, type, normalized) { + if (type === 2) { + return getOffsetBookmark(trim$2, normalized, selection); + } else if (type === 3) { + return getCaretBookmark(selection); + } else if (type) { + return getRangeBookmark(selection); + } else { + return getPersistentBookmark(selection, false); + } + }; + var getUndoBookmark = curry(getOffsetBookmark, identity, true); + + var DOM$1 = DOMUtils$1.DOM; + var defaultPreviewStyles = 'font-family font-size font-weight font-style text-decoration text-transform color background-color border border-radius outline text-shadow'; + var getBodySetting = function (editor, name, defaultValue) { + var value = editor.getParam(name, defaultValue); + if (value.indexOf('=') !== -1) { + var bodyObj = editor.getParam(name, '', 'hash'); + return bodyObj.hasOwnProperty(editor.id) ? bodyObj[editor.id] : defaultValue; + } else { + return value; + } + }; + var getIframeAttrs = function (editor) { + return editor.getParam('iframe_attrs', {}); + }; + var getDocType = function (editor) { + return editor.getParam('doctype', ''); + }; + var getDocumentBaseUrl = function (editor) { + return editor.getParam('document_base_url', ''); + }; + var getBodyId = function (editor) { + return getBodySetting(editor, 'body_id', 'tinymce'); + }; + var getBodyClass = function (editor) { + return getBodySetting(editor, 'body_class', ''); + }; + var getContentSecurityPolicy = function (editor) { + return editor.getParam('content_security_policy', ''); + }; + var shouldPutBrInPre = function (editor) { + return editor.getParam('br_in_pre', true); + }; + var getForcedRootBlock = function (editor) { + if (editor.getParam('force_p_newlines', false)) { + return 'p'; + } + var block = editor.getParam('forced_root_block', 'p'); + if (block === false) { + return ''; + } else if (block === true) { + return 'p'; + } else { + return block; + } + }; + var getForcedRootBlockAttrs = function (editor) { + return editor.getParam('forced_root_block_attrs', {}); + }; + var getBrNewLineSelector = function (editor) { + return editor.getParam('br_newline_selector', '.mce-toc h2,figcaption,caption'); + }; + var getNoNewLineSelector = function (editor) { + return editor.getParam('no_newline_selector', ''); + }; + var shouldKeepStyles = function (editor) { + return editor.getParam('keep_styles', true); + }; + var shouldEndContainerOnEmptyBlock = function (editor) { + return editor.getParam('end_container_on_empty_block', false); + }; + var getFontStyleValues = function (editor) { + return Tools.explode(editor.getParam('font_size_style_values', 'xx-small,x-small,small,medium,large,x-large,xx-large')); + }; + var getFontSizeClasses = function (editor) { + return Tools.explode(editor.getParam('font_size_classes', '')); + }; + var getImagesDataImgFilter = function (editor) { + return editor.getParam('images_dataimg_filter', always, 'function'); + }; + var isAutomaticUploadsEnabled = function (editor) { + return editor.getParam('automatic_uploads', true, 'boolean'); + }; + var shouldReuseFileName = function (editor) { + return editor.getParam('images_reuse_filename', false, 'boolean'); + }; + var shouldReplaceBlobUris = function (editor) { + return editor.getParam('images_replace_blob_uris', true, 'boolean'); + }; + var getIconPackName = function (editor) { + return editor.getParam('icons', '', 'string'); + }; + var getIconsUrl = function (editor) { + return editor.getParam('icons_url', '', 'string'); + }; + var getImageUploadUrl = function (editor) { + return editor.getParam('images_upload_url', '', 'string'); + }; + var getImageUploadBasePath = function (editor) { + return editor.getParam('images_upload_base_path', '', 'string'); + }; + var getImagesUploadCredentials = function (editor) { + return editor.getParam('images_upload_credentials', false, 'boolean'); + }; + var getImagesUploadHandler = function (editor) { + return editor.getParam('images_upload_handler', null, 'function'); + }; + var shouldUseContentCssCors = function (editor) { + return editor.getParam('content_css_cors', false, 'boolean'); + }; + var getReferrerPolicy = function (editor) { + return editor.getParam('referrer_policy', '', 'string'); + }; + var getLanguageCode = function (editor) { + return editor.getParam('language', 'en', 'string'); + }; + var getLanguageUrl = function (editor) { + return editor.getParam('language_url', '', 'string'); + }; + var shouldIndentUseMargin = function (editor) { + return editor.getParam('indent_use_margin', false); + }; + var getIndentation = function (editor) { + return editor.getParam('indentation', '40px', 'string'); + }; + var getContentCss = function (editor) { + var contentCss = editor.getParam('content_css'); + if (isString(contentCss)) { + return map(contentCss.split(','), trim); + } else if (isArray(contentCss)) { + return contentCss; + } else if (contentCss === false || editor.inline) { + return []; + } else { + return ['default']; + } + }; + var getDirectionality = function (editor) { + return editor.getParam('directionality', I18n.isRtl() ? 'rtl' : undefined); + }; + var getInlineBoundarySelector = function (editor) { + return editor.getParam('inline_boundaries_selector', 'a[href],code,.mce-annotation', 'string'); + }; + var getObjectResizing = function (editor) { + var selector = editor.getParam('object_resizing'); + if (selector === false || Env.iOS) { + return false; + } else { + return isString(selector) ? selector : 'table,img,figure.image,div'; + } + }; + var getResizeImgProportional = function (editor) { + return editor.getParam('resize_img_proportional', true, 'boolean'); + }; + var getPlaceholder = function (editor) { + return editor.getParam('placeholder', DOM$1.getAttrib(editor.getElement(), 'placeholder'), 'string'); + }; + var getEventRoot = function (editor) { + return editor.getParam('event_root'); + }; + var getServiceMessage = function (editor) { + return editor.getParam('service_message'); + }; + var getTheme = function (editor) { + return editor.getParam('theme'); + }; + var shouldValidate = function (editor) { + return editor.getParam('validate'); + }; + var isInlineBoundariesEnabled = function (editor) { + return editor.getParam('inline_boundaries') !== false; + }; + var getFormats = function (editor) { + return editor.getParam('formats'); + }; + var getPreviewStyles = function (editor) { + var style = editor.getParam('preview_styles', defaultPreviewStyles); + if (isString(style)) { + return style; + } else { + return ''; + } + }; + var canFormatEmptyLines = function (editor) { + return editor.getParam('format_empty_lines', false, 'boolean'); + }; + var getCustomUiSelector = function (editor) { + return editor.getParam('custom_ui_selector', '', 'string'); + }; + var getThemeUrl = function (editor) { + return editor.getParam('theme_url'); + }; + var isInline$1 = function (editor) { + return editor.getParam('inline'); + }; + var hasHiddenInput = function (editor) { + return editor.getParam('hidden_input'); + }; + var shouldPatchSubmit = function (editor) { + return editor.getParam('submit_patch'); + }; + var isEncodingXml = function (editor) { + return editor.getParam('encoding') === 'xml'; + }; + var shouldAddFormSubmitTrigger = function (editor) { + return editor.getParam('add_form_submit_trigger'); + }; + var shouldAddUnloadTrigger = function (editor) { + return editor.getParam('add_unload_trigger'); + }; + var hasForcedRootBlock = function (editor) { + return getForcedRootBlock(editor) !== ''; + }; + var getCustomUndoRedoLevels = function (editor) { + return editor.getParam('custom_undo_redo_levels', 0, 'number'); + }; + var shouldDisableNodeChange = function (editor) { + return editor.getParam('disable_nodechange'); + }; + var isReadOnly = function (editor) { + return editor.getParam('readonly'); + }; + var hasContentCssCors = function (editor) { + return editor.getParam('content_css_cors'); + }; + var getPlugins = function (editor) { + return editor.getParam('plugins', '', 'string'); + }; + var getExternalPlugins = function (editor) { + return editor.getParam('external_plugins'); + }; + var shouldBlockUnsupportedDrop = function (editor) { + return editor.getParam('block_unsupported_drop', true, 'boolean'); + }; + var isVisualAidsEnabled = function (editor) { + return editor.getParam('visual', true, 'boolean'); + }; + var getVisualAidsTableClass = function (editor) { + return editor.getParam('visual_table_class', 'mce-item-table', 'string'); + }; + var getVisualAidsAnchorClass = function (editor) { + return editor.getParam('visual_anchor_class', 'mce-item-anchor', 'string'); + }; + + var isElement$4 = isElement$1; + var isText$6 = isText$1; + var removeNode = function (node) { + var parentNode = node.parentNode; + if (parentNode) { + parentNode.removeChild(node); + } + }; + var trimCount = function (text) { + var trimmedText = trim$2(text); + return { + count: text.length - trimmedText.length, + text: trimmedText + }; + }; + var deleteZwspChars = function (caretContainer) { + var idx; + while ((idx = caretContainer.data.lastIndexOf(ZWSP)) !== -1) { + caretContainer.deleteData(idx, 1); + } + }; + var removeUnchanged = function (caretContainer, pos) { + remove$5(caretContainer); + return pos; + }; + var removeTextAndReposition = function (caretContainer, pos) { + var before = trimCount(caretContainer.data.substr(0, pos.offset())); + var after = trimCount(caretContainer.data.substr(pos.offset())); + var text = before.text + after.text; + if (text.length > 0) { + deleteZwspChars(caretContainer); + return CaretPosition$1(caretContainer, pos.offset() - before.count); + } else { + return pos; + } + }; + var removeElementAndReposition = function (caretContainer, pos) { + var parentNode = pos.container(); + var newPosition = indexOf(from$1(parentNode.childNodes), caretContainer).map(function (index) { + return index < pos.offset() ? CaretPosition$1(parentNode, pos.offset() - 1) : pos; + }).getOr(pos); + remove$5(caretContainer); + return newPosition; + }; + var removeTextCaretContainer = function (caretContainer, pos) { + return isText$6(caretContainer) && pos.container() === caretContainer ? removeTextAndReposition(caretContainer, pos) : removeUnchanged(caretContainer, pos); + }; + var removeElementCaretContainer = function (caretContainer, pos) { + return pos.container() === caretContainer.parentNode ? removeElementAndReposition(caretContainer, pos) : removeUnchanged(caretContainer, pos); + }; + var removeAndReposition = function (container, pos) { + return CaretPosition$1.isTextPosition(pos) ? removeTextCaretContainer(container, pos) : removeElementCaretContainer(container, pos); + }; + var remove$5 = function (caretContainerNode) { + if (isElement$4(caretContainerNode) && isCaretContainer(caretContainerNode)) { + if (hasContent(caretContainerNode)) { + caretContainerNode.removeAttribute('data-mce-caret'); + } else { + removeNode(caretContainerNode); + } + } + if (isText$6(caretContainerNode)) { + deleteZwspChars(caretContainerNode); + if (caretContainerNode.data.length === 0) { + removeNode(caretContainerNode); + } + } + }; + + var browser$2 = detect$3().browser; + var isContentEditableFalse$3 = isContentEditableFalse; + var isMedia$1 = isMedia; + var isTableCell$2 = isTableCell; + var inlineFakeCaretSelector = '*[contentEditable=false],video,audio,embed,object'; + var getAbsoluteClientRect = function (root, element, before) { + var clientRect = collapse(element.getBoundingClientRect(), before); + var docElm, scrollX, scrollY, margin, rootRect; + if (root.tagName === 'BODY') { + docElm = root.ownerDocument.documentElement; + scrollX = root.scrollLeft || docElm.scrollLeft; + scrollY = root.scrollTop || docElm.scrollTop; + } else { + rootRect = root.getBoundingClientRect(); + scrollX = root.scrollLeft - rootRect.left; + scrollY = root.scrollTop - rootRect.top; + } + clientRect.left += scrollX; + clientRect.right += scrollX; + clientRect.top += scrollY; + clientRect.bottom += scrollY; + clientRect.width = 1; + margin = element.offsetWidth - element.clientWidth; + if (margin > 0) { + if (before) { + margin *= -1; + } + clientRect.left += margin; + clientRect.right += margin; + } + return clientRect; + }; + var trimInlineCaretContainers = function (root) { + var fakeCaretTargetNodes = descendants$1(SugarElement.fromDom(root), inlineFakeCaretSelector); + for (var i = 0; i < fakeCaretTargetNodes.length; i++) { + var node = fakeCaretTargetNodes[i].dom; + var sibling = node.previousSibling; + if (endsWithCaretContainer(sibling)) { + var data = sibling.data; + if (data.length === 1) { + sibling.parentNode.removeChild(sibling); + } else { + sibling.deleteData(data.length - 1, 1); + } + } + sibling = node.nextSibling; + if (startsWithCaretContainer(sibling)) { + var data = sibling.data; + if (data.length === 1) { + sibling.parentNode.removeChild(sibling); + } else { + sibling.deleteData(0, 1); + } + } + } + }; + var FakeCaret = function (editor, root, isBlock, hasFocus) { + var lastVisualCaret = Cell(Optional.none()); + var cursorInterval, caretContainerNode; + var rootBlock = getForcedRootBlock(editor); + var caretBlock = rootBlock.length > 0 ? rootBlock : 'p'; + var show = function (before, element) { + var clientRect, rng; + hide(); + if (isTableCell$2(element)) { + return null; + } + if (isBlock(element)) { + caretContainerNode = insertBlock(caretBlock, element, before); + clientRect = getAbsoluteClientRect(root, element, before); + DomQuery(caretContainerNode).css('top', clientRect.top); + var caret = DomQuery('
                                      ').css(clientRect).appendTo(root)[0]; + lastVisualCaret.set(Optional.some({ + caret: caret, + element: element, + before: before + })); + lastVisualCaret.get().each(function (caretState) { + if (before) { + DomQuery(caretState.caret).addClass('mce-visual-caret-before'); + } + }); + startBlink(); + rng = element.ownerDocument.createRange(); + rng.setStart(caretContainerNode, 0); + rng.setEnd(caretContainerNode, 0); + } else { + caretContainerNode = insertInline(element, before); + rng = element.ownerDocument.createRange(); + if (isInlineFakeCaretTarget(caretContainerNode.nextSibling)) { + rng.setStart(caretContainerNode, 0); + rng.setEnd(caretContainerNode, 0); + } else { + rng.setStart(caretContainerNode, 1); + rng.setEnd(caretContainerNode, 1); + } + return rng; + } + return rng; + }; + var hide = function () { + trimInlineCaretContainers(root); + if (caretContainerNode) { + remove$5(caretContainerNode); + caretContainerNode = null; + } + lastVisualCaret.get().each(function (caretState) { + DomQuery(caretState.caret).remove(); + lastVisualCaret.set(Optional.none()); + }); + if (cursorInterval) { + Delay.clearInterval(cursorInterval); + cursorInterval = null; + } + }; + var startBlink = function () { + cursorInterval = Delay.setInterval(function () { + if (hasFocus()) { + DomQuery('div.mce-visual-caret', root).toggleClass('mce-visual-caret-hidden'); + } else { + DomQuery('div.mce-visual-caret', root).addClass('mce-visual-caret-hidden'); + } + }, 500); + }; + var reposition = function () { + lastVisualCaret.get().each(function (caretState) { + var clientRect = getAbsoluteClientRect(root, caretState.element, caretState.before); + DomQuery(caretState.caret).css(__assign({}, clientRect)); + }); + }; + var destroy = function () { + return Delay.clearInterval(cursorInterval); + }; + var getCss = function () { + return '.mce-visual-caret {' + 'position: absolute;' + 'background-color: black;' + 'background-color: currentcolor;' + '}' + '.mce-visual-caret-hidden {' + 'display: none;' + '}' + '*[data-mce-caret] {' + 'position: absolute;' + 'left: -1000px;' + 'right: auto;' + 'top: 0;' + 'margin: 0;' + 'padding: 0;' + '}'; + }; + return { + show: show, + hide: hide, + getCss: getCss, + reposition: reposition, + destroy: destroy + }; + }; + var isFakeCaretTableBrowser = function () { + return browser$2.isIE() || browser$2.isEdge() || browser$2.isFirefox(); + }; + var isInlineFakeCaretTarget = function (node) { + return isContentEditableFalse$3(node) || isMedia$1(node); + }; + var isFakeCaretTarget = function (node) { + return isInlineFakeCaretTarget(node) || isTable(node) && isFakeCaretTableBrowser(); + }; + + var isContentEditableFalse$4 = isContentEditableFalse; + var isMedia$2 = isMedia; + var isBlockLike = matchStyleValues('display', 'block table table-cell table-caption list-item'); + var isCaretContainer$2 = isCaretContainer; + var isCaretContainerBlock$1 = isCaretContainerBlock; + var isElement$5 = isElement$1; + var isCaretCandidate$2 = isCaretCandidate; + var isForwards = function (direction) { + return direction > 0; + }; + var isBackwards = function (direction) { + return direction < 0; + }; + var skipCaretContainers = function (walk, shallow) { + var node; + while (node = walk(shallow)) { + if (!isCaretContainerBlock$1(node)) { + return node; + } + } + return null; + }; + var findNode = function (node, direction, predicateFn, rootNode, shallow) { + var walker = new DomTreeWalker(node, rootNode); + var isCefOrCaretContainer = isContentEditableFalse$4(node) || isCaretContainerBlock$1(node); + if (isBackwards(direction)) { + if (isCefOrCaretContainer) { + node = skipCaretContainers(walker.prev, true); + if (predicateFn(node)) { + return node; + } + } + while (node = skipCaretContainers(walker.prev, shallow)) { + if (predicateFn(node)) { + return node; + } + } + } + if (isForwards(direction)) { + if (isCefOrCaretContainer) { + node = skipCaretContainers(walker.next, true); + if (predicateFn(node)) { + return node; + } + } + while (node = skipCaretContainers(walker.next, shallow)) { + if (predicateFn(node)) { + return node; + } + } + } + return null; + }; + var getParentBlock = function (node, rootNode) { + while (node && node !== rootNode) { + if (isBlockLike(node)) { + return node; + } + node = node.parentNode; + } + return null; + }; + var isInSameBlock = function (caretPosition1, caretPosition2, rootNode) { + return getParentBlock(caretPosition1.container(), rootNode) === getParentBlock(caretPosition2.container(), rootNode); + }; + var getChildNodeAtRelativeOffset = function (relativeOffset, caretPosition) { + if (!caretPosition) { + return null; + } + var container = caretPosition.container(); + var offset = caretPosition.offset(); + if (!isElement$5(container)) { + return null; + } + return container.childNodes[offset + relativeOffset]; + }; + var beforeAfter = function (before, node) { + var range = node.ownerDocument.createRange(); + if (before) { + range.setStartBefore(node); + range.setEndBefore(node); + } else { + range.setStartAfter(node); + range.setEndAfter(node); + } + return range; + }; + var isNodesInSameBlock = function (root, node1, node2) { + return getParentBlock(node1, root) === getParentBlock(node2, root); + }; + var lean = function (left, root, node) { + var sibling, siblingName; + if (left) { + siblingName = 'previousSibling'; + } else { + siblingName = 'nextSibling'; + } + while (node && node !== root) { + sibling = node[siblingName]; + if (isCaretContainer$2(sibling)) { + sibling = sibling[siblingName]; + } + if (isContentEditableFalse$4(sibling) || isMedia$2(sibling)) { + if (isNodesInSameBlock(root, sibling, node)) { + return sibling; + } + break; + } + if (isCaretCandidate$2(sibling)) { + break; + } + node = node.parentNode; + } + return null; + }; + var before$2 = curry(beforeAfter, true); + var after$1 = curry(beforeAfter, false); + var normalizeRange = function (direction, root, range) { + var node, container, location; + var leanLeft = curry(lean, true, root); + var leanRight = curry(lean, false, root); + container = range.startContainer; + var offset = range.startOffset; + if (isCaretContainerBlock(container)) { + if (!isElement$5(container)) { + container = container.parentNode; + } + location = container.getAttribute('data-mce-caret'); + if (location === 'before') { + node = container.nextSibling; + if (isFakeCaretTarget(node)) { + return before$2(node); + } + } + if (location === 'after') { + node = container.previousSibling; + if (isFakeCaretTarget(node)) { + return after$1(node); + } + } + } + if (!range.collapsed) { + return range; + } + if (isText$1(container)) { + if (isCaretContainer$2(container)) { + if (direction === 1) { + node = leanRight(container); + if (node) { + return before$2(node); + } + node = leanLeft(container); + if (node) { + return after$1(node); + } + } + if (direction === -1) { + node = leanLeft(container); + if (node) { + return after$1(node); + } + node = leanRight(container); + if (node) { + return before$2(node); + } + } + return range; + } + if (endsWithCaretContainer(container) && offset >= container.data.length - 1) { + if (direction === 1) { + node = leanRight(container); + if (node) { + return before$2(node); + } + } + return range; + } + if (startsWithCaretContainer(container) && offset <= 1) { + if (direction === -1) { + node = leanLeft(container); + if (node) { + return after$1(node); + } + } + return range; + } + if (offset === container.data.length) { + node = leanRight(container); + if (node) { + return before$2(node); + } + return range; + } + if (offset === 0) { + node = leanLeft(container); + if (node) { + return after$1(node); + } + return range; + } + } + return range; + }; + var getRelativeCefElm = function (forward, caretPosition) { + return Optional.from(getChildNodeAtRelativeOffset(forward ? 0 : -1, caretPosition)).filter(isContentEditableFalse$4); + }; + var getNormalizedRangeEndPoint = function (direction, root, range) { + var normalizedRange = normalizeRange(direction, root, range); + if (direction === -1) { + return CaretPosition.fromRangeStart(normalizedRange); + } + return CaretPosition.fromRangeEnd(normalizedRange); + }; + var getElementFromPosition = function (pos) { + return Optional.from(pos.getNode()).map(SugarElement.fromDom); + }; + var getElementFromPrevPosition = function (pos) { + return Optional.from(pos.getNode(true)).map(SugarElement.fromDom); + }; + var getVisualCaretPosition = function (walkFn, caretPosition) { + while (caretPosition = walkFn(caretPosition)) { + if (caretPosition.isVisible()) { + return caretPosition; + } + } + return caretPosition; + }; + var isMoveInsideSameBlock = function (from, to) { + var inSameBlock = isInSameBlock(from, to); + if (!inSameBlock && isBr(from.getNode())) { + return true; + } + return inSameBlock; + }; + + var HDirection; + (function (HDirection) { + HDirection[HDirection['Backwards'] = -1] = 'Backwards'; + HDirection[HDirection['Forwards'] = 1] = 'Forwards'; + }(HDirection || (HDirection = {}))); + var isContentEditableFalse$5 = isContentEditableFalse; + var isText$7 = isText$1; + var isElement$6 = isElement$1; + var isBr$4 = isBr; + var isCaretCandidate$3 = isCaretCandidate; + var isAtomic$1 = isAtomic; + var isEditableCaretCandidate$1 = isEditableCaretCandidate; + var getParents = function (node, root) { + var parents = []; + while (node && node !== root) { + parents.push(node); + node = node.parentNode; + } + return parents; + }; + var nodeAtIndex = function (container, offset) { + if (container.hasChildNodes() && offset < container.childNodes.length) { + return container.childNodes[offset]; + } + return null; + }; + var getCaretCandidatePosition = function (direction, node) { + if (isForwards(direction)) { + if (isCaretCandidate$3(node.previousSibling) && !isText$7(node.previousSibling)) { + return CaretPosition$1.before(node); + } + if (isText$7(node)) { + return CaretPosition$1(node, 0); + } + } + if (isBackwards(direction)) { + if (isCaretCandidate$3(node.nextSibling) && !isText$7(node.nextSibling)) { + return CaretPosition$1.after(node); + } + if (isText$7(node)) { + return CaretPosition$1(node, node.data.length); + } + } + if (isBackwards(direction)) { + if (isBr$4(node)) { + return CaretPosition$1.before(node); + } + return CaretPosition$1.after(node); + } + return CaretPosition$1.before(node); + }; + var moveForwardFromBr = function (root, nextNode) { + var nextSibling = nextNode.nextSibling; + if (nextSibling && isCaretCandidate$3(nextSibling)) { + if (isText$7(nextSibling)) { + return CaretPosition$1(nextSibling, 0); + } else { + return CaretPosition$1.before(nextSibling); + } + } else { + return findCaretPosition(HDirection.Forwards, CaretPosition$1.after(nextNode), root); + } + }; + var findCaretPosition = function (direction, startPos, root) { + var node, nextNode, innerNode; + var caretPosition; + if (!isElement$6(root) || !startPos) { + return null; + } + if (startPos.isEqual(CaretPosition$1.after(root)) && root.lastChild) { + caretPosition = CaretPosition$1.after(root.lastChild); + if (isBackwards(direction) && isCaretCandidate$3(root.lastChild) && isElement$6(root.lastChild)) { + return isBr$4(root.lastChild) ? CaretPosition$1.before(root.lastChild) : caretPosition; + } + } else { + caretPosition = startPos; + } + var container = caretPosition.container(); + var offset = caretPosition.offset(); + if (isText$7(container)) { + if (isBackwards(direction) && offset > 0) { + return CaretPosition$1(container, --offset); + } + if (isForwards(direction) && offset < container.length) { + return CaretPosition$1(container, ++offset); + } + node = container; + } else { + if (isBackwards(direction) && offset > 0) { + nextNode = nodeAtIndex(container, offset - 1); + if (isCaretCandidate$3(nextNode)) { + if (!isAtomic$1(nextNode)) { + innerNode = findNode(nextNode, direction, isEditableCaretCandidate$1, nextNode); + if (innerNode) { + if (isText$7(innerNode)) { + return CaretPosition$1(innerNode, innerNode.data.length); + } + return CaretPosition$1.after(innerNode); + } + } + if (isText$7(nextNode)) { + return CaretPosition$1(nextNode, nextNode.data.length); + } + return CaretPosition$1.before(nextNode); + } + } + if (isForwards(direction) && offset < container.childNodes.length) { + nextNode = nodeAtIndex(container, offset); + if (isCaretCandidate$3(nextNode)) { + if (isBr$4(nextNode)) { + return moveForwardFromBr(root, nextNode); + } + if (!isAtomic$1(nextNode)) { + innerNode = findNode(nextNode, direction, isEditableCaretCandidate$1, nextNode); + if (innerNode) { + if (isText$7(innerNode)) { + return CaretPosition$1(innerNode, 0); + } + return CaretPosition$1.before(innerNode); + } + } + if (isText$7(nextNode)) { + return CaretPosition$1(nextNode, 0); + } + return CaretPosition$1.after(nextNode); + } + } + node = nextNode ? nextNode : caretPosition.getNode(); + } + if (isForwards(direction) && caretPosition.isAtEnd() || isBackwards(direction) && caretPosition.isAtStart()) { + node = findNode(node, direction, always, root, true); + if (isEditableCaretCandidate$1(node, root)) { + return getCaretCandidatePosition(direction, node); + } + } + nextNode = findNode(node, direction, isEditableCaretCandidate$1, root); + var rootContentEditableFalseElm = last$1(filter(getParents(container, root), isContentEditableFalse$5)); + if (rootContentEditableFalseElm && (!nextNode || !rootContentEditableFalseElm.contains(nextNode))) { + if (isForwards(direction)) { + caretPosition = CaretPosition$1.after(rootContentEditableFalseElm); + } else { + caretPosition = CaretPosition$1.before(rootContentEditableFalseElm); + } + return caretPosition; + } + if (nextNode) { + return getCaretCandidatePosition(direction, nextNode); + } + return null; + }; + var CaretWalker = function (root) { + return { + next: function (caretPosition) { + return findCaretPosition(HDirection.Forwards, caretPosition, root); + }, + prev: function (caretPosition) { + return findCaretPosition(HDirection.Backwards, caretPosition, root); + } + }; + }; + + var walkToPositionIn = function (forward, root, start) { + var position = forward ? CaretPosition$1.before(start) : CaretPosition$1.after(start); + return fromPosition(forward, root, position); + }; + var afterElement = function (node) { + return isBr(node) ? CaretPosition$1.before(node) : CaretPosition$1.after(node); + }; + var isBeforeOrStart = function (position) { + if (CaretPosition$1.isTextPosition(position)) { + return position.offset() === 0; + } else { + return isCaretCandidate(position.getNode()); + } + }; + var isAfterOrEnd = function (position) { + if (CaretPosition$1.isTextPosition(position)) { + var container = position.container(); + return position.offset() === container.data.length; + } else { + return isCaretCandidate(position.getNode(true)); + } + }; + var isBeforeAfterSameElement = function (from, to) { + return !CaretPosition$1.isTextPosition(from) && !CaretPosition$1.isTextPosition(to) && from.getNode() === to.getNode(true); + }; + var isAtBr = function (position) { + return !CaretPosition$1.isTextPosition(position) && isBr(position.getNode()); + }; + var shouldSkipPosition = function (forward, from, to) { + if (forward) { + return !isBeforeAfterSameElement(from, to) && !isAtBr(from) && isAfterOrEnd(from) && isBeforeOrStart(to); + } else { + return !isBeforeAfterSameElement(to, from) && isBeforeOrStart(from) && isAfterOrEnd(to); + } + }; + var fromPosition = function (forward, root, pos) { + var walker = CaretWalker(root); + return Optional.from(forward ? walker.next(pos) : walker.prev(pos)); + }; + var navigate = function (forward, root, from) { + return fromPosition(forward, root, from).bind(function (to) { + if (isInSameBlock(from, to, root) && shouldSkipPosition(forward, from, to)) { + return fromPosition(forward, root, to); + } else { + return Optional.some(to); + } + }); + }; + var navigateIgnore = function (forward, root, from, ignoreFilter) { + return navigate(forward, root, from).bind(function (pos) { + return ignoreFilter(pos) ? navigateIgnore(forward, root, pos, ignoreFilter) : Optional.some(pos); + }); + }; + var positionIn = function (forward, element) { + var startNode = forward ? element.firstChild : element.lastChild; + if (isText$1(startNode)) { + return Optional.some(CaretPosition$1(startNode, forward ? 0 : startNode.data.length)); + } else if (startNode) { + if (isCaretCandidate(startNode)) { + return Optional.some(forward ? CaretPosition$1.before(startNode) : afterElement(startNode)); + } else { + return walkToPositionIn(forward, element, startNode); + } + } else { + return Optional.none(); + } + }; + var nextPosition = curry(fromPosition, true); + var prevPosition = curry(fromPosition, false); + var firstPositionIn = curry(positionIn, true); + var lastPositionIn = curry(positionIn, false); + + var CARET_ID = '_mce_caret'; + var isCaretNode = function (node) { + return isElement$1(node) && node.id === CARET_ID; + }; + var getParentCaretContainer = function (body, node) { + while (node && node !== body) { + if (node.id === CARET_ID) { + return node; + } + node = node.parentNode; + } + return null; + }; + + var isStringPathBookmark = function (bookmark) { + return typeof bookmark.start === 'string'; + }; + var isRangeBookmark = function (bookmark) { + return bookmark.hasOwnProperty('rng'); + }; + var isIdBookmark = function (bookmark) { + return bookmark.hasOwnProperty('id'); + }; + var isIndexBookmark = function (bookmark) { + return bookmark.hasOwnProperty('name'); + }; + var isPathBookmark = function (bookmark) { + return Tools.isArray(bookmark.start); + }; + + var addBogus = function (dom, node) { + if (isElement$1(node) && dom.isBlock(node) && !node.innerHTML && !Env.ie) { + node.innerHTML = '
                                      '; + } + return node; + }; + var resolveCaretPositionBookmark = function (dom, bookmark) { + var pos; + var rng = dom.createRng(); + pos = resolve$1(dom.getRoot(), bookmark.start); + rng.setStart(pos.container(), pos.offset()); + pos = resolve$1(dom.getRoot(), bookmark.end); + rng.setEnd(pos.container(), pos.offset()); + return rng; + }; + var insertZwsp = function (node, rng) { + var textNode = node.ownerDocument.createTextNode(ZWSP); + node.appendChild(textNode); + rng.setStart(textNode, 0); + rng.setEnd(textNode, 0); + }; + var isEmpty$1 = function (node) { + return node.hasChildNodes() === false; + }; + var tryFindRangePosition = function (node, rng) { + return lastPositionIn(node).fold(function () { + return false; + }, function (pos) { + rng.setStart(pos.container(), pos.offset()); + rng.setEnd(pos.container(), pos.offset()); + return true; + }); + }; + var padEmptyCaretContainer = function (root, node, rng) { + if (isEmpty$1(node) && getParentCaretContainer(root, node)) { + insertZwsp(node, rng); + return true; + } else { + return false; + } + }; + var setEndPoint = function (dom, start, bookmark, rng) { + var point = bookmark[start ? 'start' : 'end']; + var i, node, offset, children; + var root = dom.getRoot(); + if (point) { + offset = point[0]; + for (node = root, i = point.length - 1; i >= 1; i--) { + children = node.childNodes; + if (padEmptyCaretContainer(root, node, rng)) { + return true; + } + if (point[i] > children.length - 1) { + if (padEmptyCaretContainer(root, node, rng)) { + return true; + } + return tryFindRangePosition(node, rng); + } + node = children[point[i]]; + } + if (node.nodeType === 3) { + offset = Math.min(point[0], node.nodeValue.length); + } + if (node.nodeType === 1) { + offset = Math.min(point[0], node.childNodes.length); + } + if (start) { + rng.setStart(node, offset); + } else { + rng.setEnd(node, offset); + } + } + return true; + }; + var isValidTextNode = function (node) { + return isText$1(node) && node.data.length > 0; + }; + var restoreEndPoint = function (dom, suffix, bookmark) { + var marker = dom.get(bookmark.id + '_' + suffix), node, idx, next, prev; + var keep = bookmark.keep; + var container, offset; + if (marker) { + node = marker.parentNode; + if (suffix === 'start') { + if (!keep) { + idx = dom.nodeIndex(marker); + } else { + if (marker.hasChildNodes()) { + node = marker.firstChild; + idx = 1; + } else if (isValidTextNode(marker.nextSibling)) { + node = marker.nextSibling; + idx = 0; + } else if (isValidTextNode(marker.previousSibling)) { + node = marker.previousSibling; + idx = marker.previousSibling.data.length; + } else { + node = marker.parentNode; + idx = dom.nodeIndex(marker) + 1; + } + } + container = node; + offset = idx; + } else { + if (!keep) { + idx = dom.nodeIndex(marker); + } else { + if (marker.hasChildNodes()) { + node = marker.firstChild; + idx = 1; + } else if (isValidTextNode(marker.previousSibling)) { + node = marker.previousSibling; + idx = marker.previousSibling.data.length; + } else { + node = marker.parentNode; + idx = dom.nodeIndex(marker); + } + } + container = node; + offset = idx; + } + if (!keep) { + prev = marker.previousSibling; + next = marker.nextSibling; + Tools.each(Tools.grep(marker.childNodes), function (node) { + if (isText$1(node)) { + node.nodeValue = node.nodeValue.replace(/\uFEFF/g, ''); + } + }); + while (marker = dom.get(bookmark.id + '_' + suffix)) { + dom.remove(marker, true); + } + if (prev && next && prev.nodeType === next.nodeType && isText$1(prev) && !Env.opera) { + idx = prev.nodeValue.length; + prev.appendData(next.nodeValue); + dom.remove(next); + container = prev; + offset = idx; + } + } + return Optional.some(CaretPosition$1(container, offset)); + } else { + return Optional.none(); + } + }; + var resolvePaths = function (dom, bookmark) { + var rng = dom.createRng(); + if (setEndPoint(dom, true, bookmark, rng) && setEndPoint(dom, false, bookmark, rng)) { + return Optional.some(rng); + } else { + return Optional.none(); + } + }; + var resolveId = function (dom, bookmark) { + var startPos = restoreEndPoint(dom, 'start', bookmark); + var endPos = restoreEndPoint(dom, 'end', bookmark); + return lift2(startPos, endPos.or(startPos), function (spos, epos) { + var rng = dom.createRng(); + rng.setStart(addBogus(dom, spos.container()), spos.offset()); + rng.setEnd(addBogus(dom, epos.container()), epos.offset()); + return rng; + }); + }; + var resolveIndex$1 = function (dom, bookmark) { + return Optional.from(dom.select(bookmark.name)[bookmark.index]).map(function (elm) { + var rng = dom.createRng(); + rng.selectNode(elm); + return rng; + }); + }; + var resolve$2 = function (selection, bookmark) { + var dom = selection.dom; + if (bookmark) { + if (isPathBookmark(bookmark)) { + return resolvePaths(dom, bookmark); + } else if (isStringPathBookmark(bookmark)) { + return Optional.some(resolveCaretPositionBookmark(dom, bookmark)); + } else if (isIdBookmark(bookmark)) { + return resolveId(dom, bookmark); + } else if (isIndexBookmark(bookmark)) { + return resolveIndex$1(dom, bookmark); + } else if (isRangeBookmark(bookmark)) { + return Optional.some(bookmark.rng); + } + } + return Optional.none(); + }; + + var getBookmark$1 = function (selection, type, normalized) { + return getBookmark(selection, type, normalized); + }; + var moveToBookmark = function (selection, bookmark) { + resolve$2(selection, bookmark).each(function (rng) { + selection.setRng(rng); + }); + }; + var isBookmarkNode$1 = function (node) { + return isElement$1(node) && node.tagName === 'SPAN' && node.getAttribute('data-mce-type') === 'bookmark'; + }; + + var is$2 = function (expected) { + return function (actual) { + return expected === actual; + }; + }; + var isNbsp = is$2(nbsp); + var isWhiteSpace$1 = function (chr) { + return chr !== '' && ' \f\n\r\t\x0B'.indexOf(chr) !== -1; + }; + var isContent$1 = function (chr) { + return !isWhiteSpace$1(chr) && !isNbsp(chr); + }; + + var isNode = function (node) { + return !!node.nodeType; + }; + var isInlineBlock = function (node) { + return node && /^(IMG)$/.test(node.nodeName); + }; + var moveStart = function (dom, selection, rng) { + var offset = rng.startOffset; + var container = rng.startContainer, walker, node, nodes; + if (rng.startContainer === rng.endContainer) { + if (isInlineBlock(rng.startContainer.childNodes[rng.startOffset])) { + return; + } + } + if (container.nodeType === 1) { + nodes = container.childNodes; + if (offset < nodes.length) { + container = nodes[offset]; + walker = new DomTreeWalker(container, dom.getParent(container, dom.isBlock)); + } else { + container = nodes[nodes.length - 1]; + walker = new DomTreeWalker(container, dom.getParent(container, dom.isBlock)); + walker.next(true); + } + for (node = walker.current(); node; node = walker.next()) { + if (node.nodeType === 3 && !isWhiteSpaceNode(node)) { + rng.setStart(node, 0); + selection.setRng(rng); + return; + } + } + } + }; + var getNonWhiteSpaceSibling = function (node, next, inc) { + if (node) { + var nextName = next ? 'nextSibling' : 'previousSibling'; + for (node = inc ? node : node[nextName]; node; node = node[nextName]) { + if (node.nodeType === 1 || !isWhiteSpaceNode(node)) { + return node; + } + } + } + }; + var isTextBlock$1 = function (editor, name) { + if (isNode(name)) { + name = name.nodeName; + } + return !!editor.schema.getTextBlockElements()[name.toLowerCase()]; + }; + var isValid = function (ed, parent, child) { + return ed.schema.isValidChild(parent, child); + }; + var isWhiteSpaceNode = function (node, allowSpaces) { + if (allowSpaces === void 0) { + allowSpaces = false; + } + if (isNonNullable(node) && isText$1(node)) { + var data = allowSpaces ? node.data.replace(/ /g, '\xA0') : node.data; + return isWhitespaceText(data); + } else { + return false; + } + }; + var isEmptyTextNode = function (node) { + return isNonNullable(node) && isText$1(node) && node.length === 0; + }; + var replaceVars = function (value, vars) { + if (typeof value !== 'string') { + value = value(vars); + } else if (vars) { + value = value.replace(/%(\w+)/g, function (str, name) { + return vars[name] || str; + }); + } + return value; + }; + var isEq = function (str1, str2) { + str1 = str1 || ''; + str2 = str2 || ''; + str1 = '' + (str1.nodeName || str1); + str2 = '' + (str2.nodeName || str2); + return str1.toLowerCase() === str2.toLowerCase(); + }; + var normalizeStyleValue = function (dom, value, name) { + if (name === 'color' || name === 'backgroundColor') { + value = dom.toHex(value); + } + if (name === 'fontWeight' && value === 700) { + value = 'bold'; + } + if (name === 'fontFamily') { + value = value.replace(/[\'\"]/g, '').replace(/,\s+/g, ','); + } + return '' + value; + }; + var getStyle = function (dom, node, name) { + return normalizeStyleValue(dom, dom.getStyle(node, name), name); + }; + var getTextDecoration = function (dom, node) { + var decoration; + dom.getParent(node, function (n) { + decoration = dom.getStyle(n, 'text-decoration'); + return decoration && decoration !== 'none'; + }); + return decoration; + }; + var getParents$1 = function (dom, node, selector) { + return dom.getParents(node, selector, dom.getRoot()); + }; + var isVariableFormatName = function (editor, formatName) { + var hasVariableValues = function (format) { + var isVariableValue = function (val) { + return val.length > 1 && val.charAt(0) === '%'; + }; + return exists([ + 'styles', + 'attributes' + ], function (key) { + return get$1(format, key).exists(function (field) { + var fieldValues = isArray(field) ? field : values(field); + return exists(fieldValues, isVariableValue); + }); + }); + }; + return exists(editor.formatter.get(formatName), hasVariableValues); + }; + var areSimilarFormats = function (editor, formatName, otherFormatName) { + var validKeys = [ + 'inline', + 'block', + 'selector', + 'attributes', + 'styles', + 'classes' + ]; + var filterObj = function (format) { + return filter$1(format, function (_, key) { + return exists(validKeys, function (validKey) { + return validKey === key; + }); + }); + }; + return exists(editor.formatter.get(formatName), function (fmt1) { + var filteredFmt1 = filterObj(fmt1); + return exists(editor.formatter.get(otherFormatName), function (fmt2) { + var filteredFmt2 = filterObj(fmt2); + return equal(filteredFmt1, filteredFmt2); + }); + }); + }; + var isBlockFormat = function (format) { + return hasNonNullableKey(format, 'block'); + }; + var isSelectorFormat = function (format) { + return hasNonNullableKey(format, 'selector'); + }; + var isInlineFormat = function (format) { + return hasNonNullableKey(format, 'inline'); + }; + + var isBookmarkNode$2 = isBookmarkNode$1; + var getParents$2 = getParents$1; + var isWhiteSpaceNode$1 = isWhiteSpaceNode; + var isTextBlock$2 = isTextBlock$1; + var isBogusBr = function (node) { + return isBr(node) && node.getAttribute('data-mce-bogus') && !node.nextSibling; + }; + var findParentContentEditable = function (dom, node) { + var parent = node; + while (parent) { + if (isElement$1(parent) && dom.getContentEditable(parent)) { + return dom.getContentEditable(parent) === 'false' ? parent : node; + } + parent = parent.parentNode; + } + return node; + }; + var walkText = function (start, node, offset, predicate) { + var str = node.data; + for (var i = offset; start ? i >= 0 : i < str.length; start ? i-- : i++) { + if (predicate(str.charAt(i))) { + return start ? i + 1 : i; + } + } + return -1; + }; + var findSpace = function (start, node, offset) { + return walkText(start, node, offset, function (c) { + return isNbsp(c) || isWhiteSpace$1(c); + }); + }; + var findContent = function (start, node, offset) { + return walkText(start, node, offset, isContent$1); + }; + var findWordEndPoint = function (dom, body, container, offset, start, includeTrailingSpaces) { + var lastTextNode; + var rootNode = dom.getParent(container, dom.isBlock) || body; + var walk = function (container, offset, pred) { + var textSeeker = TextSeeker(dom); + var walker = start ? textSeeker.backwards : textSeeker.forwards; + return Optional.from(walker(container, offset, function (text, textOffset) { + if (isBookmarkNode$2(text.parentNode)) { + return -1; + } else { + lastTextNode = text; + return pred(start, text, textOffset); + } + }, rootNode)); + }; + var spaceResult = walk(container, offset, findSpace); + return spaceResult.bind(function (result) { + return includeTrailingSpaces ? walk(result.container, result.offset + (start ? -1 : 0), findContent) : Optional.some(result); + }).orThunk(function () { + return lastTextNode ? Optional.some({ + container: lastTextNode, + offset: start ? 0 : lastTextNode.length + }) : Optional.none(); + }); + }; + var findSelectorEndPoint = function (dom, format, rng, container, siblingName) { + if (isText$1(container) && container.nodeValue.length === 0 && container[siblingName]) { + container = container[siblingName]; + } + var parents = getParents$2(dom, container); + for (var i = 0; i < parents.length; i++) { + for (var y = 0; y < format.length; y++) { + var curFormat = format[y]; + if ('collapsed' in curFormat && curFormat.collapsed !== rng.collapsed) { + continue; + } + if (dom.is(parents[i], curFormat.selector)) { + return parents[i]; + } + } + } + return container; + }; + var findBlockEndPoint = function (editor, format, container, siblingName) { + var node; + var dom = editor.dom; + var root = dom.getRoot(); + if (!format[0].wrapper) { + node = dom.getParent(container, format[0].block, root); + } + if (!node) { + var scopeRoot = dom.getParent(container, 'LI,TD,TH'); + node = dom.getParent(isText$1(container) ? container.parentNode : container, function (node) { + return node !== root && isTextBlock$2(editor, node); + }, scopeRoot); + } + if (node && format[0].wrapper) { + node = getParents$2(dom, node, 'ul,ol').reverse()[0] || node; + } + if (!node) { + node = container; + while (node[siblingName] && !dom.isBlock(node[siblingName])) { + node = node[siblingName]; + if (isEq(node, 'br')) { + break; + } + } + } + return node || container; + }; + var isAtBlockBoundary = function (dom, root, container, siblingName) { + var parent = container.parentNode; + if (isNonNullable(container[siblingName])) { + return false; + } else if (parent === root || isNullable(parent) || dom.isBlock(parent)) { + return true; + } else { + return isAtBlockBoundary(dom, root, parent, siblingName); + } + }; + var findParentContainer = function (dom, format, container, offset, start) { + var parent = container; + var sibling; + var siblingName = start ? 'previousSibling' : 'nextSibling'; + var root = dom.getRoot(); + if (isText$1(container) && !isWhiteSpaceNode$1(container)) { + if (start ? offset > 0 : offset < container.data.length) { + return container; + } + } + while (true) { + if (!format[0].block_expand && dom.isBlock(parent)) { + return parent; + } + for (sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) { + var allowSpaces = isText$1(sibling) && !isAtBlockBoundary(dom, root, sibling, siblingName); + if (!isBookmarkNode$2(sibling) && !isBogusBr(sibling) && !isWhiteSpaceNode$1(sibling, allowSpaces)) { + return parent; + } + } + if (parent === root || parent.parentNode === root) { + container = parent; + break; + } + parent = parent.parentNode; + } + return container; + }; + var isSelfOrParentBookmark = function (container) { + return isBookmarkNode$2(container.parentNode) || isBookmarkNode$2(container); + }; + var expandRng = function (editor, rng, format, includeTrailingSpace) { + if (includeTrailingSpace === void 0) { + includeTrailingSpace = false; + } + var startContainer = rng.startContainer, startOffset = rng.startOffset, endContainer = rng.endContainer, endOffset = rng.endOffset; + var dom = editor.dom; + if (isElement$1(startContainer) && startContainer.hasChildNodes()) { + startContainer = getNode(startContainer, startOffset); + if (isText$1(startContainer)) { + startOffset = 0; + } + } + if (isElement$1(endContainer) && endContainer.hasChildNodes()) { + endContainer = getNode(endContainer, rng.collapsed ? endOffset : endOffset - 1); + if (isText$1(endContainer)) { + endOffset = endContainer.nodeValue.length; + } + } + startContainer = findParentContentEditable(dom, startContainer); + endContainer = findParentContentEditable(dom, endContainer); + if (isSelfOrParentBookmark(startContainer)) { + startContainer = isBookmarkNode$2(startContainer) ? startContainer : startContainer.parentNode; + if (rng.collapsed) { + startContainer = startContainer.previousSibling || startContainer; + } else { + startContainer = startContainer.nextSibling || startContainer; + } + if (isText$1(startContainer)) { + startOffset = rng.collapsed ? startContainer.length : 0; + } + } + if (isSelfOrParentBookmark(endContainer)) { + endContainer = isBookmarkNode$2(endContainer) ? endContainer : endContainer.parentNode; + if (rng.collapsed) { + endContainer = endContainer.nextSibling || endContainer; + } else { + endContainer = endContainer.previousSibling || endContainer; + } + if (isText$1(endContainer)) { + endOffset = rng.collapsed ? 0 : endContainer.length; + } + } + if (rng.collapsed) { + var startPoint = findWordEndPoint(dom, editor.getBody(), startContainer, startOffset, true, includeTrailingSpace); + startPoint.each(function (_a) { + var container = _a.container, offset = _a.offset; + startContainer = container; + startOffset = offset; + }); + var endPoint = findWordEndPoint(dom, editor.getBody(), endContainer, endOffset, false, includeTrailingSpace); + endPoint.each(function (_a) { + var container = _a.container, offset = _a.offset; + endContainer = container; + endOffset = offset; + }); + } + if (format[0].inline || format[0].block_expand) { + if (!format[0].inline || (!isText$1(startContainer) || startOffset === 0)) { + startContainer = findParentContainer(dom, format, startContainer, startOffset, true); + } + if (!format[0].inline || (!isText$1(endContainer) || endOffset === endContainer.nodeValue.length)) { + endContainer = findParentContainer(dom, format, endContainer, endOffset, false); + } + } + if (format[0].selector && format[0].expand !== false && !format[0].inline) { + startContainer = findSelectorEndPoint(dom, format, rng, startContainer, 'previousSibling'); + endContainer = findSelectorEndPoint(dom, format, rng, endContainer, 'nextSibling'); + } + if (format[0].block || format[0].selector) { + startContainer = findBlockEndPoint(editor, format, startContainer, 'previousSibling'); + endContainer = findBlockEndPoint(editor, format, endContainer, 'nextSibling'); + if (format[0].block) { + if (!dom.isBlock(startContainer)) { + startContainer = findParentContainer(dom, format, startContainer, startOffset, true); + } + if (!dom.isBlock(endContainer)) { + endContainer = findParentContainer(dom, format, endContainer, endOffset, false); + } + } + } + if (isElement$1(startContainer)) { + startOffset = dom.nodeIndex(startContainer); + startContainer = startContainer.parentNode; + } + if (isElement$1(endContainer)) { + endOffset = dom.nodeIndex(endContainer) + 1; + endContainer = endContainer.parentNode; + } + return { + startContainer: startContainer, + startOffset: startOffset, + endContainer: endContainer, + endOffset: endOffset + }; + }; + + var clampToExistingChildren = function (container, index) { + var childNodes = container.childNodes; + if (index >= childNodes.length) { + index = childNodes.length - 1; + } else if (index < 0) { + index = 0; + } + return childNodes[index] || container; + }; + var getEndChild = function (container, index) { + return clampToExistingChildren(container, index - 1); + }; + var walk$1 = function (dom, rng, callback) { + var startContainer = rng.startContainer; + var startOffset = rng.startOffset; + var endContainer = rng.endContainer; + var endOffset = rng.endOffset; + var exclude = function (nodes) { + var node; + node = nodes[0]; + if (node.nodeType === 3 && node === startContainer && startOffset >= node.nodeValue.length) { + nodes.splice(0, 1); + } + node = nodes[nodes.length - 1]; + if (endOffset === 0 && nodes.length > 0 && node === endContainer && node.nodeType === 3) { + nodes.splice(nodes.length - 1, 1); + } + return nodes; + }; + var collectSiblings = function (node, name, endNode) { + var siblings = []; + for (; node && node !== endNode; node = node[name]) { + siblings.push(node); + } + return siblings; + }; + var findEndPoint = function (node, root) { + do { + if (node.parentNode === root) { + return node; + } + node = node.parentNode; + } while (node); + }; + var walkBoundary = function (startNode, endNode, next) { + var siblingName = next ? 'nextSibling' : 'previousSibling'; + for (var node = startNode, parent_1 = node.parentNode; node && node !== endNode; node = parent_1) { + parent_1 = node.parentNode; + var siblings_1 = collectSiblings(node === startNode ? node : node[siblingName], siblingName); + if (siblings_1.length) { + if (!next) { + siblings_1.reverse(); + } + callback(exclude(siblings_1)); + } + } + }; + if (startContainer.nodeType === 1 && startContainer.hasChildNodes()) { + startContainer = clampToExistingChildren(startContainer, startOffset); + } + if (endContainer.nodeType === 1 && endContainer.hasChildNodes()) { + endContainer = getEndChild(endContainer, endOffset); + } + if (startContainer === endContainer) { + return callback(exclude([startContainer])); + } + var ancestor = dom.findCommonAncestor(startContainer, endContainer); + for (var node = startContainer; node; node = node.parentNode) { + if (node === endContainer) { + return walkBoundary(startContainer, ancestor, true); + } + if (node === ancestor) { + break; + } + } + for (var node = endContainer; node; node = node.parentNode) { + if (node === startContainer) { + return walkBoundary(endContainer, ancestor); + } + if (node === ancestor) { + break; + } + } + var startPoint = findEndPoint(startContainer, ancestor) || startContainer; + var endPoint = findEndPoint(endContainer, ancestor) || endContainer; + walkBoundary(startContainer, startPoint, true); + var siblings = collectSiblings(startPoint === startContainer ? startPoint : startPoint.nextSibling, 'nextSibling', endPoint === endContainer ? endPoint.nextSibling : endPoint); + if (siblings.length) { + callback(exclude(siblings)); + } + walkBoundary(endContainer, endPoint); + }; + + var getRanges = function (selection) { + var ranges = []; + if (selection) { + for (var i = 0; i < selection.rangeCount; i++) { + ranges.push(selection.getRangeAt(i)); + } + } + return ranges; + }; + var getSelectedNodes = function (ranges) { + return bind(ranges, function (range) { + var node = getSelectedNode(range); + return node ? [SugarElement.fromDom(node)] : []; + }); + }; + var hasMultipleRanges = function (selection) { + return getRanges(selection).length > 1; + }; + + var getCellsFromRanges = function (ranges) { + return filter(getSelectedNodes(ranges), isTableCell$1); + }; + var getCellsFromElement = function (elm) { + return descendants$1(elm, 'td[data-mce-selected],th[data-mce-selected]'); + }; + var getCellsFromElementOrRanges = function (ranges, element) { + var selectedCells = getCellsFromElement(element); + return selectedCells.length > 0 ? selectedCells : getCellsFromRanges(ranges); + }; + var getCellsFromEditor = function (editor) { + return getCellsFromElementOrRanges(getRanges(editor.selection.getSel()), SugarElement.fromDom(editor.getBody())); + }; + + var getStartNode = function (rng) { + var sc = rng.startContainer, so = rng.startOffset; + if (isText$1(sc)) { + return so === 0 ? Optional.some(SugarElement.fromDom(sc)) : Optional.none(); + } else { + return Optional.from(sc.childNodes[so]).map(SugarElement.fromDom); + } + }; + var getEndNode = function (rng) { + var ec = rng.endContainer, eo = rng.endOffset; + if (isText$1(ec)) { + return eo === ec.data.length ? Optional.some(SugarElement.fromDom(ec)) : Optional.none(); + } else { + return Optional.from(ec.childNodes[eo - 1]).map(SugarElement.fromDom); + } + }; + var getFirstChildren = function (node) { + return firstChild(node).fold(constant([node]), function (child) { + return [node].concat(getFirstChildren(child)); + }); + }; + var getLastChildren = function (node) { + return lastChild(node).fold(constant([node]), function (child) { + if (name(child) === 'br') { + return prevSibling(child).map(function (sibling) { + return [node].concat(getLastChildren(sibling)); + }).getOr([]); + } else { + return [node].concat(getLastChildren(child)); + } + }); + }; + var hasAllContentsSelected = function (elm, rng) { + return lift2(getStartNode(rng), getEndNode(rng), function (startNode, endNode) { + var start = find(getFirstChildren(elm), curry(eq$2, startNode)); + var end = find(getLastChildren(elm), curry(eq$2, endNode)); + return start.isSome() && end.isSome(); + }).getOr(false); + }; + var moveEndPoint$1 = function (dom, rng, node, start) { + var root = node, walker = new DomTreeWalker(node, root); + var moveCaretBeforeOnEnterElementsMap = filter$1(dom.schema.getMoveCaretBeforeOnEnterElements(), function (_, name) { + return !contains([ + 'td', + 'th', + 'table' + ], name.toLowerCase()); + }); + do { + if (isText$1(node) && Tools.trim(node.nodeValue).length !== 0) { + if (start) { + rng.setStart(node, 0); + } else { + rng.setEnd(node, node.nodeValue.length); + } + return; + } + if (moveCaretBeforeOnEnterElementsMap[node.nodeName]) { + if (start) { + rng.setStartBefore(node); + } else { + if (node.nodeName === 'BR') { + rng.setEndBefore(node); + } else { + rng.setEndAfter(node); + } + } + return; + } + } while (node = start ? walker.next() : walker.prev()); + if (root.nodeName === 'BODY') { + if (start) { + rng.setStart(root, 0); + } else { + rng.setEnd(root, root.childNodes.length); + } + } + }; + var hasAnyRanges = function (editor) { + var sel = editor.selection.getSel(); + return sel && sel.rangeCount > 0; + }; + var runOnRanges = function (editor, executor) { + var fakeSelectionNodes = getCellsFromEditor(editor); + if (fakeSelectionNodes.length > 0) { + each(fakeSelectionNodes, function (elem) { + var node = elem.dom; + var fakeNodeRng = editor.dom.createRng(); + fakeNodeRng.setStartBefore(node); + fakeNodeRng.setEndAfter(node); + executor(fakeNodeRng, true); + }); + } else { + executor(editor.selection.getRng(), false); + } + }; + var preserve = function (selection, fillBookmark, executor) { + var bookmark = getPersistentBookmark(selection, fillBookmark); + executor(bookmark); + selection.moveToBookmark(bookmark); + }; + + function NodeValue (is, name) { + var get = function (element) { + if (!is(element)) { + throw new Error('Can only get ' + name + ' value of a ' + name + ' node'); + } + return getOption(element).getOr(''); + }; + var getOption = function (element) { + return is(element) ? Optional.from(element.dom.nodeValue) : Optional.none(); + }; + var set = function (element, value) { + if (!is(element)) { + throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node'); + } + element.dom.nodeValue = value; + }; + return { + get: get, + getOption: getOption, + set: set + }; + } + + var api = NodeValue(isText, 'text'); + var get$8 = function (element) { + return api.get(element); + }; + + var isZeroWidth = function (elem) { + return isText(elem) && get$8(elem) === ZWSP; + }; + var context = function (editor, elem, wrapName, nodeName) { + return parent(elem).fold(function () { + return 'skipping'; + }, function (parent) { + if (nodeName === 'br' || isZeroWidth(elem)) { + return 'valid'; + } else if (isAnnotation(elem)) { + return 'existing'; + } else if (isCaretNode(elem.dom)) { + return 'caret'; + } else if (!isValid(editor, wrapName, nodeName) || !isValid(editor, name(parent), wrapName)) { + return 'invalid-child'; + } else { + return 'valid'; + } + }); + }; + + var applyWordGrab = function (editor, rng) { + var r = expandRng(editor, rng, [{ inline: true }]); + rng.setStart(r.startContainer, r.startOffset); + rng.setEnd(r.endContainer, r.endOffset); + editor.selection.setRng(rng); + }; + var makeAnnotation = function (eDoc, _a, annotationName, decorate) { + var _b = _a.uid, uid = _b === void 0 ? generate$1('mce-annotation') : _b, data = __rest(_a, ['uid']); + var master = SugarElement.fromTag('span', eDoc); + add$3(master, annotation()); + set(master, '' + dataAnnotationId(), uid); + set(master, '' + dataAnnotation(), annotationName); + var _c = decorate(uid, data), _d = _c.attributes, attributes = _d === void 0 ? {} : _d, _e = _c.classes, classes = _e === void 0 ? [] : _e; + setAll(master, attributes); + add$4(master, classes); + return master; + }; + var annotate = function (editor, rng, annotationName, decorate, data) { + var newWrappers = []; + var master = makeAnnotation(editor.getDoc(), data, annotationName, decorate); + var wrapper = Cell(Optional.none()); + var finishWrapper = function () { + wrapper.set(Optional.none()); + }; + var getOrOpenWrapper = function () { + return wrapper.get().getOrThunk(function () { + var nu = shallow(master); + newWrappers.push(nu); + wrapper.set(Optional.some(nu)); + return nu; + }); + }; + var processElements = function (elems) { + each(elems, processElement); + }; + var processElement = function (elem) { + var ctx = context(editor, elem, 'span', name(elem)); + switch (ctx) { + case 'invalid-child': { + finishWrapper(); + var children$1 = children(elem); + processElements(children$1); + finishWrapper(); + break; + } + case 'valid': { + var w = getOrOpenWrapper(); + wrap(elem, w); + break; + } + } + }; + var processNodes = function (nodes) { + var elems = map(nodes, SugarElement.fromDom); + processElements(elems); + }; + walk$1(editor.dom, rng, function (nodes) { + finishWrapper(); + processNodes(nodes); + }); + return newWrappers; + }; + var annotateWithBookmark = function (editor, name, settings, data) { + editor.undoManager.transact(function () { + var selection = editor.selection; + var initialRng = selection.getRng(); + var hasFakeSelection = getCellsFromEditor(editor).length > 0; + if (initialRng.collapsed && !hasFakeSelection) { + applyWordGrab(editor, initialRng); + } + if (selection.getRng().collapsed && !hasFakeSelection) { + var wrapper = makeAnnotation(editor.getDoc(), data, name, settings.decorate); + set$1(wrapper, nbsp); + selection.getRng().insertNode(wrapper.dom); + selection.select(wrapper.dom); + } else { + preserve(selection, false, function () { + runOnRanges(editor, function (selectionRng) { + annotate(editor, selectionRng, name, settings.decorate, data); + }); + }); + } + }); + }; + + var Annotator = function (editor) { + var registry = create$2(); + setup$1(editor, registry); + var changes = setup(editor); + return { + register: function (name, settings) { + registry.register(name, settings); + }, + annotate: function (name, data) { + registry.lookup(name).each(function (settings) { + annotateWithBookmark(editor, name, settings, data); + }); + }, + annotationChanged: function (name, callback) { + changes.addListener(name, callback); + }, + remove: function (name) { + identify(editor, Optional.some(name)).each(function (_a) { + var elements = _a.elements; + each(elements, unwrap); + }); + }, + getAll: function (name) { + var directory = findAll(editor, name); + return map$1(directory, function (elems) { + return map(elems, function (elem) { + return elem.dom; + }); + }); + } + }; + }; + + function BookmarkManager(selection) { + return { + getBookmark: curry(getBookmark$1, selection), + moveToBookmark: curry(moveToBookmark, selection) + }; + } + (function (BookmarkManager) { + BookmarkManager.isBookmarkNode = isBookmarkNode$1; + }(BookmarkManager || (BookmarkManager = {}))); + var BookmarkManager$1 = BookmarkManager; + + var getContentEditableRoot = function (root, node) { + while (node && node !== root) { + if (isContentEditableTrue(node) || isContentEditableFalse(node)) { + return node; + } + node = node.parentNode; + } + return null; + }; + + var isXYWithinRange = function (clientX, clientY, range) { + if (range.collapsed) { + return false; + } + if (Env.browser.isIE() && range.startOffset === range.endOffset - 1 && range.startContainer === range.endContainer) { + var elm = range.startContainer.childNodes[range.startOffset]; + if (isElement$1(elm)) { + return exists(elm.getClientRects(), function (rect) { + return containsXY(rect, clientX, clientY); + }); + } + } + return exists(range.getClientRects(), function (rect) { + return containsXY(rect, clientX, clientY); + }); + }; + + var firePreProcess = function (editor, args) { + return editor.fire('PreProcess', args); + }; + var firePostProcess = function (editor, args) { + return editor.fire('PostProcess', args); + }; + var fireRemove = function (editor) { + return editor.fire('remove'); + }; + var fireDetach = function (editor) { + return editor.fire('detach'); + }; + var fireSwitchMode = function (editor, mode) { + return editor.fire('SwitchMode', { mode: mode }); + }; + var fireObjectResizeStart = function (editor, target, width, height, origin) { + editor.fire('ObjectResizeStart', { + target: target, + width: width, + height: height, + origin: origin + }); + }; + var fireObjectResized = function (editor, target, width, height, origin) { + editor.fire('ObjectResized', { + target: target, + width: width, + height: height, + origin: origin + }); + }; + var firePreInit = function (editor) { + return editor.fire('PreInit'); + }; + var firePostRender = function (editor) { + return editor.fire('PostRender'); + }; + var fireInit = function (editor) { + return editor.fire('Init'); + }; + var firePlaceholderToggle = function (editor, state) { + return editor.fire('PlaceholderToggle', { state: state }); + }; + var fireError = function (editor, errorType, error) { + return editor.fire(errorType, error); + }; + + var VK = { + BACKSPACE: 8, + DELETE: 46, + DOWN: 40, + ENTER: 13, + LEFT: 37, + RIGHT: 39, + SPACEBAR: 32, + TAB: 9, + UP: 38, + END: 35, + HOME: 36, + modifierPressed: function (e) { + return e.shiftKey || e.ctrlKey || e.altKey || this.metaKeyPressed(e); + }, + metaKeyPressed: function (e) { + return Env.mac ? e.metaKey : e.ctrlKey && !e.altKey; + } + }; + + var isContentEditableFalse$6 = isContentEditableFalse; + var ControlSelection = function (selection, editor) { + var dom = editor.dom, each = Tools.each; + var selectedElm, selectedElmGhost, resizeHelper, selectedHandle; + var startX, startY, selectedElmX, selectedElmY, startW, startH, ratio, resizeStarted; + var width, height; + var editableDoc = editor.getDoc(), rootDocument = document; + var abs = Math.abs, round = Math.round, rootElement = editor.getBody(); + var startScrollWidth, startScrollHeight; + var resizeHandles = { + nw: [ + 0, + 0, + -1, + -1 + ], + ne: [ + 1, + 0, + 1, + -1 + ], + se: [ + 1, + 1, + 1, + 1 + ], + sw: [ + 0, + 1, + -1, + 1 + ] + }; + var isImage = function (elm) { + return elm && (elm.nodeName === 'IMG' || editor.dom.is(elm, 'figure.image')); + }; + var isEventOnImageOutsideRange = function (evt, range) { + if (evt.type === 'longpress' || evt.type.indexOf('touch') === 0) { + var touch = evt.touches[0]; + return isImage(evt.target) && !isXYWithinRange(touch.clientX, touch.clientY, range); + } else { + return isImage(evt.target) && !isXYWithinRange(evt.clientX, evt.clientY, range); + } + }; + var contextMenuSelectImage = function (evt) { + var target = evt.target; + if (isEventOnImageOutsideRange(evt, editor.selection.getRng()) && !evt.isDefaultPrevented()) { + editor.selection.select(target); + } + }; + var getResizeTarget = function (elm) { + return editor.dom.is(elm, 'figure.image') ? elm.querySelector('img') : elm; + }; + var isResizable = function (elm) { + var selector = getObjectResizing(editor); + if (!selector) { + return false; + } + if (elm.getAttribute('data-mce-resize') === 'false') { + return false; + } + if (elm === editor.getBody()) { + return false; + } + return is$1(SugarElement.fromDom(elm), selector); + }; + var setGhostElmSize = function (ghostElm, width, height) { + dom.setStyles(getResizeTarget(ghostElm), { + width: width, + height: height + }); + }; + var resizeGhostElement = function (e) { + var deltaX, deltaY, proportional; + var resizeHelperX, resizeHelperY; + deltaX = e.screenX - startX; + deltaY = e.screenY - startY; + width = deltaX * selectedHandle[2] + startW; + height = deltaY * selectedHandle[3] + startH; + width = width < 5 ? 5 : width; + height = height < 5 ? 5 : height; + if (isImage(selectedElm) && getResizeImgProportional(editor) !== false) { + proportional = !VK.modifierPressed(e); + } else { + proportional = VK.modifierPressed(e); + } + if (proportional) { + if (abs(deltaX) > abs(deltaY)) { + height = round(width * ratio); + width = round(height / ratio); + } else { + width = round(height / ratio); + height = round(width * ratio); + } + } + setGhostElmSize(selectedElmGhost, width, height); + resizeHelperX = selectedHandle.startPos.x + deltaX; + resizeHelperY = selectedHandle.startPos.y + deltaY; + resizeHelperX = resizeHelperX > 0 ? resizeHelperX : 0; + resizeHelperY = resizeHelperY > 0 ? resizeHelperY : 0; + dom.setStyles(resizeHelper, { + left: resizeHelperX, + top: resizeHelperY, + display: 'block' + }); + resizeHelper.innerHTML = width + ' × ' + height; + if (selectedHandle[2] < 0 && selectedElmGhost.clientWidth <= width) { + dom.setStyle(selectedElmGhost, 'left', selectedElmX + (startW - width)); + } + if (selectedHandle[3] < 0 && selectedElmGhost.clientHeight <= height) { + dom.setStyle(selectedElmGhost, 'top', selectedElmY + (startH - height)); + } + deltaX = rootElement.scrollWidth - startScrollWidth; + deltaY = rootElement.scrollHeight - startScrollHeight; + if (deltaX + deltaY !== 0) { + dom.setStyles(resizeHelper, { + left: resizeHelperX - deltaX, + top: resizeHelperY - deltaY + }); + } + if (!resizeStarted) { + fireObjectResizeStart(editor, selectedElm, startW, startH, 'corner-' + selectedHandle.name); + resizeStarted = true; + } + }; + var endGhostResize = function () { + var wasResizeStarted = resizeStarted; + resizeStarted = false; + var setSizeProp = function (name, value) { + if (value) { + if (selectedElm.style[name] || !editor.schema.isValid(selectedElm.nodeName.toLowerCase(), name)) { + dom.setStyle(getResizeTarget(selectedElm), name, value); + } else { + dom.setAttrib(getResizeTarget(selectedElm), name, '' + value); + } + } + }; + if (wasResizeStarted) { + setSizeProp('width', width); + setSizeProp('height', height); + } + dom.unbind(editableDoc, 'mousemove', resizeGhostElement); + dom.unbind(editableDoc, 'mouseup', endGhostResize); + if (rootDocument !== editableDoc) { + dom.unbind(rootDocument, 'mousemove', resizeGhostElement); + dom.unbind(rootDocument, 'mouseup', endGhostResize); + } + dom.remove(selectedElmGhost); + dom.remove(resizeHelper); + showResizeRect(selectedElm); + if (wasResizeStarted) { + fireObjectResized(editor, selectedElm, width, height, 'corner-' + selectedHandle.name); + dom.setAttrib(selectedElm, 'style', dom.getAttrib(selectedElm, 'style')); + } + editor.nodeChanged(); + }; + var showResizeRect = function (targetElm) { + hideResizeRect(); + unbindResizeHandleEvents(); + var position = dom.getPos(targetElm, rootElement); + var selectedElmX = position.x; + var selectedElmY = position.y; + var rect = targetElm.getBoundingClientRect(); + var targetWidth = rect.width || rect.right - rect.left; + var targetHeight = rect.height || rect.bottom - rect.top; + if (selectedElm !== targetElm) { + selectedElm = targetElm; + width = height = 0; + } + var e = editor.fire('ObjectSelected', { target: targetElm }); + if (isResizable(targetElm) && !e.isDefaultPrevented()) { + each(resizeHandles, function (handle, name) { + var handleElm; + var startDrag = function (e) { + startX = e.screenX; + startY = e.screenY; + startW = getResizeTarget(selectedElm).clientWidth; + startH = getResizeTarget(selectedElm).clientHeight; + ratio = startH / startW; + selectedHandle = handle; + selectedHandle.name = name; + selectedHandle.startPos = { + x: targetWidth * handle[0] + selectedElmX, + y: targetHeight * handle[1] + selectedElmY + }; + startScrollWidth = rootElement.scrollWidth; + startScrollHeight = rootElement.scrollHeight; + selectedElmGhost = selectedElm.cloneNode(true); + dom.addClass(selectedElmGhost, 'mce-clonedresizable'); + dom.setAttrib(selectedElmGhost, 'data-mce-bogus', 'all'); + selectedElmGhost.contentEditable = false; + selectedElmGhost.unSelectabe = true; + dom.setStyles(selectedElmGhost, { + left: selectedElmX, + top: selectedElmY, + margin: 0 + }); + setGhostElmSize(selectedElmGhost, targetWidth, targetHeight); + selectedElmGhost.removeAttribute('data-mce-selected'); + rootElement.appendChild(selectedElmGhost); + dom.bind(editableDoc, 'mousemove', resizeGhostElement); + dom.bind(editableDoc, 'mouseup', endGhostResize); + if (rootDocument !== editableDoc) { + dom.bind(rootDocument, 'mousemove', resizeGhostElement); + dom.bind(rootDocument, 'mouseup', endGhostResize); + } + resizeHelper = dom.add(rootElement, 'div', { + 'class': 'mce-resize-helper', + 'data-mce-bogus': 'all' + }, startW + ' × ' + startH); + }; + handleElm = dom.get('mceResizeHandle' + name); + if (handleElm) { + dom.remove(handleElm); + } + handleElm = dom.add(rootElement, 'div', { + 'id': 'mceResizeHandle' + name, + 'data-mce-bogus': 'all', + 'class': 'mce-resizehandle', + 'unselectable': true, + 'style': 'cursor:' + name + '-resize; margin:0; padding:0' + }); + if (Env.ie === 11) { + handleElm.contentEditable = false; + } + dom.bind(handleElm, 'mousedown', function (e) { + e.stopImmediatePropagation(); + e.preventDefault(); + startDrag(e); + }); + handle.elm = handleElm; + dom.setStyles(handleElm, { + left: targetWidth * handle[0] + selectedElmX - handleElm.offsetWidth / 2, + top: targetHeight * handle[1] + selectedElmY - handleElm.offsetHeight / 2 + }); + }); + } else { + hideResizeRect(); + } + selectedElm.setAttribute('data-mce-selected', '1'); + }; + var hideResizeRect = function () { + unbindResizeHandleEvents(); + if (selectedElm) { + selectedElm.removeAttribute('data-mce-selected'); + } + each$1(resizeHandles, function (value, name) { + var handleElm = dom.get('mceResizeHandle' + name); + if (handleElm) { + dom.unbind(handleElm); + dom.remove(handleElm); + } + }); + }; + var updateResizeRect = function (e) { + var startElm, controlElm; + var isChildOrEqual = function (node, parent) { + if (node) { + do { + if (node === parent) { + return true; + } + } while (node = node.parentNode); + } + }; + if (resizeStarted || editor.removed) { + return; + } + each(dom.select('img[data-mce-selected],hr[data-mce-selected]'), function (img) { + img.removeAttribute('data-mce-selected'); + }); + controlElm = e.type === 'mousedown' ? e.target : selection.getNode(); + controlElm = dom.$(controlElm).closest('table,img,figure.image,hr')[0]; + if (isChildOrEqual(controlElm, rootElement)) { + disableGeckoResize(); + startElm = selection.getStart(true); + if (isChildOrEqual(startElm, controlElm) && isChildOrEqual(selection.getEnd(true), controlElm)) { + showResizeRect(controlElm); + return; + } + } + hideResizeRect(); + }; + var isWithinContentEditableFalse = function (elm) { + return isContentEditableFalse$6(getContentEditableRoot(editor.getBody(), elm)); + }; + var unbindResizeHandleEvents = function () { + each$1(resizeHandles, function (handle) { + if (handle.elm) { + dom.unbind(handle.elm); + delete handle.elm; + } + }); + }; + var disableGeckoResize = function () { + try { + editor.getDoc().execCommand('enableObjectResizing', false, 'false'); + } catch (ex) { + } + }; + editor.on('init', function () { + disableGeckoResize(); + if (Env.browser.isIE() || Env.browser.isEdge()) { + editor.on('mousedown click', function (e) { + var target = e.target, nodeName = target.nodeName; + if (!resizeStarted && /^(TABLE|IMG|HR)$/.test(nodeName) && !isWithinContentEditableFalse(target)) { + if (e.button !== 2) { + editor.selection.select(target, nodeName === 'TABLE'); + } + if (e.type === 'mousedown') { + editor.nodeChanged(); + } + } + }); + var handleMSControlSelect_1 = function (e) { + var delayedSelect = function (node) { + Delay.setEditorTimeout(editor, function () { + return editor.selection.select(node); + }); + }; + if (isWithinContentEditableFalse(e.target) || isMedia(e.target)) { + e.preventDefault(); + delayedSelect(e.target); + return; + } + if (/^(TABLE|IMG|HR)$/.test(e.target.nodeName)) { + e.preventDefault(); + if (e.target.tagName === 'IMG') { + delayedSelect(e.target); + } + } + }; + dom.bind(rootElement, 'mscontrolselect', handleMSControlSelect_1); + editor.on('remove', function () { + return dom.unbind(rootElement, 'mscontrolselect', handleMSControlSelect_1); + }); + } + var throttledUpdateResizeRect = Delay.throttle(function (e) { + if (!editor.composing) { + updateResizeRect(e); + } + }); + editor.on('nodechange ResizeEditor ResizeWindow ResizeContent drop FullscreenStateChanged', throttledUpdateResizeRect); + editor.on('keyup compositionend', function (e) { + if (selectedElm && selectedElm.nodeName === 'TABLE') { + throttledUpdateResizeRect(e); + } + }); + editor.on('hide blur', hideResizeRect); + editor.on('contextmenu longpress', contextMenuSelectImage, true); + }); + editor.on('remove', unbindResizeHandleEvents); + var destroy = function () { + selectedElm = selectedElmGhost = null; + }; + return { + isResizable: isResizable, + showResizeRect: showResizeRect, + hideResizeRect: hideResizeRect, + updateResizeRect: updateResizeRect, + destroy: destroy + }; + }; + + var hasCeProperty = function (node) { + return isContentEditableTrue(node) || isContentEditableFalse(node); + }; + var findParent = function (node, rootNode, predicate) { + while (node && node !== rootNode) { + if (predicate(node)) { + return node; + } + node = node.parentNode; + } + return null; + }; + var findClosestIeRange = function (clientX, clientY, doc) { + var rects; + var element = doc.elementFromPoint(clientX, clientY); + var rng = doc.body.createTextRange(); + if (!element || element.tagName === 'HTML') { + element = doc.body; + } + rng.moveToElementText(element); + rects = Tools.toArray(rng.getClientRects()); + rects = rects.sort(function (a, b) { + a = Math.abs(Math.max(a.top - clientY, a.bottom - clientY)); + b = Math.abs(Math.max(b.top - clientY, b.bottom - clientY)); + return a - b; + }); + if (rects.length > 0) { + clientY = (rects[0].bottom + rects[0].top) / 2; + try { + rng.moveToPoint(clientX, clientY); + rng.collapse(true); + return rng; + } catch (ex) { + } + } + return null; + }; + var moveOutOfContentEditableFalse = function (rng, rootNode) { + var parentElement = rng && rng.parentElement ? rng.parentElement() : null; + return isContentEditableFalse(findParent(parentElement, rootNode, hasCeProperty)) ? null : rng; + }; + var fromPoint$1 = function (clientX, clientY, doc) { + var rng, point; + var pointDoc = doc; + if (pointDoc.caretPositionFromPoint) { + point = pointDoc.caretPositionFromPoint(clientX, clientY); + if (point) { + rng = doc.createRange(); + rng.setStart(point.offsetNode, point.offset); + rng.collapse(true); + } + } else if (doc.caretRangeFromPoint) { + rng = doc.caretRangeFromPoint(clientX, clientY); + } else if (pointDoc.body.createTextRange) { + rng = pointDoc.body.createTextRange(); + try { + rng.moveToPoint(clientX, clientY); + rng.collapse(true); + } catch (ex) { + rng = findClosestIeRange(clientX, clientY, doc); + } + return moveOutOfContentEditableFalse(rng, doc.body); + } + return rng; + }; + + var isEq$1 = function (rng1, rng2) { + return rng1 && rng2 && (rng1.startContainer === rng2.startContainer && rng1.startOffset === rng2.startOffset) && (rng1.endContainer === rng2.endContainer && rng1.endOffset === rng2.endOffset); + }; + + var findParent$1 = function (node, rootNode, predicate) { + while (node && node !== rootNode) { + if (predicate(node)) { + return node; + } + node = node.parentNode; + } + return null; + }; + var hasParent = function (node, rootNode, predicate) { + return findParent$1(node, rootNode, predicate) !== null; + }; + var hasParentWithName = function (node, rootNode, name) { + return hasParent(node, rootNode, function (node) { + return node.nodeName === name; + }); + }; + var isTable$3 = function (node) { + return node && node.nodeName === 'TABLE'; + }; + var isTableCell$3 = function (node) { + return node && /^(TD|TH|CAPTION)$/.test(node.nodeName); + }; + var isCeFalseCaretContainer = function (node, rootNode) { + return isCaretContainer(node) && hasParent(node, rootNode, isCaretNode) === false; + }; + var hasBrBeforeAfter = function (dom, node, left) { + var walker = new DomTreeWalker(node, dom.getParent(node.parentNode, dom.isBlock) || dom.getRoot()); + while (node = walker[left ? 'prev' : 'next']()) { + if (isBr(node)) { + return true; + } + } + }; + var isPrevNode = function (node, name) { + return node.previousSibling && node.previousSibling.nodeName === name; + }; + var hasContentEditableFalseParent = function (body, node) { + while (node && node !== body) { + if (isContentEditableFalse(node)) { + return true; + } + node = node.parentNode; + } + return false; + }; + var findTextNodeRelative = function (dom, isAfterNode, collapsed, left, startNode) { + var lastInlineElement; + var body = dom.getRoot(); + var node; + var nonEmptyElementsMap = dom.schema.getNonEmptyElements(); + var parentBlockContainer = dom.getParent(startNode.parentNode, dom.isBlock) || body; + if (left && isBr(startNode) && isAfterNode && dom.isEmpty(parentBlockContainer)) { + return Optional.some(CaretPosition(startNode.parentNode, dom.nodeIndex(startNode))); + } + var walker = new DomTreeWalker(startNode, parentBlockContainer); + while (node = walker[left ? 'prev' : 'next']()) { + if (dom.getContentEditableParent(node) === 'false' || isCeFalseCaretContainer(node, body)) { + return Optional.none(); + } + if (isText$1(node) && node.nodeValue.length > 0) { + if (hasParentWithName(node, body, 'A') === false) { + return Optional.some(CaretPosition(node, left ? node.nodeValue.length : 0)); + } + return Optional.none(); + } + if (dom.isBlock(node) || nonEmptyElementsMap[node.nodeName.toLowerCase()]) { + return Optional.none(); + } + lastInlineElement = node; + } + if (collapsed && lastInlineElement) { + return Optional.some(CaretPosition(lastInlineElement, 0)); + } + return Optional.none(); + }; + var normalizeEndPoint = function (dom, collapsed, start, rng) { + var container, offset; + var body = dom.getRoot(); + var node; + var directionLeft, normalized = false; + container = rng[(start ? 'start' : 'end') + 'Container']; + offset = rng[(start ? 'start' : 'end') + 'Offset']; + var isAfterNode = isElement$1(container) && offset === container.childNodes.length; + var nonEmptyElementsMap = dom.schema.getNonEmptyElements(); + directionLeft = start; + if (isCaretContainer(container)) { + return Optional.none(); + } + if (isElement$1(container) && offset > container.childNodes.length - 1) { + directionLeft = false; + } + if (isDocument$1(container)) { + container = body; + offset = 0; + } + if (container === body) { + if (directionLeft) { + node = container.childNodes[offset > 0 ? offset - 1 : 0]; + if (node) { + if (isCaretContainer(node)) { + return Optional.none(); + } + if (nonEmptyElementsMap[node.nodeName] || isTable$3(node)) { + return Optional.none(); + } + } + } + if (container.hasChildNodes()) { + offset = Math.min(!directionLeft && offset > 0 ? offset - 1 : offset, container.childNodes.length - 1); + container = container.childNodes[offset]; + offset = isText$1(container) && isAfterNode ? container.data.length : 0; + if (!collapsed && container === body.lastChild && isTable$3(container)) { + return Optional.none(); + } + if (hasContentEditableFalseParent(body, container) || isCaretContainer(container)) { + return Optional.none(); + } + if (container.hasChildNodes() && isTable$3(container) === false) { + node = container; + var walker = new DomTreeWalker(container, body); + do { + if (isContentEditableFalse(node) || isCaretContainer(node)) { + normalized = false; + break; + } + if (isText$1(node) && node.nodeValue.length > 0) { + offset = directionLeft ? 0 : node.nodeValue.length; + container = node; + normalized = true; + break; + } + if (nonEmptyElementsMap[node.nodeName.toLowerCase()] && !isTableCell$3(node)) { + offset = dom.nodeIndex(node); + container = node.parentNode; + if (!directionLeft) { + offset++; + } + normalized = true; + break; + } + } while (node = directionLeft ? walker.next() : walker.prev()); + } + } + } + if (collapsed) { + if (isText$1(container) && offset === 0) { + findTextNodeRelative(dom, isAfterNode, collapsed, true, container).each(function (pos) { + container = pos.container(); + offset = pos.offset(); + normalized = true; + }); + } + if (isElement$1(container)) { + node = container.childNodes[offset]; + if (!node) { + node = container.childNodes[offset - 1]; + } + if (node && isBr(node) && !isPrevNode(node, 'A') && !hasBrBeforeAfter(dom, node, false) && !hasBrBeforeAfter(dom, node, true)) { + findTextNodeRelative(dom, isAfterNode, collapsed, true, node).each(function (pos) { + container = pos.container(); + offset = pos.offset(); + normalized = true; + }); + } + } + } + if (directionLeft && !collapsed && isText$1(container) && offset === container.nodeValue.length) { + findTextNodeRelative(dom, isAfterNode, collapsed, false, container).each(function (pos) { + container = pos.container(); + offset = pos.offset(); + normalized = true; + }); + } + return normalized ? Optional.some(CaretPosition(container, offset)) : Optional.none(); + }; + var normalize = function (dom, rng) { + var collapsed = rng.collapsed, normRng = rng.cloneRange(); + var startPos = CaretPosition.fromRangeStart(rng); + normalizeEndPoint(dom, collapsed, true, normRng).each(function (pos) { + if (!collapsed || !CaretPosition.isAbove(startPos, pos)) { + normRng.setStart(pos.container(), pos.offset()); + } + }); + if (!collapsed) { + normalizeEndPoint(dom, collapsed, false, normRng).each(function (pos) { + normRng.setEnd(pos.container(), pos.offset()); + }); + } + if (collapsed) { + normRng.collapse(true); + } + return isEq$1(rng, normRng) ? Optional.none() : Optional.some(normRng); + }; + + var splitText = function (node, offset) { + return node.splitText(offset); + }; + var split$1 = function (rng) { + var startContainer = rng.startContainer, startOffset = rng.startOffset, endContainer = rng.endContainer, endOffset = rng.endOffset; + if (startContainer === endContainer && isText$1(startContainer)) { + if (startOffset > 0 && startOffset < startContainer.nodeValue.length) { + endContainer = splitText(startContainer, startOffset); + startContainer = endContainer.previousSibling; + if (endOffset > startOffset) { + endOffset = endOffset - startOffset; + startContainer = endContainer = splitText(endContainer, endOffset).previousSibling; + endOffset = endContainer.nodeValue.length; + startOffset = 0; + } else { + endOffset = 0; + } + } + } else { + if (isText$1(startContainer) && startOffset > 0 && startOffset < startContainer.nodeValue.length) { + startContainer = splitText(startContainer, startOffset); + startOffset = 0; + } + if (isText$1(endContainer) && endOffset > 0 && endOffset < endContainer.nodeValue.length) { + endContainer = splitText(endContainer, endOffset).previousSibling; + endOffset = endContainer.nodeValue.length; + } + } + return { + startContainer: startContainer, + startOffset: startOffset, + endContainer: endContainer, + endOffset: endOffset + }; + }; + + function RangeUtils(dom) { + var walk = function (rng, callback) { + return walk$1(dom, rng, callback); + }; + var split = split$1; + var normalize$1 = function (rng) { + return normalize(dom, rng).fold(never, function (normalizedRng) { + rng.setStart(normalizedRng.startContainer, normalizedRng.startOffset); + rng.setEnd(normalizedRng.endContainer, normalizedRng.endOffset); + return true; + }); + }; + return { + walk: walk, + split: split, + normalize: normalize$1 + }; + } + (function (RangeUtils) { + RangeUtils.compareRanges = isEq$1; + RangeUtils.getCaretRangeFromPoint = fromPoint$1; + RangeUtils.getSelectedNode = getSelectedNode; + RangeUtils.getNode = getNode; + }(RangeUtils || (RangeUtils = {}))); + var RangeUtils$1 = RangeUtils; + + function Dimension (name, getOffset) { + var set = function (element, h) { + if (!isNumber(h) && !h.match(/^[0-9]+$/)) { + throw new Error(name + '.set accepts only positive integer values. Value was ' + h); + } + var dom = element.dom; + if (isSupported$1(dom)) { + dom.style[name] = h + 'px'; + } + }; + var get = function (element) { + var r = getOffset(element); + if (r <= 0 || r === null) { + var css = get$5(element, name); + return parseFloat(css) || 0; + } + return r; + }; + var getOuter = get; + var aggregate = function (element, properties) { + return foldl(properties, function (acc, property) { + var val = get$5(element, property); + var value = val === undefined ? 0 : parseInt(val, 10); + return isNaN(value) ? acc : acc + value; + }, 0); + }; + var max = function (element, value, properties) { + var cumulativeInclusions = aggregate(element, properties); + var absoluteMax = value > cumulativeInclusions ? value - cumulativeInclusions : 0; + return absoluteMax; + }; + return { + set: set, + get: get, + getOuter: getOuter, + aggregate: aggregate, + max: max + }; + } + + var api$1 = Dimension('height', function (element) { + var dom = element.dom; + return inBody(element) ? dom.getBoundingClientRect().height : dom.offsetHeight; + }); + var get$9 = function (element) { + return api$1.get(element); + }; + + var walkUp = function (navigation, doc) { + var frame = navigation.view(doc); + return frame.fold(constant([]), function (f) { + var parent = navigation.owner(f); + var rest = walkUp(navigation, parent); + return [f].concat(rest); + }); + }; + var pathTo = function (element, navigation) { + var d = navigation.owner(element); + return walkUp(navigation, d); + }; + + var view = function (doc) { + var _a; + var element = doc.dom === document ? Optional.none() : Optional.from((_a = doc.dom.defaultView) === null || _a === void 0 ? void 0 : _a.frameElement); + return element.map(SugarElement.fromDom); + }; + var owner$1 = function (element) { + return documentOrOwner(element); + }; + + var Navigation = /*#__PURE__*/Object.freeze({ + __proto__: null, + view: view, + owner: owner$1 + }); + + var find$2 = function (element) { + var doc = SugarElement.fromDom(document); + var scroll = get$2(doc); + var frames = pathTo(element, Navigation); + var offset = viewport(element); + var r = foldr(frames, function (b, a) { + var loc = viewport(a); + return { + left: b.left + loc.left, + top: b.top + loc.top + }; + }, { + left: 0, + top: 0 + }); + return SugarPosition(r.left + offset.left + scroll.left, r.top + offset.top + scroll.top); + }; + + var excludeFromDescend = function (element) { + return name(element) === 'textarea'; + }; + var fireScrollIntoViewEvent = function (editor, data) { + var scrollEvent = editor.fire('ScrollIntoView', data); + return scrollEvent.isDefaultPrevented(); + }; + var fireAfterScrollIntoViewEvent = function (editor, data) { + editor.fire('AfterScrollIntoView', data); + }; + var descend = function (element, offset) { + var children$1 = children(element); + if (children$1.length === 0 || excludeFromDescend(element)) { + return { + element: element, + offset: offset + }; + } else if (offset < children$1.length && !excludeFromDescend(children$1[offset])) { + return { + element: children$1[offset], + offset: 0 + }; + } else { + var last = children$1[children$1.length - 1]; + if (excludeFromDescend(last)) { + return { + element: element, + offset: offset + }; + } else { + if (name(last) === 'img') { + return { + element: last, + offset: 1 + }; + } else if (isText(last)) { + return { + element: last, + offset: get$8(last).length + }; + } else { + return { + element: last, + offset: children(last).length + }; + } + } + } + }; + var markerInfo = function (element, cleanupFun) { + var pos = absolute(element); + var height = get$9(element); + return { + element: element, + bottom: pos.top + height, + height: height, + pos: pos, + cleanup: cleanupFun + }; + }; + var createMarker = function (element, offset) { + var startPoint = descend(element, offset); + var span = SugarElement.fromHtml('' + ZWSP + ''); + before(startPoint.element, span); + return markerInfo(span, function () { + return remove(span); + }); + }; + var elementMarker = function (element) { + return markerInfo(SugarElement.fromDom(element), noop); + }; + var withMarker = function (editor, f, rng, alignToTop) { + preserveWith(editor, function (_s, _e) { + return applyWithMarker(editor, f, rng, alignToTop); + }, rng); + }; + var withScrollEvents = function (editor, doc, f, marker, alignToTop) { + var data = { + elm: marker.element.dom, + alignToTop: alignToTop + }; + if (fireScrollIntoViewEvent(editor, data)) { + return; + } + var scrollTop = get$2(doc).top; + f(doc, scrollTop, marker, alignToTop); + fireAfterScrollIntoViewEvent(editor, data); + }; + var applyWithMarker = function (editor, f, rng, alignToTop) { + var body = SugarElement.fromDom(editor.getBody()); + var doc = SugarElement.fromDom(editor.getDoc()); + reflow(body); + var marker = createMarker(SugarElement.fromDom(rng.startContainer), rng.startOffset); + withScrollEvents(editor, doc, f, marker, alignToTop); + marker.cleanup(); + }; + var withElement = function (editor, element, f, alignToTop) { + var doc = SugarElement.fromDom(editor.getDoc()); + withScrollEvents(editor, doc, f, elementMarker(element), alignToTop); + }; + var preserveWith = function (editor, f, rng) { + var startElement = rng.startContainer; + var startOffset = rng.startOffset; + var endElement = rng.endContainer; + var endOffset = rng.endOffset; + f(SugarElement.fromDom(startElement), SugarElement.fromDom(endElement)); + var newRng = editor.dom.createRng(); + newRng.setStart(startElement, startOffset); + newRng.setEnd(endElement, endOffset); + editor.selection.setRng(rng); + }; + var scrollToMarker = function (marker, viewHeight, alignToTop, doc) { + var pos = marker.pos; + if (alignToTop) { + to(pos.left, pos.top, doc); + } else { + var y = pos.top - viewHeight + marker.height; + to(pos.left, y, doc); + } + }; + var intoWindowIfNeeded = function (doc, scrollTop, viewHeight, marker, alignToTop) { + var viewportBottom = viewHeight + scrollTop; + var markerTop = marker.pos.top; + var markerBottom = marker.bottom; + var largerThanViewport = markerBottom - markerTop >= viewHeight; + if (markerTop < scrollTop) { + scrollToMarker(marker, viewHeight, alignToTop !== false, doc); + } else if (markerTop > viewportBottom) { + var align = largerThanViewport ? alignToTop !== false : alignToTop === true; + scrollToMarker(marker, viewHeight, align, doc); + } else if (markerBottom > viewportBottom && !largerThanViewport) { + scrollToMarker(marker, viewHeight, alignToTop === true, doc); + } + }; + var intoWindow = function (doc, scrollTop, marker, alignToTop) { + var viewHeight = doc.dom.defaultView.innerHeight; + intoWindowIfNeeded(doc, scrollTop, viewHeight, marker, alignToTop); + }; + var intoFrame = function (doc, scrollTop, marker, alignToTop) { + var frameViewHeight = doc.dom.defaultView.innerHeight; + intoWindowIfNeeded(doc, scrollTop, frameViewHeight, marker, alignToTop); + var op = find$2(marker.element); + var viewportBounds = getBounds(window); + if (op.top < viewportBounds.y) { + intoView(marker.element, alignToTop !== false); + } else if (op.top > viewportBounds.bottom) { + intoView(marker.element, alignToTop === true); + } + }; + var rangeIntoWindow = function (editor, rng, alignToTop) { + return withMarker(editor, intoWindow, rng, alignToTop); + }; + var elementIntoWindow = function (editor, element, alignToTop) { + return withElement(editor, element, intoWindow, alignToTop); + }; + var rangeIntoFrame = function (editor, rng, alignToTop) { + return withMarker(editor, intoFrame, rng, alignToTop); + }; + var elementIntoFrame = function (editor, element, alignToTop) { + return withElement(editor, element, intoFrame, alignToTop); + }; + var scrollElementIntoView = function (editor, element, alignToTop) { + var scroller = editor.inline ? elementIntoWindow : elementIntoFrame; + scroller(editor, element, alignToTop); + }; + var scrollRangeIntoView = function (editor, rng, alignToTop) { + var scroller = editor.inline ? rangeIntoWindow : rangeIntoFrame; + scroller(editor, rng, alignToTop); + }; + + var getDocument = function () { + return SugarElement.fromDom(document); + }; + + var focus = function (element) { + return element.dom.focus(); + }; + var hasFocus = function (element) { + var root = getRootNode(element).dom; + return element.dom === root.activeElement; + }; + var active = function (root) { + if (root === void 0) { + root = getDocument(); + } + return Optional.from(root.dom.activeElement).map(SugarElement.fromDom); + }; + var search = function (element) { + return active(getRootNode(element)).filter(function (e) { + return element.dom.contains(e.dom); + }); + }; + + var create$4 = function (start, soffset, finish, foffset) { + return { + start: start, + soffset: soffset, + finish: finish, + foffset: foffset + }; + }; + var SimRange = { create: create$4 }; + + var adt = Adt.generate([ + { before: ['element'] }, + { + on: [ + 'element', + 'offset' + ] + }, + { after: ['element'] } + ]); + var cata = function (subject, onBefore, onOn, onAfter) { + return subject.fold(onBefore, onOn, onAfter); + }; + var getStart = function (situ) { + return situ.fold(identity, identity, identity); + }; + var before$3 = adt.before; + var on = adt.on; + var after$2 = adt.after; + var Situ = { + before: before$3, + on: on, + after: after$2, + cata: cata, + getStart: getStart + }; + + var adt$1 = Adt.generate([ + { domRange: ['rng'] }, + { + relative: [ + 'startSitu', + 'finishSitu' + ] + }, + { + exact: [ + 'start', + 'soffset', + 'finish', + 'foffset' + ] + } + ]); + var exactFromRange = function (simRange) { + return adt$1.exact(simRange.start, simRange.soffset, simRange.finish, simRange.foffset); + }; + var getStart$1 = function (selection) { + return selection.match({ + domRange: function (rng) { + return SugarElement.fromDom(rng.startContainer); + }, + relative: function (startSitu, _finishSitu) { + return Situ.getStart(startSitu); + }, + exact: function (start, _soffset, _finish, _foffset) { + return start; + } + }); + }; + var domRange = adt$1.domRange; + var relative = adt$1.relative; + var exact = adt$1.exact; + var getWin = function (selection) { + var start = getStart$1(selection); + return defaultView(start); + }; + var range = SimRange.create; + var SimSelection = { + domRange: domRange, + relative: relative, + exact: exact, + exactFromRange: exactFromRange, + getWin: getWin, + range: range + }; + + var browser$3 = detect$3().browser; + var clamp = function (offset, element) { + var max = isText(element) ? get$8(element).length : children(element).length + 1; + if (offset > max) { + return max; + } else if (offset < 0) { + return 0; + } + return offset; + }; + var normalizeRng = function (rng) { + return SimSelection.range(rng.start, clamp(rng.soffset, rng.start), rng.finish, clamp(rng.foffset, rng.finish)); + }; + var isOrContains = function (root, elm) { + return !isRestrictedNode(elm.dom) && (contains$2(root, elm) || eq$2(root, elm)); + }; + var isRngInRoot = function (root) { + return function (rng) { + return isOrContains(root, rng.start) && isOrContains(root, rng.finish); + }; + }; + var shouldStore = function (editor) { + return editor.inline === true || browser$3.isIE(); + }; + var nativeRangeToSelectionRange = function (r) { + return SimSelection.range(SugarElement.fromDom(r.startContainer), r.startOffset, SugarElement.fromDom(r.endContainer), r.endOffset); + }; + var readRange = function (win) { + var selection = win.getSelection(); + var rng = !selection || selection.rangeCount === 0 ? Optional.none() : Optional.from(selection.getRangeAt(0)); + return rng.map(nativeRangeToSelectionRange); + }; + var getBookmark$2 = function (root) { + var win = defaultView(root); + return readRange(win.dom).filter(isRngInRoot(root)); + }; + var validate = function (root, bookmark) { + return Optional.from(bookmark).filter(isRngInRoot(root)).map(normalizeRng); + }; + var bookmarkToNativeRng = function (bookmark) { + var rng = document.createRange(); + try { + rng.setStart(bookmark.start.dom, bookmark.soffset); + rng.setEnd(bookmark.finish.dom, bookmark.foffset); + return Optional.some(rng); + } catch (_) { + return Optional.none(); + } + }; + var store = function (editor) { + var newBookmark = shouldStore(editor) ? getBookmark$2(SugarElement.fromDom(editor.getBody())) : Optional.none(); + editor.bookmark = newBookmark.isSome() ? newBookmark : editor.bookmark; + }; + var storeNative = function (editor, rng) { + var root = SugarElement.fromDom(editor.getBody()); + var range = shouldStore(editor) ? Optional.from(rng) : Optional.none(); + var newBookmark = range.map(nativeRangeToSelectionRange).filter(isRngInRoot(root)); + editor.bookmark = newBookmark.isSome() ? newBookmark : editor.bookmark; + }; + var getRng = function (editor) { + var bookmark = editor.bookmark ? editor.bookmark : Optional.none(); + return bookmark.bind(function (x) { + return validate(SugarElement.fromDom(editor.getBody()), x); + }).bind(bookmarkToNativeRng); + }; + var restore = function (editor) { + getRng(editor).each(function (rng) { + return editor.selection.setRng(rng); + }); + }; + + var isEditorUIElement = function (elm) { + var className = elm.className.toString(); + return className.indexOf('tox-') !== -1 || className.indexOf('mce-') !== -1; + }; + var FocusManager = { isEditorUIElement: isEditorUIElement }; + + var isManualNodeChange = function (e) { + return e.type === 'nodechange' && e.selectionChange; + }; + var registerPageMouseUp = function (editor, throttledStore) { + var mouseUpPage = function () { + throttledStore.throttle(); + }; + DOMUtils$1.DOM.bind(document, 'mouseup', mouseUpPage); + editor.on('remove', function () { + DOMUtils$1.DOM.unbind(document, 'mouseup', mouseUpPage); + }); + }; + var registerFocusOut = function (editor) { + editor.on('focusout', function () { + store(editor); + }); + }; + var registerMouseUp = function (editor, throttledStore) { + editor.on('mouseup touchend', function (_e) { + throttledStore.throttle(); + }); + }; + var registerEditorEvents = function (editor, throttledStore) { + var browser = detect$3().browser; + if (browser.isIE()) { + registerFocusOut(editor); + } else { + registerMouseUp(editor, throttledStore); + } + editor.on('keyup NodeChange', function (e) { + if (!isManualNodeChange(e)) { + store(editor); + } + }); + }; + var register = function (editor) { + var throttledStore = first(function () { + store(editor); + }, 0); + editor.on('init', function () { + if (editor.inline) { + registerPageMouseUp(editor, throttledStore); + } + registerEditorEvents(editor, throttledStore); + }); + editor.on('remove', function () { + throttledStore.cancel(); + }); + }; + + var documentFocusInHandler; + var DOM$2 = DOMUtils$1.DOM; + var isEditorUIElement$1 = function (elm) { + return FocusManager.isEditorUIElement(elm); + }; + var isEditorContentAreaElement = function (elm) { + var classList = elm.classList; + if (classList !== undefined) { + return classList.contains('tox-edit-area') || classList.contains('tox-edit-area__iframe') || classList.contains('mce-content-body'); + } else { + return false; + } + }; + var isUIElement = function (editor, elm) { + var customSelector = getCustomUiSelector(editor); + var parent = DOM$2.getParent(elm, function (elm) { + return isEditorUIElement$1(elm) || (customSelector ? editor.dom.is(elm, customSelector) : false); + }); + return parent !== null; + }; + var getActiveElement = function (editor) { + try { + var root = getRootNode(SugarElement.fromDom(editor.getElement())); + return active(root).fold(function () { + return document.body; + }, function (x) { + return x.dom; + }); + } catch (ex) { + return document.body; + } + }; + var registerEvents = function (editorManager, e) { + var editor = e.editor; + register(editor); + editor.on('focusin', function () { + var self = this; + var focusedEditor = editorManager.focusedEditor; + if (focusedEditor !== self) { + if (focusedEditor) { + focusedEditor.fire('blur', { focusedEditor: self }); + } + editorManager.setActive(self); + editorManager.focusedEditor = self; + self.fire('focus', { blurredEditor: focusedEditor }); + self.focus(true); + } + }); + editor.on('focusout', function () { + var self = this; + Delay.setEditorTimeout(self, function () { + var focusedEditor = editorManager.focusedEditor; + if (!isUIElement(self, getActiveElement(self)) && focusedEditor === self) { + self.fire('blur', { focusedEditor: null }); + editorManager.focusedEditor = null; + } + }); + }); + if (!documentFocusInHandler) { + documentFocusInHandler = function (e) { + var activeEditor = editorManager.activeEditor; + if (activeEditor) { + getOriginalEventTarget(e).each(function (target) { + if (target.ownerDocument === document) { + if (target !== document.body && !isUIElement(activeEditor, target) && editorManager.focusedEditor === activeEditor) { + activeEditor.fire('blur', { focusedEditor: null }); + editorManager.focusedEditor = null; + } + } + }); + } + }; + DOM$2.bind(document, 'focusin', documentFocusInHandler); + } + }; + var unregisterDocumentEvents = function (editorManager, e) { + if (editorManager.focusedEditor === e.editor) { + editorManager.focusedEditor = null; + } + if (!editorManager.activeEditor) { + DOM$2.unbind(document, 'focusin', documentFocusInHandler); + documentFocusInHandler = null; + } + }; + var setup$2 = function (editorManager) { + editorManager.on('AddEditor', curry(registerEvents, editorManager)); + editorManager.on('RemoveEditor', curry(unregisterDocumentEvents, editorManager)); + }; + + var getContentEditableHost = function (editor, node) { + return editor.dom.getParent(node, function (node) { + return editor.dom.getContentEditable(node) === 'true'; + }); + }; + var getCollapsedNode = function (rng) { + return rng.collapsed ? Optional.from(getNode(rng.startContainer, rng.startOffset)).map(SugarElement.fromDom) : Optional.none(); + }; + var getFocusInElement = function (root, rng) { + return getCollapsedNode(rng).bind(function (node) { + if (isTableSection(node)) { + return Optional.some(node); + } else if (contains$2(root, node) === false) { + return Optional.some(root); + } else { + return Optional.none(); + } + }); + }; + var normalizeSelection = function (editor, rng) { + getFocusInElement(SugarElement.fromDom(editor.getBody()), rng).bind(function (elm) { + return firstPositionIn(elm.dom); + }).fold(function () { + editor.selection.normalize(); + return; + }, function (caretPos) { + return editor.selection.setRng(caretPos.toRange()); + }); + }; + var focusBody = function (body) { + if (body.setActive) { + try { + body.setActive(); + } catch (ex) { + body.focus(); + } + } else { + body.focus(); + } + }; + var hasElementFocus = function (elm) { + return hasFocus(elm) || search(elm).isSome(); + }; + var hasIframeFocus = function (editor) { + return editor.iframeElement && hasFocus(SugarElement.fromDom(editor.iframeElement)); + }; + var hasInlineFocus = function (editor) { + var rawBody = editor.getBody(); + return rawBody && hasElementFocus(SugarElement.fromDom(rawBody)); + }; + var hasUiFocus = function (editor) { + return active().filter(function (elem) { + return !isEditorContentAreaElement(elem.dom) && isUIElement(editor, elem.dom); + }).isSome(); + }; + var hasFocus$1 = function (editor) { + return editor.inline ? hasInlineFocus(editor) : hasIframeFocus(editor); + }; + var hasEditorOrUiFocus = function (editor) { + return hasFocus$1(editor) || hasUiFocus(editor); + }; + var focusEditor = function (editor) { + var selection = editor.selection; + var body = editor.getBody(); + var rng = selection.getRng(); + editor.quirks.refreshContentEditable(); + if (editor.bookmark !== undefined && hasFocus$1(editor) === false) { + getRng(editor).each(function (bookmarkRng) { + editor.selection.setRng(bookmarkRng); + rng = bookmarkRng; + }); + } + var contentEditableHost = getContentEditableHost(editor, selection.getNode()); + if (editor.$.contains(body, contentEditableHost)) { + focusBody(contentEditableHost); + normalizeSelection(editor, rng); + activateEditor(editor); + return; + } + if (!editor.inline) { + if (!Env.opera) { + focusBody(body); + } + editor.getWin().focus(); + } + if (Env.gecko || editor.inline) { + focusBody(body); + normalizeSelection(editor, rng); + } + activateEditor(editor); + }; + var activateEditor = function (editor) { + return editor.editorManager.setActive(editor); + }; + var focus$1 = function (editor, skipFocus) { + if (editor.removed) { + return; + } + skipFocus ? activateEditor(editor) : focusEditor(editor); + }; + + var getEndpointElement = function (root, rng, start, real, resolve) { + var container = start ? rng.startContainer : rng.endContainer; + var offset = start ? rng.startOffset : rng.endOffset; + return Optional.from(container).map(SugarElement.fromDom).map(function (elm) { + return !real || !rng.collapsed ? child(elm, resolve(elm, offset)).getOr(elm) : elm; + }).bind(function (elm) { + return isElement(elm) ? Optional.some(elm) : parent(elm).filter(isElement); + }).map(function (elm) { + return elm.dom; + }).getOr(root); + }; + var getStart$2 = function (root, rng, real) { + return getEndpointElement(root, rng, true, real, function (elm, offset) { + return Math.min(childNodesCount(elm), offset); + }); + }; + var getEnd = function (root, rng, real) { + return getEndpointElement(root, rng, false, real, function (elm, offset) { + return offset > 0 ? offset - 1 : offset; + }); + }; + var skipEmptyTextNodes = function (node, forwards) { + var orig = node; + while (node && isText$1(node) && node.length === 0) { + node = forwards ? node.nextSibling : node.previousSibling; + } + return node || orig; + }; + var getNode$1 = function (root, rng) { + var elm, startContainer, endContainer; + if (!rng) { + return root; + } + startContainer = rng.startContainer; + endContainer = rng.endContainer; + var startOffset = rng.startOffset; + var endOffset = rng.endOffset; + elm = rng.commonAncestorContainer; + if (!rng.collapsed) { + if (startContainer === endContainer) { + if (endOffset - startOffset < 2) { + if (startContainer.hasChildNodes()) { + elm = startContainer.childNodes[startOffset]; + } + } + } + if (startContainer.nodeType === 3 && endContainer.nodeType === 3) { + if (startContainer.length === startOffset) { + startContainer = skipEmptyTextNodes(startContainer.nextSibling, true); + } else { + startContainer = startContainer.parentNode; + } + if (endOffset === 0) { + endContainer = skipEmptyTextNodes(endContainer.previousSibling, false); + } else { + endContainer = endContainer.parentNode; + } + if (startContainer && startContainer === endContainer) { + return startContainer; + } + } + } + if (elm && elm.nodeType === 3) { + return elm.parentNode; + } + return elm; + }; + var getSelectedBlocks = function (dom, rng, startElm, endElm) { + var node; + var selectedBlocks = []; + var root = dom.getRoot(); + startElm = dom.getParent(startElm || getStart$2(root, rng, rng.collapsed), dom.isBlock); + endElm = dom.getParent(endElm || getEnd(root, rng, rng.collapsed), dom.isBlock); + if (startElm && startElm !== root) { + selectedBlocks.push(startElm); + } + if (startElm && endElm && startElm !== endElm) { + node = startElm; + var walker = new DomTreeWalker(startElm, root); + while ((node = walker.next()) && node !== endElm) { + if (dom.isBlock(node)) { + selectedBlocks.push(node); + } + } + } + if (endElm && startElm !== endElm && endElm !== root) { + selectedBlocks.push(endElm); + } + return selectedBlocks; + }; + var select$1 = function (dom, node, content) { + return Optional.from(node).map(function (node) { + var idx = dom.nodeIndex(node); + var rng = dom.createRng(); + rng.setStart(node.parentNode, idx); + rng.setEnd(node.parentNode, idx + 1); + if (content) { + moveEndPoint$1(dom, rng, node, true); + moveEndPoint$1(dom, rng, node, false); + } + return rng; + }); + }; + + var processRanges = function (editor, ranges) { + return map(ranges, function (range) { + var evt = editor.fire('GetSelectionRange', { range: range }); + return evt.range !== range ? evt.range : range; + }); + }; + + var ensureIsRoot = function (isRoot) { + return isFunction(isRoot) ? isRoot : never; + }; + var ancestor$3 = function (scope, transform, isRoot) { + var element = scope.dom; + var stop = ensureIsRoot(isRoot); + while (element.parentNode) { + element = element.parentNode; + var el = SugarElement.fromDom(element); + var transformed = transform(el); + if (transformed.isSome()) { + return transformed; + } else if (stop(el)) { + break; + } + } + return Optional.none(); + }; + var closest$2 = function (scope, transform, isRoot) { + var current = transform(scope); + var stop = ensureIsRoot(isRoot); + return current.orThunk(function () { + return stop(scope) ? Optional.none() : ancestor$3(scope, transform, stop); + }); + }; + + var isEq$2 = isEq; + var matchesUnInheritedFormatSelector = function (ed, node, name) { + var formatList = ed.formatter.get(name); + if (formatList) { + for (var i = 0; i < formatList.length; i++) { + if (formatList[i].inherit === false && ed.dom.is(node, formatList[i].selector)) { + return true; + } + } + } + return false; + }; + var matchParents = function (editor, node, name, vars) { + var root = editor.dom.getRoot(); + if (node === root) { + return false; + } + node = editor.dom.getParent(node, function (node) { + if (matchesUnInheritedFormatSelector(editor, node, name)) { + return true; + } + return node.parentNode === root || !!matchNode(editor, node, name, vars, true); + }); + return matchNode(editor, node, name, vars); + }; + var matchName = function (dom, node, format) { + if (isEq$2(node, format.inline)) { + return true; + } + if (isEq$2(node, format.block)) { + return true; + } + if (format.selector) { + return node.nodeType === 1 && dom.is(node, format.selector); + } + }; + var matchItems = function (dom, node, format, itemName, similar, vars) { + var key, value; + var items = format[itemName]; + var i; + if (format.onmatch) { + return format.onmatch(node, format, itemName); + } + if (items) { + if (typeof items.length === 'undefined') { + for (key in items) { + if (items.hasOwnProperty(key)) { + if (itemName === 'attributes') { + value = dom.getAttrib(node, key); + } else { + value = getStyle(dom, node, key); + } + if (similar && !value && !format.exact) { + return; + } + if ((!similar || format.exact) && !isEq$2(value, normalizeStyleValue(dom, replaceVars(items[key], vars), key))) { + return; + } + } + } + } else { + for (i = 0; i < items.length; i++) { + if (itemName === 'attributes' ? dom.getAttrib(node, items[i]) : getStyle(dom, node, items[i])) { + return format; + } + } + } + } + return format; + }; + var matchNode = function (ed, node, name, vars, similar) { + var formatList = ed.formatter.get(name); + var format, i, x, classes; + var dom = ed.dom; + if (formatList && node) { + for (i = 0; i < formatList.length; i++) { + format = formatList[i]; + if (matchName(ed.dom, node, format) && matchItems(dom, node, format, 'attributes', similar, vars) && matchItems(dom, node, format, 'styles', similar, vars)) { + if (classes = format.classes) { + for (x = 0; x < classes.length; x++) { + if (!ed.dom.hasClass(node, classes[x])) { + return; + } + } + } + return format; + } + } + } + }; + var match = function (editor, name, vars, node) { + if (node) { + return matchParents(editor, node, name, vars); + } + node = editor.selection.getNode(); + if (matchParents(editor, node, name, vars)) { + return true; + } + var startNode = editor.selection.getStart(); + if (startNode !== node) { + if (matchParents(editor, startNode, name, vars)) { + return true; + } + } + return false; + }; + var matchAll = function (editor, names, vars) { + var matchedFormatNames = []; + var checkedMap = {}; + var startElement = editor.selection.getStart(); + editor.dom.getParent(startElement, function (node) { + for (var i = 0; i < names.length; i++) { + var name_1 = names[i]; + if (!checkedMap[name_1] && matchNode(editor, node, name_1, vars)) { + checkedMap[name_1] = true; + matchedFormatNames.push(name_1); + } + } + }, editor.dom.getRoot()); + return matchedFormatNames; + }; + var closest$3 = function (editor, names) { + var isRoot = function (elm) { + return eq$2(elm, SugarElement.fromDom(editor.getBody())); + }; + var match = function (elm, name) { + return matchNode(editor, elm.dom, name) ? Optional.some(name) : Optional.none(); + }; + return Optional.from(editor.selection.getStart(true)).bind(function (rawElm) { + return closest$2(SugarElement.fromDom(rawElm), function (elm) { + return findMap(names, function (name) { + return match(elm, name); + }); + }, isRoot); + }).getOrNull(); + }; + var canApply = function (editor, name) { + var formatList = editor.formatter.get(name); + var startNode, parents, i, x, selector; + var dom = editor.dom; + if (formatList) { + startNode = editor.selection.getStart(); + parents = getParents$1(dom, startNode); + for (x = formatList.length - 1; x >= 0; x--) { + selector = formatList[x].selector; + if (!selector || formatList[x].defaultBlock) { + return true; + } + for (i = parents.length - 1; i >= 0; i--) { + if (dom.is(parents[i], selector)) { + return true; + } + } + } + } + return false; + }; + var matchAllOnNode = function (editor, node, formatNames) { + return foldl(formatNames, function (acc, name) { + var matchSimilar = isVariableFormatName(editor, name); + if (editor.formatter.matchNode(node, name, {}, matchSimilar)) { + return acc.concat([name]); + } else { + return acc; + } + }, []); + }; + + var typeLookup = { + '#text': 3, + '#comment': 8, + '#cdata': 4, + '#pi': 7, + '#doctype': 10, + '#document-fragment': 11 + }; + var walk$2 = function (node, root, prev) { + var startName = prev ? 'lastChild' : 'firstChild'; + var siblingName = prev ? 'prev' : 'next'; + if (node[startName]) { + return node[startName]; + } + if (node !== root) { + var sibling = node[siblingName]; + if (sibling) { + return sibling; + } + for (var parent_1 = node.parent; parent_1 && parent_1 !== root; parent_1 = parent_1.parent) { + sibling = parent_1[siblingName]; + if (sibling) { + return sibling; + } + } + } + }; + var isEmptyTextNode$1 = function (node) { + if (!isWhitespaceText(node.value)) { + return false; + } + var parentNode = node.parent; + if (parentNode && (parentNode.name !== 'span' || parentNode.attr('style')) && /^[ ]+$/.test(node.value)) { + return false; + } + return true; + }; + var isNonEmptyElement = function (node) { + var isNamedAnchor = node.name === 'a' && !node.attr('href') && node.attr('id'); + return node.attr('name') || node.attr('id') && !node.firstChild || node.attr('data-mce-bookmark') || isNamedAnchor; + }; + var AstNode = function () { + function AstNode(name, type) { + this.name = name; + this.type = type; + if (type === 1) { + this.attributes = []; + this.attributes.map = {}; + } + } + AstNode.create = function (name, attrs) { + var node = new AstNode(name, typeLookup[name] || 1); + if (attrs) { + each$1(attrs, function (value, attrName) { + node.attr(attrName, value); + }); + } + return node; + }; + AstNode.prototype.replace = function (node) { + var self = this; + if (node.parent) { + node.remove(); + } + self.insert(node, self); + self.remove(); + return self; + }; + AstNode.prototype.attr = function (name, value) { + var self = this; + var attrs; + if (typeof name !== 'string') { + if (name !== undefined && name !== null) { + each$1(name, function (value, key) { + self.attr(key, value); + }); + } + return self; + } + if (attrs = self.attributes) { + if (value !== undefined) { + if (value === null) { + if (name in attrs.map) { + delete attrs.map[name]; + var i = attrs.length; + while (i--) { + if (attrs[i].name === name) { + attrs.splice(i, 1); + return self; + } + } + } + return self; + } + if (name in attrs.map) { + var i = attrs.length; + while (i--) { + if (attrs[i].name === name) { + attrs[i].value = value; + break; + } + } + } else { + attrs.push({ + name: name, + value: value + }); + } + attrs.map[name] = value; + return self; + } + return attrs.map[name]; + } + }; + AstNode.prototype.clone = function () { + var self = this; + var clone = new AstNode(self.name, self.type); + var selfAttrs; + if (selfAttrs = self.attributes) { + var cloneAttrs = []; + cloneAttrs.map = {}; + for (var i = 0, l = selfAttrs.length; i < l; i++) { + var selfAttr = selfAttrs[i]; + if (selfAttr.name !== 'id') { + cloneAttrs[cloneAttrs.length] = { + name: selfAttr.name, + value: selfAttr.value + }; + cloneAttrs.map[selfAttr.name] = selfAttr.value; + } + } + clone.attributes = cloneAttrs; + } + clone.value = self.value; + clone.shortEnded = self.shortEnded; + return clone; + }; + AstNode.prototype.wrap = function (wrapper) { + var self = this; + self.parent.insert(wrapper, self); + wrapper.append(self); + return self; + }; + AstNode.prototype.unwrap = function () { + var self = this; + for (var node = self.firstChild; node;) { + var next = node.next; + self.insert(node, self, true); + node = next; + } + self.remove(); + }; + AstNode.prototype.remove = function () { + var self = this, parent = self.parent, next = self.next, prev = self.prev; + if (parent) { + if (parent.firstChild === self) { + parent.firstChild = next; + if (next) { + next.prev = null; + } + } else { + prev.next = next; + } + if (parent.lastChild === self) { + parent.lastChild = prev; + if (prev) { + prev.next = null; + } + } else { + next.prev = prev; + } + self.parent = self.next = self.prev = null; + } + return self; + }; + AstNode.prototype.append = function (node) { + var self = this; + if (node.parent) { + node.remove(); + } + var last = self.lastChild; + if (last) { + last.next = node; + node.prev = last; + self.lastChild = node; + } else { + self.lastChild = self.firstChild = node; + } + node.parent = self; + return node; + }; + AstNode.prototype.insert = function (node, refNode, before) { + if (node.parent) { + node.remove(); + } + var parent = refNode.parent || this; + if (before) { + if (refNode === parent.firstChild) { + parent.firstChild = node; + } else { + refNode.prev.next = node; + } + node.prev = refNode.prev; + node.next = refNode; + refNode.prev = node; + } else { + if (refNode === parent.lastChild) { + parent.lastChild = node; + } else { + refNode.next.prev = node; + } + node.next = refNode.next; + node.prev = refNode; + refNode.next = node; + } + node.parent = parent; + return node; + }; + AstNode.prototype.getAll = function (name) { + var self = this; + var collection = []; + for (var node = self.firstChild; node; node = walk$2(node, self)) { + if (node.name === name) { + collection.push(node); + } + } + return collection; + }; + AstNode.prototype.empty = function () { + var self = this; + if (self.firstChild) { + var nodes = []; + for (var node = self.firstChild; node; node = walk$2(node, self)) { + nodes.push(node); + } + var i = nodes.length; + while (i--) { + var node = nodes[i]; + node.parent = node.firstChild = node.lastChild = node.next = node.prev = null; + } + } + self.firstChild = self.lastChild = null; + return self; + }; + AstNode.prototype.isEmpty = function (elements, whitespace, predicate) { + if (whitespace === void 0) { + whitespace = {}; + } + var self = this; + var node = self.firstChild; + if (isNonEmptyElement(self)) { + return false; + } + if (node) { + do { + if (node.type === 1) { + if (node.attr('data-mce-bogus')) { + continue; + } + if (elements[node.name]) { + return false; + } + if (isNonEmptyElement(node)) { + return false; + } + } + if (node.type === 8) { + return false; + } + if (node.type === 3 && !isEmptyTextNode$1(node)) { + return false; + } + if (node.type === 3 && node.parent && whitespace[node.parent.name] && isWhitespaceText(node.value)) { + return false; + } + if (predicate && predicate(node)) { + return false; + } + } while (node = walk$2(node, self)); + } + return true; + }; + AstNode.prototype.walk = function (prev) { + return walk$2(this, null, prev); + }; + return AstNode; + }(); + + var makeMap$3 = Tools.makeMap; + var Writer = function (settings) { + var html = []; + settings = settings || {}; + var indent = settings.indent; + var indentBefore = makeMap$3(settings.indent_before || ''); + var indentAfter = makeMap$3(settings.indent_after || ''); + var encode = Entities.getEncodeFunc(settings.entity_encoding || 'raw', settings.entities); + var htmlOutput = settings.element_format === 'html'; + return { + start: function (name, attrs, empty) { + var i, l, attr, value; + if (indent && indentBefore[name] && html.length > 0) { + value = html[html.length - 1]; + if (value.length > 0 && value !== '\n') { + html.push('\n'); + } + } + html.push('<', name); + if (attrs) { + for (i = 0, l = attrs.length; i < l; i++) { + attr = attrs[i]; + html.push(' ', attr.name, '="', encode(attr.value, true), '"'); + } + } + if (!empty || htmlOutput) { + html[html.length] = '>'; + } else { + html[html.length] = ' />'; + } + if (empty && indent && indentAfter[name] && html.length > 0) { + value = html[html.length - 1]; + if (value.length > 0 && value !== '\n') { + html.push('\n'); + } + } + }, + end: function (name) { + var value; + html.push(''); + if (indent && indentAfter[name] && html.length > 0) { + value = html[html.length - 1]; + if (value.length > 0 && value !== '\n') { + html.push('\n'); + } + } + }, + text: function (text, raw) { + if (text.length > 0) { + html[html.length] = raw ? text : encode(text); + } + }, + cdata: function (text) { + html.push(''); + }, + comment: function (text) { + html.push(''); + }, + pi: function (name, text) { + if (text) { + html.push(''); + } else { + html.push(''); + } + if (indent) { + html.push('\n'); + } + }, + doctype: function (text) { + html.push('', indent ? '\n' : ''); + }, + reset: function () { + html.length = 0; + }, + getContent: function () { + return html.join('').replace(/\n$/, ''); + } + }; + }; + + var HtmlSerializer = function (settings, schema) { + if (schema === void 0) { + schema = Schema(); + } + var writer = Writer(settings); + settings = settings || {}; + settings.validate = 'validate' in settings ? settings.validate : true; + var serialize = function (node) { + var validate = settings.validate; + var handlers = { + 3: function (node) { + writer.text(node.value, node.raw); + }, + 8: function (node) { + writer.comment(node.value); + }, + 7: function (node) { + writer.pi(node.name, node.value); + }, + 10: function (node) { + writer.doctype(node.value); + }, + 4: function (node) { + writer.cdata(node.value); + }, + 11: function (node) { + if (node = node.firstChild) { + do { + walk(node); + } while (node = node.next); + } + } + }; + writer.reset(); + var walk = function (node) { + var handler = handlers[node.type]; + var name, isEmpty, attrs, attrName, attrValue, sortedAttrs, i, l, elementRule; + if (!handler) { + name = node.name; + isEmpty = node.shortEnded; + attrs = node.attributes; + if (validate && attrs && attrs.length > 1) { + sortedAttrs = []; + sortedAttrs.map = {}; + elementRule = schema.getElementRule(node.name); + if (elementRule) { + for (i = 0, l = elementRule.attributesOrder.length; i < l; i++) { + attrName = elementRule.attributesOrder[i]; + if (attrName in attrs.map) { + attrValue = attrs.map[attrName]; + sortedAttrs.map[attrName] = attrValue; + sortedAttrs.push({ + name: attrName, + value: attrValue + }); + } + } + for (i = 0, l = attrs.length; i < l; i++) { + attrName = attrs[i].name; + if (!(attrName in sortedAttrs.map)) { + attrValue = attrs.map[attrName]; + sortedAttrs.map[attrName] = attrValue; + sortedAttrs.push({ + name: attrName, + value: attrValue + }); + } + } + attrs = sortedAttrs; + } + } + writer.start(node.name, attrs, isEmpty); + if (!isEmpty) { + if (node = node.firstChild) { + do { + walk(node); + } while (node = node.next); + } + writer.end(name); + } + } else { + handler(node); + } + }; + if (node.type === 1 && !settings.inner) { + walk(node); + } else { + handlers[11](node); + } + return writer.getContent(); + }; + return { serialize: serialize }; + }; + + var extractBase64DataUris = function (html) { + var dataImageUri = /data:[^;]+;base64,([a-z0-9\+\/=]+)/gi; + var chunks = []; + var uris = {}; + var prefix = generate$1('img'); + var matches; + var index = 0; + var count = 0; + while (matches = dataImageUri.exec(html)) { + var uri = matches[0]; + var imageId = prefix + '_' + count++; + uris[imageId] = uri; + if (index < matches.index) { + chunks.push(html.substr(index, matches.index - index)); + } + chunks.push(imageId); + index = matches.index + uri.length; + } + if (index === 0) { + return { + prefix: prefix, + uris: uris, + html: html + }; + } else { + if (index < html.length) { + chunks.push(html.substr(index)); + } + return { + prefix: prefix, + uris: uris, + html: chunks.join('') + }; + } + }; + var restoreDataUris = function (html, result) { + return html.replace(new RegExp(result.prefix + '_[0-9]+', 'g'), function (imageId) { + return get$1(result.uris, imageId).getOr(imageId); + }); + }; + var parseDataUri = function (uri) { + var matches = /data:([^;]+);base64,([a-z0-9\+\/=]+)/i.exec(uri); + if (matches) { + return Optional.some({ + type: matches[1], + data: decodeURIComponent(matches[2]) + }); + } else { + return Optional.none(); + } + }; + + var safeSvgDataUrlElements = [ + 'img', + 'video' + ]; + var isValidPrefixAttrName = function (name) { + return name.indexOf('data-') === 0 || name.indexOf('aria-') === 0; + }; + var blockSvgDataUris = function (allowSvgDataUrls, tagName) { + var allowed = isNullable(allowSvgDataUrls) ? contains(safeSvgDataUrlElements, tagName) : allowSvgDataUrls; + return !allowed; + }; + var isInvalidUri = function (settings, uri, tagName) { + if (settings.allow_html_data_urls) { + return false; + } else if (/^data:image\//i.test(uri)) { + return blockSvgDataUris(settings.allow_svg_data_urls, tagName) && /^data:image\/svg\+xml/i.test(uri); + } else { + return /^data:/i.test(uri); + } + }; + var findEndTagIndex = function (schema, html, startIndex) { + var count = 1, index, matches; + var shortEndedElements = schema.getShortEndedElements(); + var tokenRegExp = /<([!?\/])?([A-Za-z0-9\-_\:\.]+)((?:\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\/|\s+)>/g; + tokenRegExp.lastIndex = index = startIndex; + while (matches = tokenRegExp.exec(html)) { + index = tokenRegExp.lastIndex; + if (matches[1] === '/') { + count--; + } else if (!matches[1]) { + if (matches[2] in shortEndedElements) { + continue; + } + count++; + } + if (count === 0) { + break; + } + } + return index; + }; + var isConditionalComment = function (html, startIndex) { + return /^\s*\[if [\w\W]+\]>.*/.test(html.substr(startIndex)); + }; + var findCommentEndIndex = function (html, isBogus, startIndex) { + if (startIndex === void 0) { + startIndex = 0; + } + var lcHtml = html.toLowerCase(); + if (lcHtml.indexOf('[if ', startIndex) !== -1 && isConditionalComment(lcHtml, startIndex)) { + var endIfIndex = lcHtml.indexOf('[endif]', startIndex); + return lcHtml.indexOf('>', endIfIndex); + } else { + if (isBogus) { + var endIndex = lcHtml.indexOf('>', startIndex); + return endIndex !== -1 ? endIndex : lcHtml.length; + } else { + var endCommentRegexp = /--!?>/; + endCommentRegexp.lastIndex = startIndex; + var match = endCommentRegexp.exec(html); + return match ? match.index + match[0].length : lcHtml.length; + } + } + }; + var checkBogusAttribute = function (regExp, attrString) { + var matches = regExp.exec(attrString); + if (matches) { + var name_1 = matches[1]; + var value = matches[2]; + return typeof name_1 === 'string' && name_1.toLowerCase() === 'data-mce-bogus' ? value : null; + } else { + return null; + } + }; + function SaxParser(settings, schema) { + if (schema === void 0) { + schema = Schema(); + } + var noop = function () { + }; + settings = settings || {}; + if (settings.fix_self_closing !== false) { + settings.fix_self_closing = true; + } + var comment = settings.comment ? settings.comment : noop; + var cdata = settings.cdata ? settings.cdata : noop; + var text = settings.text ? settings.text : noop; + var start = settings.start ? settings.start : noop; + var end = settings.end ? settings.end : noop; + var pi = settings.pi ? settings.pi : noop; + var doctype = settings.doctype ? settings.doctype : noop; + var parseInternal = function (base64Extract, format) { + if (format === void 0) { + format = 'html'; + } + var html = base64Extract.html; + var matches, index = 0, value, endRegExp; + var stack = []; + var attrList, i, textData, name; + var isInternalElement, isShortEnded; + var elementRule, isValidElement, attr, attribsValue, validAttributesMap, validAttributePatterns; + var attributesRequired, attributesDefault, attributesForced; + var anyAttributesRequired, attrValue, idCount = 0; + var decode = Entities.decode; + var filteredUrlAttrs = Tools.makeMap('src,href,data,background,formaction,poster,xlink:href'); + var scriptUriRegExp = /((java|vb)script|mhtml):/i; + var parsingMode = format === 'html' ? 0 : 1; + var processEndTag = function (name) { + var pos, i; + pos = stack.length; + while (pos--) { + if (stack[pos].name === name) { + break; + } + } + if (pos >= 0) { + for (i = stack.length - 1; i >= pos; i--) { + name = stack[i]; + if (name.valid) { + end(name.name); + } + } + stack.length = pos; + } + }; + var processText = function (value, raw) { + return text(restoreDataUris(value, base64Extract), raw); + }; + var processComment = function (value) { + if (value === '') { + return; + } + if (value.charAt(0) === '>') { + value = ' ' + value; + } + if (!settings.allow_conditional_comments && value.substr(0, 3).toLowerCase() === '[if') { + value = ' ' + value; + } + comment(restoreDataUris(value, base64Extract)); + }; + var processAttr = function (value) { + return get$1(base64Extract.uris, value).getOr(value); + }; + var processMalformedComment = function (value, startIndex) { + var startTag = value || ''; + var isBogus = !startsWith(startTag, '--'); + var endIndex = findCommentEndIndex(html, isBogus, startIndex); + value = html.substr(startIndex, endIndex - startIndex); + processComment(isBogus ? startTag + value : value); + return endIndex + 1; + }; + var parseAttribute = function (tagName, name, value, val2, val3) { + var attrRule, i; + var trimRegExp = /[\s\u0000-\u001F]+/g; + name = name.toLowerCase(); + value = processAttr(name in fillAttrsMap ? name : decode(value || val2 || val3 || '')); + if (validate && !isInternalElement && isValidPrefixAttrName(name) === false) { + attrRule = validAttributesMap[name]; + if (!attrRule && validAttributePatterns) { + i = validAttributePatterns.length; + while (i--) { + attrRule = validAttributePatterns[i]; + if (attrRule.pattern.test(name)) { + break; + } + } + if (i === -1) { + attrRule = null; + } + } + if (!attrRule) { + return; + } + if (attrRule.validValues && !(value in attrRule.validValues)) { + return; + } + } + if (filteredUrlAttrs[name] && !settings.allow_script_urls) { + var uri = value.replace(trimRegExp, ''); + try { + uri = decodeURIComponent(uri); + } catch (ex) { + uri = unescape(uri); + } + if (scriptUriRegExp.test(uri)) { + return; + } + if (isInvalidUri(settings, uri, tagName)) { + return; + } + } + if (isInternalElement && (name in filteredUrlAttrs || name.indexOf('on') === 0)) { + return; + } + attrList.map[name] = value; + attrList.push({ + name: name, + value: value + }); + }; + var tokenRegExp = new RegExp('<(?:' + '(?:!--([\\w\\W]*?)--!?>)|' + '(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|' + '(?:![Dd][Oo][Cc][Tt][Yy][Pp][Ee]([\\w\\W]*?)>)|' + '(?:!(--)?)|' + '(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|' + '(?:\\/([A-Za-z][A-Za-z0-9\\-_\\:\\.]*)>)|' + '(?:([A-Za-z][A-Za-z0-9\\-_\\:\\.]*)((?:\\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\\/|\\s+)>)' + ')', 'g'); + var attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g; + var shortEndedElements = schema.getShortEndedElements(); + var selfClosing = settings.self_closing_elements || schema.getSelfClosingElements(); + var fillAttrsMap = schema.getBoolAttrs(); + var validate = settings.validate; + var removeInternalElements = settings.remove_internals; + var fixSelfClosing = settings.fix_self_closing; + var specialElements = schema.getSpecialElements(); + var processHtml = html + '>'; + while (matches = tokenRegExp.exec(processHtml)) { + var matchText = matches[0]; + if (index < matches.index) { + processText(decode(html.substr(index, matches.index - index))); + } + if (value = matches[7]) { + value = value.toLowerCase(); + if (value.charAt(0) === ':') { + value = value.substr(1); + } + processEndTag(value); + } else if (value = matches[8]) { + if (matches.index + matchText.length > html.length) { + processText(decode(html.substr(matches.index))); + index = matches.index + matchText.length; + continue; + } + value = value.toLowerCase(); + if (value.charAt(0) === ':') { + value = value.substr(1); + } + isShortEnded = value in shortEndedElements; + if (fixSelfClosing && selfClosing[value] && stack.length > 0 && stack[stack.length - 1].name === value) { + processEndTag(value); + } + var bogusValue = checkBogusAttribute(attrRegExp, matches[9]); + if (bogusValue !== null) { + if (bogusValue === 'all') { + index = findEndTagIndex(schema, html, tokenRegExp.lastIndex); + tokenRegExp.lastIndex = index; + continue; + } + isValidElement = false; + } + if (!validate || (elementRule = schema.getElementRule(value))) { + isValidElement = true; + if (validate) { + validAttributesMap = elementRule.attributes; + validAttributePatterns = elementRule.attributePatterns; + } + if (attribsValue = matches[9]) { + isInternalElement = attribsValue.indexOf('data-mce-type') !== -1; + if (isInternalElement && removeInternalElements) { + isValidElement = false; + } + attrList = []; + attrList.map = {}; + attribsValue.replace(attrRegExp, function (match, name, val, val2, val3) { + parseAttribute(value, name, val, val2, val3); + return ''; + }); + } else { + attrList = []; + attrList.map = {}; + } + if (validate && !isInternalElement) { + attributesRequired = elementRule.attributesRequired; + attributesDefault = elementRule.attributesDefault; + attributesForced = elementRule.attributesForced; + anyAttributesRequired = elementRule.removeEmptyAttrs; + if (anyAttributesRequired && !attrList.length) { + isValidElement = false; + } + if (attributesForced) { + i = attributesForced.length; + while (i--) { + attr = attributesForced[i]; + name = attr.name; + attrValue = attr.value; + if (attrValue === '{$uid}') { + attrValue = 'mce_' + idCount++; + } + attrList.map[name] = attrValue; + attrList.push({ + name: name, + value: attrValue + }); + } + } + if (attributesDefault) { + i = attributesDefault.length; + while (i--) { + attr = attributesDefault[i]; + name = attr.name; + if (!(name in attrList.map)) { + attrValue = attr.value; + if (attrValue === '{$uid}') { + attrValue = 'mce_' + idCount++; + } + attrList.map[name] = attrValue; + attrList.push({ + name: name, + value: attrValue + }); + } + } + } + if (attributesRequired) { + i = attributesRequired.length; + while (i--) { + if (attributesRequired[i] in attrList.map) { + break; + } + } + if (i === -1) { + isValidElement = false; + } + } + if (attr = attrList.map['data-mce-bogus']) { + if (attr === 'all') { + index = findEndTagIndex(schema, html, tokenRegExp.lastIndex); + tokenRegExp.lastIndex = index; + continue; + } + isValidElement = false; + } + } + if (isValidElement) { + start(value, attrList, isShortEnded); + } + } else { + isValidElement = false; + } + if (endRegExp = specialElements[value]) { + endRegExp.lastIndex = index = matches.index + matchText.length; + if (matches = endRegExp.exec(html)) { + if (isValidElement) { + textData = html.substr(index, matches.index - index); + } + index = matches.index + matches[0].length; + } else { + textData = html.substr(index); + index = html.length; + } + if (isValidElement) { + if (textData.length > 0) { + processText(textData, true); + } + end(value); + } + tokenRegExp.lastIndex = index; + continue; + } + if (!isShortEnded) { + if (!attribsValue || attribsValue.indexOf('/') !== attribsValue.length - 1) { + stack.push({ + name: value, + valid: isValidElement + }); + } else if (isValidElement) { + end(value); + } + } + } else if (value = matches[1]) { + processComment(value); + } else if (value = matches[2]) { + var isValidCdataSection = parsingMode === 1 || settings.preserve_cdata || stack.length > 0 && schema.isValidChild(stack[stack.length - 1].name, '#cdata'); + if (isValidCdataSection) { + cdata(value); + } else { + index = processMalformedComment('', matches.index + 2); + tokenRegExp.lastIndex = index; + continue; + } + } else if (value = matches[3]) { + doctype(value); + } else if ((value = matches[4]) || matchText === '= 0; i--) { + value = stack[i]; + if (value.valid) { + end(value.name); + } + } + }; + var parse = function (html, format) { + if (format === void 0) { + format = 'html'; + } + parseInternal(extractBase64DataUris(html), format); + }; + return { parse: parse }; + } + (function (SaxParser) { + SaxParser.findEndTag = findEndTagIndex; + }(SaxParser || (SaxParser = {}))); + var SaxParser$1 = SaxParser; + + var trimHtml = function (tempAttrs, html) { + var trimContentRegExp = new RegExp(['\\s?(' + tempAttrs.join('|') + ')="[^"]+"'].join('|'), 'gi'); + return html.replace(trimContentRegExp, ''); + }; + var trimInternal = function (serializer, html) { + var content = html; + var bogusAllRegExp = /<(\w+) [^>]*data-mce-bogus="all"[^>]*>/g; + var endTagIndex, index, matchLength, matches; + var schema = serializer.schema; + content = trimHtml(serializer.getTempAttrs(), content); + var shortEndedElements = schema.getShortEndedElements(); + while (matches = bogusAllRegExp.exec(content)) { + index = bogusAllRegExp.lastIndex; + matchLength = matches[0].length; + if (shortEndedElements[matches[1]]) { + endTagIndex = index; + } else { + endTagIndex = SaxParser$1.findEndTag(schema, content, index); + } + content = content.substring(0, index - matchLength) + content.substring(endTagIndex); + bogusAllRegExp.lastIndex = index - matchLength; + } + return trim$2(content); + }; + var trimExternal = trimInternal; + + var trimEmptyContents = function (editor, html) { + var blockName = getForcedRootBlock(editor); + var emptyRegExp = new RegExp('^(<' + blockName + '[^>]*>( | |\\s|\xA0|
                                      |)<\\/' + blockName + '>[\r\n]*|
                                      [\r\n]*)$'); + return html.replace(emptyRegExp, ''); + }; + var getContentFromBody = function (editor, args, format, body) { + var content; + args.format = format; + args.get = true; + args.getInner = true; + if (!args.no_events) { + editor.fire('BeforeGetContent', args); + } + if (args.format === 'raw') { + content = Tools.trim(trimExternal(editor.serializer, body.innerHTML)); + } else if (args.format === 'text') { + content = editor.dom.isEmpty(body) ? '' : trim$2(body.innerText || body.textContent); + } else if (args.format === 'tree') { + content = editor.serializer.serialize(body, args); + } else { + content = trimEmptyContents(editor, editor.serializer.serialize(body, args)); + } + if (!contains([ + 'text', + 'tree' + ], args.format) && !isWsPreserveElement(SugarElement.fromDom(body))) { + args.content = Tools.trim(content); + } else { + args.content = content; + } + if (!args.no_events) { + editor.fire('GetContent', args); + } + return args.content; + }; + var getContentInternal = function (editor, args, format) { + return Optional.from(editor.getBody()).fold(constant(args.format === 'tree' ? new AstNode('body', 11) : ''), function (body) { + return getContentFromBody(editor, args, format, body); + }); + }; + + var each$7 = Tools.each; + var ElementUtils = function (dom) { + this.compare = function (node1, node2) { + if (node1.nodeName !== node2.nodeName) { + return false; + } + var getAttribs = function (node) { + var attribs = {}; + each$7(dom.getAttribs(node), function (attr) { + var name = attr.nodeName.toLowerCase(); + if (name.indexOf('_') !== 0 && name !== 'style' && name.indexOf('data-') !== 0) { + attribs[name] = dom.getAttrib(node, name); + } + }); + return attribs; + }; + var compareObjects = function (obj1, obj2) { + var value, name; + for (name in obj1) { + if (obj1.hasOwnProperty(name)) { + value = obj2[name]; + if (typeof value === 'undefined') { + return false; + } + if (obj1[name] !== value) { + return false; + } + delete obj2[name]; + } + } + for (name in obj2) { + if (obj2.hasOwnProperty(name)) { + return false; + } + } + return true; + }; + if (!compareObjects(getAttribs(node1), getAttribs(node2))) { + return false; + } + if (!compareObjects(dom.parseStyle(dom.getAttrib(node1, 'style')), dom.parseStyle(dom.getAttrib(node2, 'style')))) { + return false; + } + return !isBookmarkNode$1(node1) && !isBookmarkNode$1(node2); + }; + }; + + var isChar = function (forward, predicate, pos) { + return Optional.from(pos.container()).filter(isText$1).exists(function (text) { + var delta = forward ? 0 : -1; + return predicate(text.data.charAt(pos.offset() + delta)); + }); + }; + var isBeforeSpace = curry(isChar, true, isWhiteSpace$1); + var isAfterSpace = curry(isChar, false, isWhiteSpace$1); + var isEmptyText = function (pos) { + var container = pos.container(); + return isText$1(container) && (container.data.length === 0 || isZwsp$1(container.data) && BookmarkManager$1.isBookmarkNode(container.parentNode)); + }; + var matchesElementPosition = function (before, predicate) { + return function (pos) { + return Optional.from(getChildNodeAtRelativeOffset(before ? 0 : -1, pos)).filter(predicate).isSome(); + }; + }; + var isImageBlock = function (node) { + return isImg(node) && get$5(SugarElement.fromDom(node), 'display') === 'block'; + }; + var isCefNode = function (node) { + return isContentEditableFalse(node) && !isBogusAll(node); + }; + var isBeforeImageBlock = matchesElementPosition(true, isImageBlock); + var isAfterImageBlock = matchesElementPosition(false, isImageBlock); + var isBeforeMedia = matchesElementPosition(true, isMedia); + var isAfterMedia = matchesElementPosition(false, isMedia); + var isBeforeTable = matchesElementPosition(true, isTable); + var isAfterTable = matchesElementPosition(false, isTable); + var isBeforeContentEditableFalse = matchesElementPosition(true, isCefNode); + var isAfterContentEditableFalse = matchesElementPosition(false, isCefNode); + + var getLastChildren$1 = function (elm) { + var children = []; + var rawNode = elm.dom; + while (rawNode) { + children.push(SugarElement.fromDom(rawNode)); + rawNode = rawNode.lastChild; + } + return children; + }; + var removeTrailingBr = function (elm) { + var allBrs = descendants$1(elm, 'br'); + var brs = filter(getLastChildren$1(elm).slice(-1), isBr$1); + if (allBrs.length === brs.length) { + each(brs, remove); + } + }; + var fillWithPaddingBr = function (elm) { + empty(elm); + append(elm, SugarElement.fromHtml('
                                      ')); + }; + var trimBlockTrailingBr = function (elm) { + lastChild(elm).each(function (lastChild) { + prevSibling(lastChild).each(function (lastChildPrevSibling) { + if (isBlock(elm) && isBr$1(lastChild) && isBlock(lastChildPrevSibling)) { + remove(lastChild); + } + }); + }); + }; + + var dropLast = function (xs) { + return xs.slice(0, -1); + }; + var parentsUntil$1 = function (start, root, predicate) { + if (contains$2(root, start)) { + return dropLast(parents(start, function (elm) { + return predicate(elm) || eq$2(elm, root); + })); + } else { + return []; + } + }; + var parents$1 = function (start, root) { + return parentsUntil$1(start, root, never); + }; + var parentsAndSelf = function (start, root) { + return [start].concat(parents$1(start, root)); + }; + + var navigateIgnoreEmptyTextNodes = function (forward, root, from) { + return navigateIgnore(forward, root, from, isEmptyText); + }; + var getClosestBlock = function (root, pos) { + return find(parentsAndSelf(SugarElement.fromDom(pos.container()), root), isBlock); + }; + var isAtBeforeAfterBlockBoundary = function (forward, root, pos) { + return navigateIgnoreEmptyTextNodes(forward, root.dom, pos).forall(function (newPos) { + return getClosestBlock(root, pos).fold(function () { + return isInSameBlock(newPos, pos, root.dom) === false; + }, function (fromBlock) { + return isInSameBlock(newPos, pos, root.dom) === false && contains$2(fromBlock, SugarElement.fromDom(newPos.container())); + }); + }); + }; + var isAtBlockBoundary$1 = function (forward, root, pos) { + return getClosestBlock(root, pos).fold(function () { + return navigateIgnoreEmptyTextNodes(forward, root.dom, pos).forall(function (newPos) { + return isInSameBlock(newPos, pos, root.dom) === false; + }); + }, function (parent) { + return navigateIgnoreEmptyTextNodes(forward, parent.dom, pos).isNone(); + }); + }; + var isAtStartOfBlock = curry(isAtBlockBoundary$1, false); + var isAtEndOfBlock = curry(isAtBlockBoundary$1, true); + var isBeforeBlock = curry(isAtBeforeAfterBlockBoundary, false); + var isAfterBlock = curry(isAtBeforeAfterBlockBoundary, true); + + var isBr$5 = function (pos) { + return getElementFromPosition(pos).exists(isBr$1); + }; + var findBr = function (forward, root, pos) { + var parentBlocks = filter(parentsAndSelf(SugarElement.fromDom(pos.container()), root), isBlock); + var scope = head(parentBlocks).getOr(root); + return fromPosition(forward, scope.dom, pos).filter(isBr$5); + }; + var isBeforeBr = function (root, pos) { + return getElementFromPosition(pos).exists(isBr$1) || findBr(true, root, pos).isSome(); + }; + var isAfterBr = function (root, pos) { + return getElementFromPrevPosition(pos).exists(isBr$1) || findBr(false, root, pos).isSome(); + }; + var findPreviousBr = curry(findBr, false); + var findNextBr = curry(findBr, true); + + var isInMiddleOfText = function (pos) { + return CaretPosition.isTextPosition(pos) && !pos.isAtStart() && !pos.isAtEnd(); + }; + var getClosestBlock$1 = function (root, pos) { + var parentBlocks = filter(parentsAndSelf(SugarElement.fromDom(pos.container()), root), isBlock); + return head(parentBlocks).getOr(root); + }; + var hasSpaceBefore = function (root, pos) { + if (isInMiddleOfText(pos)) { + return isAfterSpace(pos); + } else { + return isAfterSpace(pos) || prevPosition(getClosestBlock$1(root, pos).dom, pos).exists(isAfterSpace); + } + }; + var hasSpaceAfter = function (root, pos) { + if (isInMiddleOfText(pos)) { + return isBeforeSpace(pos); + } else { + return isBeforeSpace(pos) || nextPosition(getClosestBlock$1(root, pos).dom, pos).exists(isBeforeSpace); + } + }; + var isPreValue = function (value) { + return contains([ + 'pre', + 'pre-wrap' + ], value); + }; + var isInPre = function (pos) { + return getElementFromPosition(pos).bind(function (elm) { + return closest(elm, isElement); + }).exists(function (elm) { + return isPreValue(get$5(elm, 'white-space')); + }); + }; + var isAtBeginningOfBody = function (root, pos) { + return prevPosition(root.dom, pos).isNone(); + }; + var isAtEndOfBody = function (root, pos) { + return nextPosition(root.dom, pos).isNone(); + }; + var isAtLineBoundary = function (root, pos) { + return isAtBeginningOfBody(root, pos) || isAtEndOfBody(root, pos) || isAtStartOfBlock(root, pos) || isAtEndOfBlock(root, pos) || isAfterBr(root, pos) || isBeforeBr(root, pos); + }; + var needsToHaveNbsp = function (root, pos) { + if (isInPre(pos)) { + return false; + } else { + return isAtLineBoundary(root, pos) || hasSpaceBefore(root, pos) || hasSpaceAfter(root, pos); + } + }; + var needsToBeNbspLeft = function (root, pos) { + if (isInPre(pos)) { + return false; + } else { + return isAtStartOfBlock(root, pos) || isBeforeBlock(root, pos) || isAfterBr(root, pos) || hasSpaceBefore(root, pos); + } + }; + var leanRight = function (pos) { + var container = pos.container(); + var offset = pos.offset(); + if (isText$1(container) && offset < container.data.length) { + return CaretPosition(container, offset + 1); + } else { + return pos; + } + }; + var needsToBeNbspRight = function (root, pos) { + if (isInPre(pos)) { + return false; + } else { + return isAtEndOfBlock(root, pos) || isAfterBlock(root, pos) || isBeforeBr(root, pos) || hasSpaceAfter(root, pos); + } + }; + var needsToBeNbsp = function (root, pos) { + return needsToBeNbspLeft(root, pos) || needsToBeNbspRight(root, leanRight(pos)); + }; + var isNbspAt = function (text, offset) { + return isNbsp(text.charAt(offset)); + }; + var hasNbsp = function (pos) { + var container = pos.container(); + return isText$1(container) && contains$1(container.data, nbsp); + }; + var normalizeNbspMiddle = function (text) { + var chars = text.split(''); + return map(chars, function (chr, i) { + if (isNbsp(chr) && i > 0 && i < chars.length - 1 && isContent$1(chars[i - 1]) && isContent$1(chars[i + 1])) { + return ' '; + } else { + return chr; + } + }).join(''); + }; + var normalizeNbspAtStart = function (root, node) { + var text = node.data; + var firstPos = CaretPosition(node, 0); + if (isNbspAt(text, 0) && !needsToBeNbsp(root, firstPos)) { + node.data = ' ' + text.slice(1); + return true; + } else { + return false; + } + }; + var normalizeNbspInMiddleOfTextNode = function (node) { + var text = node.data; + var newText = normalizeNbspMiddle(text); + if (newText !== text) { + node.data = newText; + return true; + } else { + return false; + } + }; + var normalizeNbspAtEnd = function (root, node) { + var text = node.data; + var lastPos = CaretPosition(node, text.length - 1); + if (isNbspAt(text, text.length - 1) && !needsToBeNbsp(root, lastPos)) { + node.data = text.slice(0, -1) + ' '; + return true; + } else { + return false; + } + }; + var normalizeNbsps = function (root, pos) { + return Optional.some(pos).filter(hasNbsp).bind(function (pos) { + var container = pos.container(); + var normalized = normalizeNbspAtStart(root, container) || normalizeNbspInMiddleOfTextNode(container) || normalizeNbspAtEnd(root, container); + return normalized ? Optional.some(pos) : Optional.none(); + }); + }; + var normalizeNbspsInEditor = function (editor) { + var root = SugarElement.fromDom(editor.getBody()); + if (editor.selection.isCollapsed()) { + normalizeNbsps(root, CaretPosition.fromRangeStart(editor.selection.getRng())).each(function (pos) { + editor.selection.setRng(pos.toRange()); + }); + } + }; + + var normalizeContent = function (content, isStartOfContent, isEndOfContent) { + var result = foldl(content, function (acc, c) { + if (isWhiteSpace$1(c) || isNbsp(c)) { + if (acc.previousCharIsSpace || acc.str === '' && isStartOfContent || acc.str.length === content.length - 1 && isEndOfContent) { + return { + previousCharIsSpace: false, + str: acc.str + nbsp + }; + } else { + return { + previousCharIsSpace: true, + str: acc.str + ' ' + }; + } + } else { + return { + previousCharIsSpace: false, + str: acc.str + c + }; + } + }, { + previousCharIsSpace: false, + str: '' + }); + return result.str; + }; + var normalize$1 = function (node, offset, count) { + if (count === 0) { + return; + } + var elm = SugarElement.fromDom(node); + var root = ancestor(elm, isBlock).getOr(elm); + var whitespace = node.data.slice(offset, offset + count); + var isEndOfContent = offset + count >= node.data.length && needsToBeNbspRight(root, CaretPosition$1(node, node.data.length)); + var isStartOfContent = offset === 0 && needsToBeNbspLeft(root, CaretPosition$1(node, 0)); + node.replaceData(offset, count, normalizeContent(whitespace, isStartOfContent, isEndOfContent)); + }; + var normalizeWhitespaceAfter = function (node, offset) { + var content = node.data.slice(offset); + var whitespaceCount = content.length - lTrim(content).length; + return normalize$1(node, offset, whitespaceCount); + }; + var normalizeWhitespaceBefore = function (node, offset) { + var content = node.data.slice(0, offset); + var whitespaceCount = content.length - rTrim(content).length; + return normalize$1(node, offset - whitespaceCount, whitespaceCount); + }; + var mergeTextNodes = function (prevNode, nextNode, normalizeWhitespace, mergeToPrev) { + if (mergeToPrev === void 0) { + mergeToPrev = true; + } + var whitespaceOffset = rTrim(prevNode.data).length; + var newNode = mergeToPrev ? prevNode : nextNode; + var removeNode = mergeToPrev ? nextNode : prevNode; + if (mergeToPrev) { + newNode.appendData(removeNode.data); + } else { + newNode.insertData(0, removeNode.data); + } + remove(SugarElement.fromDom(removeNode)); + if (normalizeWhitespace) { + normalizeWhitespaceAfter(newNode, whitespaceOffset); + } + return newNode; + }; + + var needsReposition = function (pos, elm) { + var container = pos.container(); + var offset = pos.offset(); + return CaretPosition$1.isTextPosition(pos) === false && container === elm.parentNode && offset > CaretPosition$1.before(elm).offset(); + }; + var reposition = function (elm, pos) { + return needsReposition(pos, elm) ? CaretPosition$1(pos.container(), pos.offset() - 1) : pos; + }; + var beforeOrStartOf = function (node) { + return isText$1(node) ? CaretPosition$1(node, 0) : CaretPosition$1.before(node); + }; + var afterOrEndOf = function (node) { + return isText$1(node) ? CaretPosition$1(node, node.data.length) : CaretPosition$1.after(node); + }; + var getPreviousSiblingCaretPosition = function (elm) { + if (isCaretCandidate(elm.previousSibling)) { + return Optional.some(afterOrEndOf(elm.previousSibling)); + } else { + return elm.previousSibling ? lastPositionIn(elm.previousSibling) : Optional.none(); + } + }; + var getNextSiblingCaretPosition = function (elm) { + if (isCaretCandidate(elm.nextSibling)) { + return Optional.some(beforeOrStartOf(elm.nextSibling)); + } else { + return elm.nextSibling ? firstPositionIn(elm.nextSibling) : Optional.none(); + } + }; + var findCaretPositionBackwardsFromElm = function (rootElement, elm) { + var startPosition = CaretPosition$1.before(elm.previousSibling ? elm.previousSibling : elm.parentNode); + return prevPosition(rootElement, startPosition).fold(function () { + return nextPosition(rootElement, CaretPosition$1.after(elm)); + }, Optional.some); + }; + var findCaretPositionForwardsFromElm = function (rootElement, elm) { + return nextPosition(rootElement, CaretPosition$1.after(elm)).fold(function () { + return prevPosition(rootElement, CaretPosition$1.before(elm)); + }, Optional.some); + }; + var findCaretPositionBackwards = function (rootElement, elm) { + return getPreviousSiblingCaretPosition(elm).orThunk(function () { + return getNextSiblingCaretPosition(elm); + }).orThunk(function () { + return findCaretPositionBackwardsFromElm(rootElement, elm); + }); + }; + var findCaretPositionForward = function (rootElement, elm) { + return getNextSiblingCaretPosition(elm).orThunk(function () { + return getPreviousSiblingCaretPosition(elm); + }).orThunk(function () { + return findCaretPositionForwardsFromElm(rootElement, elm); + }); + }; + var findCaretPosition$1 = function (forward, rootElement, elm) { + return forward ? findCaretPositionForward(rootElement, elm) : findCaretPositionBackwards(rootElement, elm); + }; + var findCaretPosOutsideElmAfterDelete = function (forward, rootElement, elm) { + return findCaretPosition$1(forward, rootElement, elm).map(curry(reposition, elm)); + }; + var setSelection = function (editor, forward, pos) { + pos.fold(function () { + editor.focus(); + }, function (pos) { + editor.selection.setRng(pos.toRange(), forward); + }); + }; + var eqRawNode = function (rawNode) { + return function (elm) { + return elm.dom === rawNode; + }; + }; + var isBlock$2 = function (editor, elm) { + return elm && has(editor.schema.getBlockElements(), name(elm)); + }; + var paddEmptyBlock = function (elm) { + if (isEmpty(elm)) { + var br = SugarElement.fromHtml('
                                      '); + empty(elm); + append(elm, br); + return Optional.some(CaretPosition$1.before(br.dom)); + } else { + return Optional.none(); + } + }; + var deleteNormalized = function (elm, afterDeletePosOpt, normalizeWhitespace) { + var prevTextOpt = prevSibling(elm).filter(isText); + var nextTextOpt = nextSibling(elm).filter(isText); + remove(elm); + return lift3(prevTextOpt, nextTextOpt, afterDeletePosOpt, function (prev, next, pos) { + var prevNode = prev.dom, nextNode = next.dom; + var offset = prevNode.data.length; + mergeTextNodes(prevNode, nextNode, normalizeWhitespace); + return pos.container() === nextNode ? CaretPosition$1(prevNode, offset) : pos; + }).orThunk(function () { + if (normalizeWhitespace) { + prevTextOpt.each(function (elm) { + return normalizeWhitespaceBefore(elm.dom, elm.dom.length); + }); + nextTextOpt.each(function (elm) { + return normalizeWhitespaceAfter(elm.dom, 0); + }); + } + return afterDeletePosOpt; + }); + }; + var isInlineElement = function (editor, element) { + return has(editor.schema.getTextInlineElements(), name(element)); + }; + var deleteElement = function (editor, forward, elm, moveCaret) { + if (moveCaret === void 0) { + moveCaret = true; + } + var afterDeletePos = findCaretPosOutsideElmAfterDelete(forward, editor.getBody(), elm.dom); + var parentBlock = ancestor(elm, curry(isBlock$2, editor), eqRawNode(editor.getBody())); + var normalizedAfterDeletePos = deleteNormalized(elm, afterDeletePos, isInlineElement(editor, elm)); + if (editor.dom.isEmpty(editor.getBody())) { + editor.setContent(''); + editor.selection.setCursorLocation(); + } else { + parentBlock.bind(paddEmptyBlock).fold(function () { + if (moveCaret) { + setSelection(editor, forward, normalizedAfterDeletePos); + } + }, function (paddPos) { + if (moveCaret) { + setSelection(editor, forward, Optional.some(paddPos)); + } + }); + } + }; + + var tableCellRng = function (start, end) { + return { + start: start, + end: end + }; + }; + var tableSelection = function (rng, table, cells) { + return { + rng: rng, + table: table, + cells: cells + }; + }; + var deleteAction = Adt.generate([ + { removeTable: ['element'] }, + { emptyCells: ['cells'] }, + { + deleteCellSelection: [ + 'rng', + 'cell' + ] + } + ]); + var isRootFromElement = function (root) { + return function (cur) { + return eq$2(root, cur); + }; + }; + var getClosestCell = function (container, isRoot) { + return closest$1(SugarElement.fromDom(container), 'td,th', isRoot); + }; + var getClosestTable = function (cell, isRoot) { + return ancestor$1(cell, 'table', isRoot); + }; + var isExpandedCellRng = function (cellRng) { + return !eq$2(cellRng.start, cellRng.end); + }; + var getTableFromCellRng = function (cellRng, isRoot) { + return getClosestTable(cellRng.start, isRoot).bind(function (startParentTable) { + return getClosestTable(cellRng.end, isRoot).bind(function (endParentTable) { + return someIf(eq$2(startParentTable, endParentTable), startParentTable); + }); + }); + }; + var isSingleCellTable = function (cellRng, isRoot) { + return !isExpandedCellRng(cellRng) && getTableFromCellRng(cellRng, isRoot).exists(function (table) { + var rows = table.dom.rows; + return rows.length === 1 && rows[0].cells.length === 1; + }); + }; + var getTableCells = function (table) { + return descendants$1(table, 'td,th'); + }; + var getCellRng = function (rng, isRoot) { + var startCell = getClosestCell(rng.startContainer, isRoot); + var endCell = getClosestCell(rng.endContainer, isRoot); + return lift2(startCell, endCell, tableCellRng); + }; + var getCellRangeFromStartTable = function (cellRng, isRoot) { + return getClosestTable(cellRng.start, isRoot).bind(function (table) { + return last(getTableCells(table)).map(function (endCell) { + return tableCellRng(cellRng.start, endCell); + }); + }); + }; + var partialSelection = function (isRoot, rng) { + var startCell = getClosestCell(rng.startContainer, isRoot); + var endCell = getClosestCell(rng.endContainer, isRoot); + return rng.collapsed ? Optional.none() : lift2(startCell, endCell, tableCellRng).fold(function () { + return startCell.fold(function () { + return endCell.bind(function (endCell) { + return getClosestTable(endCell, isRoot).bind(function (table) { + return head(getTableCells(table)).map(function (startCell) { + return tableCellRng(startCell, endCell); + }); + }); + }); + }, function (startCell) { + return getClosestTable(startCell, isRoot).bind(function (table) { + return last(getTableCells(table)).map(function (endCell) { + return tableCellRng(startCell, endCell); + }); + }); + }); + }, function (cellRng) { + return isWithinSameTable(isRoot, cellRng) ? Optional.none() : getCellRangeFromStartTable(cellRng, isRoot); + }); + }; + var isWithinSameTable = function (isRoot, cellRng) { + return getTableFromCellRng(cellRng, isRoot).isSome(); + }; + var getTableSelectionFromCellRng = function (cellRng, isRoot) { + return getTableFromCellRng(cellRng, isRoot).map(function (table) { + return tableSelection(cellRng, table, getTableCells(table)); + }); + }; + var getTableSelection = function (optCellRng, rng, isRoot) { + return optCellRng.filter(function (cellRng) { + return isExpandedCellRng(cellRng) && isWithinSameTable(isRoot, cellRng); + }).orThunk(function () { + return partialSelection(isRoot, rng); + }).bind(function (cRng) { + return getTableSelectionFromCellRng(cRng, isRoot); + }); + }; + var getCellIndex = function (cells, cell) { + return findIndex(cells, function (x) { + return eq$2(x, cell); + }); + }; + var getSelectedCells = function (tableSelection) { + return lift2(getCellIndex(tableSelection.cells, tableSelection.rng.start), getCellIndex(tableSelection.cells, tableSelection.rng.end), function (startIndex, endIndex) { + return tableSelection.cells.slice(startIndex, endIndex + 1); + }); + }; + var isSingleCellTableContentSelected = function (optCellRng, rng, isRoot) { + return optCellRng.filter(function (cellRng) { + return isSingleCellTable(cellRng, isRoot) && hasAllContentsSelected(cellRng.start, rng); + }).map(function (cellRng) { + return cellRng.start; + }); + }; + var getAction = function (tableSelection) { + return getSelectedCells(tableSelection).map(function (selected) { + var cells = tableSelection.cells; + return selected.length === cells.length ? deleteAction.removeTable(tableSelection.table) : deleteAction.emptyCells(selected); + }); + }; + var getActionFromRange = function (root, rng) { + var isRoot = isRootFromElement(root); + var optCellRng = getCellRng(rng, isRoot); + return isSingleCellTableContentSelected(optCellRng, rng, isRoot).map(function (cell) { + return deleteAction.deleteCellSelection(rng, cell); + }).orThunk(function () { + return getTableSelection(optCellRng, rng, isRoot).bind(getAction); + }); + }; + + var freefallRtl = function (root) { + var child = isComment(root) ? prevSibling(root) : lastChild(root); + return child.bind(freefallRtl).orThunk(function () { + return Optional.some(root); + }); + }; + var emptyCells = function (editor, cells) { + each(cells, fillWithPaddingBr); + editor.selection.setCursorLocation(cells[0].dom, 0); + return true; + }; + var deleteCellContents = function (editor, rng, cell) { + rng.deleteContents(); + var lastNode = freefallRtl(cell).getOr(cell); + var lastBlock = SugarElement.fromDom(editor.dom.getParent(lastNode.dom, editor.dom.isBlock)); + if (isEmpty(lastBlock)) { + fillWithPaddingBr(lastBlock); + editor.selection.setCursorLocation(lastBlock.dom, 0); + } + if (!eq$2(cell, lastBlock)) { + var additionalCleanupNodes = parent(lastBlock).is(cell) ? [] : siblings(lastBlock); + each(additionalCleanupNodes.concat(children(cell)), function (node) { + if (!eq$2(node, lastBlock) && !contains$2(node, lastBlock)) { + remove(node); + } + }); + } + return true; + }; + var deleteTableElement = function (editor, table) { + deleteElement(editor, false, table); + return true; + }; + var deleteCellRange = function (editor, rootElm, rng) { + return getActionFromRange(rootElm, rng).map(function (action) { + return action.fold(curry(deleteTableElement, editor), curry(emptyCells, editor), curry(deleteCellContents, editor)); + }); + }; + var deleteCaptionRange = function (editor, caption) { + return emptyElement(editor, caption); + }; + var deleteTableRange = function (editor, rootElm, rng, startElm) { + return getParentCaption(rootElm, startElm).fold(function () { + return deleteCellRange(editor, rootElm, rng); + }, function (caption) { + return deleteCaptionRange(editor, caption); + }).getOr(false); + }; + var deleteRange = function (editor, startElm) { + var rootNode = SugarElement.fromDom(editor.getBody()); + var rng = editor.selection.getRng(); + var selectedCells = getCellsFromEditor(editor); + return selectedCells.length !== 0 ? emptyCells(editor, selectedCells) : deleteTableRange(editor, rootNode, rng, startElm); + }; + var getParentCell = function (rootElm, elm) { + return find(parentsAndSelf(elm, rootElm), isTableCell$1); + }; + var getParentCaption = function (rootElm, elm) { + return find(parentsAndSelf(elm, rootElm), function (elm) { + return name(elm) === 'caption'; + }); + }; + var deleteBetweenCells = function (editor, rootElm, forward, fromCell, from) { + return navigate(forward, editor.getBody(), from).bind(function (to) { + return getParentCell(rootElm, SugarElement.fromDom(to.getNode())).map(function (toCell) { + return eq$2(toCell, fromCell) === false; + }); + }); + }; + var emptyElement = function (editor, elm) { + fillWithPaddingBr(elm); + editor.selection.setCursorLocation(elm.dom, 0); + return Optional.some(true); + }; + var isDeleteOfLastCharPos = function (fromCaption, forward, from, to) { + return firstPositionIn(fromCaption.dom).bind(function (first) { + return lastPositionIn(fromCaption.dom).map(function (last) { + return forward ? from.isEqual(first) && to.isEqual(last) : from.isEqual(last) && to.isEqual(first); + }); + }).getOr(true); + }; + var emptyCaretCaption = function (editor, elm) { + return emptyElement(editor, elm); + }; + var validateCaretCaption = function (rootElm, fromCaption, to) { + return getParentCaption(rootElm, SugarElement.fromDom(to.getNode())).map(function (toCaption) { + return eq$2(toCaption, fromCaption) === false; + }); + }; + var deleteCaretInsideCaption = function (editor, rootElm, forward, fromCaption, from) { + return navigate(forward, editor.getBody(), from).bind(function (to) { + return isDeleteOfLastCharPos(fromCaption, forward, from, to) ? emptyCaretCaption(editor, fromCaption) : validateCaretCaption(rootElm, fromCaption, to); + }).or(Optional.some(true)); + }; + var deleteCaretCells = function (editor, forward, rootElm, startElm) { + var from = CaretPosition$1.fromRangeStart(editor.selection.getRng()); + return getParentCell(rootElm, startElm).bind(function (fromCell) { + return isEmpty(fromCell) ? emptyElement(editor, fromCell) : deleteBetweenCells(editor, rootElm, forward, fromCell, from); + }).getOr(false); + }; + var deleteCaretCaption = function (editor, forward, rootElm, fromCaption) { + var from = CaretPosition$1.fromRangeStart(editor.selection.getRng()); + return isEmpty(fromCaption) ? emptyElement(editor, fromCaption) : deleteCaretInsideCaption(editor, rootElm, forward, fromCaption, from); + }; + var isNearTable = function (forward, pos) { + return forward ? isBeforeTable(pos) : isAfterTable(pos); + }; + var isBeforeOrAfterTable = function (editor, forward) { + var fromPos = CaretPosition$1.fromRangeStart(editor.selection.getRng()); + return isNearTable(forward, fromPos) || fromPosition(forward, editor.getBody(), fromPos).exists(function (pos) { + return isNearTable(forward, pos); + }); + }; + var deleteCaret = function (editor, forward, startElm) { + var rootElm = SugarElement.fromDom(editor.getBody()); + return getParentCaption(rootElm, startElm).fold(function () { + return deleteCaretCells(editor, forward, rootElm, startElm) || isBeforeOrAfterTable(editor, forward); + }, function (fromCaption) { + return deleteCaretCaption(editor, forward, rootElm, fromCaption).getOr(false); + }); + }; + var backspaceDelete = function (editor, forward) { + var startElm = SugarElement.fromDom(editor.selection.getStart(true)); + var cells = getCellsFromEditor(editor); + return editor.selection.isCollapsed() && cells.length === 0 ? deleteCaret(editor, forward, startElm) : deleteRange(editor, startElm); + }; + + var createRange$1 = function (sc, so, ec, eo) { + var rng = document.createRange(); + rng.setStart(sc, so); + rng.setEnd(ec, eo); + return rng; + }; + var normalizeBlockSelectionRange = function (rng) { + var startPos = CaretPosition$1.fromRangeStart(rng); + var endPos = CaretPosition$1.fromRangeEnd(rng); + var rootNode = rng.commonAncestorContainer; + return fromPosition(false, rootNode, endPos).map(function (newEndPos) { + if (!isInSameBlock(startPos, endPos, rootNode) && isInSameBlock(startPos, newEndPos, rootNode)) { + return createRange$1(startPos.container(), startPos.offset(), newEndPos.container(), newEndPos.offset()); + } else { + return rng; + } + }).getOr(rng); + }; + var normalize$2 = function (rng) { + return rng.collapsed ? rng : normalizeBlockSelectionRange(rng); + }; + + var hasOnlyOneChild = function (node) { + return node.firstChild && node.firstChild === node.lastChild; + }; + var isPaddingNode = function (node) { + return node.name === 'br' || node.value === nbsp; + }; + var isPaddedEmptyBlock = function (schema, node) { + var blockElements = schema.getBlockElements(); + return blockElements[node.name] && hasOnlyOneChild(node) && isPaddingNode(node.firstChild); + }; + var isEmptyFragmentElement = function (schema, node) { + var nonEmptyElements = schema.getNonEmptyElements(); + return node && (node.isEmpty(nonEmptyElements) || isPaddedEmptyBlock(schema, node)); + }; + var isListFragment = function (schema, fragment) { + var firstChild = fragment.firstChild; + var lastChild = fragment.lastChild; + if (firstChild && firstChild.name === 'meta') { + firstChild = firstChild.next; + } + if (lastChild && lastChild.attr('id') === 'mce_marker') { + lastChild = lastChild.prev; + } + if (isEmptyFragmentElement(schema, lastChild)) { + lastChild = lastChild.prev; + } + if (!firstChild || firstChild !== lastChild) { + return false; + } + return firstChild.name === 'ul' || firstChild.name === 'ol'; + }; + var cleanupDomFragment = function (domFragment) { + var firstChild = domFragment.firstChild; + var lastChild = domFragment.lastChild; + if (firstChild && firstChild.nodeName === 'META') { + firstChild.parentNode.removeChild(firstChild); + } + if (lastChild && lastChild.id === 'mce_marker') { + lastChild.parentNode.removeChild(lastChild); + } + return domFragment; + }; + var toDomFragment = function (dom, serializer, fragment) { + var html = serializer.serialize(fragment); + var domFragment = dom.createFragment(html); + return cleanupDomFragment(domFragment); + }; + var listItems$1 = function (elm) { + return Tools.grep(elm.childNodes, function (child) { + return child.nodeName === 'LI'; + }); + }; + var isPadding = function (node) { + return node.data === nbsp || isBr(node); + }; + var isListItemPadded = function (node) { + return node && node.firstChild && node.firstChild === node.lastChild && isPadding(node.firstChild); + }; + var isEmptyOrPadded = function (elm) { + return !elm.firstChild || isListItemPadded(elm); + }; + var trimListItems = function (elms) { + return elms.length > 0 && isEmptyOrPadded(elms[elms.length - 1]) ? elms.slice(0, -1) : elms; + }; + var getParentLi = function (dom, node) { + var parentBlock = dom.getParent(node, dom.isBlock); + return parentBlock && parentBlock.nodeName === 'LI' ? parentBlock : null; + }; + var isParentBlockLi = function (dom, node) { + return !!getParentLi(dom, node); + }; + var getSplit = function (parentNode, rng) { + var beforeRng = rng.cloneRange(); + var afterRng = rng.cloneRange(); + beforeRng.setStartBefore(parentNode); + afterRng.setEndAfter(parentNode); + return [ + beforeRng.cloneContents(), + afterRng.cloneContents() + ]; + }; + var findFirstIn = function (node, rootNode) { + var caretPos = CaretPosition$1.before(node); + var caretWalker = CaretWalker(rootNode); + var newCaretPos = caretWalker.next(caretPos); + return newCaretPos ? newCaretPos.toRange() : null; + }; + var findLastOf = function (node, rootNode) { + var caretPos = CaretPosition$1.after(node); + var caretWalker = CaretWalker(rootNode); + var newCaretPos = caretWalker.prev(caretPos); + return newCaretPos ? newCaretPos.toRange() : null; + }; + var insertMiddle = function (target, elms, rootNode, rng) { + var parts = getSplit(target, rng); + var parentElm = target.parentNode; + parentElm.insertBefore(parts[0], target); + Tools.each(elms, function (li) { + parentElm.insertBefore(li, target); + }); + parentElm.insertBefore(parts[1], target); + parentElm.removeChild(target); + return findLastOf(elms[elms.length - 1], rootNode); + }; + var insertBefore = function (target, elms, rootNode) { + var parentElm = target.parentNode; + Tools.each(elms, function (elm) { + parentElm.insertBefore(elm, target); + }); + return findFirstIn(target, rootNode); + }; + var insertAfter = function (target, elms, rootNode, dom) { + dom.insertAfter(elms.reverse(), target); + return findLastOf(elms[0], rootNode); + }; + var insertAtCaret = function (serializer, dom, rng, fragment) { + var domFragment = toDomFragment(dom, serializer, fragment); + var liTarget = getParentLi(dom, rng.startContainer); + var liElms = trimListItems(listItems$1(domFragment.firstChild)); + var BEGINNING = 1, END = 2; + var rootNode = dom.getRoot(); + var isAt = function (location) { + var caretPos = CaretPosition$1.fromRangeStart(rng); + var caretWalker = CaretWalker(dom.getRoot()); + var newPos = location === BEGINNING ? caretWalker.prev(caretPos) : caretWalker.next(caretPos); + return newPos ? getParentLi(dom, newPos.getNode()) !== liTarget : true; + }; + if (isAt(BEGINNING)) { + return insertBefore(liTarget, liElms, rootNode); + } else if (isAt(END)) { + return insertAfter(liTarget, liElms, rootNode, dom); + } + return insertMiddle(liTarget, liElms, rootNode, rng); + }; + + var trimOrPadLeftRight = function (dom, rng, html) { + var root = SugarElement.fromDom(dom.getRoot()); + if (needsToBeNbspLeft(root, CaretPosition$1.fromRangeStart(rng))) { + html = html.replace(/^ /, ' '); + } else { + html = html.replace(/^ /, ' '); + } + if (needsToBeNbspRight(root, CaretPosition$1.fromRangeEnd(rng))) { + html = html.replace(/( | )()?$/, ' '); + } else { + html = html.replace(/ ()?$/, ' '); + } + return html; + }; + + var isTableCell$4 = isTableCell; + var isTableCellContentSelected = function (dom, rng, cell) { + if (cell !== null) { + var endCell = dom.getParent(rng.endContainer, isTableCell$4); + return cell === endCell && hasAllContentsSelected(SugarElement.fromDom(cell), rng); + } else { + return false; + } + }; + var validInsertion = function (editor, value, parentNode) { + if (parentNode.getAttribute('data-mce-bogus') === 'all') { + parentNode.parentNode.insertBefore(editor.dom.createFragment(value), parentNode); + } else { + var node = parentNode.firstChild; + var node2 = parentNode.lastChild; + if (!node || node === node2 && node.nodeName === 'BR') { + editor.dom.setHTML(parentNode, value); + } else { + editor.selection.setContent(value); + } + } + }; + var trimBrsFromTableCell = function (dom, elm) { + Optional.from(dom.getParent(elm, 'td,th')).map(SugarElement.fromDom).each(trimBlockTrailingBr); + }; + var reduceInlineTextElements = function (editor, merge) { + var textInlineElements = editor.schema.getTextInlineElements(); + var dom = editor.dom; + if (merge) { + var root_1 = editor.getBody(), elementUtils_1 = new ElementUtils(dom); + Tools.each(dom.select('*[data-mce-fragment]'), function (node) { + for (var testNode = node.parentNode; testNode && testNode !== root_1; testNode = testNode.parentNode) { + if (textInlineElements[node.nodeName.toLowerCase()] && elementUtils_1.compare(testNode, node)) { + dom.remove(node, true); + } + } + }); + } + }; + var markFragmentElements = function (fragment) { + var node = fragment; + while (node = node.walk()) { + if (node.type === 1) { + node.attr('data-mce-fragment', '1'); + } + } + }; + var unmarkFragmentElements = function (elm) { + Tools.each(elm.getElementsByTagName('*'), function (elm) { + elm.removeAttribute('data-mce-fragment'); + }); + }; + var isPartOfFragment = function (node) { + return !!node.getAttribute('data-mce-fragment'); + }; + var canHaveChildren = function (editor, node) { + return node && !editor.schema.getShortEndedElements()[node.nodeName]; + }; + var moveSelectionToMarker = function (editor, marker) { + var nextRng; + var dom = editor.dom, selection = editor.selection; + var node2; + var getContentEditableFalseParent = function (node) { + var root = editor.getBody(); + for (; node && node !== root; node = node.parentNode) { + if (dom.getContentEditable(node) === 'false') { + return node; + } + } + return null; + }; + if (!marker) { + return; + } + selection.scrollIntoView(marker); + var parentEditableFalseElm = getContentEditableFalseParent(marker); + if (parentEditableFalseElm) { + dom.remove(marker); + selection.select(parentEditableFalseElm); + return; + } + var rng = dom.createRng(); + var node = marker.previousSibling; + if (node && node.nodeType === 3) { + rng.setStart(node, node.nodeValue.length); + if (!Env.ie) { + node2 = marker.nextSibling; + if (node2 && node2.nodeType === 3) { + node.appendData(node2.data); + node2.parentNode.removeChild(node2); + } + } + } else { + rng.setStartBefore(marker); + rng.setEndBefore(marker); + } + var findNextCaretRng = function (rng) { + var caretPos = CaretPosition$1.fromRangeStart(rng); + var caretWalker = CaretWalker(editor.getBody()); + caretPos = caretWalker.next(caretPos); + if (caretPos) { + return caretPos.toRange(); + } + }; + var parentBlock = dom.getParent(marker, dom.isBlock); + dom.remove(marker); + if (parentBlock && dom.isEmpty(parentBlock)) { + editor.$(parentBlock).empty(); + rng.setStart(parentBlock, 0); + rng.setEnd(parentBlock, 0); + if (!isTableCell$4(parentBlock) && !isPartOfFragment(parentBlock) && (nextRng = findNextCaretRng(rng))) { + rng = nextRng; + dom.remove(parentBlock); + } else { + dom.add(parentBlock, dom.create('br', { 'data-mce-bogus': '1' })); + } + } + selection.setRng(rng); + }; + var deleteSelectedContent = function (editor) { + var dom = editor.dom; + var rng = normalize$2(editor.selection.getRng()); + editor.selection.setRng(rng); + var startCell = dom.getParent(rng.startContainer, isTableCell$4); + if (isTableCellContentSelected(dom, rng, startCell)) { + deleteCellContents(editor, rng, SugarElement.fromDom(startCell)); + } else { + editor.getDoc().execCommand('Delete', false, null); + } + }; + var insertHtmlAtCaret = function (editor, value, details) { + var parentNode, rootNode, args; + var marker, rng, node; + var selection = editor.selection, dom = editor.dom; + if (/^ | $/.test(value)) { + value = trimOrPadLeftRight(dom, selection.getRng(), value); + } + var parser = editor.parser; + var merge = details.merge; + var serializer = HtmlSerializer({ validate: shouldValidate(editor) }, editor.schema); + var bookmarkHtml = ''; + args = { + content: value, + format: 'html', + selection: true, + paste: details.paste + }; + args = editor.fire('BeforeSetContent', args); + if (args.isDefaultPrevented()) { + editor.fire('SetContent', { + content: args.content, + format: 'html', + selection: true, + paste: details.paste + }); + return; + } + value = args.content; + if (value.indexOf('{$caret}') === -1) { + value += '{$caret}'; + } + value = value.replace(/\{\$caret\}/, bookmarkHtml); + rng = selection.getRng(); + var caretElement = rng.startContainer || (rng.parentElement ? rng.parentElement() : null); + var body = editor.getBody(); + if (caretElement === body && selection.isCollapsed()) { + if (dom.isBlock(body.firstChild) && canHaveChildren(editor, body.firstChild) && dom.isEmpty(body.firstChild)) { + rng = dom.createRng(); + rng.setStart(body.firstChild, 0); + rng.setEnd(body.firstChild, 0); + selection.setRng(rng); + } + } + if (!selection.isCollapsed()) { + deleteSelectedContent(editor); + } + parentNode = selection.getNode(); + var parserArgs = { + context: parentNode.nodeName.toLowerCase(), + data: details.data, + insert: true + }; + var fragment = parser.parse(value, parserArgs); + if (details.paste === true && isListFragment(editor.schema, fragment) && isParentBlockLi(dom, parentNode)) { + rng = insertAtCaret(serializer, dom, selection.getRng(), fragment); + selection.setRng(rng); + editor.fire('SetContent', args); + return; + } + markFragmentElements(fragment); + node = fragment.lastChild; + if (node.attr('id') === 'mce_marker') { + marker = node; + for (node = node.prev; node; node = node.walk(true)) { + if (node.type === 3 || !dom.isBlock(node.name)) { + if (editor.schema.isValidChild(node.parent.name, 'span')) { + node.parent.insert(marker, node, node.name === 'br'); + } + break; + } + } + } + editor._selectionOverrides.showBlockCaretContainer(parentNode); + if (!parserArgs.invalid) { + value = serializer.serialize(fragment); + validInsertion(editor, value, parentNode); + } else { + editor.selection.setContent(bookmarkHtml); + parentNode = selection.getNode(); + rootNode = editor.getBody(); + if (parentNode.nodeType === 9) { + parentNode = node = rootNode; + } else { + node = parentNode; + } + while (node !== rootNode) { + parentNode = node; + node = node.parentNode; + } + value = parentNode === rootNode ? rootNode.innerHTML : dom.getOuterHTML(parentNode); + value = serializer.serialize(parser.parse(value.replace(//i, function () { + return serializer.serialize(fragment); + }))); + if (parentNode === rootNode) { + dom.setHTML(rootNode, value); + } else { + dom.setOuterHTML(parentNode, value); + } + } + reduceInlineTextElements(editor, merge); + moveSelectionToMarker(editor, dom.get('mce_marker')); + unmarkFragmentElements(editor.getBody()); + trimBrsFromTableCell(dom, selection.getStart()); + editor.fire('SetContent', args); + editor.addVisual(); + }; + + var traverse = function (node, fn) { + fn(node); + if (node.firstChild) { + traverse(node.firstChild, fn); + } + if (node.next) { + traverse(node.next, fn); + } + }; + var findMatchingNodes = function (nodeFilters, attributeFilters, node) { + var nodeMatches = {}; + var attrMatches = {}; + var matches = []; + if (node.firstChild) { + traverse(node.firstChild, function (node) { + each(nodeFilters, function (filter) { + if (filter.name === node.name) { + if (nodeMatches[filter.name]) { + nodeMatches[filter.name].nodes.push(node); + } else { + nodeMatches[filter.name] = { + filter: filter, + nodes: [node] + }; + } + } + }); + each(attributeFilters, function (filter) { + if (typeof node.attr(filter.name) === 'string') { + if (attrMatches[filter.name]) { + attrMatches[filter.name].nodes.push(node); + } else { + attrMatches[filter.name] = { + filter: filter, + nodes: [node] + }; + } + } + }); + }); + } + for (var name_1 in nodeMatches) { + if (nodeMatches.hasOwnProperty(name_1)) { + matches.push(nodeMatches[name_1]); + } + } + for (var name_2 in attrMatches) { + if (attrMatches.hasOwnProperty(name_2)) { + matches.push(attrMatches[name_2]); + } + } + return matches; + }; + var filter$3 = function (nodeFilters, attributeFilters, node) { + var matches = findMatchingNodes(nodeFilters, attributeFilters, node); + each(matches, function (match) { + each(match.filter.callbacks, function (callback) { + callback(match.nodes, match.filter.name, {}); + }); + }); + }; + + var defaultFormat = 'html'; + var isTreeNode = function (content) { + return content instanceof AstNode; + }; + var moveSelection = function (editor) { + if (hasFocus$1(editor)) { + firstPositionIn(editor.getBody()).each(function (pos) { + var node = pos.getNode(); + var caretPos = isTable(node) ? firstPositionIn(node).getOr(pos) : pos; + editor.selection.setRng(caretPos.toRange()); + }); + } + }; + var setEditorHtml = function (editor, html) { + editor.dom.setHTML(editor.getBody(), html); + moveSelection(editor); + }; + var setContentString = function (editor, body, content, args) { + var forcedRootBlockName, padd; + if (content.length === 0 || /^\s+$/.test(content)) { + padd = '
                                      '; + if (body.nodeName === 'TABLE') { + content = '' + padd + ''; + } else if (/^(UL|OL)$/.test(body.nodeName)) { + content = '
                                    • ' + padd + '
                                    • '; + } + forcedRootBlockName = getForcedRootBlock(editor); + if (forcedRootBlockName && editor.schema.isValidChild(body.nodeName.toLowerCase(), forcedRootBlockName.toLowerCase())) { + content = padd; + content = editor.dom.createHTML(forcedRootBlockName, getForcedRootBlockAttrs(editor), content); + } else if (!content) { + content = '
                                      '; + } + setEditorHtml(editor, content); + editor.fire('SetContent', args); + } else { + if (args.format !== 'raw') { + content = HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(editor.parser.parse(content, { + isRootContent: true, + insert: true + })); + } + args.content = isWsPreserveElement(SugarElement.fromDom(body)) ? content : Tools.trim(content); + setEditorHtml(editor, args.content); + if (!args.no_events) { + editor.fire('SetContent', args); + } + } + return args.content; + }; + var setContentTree = function (editor, body, content, args) { + filter$3(editor.parser.getNodeFilters(), editor.parser.getAttributeFilters(), content); + var html = HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(content); + args.content = isWsPreserveElement(SugarElement.fromDom(body)) ? html : Tools.trim(html); + setEditorHtml(editor, args.content); + if (!args.no_events) { + editor.fire('SetContent', args); + } + return content; + }; + var setContentInternal = function (editor, content, args) { + args.format = args.format ? args.format : defaultFormat; + args.set = true; + args.content = isTreeNode(content) ? '' : content; + if (!args.no_events) { + editor.fire('BeforeSetContent', args); + } + if (!isTreeNode(content)) { + content = args.content; + } + return Optional.from(editor.getBody()).fold(constant(content), function (body) { + return isTreeNode(content) ? setContentTree(editor, body, content, args) : setContentString(editor, body, content, args); + }); + }; + + var addVisualInternal = function (editor, elm) { + var dom = editor.dom; + var scope = isNonNullable(elm) ? elm : editor.getBody(); + if (isUndefined(editor.hasVisual)) { + editor.hasVisual = isVisualAidsEnabled(editor); + } + each(dom.select('table,a', scope), function (matchedElm) { + switch (matchedElm.nodeName) { + case 'TABLE': + var cls = getVisualAidsTableClass(editor); + var value = dom.getAttrib(matchedElm, 'border'); + if ((!value || value === '0') && editor.hasVisual) { + dom.addClass(matchedElm, cls); + } else { + dom.removeClass(matchedElm, cls); + } + break; + case 'A': + if (!dom.getAttrib(matchedElm, 'href')) { + var value_1 = dom.getAttrib(matchedElm, 'name') || matchedElm.id; + var cls_1 = getVisualAidsAnchorClass(editor); + if (value_1 && editor.hasVisual) { + dom.addClass(matchedElm, cls_1); + } else { + dom.removeClass(matchedElm, cls_1); + } + } + break; + } + }); + editor.fire('VisualAid', { + element: elm, + hasVisual: editor.hasVisual + }); + }; + + var sibling$2 = function (scope, predicate) { + return sibling(scope, predicate).isSome(); + }; + + var ZWSP$1 = ZWSP, CARET_ID$1 = '_mce_caret'; + var importNode = function (ownerDocument, node) { + return ownerDocument.importNode(node, true); + }; + var getEmptyCaretContainers = function (node) { + var nodes = []; + while (node) { + if (node.nodeType === 3 && node.nodeValue !== ZWSP$1 || node.childNodes.length > 1) { + return []; + } + if (node.nodeType === 1) { + nodes.push(node); + } + node = node.firstChild; + } + return nodes; + }; + var isCaretContainerEmpty = function (node) { + return getEmptyCaretContainers(node).length > 0; + }; + var findFirstTextNode = function (node) { + if (node) { + var walker = new DomTreeWalker(node, node); + for (node = walker.current(); node; node = walker.next()) { + if (isText$1(node)) { + return node; + } + } + } + return null; + }; + var createCaretContainer = function (fill) { + var caretContainer = SugarElement.fromTag('span'); + setAll(caretContainer, { + 'id': CARET_ID$1, + 'data-mce-bogus': '1', + 'data-mce-type': 'format-caret' + }); + if (fill) { + append(caretContainer, SugarElement.fromText(ZWSP$1)); + } + return caretContainer; + }; + var trimZwspFromCaretContainer = function (caretContainerNode) { + var textNode = findFirstTextNode(caretContainerNode); + if (textNode && textNode.nodeValue.charAt(0) === ZWSP$1) { + textNode.deleteData(0, 1); + } + return textNode; + }; + var removeCaretContainerNode = function (editor, node, moveCaret) { + if (moveCaret === void 0) { + moveCaret = true; + } + var dom = editor.dom, selection = editor.selection; + if (isCaretContainerEmpty(node)) { + deleteElement(editor, false, SugarElement.fromDom(node), moveCaret); + } else { + var rng = selection.getRng(); + var block = dom.getParent(node, dom.isBlock); + var startContainer = rng.startContainer; + var startOffset = rng.startOffset; + var endContainer = rng.endContainer; + var endOffset = rng.endOffset; + var textNode = trimZwspFromCaretContainer(node); + dom.remove(node, true); + if (startContainer === textNode && startOffset > 0) { + rng.setStart(textNode, startOffset - 1); + } + if (endContainer === textNode && endOffset > 0) { + rng.setEnd(textNode, endOffset - 1); + } + if (block && dom.isEmpty(block)) { + fillWithPaddingBr(SugarElement.fromDom(block)); + } + selection.setRng(rng); + } + }; + var removeCaretContainer = function (editor, node, moveCaret) { + if (moveCaret === void 0) { + moveCaret = true; + } + var dom = editor.dom, selection = editor.selection; + if (!node) { + node = getParentCaretContainer(editor.getBody(), selection.getStart()); + if (!node) { + while (node = dom.get(CARET_ID$1)) { + removeCaretContainerNode(editor, node, false); + } + } + } else { + removeCaretContainerNode(editor, node, moveCaret); + } + }; + var insertCaretContainerNode = function (editor, caretContainer, formatNode) { + var dom = editor.dom, block = dom.getParent(formatNode, curry(isTextBlock$1, editor)); + if (block && dom.isEmpty(block)) { + formatNode.parentNode.replaceChild(caretContainer, formatNode); + } else { + removeTrailingBr(SugarElement.fromDom(formatNode)); + if (dom.isEmpty(formatNode)) { + formatNode.parentNode.replaceChild(caretContainer, formatNode); + } else { + dom.insertAfter(caretContainer, formatNode); + } + } + }; + var appendNode = function (parentNode, node) { + parentNode.appendChild(node); + return node; + }; + var insertFormatNodesIntoCaretContainer = function (formatNodes, caretContainer) { + var innerMostFormatNode = foldr(formatNodes, function (parentNode, formatNode) { + return appendNode(parentNode, formatNode.cloneNode(false)); + }, caretContainer); + return appendNode(innerMostFormatNode, innerMostFormatNode.ownerDocument.createTextNode(ZWSP$1)); + }; + var cleanFormatNode = function (editor, caretContainer, formatNode, name, vars, similar) { + var formatter = editor.formatter; + var dom = editor.dom; + var validFormats = filter(keys(formatter.get()), function (formatName) { + return formatName !== name && !contains$1(formatName, 'removeformat'); + }); + var matchedFormats = matchAllOnNode(editor, formatNode, validFormats); + var uniqueFormats = filter(matchedFormats, function (fmtName) { + return !areSimilarFormats(editor, fmtName, name); + }); + if (uniqueFormats.length > 0) { + var clonedFormatNode = formatNode.cloneNode(false); + dom.add(caretContainer, clonedFormatNode); + formatter.remove(name, vars, clonedFormatNode, similar); + dom.remove(clonedFormatNode); + return Optional.some(clonedFormatNode); + } else { + return Optional.none(); + } + }; + var applyCaretFormat = function (editor, name, vars) { + var caretContainer, textNode; + var selection = editor.selection; + var selectionRng = selection.getRng(); + var offset = selectionRng.startOffset; + var container = selectionRng.startContainer; + var text = container.nodeValue; + caretContainer = getParentCaretContainer(editor.getBody(), selection.getStart()); + if (caretContainer) { + textNode = findFirstTextNode(caretContainer); + } + var wordcharRegex = /[^\s\u00a0\u00ad\u200b\ufeff]/; + if (text && offset > 0 && offset < text.length && wordcharRegex.test(text.charAt(offset)) && wordcharRegex.test(text.charAt(offset - 1))) { + var bookmark = selection.getBookmark(); + selectionRng.collapse(true); + var rng = expandRng(editor, selectionRng, editor.formatter.get(name)); + rng = split$1(rng); + editor.formatter.apply(name, vars, rng); + selection.moveToBookmark(bookmark); + } else { + if (!caretContainer || textNode.nodeValue !== ZWSP$1) { + caretContainer = importNode(editor.getDoc(), createCaretContainer(true).dom); + textNode = caretContainer.firstChild; + selectionRng.insertNode(caretContainer); + offset = 1; + editor.formatter.apply(name, vars, caretContainer); + } else { + editor.formatter.apply(name, vars, caretContainer); + } + selection.setCursorLocation(textNode, offset); + } + }; + var removeCaretFormat = function (editor, name, vars, similar) { + var dom = editor.dom; + var selection = editor.selection; + var hasContentAfter, node, formatNode; + var parents = []; + var rng = selection.getRng(); + var container = rng.startContainer; + var offset = rng.startOffset; + node = container; + if (container.nodeType === 3) { + if (offset !== container.nodeValue.length) { + hasContentAfter = true; + } + node = node.parentNode; + } + while (node) { + if (matchNode(editor, node, name, vars, similar)) { + formatNode = node; + break; + } + if (node.nextSibling) { + hasContentAfter = true; + } + parents.push(node); + node = node.parentNode; + } + if (!formatNode) { + return; + } + if (hasContentAfter) { + var bookmark = selection.getBookmark(); + rng.collapse(true); + var expandedRng = expandRng(editor, rng, editor.formatter.get(name), true); + expandedRng = split$1(expandedRng); + editor.formatter.remove(name, vars, expandedRng, similar); + selection.moveToBookmark(bookmark); + } else { + var caretContainer = getParentCaretContainer(editor.getBody(), formatNode); + var newCaretContainer = createCaretContainer(false).dom; + insertCaretContainerNode(editor, newCaretContainer, caretContainer !== null ? caretContainer : formatNode); + var cleanedFormatNode = cleanFormatNode(editor, newCaretContainer, formatNode, name, vars, similar); + var caretTextNode = insertFormatNodesIntoCaretContainer(parents.concat(cleanedFormatNode.toArray()), newCaretContainer); + removeCaretContainerNode(editor, caretContainer, false); + selection.setCursorLocation(caretTextNode, 1); + if (dom.isEmpty(formatNode)) { + dom.remove(formatNode); + } + } + }; + var disableCaretContainer = function (editor, keyCode) { + var selection = editor.selection, body = editor.getBody(); + removeCaretContainer(editor, null, false); + if ((keyCode === 8 || keyCode === 46) && selection.isCollapsed() && selection.getStart().innerHTML === ZWSP$1) { + removeCaretContainer(editor, getParentCaretContainer(body, selection.getStart())); + } + if (keyCode === 37 || keyCode === 39) { + removeCaretContainer(editor, getParentCaretContainer(body, selection.getStart())); + } + }; + var setup$3 = function (editor) { + editor.on('mouseup keydown', function (e) { + disableCaretContainer(editor, e.keyCode); + }); + }; + var replaceWithCaretFormat = function (targetNode, formatNodes) { + var caretContainer = createCaretContainer(false); + var innerMost = insertFormatNodesIntoCaretContainer(formatNodes, caretContainer.dom); + before(SugarElement.fromDom(targetNode), caretContainer); + remove(SugarElement.fromDom(targetNode)); + return CaretPosition$1(innerMost, 0); + }; + var isFormatElement = function (editor, element) { + var inlineElements = editor.schema.getTextInlineElements(); + return inlineElements.hasOwnProperty(name(element)) && !isCaretNode(element.dom) && !isBogus(element.dom); + }; + var isEmptyCaretFormatElement = function (element) { + return isCaretNode(element.dom) && isCaretContainerEmpty(element.dom); + }; + + var postProcessHooks = {}; + var filter$4 = filter$2; + var each$8 = each$2; + var addPostProcessHook = function (name, hook) { + var hooks = postProcessHooks[name]; + if (!hooks) { + postProcessHooks[name] = []; + } + postProcessHooks[name].push(hook); + }; + var postProcess = function (name, editor) { + each$8(postProcessHooks[name], function (hook) { + hook(editor); + }); + }; + addPostProcessHook('pre', function (editor) { + var rng = editor.selection.getRng(); + var blocks; + var hasPreSibling = function (pre) { + return isPre(pre.previousSibling) && indexOf$1(blocks, pre.previousSibling) !== -1; + }; + var joinPre = function (pre1, pre2) { + DomQuery(pre2).remove(); + DomQuery(pre1).append('

                                      ').append(pre2.childNodes); + }; + var isPre = matchNodeNames(['pre']); + if (!rng.collapsed) { + blocks = editor.selection.getSelectedBlocks(); + each$8(filter$4(filter$4(blocks, isPre), hasPreSibling), function (pre) { + joinPre(pre.previousSibling, pre); + }); + } + }); + + var each$9 = Tools.each; + var isElementNode = function (node) { + return isElement$1(node) && !isBookmarkNode$1(node) && !isCaretNode(node) && !isBogus(node); + }; + var findElementSibling = function (node, siblingName) { + var sibling; + for (sibling = node; sibling; sibling = sibling[siblingName]) { + if (isText$1(sibling) && sibling.nodeValue.length !== 0) { + return node; + } + if (isElement$1(sibling) && !isBookmarkNode$1(sibling)) { + return sibling; + } + } + return node; + }; + var mergeSiblingsNodes = function (dom, prev, next) { + var sibling, tmpSibling; + var elementUtils = new ElementUtils(dom); + if (prev && next) { + prev = findElementSibling(prev, 'previousSibling'); + next = findElementSibling(next, 'nextSibling'); + if (elementUtils.compare(prev, next)) { + for (sibling = prev.nextSibling; sibling && sibling !== next;) { + tmpSibling = sibling; + sibling = sibling.nextSibling; + prev.appendChild(tmpSibling); + } + dom.remove(next); + Tools.each(Tools.grep(next.childNodes), function (node) { + prev.appendChild(node); + }); + return prev; + } + } + return next; + }; + var mergeSiblings = function (dom, format, vars, node) { + if (node && format.merge_siblings !== false) { + var newNode = mergeSiblingsNodes(dom, getNonWhiteSpaceSibling(node), node); + mergeSiblingsNodes(dom, newNode, getNonWhiteSpaceSibling(newNode, true)); + } + }; + var clearChildStyles = function (dom, format, node) { + if (format.clear_child_styles) { + var selector = format.links ? '*:not(a)' : '*'; + each$9(dom.select(selector, node), function (node) { + if (isElementNode(node)) { + each$9(format.styles, function (value, name) { + dom.setStyle(node, name, ''); + }); + } + }); + } + }; + var processChildElements = function (node, filter, process) { + each$9(node.childNodes, function (node) { + if (isElementNode(node)) { + if (filter(node)) { + process(node); + } + if (node.hasChildNodes()) { + processChildElements(node, filter, process); + } + } + }); + }; + var unwrapEmptySpan = function (dom, node) { + if (node.nodeName === 'SPAN' && dom.getAttribs(node).length === 0) { + dom.remove(node, true); + } + }; + var hasStyle = function (dom, name) { + return function (node) { + return !!(node && getStyle(dom, node, name)); + }; + }; + var applyStyle = function (dom, name, value) { + return function (node) { + dom.setStyle(node, name, value); + if (node.getAttribute('style') === '') { + node.removeAttribute('style'); + } + unwrapEmptySpan(dom, node); + }; + }; + + var removeResult = Adt.generate([ + { keep: [] }, + { rename: ['name'] }, + { removed: [] } + ]); + var MCE_ATTR_RE = /^(src|href|style)$/; + var each$a = Tools.each; + var isEq$3 = isEq; + var isTableCellOrRow = function (node) { + return /^(TR|TH|TD)$/.test(node.nodeName); + }; + var isChildOfInlineParent = function (dom, node, parent) { + return dom.isChildOf(node, parent) && node !== parent && !dom.isBlock(parent); + }; + var getContainer = function (ed, rng, start) { + var container, offset; + container = rng[start ? 'startContainer' : 'endContainer']; + offset = rng[start ? 'startOffset' : 'endOffset']; + if (isElement$1(container)) { + var lastIdx = container.childNodes.length - 1; + if (!start && offset) { + offset--; + } + container = container.childNodes[offset > lastIdx ? lastIdx : offset]; + } + if (isText$1(container) && start && offset >= container.nodeValue.length) { + container = new DomTreeWalker(container, ed.getBody()).next() || container; + } + if (isText$1(container) && !start && offset === 0) { + container = new DomTreeWalker(container, ed.getBody()).prev() || container; + } + return container; + }; + var normalizeTableSelection = function (node, start) { + var prop = start ? 'firstChild' : 'lastChild'; + if (isTableCellOrRow(node) && node[prop]) { + var childNode = node[prop]; + if (node.nodeName === 'TR') { + return childNode[prop] || childNode; + } else { + return childNode; + } + } + return node; + }; + var wrap$2 = function (dom, node, name, attrs) { + var wrapper = dom.create(name, attrs); + node.parentNode.insertBefore(wrapper, node); + wrapper.appendChild(node); + return wrapper; + }; + var wrapWithSiblings = function (dom, node, next, name, attrs) { + var start = SugarElement.fromDom(node); + var wrapper = SugarElement.fromDom(dom.create(name, attrs)); + var siblings = next ? nextSiblings(start) : prevSiblings(start); + append$1(wrapper, siblings); + if (next) { + before(start, wrapper); + prepend(wrapper, start); + } else { + after(start, wrapper); + append(wrapper, start); + } + return wrapper.dom; + }; + var matchName$1 = function (dom, node, format) { + if (isEq$3(node, format.inline)) { + return true; + } + if (isEq$3(node, format.block)) { + return true; + } + if (format.selector) { + return isElement$1(node) && dom.is(node, format.selector); + } + }; + var isColorFormatAndAnchor = function (node, format) { + return format.links && node.nodeName === 'A'; + }; + var find$3 = function (dom, node, next, inc) { + node = getNonWhiteSpaceSibling(node, next, inc); + return !node || (node.nodeName === 'BR' || dom.isBlock(node)); + }; + var removeNode$1 = function (ed, node, format) { + var parentNode = node.parentNode; + var rootBlockElm; + var dom = ed.dom, forcedRootBlock = getForcedRootBlock(ed); + if (format.block) { + if (!forcedRootBlock) { + if (dom.isBlock(node) && !dom.isBlock(parentNode)) { + if (!find$3(dom, node, false) && !find$3(dom, node.firstChild, true, true)) { + node.insertBefore(dom.create('br'), node.firstChild); + } + if (!find$3(dom, node, true) && !find$3(dom, node.lastChild, false, true)) { + node.appendChild(dom.create('br')); + } + } + } else { + if (parentNode === dom.getRoot()) { + if (!format.list_block || !isEq$3(node, format.list_block)) { + each(from$1(node.childNodes), function (node) { + if (isValid(ed, forcedRootBlock, node.nodeName.toLowerCase())) { + if (!rootBlockElm) { + rootBlockElm = wrap$2(dom, node, forcedRootBlock); + dom.setAttribs(rootBlockElm, ed.settings.forced_root_block_attrs); + } else { + rootBlockElm.appendChild(node); + } + } else { + rootBlockElm = 0; + } + }); + } + } + } + } + if (format.selector && format.inline && !isEq$3(format.inline, node)) { + return; + } + dom.remove(node, true); + }; + var removeFormatInternal = function (ed, format, vars, node, compareNode) { + var stylesModified; + var dom = ed.dom; + if (!matchName$1(dom, node, format) && !isColorFormatAndAnchor(node, format)) { + return removeResult.keep(); + } + var elm = node; + if (format.inline && format.remove === 'all' && isArray(format.preserve_attributes)) { + var attrsToPreserve = filter(dom.getAttribs(elm), function (attr) { + return contains(format.preserve_attributes, attr.name.toLowerCase()); + }); + dom.removeAllAttribs(elm); + each(attrsToPreserve, function (attr) { + return dom.setAttrib(elm, attr.name, attr.value); + }); + if (attrsToPreserve.length > 0) { + return removeResult.rename('span'); + } + } + if (format.remove !== 'all') { + each$a(format.styles, function (value, name) { + value = normalizeStyleValue(dom, replaceVars(value, vars), name + ''); + if (isNumber(name)) { + name = value; + compareNode = null; + } + if (format.remove_similar || (!compareNode || isEq$3(getStyle(dom, compareNode, name), value))) { + dom.setStyle(elm, name, ''); + } + stylesModified = true; + }); + if (stylesModified && dom.getAttrib(elm, 'style') === '') { + elm.removeAttribute('style'); + elm.removeAttribute('data-mce-style'); + } + each$a(format.attributes, function (value, name) { + var valueOut; + value = replaceVars(value, vars); + if (isNumber(name)) { + name = value; + compareNode = null; + } + if (format.remove_similar || (!compareNode || isEq$3(dom.getAttrib(compareNode, name), value))) { + if (name === 'class') { + value = dom.getAttrib(elm, name); + if (value) { + valueOut = ''; + each(value.split(/\s+/), function (cls) { + if (/mce\-\w+/.test(cls)) { + valueOut += (valueOut ? ' ' : '') + cls; + } + }); + if (valueOut) { + dom.setAttrib(elm, name, valueOut); + return; + } + } + } + if (name === 'class') { + elm.removeAttribute('className'); + } + if (MCE_ATTR_RE.test(name)) { + elm.removeAttribute('data-mce-' + name); + } + elm.removeAttribute(name); + } + }); + each$a(format.classes, function (value) { + value = replaceVars(value, vars); + if (!compareNode || dom.hasClass(compareNode, value)) { + dom.removeClass(elm, value); + } + }); + var attrs = dom.getAttribs(elm); + for (var i = 0; i < attrs.length; i++) { + var attrName = attrs[i].nodeName; + if (attrName.indexOf('_') !== 0 && attrName.indexOf('data-') !== 0) { + return removeResult.keep(); + } + } + } + if (format.remove !== 'none') { + removeNode$1(ed, elm, format); + return removeResult.removed(); + } + return removeResult.keep(); + }; + var removeFormat = function (ed, format, vars, node, compareNode) { + return removeFormatInternal(ed, format, vars, node, compareNode).fold(never, function (newName) { + ed.dom.rename(node, newName); + return true; + }, always); + }; + var findFormatRoot = function (editor, container, name, vars, similar) { + var formatRoot; + each(getParents$1(editor.dom, container.parentNode).reverse(), function (parent) { + if (!formatRoot && parent.id !== '_start' && parent.id !== '_end') { + var format = matchNode(editor, parent, name, vars, similar); + if (format && format.split !== false) { + formatRoot = parent; + } + } + }); + return formatRoot; + }; + var removeFormatFromClone = function (editor, format, vars, clone) { + return removeFormatInternal(editor, format, vars, clone, clone).fold(constant(clone), function (newName) { + var fragment = editor.dom.createFragment(); + fragment.appendChild(clone); + return editor.dom.rename(clone, newName); + }, constant(null)); + }; + var wrapAndSplit = function (editor, formatList, formatRoot, container, target, split, format, vars) { + var clone, lastClone, firstClone; + var dom = editor.dom; + if (formatRoot) { + var formatRootParent = formatRoot.parentNode; + for (var parent_1 = container.parentNode; parent_1 && parent_1 !== formatRootParent; parent_1 = parent_1.parentNode) { + clone = dom.clone(parent_1, false); + for (var i = 0; i < formatList.length; i++) { + clone = removeFormatFromClone(editor, formatList[i], vars, clone); + if (clone === null) { + break; + } + } + if (clone) { + if (lastClone) { + clone.appendChild(lastClone); + } + if (!firstClone) { + firstClone = clone; + } + lastClone = clone; + } + } + if (split && (!format.mixed || !dom.isBlock(formatRoot))) { + container = dom.split(formatRoot, container); + } + if (lastClone) { + target.parentNode.insertBefore(lastClone, target); + firstClone.appendChild(target); + if (format.inline) { + mergeSiblings(dom, format, vars, lastClone); + } + } + } + return container; + }; + var remove$6 = function (ed, name, vars, node, similar) { + var formatList = ed.formatter.get(name); + var format = formatList[0]; + var contentEditable = true; + var dom = ed.dom; + var selection = ed.selection; + var splitToFormatRoot = function (container) { + var formatRoot = findFormatRoot(ed, container, name, vars, similar); + return wrapAndSplit(ed, formatList, formatRoot, container, container, true, format, vars); + }; + var isRemoveBookmarkNode = function (node) { + return isBookmarkNode$1(node) && isElement$1(node) && (node.id === '_start' || node.id === '_end'); + }; + var process = function (node) { + var lastContentEditable, hasContentEditableState; + if (isElement$1(node) && dom.getContentEditable(node)) { + lastContentEditable = contentEditable; + contentEditable = dom.getContentEditable(node) === 'true'; + hasContentEditableState = true; + } + var children = from$1(node.childNodes); + if (contentEditable && !hasContentEditableState) { + for (var i = 0; i < formatList.length; i++) { + if (removeFormat(ed, formatList[i], vars, node, node)) { + break; + } + } + } + if (format.deep) { + if (children.length) { + for (var i = 0; i < children.length; i++) { + process(children[i]); + } + if (hasContentEditableState) { + contentEditable = lastContentEditable; + } + } + } + }; + var unwrap = function (start) { + var node = dom.get(start ? '_start' : '_end'); + var out = node[start ? 'firstChild' : 'lastChild']; + if (isRemoveBookmarkNode(out)) { + out = out[start ? 'firstChild' : 'lastChild']; + } + if (isText$1(out) && out.data.length === 0) { + out = start ? node.previousSibling || node.nextSibling : node.nextSibling || node.previousSibling; + } + dom.remove(node, true); + return out; + }; + var removeRngStyle = function (rng) { + var startContainer, endContainer; + var expandedRng = expandRng(ed, rng, formatList, rng.collapsed); + if (format.split) { + expandedRng = split$1(expandedRng); + startContainer = getContainer(ed, expandedRng, true); + endContainer = getContainer(ed, expandedRng); + if (startContainer !== endContainer) { + startContainer = normalizeTableSelection(startContainer, true); + endContainer = normalizeTableSelection(endContainer, false); + if (isChildOfInlineParent(dom, startContainer, endContainer)) { + var marker = Optional.from(startContainer.firstChild).getOr(startContainer); + splitToFormatRoot(wrapWithSiblings(dom, marker, true, 'span', { + 'id': '_start', + 'data-mce-type': 'bookmark' + })); + unwrap(true); + return; + } + if (isChildOfInlineParent(dom, endContainer, startContainer)) { + var marker = Optional.from(endContainer.lastChild).getOr(endContainer); + splitToFormatRoot(wrapWithSiblings(dom, marker, false, 'span', { + 'id': '_end', + 'data-mce-type': 'bookmark' + })); + unwrap(false); + return; + } + startContainer = wrap$2(dom, startContainer, 'span', { + 'id': '_start', + 'data-mce-type': 'bookmark' + }); + endContainer = wrap$2(dom, endContainer, 'span', { + 'id': '_end', + 'data-mce-type': 'bookmark' + }); + var newRng = dom.createRng(); + newRng.setStartAfter(startContainer); + newRng.setEndBefore(endContainer); + walk$1(dom, newRng, function (nodes) { + each(nodes, function (n) { + if (!isBookmarkNode$1(n) && !isBookmarkNode$1(n.parentNode)) { + splitToFormatRoot(n); + } + }); + }); + splitToFormatRoot(startContainer); + splitToFormatRoot(endContainer); + startContainer = unwrap(true); + endContainer = unwrap(); + } else { + startContainer = endContainer = splitToFormatRoot(startContainer); + } + expandedRng.startContainer = startContainer.parentNode ? startContainer.parentNode : startContainer; + expandedRng.startOffset = dom.nodeIndex(startContainer); + expandedRng.endContainer = endContainer.parentNode ? endContainer.parentNode : endContainer; + expandedRng.endOffset = dom.nodeIndex(endContainer) + 1; + } + walk$1(dom, expandedRng, function (nodes) { + each(nodes, function (node) { + process(node); + var textDecorations = [ + 'underline', + 'line-through', + 'overline' + ]; + each(textDecorations, function (decoration) { + if (isElement$1(node) && ed.dom.getStyle(node, 'text-decoration') === decoration && node.parentNode && getTextDecoration(dom, node.parentNode) === decoration) { + removeFormat(ed, { + deep: false, + exact: true, + inline: 'span', + styles: { textDecoration: decoration } + }, null, node); + } + }); + }); + }); + }; + if (node) { + if (isNode(node)) { + var rng = dom.createRng(); + rng.setStartBefore(node); + rng.setEndAfter(node); + removeRngStyle(rng); + } else { + removeRngStyle(node); + } + return; + } + if (dom.getContentEditable(selection.getNode()) === 'false') { + node = selection.getNode(); + for (var i = 0; i < formatList.length; i++) { + if (formatList[i].ceFalseOverride) { + if (removeFormat(ed, formatList[i], vars, node, node)) { + break; + } + } + } + return; + } + if (!selection.isCollapsed() || !format.inline || getCellsFromEditor(ed).length) { + preserve(selection, true, function () { + runOnRanges(ed, removeRngStyle); + }); + if (format.inline && match(ed, name, vars, selection.getStart())) { + moveStart(dom, selection, selection.getRng()); + } + ed.nodeChanged(); + } else { + removeCaretFormat(ed, name, vars, similar); + } + }; + + var each$b = Tools.each; + var mergeTextDecorationsAndColor = function (dom, format, vars, node) { + var processTextDecorationsAndColor = function (n) { + if (n.nodeType === 1 && n.parentNode && n.parentNode.nodeType === 1) { + var textDecoration = getTextDecoration(dom, n.parentNode); + if (dom.getStyle(n, 'color') && textDecoration) { + dom.setStyle(n, 'text-decoration', textDecoration); + } else if (dom.getStyle(n, 'text-decoration') === textDecoration) { + dom.setStyle(n, 'text-decoration', null); + } + } + }; + if (format.styles && (format.styles.color || format.styles.textDecoration)) { + Tools.walk(node, processTextDecorationsAndColor, 'childNodes'); + processTextDecorationsAndColor(node); + } + }; + var mergeBackgroundColorAndFontSize = function (dom, format, vars, node) { + if (format.styles && format.styles.backgroundColor) { + processChildElements(node, hasStyle(dom, 'fontSize'), applyStyle(dom, 'backgroundColor', replaceVars(format.styles.backgroundColor, vars))); + } + }; + var mergeSubSup = function (dom, format, vars, node) { + if (format.inline === 'sub' || format.inline === 'sup') { + processChildElements(node, hasStyle(dom, 'fontSize'), applyStyle(dom, 'fontSize', '')); + dom.remove(dom.select(format.inline === 'sup' ? 'sub' : 'sup', node), true); + } + }; + var mergeWithChildren = function (editor, formatList, vars, node) { + each$b(formatList, function (format) { + each$b(editor.dom.select(format.inline, node), function (child) { + if (!isElementNode(child)) { + return; + } + removeFormat(editor, format, vars, child, format.exact ? child : null); + }); + clearChildStyles(editor.dom, format, node); + }); + }; + var mergeWithParents = function (editor, format, name, vars, node) { + if (matchNode(editor, node.parentNode, name, vars)) { + if (removeFormat(editor, format, vars, node)) { + return; + } + } + if (format.merge_with_parents) { + editor.dom.getParent(node.parentNode, function (parent) { + if (matchNode(editor, parent, name, vars)) { + removeFormat(editor, format, vars, node); + return true; + } + }); + } + }; + + var each$c = Tools.each; + var hasFormatProperty = function (format, prop) { + return hasNonNullableKey(format, prop); + }; + var isElementNode$1 = function (node) { + return node && node.nodeType === 1 && !isBookmarkNode$1(node) && !isCaretNode(node) && !isBogus(node); + }; + var canFormatBR = function (editor, format, node, parentName) { + if (canFormatEmptyLines(editor) && isInlineFormat(format)) { + var validBRParentElements = __assign(__assign({}, editor.schema.getTextBlockElements()), { + td: {}, + th: {}, + li: {}, + dt: {}, + dd: {}, + figcaption: {}, + caption: {}, + details: {}, + summary: {} + }); + var hasCaretNodeSibling = sibling$2(SugarElement.fromDom(node), function (sibling) { + return isCaretNode(sibling.dom); + }); + return hasNonNullableKey(validBRParentElements, parentName) && isEmpty(SugarElement.fromDom(node.parentNode), false) && !hasCaretNodeSibling; + } else { + return false; + } + }; + var applyFormat = function (ed, name, vars, node) { + var formatList = ed.formatter.get(name); + var format = formatList[0]; + var isCollapsed = !node && ed.selection.isCollapsed(); + var dom = ed.dom; + var selection = ed.selection; + var setElementFormat = function (elm, fmt) { + fmt = fmt || format; + if (elm) { + if (fmt.onformat) { + fmt.onformat(elm, fmt, vars, node); + } + each$c(fmt.styles, function (value, name) { + dom.setStyle(elm, name, replaceVars(value, vars)); + }); + if (fmt.styles) { + var styleVal = dom.getAttrib(elm, 'style'); + if (styleVal) { + dom.setAttrib(elm, 'data-mce-style', styleVal); + } + } + each$c(fmt.attributes, function (value, name) { + dom.setAttrib(elm, name, replaceVars(value, vars)); + }); + each$c(fmt.classes, function (value) { + value = replaceVars(value, vars); + if (!dom.hasClass(elm, value)) { + dom.addClass(elm, value); + } + }); + } + }; + var applyNodeStyle = function (formatList, node) { + var found = false; + if (!isSelectorFormat(format)) { + return false; + } + each$c(formatList, function (format) { + if ('collapsed' in format && format.collapsed !== isCollapsed) { + return; + } + if (dom.is(node, format.selector) && !isCaretNode(node)) { + setElementFormat(node, format); + found = true; + return false; + } + }); + return found; + }; + var applyRngStyle = function (dom, rng, bookmark, nodeSpecific) { + var newWrappers = []; + var contentEditable = true; + var wrapName = format.inline || format.block; + var wrapElm = dom.create(wrapName); + setElementFormat(wrapElm); + walk$1(dom, rng, function (nodes) { + var currentWrapElm; + var process = function (node) { + var hasContentEditableState = false; + var lastContentEditable = contentEditable; + var nodeName = node.nodeName.toLowerCase(); + var parentName = node.parentNode.nodeName.toLowerCase(); + if (isElement$1(node) && dom.getContentEditable(node)) { + lastContentEditable = contentEditable; + contentEditable = dom.getContentEditable(node) === 'true'; + hasContentEditableState = true; + } + if (isBr(node) && !canFormatBR(ed, format, node, parentName)) { + currentWrapElm = null; + if (isBlockFormat(format)) { + dom.remove(node); + } + return; + } + if (format.wrapper && matchNode(ed, node, name, vars)) { + currentWrapElm = null; + return; + } + if (contentEditable && !hasContentEditableState && isBlockFormat(format) && !format.wrapper && isTextBlock$1(ed, nodeName) && isValid(ed, parentName, wrapName)) { + var elm = dom.rename(node, wrapName); + setElementFormat(elm); + newWrappers.push(elm); + currentWrapElm = null; + return; + } + if (isSelectorFormat(format)) { + var found = applyNodeStyle(formatList, node); + if (!hasFormatProperty(format, 'inline') || found) { + currentWrapElm = null; + return; + } + } + if (contentEditable && !hasContentEditableState && isValid(ed, wrapName, nodeName) && isValid(ed, parentName, wrapName) && !(!nodeSpecific && node.nodeType === 3 && node.nodeValue.length === 1 && node.nodeValue.charCodeAt(0) === 65279) && !isCaretNode(node) && (!hasFormatProperty(format, 'inline') || !dom.isBlock(node))) { + if (!currentWrapElm) { + currentWrapElm = dom.clone(wrapElm, false); + node.parentNode.insertBefore(currentWrapElm, node); + newWrappers.push(currentWrapElm); + } + currentWrapElm.appendChild(node); + } else { + currentWrapElm = null; + each$c(Tools.grep(node.childNodes), process); + if (hasContentEditableState) { + contentEditable = lastContentEditable; + } + currentWrapElm = null; + } + }; + each$c(nodes, process); + }); + if (format.links === true) { + each$c(newWrappers, function (node) { + var process = function (node) { + if (node.nodeName === 'A') { + setElementFormat(node, format); + } + each$c(Tools.grep(node.childNodes), process); + }; + process(node); + }); + } + each$c(newWrappers, function (node) { + var getChildCount = function (node) { + var count = 0; + each$c(node.childNodes, function (node) { + if (!isEmptyTextNode(node) && !isBookmarkNode$1(node)) { + count++; + } + }); + return count; + }; + var getChildElementNode = function (root) { + var child = false; + each$c(root.childNodes, function (node) { + if (isElementNode$1(node)) { + child = node; + return false; + } + }); + return child; + }; + var mergeStyles = function (node) { + var clone; + var child = getChildElementNode(node); + if (child && !isBookmarkNode$1(child) && matchName(dom, child, format)) { + clone = dom.clone(child, false); + setElementFormat(clone); + dom.replace(clone, node, true); + dom.remove(child, true); + } + return clone || node; + }; + var childCount = getChildCount(node); + if ((newWrappers.length > 1 || !dom.isBlock(node)) && childCount === 0) { + dom.remove(node, true); + return; + } + if (isInlineFormat(format) || format.wrapper) { + if (!format.exact && childCount === 1) { + node = mergeStyles(node); + } + mergeWithChildren(ed, formatList, vars, node); + mergeWithParents(ed, format, name, vars, node); + mergeBackgroundColorAndFontSize(dom, format, vars, node); + mergeTextDecorationsAndColor(dom, format, vars, node); + mergeSubSup(dom, format, vars, node); + mergeSiblings(dom, format, vars, node); + } + }); + }; + if (dom.getContentEditable(selection.getNode()) === 'false') { + node = selection.getNode(); + for (var i = 0, l = formatList.length; i < l; i++) { + var formatItem = formatList[i]; + if (formatItem.ceFalseOverride && isSelectorFormat(formatItem) && dom.is(node, formatItem.selector)) { + setElementFormat(node, formatItem); + return; + } + } + return; + } + if (format) { + if (node) { + if (isNode(node)) { + if (!applyNodeStyle(formatList, node)) { + var rng = dom.createRng(); + rng.setStartBefore(node); + rng.setEndAfter(node); + applyRngStyle(dom, expandRng(ed, rng, formatList), null, true); + } + } else { + applyRngStyle(dom, node, null, true); + } + } else { + if (!isCollapsed || !isInlineFormat(format) || getCellsFromEditor(ed).length) { + var curSelNode = selection.getNode(); + var firstFormat = formatList[0]; + if (!ed.settings.forced_root_block && firstFormat.defaultBlock && !dom.getParent(curSelNode, dom.isBlock)) { + applyFormat(ed, firstFormat.defaultBlock); + } + selection.setRng(normalize$2(selection.getRng())); + preserve(selection, true, function (bookmark) { + runOnRanges(ed, function (selectionRng, fake) { + var expandedRng = fake ? selectionRng : expandRng(ed, selectionRng, formatList); + applyRngStyle(dom, expandedRng); + }); + }); + moveStart(dom, selection, selection.getRng()); + ed.nodeChanged(); + } else { + applyCaretFormat(ed, name, vars); + } + } + postProcess(name, ed); + } + }; + + var setup$4 = function (registeredFormatListeners, editor) { + var currentFormats = Cell({}); + registeredFormatListeners.set({}); + editor.on('NodeChange', function (e) { + updateAndFireChangeCallbacks(editor, e.element, currentFormats, registeredFormatListeners.get()); + }); + }; + var updateAndFireChangeCallbacks = function (editor, elm, currentFormats, formatChangeData) { + var formatsList = keys(currentFormats.get()); + var newFormats = {}; + var matchedFormats = {}; + var parents = filter(getParents$1(editor.dom, elm), function (node) { + return node.nodeType === 1 && !node.getAttribute('data-mce-bogus'); + }); + each$1(formatChangeData, function (data, format) { + Tools.each(parents, function (node) { + if (editor.formatter.matchNode(node, format, {}, data.similar)) { + if (formatsList.indexOf(format) === -1) { + each(data.callbacks, function (callback) { + callback(true, { + node: node, + format: format, + parents: parents + }); + }); + newFormats[format] = data.callbacks; + } + matchedFormats[format] = data.callbacks; + return false; + } + if (matchesUnInheritedFormatSelector(editor, node, format)) { + return false; + } + }); + }); + var remainingFormats = filterRemainingFormats(currentFormats.get(), matchedFormats, elm, parents); + currentFormats.set(__assign(__assign({}, newFormats), remainingFormats)); + }; + var filterRemainingFormats = function (currentFormats, matchedFormats, elm, parents) { + return bifilter(currentFormats, function (callbacks, format) { + if (!has(matchedFormats, format)) { + each(callbacks, function (callback) { + callback(false, { + node: elm, + format: format, + parents: parents + }); + }); + return false; + } else { + return true; + } + }).t; + }; + var addListeners = function (registeredFormatListeners, formats, callback, similar) { + var formatChangeItems = registeredFormatListeners.get(); + each(formats.split(','), function (format) { + if (!formatChangeItems[format]) { + formatChangeItems[format] = { + similar: similar, + callbacks: [] + }; + } + formatChangeItems[format].callbacks.push(callback); + }); + registeredFormatListeners.set(formatChangeItems); + }; + var removeListeners = function (registeredFormatListeners, formats, callback) { + var formatChangeItems = registeredFormatListeners.get(); + each(formats.split(','), function (format) { + formatChangeItems[format].callbacks = filter(formatChangeItems[format].callbacks, function (c) { + return c !== callback; + }); + if (formatChangeItems[format].callbacks.length === 0) { + delete formatChangeItems[format]; + } + }); + registeredFormatListeners.set(formatChangeItems); + }; + var formatChangedInternal = function (editor, registeredFormatListeners, formats, callback, similar) { + if (registeredFormatListeners.get() === null) { + setup$4(registeredFormatListeners, editor); + } + addListeners(registeredFormatListeners, formats, callback, similar); + return { + unbind: function () { + return removeListeners(registeredFormatListeners, formats, callback); + } + }; + }; + + var toggle = function (editor, name, vars, node) { + var fmt = editor.formatter.get(name); + if (match(editor, name, vars, node) && (!('toggle' in fmt[0]) || fmt[0].toggle)) { + remove$6(editor, name, vars, node); + } else { + applyFormat(editor, name, vars, node); + } + }; + + var fromElements = function (elements, scope) { + var doc = scope || document; + var fragment = doc.createDocumentFragment(); + each(elements, function (element) { + fragment.appendChild(element.dom); + }); + return SugarElement.fromDom(fragment); + }; + + var tableModel = function (element, width, rows) { + return { + element: element, + width: width, + rows: rows + }; + }; + var tableRow = function (element, cells) { + return { + element: element, + cells: cells + }; + }; + var cellPosition = function (x, y) { + return { + x: x, + y: y + }; + }; + var getSpan = function (td, key) { + var value = parseInt(get$4(td, key), 10); + return isNaN(value) ? 1 : value; + }; + var fillout = function (table, x, y, tr, td) { + var rowspan = getSpan(td, 'rowspan'); + var colspan = getSpan(td, 'colspan'); + var rows = table.rows; + for (var y2 = y; y2 < y + rowspan; y2++) { + if (!rows[y2]) { + rows[y2] = tableRow(deep(tr), []); + } + for (var x2 = x; x2 < x + colspan; x2++) { + var cells = rows[y2].cells; + cells[x2] = y2 === y && x2 === x ? td : shallow(td); + } + } + }; + var cellExists = function (table, x, y) { + var rows = table.rows; + var cells = rows[y] ? rows[y].cells : []; + return !!cells[x]; + }; + var skipCellsX = function (table, x, y) { + while (cellExists(table, x, y)) { + x++; + } + return x; + }; + var getWidth = function (rows) { + return foldl(rows, function (acc, row) { + return row.cells.length > acc ? row.cells.length : acc; + }, 0); + }; + var findElementPos = function (table, element) { + var rows = table.rows; + for (var y = 0; y < rows.length; y++) { + var cells = rows[y].cells; + for (var x = 0; x < cells.length; x++) { + if (eq$2(cells[x], element)) { + return Optional.some(cellPosition(x, y)); + } + } + } + return Optional.none(); + }; + var extractRows = function (table, sx, sy, ex, ey) { + var newRows = []; + var rows = table.rows; + for (var y = sy; y <= ey; y++) { + var cells = rows[y].cells; + var slice = sx < ex ? cells.slice(sx, ex + 1) : cells.slice(ex, sx + 1); + newRows.push(tableRow(rows[y].element, slice)); + } + return newRows; + }; + var subTable = function (table, startPos, endPos) { + var sx = startPos.x, sy = startPos.y; + var ex = endPos.x, ey = endPos.y; + var newRows = sy < ey ? extractRows(table, sx, sy, ex, ey) : extractRows(table, sx, ey, ex, sy); + return tableModel(table.element, getWidth(newRows), newRows); + }; + var createDomTable = function (table, rows) { + var tableElement = shallow(table.element); + var tableBody = SugarElement.fromTag('tbody'); + append$1(tableBody, rows); + append(tableElement, tableBody); + return tableElement; + }; + var modelRowsToDomRows = function (table) { + return map(table.rows, function (row) { + var cells = map(row.cells, function (cell) { + var td = deep(cell); + remove$1(td, 'colspan'); + remove$1(td, 'rowspan'); + return td; + }); + var tr = shallow(row.element); + append$1(tr, cells); + return tr; + }); + }; + var fromDom$1 = function (tableElm) { + var table = tableModel(shallow(tableElm), 0, []); + each(descendants$1(tableElm, 'tr'), function (tr, y) { + each(descendants$1(tr, 'td,th'), function (td, x) { + fillout(table, skipCellsX(table, x, y), y, tr, td); + }); + }); + return tableModel(table.element, getWidth(table.rows), table.rows); + }; + var toDom = function (table) { + return createDomTable(table, modelRowsToDomRows(table)); + }; + var subsection = function (table, startElement, endElement) { + return findElementPos(table, startElement).bind(function (startPos) { + return findElementPos(table, endElement).map(function (endPos) { + return subTable(table, startPos, endPos); + }); + }); + }; + + var findParentListContainer = function (parents) { + return find(parents, function (elm) { + return name(elm) === 'ul' || name(elm) === 'ol'; + }); + }; + var getFullySelectedListWrappers = function (parents, rng) { + return find(parents, function (elm) { + return name(elm) === 'li' && hasAllContentsSelected(elm, rng); + }).fold(constant([]), function (_li) { + return findParentListContainer(parents).map(function (listCont) { + var listElm = SugarElement.fromTag(name(listCont)); + var listStyles = filter$1(getAllRaw(listCont), function (_style, name) { + return startsWith(name, 'list-style'); + }); + setAll$1(listElm, listStyles); + return [ + SugarElement.fromTag('li'), + listElm + ]; + }).getOr([]); + }); + }; + var wrap$3 = function (innerElm, elms) { + var wrapped = foldl(elms, function (acc, elm) { + append(elm, acc); + return elm; + }, innerElm); + return elms.length > 0 ? fromElements([wrapped]) : wrapped; + }; + var directListWrappers = function (commonAnchorContainer) { + if (isListItem(commonAnchorContainer)) { + return parent(commonAnchorContainer).filter(isList).fold(constant([]), function (listElm) { + return [ + commonAnchorContainer, + listElm + ]; + }); + } else { + return isList(commonAnchorContainer) ? [commonAnchorContainer] : []; + } + }; + var getWrapElements = function (rootNode, rng) { + var commonAnchorContainer = SugarElement.fromDom(rng.commonAncestorContainer); + var parents = parentsAndSelf(commonAnchorContainer, rootNode); + var wrapElements = filter(parents, function (elm) { + return isInline(elm) || isHeading(elm); + }); + var listWrappers = getFullySelectedListWrappers(parents, rng); + var allWrappers = wrapElements.concat(listWrappers.length ? listWrappers : directListWrappers(commonAnchorContainer)); + return map(allWrappers, shallow); + }; + var emptyFragment = function () { + return fromElements([]); + }; + var getFragmentFromRange = function (rootNode, rng) { + return wrap$3(SugarElement.fromDom(rng.cloneContents()), getWrapElements(rootNode, rng)); + }; + var getParentTable = function (rootElm, cell) { + return ancestor$1(cell, 'table', curry(eq$2, rootElm)); + }; + var getTableFragment = function (rootNode, selectedTableCells) { + return getParentTable(rootNode, selectedTableCells[0]).bind(function (tableElm) { + var firstCell = selectedTableCells[0]; + var lastCell = selectedTableCells[selectedTableCells.length - 1]; + var fullTableModel = fromDom$1(tableElm); + return subsection(fullTableModel, firstCell, lastCell).map(function (sectionedTableModel) { + return fromElements([toDom(sectionedTableModel)]); + }); + }).getOrThunk(emptyFragment); + }; + var getSelectionFragment = function (rootNode, ranges) { + return ranges.length > 0 && ranges[0].collapsed ? emptyFragment() : getFragmentFromRange(rootNode, ranges[0]); + }; + var read$1 = function (rootNode, ranges) { + var selectedCells = getCellsFromElementOrRanges(ranges, rootNode); + return selectedCells.length > 0 ? getTableFragment(rootNode, selectedCells) : getSelectionFragment(rootNode, ranges); + }; + + var trimLeadingCollapsibleText = function (text) { + return text.replace(/^[ \f\n\r\t\v]+/, ''); + }; + var isCollapsibleWhitespace = function (text, index) { + return index >= 0 && index < text.length && isWhiteSpace$1(text.charAt(index)); + }; + var getInnerText = function (bin, shouldTrim) { + var text = trim$2(bin.innerText); + return shouldTrim ? trimLeadingCollapsibleText(text) : text; + }; + var getContextNodeName = function (parentBlockOpt) { + return parentBlockOpt.map(function (block) { + return block.nodeName; + }).getOr('div').toLowerCase(); + }; + var getTextContent = function (editor) { + return Optional.from(editor.selection.getRng()).map(function (rng) { + var parentBlockOpt = Optional.from(editor.dom.getParent(rng.commonAncestorContainer, editor.dom.isBlock)); + var body = editor.getBody(); + var contextNodeName = getContextNodeName(parentBlockOpt); + var shouldTrimSpaces = Env.browser.isIE() && contextNodeName !== 'pre'; + var bin = editor.dom.add(body, contextNodeName, { + 'data-mce-bogus': 'all', + 'style': 'overflow: hidden; opacity: 0;' + }, rng.cloneContents()); + var text = getInnerText(bin, shouldTrimSpaces); + var nonRenderedText = trim$2(bin.textContent); + editor.dom.remove(bin); + if (isCollapsibleWhitespace(nonRenderedText, 0) || isCollapsibleWhitespace(nonRenderedText, nonRenderedText.length - 1)) { + var parentBlock = parentBlockOpt.getOr(body); + var parentBlockText = getInnerText(parentBlock, shouldTrimSpaces); + var textIndex = parentBlockText.indexOf(text); + if (textIndex === -1) { + return text; + } else { + var hasProceedingSpace = isCollapsibleWhitespace(parentBlockText, textIndex - 1); + var hasTrailingSpace = isCollapsibleWhitespace(parentBlockText, textIndex + text.length); + return (hasProceedingSpace ? ' ' : '') + text + (hasTrailingSpace ? ' ' : ''); + } + } else { + return text; + } + }).getOr(''); + }; + var getSerializedContent = function (editor, args) { + var rng = editor.selection.getRng(), tmpElm = editor.dom.create('body'); + var sel = editor.selection.getSel(); + var ranges = processRanges(editor, getRanges(sel)); + var fragment = args.contextual ? read$1(SugarElement.fromDom(editor.getBody()), ranges).dom : rng.cloneContents(); + if (fragment) { + tmpElm.appendChild(fragment); + } + return editor.selection.serializer.serialize(tmpElm, args); + }; + var getSelectedContentInternal = function (editor, format, args) { + if (args === void 0) { + args = {}; + } + args.get = true; + args.format = format; + args.selection = true; + args = editor.fire('BeforeGetContent', args); + if (args.isDefaultPrevented()) { + editor.fire('GetContent', args); + return args.content; + } + if (args.format === 'text') { + return getTextContent(editor); + } else { + args.getInner = true; + var content = getSerializedContent(editor, args); + if (args.format === 'tree') { + return content; + } else { + args.content = editor.selection.isCollapsed() ? '' : content; + editor.fire('GetContent', args); + return args.content; + } + } + }; + + var KEEP = 0, INSERT = 1, DELETE = 2; + var diff = function (left, right) { + var size = left.length + right.length + 2; + var vDown = new Array(size); + var vUp = new Array(size); + var snake = function (start, end, diag) { + return { + start: start, + end: end, + diag: diag + }; + }; + var buildScript = function (start1, end1, start2, end2, script) { + var middle = getMiddleSnake(start1, end1, start2, end2); + if (middle === null || middle.start === end1 && middle.diag === end1 - end2 || middle.end === start1 && middle.diag === start1 - start2) { + var i = start1; + var j = start2; + while (i < end1 || j < end2) { + if (i < end1 && j < end2 && left[i] === right[j]) { + script.push([ + KEEP, + left[i] + ]); + ++i; + ++j; + } else { + if (end1 - start1 > end2 - start2) { + script.push([ + DELETE, + left[i] + ]); + ++i; + } else { + script.push([ + INSERT, + right[j] + ]); + ++j; + } + } + } + } else { + buildScript(start1, middle.start, start2, middle.start - middle.diag, script); + for (var i2 = middle.start; i2 < middle.end; ++i2) { + script.push([ + KEEP, + left[i2] + ]); + } + buildScript(middle.end, end1, middle.end - middle.diag, end2, script); + } + }; + var buildSnake = function (start, diag, end1, end2) { + var end = start; + while (end - diag < end2 && end < end1 && left[end] === right[end - diag]) { + ++end; + } + return snake(start, end, diag); + }; + var getMiddleSnake = function (start1, end1, start2, end2) { + var m = end1 - start1; + var n = end2 - start2; + if (m === 0 || n === 0) { + return null; + } + var delta = m - n; + var sum = n + m; + var offset = (sum % 2 === 0 ? sum : sum + 1) / 2; + vDown[1 + offset] = start1; + vUp[1 + offset] = end1 + 1; + var d, k, i, x, y; + for (d = 0; d <= offset; ++d) { + for (k = -d; k <= d; k += 2) { + i = k + offset; + if (k === -d || k !== d && vDown[i - 1] < vDown[i + 1]) { + vDown[i] = vDown[i + 1]; + } else { + vDown[i] = vDown[i - 1] + 1; + } + x = vDown[i]; + y = x - start1 + start2 - k; + while (x < end1 && y < end2 && left[x] === right[y]) { + vDown[i] = ++x; + ++y; + } + if (delta % 2 !== 0 && delta - d <= k && k <= delta + d) { + if (vUp[i - delta] <= vDown[i]) { + return buildSnake(vUp[i - delta], k + start1 - start2, end1, end2); + } + } + } + for (k = delta - d; k <= delta + d; k += 2) { + i = k + offset - delta; + if (k === delta - d || k !== delta + d && vUp[i + 1] <= vUp[i - 1]) { + vUp[i] = vUp[i + 1] - 1; + } else { + vUp[i] = vUp[i - 1]; + } + x = vUp[i] - 1; + y = x - start1 + start2 - k; + while (x >= start1 && y >= start2 && left[x] === right[y]) { + vUp[i] = x--; + y--; + } + if (delta % 2 === 0 && -d <= k && k <= d) { + if (vUp[i] <= vDown[i + delta]) { + return buildSnake(vUp[i], k + start1 - start2, end1, end2); + } + } + } + } + }; + var script = []; + buildScript(0, left.length, 0, right.length, script); + return script; + }; + + var getOuterHtml = function (elm) { + if (isElement$1(elm)) { + return elm.outerHTML; + } else if (isText$1(elm)) { + return Entities.encodeRaw(elm.data, false); + } else if (isComment$1(elm)) { + return ''; + } + return ''; + }; + var createFragment$1 = function (html) { + var node; + var container = document.createElement('div'); + var frag = document.createDocumentFragment(); + if (html) { + container.innerHTML = html; + } + while (node = container.firstChild) { + frag.appendChild(node); + } + return frag; + }; + var insertAt = function (elm, html, index) { + var fragment = createFragment$1(html); + if (elm.hasChildNodes() && index < elm.childNodes.length) { + var target = elm.childNodes[index]; + target.parentNode.insertBefore(fragment, target); + } else { + elm.appendChild(fragment); + } + }; + var removeAt = function (elm, index) { + if (elm.hasChildNodes() && index < elm.childNodes.length) { + var target = elm.childNodes[index]; + target.parentNode.removeChild(target); + } + }; + var applyDiff = function (diff, elm) { + var index = 0; + each(diff, function (action) { + if (action[0] === KEEP) { + index++; + } else if (action[0] === INSERT) { + insertAt(elm, action[1], index); + index++; + } else if (action[0] === DELETE) { + removeAt(elm, index); + } + }); + }; + var read$2 = function (elm) { + return filter(map(from$1(elm.childNodes), getOuterHtml), function (item) { + return item.length > 0; + }); + }; + var write = function (fragments, elm) { + var currentFragments = map(from$1(elm.childNodes), getOuterHtml); + applyDiff(diff(currentFragments, fragments), elm); + return elm; + }; + + var undoLevelDocument = Cell(Optional.none()); + var lazyTempDocument = function () { + return undoLevelDocument.get().getOrThunk(function () { + var doc = document.implementation.createHTMLDocument('undo'); + undoLevelDocument.set(Optional.some(doc)); + return doc; + }); + }; + var hasIframes = function (html) { + return html.indexOf('') !== -1; + }; + var createFragmentedLevel = function (fragments) { + return { + type: 'fragmented', + fragments: fragments, + content: '', + bookmark: null, + beforeBookmark: null + }; + }; + var createCompleteLevel = function (content) { + return { + type: 'complete', + fragments: null, + content: content, + bookmark: null, + beforeBookmark: null + }; + }; + var createFromEditor = function (editor) { + var fragments = read$2(editor.getBody()); + var trimmedFragments = bind(fragments, function (html) { + var trimmed = trimInternal(editor.serializer, html); + return trimmed.length > 0 ? [trimmed] : []; + }); + var content = trimmedFragments.join(''); + return hasIframes(content) ? createFragmentedLevel(trimmedFragments) : createCompleteLevel(content); + }; + var applyToEditor = function (editor, level, before) { + if (level.type === 'fragmented') { + write(level.fragments, editor.getBody()); + } else { + editor.setContent(level.content, { format: 'raw' }); + } + editor.selection.moveToBookmark(before ? level.beforeBookmark : level.bookmark); + }; + var getLevelContent = function (level) { + return level.type === 'fragmented' ? level.fragments.join('') : level.content; + }; + var getCleanLevelContent = function (level) { + var elm = SugarElement.fromTag('body', lazyTempDocument()); + set$1(elm, getLevelContent(level)); + each(descendants$1(elm, '*[data-mce-bogus]'), unwrap); + return get$7(elm); + }; + var hasEqualContent = function (level1, level2) { + return getLevelContent(level1) === getLevelContent(level2); + }; + var hasEqualCleanedContent = function (level1, level2) { + return getCleanLevelContent(level1) === getCleanLevelContent(level2); + }; + var isEq$4 = function (level1, level2) { + if (!level1 || !level2) { + return false; + } else if (hasEqualContent(level1, level2)) { + return true; + } else { + return hasEqualCleanedContent(level1, level2); + } + }; + + var isUnlocked = function (locks) { + return locks.get() === 0; + }; + + var setTyping = function (undoManager, typing, locks) { + if (isUnlocked(locks)) { + undoManager.typing = typing; + } + }; + var endTyping = function (undoManager, locks) { + if (undoManager.typing) { + setTyping(undoManager, false, locks); + undoManager.add(); + } + }; + var endTypingLevelIgnoreLocks = function (undoManager) { + if (undoManager.typing) { + undoManager.typing = false; + undoManager.add(); + } + }; + + var beforeChange = function (editor, locks, beforeBookmark) { + if (isUnlocked(locks)) { + beforeBookmark.set(Optional.some(getUndoBookmark(editor.selection))); + } + }; + var addUndoLevel = function (editor, undoManager, index, locks, beforeBookmark, level, event) { + var currentLevel = createFromEditor(editor); + level = level || {}; + level = Tools.extend(level, currentLevel); + if (isUnlocked(locks) === false || editor.removed) { + return null; + } + var lastLevel = undoManager.data[index.get()]; + if (editor.fire('BeforeAddUndo', { + level: level, + lastLevel: lastLevel, + originalEvent: event + }).isDefaultPrevented()) { + return null; + } + if (lastLevel && isEq$4(lastLevel, level)) { + return null; + } + if (undoManager.data[index.get()]) { + beforeBookmark.get().each(function (bm) { + undoManager.data[index.get()].beforeBookmark = bm; + }); + } + var customUndoRedoLevels = getCustomUndoRedoLevels(editor); + if (customUndoRedoLevels) { + if (undoManager.data.length > customUndoRedoLevels) { + for (var i = 0; i < undoManager.data.length - 1; i++) { + undoManager.data[i] = undoManager.data[i + 1]; + } + undoManager.data.length--; + index.set(undoManager.data.length); + } + } + level.bookmark = getUndoBookmark(editor.selection); + if (index.get() < undoManager.data.length - 1) { + undoManager.data.length = index.get() + 1; + } + undoManager.data.push(level); + index.set(undoManager.data.length - 1); + var args = { + level: level, + lastLevel: lastLevel, + originalEvent: event + }; + if (index.get() > 0) { + editor.setDirty(true); + editor.fire('AddUndo', args); + editor.fire('change', args); + } else { + editor.fire('AddUndo', args); + } + return level; + }; + var clear = function (editor, undoManager, index) { + undoManager.data = []; + index.set(0); + undoManager.typing = false; + editor.fire('ClearUndos'); + }; + var extra = function (editor, undoManager, index, callback1, callback2) { + if (undoManager.transact(callback1)) { + var bookmark = undoManager.data[index.get()].bookmark; + var lastLevel = undoManager.data[index.get() - 1]; + applyToEditor(editor, lastLevel, true); + if (undoManager.transact(callback2)) { + undoManager.data[index.get() - 1].beforeBookmark = bookmark; + } + } + }; + var redo = function (editor, index, data) { + var level; + if (index.get() < data.length - 1) { + index.set(index.get() + 1); + level = data[index.get()]; + applyToEditor(editor, level, false); + editor.setDirty(true); + editor.fire('Redo', { level: level }); + } + return level; + }; + var undo = function (editor, undoManager, locks, index) { + var level; + if (undoManager.typing) { + undoManager.add(); + undoManager.typing = false; + setTyping(undoManager, false, locks); + } + if (index.get() > 0) { + index.set(index.get() - 1); + level = undoManager.data[index.get()]; + applyToEditor(editor, level, true); + editor.setDirty(true); + editor.fire('Undo', { level: level }); + } + return level; + }; + var reset = function (undoManager) { + undoManager.clear(); + undoManager.add(); + }; + var hasUndo = function (editor, undoManager, index) { + return index.get() > 0 || undoManager.typing && undoManager.data[0] && !isEq$4(createFromEditor(editor), undoManager.data[0]); + }; + var hasRedo = function (undoManager, index) { + return index.get() < undoManager.data.length - 1 && !undoManager.typing; + }; + var transact = function (undoManager, locks, callback) { + endTyping(undoManager, locks); + undoManager.beforeChange(); + undoManager.ignore(callback); + return undoManager.add(); + }; + var ignore = function (locks, callback) { + try { + locks.set(locks.get() + 1); + callback(); + } finally { + locks.set(locks.get() - 1); + } + }; + + var isTreeNode$1 = function (content) { + return content instanceof AstNode; + }; + var runSerializerFiltersOnFragment = function (editor, fragment) { + filter$3(editor.serializer.getNodeFilters(), editor.serializer.getAttributeFilters(), fragment); + }; + var getInsertContext = function (editor) { + return Optional.from(editor.selection.getStart(true)).map(function (elm) { + return elm.nodeName.toLowerCase(); + }); + }; + var createDummyUndoLevel = function () { + return { + type: 'complete', + fragments: [], + content: '', + bookmark: null, + beforeBookmark: null + }; + }; + var makePlainAdaptor = function (editor) { + return { + undoManager: { + beforeChange: function (locks, beforeBookmark) { + return beforeChange(editor, locks, beforeBookmark); + }, + addUndoLevel: function (undoManager, index, locks, beforeBookmark, level, event) { + return addUndoLevel(editor, undoManager, index, locks, beforeBookmark, level, event); + }, + undo: function (undoManager, locks, index) { + return undo(editor, undoManager, locks, index); + }, + redo: function (index, data) { + return redo(editor, index, data); + }, + clear: function (undoManager, index) { + return clear(editor, undoManager, index); + }, + reset: function (undoManager) { + return reset(undoManager); + }, + hasUndo: function (undoManager, index) { + return hasUndo(editor, undoManager, index); + }, + hasRedo: function (undoManager, index) { + return hasRedo(undoManager, index); + }, + transact: function (undoManager, locks, callback) { + return transact(undoManager, locks, callback); + }, + ignore: function (locks, callback) { + return ignore(locks, callback); + }, + extra: function (undoManager, index, callback1, callback2) { + return extra(editor, undoManager, index, callback1, callback2); + } + }, + formatter: { + match: function (name, vars, node) { + return match(editor, name, vars, node); + }, + matchAll: function (names, vars) { + return matchAll(editor, names, vars); + }, + matchNode: function (node, name, vars, similar) { + return matchNode(editor, node, name, vars, similar); + }, + canApply: function (name) { + return canApply(editor, name); + }, + closest: function (names) { + return closest$3(editor, names); + }, + apply: function (name, vars, node) { + return applyFormat(editor, name, vars, node); + }, + remove: function (name, vars, node, similar) { + return remove$6(editor, name, vars, node, similar); + }, + toggle: function (name, vars, node) { + return toggle(editor, name, vars, node); + }, + formatChanged: function (registeredFormatListeners, formats, callback, similar) { + return formatChangedInternal(editor, registeredFormatListeners, formats, callback, similar); + } + }, + editor: { + getContent: function (args, format) { + return getContentInternal(editor, args, format); + }, + setContent: function (content, args) { + return setContentInternal(editor, content, args); + }, + insertContent: function (value, details) { + return insertHtmlAtCaret(editor, value, details); + }, + addVisual: function (elm) { + return addVisualInternal(editor, elm); + } + }, + selection: { + getContent: function (format, args) { + return getSelectedContentInternal(editor, format, args); + } + }, + raw: { + getModel: function () { + return Optional.none(); + } + } + }; + }; + var makeRtcAdaptor = function (tinymceEditor, rtcEditor) { + var defaultVars = function (vars) { + return isObject(vars) ? vars : {}; + }; + var unsupported = die('Unimplemented feature for rtc'); + var ignore = noop; + return { + undoManager: { + beforeChange: ignore, + addUndoLevel: unsupported, + undo: function () { + rtcEditor.undo(); + return createDummyUndoLevel(); + }, + redo: function () { + rtcEditor.redo(); + return createDummyUndoLevel(); + }, + clear: unsupported, + reset: unsupported, + hasUndo: function () { + return rtcEditor.hasUndo(); + }, + hasRedo: function () { + return rtcEditor.hasRedo(); + }, + transact: function (_undoManager, _locks, fn) { + rtcEditor.transact(fn); + return createDummyUndoLevel(); + }, + ignore: unsupported, + extra: unsupported + }, + formatter: { + match: function (name, vars, _node) { + return rtcEditor.matchFormat(name, defaultVars(vars)); + }, + matchAll: unsupported, + matchNode: unsupported, + canApply: function (name) { + return rtcEditor.canApplyFormat(name); + }, + closest: function (names) { + return rtcEditor.closestFormat(names); + }, + apply: function (name, vars, _node) { + return rtcEditor.applyFormat(name, defaultVars(vars)); + }, + remove: function (name, vars, _node, _similar) { + return rtcEditor.removeFormat(name, defaultVars(vars)); + }, + toggle: function (name, vars, _node) { + return rtcEditor.toggleFormat(name, defaultVars(vars)); + }, + formatChanged: function (_rfl, formats, callback, similar) { + return rtcEditor.formatChanged(formats, callback, similar); + } + }, + editor: { + getContent: function (args, format) { + if (format === 'html' || format === 'tree') { + var fragment = rtcEditor.getContent(); + var serializer = HtmlSerializer({ inner: true }); + runSerializerFiltersOnFragment(tinymceEditor, fragment); + return format === 'tree' ? fragment : serializer.serialize(fragment); + } else { + return makePlainAdaptor(tinymceEditor).editor.getContent(args, format); + } + }, + setContent: function (content, _args) { + var fragment = isTreeNode$1(content) ? content : tinymceEditor.parser.parse(content, { + isRootContent: true, + insert: true + }); + rtcEditor.setContent(fragment); + return content; + }, + insertContent: function (value, _details) { + var contextArgs = getInsertContext(tinymceEditor).fold(function () { + return {}; + }, function (context) { + return { context: context }; + }); + var fragment = isTreeNode$1(value) ? value : tinymceEditor.parser.parse(value, __assign(__assign({}, contextArgs), { insert: true })); + rtcEditor.insertContent(fragment); + }, + addVisual: function (_elm) { + } + }, + selection: { + getContent: function (format, args) { + if (format === 'html' || format === 'tree') { + var fragment = rtcEditor.getSelectedContent(); + var serializer = HtmlSerializer({}); + runSerializerFiltersOnFragment(tinymceEditor, fragment); + return format === 'tree' ? fragment : serializer.serialize(fragment); + } else { + return makePlainAdaptor(tinymceEditor).selection.getContent(format, args); + } + } + }, + raw: { + getModel: function () { + return Optional.some(rtcEditor.getRawModel()); + } + } + }; + }; + var isRtc = function (editor) { + return has(editor.plugins, 'rtc'); + }; + var setup$5 = function (editor) { + var editorCast = editor; + return get$1(editor.plugins, 'rtc').fold(function () { + editorCast.rtcInstance = makePlainAdaptor(editor); + return Optional.none(); + }, function (rtc) { + return Optional.some(rtc.setup().then(function (rtcEditor) { + editorCast.rtcInstance = makeRtcAdaptor(editor, rtcEditor); + return rtcEditor.isRemote; + })); + }); + }; + var getRtcInstanceWithFallback = function (editor) { + return editor.rtcInstance ? editor.rtcInstance : makePlainAdaptor(editor); + }; + var getRtcInstanceWithError = function (editor) { + var rtcInstance = editor.rtcInstance; + if (!rtcInstance) { + throw new Error('Failed to get RTC instance not yet initialized.'); + } else { + return rtcInstance; + } + }; + var beforeChange$1 = function (editor, locks, beforeBookmark) { + getRtcInstanceWithError(editor).undoManager.beforeChange(locks, beforeBookmark); + }; + var addUndoLevel$1 = function (editor, undoManager, index, locks, beforeBookmark, level, event) { + return getRtcInstanceWithError(editor).undoManager.addUndoLevel(undoManager, index, locks, beforeBookmark, level, event); + }; + var undo$1 = function (editor, undoManager, locks, index) { + return getRtcInstanceWithError(editor).undoManager.undo(undoManager, locks, index); + }; + var redo$1 = function (editor, index, data) { + return getRtcInstanceWithError(editor).undoManager.redo(index, data); + }; + var clear$1 = function (editor, undoManager, index) { + getRtcInstanceWithError(editor).undoManager.clear(undoManager, index); + }; + var reset$1 = function (editor, undoManager) { + getRtcInstanceWithError(editor).undoManager.reset(undoManager); + }; + var hasUndo$1 = function (editor, undoManager, index) { + return getRtcInstanceWithError(editor).undoManager.hasUndo(undoManager, index); + }; + var hasRedo$1 = function (editor, undoManager, index) { + return getRtcInstanceWithError(editor).undoManager.hasRedo(undoManager, index); + }; + var transact$1 = function (editor, undoManager, locks, callback) { + return getRtcInstanceWithError(editor).undoManager.transact(undoManager, locks, callback); + }; + var ignore$1 = function (editor, locks, callback) { + getRtcInstanceWithError(editor).undoManager.ignore(locks, callback); + }; + var extra$1 = function (editor, undoManager, index, callback1, callback2) { + getRtcInstanceWithError(editor).undoManager.extra(undoManager, index, callback1, callback2); + }; + var matchFormat = function (editor, name, vars, node) { + return getRtcInstanceWithError(editor).formatter.match(name, vars, node); + }; + var matchAllFormats = function (editor, names, vars) { + return getRtcInstanceWithError(editor).formatter.matchAll(names, vars); + }; + var matchNodeFormat = function (editor, node, name, vars, similar) { + return getRtcInstanceWithError(editor).formatter.matchNode(node, name, vars, similar); + }; + var canApplyFormat = function (editor, name) { + return getRtcInstanceWithError(editor).formatter.canApply(name); + }; + var closestFormat = function (editor, names) { + return getRtcInstanceWithError(editor).formatter.closest(names); + }; + var applyFormat$1 = function (editor, name, vars, node) { + getRtcInstanceWithError(editor).formatter.apply(name, vars, node); + }; + var removeFormat$1 = function (editor, name, vars, node, similar) { + getRtcInstanceWithError(editor).formatter.remove(name, vars, node, similar); + }; + var toggleFormat = function (editor, name, vars, node) { + getRtcInstanceWithError(editor).formatter.toggle(name, vars, node); + }; + var formatChanged = function (editor, registeredFormatListeners, formats, callback, similar) { + if (similar === void 0) { + similar = false; + } + return getRtcInstanceWithError(editor).formatter.formatChanged(registeredFormatListeners, formats, callback, similar); + }; + var getContent = function (editor, args, format) { + return getRtcInstanceWithFallback(editor).editor.getContent(args, format); + }; + var setContent = function (editor, content, args) { + return getRtcInstanceWithFallback(editor).editor.setContent(content, args); + }; + var insertContent = function (editor, value, details) { + return getRtcInstanceWithFallback(editor).editor.insertContent(value, details); + }; + var getSelectedContent = function (editor, format, args) { + return getRtcInstanceWithError(editor).selection.getContent(format, args); + }; + var addVisual = function (editor, elm) { + return getRtcInstanceWithError(editor).editor.addVisual(elm); + }; + + var getContent$1 = function (editor, args) { + if (args === void 0) { + args = {}; + } + var format = args.format ? args.format : 'html'; + return getSelectedContent(editor, format, args); + }; + + var removeEmpty = function (text) { + if (text.dom.length === 0) { + remove(text); + return Optional.none(); + } else { + return Optional.some(text); + } + }; + var walkPastBookmark = function (node, start) { + return node.filter(function (elm) { + return BookmarkManager$1.isBookmarkNode(elm.dom); + }).bind(start ? nextSibling : prevSibling); + }; + var merge = function (outer, inner, rng, start) { + var outerElm = outer.dom; + var innerElm = inner.dom; + var oldLength = start ? outerElm.length : innerElm.length; + if (start) { + mergeTextNodes(outerElm, innerElm, false, !start); + rng.setStart(innerElm, oldLength); + } else { + mergeTextNodes(innerElm, outerElm, false, !start); + rng.setEnd(innerElm, oldLength); + } + }; + var normalizeTextIfRequired = function (inner, start) { + parent(inner).each(function (root) { + var text = inner.dom; + if (start && needsToBeNbspLeft(root, CaretPosition$1(text, 0))) { + normalizeWhitespaceAfter(text, 0); + } else if (!start && needsToBeNbspRight(root, CaretPosition$1(text, text.length))) { + normalizeWhitespaceBefore(text, text.length); + } + }); + }; + var mergeAndNormalizeText = function (outerNode, innerNode, rng, start) { + outerNode.bind(function (outer) { + var normalizer = start ? normalizeWhitespaceBefore : normalizeWhitespaceAfter; + normalizer(outer.dom, start ? outer.dom.length : 0); + return innerNode.filter(isText).map(function (inner) { + return merge(outer, inner, rng, start); + }); + }).orThunk(function () { + var innerTextNode = walkPastBookmark(innerNode, start).or(innerNode).filter(isText); + return innerTextNode.map(function (inner) { + return normalizeTextIfRequired(inner, start); + }); + }); + }; + var rngSetContent = function (rng, fragment) { + var firstChild = Optional.from(fragment.firstChild).map(SugarElement.fromDom); + var lastChild = Optional.from(fragment.lastChild).map(SugarElement.fromDom); + rng.deleteContents(); + rng.insertNode(fragment); + var prevText = firstChild.bind(prevSibling).filter(isText).bind(removeEmpty); + var nextText = lastChild.bind(nextSibling).filter(isText).bind(removeEmpty); + mergeAndNormalizeText(prevText, firstChild, rng, true); + mergeAndNormalizeText(nextText, lastChild, rng, false); + rng.collapse(false); + }; + var setupArgs = function (args, content) { + return __assign(__assign({ format: 'html' }, args), { + set: true, + selection: true, + content: content + }); + }; + var cleanContent = function (editor, args) { + if (args.format !== 'raw') { + var rng = editor.selection.getRng(); + var contextBlock = editor.dom.getParent(rng.commonAncestorContainer, editor.dom.isBlock); + var contextArgs = contextBlock ? { context: contextBlock.nodeName.toLowerCase() } : {}; + var node = editor.parser.parse(args.content, __assign(__assign({ + isRootContent: true, + forced_root_block: false + }, contextArgs), args)); + return HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(node); + } else { + return args.content; + } + }; + var setContent$1 = function (editor, content, args) { + if (args === void 0) { + args = {}; + } + var contentArgs = setupArgs(args, content); + if (!contentArgs.no_events) { + contentArgs = editor.fire('BeforeSetContent', contentArgs); + if (contentArgs.isDefaultPrevented()) { + editor.fire('SetContent', contentArgs); + return; + } + } + args.content = cleanContent(editor, contentArgs); + var rng = editor.selection.getRng(); + rngSetContent(rng, rng.createContextualFragment(args.content)); + editor.selection.setRng(rng); + scrollRangeIntoView(editor, rng); + if (!contentArgs.no_events) { + editor.fire('SetContent', contentArgs); + } + }; + + var deleteFromCallbackMap = function (callbackMap, selector, callback) { + if (callbackMap && callbackMap.hasOwnProperty(selector)) { + var newCallbacks = filter(callbackMap[selector], function (cb) { + return cb !== callback; + }); + if (newCallbacks.length === 0) { + delete callbackMap[selector]; + } else { + callbackMap[selector] = newCallbacks; + } + } + }; + function SelectorChanged (dom, editor) { + var selectorChangedData; + var currentSelectors; + return { + selectorChangedWithUnbind: function (selector, callback) { + if (!selectorChangedData) { + selectorChangedData = {}; + currentSelectors = {}; + editor.on('NodeChange', function (e) { + var node = e.element, parents = dom.getParents(node, null, dom.getRoot()), matchedSelectors = {}; + Tools.each(selectorChangedData, function (callbacks, selector) { + Tools.each(parents, function (node) { + if (dom.is(node, selector)) { + if (!currentSelectors[selector]) { + Tools.each(callbacks, function (callback) { + callback(true, { + node: node, + selector: selector, + parents: parents + }); + }); + currentSelectors[selector] = callbacks; + } + matchedSelectors[selector] = callbacks; + return false; + } + }); + }); + Tools.each(currentSelectors, function (callbacks, selector) { + if (!matchedSelectors[selector]) { + delete currentSelectors[selector]; + Tools.each(callbacks, function (callback) { + callback(false, { + node: node, + selector: selector, + parents: parents + }); + }); + } + }); + }); + } + if (!selectorChangedData[selector]) { + selectorChangedData[selector] = []; + } + selectorChangedData[selector].push(callback); + return { + unbind: function () { + deleteFromCallbackMap(selectorChangedData, selector, callback); + deleteFromCallbackMap(currentSelectors, selector, callback); + } + }; + } + }; + } + + var isNativeIeSelection = function (rng) { + return !!rng.select; + }; + var isAttachedToDom = function (node) { + return !!(node && node.ownerDocument) && contains$2(SugarElement.fromDom(node.ownerDocument), SugarElement.fromDom(node)); + }; + var isValidRange = function (rng) { + if (!rng) { + return false; + } else if (isNativeIeSelection(rng)) { + return true; + } else { + return isAttachedToDom(rng.startContainer) && isAttachedToDom(rng.endContainer); + } + }; + var EditorSelection = function (dom, win, serializer, editor) { + var selectedRange; + var explicitRange; + var selectorChangedWithUnbind = SelectorChanged(dom, editor).selectorChangedWithUnbind; + var setCursorLocation = function (node, offset) { + var rng = dom.createRng(); + if (!node) { + moveEndPoint$1(dom, rng, editor.getBody(), true); + setRng(rng); + } else { + rng.setStart(node, offset); + rng.setEnd(node, offset); + setRng(rng); + collapse(false); + } + }; + var getContent = function (args) { + return getContent$1(editor, args); + }; + var setContent = function (content, args) { + return setContent$1(editor, content, args); + }; + var getStart = function (real) { + return getStart$2(editor.getBody(), getRng$1(), real); + }; + var getEnd$1 = function (real) { + return getEnd(editor.getBody(), getRng$1(), real); + }; + var getBookmark = function (type, normalized) { + return bookmarkManager.getBookmark(type, normalized); + }; + var moveToBookmark = function (bookmark) { + return bookmarkManager.moveToBookmark(bookmark); + }; + var select = function (node, content) { + select$1(dom, node, content).each(setRng); + return node; + }; + var isCollapsed = function () { + var rng = getRng$1(), sel = getSel(); + if (!rng || rng.item) { + return false; + } + if (rng.compareEndPoints) { + return rng.compareEndPoints('StartToEnd', rng) === 0; + } + return !sel || rng.collapsed; + }; + var collapse = function (toStart) { + var rng = getRng$1(); + rng.collapse(!!toStart); + setRng(rng); + }; + var getSel = function () { + return win.getSelection ? win.getSelection() : win.document.selection; + }; + var getRng$1 = function () { + var selection, rng, elm; + var tryCompareBoundaryPoints = function (how, sourceRange, destinationRange) { + try { + return sourceRange.compareBoundaryPoints(how, destinationRange); + } catch (ex) { + return -1; + } + }; + if (!win) { + return null; + } + var doc = win.document; + if (typeof doc === 'undefined' || doc === null) { + return null; + } + if (editor.bookmark !== undefined && hasFocus$1(editor) === false) { + var bookmark = getRng(editor); + if (bookmark.isSome()) { + return bookmark.map(function (r) { + return processRanges(editor, [r])[0]; + }).getOr(doc.createRange()); + } + } + try { + if ((selection = getSel()) && !isRestrictedNode(selection.anchorNode)) { + if (selection.rangeCount > 0) { + rng = selection.getRangeAt(0); + } else { + rng = selection.createRange ? selection.createRange() : doc.createRange(); + } + rng = processRanges(editor, [rng])[0]; + } + } catch (ex) { + } + if (!rng) { + rng = doc.createRange ? doc.createRange() : doc.body.createTextRange(); + } + if (rng.setStart && rng.startContainer.nodeType === 9 && rng.collapsed) { + elm = dom.getRoot(); + rng.setStart(elm, 0); + rng.setEnd(elm, 0); + } + if (selectedRange && explicitRange) { + if (tryCompareBoundaryPoints(rng.START_TO_START, rng, selectedRange) === 0 && tryCompareBoundaryPoints(rng.END_TO_END, rng, selectedRange) === 0) { + rng = explicitRange; + } else { + selectedRange = null; + explicitRange = null; + } + } + return rng; + }; + var setRng = function (rng, forward) { + var node; + if (!isValidRange(rng)) { + return; + } + var ieRange = isNativeIeSelection(rng) ? rng : null; + if (ieRange) { + explicitRange = null; + try { + ieRange.select(); + } catch (ex) { + } + return; + } + var sel = getSel(); + var evt = editor.fire('SetSelectionRange', { + range: rng, + forward: forward + }); + rng = evt.range; + if (sel) { + explicitRange = rng; + try { + sel.removeAllRanges(); + sel.addRange(rng); + } catch (ex) { + } + if (forward === false && sel.extend) { + sel.collapse(rng.endContainer, rng.endOffset); + sel.extend(rng.startContainer, rng.startOffset); + } + selectedRange = sel.rangeCount > 0 ? sel.getRangeAt(0) : null; + } + if (!rng.collapsed && rng.startContainer === rng.endContainer && sel.setBaseAndExtent && !Env.ie) { + if (rng.endOffset - rng.startOffset < 2) { + if (rng.startContainer.hasChildNodes()) { + node = rng.startContainer.childNodes[rng.startOffset]; + if (node && node.tagName === 'IMG') { + sel.setBaseAndExtent(rng.startContainer, rng.startOffset, rng.endContainer, rng.endOffset); + if (sel.anchorNode !== rng.startContainer || sel.focusNode !== rng.endContainer) { + sel.setBaseAndExtent(node, 0, node, 1); + } + } + } + } + } + editor.fire('AfterSetSelectionRange', { + range: rng, + forward: forward + }); + }; + var setNode = function (elm) { + setContent(dom.getOuterHTML(elm)); + return elm; + }; + var getNode = function () { + return getNode$1(editor.getBody(), getRng$1()); + }; + var getSelectedBlocks$1 = function (startElm, endElm) { + return getSelectedBlocks(dom, getRng$1(), startElm, endElm); + }; + var isForward = function () { + var sel = getSel(); + var anchorNode = sel === null || sel === void 0 ? void 0 : sel.anchorNode; + var focusNode = sel === null || sel === void 0 ? void 0 : sel.focusNode; + if (!sel || !anchorNode || !focusNode || isRestrictedNode(anchorNode) || isRestrictedNode(focusNode)) { + return true; + } + var anchorRange = dom.createRng(); + anchorRange.setStart(anchorNode, sel.anchorOffset); + anchorRange.collapse(true); + var focusRange = dom.createRng(); + focusRange.setStart(focusNode, sel.focusOffset); + focusRange.collapse(true); + return anchorRange.compareBoundaryPoints(anchorRange.START_TO_START, focusRange) <= 0; + }; + var normalize$1 = function () { + var rng = getRng$1(); + var sel = getSel(); + if (!hasMultipleRanges(sel) && hasAnyRanges(editor)) { + var normRng = normalize(dom, rng); + normRng.each(function (normRng) { + setRng(normRng, isForward()); + }); + return normRng.getOr(rng); + } + return rng; + }; + var selectorChanged = function (selector, callback) { + selectorChangedWithUnbind(selector, callback); + return exports; + }; + var getScrollContainer = function () { + var scrollContainer; + var node = dom.getRoot(); + while (node && node.nodeName !== 'BODY') { + if (node.scrollHeight > node.clientHeight) { + scrollContainer = node; + break; + } + node = node.parentNode; + } + return scrollContainer; + }; + var scrollIntoView = function (elm, alignToTop) { + return scrollElementIntoView(editor, elm, alignToTop); + }; + var placeCaretAt = function (clientX, clientY) { + return setRng(fromPoint$1(clientX, clientY, editor.getDoc())); + }; + var getBoundingClientRect = function () { + var rng = getRng$1(); + return rng.collapsed ? CaretPosition$1.fromRangeStart(rng).getClientRects()[0] : rng.getBoundingClientRect(); + }; + var destroy = function () { + win = selectedRange = explicitRange = null; + controlSelection.destroy(); + }; + var exports = { + bookmarkManager: null, + controlSelection: null, + dom: dom, + win: win, + serializer: serializer, + editor: editor, + collapse: collapse, + setCursorLocation: setCursorLocation, + getContent: getContent, + setContent: setContent, + getBookmark: getBookmark, + moveToBookmark: moveToBookmark, + select: select, + isCollapsed: isCollapsed, + isForward: isForward, + setNode: setNode, + getNode: getNode, + getSel: getSel, + setRng: setRng, + getRng: getRng$1, + getStart: getStart, + getEnd: getEnd$1, + getSelectedBlocks: getSelectedBlocks$1, + normalize: normalize$1, + selectorChanged: selectorChanged, + selectorChangedWithUnbind: selectorChangedWithUnbind, + getScrollContainer: getScrollContainer, + scrollIntoView: scrollIntoView, + placeCaretAt: placeCaretAt, + getBoundingClientRect: getBoundingClientRect, + destroy: destroy + }; + var bookmarkManager = BookmarkManager$1(exports); + var controlSelection = ControlSelection(exports, editor); + exports.bookmarkManager = bookmarkManager; + exports.controlSelection = controlSelection; + return exports; + }; + + var removeAttrs = function (node, names) { + each(names, function (name) { + node.attr(name, null); + }); + }; + var addFontToSpansFilter = function (domParser, styles, fontSizes) { + domParser.addNodeFilter('font', function (nodes) { + each(nodes, function (node) { + var props = styles.parse(node.attr('style')); + var color = node.attr('color'); + var face = node.attr('face'); + var size = node.attr('size'); + if (color) { + props.color = color; + } + if (face) { + props['font-family'] = face; + } + if (size) { + props['font-size'] = fontSizes[parseInt(node.attr('size'), 10) - 1]; + } + node.name = 'span'; + node.attr('style', styles.serialize(props)); + removeAttrs(node, [ + 'color', + 'face', + 'size' + ]); + }); + }); + }; + var addStrikeToSpanFilter = function (domParser, styles) { + domParser.addNodeFilter('strike', function (nodes) { + each(nodes, function (node) { + var props = styles.parse(node.attr('style')); + props['text-decoration'] = 'line-through'; + node.name = 'span'; + node.attr('style', styles.serialize(props)); + }); + }); + }; + var addFilters = function (domParser, settings) { + var styles = Styles(); + if (settings.convert_fonts_to_spans) { + addFontToSpansFilter(domParser, styles, Tools.explode(settings.font_size_legacy_values)); + } + addStrikeToSpanFilter(domParser, styles); + }; + var register$1 = function (domParser, settings) { + if (settings.inline_styles) { + addFilters(domParser, settings); + } + }; + + var blobUriToBlob = function (url) { + return new promiseObj(function (resolve, reject) { + var rejectWithError = function () { + reject('Cannot convert ' + url + ' to Blob. Resource might not exist or is inaccessible.'); + }; + try { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'blob'; + xhr.onload = function () { + if (this.status === 200) { + resolve(this.response); + } else { + rejectWithError(); + } + }; + xhr.onerror = rejectWithError; + xhr.send(); + } catch (ex) { + rejectWithError(); + } + }); + }; + var parseDataUri$1 = function (uri) { + var type; + var uriParts = decodeURIComponent(uri).split(','); + var matches = /data:([^;]+)/.exec(uriParts[0]); + if (matches) { + type = matches[1]; + } + return { + type: type, + data: uriParts[1] + }; + }; + var buildBlob = function (type, data) { + var str; + try { + str = atob(data); + } catch (e) { + return Optional.none(); + } + var arr = new Uint8Array(str.length); + for (var i = 0; i < arr.length; i++) { + arr[i] = str.charCodeAt(i); + } + return Optional.some(new Blob([arr], { type: type })); + }; + var dataUriToBlob = function (uri) { + return new promiseObj(function (resolve) { + var _a = parseDataUri$1(uri), type = _a.type, data = _a.data; + buildBlob(type, data).fold(function () { + return resolve(new Blob([])); + }, resolve); + }); + }; + var uriToBlob = function (url) { + if (url.indexOf('blob:') === 0) { + return blobUriToBlob(url); + } + if (url.indexOf('data:') === 0) { + return dataUriToBlob(url); + } + return null; + }; + var blobToDataUri = function (blob) { + return new promiseObj(function (resolve) { + var reader = new FileReader(); + reader.onloadend = function () { + resolve(reader.result); + }; + reader.readAsDataURL(blob); + }); + }; + + var count = 0; + var uniqueId = function (prefix) { + return (prefix || 'blobid') + count++; + }; + var imageToBlobInfo = function (blobCache, img, resolve, reject) { + var base64, blobInfo; + if (img.src.indexOf('blob:') === 0) { + blobInfo = blobCache.getByUri(img.src); + if (blobInfo) { + resolve({ + image: img, + blobInfo: blobInfo + }); + } else { + uriToBlob(img.src).then(function (blob) { + blobToDataUri(blob).then(function (dataUri) { + base64 = parseDataUri$1(dataUri).data; + blobInfo = blobCache.create(uniqueId(), blob, base64); + blobCache.add(blobInfo); + resolve({ + image: img, + blobInfo: blobInfo + }); + }); + }, function (err) { + reject(err); + }); + } + return; + } + var _a = parseDataUri$1(img.src), data = _a.data, type = _a.type; + base64 = data; + blobInfo = blobCache.getByData(base64, type); + if (blobInfo) { + resolve({ + image: img, + blobInfo: blobInfo + }); + } else { + uriToBlob(img.src).then(function (blob) { + blobInfo = blobCache.create(uniqueId(), blob, base64); + blobCache.add(blobInfo); + resolve({ + image: img, + blobInfo: blobInfo + }); + }, function (err) { + reject(err); + }); + } + }; + var getAllImages = function (elm) { + return elm ? from$1(elm.getElementsByTagName('img')) : []; + }; + function ImageScanner(uploadStatus, blobCache) { + var cachedPromises = {}; + var findAll = function (elm, predicate) { + if (!predicate) { + predicate = always; + } + var images = filter(getAllImages(elm), function (img) { + var src = img.src; + if (!Env.fileApi) { + return false; + } + if (img.hasAttribute('data-mce-bogus')) { + return false; + } + if (img.hasAttribute('data-mce-placeholder')) { + return false; + } + if (!src || src === Env.transparentSrc) { + return false; + } + if (src.indexOf('blob:') === 0) { + return !uploadStatus.isUploaded(src) && predicate(img); + } + if (src.indexOf('data:') === 0) { + return predicate(img); + } + return false; + }); + var promises = map(images, function (img) { + if (cachedPromises[img.src] !== undefined) { + return new promiseObj(function (resolve) { + cachedPromises[img.src].then(function (imageInfo) { + if (typeof imageInfo === 'string') { + return imageInfo; + } + resolve({ + image: img, + blobInfo: imageInfo.blobInfo + }); + }); + }); + } + var newPromise = new promiseObj(function (resolve, reject) { + imageToBlobInfo(blobCache, img, resolve, reject); + }).then(function (result) { + delete cachedPromises[result.image.src]; + return result; + }).catch(function (error) { + delete cachedPromises[img.src]; + return error; + }); + cachedPromises[img.src] = newPromise; + return newPromise; + }); + return promiseObj.all(promises); + }; + return { findAll: findAll }; + } + + var paddEmptyNode = function (settings, args, blockElements, node) { + var brPreferred = settings.padd_empty_with_br || args.insert; + if (brPreferred && blockElements[node.name]) { + node.empty().append(new AstNode('br', 1)).shortEnded = true; + } else { + node.empty().append(new AstNode('#text', 3)).value = nbsp; + } + }; + var isPaddedWithNbsp = function (node) { + return hasOnlyChild(node, '#text') && node.firstChild.value === nbsp; + }; + var hasOnlyChild = function (node, name) { + return node && node.firstChild && node.firstChild === node.lastChild && node.firstChild.name === name; + }; + var isPadded = function (schema, node) { + var rule = schema.getElementRule(node.name); + return rule && rule.paddEmpty; + }; + var isEmpty$2 = function (schema, nonEmptyElements, whitespaceElements, node) { + return node.isEmpty(nonEmptyElements, whitespaceElements, function (node) { + return isPadded(schema, node); + }); + }; + var isLineBreakNode = function (node, blockElements) { + return node && (blockElements[node.name] || node.name === 'br'); + }; + + var isBogusImage = function (img) { + return img.attr('data-mce-bogus'); + }; + var isInternalImageSource = function (img) { + return img.attr('src') === Env.transparentSrc || img.attr('data-mce-placeholder'); + }; + var isValidDataImg = function (img, settings) { + if (settings.images_dataimg_filter) { + var imgElem_1 = new Image(); + imgElem_1.src = img.attr('src'); + each$1(img.attributes.map, function (value, key) { + imgElem_1.setAttribute(key, value); + }); + return settings.images_dataimg_filter(imgElem_1); + } else { + return true; + } + }; + var registerBase64ImageFilter = function (parser, settings) { + var blobCache = settings.blob_cache; + var processImage = function (img) { + var inputSrc = img.attr('src'); + if (isInternalImageSource(img) || isBogusImage(img)) { + return; + } + parseDataUri(inputSrc).filter(function () { + return isValidDataImg(img, settings); + }).bind(function (_a) { + var type = _a.type, data = _a.data; + return Optional.from(blobCache.getByData(data, type)).orThunk(function () { + return buildBlob(type, data).map(function (blob) { + var blobInfo = blobCache.create(uniqueId(), blob, data); + blobCache.add(blobInfo); + return blobInfo; + }); + }); + }).each(function (blobInfo) { + img.attr('src', blobInfo.blobUri()); + }); + }; + if (blobCache) { + parser.addAttributeFilter('src', function (nodes) { + return each(nodes, processImage); + }); + } + }; + var register$2 = function (parser, settings) { + var schema = parser.schema; + if (settings.remove_trailing_brs) { + parser.addNodeFilter('br', function (nodes, _, args) { + var i; + var l = nodes.length; + var node; + var blockElements = Tools.extend({}, schema.getBlockElements()); + var nonEmptyElements = schema.getNonEmptyElements(); + var parent, lastParent, prev, prevName; + var whiteSpaceElements = schema.getWhiteSpaceElements(); + var elementRule, textNode; + blockElements.body = 1; + for (i = 0; i < l; i++) { + node = nodes[i]; + parent = node.parent; + if (blockElements[node.parent.name] && node === parent.lastChild) { + prev = node.prev; + while (prev) { + prevName = prev.name; + if (prevName !== 'span' || prev.attr('data-mce-type') !== 'bookmark') { + if (prevName === 'br') { + node = null; + } + break; + } + prev = prev.prev; + } + if (node) { + node.remove(); + if (isEmpty$2(schema, nonEmptyElements, whiteSpaceElements, parent)) { + elementRule = schema.getElementRule(parent.name); + if (elementRule) { + if (elementRule.removeEmpty) { + parent.remove(); + } else if (elementRule.paddEmpty) { + paddEmptyNode(settings, args, blockElements, parent); + } + } + } + } + } else { + lastParent = node; + while (parent && parent.firstChild === lastParent && parent.lastChild === lastParent) { + lastParent = parent; + if (blockElements[parent.name]) { + break; + } + parent = parent.parent; + } + if (lastParent === parent && settings.padd_empty_with_br !== true) { + textNode = new AstNode('#text', 3); + textNode.value = nbsp; + node.replace(textNode); + } + } + } + }); + } + parser.addAttributeFilter('href', function (nodes) { + var i = nodes.length; + var appendRel = function (rel) { + var parts = rel.split(' ').filter(function (p) { + return p.length > 0; + }); + return parts.concat(['noopener']).sort().join(' '); + }; + var addNoOpener = function (rel) { + var newRel = rel ? Tools.trim(rel) : ''; + if (!/\b(noopener)\b/g.test(newRel)) { + return appendRel(newRel); + } else { + return newRel; + } + }; + if (!settings.allow_unsafe_link_target) { + while (i--) { + var node = nodes[i]; + if (node.name === 'a' && node.attr('target') === '_blank') { + node.attr('rel', addNoOpener(node.attr('rel'))); + } + } + } + }); + if (!settings.allow_html_in_named_anchor) { + parser.addAttributeFilter('id,name', function (nodes) { + var i = nodes.length, sibling, prevSibling, parent, node; + while (i--) { + node = nodes[i]; + if (node.name === 'a' && node.firstChild && !node.attr('href')) { + parent = node.parent; + sibling = node.lastChild; + do { + prevSibling = sibling.prev; + parent.insert(sibling, node); + sibling = prevSibling; + } while (sibling); + } + } + }); + } + if (settings.fix_list_elements) { + parser.addNodeFilter('ul,ol', function (nodes) { + var i = nodes.length, node, parentNode; + while (i--) { + node = nodes[i]; + parentNode = node.parent; + if (parentNode.name === 'ul' || parentNode.name === 'ol') { + if (node.prev && node.prev.name === 'li') { + node.prev.append(node); + } else { + var li = new AstNode('li', 1); + li.attr('style', 'list-style-type: none'); + node.wrap(li); + } + } + } + }); + } + if (settings.validate && schema.getValidClasses()) { + parser.addAttributeFilter('class', function (nodes) { + var i = nodes.length, node, classList, ci, className, classValue; + var validClasses = schema.getValidClasses(); + var validClassesMap, valid; + while (i--) { + node = nodes[i]; + classList = node.attr('class').split(' '); + classValue = ''; + for (ci = 0; ci < classList.length; ci++) { + className = classList[ci]; + valid = false; + validClassesMap = validClasses['*']; + if (validClassesMap && validClassesMap[className]) { + valid = true; + } + validClassesMap = validClasses[node.name]; + if (!valid && validClassesMap && validClassesMap[className]) { + valid = true; + } + if (valid) { + if (classValue) { + classValue += ' '; + } + classValue += className; + } + } + if (!classValue.length) { + classValue = null; + } + node.attr('class', classValue); + } + }); + } + registerBase64ImageFilter(parser, settings); + }; + + var makeMap$4 = Tools.makeMap, each$d = Tools.each, explode$2 = Tools.explode, extend$2 = Tools.extend; + var DomParser = function (settings, schema) { + if (schema === void 0) { + schema = Schema(); + } + var nodeFilters = {}; + var attributeFilters = []; + var matchedNodes = {}; + var matchedAttributes = {}; + settings = settings || {}; + settings.validate = 'validate' in settings ? settings.validate : true; + settings.root_name = settings.root_name || 'body'; + var fixInvalidChildren = function (nodes) { + var ni, node, parent, parents, newParent, currentNode, tempNode, childNode, i; + var sibling, nextNode; + var nonSplitableElements = makeMap$4('tr,td,th,tbody,thead,tfoot,table'); + var nonEmptyElements = schema.getNonEmptyElements(); + var whitespaceElements = schema.getWhiteSpaceElements(); + var textBlockElements = schema.getTextBlockElements(); + var specialElements = schema.getSpecialElements(); + for (ni = 0; ni < nodes.length; ni++) { + node = nodes[ni]; + if (!node.parent || node.fixed) { + continue; + } + if (textBlockElements[node.name] && node.parent.name === 'li') { + sibling = node.next; + while (sibling) { + if (textBlockElements[sibling.name]) { + sibling.name = 'li'; + sibling.fixed = true; + node.parent.insert(sibling, node.parent); + } else { + break; + } + sibling = sibling.next; + } + node.unwrap(node); + continue; + } + parents = [node]; + for (parent = node.parent; parent && !schema.isValidChild(parent.name, node.name) && !nonSplitableElements[parent.name]; parent = parent.parent) { + parents.push(parent); + } + if (parent && parents.length > 1) { + parents.reverse(); + newParent = currentNode = filterNode(parents[0].clone()); + for (i = 0; i < parents.length - 1; i++) { + if (schema.isValidChild(currentNode.name, parents[i].name)) { + tempNode = filterNode(parents[i].clone()); + currentNode.append(tempNode); + } else { + tempNode = currentNode; + } + for (childNode = parents[i].firstChild; childNode && childNode !== parents[i + 1];) { + nextNode = childNode.next; + tempNode.append(childNode); + childNode = nextNode; + } + currentNode = tempNode; + } + if (!isEmpty$2(schema, nonEmptyElements, whitespaceElements, newParent)) { + parent.insert(newParent, parents[0], true); + parent.insert(node, newParent); + } else { + parent.insert(node, parents[0], true); + } + parent = parents[0]; + if (isEmpty$2(schema, nonEmptyElements, whitespaceElements, parent) || hasOnlyChild(parent, 'br')) { + parent.empty().remove(); + } + } else if (node.parent) { + if (node.name === 'li') { + sibling = node.prev; + if (sibling && (sibling.name === 'ul' || sibling.name === 'ol')) { + sibling.append(node); + continue; + } + sibling = node.next; + if (sibling && (sibling.name === 'ul' || sibling.name === 'ol')) { + sibling.insert(node, sibling.firstChild, true); + continue; + } + node.wrap(filterNode(new AstNode('ul', 1))); + continue; + } + if (schema.isValidChild(node.parent.name, 'div') && schema.isValidChild('div', node.name)) { + node.wrap(filterNode(new AstNode('div', 1))); + } else { + if (specialElements[node.name]) { + node.empty().remove(); + } else { + node.unwrap(); + } + } + } + } + }; + var filterNode = function (node) { + var i, name, list; + name = node.name; + if (name in nodeFilters) { + list = matchedNodes[name]; + if (list) { + list.push(node); + } else { + matchedNodes[name] = [node]; + } + } + i = attributeFilters.length; + while (i--) { + name = attributeFilters[i].name; + if (name in node.attributes.map) { + list = matchedAttributes[name]; + if (list) { + list.push(node); + } else { + matchedAttributes[name] = [node]; + } + } + } + return node; + }; + var addNodeFilter = function (name, callback) { + each$d(explode$2(name), function (name) { + var list = nodeFilters[name]; + if (!list) { + nodeFilters[name] = list = []; + } + list.push(callback); + }); + }; + var getNodeFilters = function () { + var out = []; + for (var name_1 in nodeFilters) { + if (nodeFilters.hasOwnProperty(name_1)) { + out.push({ + name: name_1, + callbacks: nodeFilters[name_1] + }); + } + } + return out; + }; + var addAttributeFilter = function (name, callback) { + each$d(explode$2(name), function (name) { + var i; + for (i = 0; i < attributeFilters.length; i++) { + if (attributeFilters[i].name === name) { + attributeFilters[i].callbacks.push(callback); + return; + } + } + attributeFilters.push({ + name: name, + callbacks: [callback] + }); + }); + }; + var getAttributeFilters = function () { + return [].concat(attributeFilters); + }; + var parse = function (html, args) { + var nodes, i, l, fi, fl, list, name; + var invalidChildren = []; + var isInWhiteSpacePreservedElement; + var node; + var getRootBlockName = function (name) { + if (name === false) { + return ''; + } else if (name === true) { + return 'p'; + } else { + return name; + } + }; + args = args || {}; + matchedNodes = {}; + matchedAttributes = {}; + var blockElements = extend$2(makeMap$4('script,style,head,html,body,title,meta,param'), schema.getBlockElements()); + var nonEmptyElements = schema.getNonEmptyElements(); + var children = schema.children; + var validate = settings.validate; + var forcedRootBlockName = 'forced_root_block' in args ? args.forced_root_block : settings.forced_root_block; + var rootBlockName = getRootBlockName(forcedRootBlockName); + var whiteSpaceElements = schema.getWhiteSpaceElements(); + var startWhiteSpaceRegExp = /^[ \t\r\n]+/; + var endWhiteSpaceRegExp = /[ \t\r\n]+$/; + var allWhiteSpaceRegExp = /[ \t\r\n]+/g; + var isAllWhiteSpaceRegExp = /^[ \t\r\n]+$/; + isInWhiteSpacePreservedElement = whiteSpaceElements.hasOwnProperty(args.context) || whiteSpaceElements.hasOwnProperty(settings.root_name); + var addRootBlocks = function () { + var node = rootNode.firstChild, next, rootBlockNode; + var trim = function (rootBlockNode) { + if (rootBlockNode) { + node = rootBlockNode.firstChild; + if (node && node.type === 3) { + node.value = node.value.replace(startWhiteSpaceRegExp, ''); + } + node = rootBlockNode.lastChild; + if (node && node.type === 3) { + node.value = node.value.replace(endWhiteSpaceRegExp, ''); + } + } + }; + if (!schema.isValidChild(rootNode.name, rootBlockName.toLowerCase())) { + return; + } + while (node) { + next = node.next; + if (node.type === 3 || node.type === 1 && node.name !== 'p' && !blockElements[node.name] && !node.attr('data-mce-type')) { + if (!rootBlockNode) { + rootBlockNode = createNode(rootBlockName, 1); + rootBlockNode.attr(settings.forced_root_block_attrs); + rootNode.insert(rootBlockNode, node); + rootBlockNode.append(node); + } else { + rootBlockNode.append(node); + } + } else { + trim(rootBlockNode); + rootBlockNode = null; + } + node = next; + } + trim(rootBlockNode); + }; + var createNode = function (name, type) { + var node = new AstNode(name, type); + var list; + if (name in nodeFilters) { + list = matchedNodes[name]; + if (list) { + list.push(node); + } else { + matchedNodes[name] = [node]; + } + } + return node; + }; + var removeWhitespaceBefore = function (node) { + var textNode, textNodeNext, textVal, sibling; + var blockElements = schema.getBlockElements(); + for (textNode = node.prev; textNode && textNode.type === 3;) { + textVal = textNode.value.replace(endWhiteSpaceRegExp, ''); + if (textVal.length > 0) { + textNode.value = textVal; + return; + } + textNodeNext = textNode.next; + if (textNodeNext) { + if (textNodeNext.type === 3 && textNodeNext.value.length) { + textNode = textNode.prev; + continue; + } + if (!blockElements[textNodeNext.name] && textNodeNext.name !== 'script' && textNodeNext.name !== 'style') { + textNode = textNode.prev; + continue; + } + } + sibling = textNode.prev; + textNode.remove(); + textNode = sibling; + } + }; + var cloneAndExcludeBlocks = function (input) { + var name; + var output = {}; + for (name in input) { + if (name !== 'li' && name !== 'p') { + output[name] = input[name]; + } + } + return output; + }; + var parser = SaxParser$1({ + validate: validate, + allow_html_data_urls: settings.allow_html_data_urls, + allow_svg_data_urls: settings.allow_svg_data_urls, + allow_script_urls: settings.allow_script_urls, + allow_conditional_comments: settings.allow_conditional_comments, + preserve_cdata: settings.preserve_cdata, + self_closing_elements: cloneAndExcludeBlocks(schema.getSelfClosingElements()), + cdata: function (text) { + node.append(createNode('#cdata', 4)).value = text; + }, + text: function (text, raw) { + var textNode; + if (!isInWhiteSpacePreservedElement) { + text = text.replace(allWhiteSpaceRegExp, ' '); + if (isLineBreakNode(node.lastChild, blockElements)) { + text = text.replace(startWhiteSpaceRegExp, ''); + } + } + if (text.length !== 0) { + textNode = createNode('#text', 3); + textNode.raw = !!raw; + node.append(textNode).value = text; + } + }, + comment: function (text) { + node.append(createNode('#comment', 8)).value = text; + }, + pi: function (name, text) { + node.append(createNode(name, 7)).value = text; + removeWhitespaceBefore(node); + }, + doctype: function (text) { + var newNode = node.append(createNode('#doctype', 10)); + newNode.value = text; + removeWhitespaceBefore(node); + }, + start: function (name, attrs, empty) { + var newNode, attrFiltersLen, attrName, parent; + var elementRule = validate ? schema.getElementRule(name) : {}; + if (elementRule) { + newNode = createNode(elementRule.outputName || name, 1); + newNode.attributes = attrs; + newNode.shortEnded = empty; + node.append(newNode); + parent = children[node.name]; + if (parent && children[newNode.name] && !parent[newNode.name]) { + invalidChildren.push(newNode); + } + attrFiltersLen = attributeFilters.length; + while (attrFiltersLen--) { + attrName = attributeFilters[attrFiltersLen].name; + if (attrName in attrs.map) { + list = matchedAttributes[attrName]; + if (list) { + list.push(newNode); + } else { + matchedAttributes[attrName] = [newNode]; + } + } + } + if (blockElements[name]) { + removeWhitespaceBefore(newNode); + } + if (!empty) { + node = newNode; + } + if (!isInWhiteSpacePreservedElement && whiteSpaceElements[name]) { + isInWhiteSpacePreservedElement = true; + } + } + }, + end: function (name) { + var textNode, text, sibling, tempNode; + var elementRule = validate ? schema.getElementRule(name) : {}; + if (elementRule) { + if (blockElements[name]) { + if (!isInWhiteSpacePreservedElement) { + textNode = node.firstChild; + if (textNode && textNode.type === 3) { + text = textNode.value.replace(startWhiteSpaceRegExp, ''); + if (text.length > 0) { + textNode.value = text; + textNode = textNode.next; + } else { + sibling = textNode.next; + textNode.remove(); + textNode = sibling; + while (textNode && textNode.type === 3) { + text = textNode.value; + sibling = textNode.next; + if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) { + textNode.remove(); + textNode = sibling; + } + textNode = sibling; + } + } + } + textNode = node.lastChild; + if (textNode && textNode.type === 3) { + text = textNode.value.replace(endWhiteSpaceRegExp, ''); + if (text.length > 0) { + textNode.value = text; + textNode = textNode.prev; + } else { + sibling = textNode.prev; + textNode.remove(); + textNode = sibling; + while (textNode && textNode.type === 3) { + text = textNode.value; + sibling = textNode.prev; + if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) { + textNode.remove(); + textNode = sibling; + } + textNode = sibling; + } + } + } + } + } + if (isInWhiteSpacePreservedElement && whiteSpaceElements[name]) { + isInWhiteSpacePreservedElement = false; + } + if (elementRule.removeEmpty && isEmpty$2(schema, nonEmptyElements, whiteSpaceElements, node)) { + tempNode = node.parent; + if (blockElements[node.name]) { + node.empty().remove(); + } else { + node.unwrap(); + } + node = tempNode; + return; + } + if (elementRule.paddEmpty && (isPaddedWithNbsp(node) || isEmpty$2(schema, nonEmptyElements, whiteSpaceElements, node))) { + paddEmptyNode(settings, args, blockElements, node); + } + node = node.parent; + } + } + }, schema); + var rootNode = node = new AstNode(args.context || settings.root_name, 11); + parser.parse(html, args.format); + if (validate && invalidChildren.length) { + if (!args.context) { + fixInvalidChildren(invalidChildren); + } else { + args.invalid = true; + } + } + if (rootBlockName && (rootNode.name === 'body' || args.isRootContent)) { + addRootBlocks(); + } + if (!args.invalid) { + for (name in matchedNodes) { + if (!matchedNodes.hasOwnProperty(name)) { + continue; + } + list = nodeFilters[name]; + nodes = matchedNodes[name]; + fi = nodes.length; + while (fi--) { + if (!nodes[fi].parent) { + nodes.splice(fi, 1); + } + } + for (i = 0, l = list.length; i < l; i++) { + list[i](nodes, name, args); + } + } + for (i = 0, l = attributeFilters.length; i < l; i++) { + list = attributeFilters[i]; + if (list.name in matchedAttributes) { + nodes = matchedAttributes[list.name]; + fi = nodes.length; + while (fi--) { + if (!nodes[fi].parent) { + nodes.splice(fi, 1); + } + } + for (fi = 0, fl = list.callbacks.length; fi < fl; fi++) { + list.callbacks[fi](nodes, list.name, args); + } + } + } + } + return rootNode; + }; + var exports = { + schema: schema, + addAttributeFilter: addAttributeFilter, + getAttributeFilters: getAttributeFilters, + addNodeFilter: addNodeFilter, + getNodeFilters: getNodeFilters, + filterNode: filterNode, + parse: parse + }; + register$2(exports, settings); + register$1(exports, settings); + return exports; + }; + + var register$3 = function (htmlParser, settings, dom) { + htmlParser.addAttributeFilter('data-mce-tabindex', function (nodes, name) { + var i = nodes.length, node; + while (i--) { + node = nodes[i]; + node.attr('tabindex', node.attr('data-mce-tabindex')); + node.attr(name, null); + } + }); + htmlParser.addAttributeFilter('src,href,style', function (nodes, name) { + var i = nodes.length, node, value; + var internalName = 'data-mce-' + name; + var urlConverter = settings.url_converter; + var urlConverterScope = settings.url_converter_scope; + while (i--) { + node = nodes[i]; + value = node.attr(internalName); + if (value !== undefined) { + node.attr(name, value.length > 0 ? value : null); + node.attr(internalName, null); + } else { + value = node.attr(name); + if (name === 'style') { + value = dom.serializeStyle(dom.parseStyle(value), node.name); + } else if (urlConverter) { + value = urlConverter.call(urlConverterScope, value, name, node.name); + } + node.attr(name, value.length > 0 ? value : null); + } + } + }); + htmlParser.addAttributeFilter('class', function (nodes) { + var i = nodes.length, node, value; + while (i--) { + node = nodes[i]; + value = node.attr('class'); + if (value) { + value = node.attr('class').replace(/(?:^|\s)mce-item-\w+(?!\S)/g, ''); + node.attr('class', value.length > 0 ? value : null); + } + } + }); + htmlParser.addAttributeFilter('data-mce-type', function (nodes, name, args) { + var i = nodes.length, node; + while (i--) { + node = nodes[i]; + if (node.attr('data-mce-type') === 'bookmark' && !args.cleanup) { + var hasChildren = Optional.from(node.firstChild).exists(function (firstChild) { + return !isZwsp$1(firstChild.value); + }); + if (hasChildren) { + node.unwrap(); + } else { + node.remove(); + } + } + } + }); + htmlParser.addNodeFilter('noscript', function (nodes) { + var i = nodes.length, node; + while (i--) { + node = nodes[i].firstChild; + if (node) { + node.value = Entities.decode(node.value); + } + } + }); + htmlParser.addNodeFilter('script,style', function (nodes, name) { + var i = nodes.length, node, value, type; + var trim = function (value) { + return value.replace(/()/g, '\n').replace(/^[\r\n]*|[\r\n]*$/g, '').replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g, ''); + }; + while (i--) { + node = nodes[i]; + value = node.firstChild ? node.firstChild.value : ''; + if (name === 'script') { + type = node.attr('type'); + if (type) { + node.attr('type', type === 'mce-no/type' ? null : type.replace(/^mce\-/, '')); + } + if (settings.element_format === 'xhtml' && value.length > 0) { + node.firstChild.value = '// '; + } + } else { + if (settings.element_format === 'xhtml' && value.length > 0) { + node.firstChild.value = ''; + } + } + } + }); + htmlParser.addNodeFilter('#comment', function (nodes) { + var i = nodes.length, node; + while (i--) { + node = nodes[i]; + if (settings.preserve_cdata && node.value.indexOf('[CDATA[') === 0) { + node.name = '#cdata'; + node.type = 4; + node.value = dom.decode(node.value.replace(/^\[CDATA\[|\]\]$/g, '')); + } else if (node.value.indexOf('mce:protected ') === 0) { + node.name = '#text'; + node.type = 3; + node.raw = true; + node.value = unescape(node.value).substr(14); + } + } + }); + htmlParser.addNodeFilter('xml:namespace,input', function (nodes, name) { + var i = nodes.length, node; + while (i--) { + node = nodes[i]; + if (node.type === 7) { + node.remove(); + } else if (node.type === 1) { + if (name === 'input' && !node.attr('type')) { + node.attr('type', 'text'); + } + } + } + }); + htmlParser.addAttributeFilter('data-mce-type', function (nodes) { + each(nodes, function (node) { + if (node.attr('data-mce-type') === 'format-caret') { + if (node.isEmpty(htmlParser.schema.getNonEmptyElements())) { + node.remove(); + } else { + node.unwrap(); + } + } + }); + }); + htmlParser.addAttributeFilter('data-mce-src,data-mce-href,data-mce-style,' + 'data-mce-selected,data-mce-expando,' + 'data-mce-type,data-mce-resize,data-mce-placeholder', function (nodes, name) { + var i = nodes.length; + while (i--) { + nodes[i].attr(name, null); + } + }); + }; + var trimTrailingBr = function (rootNode) { + var isBr = function (node) { + return node && node.name === 'br'; + }; + var brNode1 = rootNode.lastChild; + if (isBr(brNode1)) { + var brNode2 = brNode1.prev; + if (isBr(brNode2)) { + brNode1.remove(); + brNode2.remove(); + } + } + }; + + var preProcess = function (editor, node, args) { + var doc, oldDoc; + var dom = editor.dom; + node = node.cloneNode(true); + var impl = document.implementation; + if (impl.createHTMLDocument) { + doc = impl.createHTMLDocument(''); + Tools.each(node.nodeName === 'BODY' ? node.childNodes : [node], function (node) { + doc.body.appendChild(doc.importNode(node, true)); + }); + if (node.nodeName !== 'BODY') { + node = doc.body.firstChild; + } else { + node = doc.body; + } + oldDoc = dom.doc; + dom.doc = doc; + } + firePreProcess(editor, __assign(__assign({}, args), { node: node })); + if (oldDoc) { + dom.doc = oldDoc; + } + return node; + }; + var shouldFireEvent = function (editor, args) { + return editor && editor.hasEventListeners('PreProcess') && !args.no_events; + }; + var process = function (editor, node, args) { + return shouldFireEvent(editor, args) ? preProcess(editor, node, args) : node; + }; + + var addTempAttr = function (htmlParser, tempAttrs, name) { + if (Tools.inArray(tempAttrs, name) === -1) { + htmlParser.addAttributeFilter(name, function (nodes, name) { + var i = nodes.length; + while (i--) { + nodes[i].attr(name, null); + } + }); + tempAttrs.push(name); + } + }; + var postProcess$1 = function (editor, args, content) { + if (!args.no_events && editor) { + var outArgs = firePostProcess(editor, __assign(__assign({}, args), { content: content })); + return outArgs.content; + } else { + return content; + } + }; + var getHtmlFromNode = function (dom, node, args) { + var html = trim$2(args.getInner ? node.innerHTML : dom.getOuterHTML(node)); + return args.selection || isWsPreserveElement(SugarElement.fromDom(node)) ? html : Tools.trim(html); + }; + var parseHtml = function (htmlParser, html, args) { + var parserArgs = args.selection ? __assign({ forced_root_block: false }, args) : args; + var rootNode = htmlParser.parse(html, parserArgs); + trimTrailingBr(rootNode); + return rootNode; + }; + var serializeNode = function (settings, schema, node) { + var htmlSerializer = HtmlSerializer(settings, schema); + return htmlSerializer.serialize(node); + }; + var toHtml = function (editor, settings, schema, rootNode, args) { + var content = serializeNode(settings, schema, rootNode); + return postProcess$1(editor, args, content); + }; + var DomSerializerImpl = function (settings, editor) { + var tempAttrs = ['data-mce-selected']; + var dom = editor && editor.dom ? editor.dom : DOMUtils$1.DOM; + var schema = editor && editor.schema ? editor.schema : Schema(settings); + settings.entity_encoding = settings.entity_encoding || 'named'; + settings.remove_trailing_brs = 'remove_trailing_brs' in settings ? settings.remove_trailing_brs : true; + var htmlParser = DomParser(settings, schema); + register$3(htmlParser, settings, dom); + var serialize = function (node, parserArgs) { + if (parserArgs === void 0) { + parserArgs = {}; + } + var args = __assign({ format: 'html' }, parserArgs); + var targetNode = process(editor, node, args); + var html = getHtmlFromNode(dom, targetNode, args); + var rootNode = parseHtml(htmlParser, html, args); + return args.format === 'tree' ? rootNode : toHtml(editor, settings, schema, rootNode, args); + }; + return { + schema: schema, + addNodeFilter: htmlParser.addNodeFilter, + addAttributeFilter: htmlParser.addAttributeFilter, + serialize: serialize, + addRules: function (rules) { + schema.addValidElements(rules); + }, + setRules: function (rules) { + schema.setValidElements(rules); + }, + addTempAttr: curry(addTempAttr, htmlParser, tempAttrs), + getTempAttrs: function () { + return tempAttrs; + }, + getNodeFilters: htmlParser.getNodeFilters, + getAttributeFilters: htmlParser.getAttributeFilters + }; + }; + + var DomSerializer = function (settings, editor) { + var domSerializer = DomSerializerImpl(settings, editor); + return { + schema: domSerializer.schema, + addNodeFilter: domSerializer.addNodeFilter, + addAttributeFilter: domSerializer.addAttributeFilter, + serialize: domSerializer.serialize, + addRules: domSerializer.addRules, + setRules: domSerializer.setRules, + addTempAttr: domSerializer.addTempAttr, + getTempAttrs: domSerializer.getTempAttrs, + getNodeFilters: domSerializer.getNodeFilters, + getAttributeFilters: domSerializer.getAttributeFilters + }; + }; + + var defaultFormat$1 = 'html'; + var getContent$2 = function (editor, args) { + if (args === void 0) { + args = {}; + } + var format = args.format ? args.format : defaultFormat$1; + return getContent(editor, args, format); + }; + + var setContent$2 = function (editor, content, args) { + if (args === void 0) { + args = {}; + } + return setContent(editor, content, args); + }; + + var DOM$3 = DOMUtils$1.DOM; + var restoreOriginalStyles = function (editor) { + DOM$3.setStyle(editor.id, 'display', editor.orgDisplay); + }; + var safeDestroy = function (x) { + return Optional.from(x).each(function (x) { + return x.destroy(); + }); + }; + var clearDomReferences = function (editor) { + editor.contentAreaContainer = editor.formElement = editor.container = editor.editorContainer = null; + editor.bodyElement = editor.contentDocument = editor.contentWindow = null; + editor.iframeElement = editor.targetElm = null; + if (editor.selection) { + editor.selection = editor.selection.win = editor.selection.dom = editor.selection.dom.doc = null; + } + }; + var restoreForm = function (editor) { + var form = editor.formElement; + if (form) { + if (form._mceOldSubmit) { + form.submit = form._mceOldSubmit; + form._mceOldSubmit = null; + } + DOM$3.unbind(form, 'submit reset', editor.formEventDelegate); + } + }; + var remove$7 = function (editor) { + if (!editor.removed) { + var _selectionOverrides = editor._selectionOverrides, editorUpload = editor.editorUpload; + var body = editor.getBody(); + var element = editor.getElement(); + if (body) { + editor.save({ is_removing: true }); + } + editor.removed = true; + editor.unbindAllNativeEvents(); + if (editor.hasHiddenInput && element) { + DOM$3.remove(element.nextSibling); + } + fireRemove(editor); + editor.editorManager.remove(editor); + if (!editor.inline && body) { + restoreOriginalStyles(editor); + } + fireDetach(editor); + DOM$3.remove(editor.getContainer()); + safeDestroy(_selectionOverrides); + safeDestroy(editorUpload); + editor.destroy(); + } + }; + var destroy = function (editor, automatic) { + var selection = editor.selection, dom = editor.dom; + if (editor.destroyed) { + return; + } + if (!automatic && !editor.removed) { + editor.remove(); + return; + } + if (!automatic) { + editor.editorManager.off('beforeunload', editor._beforeUnload); + if (editor.theme && editor.theme.destroy) { + editor.theme.destroy(); + } + safeDestroy(selection); + safeDestroy(dom); + } + restoreForm(editor); + clearDomReferences(editor); + editor.destroyed = true; + }; + + var hasOwnProperty$2 = Object.prototype.hasOwnProperty; + var deep$1 = function (old, nu) { + var bothObjects = isObject(old) && isObject(nu); + return bothObjects ? deepMerge(old, nu) : 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$2.call(curObject, key)) { + ret[key] = merger(ret[key], curObject[key]); + } + } + } + return ret; + }; + }; + var deepMerge = baseMerge(deep$1); + + var sectionResult = function (sections, settings) { + return { + sections: constant(sections), + settings: constant(settings) + }; + }; + var deviceDetection = detect$3().deviceType; + var isTouch = deviceDetection.isTouch(); + var isPhone = deviceDetection.isPhone(); + var isTablet = deviceDetection.isTablet(); + var legacyMobilePlugins = [ + 'lists', + 'autolink', + 'autosave' + ]; + var defaultTouchSettings = { + table_grid: false, + object_resizing: false, + resize: false + }; + var normalizePlugins = function (plugins) { + var pluginNames = isArray(plugins) ? plugins.join(' ') : plugins; + var trimmedPlugins = map(isString(pluginNames) ? pluginNames.split(' ') : [], trim); + return filter(trimmedPlugins, function (item) { + return item.length > 0; + }); + }; + var filterLegacyMobilePlugins = function (plugins) { + return filter(plugins, curry(contains, legacyMobilePlugins)); + }; + var extractSections = function (keys, settings) { + var result = bifilter(settings, function (value, key) { + return contains(keys, key); + }); + return sectionResult(result.t, result.f); + }; + var getSection = function (sectionResult, name, defaults) { + if (defaults === void 0) { + defaults = {}; + } + var sections = sectionResult.sections(); + var sectionSettings = sections.hasOwnProperty(name) ? sections[name] : {}; + return Tools.extend({}, defaults, sectionSettings); + }; + var hasSection = function (sectionResult, name) { + return sectionResult.sections().hasOwnProperty(name); + }; + var isSectionTheme = function (sectionResult, name, theme) { + var section = sectionResult.sections(); + return hasSection(sectionResult, name) && section[name].theme === theme; + }; + var getSectionConfig = function (sectionResult, name) { + return hasSection(sectionResult, name) ? sectionResult.sections()[name] : {}; + }; + var getToolbarMode = function (settings, defaultVal) { + return get$1(settings, 'toolbar_mode').orThunk(function () { + return get$1(settings, 'toolbar_drawer').map(function (val) { + return val === false ? 'wrap' : val; + }); + }).getOr(defaultVal); + }; + var getDefaultSettings = function (settings, id, documentBaseUrl, isTouch, editor) { + var baseDefaults = { + id: id, + theme: 'silver', + toolbar_mode: getToolbarMode(settings, 'floating'), + plugins: '', + document_base_url: documentBaseUrl, + add_form_submit_trigger: true, + submit_patch: true, + add_unload_trigger: true, + convert_urls: true, + relative_urls: true, + remove_script_host: true, + object_resizing: true, + doctype: '', + visual: true, + font_size_legacy_values: 'xx-small,small,medium,large,x-large,xx-large,300%', + forced_root_block: 'p', + hidden_input: true, + inline_styles: true, + convert_fonts_to_spans: true, + indent: true, + indent_before: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' + 'tfoot,tbody,tr,section,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist', + indent_after: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' + 'tfoot,tbody,tr,section,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist', + entity_encoding: 'named', + url_converter: editor.convertURL, + url_converter_scope: editor + }; + return __assign(__assign({}, baseDefaults), isTouch ? defaultTouchSettings : {}); + }; + var getDefaultMobileSettings = function (mobileSettings, isPhone) { + var defaultMobileSettings = { + resize: false, + toolbar_mode: getToolbarMode(mobileSettings, 'scrolling'), + toolbar_sticky: false + }; + var defaultPhoneSettings = { menubar: false }; + return __assign(__assign(__assign({}, defaultTouchSettings), defaultMobileSettings), isPhone ? defaultPhoneSettings : {}); + }; + var getExternalPlugins$1 = function (overrideSettings, settings) { + var userDefinedExternalPlugins = settings.external_plugins ? settings.external_plugins : {}; + if (overrideSettings && overrideSettings.external_plugins) { + return Tools.extend({}, overrideSettings.external_plugins, userDefinedExternalPlugins); + } else { + return userDefinedExternalPlugins; + } + }; + var combinePlugins = function (forcedPlugins, plugins) { + return [].concat(normalizePlugins(forcedPlugins)).concat(normalizePlugins(plugins)); + }; + var getPlatformPlugins = function (isMobileDevice, sectionResult, desktopPlugins, mobilePlugins) { + if (isMobileDevice && isSectionTheme(sectionResult, 'mobile', 'mobile')) { + return filterLegacyMobilePlugins(mobilePlugins); + } else if (isMobileDevice && hasSection(sectionResult, 'mobile')) { + return mobilePlugins; + } else { + return desktopPlugins; + } + }; + var processPlugins = function (isMobileDevice, sectionResult, defaultOverrideSettings, settings) { + var forcedPlugins = normalizePlugins(defaultOverrideSettings.forced_plugins); + var desktopPlugins = normalizePlugins(settings.plugins); + var mobileConfig = getSectionConfig(sectionResult, 'mobile'); + var mobilePlugins = mobileConfig.plugins ? normalizePlugins(mobileConfig.plugins) : desktopPlugins; + var platformPlugins = getPlatformPlugins(isMobileDevice, sectionResult, desktopPlugins, mobilePlugins); + var combinedPlugins = combinePlugins(forcedPlugins, platformPlugins); + if (Env.browser.isIE() && contains(combinedPlugins, 'rtc')) { + throw new Error('RTC plugin is not supported on IE 11.'); + } + return Tools.extend(settings, { plugins: combinedPlugins.join(' ') }); + }; + var isOnMobile = function (isMobileDevice, sectionResult) { + return isMobileDevice && hasSection(sectionResult, 'mobile'); + }; + var combineSettings = function (isMobileDevice, isPhone, defaultSettings, defaultOverrideSettings, settings) { + var defaultDeviceSettings = isMobileDevice ? { mobile: getDefaultMobileSettings(settings.mobile || {}, isPhone) } : {}; + var sectionResult = extractSections(['mobile'], deepMerge(defaultDeviceSettings, settings)); + var extendedSettings = Tools.extend(defaultSettings, defaultOverrideSettings, sectionResult.settings(), isOnMobile(isMobileDevice, sectionResult) ? getSection(sectionResult, 'mobile') : {}, { + validate: true, + external_plugins: getExternalPlugins$1(defaultOverrideSettings, sectionResult.settings()) + }); + return processPlugins(isMobileDevice, sectionResult, defaultOverrideSettings, extendedSettings); + }; + var getEditorSettings = function (editor, id, documentBaseUrl, defaultOverrideSettings, settings) { + var defaultSettings = getDefaultSettings(settings, id, documentBaseUrl, isTouch, editor); + return combineSettings(isPhone || isTablet, isPhone, defaultSettings, defaultOverrideSettings, settings); + }; + var getFiltered = function (predicate, editor, name) { + return Optional.from(editor.settings[name]).filter(predicate); + }; + var getParamObject = function (value) { + var output = {}; + if (typeof value === 'string') { + each(value.indexOf('=') > 0 ? value.split(/[;,](?![^=;,]*(?:[;,]|$))/) : value.split(','), function (val) { + var arr = val.split('='); + if (arr.length > 1) { + output[Tools.trim(arr[0])] = Tools.trim(arr[1]); + } else { + output[Tools.trim(arr[0])] = Tools.trim(arr[0]); + } + }); + } else { + output = value; + } + return output; + }; + var isArrayOf = function (p) { + return function (a) { + return isArray(a) && forall(a, p); + }; + }; + var getParam = function (editor, name, defaultVal, type) { + var value = name in editor.settings ? editor.settings[name] : defaultVal; + if (type === 'hash') { + return getParamObject(value); + } else if (type === 'string') { + return getFiltered(isString, editor, name).getOr(defaultVal); + } else if (type === 'number') { + return getFiltered(isNumber, editor, name).getOr(defaultVal); + } else if (type === 'boolean') { + return getFiltered(isBoolean, editor, name).getOr(defaultVal); + } else if (type === 'object') { + return getFiltered(isObject, editor, name).getOr(defaultVal); + } else if (type === 'array') { + return getFiltered(isArray, editor, name).getOr(defaultVal); + } else if (type === 'string[]') { + return getFiltered(isArrayOf(isString), editor, name).getOr(defaultVal); + } else if (type === 'function') { + return getFiltered(isFunction, editor, name).getOr(defaultVal); + } else { + return value; + } + }; + + var CreateIconManager = function () { + var lookup = {}; + var add = function (id, iconPack) { + lookup[id] = iconPack; + }; + var get = function (id) { + if (lookup[id]) { + return lookup[id]; + } + return { icons: {} }; + }; + var has$1 = function (id) { + return has(lookup, id); + }; + return { + add: add, + get: get, + has: has$1 + }; + }; + var IconManager = CreateIconManager(); + + var getProp = function (propName, elm) { + var rawElm = elm.dom; + return rawElm[propName]; + }; + var getComputedSizeProp = function (propName, elm) { + return parseInt(get$5(elm, propName), 10); + }; + var getClientWidth = curry(getProp, 'clientWidth'); + var getClientHeight = curry(getProp, 'clientHeight'); + var getMarginTop = curry(getComputedSizeProp, 'margin-top'); + var getMarginLeft = curry(getComputedSizeProp, 'margin-left'); + var getBoundingClientRect$1 = function (elm) { + return elm.dom.getBoundingClientRect(); + }; + var isInsideElementContentArea = function (bodyElm, clientX, clientY) { + var clientWidth = getClientWidth(bodyElm); + var clientHeight = getClientHeight(bodyElm); + return clientX >= 0 && clientY >= 0 && clientX <= clientWidth && clientY <= clientHeight; + }; + var transpose = function (inline, elm, clientX, clientY) { + var clientRect = getBoundingClientRect$1(elm); + var deltaX = inline ? clientRect.left + elm.dom.clientLeft + getMarginLeft(elm) : 0; + var deltaY = inline ? clientRect.top + elm.dom.clientTop + getMarginTop(elm) : 0; + var x = clientX - deltaX; + var y = clientY - deltaY; + return { + x: x, + y: y + }; + }; + var isXYInContentArea = function (editor, clientX, clientY) { + var bodyElm = SugarElement.fromDom(editor.getBody()); + var targetElm = editor.inline ? bodyElm : documentElement(bodyElm); + var transposedPoint = transpose(editor.inline, targetElm, clientX, clientY); + return isInsideElementContentArea(targetElm, transposedPoint.x, transposedPoint.y); + }; + var fromDomSafe = function (node) { + return Optional.from(node).map(SugarElement.fromDom); + }; + var isEditorAttachedToDom = function (editor) { + var rawContainer = editor.inline ? editor.getBody() : editor.getContentAreaContainer(); + return fromDomSafe(rawContainer).map(inBody).getOr(false); + }; + + function NotificationManagerImpl() { + var unimplemented = function () { + throw new Error('Theme did not provide a NotificationManager implementation.'); + }; + return { + open: unimplemented, + close: unimplemented, + reposition: unimplemented, + getArgs: unimplemented + }; + } + + function NotificationManager(editor) { + var notifications = []; + var getImplementation = function () { + var theme = editor.theme; + return theme && theme.getNotificationManagerImpl ? theme.getNotificationManagerImpl() : NotificationManagerImpl(); + }; + var getTopNotification = function () { + return Optional.from(notifications[0]); + }; + var isEqual = function (a, b) { + return a.type === b.type && a.text === b.text && !a.progressBar && !a.timeout && !b.progressBar && !b.timeout; + }; + var reposition = function () { + if (notifications.length > 0) { + getImplementation().reposition(notifications); + } + }; + var addNotification = function (notification) { + notifications.push(notification); + }; + var closeNotification = function (notification) { + findIndex(notifications, function (otherNotification) { + return otherNotification === notification; + }).each(function (index) { + notifications.splice(index, 1); + }); + }; + var open = function (spec, fireEvent) { + if (fireEvent === void 0) { + fireEvent = true; + } + if (editor.removed || !isEditorAttachedToDom(editor)) { + return; + } + if (fireEvent) { + editor.fire('BeforeOpenNotification', { notification: spec }); + } + return find(notifications, function (notification) { + return isEqual(getImplementation().getArgs(notification), spec); + }).getOrThunk(function () { + editor.editorManager.setActive(editor); + var notification = getImplementation().open(spec, function () { + closeNotification(notification); + reposition(); + getTopNotification().fold(function () { + return editor.focus(); + }, function (top) { + return focus(SugarElement.fromDom(top.getEl())); + }); + }); + addNotification(notification); + reposition(); + editor.fire('OpenNotification', __assign({}, notification)); + return notification; + }); + }; + var close = function () { + getTopNotification().each(function (notification) { + getImplementation().close(notification); + closeNotification(notification); + reposition(); + }); + }; + var getNotifications = function () { + return notifications; + }; + var registerEvents = function (editor) { + editor.on('SkinLoaded', function () { + var serviceMessage = getServiceMessage(editor); + if (serviceMessage) { + open({ + text: serviceMessage, + type: 'warning', + timeout: 0 + }, false); + } + }); + editor.on('ResizeEditor ResizeWindow NodeChange', function () { + Delay.requestAnimationFrame(reposition); + }); + editor.on('remove', function () { + each(notifications.slice(), function (notification) { + getImplementation().close(notification); + }); + }); + }; + registerEvents(editor); + return { + open: open, + close: close, + getNotifications: getNotifications + }; + } + + var PluginManager = AddOnManager$1.PluginManager; + + var ThemeManager = AddOnManager$1.ThemeManager; + + function WindowManagerImpl () { + var unimplemented = function () { + throw new Error('Theme did not provide a WindowManager implementation.'); + }; + return { + open: unimplemented, + openUrl: unimplemented, + alert: unimplemented, + confirm: unimplemented, + close: unimplemented, + getParams: unimplemented, + setParams: unimplemented + }; + } + + var WindowManager = function (editor) { + var dialogs = []; + var getImplementation = function () { + var theme = editor.theme; + return theme && theme.getWindowManagerImpl ? theme.getWindowManagerImpl() : WindowManagerImpl(); + }; + var funcBind = function (scope, f) { + return function () { + return f ? f.apply(scope, arguments) : undefined; + }; + }; + var fireOpenEvent = function (dialog) { + editor.fire('OpenWindow', { dialog: dialog }); + }; + var fireCloseEvent = function (dialog) { + editor.fire('CloseWindow', { dialog: dialog }); + }; + var addDialog = function (dialog) { + dialogs.push(dialog); + fireOpenEvent(dialog); + }; + var closeDialog = function (dialog) { + fireCloseEvent(dialog); + dialogs = filter(dialogs, function (otherDialog) { + return otherDialog !== dialog; + }); + if (dialogs.length === 0) { + editor.focus(); + } + }; + var getTopDialog = function () { + return Optional.from(dialogs[dialogs.length - 1]); + }; + var storeSelectionAndOpenDialog = function (openDialog) { + editor.editorManager.setActive(editor); + store(editor); + var dialog = openDialog(); + addDialog(dialog); + return dialog; + }; + var open = function (args, params) { + return storeSelectionAndOpenDialog(function () { + return getImplementation().open(args, params, closeDialog); + }); + }; + var openUrl = function (args) { + return storeSelectionAndOpenDialog(function () { + return getImplementation().openUrl(args, closeDialog); + }); + }; + var alert = function (message, callback, scope) { + getImplementation().alert(message, funcBind(scope ? scope : this, callback)); + }; + var confirm = function (message, callback, scope) { + getImplementation().confirm(message, funcBind(scope ? scope : this, callback)); + }; + var close = function () { + getTopDialog().each(function (dialog) { + getImplementation().close(dialog); + closeDialog(dialog); + }); + }; + editor.on('remove', function () { + each(dialogs, function (dialog) { + getImplementation().close(dialog); + }); + }); + return { + open: open, + openUrl: openUrl, + alert: alert, + confirm: confirm, + close: close + }; + }; + + var displayNotification = function (editor, message) { + editor.notificationManager.open({ + type: 'error', + text: message + }); + }; + var displayError = function (editor, message) { + if (editor._skinLoaded) { + displayNotification(editor, message); + } else { + editor.on('SkinLoaded', function () { + displayNotification(editor, message); + }); + } + }; + var uploadError = function (editor, message) { + displayError(editor, I18n.translate([ + 'Failed to upload image: {0}', + message + ])); + }; + var logError = function (editor, errorType, msg) { + fireError(editor, errorType, { message: msg }); + console.error(msg); + }; + var createLoadError = function (type, url, name) { + return name ? 'Failed to load ' + type + ': ' + name + ' from url ' + url : 'Failed to load ' + type + ' url: ' + url; + }; + var pluginLoadError = function (editor, url, name) { + logError(editor, 'PluginLoadError', createLoadError('plugin', url, name)); + }; + var iconsLoadError = function (editor, url, name) { + logError(editor, 'IconsLoadError', createLoadError('icons', url, name)); + }; + var languageLoadError = function (editor, url, name) { + logError(editor, 'LanguageLoadError', createLoadError('language', url, name)); + }; + var pluginInitError = function (editor, name, err) { + var message = I18n.translate([ + 'Failed to initialize plugin: {0}', + name + ]); + initError(message, err); + displayError(editor, message); + }; + var initError = function (message) { + var x = []; + for (var _i = 1; _i < arguments.length; _i++) { + x[_i - 1] = arguments[_i]; + } + var console = window.console; + if (console) { + if (console.error) { + console.error.apply(console, __spreadArrays([message], x)); + } else { + console.log.apply(console, __spreadArrays([message], x)); + } + } + }; + + var isContentCssSkinName = function (url) { + return /^[a-z0-9\-]+$/i.test(url); + }; + var getContentCssUrls = function (editor) { + var contentCss = getContentCss(editor); + var skinUrl = editor.editorManager.baseURL + '/skins/content'; + var suffix = editor.editorManager.suffix; + var contentCssFile = 'content' + suffix + '.css'; + var inline = editor.inline === true; + return map(contentCss, function (url) { + if (isContentCssSkinName(url) && !inline) { + return skinUrl + '/' + url + '/' + contentCssFile; + } else { + return editor.documentBaseURI.toAbsolute(url); + } + }); + }; + var appendContentCssFromSettings = function (editor) { + editor.contentCSS = editor.contentCSS.concat(getContentCssUrls(editor)); + }; + + function Uploader(uploadStatus, settings) { + var pendingPromises = {}; + var pathJoin = function (path1, path2) { + if (path1) { + return path1.replace(/\/$/, '') + '/' + path2.replace(/^\//, ''); + } + return path2; + }; + var defaultHandler = function (blobInfo, success, failure, progress) { + var xhr = new XMLHttpRequest(); + xhr.open('POST', settings.url); + xhr.withCredentials = settings.credentials; + xhr.upload.onprogress = function (e) { + progress(e.loaded / e.total * 100); + }; + xhr.onerror = function () { + failure('Image upload failed due to a XHR Transport error. Code: ' + xhr.status); + }; + xhr.onload = function () { + if (xhr.status < 200 || xhr.status >= 300) { + failure('HTTP Error: ' + xhr.status); + return; + } + var json = JSON.parse(xhr.responseText); + if (!json || typeof json.location !== 'string') { + failure('Invalid JSON: ' + xhr.responseText); + return; + } + success(pathJoin(settings.basePath, json.location)); + }; + var formData = new FormData(); + formData.append('file', blobInfo.blob(), blobInfo.filename()); + xhr.send(formData); + }; + var noUpload = function () { + return new promiseObj(function (resolve) { + resolve([]); + }); + }; + var handlerSuccess = function (blobInfo, url) { + return { + url: url, + blobInfo: blobInfo, + status: true + }; + }; + var handlerFailure = function (blobInfo, message, options) { + return { + url: '', + blobInfo: blobInfo, + status: false, + error: { + message: message, + options: options + } + }; + }; + var resolvePending = function (blobUri, result) { + Tools.each(pendingPromises[blobUri], function (resolve) { + resolve(result); + }); + delete pendingPromises[blobUri]; + }; + var uploadBlobInfo = function (blobInfo, handler, openNotification) { + uploadStatus.markPending(blobInfo.blobUri()); + return new promiseObj(function (resolve) { + var notification, progress; + var noop = function () { + }; + try { + var closeNotification_1 = function () { + if (notification) { + notification.close(); + progress = noop; + } + }; + var success = function (url) { + closeNotification_1(); + uploadStatus.markUploaded(blobInfo.blobUri(), url); + resolvePending(blobInfo.blobUri(), handlerSuccess(blobInfo, url)); + resolve(handlerSuccess(blobInfo, url)); + }; + var failure = function (error, options) { + var failureOptions = options ? options : {}; + closeNotification_1(); + uploadStatus.removeFailed(blobInfo.blobUri()); + resolvePending(blobInfo.blobUri(), handlerFailure(blobInfo, error, failureOptions)); + resolve(handlerFailure(blobInfo, error, failureOptions)); + }; + progress = function (percent) { + if (percent < 0 || percent > 100) { + return; + } + if (!notification) { + notification = openNotification(); + } + notification.progressBar.value(percent); + }; + handler(blobInfo, success, failure, progress); + } catch (ex) { + resolve(handlerFailure(blobInfo, ex.message, {})); + } + }); + }; + var isDefaultHandler = function (handler) { + return handler === defaultHandler; + }; + var pendingUploadBlobInfo = function (blobInfo) { + var blobUri = blobInfo.blobUri(); + return new promiseObj(function (resolve) { + pendingPromises[blobUri] = pendingPromises[blobUri] || []; + pendingPromises[blobUri].push(resolve); + }); + }; + var uploadBlobs = function (blobInfos, openNotification) { + blobInfos = Tools.grep(blobInfos, function (blobInfo) { + return !uploadStatus.isUploaded(blobInfo.blobUri()); + }); + return promiseObj.all(Tools.map(blobInfos, function (blobInfo) { + return uploadStatus.isPending(blobInfo.blobUri()) ? pendingUploadBlobInfo(blobInfo) : uploadBlobInfo(blobInfo, settings.handler, openNotification); + })); + }; + var upload = function (blobInfos, openNotification) { + return !settings.url && isDefaultHandler(settings.handler) ? noUpload() : uploadBlobs(blobInfos, openNotification); + }; + if (isFunction(settings.handler) === false) { + settings.handler = defaultHandler; + } + return { upload: upload }; + } + + function UploadStatus () { + var PENDING = 1, UPLOADED = 2; + var blobUriStatuses = {}; + var createStatus = function (status, resultUri) { + return { + status: status, + resultUri: resultUri + }; + }; + var hasBlobUri = function (blobUri) { + return blobUri in blobUriStatuses; + }; + var getResultUri = function (blobUri) { + var result = blobUriStatuses[blobUri]; + return result ? result.resultUri : null; + }; + var isPending = function (blobUri) { + return hasBlobUri(blobUri) ? blobUriStatuses[blobUri].status === PENDING : false; + }; + var isUploaded = function (blobUri) { + return hasBlobUri(blobUri) ? blobUriStatuses[blobUri].status === UPLOADED : false; + }; + var markPending = function (blobUri) { + blobUriStatuses[blobUri] = createStatus(PENDING, null); + }; + var markUploaded = function (blobUri, resultUri) { + blobUriStatuses[blobUri] = createStatus(UPLOADED, resultUri); + }; + var removeFailed = function (blobUri) { + delete blobUriStatuses[blobUri]; + }; + var destroy = function () { + blobUriStatuses = {}; + }; + return { + hasBlobUri: hasBlobUri, + getResultUri: getResultUri, + isPending: isPending, + isUploaded: isUploaded, + markPending: markPending, + markUploaded: markUploaded, + removeFailed: removeFailed, + destroy: destroy + }; + } + + var count$1 = 0; + var seed = function () { + var rnd = function () { + return Math.round(Math.random() * 4294967295).toString(36); + }; + var now = new Date().getTime(); + return 's' + now.toString(36) + rnd() + rnd() + rnd(); + }; + var uuid = function (prefix) { + return prefix + count$1++ + seed(); + }; + + var BlobCache = function () { + var cache = []; + var mimeToExt = function (mime) { + var mimes = { + 'image/jpeg': 'jpg', + 'image/jpg': 'jpg', + 'image/gif': 'gif', + 'image/png': 'png', + 'image/apng': 'apng', + 'image/avif': 'avif', + 'image/svg+xml': 'svg', + 'image/webp': 'webp', + 'image/bmp': 'bmp', + 'image/tiff': 'tiff' + }; + return mimes[mime.toLowerCase()] || 'dat'; + }; + var create = function (o, blob, base64, name, filename) { + if (isString(o)) { + var id = o; + return toBlobInfo({ + id: id, + name: name, + filename: filename, + blob: blob, + base64: base64 + }); + } else if (isObject(o)) { + return toBlobInfo(o); + } else { + throw new Error('Unknown input type'); + } + }; + var toBlobInfo = function (o) { + if (!o.blob || !o.base64) { + throw new Error('blob and base64 representations of the image are required for BlobInfo to be created'); + } + var id = o.id || uuid('blobid'); + var name = o.name || id; + var blob = o.blob; + return { + id: constant(id), + name: constant(name), + filename: constant(o.filename || name + '.' + mimeToExt(blob.type)), + blob: constant(blob), + base64: constant(o.base64), + blobUri: constant(o.blobUri || URL.createObjectURL(blob)), + uri: constant(o.uri) + }; + }; + var add = function (blobInfo) { + if (!get(blobInfo.id())) { + cache.push(blobInfo); + } + }; + var findFirst = function (predicate) { + return find(cache, predicate).getOrUndefined(); + }; + var get = function (id) { + return findFirst(function (cachedBlobInfo) { + return cachedBlobInfo.id() === id; + }); + }; + var getByUri = function (blobUri) { + return findFirst(function (blobInfo) { + return blobInfo.blobUri() === blobUri; + }); + }; + var getByData = function (base64, type) { + return findFirst(function (blobInfo) { + return blobInfo.base64() === base64 && blobInfo.blob().type === type; + }); + }; + var removeByUri = function (blobUri) { + cache = filter(cache, function (blobInfo) { + if (blobInfo.blobUri() === blobUri) { + URL.revokeObjectURL(blobInfo.blobUri()); + return false; + } + return true; + }); + }; + var destroy = function () { + each(cache, function (cachedBlobInfo) { + URL.revokeObjectURL(cachedBlobInfo.blobUri()); + }); + cache = []; + }; + return { + create: create, + add: add, + get: get, + getByUri: getByUri, + getByData: getByData, + findFirst: findFirst, + removeByUri: removeByUri, + destroy: destroy + }; + }; + + var UploadChangeHandler = function (editor) { + var lastChangedLevel = Cell(null); + editor.on('change AddUndo', function (e) { + lastChangedLevel.set(__assign({}, e.level)); + }); + var fireIfChanged = function () { + var data = editor.undoManager.data; + last(data).filter(function (level) { + return !isEq$4(lastChangedLevel.get(), level); + }).each(function (level) { + editor.setDirty(true); + editor.fire('change', { + level: level, + lastLevel: get(data, data.length - 2).getOrNull() + }); + }); + }; + return { fireIfChanged: fireIfChanged }; + }; + var EditorUpload = function (editor) { + var blobCache = BlobCache(); + var uploader, imageScanner; + var uploadStatus = UploadStatus(); + var urlFilters = []; + var changeHandler = UploadChangeHandler(editor); + var aliveGuard = function (callback) { + return function (result) { + if (editor.selection) { + return callback(result); + } + return []; + }; + }; + var cacheInvalidator = function (url) { + return url + (url.indexOf('?') === -1 ? '?' : '&') + new Date().getTime(); + }; + var replaceString = function (content, search, replace) { + var index = 0; + do { + index = content.indexOf(search, index); + if (index !== -1) { + content = content.substring(0, index) + replace + content.substr(index + search.length); + index += replace.length - search.length + 1; + } + } while (index !== -1); + return content; + }; + var replaceImageUrl = function (content, targetUrl, replacementUrl) { + var replacementString = 'src="' + replacementUrl + '"' + (replacementUrl === Env.transparentSrc ? ' data-mce-placeholder="1"' : ''); + content = replaceString(content, 'src="' + targetUrl + '"', replacementString); + content = replaceString(content, 'data-mce-src="' + targetUrl + '"', 'data-mce-src="' + replacementUrl + '"'); + return content; + }; + var replaceUrlInUndoStack = function (targetUrl, replacementUrl) { + each(editor.undoManager.data, function (level) { + if (level.type === 'fragmented') { + level.fragments = map(level.fragments, function (fragment) { + return replaceImageUrl(fragment, targetUrl, replacementUrl); + }); + } else { + level.content = replaceImageUrl(level.content, targetUrl, replacementUrl); + } + }); + }; + var openNotification = function () { + return editor.notificationManager.open({ + text: editor.translate('Image uploading...'), + type: 'info', + timeout: -1, + progressBar: true + }); + }; + var replaceImageUriInView = function (image, resultUri) { + var src = editor.convertURL(resultUri, 'src'); + replaceUrlInUndoStack(image.src, resultUri); + editor.$(image).attr({ + 'src': shouldReuseFileName(editor) ? cacheInvalidator(resultUri) : resultUri, + 'data-mce-src': src + }); + }; + var uploadImages = function (callback) { + if (!uploader) { + uploader = Uploader(uploadStatus, { + url: getImageUploadUrl(editor), + basePath: getImageUploadBasePath(editor), + credentials: getImagesUploadCredentials(editor), + handler: getImagesUploadHandler(editor) + }); + } + return scanForImages().then(aliveGuard(function (imageInfos) { + var blobInfos = map(imageInfos, function (imageInfo) { + return imageInfo.blobInfo; + }); + return uploader.upload(blobInfos, openNotification).then(aliveGuard(function (result) { + var imagesToRemove = []; + var filteredResult = map(result, function (uploadInfo, index) { + var blobInfo = imageInfos[index].blobInfo; + var image = imageInfos[index].image; + if (uploadInfo.status && shouldReplaceBlobUris(editor)) { + blobCache.removeByUri(image.src); + replaceImageUriInView(image, uploadInfo.url); + } else if (uploadInfo.error) { + if (uploadInfo.error.options.remove) { + replaceUrlInUndoStack(image.getAttribute('src'), Env.transparentSrc); + imagesToRemove.push(image); + } + uploadError(editor, uploadInfo.error.message); + } + return { + element: image, + status: uploadInfo.status, + uploadUri: uploadInfo.url, + blobInfo: blobInfo + }; + }); + if (filteredResult.length > 0) { + changeHandler.fireIfChanged(); + } + if (imagesToRemove.length > 0) { + if (isRtc(editor)) { + console.error('Removing images on failed uploads is currently unsupported for RTC'); + } else { + editor.undoManager.transact(function () { + each(imagesToRemove, function (element) { + editor.dom.remove(element); + blobCache.removeByUri(element.src); + }); + }); + } + } + if (callback) { + callback(filteredResult); + } + return filteredResult; + })); + })); + }; + var uploadImagesAuto = function (callback) { + if (isAutomaticUploadsEnabled(editor)) { + return uploadImages(callback); + } + }; + var isValidDataUriImage = function (imgElm) { + if (forall(urlFilters, function (filter) { + return filter(imgElm); + }) === false) { + return false; + } + if (imgElm.getAttribute('src').indexOf('data:') === 0) { + var dataImgFilter = getImagesDataImgFilter(editor); + return dataImgFilter(imgElm); + } + return true; + }; + var addFilter = function (filter) { + urlFilters.push(filter); + }; + var scanForImages = function () { + if (!imageScanner) { + imageScanner = ImageScanner(uploadStatus, blobCache); + } + return imageScanner.findAll(editor.getBody(), isValidDataUriImage).then(aliveGuard(function (result) { + result = filter(result, function (resultItem) { + if (typeof resultItem === 'string') { + displayError(editor, resultItem); + return false; + } + return true; + }); + each(result, function (resultItem) { + replaceUrlInUndoStack(resultItem.image.src, resultItem.blobInfo.blobUri()); + resultItem.image.src = resultItem.blobInfo.blobUri(); + resultItem.image.removeAttribute('data-mce-src'); + }); + return result; + })); + }; + var destroy = function () { + blobCache.destroy(); + uploadStatus.destroy(); + imageScanner = uploader = null; + }; + var replaceBlobUris = function (content) { + return content.replace(/src="(blob:[^"]+)"/g, function (match, blobUri) { + var resultUri = uploadStatus.getResultUri(blobUri); + if (resultUri) { + return 'src="' + resultUri + '"'; + } + var blobInfo = blobCache.getByUri(blobUri); + if (!blobInfo) { + blobInfo = foldl(editor.editorManager.get(), function (result, editor) { + return result || editor.editorUpload && editor.editorUpload.blobCache.getByUri(blobUri); + }, null); + } + if (blobInfo) { + var blob = blobInfo.blob(); + return 'src="data:' + blob.type + ';base64,' + blobInfo.base64() + '"'; + } + return match; + }); + }; + editor.on('SetContent', function () { + if (isAutomaticUploadsEnabled(editor)) { + uploadImagesAuto(); + } else { + scanForImages(); + } + }); + editor.on('RawSaveContent', function (e) { + e.content = replaceBlobUris(e.content); + }); + editor.on('GetContent', function (e) { + if (e.source_view || e.format === 'raw' || e.format === 'tree') { + return; + } + e.content = replaceBlobUris(e.content); + }); + editor.on('PostRender', function () { + editor.parser.addNodeFilter('img', function (images) { + each(images, function (img) { + var src = img.attr('src'); + if (blobCache.getByUri(src)) { + return; + } + var resultUri = uploadStatus.getResultUri(src); + if (resultUri) { + img.attr('src', resultUri); + } + }); + }); + }); + return { + blobCache: blobCache, + addFilter: addFilter, + uploadImages: uploadImages, + uploadImagesAuto: uploadImagesAuto, + scanForImages: scanForImages, + destroy: destroy + }; + }; + + var get$a = function (dom) { + var formats = { + valigntop: [{ + selector: 'td,th', + styles: { verticalAlign: 'top' } + }], + valignmiddle: [{ + selector: 'td,th', + styles: { verticalAlign: 'middle' } + }], + valignbottom: [{ + selector: 'td,th', + styles: { verticalAlign: 'bottom' } + }], + alignleft: [ + { + selector: 'figure.image', + collapsed: false, + classes: 'align-left', + ceFalseOverride: true, + preview: 'font-family font-size' + }, + { + selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', + styles: { textAlign: 'left' }, + inherit: false, + preview: false, + defaultBlock: 'div' + }, + { + selector: 'img,table', + collapsed: false, + styles: { float: 'left' }, + preview: 'font-family font-size' + } + ], + aligncenter: [ + { + selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', + styles: { textAlign: 'center' }, + inherit: false, + preview: 'font-family font-size', + defaultBlock: 'div' + }, + { + selector: 'figure.image', + collapsed: false, + classes: 'align-center', + ceFalseOverride: true, + preview: 'font-family font-size' + }, + { + selector: 'img', + collapsed: false, + styles: { + display: 'block', + marginLeft: 'auto', + marginRight: 'auto' + }, + preview: false + }, + { + selector: 'table', + collapsed: false, + styles: { + marginLeft: 'auto', + marginRight: 'auto' + }, + preview: 'font-family font-size' + } + ], + alignright: [ + { + selector: 'figure.image', + collapsed: false, + classes: 'align-right', + ceFalseOverride: true, + preview: 'font-family font-size' + }, + { + selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', + styles: { textAlign: 'right' }, + inherit: false, + preview: 'font-family font-size', + defaultBlock: 'div' + }, + { + selector: 'img,table', + collapsed: false, + styles: { float: 'right' }, + preview: 'font-family font-size' + } + ], + alignjustify: [{ + selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', + styles: { textAlign: 'justify' }, + inherit: false, + defaultBlock: 'div', + preview: 'font-family font-size' + }], + bold: [ + { + inline: 'strong', + remove: 'all', + preserve_attributes: [ + 'class', + 'style' + ] + }, + { + inline: 'span', + styles: { fontWeight: 'bold' } + }, + { + inline: 'b', + remove: 'all', + preserve_attributes: [ + 'class', + 'style' + ] + } + ], + italic: [ + { + inline: 'em', + remove: 'all', + preserve_attributes: [ + 'class', + 'style' + ] + }, + { + inline: 'span', + styles: { fontStyle: 'italic' } + }, + { + inline: 'i', + remove: 'all', + preserve_attributes: [ + 'class', + 'style' + ] + } + ], + underline: [ + { + inline: 'span', + styles: { textDecoration: 'underline' }, + exact: true + }, + { + inline: 'u', + remove: 'all', + preserve_attributes: [ + 'class', + 'style' + ] + } + ], + strikethrough: [ + { + inline: 'span', + styles: { textDecoration: 'line-through' }, + exact: true + }, + { + inline: 'strike', + remove: 'all', + preserve_attributes: [ + 'class', + 'style' + ] + }, + { + inline: 's', + remove: 'all', + preserve_attributes: [ + 'class', + 'style' + ] + } + ], + forecolor: { + inline: 'span', + styles: { color: '%value' }, + links: true, + remove_similar: true, + clear_child_styles: true + }, + hilitecolor: { + inline: 'span', + styles: { backgroundColor: '%value' }, + links: true, + remove_similar: true, + clear_child_styles: true + }, + fontname: { + inline: 'span', + toggle: false, + styles: { fontFamily: '%value' }, + clear_child_styles: true + }, + fontsize: { + inline: 'span', + toggle: false, + styles: { fontSize: '%value' }, + clear_child_styles: true + }, + lineheight: { + selector: 'h1,h2,h3,h4,h5,h6,p,li,td,th,div', + defaultBlock: 'p', + styles: { lineHeight: '%value' } + }, + fontsize_class: { + inline: 'span', + attributes: { class: '%value' } + }, + blockquote: { + block: 'blockquote', + wrapper: true, + remove: 'all' + }, + subscript: { inline: 'sub' }, + superscript: { inline: 'sup' }, + code: { inline: 'code' }, + link: { + inline: 'a', + selector: 'a', + remove: 'all', + split: true, + deep: true, + onmatch: function (node, _fmt, _itemName) { + return isElement$1(node) && node.hasAttribute('href'); + }, + onformat: function (elm, _fmt, vars) { + Tools.each(vars, function (value, key) { + dom.setAttrib(elm, key, value); + }); + } + }, + removeformat: [ + { + selector: 'b,strong,em,i,font,u,strike,s,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins', + remove: 'all', + split: true, + expand: false, + block_expand: true, + deep: true + }, + { + selector: 'span', + attributes: [ + 'style', + 'class' + ], + remove: 'empty', + split: true, + expand: false, + deep: true + }, + { + selector: '*', + attributes: [ + 'style', + 'class' + ], + split: false, + expand: false, + deep: true + } + ] + }; + Tools.each('p h1 h2 h3 h4 h5 h6 div address pre div dt dd samp'.split(/\s/), function (name) { + formats[name] = { + block: name, + remove: 'all' + }; + }); + return formats; + }; + + function FormatRegistry(editor) { + var formats = {}; + var get = function (name) { + return name ? formats[name] : formats; + }; + var has$1 = function (name) { + return has(formats, name); + }; + var register = function (name, format) { + if (name) { + if (typeof name !== 'string') { + Tools.each(name, function (format, name) { + register(name, format); + }); + } else { + if (!isArray(format)) { + format = [format]; + } + Tools.each(format, function (format) { + if (typeof format.deep === 'undefined') { + format.deep = !format.selector; + } + if (typeof format.split === 'undefined') { + format.split = !format.selector || format.inline; + } + if (typeof format.remove === 'undefined' && format.selector && !format.inline) { + format.remove = 'none'; + } + if (format.selector && format.inline) { + format.mixed = true; + format.block_expand = true; + } + if (typeof format.classes === 'string') { + format.classes = format.classes.split(/\s+/); + } + }); + formats[name] = format; + } + } + }; + var unregister = function (name) { + if (name && formats[name]) { + delete formats[name]; + } + return formats; + }; + register(get$a(editor.dom)); + register(getFormats(editor)); + return { + get: get, + has: has$1, + register: register, + unregister: unregister + }; + } + + var each$e = Tools.each; + var dom = DOMUtils$1.DOM; + var parsedSelectorToHtml = function (ancestry, editor) { + var elm, item, fragment; + var schema = editor && editor.schema || Schema({}); + var decorate = function (elm, item) { + if (item.classes.length) { + dom.addClass(elm, item.classes.join(' ')); + } + dom.setAttribs(elm, item.attrs); + }; + var createElement = function (sItem) { + item = typeof sItem === 'string' ? { + name: sItem, + classes: [], + attrs: {} + } : sItem; + var elm = dom.create(item.name); + decorate(elm, item); + return elm; + }; + var getRequiredParent = function (elm, candidate) { + var name = typeof elm !== 'string' ? elm.nodeName.toLowerCase() : elm; + var elmRule = schema.getElementRule(name); + var parentsRequired = elmRule && elmRule.parentsRequired; + if (parentsRequired && parentsRequired.length) { + return candidate && Tools.inArray(parentsRequired, candidate) !== -1 ? candidate : parentsRequired[0]; + } else { + return false; + } + }; + var wrapInHtml = function (elm, ancestry, siblings) { + var parent, parentCandidate; + var ancestor = ancestry.length > 0 && ancestry[0]; + var ancestorName = ancestor && ancestor.name; + var parentRequired = getRequiredParent(elm, ancestorName); + if (parentRequired) { + if (ancestorName === parentRequired) { + parentCandidate = ancestry[0]; + ancestry = ancestry.slice(1); + } else { + parentCandidate = parentRequired; + } + } else if (ancestor) { + parentCandidate = ancestry[0]; + ancestry = ancestry.slice(1); + } else if (!siblings) { + return elm; + } + if (parentCandidate) { + parent = createElement(parentCandidate); + parent.appendChild(elm); + } + if (siblings) { + if (!parent) { + parent = dom.create('div'); + parent.appendChild(elm); + } + Tools.each(siblings, function (sibling) { + var siblingElm = createElement(sibling); + parent.insertBefore(siblingElm, elm); + }); + } + return wrapInHtml(parent, ancestry, parentCandidate && parentCandidate.siblings); + }; + if (ancestry && ancestry.length) { + item = ancestry[0]; + elm = createElement(item); + fragment = dom.create('div'); + fragment.appendChild(wrapInHtml(elm, ancestry.slice(1), item.siblings)); + return fragment; + } else { + return ''; + } + }; + var parseSelectorItem = function (item) { + var tagName; + var obj = { + classes: [], + attrs: {} + }; + item = obj.selector = Tools.trim(item); + if (item !== '*') { + tagName = item.replace(/(?:([#\.]|::?)([\w\-]+)|(\[)([^\]]+)\]?)/g, function ($0, $1, $2, $3, $4) { + switch ($1) { + case '#': + obj.attrs.id = $2; + break; + case '.': + obj.classes.push($2); + break; + case ':': + if (Tools.inArray('checked disabled enabled read-only required'.split(' '), $2) !== -1) { + obj.attrs[$2] = $2; + } + break; + } + if ($3 === '[') { + var m = $4.match(/([\w\-]+)(?:\=\"([^\"]+))?/); + if (m) { + obj.attrs[m[1]] = m[2]; + } + } + return ''; + }); + } + obj.name = tagName || 'div'; + return obj; + }; + var parseSelector = function (selector) { + if (!selector || typeof selector !== 'string') { + return []; + } + selector = selector.split(/\s*,\s*/)[0]; + selector = selector.replace(/\s*(~\+|~|\+|>)\s*/g, '$1'); + return Tools.map(selector.split(/(?:>|\s+(?![^\[\]]+\]))/), function (item) { + var siblings = Tools.map(item.split(/(?:~\+|~|\+)/), parseSelectorItem); + var obj = siblings.pop(); + if (siblings.length) { + obj.siblings = siblings; + } + return obj; + }).reverse(); + }; + var getCssText = function (editor, format) { + var name, previewFrag; + var previewCss = '', parentFontSize; + var previewStyles = getPreviewStyles(editor); + if (previewStyles === '') { + return ''; + } + var removeVars = function (val) { + return val.replace(/%(\w+)/g, ''); + }; + if (typeof format === 'string') { + format = editor.formatter.get(format); + if (!format) { + return; + } + format = format[0]; + } + if ('preview' in format) { + var previewOpt = get$1(format, 'preview'); + if (previewOpt.is(false)) { + return ''; + } else { + previewStyles = previewOpt.getOr(previewStyles); + } + } + name = format.block || format.inline || 'span'; + var items = parseSelector(format.selector); + if (items.length) { + if (!items[0].name) { + items[0].name = name; + } + name = format.selector; + previewFrag = parsedSelectorToHtml(items, editor); + } else { + previewFrag = parsedSelectorToHtml([name], editor); + } + var previewElm = dom.select(name, previewFrag)[0] || previewFrag.firstChild; + each$e(format.styles, function (value, name) { + var newValue = removeVars(value); + if (newValue) { + dom.setStyle(previewElm, name, newValue); + } + }); + each$e(format.attributes, function (value, name) { + var newValue = removeVars(value); + if (newValue) { + dom.setAttrib(previewElm, name, newValue); + } + }); + each$e(format.classes, function (value) { + var newValue = removeVars(value); + if (!dom.hasClass(previewElm, newValue)) { + dom.addClass(previewElm, newValue); + } + }); + editor.fire('PreviewFormats'); + dom.setStyles(previewFrag, { + position: 'absolute', + left: -65535 + }); + editor.getBody().appendChild(previewFrag); + parentFontSize = dom.getStyle(editor.getBody(), 'fontSize', true); + parentFontSize = /px$/.test(parentFontSize) ? parseInt(parentFontSize, 10) : 0; + each$e(previewStyles.split(' '), function (name) { + var value = dom.getStyle(previewElm, name, true); + if (name === 'background-color' && /transparent|rgba\s*\([^)]+,\s*0\)/.test(value)) { + value = dom.getStyle(editor.getBody(), name, true); + if (dom.toHex(value).toLowerCase() === '#ffffff') { + return; + } + } + if (name === 'color') { + if (dom.toHex(value).toLowerCase() === '#000000') { + return; + } + } + if (name === 'font-size') { + if (/em|%$/.test(value)) { + if (parentFontSize === 0) { + return; + } + var numValue = parseFloat(value) / (/%$/.test(value) ? 100 : 1); + value = numValue * parentFontSize + 'px'; + } + } + if (name === 'border' && value) { + previewCss += 'padding:0 2px;'; + } + previewCss += name + ':' + value + ';'; + }); + editor.fire('AfterPreviewFormats'); + dom.remove(previewFrag); + return previewCss; + }; + + var setup$6 = function (editor) { + editor.addShortcut('meta+b', '', 'Bold'); + editor.addShortcut('meta+i', '', 'Italic'); + editor.addShortcut('meta+u', '', 'Underline'); + for (var i = 1; i <= 6; i++) { + editor.addShortcut('access+' + i, '', [ + 'FormatBlock', + false, + 'h' + i + ]); + } + editor.addShortcut('access+7', '', [ + 'FormatBlock', + false, + 'p' + ]); + editor.addShortcut('access+8', '', [ + 'FormatBlock', + false, + 'div' + ]); + editor.addShortcut('access+9', '', [ + 'FormatBlock', + false, + 'address' + ]); + }; + + var Formatter = function (editor) { + var formats = FormatRegistry(editor); + var formatChangeState = Cell(null); + setup$6(editor); + setup$3(editor); + return { + get: formats.get, + has: formats.has, + register: formats.register, + unregister: formats.unregister, + apply: function (name, vars, node) { + applyFormat$1(editor, name, vars, node); + }, + remove: function (name, vars, node, similar) { + removeFormat$1(editor, name, vars, node, similar); + }, + toggle: function (name, vars, node) { + toggleFormat(editor, name, vars, node); + }, + match: function (name, vars, node) { + return matchFormat(editor, name, vars, node); + }, + closest: function (names) { + return closestFormat(editor, names); + }, + matchAll: function (names, vars) { + return matchAllFormats(editor, names, vars); + }, + matchNode: function (node, names, vars, similar) { + return matchNodeFormat(editor, node, names, vars, similar); + }, + canApply: function (name) { + return canApplyFormat(editor, name); + }, + formatChanged: function (formats, callback, similar) { + return formatChanged(editor, formatChangeState, formats, callback, similar); + }, + getCssText: curry(getCssText, editor) + }; + }; + + var registerEvents$1 = function (editor, undoManager, locks) { + var isFirstTypedCharacter = Cell(false); + var addNonTypingUndoLevel = function (e) { + setTyping(undoManager, false, locks); + undoManager.add({}, e); + }; + editor.on('init', function () { + undoManager.add(); + }); + editor.on('BeforeExecCommand', function (e) { + var cmd = e.command.toLowerCase(); + if (cmd !== 'undo' && cmd !== 'redo' && cmd !== 'mcerepaint') { + endTyping(undoManager, locks); + undoManager.beforeChange(); + } + }); + editor.on('ExecCommand', function (e) { + var cmd = e.command.toLowerCase(); + if (cmd !== 'undo' && cmd !== 'redo' && cmd !== 'mcerepaint') { + addNonTypingUndoLevel(e); + } + }); + editor.on('ObjectResizeStart cut', function () { + undoManager.beforeChange(); + }); + editor.on('SaveContent ObjectResized blur', addNonTypingUndoLevel); + editor.on('dragend', addNonTypingUndoLevel); + editor.on('keyup', function (e) { + var keyCode = e.keyCode; + if (e.isDefaultPrevented()) { + return; + } + if (keyCode >= 33 && keyCode <= 36 || keyCode >= 37 && keyCode <= 40 || keyCode === 45 || e.ctrlKey) { + addNonTypingUndoLevel(); + editor.nodeChanged(); + } + if (keyCode === 46 || keyCode === 8) { + editor.nodeChanged(); + } + if (isFirstTypedCharacter.get() && undoManager.typing && isEq$4(createFromEditor(editor), undoManager.data[0]) === false) { + if (editor.isDirty() === false) { + editor.setDirty(true); + editor.fire('change', { + level: undoManager.data[0], + lastLevel: null + }); + } + editor.fire('TypingUndo'); + isFirstTypedCharacter.set(false); + editor.nodeChanged(); + } + }); + editor.on('keydown', function (e) { + var keyCode = e.keyCode; + if (e.isDefaultPrevented()) { + return; + } + if (keyCode >= 33 && keyCode <= 36 || keyCode >= 37 && keyCode <= 40 || keyCode === 45) { + if (undoManager.typing) { + addNonTypingUndoLevel(e); + } + return; + } + var modKey = e.ctrlKey && !e.altKey || e.metaKey; + if ((keyCode < 16 || keyCode > 20) && keyCode !== 224 && keyCode !== 91 && !undoManager.typing && !modKey) { + undoManager.beforeChange(); + setTyping(undoManager, true, locks); + undoManager.add({}, e); + isFirstTypedCharacter.set(true); + } + }); + editor.on('mousedown', function (e) { + if (undoManager.typing) { + addNonTypingUndoLevel(e); + } + }); + var isInsertReplacementText = function (event) { + return event.inputType === 'insertReplacementText'; + }; + var isInsertTextDataNull = function (event) { + return event.inputType === 'insertText' && event.data === null; + }; + var isInsertFromPasteOrDrop = function (event) { + return event.inputType === 'insertFromPaste' || event.inputType === 'insertFromDrop'; + }; + editor.on('input', function (e) { + if (e.inputType && (isInsertReplacementText(e) || isInsertTextDataNull(e) || isInsertFromPasteOrDrop(e))) { + addNonTypingUndoLevel(e); + } + }); + editor.on('AddUndo Undo Redo ClearUndos', function (e) { + if (!e.isDefaultPrevented()) { + editor.nodeChanged(); + } + }); + }; + var addKeyboardShortcuts = function (editor) { + editor.addShortcut('meta+z', '', 'Undo'); + editor.addShortcut('meta+y,meta+shift+z', '', 'Redo'); + }; + + var UndoManager = function (editor) { + var beforeBookmark = Cell(Optional.none()); + var locks = Cell(0); + var index = Cell(0); + var undoManager = { + data: [], + typing: false, + beforeChange: function () { + beforeChange$1(editor, locks, beforeBookmark); + }, + add: function (level, event) { + return addUndoLevel$1(editor, undoManager, index, locks, beforeBookmark, level, event); + }, + undo: function () { + return undo$1(editor, undoManager, locks, index); + }, + redo: function () { + return redo$1(editor, index, undoManager.data); + }, + clear: function () { + clear$1(editor, undoManager, index); + }, + reset: function () { + reset$1(editor, undoManager); + }, + hasUndo: function () { + return hasUndo$1(editor, undoManager, index); + }, + hasRedo: function () { + return hasRedo$1(editor, undoManager, index); + }, + transact: function (callback) { + return transact$1(editor, undoManager, locks, callback); + }, + ignore: function (callback) { + ignore$1(editor, locks, callback); + }, + extra: function (callback1, callback2) { + extra$1(editor, undoManager, index, callback1, callback2); + } + }; + if (!isRtc(editor)) { + registerEvents$1(editor, undoManager, locks); + } + addKeyboardShortcuts(editor); + return undoManager; + }; + + var nonTypingKeycodes = [ + 9, + 27, + VK.HOME, + VK.END, + 19, + 20, + 44, + 144, + 145, + 33, + 34, + 45, + 16, + 17, + 18, + 91, + 92, + 93, + VK.DOWN, + VK.UP, + VK.LEFT, + VK.RIGHT + ].concat(Env.browser.isFirefox() ? [224] : []); + var placeholderAttr = 'data-mce-placeholder'; + var isKeyboardEvent = function (e) { + return e.type === 'keydown' || e.type === 'keyup'; + }; + var isDeleteEvent = function (e) { + var keyCode = e.keyCode; + return keyCode === VK.BACKSPACE || keyCode === VK.DELETE; + }; + var isNonTypingKeyboardEvent = function (e) { + if (isKeyboardEvent(e)) { + var keyCode = e.keyCode; + return !isDeleteEvent(e) && (VK.metaKeyPressed(e) || e.altKey || keyCode >= 112 && keyCode <= 123 || contains(nonTypingKeycodes, keyCode)); + } else { + return false; + } + }; + var isTypingKeyboardEvent = function (e) { + return isKeyboardEvent(e) && !(isDeleteEvent(e) || e.type === 'keyup' && e.keyCode === 229); + }; + var isVisuallyEmpty = function (dom, rootElm, forcedRootBlock) { + if (isEmpty(SugarElement.fromDom(rootElm), false)) { + var isForcedRootBlockFalse = forcedRootBlock === ''; + var firstElement = rootElm.firstElementChild; + if (!firstElement) { + return true; + } else if (dom.getStyle(rootElm.firstElementChild, 'padding-left') || dom.getStyle(rootElm.firstElementChild, 'padding-right')) { + return false; + } else { + return isForcedRootBlockFalse ? !dom.isBlock(firstElement) : forcedRootBlock === firstElement.nodeName.toLowerCase(); + } + } else { + return false; + } + }; + var setup$7 = function (editor) { + var dom = editor.dom; + var rootBlock = getForcedRootBlock(editor); + var placeholder = getPlaceholder(editor); + var updatePlaceholder = function (e, initial) { + if (isNonTypingKeyboardEvent(e)) { + return; + } + var body = editor.getBody(); + var showPlaceholder = isTypingKeyboardEvent(e) ? false : isVisuallyEmpty(dom, body, rootBlock); + var isPlaceholderShown = dom.getAttrib(body, placeholderAttr) !== ''; + if (isPlaceholderShown !== showPlaceholder || initial) { + dom.setAttrib(body, placeholderAttr, showPlaceholder ? placeholder : null); + dom.setAttrib(body, 'aria-placeholder', showPlaceholder ? placeholder : null); + firePlaceholderToggle(editor, showPlaceholder); + editor.on(showPlaceholder ? 'keydown' : 'keyup', updatePlaceholder); + editor.off(showPlaceholder ? 'keyup' : 'keydown', updatePlaceholder); + } + }; + if (placeholder) { + editor.on('init', function (e) { + updatePlaceholder(e, true); + editor.on('change SetContent ExecCommand', updatePlaceholder); + editor.on('paste', function (e) { + return Delay.setEditorTimeout(editor, function () { + return updatePlaceholder(e); + }); + }); + }); + } + }; + + var strongRtl = /[\u0591-\u07FF\uFB1D-\uFDFF\uFE70-\uFEFC]/; + var hasStrongRtl = function (text) { + return strongRtl.test(text); + }; + + var isInlineTarget = function (editor, elm) { + return is$1(SugarElement.fromDom(elm), getInlineBoundarySelector(editor)); + }; + var isRtl$1 = function (element) { + return DOMUtils$1.DOM.getStyle(element, 'direction', true) === 'rtl' || hasStrongRtl(element.textContent); + }; + var findInlineParents = function (isInlineTarget, rootNode, pos) { + return filter(DOMUtils$1.DOM.getParents(pos.container(), '*', rootNode), isInlineTarget); + }; + var findRootInline = function (isInlineTarget, rootNode, pos) { + var parents = findInlineParents(isInlineTarget, rootNode, pos); + return Optional.from(parents[parents.length - 1]); + }; + var hasSameParentBlock = function (rootNode, node1, node2) { + var block1 = getParentBlock(node1, rootNode); + var block2 = getParentBlock(node2, rootNode); + return block1 && block1 === block2; + }; + var isAtZwsp = function (pos) { + return isBeforeInline(pos) || isAfterInline(pos); + }; + var normalizePosition = function (forward, pos) { + if (!pos) { + return pos; + } + var container = pos.container(), offset = pos.offset(); + if (forward) { + if (isCaretContainerInline(container)) { + if (isText$1(container.nextSibling)) { + return CaretPosition$1(container.nextSibling, 0); + } else { + return CaretPosition$1.after(container); + } + } else { + return isBeforeInline(pos) ? CaretPosition$1(container, offset + 1) : pos; + } + } else { + if (isCaretContainerInline(container)) { + if (isText$1(container.previousSibling)) { + return CaretPosition$1(container.previousSibling, container.previousSibling.data.length); + } else { + return CaretPosition$1.before(container); + } + } else { + return isAfterInline(pos) ? CaretPosition$1(container, offset - 1) : pos; + } + } + }; + var normalizeForwards = curry(normalizePosition, true); + var normalizeBackwards = curry(normalizePosition, false); + + var isBeforeRoot = function (rootNode) { + return function (elm) { + return eq$2(rootNode, SugarElement.fromDom(elm.dom.parentNode)); + }; + }; + var getParentBlock$1 = function (rootNode, elm) { + return contains$2(rootNode, elm) ? closest(elm, function (element) { + return isTextBlock(element) || isListItem(element); + }, isBeforeRoot(rootNode)) : Optional.none(); + }; + var placeCaretInEmptyBody = function (editor) { + var body = editor.getBody(); + var node = body.firstChild && editor.dom.isBlock(body.firstChild) ? body.firstChild : body; + editor.selection.setCursorLocation(node, 0); + }; + var paddEmptyBody = function (editor) { + if (editor.dom.isEmpty(editor.getBody())) { + editor.setContent(''); + placeCaretInEmptyBody(editor); + } + }; + var willDeleteLastPositionInElement = function (forward, fromPos, elm) { + return lift2(firstPositionIn(elm), lastPositionIn(elm), function (firstPos, lastPos) { + var normalizedFirstPos = normalizePosition(true, firstPos); + var normalizedLastPos = normalizePosition(false, lastPos); + var normalizedFromPos = normalizePosition(false, fromPos); + if (forward) { + return nextPosition(elm, normalizedFromPos).exists(function (nextPos) { + return nextPos.isEqual(normalizedLastPos) && fromPos.isEqual(normalizedFirstPos); + }); + } else { + return prevPosition(elm, normalizedFromPos).exists(function (prevPos) { + return prevPos.isEqual(normalizedFirstPos) && fromPos.isEqual(normalizedLastPos); + }); + } + }).getOr(true); + }; + + var blockPosition = function (block, position) { + return { + block: block, + position: position + }; + }; + var blockBoundary = function (from, to) { + return { + from: from, + to: to + }; + }; + var getBlockPosition = function (rootNode, pos) { + var rootElm = SugarElement.fromDom(rootNode); + var containerElm = SugarElement.fromDom(pos.container()); + return getParentBlock$1(rootElm, containerElm).map(function (block) { + return blockPosition(block, pos); + }); + }; + var isDifferentBlocks = function (blockBoundary) { + return eq$2(blockBoundary.from.block, blockBoundary.to.block) === false; + }; + var hasSameParent = function (blockBoundary) { + return parent(blockBoundary.from.block).bind(function (parent1) { + return parent(blockBoundary.to.block).filter(function (parent2) { + return eq$2(parent1, parent2); + }); + }).isSome(); + }; + var isEditable = function (blockBoundary) { + return isContentEditableFalse(blockBoundary.from.block.dom) === false && isContentEditableFalse(blockBoundary.to.block.dom) === false; + }; + var skipLastBr = function (rootNode, forward, blockPosition) { + if (isBr(blockPosition.position.getNode()) && isEmpty(blockPosition.block) === false) { + return positionIn(false, blockPosition.block.dom).bind(function (lastPositionInBlock) { + if (lastPositionInBlock.isEqual(blockPosition.position)) { + return fromPosition(forward, rootNode, lastPositionInBlock).bind(function (to) { + return getBlockPosition(rootNode, to); + }); + } else { + return Optional.some(blockPosition); + } + }).getOr(blockPosition); + } else { + return blockPosition; + } + }; + var readFromRange = function (rootNode, forward, rng) { + var fromBlockPos = getBlockPosition(rootNode, CaretPosition$1.fromRangeStart(rng)); + var toBlockPos = fromBlockPos.bind(function (blockPos) { + return fromPosition(forward, rootNode, blockPos.position).bind(function (to) { + return getBlockPosition(rootNode, to).map(function (blockPos) { + return skipLastBr(rootNode, forward, blockPos); + }); + }); + }); + return lift2(fromBlockPos, toBlockPos, blockBoundary).filter(function (blockBoundary) { + return isDifferentBlocks(blockBoundary) && hasSameParent(blockBoundary) && isEditable(blockBoundary); + }); + }; + var read$3 = function (rootNode, forward, rng) { + return rng.collapsed ? readFromRange(rootNode, forward, rng) : Optional.none(); + }; + + var getChildrenUntilBlockBoundary = function (block) { + var children$1 = children(block); + return findIndex(children$1, isBlock).fold(function () { + return children$1; + }, function (index) { + return children$1.slice(0, index); + }); + }; + var extractChildren = function (block) { + var children = getChildrenUntilBlockBoundary(block); + each(children, remove); + return children; + }; + var removeEmptyRoot = function (rootNode, block) { + var parents = parentsAndSelf(block, rootNode); + return find(parents.reverse(), function (element) { + return isEmpty(element); + }).each(remove); + }; + var isEmptyBefore = function (el) { + return filter(prevSiblings(el), function (el) { + return !isEmpty(el); + }).length === 0; + }; + var nestedBlockMerge = function (rootNode, fromBlock, toBlock, insertionPoint) { + if (isEmpty(toBlock)) { + fillWithPaddingBr(toBlock); + return firstPositionIn(toBlock.dom); + } + if (isEmptyBefore(insertionPoint) && isEmpty(fromBlock)) { + before(insertionPoint, SugarElement.fromTag('br')); + } + var position = prevPosition(toBlock.dom, CaretPosition$1.before(insertionPoint.dom)); + each(extractChildren(fromBlock), function (child) { + before(insertionPoint, child); + }); + removeEmptyRoot(rootNode, fromBlock); + return position; + }; + var sidelongBlockMerge = function (rootNode, fromBlock, toBlock) { + if (isEmpty(toBlock)) { + remove(toBlock); + if (isEmpty(fromBlock)) { + fillWithPaddingBr(fromBlock); + } + return firstPositionIn(fromBlock.dom); + } + var position = lastPositionIn(toBlock.dom); + each(extractChildren(fromBlock), function (child) { + append(toBlock, child); + }); + removeEmptyRoot(rootNode, fromBlock); + return position; + }; + var findInsertionPoint = function (toBlock, block) { + var parentsAndSelf$1 = parentsAndSelf(block, toBlock); + return Optional.from(parentsAndSelf$1[parentsAndSelf$1.length - 1]); + }; + var getInsertionPoint = function (fromBlock, toBlock) { + return contains$2(toBlock, fromBlock) ? findInsertionPoint(toBlock, fromBlock) : Optional.none(); + }; + var trimBr = function (first, block) { + positionIn(first, block.dom).map(function (position) { + return position.getNode(); + }).map(SugarElement.fromDom).filter(isBr$1).each(remove); + }; + var mergeBlockInto = function (rootNode, fromBlock, toBlock) { + trimBr(true, fromBlock); + trimBr(false, toBlock); + return getInsertionPoint(fromBlock, toBlock).fold(curry(sidelongBlockMerge, rootNode, fromBlock, toBlock), curry(nestedBlockMerge, rootNode, fromBlock, toBlock)); + }; + var mergeBlocks = function (rootNode, forward, block1, block2) { + return forward ? mergeBlockInto(rootNode, block2, block1) : mergeBlockInto(rootNode, block1, block2); + }; + + var backspaceDelete$1 = function (editor, forward) { + var rootNode = SugarElement.fromDom(editor.getBody()); + var position = read$3(rootNode.dom, forward, editor.selection.getRng()).bind(function (blockBoundary) { + return mergeBlocks(rootNode, forward, blockBoundary.from.block, blockBoundary.to.block); + }); + position.each(function (pos) { + editor.selection.setRng(pos.toRange()); + }); + return position.isSome(); + }; + + var deleteRangeMergeBlocks = function (rootNode, selection) { + var rng = selection.getRng(); + return lift2(getParentBlock$1(rootNode, SugarElement.fromDom(rng.startContainer)), getParentBlock$1(rootNode, SugarElement.fromDom(rng.endContainer)), function (block1, block2) { + if (eq$2(block1, block2) === false) { + rng.deleteContents(); + mergeBlocks(rootNode, true, block1, block2).each(function (pos) { + selection.setRng(pos.toRange()); + }); + return true; + } else { + return false; + } + }).getOr(false); + }; + var isRawNodeInTable = function (root, rawNode) { + var node = SugarElement.fromDom(rawNode); + var isRoot = curry(eq$2, root); + return ancestor(node, isTableCell$1, isRoot).isSome(); + }; + var isSelectionInTable = function (root, rng) { + return isRawNodeInTable(root, rng.startContainer) || isRawNodeInTable(root, rng.endContainer); + }; + var isEverythingSelected = function (root, rng) { + var noPrevious = prevPosition(root.dom, CaretPosition$1.fromRangeStart(rng)).isNone(); + var noNext = nextPosition(root.dom, CaretPosition$1.fromRangeEnd(rng)).isNone(); + return !isSelectionInTable(root, rng) && noPrevious && noNext; + }; + var emptyEditor = function (editor) { + editor.setContent(''); + editor.selection.setCursorLocation(); + return true; + }; + var deleteRange$1 = function (editor) { + var rootNode = SugarElement.fromDom(editor.getBody()); + var rng = editor.selection.getRng(); + return isEverythingSelected(rootNode, rng) ? emptyEditor(editor) : deleteRangeMergeBlocks(rootNode, editor.selection); + }; + var backspaceDelete$2 = function (editor, _forward) { + return editor.selection.isCollapsed() ? false : deleteRange$1(editor); + }; + + var isContentEditableTrue$2 = isContentEditableTrue; + var isContentEditableFalse$7 = isContentEditableFalse; + var showCaret = function (direction, editor, node, before, scrollIntoView) { + return Optional.from(editor._selectionOverrides.showCaret(direction, node, before, scrollIntoView)); + }; + var getNodeRange = function (node) { + var rng = node.ownerDocument.createRange(); + rng.selectNode(node); + return rng; + }; + var selectNode = function (editor, node) { + var e = editor.fire('BeforeObjectSelected', { target: node }); + if (e.isDefaultPrevented()) { + return Optional.none(); + } + return Optional.some(getNodeRange(node)); + }; + var renderCaretAtRange = function (editor, range, scrollIntoView) { + var normalizedRange = normalizeRange(1, editor.getBody(), range); + var caretPosition = CaretPosition$1.fromRangeStart(normalizedRange); + var caretPositionNode = caretPosition.getNode(); + if (isInlineFakeCaretTarget(caretPositionNode)) { + return showCaret(1, editor, caretPositionNode, !caretPosition.isAtEnd(), false); + } + var caretPositionBeforeNode = caretPosition.getNode(true); + if (isInlineFakeCaretTarget(caretPositionBeforeNode)) { + return showCaret(1, editor, caretPositionBeforeNode, false, false); + } + var ceRoot = editor.dom.getParent(caretPosition.getNode(), function (node) { + return isContentEditableFalse$7(node) || isContentEditableTrue$2(node); + }); + if (isInlineFakeCaretTarget(ceRoot)) { + return showCaret(1, editor, ceRoot, false, scrollIntoView); + } + return Optional.none(); + }; + var renderRangeCaret = function (editor, range, scrollIntoView) { + return range.collapsed ? renderCaretAtRange(editor, range, scrollIntoView).getOr(range) : range; + }; + + var isBeforeBoundary = function (pos) { + return isBeforeContentEditableFalse(pos) || isBeforeMedia(pos); + }; + var isAfterBoundary = function (pos) { + return isAfterContentEditableFalse(pos) || isAfterMedia(pos); + }; + var trimEmptyTextNode$1 = function (dom, node) { + if (isText$1(node) && node.data.length === 0) { + dom.remove(node); + } + }; + var deleteContentAndShowCaret = function (editor, range, node, direction, forward, peekCaretPosition) { + showCaret(direction, editor, peekCaretPosition.getNode(!forward), forward, true).each(function (caretRange) { + if (range.collapsed) { + var deleteRange = range.cloneRange(); + if (forward) { + deleteRange.setEnd(caretRange.startContainer, caretRange.startOffset); + } else { + deleteRange.setStart(caretRange.endContainer, caretRange.endOffset); + } + deleteRange.deleteContents(); + } else { + range.deleteContents(); + } + editor.selection.setRng(caretRange); + }); + trimEmptyTextNode$1(editor.dom, node); + return true; + }; + var deleteBoundaryText = function (editor, forward) { + var range = editor.selection.getRng(); + if (!isText$1(range.commonAncestorContainer)) { + return false; + } + var direction = forward ? HDirection.Forwards : HDirection.Backwards; + var caretWalker = CaretWalker(editor.getBody()); + var getNextPosFn = curry(getVisualCaretPosition, forward ? caretWalker.next : caretWalker.prev); + var isBeforeFn = forward ? isBeforeBoundary : isAfterBoundary; + var caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range); + var nextCaretPosition = normalizePosition(forward, getNextPosFn(caretPosition)); + if (!nextCaretPosition || !isMoveInsideSameBlock(caretPosition, nextCaretPosition)) { + return false; + } else if (isBeforeFn(nextCaretPosition)) { + return deleteContentAndShowCaret(editor, range, caretPosition.getNode(), direction, forward, nextCaretPosition); + } + var peekCaretPosition = getNextPosFn(nextCaretPosition); + if (peekCaretPosition && isBeforeFn(peekCaretPosition)) { + if (isMoveInsideSameBlock(nextCaretPosition, peekCaretPosition)) { + return deleteContentAndShowCaret(editor, range, caretPosition.getNode(), direction, forward, peekCaretPosition); + } + } + return false; + }; + var backspaceDelete$3 = function (editor, forward) { + return deleteBoundaryText(editor, forward); + }; + + var isCompoundElement = function (node) { + return isTableCell$1(SugarElement.fromDom(node)) || isListItem(SugarElement.fromDom(node)); + }; + var DeleteAction = Adt.generate([ + { remove: ['element'] }, + { moveToElement: ['element'] }, + { moveToPosition: ['position'] } + ]); + var isAtContentEditableBlockCaret = function (forward, from) { + var elm = from.getNode(forward === false); + var caretLocation = forward ? 'after' : 'before'; + return isElement$1(elm) && elm.getAttribute('data-mce-caret') === caretLocation; + }; + var isDeleteFromCefDifferentBlocks = function (root, forward, from, to) { + var inSameBlock = function (elm) { + return isInline(SugarElement.fromDom(elm)) && !isInSameBlock(from, to, root); + }; + return getRelativeCefElm(!forward, from).fold(function () { + return getRelativeCefElm(forward, to).fold(never, inSameBlock); + }, inSameBlock); + }; + var deleteEmptyBlockOrMoveToCef = function (root, forward, from, to) { + var toCefElm = to.getNode(forward === false); + return getParentBlock$1(SugarElement.fromDom(root), SugarElement.fromDom(from.getNode())).map(function (blockElm) { + return isEmpty(blockElm) ? DeleteAction.remove(blockElm.dom) : DeleteAction.moveToElement(toCefElm); + }).orThunk(function () { + return Optional.some(DeleteAction.moveToElement(toCefElm)); + }); + }; + var findCefPosition = function (root, forward, from) { + return fromPosition(forward, root, from).bind(function (to) { + if (isCompoundElement(to.getNode())) { + return Optional.none(); + } else if (isDeleteFromCefDifferentBlocks(root, forward, from, to)) { + return Optional.none(); + } else if (forward && isContentEditableFalse(to.getNode())) { + return deleteEmptyBlockOrMoveToCef(root, forward, from, to); + } else if (forward === false && isContentEditableFalse(to.getNode(true))) { + return deleteEmptyBlockOrMoveToCef(root, forward, from, to); + } else if (forward && isAfterContentEditableFalse(from)) { + return Optional.some(DeleteAction.moveToPosition(to)); + } else if (forward === false && isBeforeContentEditableFalse(from)) { + return Optional.some(DeleteAction.moveToPosition(to)); + } else { + return Optional.none(); + } + }); + }; + var getContentEditableBlockAction = function (forward, elm) { + if (forward && isContentEditableFalse(elm.nextSibling)) { + return Optional.some(DeleteAction.moveToElement(elm.nextSibling)); + } else if (forward === false && isContentEditableFalse(elm.previousSibling)) { + return Optional.some(DeleteAction.moveToElement(elm.previousSibling)); + } else { + return Optional.none(); + } + }; + var skipMoveToActionFromInlineCefToContent = function (root, from, deleteAction) { + return deleteAction.fold(function (elm) { + return Optional.some(DeleteAction.remove(elm)); + }, function (elm) { + return Optional.some(DeleteAction.moveToElement(elm)); + }, function (to) { + if (isInSameBlock(from, to, root)) { + return Optional.none(); + } else { + return Optional.some(DeleteAction.moveToPosition(to)); + } + }); + }; + var getContentEditableAction = function (root, forward, from) { + if (isAtContentEditableBlockCaret(forward, from)) { + return getContentEditableBlockAction(forward, from.getNode(forward === false)).fold(function () { + return findCefPosition(root, forward, from); + }, Optional.some); + } else { + return findCefPosition(root, forward, from).bind(function (deleteAction) { + return skipMoveToActionFromInlineCefToContent(root, from, deleteAction); + }); + } + }; + var read$4 = function (root, forward, rng) { + var normalizedRange = normalizeRange(forward ? 1 : -1, root, rng); + var from = CaretPosition$1.fromRangeStart(normalizedRange); + var rootElement = SugarElement.fromDom(root); + if (forward === false && isAfterContentEditableFalse(from)) { + return Optional.some(DeleteAction.remove(from.getNode(true))); + } else if (forward && isBeforeContentEditableFalse(from)) { + return Optional.some(DeleteAction.remove(from.getNode())); + } else if (forward === false && isBeforeContentEditableFalse(from) && isAfterBr(rootElement, from)) { + return findPreviousBr(rootElement, from).map(function (br) { + return DeleteAction.remove(br.getNode()); + }); + } else if (forward && isAfterContentEditableFalse(from) && isBeforeBr(rootElement, from)) { + return findNextBr(rootElement, from).map(function (br) { + return DeleteAction.remove(br.getNode()); + }); + } else { + return getContentEditableAction(root, forward, from); + } + }; + + var deleteElement$1 = function (editor, forward) { + return function (element) { + editor._selectionOverrides.hideFakeCaret(); + deleteElement(editor, forward, SugarElement.fromDom(element)); + return true; + }; + }; + var moveToElement = function (editor, forward) { + return function (element) { + var pos = forward ? CaretPosition$1.before(element) : CaretPosition$1.after(element); + editor.selection.setRng(pos.toRange()); + return true; + }; + }; + var moveToPosition = function (editor) { + return function (pos) { + editor.selection.setRng(pos.toRange()); + return true; + }; + }; + var getAncestorCe = function (editor, node) { + return Optional.from(getContentEditableRoot(editor.getBody(), node)); + }; + var backspaceDeleteCaret = function (editor, forward) { + var selectedNode = editor.selection.getNode(); + return getAncestorCe(editor, selectedNode).filter(isContentEditableFalse).fold(function () { + return read$4(editor.getBody(), forward, editor.selection.getRng()).exists(function (deleteAction) { + return deleteAction.fold(deleteElement$1(editor, forward), moveToElement(editor, forward), moveToPosition(editor)); + }); + }, always); + }; + var deleteOffscreenSelection = function (rootElement) { + each(descendants$1(rootElement, '.mce-offscreen-selection'), remove); + }; + var backspaceDeleteRange = function (editor, forward) { + var selectedNode = editor.selection.getNode(); + if (isContentEditableFalse(selectedNode)) { + var hasCefAncestor = getAncestorCe(editor, selectedNode.parentNode).filter(isContentEditableFalse); + return hasCefAncestor.fold(function () { + deleteOffscreenSelection(SugarElement.fromDom(editor.getBody())); + deleteElement(editor, forward, SugarElement.fromDom(editor.selection.getNode())); + paddEmptyBody(editor); + return true; + }, function () { + return true; + }); + } + return false; + }; + var paddEmptyElement = function (editor) { + var dom = editor.dom, selection = editor.selection; + var ceRoot = getContentEditableRoot(editor.getBody(), selection.getNode()); + if (isContentEditableTrue(ceRoot) && dom.isBlock(ceRoot) && dom.isEmpty(ceRoot)) { + var br = dom.create('br', { 'data-mce-bogus': '1' }); + dom.setHTML(ceRoot, ''); + ceRoot.appendChild(br); + selection.setRng(CaretPosition$1.before(br).toRange()); + } + return true; + }; + var backspaceDelete$4 = function (editor, forward) { + if (editor.selection.isCollapsed()) { + return backspaceDeleteCaret(editor, forward); + } else { + return backspaceDeleteRange(editor, forward); + } + }; + + var deleteCaret$1 = function (editor, forward) { + var fromPos = CaretPosition$1.fromRangeStart(editor.selection.getRng()); + return fromPosition(forward, editor.getBody(), fromPos).filter(function (pos) { + return forward ? isBeforeImageBlock(pos) : isAfterImageBlock(pos); + }).bind(function (pos) { + return Optional.from(getChildNodeAtRelativeOffset(forward ? 0 : -1, pos)); + }).exists(function (elm) { + editor.selection.select(elm); + return true; + }); + }; + var backspaceDelete$5 = function (editor, forward) { + return editor.selection.isCollapsed() ? deleteCaret$1(editor, forward) : false; + }; + + var isText$8 = isText$1; + var startsWithCaretContainer$1 = function (node) { + return isText$8(node) && node.data[0] === ZWSP; + }; + var endsWithCaretContainer$1 = function (node) { + return isText$8(node) && node.data[node.data.length - 1] === ZWSP; + }; + var createZwsp = function (node) { + return node.ownerDocument.createTextNode(ZWSP); + }; + var insertBefore$1 = function (node) { + if (isText$8(node.previousSibling)) { + if (endsWithCaretContainer$1(node.previousSibling)) { + return node.previousSibling; + } else { + node.previousSibling.appendData(ZWSP); + return node.previousSibling; + } + } else if (isText$8(node)) { + if (startsWithCaretContainer$1(node)) { + return node; + } else { + node.insertData(0, ZWSP); + return node; + } + } else { + var newNode = createZwsp(node); + node.parentNode.insertBefore(newNode, node); + return newNode; + } + }; + var insertAfter$1 = function (node) { + if (isText$8(node.nextSibling)) { + if (startsWithCaretContainer$1(node.nextSibling)) { + return node.nextSibling; + } else { + node.nextSibling.insertData(0, ZWSP); + return node.nextSibling; + } + } else if (isText$8(node)) { + if (endsWithCaretContainer$1(node)) { + return node; + } else { + node.appendData(ZWSP); + return node; + } + } else { + var newNode = createZwsp(node); + if (node.nextSibling) { + node.parentNode.insertBefore(newNode, node.nextSibling); + } else { + node.parentNode.appendChild(newNode); + } + return newNode; + } + }; + var insertInline$1 = function (before, node) { + return before ? insertBefore$1(node) : insertAfter$1(node); + }; + var insertInlineBefore = curry(insertInline$1, true); + var insertInlineAfter = curry(insertInline$1, false); + + var insertInlinePos = function (pos, before) { + if (isText$1(pos.container())) { + return insertInline$1(before, pos.container()); + } else { + return insertInline$1(before, pos.getNode()); + } + }; + var isPosCaretContainer = function (pos, caret) { + var caretNode = caret.get(); + return caretNode && pos.container() === caretNode && isCaretContainerInline(caretNode); + }; + var renderCaret = function (caret, location) { + return location.fold(function (element) { + remove$5(caret.get()); + var text = insertInlineBefore(element); + caret.set(text); + return Optional.some(CaretPosition$1(text, text.length - 1)); + }, function (element) { + return firstPositionIn(element).map(function (pos) { + if (!isPosCaretContainer(pos, caret)) { + remove$5(caret.get()); + var text = insertInlinePos(pos, true); + caret.set(text); + return CaretPosition$1(text, 1); + } else { + return CaretPosition$1(caret.get(), 1); + } + }); + }, function (element) { + return lastPositionIn(element).map(function (pos) { + if (!isPosCaretContainer(pos, caret)) { + remove$5(caret.get()); + var text = insertInlinePos(pos, false); + caret.set(text); + return CaretPosition$1(text, text.length - 1); + } else { + return CaretPosition$1(caret.get(), caret.get().length - 1); + } + }); + }, function (element) { + remove$5(caret.get()); + var text = insertInlineAfter(element); + caret.set(text); + return Optional.some(CaretPosition$1(text, 1)); + }); + }; + + var evaluateUntil = function (fns, args) { + for (var i = 0; i < fns.length; i++) { + var result = fns[i].apply(null, args); + if (result.isSome()) { + return result; + } + } + return Optional.none(); + }; + + var Location = Adt.generate([ + { before: ['element'] }, + { start: ['element'] }, + { end: ['element'] }, + { after: ['element'] } + ]); + var rescope = function (rootNode, node) { + var parentBlock = getParentBlock(node, rootNode); + return parentBlock ? parentBlock : rootNode; + }; + var before$4 = function (isInlineTarget, rootNode, pos) { + var nPos = normalizeForwards(pos); + var scope = rescope(rootNode, nPos.container()); + return findRootInline(isInlineTarget, scope, nPos).fold(function () { + return nextPosition(scope, nPos).bind(curry(findRootInline, isInlineTarget, scope)).map(function (inline) { + return Location.before(inline); + }); + }, Optional.none); + }; + var isNotInsideFormatCaretContainer = function (rootNode, elm) { + return getParentCaretContainer(rootNode, elm) === null; + }; + var findInsideRootInline = function (isInlineTarget, rootNode, pos) { + return findRootInline(isInlineTarget, rootNode, pos).filter(curry(isNotInsideFormatCaretContainer, rootNode)); + }; + var start = function (isInlineTarget, rootNode, pos) { + var nPos = normalizeBackwards(pos); + return findInsideRootInline(isInlineTarget, rootNode, nPos).bind(function (inline) { + var prevPos = prevPosition(inline, nPos); + return prevPos.isNone() ? Optional.some(Location.start(inline)) : Optional.none(); + }); + }; + var end = function (isInlineTarget, rootNode, pos) { + var nPos = normalizeForwards(pos); + return findInsideRootInline(isInlineTarget, rootNode, nPos).bind(function (inline) { + var nextPos = nextPosition(inline, nPos); + return nextPos.isNone() ? Optional.some(Location.end(inline)) : Optional.none(); + }); + }; + var after$3 = function (isInlineTarget, rootNode, pos) { + var nPos = normalizeBackwards(pos); + var scope = rescope(rootNode, nPos.container()); + return findRootInline(isInlineTarget, scope, nPos).fold(function () { + return prevPosition(scope, nPos).bind(curry(findRootInline, isInlineTarget, scope)).map(function (inline) { + return Location.after(inline); + }); + }, Optional.none); + }; + var isValidLocation = function (location) { + return isRtl$1(getElement(location)) === false; + }; + var readLocation = function (isInlineTarget, rootNode, pos) { + var location = evaluateUntil([ + before$4, + start, + end, + after$3 + ], [ + isInlineTarget, + rootNode, + pos + ]); + return location.filter(isValidLocation); + }; + var getElement = function (location) { + return location.fold(identity, identity, identity, identity); + }; + var getName = function (location) { + return location.fold(constant('before'), constant('start'), constant('end'), constant('after')); + }; + var outside = function (location) { + return location.fold(Location.before, Location.before, Location.after, Location.after); + }; + var inside = function (location) { + return location.fold(Location.start, Location.start, Location.end, Location.end); + }; + var isEq$5 = function (location1, location2) { + return getName(location1) === getName(location2) && getElement(location1) === getElement(location2); + }; + var betweenInlines = function (forward, isInlineTarget, rootNode, from, to, location) { + return lift2(findRootInline(isInlineTarget, rootNode, from), findRootInline(isInlineTarget, rootNode, to), function (fromInline, toInline) { + if (fromInline !== toInline && hasSameParentBlock(rootNode, fromInline, toInline)) { + return Location.after(forward ? fromInline : toInline); + } else { + return location; + } + }).getOr(location); + }; + var skipNoMovement = function (fromLocation, toLocation) { + return fromLocation.fold(always, function (fromLocation) { + return !isEq$5(fromLocation, toLocation); + }); + }; + var findLocationTraverse = function (forward, isInlineTarget, rootNode, fromLocation, pos) { + var from = normalizePosition(forward, pos); + var to = fromPosition(forward, rootNode, from).map(curry(normalizePosition, forward)); + var location = to.fold(function () { + return fromLocation.map(outside); + }, function (to) { + return readLocation(isInlineTarget, rootNode, to).map(curry(betweenInlines, forward, isInlineTarget, rootNode, from, to)).filter(curry(skipNoMovement, fromLocation)); + }); + return location.filter(isValidLocation); + }; + var findLocationSimple = function (forward, location) { + if (forward) { + return location.fold(compose(Optional.some, Location.start), Optional.none, compose(Optional.some, Location.after), Optional.none); + } else { + return location.fold(Optional.none, compose(Optional.some, Location.before), Optional.none, compose(Optional.some, Location.end)); + } + }; + var findLocation = function (forward, isInlineTarget, rootNode, pos) { + var from = normalizePosition(forward, pos); + var fromLocation = readLocation(isInlineTarget, rootNode, from); + return readLocation(isInlineTarget, rootNode, from).bind(curry(findLocationSimple, forward)).orThunk(function () { + return findLocationTraverse(forward, isInlineTarget, rootNode, fromLocation, pos); + }); + }; + var prevLocation = curry(findLocation, false); + var nextLocation = curry(findLocation, true); + + var hasSelectionModifyApi = function (editor) { + return isFunction(editor.selection.getSel().modify); + }; + var moveRel = function (forward, selection, pos) { + var delta = forward ? 1 : -1; + selection.setRng(CaretPosition$1(pos.container(), pos.offset() + delta).toRange()); + selection.getSel().modify('move', forward ? 'forward' : 'backward', 'word'); + return true; + }; + var moveByWord = function (forward, editor) { + var rng = editor.selection.getRng(); + var pos = forward ? CaretPosition$1.fromRangeEnd(rng) : CaretPosition$1.fromRangeStart(rng); + if (!hasSelectionModifyApi(editor)) { + return false; + } else if (forward && isBeforeInline(pos)) { + return moveRel(true, editor.selection, pos); + } else if (!forward && isAfterInline(pos)) { + return moveRel(false, editor.selection, pos); + } else { + return false; + } + }; + + var setCaretPosition = function (editor, pos) { + var rng = editor.dom.createRng(); + rng.setStart(pos.container(), pos.offset()); + rng.setEnd(pos.container(), pos.offset()); + editor.selection.setRng(rng); + }; + var setSelected = function (state, elm) { + if (state) { + elm.setAttribute('data-mce-selected', 'inline-boundary'); + } else { + elm.removeAttribute('data-mce-selected'); + } + }; + var renderCaretLocation = function (editor, caret, location) { + return renderCaret(caret, location).map(function (pos) { + setCaretPosition(editor, pos); + return location; + }); + }; + var findLocation$1 = function (editor, caret, forward) { + var rootNode = editor.getBody(); + var from = CaretPosition$1.fromRangeStart(editor.selection.getRng()); + var isInlineTarget$1 = curry(isInlineTarget, editor); + var location = findLocation(forward, isInlineTarget$1, rootNode, from); + return location.bind(function (location) { + return renderCaretLocation(editor, caret, location); + }); + }; + var toggleInlines = function (isInlineTarget, dom, elms) { + var inlineBoundaries = map(descendants$1(SugarElement.fromDom(dom.getRoot()), '*[data-mce-selected="inline-boundary"]'), function (e) { + return e.dom; + }); + var selectedInlines = filter(inlineBoundaries, isInlineTarget); + var targetInlines = filter(elms, isInlineTarget); + each(difference(selectedInlines, targetInlines), curry(setSelected, false)); + each(difference(targetInlines, selectedInlines), curry(setSelected, true)); + }; + var safeRemoveCaretContainer = function (editor, caret) { + if (editor.selection.isCollapsed() && editor.composing !== true && caret.get()) { + var pos = CaretPosition$1.fromRangeStart(editor.selection.getRng()); + if (CaretPosition$1.isTextPosition(pos) && isAtZwsp(pos) === false) { + setCaretPosition(editor, removeAndReposition(caret.get(), pos)); + caret.set(null); + } + } + }; + var renderInsideInlineCaret = function (isInlineTarget, editor, caret, elms) { + if (editor.selection.isCollapsed()) { + var inlines = filter(elms, isInlineTarget); + each(inlines, function (_inline) { + var pos = CaretPosition$1.fromRangeStart(editor.selection.getRng()); + readLocation(isInlineTarget, editor.getBody(), pos).bind(function (location) { + return renderCaretLocation(editor, caret, location); + }); + }); + } + }; + var move = function (editor, caret, forward) { + return isInlineBoundariesEnabled(editor) ? findLocation$1(editor, caret, forward).isSome() : false; + }; + var moveWord = function (forward, editor, _caret) { + return isInlineBoundariesEnabled(editor) ? moveByWord(forward, editor) : false; + }; + var setupSelectedState = function (editor) { + var caret = Cell(null); + var isInlineTarget$1 = curry(isInlineTarget, editor); + editor.on('NodeChange', function (e) { + if (isInlineBoundariesEnabled(editor) && !(Env.browser.isIE() && e.initial)) { + toggleInlines(isInlineTarget$1, editor.dom, e.parents); + safeRemoveCaretContainer(editor, caret); + renderInsideInlineCaret(isInlineTarget$1, editor, caret, e.parents); + } + }); + return caret; + }; + var moveNextWord = curry(moveWord, true); + var movePrevWord = curry(moveWord, false); + + var rangeFromPositions = function (from, to) { + var range = document.createRange(); + range.setStart(from.container(), from.offset()); + range.setEnd(to.container(), to.offset()); + return range; + }; + var hasOnlyTwoOrLessPositionsLeft = function (elm) { + return lift2(firstPositionIn(elm), lastPositionIn(elm), function (firstPos, lastPos) { + var normalizedFirstPos = normalizePosition(true, firstPos); + var normalizedLastPos = normalizePosition(false, lastPos); + return nextPosition(elm, normalizedFirstPos).forall(function (pos) { + return pos.isEqual(normalizedLastPos); + }); + }).getOr(true); + }; + var setCaretLocation = function (editor, caret) { + return function (location) { + return renderCaret(caret, location).exists(function (pos) { + setCaretPosition(editor, pos); + return true; + }); + }; + }; + var deleteFromTo = function (editor, caret, from, to) { + var rootNode = editor.getBody(); + var isInlineTarget$1 = curry(isInlineTarget, editor); + editor.undoManager.ignore(function () { + editor.selection.setRng(rangeFromPositions(from, to)); + editor.execCommand('Delete'); + readLocation(isInlineTarget$1, rootNode, CaretPosition$1.fromRangeStart(editor.selection.getRng())).map(inside).map(setCaretLocation(editor, caret)); + }); + editor.nodeChanged(); + }; + var rescope$1 = function (rootNode, node) { + var parentBlock = getParentBlock(node, rootNode); + return parentBlock ? parentBlock : rootNode; + }; + var backspaceDeleteCollapsed = function (editor, caret, forward, from) { + var rootNode = rescope$1(editor.getBody(), from.container()); + var isInlineTarget$1 = curry(isInlineTarget, editor); + var fromLocation = readLocation(isInlineTarget$1, rootNode, from); + return fromLocation.bind(function (location) { + if (forward) { + return location.fold(constant(Optional.some(inside(location))), Optional.none, constant(Optional.some(outside(location))), Optional.none); + } else { + return location.fold(Optional.none, constant(Optional.some(outside(location))), Optional.none, constant(Optional.some(inside(location)))); + } + }).map(setCaretLocation(editor, caret)).getOrThunk(function () { + var toPosition = navigate(forward, rootNode, from); + var toLocation = toPosition.bind(function (pos) { + return readLocation(isInlineTarget$1, rootNode, pos); + }); + return lift2(fromLocation, toLocation, function () { + return findRootInline(isInlineTarget$1, rootNode, from).exists(function (elm) { + if (hasOnlyTwoOrLessPositionsLeft(elm)) { + deleteElement(editor, forward, SugarElement.fromDom(elm)); + return true; + } else { + return false; + } + }); + }).orThunk(function () { + return toLocation.bind(function (_) { + return toPosition.map(function (to) { + if (forward) { + deleteFromTo(editor, caret, from, to); + } else { + deleteFromTo(editor, caret, to, from); + } + return true; + }); + }); + }).getOr(false); + }); + }; + var backspaceDelete$6 = function (editor, caret, forward) { + if (editor.selection.isCollapsed() && isInlineBoundariesEnabled(editor)) { + var from = CaretPosition$1.fromRangeStart(editor.selection.getRng()); + return backspaceDeleteCollapsed(editor, caret, forward, from); + } + return false; + }; + + var getParentInlines = function (rootElm, startElm) { + var parents = parentsAndSelf(startElm, rootElm); + return findIndex(parents, isBlock).fold(constant(parents), function (index) { + return parents.slice(0, index); + }); + }; + var hasOnlyOneChild$1 = function (elm) { + return children(elm).length === 1; + }; + var deleteLastPosition = function (forward, editor, target, parentInlines) { + var isFormatElement$1 = curry(isFormatElement, editor); + var formatNodes = map(filter(parentInlines, isFormatElement$1), function (elm) { + return elm.dom; + }); + if (formatNodes.length === 0) { + deleteElement(editor, forward, target); + } else { + var pos = replaceWithCaretFormat(target.dom, formatNodes); + editor.selection.setRng(pos.toRange()); + } + }; + var deleteCaret$2 = function (editor, forward) { + var rootElm = SugarElement.fromDom(editor.getBody()); + var startElm = SugarElement.fromDom(editor.selection.getStart()); + var parentInlines = filter(getParentInlines(rootElm, startElm), hasOnlyOneChild$1); + return last(parentInlines).exists(function (target) { + var fromPos = CaretPosition$1.fromRangeStart(editor.selection.getRng()); + if (willDeleteLastPositionInElement(forward, fromPos, target.dom) && !isEmptyCaretFormatElement(target)) { + deleteLastPosition(forward, editor, target, parentInlines); + return true; + } else { + return false; + } + }); + }; + var backspaceDelete$7 = function (editor, forward) { + return editor.selection.isCollapsed() ? deleteCaret$2(editor, forward) : false; + }; + + var deleteElement$2 = function (editor, forward, element) { + editor._selectionOverrides.hideFakeCaret(); + deleteElement(editor, forward, SugarElement.fromDom(element)); + return true; + }; + var deleteCaret$3 = function (editor, forward) { + var isNearMedia = forward ? isBeforeMedia : isAfterMedia; + var direction = forward ? HDirection.Forwards : HDirection.Backwards; + var fromPos = getNormalizedRangeEndPoint(direction, editor.getBody(), editor.selection.getRng()); + if (isNearMedia(fromPos)) { + return deleteElement$2(editor, forward, fromPos.getNode(!forward)); + } else { + return Optional.from(normalizePosition(forward, fromPos)).filter(function (pos) { + return isNearMedia(pos) && isMoveInsideSameBlock(fromPos, pos); + }).exists(function (pos) { + return deleteElement$2(editor, forward, pos.getNode(!forward)); + }); + } + }; + var deleteRange$2 = function (editor, forward) { + var selectedNode = editor.selection.getNode(); + return isMedia(selectedNode) ? deleteElement$2(editor, forward, selectedNode) : false; + }; + var backspaceDelete$8 = function (editor, forward) { + return editor.selection.isCollapsed() ? deleteCaret$3(editor, forward) : deleteRange$2(editor, forward); + }; + + var isEditable$1 = function (target) { + return closest(target, function (elm) { + return isContentEditableTrue(elm.dom) || isContentEditableFalse(elm.dom); + }).exists(function (elm) { + return isContentEditableTrue(elm.dom); + }); + }; + var parseIndentValue = function (value) { + var number = parseInt(value, 10); + return isNaN(number) ? 0 : number; + }; + var getIndentStyleName = function (useMargin, element) { + var indentStyleName = useMargin || isTable$1(element) ? 'margin' : 'padding'; + var suffix = get$5(element, 'direction') === 'rtl' ? '-right' : '-left'; + return indentStyleName + suffix; + }; + var indentElement = function (dom, command, useMargin, value, unit, element) { + var indentStyleName = getIndentStyleName(useMargin, SugarElement.fromDom(element)); + if (command === 'outdent') { + var styleValue = Math.max(0, parseIndentValue(element.style[indentStyleName]) - value); + dom.setStyle(element, indentStyleName, styleValue ? styleValue + unit : ''); + } else { + var styleValue = parseIndentValue(element.style[indentStyleName]) + value + unit; + dom.setStyle(element, indentStyleName, styleValue); + } + }; + var validateBlocks = function (editor, blocks) { + return forall(blocks, function (block) { + var indentStyleName = getIndentStyleName(shouldIndentUseMargin(editor), block); + var intentValue = getRaw(block, indentStyleName).map(parseIndentValue).getOr(0); + var contentEditable = editor.dom.getContentEditable(block.dom); + return contentEditable !== 'false' && intentValue > 0; + }); + }; + var canOutdent = function (editor) { + var blocks = getBlocksToIndent(editor); + return !editor.mode.isReadOnly() && (blocks.length > 1 || validateBlocks(editor, blocks)); + }; + var isListComponent = function (el) { + return isList(el) || isListItem(el); + }; + var parentIsListComponent = function (el) { + return parent(el).map(isListComponent).getOr(false); + }; + var getBlocksToIndent = function (editor) { + return filter(map(editor.selection.getSelectedBlocks(), SugarElement.fromDom), function (el) { + return !isListComponent(el) && !parentIsListComponent(el) && isEditable$1(el); + }); + }; + var handle = function (editor, command) { + var dom = editor.dom, selection = editor.selection, formatter = editor.formatter; + var indentation = getIndentation(editor); + var indentUnit = /[a-z%]+$/i.exec(indentation)[0]; + var indentValue = parseInt(indentation, 10); + var useMargin = shouldIndentUseMargin(editor); + var forcedRootBlock = getForcedRootBlock(editor); + if (!editor.queryCommandState('InsertUnorderedList') && !editor.queryCommandState('InsertOrderedList')) { + if (forcedRootBlock === '' && !dom.getParent(selection.getNode(), dom.isBlock)) { + formatter.apply('div'); + } + } + each(getBlocksToIndent(editor), function (block) { + indentElement(dom, command, useMargin, indentValue, indentUnit, block.dom); + }); + }; + + var backspaceDelete$9 = function (editor, _forward) { + if (editor.selection.isCollapsed() && canOutdent(editor)) { + var dom = editor.dom; + var rng = editor.selection.getRng(); + var pos = CaretPosition$1.fromRangeStart(rng); + var block = dom.getParent(rng.startContainer, dom.isBlock); + if (block !== null && isAtStartOfBlock(SugarElement.fromDom(block), pos)) { + handle(editor, 'outdent'); + return true; + } + } + return false; + }; + + var nativeCommand = function (editor, command) { + editor.getDoc().execCommand(command, false, null); + }; + var deleteCommand = function (editor, caret) { + if (backspaceDelete$9(editor)) { + return; + } else if (backspaceDelete$4(editor, false)) { + return; + } else if (backspaceDelete$3(editor, false)) { + return; + } else if (backspaceDelete$6(editor, caret, false)) { + return; + } else if (backspaceDelete$1(editor, false)) { + return; + } else if (backspaceDelete(editor)) { + return; + } else if (backspaceDelete$5(editor, false)) { + return; + } else if (backspaceDelete$8(editor, false)) { + return; + } else if (backspaceDelete$2(editor)) { + return; + } else if (backspaceDelete$7(editor, false)) { + return; + } else { + nativeCommand(editor, 'Delete'); + paddEmptyBody(editor); + } + }; + var forwardDeleteCommand = function (editor, caret) { + if (backspaceDelete$4(editor, true)) { + return; + } else if (backspaceDelete$3(editor, true)) { + return; + } else if (backspaceDelete$6(editor, caret, true)) { + return; + } else if (backspaceDelete$1(editor, true)) { + return; + } else if (backspaceDelete(editor)) { + return; + } else if (backspaceDelete$5(editor, true)) { + return; + } else if (backspaceDelete$8(editor, true)) { + return; + } else if (backspaceDelete$2(editor)) { + return; + } else if (backspaceDelete$7(editor, true)) { + return; + } else { + nativeCommand(editor, 'ForwardDelete'); + } + }; + var setup$8 = function (editor, caret) { + editor.addCommand('delete', function () { + deleteCommand(editor, caret); + }); + editor.addCommand('forwardDelete', function () { + forwardDeleteCommand(editor, caret); + }); + }; + + var SIGNIFICANT_MOVE = 5; + var LONGPRESS_DELAY = 400; + var getTouch = function (event) { + if (event.touches === undefined || event.touches.length !== 1) { + return Optional.none(); + } + return Optional.some(event.touches[0]); + }; + var isFarEnough = function (touch, data) { + var distX = Math.abs(touch.clientX - data.x); + var distY = Math.abs(touch.clientY - data.y); + return distX > SIGNIFICANT_MOVE || distY > SIGNIFICANT_MOVE; + }; + var setup$9 = function (editor) { + var startData = Cell(Optional.none()); + var longpressFired = Cell(false); + var debounceLongpress = last$2(function (e) { + editor.fire('longpress', __assign(__assign({}, e), { type: 'longpress' })); + longpressFired.set(true); + }, LONGPRESS_DELAY); + editor.on('touchstart', function (e) { + getTouch(e).each(function (touch) { + debounceLongpress.cancel(); + var data = { + x: touch.clientX, + y: touch.clientY, + target: e.target + }; + debounceLongpress.throttle(e); + longpressFired.set(false); + startData.set(Optional.some(data)); + }); + }, true); + editor.on('touchmove', function (e) { + debounceLongpress.cancel(); + getTouch(e).each(function (touch) { + startData.get().each(function (data) { + if (isFarEnough(touch, data)) { + startData.set(Optional.none()); + longpressFired.set(false); + editor.fire('longpresscancel'); + } + }); + }); + }, true); + editor.on('touchend touchcancel', function (e) { + debounceLongpress.cancel(); + if (e.type === 'touchcancel') { + return; + } + startData.get().filter(function (data) { + return data.target.isEqualNode(e.target); + }).each(function () { + if (longpressFired.get()) { + e.preventDefault(); + } else { + editor.fire('tap', __assign(__assign({}, e), { type: 'tap' })); + } + }); + }, true); + }; + + var isBlockElement = function (blockElements, node) { + return blockElements.hasOwnProperty(node.nodeName); + }; + var isValidTarget = function (blockElements, node) { + if (isText$1(node)) { + return true; + } else if (isElement$1(node)) { + return !isBlockElement(blockElements, node) && !isBookmarkNode$1(node); + } else { + return false; + } + }; + var hasBlockParent = function (blockElements, root, node) { + return exists(parents$1(SugarElement.fromDom(node), SugarElement.fromDom(root)), function (elm) { + return isBlockElement(blockElements, elm.dom); + }); + }; + var shouldRemoveTextNode = function (blockElements, node) { + if (isText$1(node)) { + if (node.nodeValue.length === 0) { + return true; + } else if (/^\s+$/.test(node.nodeValue) && (!node.nextSibling || isBlockElement(blockElements, node.nextSibling))) { + return true; + } + } + return false; + }; + var addRootBlocks = function (editor) { + var dom = editor.dom, selection = editor.selection; + var schema = editor.schema, blockElements = schema.getBlockElements(); + var node = selection.getStart(); + var rootNode = editor.getBody(); + var rootBlockNode, tempNode, wrapped; + var forcedRootBlock = getForcedRootBlock(editor); + if (!node || !isElement$1(node) || !forcedRootBlock) { + return; + } + var rootNodeName = rootNode.nodeName.toLowerCase(); + if (!schema.isValidChild(rootNodeName, forcedRootBlock.toLowerCase()) || hasBlockParent(blockElements, rootNode, node)) { + return; + } + var rng = selection.getRng(); + var startContainer = rng.startContainer; + var startOffset = rng.startOffset; + var endContainer = rng.endContainer; + var endOffset = rng.endOffset; + var restoreSelection = hasFocus$1(editor); + node = rootNode.firstChild; + while (node) { + if (isValidTarget(blockElements, node)) { + if (shouldRemoveTextNode(blockElements, node)) { + tempNode = node; + node = node.nextSibling; + dom.remove(tempNode); + continue; + } + if (!rootBlockNode) { + rootBlockNode = dom.create(forcedRootBlock, getForcedRootBlockAttrs(editor)); + node.parentNode.insertBefore(rootBlockNode, node); + wrapped = true; + } + tempNode = node; + node = node.nextSibling; + rootBlockNode.appendChild(tempNode); + } else { + rootBlockNode = null; + node = node.nextSibling; + } + } + if (wrapped && restoreSelection) { + rng.setStart(startContainer, startOffset); + rng.setEnd(endContainer, endOffset); + selection.setRng(rng); + editor.nodeChanged(); + } + }; + var setup$a = function (editor) { + if (getForcedRootBlock(editor)) { + editor.on('NodeChange', curry(addRootBlocks, editor)); + } + }; + + var findBlockCaretContainer = function (editor) { + return descendant(SugarElement.fromDom(editor.getBody()), '*[data-mce-caret]').fold(constant(null), function (elm) { + return elm.dom; + }); + }; + var removeIeControlRect = function (editor) { + editor.selection.setRng(editor.selection.getRng()); + }; + var showBlockCaretContainer = function (editor, blockCaretContainer) { + if (blockCaretContainer.hasAttribute('data-mce-caret')) { + showCaretContainerBlock(blockCaretContainer); + removeIeControlRect(editor); + editor.selection.scrollIntoView(blockCaretContainer); + } + }; + var handleBlockContainer = function (editor, e) { + var blockCaretContainer = findBlockCaretContainer(editor); + if (!blockCaretContainer) { + return; + } + if (e.type === 'compositionstart') { + e.preventDefault(); + e.stopPropagation(); + showBlockCaretContainer(editor, blockCaretContainer); + return; + } + if (hasContent(blockCaretContainer)) { + showBlockCaretContainer(editor, blockCaretContainer); + editor.undoManager.add(); + } + }; + var setup$b = function (editor) { + editor.on('keyup compositionstart', curry(handleBlockContainer, editor)); + }; + + var BreakType; + (function (BreakType) { + BreakType[BreakType['Br'] = 0] = 'Br'; + BreakType[BreakType['Block'] = 1] = 'Block'; + BreakType[BreakType['Wrap'] = 2] = 'Wrap'; + BreakType[BreakType['Eol'] = 3] = 'Eol'; + }(BreakType || (BreakType = {}))); + var flip = function (direction, positions) { + return direction === HDirection.Backwards ? reverse(positions) : positions; + }; + var walk$3 = function (direction, caretWalker, pos) { + return direction === HDirection.Forwards ? caretWalker.next(pos) : caretWalker.prev(pos); + }; + var getBreakType = function (scope, direction, currentPos, nextPos) { + if (isBr(nextPos.getNode(direction === HDirection.Forwards))) { + return BreakType.Br; + } else if (isInSameBlock(currentPos, nextPos) === false) { + return BreakType.Block; + } else { + return BreakType.Wrap; + } + }; + var getPositionsUntil = function (predicate, direction, scope, start) { + var caretWalker = CaretWalker(scope); + var currentPos = start, nextPos; + var positions = []; + while (currentPos) { + nextPos = walk$3(direction, caretWalker, currentPos); + if (!nextPos) { + break; + } + if (isBr(nextPos.getNode(false))) { + if (direction === HDirection.Forwards) { + return { + positions: flip(direction, positions).concat([nextPos]), + breakType: BreakType.Br, + breakAt: Optional.some(nextPos) + }; + } else { + return { + positions: flip(direction, positions), + breakType: BreakType.Br, + breakAt: Optional.some(nextPos) + }; + } + } + if (!nextPos.isVisible()) { + currentPos = nextPos; + continue; + } + if (predicate(currentPos, nextPos)) { + var breakType = getBreakType(scope, direction, currentPos, nextPos); + return { + positions: flip(direction, positions), + breakType: breakType, + breakAt: Optional.some(nextPos) + }; + } + positions.push(nextPos); + currentPos = nextPos; + } + return { + positions: flip(direction, positions), + breakType: BreakType.Eol, + breakAt: Optional.none() + }; + }; + var getAdjacentLinePositions = function (direction, getPositionsUntilBreak, scope, start) { + return getPositionsUntilBreak(scope, start).breakAt.map(function (pos) { + var positions = getPositionsUntilBreak(scope, pos).positions; + return direction === HDirection.Backwards ? positions.concat(pos) : [pos].concat(positions); + }).getOr([]); + }; + var findClosestHorizontalPositionFromPoint = function (positions, x) { + return foldl(positions, function (acc, newPos) { + return acc.fold(function () { + return Optional.some(newPos); + }, function (lastPos) { + return lift2(head(lastPos.getClientRects()), head(newPos.getClientRects()), function (lastRect, newRect) { + var lastDist = Math.abs(x - lastRect.left); + var newDist = Math.abs(x - newRect.left); + return newDist <= lastDist ? newPos : lastPos; + }).or(acc); + }); + }, Optional.none()); + }; + var findClosestHorizontalPosition = function (positions, pos) { + return head(pos.getClientRects()).bind(function (targetRect) { + return findClosestHorizontalPositionFromPoint(positions, targetRect.left); + }); + }; + var getPositionsUntilPreviousLine = curry(getPositionsUntil, CaretPosition.isAbove, -1); + var getPositionsUntilNextLine = curry(getPositionsUntil, CaretPosition.isBelow, 1); + var isAtFirstLine = function (scope, pos) { + return getPositionsUntilPreviousLine(scope, pos).breakAt.isNone(); + }; + var isAtLastLine = function (scope, pos) { + return getPositionsUntilNextLine(scope, pos).breakAt.isNone(); + }; + var getPositionsAbove = curry(getAdjacentLinePositions, -1, getPositionsUntilPreviousLine); + var getPositionsBelow = curry(getAdjacentLinePositions, 1, getPositionsUntilNextLine); + var getFirstLinePositions = function (scope) { + return firstPositionIn(scope).map(function (pos) { + return [pos].concat(getPositionsUntilNextLine(scope, pos).positions); + }).getOr([]); + }; + var getLastLinePositions = function (scope) { + return lastPositionIn(scope).map(function (pos) { + return getPositionsUntilPreviousLine(scope, pos).positions.concat(pos); + }).getOr([]); + }; + + var getNodeClientRects = function (node) { + var toArrayWithNode = function (clientRects) { + return map(clientRects, function (clientRect) { + clientRect = clone$2(clientRect); + clientRect.node = node; + return clientRect; + }); + }; + if (isElement$1(node)) { + return toArrayWithNode(node.getClientRects()); + } + if (isText$1(node)) { + var rng = node.ownerDocument.createRange(); + rng.setStart(node, 0); + rng.setEnd(node, node.data.length); + return toArrayWithNode(rng.getClientRects()); + } + }; + var getClientRects = function (nodes) { + return bind(nodes, getNodeClientRects); + }; + + var VDirection; + (function (VDirection) { + VDirection[VDirection['Up'] = -1] = 'Up'; + VDirection[VDirection['Down'] = 1] = 'Down'; + }(VDirection || (VDirection = {}))); + var findUntil$1 = function (direction, root, predicateFn, node) { + while (node = findNode(node, direction, isEditableCaretCandidate, root)) { + if (predicateFn(node)) { + return; + } + } + }; + var walkUntil = function (direction, isAboveFn, isBeflowFn, root, predicateFn, caretPosition) { + var line = 0; + var result = []; + var add = function (node) { + var i, clientRect, clientRects; + clientRects = getClientRects([node]); + if (direction === -1) { + clientRects = clientRects.reverse(); + } + for (i = 0; i < clientRects.length; i++) { + clientRect = clientRects[i]; + if (isBeflowFn(clientRect, targetClientRect)) { + continue; + } + if (result.length > 0 && isAboveFn(clientRect, last$1(result))) { + line++; + } + clientRect.line = line; + if (predicateFn(clientRect)) { + return true; + } + result.push(clientRect); + } + }; + var targetClientRect = last$1(caretPosition.getClientRects()); + if (!targetClientRect) { + return result; + } + var node = caretPosition.getNode(); + add(node); + findUntil$1(direction, root, add, node); + return result; + }; + var aboveLineNumber = function (lineNumber, clientRect) { + return clientRect.line > lineNumber; + }; + var isLineNumber = function (lineNumber, clientRect) { + return clientRect.line === lineNumber; + }; + var upUntil = curry(walkUntil, VDirection.Up, isAbove, isBelow); + var downUntil = curry(walkUntil, VDirection.Down, isBelow, isAbove); + var positionsUntil = function (direction, root, predicateFn, node) { + var caretWalker = CaretWalker(root); + var walkFn, isBelowFn, isAboveFn, caretPosition; + var result = []; + var line = 0, clientRect; + var getClientRect = function (caretPosition) { + if (direction === 1) { + return last$1(caretPosition.getClientRects()); + } + return last$1(caretPosition.getClientRects()); + }; + if (direction === 1) { + walkFn = caretWalker.next; + isBelowFn = isBelow; + isAboveFn = isAbove; + caretPosition = CaretPosition$1.after(node); + } else { + walkFn = caretWalker.prev; + isBelowFn = isAbove; + isAboveFn = isBelow; + caretPosition = CaretPosition$1.before(node); + } + var targetClientRect = getClientRect(caretPosition); + do { + if (!caretPosition.isVisible()) { + continue; + } + clientRect = getClientRect(caretPosition); + if (isAboveFn(clientRect, targetClientRect)) { + continue; + } + if (result.length > 0 && isBelowFn(clientRect, last$1(result))) { + line++; + } + clientRect = clone$2(clientRect); + clientRect.position = caretPosition; + clientRect.line = line; + if (predicateFn(clientRect)) { + return result; + } + result.push(clientRect); + } while (caretPosition = walkFn(caretPosition)); + return result; + }; + var isAboveLine = function (lineNumber) { + return function (clientRect) { + return aboveLineNumber(lineNumber, clientRect); + }; + }; + var isLine = function (lineNumber) { + return function (clientRect) { + return isLineNumber(lineNumber, clientRect); + }; + }; + + var isContentEditableFalse$8 = isContentEditableFalse; + var findNode$1 = findNode; + var distanceToRectLeft = function (clientRect, clientX) { + return Math.abs(clientRect.left - clientX); + }; + var distanceToRectRight = function (clientRect, clientX) { + return Math.abs(clientRect.right - clientX); + }; + var isInsideX = function (clientX, clientRect) { + return clientX >= clientRect.left && clientX <= clientRect.right; + }; + var isInsideY = function (clientY, clientRect) { + return clientY >= clientRect.top && clientY <= clientRect.bottom; + }; + var findClosestClientRect = function (clientRects, clientX) { + return reduce(clientRects, function (oldClientRect, clientRect) { + var oldDistance = Math.min(distanceToRectLeft(oldClientRect, clientX), distanceToRectRight(oldClientRect, clientX)); + var newDistance = Math.min(distanceToRectLeft(clientRect, clientX), distanceToRectRight(clientRect, clientX)); + if (isInsideX(clientX, clientRect)) { + return clientRect; + } + if (isInsideX(clientX, oldClientRect)) { + return oldClientRect; + } + if (newDistance === oldDistance && isContentEditableFalse$8(clientRect.node)) { + return clientRect; + } + if (newDistance < oldDistance) { + return clientRect; + } + return oldClientRect; + }); + }; + var walkUntil$1 = function (direction, root, predicateFn, startNode, includeChildren) { + var node = findNode$1(startNode, direction, isEditableCaretCandidate, root, !includeChildren); + do { + if (!node || predicateFn(node)) { + return; + } + } while (node = findNode$1(node, direction, isEditableCaretCandidate, root)); + }; + var findLineNodeRects = function (root, targetNodeRect, includeChildren) { + if (includeChildren === void 0) { + includeChildren = true; + } + var clientRects = []; + var collect = function (checkPosFn, node) { + var lineRects = filter(getClientRects([node]), function (clientRect) { + return !checkPosFn(clientRect, targetNodeRect); + }); + clientRects = clientRects.concat(lineRects); + return lineRects.length === 0; + }; + clientRects.push(targetNodeRect); + walkUntil$1(VDirection.Up, root, curry(collect, isAbove), targetNodeRect.node, includeChildren); + walkUntil$1(VDirection.Down, root, curry(collect, isBelow), targetNodeRect.node, includeChildren); + return clientRects; + }; + var getFakeCaretTargets = function (root) { + return filter(from$1(root.getElementsByTagName('*')), isFakeCaretTarget); + }; + var caretInfo = function (clientRect, clientX) { + return { + node: clientRect.node, + before: distanceToRectLeft(clientRect, clientX) < distanceToRectRight(clientRect, clientX) + }; + }; + var closestFakeCaret = function (root, clientX, clientY) { + var fakeTargetNodeRects = getClientRects(getFakeCaretTargets(root)); + var targetNodeRects = filter(fakeTargetNodeRects, curry(isInsideY, clientY)); + var closestNodeRect = findClosestClientRect(targetNodeRects, clientX); + if (closestNodeRect) { + var includeChildren = !isTable(closestNodeRect.node) && !isMedia(closestNodeRect.node); + closestNodeRect = findClosestClientRect(findLineNodeRects(root, closestNodeRect, includeChildren), clientX); + if (closestNodeRect && isFakeCaretTarget(closestNodeRect.node)) { + return caretInfo(closestNodeRect, clientX); + } + } + return null; + }; + + var moveToRange = function (editor, rng) { + editor.selection.setRng(rng); + scrollRangeIntoView(editor, editor.selection.getRng()); + }; + var renderRangeCaretOpt = function (editor, range, scrollIntoView) { + return Optional.some(renderRangeCaret(editor, range, scrollIntoView)); + }; + var moveHorizontally = function (editor, direction, range, isBefore, isAfter, isElement) { + var forwards = direction === HDirection.Forwards; + var caretWalker = CaretWalker(editor.getBody()); + var getNextPosFn = curry(getVisualCaretPosition, forwards ? caretWalker.next : caretWalker.prev); + var isBeforeFn = forwards ? isBefore : isAfter; + if (!range.collapsed) { + var node = getSelectedNode(range); + if (isElement(node)) { + return showCaret(direction, editor, node, direction === HDirection.Backwards, false); + } + } + var caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range); + if (isBeforeFn(caretPosition)) { + return selectNode(editor, caretPosition.getNode(!forwards)); + } + var nextCaretPosition = normalizePosition(forwards, getNextPosFn(caretPosition)); + var rangeIsInContainerBlock = isRangeInCaretContainerBlock(range); + if (!nextCaretPosition) { + return rangeIsInContainerBlock ? Optional.some(range) : Optional.none(); + } + if (isBeforeFn(nextCaretPosition)) { + return showCaret(direction, editor, nextCaretPosition.getNode(!forwards), forwards, false); + } + var peekCaretPosition = getNextPosFn(nextCaretPosition); + if (peekCaretPosition && isBeforeFn(peekCaretPosition)) { + if (isMoveInsideSameBlock(nextCaretPosition, peekCaretPosition)) { + return showCaret(direction, editor, peekCaretPosition.getNode(!forwards), forwards, false); + } + } + if (rangeIsInContainerBlock) { + return renderRangeCaretOpt(editor, nextCaretPosition.toRange(), false); + } + return Optional.none(); + }; + var moveVertically = function (editor, direction, range, isBefore, isAfter, isElement) { + var caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range); + var caretClientRect = last$1(caretPosition.getClientRects()); + var forwards = direction === VDirection.Down; + if (!caretClientRect) { + return Optional.none(); + } + var walkerFn = forwards ? downUntil : upUntil; + var linePositions = walkerFn(editor.getBody(), isAboveLine(1), caretPosition); + var nextLinePositions = filter(linePositions, isLine(1)); + var clientX = caretClientRect.left; + var nextLineRect = findClosestClientRect(nextLinePositions, clientX); + if (nextLineRect && isElement(nextLineRect.node)) { + var dist1 = Math.abs(clientX - nextLineRect.left); + var dist2 = Math.abs(clientX - nextLineRect.right); + return showCaret(direction, editor, nextLineRect.node, dist1 < dist2, false); + } + var currentNode; + if (isBefore(caretPosition)) { + currentNode = caretPosition.getNode(); + } else if (isAfter(caretPosition)) { + currentNode = caretPosition.getNode(true); + } else { + currentNode = getSelectedNode(range); + } + if (currentNode) { + var caretPositions = positionsUntil(direction, editor.getBody(), isAboveLine(1), currentNode); + var closestNextLineRect = findClosestClientRect(filter(caretPositions, isLine(1)), clientX); + if (closestNextLineRect) { + return renderRangeCaretOpt(editor, closestNextLineRect.position.toRange(), false); + } + closestNextLineRect = last$1(filter(caretPositions, isLine(0))); + if (closestNextLineRect) { + return renderRangeCaretOpt(editor, closestNextLineRect.position.toRange(), false); + } + } + if (nextLinePositions.length === 0) { + return getLineEndPoint(editor, forwards).filter(forwards ? isAfter : isBefore).map(function (pos) { + return renderRangeCaret(editor, pos.toRange(), false); + }); + } + return Optional.none(); + }; + var getLineEndPoint = function (editor, forward) { + var rng = editor.selection.getRng(); + var body = editor.getBody(); + if (forward) { + var from = CaretPosition$1.fromRangeEnd(rng); + var result = getPositionsUntilNextLine(body, from); + return last(result.positions); + } else { + var from = CaretPosition$1.fromRangeStart(rng); + var result = getPositionsUntilPreviousLine(body, from); + return head(result.positions); + } + }; + var moveToLineEndPoint = function (editor, forward, isElementPosition) { + return getLineEndPoint(editor, forward).filter(isElementPosition).exists(function (pos) { + editor.selection.setRng(pos.toRange()); + return true; + }); + }; + + var isContentEditableFalse$9 = isContentEditableFalse; + var moveToCeFalseHorizontally = function (direction, editor, range) { + return moveHorizontally(editor, direction, range, isBeforeContentEditableFalse, isAfterContentEditableFalse, isContentEditableFalse$9); + }; + var moveToCeFalseVertically = function (direction, editor, range) { + var isBefore = function (caretPosition) { + return isBeforeContentEditableFalse(caretPosition) || isBeforeTable(caretPosition); + }; + var isAfter = function (caretPosition) { + return isAfterContentEditableFalse(caretPosition) || isAfterTable(caretPosition); + }; + return moveVertically(editor, direction, range, isBefore, isAfter, isContentEditableFalse$9); + }; + var createTextBlock = function (editor) { + var textBlock = editor.dom.create(getForcedRootBlock(editor)); + if (!Env.ie || Env.ie >= 11) { + textBlock.innerHTML = '
                                      '; + } + return textBlock; + }; + var exitPreBlock = function (editor, direction, range) { + var caretWalker = CaretWalker(editor.getBody()); + var getVisualCaretPosition$1 = curry(getVisualCaretPosition, direction === 1 ? caretWalker.next : caretWalker.prev); + if (range.collapsed && hasForcedRootBlock(editor)) { + var pre = editor.dom.getParent(range.startContainer, 'PRE'); + if (!pre) { + return; + } + var caretPos = getVisualCaretPosition$1(CaretPosition$1.fromRangeStart(range)); + if (!caretPos) { + var newBlock = createTextBlock(editor); + if (direction === 1) { + editor.$(pre).after(newBlock); + } else { + editor.$(pre).before(newBlock); + } + editor.selection.select(newBlock, true); + editor.selection.collapse(); + } + } + }; + var getHorizontalRange = function (editor, forward) { + var direction = forward ? HDirection.Forwards : HDirection.Backwards; + var range = editor.selection.getRng(); + return moveToCeFalseHorizontally(direction, editor, range).orThunk(function () { + exitPreBlock(editor, direction, range); + return Optional.none(); + }); + }; + var getVerticalRange = function (editor, down) { + var direction = down ? 1 : -1; + var range = editor.selection.getRng(); + return moveToCeFalseVertically(direction, editor, range).orThunk(function () { + exitPreBlock(editor, direction, range); + return Optional.none(); + }); + }; + var moveH = function (editor, forward) { + return getHorizontalRange(editor, forward).exists(function (newRange) { + moveToRange(editor, newRange); + return true; + }); + }; + var moveV = function (editor, down) { + return getVerticalRange(editor, down).exists(function (newRange) { + moveToRange(editor, newRange); + return true; + }); + }; + var moveToLineEndPoint$1 = function (editor, forward) { + var isCefPosition = forward ? isAfterContentEditableFalse : isBeforeContentEditableFalse; + return moveToLineEndPoint(editor, forward, isCefPosition); + }; + + var isTarget = function (node) { + return contains(['figcaption'], name(node)); + }; + var rangeBefore = function (target) { + var rng = document.createRange(); + rng.setStartBefore(target.dom); + rng.setEndBefore(target.dom); + return rng; + }; + var insertElement = function (root, elm, forward) { + if (forward) { + append(root, elm); + } else { + prepend(root, elm); + } + }; + var insertBr = function (root, forward) { + var br = SugarElement.fromTag('br'); + insertElement(root, br, forward); + return rangeBefore(br); + }; + var insertBlock$1 = function (root, forward, blockName, attrs) { + var block = SugarElement.fromTag(blockName); + var br = SugarElement.fromTag('br'); + setAll(block, attrs); + append(block, br); + insertElement(root, block, forward); + return rangeBefore(br); + }; + var insertEmptyLine = function (root, rootBlockName, attrs, forward) { + if (rootBlockName === '') { + return insertBr(root, forward); + } else { + return insertBlock$1(root, forward, rootBlockName, attrs); + } + }; + var getClosestTargetBlock = function (pos, root) { + var isRoot = curry(eq$2, root); + return closest(SugarElement.fromDom(pos.container()), isBlock, isRoot).filter(isTarget); + }; + var isAtFirstOrLastLine = function (root, forward, pos) { + return forward ? isAtLastLine(root.dom, pos) : isAtFirstLine(root.dom, pos); + }; + var moveCaretToNewEmptyLine = function (editor, forward) { + var root = SugarElement.fromDom(editor.getBody()); + var pos = CaretPosition$1.fromRangeStart(editor.selection.getRng()); + var rootBlock = getForcedRootBlock(editor); + var rootBlockAttrs = getForcedRootBlockAttrs(editor); + return getClosestTargetBlock(pos, root).exists(function () { + if (isAtFirstOrLastLine(root, forward, pos)) { + var rng = insertEmptyLine(root, rootBlock, rootBlockAttrs, forward); + editor.selection.setRng(rng); + return true; + } else { + return false; + } + }); + }; + var moveV$1 = function (editor, forward) { + if (editor.selection.isCollapsed()) { + return moveCaretToNewEmptyLine(editor, forward); + } else { + return false; + } + }; + + var defaultPatterns = function (patterns) { + return map(patterns, function (pattern) { + return __assign({ + shiftKey: false, + altKey: false, + ctrlKey: false, + metaKey: false, + keyCode: 0, + action: noop + }, pattern); + }); + }; + var matchesEvent = function (pattern, evt) { + return evt.keyCode === pattern.keyCode && evt.shiftKey === pattern.shiftKey && evt.altKey === pattern.altKey && evt.ctrlKey === pattern.ctrlKey && evt.metaKey === pattern.metaKey; + }; + var match$1 = function (patterns, evt) { + return bind(defaultPatterns(patterns), function (pattern) { + return matchesEvent(pattern, evt) ? [pattern] : []; + }); + }; + var action = function (f) { + var x = []; + for (var _i = 1; _i < arguments.length; _i++) { + x[_i - 1] = arguments[_i]; + } + return function () { + return f.apply(null, x); + }; + }; + var execute = function (patterns, evt) { + return find(match$1(patterns, evt), function (pattern) { + return pattern.action(); + }); + }; + + var moveH$1 = function (editor, forward) { + var direction = forward ? HDirection.Forwards : HDirection.Backwards; + var range = editor.selection.getRng(); + return moveHorizontally(editor, direction, range, isBeforeMedia, isAfterMedia, isMedia).exists(function (newRange) { + moveToRange(editor, newRange); + return true; + }); + }; + var moveV$2 = function (editor, down) { + var direction = down ? 1 : -1; + var range = editor.selection.getRng(); + return moveVertically(editor, direction, range, isBeforeMedia, isAfterMedia, isMedia).exists(function (newRange) { + moveToRange(editor, newRange); + return true; + }); + }; + var moveToLineEndPoint$2 = function (editor, forward) { + var isNearMedia = forward ? isAfterMedia : isBeforeMedia; + return moveToLineEndPoint(editor, forward, isNearMedia); + }; + + var deflate = function (rect, delta) { + return { + left: rect.left - delta, + top: rect.top - delta, + right: rect.right + delta * 2, + bottom: rect.bottom + delta * 2, + width: rect.width + delta, + height: rect.height + delta + }; + }; + var getCorners = function (getYAxisValue, tds) { + return bind(tds, function (td) { + var rect = deflate(clone$2(td.getBoundingClientRect()), -1); + return [ + { + x: rect.left, + y: getYAxisValue(rect), + cell: td + }, + { + x: rect.right, + y: getYAxisValue(rect), + cell: td + } + ]; + }); + }; + var findClosestCorner = function (corners, x, y) { + return foldl(corners, function (acc, newCorner) { + return acc.fold(function () { + return Optional.some(newCorner); + }, function (oldCorner) { + var oldDist = Math.sqrt(Math.abs(oldCorner.x - x) + Math.abs(oldCorner.y - y)); + var newDist = Math.sqrt(Math.abs(newCorner.x - x) + Math.abs(newCorner.y - y)); + return Optional.some(newDist < oldDist ? newCorner : oldCorner); + }); + }, Optional.none()); + }; + var getClosestCell$1 = function (getYAxisValue, isTargetCorner, table, x, y) { + var cells = descendants$1(SugarElement.fromDom(table), 'td,th,caption').map(function (e) { + return e.dom; + }); + var corners = filter(getCorners(getYAxisValue, cells), function (corner) { + return isTargetCorner(corner, y); + }); + return findClosestCorner(corners, x, y).map(function (corner) { + return corner.cell; + }); + }; + var getBottomValue = function (rect) { + return rect.bottom; + }; + var getTopValue = function (rect) { + return rect.top; + }; + var isAbove$1 = function (corner, y) { + return corner.y < y; + }; + var isBelow$1 = function (corner, y) { + return corner.y > y; + }; + var getClosestCellAbove = curry(getClosestCell$1, getBottomValue, isAbove$1); + var getClosestCellBelow = curry(getClosestCell$1, getTopValue, isBelow$1); + var findClosestPositionInAboveCell = function (table, pos) { + return head(pos.getClientRects()).bind(function (rect) { + return getClosestCellAbove(table, rect.left, rect.top); + }).bind(function (cell) { + return findClosestHorizontalPosition(getLastLinePositions(cell), pos); + }); + }; + var findClosestPositionInBelowCell = function (table, pos) { + return last(pos.getClientRects()).bind(function (rect) { + return getClosestCellBelow(table, rect.left, rect.top); + }).bind(function (cell) { + return findClosestHorizontalPosition(getFirstLinePositions(cell), pos); + }); + }; + + var hasNextBreak = function (getPositionsUntil, scope, lineInfo) { + return lineInfo.breakAt.exists(function (breakPos) { + return getPositionsUntil(scope, breakPos).breakAt.isSome(); + }); + }; + var startsWithWrapBreak = function (lineInfo) { + return lineInfo.breakType === BreakType.Wrap && lineInfo.positions.length === 0; + }; + var startsWithBrBreak = function (lineInfo) { + return lineInfo.breakType === BreakType.Br && lineInfo.positions.length === 1; + }; + var isAtTableCellLine = function (getPositionsUntil, scope, pos) { + var lineInfo = getPositionsUntil(scope, pos); + if (startsWithWrapBreak(lineInfo) || !isBr(pos.getNode()) && startsWithBrBreak(lineInfo)) { + return !hasNextBreak(getPositionsUntil, scope, lineInfo); + } else { + return lineInfo.breakAt.isNone(); + } + }; + var isAtFirstTableCellLine = curry(isAtTableCellLine, getPositionsUntilPreviousLine); + var isAtLastTableCellLine = curry(isAtTableCellLine, getPositionsUntilNextLine); + var isCaretAtStartOrEndOfTable = function (forward, rng, table) { + var caretPos = CaretPosition$1.fromRangeStart(rng); + return positionIn(!forward, table).exists(function (pos) { + return pos.isEqual(caretPos); + }); + }; + var navigateHorizontally = function (editor, forward, table, _td) { + var rng = editor.selection.getRng(); + var direction = forward ? 1 : -1; + if (isFakeCaretTableBrowser() && isCaretAtStartOrEndOfTable(forward, rng, table)) { + showCaret(direction, editor, table, !forward, false).each(function (newRng) { + moveToRange(editor, newRng); + }); + return true; + } + return false; + }; + var getClosestAbovePosition = function (root, table, start) { + return findClosestPositionInAboveCell(table, start).orThunk(function () { + return head(start.getClientRects()).bind(function (rect) { + return findClosestHorizontalPositionFromPoint(getPositionsAbove(root, CaretPosition$1.before(table)), rect.left); + }); + }).getOr(CaretPosition$1.before(table)); + }; + var getClosestBelowPosition = function (root, table, start) { + return findClosestPositionInBelowCell(table, start).orThunk(function () { + return head(start.getClientRects()).bind(function (rect) { + return findClosestHorizontalPositionFromPoint(getPositionsBelow(root, CaretPosition$1.after(table)), rect.left); + }); + }).getOr(CaretPosition$1.after(table)); + }; + var getTable = function (previous, pos) { + var node = pos.getNode(previous); + return isElement$1(node) && node.nodeName === 'TABLE' ? Optional.some(node) : Optional.none(); + }; + var renderBlock = function (down, editor, table, pos) { + var forcedRootBlock = getForcedRootBlock(editor); + if (forcedRootBlock) { + editor.undoManager.transact(function () { + var element = SugarElement.fromTag(forcedRootBlock); + setAll(element, getForcedRootBlockAttrs(editor)); + append(element, SugarElement.fromTag('br')); + if (down) { + after(SugarElement.fromDom(table), element); + } else { + before(SugarElement.fromDom(table), element); + } + var rng = editor.dom.createRng(); + rng.setStart(element.dom, 0); + rng.setEnd(element.dom, 0); + moveToRange(editor, rng); + }); + } else { + moveToRange(editor, pos.toRange()); + } + }; + var moveCaret = function (editor, down, pos) { + var table = down ? getTable(true, pos) : getTable(false, pos); + var last = down === false; + table.fold(function () { + return moveToRange(editor, pos.toRange()); + }, function (table) { + return positionIn(last, editor.getBody()).filter(function (lastPos) { + return lastPos.isEqual(pos); + }).fold(function () { + return moveToRange(editor, pos.toRange()); + }, function (_) { + return renderBlock(down, editor, table, pos); + }); + }); + }; + var navigateVertically = function (editor, down, table, td) { + var rng = editor.selection.getRng(); + var pos = CaretPosition$1.fromRangeStart(rng); + var root = editor.getBody(); + if (!down && isAtFirstTableCellLine(td, pos)) { + var newPos = getClosestAbovePosition(root, table, pos); + moveCaret(editor, down, newPos); + return true; + } else if (down && isAtLastTableCellLine(td, pos)) { + var newPos = getClosestBelowPosition(root, table, pos); + moveCaret(editor, down, newPos); + return true; + } else { + return false; + } + }; + var move$1 = function (editor, forward, mover) { + return Optional.from(editor.dom.getParent(editor.selection.getNode(), 'td,th')).bind(function (td) { + return Optional.from(editor.dom.getParent(td, 'table')).map(function (table) { + return mover(editor, forward, table, td); + }); + }).getOr(false); + }; + var moveH$2 = function (editor, forward) { + return move$1(editor, forward, navigateHorizontally); + }; + var moveV$3 = function (editor, forward) { + return move$1(editor, forward, navigateVertically); + }; + + var executeKeydownOverride = function (editor, caret, evt) { + var os = detect$3().os; + execute([ + { + keyCode: VK.RIGHT, + action: action(moveH, editor, true) + }, + { + keyCode: VK.LEFT, + action: action(moveH, editor, false) + }, + { + keyCode: VK.UP, + action: action(moveV, editor, false) + }, + { + keyCode: VK.DOWN, + action: action(moveV, editor, true) + }, + { + keyCode: VK.RIGHT, + action: action(moveH$2, editor, true) + }, + { + keyCode: VK.LEFT, + action: action(moveH$2, editor, false) + }, + { + keyCode: VK.UP, + action: action(moveV$3, editor, false) + }, + { + keyCode: VK.DOWN, + action: action(moveV$3, editor, true) + }, + { + keyCode: VK.RIGHT, + action: action(moveH$1, editor, true) + }, + { + keyCode: VK.LEFT, + action: action(moveH$1, editor, false) + }, + { + keyCode: VK.UP, + action: action(moveV$2, editor, false) + }, + { + keyCode: VK.DOWN, + action: action(moveV$2, editor, true) + }, + { + keyCode: VK.RIGHT, + action: action(move, editor, caret, true) + }, + { + keyCode: VK.LEFT, + action: action(move, editor, caret, false) + }, + { + keyCode: VK.RIGHT, + ctrlKey: !os.isOSX(), + altKey: os.isOSX(), + action: action(moveNextWord, editor, caret) + }, + { + keyCode: VK.LEFT, + ctrlKey: !os.isOSX(), + altKey: os.isOSX(), + action: action(movePrevWord, editor, caret) + }, + { + keyCode: VK.UP, + action: action(moveV$1, editor, false) + }, + { + keyCode: VK.DOWN, + action: action(moveV$1, editor, true) + } + ], evt).each(function (_) { + evt.preventDefault(); + }); + }; + var setup$c = function (editor, caret) { + editor.on('keydown', function (evt) { + if (evt.isDefaultPrevented() === false) { + executeKeydownOverride(editor, caret, evt); + } + }); + }; + + var executeKeydownOverride$1 = function (editor, caret, evt) { + execute([ + { + keyCode: VK.BACKSPACE, + action: action(backspaceDelete$9, editor, false) + }, + { + keyCode: VK.BACKSPACE, + action: action(backspaceDelete$4, editor, false) + }, + { + keyCode: VK.DELETE, + action: action(backspaceDelete$4, editor, true) + }, + { + keyCode: VK.BACKSPACE, + action: action(backspaceDelete$3, editor, false) + }, + { + keyCode: VK.DELETE, + action: action(backspaceDelete$3, editor, true) + }, + { + keyCode: VK.BACKSPACE, + action: action(backspaceDelete$6, editor, caret, false) + }, + { + keyCode: VK.DELETE, + action: action(backspaceDelete$6, editor, caret, true) + }, + { + keyCode: VK.BACKSPACE, + action: action(backspaceDelete, editor, false) + }, + { + keyCode: VK.DELETE, + action: action(backspaceDelete, editor, true) + }, + { + keyCode: VK.BACKSPACE, + action: action(backspaceDelete$5, editor, false) + }, + { + keyCode: VK.DELETE, + action: action(backspaceDelete$5, editor, true) + }, + { + keyCode: VK.BACKSPACE, + action: action(backspaceDelete$8, editor, false) + }, + { + keyCode: VK.DELETE, + action: action(backspaceDelete$8, editor, true) + }, + { + keyCode: VK.BACKSPACE, + action: action(backspaceDelete$2, editor, false) + }, + { + keyCode: VK.DELETE, + action: action(backspaceDelete$2, editor, true) + }, + { + keyCode: VK.BACKSPACE, + action: action(backspaceDelete$1, editor, false) + }, + { + keyCode: VK.DELETE, + action: action(backspaceDelete$1, editor, true) + }, + { + keyCode: VK.BACKSPACE, + action: action(backspaceDelete$7, editor, false) + }, + { + keyCode: VK.DELETE, + action: action(backspaceDelete$7, editor, true) + } + ], evt).each(function (_) { + evt.preventDefault(); + }); + }; + var executeKeyupOverride = function (editor, evt) { + execute([ + { + keyCode: VK.BACKSPACE, + action: action(paddEmptyElement, editor) + }, + { + keyCode: VK.DELETE, + action: action(paddEmptyElement, editor) + } + ], evt); + }; + var setup$d = function (editor, caret) { + editor.on('keydown', function (evt) { + if (evt.isDefaultPrevented() === false) { + executeKeydownOverride$1(editor, caret, evt); + } + }); + editor.on('keyup', function (evt) { + if (evt.isDefaultPrevented() === false) { + executeKeyupOverride(editor, evt); + } + }); + }; + + var firstNonWhiteSpaceNodeSibling = function (node) { + while (node) { + if (node.nodeType === 1 || node.nodeType === 3 && node.data && /[\r\n\s]/.test(node.data)) { + return node; + } + node = node.nextSibling; + } + }; + var moveToCaretPosition = function (editor, root) { + var node, lastNode = root; + var dom = editor.dom; + var moveCaretBeforeOnEnterElementsMap = editor.schema.getMoveCaretBeforeOnEnterElements(); + if (!root) { + return; + } + if (/^(LI|DT|DD)$/.test(root.nodeName)) { + var firstChild = firstNonWhiteSpaceNodeSibling(root.firstChild); + if (firstChild && /^(UL|OL|DL)$/.test(firstChild.nodeName)) { + root.insertBefore(dom.doc.createTextNode(nbsp), root.firstChild); + } + } + var rng = dom.createRng(); + root.normalize(); + if (root.hasChildNodes()) { + var walker = new DomTreeWalker(root, root); + while (node = walker.current()) { + if (isText$1(node)) { + rng.setStart(node, 0); + rng.setEnd(node, 0); + break; + } + if (moveCaretBeforeOnEnterElementsMap[node.nodeName.toLowerCase()]) { + rng.setStartBefore(node); + rng.setEndBefore(node); + break; + } + lastNode = node; + node = walker.next(); + } + if (!node) { + rng.setStart(lastNode, 0); + rng.setEnd(lastNode, 0); + } + } else { + if (isBr(root)) { + if (root.nextSibling && dom.isBlock(root.nextSibling)) { + rng.setStartBefore(root); + rng.setEndBefore(root); + } else { + rng.setStartAfter(root); + rng.setEndAfter(root); + } + } else { + rng.setStart(root, 0); + rng.setEnd(root, 0); + } + } + editor.selection.setRng(rng); + scrollRangeIntoView(editor, rng); + }; + var getEditableRoot = function (dom, node) { + var root = dom.getRoot(); + var parent, editableRoot; + parent = node; + while (parent !== root && dom.getContentEditable(parent) !== 'false') { + if (dom.getContentEditable(parent) === 'true') { + editableRoot = parent; + } + parent = parent.parentNode; + } + return parent !== root ? editableRoot : root; + }; + var getParentBlock$2 = function (editor) { + return Optional.from(editor.dom.getParent(editor.selection.getStart(true), editor.dom.isBlock)); + }; + var getParentBlockName = function (editor) { + return getParentBlock$2(editor).fold(constant(''), function (parentBlock) { + return parentBlock.nodeName.toUpperCase(); + }); + }; + var isListItemParentBlock = function (editor) { + return getParentBlock$2(editor).filter(function (elm) { + return isListItem(SugarElement.fromDom(elm)); + }).isSome(); + }; + + var hasFirstChild = function (elm, name) { + return elm.firstChild && elm.firstChild.nodeName === name; + }; + var hasParent$1 = function (elm, parentName) { + return elm && elm.parentNode && elm.parentNode.nodeName === parentName; + }; + var isListBlock = function (elm) { + return elm && /^(OL|UL|LI)$/.test(elm.nodeName); + }; + var isNestedList = function (elm) { + return isListBlock(elm) && isListBlock(elm.parentNode); + }; + var getContainerBlock = function (containerBlock) { + var containerBlockParent = containerBlock.parentNode; + if (/^(LI|DT|DD)$/.test(containerBlockParent.nodeName)) { + return containerBlockParent; + } + return containerBlock; + }; + var isFirstOrLastLi = function (containerBlock, parentBlock, first) { + var node = containerBlock[first ? 'firstChild' : 'lastChild']; + while (node) { + if (isElement$1(node)) { + break; + } + node = node[first ? 'nextSibling' : 'previousSibling']; + } + return node === parentBlock; + }; + var insert = function (editor, createNewBlock, containerBlock, parentBlock, newBlockName) { + var dom = editor.dom; + var rng = editor.selection.getRng(); + if (containerBlock === editor.getBody()) { + return; + } + if (isNestedList(containerBlock)) { + newBlockName = 'LI'; + } + var newBlock = newBlockName ? createNewBlock(newBlockName) : dom.create('BR'); + if (isFirstOrLastLi(containerBlock, parentBlock, true) && isFirstOrLastLi(containerBlock, parentBlock, false)) { + if (hasParent$1(containerBlock, 'LI')) { + dom.insertAfter(newBlock, getContainerBlock(containerBlock)); + } else { + dom.replace(newBlock, containerBlock); + } + } else if (isFirstOrLastLi(containerBlock, parentBlock, true)) { + if (hasParent$1(containerBlock, 'LI')) { + dom.insertAfter(newBlock, getContainerBlock(containerBlock)); + newBlock.appendChild(dom.doc.createTextNode(' ')); + newBlock.appendChild(containerBlock); + } else { + containerBlock.parentNode.insertBefore(newBlock, containerBlock); + } + } else if (isFirstOrLastLi(containerBlock, parentBlock, false)) { + dom.insertAfter(newBlock, getContainerBlock(containerBlock)); + } else { + containerBlock = getContainerBlock(containerBlock); + var tmpRng = rng.cloneRange(); + tmpRng.setStartAfter(parentBlock); + tmpRng.setEndAfter(containerBlock); + var fragment = tmpRng.extractContents(); + if (newBlockName === 'LI' && hasFirstChild(fragment, 'LI')) { + newBlock = fragment.firstChild; + dom.insertAfter(fragment, containerBlock); + } else { + dom.insertAfter(fragment, containerBlock); + dom.insertAfter(newBlock, containerBlock); + } + } + dom.remove(parentBlock); + moveToCaretPosition(editor, newBlock); + }; + + var trimZwsp = function (fragment) { + each(descendants(SugarElement.fromDom(fragment), isText), function (text) { + var rawNode = text.dom; + rawNode.nodeValue = trim$2(rawNode.nodeValue); + }); + }; + var isEmptyAnchor = function (dom, elm) { + return elm && elm.nodeName === 'A' && dom.isEmpty(elm); + }; + var isTableCell$5 = function (node) { + return node && /^(TD|TH|CAPTION)$/.test(node.nodeName); + }; + var emptyBlock = function (elm) { + elm.innerHTML = '
                                      '; + }; + var containerAndSiblingName = function (container, nodeName) { + return container.nodeName === nodeName || container.previousSibling && container.previousSibling.nodeName === nodeName; + }; + var canSplitBlock = function (dom, node) { + return node && dom.isBlock(node) && !/^(TD|TH|CAPTION|FORM)$/.test(node.nodeName) && !/^(fixed|absolute)/i.test(node.style.position) && dom.getContentEditable(node) !== 'true'; + }; + var trimInlineElementsOnLeftSideOfBlock = function (dom, nonEmptyElementsMap, block) { + var node = block; + var firstChilds = []; + var i; + if (!node) { + return; + } + while (node = node.firstChild) { + if (dom.isBlock(node)) { + return; + } + if (isElement$1(node) && !nonEmptyElementsMap[node.nodeName.toLowerCase()]) { + firstChilds.push(node); + } + } + i = firstChilds.length; + while (i--) { + node = firstChilds[i]; + if (!node.hasChildNodes() || node.firstChild === node.lastChild && node.firstChild.nodeValue === '') { + dom.remove(node); + } else { + if (isEmptyAnchor(dom, node)) { + dom.remove(node); + } + } + } + }; + var normalizeZwspOffset = function (start, container, offset) { + if (isText$1(container) === false) { + return offset; + } else if (start) { + return offset === 1 && container.data.charAt(offset - 1) === ZWSP ? 0 : offset; + } else { + return offset === container.data.length - 1 && container.data.charAt(offset) === ZWSP ? container.data.length : offset; + } + }; + var includeZwspInRange = function (rng) { + var newRng = rng.cloneRange(); + newRng.setStart(rng.startContainer, normalizeZwspOffset(true, rng.startContainer, rng.startOffset)); + newRng.setEnd(rng.endContainer, normalizeZwspOffset(false, rng.endContainer, rng.endOffset)); + return newRng; + }; + var trimLeadingLineBreaks = function (node) { + do { + if (isText$1(node)) { + node.nodeValue = node.nodeValue.replace(/^[\r\n]+/, ''); + } + node = node.firstChild; + } while (node); + }; + var getEditableRoot$1 = function (dom, node) { + var root = dom.getRoot(); + var parent, editableRoot; + parent = node; + while (parent !== root && dom.getContentEditable(parent) !== 'false') { + if (dom.getContentEditable(parent) === 'true') { + editableRoot = parent; + } + parent = parent.parentNode; + } + return parent !== root ? editableRoot : root; + }; + var applyAttributes = function (editor, node, forcedRootBlockAttrs) { + var dom = editor.dom; + Optional.from(forcedRootBlockAttrs.style).map(dom.parseStyle).each(function (attrStyles) { + var currentStyles = getAllRaw(SugarElement.fromDom(node)); + var newStyles = __assign(__assign({}, currentStyles), attrStyles); + dom.setStyles(node, newStyles); + }); + var attrClassesOpt = Optional.from(forcedRootBlockAttrs.class).map(function (attrClasses) { + return attrClasses.split(/\s+/); + }); + var currentClassesOpt = Optional.from(node.className).map(function (currentClasses) { + return filter(currentClasses.split(/\s+/), function (clazz) { + return clazz !== ''; + }); + }); + lift2(attrClassesOpt, currentClassesOpt, function (attrClasses, currentClasses) { + var filteredClasses = filter(currentClasses, function (clazz) { + return !contains(attrClasses, clazz); + }); + var newClasses = __spreadArrays(attrClasses, filteredClasses); + dom.setAttrib(node, 'class', newClasses.join(' ')); + }); + var appliedAttrs = [ + 'style', + 'class' + ]; + var remainingAttrs = filter$1(forcedRootBlockAttrs, function (_, attrs) { + return !contains(appliedAttrs, attrs); + }); + dom.setAttribs(node, remainingAttrs); + }; + var setForcedBlockAttrs = function (editor, node) { + var forcedRootBlockName = getForcedRootBlock(editor); + if (forcedRootBlockName && forcedRootBlockName.toLowerCase() === node.tagName.toLowerCase()) { + var forcedRootBlockAttrs = getForcedRootBlockAttrs(editor); + applyAttributes(editor, node, forcedRootBlockAttrs); + } + }; + var wrapSelfAndSiblingsInDefaultBlock = function (editor, newBlockName, rng, container, offset) { + var newBlock, parentBlock, startNode, node, next, rootBlockName; + var blockName = newBlockName || 'P'; + var dom = editor.dom, editableRoot = getEditableRoot$1(dom, container); + parentBlock = dom.getParent(container, dom.isBlock); + if (!parentBlock || !canSplitBlock(dom, parentBlock)) { + parentBlock = parentBlock || editableRoot; + if (parentBlock === editor.getBody() || isTableCell$5(parentBlock)) { + rootBlockName = parentBlock.nodeName.toLowerCase(); + } else { + rootBlockName = parentBlock.parentNode.nodeName.toLowerCase(); + } + if (!parentBlock.hasChildNodes()) { + newBlock = dom.create(blockName); + setForcedBlockAttrs(editor, newBlock); + parentBlock.appendChild(newBlock); + rng.setStart(newBlock, 0); + rng.setEnd(newBlock, 0); + return newBlock; + } + node = container; + while (node.parentNode !== parentBlock) { + node = node.parentNode; + } + while (node && !dom.isBlock(node)) { + startNode = node; + node = node.previousSibling; + } + if (startNode && editor.schema.isValidChild(rootBlockName, blockName.toLowerCase())) { + newBlock = dom.create(blockName); + setForcedBlockAttrs(editor, newBlock); + startNode.parentNode.insertBefore(newBlock, startNode); + node = startNode; + while (node && !dom.isBlock(node)) { + next = node.nextSibling; + newBlock.appendChild(node); + node = next; + } + rng.setStart(container, offset); + rng.setEnd(container, offset); + } + } + return container; + }; + var addBrToBlockIfNeeded = function (dom, block) { + block.normalize(); + var lastChild = block.lastChild; + if (!lastChild || /^(left|right)$/gi.test(dom.getStyle(lastChild, 'float', true))) { + dom.add(block, 'br'); + } + }; + var insert$1 = function (editor, evt) { + var tmpRng, container, offset, parentBlock; + var newBlock, fragment, containerBlock, parentBlockName, newBlockName, isAfterLastNodeInContainer; + var dom = editor.dom; + var schema = editor.schema, nonEmptyElementsMap = schema.getNonEmptyElements(); + var rng = editor.selection.getRng(); + var createNewBlock = function (name) { + var node = container, block, clonedNode, caretNode; + var textInlineElements = schema.getTextInlineElements(); + if (name || parentBlockName === 'TABLE' || parentBlockName === 'HR') { + block = dom.create(name || newBlockName); + } else { + block = parentBlock.cloneNode(false); + } + caretNode = block; + if (shouldKeepStyles(editor) === false) { + dom.setAttrib(block, 'style', null); + dom.setAttrib(block, 'class', null); + } else { + do { + if (textInlineElements[node.nodeName]) { + if (isCaretNode(node) || isBookmarkNode$1(node)) { + continue; + } + clonedNode = node.cloneNode(false); + dom.setAttrib(clonedNode, 'id', ''); + if (block.hasChildNodes()) { + clonedNode.appendChild(block.firstChild); + block.appendChild(clonedNode); + } else { + caretNode = clonedNode; + block.appendChild(clonedNode); + } + } + } while ((node = node.parentNode) && node !== editableRoot); + } + setForcedBlockAttrs(editor, block); + emptyBlock(caretNode); + return block; + }; + var isCaretAtStartOrEndOfBlock = function (start) { + var node, name; + var normalizedOffset = normalizeZwspOffset(start, container, offset); + if (isText$1(container) && (start ? normalizedOffset > 0 : normalizedOffset < container.nodeValue.length)) { + return false; + } + if (container.parentNode === parentBlock && isAfterLastNodeInContainer && !start) { + return true; + } + if (start && isElement$1(container) && container === parentBlock.firstChild) { + return true; + } + if (containerAndSiblingName(container, 'TABLE') || containerAndSiblingName(container, 'HR')) { + return isAfterLastNodeInContainer && !start || !isAfterLastNodeInContainer && start; + } + var walker = new DomTreeWalker(container, parentBlock); + if (isText$1(container)) { + if (start && normalizedOffset === 0) { + walker.prev(); + } else if (!start && normalizedOffset === container.nodeValue.length) { + walker.next(); + } + } + while (node = walker.current()) { + if (isElement$1(node)) { + if (!node.getAttribute('data-mce-bogus')) { + name = node.nodeName.toLowerCase(); + if (nonEmptyElementsMap[name] && name !== 'br') { + return false; + } + } + } else if (isText$1(node) && !isWhitespaceText(node.nodeValue)) { + return false; + } + if (start) { + walker.prev(); + } else { + walker.next(); + } + } + return true; + }; + var insertNewBlockAfter = function () { + if (/^(H[1-6]|PRE|FIGURE)$/.test(parentBlockName) && containerBlockName !== 'HGROUP') { + newBlock = createNewBlock(newBlockName); + } else { + newBlock = createNewBlock(); + } + if (shouldEndContainerOnEmptyBlock(editor) && canSplitBlock(dom, containerBlock) && dom.isEmpty(parentBlock)) { + newBlock = dom.split(containerBlock, parentBlock); + } else { + dom.insertAfter(newBlock, parentBlock); + } + moveToCaretPosition(editor, newBlock); + }; + normalize(dom, rng).each(function (normRng) { + rng.setStart(normRng.startContainer, normRng.startOffset); + rng.setEnd(normRng.endContainer, normRng.endOffset); + }); + container = rng.startContainer; + offset = rng.startOffset; + newBlockName = getForcedRootBlock(editor); + var shiftKey = !!(evt && evt.shiftKey); + var ctrlKey = !!(evt && evt.ctrlKey); + if (isElement$1(container) && container.hasChildNodes()) { + isAfterLastNodeInContainer = offset > container.childNodes.length - 1; + container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container; + if (isAfterLastNodeInContainer && isText$1(container)) { + offset = container.nodeValue.length; + } else { + offset = 0; + } + } + var editableRoot = getEditableRoot$1(dom, container); + if (!editableRoot) { + return; + } + if (newBlockName && !shiftKey || !newBlockName && shiftKey) { + container = wrapSelfAndSiblingsInDefaultBlock(editor, newBlockName, rng, container, offset); + } + parentBlock = dom.getParent(container, dom.isBlock); + containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null; + parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ''; + var containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; + if (containerBlockName === 'LI' && !ctrlKey) { + parentBlock = containerBlock; + containerBlock = containerBlock.parentNode; + parentBlockName = containerBlockName; + } + if (/^(LI|DT|DD)$/.test(parentBlockName)) { + if (dom.isEmpty(parentBlock)) { + insert(editor, createNewBlock, containerBlock, parentBlock, newBlockName); + return; + } + } + if (newBlockName && parentBlock === editor.getBody()) { + return; + } + newBlockName = newBlockName || 'P'; + if (isCaretContainerBlock(parentBlock)) { + newBlock = showCaretContainerBlock(parentBlock); + if (dom.isEmpty(parentBlock)) { + emptyBlock(parentBlock); + } + setForcedBlockAttrs(editor, newBlock); + moveToCaretPosition(editor, newBlock); + } else if (isCaretAtStartOrEndOfBlock()) { + insertNewBlockAfter(); + } else if (isCaretAtStartOrEndOfBlock(true)) { + newBlock = parentBlock.parentNode.insertBefore(createNewBlock(), parentBlock); + moveToCaretPosition(editor, containerAndSiblingName(parentBlock, 'HR') ? newBlock : parentBlock); + } else { + tmpRng = includeZwspInRange(rng).cloneRange(); + tmpRng.setEndAfter(parentBlock); + fragment = tmpRng.extractContents(); + trimZwsp(fragment); + trimLeadingLineBreaks(fragment); + newBlock = fragment.firstChild; + dom.insertAfter(fragment, parentBlock); + trimInlineElementsOnLeftSideOfBlock(dom, nonEmptyElementsMap, newBlock); + addBrToBlockIfNeeded(dom, parentBlock); + if (dom.isEmpty(parentBlock)) { + emptyBlock(parentBlock); + } + newBlock.normalize(); + if (dom.isEmpty(newBlock)) { + dom.remove(newBlock); + insertNewBlockAfter(); + } else { + setForcedBlockAttrs(editor, newBlock); + moveToCaretPosition(editor, newBlock); + } + } + dom.setAttrib(newBlock, 'id', ''); + editor.fire('NewBlock', { newBlock: newBlock }); + }; + + var hasRightSideContent = function (schema, container, parentBlock) { + var walker = new DomTreeWalker(container, parentBlock); + var node; + var nonEmptyElementsMap = schema.getNonEmptyElements(); + while (node = walker.next()) { + if (nonEmptyElementsMap[node.nodeName.toLowerCase()] || node.length > 0) { + return true; + } + } + }; + var scrollToBr = function (dom, selection, brElm) { + var marker = dom.create('span', {}, ' '); + brElm.parentNode.insertBefore(marker, brElm); + selection.scrollIntoView(marker); + dom.remove(marker); + }; + var moveSelectionToBr = function (dom, selection, brElm, extraBr) { + var rng = dom.createRng(); + if (!extraBr) { + rng.setStartAfter(brElm); + rng.setEndAfter(brElm); + } else { + rng.setStartBefore(brElm); + rng.setEndBefore(brElm); + } + selection.setRng(rng); + }; + var insertBrAtCaret = function (editor, evt) { + var selection = editor.selection; + var dom = editor.dom; + var rng = selection.getRng(); + var brElm; + var extraBr; + normalize(dom, rng).each(function (normRng) { + rng.setStart(normRng.startContainer, normRng.startOffset); + rng.setEnd(normRng.endContainer, normRng.endOffset); + }); + var offset = rng.startOffset; + var container = rng.startContainer; + if (container.nodeType === 1 && container.hasChildNodes()) { + var isAfterLastNodeInContainer = offset > container.childNodes.length - 1; + container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container; + if (isAfterLastNodeInContainer && container.nodeType === 3) { + offset = container.nodeValue.length; + } else { + offset = 0; + } + } + var parentBlock = dom.getParent(container, dom.isBlock); + var containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null; + var containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; + var isControlKey = !!(evt && evt.ctrlKey); + if (containerBlockName === 'LI' && !isControlKey) { + parentBlock = containerBlock; + } + if (container && container.nodeType === 3 && offset >= container.nodeValue.length) { + if (!hasRightSideContent(editor.schema, container, parentBlock)) { + brElm = dom.create('br'); + rng.insertNode(brElm); + rng.setStartAfter(brElm); + rng.setEndAfter(brElm); + extraBr = true; + } + } + brElm = dom.create('br'); + rangeInsertNode(dom, rng, brElm); + scrollToBr(dom, selection, brElm); + moveSelectionToBr(dom, selection, brElm, extraBr); + editor.undoManager.add(); + }; + var insertBrBefore = function (editor, inline) { + var br = SugarElement.fromTag('br'); + before(SugarElement.fromDom(inline), br); + editor.undoManager.add(); + }; + var insertBrAfter = function (editor, inline) { + if (!hasBrAfter(editor.getBody(), inline)) { + after(SugarElement.fromDom(inline), SugarElement.fromTag('br')); + } + var br = SugarElement.fromTag('br'); + after(SugarElement.fromDom(inline), br); + scrollToBr(editor.dom, editor.selection, br.dom); + moveSelectionToBr(editor.dom, editor.selection, br.dom, false); + editor.undoManager.add(); + }; + var isBeforeBr$1 = function (pos) { + return isBr(pos.getNode()); + }; + var hasBrAfter = function (rootNode, startNode) { + if (isBeforeBr$1(CaretPosition$1.after(startNode))) { + return true; + } else { + return nextPosition(rootNode, CaretPosition$1.after(startNode)).map(function (pos) { + return isBr(pos.getNode()); + }).getOr(false); + } + }; + var isAnchorLink = function (elm) { + return elm && elm.nodeName === 'A' && 'href' in elm; + }; + var isInsideAnchor = function (location) { + return location.fold(never, isAnchorLink, isAnchorLink, never); + }; + var readInlineAnchorLocation = function (editor) { + var isInlineTarget$1 = curry(isInlineTarget, editor); + var position = CaretPosition$1.fromRangeStart(editor.selection.getRng()); + return readLocation(isInlineTarget$1, editor.getBody(), position).filter(isInsideAnchor); + }; + var insertBrOutsideAnchor = function (editor, location) { + location.fold(noop, curry(insertBrBefore, editor), curry(insertBrAfter, editor), noop); + }; + var insert$2 = function (editor, evt) { + var anchorLocation = readInlineAnchorLocation(editor); + if (anchorLocation.isSome()) { + anchorLocation.each(curry(insertBrOutsideAnchor, editor)); + } else { + insertBrAtCaret(editor, evt); + } + }; + + var matchesSelector = function (editor, selector) { + return getParentBlock$2(editor).filter(function (parentBlock) { + return selector.length > 0 && is$1(SugarElement.fromDom(parentBlock), selector); + }).isSome(); + }; + var shouldInsertBr = function (editor) { + return matchesSelector(editor, getBrNewLineSelector(editor)); + }; + var shouldBlockNewLine = function (editor) { + return matchesSelector(editor, getNoNewLineSelector(editor)); + }; + + var newLineAction = Adt.generate([ + { br: [] }, + { block: [] }, + { none: [] } + ]); + var shouldBlockNewLine$1 = function (editor, _shiftKey) { + return shouldBlockNewLine(editor); + }; + var isBrMode = function (requiredState) { + return function (editor, _shiftKey) { + var brMode = getForcedRootBlock(editor) === ''; + return brMode === requiredState; + }; + }; + var inListBlock = function (requiredState) { + return function (editor, _shiftKey) { + return isListItemParentBlock(editor) === requiredState; + }; + }; + var inBlock = function (blockName, requiredState) { + return function (editor, _shiftKey) { + var state = getParentBlockName(editor) === blockName.toUpperCase(); + return state === requiredState; + }; + }; + var inPreBlock = function (requiredState) { + return inBlock('pre', requiredState); + }; + var inSummaryBlock = function () { + return inBlock('summary', true); + }; + var shouldPutBrInPre$1 = function (requiredState) { + return function (editor, _shiftKey) { + return shouldPutBrInPre(editor) === requiredState; + }; + }; + var inBrContext = function (editor, _shiftKey) { + return shouldInsertBr(editor); + }; + var hasShiftKey = function (_editor, shiftKey) { + return shiftKey; + }; + var canInsertIntoEditableRoot = function (editor) { + var forcedRootBlock = getForcedRootBlock(editor); + var rootEditable = getEditableRoot(editor.dom, editor.selection.getStart()); + return rootEditable && editor.schema.isValidChild(rootEditable.nodeName, forcedRootBlock ? forcedRootBlock : 'P'); + }; + var match$2 = function (predicates, action) { + return function (editor, shiftKey) { + var isMatch = foldl(predicates, function (res, p) { + return res && p(editor, shiftKey); + }, true); + return isMatch ? Optional.some(action) : Optional.none(); + }; + }; + var getAction$1 = function (editor, evt) { + return evaluateUntil([ + match$2([shouldBlockNewLine$1], newLineAction.none()), + match$2([inSummaryBlock()], newLineAction.br()), + match$2([ + inPreBlock(true), + shouldPutBrInPre$1(false), + hasShiftKey + ], newLineAction.br()), + match$2([ + inPreBlock(true), + shouldPutBrInPre$1(false) + ], newLineAction.block()), + match$2([ + inPreBlock(true), + shouldPutBrInPre$1(true), + hasShiftKey + ], newLineAction.block()), + match$2([ + inPreBlock(true), + shouldPutBrInPre$1(true) + ], newLineAction.br()), + match$2([ + inListBlock(true), + hasShiftKey + ], newLineAction.br()), + match$2([inListBlock(true)], newLineAction.block()), + match$2([ + isBrMode(true), + hasShiftKey, + canInsertIntoEditableRoot + ], newLineAction.block()), + match$2([isBrMode(true)], newLineAction.br()), + match$2([inBrContext], newLineAction.br()), + match$2([ + isBrMode(false), + hasShiftKey + ], newLineAction.br()), + match$2([canInsertIntoEditableRoot], newLineAction.block()) + ], [ + editor, + !!(evt && evt.shiftKey) + ]).getOr(newLineAction.none()); + }; + + var insert$3 = function (editor, evt) { + getAction$1(editor, evt).fold(function () { + insert$2(editor, evt); + }, function () { + insert$1(editor, evt); + }, noop); + }; + + var handleEnterKeyEvent = function (editor, event) { + if (event.isDefaultPrevented()) { + return; + } + event.preventDefault(); + endTypingLevelIgnoreLocks(editor.undoManager); + editor.undoManager.transact(function () { + if (editor.selection.isCollapsed() === false) { + editor.execCommand('Delete'); + } + insert$3(editor, event); + }); + }; + var setup$e = function (editor) { + editor.on('keydown', function (event) { + if (event.keyCode === VK.ENTER) { + handleEnterKeyEvent(editor, event); + } + }); + }; + + var executeKeydownOverride$2 = function (editor, evt) { + execute([ + { + keyCode: VK.END, + action: action(moveToLineEndPoint$1, editor, true) + }, + { + keyCode: VK.HOME, + action: action(moveToLineEndPoint$1, editor, false) + }, + { + keyCode: VK.END, + action: action(moveToLineEndPoint$2, editor, true) + }, + { + keyCode: VK.HOME, + action: action(moveToLineEndPoint$2, editor, false) + } + ], evt).each(function (_) { + evt.preventDefault(); + }); + }; + var setup$f = function (editor) { + editor.on('keydown', function (evt) { + if (evt.isDefaultPrevented() === false) { + executeKeydownOverride$2(editor, evt); + } + }); + }; + + var browser$4 = detect$3().browser; + var setupIeInput = function (editor) { + var keypressThrotter = first(function () { + if (!editor.composing) { + normalizeNbspsInEditor(editor); + } + }, 0); + if (browser$4.isIE()) { + editor.on('keypress', function (_e) { + keypressThrotter.throttle(); + }); + editor.on('remove', function (_e) { + keypressThrotter.cancel(); + }); + } + }; + var setup$g = function (editor) { + setupIeInput(editor); + editor.on('input', function (e) { + if (e.isComposing === false) { + normalizeNbspsInEditor(editor); + } + }); + }; + + var insertTextAtPosition = function (text, pos) { + var container = pos.container(); + var offset = pos.offset(); + if (isText$1(container)) { + container.insertData(offset, text); + return Optional.some(CaretPosition(container, offset + text.length)); + } else { + return getElementFromPosition(pos).map(function (elm) { + var textNode = SugarElement.fromText(text); + if (pos.isAtEnd()) { + after(elm, textNode); + } else { + before(elm, textNode); + } + return CaretPosition(textNode.dom, text.length); + }); + } + }; + var insertNbspAtPosition = curry(insertTextAtPosition, nbsp); + var insertSpaceAtPosition = curry(insertTextAtPosition, ' '); + + var locationToCaretPosition = function (root) { + return function (location) { + return location.fold(function (element) { + return prevPosition(root.dom, CaretPosition$1.before(element)); + }, function (element) { + return firstPositionIn(element); + }, function (element) { + return lastPositionIn(element); + }, function (element) { + return nextPosition(root.dom, CaretPosition$1.after(element)); + }); + }; + }; + var insertInlineBoundarySpaceOrNbsp = function (root, pos) { + return function (checkPos) { + return needsToHaveNbsp(root, checkPos) ? insertNbspAtPosition(pos) : insertSpaceAtPosition(pos); + }; + }; + var setSelection$1 = function (editor) { + return function (pos) { + editor.selection.setRng(pos.toRange()); + editor.nodeChanged(); + return true; + }; + }; + var insertSpaceOrNbspAtSelection = function (editor) { + var pos = CaretPosition$1.fromRangeStart(editor.selection.getRng()); + var root = SugarElement.fromDom(editor.getBody()); + if (editor.selection.isCollapsed()) { + var isInlineTarget$1 = curry(isInlineTarget, editor); + var caretPosition = CaretPosition$1.fromRangeStart(editor.selection.getRng()); + return readLocation(isInlineTarget$1, editor.getBody(), caretPosition).bind(locationToCaretPosition(root)).bind(insertInlineBoundarySpaceOrNbsp(root, pos)).exists(setSelection$1(editor)); + } else { + return false; + } + }; + + var executeKeydownOverride$3 = function (editor, evt) { + execute([{ + keyCode: VK.SPACEBAR, + action: action(insertSpaceOrNbspAtSelection, editor) + }], evt).each(function (_) { + evt.preventDefault(); + }); + }; + var setup$h = function (editor) { + editor.on('keydown', function (evt) { + if (evt.isDefaultPrevented() === false) { + executeKeydownOverride$3(editor, evt); + } + }); + }; + + var registerKeyboardOverrides = function (editor) { + var caret = setupSelectedState(editor); + setup$b(editor); + setup$c(editor, caret); + setup$d(editor, caret); + setup$e(editor); + setup$h(editor); + setup$g(editor); + setup$f(editor); + return caret; + }; + var setup$i = function (editor) { + if (!isRtc(editor)) { + return registerKeyboardOverrides(editor); + } else { + return Cell(null); + } + }; + + var NodeChange = function () { + function NodeChange(editor) { + this.lastPath = []; + this.editor = editor; + var lastRng; + var self = this; + if (!('onselectionchange' in editor.getDoc())) { + editor.on('NodeChange click mouseup keyup focus', function (e) { + var nativeRng = editor.selection.getRng(); + var fakeRng = { + startContainer: nativeRng.startContainer, + startOffset: nativeRng.startOffset, + endContainer: nativeRng.endContainer, + endOffset: nativeRng.endOffset + }; + if (e.type === 'nodechange' || !isEq$1(fakeRng, lastRng)) { + editor.fire('SelectionChange'); + } + lastRng = fakeRng; + }); + } + editor.on('contextmenu', function () { + editor.fire('SelectionChange'); + }); + editor.on('SelectionChange', function () { + var startElm = editor.selection.getStart(true); + if (!startElm || !Env.range && editor.selection.isCollapsed()) { + return; + } + if (hasAnyRanges(editor) && !self.isSameElementPath(startElm) && editor.dom.isChildOf(startElm, editor.getBody())) { + editor.nodeChanged({ selectionChange: true }); + } + }); + editor.on('mouseup', function (e) { + if (!e.isDefaultPrevented() && hasAnyRanges(editor)) { + if (editor.selection.getNode().nodeName === 'IMG') { + Delay.setEditorTimeout(editor, function () { + editor.nodeChanged(); + }); + } else { + editor.nodeChanged(); + } + } + }); + } + NodeChange.prototype.nodeChanged = function (args) { + var selection = this.editor.selection; + var node, parents, root; + if (this.editor.initialized && selection && !shouldDisableNodeChange(this.editor) && !this.editor.mode.isReadOnly()) { + root = this.editor.getBody(); + node = selection.getStart(true) || root; + if (node.ownerDocument !== this.editor.getDoc() || !this.editor.dom.isChildOf(node, root)) { + node = root; + } + parents = []; + this.editor.dom.getParent(node, function (node) { + if (node === root) { + return true; + } + parents.push(node); + }); + args = args || {}; + args.element = node; + args.parents = parents; + this.editor.fire('NodeChange', args); + } + }; + NodeChange.prototype.isSameElementPath = function (startElm) { + var i; + var currentPath = this.editor.$(startElm).parentsUntil(this.editor.getBody()).add(startElm); + if (currentPath.length === this.lastPath.length) { + for (i = currentPath.length; i >= 0; i--) { + if (currentPath[i] !== this.lastPath[i]) { + break; + } + } + if (i === -1) { + this.lastPath = currentPath; + return true; + } + } + this.lastPath = currentPath; + return false; + }; + return NodeChange; + }(); + + var preventSummaryToggle = function (editor) { + editor.on('click', function (e) { + if (editor.dom.getParent(e.target, 'details')) { + e.preventDefault(); + } + }); + }; + var filterDetails = function (editor) { + editor.parser.addNodeFilter('details', function (elms) { + each(elms, function (details) { + details.attr('data-mce-open', details.attr('open')); + details.attr('open', 'open'); + }); + }); + editor.serializer.addNodeFilter('details', function (elms) { + each(elms, function (details) { + var open = details.attr('data-mce-open'); + details.attr('open', isString(open) ? open : null); + details.attr('data-mce-open', null); + }); + }); + }; + var setup$j = function (editor) { + preventSummaryToggle(editor); + filterDetails(editor); + }; + + var isTextBlockNode = function (node) { + return isElement$1(node) && isTextBlock(SugarElement.fromDom(node)); + }; + var normalizeSelection$1 = function (editor) { + var rng = editor.selection.getRng(); + var startPos = CaretPosition.fromRangeStart(rng); + var endPos = CaretPosition.fromRangeEnd(rng); + if (CaretPosition.isElementPosition(startPos)) { + var container = startPos.container(); + if (isTextBlockNode(container)) { + firstPositionIn(container).each(function (pos) { + return rng.setStart(pos.container(), pos.offset()); + }); + } + } + if (CaretPosition.isElementPosition(endPos)) { + var container = startPos.container(); + if (isTextBlockNode(container)) { + lastPositionIn(container).each(function (pos) { + return rng.setEnd(pos.container(), pos.offset()); + }); + } + } + editor.selection.setRng(normalize$2(rng)); + }; + var setup$k = function (editor) { + editor.on('click', function (e) { + if (e.detail >= 3) { + normalizeSelection$1(editor); + } + }); + }; + + var value$1 = 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 getAbsolutePosition = function (elm) { + var clientRect = elm.getBoundingClientRect(); + var doc = elm.ownerDocument; + var docElem = doc.documentElement; + var win = doc.defaultView; + return { + top: clientRect.top + win.pageYOffset - docElem.clientTop, + left: clientRect.left + win.pageXOffset - docElem.clientLeft + }; + }; + var getBodyPosition = function (editor) { + return editor.inline ? getAbsolutePosition(editor.getBody()) : { + left: 0, + top: 0 + }; + }; + var getScrollPosition = function (editor) { + var body = editor.getBody(); + return editor.inline ? { + left: body.scrollLeft, + top: body.scrollTop + } : { + left: 0, + top: 0 + }; + }; + var getBodyScroll = function (editor) { + var body = editor.getBody(), docElm = editor.getDoc().documentElement; + var inlineScroll = { + left: body.scrollLeft, + top: body.scrollTop + }; + var iframeScroll = { + left: body.scrollLeft || docElm.scrollLeft, + top: body.scrollTop || docElm.scrollTop + }; + return editor.inline ? inlineScroll : iframeScroll; + }; + var getMousePosition = function (editor, event) { + if (event.target.ownerDocument !== editor.getDoc()) { + var iframePosition = getAbsolutePosition(editor.getContentAreaContainer()); + var scrollPosition = getBodyScroll(editor); + return { + left: event.pageX - iframePosition.left + scrollPosition.left, + top: event.pageY - iframePosition.top + scrollPosition.top + }; + } + return { + left: event.pageX, + top: event.pageY + }; + }; + var calculatePosition = function (bodyPosition, scrollPosition, mousePosition) { + return { + pageX: mousePosition.left - bodyPosition.left + scrollPosition.left, + pageY: mousePosition.top - bodyPosition.top + scrollPosition.top + }; + }; + var calc = function (editor, event) { + return calculatePosition(getBodyPosition(editor), getScrollPosition(editor), getMousePosition(editor, event)); + }; + + var isContentEditableFalse$a = isContentEditableFalse, isContentEditableTrue$3 = isContentEditableTrue; + var isDraggable = function (rootElm, elm) { + return isContentEditableFalse$a(elm) && elm !== rootElm; + }; + var isValidDropTarget = function (editor, targetElement, dragElement) { + if (targetElement === dragElement || editor.dom.isChildOf(targetElement, dragElement)) { + return false; + } + return !isContentEditableFalse$a(targetElement); + }; + var cloneElement = function (elm) { + var cloneElm = elm.cloneNode(true); + cloneElm.removeAttribute('data-mce-selected'); + return cloneElm; + }; + var createGhost = function (editor, elm, width, height) { + var dom = editor.dom; + var clonedElm = elm.cloneNode(true); + dom.setStyles(clonedElm, { + width: width, + height: height + }); + dom.setAttrib(clonedElm, 'data-mce-selected', null); + var ghostElm = dom.create('div', { + 'class': 'mce-drag-container', + 'data-mce-bogus': 'all', + 'unselectable': 'on', + 'contenteditable': 'false' + }); + dom.setStyles(ghostElm, { + position: 'absolute', + opacity: 0.5, + overflow: 'hidden', + border: 0, + padding: 0, + margin: 0, + width: width, + height: height + }); + dom.setStyles(clonedElm, { + margin: 0, + boxSizing: 'border-box' + }); + ghostElm.appendChild(clonedElm); + return ghostElm; + }; + var appendGhostToBody = function (ghostElm, bodyElm) { + if (ghostElm.parentNode !== bodyElm) { + bodyElm.appendChild(ghostElm); + } + }; + var moveGhost = function (ghostElm, position, width, height, maxX, maxY) { + var overflowX = 0, overflowY = 0; + ghostElm.style.left = position.pageX + 'px'; + ghostElm.style.top = position.pageY + 'px'; + if (position.pageX + width > maxX) { + overflowX = position.pageX + width - maxX; + } + if (position.pageY + height > maxY) { + overflowY = position.pageY + height - maxY; + } + ghostElm.style.width = width - overflowX + 'px'; + ghostElm.style.height = height - overflowY + 'px'; + }; + var removeElement = function (elm) { + if (elm && elm.parentNode) { + elm.parentNode.removeChild(elm); + } + }; + var isLeftMouseButtonPressed = function (e) { + return e.button === 0; + }; + var applyRelPos = function (state, position) { + return { + pageX: position.pageX - state.relX, + pageY: position.pageY + 5 + }; + }; + var start$1 = function (state, editor) { + return function (e) { + if (isLeftMouseButtonPressed(e)) { + var ceElm = find(editor.dom.getParents(e.target), or(isContentEditableFalse$a, isContentEditableTrue$3)).getOr(null); + if (isDraggable(editor.getBody(), ceElm)) { + var elmPos = editor.dom.getPos(ceElm); + var bodyElm = editor.getBody(); + var docElm = editor.getDoc().documentElement; + state.set({ + element: ceElm, + dragging: false, + screenX: e.screenX, + screenY: e.screenY, + maxX: (editor.inline ? bodyElm.scrollWidth : docElm.offsetWidth) - 2, + maxY: (editor.inline ? bodyElm.scrollHeight : docElm.offsetHeight) - 2, + relX: e.pageX - elmPos.x, + relY: e.pageY - elmPos.y, + width: ceElm.offsetWidth, + height: ceElm.offsetHeight, + ghost: createGhost(editor, ceElm, ceElm.offsetWidth, ceElm.offsetHeight) + }); + } + } + }; + }; + var move$2 = function (state, editor) { + var throttledPlaceCaretAt = Delay.throttle(function (clientX, clientY) { + editor._selectionOverrides.hideFakeCaret(); + editor.selection.placeCaretAt(clientX, clientY); + }, 0); + editor.on('remove', throttledPlaceCaretAt.stop); + return function (e) { + return state.on(function (state) { + var movement = Math.max(Math.abs(e.screenX - state.screenX), Math.abs(e.screenY - state.screenY)); + if (!state.dragging && movement > 10) { + var args = editor.fire('dragstart', { target: state.element }); + if (args.isDefaultPrevented()) { + return; + } + state.dragging = true; + editor.focus(); + } + if (state.dragging) { + var targetPos = applyRelPos(state, calc(editor, e)); + appendGhostToBody(state.ghost, editor.getBody()); + moveGhost(state.ghost, targetPos, state.width, state.height, state.maxX, state.maxY); + throttledPlaceCaretAt(e.clientX, e.clientY); + } + }); + }; + }; + var getRawTarget = function (selection) { + var rng = selection.getSel().getRangeAt(0); + var startContainer = rng.startContainer; + return startContainer.nodeType === 3 ? startContainer.parentNode : startContainer; + }; + var drop = function (state, editor) { + return function (e) { + state.on(function (state) { + if (state.dragging) { + if (isValidDropTarget(editor, getRawTarget(editor.selection), state.element)) { + var targetClone_1 = cloneElement(state.element); + var args = editor.fire('drop', { + clientX: e.clientX, + clientY: e.clientY + }); + if (!args.isDefaultPrevented()) { + editor.undoManager.transact(function () { + removeElement(state.element); + editor.insertContent(editor.dom.getOuterHTML(targetClone_1)); + editor._selectionOverrides.hideFakeCaret(); + }); + } + } + } + }); + removeDragState(state); + }; + }; + var stop = function (state, editor) { + return function () { + state.on(function (state) { + if (state.dragging) { + editor.fire('dragend'); + } + }); + removeDragState(state); + }; + }; + var removeDragState = function (state) { + state.on(function (state) { + removeElement(state.ghost); + }); + state.clear(); + }; + var bindFakeDragEvents = function (editor) { + var state = value$1(); + var pageDom = DOMUtils$1.DOM; + var rootDocument = document; + var dragStartHandler = start$1(state, editor); + var dragHandler = move$2(state, editor); + var dropHandler = drop(state, editor); + var dragEndHandler = stop(state, editor); + editor.on('mousedown', dragStartHandler); + editor.on('mousemove', dragHandler); + editor.on('mouseup', dropHandler); + pageDom.bind(rootDocument, 'mousemove', dragHandler); + pageDom.bind(rootDocument, 'mouseup', dragEndHandler); + editor.on('remove', function () { + pageDom.unbind(rootDocument, 'mousemove', dragHandler); + pageDom.unbind(rootDocument, 'mouseup', dragEndHandler); + }); + }; + var blockIeDrop = function (editor) { + editor.on('drop', function (e) { + var realTarget = typeof e.clientX !== 'undefined' ? editor.getDoc().elementFromPoint(e.clientX, e.clientY) : null; + if (isContentEditableFalse$a(realTarget) || editor.dom.getContentEditableParent(realTarget) === 'false') { + e.preventDefault(); + } + }); + }; + var blockUnsupportedFileDrop = function (editor) { + var preventFileDrop = function (e) { + if (!e.defaultPrevented) { + var dataTransfer = e.dataTransfer; + if (dataTransfer && (contains(dataTransfer.types, 'Files') || dataTransfer.files.length > 0)) { + e.preventDefault(); + if (e.type === 'drop') { + displayError(editor, 'Dropped file type is not supported'); + } + } + } + }; + var preventFileDropIfUIElement = function (e) { + if (isUIElement(editor, e.target)) { + preventFileDrop(e); + } + }; + var setup = function () { + var pageDom = DOMUtils$1.DOM; + var dom = editor.dom; + var doc = document; + var editorRoot = editor.inline ? editor.getBody() : editor.getDoc(); + var eventNames = [ + 'drop', + 'dragover' + ]; + each(eventNames, function (name) { + pageDom.bind(doc, name, preventFileDropIfUIElement); + dom.bind(editorRoot, name, preventFileDrop); + }); + editor.on('remove', function () { + each(eventNames, function (name) { + pageDom.unbind(doc, name, preventFileDropIfUIElement); + dom.unbind(editorRoot, name, preventFileDrop); + }); + }); + }; + editor.on('init', function () { + Delay.setEditorTimeout(editor, setup, 0); + }); + }; + var init = function (editor) { + bindFakeDragEvents(editor); + blockIeDrop(editor); + if (shouldBlockUnsupportedDrop(editor)) { + blockUnsupportedFileDrop(editor); + } + }; + + var setup$l = function (editor) { + var renderFocusCaret = first(function () { + if (!editor.removed && editor.getBody().contains(document.activeElement)) { + var rng = editor.selection.getRng(); + if (rng.collapsed) { + var caretRange = renderRangeCaret(editor, rng, false); + editor.selection.setRng(caretRange); + } + } + }, 0); + editor.on('focus', function () { + renderFocusCaret.throttle(); + }); + editor.on('blur', function () { + renderFocusCaret.cancel(); + }); + }; + + var setup$m = function (editor) { + editor.on('init', function () { + editor.on('focusin', function (e) { + var target = e.target; + if (isMedia(target)) { + var ceRoot = getContentEditableRoot(editor.getBody(), target); + var node = isContentEditableFalse(ceRoot) ? ceRoot : target; + if (editor.selection.getNode() !== node) { + selectNode(editor, node).each(function (rng) { + return editor.selection.setRng(rng); + }); + } + } + }); + }); + }; + + var isContentEditableTrue$4 = isContentEditableTrue; + var isContentEditableFalse$b = isContentEditableFalse; + var getContentEditableRoot$1 = function (editor, node) { + return getContentEditableRoot(editor.getBody(), node); + }; + var SelectionOverrides = function (editor) { + var selection = editor.selection, dom = editor.dom; + var isBlock = dom.isBlock; + var rootNode = editor.getBody(); + var fakeCaret = FakeCaret(editor, rootNode, isBlock, function () { + return hasFocus$1(editor); + }); + var realSelectionId = 'sel-' + dom.uniqueId(); + var elementSelectionAttr = 'data-mce-selected'; + var selectedElement; + var isFakeSelectionElement = function (node) { + return dom.hasClass(node, 'mce-offscreen-selection'); + }; + var isFakeSelectionTargetElement = function (node) { + return node !== rootNode && (isContentEditableFalse$b(node) || isMedia(node)) && dom.isChildOf(node, rootNode); + }; + var isNearFakeSelectionElement = function (pos) { + return isBeforeContentEditableFalse(pos) || isAfterContentEditableFalse(pos) || isBeforeMedia(pos) || isAfterMedia(pos); + }; + var getRealSelectionElement = function () { + var container = dom.get(realSelectionId); + return container ? container.getElementsByTagName('*')[0] : container; + }; + var setRange = function (range) { + if (range) { + selection.setRng(range); + } + }; + var getRange = selection.getRng; + var showCaret = function (direction, node, before, scrollIntoView) { + if (scrollIntoView === void 0) { + scrollIntoView = true; + } + var e = editor.fire('ShowCaret', { + target: node, + direction: direction, + before: before + }); + if (e.isDefaultPrevented()) { + return null; + } + if (scrollIntoView) { + selection.scrollIntoView(node, direction === -1); + } + return fakeCaret.show(before, node); + }; + var showBlockCaretContainer = function (blockCaretContainer) { + if (blockCaretContainer.hasAttribute('data-mce-caret')) { + showCaretContainerBlock(blockCaretContainer); + setRange(getRange()); + selection.scrollIntoView(blockCaretContainer); + } + }; + var registerEvents = function () { + editor.on('mouseup', function (e) { + var range = getRange(); + if (range.collapsed && isXYInContentArea(editor, e.clientX, e.clientY)) { + renderCaretAtRange(editor, range, false).each(setRange); + } + }); + editor.on('click', function (e) { + var contentEditableRoot = getContentEditableRoot$1(editor, e.target); + if (contentEditableRoot) { + if (isContentEditableFalse$b(contentEditableRoot)) { + e.preventDefault(); + editor.focus(); + } + if (isContentEditableTrue$4(contentEditableRoot)) { + if (dom.isChildOf(contentEditableRoot, selection.getNode())) { + removeElementSelection(); + } + } + } + }); + editor.on('blur NewBlock', removeElementSelection); + editor.on('ResizeWindow FullscreenStateChanged', fakeCaret.reposition); + var hasNormalCaretPosition = function (elm) { + var caretWalker = CaretWalker(elm); + if (!elm.firstChild) { + return false; + } + var startPos = CaretPosition$1.before(elm.firstChild); + var newPos = caretWalker.next(startPos); + return newPos && !isNearFakeSelectionElement(newPos); + }; + var isInSameBlock = function (node1, node2) { + var block1 = dom.getParent(node1, isBlock); + var block2 = dom.getParent(node2, isBlock); + return block1 === block2; + }; + var hasBetterMouseTarget = function (targetNode, caretNode) { + var targetBlock = dom.getParent(targetNode, isBlock); + var caretBlock = dom.getParent(caretNode, isBlock); + if (targetBlock && targetNode !== caretBlock && dom.isChildOf(targetBlock, caretBlock) && isContentEditableFalse$b(getContentEditableRoot$1(editor, targetBlock)) === false) { + return true; + } + return targetBlock && !isInSameBlock(targetBlock, caretBlock) && hasNormalCaretPosition(targetBlock); + }; + editor.on('tap', function (e) { + var targetElm = e.target; + var contentEditableRoot = getContentEditableRoot$1(editor, targetElm); + if (isContentEditableFalse$b(contentEditableRoot)) { + e.preventDefault(); + selectNode(editor, contentEditableRoot).each(setElementSelection); + } else if (isFakeSelectionTargetElement(targetElm)) { + selectNode(editor, targetElm).each(setElementSelection); + } + }, true); + editor.on('mousedown', function (e) { + var targetElm = e.target; + if (targetElm !== rootNode && targetElm.nodeName !== 'HTML' && !dom.isChildOf(targetElm, rootNode)) { + return; + } + if (isXYInContentArea(editor, e.clientX, e.clientY) === false) { + return; + } + var contentEditableRoot = getContentEditableRoot$1(editor, targetElm); + if (contentEditableRoot) { + if (isContentEditableFalse$b(contentEditableRoot)) { + e.preventDefault(); + selectNode(editor, contentEditableRoot).each(setElementSelection); + } else { + removeElementSelection(); + if (!(isContentEditableTrue$4(contentEditableRoot) && e.shiftKey) && !isXYWithinRange(e.clientX, e.clientY, selection.getRng())) { + hideFakeCaret(); + selection.placeCaretAt(e.clientX, e.clientY); + } + } + } else if (isFakeSelectionTargetElement(targetElm)) { + selectNode(editor, targetElm).each(setElementSelection); + } else if (isFakeCaretTarget(targetElm) === false) { + removeElementSelection(); + hideFakeCaret(); + var fakeCaretInfo = closestFakeCaret(rootNode, e.clientX, e.clientY); + if (fakeCaretInfo) { + if (!hasBetterMouseTarget(targetElm, fakeCaretInfo.node)) { + e.preventDefault(); + var range = showCaret(1, fakeCaretInfo.node, fakeCaretInfo.before, false); + editor.getBody().focus(); + setRange(range); + } + } + } + }); + editor.on('keypress', function (e) { + if (VK.modifierPressed(e)) { + return; + } + if (isContentEditableFalse$b(selection.getNode())) { + e.preventDefault(); + } + }); + editor.on('GetSelectionRange', function (e) { + var rng = e.range; + if (selectedElement) { + if (!selectedElement.parentNode) { + selectedElement = null; + return; + } + rng = rng.cloneRange(); + rng.selectNode(selectedElement); + e.range = rng; + } + }); + editor.on('SetSelectionRange', function (e) { + e.range = normalizeShortEndedElementSelection(e.range); + var rng = setElementSelection(e.range, e.forward); + if (rng) { + e.range = rng; + } + }); + var isPasteBin = function (node) { + return node.id === 'mcepastebin'; + }; + editor.on('AfterSetSelectionRange', function (e) { + var rng = e.range; + var parentNode = rng.startContainer.parentNode; + if (!isRangeInCaretContainer(rng) && !isPasteBin(parentNode)) { + hideFakeCaret(); + } + if (!isFakeSelectionElement(parentNode)) { + removeElementSelection(); + } + }); + editor.on('copy', function (e) { + var clipboardData = e.clipboardData; + if (!e.isDefaultPrevented() && e.clipboardData && !Env.ie) { + var realSelectionElement = getRealSelectionElement(); + if (realSelectionElement) { + e.preventDefault(); + clipboardData.clearData(); + clipboardData.setData('text/html', realSelectionElement.outerHTML); + clipboardData.setData('text/plain', realSelectionElement.outerText || realSelectionElement.innerText); + } + } + }); + init(editor); + setup$l(editor); + setup$m(editor); + }; + var isWithinCaretContainer = function (node) { + return isCaretContainer(node) || startsWithCaretContainer(node) || endsWithCaretContainer(node); + }; + var isRangeInCaretContainer = function (rng) { + return isWithinCaretContainer(rng.startContainer) || isWithinCaretContainer(rng.endContainer); + }; + var normalizeShortEndedElementSelection = function (rng) { + var shortEndedElements = editor.schema.getShortEndedElements(); + var newRng = dom.createRng(); + var startContainer = rng.startContainer; + var startOffset = rng.startOffset; + var endContainer = rng.endContainer; + var endOffset = rng.endOffset; + if (has(shortEndedElements, startContainer.nodeName.toLowerCase())) { + if (startOffset === 0) { + newRng.setStartBefore(startContainer); + } else { + newRng.setStartAfter(startContainer); + } + } else { + newRng.setStart(startContainer, startOffset); + } + if (has(shortEndedElements, endContainer.nodeName.toLowerCase())) { + if (endOffset === 0) { + newRng.setEndBefore(endContainer); + } else { + newRng.setEndAfter(endContainer); + } + } else { + newRng.setEnd(endContainer, endOffset); + } + return newRng; + }; + var setupOffscreenSelection = function (node, targetClone, origTargetClone) { + var $ = editor.$; + var $realSelectionContainer = descendant(SugarElement.fromDom(editor.getBody()), '#' + realSelectionId).fold(function () { + return $([]); + }, function (elm) { + return $([elm.dom]); + }); + if ($realSelectionContainer.length === 0) { + $realSelectionContainer = $('
                                      ').attr('id', realSelectionId); + $realSelectionContainer.appendTo(editor.getBody()); + } + var newRange = dom.createRng(); + if (targetClone === origTargetClone && Env.ie) { + $realSelectionContainer.empty().append('

                                      \xA0

                                      ').append(targetClone); + newRange.setStartAfter($realSelectionContainer[0].firstChild.firstChild); + newRange.setEndAfter(targetClone); + } else { + $realSelectionContainer.empty().append(nbsp).append(targetClone).append(nbsp); + newRange.setStart($realSelectionContainer[0].firstChild, 1); + newRange.setEnd($realSelectionContainer[0].lastChild, 0); + } + $realSelectionContainer.css({ top: dom.getPos(node, editor.getBody()).y }); + $realSelectionContainer[0].focus(); + var sel = selection.getSel(); + sel.removeAllRanges(); + sel.addRange(newRange); + return newRange; + }; + var selectElement = function (elm) { + var targetClone = elm.cloneNode(true); + var e = editor.fire('ObjectSelected', { + target: elm, + targetClone: targetClone + }); + if (e.isDefaultPrevented()) { + return null; + } + var range = setupOffscreenSelection(elm, e.targetClone, targetClone); + var nodeElm = SugarElement.fromDom(elm); + each(descendants$1(SugarElement.fromDom(editor.getBody()), '*[data-mce-selected]'), function (elm) { + if (!eq$2(nodeElm, elm)) { + remove$1(elm, elementSelectionAttr); + } + }); + if (!dom.getAttrib(elm, elementSelectionAttr)) { + elm.setAttribute(elementSelectionAttr, '1'); + } + selectedElement = elm; + hideFakeCaret(); + return range; + }; + var setElementSelection = function (range, forward) { + if (!range) { + return null; + } + if (range.collapsed) { + if (!isRangeInCaretContainer(range)) { + var dir = forward ? 1 : -1; + var caretPosition = getNormalizedRangeEndPoint(dir, rootNode, range); + var beforeNode = caretPosition.getNode(!forward); + if (isFakeCaretTarget(beforeNode)) { + return showCaret(dir, beforeNode, forward ? !caretPosition.isAtEnd() : false, false); + } + var afterNode = caretPosition.getNode(forward); + if (isFakeCaretTarget(afterNode)) { + return showCaret(dir, afterNode, forward ? false : !caretPosition.isAtEnd(), false); + } + } + return null; + } + var startContainer = range.startContainer; + var startOffset = range.startOffset; + var endOffset = range.endOffset; + if (startContainer.nodeType === 3 && startOffset === 0 && isContentEditableFalse$b(startContainer.parentNode)) { + startContainer = startContainer.parentNode; + startOffset = dom.nodeIndex(startContainer); + startContainer = startContainer.parentNode; + } + if (startContainer.nodeType !== 1) { + return null; + } + if (endOffset === startOffset + 1 && startContainer === range.endContainer) { + var node = startContainer.childNodes[startOffset]; + if (isFakeSelectionTargetElement(node)) { + return selectElement(node); + } + } + return null; + }; + var removeElementSelection = function () { + if (selectedElement) { + selectedElement.removeAttribute(elementSelectionAttr); + } + descendant(SugarElement.fromDom(editor.getBody()), '#' + realSelectionId).each(remove); + selectedElement = null; + }; + var destroy = function () { + fakeCaret.destroy(); + selectedElement = null; + }; + var hideFakeCaret = function () { + fakeCaret.hide(); + }; + if (Env.ceFalse) { + registerEvents(); + } + return { + showCaret: showCaret, + showBlockCaretContainer: showBlockCaretContainer, + hideFakeCaret: hideFakeCaret, + destroy: destroy + }; + }; + + var Quirks = function (editor) { + var each = Tools.each; + var BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE, dom = editor.dom, selection = editor.selection, parser = editor.parser; + var isGecko = Env.gecko, isIE = Env.ie, isWebKit = Env.webkit; + var mceInternalUrlPrefix = 'data:text/mce-internal,'; + var mceInternalDataType = isIE ? 'Text' : 'URL'; + var setEditorCommandState = function (cmd, state) { + try { + editor.getDoc().execCommand(cmd, false, state); + } catch (ex) { + } + }; + var isDefaultPrevented = function (e) { + return e.isDefaultPrevented(); + }; + var setMceInternalContent = function (e) { + var selectionHtml, internalContent; + if (e.dataTransfer) { + if (editor.selection.isCollapsed() && e.target.tagName === 'IMG') { + selection.select(e.target); + } + selectionHtml = editor.selection.getContent(); + if (selectionHtml.length > 0) { + internalContent = mceInternalUrlPrefix + escape(editor.id) + ',' + escape(selectionHtml); + e.dataTransfer.setData(mceInternalDataType, internalContent); + } + } + }; + var getMceInternalContent = function (e) { + var internalContent; + if (e.dataTransfer) { + internalContent = e.dataTransfer.getData(mceInternalDataType); + if (internalContent && internalContent.indexOf(mceInternalUrlPrefix) >= 0) { + internalContent = internalContent.substr(mceInternalUrlPrefix.length).split(','); + return { + id: unescape(internalContent[0]), + html: unescape(internalContent[1]) + }; + } + } + return null; + }; + var insertClipboardContents = function (content, internal) { + if (editor.queryCommandSupported('mceInsertClipboardContent')) { + editor.execCommand('mceInsertClipboardContent', false, { + content: content, + internal: internal + }); + } else { + editor.execCommand('mceInsertContent', false, content); + } + }; + var emptyEditorWhenDeleting = function () { + var serializeRng = function (rng) { + var body = dom.create('body'); + var contents = rng.cloneContents(); + body.appendChild(contents); + return selection.serializer.serialize(body, { format: 'html' }); + }; + var allContentsSelected = function (rng) { + var selection = serializeRng(rng); + var allRng = dom.createRng(); + allRng.selectNode(editor.getBody()); + var allSelection = serializeRng(allRng); + return selection === allSelection; + }; + editor.on('keydown', function (e) { + var keyCode = e.keyCode; + var isCollapsed, body; + if (!isDefaultPrevented(e) && (keyCode === DELETE || keyCode === BACKSPACE)) { + isCollapsed = editor.selection.isCollapsed(); + body = editor.getBody(); + if (isCollapsed && !dom.isEmpty(body)) { + return; + } + if (!isCollapsed && !allContentsSelected(editor.selection.getRng())) { + return; + } + e.preventDefault(); + editor.setContent(''); + if (body.firstChild && dom.isBlock(body.firstChild)) { + editor.selection.setCursorLocation(body.firstChild, 0); + } else { + editor.selection.setCursorLocation(body, 0); + } + editor.nodeChanged(); + } + }); + }; + var selectAll = function () { + editor.shortcuts.add('meta+a', null, 'SelectAll'); + }; + var inputMethodFocus = function () { + if (!editor.inline) { + dom.bind(editor.getDoc(), 'mousedown mouseup', function (e) { + var rng; + if (e.target === editor.getDoc().documentElement) { + rng = selection.getRng(); + editor.getBody().focus(); + if (e.type === 'mousedown') { + if (isCaretContainer(rng.startContainer)) { + return; + } + selection.placeCaretAt(e.clientX, e.clientY); + } else { + selection.setRng(rng); + } + } + }); + } + }; + var removeHrOnBackspace = function () { + editor.on('keydown', function (e) { + if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) { + if (!editor.getBody().getElementsByTagName('hr').length) { + return; + } + if (selection.isCollapsed() && selection.getRng().startOffset === 0) { + var node = selection.getNode(); + var previousSibling = node.previousSibling; + if (node.nodeName === 'HR') { + dom.remove(node); + e.preventDefault(); + return; + } + if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === 'hr') { + dom.remove(previousSibling); + e.preventDefault(); + } + } + } + }); + }; + var focusBody = function () { + if (!Range.prototype.getClientRects) { + editor.on('mousedown', function (e) { + if (!isDefaultPrevented(e) && e.target.nodeName === 'HTML') { + var body_1 = editor.getBody(); + body_1.blur(); + Delay.setEditorTimeout(editor, function () { + body_1.focus(); + }); + } + }); + } + }; + var selectControlElements = function () { + editor.on('click', function (e) { + var target = e.target; + if (/^(IMG|HR)$/.test(target.nodeName) && dom.getContentEditableParent(target) !== 'false') { + e.preventDefault(); + editor.selection.select(target); + editor.nodeChanged(); + } + if (target.nodeName === 'A' && dom.hasClass(target, 'mce-item-anchor')) { + e.preventDefault(); + selection.select(target); + } + }); + }; + var removeStylesWhenDeletingAcrossBlockElements = function () { + var getAttributeApplyFunction = function () { + var template = dom.getAttribs(selection.getStart().cloneNode(false)); + return function () { + var target = selection.getStart(); + if (target !== editor.getBody()) { + dom.setAttrib(target, 'style', null); + each(template, function (attr) { + target.setAttributeNode(attr.cloneNode(true)); + }); + } + }; + }; + var isSelectionAcrossElements = function () { + return !selection.isCollapsed() && dom.getParent(selection.getStart(), dom.isBlock) !== dom.getParent(selection.getEnd(), dom.isBlock); + }; + editor.on('keypress', function (e) { + var applyAttributes; + if (!isDefaultPrevented(e) && (e.keyCode === 8 || e.keyCode === 46) && isSelectionAcrossElements()) { + applyAttributes = getAttributeApplyFunction(); + editor.getDoc().execCommand('delete', false, null); + applyAttributes(); + e.preventDefault(); + return false; + } + }); + dom.bind(editor.getDoc(), 'cut', function (e) { + var applyAttributes; + if (!isDefaultPrevented(e) && isSelectionAcrossElements()) { + applyAttributes = getAttributeApplyFunction(); + Delay.setEditorTimeout(editor, function () { + applyAttributes(); + }); + } + }); + }; + var disableBackspaceIntoATable = function () { + editor.on('keydown', function (e) { + if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) { + if (selection.isCollapsed() && selection.getRng().startOffset === 0) { + var previousSibling = selection.getNode().previousSibling; + if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === 'table') { + e.preventDefault(); + return false; + } + } + } + }); + }; + var removeBlockQuoteOnBackSpace = function () { + editor.on('keydown', function (e) { + var rng, parent; + if (isDefaultPrevented(e) || e.keyCode !== VK.BACKSPACE) { + return; + } + rng = selection.getRng(); + var container = rng.startContainer; + var offset = rng.startOffset; + var root = dom.getRoot(); + parent = container; + if (!rng.collapsed || offset !== 0) { + return; + } + while (parent && parent.parentNode && parent.parentNode.firstChild === parent && parent.parentNode !== root) { + parent = parent.parentNode; + } + if (parent.tagName === 'BLOCKQUOTE') { + editor.formatter.toggle('blockquote', null, parent); + rng = dom.createRng(); + rng.setStart(container, 0); + rng.setEnd(container, 0); + selection.setRng(rng); + } + }); + }; + var setGeckoEditingOptions = function () { + var setOpts = function () { + setEditorCommandState('StyleWithCSS', false); + setEditorCommandState('enableInlineTableEditing', false); + if (!getObjectResizing(editor)) { + setEditorCommandState('enableObjectResizing', false); + } + }; + if (!isReadOnly(editor)) { + editor.on('BeforeExecCommand mousedown', setOpts); + } + }; + var addBrAfterLastLinks = function () { + var fixLinks = function () { + each(dom.select('a'), function (node) { + var parentNode = node.parentNode; + var root = dom.getRoot(); + if (parentNode.lastChild === node) { + while (parentNode && !dom.isBlock(parentNode)) { + if (parentNode.parentNode.lastChild !== parentNode || parentNode === root) { + return; + } + parentNode = parentNode.parentNode; + } + dom.add(parentNode, 'br', { 'data-mce-bogus': 1 }); + } + }); + }; + editor.on('SetContent ExecCommand', function (e) { + if (e.type === 'setcontent' || e.command === 'mceInsertLink') { + fixLinks(); + } + }); + }; + var setDefaultBlockType = function () { + if (getForcedRootBlock(editor)) { + editor.on('init', function () { + setEditorCommandState('DefaultParagraphSeparator', getForcedRootBlock(editor)); + }); + } + }; + var normalizeSelection = function () { + editor.on('keyup focusin mouseup', function (e) { + if (!VK.modifierPressed(e)) { + selection.normalize(); + } + }, true); + }; + var showBrokenImageIcon = function () { + editor.contentStyles.push('img:-moz-broken {' + '-moz-force-broken-image-icon:1;' + 'min-width:24px;' + 'min-height:24px' + '}'); + }; + var restoreFocusOnKeyDown = function () { + if (!editor.inline) { + editor.on('keydown', function () { + if (document.activeElement === document.body) { + editor.getWin().focus(); + } + }); + } + }; + var bodyHeight = function () { + if (!editor.inline) { + editor.contentStyles.push('body {min-height: 150px}'); + editor.on('click', function (e) { + var rng; + if (e.target.nodeName === 'HTML') { + if (Env.ie > 11) { + editor.getBody().focus(); + return; + } + rng = editor.selection.getRng(); + editor.getBody().focus(); + editor.selection.setRng(rng); + editor.selection.normalize(); + editor.nodeChanged(); + } + }); + } + }; + var blockCmdArrowNavigation = function () { + if (Env.mac) { + editor.on('keydown', function (e) { + if (VK.metaKeyPressed(e) && !e.shiftKey && (e.keyCode === 37 || e.keyCode === 39)) { + e.preventDefault(); + var selection_1 = editor.selection.getSel(); + selection_1.modify('move', e.keyCode === 37 ? 'backward' : 'forward', 'lineboundary'); + } + }); + } + }; + var disableAutoUrlDetect = function () { + setEditorCommandState('AutoUrlDetect', false); + }; + var tapLinksAndImages = function () { + editor.on('click', function (e) { + var elm = e.target; + do { + if (elm.tagName === 'A') { + e.preventDefault(); + return; + } + } while (elm = elm.parentNode); + }); + editor.contentStyles.push('.mce-content-body {-webkit-touch-callout: none}'); + }; + var blockFormSubmitInsideEditor = function () { + editor.on('init', function () { + editor.dom.bind(editor.getBody(), 'submit', function (e) { + e.preventDefault(); + }); + }); + }; + var removeAppleInterchangeBrs = function () { + parser.addNodeFilter('br', function (nodes) { + var i = nodes.length; + while (i--) { + if (nodes[i].attr('class') === 'Apple-interchange-newline') { + nodes[i].remove(); + } + } + }); + }; + var ieInternalDragAndDrop = function () { + editor.on('dragstart', function (e) { + setMceInternalContent(e); + }); + editor.on('drop', function (e) { + if (!isDefaultPrevented(e)) { + var internalContent = getMceInternalContent(e); + if (internalContent && internalContent.id !== editor.id) { + e.preventDefault(); + var rng = fromPoint$1(e.x, e.y, editor.getDoc()); + selection.setRng(rng); + insertClipboardContents(internalContent.html, true); + } + } + }); + }; + var refreshContentEditable = function () { + }; + var isHidden = function () { + if (!isGecko || editor.removed) { + return false; + } + var sel = editor.selection.getSel(); + return !sel || !sel.rangeCount || sel.rangeCount === 0; + }; + removeBlockQuoteOnBackSpace(); + emptyEditorWhenDeleting(); + if (!Env.windowsPhone) { + normalizeSelection(); + } + if (isWebKit) { + inputMethodFocus(); + selectControlElements(); + setDefaultBlockType(); + blockFormSubmitInsideEditor(); + disableBackspaceIntoATable(); + removeAppleInterchangeBrs(); + if (Env.iOS) { + restoreFocusOnKeyDown(); + bodyHeight(); + tapLinksAndImages(); + } else { + selectAll(); + } + } + if (Env.ie >= 11) { + bodyHeight(); + disableBackspaceIntoATable(); + } + if (Env.ie) { + selectAll(); + disableAutoUrlDetect(); + ieInternalDragAndDrop(); + } + if (isGecko) { + removeHrOnBackspace(); + focusBody(); + removeStylesWhenDeletingAcrossBlockElements(); + setGeckoEditingOptions(); + addBrAfterLastLinks(); + showBrokenImageIcon(); + blockCmdArrowNavigation(); + disableBackspaceIntoATable(); + } + return { + refreshContentEditable: refreshContentEditable, + isHidden: isHidden + }; + }; + + var DOM$4 = DOMUtils$1.DOM; + var appendStyle = function (editor, text) { + var body = SugarElement.fromDom(editor.getBody()); + var container = getStyleContainer(getRootNode(body)); + var style = SugarElement.fromTag('style'); + set(style, 'type', 'text/css'); + append(style, SugarElement.fromText(text)); + append(container, style); + editor.on('remove', function () { + remove(style); + }); + }; + var getRootName = function (editor) { + return editor.inline ? editor.getElement().nodeName.toLowerCase() : undefined; + }; + var removeUndefined = function (obj) { + return filter$1(obj, function (v) { + return isUndefined(v) === false; + }); + }; + var mkParserSettings = function (editor) { + var settings = editor.settings; + var blobCache = editor.editorUpload.blobCache; + return removeUndefined({ + allow_conditional_comments: settings.allow_conditional_comments, + allow_html_data_urls: settings.allow_html_data_urls, + allow_svg_data_urls: settings.allow_svg_data_urls, + allow_html_in_named_anchor: settings.allow_html_in_named_anchor, + allow_script_urls: settings.allow_script_urls, + allow_unsafe_link_target: settings.allow_unsafe_link_target, + convert_fonts_to_spans: settings.convert_fonts_to_spans, + fix_list_elements: settings.fix_list_elements, + font_size_legacy_values: settings.font_size_legacy_values, + forced_root_block: settings.forced_root_block, + forced_root_block_attrs: settings.forced_root_block_attrs, + padd_empty_with_br: settings.padd_empty_with_br, + preserve_cdata: settings.preserve_cdata, + remove_trailing_brs: settings.remove_trailing_brs, + inline_styles: settings.inline_styles, + root_name: getRootName(editor), + validate: true, + blob_cache: blobCache, + images_dataimg_filter: settings.images_dataimg_filter + }); + }; + var mkSerializerSettings = function (editor) { + var settings = editor.settings; + return __assign(__assign({}, mkParserSettings(editor)), removeUndefined({ + url_converter: settings.url_converter, + url_converter_scope: settings.url_converter_scope, + element_format: settings.element_format, + entities: settings.entities, + entity_encoding: settings.entity_encoding, + indent: settings.indent, + indent_after: settings.indent_after, + indent_before: settings.indent_before, + block_elements: settings.block_elements, + boolean_attributes: settings.boolean_attributes, + custom_elements: settings.custom_elements, + extended_valid_elements: settings.extended_valid_elements, + invalid_elements: settings.invalid_elements, + invalid_styles: settings.invalid_styles, + move_caret_before_on_enter_elements: settings.move_caret_before_on_enter_elements, + non_empty_elements: settings.non_empty_elements, + schema: settings.schema, + self_closing_elements: settings.self_closing_elements, + short_ended_elements: settings.short_ended_elements, + special: settings.special, + text_block_elements: settings.text_block_elements, + text_inline_elements: settings.text_inline_elements, + valid_children: settings.valid_children, + valid_classes: settings.valid_classes, + valid_elements: settings.valid_elements, + valid_styles: settings.valid_styles, + verify_html: settings.verify_html, + whitespace_elements: settings.whitespace_elements + })); + }; + var createParser = function (editor) { + var parser = DomParser(mkParserSettings(editor), editor.schema); + parser.addAttributeFilter('src,href,style,tabindex', function (nodes, name) { + var i = nodes.length, node, value; + var dom = editor.dom; + var internalName = 'data-mce-' + name; + while (i--) { + node = nodes[i]; + value = node.attr(name); + if (value && !node.attr(internalName)) { + if (value.indexOf('data:') === 0 || value.indexOf('blob:') === 0) { + continue; + } + if (name === 'style') { + value = dom.serializeStyle(dom.parseStyle(value), node.name); + if (!value.length) { + value = null; + } + node.attr(internalName, value); + node.attr(name, value); + } else if (name === 'tabindex') { + node.attr(internalName, value); + node.attr(name, null); + } else { + node.attr(internalName, editor.convertURL(value, name, node.name)); + } + } + } + }); + parser.addNodeFilter('script', function (nodes) { + var i = nodes.length; + while (i--) { + var node = nodes[i]; + var type = node.attr('type') || 'no/type'; + if (type.indexOf('mce-') !== 0) { + node.attr('type', 'mce-' + type); + } + } + }); + if (editor.settings.preserve_cdata) { + parser.addNodeFilter('#cdata', function (nodes) { + var i = nodes.length; + while (i--) { + var node = nodes[i]; + node.type = 8; + node.name = '#comment'; + node.value = '[CDATA[' + editor.dom.encode(node.value) + ']]'; + } + }); + } + parser.addNodeFilter('p,h1,h2,h3,h4,h5,h6,div', function (nodes) { + var i = nodes.length; + var nonEmptyElements = editor.schema.getNonEmptyElements(); + while (i--) { + var node = nodes[i]; + if (node.isEmpty(nonEmptyElements) && node.getAll('br').length === 0) { + node.append(new AstNode('br', 1)).shortEnded = true; + } + } + }); + return parser; + }; + var autoFocus = function (editor) { + if (editor.settings.auto_focus) { + Delay.setEditorTimeout(editor, function () { + var focusEditor; + if (editor.settings.auto_focus === true) { + focusEditor = editor; + } else { + focusEditor = editor.editorManager.get(editor.settings.auto_focus); + } + if (!focusEditor.destroyed) { + focusEditor.focus(); + } + }, 100); + } + }; + var moveSelectionToFirstCaretPosition = function (editor) { + var root = editor.dom.getRoot(); + if (!editor.inline && (!hasAnyRanges(editor) || editor.selection.getStart(true) === root)) { + firstPositionIn(root).each(function (pos) { + var node = pos.getNode(); + var caretPos = isTable(node) ? firstPositionIn(node).getOr(pos) : pos; + if (Env.browser.isIE()) { + storeNative(editor, caretPos.toRange()); + } else { + editor.selection.setRng(caretPos.toRange()); + } + }); + } + }; + var initEditor = function (editor) { + editor.bindPendingEventDelegates(); + editor.initialized = true; + fireInit(editor); + editor.focus(true); + moveSelectionToFirstCaretPosition(editor); + editor.nodeChanged({ initial: true }); + editor.execCallback('init_instance_callback', editor); + autoFocus(editor); + }; + var getStyleSheetLoader = function (editor) { + return editor.inline ? editor.ui.styleSheetLoader : editor.dom.styleSheetLoader; + }; + var loadContentCss = function (editor, css) { + var styleSheetLoader = getStyleSheetLoader(editor); + var loaded = function () { + editor.on('remove', function () { + return styleSheetLoader.unloadAll(css); + }); + initEditor(editor); + }; + styleSheetLoader.loadAll(css, loaded, loaded); + }; + var preInit = function (editor, rtcMode) { + var settings = editor.settings, doc = editor.getDoc(), body = editor.getBody(); + if (!settings.browser_spellcheck && !settings.gecko_spellcheck) { + doc.body.spellcheck = false; + DOM$4.setAttrib(body, 'spellcheck', 'false'); + } + editor.quirks = Quirks(editor); + firePostRender(editor); + var directionality = getDirectionality(editor); + if (directionality !== undefined) { + body.dir = directionality; + } + if (settings.protect) { + editor.on('BeforeSetContent', function (e) { + Tools.each(settings.protect, function (pattern) { + e.content = e.content.replace(pattern, function (str) { + return ''; + }); + }); + }); + } + editor.on('SetContent', function () { + editor.addVisual(editor.getBody()); + }); + if (rtcMode === false) { + editor.load({ + initial: true, + format: 'html' + }); + } + editor.startContent = editor.getContent({ format: 'raw' }); + editor.on('compositionstart compositionend', function (e) { + editor.composing = e.type === 'compositionstart'; + }); + if (editor.contentStyles.length > 0) { + var contentCssText_1 = ''; + Tools.each(editor.contentStyles, function (style) { + contentCssText_1 += style + '\r\n'; + }); + editor.dom.addStyle(contentCssText_1); + } + loadContentCss(editor, editor.contentCSS); + if (settings.content_style) { + appendStyle(editor, settings.content_style); + } + }; + var initContentBody = function (editor, skipWrite) { + var settings = editor.settings; + var targetElm = editor.getElement(); + var doc = editor.getDoc(); + if (!settings.inline) { + editor.getElement().style.visibility = editor.orgVisibility; + } + if (!skipWrite && !editor.inline) { + doc.open(); + doc.write(editor.iframeHTML); + doc.close(); + } + if (editor.inline) { + DOM$4.addClass(targetElm, 'mce-content-body'); + editor.contentDocument = doc = document; + editor.contentWindow = window; + editor.bodyElement = targetElm; + editor.contentAreaContainer = targetElm; + } + var body = editor.getBody(); + body.disabled = true; + editor.readonly = !!settings.readonly; + if (!editor.readonly) { + if (editor.inline && DOM$4.getStyle(body, 'position', true) === 'static') { + body.style.position = 'relative'; + } + body.contentEditable = editor.getParam('content_editable_state', true); + } + body.disabled = false; + editor.editorUpload = EditorUpload(editor); + editor.schema = Schema(settings); + editor.dom = DOMUtils$1(doc, { + keep_values: true, + url_converter: editor.convertURL, + url_converter_scope: editor, + hex_colors: settings.force_hex_style_colors, + update_styles: true, + root_element: editor.inline ? editor.getBody() : null, + collect: function () { + return editor.inline; + }, + schema: editor.schema, + contentCssCors: shouldUseContentCssCors(editor), + referrerPolicy: getReferrerPolicy(editor), + onSetAttrib: function (e) { + editor.fire('SetAttrib', e); + } + }); + editor.parser = createParser(editor); + editor.serializer = DomSerializer(mkSerializerSettings(editor), editor); + editor.selection = EditorSelection(editor.dom, editor.getWin(), editor.serializer, editor); + editor.annotator = Annotator(editor); + editor.formatter = Formatter(editor); + editor.undoManager = UndoManager(editor); + editor._nodeChangeDispatcher = new NodeChange(editor); + editor._selectionOverrides = SelectionOverrides(editor); + setup$9(editor); + setup$j(editor); + if (!isRtc(editor)) { + setup$k(editor); + } + var caret = setup$i(editor); + setup$8(editor, caret); + setup$a(editor); + setup$7(editor); + firePreInit(editor); + setup$5(editor).fold(function () { + preInit(editor, false); + }, function (loadingRtc) { + editor.setProgressState(true); + loadingRtc.then(function (rtcMode) { + editor.setProgressState(false); + preInit(editor, rtcMode); + }); + }); + }; + + var DOM$5 = DOMUtils$1.DOM; + var relaxDomain = function (editor, ifr) { + if (document.domain !== window.location.hostname && Env.browser.isIE()) { + var bodyUuid = uuid('mce'); + editor[bodyUuid] = function () { + initContentBody(editor); + }; + var domainRelaxUrl = 'javascript:(function(){' + 'document.open();document.domain="' + document.domain + '";' + 'var ed = window.parent.tinymce.get("' + editor.id + '");document.write(ed.iframeHTML);' + 'document.close();ed.' + bodyUuid + '(true);})()'; + DOM$5.setAttrib(ifr, 'src', domainRelaxUrl); + return true; + } + return false; + }; + var createIframeElement = function (id, title, height, customAttrs) { + var iframe = SugarElement.fromTag('iframe'); + setAll(iframe, customAttrs); + setAll(iframe, { + id: id + '_ifr', + frameBorder: '0', + allowTransparency: 'true', + title: title + }); + add$3(iframe, 'tox-edit-area__iframe'); + return iframe; + }; + var getIframeHtml = function (editor) { + var iframeHTML = getDocType(editor) + ''; + if (getDocumentBaseUrl(editor) !== editor.documentBaseUrl) { + iframeHTML += ''; + } + iframeHTML += ''; + var bodyId = getBodyId(editor); + var bodyClass = getBodyClass(editor); + if (getContentSecurityPolicy(editor)) { + iframeHTML += ''; + } + iframeHTML += '
                                      '; + return iframeHTML; + }; + var createIframe = function (editor, o) { + var title = editor.editorManager.translate('Rich Text Area. Press ALT-0 for help.'); + var ifr = createIframeElement(editor.id, title, o.height, getIframeAttrs(editor)).dom; + ifr.onload = function () { + ifr.onload = null; + editor.fire('load'); + }; + var isDomainRelaxed = relaxDomain(editor, ifr); + editor.contentAreaContainer = o.iframeContainer; + editor.iframeElement = ifr; + editor.iframeHTML = getIframeHtml(editor); + DOM$5.add(o.iframeContainer, ifr); + return isDomainRelaxed; + }; + var init$1 = function (editor, boxInfo) { + var isDomainRelaxed = createIframe(editor, boxInfo); + if (boxInfo.editorContainer) { + DOM$5.get(boxInfo.editorContainer).style.display = editor.orgDisplay; + editor.hidden = DOM$5.isHidden(boxInfo.editorContainer); + } + editor.getElement().style.display = 'none'; + DOM$5.setAttrib(editor.id, 'aria-hidden', 'true'); + if (!isDomainRelaxed) { + initContentBody(editor); + } + }; + + var DOM$6 = DOMUtils$1.DOM; + var initPlugin = function (editor, initializedPlugins, plugin) { + var Plugin = PluginManager.get(plugin); + var pluginUrl = PluginManager.urls[plugin] || editor.documentBaseUrl.replace(/\/$/, ''); + plugin = Tools.trim(plugin); + if (Plugin && Tools.inArray(initializedPlugins, plugin) === -1) { + Tools.each(PluginManager.dependencies(plugin), function (dep) { + initPlugin(editor, initializedPlugins, dep); + }); + if (editor.plugins[plugin]) { + return; + } + try { + var pluginInstance = new Plugin(editor, pluginUrl, editor.$); + editor.plugins[plugin] = pluginInstance; + if (pluginInstance.init) { + pluginInstance.init(editor, pluginUrl); + initializedPlugins.push(plugin); + } + } catch (e) { + pluginInitError(editor, plugin, e); + } + } + }; + var trimLegacyPrefix = function (name) { + return name.replace(/^\-/, ''); + }; + var initPlugins = function (editor) { + var initializedPlugins = []; + Tools.each(getPlugins(editor).split(/[ ,]/), function (name) { + initPlugin(editor, initializedPlugins, trimLegacyPrefix(name)); + }); + }; + var initIcons = function (editor) { + var iconPackName = Tools.trim(getIconPackName(editor)); + var currentIcons = editor.ui.registry.getAll().icons; + var loadIcons = __assign(__assign({}, IconManager.get('default').icons), IconManager.get(iconPackName).icons); + each$1(loadIcons, function (svgData, icon) { + if (!has(currentIcons, icon)) { + editor.ui.registry.addIcon(icon, svgData); + } + }); + }; + var initTheme = function (editor) { + var theme = getTheme(editor); + if (isString(theme)) { + editor.settings.theme = trimLegacyPrefix(theme); + var Theme = ThemeManager.get(theme); + editor.theme = new Theme(editor, ThemeManager.urls[theme]); + if (editor.theme.init) { + editor.theme.init(editor, ThemeManager.urls[theme] || editor.documentBaseUrl.replace(/\/$/, ''), editor.$); + } + } else { + editor.theme = {}; + } + }; + var renderFromLoadedTheme = function (editor) { + return editor.theme.renderUI(); + }; + var renderFromThemeFunc = function (editor) { + var elm = editor.getElement(); + var theme = getTheme(editor); + var info = theme(editor, elm); + if (info.editorContainer.nodeType) { + info.editorContainer.id = info.editorContainer.id || editor.id + '_parent'; + } + if (info.iframeContainer && info.iframeContainer.nodeType) { + info.iframeContainer.id = info.iframeContainer.id || editor.id + '_iframecontainer'; + } + info.height = info.iframeHeight ? info.iframeHeight : elm.offsetHeight; + return info; + }; + var createThemeFalseResult = function (element) { + return { + editorContainer: element, + iframeContainer: element, + api: {} + }; + }; + var renderThemeFalseIframe = function (targetElement) { + var iframeContainer = DOM$6.create('div'); + DOM$6.insertAfter(iframeContainer, targetElement); + return createThemeFalseResult(iframeContainer); + }; + var renderThemeFalse = function (editor) { + var targetElement = editor.getElement(); + return editor.inline ? createThemeFalseResult(null) : renderThemeFalseIframe(targetElement); + }; + var renderThemeUi = function (editor) { + var elm = editor.getElement(); + editor.orgDisplay = elm.style.display; + if (isString(getTheme(editor))) { + return renderFromLoadedTheme(editor); + } else if (isFunction(getTheme(editor))) { + return renderFromThemeFunc(editor); + } else { + return renderThemeFalse(editor); + } + }; + var augmentEditorUiApi = function (editor, api) { + var uiApiFacade = { + show: Optional.from(api.show).getOr(noop), + hide: Optional.from(api.hide).getOr(noop), + disable: Optional.from(api.disable).getOr(noop), + isDisabled: Optional.from(api.isDisabled).getOr(never), + enable: function () { + if (!editor.mode.isReadOnly()) { + Optional.from(api.enable).map(call); + } + } + }; + editor.ui = __assign(__assign({}, editor.ui), uiApiFacade); + }; + var init$2 = function (editor) { + editor.fire('ScriptsLoaded'); + initIcons(editor); + initTheme(editor); + initPlugins(editor); + var renderInfo = renderThemeUi(editor); + augmentEditorUiApi(editor, Optional.from(renderInfo.api).getOr({})); + var boxInfo = { + editorContainer: renderInfo.editorContainer, + iframeContainer: renderInfo.iframeContainer + }; + editor.editorContainer = boxInfo.editorContainer ? boxInfo.editorContainer : null; + appendContentCssFromSettings(editor); + if (editor.inline) { + return initContentBody(editor); + } else { + return init$1(editor, boxInfo); + } + }; + + var DOM$7 = DOMUtils$1.DOM; + var hasSkipLoadPrefix = function (name) { + return name.charAt(0) === '-'; + }; + var loadLanguage = function (scriptLoader, editor) { + var languageCode = getLanguageCode(editor); + var languageUrl = getLanguageUrl(editor); + if (I18n.hasCode(languageCode) === false && languageCode !== 'en') { + var url_1 = languageUrl !== '' ? languageUrl : editor.editorManager.baseURL + '/langs/' + languageCode + '.js'; + scriptLoader.add(url_1, noop, undefined, function () { + languageLoadError(editor, url_1, languageCode); + }); + } + }; + var loadTheme = function (scriptLoader, editor, suffix, callback) { + var theme = getTheme(editor); + if (isString(theme)) { + if (!hasSkipLoadPrefix(theme) && !ThemeManager.urls.hasOwnProperty(theme)) { + var themeUrl = getThemeUrl(editor); + if (themeUrl) { + ThemeManager.load(theme, editor.documentBaseURI.toAbsolute(themeUrl)); + } else { + ThemeManager.load(theme, 'themes/' + theme + '/theme' + suffix + '.js'); + } + } + scriptLoader.loadQueue(function () { + ThemeManager.waitFor(theme, callback); + }); + } else { + callback(); + } + }; + var getIconsUrlMetaFromUrl = function (editor) { + return Optional.from(getIconsUrl(editor)).filter(function (url) { + return url.length > 0; + }).map(function (url) { + return { + url: url, + name: Optional.none() + }; + }); + }; + var getIconsUrlMetaFromName = function (editor, name, suffix) { + return Optional.from(name).filter(function (name) { + return name.length > 0 && !IconManager.has(name); + }).map(function (name) { + return { + url: editor.editorManager.baseURL + '/icons/' + name + '/icons' + suffix + '.js', + name: Optional.some(name) + }; + }); + }; + var loadIcons = function (scriptLoader, editor, suffix) { + var defaultIconsUrl = getIconsUrlMetaFromName(editor, 'default', suffix); + var customIconsUrl = getIconsUrlMetaFromUrl(editor).orThunk(function () { + return getIconsUrlMetaFromName(editor, getIconPackName(editor), ''); + }); + each(cat([ + defaultIconsUrl, + customIconsUrl + ]), function (urlMeta) { + scriptLoader.add(urlMeta.url, noop, undefined, function () { + iconsLoadError(editor, urlMeta.url, urlMeta.name.getOrUndefined()); + }); + }); + }; + var loadPlugins = function (editor, suffix) { + Tools.each(getExternalPlugins(editor), function (url, name) { + PluginManager.load(name, url, noop, undefined, function () { + pluginLoadError(editor, url, name); + }); + editor.settings.plugins += ' ' + name; + }); + Tools.each(getPlugins(editor).split(/[ ,]/), function (plugin) { + plugin = Tools.trim(plugin); + if (plugin && !PluginManager.urls[plugin]) { + if (hasSkipLoadPrefix(plugin)) { + plugin = plugin.substr(1, plugin.length); + var dependencies = PluginManager.dependencies(plugin); + Tools.each(dependencies, function (depPlugin) { + var defaultSettings = { + prefix: 'plugins/', + resource: depPlugin, + suffix: '/plugin' + suffix + '.js' + }; + var dep = PluginManager.createUrl(defaultSettings, depPlugin); + PluginManager.load(dep.resource, dep, noop, undefined, function () { + pluginLoadError(editor, dep.prefix + dep.resource + dep.suffix, dep.resource); + }); + }); + } else { + var url_2 = { + prefix: 'plugins/', + resource: plugin, + suffix: '/plugin' + suffix + '.js' + }; + PluginManager.load(plugin, url_2, noop, undefined, function () { + pluginLoadError(editor, url_2.prefix + url_2.resource + url_2.suffix, plugin); + }); + } + } + }); + }; + var loadScripts = function (editor, suffix) { + var scriptLoader = ScriptLoader.ScriptLoader; + loadTheme(scriptLoader, editor, suffix, function () { + loadLanguage(scriptLoader, editor); + loadIcons(scriptLoader, editor, suffix); + loadPlugins(editor, suffix); + scriptLoader.loadQueue(function () { + if (!editor.removed) { + init$2(editor); + } + }, editor, function () { + if (!editor.removed) { + init$2(editor); + } + }); + }); + }; + var getStyleSheetLoader$1 = function (element, editor) { + return instance.forElement(element, { + contentCssCors: hasContentCssCors(editor), + referrerPolicy: getReferrerPolicy(editor) + }); + }; + var render = function (editor) { + var id = editor.id; + I18n.setCode(getLanguageCode(editor)); + var readyHandler = function () { + DOM$7.unbind(window, 'ready', readyHandler); + editor.render(); + }; + if (!EventUtils.Event.domLoaded) { + DOM$7.bind(window, 'ready', readyHandler); + return; + } + if (!editor.getElement()) { + return; + } + if (!Env.contentEditable) { + return; + } + var element = SugarElement.fromDom(editor.getElement()); + var snapshot = clone(element); + editor.on('remove', function () { + eachr(element.dom.attributes, function (attr) { + return remove$1(element, attr.name); + }); + setAll(element, snapshot); + }); + editor.ui.styleSheetLoader = getStyleSheetLoader$1(element, editor); + if (!isInline$1(editor)) { + editor.orgVisibility = editor.getElement().style.visibility; + editor.getElement().style.visibility = 'hidden'; + } else { + editor.inline = true; + } + var form = editor.getElement().form || DOM$7.getParent(id, 'form'); + if (form) { + editor.formElement = form; + if (hasHiddenInput(editor) && !isTextareaOrInput(editor.getElement())) { + DOM$7.insertAfter(DOM$7.create('input', { + type: 'hidden', + name: id + }), id); + editor.hasHiddenInput = true; + } + editor.formEventDelegate = function (e) { + editor.fire(e.type, e); + }; + DOM$7.bind(form, 'submit reset', editor.formEventDelegate); + editor.on('reset', function () { + editor.resetContent(); + }); + if (shouldPatchSubmit(editor) && !form.submit.nodeType && !form.submit.length && !form._mceOldSubmit) { + form._mceOldSubmit = form.submit; + form.submit = function () { + editor.editorManager.triggerSave(); + editor.setDirty(false); + return form._mceOldSubmit(form); + }; + } + } + editor.windowManager = WindowManager(editor); + editor.notificationManager = NotificationManager(editor); + if (isEncodingXml(editor)) { + editor.on('GetContent', function (e) { + if (e.save) { + e.content = DOM$7.encode(e.content); + } + }); + } + if (shouldAddFormSubmitTrigger(editor)) { + editor.on('submit', function () { + if (editor.initialized) { + editor.save(); + } + }); + } + if (shouldAddUnloadTrigger(editor)) { + editor._beforeUnload = function () { + if (editor.initialized && !editor.destroyed && !editor.isHidden()) { + editor.save({ + format: 'raw', + no_events: true, + set_dirty: false + }); + } + }; + editor.editorManager.on('BeforeUnload', editor._beforeUnload); + } + editor.editorManager.add(editor); + loadScripts(editor, editor.suffix); + }; + + var addVisual$1 = function (editor, elm) { + return addVisual(editor, elm); + }; + + var legacyPropNames = { + 'font-size': 'size', + 'font-family': 'face' + }; + var getSpecifiedFontProp = function (propName, rootElm, elm) { + var getProperty = function (elm) { + return getRaw(elm, propName).orThunk(function () { + if (name(elm) === 'font') { + return get$1(legacyPropNames, propName).bind(function (legacyPropName) { + return getOpt(elm, legacyPropName); + }); + } else { + return Optional.none(); + } + }); + }; + var isRoot = function (elm) { + return eq$2(SugarElement.fromDom(rootElm), elm); + }; + return closest$2(SugarElement.fromDom(elm), function (elm) { + return getProperty(elm); + }, isRoot); + }; + var normalizeFontFamily = function (fontFamily) { + return fontFamily.replace(/[\'\"\\]/g, '').replace(/,\s+/g, ','); + }; + var getComputedFontProp = function (propName, elm) { + return Optional.from(DOMUtils$1.DOM.getStyle(elm, propName, true)); + }; + var getFontProp = function (propName) { + return function (rootElm, elm) { + return Optional.from(elm).map(SugarElement.fromDom).filter(isElement).bind(function (element) { + return getSpecifiedFontProp(propName, rootElm, element.dom).or(getComputedFontProp(propName, element.dom)); + }).getOr(''); + }; + }; + var getFontSize = getFontProp('font-size'); + var getFontFamily = compose(normalizeFontFamily, getFontProp('font-family')); + + var findFirstCaretElement = function (editor) { + return firstPositionIn(editor.getBody()).map(function (caret) { + var container = caret.container(); + return isText$1(container) ? container.parentNode : container; + }); + }; + var getCaretElement = function (editor) { + return Optional.from(editor.selection.getRng()).bind(function (rng) { + var root = editor.getBody(); + var atStartOfNode = rng.startContainer === root && rng.startOffset === 0; + return atStartOfNode ? Optional.none() : Optional.from(editor.selection.getStart(true)); + }); + }; + var mapRange = function (editor, mapper) { + return getCaretElement(editor).orThunk(curry(findFirstCaretElement, editor)).map(SugarElement.fromDom).filter(isElement).map(mapper); + }; + + var fromFontSizeNumber = function (editor, value) { + if (/^[0-9.]+$/.test(value)) { + var fontSizeNumber = parseInt(value, 10); + if (fontSizeNumber >= 1 && fontSizeNumber <= 7) { + var fontSizes = getFontStyleValues(editor); + var fontClasses = getFontSizeClasses(editor); + if (fontClasses) { + return fontClasses[fontSizeNumber - 1] || value; + } else { + return fontSizes[fontSizeNumber - 1] || value; + } + } else { + return value; + } + } else { + return value; + } + }; + var normalizeFontNames = function (font) { + var fonts = font.split(/\s*,\s*/); + return map(fonts, function (font) { + if (font.indexOf(' ') !== -1 && !(startsWith(font, '"') || startsWith(font, '\''))) { + return '\'' + font + '\''; + } else { + return font; + } + }).join(','); + }; + var fontNameAction = function (editor, value) { + var font = fromFontSizeNumber(editor, value); + editor.formatter.toggle('fontname', { value: normalizeFontNames(font) }); + editor.nodeChanged(); + }; + var fontNameQuery = function (editor) { + return mapRange(editor, function (elm) { + return getFontFamily(editor.getBody(), elm.dom); + }).getOr(''); + }; + var fontSizeAction = function (editor, value) { + editor.formatter.toggle('fontsize', { value: fromFontSizeNumber(editor, value) }); + editor.nodeChanged(); + }; + var fontSizeQuery = function (editor) { + return mapRange(editor, function (elm) { + return getFontSize(editor.getBody(), elm.dom); + }).getOr(''); + }; + + var lineHeightQuery = function (editor) { + return mapRange(editor, function (elm) { + var root = SugarElement.fromDom(editor.getBody()); + var specifiedStyle = closest$2(elm, function (elm) { + return getRaw(elm, 'line-height'); + }, curry(eq$2, root)); + var computedStyle = function () { + var lineHeight = parseFloat(get$5(elm, 'line-height')); + var fontSize = parseFloat(get$5(elm, 'font-size')); + return String(lineHeight / fontSize); + }; + return specifiedStyle.getOrThunk(computedStyle); + }).getOr(''); + }; + var lineHeightAction = function (editor, lineHeight) { + editor.undoManager.transact(function () { + editor.formatter.toggle('lineheight', { value: String(lineHeight) }); + editor.nodeChanged(); + }); + }; + + var processValue = function (value) { + var details; + if (typeof value !== 'string') { + details = Tools.extend({ + paste: value.paste, + data: { paste: value.paste } + }, value); + return { + content: value.content, + details: details + }; + } + return { + content: value, + details: {} + }; + }; + var insertAtCaret$1 = function (editor, value) { + var result = processValue(value); + insertContent(editor, result.content, result.details); + }; + + var each$f = Tools.each; + var map$3 = Tools.map, inArray$2 = Tools.inArray; + var EditorCommands = function () { + function EditorCommands(editor) { + this.commands = { + state: {}, + exec: {}, + value: {} + }; + this.editor = editor; + this.setupCommands(editor); + } + EditorCommands.prototype.execCommand = function (command, ui, value, args) { + var func, state = false; + var self = this; + if (self.editor.removed) { + return; + } + if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(command) && (!args || !args.skip_focus)) { + self.editor.focus(); + } else { + restore(self.editor); + } + args = self.editor.fire('BeforeExecCommand', { + command: command, + ui: ui, + value: value + }); + if (args.isDefaultPrevented()) { + return false; + } + var customCommand = command.toLowerCase(); + if (func = self.commands.exec[customCommand]) { + func(customCommand, ui, value); + self.editor.fire('ExecCommand', { + command: command, + ui: ui, + value: value + }); + return true; + } + each$f(this.editor.plugins, function (p) { + if (p.execCommand && p.execCommand(command, ui, value)) { + self.editor.fire('ExecCommand', { + command: command, + ui: ui, + value: value + }); + state = true; + return false; + } + }); + if (state) { + return state; + } + if (self.editor.theme && self.editor.theme.execCommand && self.editor.theme.execCommand(command, ui, value)) { + self.editor.fire('ExecCommand', { + command: command, + ui: ui, + value: value + }); + return true; + } + try { + state = self.editor.getDoc().execCommand(command, ui, value); + } catch (ex) { + } + if (state) { + self.editor.fire('ExecCommand', { + command: command, + ui: ui, + value: value + }); + return true; + } + return false; + }; + EditorCommands.prototype.queryCommandState = function (command) { + var func; + if (this.editor.quirks.isHidden() || this.editor.removed) { + return; + } + command = command.toLowerCase(); + if (func = this.commands.state[command]) { + return func(command); + } + try { + return this.editor.getDoc().queryCommandState(command); + } catch (ex) { + } + return false; + }; + EditorCommands.prototype.queryCommandValue = function (command) { + var func; + if (this.editor.quirks.isHidden() || this.editor.removed) { + return; + } + command = command.toLowerCase(); + if (func = this.commands.value[command]) { + return func(command); + } + try { + return this.editor.getDoc().queryCommandValue(command); + } catch (ex) { + } + }; + EditorCommands.prototype.addCommands = function (commandList, type) { + if (type === void 0) { + type = 'exec'; + } + var self = this; + each$f(commandList, function (callback, command) { + each$f(command.toLowerCase().split(','), function (command) { + self.commands[type][command] = callback; + }); + }); + }; + EditorCommands.prototype.addCommand = function (command, callback, scope) { + var _this = this; + command = command.toLowerCase(); + this.commands.exec[command] = function (command, ui, value, args) { + return callback.call(scope || _this.editor, ui, value, args); + }; + }; + EditorCommands.prototype.queryCommandSupported = function (command) { + command = command.toLowerCase(); + if (this.commands.exec[command]) { + return true; + } + try { + return this.editor.getDoc().queryCommandSupported(command); + } catch (ex) { + } + return false; + }; + EditorCommands.prototype.addQueryStateHandler = function (command, callback, scope) { + var _this = this; + command = command.toLowerCase(); + this.commands.state[command] = function () { + return callback.call(scope || _this.editor); + }; + }; + EditorCommands.prototype.addQueryValueHandler = function (command, callback, scope) { + var _this = this; + command = command.toLowerCase(); + this.commands.value[command] = function () { + return callback.call(scope || _this.editor); + }; + }; + EditorCommands.prototype.hasCustomCommand = function (command) { + command = command.toLowerCase(); + return !!this.commands.exec[command]; + }; + EditorCommands.prototype.execNativeCommand = function (command, ui, value) { + if (ui === undefined) { + ui = false; + } + if (value === undefined) { + value = null; + } + return this.editor.getDoc().execCommand(command, ui, value); + }; + EditorCommands.prototype.isFormatMatch = function (name) { + return this.editor.formatter.match(name); + }; + EditorCommands.prototype.toggleFormat = function (name, value) { + this.editor.formatter.toggle(name, value ? { value: value } : undefined); + this.editor.nodeChanged(); + }; + EditorCommands.prototype.storeSelection = function (type) { + this.selectionBookmark = this.editor.selection.getBookmark(type); + }; + EditorCommands.prototype.restoreSelection = function () { + this.editor.selection.moveToBookmark(this.selectionBookmark); + }; + EditorCommands.prototype.setupCommands = function (editor) { + var self = this; + this.addCommands({ + 'mceResetDesignMode,mceBeginUndoLevel': function () { + }, + 'mceEndUndoLevel,mceAddUndoLevel': function () { + editor.undoManager.add(); + }, + 'Cut,Copy,Paste': function (command) { + var doc = editor.getDoc(); + var failed; + try { + self.execNativeCommand(command); + } catch (ex) { + failed = true; + } + if (command === 'paste' && !doc.queryCommandEnabled(command)) { + failed = true; + } + if (failed || !doc.queryCommandSupported(command)) { + var msg = editor.translate('Your browser doesn\'t support direct access to the clipboard. ' + 'Please use the Ctrl+X/C/V keyboard shortcuts instead.'); + if (Env.mac) { + msg = msg.replace(/Ctrl\+/g, '\u2318+'); + } + editor.notificationManager.open({ + text: msg, + type: 'error' + }); + } + }, + 'unlink': function () { + if (editor.selection.isCollapsed()) { + var elm = editor.dom.getParent(editor.selection.getStart(), 'a'); + if (elm) { + editor.dom.remove(elm, true); + } + return; + } + editor.formatter.remove('link'); + }, + 'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull,JustifyNone': function (command) { + var align = command.substring(7); + if (align === 'full') { + align = 'justify'; + } + each$f('left,center,right,justify'.split(','), function (name) { + if (align !== name) { + editor.formatter.remove('align' + name); + } + }); + if (align !== 'none') { + self.toggleFormat('align' + align); + } + }, + 'InsertUnorderedList,InsertOrderedList': function (command) { + var listParent; + self.execNativeCommand(command); + var listElm = editor.dom.getParent(editor.selection.getNode(), 'ol,ul'); + if (listElm) { + listParent = listElm.parentNode; + if (/^(H[1-6]|P|ADDRESS|PRE)$/.test(listParent.nodeName)) { + self.storeSelection(); + editor.dom.split(listParent, listElm); + self.restoreSelection(); + } + } + }, + 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function (command) { + self.toggleFormat(command); + }, + 'ForeColor,HiliteColor': function (command, ui, value) { + self.toggleFormat(command, value); + }, + 'FontName': function (command, ui, value) { + fontNameAction(editor, value); + }, + 'FontSize': function (command, ui, value) { + fontSizeAction(editor, value); + }, + 'LineHeight': function (command, ui, value) { + lineHeightAction(editor, value); + }, + 'RemoveFormat': function (command) { + editor.formatter.remove(command); + }, + 'mceBlockQuote': function () { + self.toggleFormat('blockquote'); + }, + 'FormatBlock': function (command, ui, value) { + return self.toggleFormat(value || 'p'); + }, + 'mceCleanup': function () { + var bookmark = editor.selection.getBookmark(); + editor.setContent(editor.getContent()); + editor.selection.moveToBookmark(bookmark); + }, + 'mceRemoveNode': function (command, ui, value) { + var node = value || editor.selection.getNode(); + if (node !== editor.getBody()) { + self.storeSelection(); + editor.dom.remove(node, true); + self.restoreSelection(); + } + }, + 'mceSelectNodeDepth': function (command, ui, value) { + var counter = 0; + editor.dom.getParent(editor.selection.getNode(), function (node) { + if (node.nodeType === 1 && counter++ === value) { + editor.selection.select(node); + return false; + } + }, editor.getBody()); + }, + 'mceSelectNode': function (command, ui, value) { + editor.selection.select(value); + }, + 'mceInsertContent': function (command, ui, value) { + insertAtCaret$1(editor, value); + }, + 'mceInsertRawHTML': function (command, ui, value) { + editor.selection.setContent('tiny_mce_marker'); + var content = editor.getContent(); + editor.setContent(content.replace(/tiny_mce_marker/g, function () { + return value; + })); + }, + 'mceInsertNewLine': function (command, ui, value) { + insert$3(editor, value); + }, + 'mceToggleFormat': function (command, ui, value) { + self.toggleFormat(value); + }, + 'mceSetContent': function (command, ui, value) { + editor.setContent(value); + }, + 'Indent,Outdent': function (command) { + handle(editor, command); + }, + 'mceRepaint': function () { + }, + 'InsertHorizontalRule': function () { + editor.execCommand('mceInsertContent', false, '
                                      '); + }, + 'mceToggleVisualAid': function () { + editor.hasVisual = !editor.hasVisual; + editor.addVisual(); + }, + 'mceReplaceContent': function (command, ui, value) { + editor.execCommand('mceInsertContent', false, value.replace(/\{\$selection\}/g, editor.selection.getContent({ format: 'text' }))); + }, + 'mceInsertLink': function (command, ui, value) { + if (typeof value === 'string') { + value = { href: value }; + } + var anchor = editor.dom.getParent(editor.selection.getNode(), 'a'); + value.href = value.href.replace(/ /g, '%20'); + if (!anchor || !value.href) { + editor.formatter.remove('link'); + } + if (value.href) { + editor.formatter.apply('link', value, anchor); + } + }, + 'selectAll': function () { + var editingHost = editor.dom.getParent(editor.selection.getStart(), isContentEditableTrue); + if (editingHost) { + var rng = editor.dom.createRng(); + rng.selectNodeContents(editingHost); + editor.selection.setRng(rng); + } + }, + 'mceNewDocument': function () { + editor.setContent(''); + }, + 'InsertLineBreak': function (command, ui, value) { + insert$2(editor, value); + return true; + } + }); + var alignStates = function (name) { + return function () { + var selection = editor.selection; + var nodes = selection.isCollapsed() ? [editor.dom.getParent(selection.getNode(), editor.dom.isBlock)] : selection.getSelectedBlocks(); + var matches = map$3(nodes, function (node) { + return !!editor.formatter.matchNode(node, name); + }); + return inArray$2(matches, true) !== -1; + }; + }; + self.addCommands({ + 'JustifyLeft': alignStates('alignleft'), + 'JustifyCenter': alignStates('aligncenter'), + 'JustifyRight': alignStates('alignright'), + 'JustifyFull': alignStates('alignjustify'), + 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function (command) { + return self.isFormatMatch(command); + }, + 'mceBlockQuote': function () { + return self.isFormatMatch('blockquote'); + }, + 'Outdent': function () { + return canOutdent(editor); + }, + 'InsertUnorderedList,InsertOrderedList': function (command) { + var list = editor.dom.getParent(editor.selection.getNode(), 'ul,ol'); + return list && (command === 'insertunorderedlist' && list.tagName === 'UL' || command === 'insertorderedlist' && list.tagName === 'OL'); + } + }, 'state'); + self.addCommands({ + Undo: function () { + editor.undoManager.undo(); + }, + Redo: function () { + editor.undoManager.redo(); + } + }); + self.addQueryValueHandler('FontName', function () { + return fontNameQuery(editor); + }, this); + self.addQueryValueHandler('FontSize', function () { + return fontSizeQuery(editor); + }, this); + self.addQueryValueHandler('LineHeight', function () { + return lineHeightQuery(editor); + }, this); + }; + return EditorCommands; + }(); + + var internalContentEditableAttr = 'data-mce-contenteditable'; + var toggleClass = function (elm, cls, state) { + if (has$2(elm, cls) && state === false) { + remove$4(elm, cls); + } else if (state) { + add$3(elm, cls); + } + }; + var setEditorCommandState = function (editor, cmd, state) { + try { + editor.getDoc().execCommand(cmd, false, String(state)); + } catch (ex) { + } + }; + var setContentEditable = function (elm, state) { + elm.dom.contentEditable = state ? 'true' : 'false'; + }; + var switchOffContentEditableTrue = function (elm) { + each(descendants$1(elm, '*[contenteditable="true"]'), function (elm) { + set(elm, internalContentEditableAttr, 'true'); + setContentEditable(elm, false); + }); + }; + var switchOnContentEditableTrue = function (elm) { + each(descendants$1(elm, '*[' + internalContentEditableAttr + '="true"]'), function (elm) { + remove$1(elm, internalContentEditableAttr); + setContentEditable(elm, true); + }); + }; + var removeFakeSelection = function (editor) { + Optional.from(editor.selection.getNode()).each(function (elm) { + elm.removeAttribute('data-mce-selected'); + }); + }; + var restoreFakeSelection = function (editor) { + editor.selection.setRng(editor.selection.getRng()); + }; + var toggleReadOnly = function (editor, state) { + var body = SugarElement.fromDom(editor.getBody()); + toggleClass(body, 'mce-content-readonly', state); + if (state) { + editor.selection.controlSelection.hideResizeRect(); + editor._selectionOverrides.hideFakeCaret(); + removeFakeSelection(editor); + editor.readonly = true; + setContentEditable(body, false); + switchOffContentEditableTrue(body); + } else { + editor.readonly = false; + setContentEditable(body, true); + switchOnContentEditableTrue(body); + setEditorCommandState(editor, 'StyleWithCSS', false); + setEditorCommandState(editor, 'enableInlineTableEditing', false); + setEditorCommandState(editor, 'enableObjectResizing', false); + if (hasEditorOrUiFocus(editor)) { + editor.focus(); + } + restoreFakeSelection(editor); + editor.nodeChanged(); + } + }; + var isReadOnly$1 = function (editor) { + return editor.readonly; + }; + var registerFilters = function (editor) { + editor.parser.addAttributeFilter('contenteditable', function (nodes) { + if (isReadOnly$1(editor)) { + each(nodes, function (node) { + node.attr(internalContentEditableAttr, node.attr('contenteditable')); + node.attr('contenteditable', 'false'); + }); + } + }); + editor.serializer.addAttributeFilter(internalContentEditableAttr, function (nodes) { + if (isReadOnly$1(editor)) { + each(nodes, function (node) { + node.attr('contenteditable', node.attr(internalContentEditableAttr)); + }); + } + }); + editor.serializer.addTempAttr(internalContentEditableAttr); + }; + var registerReadOnlyContentFilters = function (editor) { + if (editor.serializer) { + registerFilters(editor); + } else { + editor.on('PreInit', function () { + registerFilters(editor); + }); + } + }; + var isClickEvent = function (e) { + return e.type === 'click'; + }; + var getAnchorHrefOpt = function (editor, elm) { + var isRoot = function (elm) { + return eq$2(elm, SugarElement.fromDom(editor.getBody())); + }; + return closest$1(elm, 'a', isRoot).bind(function (a) { + return getOpt(a, 'href'); + }); + }; + var processReadonlyEvents = function (editor, e) { + if (isClickEvent(e) && !VK.metaKeyPressed(e)) { + var elm = SugarElement.fromDom(e.target); + getAnchorHrefOpt(editor, elm).each(function (href) { + e.preventDefault(); + if (/^#/.test(href)) { + var targetEl = editor.dom.select(href + ',[name="' + removeLeading(href, '#') + '"]'); + if (targetEl.length) { + editor.selection.scrollIntoView(targetEl[0], true); + } + } else { + window.open(href, '_blank', 'rel=noopener noreferrer,menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes,scrollbars=yes'); + } + }); + } + }; + var registerReadOnlySelectionBlockers = function (editor) { + editor.on('ShowCaret', function (e) { + if (isReadOnly$1(editor)) { + e.preventDefault(); + } + }); + editor.on('ObjectSelected', function (e) { + if (isReadOnly$1(editor)) { + e.preventDefault(); + } + }); + }; + + var nativeEvents = Tools.makeMap('focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange ' + 'mouseout mouseenter mouseleave wheel keydown keypress keyup input beforeinput contextmenu dragstart dragend dragover ' + 'draggesture dragdrop drop drag submit ' + 'compositionstart compositionend compositionupdate touchstart touchmove touchend touchcancel', ' '); + var EventDispatcher = function () { + function EventDispatcher(settings) { + this.bindings = {}; + this.settings = settings || {}; + this.scope = this.settings.scope || this; + this.toggleEvent = this.settings.toggleEvent || never; + } + EventDispatcher.isNative = function (name) { + return !!nativeEvents[name.toLowerCase()]; + }; + EventDispatcher.prototype.fire = function (nameIn, argsIn) { + var name = nameIn.toLowerCase(); + var args = argsIn || {}; + args.type = name; + if (!args.target) { + args.target = this.scope; + } + if (!args.preventDefault) { + args.preventDefault = function () { + args.isDefaultPrevented = always; + }; + args.stopPropagation = function () { + args.isPropagationStopped = always; + }; + args.stopImmediatePropagation = function () { + args.isImmediatePropagationStopped = always; + }; + args.isDefaultPrevented = never; + args.isPropagationStopped = never; + args.isImmediatePropagationStopped = never; + } + if (this.settings.beforeFire) { + this.settings.beforeFire(args); + } + var handlers = this.bindings[name]; + if (handlers) { + for (var i = 0, l = handlers.length; i < l; i++) { + var callback = handlers[i]; + if (callback.once) { + this.off(name, callback.func); + } + if (args.isImmediatePropagationStopped()) { + args.stopPropagation(); + return args; + } + if (callback.func.call(this.scope, args) === false) { + args.preventDefault(); + return args; + } + } + } + return args; + }; + EventDispatcher.prototype.on = function (name, callback, prepend, extra) { + if (callback === false) { + callback = never; + } + if (callback) { + var wrappedCallback = { func: callback }; + if (extra) { + Tools.extend(wrappedCallback, extra); + } + var names = name.toLowerCase().split(' '); + var i = names.length; + while (i--) { + var currentName = names[i]; + var handlers = this.bindings[currentName]; + if (!handlers) { + handlers = this.bindings[currentName] = []; + this.toggleEvent(currentName, true); + } + if (prepend) { + handlers.unshift(wrappedCallback); + } else { + handlers.push(wrappedCallback); + } + } + } + return this; + }; + EventDispatcher.prototype.off = function (name, callback) { + var _this = this; + if (name) { + var names = name.toLowerCase().split(' '); + var i = names.length; + while (i--) { + var currentName = names[i]; + var handlers = this.bindings[currentName]; + if (!currentName) { + each$1(this.bindings, function (_value, bindingName) { + _this.toggleEvent(bindingName, false); + delete _this.bindings[bindingName]; + }); + return this; + } + if (handlers) { + if (!callback) { + handlers.length = 0; + } else { + var hi = handlers.length; + while (hi--) { + if (handlers[hi].func === callback) { + handlers = handlers.slice(0, hi).concat(handlers.slice(hi + 1)); + this.bindings[currentName] = handlers; + } } - }; - if (typeof admin.req == 'function') { - admin.req(ajaxOpt); + } + if (!handlers.length) { + this.toggleEvent(name, false); + delete this.bindings[currentName]; + } + } + } + } else { + each$1(this.bindings, function (_value, name) { + _this.toggleEvent(name, false); + }); + this.bindings = {}; + } + return this; + }; + EventDispatcher.prototype.once = function (name, callback, prepend) { + return this.on(name, callback, prepend, { once: true }); + }; + EventDispatcher.prototype.has = function (name) { + name = name.toLowerCase(); + return !(!this.bindings[name] || this.bindings[name].length === 0); + }; + return EventDispatcher; + }(); + + var getEventDispatcher = function (obj) { + if (!obj._eventDispatcher) { + obj._eventDispatcher = new EventDispatcher({ + scope: obj, + toggleEvent: function (name, state) { + if (EventDispatcher.isNative(name) && obj.toggleNativeEvent) { + obj.toggleNativeEvent(name, state); + } + } + }); + } + return obj._eventDispatcher; + }; + var Observable = { + fire: function (name, args, bubble) { + var self = this; + if (self.removed && name !== 'remove' && name !== 'detach') { + return args; + } + var dispatcherArgs = getEventDispatcher(self).fire(name, args); + if (bubble !== false && self.parent) { + var parent_1 = self.parent(); + while (parent_1 && !dispatcherArgs.isPropagationStopped()) { + parent_1.fire(name, dispatcherArgs, false); + parent_1 = parent_1.parent(); + } + } + return dispatcherArgs; + }, + on: function (name, callback, prepend) { + return getEventDispatcher(this).on(name, callback, prepend); + }, + off: function (name, callback) { + return getEventDispatcher(this).off(name, callback); + }, + once: function (name, callback) { + return getEventDispatcher(this).once(name, callback); + }, + hasEventListeners: function (name) { + return getEventDispatcher(this).has(name); + } + }; + + var DOM$8 = DOMUtils$1.DOM; + var customEventRootDelegates; + var getEventTarget = function (editor, eventName) { + if (eventName === 'selectionchange') { + return editor.getDoc(); + } + if (!editor.inline && /^mouse|touch|click|contextmenu|drop|dragover|dragend/.test(eventName)) { + return editor.getDoc().documentElement; + } + var eventRoot = getEventRoot(editor); + if (eventRoot) { + if (!editor.eventRoot) { + editor.eventRoot = DOM$8.select(eventRoot)[0]; + } + return editor.eventRoot; + } + return editor.getBody(); + }; + var isListening = function (editor) { + return !editor.hidden && !isReadOnly$1(editor); + }; + var fireEvent = function (editor, eventName, e) { + if (isListening(editor)) { + editor.fire(eventName, e); + } else if (isReadOnly$1(editor)) { + processReadonlyEvents(editor, e); + } + }; + var bindEventDelegate = function (editor, eventName) { + var delegate; + if (!editor.delegates) { + editor.delegates = {}; + } + if (editor.delegates[eventName] || editor.removed) { + return; + } + var eventRootElm = getEventTarget(editor, eventName); + if (getEventRoot(editor)) { + if (!customEventRootDelegates) { + customEventRootDelegates = {}; + editor.editorManager.on('removeEditor', function () { + if (!editor.editorManager.activeEditor) { + if (customEventRootDelegates) { + each$1(customEventRootDelegates, function (_value, name) { + editor.dom.unbind(getEventTarget(editor, name)); + }); + customEventRootDelegates = null; + } + } + }); + } + if (customEventRootDelegates[eventName]) { + return; + } + delegate = function (e) { + var target = e.target; + var editors = editor.editorManager.get(); + var i = editors.length; + while (i--) { + var body = editors[i].getBody(); + if (body === target || DOM$8.isChildOf(target, body)) { + fireEvent(editors[i], eventName, e); + } + } + }; + customEventRootDelegates[eventName] = delegate; + DOM$8.bind(eventRootElm, eventName, delegate); + } else { + delegate = function (e) { + fireEvent(editor, eventName, e); + }; + DOM$8.bind(eventRootElm, eventName, delegate); + editor.delegates[eventName] = delegate; + } + }; + var EditorObservable = __assign(__assign({}, Observable), { + bindPendingEventDelegates: function () { + var self = this; + Tools.each(self._pendingNativeEvents, function (name) { + bindEventDelegate(self, name); + }); + }, + toggleNativeEvent: function (name, state) { + var self = this; + if (name === 'focus' || name === 'blur') { + return; + } + if (state) { + if (self.initialized) { + bindEventDelegate(self, name); + } else { + if (!self._pendingNativeEvents) { + self._pendingNativeEvents = [name]; } else { - $.ajax(ajaxOpt); + self._pendingNativeEvents.push(name); } + } + } else if (self.initialized) { + self.dom.unbind(getEventTarget(self, name), name, self.delegates[name]); + delete self.delegates[name]; + } + }, + unbindAllNativeEvents: function () { + var self = this; + var body = self.getBody(); + var dom = self.dom; + if (self.delegates) { + each$1(self.delegates, function (value, name) { + self.dom.unbind(getEventTarget(self, name), name, value); + }); + delete self.delegates; } + if (!self.inline && body && dom) { + body.onload = null; + dom.unbind(self.getWin()); + dom.unbind(self.getDoc()); + } + if (dom) { + dom.unbind(body); + dom.unbind(self.getContainer()); + } + } + }); - layui.sessionData('layui-tinymce',{ - key:option.selector, - value:option - }) - return option - } + var defaultModes = [ + 'design', + 'readonly' + ]; + var switchToMode = function (editor, activeMode, availableModes, mode) { + var oldMode = availableModes[activeMode.get()]; + var newMode = availableModes[mode]; + try { + newMode.activate(); + } catch (e) { + console.error('problem while activating editor mode ' + mode + ':', e); + return; + } + oldMode.deactivate(); + if (oldMode.editorReadOnly !== newMode.editorReadOnly) { + toggleReadOnly(editor, newMode.editorReadOnly); + } + activeMode.set(mode); + fireSwitchMode(editor, mode); + }; + var setMode = function (editor, availableModes, activeMode, mode) { + if (mode === activeMode.get()) { + return; + } else if (!has(availableModes, mode)) { + throw new Error('Editor mode \'' + mode + '\' is invalid'); + } + if (editor.initialized) { + switchToMode(editor, activeMode, availableModes, mode); + } else { + editor.on('init', function () { + return switchToMode(editor, activeMode, availableModes, mode); + }); + } + }; + var registerMode = function (availableModes, mode, api) { + var _a; + if (contains(defaultModes, mode)) { + throw new Error('Cannot override default mode ' + mode); + } + return __assign(__assign({}, availableModes), (_a = {}, _a[mode] = __assign(__assign({}, api), { + deactivate: function () { + try { + api.deactivate(); + } catch (e) { + console.error('problem while deactivating editor mode ' + mode + ':', e); + } + } + }), _a)); + }; - function initTinymce() { - if (typeof tinymce == 'undefined') { - $.ajax({//获取插件 - url: settings.base_url + '/' + plugin_filename, - dataType: 'script', - cache: true, - async: false, + var create$5 = function (editor) { + var activeMode = Cell('design'); + var availableModes = Cell({ + design: { + activate: noop, + deactivate: noop, + editorReadOnly: false + }, + readonly: { + activate: noop, + deactivate: noop, + editorReadOnly: true + } + }); + registerReadOnlyContentFilters(editor); + registerReadOnlySelectionBlockers(editor); + return { + isReadOnly: function () { + return isReadOnly$1(editor); + }, + set: function (mode) { + return setMode(editor, availableModes.get(), activeMode, mode); + }, + get: function () { + return activeMode.get(); + }, + register: function (mode, api) { + availableModes.set(registerMode(availableModes.get(), mode, api)); + } + }; + }; + + var each$g = Tools.each, explode$3 = Tools.explode; + var keyCodeLookup = { + f1: 112, + f2: 113, + f3: 114, + f4: 115, + f5: 116, + f6: 117, + f7: 118, + f8: 119, + f9: 120, + f10: 121, + f11: 122, + f12: 123 + }; + var modifierNames = Tools.makeMap('alt,ctrl,shift,meta,access'); + var Shortcuts = function () { + function Shortcuts(editor) { + this.shortcuts = {}; + this.pendingPatterns = []; + this.editor = editor; + var self = this; + editor.on('keyup keypress keydown', function (e) { + if ((self.hasModifier(e) || self.isFunctionKey(e)) && !e.isDefaultPrevented()) { + each$g(self.shortcuts, function (shortcut) { + if (self.matchShortcut(e, shortcut)) { + self.pendingPatterns = shortcut.subpatterns.slice(0); + if (e.type === 'keydown') { + self.executeShortcutAction(shortcut); + } + return true; + } }); + if (self.matchShortcut(e, self.pendingPatterns[0])) { + if (self.pendingPatterns.length === 1) { + if (e.type === 'keydown') { + self.executeShortcutAction(self.pendingPatterns[0]); + } + } + self.pendingPatterns.shift(); + } + } + }); + } + Shortcuts.prototype.add = function (pattern, desc, cmdFunc, scope) { + var self = this; + var func = self.normalizeCommandFunc(cmdFunc); + each$g(explode$3(Tools.trim(pattern)), function (pattern) { + var shortcut = self.createShortcut(pattern, desc, func, scope); + self.shortcuts[shortcut.id] = shortcut; + }); + return true; + }; + Shortcuts.prototype.remove = function (pattern) { + var shortcut = this.createShortcut(pattern); + if (this.shortcuts[shortcut.id]) { + delete this.shortcuts[shortcut.id]; + return true; } - } + return false; + }; + Shortcuts.prototype.normalizeCommandFunc = function (cmdFunc) { + var self = this; + var cmd = cmdFunc; + if (typeof cmd === 'string') { + return function () { + self.editor.execCommand(cmd, false, null); + }; + } else if (Tools.isArray(cmd)) { + return function () { + self.editor.execCommand(cmd[0], cmd[1], cmd[2]); + }; + } else { + return cmd; + } + }; + Shortcuts.prototype.parseShortcut = function (pattern) { + var key; + var shortcut = {}; + each$g(explode$3(pattern.toLowerCase(), '+'), function (value) { + if (value in modifierNames) { + shortcut[value] = true; + } else { + if (/^[0-9]{2,}$/.test(value)) { + shortcut.keyCode = parseInt(value, 10); + } else { + shortcut.charCode = value.charCodeAt(0); + shortcut.keyCode = keyCodeLookup[value] || value.toUpperCase().charCodeAt(0); + } + } + }); + var id = [shortcut.keyCode]; + for (key in modifierNames) { + if (shortcut[key]) { + id.push(key); + } else { + shortcut[key] = false; + } + } + shortcut.id = id.join(','); + if (shortcut.access) { + shortcut.alt = true; + if (Env.mac) { + shortcut.ctrl = true; + } else { + shortcut.shift = true; + } + } + if (shortcut.meta) { + if (Env.mac) { + shortcut.meta = true; + } else { + shortcut.ctrl = true; + shortcut.meta = false; + } + } + return shortcut; + }; + Shortcuts.prototype.createShortcut = function (pattern, desc, cmdFunc, scope) { + var shortcuts = Tools.map(explode$3(pattern, '>'), this.parseShortcut); + shortcuts[shortcuts.length - 1] = Tools.extend(shortcuts[shortcuts.length - 1], { + func: cmdFunc, + scope: scope || this.editor + }); + return Tools.extend(shortcuts[0], { + desc: this.editor.translate(desc), + subpatterns: shortcuts.slice(1) + }); + }; + Shortcuts.prototype.hasModifier = function (e) { + return e.altKey || e.ctrlKey || e.metaKey; + }; + Shortcuts.prototype.isFunctionKey = function (e) { + return e.type === 'keydown' && e.keyCode >= 112 && e.keyCode <= 123; + }; + Shortcuts.prototype.matchShortcut = function (e, shortcut) { + if (!shortcut) { + return false; + } + if (shortcut.ctrl !== e.ctrlKey || shortcut.meta !== e.metaKey) { + return false; + } + if (shortcut.alt !== e.altKey || shortcut.shift !== e.shiftKey) { + return false; + } + if (e.keyCode === shortcut.keyCode || e.charCode && e.charCode === shortcut.charCode) { + e.preventDefault(); + return true; + } + return false; + }; + Shortcuts.prototype.executeShortcutAction = function (shortcut) { + return shortcut.func ? shortcut.func.call(shortcut.scope) : null; + }; + return Shortcuts; + }(); - function isset(value) { - return typeof value !== 'undefined' && value !== null - } + var create$6 = function () { + var buttons = {}; + var menuItems = {}; + var popups = {}; + var icons = {}; + var contextMenus = {}; + var contextToolbars = {}; + var sidebars = {}; + var add = function (collection, type) { + return function (name, spec) { + return collection[name.toLowerCase()] = __assign(__assign({}, spec), { type: type }); + }; + }; + var addIcon = function (name, svgData) { + return icons[name.toLowerCase()] = svgData; + }; + return { + addButton: add(buttons, 'button'), + addGroupToolbarButton: add(buttons, 'grouptoolbarbutton'), + addToggleButton: add(buttons, 'togglebutton'), + addMenuButton: add(buttons, 'menubutton'), + addSplitButton: add(buttons, 'splitbutton'), + addMenuItem: add(menuItems, 'menuitem'), + addNestedMenuItem: add(menuItems, 'nestedmenuitem'), + addToggleMenuItem: add(menuItems, 'togglemenuitem'), + addAutocompleter: add(popups, 'autocompleter'), + addContextMenu: add(contextMenus, 'contextmenu'), + addContextToolbar: add(contextToolbars, 'contexttoolbar'), + addContextForm: add(contextToolbars, 'contextform'), + addSidebar: add(sidebars, 'sidebar'), + addIcon: addIcon, + getAll: function () { + return { + buttons: buttons, + menuItems: menuItems, + icons: icons, + popups: popups, + contextMenus: contextMenus, + contextToolbars: contextToolbars, + sidebars: sidebars + }; + } + }; + }; + + var registry = function () { + var bridge = create$6(); + return { + addAutocompleter: bridge.addAutocompleter, + addButton: bridge.addButton, + addContextForm: bridge.addContextForm, + addContextMenu: bridge.addContextMenu, + addContextToolbar: bridge.addContextToolbar, + addIcon: bridge.addIcon, + addMenuButton: bridge.addMenuButton, + addMenuItem: bridge.addMenuItem, + addNestedMenuItem: bridge.addNestedMenuItem, + addSidebar: bridge.addSidebar, + addSplitButton: bridge.addSplitButton, + addToggleButton: bridge.addToggleButton, + addGroupToolbarButton: bridge.addGroupToolbarButton, + addToggleMenuItem: bridge.addToggleMenuItem, + getAll: bridge.getAll + }; + }; + + var each$h = Tools.each, trim$4 = Tools.trim; + var queryParts = 'source protocol authority userInfo user password host port relative path directory file query anchor'.split(' '); + var DEFAULT_PORTS = { + ftp: 21, + http: 80, + https: 443, + mailto: 25 + }; + var URI = function () { + function URI(url, settings) { + url = trim$4(url); + this.settings = settings || {}; + var baseUri = this.settings.base_uri; + var self = this; + if (/^([\w\-]+):([^\/]{2})/i.test(url) || /^\s*#/.test(url)) { + self.source = url; + return; + } + var isProtocolRelative = url.indexOf('//') === 0; + if (url.indexOf('/') === 0 && !isProtocolRelative) { + url = (baseUri ? baseUri.protocol || 'http' : 'http') + '://mce_host' + url; + } + if (!/^[\w\-]*:?\/\//.test(url)) { + var baseUrl = this.settings.base_uri ? this.settings.base_uri.path : new URI(document.location.href).directory; + if (this.settings.base_uri && this.settings.base_uri.protocol == '') { + url = '//mce_host' + self.toAbsPath(baseUrl, url); + } else { + var match = /([^#?]*)([#?]?.*)/.exec(url); + url = (baseUri && baseUri.protocol || 'http') + '://mce_host' + self.toAbsPath(baseUrl, match[1]) + match[2]; + } + } + url = url.replace(/@@/g, '(mce_at)'); + var urlMatch = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(url); + each$h(queryParts, function (v, i) { + var part = urlMatch[i]; + if (part) { + part = part.replace(/\(mce_at\)/g, '@@'); + } + self[v] = part; + }); + if (baseUri) { + if (!self.protocol) { + self.protocol = baseUri.protocol; + } + if (!self.userInfo) { + self.userInfo = baseUri.userInfo; + } + if (!self.port && self.host === 'mce_host') { + self.port = baseUri.port; + } + if (!self.host || self.host === 'mce_host') { + self.host = baseUri.host; + } + self.source = ''; + } + if (isProtocolRelative) { + self.protocol = ''; + } + } + URI.parseDataUri = function (uri) { + var type; + var uriComponents = decodeURIComponent(uri).split(','); + var matches = /data:([^;]+)/.exec(uriComponents[0]); + if (matches) { + type = matches[1]; + } + return { + type: type, + data: uriComponents[1] + }; + }; + URI.getDocumentBaseUrl = function (loc) { + var baseUrl; + if (loc.protocol.indexOf('http') !== 0 && loc.protocol !== 'file:') { + baseUrl = loc.href; + } else { + baseUrl = loc.protocol + '//' + loc.host + loc.pathname; + } + if (/^[^:]+:\/\/\/?[^\/]+\//.test(baseUrl)) { + baseUrl = baseUrl.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, ''); + if (!/[\/\\]$/.test(baseUrl)) { + baseUrl += '/'; + } + } + return baseUrl; + }; + URI.prototype.setPath = function (path) { + var pathMatch = /^(.*?)\/?(\w+)?$/.exec(path); + this.path = pathMatch[0]; + this.directory = pathMatch[1]; + this.file = pathMatch[2]; + this.source = ''; + this.getURI(); + }; + URI.prototype.toRelative = function (uri) { + var output; + if (uri === './') { + return uri; + } + var relativeUri = new URI(uri, { base_uri: this }); + if (relativeUri.host !== 'mce_host' && this.host !== relativeUri.host && relativeUri.host || this.port !== relativeUri.port || this.protocol !== relativeUri.protocol && relativeUri.protocol !== '') { + return relativeUri.getURI(); + } + var tu = this.getURI(), uu = relativeUri.getURI(); + if (tu === uu || tu.charAt(tu.length - 1) === '/' && tu.substr(0, tu.length - 1) === uu) { + return tu; + } + output = this.toRelPath(this.path, relativeUri.path); + if (relativeUri.query) { + output += '?' + relativeUri.query; + } + if (relativeUri.anchor) { + output += '#' + relativeUri.anchor; + } + return output; + }; + URI.prototype.toAbsolute = function (uri, noHost) { + var absoluteUri = new URI(uri, { base_uri: this }); + return absoluteUri.getURI(noHost && this.isSameOrigin(absoluteUri)); + }; + URI.prototype.isSameOrigin = function (uri) { + if (this.host == uri.host && this.protocol == uri.protocol) { + if (this.port == uri.port) { + return true; + } + var defaultPort = DEFAULT_PORTS[this.protocol]; + if (defaultPort && (this.port || defaultPort) == (uri.port || defaultPort)) { + return true; + } + } + return false; + }; + URI.prototype.toRelPath = function (base, path) { + var breakPoint = 0, out = '', i, l; + var normalizedBase = base.substring(0, base.lastIndexOf('/')).split('/'); + var items = path.split('/'); + if (normalizedBase.length >= items.length) { + for (i = 0, l = normalizedBase.length; i < l; i++) { + if (i >= items.length || normalizedBase[i] !== items[i]) { + breakPoint = i + 1; + break; + } + } + } + if (normalizedBase.length < items.length) { + for (i = 0, l = items.length; i < l; i++) { + if (i >= normalizedBase.length || normalizedBase[i] !== items[i]) { + breakPoint = i + 1; + break; + } + } + } + if (breakPoint === 1) { + return path; + } + for (i = 0, l = normalizedBase.length - (breakPoint - 1); i < l; i++) { + out += '../'; + } + for (i = breakPoint - 1, l = items.length; i < l; i++) { + if (i !== breakPoint - 1) { + out += '/' + items[i]; + } else { + out += items[i]; + } + } + return out; + }; + URI.prototype.toAbsPath = function (base, path) { + var i, nb = 0, o = [], outPath; + var tr = /\/$/.test(path) ? '/' : ''; + var normalizedBase = base.split('/'); + var normalizedPath = path.split('/'); + each$h(normalizedBase, function (k) { + if (k) { + o.push(k); + } + }); + normalizedBase = o; + for (i = normalizedPath.length - 1, o = []; i >= 0; i--) { + if (normalizedPath[i].length === 0 || normalizedPath[i] === '.') { + continue; + } + if (normalizedPath[i] === '..') { + nb++; + continue; + } + if (nb > 0) { + nb--; + continue; + } + o.push(normalizedPath[i]); + } + i = normalizedBase.length - nb; + if (i <= 0) { + outPath = reverse(o).join('/'); + } else { + outPath = normalizedBase.slice(0, i).join('/') + '/' + reverse(o).join('/'); + } + if (outPath.indexOf('/') !== 0) { + outPath = '/' + outPath; + } + if (tr && outPath.lastIndexOf('/') !== outPath.length - 1) { + outPath += tr; + } + return outPath; + }; + URI.prototype.getURI = function (noProtoHost) { + if (noProtoHost === void 0) { + noProtoHost = false; + } + var s; + if (!this.source || noProtoHost) { + s = ''; + if (!noProtoHost) { + if (this.protocol) { + s += this.protocol + '://'; + } else { + s += '//'; + } + if (this.userInfo) { + s += this.userInfo + '@'; + } + if (this.host) { + s += this.host; + } + if (this.port) { + s += ':' + this.port; + } + } + if (this.path) { + s += this.path; + } + if (this.query) { + s += '?' + this.query; + } + if (this.anchor) { + s += '#' + this.anchor; + } + this.source = s; + } + return this.source; + }; + return URI; + }(); + + var DOM$9 = DOMUtils$1.DOM; + var extend$3 = Tools.extend, each$i = Tools.each; + var resolve$3 = Tools.resolve; + var ie$1 = Env.ie; + var Editor = function () { + function Editor(id, settings, editorManager) { + var _this = this; + this.plugins = {}; + this.contentCSS = []; + this.contentStyles = []; + this.loadedCSS = {}; + this.isNotDirty = false; + this.editorManager = editorManager; + this.documentBaseUrl = editorManager.documentBaseURL; + extend$3(this, EditorObservable); + this.settings = getEditorSettings(this, id, this.documentBaseUrl, editorManager.defaultSettings, settings); + if (this.settings.suffix) { + editorManager.suffix = this.settings.suffix; + } + this.suffix = editorManager.suffix; + if (this.settings.base_url) { + editorManager._setBaseUrl(this.settings.base_url); + } + this.baseUri = editorManager.baseURI; + if (this.settings.referrer_policy) { + ScriptLoader.ScriptLoader._setReferrerPolicy(this.settings.referrer_policy); + DOMUtils$1.DOM.styleSheetLoader._setReferrerPolicy(this.settings.referrer_policy); + } + AddOnManager$1.languageLoad = this.settings.language_load; + AddOnManager$1.baseURL = editorManager.baseURL; + this.id = id; + this.setDirty(false); + this.documentBaseURI = new URI(this.settings.document_base_url, { base_uri: this.baseUri }); + this.baseURI = this.baseUri; + this.inline = !!this.settings.inline; + this.shortcuts = new Shortcuts(this); + this.editorCommands = new EditorCommands(this); + if (this.settings.cache_suffix) { + Env.cacheSuffix = this.settings.cache_suffix.replace(/^[\?\&]+/, ''); + } + this.ui = { + registry: registry(), + styleSheetLoader: undefined, + show: noop, + hide: noop, + enable: noop, + disable: noop, + isDisabled: never + }; + var self = this; + var modeInstance = create$5(self); + this.mode = modeInstance; + this.setMode = modeInstance.set; + editorManager.fire('SetupEditor', { editor: this }); + this.execCallback('setup', this); + this.$ = DomQuery.overrideDefaults(function () { + return { + context: _this.inline ? _this.getBody() : _this.getDoc(), + element: _this.getBody() + }; + }); + } + Editor.prototype.render = function () { + render(this); + }; + Editor.prototype.focus = function (skipFocus) { + focus$1(this, skipFocus); + }; + Editor.prototype.hasFocus = function () { + return hasFocus$1(this); + }; + Editor.prototype.execCallback = function (name) { + var x = []; + for (var _i = 1; _i < arguments.length; _i++) { + x[_i - 1] = arguments[_i]; + } + var self = this; + var callback = self.settings[name], scope; + if (!callback) { + return; + } + if (self.callbackLookup && (scope = self.callbackLookup[name])) { + callback = scope.func; + scope = scope.scope; + } + if (typeof callback === 'string') { + scope = callback.replace(/\.\w+$/, ''); + scope = scope ? resolve$3(scope) : 0; + callback = resolve$3(callback); + self.callbackLookup = self.callbackLookup || {}; + self.callbackLookup[name] = { + func: callback, + scope: scope + }; + } + return callback.apply(scope || self, x); + }; + Editor.prototype.translate = function (text) { + return I18n.translate(text); + }; + Editor.prototype.getParam = function (name, defaultVal, type) { + return getParam(this, name, defaultVal, type); + }; + Editor.prototype.hasPlugin = function (name, loaded) { + var hasPlugin = contains(getPlugins(this).split(/[ ,]/), name); + if (hasPlugin) { + return loaded ? PluginManager.get(name) !== undefined : true; + } else { + return false; + } + }; + Editor.prototype.nodeChanged = function (args) { + this._nodeChangeDispatcher.nodeChanged(args); + }; + Editor.prototype.addCommand = function (name, callback, scope) { + this.editorCommands.addCommand(name, callback, scope); + }; + Editor.prototype.addQueryStateHandler = function (name, callback, scope) { + this.editorCommands.addQueryStateHandler(name, callback, scope); + }; + Editor.prototype.addQueryValueHandler = function (name, callback, scope) { + this.editorCommands.addQueryValueHandler(name, callback, scope); + }; + Editor.prototype.addShortcut = function (pattern, desc, cmdFunc, scope) { + this.shortcuts.add(pattern, desc, cmdFunc, scope); + }; + Editor.prototype.execCommand = function (cmd, ui, value, args) { + return this.editorCommands.execCommand(cmd, ui, value, args); + }; + Editor.prototype.queryCommandState = function (cmd) { + return this.editorCommands.queryCommandState(cmd); + }; + Editor.prototype.queryCommandValue = function (cmd) { + return this.editorCommands.queryCommandValue(cmd); + }; + Editor.prototype.queryCommandSupported = function (cmd) { + return this.editorCommands.queryCommandSupported(cmd); + }; + Editor.prototype.show = function () { + var self = this; + if (self.hidden) { + self.hidden = false; + if (self.inline) { + self.getBody().contentEditable = 'true'; + } else { + DOM$9.show(self.getContainer()); + DOM$9.hide(self.id); + } + self.load(); + self.fire('show'); + } + }; + Editor.prototype.hide = function () { + var self = this, doc = self.getDoc(); + if (!self.hidden) { + if (ie$1 && doc && !self.inline) { + doc.execCommand('SelectAll'); + } + self.save(); + if (self.inline) { + self.getBody().contentEditable = 'false'; + if (self === self.editorManager.focusedEditor) { + self.editorManager.focusedEditor = null; + } + } else { + DOM$9.hide(self.getContainer()); + DOM$9.setStyle(self.id, 'display', self.orgDisplay); + } + self.hidden = true; + self.fire('hide'); + } + }; + Editor.prototype.isHidden = function () { + return !!this.hidden; + }; + Editor.prototype.setProgressState = function (state, time) { + this.fire('ProgressState', { + state: state, + time: time + }); + }; + Editor.prototype.load = function (args) { + var self = this; + var elm = self.getElement(), html; + if (self.removed) { + return ''; + } + if (elm) { + args = args || {}; + args.load = true; + var value = isTextareaOrInput(elm) ? elm.value : elm.innerHTML; + html = self.setContent(value, args); + args.element = elm; + if (!args.no_events) { + self.fire('LoadContent', args); + } + args.element = elm = null; + return html; + } + }; + Editor.prototype.save = function (args) { + var self = this; + var elm = self.getElement(), html, form; + if (!elm || !self.initialized || self.removed) { + return; + } + args = args || {}; + args.save = true; + args.element = elm; + html = args.content = self.getContent(args); + if (!args.no_events) { + self.fire('SaveContent', args); + } + if (args.format === 'raw') { + self.fire('RawSaveContent', args); + } + html = args.content; + if (!isTextareaOrInput(elm)) { + if (args.is_removing || !self.inline) { + elm.innerHTML = html; + } + if (form = DOM$9.getParent(self.id, 'form')) { + each$i(form.elements, function (elm) { + if (elm.name === self.id) { + elm.value = html; + return false; + } + }); + } + } else { + elm.value = html; + } + args.element = elm = null; + if (args.set_dirty !== false) { + self.setDirty(false); + } + return html; + }; + Editor.prototype.setContent = function (content, args) { + return setContent$2(this, content, args); + }; + Editor.prototype.getContent = function (args) { + return getContent$2(this, args); + }; + Editor.prototype.insertContent = function (content, args) { + if (args) { + content = extend$3({ content: content }, args); + } + this.execCommand('mceInsertContent', false, content); + }; + Editor.prototype.resetContent = function (initialContent) { + if (initialContent === undefined) { + setContent$2(this, this.startContent, { format: 'raw' }); + } else { + setContent$2(this, initialContent); + } + this.undoManager.reset(); + this.setDirty(false); + this.nodeChanged(); + }; + Editor.prototype.isDirty = function () { + return !this.isNotDirty; + }; + Editor.prototype.setDirty = function (state) { + var oldState = !this.isNotDirty; + this.isNotDirty = !state; + if (state && state !== oldState) { + this.fire('dirty'); + } + }; + Editor.prototype.getContainer = function () { + var self = this; + if (!self.container) { + self.container = DOM$9.get(self.editorContainer || self.id + '_parent'); + } + return self.container; + }; + Editor.prototype.getContentAreaContainer = function () { + return this.contentAreaContainer; + }; + Editor.prototype.getElement = function () { + if (!this.targetElm) { + this.targetElm = DOM$9.get(this.id); + } + return this.targetElm; + }; + Editor.prototype.getWin = function () { + var self = this; + var elm; + if (!self.contentWindow) { + elm = self.iframeElement; + if (elm) { + self.contentWindow = elm.contentWindow; + } + } + return self.contentWindow; + }; + Editor.prototype.getDoc = function () { + var self = this; + var win; + if (!self.contentDocument) { + win = self.getWin(); + if (win) { + self.contentDocument = win.document; + } + } + return self.contentDocument; + }; + Editor.prototype.getBody = function () { + var doc = this.getDoc(); + return this.bodyElement || (doc ? doc.body : null); + }; + Editor.prototype.convertURL = function (url, name, elm) { + var self = this, settings = self.settings; + if (settings.urlconverter_callback) { + return self.execCallback('urlconverter_callback', url, elm, true, name); + } + if (!settings.convert_urls || elm && elm.nodeName === 'LINK' || url.indexOf('file:') === 0 || url.length === 0) { + return url; + } + if (settings.relative_urls) { + return self.documentBaseURI.toRelative(url); + } + url = self.documentBaseURI.toAbsolute(url, settings.remove_script_host); + return url; + }; + Editor.prototype.addVisual = function (elm) { + addVisual$1(this, elm); + }; + Editor.prototype.remove = function () { + remove$7(this); + }; + Editor.prototype.destroy = function (automatic) { + destroy(this, automatic); + }; + Editor.prototype.uploadImages = function (callback) { + return this.editorUpload.uploadImages(callback); + }; + Editor.prototype._scanForImages = function () { + return this.editorUpload.scanForImages(); + }; + Editor.prototype.addButton = function () { + throw new Error('editor.addButton has been removed in tinymce 5x, use editor.ui.registry.addButton or editor.ui.registry.addToggleButton or editor.ui.registry.addSplitButton instead'); + }; + Editor.prototype.addSidebar = function () { + throw new Error('editor.addSidebar has been removed in tinymce 5x, use editor.ui.registry.addSidebar instead'); + }; + Editor.prototype.addMenuItem = function () { + throw new Error('editor.addMenuItem has been removed in tinymce 5x, use editor.ui.registry.addMenuItem instead'); + }; + Editor.prototype.addContextToolbar = function () { + throw new Error('editor.addContextToolbar has been removed in tinymce 5x, use editor.ui.registry.addContextToolbar instead'); + }; + return Editor; + }(); + + var DOM$a = DOMUtils$1.DOM; + var explode$4 = Tools.explode, each$j = Tools.each, extend$4 = Tools.extend; + var instanceCounter = 0, boundGlobalEvents = false; + var beforeUnloadDelegate; + var legacyEditors = []; + var editors = []; + var isValidLegacyKey = function (id) { + return id !== 'length'; + }; + var globalEventDelegate = function (e) { + var type = e.type; + each$j(EditorManager.get(), function (editor) { + switch (type) { + case 'scroll': + editor.fire('ScrollWindow', e); + break; + case 'resize': + editor.fire('ResizeWindow', e); + break; + } + }); + }; + var toggleGlobalEvents = function (state) { + if (state !== boundGlobalEvents) { + if (state) { + DomQuery(window).on('resize scroll', globalEventDelegate); + } else { + DomQuery(window).off('resize scroll', globalEventDelegate); + } + boundGlobalEvents = state; + } + }; + var removeEditorFromList = function (targetEditor) { + var oldEditors = editors; + delete legacyEditors[targetEditor.id]; + for (var i = 0; i < legacyEditors.length; i++) { + if (legacyEditors[i] === targetEditor) { + legacyEditors.splice(i, 1); + break; + } + } + editors = filter(editors, function (editor) { + return targetEditor !== editor; + }); + if (EditorManager.activeEditor === targetEditor) { + EditorManager.activeEditor = editors.length > 0 ? editors[0] : null; + } + if (EditorManager.focusedEditor === targetEditor) { + EditorManager.focusedEditor = null; + } + return oldEditors.length !== editors.length; + }; + var purgeDestroyedEditor = function (editor) { + if (editor && editor.initialized && !(editor.getContainer() || editor.getBody()).parentNode) { + removeEditorFromList(editor); + editor.unbindAllNativeEvents(); + editor.destroy(true); + editor.removed = true; + editor = null; + } + return editor; + }; + var isQuirksMode = document.compatMode !== 'CSS1Compat'; + var EditorManager = __assign(__assign({}, Observable), { + baseURI: null, + baseURL: null, + defaultSettings: {}, + documentBaseURL: null, + suffix: null, + $: DomQuery, + majorVersion: '5', + minorVersion: '6.2', + releaseDate: '2020-12-08', + editors: legacyEditors, + i18n: I18n, + activeEditor: null, + focusedEditor: null, + settings: {}, + setup: function () { + var self = this; + var baseURL, documentBaseURL, suffix = ''; + documentBaseURL = URI.getDocumentBaseUrl(document.location); + if (/^[^:]+:\/\/\/?[^\/]+\//.test(documentBaseURL)) { + documentBaseURL = documentBaseURL.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, ''); + if (!/[\/\\]$/.test(documentBaseURL)) { + documentBaseURL += '/'; + } + } + var preInit = window.tinymce || window.tinyMCEPreInit; + if (preInit) { + baseURL = preInit.base || preInit.baseURL; + suffix = preInit.suffix; + } else { + var scripts = document.getElementsByTagName('script'); + for (var i = 0; i < scripts.length; i++) { + var src = scripts[i].src || ''; + if (src === '') { + continue; + } + var srcScript = src.substring(src.lastIndexOf('/')); + if (/tinymce(\.full|\.jquery|)(\.min|\.dev|)\.js/.test(src)) { + if (srcScript.indexOf('.min') !== -1) { + suffix = '.min'; + } + baseURL = src.substring(0, src.lastIndexOf('/')); + break; + } + } + if (!baseURL && document.currentScript) { + var src = document.currentScript.src; + if (src.indexOf('.min') !== -1) { + suffix = '.min'; + } + baseURL = src.substring(0, src.lastIndexOf('/')); + } + } + self.baseURL = new URI(documentBaseURL).toAbsolute(baseURL); + self.documentBaseURL = documentBaseURL; + self.baseURI = new URI(self.baseURL); + self.suffix = suffix; + setup$2(self); + }, + overrideDefaults: function (defaultSettings) { + var baseUrl = defaultSettings.base_url; + if (baseUrl) { + this._setBaseUrl(baseUrl); + } + var suffix = defaultSettings.suffix; + if (defaultSettings.suffix) { + this.suffix = suffix; + } + this.defaultSettings = defaultSettings; + var pluginBaseUrls = defaultSettings.plugin_base_urls; + if (pluginBaseUrls !== undefined) { + each$1(pluginBaseUrls, function (pluginBaseUrl, pluginName) { + AddOnManager$1.PluginManager.urls[pluginName] = pluginBaseUrl; + }); + } + }, + init: function (settings) { + var self = this; + var result; + var invalidInlineTargets = Tools.makeMap('area base basefont br col frame hr img input isindex link meta param embed source wbr track ' + 'colgroup option table tbody tfoot thead tr th td script noscript style textarea video audio iframe object menu', ' '); + var isInvalidInlineTarget = function (settings, elm) { + return settings.inline && elm.tagName.toLowerCase() in invalidInlineTargets; + }; + var createId = function (elm) { + var id = elm.id; + if (!id) { + id = get$1(elm, 'name').filter(function (name) { + return !DOM$a.get(name); + }).getOrThunk(DOM$a.uniqueId); + elm.setAttribute('id', id); + } + return id; + }; + var execCallback = function (name) { + var callback = settings[name]; + if (!callback) { + return; + } + return callback.apply(self, Array.prototype.slice.call(arguments, 2)); + }; + var hasClass = function (elm, className) { + return className.constructor === RegExp ? className.test(elm.className) : DOM$a.hasClass(elm, className); + }; + var findTargets = function (settings) { + var targets = []; + if (Env.browser.isIE() && Env.browser.version.major < 11) { + initError('TinyMCE does not support the browser you are using. For a list of supported' + ' browsers please see: https://www.tinymce.com/docs/get-started/system-requirements/'); + return []; + } else if (isQuirksMode) { + initError('Failed to initialize the editor as the document is not in standards mode. ' + 'TinyMCE requires standards mode.'); + return []; + } + if (settings.types) { + each$j(settings.types, function (type) { + targets = targets.concat(DOM$a.select(type.selector)); + }); + return targets; + } else if (settings.selector) { + return DOM$a.select(settings.selector); + } else if (settings.target) { + return [settings.target]; + } + switch (settings.mode) { + case 'exact': + var l = settings.elements || ''; + if (l.length > 0) { + each$j(explode$4(l), function (id) { + var elm = DOM$a.get(id); + if (elm) { + targets.push(elm); + } else { + each$j(document.forms, function (f) { + each$j(f.elements, function (e) { + if (e.name === id) { + id = 'mce_editor_' + instanceCounter++; + DOM$a.setAttrib(e, 'id', id); + targets.push(e); + } + }); + }); + } + }); + } + break; + case 'textareas': + case 'specific_textareas': + each$j(DOM$a.select('textarea'), function (elm) { + if (settings.editor_deselector && hasClass(elm, settings.editor_deselector)) { + return; + } + if (!settings.editor_selector || hasClass(elm, settings.editor_selector)) { + targets.push(elm); + } + }); + break; + } + return targets; + }; + var provideResults = function (editors) { + result = editors; + }; + var initEditors = function () { + var initCount = 0; + var editors = []; + var targets; + var createEditor = function (id, settings, targetElm) { + var editor = new Editor(id, settings, self); + editors.push(editor); + editor.on('init', function () { + if (++initCount === targets.length) { + provideResults(editors); + } + }); + editor.targetElm = editor.targetElm || targetElm; + editor.render(); + }; + DOM$a.unbind(window, 'ready', initEditors); + execCallback('onpageload'); + targets = DomQuery.unique(findTargets(settings)); + if (settings.types) { + each$j(settings.types, function (type) { + Tools.each(targets, function (elm) { + if (DOM$a.is(elm, type.selector)) { + createEditor(createId(elm), extend$4({}, settings, type), elm); + return false; + } + return true; + }); + }); + return; + } + Tools.each(targets, function (elm) { + purgeDestroyedEditor(self.get(elm.id)); + }); + targets = Tools.grep(targets, function (elm) { + return !self.get(elm.id); + }); + if (targets.length === 0) { + provideResults([]); + } else { + each$j(targets, function (elm) { + if (isInvalidInlineTarget(settings, elm)) { + initError('Could not initialize inline editor on invalid inline target element', elm); + } else { + createEditor(createId(elm), settings, elm); + } + }); + } + }; + self.settings = settings; + DOM$a.bind(window, 'ready', initEditors); + return new promiseObj(function (resolve) { + if (result) { + resolve(result); + } else { + provideResults = function (editors) { + resolve(editors); + }; + } + }); + }, + get: function (id) { + if (arguments.length === 0) { + return editors.slice(0); + } else if (isString(id)) { + return find(editors, function (editor) { + return editor.id === id; + }).getOr(null); + } else if (isNumber(id)) { + return editors[id] ? editors[id] : null; + } else { + return null; + } + }, + add: function (editor) { + var self = this; + var existingEditor = legacyEditors[editor.id]; + if (existingEditor === editor) { + return editor; + } + if (self.get(editor.id) === null) { + if (isValidLegacyKey(editor.id)) { + legacyEditors[editor.id] = editor; + } + legacyEditors.push(editor); + editors.push(editor); + } + toggleGlobalEvents(true); + self.activeEditor = editor; + self.fire('AddEditor', { editor: editor }); + if (!beforeUnloadDelegate) { + beforeUnloadDelegate = function (e) { + var event = self.fire('BeforeUnload'); + if (event.returnValue) { + e.preventDefault(); + e.returnValue = event.returnValue; + return event.returnValue; + } + }; + window.addEventListener('beforeunload', beforeUnloadDelegate); + } + return editor; + }, + createEditor: function (id, settings) { + return this.add(new Editor(id, settings, this)); + }, + remove: function (selector) { + var self = this; + var i, editor; + if (!selector) { + for (i = editors.length - 1; i >= 0; i--) { + self.remove(editors[i]); + } + return; + } + if (isString(selector)) { + each$j(DOM$a.select(selector), function (elm) { + editor = self.get(elm.id); + if (editor) { + self.remove(editor); + } + }); + return; + } + editor = selector; + if (isNull(self.get(editor.id))) { + return null; + } + if (removeEditorFromList(editor)) { + self.fire('RemoveEditor', { editor: editor }); + } + if (editors.length === 0) { + window.removeEventListener('beforeunload', beforeUnloadDelegate); + } + editor.remove(); + toggleGlobalEvents(editors.length > 0); + return editor; + }, + execCommand: function (cmd, ui, value) { + var self = this, editor = self.get(value); + switch (cmd) { + case 'mceAddEditor': + if (!self.get(value)) { + new Editor(value, self.settings, self).render(); + } + return true; + case 'mceRemoveEditor': + if (editor) { + editor.remove(); + } + return true; + case 'mceToggleEditor': + if (!editor) { + self.execCommand('mceAddEditor', 0, value); + return true; + } + if (editor.isHidden()) { + editor.show(); + } else { + editor.hide(); + } + return true; + } + if (self.activeEditor) { + return self.activeEditor.execCommand(cmd, ui, value); + } + return false; + }, + triggerSave: function () { + each$j(editors, function (editor) { + editor.save(); + }); + }, + addI18n: function (code, items) { + I18n.add(code, items); + }, + translate: function (text) { + return I18n.translate(text); + }, + setActive: function (editor) { + var activeEditor = this.activeEditor; + if (this.activeEditor !== editor) { + if (activeEditor) { + activeEditor.fire('deactivate', { relatedTarget: editor }); + } + editor.fire('activate', { relatedTarget: activeEditor }); + } + this.activeEditor = editor; + }, + _setBaseUrl: function (baseUrl) { + this.baseURL = new URI(this.documentBaseURL).toAbsolute(baseUrl.replace(/\/+$/, '')); + this.baseURI = new URI(this.baseURL); + } + }); + EditorManager.setup(); + + var min = Math.min, max = Math.max, round$1 = Math.round; + var relativePosition = function (rect, targetRect, rel) { + var x = targetRect.x; + var y = targetRect.y; + var w = rect.w; + var h = rect.h; + var targetW = targetRect.w; + var targetH = targetRect.h; + var relChars = (rel || '').split(''); + if (relChars[0] === 'b') { + y += targetH; + } + if (relChars[1] === 'r') { + x += targetW; + } + if (relChars[0] === 'c') { + y += round$1(targetH / 2); + } + if (relChars[1] === 'c') { + x += round$1(targetW / 2); + } + if (relChars[3] === 'b') { + y -= h; + } + if (relChars[4] === 'r') { + x -= w; + } + if (relChars[3] === 'c') { + y -= round$1(h / 2); + } + if (relChars[4] === 'c') { + x -= round$1(w / 2); + } + return create$7(x, y, w, h); + }; + var findBestRelativePosition = function (rect, targetRect, constrainRect, rels) { + var pos, i; + for (i = 0; i < rels.length; i++) { + pos = relativePosition(rect, targetRect, rels[i]); + if (pos.x >= constrainRect.x && pos.x + pos.w <= constrainRect.w + constrainRect.x && pos.y >= constrainRect.y && pos.y + pos.h <= constrainRect.h + constrainRect.y) { + return rels[i]; + } + } + return null; + }; + var inflate = function (rect, w, h) { + return create$7(rect.x - w, rect.y - h, rect.w + w * 2, rect.h + h * 2); + }; + var intersect = function (rect, cropRect) { + var x1 = max(rect.x, cropRect.x); + var y1 = max(rect.y, cropRect.y); + var x2 = min(rect.x + rect.w, cropRect.x + cropRect.w); + var y2 = min(rect.y + rect.h, cropRect.y + cropRect.h); + if (x2 - x1 < 0 || y2 - y1 < 0) { + return null; + } + return create$7(x1, y1, x2 - x1, y2 - y1); + }; + var clamp$1 = function (rect, clampRect, fixedSize) { + var x1 = rect.x; + var y1 = rect.y; + var x2 = rect.x + rect.w; + var y2 = rect.y + rect.h; + var cx2 = clampRect.x + clampRect.w; + var cy2 = clampRect.y + clampRect.h; + var underflowX1 = max(0, clampRect.x - x1); + var underflowY1 = max(0, clampRect.y - y1); + var overflowX2 = max(0, x2 - cx2); + var overflowY2 = max(0, y2 - cy2); + x1 += underflowX1; + y1 += underflowY1; + if (fixedSize) { + x2 += underflowX1; + y2 += underflowY1; + x1 -= overflowX2; + y1 -= overflowY2; + } + x2 -= overflowX2; + y2 -= overflowY2; + return create$7(x1, y1, x2 - x1, y2 - y1); + }; + var create$7 = function (x, y, w, h) { + return { + x: x, + y: y, + w: w, + h: h + }; + }; + var fromClientRect = function (clientRect) { + return create$7(clientRect.left, clientRect.top, clientRect.width, clientRect.height); + }; + var Rect = { + inflate: inflate, + relativePosition: relativePosition, + findBestRelativePosition: findBestRelativePosition, + intersect: intersect, + clamp: clamp$1, + create: create$7, + fromClientRect: fromClientRect + }; + + var awaiter = function (resolveCb, rejectCb, timeout) { + if (timeout === void 0) { + timeout = 1000; + } + var done = false; + var timer = null; + var complete = function (completer) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (!done) { + done = true; + if (timer !== null) { + clearTimeout(timer); + timer = null; + } + completer.apply(null, args); + } + }; + }; + var resolve = complete(resolveCb); + var reject = complete(rejectCb); + var start = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (!done && timer === null) { + timer = setTimeout(function () { + return reject.apply(null, args); + }, timeout); + } + }; + return { + start: start, + resolve: resolve, + reject: reject + }; + }; + var create$8 = function () { + var tasks = {}; + var resultFns = {}; + var load = function (id, url) { + var loadErrMsg = 'Script at URL "' + url + '" failed to load'; + var runErrMsg = 'Script at URL "' + url + '" did not call `tinymce.Resource.add(\'' + id + '\', data)` within 1 second'; + if (tasks[id] !== undefined) { + return tasks[id]; + } else { + var task = new promiseObj(function (resolve, reject) { + var waiter = awaiter(resolve, reject); + resultFns[id] = waiter.resolve; + ScriptLoader.ScriptLoader.loadScript(url, function () { + return waiter.start(runErrMsg); + }, function () { + return waiter.reject(loadErrMsg); + }); + }); + tasks[id] = task; + return task; + } + }; + var add = function (id, data) { + if (resultFns[id] !== undefined) { + resultFns[id](data); + delete resultFns[id]; + } + tasks[id] = promiseObj.resolve(data); + }; + return { + load: load, + add: add + }; + }; + var Resource = create$8(); + + var each$k = Tools.each, extend$5 = Tools.extend; + var extendClass, initializing; + var Class = function () { + }; + Class.extend = extendClass = function (props) { + var self = this; + var _super = self.prototype; + var Class = function () { + var i, mixins, mixin; + var self = this; + if (!initializing) { + if (self.init) { + self.init.apply(self, arguments); + } + mixins = self.Mixins; + if (mixins) { + i = mixins.length; + while (i--) { + mixin = mixins[i]; + if (mixin.init) { + mixin.init.apply(self, arguments); + } + } + } + } + }; + var dummy = function () { + return this; + }; + var createMethod = function (name, fn) { + return function () { + var self = this; + var tmp = self._super; + self._super = _super[name]; + var ret = fn.apply(self, arguments); + self._super = tmp; + return ret; + }; + }; + initializing = true; + var prototype = new self(); + initializing = false; + if (props.Mixins) { + each$k(props.Mixins, function (mixin) { + for (var name_1 in mixin) { + if (name_1 !== 'init') { + props[name_1] = mixin[name_1]; + } + } + }); + if (_super.Mixins) { + props.Mixins = _super.Mixins.concat(props.Mixins); + } + } + if (props.Methods) { + each$k(props.Methods.split(','), function (name) { + props[name] = dummy; + }); + } + if (props.Properties) { + each$k(props.Properties.split(','), function (name) { + var fieldName = '_' + name; + props[name] = function (value) { + var self = this; + if (value !== undefined) { + self[fieldName] = value; + return self; + } + return self[fieldName]; + }; + }); + } + if (props.Statics) { + each$k(props.Statics, function (func, name) { + Class[name] = func; + }); + } + if (props.Defaults && _super.Defaults) { + props.Defaults = extend$5({}, _super.Defaults, props.Defaults); + } + each$1(props, function (member, name) { + if (typeof member === 'function' && _super[name]) { + prototype[name] = createMethod(name, member); + } else { + prototype[name] = member; + } + }); + Class.prototype = prototype; + Class.constructor = Class; + Class.extend = extendClass; + return Class; + }; + + var min$1 = Math.min, max$1 = Math.max, round$2 = Math.round; + var Color = function (value) { + var self = {}; + var r = 0, g = 0, b = 0; + var rgb2hsv = function (r, g, b) { + var h, s, v; + h = 0; + s = 0; + v = 0; + r = r / 255; + g = g / 255; + b = b / 255; + var minRGB = min$1(r, min$1(g, b)); + var maxRGB = max$1(r, max$1(g, b)); + if (minRGB === maxRGB) { + v = minRGB; + return { + h: 0, + s: 0, + v: v * 100 + }; + } + var d = r === minRGB ? g - b : b === minRGB ? r - g : b - r; + h = r === minRGB ? 3 : b === minRGB ? 1 : 5; + h = 60 * (h - d / (maxRGB - minRGB)); + s = (maxRGB - minRGB) / maxRGB; + v = maxRGB; + return { + h: round$2(h), + s: round$2(s * 100), + v: round$2(v * 100) + }; + }; + var hsvToRgb = function (hue, saturation, brightness) { + hue = (parseInt(hue, 10) || 0) % 360; + saturation = parseInt(saturation, 10) / 100; + brightness = parseInt(brightness, 10) / 100; + saturation = max$1(0, min$1(saturation, 1)); + brightness = max$1(0, min$1(brightness, 1)); + if (saturation === 0) { + r = g = b = round$2(255 * brightness); + return; + } + var side = hue / 60; + var chroma = brightness * saturation; + var x = chroma * (1 - Math.abs(side % 2 - 1)); + var match = brightness - chroma; + switch (Math.floor(side)) { + case 0: + r = chroma; + g = x; + b = 0; + break; + case 1: + r = x; + g = chroma; + b = 0; + break; + case 2: + r = 0; + g = chroma; + b = x; + break; + case 3: + r = 0; + g = x; + b = chroma; + break; + case 4: + r = x; + g = 0; + b = chroma; + break; + case 5: + r = chroma; + g = 0; + b = x; + break; + default: + r = g = b = 0; + } + r = round$2(255 * (r + match)); + g = round$2(255 * (g + match)); + b = round$2(255 * (b + match)); + }; + var toHex = function () { + var hex = function (val) { + val = parseInt(val, 10).toString(16); + return val.length > 1 ? val : '0' + val; + }; + return '#' + hex(r) + hex(g) + hex(b); + }; + var toRgb = function () { + return { + r: r, + g: g, + b: b + }; + }; + var toHsv = function () { + return rgb2hsv(r, g, b); + }; + var parse = function (value) { + var matches; + if (typeof value === 'object') { + if ('r' in value) { + r = value.r; + g = value.g; + b = value.b; + } else if ('v' in value) { + hsvToRgb(value.h, value.s, value.v); + } + } else { + if (matches = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)[^\)]*\)/gi.exec(value)) { + r = parseInt(matches[1], 10); + g = parseInt(matches[2], 10); + b = parseInt(matches[3], 10); + } else if (matches = /#([0-F]{2})([0-F]{2})([0-F]{2})/gi.exec(value)) { + r = parseInt(matches[1], 16); + g = parseInt(matches[2], 16); + b = parseInt(matches[3], 16); + } else if (matches = /#([0-F])([0-F])([0-F])/gi.exec(value)) { + r = parseInt(matches[1] + matches[1], 16); + g = parseInt(matches[2] + matches[2], 16); + b = parseInt(matches[3] + matches[3], 16); + } + } + r = r < 0 ? 0 : r > 255 ? 255 : r; + g = g < 0 ? 0 : g > 255 ? 255 : g; + b = b < 0 ? 0 : b > 255 ? 255 : b; + return self; + }; + if (value) { + parse(value); + } + self.toRgb = toRgb; + self.toHsv = toHsv; + self.toHex = toHex; + self.parse = parse; + return self; + }; + + var serialize = function (obj) { + var data = JSON.stringify(obj); + if (!isString(data)) { + return data; + } + return data.replace(/[\u0080-\uFFFF]/g, function (match) { + var hexCode = match.charCodeAt(0).toString(16); + return '\\u' + '0000'.substring(hexCode.length) + hexCode; + }); + }; + var JSONUtils = { + serialize: serialize, + parse: function (text) { + try { + return JSON.parse(text); + } catch (ex) { + } + } + }; + + var JSONP = { + callbacks: {}, + count: 0, + send: function (settings) { + var self = this, dom = DOMUtils$1.DOM, count = settings.count !== undefined ? settings.count : self.count; + var id = 'tinymce_jsonp_' + count; + self.callbacks[count] = function (json) { + dom.remove(id); + delete self.callbacks[count]; + settings.callback(json); + }; + dom.add(dom.doc.body, 'script', { + id: id, + src: settings.url, + type: 'text/javascript' + }); + self.count++; + } + }; - 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 + var XHR = __assign(__assign({}, Observable), { + send: function (settings) { + var xhr, count = 0; + var ready = function () { + if (!settings.async || xhr.readyState === 4 || count++ > 10000) { + if (settings.success && count < 10000 && xhr.status === 200) { + settings.success.call(settings.success_scope, '' + xhr.responseText, xhr, settings); + } else if (settings.error) { + settings.error.call(settings.error_scope, count > 10000 ? 'TIMED_OUT' : 'GENERAL', xhr, settings); + } + xhr = null; + } else { + Delay.setTimeout(ready, 10); + } + }; + settings.scope = settings.scope || this; + settings.success_scope = settings.success_scope || settings.scope; + settings.error_scope = settings.error_scope || settings.scope; + settings.async = settings.async !== false; + settings.data = settings.data || ''; + XHR.fire('beforeInitialize', { settings: settings }); + xhr = new XMLHttpRequest(); + if (xhr.overrideMimeType) { + xhr.overrideMimeType(settings.content_type); + } + xhr.open(settings.type || (settings.data ? 'POST' : 'GET'), settings.url, settings.async); + if (settings.crossDomain) { + xhr.withCredentials = true; } - return false + if (settings.content_type) { + xhr.setRequestHeader('Content-Type', settings.content_type); + } + if (settings.requestheaders) { + Tools.each(settings.requestheaders, function (header) { + xhr.setRequestHeader(header.key, header.value); + }); + } + xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + xhr = XHR.fire('beforeSend', { + xhr: xhr, + settings: settings + }).xhr; + xhr.send(settings.data); + if (!settings.async) { + return ready(); + } + Delay.setTimeout(ready, 10); + } + }); + + var extend$6 = Tools.extend; + var JSONRequest = function () { + function JSONRequest(settings) { + this.settings = extend$6({}, settings); + this.count = 0; + } + JSONRequest.sendRPC = function (o) { + return new JSONRequest().send(o); + }; + JSONRequest.prototype.send = function (args) { + var ecb = args.error, scb = args.success; + var xhrArgs = extend$6(this.settings, args); + xhrArgs.success = function (c, x) { + c = JSONUtils.parse(c); + if (typeof c === 'undefined') { + c = { error: 'JSON Parse error.' }; + } + if (c.error) { + ecb.call(xhrArgs.error_scope || xhrArgs.scope, c.error, x); + } else { + scb.call(xhrArgs.success_scope || xhrArgs.scope, c.result); + } + }; + xhrArgs.error = function (ty, x) { + if (ecb) { + ecb.call(xhrArgs.error_scope || xhrArgs.scope, ty, x); + } + }; + xhrArgs.data = JSONUtils.serialize({ + id: args.id || 'c' + this.count++, + method: args.method, + params: args.params + }); + xhrArgs.content_type = 'application/json'; + XHR.send(xhrArgs); + }; + return JSONRequest; + }(); + + var create$9 = function () { + return function () { + var data = {}; + var keys = []; + var storage = { + getItem: function (key) { + var item = data[key]; + return item ? item : null; + }, + setItem: function (key, value) { + keys.push(key); + data[key] = String(value); + }, + key: function (index) { + return keys[index]; + }, + removeItem: function (key) { + keys = keys.filter(function (k) { + return k === key; + }); + delete data[key]; + }, + clear: function () { + keys = []; + data = {}; + }, + length: 0 + }; + Object.defineProperty(storage, 'length', { + get: function () { + return keys.length; + }, + configurable: false, + enumerable: false + }); + return storage; + }(); + }; + + var localStorage; + try { + var test = '__storage_test__'; + localStorage = window.localStorage; + localStorage.setItem(test, test); + localStorage.removeItem(test); + } catch (e) { + localStorage = create$9(); } + var LocalStorage = localStorage; + + var publicApi = { + geom: { Rect: Rect }, + util: { + Promise: promiseObj, + Delay: Delay, + Tools: Tools, + VK: VK, + URI: URI, + Class: Class, + EventDispatcher: EventDispatcher, + Observable: Observable, + I18n: I18n, + XHR: XHR, + JSON: JSONUtils, + JSONRequest: JSONRequest, + JSONP: JSONP, + LocalStorage: LocalStorage, + Color: Color + }, + dom: { + EventUtils: EventUtils, + Sizzle: Sizzle, + DomQuery: DomQuery, + TreeWalker: DomTreeWalker, + TextSeeker: TextSeeker, + DOMUtils: DOMUtils$1, + ScriptLoader: ScriptLoader, + RangeUtils: RangeUtils$1, + Serializer: DomSerializer, + StyleSheetLoader: StyleSheetLoader, + ControlSelection: ControlSelection, + BookmarkManager: BookmarkManager$1, + Selection: EditorSelection, + Event: EventUtils.Event + }, + html: { + Styles: Styles, + Entities: Entities, + Node: AstNode, + Schema: Schema, + SaxParser: SaxParser$1, + DomParser: DomParser, + Writer: Writer, + Serializer: HtmlSerializer + }, + Env: Env, + AddOnManager: AddOnManager$1, + Annotator: Annotator, + Formatter: Formatter, + UndoManager: UndoManager, + EditorCommands: EditorCommands, + WindowManager: WindowManager, + NotificationManager: NotificationManager, + EditorObservable: EditorObservable, + Shortcuts: Shortcuts, + Editor: Editor, + FocusManager: FocusManager, + EditorManager: EditorManager, + DOM: DOMUtils$1.DOM, + ScriptLoader: ScriptLoader.ScriptLoader, + PluginManager: PluginManager, + ThemeManager: ThemeManager, + IconManager: IconManager, + Resource: Resource, + trim: Tools.trim, + isArray: Tools.isArray, + is: Tools.is, + toArray: Tools.toArray, + makeMap: Tools.makeMap, + each: Tools.each, + map: Tools.map, + grep: Tools.grep, + inArray: Tools.inArray, + extend: Tools.extend, + create: Tools.create, + walk: Tools.walk, + createNS: Tools.createNS, + resolve: Tools.resolve, + explode: Tools.explode, + _addCacheSuffix: Tools._addCacheSuffix, + isOpera: Env.opera, + isWebKit: Env.webkit, + isIE: Env.ie, + isGecko: Env.gecko, + isMac: Env.mac + }; + var tinymce = Tools.extend(EditorManager, publicApi); - exports('tinymce', t); + var exportToModuleLoaders = function (tinymce) { + if (typeof module === 'object') { + try { + module.exports = tinymce; + } catch (_) { + } + } + }; + var exportToWindowGlobal = function (tinymce) { + window.tinymce = tinymce; + window.tinyMCE = tinymce; + }; + exportToWindowGlobal(tinymce); + exportToModuleLoaders(tinymce); -}); +}()); diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/tinymce.min.js b/src/plugin/admin/public/component/pear/module/tinymce/tinymce.min.js similarity index 100% rename from src/plugin/admin/public/component/pear/module/tinymce/tinymce/tinymce.min.js rename to src/plugin/admin/public/component/pear/module/tinymce/tinymce.min.js diff --git a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/tinymce.js b/src/plugin/admin/public/component/pear/module/tinymce/tinymce/tinymce.js deleted file mode 100644 index aac0a417..00000000 --- a/src/plugin/admin/public/component/pear/module/tinymce/tinymce/tinymce.js +++ /dev/null @@ -1,29786 +0,0 @@ -/** - * 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 typeOf = function (x) { - if (x === null) { - return 'null'; - } - if (x === undefined) { - return 'undefined'; - } - var t = typeof x; - if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) { - return 'array'; - } - if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) { - return 'string'; - } - return t; - }; - var isEquatableType = function (x) { - return [ - 'undefined', - 'boolean', - 'number', - 'string', - 'function', - 'xml', - 'null' - ].indexOf(x) !== -1; - }; - - var sort = function (xs, compareFn) { - var clone = Array.prototype.slice.call(xs); - return clone.sort(compareFn); - }; - - var contramap = function (eqa, f) { - return eq(function (x, y) { - return eqa.eq(f(x), f(y)); - }); - }; - var eq = function (f) { - return { eq: f }; - }; - var tripleEq = eq(function (x, y) { - return x === y; - }); - var eqString = tripleEq; - var eqArray = function (eqa) { - return eq(function (x, y) { - if (x.length !== y.length) { - return false; - } - var len = x.length; - for (var i = 0; i < len; i++) { - if (!eqa.eq(x[i], y[i])) { - return false; - } - } - return true; - }); - }; - var eqSortedArray = function (eqa, compareFn) { - return contramap(eqArray(eqa), function (xs) { - return sort(xs, compareFn); - }); - }; - var eqRecord = function (eqa) { - return eq(function (x, y) { - var kx = Object.keys(x); - var ky = Object.keys(y); - if (!eqSortedArray(eqString).eq(kx, ky)) { - return false; - } - var len = kx.length; - for (var i = 0; i < len; i++) { - var q = kx[i]; - if (!eqa.eq(x[q], y[q])) { - return false; - } - } - return true; - }); - }; - var eqAny = eq(function (x, y) { - if (x === y) { - return true; - } - var tx = typeOf(x); - var ty = typeOf(y); - if (tx !== ty) { - return false; - } - if (isEquatableType(tx)) { - return x === y; - } else if (tx === 'array') { - return eqArray(eqAny).eq(x, y); - } else if (tx === 'object') { - return eqRecord(eqAny).eq(x, y); - } - return false; - }); - - 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; - }; - }; - var identity = function (x) { - return x; - }; - 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 not = function (f) { - return function (t) { - return !f(t); - }; - }; - var die = function (msg) { - return function () { - throw new Error(msg); - }; - }; - var call = function (f) { - f(); - }; - 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 typeOf$1 = 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$1(value) === type; - }; - }; - var isSimpleType = function (type) { - return function (value) { - return typeof value === type; - }; - }; - var eq$1 = function (t) { - return function (a) { - return t === a; - }; - }; - var isString = isType('string'); - var isObject = isType('object'); - var isArray = isType('array'); - var isNull = eq$1(null); - var isBoolean = isSimpleType('boolean'); - var isUndefined = eq$1(undefined); - 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 nativeSlice = Array.prototype.slice; - var nativeIndexOf = Array.prototype.indexOf; - var nativePush = Array.prototype.push; - var rawIndexOf = function (ts, t) { - return nativeIndexOf.call(ts, t); - }; - var indexOf = function (xs, x) { - var r = rawIndexOf(xs, x); - return r === -1 ? Optional.none() : Optional.some(r); - }; - var contains = function (xs, x) { - return rawIndexOf(xs, x) > -1; - }; - 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 = 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 eachr = function (xs, f) { - for (var i = xs.length - 1; i >= 0; i--) { - var x = xs[i]; - f(x, i); - } - }; - var partition = function (xs, pred) { - var pass = []; - var fail = []; - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - var arr = pred(x, i) ? pass : fail; - arr.push(x); - } - return { - pass: pass, - fail: fail - }; - }; - 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 foldr = function (xs, f, acc) { - eachr(xs, function (x) { - acc = f(acc, x); - }); - return acc; - }; - var foldl = function (xs, f, acc) { - each(xs, function (x) { - acc = f(acc, x); - }); - return acc; - }; - 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 findIndex = function (xs, pred) { - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - if (pred(x, i)) { - return Optional.some(i); - } - } - return Optional.none(); - }; - 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 forall = function (xs, pred) { - for (var i = 0, len = xs.length; i < len; ++i) { - var x = xs[i]; - if (pred(x, i) !== true) { - return false; - } - } - return true; - }; - var reverse = function (xs) { - var r = nativeSlice.call(xs, 0); - r.reverse(); - return r; - }; - var difference = function (a1, a2) { - return filter(a1, function (x) { - return !contains(a2, x); - }); - }; - var mapToObject = function (xs, f) { - var r = {}; - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - r[String(x)] = f(x, i); - } - return r; - }; - var sort$1 = function (xs, comparator) { - var copy = nativeSlice.call(xs, 0); - copy.sort(comparator); - return copy; - }; - var get = function (xs, i) { - return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none(); - }; - var head = function (xs) { - return get(xs, 0); - }; - var last = function (xs) { - return get(xs, xs.length - 1); - }; - var from$1 = isFunction(Array.from) ? Array.from : function (x) { - return nativeSlice.call(x); - }; - var findMap = function (arr, f) { - for (var i = 0; i < arr.length; i++) { - var r = f(arr[i], i); - if (r.isSome()) { - return r; - } - } - return Optional.none(); - }; - - var keys = Object.keys; - var hasOwnProperty = Object.hasOwnProperty; - 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 map$1 = function (obj, f) { - return tupleMap(obj, function (x, i) { - return { - k: i, - v: f(x, i) - }; - }); - }; - var tupleMap = function (obj, f) { - var r = {}; - each$1(obj, function (x, i) { - var tuple = f(x, i); - r[tuple.k] = tuple.v; - }); - return r; - }; - var objAcc = function (r) { - return function (x, i) { - r[i] = x; - }; - }; - var internalFilter = function (obj, pred, onTrue, onFalse) { - var r = {}; - each$1(obj, function (x, i) { - (pred(x, i) ? onTrue : onFalse)(x, i); - }); - return r; - }; - var bifilter = function (obj, pred) { - var t = {}; - var f = {}; - internalFilter(obj, pred, objAcc(t), objAcc(f)); - return { - t: t, - f: f - }; - }; - var filter$1 = function (obj, pred) { - var t = {}; - internalFilter(obj, pred, objAcc(t), noop); - return t; - }; - var mapToArray = function (obj, f) { - var r = []; - each$1(obj, function (value, name) { - r.push(f(value, name)); - }); - return r; - }; - var values = function (obj) { - return mapToArray(obj, function (v) { - return v; - }); - }; - 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 hasNonNullableKey = function (obj, key) { - return has(obj, key) && obj[key] !== undefined && obj[key] !== null; - }; - var equal = function (a1, a2, eq) { - if (eq === void 0) { - eq = eqAny; - } - return eqRecord(eq).eq(a1, a2); - }; - - var isArray$1 = Array.isArray; - var toArray = function (obj) { - if (!isArray$1(obj)) { - var array = []; - for (var i = 0, l = obj.length; i < l; i++) { - array[i] = obj[i]; - } - return array; - } else { - return obj; - } - }; - var each$2 = function (o, cb, s) { - var n, l; - if (!o) { - return false; - } - s = s || o; - if (o.length !== undefined) { - for (n = 0, l = o.length; n < l; n++) { - if (cb.call(s, o[n], n, o) === false) { - return false; - } - } - } else { - for (n in o) { - if (o.hasOwnProperty(n)) { - if (cb.call(s, o[n], n, o) === false) { - return false; - } - } - } - } - return true; - }; - var map$2 = function (array, callback) { - var out = []; - each$2(array, function (item, index) { - out.push(callback(item, index, array)); - }); - return out; - }; - var filter$2 = function (a, f) { - var o = []; - each$2(a, function (v, index) { - if (!f || f(v, index, a)) { - o.push(v); - } - }); - return o; - }; - var indexOf$1 = function (a, v) { - if (a) { - for (var i = 0, l = a.length; i < l; i++) { - if (a[i] === v) { - return i; - } - } - } - return -1; - }; - var reduce = function (collection, iteratee, accumulator, thisArg) { - var acc = isUndefined(accumulator) ? collection[0] : accumulator; - for (var i = 0; i < collection.length; i++) { - acc = iteratee.call(thisArg, acc, collection[i], i); - } - return acc; - }; - var findIndex$1 = function (array, predicate, thisArg) { - var i, l; - for (i = 0, l = array.length; i < l; i++) { - if (predicate.call(thisArg, array[i], i, array)) { - return i; - } - } - return -1; - }; - var last$1 = function (collection) { - return collection[collection.length - 1]; - }; - - 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); - }; - function __rest(s, e) { - var t = {}; - for (var p in s) - if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === 'function') - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - } - function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) - s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - } - - var cached = function (f) { - var called = false; - var r; - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - if (!called) { - called = true; - r = f.apply(null, args); - } - return r; - }; - }; - - var DeviceType = function (os, browser, userAgent, mediaMatch) { - var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true; - var isiPhone = os.isiOS() && !isiPad; - var isMobile = os.isiOS() || os.isAndroid(); - var isTouch = isMobile || mediaMatch('(pointer:coarse)'); - var isTablet = isiPad || !isiPhone && isMobile && mediaMatch('(min-device-width:768px)'); - var isPhone = isiPhone || isMobile && !isTablet; - var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false; - var isDesktop = !isPhone && !isTablet && !iOSwebview; - return { - isiPad: constant(isiPad), - isiPhone: constant(isiPhone), - isTablet: constant(isTablet), - isPhone: constant(isPhone), - isTouch: constant(isTouch), - isAndroid: os.isAndroid, - isiOS: os.isiOS, - isWebView: constant(iOSwebview), - isDesktop: constant(isDesktop) - }; - }; - - var firstMatch = function (regexes, s) { - for (var i = 0; i < regexes.length; i++) { - var x = regexes[i]; - if (x.test(s)) { - return x; - } - } - return undefined; - }; - var find$1 = function (regexes, agent) { - var r = firstMatch(regexes, agent); - if (!r) { - return { - major: 0, - minor: 0 - }; - } - var group = function (i) { - return Number(agent.replace(r, '$' + i)); - }; - return nu(group(1), group(2)); - }; - var detect = function (versionRegexes, agent) { - var cleanedAgent = String(agent).toLowerCase(); - if (versionRegexes.length === 0) { - return unknown(); - } - return find$1(versionRegexes, cleanedAgent); - }; - var unknown = function () { - return nu(0, 0); - }; - var nu = function (major, minor) { - return { - major: major, - minor: minor - }; - }; - var Version = { - nu: nu, - detect: detect, - unknown: unknown - }; - - var detect$1 = function (candidates, userAgent) { - var agent = String(userAgent).toLowerCase(); - return find(candidates, function (candidate) { - return candidate.search(agent); - }); - }; - var detectBrowser = function (browsers, userAgent) { - return detect$1(browsers, userAgent).map(function (browser) { - var version = Version.detect(browser.versionRegexes, userAgent); - return { - current: browser.name, - version: version - }; - }); - }; - var detectOs = function (oses, userAgent) { - return detect$1(oses, userAgent).map(function (os) { - var version = Version.detect(os.versionRegexes, userAgent); - return { - current: os.name, - version: version - }; - }); - }; - var UaString = { - detectBrowser: detectBrowser, - detectOs: detectOs - }; - - var removeFromStart = function (str, numChars) { - return str.substring(numChars); - }; - - var checkRange = function (str, substr, start) { - return substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr; - }; - var removeLeading = function (str, prefix) { - return startsWith(str, prefix) ? removeFromStart(str, prefix.length) : str; - }; - var contains$1 = function (str, substr) { - return str.indexOf(substr) !== -1; - }; - var startsWith = function (str, prefix) { - return checkRange(str, prefix, 0); - }; - var blank = function (r) { - return function (s) { - return s.replace(r, ''); - }; - }; - var trim = blank(/^\s+|\s+$/g); - var lTrim = blank(/^\s+/g); - var rTrim = blank(/\s+$/g); - - var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/; - var checkContains = function (target) { - return function (uastring) { - return contains$1(uastring, target); - }; - }; - var browsers = [ - { - name: 'Edge', - versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/], - search: function (uastring) { - return contains$1(uastring, 'edge/') && contains$1(uastring, 'chrome') && contains$1(uastring, 'safari') && contains$1(uastring, 'applewebkit'); - } - }, - { - name: 'Chrome', - versionRegexes: [ - /.*?chrome\/([0-9]+)\.([0-9]+).*/, - normalVersionRegex - ], - search: function (uastring) { - return contains$1(uastring, 'chrome') && !contains$1(uastring, 'chromeframe'); - } - }, - { - name: 'IE', - versionRegexes: [ - /.*?msie\ ?([0-9]+)\.([0-9]+).*/, - /.*?rv:([0-9]+)\.([0-9]+).*/ - ], - search: function (uastring) { - return contains$1(uastring, 'msie') || contains$1(uastring, 'trident'); - } - }, - { - name: 'Opera', - versionRegexes: [ - normalVersionRegex, - /.*?opera\/([0-9]+)\.([0-9]+).*/ - ], - search: checkContains('opera') - }, - { - name: 'Firefox', - versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/], - search: checkContains('firefox') - }, - { - name: 'Safari', - versionRegexes: [ - normalVersionRegex, - /.*?cpu os ([0-9]+)_([0-9]+).*/ - ], - search: function (uastring) { - return (contains$1(uastring, 'safari') || contains$1(uastring, 'mobile/')) && contains$1(uastring, 'applewebkit'); - } - } - ]; - var oses = [ - { - name: 'Windows', - search: checkContains('win'), - versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/] - }, - { - name: 'iOS', - search: function (uastring) { - return contains$1(uastring, 'iphone') || contains$1(uastring, 'ipad'); - }, - versionRegexes: [ - /.*?version\/\ ?([0-9]+)\.([0-9]+).*/, - /.*cpu os ([0-9]+)_([0-9]+).*/, - /.*cpu iphone os ([0-9]+)_([0-9]+).*/ - ] - }, - { - name: 'Android', - search: checkContains('android'), - versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/] - }, - { - name: 'OSX', - search: checkContains('mac os x'), - versionRegexes: [/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/] - }, - { - name: 'Linux', - search: checkContains('linux'), - versionRegexes: [] - }, - { - name: 'Solaris', - search: checkContains('sunos'), - versionRegexes: [] - }, - { - name: 'FreeBSD', - search: checkContains('freebsd'), - versionRegexes: [] - }, - { - name: 'ChromeOS', - search: checkContains('cros'), - versionRegexes: [/.*?chrome\/([0-9]+)\.([0-9]+).*/] - } - ]; - var PlatformInfo = { - browsers: constant(browsers), - oses: constant(oses) - }; - - var edge = 'Edge'; - var chrome = 'Chrome'; - var ie = 'IE'; - var opera = 'Opera'; - var firefox = 'Firefox'; - var safari = 'Safari'; - var unknown$1 = function () { - return nu$1({ - current: undefined, - version: Version.unknown() - }); - }; - var nu$1 = function (info) { - var current = info.current; - var version = info.version; - var isBrowser = function (name) { - return function () { - return current === name; - }; - }; - return { - current: current, - version: version, - isEdge: isBrowser(edge), - isChrome: isBrowser(chrome), - isIE: isBrowser(ie), - isOpera: isBrowser(opera), - isFirefox: isBrowser(firefox), - isSafari: isBrowser(safari) - }; - }; - var Browser = { - unknown: unknown$1, - nu: nu$1, - edge: constant(edge), - chrome: constant(chrome), - ie: constant(ie), - opera: constant(opera), - firefox: constant(firefox), - safari: constant(safari) - }; - - var windows = 'Windows'; - var ios = 'iOS'; - var android = 'Android'; - var linux = 'Linux'; - var osx = 'OSX'; - var solaris = 'Solaris'; - var freebsd = 'FreeBSD'; - var chromeos = 'ChromeOS'; - var unknown$2 = function () { - return nu$2({ - current: undefined, - version: Version.unknown() - }); - }; - var nu$2 = function (info) { - var current = info.current; - var version = info.version; - var isOS = function (name) { - return function () { - return current === name; - }; - }; - return { - current: current, - version: version, - isWindows: isOS(windows), - isiOS: isOS(ios), - isAndroid: isOS(android), - isOSX: isOS(osx), - isLinux: isOS(linux), - isSolaris: isOS(solaris), - isFreeBSD: isOS(freebsd), - isChromeOS: isOS(chromeos) - }; - }; - var OperatingSystem = { - unknown: unknown$2, - nu: nu$2, - windows: constant(windows), - ios: constant(ios), - android: constant(android), - linux: constant(linux), - osx: constant(osx), - solaris: constant(solaris), - freebsd: constant(freebsd), - chromeos: constant(chromeos) - }; - - var detect$2 = function (userAgent, mediaMatch) { - var browsers = PlatformInfo.browsers(); - var oses = PlatformInfo.oses(); - var browser = UaString.detectBrowser(browsers, userAgent).fold(Browser.unknown, Browser.nu); - var os = UaString.detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu); - var deviceType = DeviceType(os, browser, userAgent, mediaMatch); - return { - browser: browser, - os: os, - deviceType: deviceType - }; - }; - var PlatformDetection = { detect: detect$2 }; - - var mediaMatch = function (query) { - return window.matchMedia(query).matches; - }; - var platform = cached(function () { - return PlatformDetection.detect(navigator.userAgent, mediaMatch); - }); - var detect$3 = function () { - return platform(); - }; - - var userAgent = navigator.userAgent; - var platform$1 = detect$3(); - var browser = platform$1.browser; - var os = platform$1.os; - var deviceType = platform$1.deviceType; - var webkit = /WebKit/.test(userAgent) && !browser.isEdge(); - var fileApi = 'FormData' in window && 'FileReader' in window && 'URL' in window && !!URL.createObjectURL; - var windowsPhone = userAgent.indexOf('Windows Phone') !== -1; - var Env = { - opera: browser.isOpera(), - webkit: webkit, - ie: browser.isIE() || browser.isEdge() ? browser.version.major : false, - gecko: browser.isFirefox(), - mac: os.isOSX() || os.isiOS(), - iOS: deviceType.isiPad() || deviceType.isiPhone(), - android: os.isAndroid(), - contentEditable: true, - transparentSrc: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7', - caretAfter: true, - range: window.getSelection && 'Range' in window, - documentMode: browser.isIE() ? document.documentMode || 7 : 10, - fileApi: fileApi, - ceFalse: true, - cacheSuffix: null, - container: null, - experimentalShadowDom: false, - canHaveCSP: !browser.isIE(), - desktop: deviceType.isDesktop(), - windowsPhone: windowsPhone, - browser: { - current: browser.current, - version: browser.version, - isChrome: browser.isChrome, - isEdge: browser.isEdge, - isFirefox: browser.isFirefox, - isIE: browser.isIE, - isOpera: browser.isOpera, - isSafari: browser.isSafari - }, - os: { - current: os.current, - version: os.version, - isAndroid: os.isAndroid, - isChromeOS: os.isChromeOS, - isFreeBSD: os.isFreeBSD, - isiOS: os.isiOS, - isLinux: os.isLinux, - isOSX: os.isOSX, - isSolaris: os.isSolaris, - isWindows: os.isWindows - }, - deviceType: { - isDesktop: deviceType.isDesktop, - isiPad: deviceType.isiPad, - isiPhone: deviceType.isiPhone, - isPhone: deviceType.isPhone, - isTablet: deviceType.isTablet, - isTouch: deviceType.isTouch, - isWebView: deviceType.isWebView - } - }; - - var whiteSpaceRegExp = /^\s*|\s*$/g; - var trim$1 = function (str) { - return str === null || str === undefined ? '' : ('' + str).replace(whiteSpaceRegExp, ''); - }; - var is = function (obj, type) { - if (!type) { - return obj !== undefined; - } - if (type === 'array' && isArray$1(obj)) { - return true; - } - return typeof obj === type; - }; - var makeMap = function (items, delim, map) { - var i; - items = items || []; - delim = delim || ','; - if (typeof items === 'string') { - items = items.split(delim); - } - map = map || {}; - i = items.length; - while (i--) { - map[items[i]] = {}; - } - return map; - }; - var hasOwnProperty$1 = function (obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); - }; - var create = function (s, p, root) { - var self = this; - var sp, scn, c, de = 0; - s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s); - var cn = s[3].match(/(^|\.)(\w+)$/i)[2]; - var ns = self.createNS(s[3].replace(/\.\w+$/, ''), root); - if (ns[cn]) { - return; - } - if (s[2] === 'static') { - ns[cn] = p; - if (this.onCreate) { - this.onCreate(s[2], s[3], ns[cn]); - } - return; - } - if (!p[cn]) { - p[cn] = function () { - }; - de = 1; - } - ns[cn] = p[cn]; - self.extend(ns[cn].prototype, p); - if (s[5]) { - sp = self.resolve(s[5]).prototype; - scn = s[5].match(/\.(\w+)$/i)[1]; - c = ns[cn]; - if (de) { - ns[cn] = function () { - return sp[scn].apply(this, arguments); - }; - } else { - ns[cn] = function () { - this.parent = sp[scn]; - return c.apply(this, arguments); - }; - } - ns[cn].prototype[cn] = ns[cn]; - self.each(sp, function (f, n) { - ns[cn].prototype[n] = sp[n]; - }); - self.each(p, function (f, n) { - if (sp[n]) { - ns[cn].prototype[n] = function () { - this.parent = sp[n]; - return f.apply(this, arguments); - }; - } else { - if (n !== cn) { - ns[cn].prototype[n] = f; - } - } - }); - } - self.each(p.static, function (f, n) { - ns[cn][n] = f; - }); - }; - var extend = function (obj) { - var exts = []; - for (var _i = 1; _i < arguments.length; _i++) { - exts[_i - 1] = arguments[_i]; - } - for (var i = 0; i < exts.length; i++) { - var ext = exts[i]; - for (var name_1 in ext) { - if (ext.hasOwnProperty(name_1)) { - var value = ext[name_1]; - if (value !== undefined) { - obj[name_1] = value; - } - } - } - } - return obj; - }; - var walk = function (o, f, n, s) { - s = s || this; - if (o) { - if (n) { - o = o[n]; - } - each$2(o, function (o, i) { - if (f.call(s, o, i, n) === false) { - return false; - } - walk(o, f, n, s); - }); - } - }; - var createNS = function (n, o) { - var i, v; - o = o || window; - n = n.split('.'); - for (i = 0; i < n.length; i++) { - v = n[i]; - if (!o[v]) { - o[v] = {}; - } - o = o[v]; - } - return o; - }; - var resolve = function (n, o) { - var i, l; - o = o || window; - n = n.split('.'); - for (i = 0, l = n.length; i < l; i++) { - o = o[n[i]]; - if (!o) { - break; - } - } - return o; - }; - var explode = function (s, d) { - if (!s || is(s, 'array')) { - return s; - } - return map$2(s.split(d || ','), trim$1); - }; - var _addCacheSuffix = function (url) { - var cacheSuffix = Env.cacheSuffix; - if (cacheSuffix) { - url += (url.indexOf('?') === -1 ? '?' : '&') + cacheSuffix; - } - return url; - }; - var Tools = { - trim: trim$1, - isArray: isArray$1, - is: is, - toArray: toArray, - makeMap: makeMap, - each: each$2, - map: map$2, - grep: filter$2, - inArray: indexOf$1, - hasOwn: hasOwnProperty$1, - extend: extend, - create: create, - walk: walk, - createNS: createNS, - resolve: resolve, - explode: explode, - _addCacheSuffix: _addCacheSuffix - }; - - 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 toArray$1 = function (target, f) { - var r = []; - var recurse = function (e) { - r.push(e); - return f(e); - }; - var cur = f(target); - do { - cur = cur.bind(recurse); - } while (cur.isSome()); - return r; - }; - - var compareDocumentPosition = function (a, b, match) { - return (a.compareDocumentPosition(b) & match) !== 0; - }; - var documentPositionContainedBy = function (a, b) { - return compareDocumentPosition(a, b, Node.DOCUMENT_POSITION_CONTAINED_BY); - }; - - var COMMENT = 8; - var DOCUMENT = 9; - var DOCUMENT_FRAGMENT = 11; - var ELEMENT = 1; - var TEXT = 3; - - var is$1 = 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 one = function (selector, scope) { - var base = scope === undefined ? document : scope.dom; - return bypassSelector(base) ? Optional.none() : Optional.from(base.querySelector(selector)).map(SugarElement.fromDom); - }; - - var eq$2 = function (e1, e2) { - return e1.dom === e2.dom; - }; - var regularContains = function (e1, e2) { - var d1 = e1.dom; - var d2 = e2.dom; - return d1 === d2 ? false : d1.contains(d2); - }; - var ieContains = function (e1, e2) { - return documentPositionContainedBy(e1.dom, e2.dom); - }; - var contains$2 = function (e1, e2) { - return detect$3().browser.isIE() ? ieContains(e1, e2) : regularContains(e1, e2); - }; - - var Global = typeof window !== 'undefined' ? window : Function('return this;')(); - - var name = function (element) { - var r = element.dom.nodeName; - return r.toLowerCase(); - }; - var type = function (element) { - return element.dom.nodeType; - }; - var isType$1 = function (t) { - return function (element) { - return type(element) === t; - }; - }; - var isComment = function (element) { - return type(element) === COMMENT || name(element) === '#comment'; - }; - var isElement = isType$1(ELEMENT); - var isText = isType$1(TEXT); - var isDocument = isType$1(DOCUMENT); - var isDocumentFragment = isType$1(DOCUMENT_FRAGMENT); - - var owner = function (element) { - return SugarElement.fromDom(element.dom.ownerDocument); - }; - var documentOrOwner = function (dos) { - return isDocument(dos) ? dos : owner(dos); - }; - var documentElement = function (element) { - return SugarElement.fromDom(documentOrOwner(element).dom.documentElement); - }; - var defaultView = function (element) { - return SugarElement.fromDom(documentOrOwner(element).dom.defaultView); - }; - 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$2(element, x); - }); - }; - return parent(element).map(children).map(filterSelf).getOr([]); - }; - var prevSibling = function (element) { - return Optional.from(element.dom.previousSibling).map(SugarElement.fromDom); - }; - var nextSibling = function (element) { - return Optional.from(element.dom.nextSibling).map(SugarElement.fromDom); - }; - var prevSiblings = function (element) { - return reverse(toArray$1(element, prevSibling)); - }; - var nextSiblings = function (element) { - return toArray$1(element, nextSibling); - }; - var children = function (element) { - return map(element.dom.childNodes, SugarElement.fromDom); - }; - var child = function (element, index) { - var cs = element.dom.childNodes; - return Optional.from(cs[index]).map(SugarElement.fromDom); - }; - var firstChild = function (element) { - return child(element, 0); - }; - var lastChild = function (element) { - return child(element, element.dom.childNodes.length - 1); - }; - var childNodesCount = function (element) { - return element.dom.childNodes.length; - }; - - var getHead = function (doc) { - var b = doc.dom.head; - if (b === null || b === undefined) { - throw new Error('Head is not available yet'); - } - return SugarElement.fromDom(b); - }; - - var isShadowRoot = function (dos) { - return isDocumentFragment(dos); - }; - var supported = isFunction(Element.prototype.attachShadow) && isFunction(Node.prototype.getRootNode); - var isSupported = constant(supported); - var getRootNode = supported ? function (e) { - return SugarElement.fromDom(e.dom.getRootNode()); - } : documentOrOwner; - var getStyleContainer = function (dos) { - return isShadowRoot(dos) ? dos : getHead(documentOrOwner(dos)); - }; - 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() && 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 before = function (marker, element) { - var parent$1 = parent(marker); - parent$1.each(function (v) { - v.dom.insertBefore(element.dom, marker.dom); - }); - }; - var after = function (marker, element) { - var sibling = nextSibling(marker); - sibling.fold(function () { - var parent$1 = parent(marker); - parent$1.each(function (v) { - append(v, element); - }); - }, function (v) { - before(v, element); - }); - }; - var prepend = function (parent, element) { - var firstChild$1 = firstChild(parent); - firstChild$1.fold(function () { - append(parent, element); - }, function (v) { - parent.dom.insertBefore(element.dom, v.dom); - }); - }; - var append = function (parent, element) { - parent.dom.appendChild(element.dom); - }; - var wrap = function (element, wrapper) { - before(element, wrapper); - append(wrapper, element); - }; - - var before$1 = function (marker, elements) { - each(elements, function (x) { - before(marker, x); - }); - }; - var append$1 = function (parent, elements) { - each(elements, function (x) { - append(parent, x); - }); - }; - - var empty = function (element) { - element.dom.textContent = ''; - each(children(element), function (rogue) { - remove(rogue); - }); - }; - var remove = function (element) { - var dom = element.dom; - if (dom.parentNode !== null) { - dom.parentNode.removeChild(dom); - } - }; - var unwrap = function (wrapper) { - var children$1 = children(wrapper); - if (children$1.length > 0) { - before$1(wrapper, children$1); - } - remove(wrapper); - }; - - 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 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 boxPosition = function (dom) { - var box = dom.getBoundingClientRect(); - return SugarPosition(box.left, box.top); - }; - var firstDefinedOrZero = function (a, b) { - if (a !== undefined) { - return a; - } else { - return b !== undefined ? b : 0; - } - }; - var absolute = function (element) { - var doc = element.dom.ownerDocument; - var body = doc.body; - var win = doc.defaultView; - var html = doc.documentElement; - if (body === element.dom) { - return SugarPosition(body.offsetLeft, body.offsetTop); - } - var scrollTop = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageYOffset, html.scrollTop); - var scrollLeft = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageXOffset, html.scrollLeft); - var clientTop = firstDefinedOrZero(html.clientTop, body.clientTop); - var clientLeft = firstDefinedOrZero(html.clientLeft, body.clientLeft); - return viewport(element).translate(scrollLeft - clientLeft, scrollTop - clientTop); - }; - var viewport = function (element) { - var dom = element.dom; - var doc = dom.ownerDocument; - var body = doc.body; - if (body === dom) { - return SugarPosition(body.offsetLeft, body.offsetTop); - } - if (!inBody(element)) { - return SugarPosition(0, 0); - } - return boxPosition(dom); - }; - - var get$2 = 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 to = function (x, y, _DOC) { - var doc = _DOC !== undefined ? _DOC.dom : document; - var win = doc.defaultView; - if (win) { - win.scrollTo(x, y); - } - }; - var intoView = function (element, alignToTop) { - var isSafari = detect$3().browser.isSafari(); - if (isSafari && isFunction(element.dom.scrollIntoViewIfNeeded)) { - element.dom.scrollIntoViewIfNeeded(false); - } else { - element.dom.scrollIntoView(alignToTop); - } - }; - - var get$3 = 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$2(SugarElement.fromDom(doc)); - return get$3(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 isNodeType = function (type) { - return function (node) { - return !!node && node.nodeType === type; - }; - }; - var isRestrictedNode = function (node) { - return !!node && !Object.getPrototypeOf(node); - }; - var isElement$1 = isNodeType(1); - var matchNodeNames = function (names) { - var lowercasedNames = names.map(function (s) { - return s.toLowerCase(); - }); - return function (node) { - if (node && node.nodeName) { - var nodeName = node.nodeName.toLowerCase(); - return contains(lowercasedNames, nodeName); - } - return false; - }; - }; - var matchStyleValues = function (name, values) { - var items = values.toLowerCase().split(' '); - return function (node) { - var i, cssValue; - if (isElement$1(node)) { - for (i = 0; i < items.length; i++) { - var computed = node.ownerDocument.defaultView.getComputedStyle(node, null); - cssValue = computed ? computed.getPropertyValue(name) : null; - if (cssValue === items[i]) { - return true; - } - } - } - return false; - }; - }; - var hasAttribute = function (attrName) { - return function (node) { - return isElement$1(node) && node.hasAttribute(attrName); - }; - }; - var hasAttributeValue = function (attrName, attrValue) { - return function (node) { - return isElement$1(node) && node.getAttribute(attrName) === attrValue; - }; - }; - var isBogus = function (node) { - return isElement$1(node) && node.hasAttribute('data-mce-bogus'); - }; - var isBogusAll = function (node) { - return isElement$1(node) && node.getAttribute('data-mce-bogus') === 'all'; - }; - var isTable = function (node) { - return isElement$1(node) && node.tagName === 'TABLE'; - }; - var hasContentEditableState = function (value) { - return function (node) { - if (isElement$1(node)) { - if (node.contentEditable === value) { - return true; - } - if (node.getAttribute('data-mce-contenteditable') === value) { - return true; - } - } - return false; - }; - }; - var isTextareaOrInput = matchNodeNames([ - 'textarea', - 'input' - ]); - var isText$1 = isNodeType(3); - var isComment$1 = isNodeType(8); - var isDocument$1 = isNodeType(9); - var isDocumentFragment$1 = isNodeType(11); - var isBr = matchNodeNames(['br']); - var isImg = matchNodeNames(['img']); - var isContentEditableTrue = hasContentEditableState('true'); - var isContentEditableFalse = hasContentEditableState('false'); - var isTableCell = matchNodeNames([ - 'td', - 'th' - ]); - var isMedia = matchNodeNames([ - 'video', - 'audio', - 'object', - 'embed' - ]); - - var isSupported$1 = function (dom) { - return dom.style !== undefined && isFunction(dom.style.getPropertyValue); - }; - - 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 setAll = function (element, attrs) { - var dom = element.dom; - each$1(attrs, function (v, k) { - rawSet(dom, k, v); - }); - }; - var get$4 = function (element, key) { - var v = element.dom.getAttribute(key); - return v === null ? undefined : v; - }; - var getOpt = function (element, key) { - return Optional.from(get$4(element, key)); - }; - var has$1 = function (element, key) { - var dom = element.dom; - return dom && dom.hasAttribute ? dom.hasAttribute(key) : false; - }; - var remove$1 = function (element, key) { - element.dom.removeAttribute(key); - }; - var clone = function (element) { - return foldl(element.dom.attributes, function (acc, attr) { - acc[attr.name] = attr.value; - return acc; - }, {}); - }; - - 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$1(dom)) { - dom.style.setProperty(property, value); - } - }; - var setAll$1 = function (element, css) { - var dom = element.dom; - each$1(css, function (v, k) { - internalSet(dom, k, v); - }); - }; - var get$5 = 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$1(dom) ? dom.style.getPropertyValue(property) : ''; - }; - var getRaw = function (element, property) { - var dom = element.dom; - var raw = getUnsafeProperty(dom, property); - return Optional.from(raw).filter(function (r) { - return r.length > 0; - }); - }; - var getAllRaw = function (element) { - var css = {}; - var dom = element.dom; - if (isSupported$1(dom)) { - for (var i = 0; i < dom.style.length; i++) { - var ruleName = dom.style.item(i); - css[ruleName] = dom.style[ruleName]; - } - } - return css; - }; - var reflow = function (e) { - return e.dom.offsetWidth; - }; - - var browser$1 = detect$3().browser; - var firstElement = function (nodes) { - return find(nodes, isElement); - }; - var getTableCaptionDeltaY = function (elm) { - if (browser$1.isFirefox() && name(elm) === 'table') { - return firstElement(children(elm)).filter(function (elm) { - return name(elm) === 'caption'; - }).bind(function (caption) { - return firstElement(nextSiblings(caption)).map(function (body) { - var bodyTop = body.dom.offsetTop; - var captionTop = caption.dom.offsetTop; - var captionHeight = caption.dom.offsetHeight; - return bodyTop <= captionTop ? -captionHeight : 0; - }); - }).getOr(0); - } else { - return 0; - } - }; - var hasChild = function (elm, child) { - return elm.children && contains(elm.children, child); - }; - var getPos = function (body, elm, rootElm) { - var x = 0, y = 0, offsetParent; - var doc = body.ownerDocument; - var pos; - rootElm = rootElm ? rootElm : body; - if (elm) { - if (rootElm === body && elm.getBoundingClientRect && get$5(SugarElement.fromDom(body), 'position') === 'static') { - pos = elm.getBoundingClientRect(); - x = pos.left + (doc.documentElement.scrollLeft || body.scrollLeft) - doc.documentElement.clientLeft; - y = pos.top + (doc.documentElement.scrollTop || body.scrollTop) - doc.documentElement.clientTop; - return { - x: x, - y: y - }; - } - offsetParent = elm; - while (offsetParent && offsetParent !== rootElm && offsetParent.nodeType && !hasChild(offsetParent, rootElm)) { - x += offsetParent.offsetLeft || 0; - y += offsetParent.offsetTop || 0; - offsetParent = offsetParent.offsetParent; - } - offsetParent = elm.parentNode; - while (offsetParent && offsetParent !== rootElm && offsetParent.nodeType && !hasChild(offsetParent, rootElm)) { - x -= offsetParent.scrollLeft || 0; - y -= offsetParent.scrollTop || 0; - offsetParent = offsetParent.parentNode; - } - y += getTableCaptionDeltaY(SugarElement.fromDom(elm)); - } - return { - x: x, - y: y - }; - }; - - var exports$1 = {}, module$1 = { exports: exports$1 }; - (function (define, exports, module, require) { - (function (f) { - if (typeof exports === 'object' && typeof module !== 'undefined') { - module.exports = f(); - } else if (typeof define === 'function' && define.amd) { - define([], f); - } else { - var g; - if (typeof window !== 'undefined') { - g = window; - } else if (typeof global !== 'undefined') { - g = global; - } else if (typeof self !== 'undefined') { - g = self; - } else { - g = this; - } - g.EphoxContactWrapper = f(); - } - }(function () { - return function () { - function r(e, n, t) { - function o(i, f) { - if (!n[i]) { - if (!e[i]) { - var c = 'function' == typeof require && require; - if (!f && c) - return c(i, !0); - if (u) - return u(i, !0); - var a = new Error('Cannot find module \'' + i + '\''); - throw a.code = 'MODULE_NOT_FOUND', a; - } - var p = n[i] = { exports: {} }; - e[i][0].call(p.exports, function (r) { - var n = e[i][1][r]; - return o(n || r); - }, p, p.exports, r, e, n, t); - } - return n[i].exports; - } - for (var u = 'function' == typeof require && require, i = 0; i < t.length; i++) - o(t[i]); - return o; - } - return r; - }()({ - 1: [ - function (require, module, exports) { - var process = module.exports = {}; - var cachedSetTimeout; - var cachedClearTimeout; - function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); - } - function defaultClearTimeout() { - throw new Error('clearTimeout has not been defined'); - } - (function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } - }()); - function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - return setTimeout(fun, 0); - } - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - return cachedSetTimeout(fun, 0); - } catch (e) { - try { - return cachedSetTimeout.call(null, fun, 0); - } catch (e) { - return cachedSetTimeout.call(this, fun, 0); - } - } - } - function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - return clearTimeout(marker); - } - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - return cachedClearTimeout(marker); - } catch (e) { - try { - return cachedClearTimeout.call(null, marker); - } catch (e) { - return cachedClearTimeout.call(this, marker); - } - } - } - var queue = []; - var draining = false; - var currentQueue; - var queueIndex = -1; - function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } - } - function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - var len = queue.length; - while (len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); - } - process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } - }; - function Item(fun, array) { - this.fun = fun; - this.array = array; - } - Item.prototype.run = function () { - this.fun.apply(null, this.array); - }; - process.title = 'browser'; - process.browser = true; - process.env = {}; - process.argv = []; - process.version = ''; - process.versions = {}; - function noop() { - } - process.on = noop; - process.addListener = noop; - process.once = noop; - process.off = noop; - process.removeListener = noop; - process.removeAllListeners = noop; - process.emit = noop; - process.prependListener = noop; - process.prependOnceListener = noop; - process.listeners = function (name) { - return []; - }; - process.binding = function (name) { - throw new Error('process.binding is not supported'); - }; - process.cwd = function () { - return '/'; - }; - process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); - }; - process.umask = function () { - return 0; - }; - }, - {} - ], - 2: [ - function (require, module, exports) { - (function (setImmediate) { - (function (root) { - var setTimeoutFunc = setTimeout; - function noop() { - } - function bind(fn, thisArg) { - return function () { - fn.apply(thisArg, arguments); - }; - } - function Promise(fn) { - if (typeof this !== 'object') - throw new TypeError('Promises must be constructed via new'); - if (typeof fn !== 'function') - throw new TypeError('not a function'); - this._state = 0; - this._handled = false; - this._value = undefined; - this._deferreds = []; - doResolve(fn, this); - } - function handle(self, deferred) { - while (self._state === 3) { - self = self._value; - } - if (self._state === 0) { - self._deferreds.push(deferred); - return; - } - self._handled = true; - Promise._immediateFn(function () { - var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected; - if (cb === null) { - (self._state === 1 ? resolve : reject)(deferred.promise, self._value); - return; - } - var ret; - try { - ret = cb(self._value); - } catch (e) { - reject(deferred.promise, e); - return; - } - resolve(deferred.promise, ret); - }); - } - function resolve(self, newValue) { - try { - if (newValue === self) - throw new TypeError('A promise cannot be resolved with itself.'); - if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) { - var then = newValue.then; - if (newValue instanceof Promise) { - self._state = 3; - self._value = newValue; - finale(self); - return; - } else if (typeof then === 'function') { - doResolve(bind(then, newValue), self); - return; - } - } - self._state = 1; - self._value = newValue; - finale(self); - } catch (e) { - reject(self, e); - } - } - function reject(self, newValue) { - self._state = 2; - self._value = newValue; - finale(self); - } - function finale(self) { - if (self._state === 2 && self._deferreds.length === 0) { - Promise._immediateFn(function () { - if (!self._handled) { - Promise._unhandledRejectionFn(self._value); - } - }); - } - for (var i = 0, len = self._deferreds.length; i < len; i++) { - handle(self, self._deferreds[i]); - } - self._deferreds = null; - } - function Handler(onFulfilled, onRejected, promise) { - this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; - this.onRejected = typeof onRejected === 'function' ? onRejected : null; - this.promise = promise; - } - function doResolve(fn, self) { - var done = false; - try { - fn(function (value) { - if (done) - return; - done = true; - resolve(self, value); - }, function (reason) { - if (done) - return; - done = true; - reject(self, reason); - }); - } catch (ex) { - if (done) - return; - done = true; - reject(self, ex); - } - } - Promise.prototype['catch'] = function (onRejected) { - return this.then(null, onRejected); - }; - Promise.prototype.then = function (onFulfilled, onRejected) { - var prom = new this.constructor(noop); - handle(this, new Handler(onFulfilled, onRejected, prom)); - return prom; - }; - Promise.all = function (arr) { - var args = Array.prototype.slice.call(arr); - return new Promise(function (resolve, reject) { - if (args.length === 0) - return resolve([]); - var remaining = args.length; - function res(i, val) { - try { - if (val && (typeof val === 'object' || typeof val === 'function')) { - var then = val.then; - if (typeof then === 'function') { - then.call(val, function (val) { - res(i, val); - }, reject); - return; - } - } - args[i] = val; - if (--remaining === 0) { - resolve(args); - } - } catch (ex) { - reject(ex); - } - } - for (var i = 0; i < args.length; i++) { - res(i, args[i]); - } - }); - }; - Promise.resolve = function (value) { - if (value && typeof value === 'object' && value.constructor === Promise) { - return value; - } - return new Promise(function (resolve) { - resolve(value); - }); - }; - Promise.reject = function (value) { - return new Promise(function (resolve, reject) { - reject(value); - }); - }; - Promise.race = function (values) { - return new Promise(function (resolve, reject) { - for (var i = 0, len = values.length; i < len; i++) { - values[i].then(resolve, reject); - } - }); - }; - Promise._immediateFn = typeof setImmediate === 'function' ? function (fn) { - setImmediate(fn); - } : function (fn) { - setTimeoutFunc(fn, 0); - }; - Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) { - if (typeof console !== 'undefined' && console) { - console.warn('Possible Unhandled Promise Rejection:', err); - } - }; - Promise._setImmediateFn = function _setImmediateFn(fn) { - Promise._immediateFn = fn; - }; - Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) { - Promise._unhandledRejectionFn = fn; - }; - if (typeof module !== 'undefined' && module.exports) { - module.exports = Promise; - } else if (!root.Promise) { - root.Promise = Promise; - } - }(this)); - }.call(this, require('timers').setImmediate)); - }, - { 'timers': 3 } - ], - 3: [ - function (require, module, exports) { - (function (setImmediate, clearImmediate) { - var nextTick = require('process/browser.js').nextTick; - var apply = Function.prototype.apply; - var slice = Array.prototype.slice; - var immediateIds = {}; - var nextImmediateId = 0; - exports.setTimeout = function () { - return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); - }; - exports.setInterval = function () { - return new Timeout(apply.call(setInterval, window, arguments), clearInterval); - }; - exports.clearTimeout = exports.clearInterval = function (timeout) { - timeout.close(); - }; - function Timeout(id, clearFn) { - this._id = id; - this._clearFn = clearFn; - } - Timeout.prototype.unref = Timeout.prototype.ref = function () { - }; - Timeout.prototype.close = function () { - this._clearFn.call(window, this._id); - }; - exports.enroll = function (item, msecs) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = msecs; - }; - exports.unenroll = function (item) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = -1; - }; - exports._unrefActive = exports.active = function (item) { - clearTimeout(item._idleTimeoutId); - var msecs = item._idleTimeout; - if (msecs >= 0) { - item._idleTimeoutId = setTimeout(function onTimeout() { - if (item._onTimeout) - item._onTimeout(); - }, msecs); - } - }; - exports.setImmediate = typeof setImmediate === 'function' ? setImmediate : function (fn) { - var id = nextImmediateId++; - var args = arguments.length < 2 ? false : slice.call(arguments, 1); - immediateIds[id] = true; - nextTick(function onNextTick() { - if (immediateIds[id]) { - if (args) { - fn.apply(null, args); - } else { - fn.call(null); - } - exports.clearImmediate(id); - } - }); - return id; - }; - exports.clearImmediate = typeof clearImmediate === 'function' ? clearImmediate : function (id) { - delete immediateIds[id]; - }; - }.call(this, require('timers').setImmediate, require('timers').clearImmediate)); - }, - { - 'process/browser.js': 1, - 'timers': 3 - } - ], - 4: [ - function (require, module, exports) { - var promisePolyfill = require('promise-polyfill'); - var Global = function () { - if (typeof window !== 'undefined') { - return window; - } else { - return Function('return this;')(); - } - }(); - module.exports = { boltExport: Global.Promise || promisePolyfill }; - }, - { 'promise-polyfill': 2 } - ] - }, {}, [4])(4); - })); - }(undefined, exports$1, module$1, undefined)); - var Promise = module$1.exports.boltExport; - - var nu$3 = function (baseFn) { - var data = Optional.none(); - var callbacks = []; - var map = function (f) { - return nu$3(function (nCallback) { - get(function (data) { - nCallback(f(data)); - }); - }); - }; - var get = function (nCallback) { - if (isReady()) { - call(nCallback); - } else { - callbacks.push(nCallback); - } - }; - var set = function (x) { - if (!isReady()) { - data = Optional.some(x); - run(callbacks); - callbacks = []; - } - }; - var isReady = function () { - return data.isSome(); - }; - var run = function (cbs) { - each(cbs, call); - }; - var call = function (cb) { - data.each(function (x) { - setTimeout(function () { - cb(x); - }, 0); - }); - }; - baseFn(set); - return { - get: get, - map: map, - isReady: isReady - }; - }; - var pure = function (a) { - return nu$3(function (callback) { - callback(a); - }); - }; - var LazyValue = { - nu: nu$3, - pure: pure - }; - - var errorReporter = function (err) { - setTimeout(function () { - throw err; - }, 0); - }; - var make = function (run) { - var get = function (callback) { - run().then(callback, errorReporter); - }; - var map = function (fab) { - return make(function () { - return run().then(fab); - }); - }; - var bind = function (aFutureB) { - return make(function () { - return run().then(function (v) { - return aFutureB(v).toPromise(); - }); - }); - }; - var anonBind = function (futureB) { - return make(function () { - return run().then(function () { - return futureB.toPromise(); - }); - }); - }; - var toLazy = function () { - return LazyValue.nu(get); - }; - var toCached = function () { - var cache = null; - return make(function () { - if (cache === null) { - cache = run(); - } - return cache; - }); - }; - var toPromise = run; - return { - map: map, - bind: bind, - anonBind: anonBind, - toLazy: toLazy, - toCached: toCached, - toPromise: toPromise, - get: get - }; - }; - var nu$4 = function (baseFn) { - return make(function () { - return new Promise(baseFn); - }); - }; - var pure$1 = function (a) { - return make(function () { - return Promise.resolve(a); - }); - }; - var Future = { - nu: nu$4, - pure: pure$1 - }; - - var par = function (asyncValues, nu) { - return nu(function (callback) { - var r = []; - var count = 0; - var cb = function (i) { - return function (value) { - r[i] = value; - count++; - if (count >= asyncValues.length) { - callback(r); - } - }; - }; - if (asyncValues.length === 0) { - callback([]); - } else { - each(asyncValues, function (asyncValue, i) { - asyncValue.get(cb(i)); - }); - } - }); - }; - - var par$1 = function (futures) { - return par(futures, Future.nu); - }; - - var value = function (o) { - var is = function (v) { - return o === v; - }; - var or = function (_opt) { - return value(o); - }; - var orThunk = function (_f) { - return value(o); - }; - var map = function (f) { - return value(f(o)); - }; - var mapError = function (_f) { - return value(o); - }; - var each = function (f) { - f(o); - }; - var bind = function (f) { - return f(o); - }; - var fold = function (_, onValue) { - return onValue(o); - }; - var exists = function (f) { - return f(o); - }; - var forall = function (f) { - return f(o); - }; - var toOptional = function () { - return Optional.some(o); - }; - return { - is: is, - isValue: always, - isError: never, - getOr: constant(o), - getOrThunk: constant(o), - getOrDie: constant(o), - or: or, - orThunk: orThunk, - fold: fold, - map: map, - mapError: mapError, - each: each, - bind: bind, - exists: exists, - forall: forall, - toOptional: toOptional - }; - }; - var error = function (message) { - var getOrThunk = function (f) { - return f(); - }; - var getOrDie = function () { - return die(String(message))(); - }; - var or = function (opt) { - return opt; - }; - var orThunk = function (f) { - return f(); - }; - var map = function (_f) { - return error(message); - }; - var mapError = function (f) { - return error(f(message)); - }; - var bind = function (_f) { - return error(message); - }; - var fold = function (onError, _) { - return onError(message); - }; - return { - is: never, - isValue: never, - isError: always, - getOr: identity, - getOrThunk: getOrThunk, - getOrDie: getOrDie, - or: or, - orThunk: orThunk, - fold: fold, - map: map, - mapError: mapError, - each: noop, - bind: bind, - exists: never, - forall: always, - toOptional: Optional.none - }; - }; - var fromOption = function (opt, err) { - return opt.fold(function () { - return error(err); - }, value); - }; - var Result = { - value: value, - error: error, - fromOption: fromOption - }; - - var generate = function (cases) { - if (!isArray(cases)) { - throw new Error('cases must be an array'); - } - if (cases.length === 0) { - throw new Error('there must be at least one case'); - } - var constructors = []; - var adt = {}; - each(cases, function (acase, count) { - var keys$1 = keys(acase); - if (keys$1.length !== 1) { - throw new Error('one and only one name per case'); - } - var key = keys$1[0]; - var value = acase[key]; - if (adt[key] !== undefined) { - throw new Error('duplicate key detected:' + key); - } else if (key === 'cata') { - throw new Error('cannot have a case named cata (sorry)'); - } else if (!isArray(value)) { - throw new Error('case arguments must be an array'); - } - constructors.push(key); - adt[key] = function () { - var argLength = arguments.length; - if (argLength !== value.length) { - throw new Error('Wrong number of arguments to case ' + key + '. Expected ' + value.length + ' (' + value + '), got ' + argLength); - } - var args = new Array(argLength); - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i]; - } - var match = function (branches) { - var branchKeys = keys(branches); - if (constructors.length !== branchKeys.length) { - throw new Error('Wrong number of arguments to match. Expected: ' + constructors.join(',') + '\nActual: ' + branchKeys.join(',')); - } - var allReqd = forall(constructors, function (reqKey) { - return contains(branchKeys, reqKey); - }); - if (!allReqd) { - throw new Error('Not all branches were specified when using match. Specified: ' + branchKeys.join(', ') + '\nRequired: ' + constructors.join(', ')); - } - return branches[key].apply(null, args); - }; - return { - fold: function () { - if (arguments.length !== cases.length) { - throw new Error('Wrong number of arguments to fold. Expected ' + cases.length + ', got ' + arguments.length); - } - var target = arguments[count]; - return target.apply(null, args); - }, - match: match, - log: function (label) { - console.log(label, { - constructors: constructors, - constructor: key, - params: args - }); - } - }; - }; - }); - return adt; - }; - var Adt = { generate: generate }; - - var comparison = Adt.generate([ - { - bothErrors: [ - 'error1', - 'error2' - ] - }, - { - firstError: [ - 'error1', - 'value2' - ] - }, - { - secondError: [ - 'value1', - 'error2' - ] - }, - { - bothValues: [ - 'value1', - 'value2' - ] - } - ]); - var unite = function (result) { - return result.fold(identity, identity); - }; - - function ClosestOrAncestor (is, ancestor, scope, a, isRoot) { - if (is(scope, a)) { - return Optional.some(scope); - } else if (isFunction(isRoot) && isRoot(scope)) { - return Optional.none(); - } else { - return ancestor(scope, a, isRoot); - } - } - - var ancestor = function (scope, predicate, isRoot) { - var element = scope.dom; - var stop = isFunction(isRoot) ? isRoot : never; - while (element.parentNode) { - element = element.parentNode; - var el = SugarElement.fromDom(element); - if (predicate(el)) { - return Optional.some(el); - } else if (stop(el)) { - break; - } - } - return Optional.none(); - }; - var closest = function (scope, predicate, isRoot) { - var is = function (s, test) { - return test(s); - }; - return ClosestOrAncestor(is, ancestor, scope, predicate, isRoot); - }; - var sibling = function (scope, predicate) { - var element = scope.dom; - if (!element.parentNode) { - return Optional.none(); - } - return child$1(SugarElement.fromDom(element.parentNode), function (x) { - return !eq$2(scope, x) && predicate(x); - }); - }; - var child$1 = function (scope, predicate) { - var pred = function (node) { - return predicate(SugarElement.fromDom(node)); - }; - var result = find(scope.dom.childNodes, pred); - return result.map(SugarElement.fromDom); - }; - - var ancestor$1 = function (scope, selector, isRoot) { - return ancestor(scope, function (e) { - return is$1(e, selector); - }, isRoot); - }; - var descendant = function (scope, selector) { - return one(selector, scope); - }; - var closest$1 = function (scope, selector, isRoot) { - var is = function (element, selector) { - return is$1(element, selector); - }; - return ClosestOrAncestor(is, ancestor$1, scope, selector, isRoot); - }; - - var promise = function () { - function bind(fn, thisArg) { - return function () { - fn.apply(thisArg, arguments); - }; - } - var isArray = Array.isArray || function (value) { - return Object.prototype.toString.call(value) === '[object Array]'; - }; - var Promise = function (fn) { - if (typeof this !== 'object') { - throw new TypeError('Promises must be constructed via new'); - } - if (typeof fn !== 'function') { - throw new TypeError('not a function'); - } - this._state = null; - this._value = null; - this._deferreds = []; - doResolve(fn, bind(resolve, this), bind(reject, this)); - }; - var asap = Promise.immediateFn || typeof setImmediate === 'function' && setImmediate || function (fn) { - setTimeout(fn, 1); - }; - function handle(deferred) { - var me = this; - if (this._state === null) { - this._deferreds.push(deferred); - return; - } - asap(function () { - var cb = me._state ? deferred.onFulfilled : deferred.onRejected; - if (cb === null) { - (me._state ? deferred.resolve : deferred.reject)(me._value); - return; - } - var ret; - try { - ret = cb(me._value); - } catch (e) { - deferred.reject(e); - return; - } - deferred.resolve(ret); - }); - } - function resolve(newValue) { - try { - if (newValue === this) { - throw new TypeError('A promise cannot be resolved with itself.'); - } - if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) { - var then = newValue.then; - if (typeof then === 'function') { - doResolve(bind(then, newValue), bind(resolve, this), bind(reject, this)); - return; - } - } - this._state = true; - this._value = newValue; - finale.call(this); - } catch (e) { - reject.call(this, e); - } - } - function reject(newValue) { - this._state = false; - this._value = newValue; - finale.call(this); - } - function finale() { - for (var i = 0, len = this._deferreds.length; i < len; i++) { - handle.call(this, this._deferreds[i]); - } - this._deferreds = null; - } - function Handler(onFulfilled, onRejected, resolve, reject) { - this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; - this.onRejected = typeof onRejected === 'function' ? onRejected : null; - this.resolve = resolve; - this.reject = reject; - } - function doResolve(fn, onFulfilled, onRejected) { - var done = false; - try { - fn(function (value) { - if (done) { - return; - } - done = true; - onFulfilled(value); - }, function (reason) { - if (done) { - return; - } - done = true; - onRejected(reason); - }); - } catch (ex) { - if (done) { - return; - } - done = true; - onRejected(ex); - } - } - Promise.prototype.catch = function (onRejected) { - return this.then(null, onRejected); - }; - Promise.prototype.then = function (onFulfilled, onRejected) { - var me = this; - return new Promise(function (resolve, reject) { - handle.call(me, new Handler(onFulfilled, onRejected, resolve, reject)); - }); - }; - Promise.all = function () { - var args = Array.prototype.slice.call(arguments.length === 1 && isArray(arguments[0]) ? arguments[0] : arguments); - return new Promise(function (resolve, reject) { - if (args.length === 0) { - return resolve([]); - } - var remaining = args.length; - function res(i, val) { - try { - if (val && (typeof val === 'object' || typeof val === 'function')) { - var then = val.then; - if (typeof then === 'function') { - then.call(val, function (val) { - res(i, val); - }, reject); - return; - } - } - args[i] = val; - if (--remaining === 0) { - resolve(args); - } - } catch (ex) { - reject(ex); - } - } - for (var i = 0; i < args.length; i++) { - res(i, args[i]); - } - }); - }; - Promise.resolve = function (value) { - if (value && typeof value === 'object' && value.constructor === Promise) { - return value; - } - return new Promise(function (resolve) { - resolve(value); - }); - }; - Promise.reject = function (value) { - return new Promise(function (resolve, reject) { - reject(value); - }); - }; - Promise.race = function (values) { - return new Promise(function (resolve, reject) { - for (var i = 0, len = values.length; i < len; i++) { - values[i].then(resolve, reject); - } - }); - }; - return Promise; - }; - var promiseObj = window.Promise ? window.Promise : promise(); - - var requestAnimationFramePromise; - var requestAnimationFrame = function (callback, element) { - var i, requestAnimationFrameFunc = window.requestAnimationFrame; - var vendors = [ - 'ms', - 'moz', - 'webkit' - ]; - var featurefill = function (callback) { - window.setTimeout(callback, 0); - }; - for (i = 0; i < vendors.length && !requestAnimationFrameFunc; i++) { - requestAnimationFrameFunc = window[vendors[i] + 'RequestAnimationFrame']; - } - if (!requestAnimationFrameFunc) { - requestAnimationFrameFunc = featurefill; - } - requestAnimationFrameFunc(callback, element); - }; - var wrappedSetTimeout = function (callback, time) { - if (typeof time !== 'number') { - time = 0; - } - return setTimeout(callback, time); - }; - var wrappedSetInterval = function (callback, time) { - if (typeof time !== 'number') { - time = 1; - } - return setInterval(callback, time); - }; - var wrappedClearTimeout = function (id) { - return clearTimeout(id); - }; - var wrappedClearInterval = function (id) { - return clearInterval(id); - }; - var debounce = function (callback, time) { - var timer; - var func = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - clearTimeout(timer); - timer = wrappedSetTimeout(function () { - callback.apply(this, args); - }, time); - }; - func.stop = function () { - clearTimeout(timer); - }; - return func; - }; - var Delay = { - requestAnimationFrame: function (callback, element) { - if (requestAnimationFramePromise) { - requestAnimationFramePromise.then(callback); - return; - } - requestAnimationFramePromise = new promiseObj(function (resolve) { - if (!element) { - element = document.body; - } - requestAnimationFrame(resolve, element); - }).then(callback); - }, - setTimeout: wrappedSetTimeout, - setInterval: wrappedSetInterval, - setEditorTimeout: function (editor, callback, time) { - return wrappedSetTimeout(function () { - if (!editor.removed) { - callback(); - } - }, time); - }, - setEditorInterval: function (editor, callback, time) { - var timer = wrappedSetInterval(function () { - if (!editor.removed) { - callback(); - } else { - clearInterval(timer); - } - }, time); - return timer; - }, - debounce: debounce, - throttle: debounce, - clearInterval: wrappedClearInterval, - clearTimeout: wrappedClearTimeout - }; - - function StyleSheetLoader(documentOrShadowRoot, settings) { - if (settings === void 0) { - settings = {}; - } - var idCount = 0; - var loadedStates = {}; - var edos = SugarElement.fromDom(documentOrShadowRoot); - var doc = documentOrOwner(edos); - var maxLoadTime = settings.maxLoadTime || 5000; - var _setReferrerPolicy = function (referrerPolicy) { - settings.referrerPolicy = referrerPolicy; - }; - var addStyle = function (element) { - append(getStyleContainer(edos), element); - }; - var removeStyle = function (id) { - var styleContainer = getStyleContainer(edos); - descendant(styleContainer, '#' + id).each(remove); - }; - var getOrCreateState = function (url) { - return get$1(loadedStates, url).getOrThunk(function () { - return { - id: 'mce-u' + idCount++, - passed: [], - failed: [], - count: 0 - }; - }); - }; - var load = function (url, success, failure) { - var link; - var urlWithSuffix = Tools._addCacheSuffix(url); - var state = getOrCreateState(urlWithSuffix); - loadedStates[urlWithSuffix] = state; - state.count++; - var resolve = function (callbacks, status) { - var i = callbacks.length; - while (i--) { - callbacks[i](); - } - state.status = status; - state.passed = []; - state.failed = []; - if (link) { - link.onload = null; - link.onerror = null; - link = null; - } - }; - var passed = function () { - return resolve(state.passed, 2); - }; - var failed = function () { - return resolve(state.failed, 3); - }; - var wait = function (testCallback, waitCallback) { - if (!testCallback()) { - if (Date.now() - startTime < maxLoadTime) { - Delay.setTimeout(waitCallback); - } else { - failed(); - } - } - }; - var waitForWebKitLinkLoaded = function () { - wait(function () { - var styleSheets = documentOrShadowRoot.styleSheets; - var i = styleSheets.length; - while (i--) { - var styleSheet = styleSheets[i]; - var owner = styleSheet.ownerNode; - if (owner && owner.id === link.id) { - passed(); - return true; - } - } - return false; - }, waitForWebKitLinkLoaded); - }; - if (success) { - state.passed.push(success); - } - if (failure) { - state.failed.push(failure); - } - if (state.status === 1) { - return; - } - if (state.status === 2) { - passed(); - return; - } - if (state.status === 3) { - failed(); - return; - } - state.status = 1; - var linkElem = SugarElement.fromTag('link', doc.dom); - setAll(linkElem, { - rel: 'stylesheet', - type: 'text/css', - id: state.id - }); - var startTime = Date.now(); - if (settings.contentCssCors) { - set(linkElem, 'crossOrigin', 'anonymous'); - } - if (settings.referrerPolicy) { - set(linkElem, 'referrerpolicy', settings.referrerPolicy); - } - link = linkElem.dom; - link.onload = waitForWebKitLinkLoaded; - link.onerror = failed; - addStyle(linkElem); - set(linkElem, 'href', urlWithSuffix); - }; - var loadF = function (url) { - return Future.nu(function (resolve) { - load(url, compose(resolve, constant(Result.value(url))), compose(resolve, constant(Result.error(url)))); - }); - }; - var loadAll = function (urls, success, failure) { - par$1(map(urls, loadF)).get(function (result) { - var parts = partition(result, function (r) { - return r.isValue(); - }); - if (parts.fail.length > 0) { - failure(parts.fail.map(unite)); - } else { - success(parts.pass.map(unite)); - } - }); - }; - var unload = function (url) { - var urlWithSuffix = Tools._addCacheSuffix(url); - get$1(loadedStates, urlWithSuffix).each(function (state) { - var count = --state.count; - if (count === 0) { - delete loadedStates[urlWithSuffix]; - removeStyle(state.id); - } - }); - }; - var unloadAll = function (urls) { - each(urls, function (url) { - unload(url); - }); - }; - return { - load: load, - loadAll: loadAll, - unload: unload, - unloadAll: unloadAll, - _setReferrerPolicy: _setReferrerPolicy - }; - } - - var create$1 = function () { - var map = new WeakMap(); - var forElement = function (referenceElement, settings) { - var root = getRootNode(referenceElement); - var rootDom = root.dom; - return Optional.from(map.get(rootDom)).getOrThunk(function () { - var sl = StyleSheetLoader(rootDom, settings); - map.set(rootDom, sl); - return sl; - }); - }; - return { forElement: forElement }; - }; - var instance = create$1(); - - var DomTreeWalker = function () { - function DomTreeWalker(startNode, rootNode) { - this.node = startNode; - this.rootNode = rootNode; - this.current = this.current.bind(this); - this.next = this.next.bind(this); - this.prev = this.prev.bind(this); - this.prev2 = this.prev2.bind(this); - } - DomTreeWalker.prototype.current = function () { - return this.node; - }; - DomTreeWalker.prototype.next = function (shallow) { - this.node = this.findSibling(this.node, 'firstChild', 'nextSibling', shallow); - return this.node; - }; - DomTreeWalker.prototype.prev = function (shallow) { - this.node = this.findSibling(this.node, 'lastChild', 'previousSibling', shallow); - return this.node; - }; - DomTreeWalker.prototype.prev2 = function (shallow) { - this.node = this.findPreviousNode(this.node, 'lastChild', 'previousSibling', shallow); - return this.node; - }; - DomTreeWalker.prototype.findSibling = function (node, startName, siblingName, shallow) { - var sibling, parent; - if (node) { - if (!shallow && node[startName]) { - return node[startName]; - } - if (node !== this.rootNode) { - sibling = node[siblingName]; - if (sibling) { - return sibling; - } - for (parent = node.parentNode; parent && parent !== this.rootNode; parent = parent.parentNode) { - sibling = parent[siblingName]; - if (sibling) { - return sibling; - } - } - } - } - }; - DomTreeWalker.prototype.findPreviousNode = function (node, startName, siblingName, shallow) { - var sibling, parent, child; - if (node) { - sibling = node[siblingName]; - if (this.rootNode && sibling === this.rootNode) { - return; - } - if (sibling) { - if (!shallow) { - for (child = sibling[startName]; child; child = child[startName]) { - if (!child[startName]) { - return child; - } - } - } - return sibling; - } - parent = node.parentNode; - if (parent && parent !== this.rootNode) { - return parent; - } - } - }; - return DomTreeWalker; - }(); - - var blocks = [ - 'article', - 'aside', - 'details', - 'div', - 'dt', - 'figcaption', - 'footer', - 'form', - 'fieldset', - 'header', - 'hgroup', - 'html', - 'main', - 'nav', - 'section', - 'summary', - 'body', - 'p', - 'dl', - 'multicol', - 'dd', - 'figure', - 'address', - 'center', - 'blockquote', - 'h1', - 'h2', - 'h3', - 'h4', - 'h5', - 'h6', - 'listing', - 'xmp', - 'pre', - 'plaintext', - 'menu', - 'dir', - 'ul', - 'ol', - 'li', - 'hr', - 'table', - 'tbody', - 'thead', - 'tfoot', - 'th', - 'tr', - 'td', - 'caption' - ]; - var tableCells = [ - 'td', - 'th' - ]; - var tableSections = [ - 'thead', - 'tbody', - 'tfoot' - ]; - var textBlocks = [ - 'h1', - 'h2', - 'h3', - 'h4', - 'h5', - 'h6', - 'p', - 'div', - 'address', - 'pre', - 'form', - 'blockquote', - 'center', - 'dir', - 'fieldset', - 'header', - 'footer', - 'article', - 'section', - 'hgroup', - 'aside', - 'nav', - 'figure' - ]; - var headings = [ - 'h1', - 'h2', - 'h3', - 'h4', - 'h5', - 'h6' - ]; - var listItems = [ - 'li', - 'dd', - 'dt' - ]; - var lists = [ - 'ul', - 'ol', - 'dl' - ]; - var wsElements = [ - 'pre', - 'script', - 'textarea', - 'style' - ]; - var lazyLookup = function (items) { - var lookup; - return function (node) { - lookup = lookup ? lookup : mapToObject(items, always); - return lookup.hasOwnProperty(name(node)); - }; - }; - var isHeading = lazyLookup(headings); - var isBlock = lazyLookup(blocks); - var isTable$1 = function (node) { - return name(node) === 'table'; - }; - var isInline = function (node) { - return isElement(node) && !isBlock(node); - }; - var isBr$1 = function (node) { - return isElement(node) && name(node) === 'br'; - }; - var isTextBlock = lazyLookup(textBlocks); - var isList = lazyLookup(lists); - var isListItem = lazyLookup(listItems); - var isTableSection = lazyLookup(tableSections); - var isTableCell$1 = lazyLookup(tableCells); - var isWsPreserveElement = lazyLookup(wsElements); - - var ancestor$2 = function (scope, selector, isRoot) { - return ancestor$1(scope, selector, isRoot).isSome(); - }; - - var zeroWidth = '\uFEFF'; - var nbsp = '\xA0'; - var isZwsp = function (char) { - return char === zeroWidth; - }; - var removeZwsp = function (s) { - return s.replace(/\uFEFF/g, ''); - }; - - var ZWSP = zeroWidth; - var isZwsp$1 = isZwsp; - var trim$2 = removeZwsp; - - var isElement$2 = isElement$1; - var isText$2 = isText$1; - var isCaretContainerBlock = function (node) { - if (isText$2(node)) { - node = node.parentNode; - } - return isElement$2(node) && node.hasAttribute('data-mce-caret'); - }; - var isCaretContainerInline = function (node) { - return isText$2(node) && isZwsp$1(node.data); - }; - var isCaretContainer = function (node) { - return isCaretContainerBlock(node) || isCaretContainerInline(node); - }; - var hasContent = function (node) { - return node.firstChild !== node.lastChild || !isBr(node.firstChild); - }; - var insertInline = function (node, before) { - var sibling; - var doc = node.ownerDocument; - var textNode = doc.createTextNode(ZWSP); - var parentNode = node.parentNode; - if (!before) { - sibling = node.nextSibling; - if (isText$2(sibling)) { - if (isCaretContainer(sibling)) { - return sibling; - } - if (startsWithCaretContainer(sibling)) { - sibling.splitText(1); - return sibling; - } - } - if (node.nextSibling) { - parentNode.insertBefore(textNode, node.nextSibling); - } else { - parentNode.appendChild(textNode); - } - } else { - sibling = node.previousSibling; - if (isText$2(sibling)) { - if (isCaretContainer(sibling)) { - return sibling; - } - if (endsWithCaretContainer(sibling)) { - return sibling.splitText(sibling.data.length - 1); - } - } - parentNode.insertBefore(textNode, node); - } - return textNode; - }; - var isBeforeInline = function (pos) { - var container = pos.container(); - if (!isText$1(container)) { - return false; - } - return container.data.charAt(pos.offset()) === ZWSP || pos.isAtStart() && isCaretContainerInline(container.previousSibling); - }; - var isAfterInline = function (pos) { - var container = pos.container(); - if (!isText$1(container)) { - return false; - } - return container.data.charAt(pos.offset() - 1) === ZWSP || pos.isAtEnd() && isCaretContainerInline(container.nextSibling); - }; - var createBogusBr = function () { - var br = document.createElement('br'); - br.setAttribute('data-mce-bogus', '1'); - return br; - }; - var insertBlock = function (blockName, node, before) { - var doc = node.ownerDocument; - var blockNode = doc.createElement(blockName); - blockNode.setAttribute('data-mce-caret', before ? 'before' : 'after'); - blockNode.setAttribute('data-mce-bogus', 'all'); - blockNode.appendChild(createBogusBr()); - var parentNode = node.parentNode; - if (!before) { - if (node.nextSibling) { - parentNode.insertBefore(blockNode, node.nextSibling); - } else { - parentNode.appendChild(blockNode); - } - } else { - parentNode.insertBefore(blockNode, node); - } - return blockNode; - }; - var startsWithCaretContainer = function (node) { - return isText$2(node) && node.data[0] === ZWSP; - }; - var endsWithCaretContainer = function (node) { - return isText$2(node) && node.data[node.data.length - 1] === ZWSP; - }; - var trimBogusBr = function (elm) { - var brs = elm.getElementsByTagName('br'); - var lastBr = brs[brs.length - 1]; - if (isBogus(lastBr)) { - lastBr.parentNode.removeChild(lastBr); - } - }; - var showCaretContainerBlock = function (caretContainer) { - if (caretContainer && caretContainer.hasAttribute('data-mce-caret')) { - trimBogusBr(caretContainer); - caretContainer.removeAttribute('data-mce-caret'); - caretContainer.removeAttribute('data-mce-bogus'); - caretContainer.removeAttribute('style'); - caretContainer.removeAttribute('_moz_abspos'); - return caretContainer; - } - return null; - }; - var isRangeInCaretContainerBlock = function (range) { - return isCaretContainerBlock(range.startContainer); - }; - - var isContentEditableTrue$1 = isContentEditableTrue; - var isContentEditableFalse$1 = isContentEditableFalse; - var isBr$2 = isBr; - var isText$3 = isText$1; - var isInvalidTextElement = matchNodeNames([ - 'script', - 'style', - 'textarea' - ]); - var isAtomicInline = matchNodeNames([ - 'img', - 'input', - 'textarea', - 'hr', - 'iframe', - 'video', - 'audio', - 'object', - 'embed' - ]); - var isTable$2 = matchNodeNames(['table']); - var isCaretContainer$1 = isCaretContainer; - var isCaretCandidate = function (node) { - if (isCaretContainer$1(node)) { - return false; - } - if (isText$3(node)) { - return !isInvalidTextElement(node.parentNode); - } - return isAtomicInline(node) || isBr$2(node) || isTable$2(node) || isNonUiContentEditableFalse(node); - }; - var isUnselectable = function (node) { - return isElement$1(node) && node.getAttribute('unselectable') === 'true'; - }; - var isNonUiContentEditableFalse = function (node) { - return isUnselectable(node) === false && isContentEditableFalse$1(node); - }; - var isInEditable = function (node, root) { - for (node = node.parentNode; node && node !== root; node = node.parentNode) { - if (isNonUiContentEditableFalse(node)) { - return false; - } - if (isContentEditableTrue$1(node)) { - return true; - } - } - return true; - }; - var isAtomicContentEditableFalse = function (node) { - if (!isNonUiContentEditableFalse(node)) { - return false; - } - return foldl(from$1(node.getElementsByTagName('*')), function (result, elm) { - return result || isContentEditableTrue$1(elm); - }, false) !== true; - }; - var isAtomic = function (node) { - return isAtomicInline(node) || isAtomicContentEditableFalse(node); - }; - var isEditableCaretCandidate = function (node, root) { - return isCaretCandidate(node) && isInEditable(node, root); - }; - - var whiteSpaceRegExp$1 = /^[ \t\r\n]*$/; - var isWhitespaceText = function (text) { - return whiteSpaceRegExp$1.test(text); - }; - - var hasWhitespacePreserveParent = function (node, rootNode) { - var rootElement = SugarElement.fromDom(rootNode); - var startNode = SugarElement.fromDom(node); - return ancestor$2(startNode, 'pre,code', curry(eq$2, rootElement)); - }; - var isWhitespace = function (node, rootNode) { - return isText$1(node) && isWhitespaceText(node.data) && hasWhitespacePreserveParent(node, rootNode) === false; - }; - var isNamedAnchor = function (node) { - return isElement$1(node) && node.nodeName === 'A' && !node.hasAttribute('href') && (node.hasAttribute('name') || node.hasAttribute('id')); - }; - var isContent = function (node, rootNode) { - return isCaretCandidate(node) && isWhitespace(node, rootNode) === false || isNamedAnchor(node) || isBookmark(node); - }; - var isBookmark = hasAttribute('data-mce-bookmark'); - var isBogus$1 = hasAttribute('data-mce-bogus'); - var isBogusAll$1 = hasAttributeValue('data-mce-bogus', 'all'); - var isEmptyNode = function (targetNode, skipBogus) { - var node, brCount = 0; - if (isContent(targetNode, targetNode)) { - return false; - } else { - node = targetNode.firstChild; - if (!node) { - return true; - } - var walker = new DomTreeWalker(node, targetNode); - do { - if (skipBogus) { - if (isBogusAll$1(node)) { - node = walker.next(true); - continue; - } - if (isBogus$1(node)) { - node = walker.next(); - continue; - } - } - if (isBr(node)) { - brCount++; - node = walker.next(); - continue; - } - if (isContent(node, targetNode)) { - return false; - } - node = walker.next(); - } while (node); - return brCount <= 1; - } - }; - var isEmpty = function (elm, skipBogus) { - if (skipBogus === void 0) { - skipBogus = true; - } - return isEmptyNode(elm.dom, skipBogus); - }; - - var isSpan = function (node) { - return node.nodeName.toLowerCase() === 'span'; - }; - var isInlineContent = function (node, root) { - return isNonNullable(node) && (isContent(node, root) || isInline(SugarElement.fromDom(node))); - }; - var surroundedByInlineContent = function (node, root) { - var prev = new DomTreeWalker(node, root).prev(false); - var next = new DomTreeWalker(node, root).next(false); - var prevIsInline = isUndefined(prev) || isInlineContent(prev, root); - var nextIsInline = isUndefined(next) || isInlineContent(next, root); - return prevIsInline && nextIsInline; - }; - var isBookmarkNode = function (node) { - return isSpan(node) && node.getAttribute('data-mce-type') === 'bookmark'; - }; - var isKeepTextNode = function (node, root) { - return isText$1(node) && node.data.length > 0 && surroundedByInlineContent(node, root); - }; - var isKeepElement = function (node) { - return isElement$1(node) ? node.childNodes.length > 0 : false; - }; - var isDocument$2 = function (node) { - return isDocumentFragment$1(node) || isDocument$1(node); - }; - var trimNode = function (dom, node, root) { - var rootNode = root || node; - if (isElement$1(node) && isBookmarkNode(node)) { - return node; - } - var children = node.childNodes; - for (var i = children.length - 1; i >= 0; i--) { - trimNode(dom, children[i], rootNode); - } - if (isElement$1(node)) { - var currentChildren = node.childNodes; - if (currentChildren.length === 1 && isBookmarkNode(currentChildren[0])) { - node.parentNode.insertBefore(currentChildren[0], node); - } - } - if (!isDocument$2(node) && !isContent(node, rootNode) && !isKeepElement(node) && !isKeepTextNode(node, rootNode)) { - dom.remove(node); - } - return node; - }; - - var makeMap$1 = Tools.makeMap; - var attrsCharsRegExp = /[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g; - var textCharsRegExp = /[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g; - var rawCharsRegExp = /[<>&\"\']/g; - var entityRegExp = /&#([a-z0-9]+);?|&([a-z0-9]+);/gi; - var asciiMap = { - 128: '\u20AC', - 130: '\u201A', - 131: '\u0192', - 132: '\u201E', - 133: '\u2026', - 134: '\u2020', - 135: '\u2021', - 136: '\u02c6', - 137: '\u2030', - 138: '\u0160', - 139: '\u2039', - 140: '\u0152', - 142: '\u017d', - 145: '\u2018', - 146: '\u2019', - 147: '\u201C', - 148: '\u201D', - 149: '\u2022', - 150: '\u2013', - 151: '\u2014', - 152: '\u02DC', - 153: '\u2122', - 154: '\u0161', - 155: '\u203A', - 156: '\u0153', - 158: '\u017e', - 159: '\u0178' - }; - var baseEntities = { - '"': '"', - '\'': ''', - '<': '<', - '>': '>', - '&': '&', - '`': '`' - }; - var reverseEntities = { - '<': '<', - '>': '>', - '&': '&', - '"': '"', - ''': '\'' - }; - var nativeDecode = function (text) { - var elm = SugarElement.fromTag('div').dom; - elm.innerHTML = text; - return elm.textContent || elm.innerText || text; - }; - var buildEntitiesLookup = function (items, radix) { - var i, chr, entity; - var lookup = {}; - if (items) { - items = items.split(','); - radix = radix || 10; - for (i = 0; i < items.length; i += 2) { - chr = String.fromCharCode(parseInt(items[i], radix)); - if (!baseEntities[chr]) { - entity = '&' + items[i + 1] + ';'; - lookup[chr] = entity; - lookup[entity] = chr; - } - } - return lookup; - } - }; - var namedEntities = buildEntitiesLookup('50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,' + '5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,' + '5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,' + '5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,' + '68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,' + '6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,' + '6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,' + '75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,' + '7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,' + '7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,' + 'sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,' + 'st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,' + 't9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,' + 'tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,' + 'u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,' + '81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,' + '8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,' + '8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,' + '8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,' + '8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,' + 'nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,' + 'rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,' + 'Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,' + '80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,' + '811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro', 32); - var encodeRaw = function (text, attr) { - return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) { - return baseEntities[chr] || chr; - }); - }; - var encodeAllRaw = function (text) { - return ('' + text).replace(rawCharsRegExp, function (chr) { - return baseEntities[chr] || chr; - }); - }; - var encodeNumeric = function (text, attr) { - return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) { - if (chr.length > 1) { - return '&#' + ((chr.charCodeAt(0) - 55296) * 1024 + (chr.charCodeAt(1) - 56320) + 65536) + ';'; - } - return baseEntities[chr] || '&#' + chr.charCodeAt(0) + ';'; - }); - }; - var encodeNamed = function (text, attr, entities) { - entities = entities || namedEntities; - return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) { - return baseEntities[chr] || entities[chr] || chr; - }); - }; - var getEncodeFunc = function (name, entities) { - var entitiesMap = buildEntitiesLookup(entities) || namedEntities; - var encodeNamedAndNumeric = function (text, attr) { - return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) { - if (baseEntities[chr] !== undefined) { - return baseEntities[chr]; - } - if (entitiesMap[chr] !== undefined) { - return entitiesMap[chr]; - } - if (chr.length > 1) { - return '&#' + ((chr.charCodeAt(0) - 55296) * 1024 + (chr.charCodeAt(1) - 56320) + 65536) + ';'; - } - return '&#' + chr.charCodeAt(0) + ';'; - }); - }; - var encodeCustomNamed = function (text, attr) { - return encodeNamed(text, attr, entitiesMap); - }; - var nameMap = makeMap$1(name.replace(/\+/g, ',')); - if (nameMap.named && nameMap.numeric) { - return encodeNamedAndNumeric; - } - if (nameMap.named) { - if (entities) { - return encodeCustomNamed; - } - return encodeNamed; - } - if (nameMap.numeric) { - return encodeNumeric; - } - return encodeRaw; - }; - var decode = function (text) { - return text.replace(entityRegExp, function (all, numeric) { - if (numeric) { - if (numeric.charAt(0).toLowerCase() === 'x') { - numeric = parseInt(numeric.substr(1), 16); - } else { - numeric = parseInt(numeric, 10); - } - if (numeric > 65535) { - numeric -= 65536; - return String.fromCharCode(55296 + (numeric >> 10), 56320 + (numeric & 1023)); - } - return asciiMap[numeric] || String.fromCharCode(numeric); - } - return reverseEntities[all] || namedEntities[all] || nativeDecode(all); - }); - }; - var Entities = { - encodeRaw: encodeRaw, - encodeAllRaw: encodeAllRaw, - encodeNumeric: encodeNumeric, - encodeNamed: encodeNamed, - getEncodeFunc: getEncodeFunc, - decode: decode - }; - - var mapCache = {}, dummyObj = {}; - var makeMap$2 = Tools.makeMap, each$3 = Tools.each, extend$1 = Tools.extend, explode$1 = Tools.explode, inArray = Tools.inArray; - var split = function (items, delim) { - items = Tools.trim(items); - return items ? items.split(delim || ' ') : []; - }; - var compileSchema = function (type) { - var schema = {}; - var globalAttributes, blockContent; - var phrasingContent, flowContent, html4BlockContent, html4PhrasingContent; - var add = function (name, attributes, children) { - var ni, attributesOrder, element; - var arrayToMap = function (array, obj) { - var map = {}; - var i, l; - for (i = 0, l = array.length; i < l; i++) { - map[array[i]] = obj || {}; - } - return map; - }; - children = children || []; - attributes = attributes || ''; - if (typeof children === 'string') { - children = split(children); - } - var names = split(name); - ni = names.length; - while (ni--) { - attributesOrder = split([ - globalAttributes, - attributes - ].join(' ')); - element = { - attributes: arrayToMap(attributesOrder), - attributesOrder: attributesOrder, - children: arrayToMap(children, dummyObj) - }; - schema[names[ni]] = element; - } - }; - var addAttrs = function (name, attributes) { - var ni, schemaItem, i, l; - var names = split(name); - ni = names.length; - var attrs = split(attributes); - while (ni--) { - schemaItem = schema[names[ni]]; - for (i = 0, l = attrs.length; i < l; i++) { - schemaItem.attributes[attrs[i]] = {}; - schemaItem.attributesOrder.push(attrs[i]); - } - } - }; - if (mapCache[type]) { - return mapCache[type]; - } - globalAttributes = 'id accesskey class dir lang style tabindex title role'; - blockContent = 'address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul'; - phrasingContent = 'a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd ' + 'label map noscript object q s samp script select small span strong sub sup ' + 'textarea u var #text #comment'; - if (type !== 'html4') { - globalAttributes += ' contenteditable contextmenu draggable dropzone ' + 'hidden spellcheck translate'; - blockContent += ' article aside details dialog figure main header footer hgroup section nav'; - phrasingContent += ' audio canvas command datalist mark meter output picture ' + 'progress time wbr video ruby bdi keygen'; - } - if (type !== 'html5-strict') { - globalAttributes += ' xml:lang'; - html4PhrasingContent = 'acronym applet basefont big font strike tt'; - phrasingContent = [ - phrasingContent, - html4PhrasingContent - ].join(' '); - each$3(split(html4PhrasingContent), function (name) { - add(name, '', phrasingContent); - }); - html4BlockContent = 'center dir isindex noframes'; - blockContent = [ - blockContent, - html4BlockContent - ].join(' '); - flowContent = [ - blockContent, - phrasingContent - ].join(' '); - each$3(split(html4BlockContent), function (name) { - add(name, '', flowContent); - }); - } - flowContent = flowContent || [ - blockContent, - phrasingContent - ].join(' '); - add('html', 'manifest', 'head body'); - add('head', '', 'base command link meta noscript script style title'); - add('title hr noscript br'); - add('base', 'href target'); - add('link', 'href rel media hreflang type sizes hreflang'); - add('meta', 'name http-equiv content charset'); - add('style', 'media type scoped'); - add('script', 'src async defer type charset'); - add('body', 'onafterprint onbeforeprint onbeforeunload onblur onerror onfocus ' + 'onhashchange onload onmessage onoffline ononline onpagehide onpageshow ' + 'onpopstate onresize onscroll onstorage onunload', flowContent); - add('address dt dd div caption', '', flowContent); - add('h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn', '', phrasingContent); - add('blockquote', 'cite', flowContent); - add('ol', 'reversed start type', 'li'); - add('ul', '', 'li'); - add('li', 'value', flowContent); - add('dl', '', 'dt dd'); - add('a', 'href target rel media hreflang type', phrasingContent); - add('q', 'cite', phrasingContent); - add('ins del', 'cite datetime', flowContent); - add('img', 'src sizes srcset alt usemap ismap width height'); - add('iframe', 'src name width height', flowContent); - add('embed', 'src type width height'); - add('object', 'data type typemustmatch name usemap form width height', [ - flowContent, - 'param' - ].join(' ')); - add('param', 'name value'); - add('map', 'name', [ - flowContent, - 'area' - ].join(' ')); - add('area', 'alt coords shape href target rel media hreflang type'); - add('table', 'border', 'caption colgroup thead tfoot tbody tr' + (type === 'html4' ? ' col' : '')); - add('colgroup', 'span', 'col'); - add('col', 'span'); - add('tbody thead tfoot', '', 'tr'); - add('tr', '', 'td th'); - add('td', 'colspan rowspan headers', flowContent); - add('th', 'colspan rowspan headers scope abbr', flowContent); - add('form', 'accept-charset action autocomplete enctype method name novalidate target', flowContent); - add('fieldset', 'disabled form name', [ - flowContent, - 'legend' - ].join(' ')); - add('label', 'form for', phrasingContent); - add('input', 'accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate ' + 'formtarget height list max maxlength min multiple name pattern readonly required size src step type value width'); - add('button', 'disabled form formaction formenctype formmethod formnovalidate formtarget name type value', type === 'html4' ? flowContent : phrasingContent); - add('select', 'disabled form multiple name required size', 'option optgroup'); - add('optgroup', 'disabled label', 'option'); - add('option', 'disabled label selected value'); - add('textarea', 'cols dirname disabled form maxlength name readonly required rows wrap'); - add('menu', 'type label', [ - flowContent, - 'li' - ].join(' ')); - add('noscript', '', flowContent); - if (type !== 'html4') { - add('wbr'); - add('ruby', '', [ - phrasingContent, - 'rt rp' - ].join(' ')); - add('figcaption', '', flowContent); - add('mark rt rp summary bdi', '', phrasingContent); - add('canvas', 'width height', flowContent); - add('video', 'src crossorigin poster preload autoplay mediagroup loop ' + 'muted controls width height buffered', [ - flowContent, - 'track source' - ].join(' ')); - add('audio', 'src crossorigin preload autoplay mediagroup loop muted controls ' + 'buffered volume', [ - flowContent, - 'track source' - ].join(' ')); - add('picture', '', 'img source'); - add('source', 'src srcset type media sizes'); - add('track', 'kind src srclang label default'); - add('datalist', '', [ - phrasingContent, - 'option' - ].join(' ')); - add('article section nav aside main header footer', '', flowContent); - add('hgroup', '', 'h1 h2 h3 h4 h5 h6'); - add('figure', '', [ - flowContent, - 'figcaption' - ].join(' ')); - add('time', 'datetime', phrasingContent); - add('dialog', 'open', flowContent); - add('command', 'type label icon disabled checked radiogroup command'); - add('output', 'for form name', phrasingContent); - add('progress', 'value max', phrasingContent); - add('meter', 'value min max low high optimum', phrasingContent); - add('details', 'open', [ - flowContent, - 'summary' - ].join(' ')); - add('keygen', 'autofocus challenge disabled form keytype name'); - } - if (type !== 'html5-strict') { - addAttrs('script', 'language xml:space'); - addAttrs('style', 'xml:space'); - addAttrs('object', 'declare classid code codebase codetype archive standby align border hspace vspace'); - addAttrs('embed', 'align name hspace vspace'); - addAttrs('param', 'valuetype type'); - addAttrs('a', 'charset name rev shape coords'); - addAttrs('br', 'clear'); - addAttrs('applet', 'codebase archive code object alt name width height align hspace vspace'); - addAttrs('img', 'name longdesc align border hspace vspace'); - addAttrs('iframe', 'longdesc frameborder marginwidth marginheight scrolling align'); - addAttrs('font basefont', 'size color face'); - addAttrs('input', 'usemap align'); - addAttrs('select'); - addAttrs('textarea'); - addAttrs('h1 h2 h3 h4 h5 h6 div p legend caption', 'align'); - addAttrs('ul', 'type compact'); - addAttrs('li', 'type'); - addAttrs('ol dl menu dir', 'compact'); - addAttrs('pre', 'width xml:space'); - addAttrs('hr', 'align noshade size width'); - addAttrs('isindex', 'prompt'); - addAttrs('table', 'summary width frame rules cellspacing cellpadding align bgcolor'); - addAttrs('col', 'width align char charoff valign'); - addAttrs('colgroup', 'width align char charoff valign'); - addAttrs('thead', 'align char charoff valign'); - addAttrs('tr', 'align char charoff valign bgcolor'); - addAttrs('th', 'axis align char charoff valign nowrap bgcolor width height'); - addAttrs('form', 'accept'); - addAttrs('td', 'abbr axis scope align char charoff valign nowrap bgcolor width height'); - addAttrs('tfoot', 'align char charoff valign'); - addAttrs('tbody', 'align char charoff valign'); - addAttrs('area', 'nohref'); - addAttrs('body', 'background bgcolor text link vlink alink'); - } - if (type !== 'html4') { - addAttrs('input button select textarea', 'autofocus'); - addAttrs('input textarea', 'placeholder'); - addAttrs('a', 'download'); - addAttrs('link script img', 'crossorigin'); - addAttrs('img', 'loading'); - addAttrs('iframe', 'sandbox seamless allowfullscreen loading'); - } - each$3(split('a form meter progress dfn'), function (name) { - if (schema[name]) { - delete schema[name].children[name]; - } - }); - delete schema.caption.children.table; - delete schema.script; - mapCache[type] = schema; - return schema; - }; - var compileElementMap = function (value, mode) { - var styles; - if (value) { - styles = {}; - if (typeof value === 'string') { - value = { '*': value }; - } - each$3(value, function (value, key) { - styles[key] = styles[key.toUpperCase()] = mode === 'map' ? makeMap$2(value, /[, ]/) : explode$1(value, /[, ]/); - }); - } - return styles; - }; - function Schema(settings) { - var elements = {}; - var children = {}; - var patternElements = []; - var customElementsMap = {}, specialElements = {}; - var createLookupTable = function (option, defaultValue, extendWith) { - var value = settings[option]; - if (!value) { - value = mapCache[option]; - if (!value) { - value = makeMap$2(defaultValue, ' ', makeMap$2(defaultValue.toUpperCase(), ' ')); - value = extend$1(value, extendWith); - mapCache[option] = value; - } - } else { - value = makeMap$2(value, /[, ]/, makeMap$2(value.toUpperCase(), /[, ]/)); - } - return value; - }; - settings = settings || {}; - var schemaItems = compileSchema(settings.schema); - if (settings.verify_html === false) { - settings.valid_elements = '*[*]'; - } - var validStyles = compileElementMap(settings.valid_styles); - var invalidStyles = compileElementMap(settings.invalid_styles, 'map'); - var validClasses = compileElementMap(settings.valid_classes, 'map'); - var whiteSpaceElementsMap = createLookupTable('whitespace_elements', 'pre script noscript style textarea video audio iframe object code'); - var selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li option p td tfoot th thead tr'); - var shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link ' + 'meta param embed source wbr track'); - var boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize ' + 'noshade nowrap readonly selected autoplay loop controls'); - var nonEmptyOrMoveCaretBeforeOnEnter = 'td th iframe video audio object script code'; - var nonEmptyElementsMap = createLookupTable('non_empty_elements', nonEmptyOrMoveCaretBeforeOnEnter + ' pre', shortEndedElementsMap); - var moveCaretBeforeOnEnterElementsMap = createLookupTable('move_caret_before_on_enter_elements', nonEmptyOrMoveCaretBeforeOnEnter + ' table', shortEndedElementsMap); - var textBlockElementsMap = createLookupTable('text_block_elements', 'h1 h2 h3 h4 h5 h6 p div address pre form ' + 'blockquote center dir fieldset header footer article section hgroup aside main nav figure'); - var blockElementsMap = createLookupTable('block_elements', 'hr table tbody thead tfoot ' + 'th tr td li ol ul caption dl dt dd noscript menu isindex option ' + 'datalist select optgroup figcaption details summary', textBlockElementsMap); - var textInlineElementsMap = createLookupTable('text_inline_elements', 'span strong b em i font strike u var cite ' + 'dfn code mark q sup sub samp'); - each$3((settings.special || 'script noscript iframe noframes noembed title style textarea xmp').split(' '), function (name) { - specialElements[name] = new RegExp(']*>', 'gi'); - }); - var patternToRegExp = function (str) { - return new RegExp('^' + str.replace(/([?+*])/g, '.$1') + '$'); - }; - var addValidElements = function (validElements) { - var ei, el, ai, al, matches, element, attr, attrData, elementName, attrName, attrType, attributes, attributesOrder, prefix, outputName, globalAttributes, globalAttributesOrder, value; - var elementRuleRegExp = /^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)])?$/, attrRuleRegExp = /^([!\-])?(\w+[\\:]:\w+|[^=:<]+)?(?:([=:<])(.*))?$/, hasPatternsRegExp = /[*?+]/; - if (validElements) { - var validElementsArr = split(validElements, ','); - if (elements['@']) { - globalAttributes = elements['@'].attributes; - globalAttributesOrder = elements['@'].attributesOrder; - } - for (ei = 0, el = validElementsArr.length; ei < el; ei++) { - matches = elementRuleRegExp.exec(validElementsArr[ei]); - if (matches) { - prefix = matches[1]; - elementName = matches[2]; - outputName = matches[3]; - attrData = matches[5]; - attributes = {}; - attributesOrder = []; - element = { - attributes: attributes, - attributesOrder: attributesOrder - }; - if (prefix === '#') { - element.paddEmpty = true; - } - if (prefix === '-') { - element.removeEmpty = true; - } - if (matches[4] === '!') { - element.removeEmptyAttrs = true; - } - if (globalAttributes) { - each$1(globalAttributes, function (value, key) { - attributes[key] = value; - }); - attributesOrder.push.apply(attributesOrder, globalAttributesOrder); - } - if (attrData) { - attrData = split(attrData, '|'); - for (ai = 0, al = attrData.length; ai < al; ai++) { - matches = attrRuleRegExp.exec(attrData[ai]); - if (matches) { - attr = {}; - attrType = matches[1]; - attrName = matches[2].replace(/[\\:]:/g, ':'); - prefix = matches[3]; - value = matches[4]; - if (attrType === '!') { - element.attributesRequired = element.attributesRequired || []; - element.attributesRequired.push(attrName); - attr.required = true; - } - if (attrType === '-') { - delete attributes[attrName]; - attributesOrder.splice(inArray(attributesOrder, attrName), 1); - continue; - } - if (prefix) { - if (prefix === '=') { - element.attributesDefault = element.attributesDefault || []; - element.attributesDefault.push({ - name: attrName, - value: value - }); - attr.defaultValue = value; - } - if (prefix === ':') { - element.attributesForced = element.attributesForced || []; - element.attributesForced.push({ - name: attrName, - value: value - }); - attr.forcedValue = value; - } - if (prefix === '<') { - attr.validValues = makeMap$2(value, '?'); - } - } - if (hasPatternsRegExp.test(attrName)) { - element.attributePatterns = element.attributePatterns || []; - attr.pattern = patternToRegExp(attrName); - element.attributePatterns.push(attr); - } else { - if (!attributes[attrName]) { - attributesOrder.push(attrName); - } - attributes[attrName] = attr; - } - } - } - } - if (!globalAttributes && elementName === '@') { - globalAttributes = attributes; - globalAttributesOrder = attributesOrder; - } - if (outputName) { - element.outputName = elementName; - elements[outputName] = element; - } - if (hasPatternsRegExp.test(elementName)) { - element.pattern = patternToRegExp(elementName); - patternElements.push(element); - } else { - elements[elementName] = element; - } - } - } - } - }; - var setValidElements = function (validElements) { - elements = {}; - patternElements = []; - addValidElements(validElements); - each$3(schemaItems, function (element, name) { - children[name] = element.children; - }); - }; - var addCustomElements = function (customElements) { - var customElementRegExp = /^(~)?(.+)$/; - if (customElements) { - mapCache.text_block_elements = mapCache.block_elements = null; - each$3(split(customElements, ','), function (rule) { - var matches = customElementRegExp.exec(rule), inline = matches[1] === '~', cloneName = inline ? 'span' : 'div', name = matches[2]; - children[name] = children[cloneName]; - customElementsMap[name] = cloneName; - if (!inline) { - blockElementsMap[name.toUpperCase()] = {}; - blockElementsMap[name] = {}; - } - if (!elements[name]) { - var customRule = elements[cloneName]; - customRule = extend$1({}, customRule); - delete customRule.removeEmptyAttrs; - delete customRule.removeEmpty; - elements[name] = customRule; - } - each$3(children, function (element, elmName) { - if (element[cloneName]) { - children[elmName] = element = extend$1({}, children[elmName]); - element[name] = element[cloneName]; - } - }); - }); - } - }; - var addValidChildren = function (validChildren) { - var childRuleRegExp = /^([+\-]?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)\[([^\]]+)]$/; - mapCache[settings.schema] = null; - if (validChildren) { - each$3(split(validChildren, ','), function (rule) { - var matches = childRuleRegExp.exec(rule); - var parent, prefix; - if (matches) { - prefix = matches[1]; - if (prefix) { - parent = children[matches[2]]; - } else { - parent = children[matches[2]] = { '#comment': {} }; - } - parent = children[matches[2]]; - each$3(split(matches[3], '|'), function (child) { - if (prefix === '-') { - delete parent[child]; - } else { - parent[child] = {}; - } - }); - } - }); - } - }; - var getElementRule = function (name) { - var element = elements[name], i; - if (element) { - return element; - } - i = patternElements.length; - while (i--) { - element = patternElements[i]; - if (element.pattern.test(name)) { - return element; - } - } - }; - if (!settings.valid_elements) { - each$3(schemaItems, function (element, name) { - elements[name] = { - attributes: element.attributes, - attributesOrder: element.attributesOrder - }; - children[name] = element.children; - }); - if (settings.schema !== 'html5') { - each$3(split('strong/b em/i'), function (item) { - var items = split(item, '/'); - elements[items[1]].outputName = items[0]; - }); - } - each$3(split('ol ul sub sup blockquote span font a table tbody strong em b i'), function (name) { - if (elements[name]) { - elements[name].removeEmpty = true; - } - }); - each$3(split('p h1 h2 h3 h4 h5 h6 th td pre div address caption li'), function (name) { - elements[name].paddEmpty = true; - }); - each$3(split('span'), function (name) { - elements[name].removeEmptyAttrs = true; - }); - } else { - setValidElements(settings.valid_elements); - } - addCustomElements(settings.custom_elements); - addValidChildren(settings.valid_children); - addValidElements(settings.extended_valid_elements); - addValidChildren('+ol[ul|ol],+ul[ul|ol]'); - each$3({ - dd: 'dl', - dt: 'dl', - li: 'ul ol', - td: 'tr', - th: 'tr', - tr: 'tbody thead tfoot', - tbody: 'table', - thead: 'table', - tfoot: 'table', - legend: 'fieldset', - area: 'map', - param: 'video audio object' - }, function (parents, item) { - if (elements[item]) { - elements[item].parentsRequired = split(parents); - } - }); - if (settings.invalid_elements) { - each$3(explode$1(settings.invalid_elements), function (item) { - if (elements[item]) { - delete elements[item]; - } - }); - } - if (!getElementRule('span')) { - addValidElements('span[!data-mce-type|*]'); - } - var getValidStyles = function () { - return validStyles; - }; - var getInvalidStyles = function () { - return invalidStyles; - }; - var getValidClasses = function () { - return validClasses; - }; - var getBoolAttrs = function () { - return boolAttrMap; - }; - var getBlockElements = function () { - return blockElementsMap; - }; - var getTextBlockElements = function () { - return textBlockElementsMap; - }; - var getTextInlineElements = function () { - return textInlineElementsMap; - }; - var getShortEndedElements = function () { - return shortEndedElementsMap; - }; - var getSelfClosingElements = function () { - return selfClosingElementsMap; - }; - var getNonEmptyElements = function () { - return nonEmptyElementsMap; - }; - var getMoveCaretBeforeOnEnterElements = function () { - return moveCaretBeforeOnEnterElementsMap; - }; - var getWhiteSpaceElements = function () { - return whiteSpaceElementsMap; - }; - var getSpecialElements = function () { - return specialElements; - }; - var isValidChild = function (name, child) { - var parent = children[name.toLowerCase()]; - return !!(parent && parent[child.toLowerCase()]); - }; - var isValid = function (name, attr) { - var attrPatterns, i; - var rule = getElementRule(name); - if (rule) { - if (attr) { - if (rule.attributes[attr]) { - return true; - } - attrPatterns = rule.attributePatterns; - if (attrPatterns) { - i = attrPatterns.length; - while (i--) { - if (attrPatterns[i].pattern.test(name)) { - return true; - } - } - } - } else { - return true; - } - } - return false; - }; - var getCustomElements = function () { - return customElementsMap; - }; - return { - children: children, - elements: elements, - getValidStyles: getValidStyles, - getValidClasses: getValidClasses, - getBlockElements: getBlockElements, - getInvalidStyles: getInvalidStyles, - getShortEndedElements: getShortEndedElements, - getTextBlockElements: getTextBlockElements, - getTextInlineElements: getTextInlineElements, - getBoolAttrs: getBoolAttrs, - getElementRule: getElementRule, - getSelfClosingElements: getSelfClosingElements, - getNonEmptyElements: getNonEmptyElements, - getMoveCaretBeforeOnEnterElements: getMoveCaretBeforeOnEnterElements, - getWhiteSpaceElements: getWhiteSpaceElements, - getSpecialElements: getSpecialElements, - isValidChild: isValidChild, - isValid: isValid, - getCustomElements: getCustomElements, - addValidElements: addValidElements, - setValidElements: setValidElements, - addCustomElements: addCustomElements, - addValidChildren: addValidChildren - }; - } - - var toHex = function (match, r, g, b) { - var hex = function (val) { - val = parseInt(val, 10).toString(16); - return val.length > 1 ? val : '0' + val; - }; - return '#' + hex(r) + hex(g) + hex(b); - }; - var Styles = function (settings, schema) { - var rgbRegExp = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi; - var urlOrStrRegExp = /(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi; - var styleRegExp = /\s*([^:]+):\s*([^;]+);?/g; - var trimRightRegExp = /\s+$/; - var i; - var encodingLookup = {}; - var validStyles; - var invalidStyles; - var invisibleChar = zeroWidth; - settings = settings || {}; - if (schema) { - validStyles = schema.getValidStyles(); - invalidStyles = schema.getInvalidStyles(); - } - var encodingItems = ('\\" \\\' \\; \\: ; : ' + invisibleChar).split(' '); - for (i = 0; i < encodingItems.length; i++) { - encodingLookup[encodingItems[i]] = invisibleChar + i; - encodingLookup[invisibleChar + i] = encodingItems[i]; - } - return { - toHex: function (color) { - return color.replace(rgbRegExp, toHex); - }, - parse: function (css) { - var styles = {}; - var matches, name, value, isEncoded; - var urlConverter = settings.url_converter; - var urlConverterScope = settings.url_converter_scope || this; - var compress = function (prefix, suffix, noJoin) { - var top = styles[prefix + '-top' + suffix]; - if (!top) { - return; - } - var right = styles[prefix + '-right' + suffix]; - if (!right) { - return; - } - var bottom = styles[prefix + '-bottom' + suffix]; - if (!bottom) { - return; - } - var left = styles[prefix + '-left' + suffix]; - if (!left) { - return; - } - var box = [ - top, - right, - bottom, - left - ]; - i = box.length - 1; - while (i--) { - if (box[i] !== box[i + 1]) { - break; - } - } - if (i > -1 && noJoin) { - return; - } - styles[prefix + suffix] = i === -1 ? box[0] : box.join(' '); - delete styles[prefix + '-top' + suffix]; - delete styles[prefix + '-right' + suffix]; - delete styles[prefix + '-bottom' + suffix]; - delete styles[prefix + '-left' + suffix]; - }; - var canCompress = function (key) { - var value = styles[key], i; - if (!value) { - return; - } - value = value.split(' '); - i = value.length; - while (i--) { - if (value[i] !== value[0]) { - return false; - } - } - styles[key] = value[0]; - return true; - }; - var compress2 = function (target, a, b, c) { - if (!canCompress(a)) { - return; - } - if (!canCompress(b)) { - return; - } - if (!canCompress(c)) { - return; - } - styles[target] = styles[a] + ' ' + styles[b] + ' ' + styles[c]; - delete styles[a]; - delete styles[b]; - delete styles[c]; - }; - var encode = function (str) { - isEncoded = true; - return encodingLookup[str]; - }; - var decode = function (str, keepSlashes) { - if (isEncoded) { - str = str.replace(/\uFEFF[0-9]/g, function (str) { - return encodingLookup[str]; - }); - } - if (!keepSlashes) { - str = str.replace(/\\([\'\";:])/g, '$1'); - } - return str; - }; - var decodeSingleHexSequence = function (escSeq) { - return String.fromCharCode(parseInt(escSeq.slice(1), 16)); - }; - var decodeHexSequences = function (value) { - return value.replace(/\\[0-9a-f]+/gi, decodeSingleHexSequence); - }; - var processUrl = function (match, url, url2, url3, str, str2) { - str = str || str2; - if (str) { - str = decode(str); - return '\'' + str.replace(/\'/g, '\\\'') + '\''; - } - url = decode(url || url2 || url3); - if (!settings.allow_script_urls) { - var scriptUrl = url.replace(/[\s\r\n]+/g, ''); - if (/(java|vb)script:/i.test(scriptUrl)) { - return ''; - } - if (!settings.allow_svg_data_urls && /^data:image\/svg/i.test(scriptUrl)) { - return ''; - } - } - if (urlConverter) { - url = urlConverter.call(urlConverterScope, url, 'style'); - } - return 'url(\'' + url.replace(/\'/g, '\\\'') + '\')'; - }; - if (css) { - css = css.replace(/[\u0000-\u001F]/g, ''); - css = css.replace(/\\[\"\';:\uFEFF]/g, encode).replace(/\"[^\"]+\"|\'[^\']+\'/g, function (str) { - return str.replace(/[;:]/g, encode); - }); - while (matches = styleRegExp.exec(css)) { - styleRegExp.lastIndex = matches.index + matches[0].length; - name = matches[1].replace(trimRightRegExp, '').toLowerCase(); - value = matches[2].replace(trimRightRegExp, ''); - if (name && value) { - name = decodeHexSequences(name); - value = decodeHexSequences(value); - if (name.indexOf(invisibleChar) !== -1 || name.indexOf('"') !== -1) { - continue; - } - if (!settings.allow_script_urls && (name === 'behavior' || /expression\s*\(|\/\*|\*\//.test(value))) { - continue; - } - if (name === 'font-weight' && value === '700') { - value = 'bold'; - } else if (name === 'color' || name === 'background-color') { - value = value.toLowerCase(); - } - value = value.replace(rgbRegExp, toHex); - value = value.replace(urlOrStrRegExp, processUrl); - styles[name] = isEncoded ? decode(value, true) : value; - } - } - compress('border', '', true); - compress('border', '-width'); - compress('border', '-color'); - compress('border', '-style'); - compress('padding', ''); - compress('margin', ''); - compress2('border', 'border-width', 'border-style', 'border-color'); - if (styles.border === 'medium none') { - delete styles.border; - } - if (styles['border-image'] === 'none') { - delete styles['border-image']; - } - } - return styles; - }, - serialize: function (styles, elementName) { - var css = ''; - var serializeStyles = function (name) { - var value; - var styleList = validStyles[name]; - if (styleList) { - for (var i_1 = 0, l = styleList.length; i_1 < l; i_1++) { - name = styleList[i_1]; - value = styles[name]; - if (value) { - css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';'; - } - } - } - }; - var isValid = function (name, elementName) { - var styleMap = invalidStyles['*']; - if (styleMap && styleMap[name]) { - return false; - } - styleMap = invalidStyles[elementName]; - return !(styleMap && styleMap[name]); - }; - if (elementName && validStyles) { - serializeStyles('*'); - serializeStyles(elementName); - } else { - each$1(styles, function (value, name) { - if (value && (!invalidStyles || isValid(name, elementName))) { - css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';'; - } - }); - } - return css; - } - }; - }; - - var eventExpandoPrefix = 'mce-data-'; - var mouseEventRe = /^(?:mouse|contextmenu)|click/; - var deprecated = { - keyLocation: 1, - layerX: 1, - layerY: 1, - returnValue: 1, - webkitMovementX: 1, - webkitMovementY: 1, - keyIdentifier: 1, - mozPressure: 1 - }; - var hasIsDefaultPrevented = function (event) { - return event.isDefaultPrevented === returnTrue || event.isDefaultPrevented === returnFalse; - }; - var returnFalse = function () { - return false; - }; - var returnTrue = function () { - return true; - }; - var addEvent = function (target, name, callback, capture) { - if (target.addEventListener) { - target.addEventListener(name, callback, capture || false); - } else if (target.attachEvent) { - target.attachEvent('on' + name, callback); - } - }; - var removeEvent = function (target, name, callback, capture) { - if (target.removeEventListener) { - target.removeEventListener(name, callback, capture || false); - } else if (target.detachEvent) { - target.detachEvent('on' + name, callback); - } - }; - var isMouseEvent = function (event) { - return mouseEventRe.test(event.type); - }; - var fix = function (originalEvent, data) { - var name; - var event = data || {}; - for (name in originalEvent) { - if (!deprecated[name]) { - event[name] = originalEvent[name]; - } - } - if (!event.target) { - event.target = event.srcElement || document; - } - if (event.composedPath) { - event.composedPath = function () { - return originalEvent.composedPath(); - }; - } - if (originalEvent && isMouseEvent(originalEvent) && originalEvent.pageX === undefined && originalEvent.clientX !== undefined) { - var eventDoc = event.target.ownerDocument || document; - var doc = eventDoc.documentElement; - var body = eventDoc.body; - event.pageX = originalEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); - event.pageY = originalEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); - } - event.preventDefault = function () { - event.isDefaultPrevented = returnTrue; - if (originalEvent) { - if (originalEvent.preventDefault) { - originalEvent.preventDefault(); - } else { - originalEvent.returnValue = false; - } - } - }; - event.stopPropagation = function () { - event.isPropagationStopped = returnTrue; - if (originalEvent) { - if (originalEvent.stopPropagation) { - originalEvent.stopPropagation(); - } else { - originalEvent.cancelBubble = true; - } - } - }; - event.stopImmediatePropagation = function () { - event.isImmediatePropagationStopped = returnTrue; - event.stopPropagation(); - }; - if (hasIsDefaultPrevented(event) === false) { - event.isDefaultPrevented = returnFalse; - event.isPropagationStopped = returnFalse; - event.isImmediatePropagationStopped = returnFalse; - } - if (typeof event.metaKey === 'undefined') { - event.metaKey = false; - } - return event; - }; - var bindOnReady = function (win, callback, eventUtils) { - var doc = win.document, event = { type: 'ready' }; - if (eventUtils.domLoaded) { - callback(event); - return; - } - var isDocReady = function () { - return doc.readyState === 'complete' || doc.readyState === 'interactive' && doc.body; - }; - var readyHandler = function () { - removeEvent(win, 'DOMContentLoaded', readyHandler); - removeEvent(win, 'load', readyHandler); - if (!eventUtils.domLoaded) { - eventUtils.domLoaded = true; - callback(event); - } - win = null; - }; - if (isDocReady()) { - readyHandler(); - } else { - addEvent(win, 'DOMContentLoaded', readyHandler); - } - if (!eventUtils.domLoaded) { - addEvent(win, 'load', readyHandler); - } - }; - var EventUtils = function () { - function EventUtils() { - this.domLoaded = false; - this.events = {}; - this.count = 1; - this.expando = eventExpandoPrefix + (+new Date()).toString(32); - this.hasMouseEnterLeave = 'onmouseenter' in document.documentElement; - this.hasFocusIn = 'onfocusin' in document.documentElement; - this.count = 1; - } - EventUtils.prototype.bind = function (target, names, callback, scope) { - var self = this; - var id, callbackList, i, name, fakeName, nativeHandler, capture; - var win = window; - var defaultNativeHandler = function (evt) { - self.executeHandlers(fix(evt || win.event), id); - }; - if (!target || target.nodeType === 3 || target.nodeType === 8) { - return; - } - if (!target[self.expando]) { - id = self.count++; - target[self.expando] = id; - self.events[id] = {}; - } else { - id = target[self.expando]; - } - scope = scope || target; - var namesList = names.split(' '); - i = namesList.length; - while (i--) { - name = namesList[i]; - nativeHandler = defaultNativeHandler; - fakeName = capture = false; - if (name === 'DOMContentLoaded') { - name = 'ready'; - } - if (self.domLoaded && name === 'ready' && target.readyState === 'complete') { - callback.call(scope, fix({ type: name })); - continue; - } - if (!self.hasMouseEnterLeave) { - fakeName = self.mouseEnterLeave[name]; - if (fakeName) { - nativeHandler = function (evt) { - var current = evt.currentTarget; - var related = evt.relatedTarget; - if (related && current.contains) { - related = current.contains(related); - } else { - while (related && related !== current) { - related = related.parentNode; - } - } - if (!related) { - evt = fix(evt || win.event); - evt.type = evt.type === 'mouseout' ? 'mouseleave' : 'mouseenter'; - evt.target = current; - self.executeHandlers(evt, id); - } - }; - } - } - if (!self.hasFocusIn && (name === 'focusin' || name === 'focusout')) { - capture = true; - fakeName = name === 'focusin' ? 'focus' : 'blur'; - nativeHandler = function (evt) { - evt = fix(evt || win.event); - evt.type = evt.type === 'focus' ? 'focusin' : 'focusout'; - self.executeHandlers(evt, id); - }; - } - callbackList = self.events[id][name]; - if (!callbackList) { - self.events[id][name] = callbackList = [{ - func: callback, - scope: scope - }]; - callbackList.fakeName = fakeName; - callbackList.capture = capture; - callbackList.nativeHandler = nativeHandler; - if (name === 'ready') { - bindOnReady(target, nativeHandler, self); - } else { - addEvent(target, fakeName || name, nativeHandler, capture); - } - } else { - if (name === 'ready' && self.domLoaded) { - callback(fix({ type: name })); - } else { - callbackList.push({ - func: callback, - scope: scope - }); - } - } - } - target = callbackList = null; - return callback; - }; - EventUtils.prototype.unbind = function (target, names, callback) { - var callbackList, i, ci, name, eventMap; - if (!target || target.nodeType === 3 || target.nodeType === 8) { - return this; - } - var id = target[this.expando]; - if (id) { - eventMap = this.events[id]; - if (names) { - var namesList = names.split(' '); - i = namesList.length; - while (i--) { - name = namesList[i]; - callbackList = eventMap[name]; - if (callbackList) { - if (callback) { - ci = callbackList.length; - while (ci--) { - if (callbackList[ci].func === callback) { - var nativeHandler = callbackList.nativeHandler; - var fakeName = callbackList.fakeName, capture = callbackList.capture; - callbackList = callbackList.slice(0, ci).concat(callbackList.slice(ci + 1)); - callbackList.nativeHandler = nativeHandler; - callbackList.fakeName = fakeName; - callbackList.capture = capture; - eventMap[name] = callbackList; - } - } - } - if (!callback || callbackList.length === 0) { - delete eventMap[name]; - removeEvent(target, callbackList.fakeName || name, callbackList.nativeHandler, callbackList.capture); - } - } - } - } else { - each$1(eventMap, function (callbackList, name) { - removeEvent(target, callbackList.fakeName || name, callbackList.nativeHandler, callbackList.capture); - }); - eventMap = {}; - } - for (name in eventMap) { - if (has(eventMap, name)) { - return this; - } - } - delete this.events[id]; - try { - delete target[this.expando]; - } catch (ex) { - target[this.expando] = null; - } - } - return this; - }; - EventUtils.prototype.fire = function (target, name, args) { - var id; - if (!target || target.nodeType === 3 || target.nodeType === 8) { - return this; - } - var event = fix(null, args); - event.type = name; - event.target = target; - do { - id = target[this.expando]; - if (id) { - this.executeHandlers(event, id); - } - target = target.parentNode || target.ownerDocument || target.defaultView || target.parentWindow; - } while (target && !event.isPropagationStopped()); - return this; - }; - EventUtils.prototype.clean = function (target) { - var i, children; - if (!target || target.nodeType === 3 || target.nodeType === 8) { - return this; - } - if (target[this.expando]) { - this.unbind(target); - } - if (!target.getElementsByTagName) { - target = target.document; - } - if (target && target.getElementsByTagName) { - this.unbind(target); - children = target.getElementsByTagName('*'); - i = children.length; - while (i--) { - target = children[i]; - if (target[this.expando]) { - this.unbind(target); - } - } - } - return this; - }; - EventUtils.prototype.destroy = function () { - this.events = {}; - }; - EventUtils.prototype.cancel = function (e) { - if (e) { - e.preventDefault(); - e.stopImmediatePropagation(); - } - return false; - }; - EventUtils.prototype.executeHandlers = function (evt, id) { - var container = this.events[id]; - var callbackList = container && container[evt.type]; - if (callbackList) { - for (var i = 0, l = callbackList.length; i < l; i++) { - var callback = callbackList[i]; - if (callback && callback.func.call(callback.scope, evt) === false) { - evt.preventDefault(); - } - if (evt.isImmediatePropagationStopped()) { - return; - } - } - } - }; - EventUtils.Event = new EventUtils(); - return EventUtils; - }(); - - var support, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, setDocument, document$1, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains$3, expando = 'sizzle' + -new Date(), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), sortOrder = function (a, b) { - if (a === b) { - hasDuplicate = true; - } - return 0; - }, strundefined = typeof undefined, MAX_NEGATIVE = 1 << 31, hasOwn = {}.hasOwnProperty, arr = [], pop = arr.pop, push_native = arr.push, push = arr.push, slice = arr.slice, indexOf$2 = arr.indexOf || function (elem) { - var i = 0, len = this.length; - for (; i < len; i++) { - if (this[i] === elem) { - return i; - } - } - return -1; - }, booleans = 'checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped', whitespace = '[\\x20\\t\\r\\n\\f]', identifier = '(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+', attributes = '\\[' + whitespace + '*(' + identifier + ')(?:' + whitespace + '*([*^$|!~]?=)' + whitespace + '*(?:\'((?:\\\\.|[^\\\\\'])*)\'|"((?:\\\\.|[^\\\\"])*)"|(' + identifier + '))|)' + whitespace + '*\\]', pseudos = ':(' + identifier + ')(?:\\((' + '(\'((?:\\\\.|[^\\\\\'])*)\'|"((?:\\\\.|[^\\\\"])*)")|' + '((?:\\\\.|[^\\\\()[\\]]|' + attributes + ')*)|' + '.*' + ')\\)|)', rtrim = new RegExp('^' + whitespace + '+|((?:^|[^\\\\])(?:\\\\.)*)' + whitespace + '+$', 'g'), rcomma = new RegExp('^' + whitespace + '*,' + whitespace + '*'), rcombinators = new RegExp('^' + whitespace + '*([>+~]|' + whitespace + ')' + whitespace + '*'), rattributeQuotes = new RegExp('=' + whitespace + '*([^\\]\'"]*?)' + whitespace + '*\\]', 'g'), rpseudo = new RegExp(pseudos), ridentifier = new RegExp('^' + identifier + '$'), matchExpr = { - ID: new RegExp('^#(' + identifier + ')'), - CLASS: new RegExp('^\\.(' + identifier + ')'), - TAG: new RegExp('^(' + identifier + '|[*])'), - ATTR: new RegExp('^' + attributes), - PSEUDO: new RegExp('^' + pseudos), - CHILD: new RegExp('^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(' + whitespace + '*(even|odd|(([+-]|)(\\d*)n|)' + whitespace + '*(?:([+-]|)' + whitespace + '*(\\d+)|))' + whitespace + '*\\)|)', 'i'), - bool: new RegExp('^(?:' + booleans + ')$', 'i'), - needsContext: new RegExp('^' + whitespace + '*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(' + whitespace + '*((?:-\\d)?\\d*)' + whitespace + '*\\)|)(?=[^-]|$)', 'i') - }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rnative = /^[^{]+\{\s*\[native \w/, rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, rescape = /'|\\/g, runescape = new RegExp('\\\\([\\da-f]{1,6}' + whitespace + '?|(' + whitespace + ')|.)', 'ig'), funescape = function (_, escaped, escapedWhitespace) { - var high = '0x' + escaped - 65536; - return high !== high || escapedWhitespace ? escaped : high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320); - }; - try { - push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes); - arr[preferredDoc.childNodes.length].nodeType; - } catch (e) { - push = { - apply: arr.length ? function (target, els) { - push_native.apply(target, slice.call(els)); - } : function (target, els) { - var j = target.length, i = 0; - while (target[j++] = els[i++]) { - } - target.length = j - 1; - } - }; - } - var Sizzle = function (selector, context, results, seed) { - var match, elem, m, nodeType, i, groups, old, nid, newContext, newSelector; - if ((context ? context.ownerDocument || context : preferredDoc) !== document$1) { - setDocument(context); - } - context = context || document$1; - results = results || []; - if (!selector || typeof selector !== 'string') { - return results; - } - if ((nodeType = context.nodeType) !== 1 && nodeType !== 9) { - return []; - } - if (documentIsHTML && !seed) { - if (match = rquickExpr.exec(selector)) { - if (m = match[1]) { - if (nodeType === 9) { - elem = context.getElementById(m); - if (elem && elem.parentNode) { - if (elem.id === m) { - results.push(elem); - return results; - } - } else { - return results; - } - } else { - if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) && contains$3(context, elem) && elem.id === m) { - results.push(elem); - return results; - } - } - } else if (match[2]) { - push.apply(results, context.getElementsByTagName(selector)); - return results; - } else if ((m = match[3]) && support.getElementsByClassName) { - push.apply(results, context.getElementsByClassName(m)); - return results; - } - } - if (support.qsa && (!rbuggyQSA || !rbuggyQSA.test(selector))) { - nid = old = expando; - newContext = context; - newSelector = nodeType === 9 && selector; - if (nodeType === 1 && context.nodeName.toLowerCase() !== 'object') { - groups = tokenize(selector); - if (old = context.getAttribute('id')) { - nid = old.replace(rescape, '\\$&'); - } else { - context.setAttribute('id', nid); - } - nid = '[id=\'' + nid + '\'] '; - i = groups.length; - while (i--) { - groups[i] = nid + toSelector(groups[i]); - } - newContext = rsibling.test(selector) && testContext(context.parentNode) || context; - newSelector = groups.join(','); - } - if (newSelector) { - try { - push.apply(results, newContext.querySelectorAll(newSelector)); - return results; - } catch (qsaError) { - } finally { - if (!old) { - context.removeAttribute('id'); - } - } - } - } - } - return select(selector.replace(rtrim, '$1'), context, results, seed); - }; - function createCache() { - var keys = []; - function cache(key, value) { - if (keys.push(key + ' ') > Expr.cacheLength) { - delete cache[keys.shift()]; - } - return cache[key + ' '] = value; - } - return cache; - } - function markFunction(fn) { - fn[expando] = true; - return fn; - } - function siblingCheck(a, b) { - var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && (~b.sourceIndex || MAX_NEGATIVE) - (~a.sourceIndex || MAX_NEGATIVE); - if (diff) { - return diff; - } - if (cur) { - while (cur = cur.nextSibling) { - if (cur === b) { - return -1; - } - } - } - return a ? 1 : -1; - } - function createInputPseudo(type) { - return function (elem) { - var name = elem.nodeName.toLowerCase(); - return name === 'input' && elem.type === type; - }; - } - function createButtonPseudo(type) { - return function (elem) { - var name = elem.nodeName.toLowerCase(); - return (name === 'input' || name === 'button') && elem.type === type; - }; - } - function createPositionalPseudo(fn) { - return markFunction(function (argument) { - argument = +argument; - return markFunction(function (seed, matches) { - var j, matchIndexes = fn([], seed.length, argument), i = matchIndexes.length; - while (i--) { - if (seed[j = matchIndexes[i]]) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); - } - function testContext(context) { - return context && typeof context.getElementsByTagName !== strundefined && context; - } - support = Sizzle.support = {}; - isXML = Sizzle.isXML = function (elem) { - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== 'HTML' : false; - }; - setDocument = Sizzle.setDocument = function (node) { - var hasCompare, doc = node ? node.ownerDocument || node : preferredDoc, parent = doc.defaultView; - function getTop(win) { - try { - return win.top; - } catch (ex) { - } - return null; - } - if (doc === document$1 || doc.nodeType !== 9 || !doc.documentElement) { - return document$1; - } - document$1 = doc; - docElem = doc.documentElement; - documentIsHTML = !isXML(doc); - if (parent && parent !== getTop(parent)) { - if (parent.addEventListener) { - parent.addEventListener('unload', function () { - setDocument(); - }, false); - } else if (parent.attachEvent) { - parent.attachEvent('onunload', function () { - setDocument(); - }); - } - } - support.attributes = true; - support.getElementsByTagName = true; - support.getElementsByClassName = rnative.test(doc.getElementsByClassName); - support.getById = true; - Expr.find.ID = function (id, context) { - if (typeof context.getElementById !== strundefined && documentIsHTML) { - var m = context.getElementById(id); - return m && m.parentNode ? [m] : []; - } - }; - Expr.filter.ID = function (id) { - var attrId = id.replace(runescape, funescape); - return function (elem) { - return elem.getAttribute('id') === attrId; - }; - }; - Expr.find.TAG = support.getElementsByTagName ? function (tag, context) { - if (typeof context.getElementsByTagName !== strundefined) { - return context.getElementsByTagName(tag); - } - } : function (tag, context) { - var elem, tmp = [], i = 0, results = context.getElementsByTagName(tag); - if (tag === '*') { - while (elem = results[i++]) { - if (elem.nodeType === 1) { - tmp.push(elem); - } - } - return tmp; - } - return results; - }; - Expr.find.CLASS = support.getElementsByClassName && function (className, context) { - if (documentIsHTML) { - return context.getElementsByClassName(className); - } - }; - rbuggyMatches = []; - rbuggyQSA = []; - support.disconnectedMatch = true; - rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join('|')); - rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join('|')); - hasCompare = rnative.test(docElem.compareDocumentPosition); - contains$3 = hasCompare || rnative.test(docElem.contains) ? function (a, b) { - var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; - return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16)); - } : function (a, b) { - if (b) { - while (b = b.parentNode) { - if (b === a) { - return true; - } - } - } - return false; - }; - sortOrder = hasCompare ? function (a, b) { - if (a === b) { - hasDuplicate = true; - return 0; - } - var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; - if (compare) { - return compare; - } - compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1; - if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) { - if (a === doc || a.ownerDocument === preferredDoc && contains$3(preferredDoc, a)) { - return -1; - } - if (b === doc || b.ownerDocument === preferredDoc && contains$3(preferredDoc, b)) { - return 1; - } - return sortInput ? indexOf$2.call(sortInput, a) - indexOf$2.call(sortInput, b) : 0; - } - return compare & 4 ? -1 : 1; - } : function (a, b) { - if (a === b) { - hasDuplicate = true; - return 0; - } - var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [a], bp = [b]; - if (!aup || !bup) { - return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf$2.call(sortInput, a) - indexOf$2.call(sortInput, b) : 0; - } else if (aup === bup) { - return siblingCheck(a, b); - } - cur = a; - while (cur = cur.parentNode) { - ap.unshift(cur); - } - cur = b; - while (cur = cur.parentNode) { - bp.unshift(cur); - } - while (ap[i] === bp[i]) { - i++; - } - return i ? siblingCheck(ap[i], bp[i]) : ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0; - }; - return doc; - }; - Sizzle.matches = function (expr, elements) { - return Sizzle(expr, null, null, elements); - }; - Sizzle.matchesSelector = function (elem, expr) { - if ((elem.ownerDocument || elem) !== document$1) { - setDocument(elem); - } - expr = expr.replace(rattributeQuotes, '=\'$1\']'); - if (support.matchesSelector && documentIsHTML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) { - try { - var ret = matches.call(elem, expr); - if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) { - return ret; - } - } catch (e) { - } - } - return Sizzle(expr, document$1, null, [elem]).length > 0; - }; - Sizzle.contains = function (context, elem) { - if ((context.ownerDocument || context) !== document$1) { - setDocument(context); - } - return contains$3(context, elem); - }; - Sizzle.attr = function (elem, name) { - if ((elem.ownerDocument || elem) !== document$1) { - setDocument(elem); - } - var fn = Expr.attrHandle[name.toLowerCase()], val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined; - return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null; - }; - Sizzle.error = function (msg) { - throw new Error('Syntax error, unrecognized expression: ' + msg); - }; - Sizzle.uniqueSort = function (results) { - var elem, duplicates = [], j = 0, i = 0; - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice(0); - results.sort(sortOrder); - if (hasDuplicate) { - while (elem = results[i++]) { - if (elem === results[i]) { - j = duplicates.push(i); - } - } - while (j--) { - results.splice(duplicates[j], 1); - } - } - sortInput = null; - return results; - }; - getText = Sizzle.getText = function (elem) { - var node, ret = '', i = 0, nodeType = elem.nodeType; - if (!nodeType) { - while (node = elem[i++]) { - ret += getText(node); - } - } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) { - if (typeof elem.textContent === 'string') { - return elem.textContent; - } else { - for (elem = elem.firstChild; elem; elem = elem.nextSibling) { - ret += getText(elem); - } - } - } else if (nodeType === 3 || nodeType === 4) { - return elem.nodeValue; - } - return ret; - }; - Expr = Sizzle.selectors = { - cacheLength: 50, - createPseudo: markFunction, - match: matchExpr, - attrHandle: {}, - find: {}, - relative: { - '>': { - dir: 'parentNode', - first: true - }, - ' ': { dir: 'parentNode' }, - '+': { - dir: 'previousSibling', - first: true - }, - '~': { dir: 'previousSibling' } - }, - preFilter: { - ATTR: function (match) { - match[1] = match[1].replace(runescape, funescape); - match[3] = (match[3] || match[4] || match[5] || '').replace(runescape, funescape); - if (match[2] === '~=') { - match[3] = ' ' + match[3] + ' '; - } - return match.slice(0, 4); - }, - CHILD: function (match) { - match[1] = match[1].toLowerCase(); - if (match[1].slice(0, 3) === 'nth') { - if (!match[3]) { - Sizzle.error(match[0]); - } - match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === 'even' || match[3] === 'odd')); - match[5] = +(match[7] + match[8] || match[3] === 'odd'); - } else if (match[3]) { - Sizzle.error(match[0]); - } - return match; - }, - PSEUDO: function (match) { - var excess, unquoted = !match[6] && match[2]; - if (matchExpr.CHILD.test(match[0])) { - return null; - } - if (match[3]) { - match[2] = match[4] || match[5] || ''; - } else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(')', unquoted.length - excess) - unquoted.length)) { - match[0] = match[0].slice(0, excess); - match[2] = unquoted.slice(0, excess); - } - return match.slice(0, 3); - } - }, - filter: { - TAG: function (nodeNameSelector) { - var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase(); - return nodeNameSelector === '*' ? function () { - return true; - } : function (elem) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - CLASS: function (className) { - var pattern = classCache[className + ' ']; - return pattern || (pattern = new RegExp('(^|' + whitespace + ')' + className + '(' + whitespace + '|$)')) && classCache(className, function (elem) { - return pattern.test(typeof elem.className === 'string' && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute('class') || ''); - }); - }, - ATTR: function (name, operator, check) { - return function (elem) { - var result = Sizzle.attr(elem, name); - if (result == null) { - return operator === '!='; - } - if (!operator) { - return true; - } - result += ''; - return operator === '=' ? result === check : operator === '!=' ? result !== check : operator === '^=' ? check && result.indexOf(check) === 0 : operator === '*=' ? check && result.indexOf(check) > -1 : operator === '$=' ? check && result.slice(-check.length) === check : operator === '~=' ? (' ' + result + ' ').indexOf(check) > -1 : operator === '|=' ? result === check || result.slice(0, check.length + 1) === check + '-' : false; - }; - }, - CHILD: function (type, what, argument, first, last) { - var simple = type.slice(0, 3) !== 'nth', forward = type.slice(-4) !== 'last', ofType = what === 'of-type'; - return first === 1 && last === 0 ? function (elem) { - return !!elem.parentNode; - } : function (elem, context, xml) { - var cache, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? 'nextSibling' : 'previousSibling', parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType; - if (parent) { - if (simple) { - while (dir) { - node = elem; - while (node = node[dir]) { - if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) { - return false; - } - } - start = dir = type === 'only' && !start && 'nextSibling'; - } - return true; - } - start = [forward ? parent.firstChild : parent.lastChild]; - if (forward && useCache) { - outerCache = parent[expando] || (parent[expando] = {}); - cache = outerCache[type] || []; - nodeIndex = cache[0] === dirruns && cache[1]; - diff = cache[0] === dirruns && cache[2]; - node = nodeIndex && parent.childNodes[nodeIndex]; - while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) { - if (node.nodeType === 1 && ++diff && node === elem) { - outerCache[type] = [ - dirruns, - nodeIndex, - diff - ]; - break; - } - } - } else if (useCache && (cache = (elem[expando] || (elem[expando] = {}))[type]) && cache[0] === dirruns) { - diff = cache[1]; - } else { - while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) { - if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) { - if (useCache) { - (node[expando] || (node[expando] = {}))[type] = [ - dirruns, - diff - ]; - } - if (node === elem) { - break; - } - } - } - } - diff -= last; - return diff === first || diff % first === 0 && diff / first >= 0; - } - }; - }, - PSEUDO: function (pseudo, argument) { - var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error('unsupported pseudo: ' + pseudo); - if (fn[expando]) { - return fn(argument); - } - if (fn.length > 1) { - args = [ - pseudo, - pseudo, - '', - argument - ]; - return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) { - var idx, matched = fn(seed, argument), i = matched.length; - while (i--) { - idx = indexOf$2.call(seed, matched[i]); - seed[idx] = !(matches[idx] = matched[i]); - } - }) : function (elem) { - return fn(elem, 0, args); - }; - } - return fn; - } - }, - pseudos: { - not: markFunction(function (selector) { - var input = [], results = [], matcher = compile(selector.replace(rtrim, '$1')); - return matcher[expando] ? markFunction(function (seed, matches, context, xml) { - var elem, unmatched = matcher(seed, null, xml, []), i = seed.length; - while (i--) { - if (elem = unmatched[i]) { - seed[i] = !(matches[i] = elem); - } - } - }) : function (elem, context, xml) { - input[0] = elem; - matcher(input, null, xml, results); - return !results.pop(); - }; - }), - has: markFunction(function (selector) { - return function (elem) { - return Sizzle(selector, elem).length > 0; - }; - }), - contains: markFunction(function (text) { - text = text.replace(runescape, funescape); - return function (elem) { - return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1; - }; - }), - lang: markFunction(function (lang) { - if (!ridentifier.test(lang || '')) { - Sizzle.error('unsupported lang: ' + lang); - } - lang = lang.replace(runescape, funescape).toLowerCase(); - return function (elem) { - var elemLang; - do { - if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute('xml:lang') || elem.getAttribute('lang')) { - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf(lang + '-') === 0; - } - } while ((elem = elem.parentNode) && elem.nodeType === 1); - return false; - }; - }), - target: function (elem) { - var hash = window.location && window.location.hash; - return hash && hash.slice(1) === elem.id; - }, - root: function (elem) { - return elem === docElem; - }, - focus: function (elem) { - return elem === document$1.activeElement && (!document$1.hasFocus || document$1.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); - }, - enabled: function (elem) { - return elem.disabled === false; - }, - disabled: function (elem) { - return elem.disabled === true; - }, - checked: function (elem) { - var nodeName = elem.nodeName.toLowerCase(); - return nodeName === 'input' && !!elem.checked || nodeName === 'option' && !!elem.selected; - }, - selected: function (elem) { - if (elem.parentNode) { - elem.parentNode.selectedIndex; - } - return elem.selected === true; - }, - empty: function (elem) { - for (elem = elem.firstChild; elem; elem = elem.nextSibling) { - if (elem.nodeType < 6) { - return false; - } - } - return true; - }, - parent: function (elem) { - return !Expr.pseudos.empty(elem); - }, - header: function (elem) { - return rheader.test(elem.nodeName); - }, - input: function (elem) { - return rinputs.test(elem.nodeName); - }, - button: function (elem) { - var name = elem.nodeName.toLowerCase(); - return name === 'input' && elem.type === 'button' || name === 'button'; - }, - text: function (elem) { - var attr; - return elem.nodeName.toLowerCase() === 'input' && elem.type === 'text' && ((attr = elem.getAttribute('type')) == null || attr.toLowerCase() === 'text'); - }, - first: createPositionalPseudo(function () { - return [0]; - }), - last: createPositionalPseudo(function (matchIndexes, length) { - return [length - 1]; - }), - eq: createPositionalPseudo(function (matchIndexes, length, argument) { - return [argument < 0 ? argument + length : argument]; - }), - even: createPositionalPseudo(function (matchIndexes, length) { - var i = 0; - for (; i < length; i += 2) { - matchIndexes.push(i); - } - return matchIndexes; - }), - odd: createPositionalPseudo(function (matchIndexes, length) { - var i = 1; - for (; i < length; i += 2) { - matchIndexes.push(i); - } - return matchIndexes; - }), - lt: createPositionalPseudo(function (matchIndexes, length, argument) { - var i = argument < 0 ? argument + length : argument; - for (; --i >= 0;) { - matchIndexes.push(i); - } - return matchIndexes; - }), - gt: createPositionalPseudo(function (matchIndexes, length, argument) { - var i = argument < 0 ? argument + length : argument; - for (; ++i < length;) { - matchIndexes.push(i); - } - return matchIndexes; - }) - } - }; - Expr.pseudos.nth = Expr.pseudos.eq; - each([ - 'radio', - 'checkbox', - 'file', - 'password', - 'image' - ], function (i) { - Expr.pseudos[i] = createInputPseudo(i); - }); - each([ - 'submit', - 'reset' - ], function (i) { - Expr.pseudos[i] = createButtonPseudo(i); - }); - function setFilters() { - } - setFilters.prototype = Expr.filters = Expr.pseudos; - Expr.setFilters = new setFilters(); - tokenize = Sizzle.tokenize = function (selector, parseOnly) { - var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + ' ']; - if (cached) { - return parseOnly ? 0 : cached.slice(0); - } - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - while (soFar) { - if (!matched || (match = rcomma.exec(soFar))) { - if (match) { - soFar = soFar.slice(match[0].length) || soFar; - } - groups.push(tokens = []); - } - matched = false; - if (match = rcombinators.exec(soFar)) { - matched = match.shift(); - tokens.push({ - value: matched, - type: match[0].replace(rtrim, ' ') - }); - soFar = soFar.slice(matched.length); - } - for (type in Expr.filter) { - if (!Expr.filter.hasOwnProperty(type)) { - continue; - } - if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) { - matched = match.shift(); - tokens.push({ - value: matched, - type: type, - matches: match - }); - soFar = soFar.slice(matched.length); - } - } - if (!matched) { - break; - } - } - return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) : tokenCache(selector, groups).slice(0); - }; - function toSelector(tokens) { - var i = 0, len = tokens.length, selector = ''; - for (; i < len; i++) { - selector += tokens[i].value; - } - return selector; - } - function addCombinator(matcher, combinator, base) { - var dir = combinator.dir, checkNonElements = base && dir === 'parentNode', doneName = done++; - return combinator.first ? function (elem, context, xml) { - while (elem = elem[dir]) { - if (elem.nodeType === 1 || checkNonElements) { - return matcher(elem, context, xml); - } - } - } : function (elem, context, xml) { - var oldCache, outerCache, newCache = [ - dirruns, - doneName - ]; - if (xml) { - while (elem = elem[dir]) { - if (elem.nodeType === 1 || checkNonElements) { - if (matcher(elem, context, xml)) { - return true; - } - } - } - } else { - while (elem = elem[dir]) { - if (elem.nodeType === 1 || checkNonElements) { - outerCache = elem[expando] || (elem[expando] = {}); - if ((oldCache = outerCache[dir]) && oldCache[0] === dirruns && oldCache[1] === doneName) { - return newCache[2] = oldCache[2]; - } else { - outerCache[dir] = newCache; - if (newCache[2] = matcher(elem, context, xml)) { - return true; - } - } - } - } - } - }; - } - function elementMatcher(matchers) { - return matchers.length > 1 ? function (elem, context, xml) { - var i = matchers.length; - while (i--) { - if (!matchers[i](elem, context, xml)) { - return false; - } - } - return true; - } : matchers[0]; - } - function multipleContexts(selector, contexts, results) { - var i = 0, len = contexts.length; - for (; i < len; i++) { - Sizzle(selector, contexts[i], results); - } - return results; - } - function condense(unmatched, map, filter, context, xml) { - var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; - for (; i < len; i++) { - if (elem = unmatched[i]) { - if (!filter || filter(elem, context, xml)) { - newUnmatched.push(elem); - if (mapped) { - map.push(i); - } - } - } - } - return newUnmatched; - } - function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) { - if (postFilter && !postFilter[expando]) { - postFilter = setMatcher(postFilter); - } - if (postFinder && !postFinder[expando]) { - postFinder = setMatcher(postFinder, postSelector); - } - return markFunction(function (seed, results, context, xml) { - var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, elems = seed || multipleContexts(selector || '*', context.nodeType ? [context] : context, []), matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems, matcherOut = matcher ? postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results : matcherIn; - if (matcher) { - matcher(matcherIn, matcherOut, context, xml); - } - if (postFilter) { - temp = condense(matcherOut, postMap); - postFilter(temp, [], context, xml); - i = temp.length; - while (i--) { - if (elem = temp[i]) { - matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem); - } - } - } - if (seed) { - if (postFinder || preFilter) { - if (postFinder) { - temp = []; - i = matcherOut.length; - while (i--) { - if (elem = matcherOut[i]) { - temp.push(matcherIn[i] = elem); - } - } - postFinder(null, matcherOut = [], temp, xml); - } - i = matcherOut.length; - while (i--) { - if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf$2.call(seed, elem) : preMap[i]) > -1) { - seed[temp] = !(results[temp] = elem); - } - } - } - } else { - matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut); - if (postFinder) { - postFinder(null, results, matcherOut, xml); - } else { - push.apply(results, matcherOut); - } - } - }); - } - function matcherFromTokens(tokens) { - var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[' '], i = leadingRelative ? 1 : 0, matchContext = addCombinator(function (elem) { - return elem === checkContext; - }, implicitRelative, true), matchAnyContext = addCombinator(function (elem) { - return indexOf$2.call(checkContext, elem) > -1; - }, implicitRelative, true), matchers = [function (elem, context, xml) { - return !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml)); - }]; - for (; i < len; i++) { - if (matcher = Expr.relative[tokens[i].type]) { - matchers = [addCombinator(elementMatcher(matchers), matcher)]; - } else { - matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches); - if (matcher[expando]) { - j = ++i; - for (; j < len; j++) { - if (Expr.relative[tokens[j].type]) { - break; - } - } - return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === ' ' ? '*' : '' })).replace(rtrim, '$1'), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens)); - } - matchers.push(matcher); - } - } - return elementMatcher(matchers); - } - function matcherFromGroupMatchers(elementMatchers, setMatchers) { - var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function (seed, context, xml, results, outermost) { - var elem, j, matcher, matchedCount = 0, i = '0', unmatched = seed && [], setMatched = [], contextBackup = outermostContext, elems = seed || byElement && Expr.find.TAG('*', outermost), dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1, len = elems.length; - if (outermost) { - outermostContext = context !== document$1 && context; - } - for (; i !== len && (elem = elems[i]) != null; i++) { - if (byElement && elem) { - j = 0; - while (matcher = elementMatchers[j++]) { - if (matcher(elem, context, xml)) { - results.push(elem); - break; - } - } - if (outermost) { - dirruns = dirrunsUnique; - } - } - if (bySet) { - if (elem = !matcher && elem) { - matchedCount--; - } - if (seed) { - unmatched.push(elem); - } - } - } - matchedCount += i; - if (bySet && i !== matchedCount) { - j = 0; - while (matcher = setMatchers[j++]) { - matcher(unmatched, setMatched, context, xml); - } - if (seed) { - if (matchedCount > 0) { - while (i--) { - if (!(unmatched[i] || setMatched[i])) { - setMatched[i] = pop.call(results); - } - } - } - setMatched = condense(setMatched); - } - push.apply(results, setMatched); - if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) { - Sizzle.uniqueSort(results); - } - } - if (outermost) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - return unmatched; - }; - return bySet ? markFunction(superMatcher) : superMatcher; - } - compile = Sizzle.compile = function (selector, match) { - var i, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + ' ']; - if (!cached) { - if (!match) { - match = tokenize(selector); - } - i = match.length; - while (i--) { - cached = matcherFromTokens(match[i]); - if (cached[expando]) { - setMatchers.push(cached); - } else { - elementMatchers.push(cached); - } - } - cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers)); - cached.selector = selector; - } - return cached; - }; - select = Sizzle.select = function (selector, context, results, seed) { - var i, tokens, token, type, find, compiled = typeof selector === 'function' && selector, match = !seed && tokenize(selector = compiled.selector || selector); - results = results || []; - if (match.length === 1) { - tokens = match[0] = match[0].slice(0); - if (tokens.length > 2 && (token = tokens[0]).type === 'ID' && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) { - context = (Expr.find.ID(token.matches[0].replace(runescape, funescape), context) || [])[0]; - if (!context) { - return results; - } else if (compiled) { - context = context.parentNode; - } - selector = selector.slice(tokens.shift().value.length); - } - i = matchExpr.needsContext.test(selector) ? 0 : tokens.length; - while (i--) { - token = tokens[i]; - if (Expr.relative[type = token.type]) { - break; - } - if (find = Expr.find[type]) { - if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) { - tokens.splice(i, 1); - selector = seed.length && toSelector(tokens); - if (!selector) { - push.apply(results, seed); - return results; - } - break; - } - } - } - } - (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, rsibling.test(selector) && testContext(context.parentNode) || context); - return results; - }; - support.sortStable = expando.split('').sort(sortOrder).join('') === expando; - support.detectDuplicates = !!hasDuplicate; - setDocument(); - support.sortDetached = true; - - var doc = document, push$1 = Array.prototype.push, slice$1 = Array.prototype.slice; - var rquickExpr$1 = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/; - var Event = EventUtils.Event; - var skipUniques = Tools.makeMap('children,contents,next,prev'); - var isDefined = function (obj) { - return typeof obj !== 'undefined'; - }; - var isString$1 = function (obj) { - return typeof obj === 'string'; - }; - var isWindow = function (obj) { - return obj && obj === obj.window; - }; - var createFragment = function (html, fragDoc) { - fragDoc = fragDoc || doc; - var container = fragDoc.createElement('div'); - var frag = fragDoc.createDocumentFragment(); - container.innerHTML = html; - var node; - while (node = container.firstChild) { - frag.appendChild(node); - } - return frag; - }; - var domManipulate = function (targetNodes, sourceItem, callback, reverse) { - var i; - if (isString$1(sourceItem)) { - sourceItem = createFragment(sourceItem, getElementDocument(targetNodes[0])); - } else if (sourceItem.length && !sourceItem.nodeType) { - sourceItem = DomQuery.makeArray(sourceItem); - if (reverse) { - for (i = sourceItem.length - 1; i >= 0; i--) { - domManipulate(targetNodes, sourceItem[i], callback, reverse); - } - } else { - for (i = 0; i < sourceItem.length; i++) { - domManipulate(targetNodes, sourceItem[i], callback, reverse); - } - } - return targetNodes; - } - if (sourceItem.nodeType) { - i = targetNodes.length; - while (i--) { - callback.call(targetNodes[i], sourceItem); - } - } - return targetNodes; - }; - var hasClass = function (node, className) { - return node && className && (' ' + node.className + ' ').indexOf(' ' + className + ' ') !== -1; - }; - var wrap$1 = function (elements, wrapper, all) { - var lastParent, newWrapper; - wrapper = DomQuery(wrapper)[0]; - elements.each(function () { - var self = this; - if (!all || lastParent !== self.parentNode) { - lastParent = self.parentNode; - newWrapper = wrapper.cloneNode(false); - self.parentNode.insertBefore(newWrapper, self); - newWrapper.appendChild(self); - } else { - newWrapper.appendChild(self); - } - }); - return elements; - }; - var numericCssMap = Tools.makeMap('fillOpacity fontWeight lineHeight opacity orphans widows zIndex zoom', ' '); - var booleanMap = Tools.makeMap('checked compact declare defer disabled ismap multiple nohref noshade nowrap readonly selected', ' '); - var propFix = { - for: 'htmlFor', - class: 'className', - readonly: 'readOnly' - }; - var cssFix = { float: 'cssFloat' }; - var attrHooks = {}, cssHooks = {}; - var DomQueryConstructor = function (selector, context) { - return new DomQuery.fn.init(selector, context); - }; - var inArray$1 = function (item, array) { - var i; - if (array.indexOf) { - return array.indexOf(item); - } - i = array.length; - while (i--) { - if (array[i] === item) { - return i; - } - } - return -1; - }; - var whiteSpaceRegExp$2 = /^\s*|\s*$/g; - var trim$3 = function (str) { - return str === null || str === undefined ? '' : ('' + str).replace(whiteSpaceRegExp$2, ''); - }; - var each$4 = function (obj, callback) { - var length, key, i, value; - if (obj) { - length = obj.length; - if (length === undefined) { - for (key in obj) { - if (obj.hasOwnProperty(key)) { - value = obj[key]; - if (callback.call(value, key, value) === false) { - break; - } - } - } - } else { - for (i = 0; i < length; i++) { - value = obj[i]; - if (callback.call(value, i, value) === false) { - break; - } - } - } - } - return obj; - }; - var grep = function (array, callback) { - var out = []; - each$4(array, function (i, item) { - if (callback(item, i)) { - out.push(item); - } - }); - return out; - }; - var getElementDocument = function (element) { - if (!element) { - return doc; - } - if (element.nodeType === 9) { - return element; - } - return element.ownerDocument; - }; - DomQueryConstructor.fn = DomQueryConstructor.prototype = { - constructor: DomQueryConstructor, - selector: '', - context: null, - length: 0, - init: function (selector, context) { - var self = this; - var match, node; - if (!selector) { - return self; - } - if (selector.nodeType) { - self.context = self[0] = selector; - self.length = 1; - return self; - } - if (context && context.nodeType) { - self.context = context; - } else { - if (context) { - return DomQuery(selector).attr(context); - } - self.context = context = document; - } - if (isString$1(selector)) { - self.selector = selector; - if (selector.charAt(0) === '<' && selector.charAt(selector.length - 1) === '>' && selector.length >= 3) { - match = [ - null, - selector, - null - ]; - } else { - match = rquickExpr$1.exec(selector); - } - if (match) { - if (match[1]) { - node = createFragment(selector, getElementDocument(context)).firstChild; - while (node) { - push$1.call(self, node); - node = node.nextSibling; - } - } else { - node = getElementDocument(context).getElementById(match[2]); - if (!node) { - return self; - } - if (node.id !== match[2]) { - return self.find(selector); - } - self.length = 1; - self[0] = node; - } - } else { - return DomQuery(context).find(selector); - } - } else { - this.add(selector, false); - } - return self; - }, - toArray: function () { - return Tools.toArray(this); - }, - add: function (items, sort) { - var self = this; - var nodes, i; - if (isString$1(items)) { - return self.add(DomQuery(items)); - } - if (sort !== false) { - nodes = DomQuery.unique(self.toArray().concat(DomQuery.makeArray(items))); - self.length = nodes.length; - for (i = 0; i < nodes.length; i++) { - self[i] = nodes[i]; - } - } else { - push$1.apply(self, DomQuery.makeArray(items)); - } - return self; - }, - attr: function (name, value) { - var self = this; - var hook; - if (typeof name === 'object') { - each$4(name, function (name, value) { - self.attr(name, value); - }); - } else if (isDefined(value)) { - this.each(function () { - var hook; - if (this.nodeType === 1) { - hook = attrHooks[name]; - if (hook && hook.set) { - hook.set(this, value); - return; - } - if (value === null) { - this.removeAttribute(name, 2); - } else { - this.setAttribute(name, value, 2); - } - } - }); - } else { - if (self[0] && self[0].nodeType === 1) { - hook = attrHooks[name]; - if (hook && hook.get) { - return hook.get(self[0], name); - } - if (booleanMap[name]) { - return self.prop(name) ? name : undefined; - } - value = self[0].getAttribute(name, 2); - if (value === null) { - value = undefined; - } - } - return value; - } - return self; - }, - removeAttr: function (name) { - return this.attr(name, null); - }, - prop: function (name, value) { - var self = this; - name = propFix[name] || name; - if (typeof name === 'object') { - each$4(name, function (name, value) { - self.prop(name, value); - }); - } else if (isDefined(value)) { - this.each(function () { - if (this.nodeType === 1) { - this[name] = value; - } - }); - } else { - if (self[0] && self[0].nodeType && name in self[0]) { - return self[0][name]; - } - return value; - } - return self; - }, - css: function (name, value) { - var self = this; - var elm, hook; - var camel = function (name) { - return name.replace(/-(\D)/g, function (a, b) { - return b.toUpperCase(); - }); - }; - var dashed = function (name) { - return name.replace(/[A-Z]/g, function (a) { - return '-' + a; - }); - }; - if (typeof name === 'object') { - each$4(name, function (name, value) { - self.css(name, value); - }); - } else { - if (isDefined(value)) { - name = camel(name); - if (typeof value === 'number' && !numericCssMap[name]) { - value = value.toString() + 'px'; - } - self.each(function () { - var style = this.style; - hook = cssHooks[name]; - if (hook && hook.set) { - hook.set(this, value); - return; - } - try { - this.style[cssFix[name] || name] = value; - } catch (ex) { - } - if (value === null || value === '') { - if (style.removeProperty) { - style.removeProperty(dashed(name)); - } else { - style.removeAttribute(name); - } - } - }); - } else { - elm = self[0]; - hook = cssHooks[name]; - if (hook && hook.get) { - return hook.get(elm); - } - if (elm.ownerDocument.defaultView) { - try { - return elm.ownerDocument.defaultView.getComputedStyle(elm, null).getPropertyValue(dashed(name)); - } catch (ex) { - return undefined; - } - } else if (elm.currentStyle) { - return elm.currentStyle[camel(name)]; - } else { - return ''; - } - } - } - return self; - }, - remove: function () { - var self = this; - var node, i = this.length; - while (i--) { - node = self[i]; - Event.clean(node); - if (node.parentNode) { - node.parentNode.removeChild(node); - } - } - return this; - }, - empty: function () { - var self = this; - var node, i = this.length; - while (i--) { - node = self[i]; - while (node.firstChild) { - node.removeChild(node.firstChild); - } - } - return this; - }, - html: function (value) { - var self = this; - var i; - if (isDefined(value)) { - i = self.length; - try { - while (i--) { - self[i].innerHTML = value; - } - } catch (ex) { - DomQuery(self[i]).empty().append(value); - } - return self; - } - return self[0] ? self[0].innerHTML : ''; - }, - text: function (value) { - var self = this; - var i; - if (isDefined(value)) { - i = self.length; - while (i--) { - if ('innerText' in self[i]) { - self[i].innerText = value; - } else { - self[0].textContent = value; - } - } - return self; - } - return self[0] ? self[0].innerText || self[0].textContent : ''; - }, - append: function () { - return domManipulate(this, arguments, function (node) { - if (this.nodeType === 1 || this.host && this.host.nodeType === 1) { - this.appendChild(node); - } - }); - }, - prepend: function () { - return domManipulate(this, arguments, function (node) { - if (this.nodeType === 1 || this.host && this.host.nodeType === 1) { - this.insertBefore(node, this.firstChild); - } - }, true); - }, - before: function () { - var self = this; - if (self[0] && self[0].parentNode) { - return domManipulate(self, arguments, function (node) { - this.parentNode.insertBefore(node, this); - }); - } - return self; - }, - after: function () { - var self = this; - if (self[0] && self[0].parentNode) { - return domManipulate(self, arguments, function (node) { - this.parentNode.insertBefore(node, this.nextSibling); - }, true); - } - return self; - }, - appendTo: function (val) { - DomQuery(val).append(this); - return this; - }, - prependTo: function (val) { - DomQuery(val).prepend(this); - return this; - }, - replaceWith: function (content) { - return this.before(content).remove(); - }, - wrap: function (content) { - return wrap$1(this, content); - }, - wrapAll: function (content) { - return wrap$1(this, content, true); - }, - wrapInner: function (content) { - this.each(function () { - DomQuery(this).contents().wrapAll(content); - }); - return this; - }, - unwrap: function () { - return this.parent().each(function () { - DomQuery(this).replaceWith(this.childNodes); - }); - }, - clone: function () { - var result = []; - this.each(function () { - result.push(this.cloneNode(true)); - }); - return DomQuery(result); - }, - addClass: function (className) { - return this.toggleClass(className, true); - }, - removeClass: function (className) { - return this.toggleClass(className, false); - }, - toggleClass: function (className, state) { - var self = this; - if (typeof className !== 'string') { - return self; - } - if (className.indexOf(' ') !== -1) { - each$4(className.split(' '), function () { - self.toggleClass(this, state); - }); - } else { - self.each(function (index, node) { - var classState = hasClass(node, className); - if (classState !== state) { - var existingClassName = node.className; - if (classState) { - node.className = trim$3((' ' + existingClassName + ' ').replace(' ' + className + ' ', ' ')); - } else { - node.className += existingClassName ? ' ' + className : className; - } - } - }); - } - return self; - }, - hasClass: function (className) { - return hasClass(this[0], className); - }, - each: function (callback) { - return each$4(this, callback); - }, - on: function (name, callback) { - return this.each(function () { - Event.bind(this, name, callback); - }); - }, - off: function (name, callback) { - return this.each(function () { - Event.unbind(this, name, callback); - }); - }, - trigger: function (name) { - return this.each(function () { - if (typeof name === 'object') { - Event.fire(this, name.type, name); - } else { - Event.fire(this, name); - } - }); - }, - show: function () { - return this.css('display', ''); - }, - hide: function () { - return this.css('display', 'none'); - }, - slice: function () { - return new DomQuery(slice$1.apply(this, arguments)); - }, - eq: function (index) { - return index === -1 ? this.slice(index) : this.slice(index, +index + 1); - }, - first: function () { - return this.eq(0); - }, - last: function () { - return this.eq(-1); - }, - find: function (selector) { - var i, l; - var ret = []; - for (i = 0, l = this.length; i < l; i++) { - DomQuery.find(selector, this[i], ret); - } - return DomQuery(ret); - }, - filter: function (selector) { - if (typeof selector === 'function') { - return DomQuery(grep(this.toArray(), function (item, i) { - return selector(i, item); - })); - } - return DomQuery(DomQuery.filter(selector, this.toArray())); - }, - closest: function (selector) { - var result = []; - if (selector instanceof DomQuery) { - selector = selector[0]; - } - this.each(function (i, node) { - while (node) { - if (typeof selector === 'string' && DomQuery(node).is(selector)) { - result.push(node); - break; - } else if (node === selector) { - result.push(node); - break; - } - node = node.parentNode; - } - }); - return DomQuery(result); - }, - offset: function (offset) { - var elm, doc, docElm; - var x = 0, y = 0, pos; - if (!offset) { - elm = this[0]; - if (elm) { - doc = elm.ownerDocument; - docElm = doc.documentElement; - if (elm.getBoundingClientRect) { - pos = elm.getBoundingClientRect(); - x = pos.left + (docElm.scrollLeft || doc.body.scrollLeft) - docElm.clientLeft; - y = pos.top + (docElm.scrollTop || doc.body.scrollTop) - docElm.clientTop; - } - } - return { - left: x, - top: y - }; - } - return this.css(offset); - }, - push: push$1, - sort: Array.prototype.sort, - splice: Array.prototype.splice - }; - Tools.extend(DomQueryConstructor, { - extend: Tools.extend, - makeArray: function (object) { - if (isWindow(object) || object.nodeType) { - return [object]; - } - return Tools.toArray(object); - }, - inArray: inArray$1, - isArray: Tools.isArray, - each: each$4, - trim: trim$3, - grep: grep, - find: Sizzle, - expr: Sizzle.selectors, - unique: Sizzle.uniqueSort, - text: Sizzle.getText, - contains: Sizzle.contains, - filter: function (expr, elems, not) { - var i = elems.length; - if (not) { - expr = ':not(' + expr + ')'; - } - while (i--) { - if (elems[i].nodeType !== 1) { - elems.splice(i, 1); - } - } - if (elems.length === 1) { - elems = DomQuery.find.matchesSelector(elems[0], expr) ? [elems[0]] : []; - } else { - elems = DomQuery.find.matches(expr, elems); - } - return elems; - } - }); - var dir = function (el, prop, until) { - var matched = []; - var cur = el[prop]; - if (typeof until !== 'string' && until instanceof DomQuery) { - until = until[0]; - } - while (cur && cur.nodeType !== 9) { - if (until !== undefined) { - if (cur === until) { - break; - } - if (typeof until === 'string' && DomQuery(cur).is(until)) { - break; - } - } - if (cur.nodeType === 1) { - matched.push(cur); - } - cur = cur[prop]; - } - return matched; - }; - var sibling$1 = function (node, siblingName, nodeType, until) { - var result = []; - if (until instanceof DomQuery) { - until = until[0]; - } - for (; node; node = node[siblingName]) { - if (nodeType && node.nodeType !== nodeType) { - continue; - } - if (until !== undefined) { - if (node === until) { - break; - } - if (typeof until === 'string' && DomQuery(node).is(until)) { - break; - } - } - result.push(node); - } - return result; - }; - var firstSibling = function (node, siblingName, nodeType) { - for (node = node[siblingName]; node; node = node[siblingName]) { - if (node.nodeType === nodeType) { - return node; - } - } - return null; - }; - each$4({ - parent: function (node) { - var parent = node.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function (node) { - return dir(node, 'parentNode'); - }, - next: function (node) { - return firstSibling(node, 'nextSibling', 1); - }, - prev: function (node) { - return firstSibling(node, 'previousSibling', 1); - }, - children: function (node) { - return sibling$1(node.firstChild, 'nextSibling', 1); - }, - contents: function (node) { - return Tools.toArray((node.nodeName === 'iframe' ? node.contentDocument || node.contentWindow.document : node).childNodes); - } - }, function (name, fn) { - DomQueryConstructor.fn[name] = function (selector) { - var self = this; - var result = []; - self.each(function () { - var nodes = fn.call(result, this, selector, result); - if (nodes) { - if (DomQuery.isArray(nodes)) { - result.push.apply(result, nodes); - } else { - result.push(nodes); - } - } - }); - if (this.length > 1) { - if (!skipUniques[name]) { - result = DomQuery.unique(result); - } - if (name.indexOf('parents') === 0) { - result = result.reverse(); - } - } - var wrappedResult = DomQuery(result); - if (selector) { - return wrappedResult.filter(selector); - } - return wrappedResult; - }; - }); - each$4({ - parentsUntil: function (node, until) { - return dir(node, 'parentNode', until); - }, - nextUntil: function (node, until) { - return sibling$1(node, 'nextSibling', 1, until).slice(1); - }, - prevUntil: function (node, until) { - return sibling$1(node, 'previousSibling', 1, until).slice(1); - } - }, function (name, fn) { - DomQueryConstructor.fn[name] = function (selector, filter) { - var self = this; - var result = []; - self.each(function () { - var nodes = fn.call(result, this, selector, result); - if (nodes) { - if (DomQuery.isArray(nodes)) { - result.push.apply(result, nodes); - } else { - result.push(nodes); - } - } - }); - if (this.length > 1) { - result = DomQuery.unique(result); - if (name.indexOf('parents') === 0 || name === 'prevUntil') { - result = result.reverse(); - } - } - var wrappedResult = DomQuery(result); - if (filter) { - return wrappedResult.filter(filter); - } - return wrappedResult; - }; - }); - DomQueryConstructor.fn.is = function (selector) { - return !!selector && this.filter(selector).length > 0; - }; - DomQueryConstructor.fn.init.prototype = DomQueryConstructor.fn; - DomQueryConstructor.overrideDefaults = function (callback) { - var defaults; - var sub = function (selector, context) { - defaults = defaults || callback(); - if (arguments.length === 0) { - selector = defaults.element; - } - if (!context) { - context = defaults.context; - } - return new sub.fn.init(selector, context); - }; - DomQuery.extend(sub, this); - return sub; - }; - DomQueryConstructor.attrHooks = attrHooks; - DomQueryConstructor.cssHooks = cssHooks; - var DomQuery = DomQueryConstructor; - - var each$5 = Tools.each; - var grep$1 = Tools.grep; - var isIE = Env.ie; - var simpleSelectorRe = /^([a-z0-9],?)+$/i; - var setupAttrHooks = function (styles, settings, getContext) { - var keepValues = settings.keep_values; - var keepUrlHook = { - set: function ($elm, value, name) { - if (settings.url_converter) { - value = settings.url_converter.call(settings.url_converter_scope || getContext(), value, name, $elm[0]); - } - $elm.attr('data-mce-' + name, value).attr(name, value); - }, - get: function ($elm, name) { - return $elm.attr('data-mce-' + name) || $elm.attr(name); - } - }; - var attrHooks = { - style: { - set: function ($elm, value) { - if (value !== null && typeof value === 'object') { - $elm.css(value); - return; - } - if (keepValues) { - $elm.attr('data-mce-style', value); - } - if (value !== null && typeof value === 'string') { - $elm.removeAttr('style'); - $elm.css(styles.parse(value)); - } else { - $elm.attr('style', value); - } - }, - get: function ($elm) { - var value = $elm.attr('data-mce-style') || $elm.attr('style'); - value = styles.serialize(styles.parse(value), $elm[0].nodeName); - return value; - } - } - }; - if (keepValues) { - attrHooks.href = attrHooks.src = keepUrlHook; - } - return attrHooks; - }; - var updateInternalStyleAttr = function (styles, $elm) { - var rawValue = $elm.attr('style'); - var value = styles.serialize(styles.parse(rawValue), $elm[0].nodeName); - if (!value) { - value = null; - } - $elm.attr('data-mce-style', value); - }; - var findNodeIndex = function (node, normalized) { - var idx = 0, lastNodeType, nodeType; - if (node) { - for (lastNodeType = node.nodeType, node = node.previousSibling; node; node = node.previousSibling) { - nodeType = node.nodeType; - if (normalized && nodeType === 3) { - if (nodeType === lastNodeType || !node.nodeValue.length) { - continue; - } - } - idx++; - lastNodeType = nodeType; - } - } - return idx; - }; - function DOMUtils(doc, settings) { - var _this = this; - if (settings === void 0) { - settings = {}; - } - var addedStyles = {}; - var win = window; - var files = {}; - var counter = 0; - var stdMode = true; - var boxModel = true; - var styleSheetLoader = instance.forElement(SugarElement.fromDom(doc), { - contentCssCors: settings.contentCssCors, - referrerPolicy: settings.referrerPolicy - }); - var boundEvents = []; - var schema = settings.schema ? settings.schema : Schema({}); - var styles = Styles({ - url_converter: settings.url_converter, - url_converter_scope: settings.url_converter_scope - }, settings.schema); - var events = settings.ownEvents ? new EventUtils() : EventUtils.Event; - var blockElementsMap = schema.getBlockElements(); - var $ = DomQuery.overrideDefaults(function () { - return { - context: doc, - element: self.getRoot() - }; - }); - var isBlock = function (node) { - if (typeof node === 'string') { - return !!blockElementsMap[node]; - } else if (node) { - var type = node.nodeType; - if (type) { - return !!(type === 1 && blockElementsMap[node.nodeName]); - } - } - return false; - }; - var get = function (elm) { - return elm && doc && isString(elm) ? doc.getElementById(elm) : elm; - }; - var $$ = function (elm) { - return $(typeof elm === 'string' ? get(elm) : elm); - }; - var getAttrib = function (elm, name, defaultVal) { - var hook, value; - var $elm = $$(elm); - if ($elm.length) { - hook = attrHooks[name]; - if (hook && hook.get) { - value = hook.get($elm, name); - } else { - value = $elm.attr(name); - } - } - if (typeof value === 'undefined') { - value = defaultVal || ''; - } - return value; - }; - var getAttribs = function (elm) { - var node = get(elm); - if (!node) { - return []; - } - return node.attributes; - }; - var setAttrib = function (elm, name, value) { - if (value === '') { - value = null; - } - var $elm = $$(elm); - var originalValue = $elm.attr(name); - if (!$elm.length) { - return; - } - var hook = attrHooks[name]; - if (hook && hook.set) { - hook.set($elm, value, name); - } else { - $elm.attr(name, value); - } - if (originalValue !== value && settings.onSetAttrib) { - settings.onSetAttrib({ - attrElm: $elm, - attrName: name, - attrValue: value - }); - } - }; - var clone = function (node, deep) { - if (!isIE || node.nodeType !== 1 || deep) { - return node.cloneNode(deep); - } else { - var clone_1 = doc.createElement(node.nodeName); - each$5(getAttribs(node), function (attr) { - setAttrib(clone_1, attr.nodeName, getAttrib(node, attr.nodeName)); - }); - return clone_1; - } - }; - var getRoot = function () { - return settings.root_element || doc.body; - }; - var getViewPort = function (argWin) { - var vp = getBounds(argWin); - return { - x: vp.x, - y: vp.y, - w: vp.width, - h: vp.height - }; - }; - var getPos$1 = function (elm, rootElm) { - return getPos(doc.body, get(elm), rootElm); - }; - var setStyle = function (elm, name, value) { - var $elm = isString(name) ? $$(elm).css(name, value) : $$(elm).css(name); - if (settings.update_styles) { - updateInternalStyleAttr(styles, $elm); - } - }; - var setStyles = function (elm, stylesArg) { - var $elm = $$(elm).css(stylesArg); - if (settings.update_styles) { - updateInternalStyleAttr(styles, $elm); - } - }; - var getStyle = function (elm, name, computed) { - var $elm = $$(elm); - if (computed) { - return $elm.css(name); - } - name = name.replace(/-(\D)/g, function (a, b) { - return b.toUpperCase(); - }); - if (name === 'float') { - name = Env.browser.isIE() ? 'styleFloat' : 'cssFloat'; - } - return $elm[0] && $elm[0].style ? $elm[0].style[name] : undefined; - }; - var getSize = function (elm) { - var w, h; - elm = get(elm); - w = getStyle(elm, 'width'); - h = getStyle(elm, 'height'); - if (w.indexOf('px') === -1) { - w = 0; - } - if (h.indexOf('px') === -1) { - h = 0; - } - return { - w: parseInt(w, 10) || elm.offsetWidth || elm.clientWidth, - h: parseInt(h, 10) || elm.offsetHeight || elm.clientHeight - }; - }; - var getRect = function (elm) { - elm = get(elm); - var pos = getPos$1(elm); - var size = getSize(elm); - return { - x: pos.x, - y: pos.y, - w: size.w, - h: size.h - }; - }; - var is = function (elm, selector) { - var i; - if (!elm) { - return false; - } - if (!Array.isArray(elm)) { - if (selector === '*') { - return elm.nodeType === 1; - } - if (simpleSelectorRe.test(selector)) { - var selectors = selector.toLowerCase().split(/,/); - var elmName = elm.nodeName.toLowerCase(); - for (i = selectors.length - 1; i >= 0; i--) { - if (selectors[i] === elmName) { - return true; - } - } - return false; - } - if (elm.nodeType && elm.nodeType !== 1) { - return false; - } - } - var elms = !Array.isArray(elm) ? [elm] : elm; - return Sizzle(selector, elms[0].ownerDocument || elms[0], null, elms).length > 0; - }; - var getParents = function (elm, selector, root, collect) { - var result = []; - var selectorVal; - var node = get(elm); - collect = collect === undefined; - root = root || (getRoot().nodeName !== 'BODY' ? getRoot().parentNode : null); - if (Tools.is(selector, 'string')) { - selectorVal = selector; - if (selector === '*') { - selector = function (node) { - return node.nodeType === 1; - }; - } else { - selector = function (node) { - return is(node, selectorVal); - }; - } - } - while (node) { - if (node === root || isNullable(node.nodeType) || isDocument$1(node) || isDocumentFragment$1(node)) { - break; - } - if (!selector || typeof selector === 'function' && selector(node)) { - if (collect) { - result.push(node); - } else { - return [node]; - } - } - node = node.parentNode; - } - return collect ? result : null; - }; - var getParent = function (node, selector, root) { - var parents = getParents(node, selector, root, false); - return parents && parents.length > 0 ? parents[0] : null; - }; - var _findSib = function (node, selector, name) { - var func = selector; - if (node) { - if (typeof selector === 'string') { - func = function (node) { - return is(node, selector); - }; - } - for (node = node[name]; node; node = node[name]) { - if (typeof func === 'function' && func(node)) { - return node; - } - } - } - return null; - }; - var getNext = function (node, selector) { - return _findSib(node, selector, 'nextSibling'); - }; - var getPrev = function (node, selector) { - return _findSib(node, selector, 'previousSibling'); - }; - var select = function (selector, scope) { - return Sizzle(selector, get(scope) || settings.root_element || doc, []); - }; - var run = function (elm, func, scope) { - var result; - var node = typeof elm === 'string' ? get(elm) : elm; - if (!node) { - return false; - } - if (Tools.isArray(node) && (node.length || node.length === 0)) { - result = []; - each$5(node, function (elm, i) { - if (elm) { - result.push(func.call(scope, typeof elm === 'string' ? get(elm) : elm, i)); - } - }); - return result; - } - var context = scope ? scope : _this; - return func.call(context, node); - }; - var setAttribs = function (elm, attrs) { - $$(elm).each(function (i, node) { - each$5(attrs, function (value, name) { - setAttrib(node, name, value); - }); - }); - }; - var setHTML = function (elm, html) { - var $elm = $$(elm); - if (isIE) { - $elm.each(function (i, target) { - if (target.canHaveHTML === false) { - return; - } - while (target.firstChild) { - target.removeChild(target.firstChild); - } - try { - target.innerHTML = '
                                      ' + html; - target.removeChild(target.firstChild); - } catch (ex) { - DomQuery('
                                      ').html('
                                      ' + html).contents().slice(1).appendTo(target); - } - return html; - }); - } else { - $elm.html(html); - } - }; - var add = function (parentElm, name, attrs, html, create) { - return run(parentElm, function (parentElm) { - var newElm = typeof name === 'string' ? doc.createElement(name) : name; - setAttribs(newElm, attrs); - if (html) { - if (typeof html !== 'string' && html.nodeType) { - newElm.appendChild(html); - } else if (typeof html === 'string') { - setHTML(newElm, html); - } - } - return !create ? parentElm.appendChild(newElm) : newElm; - }); - }; - var create = function (name, attrs, html) { - return add(doc.createElement(name), name, attrs, html, true); - }; - var decode = Entities.decode; - var encode = Entities.encodeAllRaw; - var createHTML = function (name, attrs, html) { - var outHtml = '', key; - outHtml += '<' + name; - for (key in attrs) { - if (attrs.hasOwnProperty(key) && attrs[key] !== null && typeof attrs[key] !== 'undefined') { - outHtml += ' ' + key + '="' + encode(attrs[key]) + '"'; - } - } - if (typeof html !== 'undefined') { - return outHtml + '>' + html + ''; - } - return outHtml + ' />'; - }; - var createFragment = function (html) { - var node; - var container = doc.createElement('div'); - var frag = doc.createDocumentFragment(); - frag.appendChild(container); - if (html) { - container.innerHTML = html; - } - while (node = container.firstChild) { - frag.appendChild(node); - } - frag.removeChild(container); - return frag; - }; - var remove = function (node, keepChildren) { - var $node = $$(node); - if (keepChildren) { - $node.each(function () { - var child; - while (child = this.firstChild) { - if (child.nodeType === 3 && child.data.length === 0) { - this.removeChild(child); - } else { - this.parentNode.insertBefore(child, this); - } - } - }).remove(); - } else { - $node.remove(); - } - return $node.length > 1 ? $node.toArray() : $node[0]; - }; - var removeAllAttribs = function (e) { - return run(e, function (e) { - var i; - var attrs = e.attributes; - for (i = attrs.length - 1; i >= 0; i--) { - e.removeAttributeNode(attrs.item(i)); - } - }); - }; - var parseStyle = function (cssText) { - return styles.parse(cssText); - }; - var serializeStyle = function (stylesArg, name) { - return styles.serialize(stylesArg, name); - }; - var addStyle = function (cssText) { - var head, styleElm; - if (self !== DOMUtils.DOM && doc === document) { - if (addedStyles[cssText]) { - return; - } - addedStyles[cssText] = true; - } - styleElm = doc.getElementById('mceDefaultStyles'); - if (!styleElm) { - styleElm = doc.createElement('style'); - styleElm.id = 'mceDefaultStyles'; - styleElm.type = 'text/css'; - head = doc.getElementsByTagName('head')[0]; - if (head.firstChild) { - head.insertBefore(styleElm, head.firstChild); - } else { - head.appendChild(styleElm); - } - } - if (styleElm.styleSheet) { - styleElm.styleSheet.cssText += cssText; - } else { - styleElm.appendChild(doc.createTextNode(cssText)); - } - }; - var loadCSS = function (urls) { - if (!urls) { - urls = ''; - } - each(urls.split(','), function (url) { - files[url] = true; - styleSheetLoader.load(url, noop); - }); - }; - var toggleClass = function (elm, cls, state) { - $$(elm).toggleClass(cls, state).each(function () { - if (this.className === '') { - DomQuery(this).attr('class', null); - } - }); - }; - var addClass = function (elm, cls) { - $$(elm).addClass(cls); - }; - var removeClass = function (elm, cls) { - toggleClass(elm, cls, false); - }; - var hasClass = function (elm, cls) { - return $$(elm).hasClass(cls); - }; - var show = function (elm) { - $$(elm).show(); - }; - var hide = function (elm) { - $$(elm).hide(); - }; - var isHidden = function (elm) { - return $$(elm).css('display') === 'none'; - }; - var uniqueId = function (prefix) { - return (!prefix ? 'mce_' : prefix) + counter++; - }; - var getOuterHTML = function (elm) { - var node = typeof elm === 'string' ? get(elm) : elm; - return isElement$1(node) ? node.outerHTML : DomQuery('
                                      ').append(DomQuery(node).clone()).html(); - }; - var setOuterHTML = function (elm, html) { - $$(elm).each(function () { - try { - if ('outerHTML' in this) { - this.outerHTML = html; - return; - } - } catch (ex) { - } - remove(DomQuery(this).html(html), true); - }); - }; - var insertAfter = function (node, reference) { - var referenceNode = get(reference); - return run(node, function (node) { - var parent = referenceNode.parentNode; - var nextSibling = referenceNode.nextSibling; - if (nextSibling) { - parent.insertBefore(node, nextSibling); - } else { - parent.appendChild(node); - } - return node; - }); - }; - var replace = function (newElm, oldElm, keepChildren) { - return run(oldElm, function (oldElm) { - if (Tools.is(oldElm, 'array')) { - newElm = newElm.cloneNode(true); - } - if (keepChildren) { - each$5(grep$1(oldElm.childNodes), function (node) { - newElm.appendChild(node); - }); - } - return oldElm.parentNode.replaceChild(newElm, oldElm); - }); - }; - var rename = function (elm, name) { - var newElm; - if (elm.nodeName !== name.toUpperCase()) { - newElm = create(name); - each$5(getAttribs(elm), function (attrNode) { - setAttrib(newElm, attrNode.nodeName, getAttrib(elm, attrNode.nodeName)); - }); - replace(newElm, elm, true); - } - return newElm || elm; - }; - var findCommonAncestor = function (a, b) { - var ps = a, pe; - while (ps) { - pe = b; - while (pe && ps !== pe) { - pe = pe.parentNode; - } - if (ps === pe) { - break; - } - ps = ps.parentNode; - } - if (!ps && a.ownerDocument) { - return a.ownerDocument.documentElement; - } - return ps; - }; - var toHex = function (rgbVal) { - return styles.toHex(Tools.trim(rgbVal)); - }; - var isNonEmptyElement = function (node) { - if (isElement$1(node)) { - var isNamedAnchor = node.nodeName.toLowerCase() === 'a' && !getAttrib(node, 'href') && getAttrib(node, 'id'); - if (getAttrib(node, 'name') || getAttrib(node, 'data-mce-bookmark') || isNamedAnchor) { - return true; - } - } - return false; - }; - var isEmpty = function (node, elements) { - var type, name, brCount = 0; - if (isNonEmptyElement(node)) { - return false; - } - node = node.firstChild; - if (node) { - var walker = new DomTreeWalker(node, node.parentNode); - var whitespace = schema ? schema.getWhiteSpaceElements() : {}; - elements = elements || (schema ? schema.getNonEmptyElements() : null); - do { - type = node.nodeType; - if (isElement$1(node)) { - var bogusVal = node.getAttribute('data-mce-bogus'); - if (bogusVal) { - node = walker.next(bogusVal === 'all'); - continue; - } - name = node.nodeName.toLowerCase(); - if (elements && elements[name]) { - if (name === 'br') { - brCount++; - node = walker.next(); - continue; - } - return false; - } - if (isNonEmptyElement(node)) { - return false; - } - } - if (type === 8) { - return false; - } - if (type === 3 && !isWhitespaceText(node.nodeValue)) { - return false; - } - if (type === 3 && node.parentNode && whitespace[node.parentNode.nodeName] && isWhitespaceText(node.nodeValue)) { - return false; - } - node = walker.next(); - } while (node); - } - return brCount <= 1; - }; - var createRng = function () { - return doc.createRange(); - }; - var split = function (parentElm, splitElm, replacementElm) { - var range = createRng(); - var beforeFragment; - var afterFragment; - var parentNode; - if (parentElm && splitElm) { - range.setStart(parentElm.parentNode, findNodeIndex(parentElm)); - range.setEnd(splitElm.parentNode, findNodeIndex(splitElm)); - beforeFragment = range.extractContents(); - range = createRng(); - range.setStart(splitElm.parentNode, findNodeIndex(splitElm) + 1); - range.setEnd(parentElm.parentNode, findNodeIndex(parentElm) + 1); - afterFragment = range.extractContents(); - parentNode = parentElm.parentNode; - parentNode.insertBefore(trimNode(self, beforeFragment), parentElm); - if (replacementElm) { - parentNode.insertBefore(replacementElm, parentElm); - } else { - parentNode.insertBefore(splitElm, parentElm); - } - parentNode.insertBefore(trimNode(self, afterFragment), parentElm); - remove(parentElm); - return replacementElm || splitElm; - } - }; - var bind = function (target, name, func, scope) { - if (Tools.isArray(target)) { - var i = target.length; - var rv = []; - while (i--) { - rv[i] = bind(target[i], name, func, scope); - } - return rv; - } - if (settings.collect && (target === doc || target === win)) { - boundEvents.push([ - target, - name, - func, - scope - ]); - } - var output = events.bind(target, name, func, scope || self); - return output; - }; - var unbind = function (target, name, func) { - if (Tools.isArray(target)) { - var i = target.length; - var rv = []; - while (i--) { - rv[i] = unbind(target[i], name, func); - } - return rv; - } else { - if (boundEvents.length > 0 && (target === doc || target === win)) { - var i = boundEvents.length; - while (i--) { - var item = boundEvents[i]; - if (target === item[0] && (!name || name === item[1]) && (!func || func === item[2])) { - events.unbind(item[0], item[1], item[2]); - } - } - } - return events.unbind(target, name, func); - } - }; - var fire = function (target, name, evt) { - return events.fire(target, name, evt); - }; - var getContentEditable = function (node) { - if (node && isElement$1(node)) { - var contentEditable = node.getAttribute('data-mce-contenteditable'); - if (contentEditable && contentEditable !== 'inherit') { - return contentEditable; - } - return node.contentEditable !== 'inherit' ? node.contentEditable : null; - } else { - return null; - } - }; - var getContentEditableParent = function (node) { - var root = getRoot(); - var state = null; - for (; node && node !== root; node = node.parentNode) { - state = getContentEditable(node); - if (state !== null) { - break; - } - } - return state; - }; - var destroy = function () { - if (boundEvents.length > 0) { - var i = boundEvents.length; - while (i--) { - var item = boundEvents[i]; - events.unbind(item[0], item[1], item[2]); - } - } - each$1(files, function (_, url) { - styleSheetLoader.unload(url); - delete files[url]; - }); - if (Sizzle.setDocument) { - Sizzle.setDocument(); - } - }; - var isChildOf = function (node, parent) { - while (node) { - if (parent === node) { - return true; - } - node = node.parentNode; - } - return false; - }; - var dumpRng = function (r) { - return 'startContainer: ' + r.startContainer.nodeName + ', startOffset: ' + r.startOffset + ', endContainer: ' + r.endContainer.nodeName + ', endOffset: ' + r.endOffset; - }; - var self = { - doc: doc, - settings: settings, - win: win, - files: files, - stdMode: stdMode, - boxModel: boxModel, - styleSheetLoader: styleSheetLoader, - boundEvents: boundEvents, - styles: styles, - schema: schema, - events: events, - isBlock: isBlock, - $: $, - $$: $$, - root: null, - clone: clone, - getRoot: getRoot, - getViewPort: getViewPort, - getRect: getRect, - getSize: getSize, - getParent: getParent, - getParents: getParents, - get: get, - getNext: getNext, - getPrev: getPrev, - select: select, - is: is, - add: add, - create: create, - createHTML: createHTML, - createFragment: createFragment, - remove: remove, - setStyle: setStyle, - getStyle: getStyle, - setStyles: setStyles, - removeAllAttribs: removeAllAttribs, - setAttrib: setAttrib, - setAttribs: setAttribs, - getAttrib: getAttrib, - getPos: getPos$1, - parseStyle: parseStyle, - serializeStyle: serializeStyle, - addStyle: addStyle, - loadCSS: loadCSS, - addClass: addClass, - removeClass: removeClass, - hasClass: hasClass, - toggleClass: toggleClass, - show: show, - hide: hide, - isHidden: isHidden, - uniqueId: uniqueId, - setHTML: setHTML, - getOuterHTML: getOuterHTML, - setOuterHTML: setOuterHTML, - decode: decode, - encode: encode, - insertAfter: insertAfter, - replace: replace, - rename: rename, - findCommonAncestor: findCommonAncestor, - toHex: toHex, - run: run, - getAttribs: getAttribs, - isEmpty: isEmpty, - createRng: createRng, - nodeIndex: findNodeIndex, - split: split, - bind: bind, - unbind: unbind, - fire: fire, - getContentEditable: getContentEditable, - getContentEditableParent: getContentEditableParent, - destroy: destroy, - isChildOf: isChildOf, - dumpRng: dumpRng - }; - var attrHooks = setupAttrHooks(styles, settings, function () { - return self; - }); - return self; - } - (function (DOMUtils) { - DOMUtils.DOM = DOMUtils(document); - DOMUtils.nodeIndex = findNodeIndex; - }(DOMUtils || (DOMUtils = {}))); - var DOMUtils$1 = DOMUtils; - - var DOM = DOMUtils$1.DOM; - var each$6 = Tools.each, grep$2 = Tools.grep; - var QUEUED = 0; - var LOADING = 1; - var LOADED = 2; - var FAILED = 3; - var ScriptLoader = function () { - function ScriptLoader(settings) { - if (settings === void 0) { - settings = {}; - } - this.states = {}; - this.queue = []; - this.scriptLoadedCallbacks = {}; - this.queueLoadedCallbacks = []; - this.loading = 0; - this.settings = settings; - } - ScriptLoader.prototype._setReferrerPolicy = function (referrerPolicy) { - this.settings.referrerPolicy = referrerPolicy; - }; - ScriptLoader.prototype.loadScript = function (url, success, failure) { - var dom = DOM; - var elm; - var cleanup = function () { - dom.remove(id); - if (elm) { - elm.onerror = elm.onload = elm = null; - } - }; - var done = function () { - cleanup(); - success(); - }; - var error = function () { - cleanup(); - if (isFunction(failure)) { - failure(); - } else { - if (typeof console !== 'undefined' && console.log) { - console.log('Failed to load script: ' + url); - } - } - }; - var id = dom.uniqueId(); - elm = document.createElement('script'); - elm.id = id; - elm.type = 'text/javascript'; - elm.src = Tools._addCacheSuffix(url); - if (this.settings.referrerPolicy) { - dom.setAttrib(elm, 'referrerpolicy', this.settings.referrerPolicy); - } - elm.onload = done; - elm.onerror = error; - (document.getElementsByTagName('head')[0] || document.body).appendChild(elm); - }; - ScriptLoader.prototype.isDone = function (url) { - return this.states[url] === LOADED; - }; - ScriptLoader.prototype.markDone = function (url) { - this.states[url] = LOADED; - }; - ScriptLoader.prototype.add = function (url, success, scope, failure) { - var state = this.states[url]; - this.queue.push(url); - if (state === undefined) { - this.states[url] = QUEUED; - } - if (success) { - if (!this.scriptLoadedCallbacks[url]) { - this.scriptLoadedCallbacks[url] = []; - } - this.scriptLoadedCallbacks[url].push({ - success: success, - failure: failure, - scope: scope || this - }); - } - }; - ScriptLoader.prototype.load = function (url, success, scope, failure) { - return this.add(url, success, scope, failure); - }; - ScriptLoader.prototype.remove = function (url) { - delete this.states[url]; - delete this.scriptLoadedCallbacks[url]; - }; - ScriptLoader.prototype.loadQueue = function (success, scope, failure) { - this.loadScripts(this.queue, success, scope, failure); - }; - ScriptLoader.prototype.loadScripts = function (scripts, success, scope, failure) { - var self = this; - var failures = []; - var execCallbacks = function (name, url) { - each$6(self.scriptLoadedCallbacks[url], function (callback) { - if (isFunction(callback[name])) { - callback[name].call(callback.scope); - } - }); - self.scriptLoadedCallbacks[url] = undefined; - }; - self.queueLoadedCallbacks.push({ - success: success, - failure: failure, - scope: scope || this - }); - var loadScripts = function () { - var loadingScripts = grep$2(scripts); - scripts.length = 0; - each$6(loadingScripts, function (url) { - if (self.states[url] === LOADED) { - execCallbacks('success', url); - return; - } - if (self.states[url] === FAILED) { - execCallbacks('failure', url); - return; - } - if (self.states[url] !== LOADING) { - self.states[url] = LOADING; - self.loading++; - self.loadScript(url, function () { - self.states[url] = LOADED; - self.loading--; - execCallbacks('success', url); - loadScripts(); - }, function () { - self.states[url] = FAILED; - self.loading--; - failures.push(url); - execCallbacks('failure', url); - loadScripts(); - }); - } - }); - if (!self.loading) { - var notifyCallbacks = self.queueLoadedCallbacks.slice(0); - self.queueLoadedCallbacks.length = 0; - each$6(notifyCallbacks, function (callback) { - if (failures.length === 0) { - if (isFunction(callback.success)) { - callback.success.call(callback.scope); - } - } else { - if (isFunction(callback.failure)) { - callback.failure.call(callback.scope, failures); - } - } - }); - } - }; - loadScripts(); - }; - ScriptLoader.ScriptLoader = new ScriptLoader(); - return ScriptLoader; - }(); - - var Cell = function (initial) { - var value = initial; - var get = function () { - return value; - }; - var set = function (v) { - value = v; - }; - return { - get: get, - set: set - }; - }; - - var isRaw = function (str) { - return isObject(str) && has(str, 'raw'); - }; - var isTokenised = function (str) { - return isArray(str) && str.length > 1; - }; - var data = {}; - var currentCode = Cell('en'); - var getLanguageData = function () { - return get$1(data, currentCode.get()); - }; - var getData = function () { - return map$1(data, function (value) { - return __assign({}, value); - }); - }; - var setCode = function (newCode) { - if (newCode) { - currentCode.set(newCode); - } - }; - var getCode = function () { - return currentCode.get(); - }; - var add = function (code, items) { - var langData = data[code]; - if (!langData) { - data[code] = langData = {}; - } - each$1(items, function (translation, name) { - langData[name.toLowerCase()] = translation; - }); - }; - var translate = function (text) { - var langData = getLanguageData().getOr({}); - var toString = function (obj) { - if (isFunction(obj)) { - return Object.prototype.toString.call(obj); - } - return !isEmpty(obj) ? '' + obj : ''; - }; - var isEmpty = function (text) { - return text === '' || text === null || text === undefined; - }; - var getLangData = function (text) { - var textstr = toString(text); - return get$1(langData, textstr.toLowerCase()).map(toString).getOr(textstr); - }; - var removeContext = function (str) { - return str.replace(/{context:\w+}$/, ''); - }; - if (isEmpty(text)) { - return ''; - } - if (isRaw(text)) { - return toString(text.raw); - } - if (isTokenised(text)) { - var values_1 = text.slice(1); - var substitued = getLangData(text[0]).replace(/\{([0-9]+)\}/g, function ($1, $2) { - return has(values_1, $2) ? toString(values_1[$2]) : $1; - }); - return removeContext(substitued); - } - return removeContext(getLangData(text)); - }; - var isRtl = function () { - return getLanguageData().bind(function (items) { - return get$1(items, '_dir'); - }).exists(function (dir) { - return dir === 'rtl'; - }); - }; - var hasCode = function (code) { - return has(data, code); - }; - var I18n = { - getData: getData, - setCode: setCode, - getCode: getCode, - add: add, - translate: translate, - isRtl: isRtl, - hasCode: hasCode - }; - - function AddOnManager() { - var _this = this; - var items = []; - var urls = {}; - var lookup = {}; - var _listeners = []; - var runListeners = function (name, state) { - var matchedListeners = filter(_listeners, function (listener) { - return listener.name === name && listener.state === state; - }); - each(matchedListeners, function (listener) { - return listener.callback(); - }); - }; - var get = function (name) { - if (lookup[name]) { - return lookup[name].instance; - } - return undefined; - }; - var dependencies = function (name) { - var result; - if (lookup[name]) { - result = lookup[name].dependencies; - } - return result || []; - }; - var requireLangPack = function (name, languages) { - if (AddOnManager.languageLoad !== false) { - waitFor(name, function () { - var language = I18n.getCode(); - var wrappedLanguages = ',' + (languages || '') + ','; - if (!language || languages && wrappedLanguages.indexOf(',' + language + ',') === -1) { - return; - } - ScriptLoader.ScriptLoader.add(urls[name] + '/langs/' + language + '.js'); - }, 'loaded'); - } - }; - var add = function (id, addOn, dependencies) { - var addOnConstructor = addOn; - items.push(addOnConstructor); - lookup[id] = { - instance: addOnConstructor, - dependencies: dependencies - }; - runListeners(id, 'added'); - return addOnConstructor; - }; - var remove = function (name) { - delete urls[name]; - delete lookup[name]; - }; - var createUrl = function (baseUrl, dep) { - if (typeof dep === 'object') { - return dep; - } - return typeof baseUrl === 'string' ? { - prefix: '', - resource: dep, - suffix: '' - } : { - prefix: baseUrl.prefix, - resource: dep, - suffix: baseUrl.suffix - }; - }; - var addComponents = function (pluginName, scripts) { - var pluginUrl = _this.urls[pluginName]; - each(scripts, function (script) { - ScriptLoader.ScriptLoader.add(pluginUrl + '/' + script); - }); - }; - var loadDependencies = function (name, addOnUrl, success, scope) { - var deps = dependencies(name); - each(deps, function (dep) { - var newUrl = createUrl(addOnUrl, dep); - load(newUrl.resource, newUrl, undefined, undefined); - }); - if (success) { - if (scope) { - success.call(scope); - } else { - success.call(ScriptLoader); - } - } - }; - var load = function (name, addOnUrl, success, scope, failure) { - if (urls[name]) { - return; - } - var urlString = typeof addOnUrl === 'string' ? addOnUrl : addOnUrl.prefix + addOnUrl.resource + addOnUrl.suffix; - if (urlString.indexOf('/') !== 0 && urlString.indexOf('://') === -1) { - urlString = AddOnManager.baseURL + '/' + urlString; - } - urls[name] = urlString.substring(0, urlString.lastIndexOf('/')); - var done = function () { - runListeners(name, 'loaded'); - loadDependencies(name, addOnUrl, success, scope); - }; - if (lookup[name]) { - done(); - } else { - ScriptLoader.ScriptLoader.add(urlString, done, scope, failure); - } - }; - var waitFor = function (name, callback, state) { - if (state === void 0) { - state = 'added'; - } - if (has(lookup, name) && state === 'added') { - callback(); - } else if (has(urls, name) && state === 'loaded') { - callback(); - } else { - _listeners.push({ - name: name, - state: state, - callback: callback - }); - } - }; - return { - items: items, - urls: urls, - lookup: lookup, - _listeners: _listeners, - get: get, - dependencies: dependencies, - requireLangPack: requireLangPack, - add: add, - remove: remove, - createUrl: createUrl, - addComponents: addComponents, - load: load, - waitFor: waitFor - }; - } - (function (AddOnManager) { - AddOnManager.PluginManager = AddOnManager(); - AddOnManager.ThemeManager = AddOnManager(); - }(AddOnManager || (AddOnManager = {}))); - var AddOnManager$1 = AddOnManager; - - var first = 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) { - timer = setTimeout(function () { - fn.apply(null, args); - timer = null; - }, rate); - } - }; - return { - cancel: cancel, - throttle: throttle - }; - }; - var last$2 = 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 read = function (element, attr) { - var value = get$4(element, attr); - return value === undefined || value === '' ? [] : value.split(' '); - }; - var add$1 = function (element, attr, id) { - var old = read(element, attr); - var nu = old.concat([id]); - set(element, attr, nu.join(' ')); - return true; - }; - var remove$2 = function (element, attr, id) { - var nu = filter(read(element, attr), function (v) { - return v !== id; - }); - if (nu.length > 0) { - set(element, attr, nu.join(' ')); - } else { - remove$1(element, attr); - } - return false; - }; - - var supports = function (element) { - return element.dom.classList !== undefined; - }; - var get$6 = function (element) { - return read(element, 'class'); - }; - var add$2 = function (element, clazz) { - return add$1(element, 'class', clazz); - }; - var remove$3 = function (element, clazz) { - return remove$2(element, 'class', clazz); - }; - - var add$3 = function (element, clazz) { - if (supports(element)) { - element.dom.classList.add(clazz); - } else { - add$2(element, clazz); - } - }; - var cleanClass = function (element) { - var classList = supports(element) ? element.dom.classList : get$6(element); - if (classList.length === 0) { - remove$1(element, 'class'); - } - }; - var remove$4 = function (element, clazz) { - if (supports(element)) { - var classList = element.dom.classList; - classList.remove(clazz); - } else { - remove$3(element, clazz); - } - cleanClass(element); - }; - var has$2 = function (element, clazz) { - return supports(element) && element.dom.classList.contains(clazz); - }; - - var descendants = function (scope, predicate) { - var result = []; - each(children(scope), function (x) { - if (predicate(x)) { - result = result.concat([x]); - } - result = result.concat(descendants(x, predicate)); - }); - return result; - }; - - var descendants$1 = function (scope, selector) { - return all(selector, scope); - }; - - var annotation = constant('mce-annotation'); - var dataAnnotation = constant('data-mce-annotation'); - var dataAnnotationId = constant('data-mce-annotation-uid'); - - var identify = function (editor, annotationName) { - var rng = editor.selection.getRng(); - var start = SugarElement.fromDom(rng.startContainer); - var root = SugarElement.fromDom(editor.getBody()); - var selector = annotationName.fold(function () { - return '.' + annotation(); - }, function (an) { - return '[' + dataAnnotation() + '="' + an + '"]'; - }); - var newStart = child(start, rng.startOffset).getOr(start); - var closest = closest$1(newStart, selector, function (n) { - return eq$2(n, root); - }); - var getAttr = function (c, property) { - if (has$1(c, property)) { - return Optional.some(get$4(c, property)); - } else { - return Optional.none(); - } - }; - return closest.bind(function (c) { - return getAttr(c, '' + dataAnnotationId()).bind(function (uid) { - return getAttr(c, '' + dataAnnotation()).map(function (name) { - var elements = findMarkers(editor, uid); - return { - uid: uid, - name: name, - elements: elements - }; - }); - }); - }); - }; - var isAnnotation = function (elem) { - return isElement(elem) && has$2(elem, annotation()); - }; - var findMarkers = function (editor, uid) { - var body = SugarElement.fromDom(editor.getBody()); - return descendants$1(body, '[' + dataAnnotationId() + '="' + uid + '"]'); - }; - var findAll = function (editor, name) { - var body = SugarElement.fromDom(editor.getBody()); - var markers = descendants$1(body, '[' + dataAnnotation() + '="' + name + '"]'); - var directory = {}; - each(markers, function (m) { - var uid = get$4(m, dataAnnotationId()); - var nodesAlready = directory.hasOwnProperty(uid) ? directory[uid] : []; - directory[uid] = nodesAlready.concat([m]); - }); - return directory; - }; - - var setup = function (editor, _registry) { - var changeCallbacks = Cell({}); - var initData = function () { - return { - listeners: [], - previous: Cell(Optional.none()) - }; - }; - var withCallbacks = function (name, f) { - updateCallbacks(name, function (data) { - f(data); - return data; - }); - }; - var updateCallbacks = function (name, f) { - var callbackMap = changeCallbacks.get(); - var data = callbackMap.hasOwnProperty(name) ? callbackMap[name] : initData(); - var outputData = f(data); - callbackMap[name] = outputData; - changeCallbacks.set(callbackMap); - }; - var fireCallbacks = function (name, uid, elements) { - withCallbacks(name, function (data) { - each(data.listeners, function (f) { - return f(true, name, { - uid: uid, - nodes: map(elements, function (elem) { - return elem.dom; - }) - }); - }); - }); - }; - var fireNoAnnotation = function (name) { - withCallbacks(name, function (data) { - each(data.listeners, function (f) { - return f(false, name); - }); - }); - }; - var onNodeChange = last$2(function () { - var callbackMap = changeCallbacks.get(); - var annotations = sort$1(keys(callbackMap)); - each(annotations, function (name) { - updateCallbacks(name, function (data) { - var prev = data.previous.get(); - identify(editor, Optional.some(name)).fold(function () { - if (prev.isSome()) { - fireNoAnnotation(name); - data.previous.set(Optional.none()); - } - }, function (_a) { - var uid = _a.uid, name = _a.name, elements = _a.elements; - if (!prev.is(uid)) { - fireCallbacks(name, uid, elements); - data.previous.set(Optional.some(uid)); - } - }); - return { - previous: data.previous, - listeners: data.listeners - }; - }); - }); - }, 30); - editor.on('remove', function () { - onNodeChange.cancel(); - }); - editor.on('NodeChange', function () { - onNodeChange.throttle(); - }); - var addListener = function (name, f) { - updateCallbacks(name, function (data) { - return { - previous: data.previous, - listeners: data.listeners.concat([f]) - }; - }); - }; - return { addListener: addListener }; - }; - - var setup$1 = function (editor, registry) { - var identifyParserNode = function (span) { - return Optional.from(span.attr(dataAnnotation())).bind(registry.lookup); - }; - editor.on('init', function () { - editor.serializer.addNodeFilter('span', function (spans) { - each(spans, function (span) { - identifyParserNode(span).each(function (settings) { - if (settings.persistent === false) { - span.unwrap(); - } - }); - }); - }); - }); - }; - - var create$2 = function () { - var annotations = {}; - var register = function (name, settings) { - annotations[name] = { - name: name, - settings: settings - }; - }; - var lookup = function (name) { - return annotations.hasOwnProperty(name) ? Optional.from(annotations[name]).map(function (a) { - return a.settings; - }) : Optional.none(); - }; - return { - register: register, - lookup: lookup - }; - }; - - var unique = 0; - var generate$1 = function (prefix) { - var date = new Date(); - var time = date.getTime(); - var random = Math.floor(Math.random() * 1000000000); - unique++; - return prefix + '_' + random + unique + String(time); - }; - - var add$4 = function (element, classes) { - each(classes, function (x) { - add$3(element, x); - }); - }; - - var fromHtml$1 = function (html, scope) { - var doc = scope || document; - var div = doc.createElement('div'); - div.innerHTML = html; - return children(SugarElement.fromDom(div)); - }; - - var get$7 = function (element) { - return element.dom.innerHTML; - }; - var set$1 = function (element, content) { - var owner$1 = owner(element); - var docDom = owner$1.dom; - var fragment = SugarElement.fromDom(docDom.createDocumentFragment()); - var contentElements = fromHtml$1(content, docDom); - append$1(fragment, contentElements); - empty(element); - append(element, fragment); - }; - - var clone$1 = function (original, isDeep) { - return SugarElement.fromDom(original.dom.cloneNode(isDeep)); - }; - var shallow = function (original) { - return clone$1(original, false); - }; - var deep = function (original) { - return clone$1(original, true); - }; - - var TextWalker = function (startNode, rootNode, isBoundary) { - if (isBoundary === void 0) { - isBoundary = never; - } - var walker = new DomTreeWalker(startNode, rootNode); - var walk = function (direction) { - var next; - do { - next = walker[direction](); - } while (next && !isText$1(next) && !isBoundary(next)); - return Optional.from(next).filter(isText$1); - }; - return { - current: function () { - return Optional.from(walker.current()).filter(isText$1); - }, - next: function () { - return walk('next'); - }, - prev: function () { - return walk('prev'); - }, - prev2: function () { - return walk('prev2'); - } - }; - }; - - var TextSeeker = function (dom, isBoundary) { - var isBlockBoundary = isBoundary ? isBoundary : function (node) { - return dom.isBlock(node) || isBr(node) || isContentEditableFalse(node); - }; - var walk = function (node, offset, walker, process) { - if (isText$1(node)) { - var newOffset = process(node, offset, node.data); - if (newOffset !== -1) { - return Optional.some({ - container: node, - offset: newOffset - }); - } - } - return walker().bind(function (next) { - return walk(next.container, next.offset, walker, process); - }); - }; - var backwards = function (node, offset, process, root) { - var walker = TextWalker(node, root, isBlockBoundary); - return walk(node, offset, function () { - return walker.prev().map(function (prev) { - return { - container: prev, - offset: prev.length - }; - }); - }, process).getOrNull(); - }; - var forwards = function (node, offset, process, root) { - var walker = TextWalker(node, root, isBlockBoundary); - return walk(node, offset, function () { - return walker.next().map(function (next) { - return { - container: next, - offset: 0 - }; - }); - }, process).getOrNull(); - }; - return { - backwards: backwards, - forwards: forwards - }; - }; - - 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 lift2 = function (oa, ob, f) { - return oa.isSome() && ob.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie())) : Optional.none(); - }; - var lift3 = function (oa, ob, oc, f) { - return oa.isSome() && ob.isSome() && oc.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie(), oc.getOrDie())) : Optional.none(); - }; - var someIf = function (b, a) { - return b ? Optional.some(a) : Optional.none(); - }; - - var round = Math.round; - var clone$2 = function (rect) { - if (!rect) { - return { - left: 0, - top: 0, - bottom: 0, - right: 0, - width: 0, - height: 0 - }; - } - return { - left: round(rect.left), - top: round(rect.top), - bottom: round(rect.bottom), - right: round(rect.right), - width: round(rect.width), - height: round(rect.height) - }; - }; - var collapse = function (rect, toStart) { - rect = clone$2(rect); - if (toStart) { - rect.right = rect.left; - } else { - rect.left = rect.left + rect.width; - rect.right = rect.left; - } - rect.width = 0; - return rect; - }; - var isEqual = function (rect1, rect2) { - return rect1.left === rect2.left && rect1.top === rect2.top && rect1.bottom === rect2.bottom && rect1.right === rect2.right; - }; - var isValidOverflow = function (overflowY, rect1, rect2) { - return overflowY >= 0 && overflowY <= Math.min(rect1.height, rect2.height) / 2; - }; - var isAbove = function (rect1, rect2) { - var halfHeight = Math.min(rect2.height / 2, rect1.height / 2); - if (rect1.bottom - halfHeight < rect2.top) { - return true; - } - if (rect1.top > rect2.bottom) { - return false; - } - return isValidOverflow(rect2.top - rect1.bottom, rect1, rect2); - }; - var isBelow = function (rect1, rect2) { - if (rect1.top > rect2.bottom) { - return true; - } - if (rect1.bottom < rect2.top) { - return false; - } - return isValidOverflow(rect2.bottom - rect1.top, rect1, rect2); - }; - var containsXY = function (rect, clientX, clientY) { - return clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom; - }; - - var getSelectedNode = function (range) { - var startContainer = range.startContainer, startOffset = range.startOffset; - if (startContainer.hasChildNodes() && range.endOffset === startOffset + 1) { - return startContainer.childNodes[startOffset]; - } - return null; - }; - var getNode = function (container, offset) { - if (container.nodeType === 1 && container.hasChildNodes()) { - if (offset >= container.childNodes.length) { - offset = container.childNodes.length - 1; - } - container = container.childNodes[offset]; - } - return container; - }; - - var extendingChars = new RegExp('[\u0300-\u036f\u0483-\u0487\u0488-\u0489\u0591-\u05bd\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u0610-\u061a' + '\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0' + '\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e3-\u0902\u093a\u093c' + '\u0941-\u0948\u094d\u0951-\u0957\u0962-\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2-\u09e3' + '\u0a01-\u0a02\u0a3c\u0a41-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a51\u0a70-\u0a71\u0a75\u0a81-\u0a82\u0abc' + '\u0ac1-\u0ac5\u0ac7-\u0ac8\u0acd\u0ae2-\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57' + '\u0b62-\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c00\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56' + '\u0c62-\u0c63\u0c81\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc-\u0ccd\u0cd5-\u0cd6\u0ce2-\u0ce3\u0d01\u0d3e\u0d41-\u0d44' + '\u0d4d\u0d57\u0d62-\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9' + '\u0ebb-\u0ebc\u0ec8-\u0ecd\u0f18-\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86-\u0f87\u0f8d-\u0f97' + '\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039-\u103a\u103d-\u103e\u1058-\u1059\u105e-\u1060\u1071-\u1074' + '\u1082\u1085-\u1086\u108d\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17b4-\u17b5' + '\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193b\u1a17-\u1a18' + '\u1a1b\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1ab0-\u1abd\u1ABE\u1b00-\u1b03\u1b34' + '\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80-\u1b81\u1ba2-\u1ba5\u1ba8-\u1ba9\u1bab-\u1bad\u1be6\u1be8-\u1be9' + '\u1bed\u1bef-\u1bf1\u1c2c-\u1c33\u1c36-\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1cf4\u1cf8-\u1cf9' + '\u1dc0-\u1df5\u1dfc-\u1dff\u200c-\u200d\u20d0-\u20dc\u20DD-\u20E0\u20e1\u20E2-\u20E4\u20e5-\u20f0\u2cef-\u2cf1' + '\u2d7f\u2de0-\u2dff\u302a-\u302d\u302e-\u302f\u3099-\u309a\ua66f\uA670-\uA672\ua674-\ua67d\ua69e-\ua69f\ua6f0-\ua6f1' + '\ua802\ua806\ua80b\ua825-\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc' + '\ua9e5\uaa29-\uaa2e\uaa31-\uaa32\uaa35-\uaa36\uaa43\uaa4c\uaa7c\uaab0\uaab2-\uaab4\uaab7-\uaab8\uaabe-\uaabf\uaac1' + '\uaaec-\uaaed\uaaf6\uabe5\uabe8\uabed\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\uff9e-\uff9f]'); - var isExtendingChar = function (ch) { - return typeof ch === 'string' && ch.charCodeAt(0) >= 768 && extendingChars.test(ch); - }; - - var or = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return function (x) { - for (var i = 0; i < args.length; i++) { - if (args[i](x)) { - return true; - } - } - return false; - }; - }; - var and = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return function (x) { - for (var i = 0; i < args.length; i++) { - if (!args[i](x)) { - return false; - } - } - return true; - }; - }; - - var isElement$3 = isElement$1; - var isCaretCandidate$1 = isCaretCandidate; - var isBlock$1 = matchStyleValues('display', 'block table'); - var isFloated = matchStyleValues('float', 'left right'); - var isValidElementCaretCandidate = and(isElement$3, isCaretCandidate$1, not(isFloated)); - var isNotPre = not(matchStyleValues('white-space', 'pre pre-line pre-wrap')); - var isText$4 = isText$1; - var isBr$3 = isBr; - var nodeIndex = DOMUtils$1.nodeIndex; - var resolveIndex = getNode; - var createRange = function (doc) { - return 'createRange' in doc ? doc.createRange() : DOMUtils$1.DOM.createRng(); - }; - var isWhiteSpace = function (chr) { - return chr && /[\r\n\t ]/.test(chr); - }; - var isRange = function (rng) { - return !!rng.setStart && !!rng.setEnd; - }; - var isHiddenWhiteSpaceRange = function (range) { - var container = range.startContainer; - var offset = range.startOffset; - var text; - if (isWhiteSpace(range.toString()) && isNotPre(container.parentNode) && isText$1(container)) { - text = container.data; - if (isWhiteSpace(text[offset - 1]) || isWhiteSpace(text[offset + 1])) { - return true; - } - } - return false; - }; - var getBrClientRect = function (brNode) { - var doc = brNode.ownerDocument; - var rng = createRange(doc); - var nbsp$1 = doc.createTextNode(nbsp); - var parentNode = brNode.parentNode; - parentNode.insertBefore(nbsp$1, brNode); - rng.setStart(nbsp$1, 0); - rng.setEnd(nbsp$1, 1); - var clientRect = clone$2(rng.getBoundingClientRect()); - parentNode.removeChild(nbsp$1); - return clientRect; - }; - var getBoundingClientRectWebKitText = function (rng) { - var sc = rng.startContainer; - var ec = rng.endContainer; - var so = rng.startOffset; - var eo = rng.endOffset; - if (sc === ec && isText$1(ec) && so === 0 && eo === 1) { - var newRng = rng.cloneRange(); - newRng.setEndAfter(ec); - return getBoundingClientRect(newRng); - } else { - return null; - } - }; - var isZeroRect = function (r) { - return r.left === 0 && r.right === 0 && r.top === 0 && r.bottom === 0; - }; - var getBoundingClientRect = function (item) { - var clientRect; - var clientRects = item.getClientRects(); - if (clientRects.length > 0) { - clientRect = clone$2(clientRects[0]); - } else { - clientRect = clone$2(item.getBoundingClientRect()); - } - if (!isRange(item) && isBr$3(item) && isZeroRect(clientRect)) { - return getBrClientRect(item); - } - if (isZeroRect(clientRect) && isRange(item)) { - return getBoundingClientRectWebKitText(item); - } - return clientRect; - }; - var collapseAndInflateWidth = function (clientRect, toStart) { - var newClientRect = collapse(clientRect, toStart); - newClientRect.width = 1; - newClientRect.right = newClientRect.left + 1; - return newClientRect; - }; - var getCaretPositionClientRects = function (caretPosition) { - var clientRects = []; - var beforeNode, node; - var addUniqueAndValidRect = function (clientRect) { - if (clientRect.height === 0) { - return; - } - if (clientRects.length > 0) { - if (isEqual(clientRect, clientRects[clientRects.length - 1])) { - return; - } - } - clientRects.push(clientRect); - }; - var addCharacterOffset = function (container, offset) { - var range = createRange(container.ownerDocument); - if (offset < container.data.length) { - if (isExtendingChar(container.data[offset])) { - return clientRects; - } - if (isExtendingChar(container.data[offset - 1])) { - range.setStart(container, offset); - range.setEnd(container, offset + 1); - if (!isHiddenWhiteSpaceRange(range)) { - addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(range), false)); - return clientRects; - } - } - } - if (offset > 0) { - range.setStart(container, offset - 1); - range.setEnd(container, offset); - if (!isHiddenWhiteSpaceRange(range)) { - addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(range), false)); - } - } - if (offset < container.data.length) { - range.setStart(container, offset); - range.setEnd(container, offset + 1); - if (!isHiddenWhiteSpaceRange(range)) { - addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(range), true)); - } - } - }; - if (isText$4(caretPosition.container())) { - addCharacterOffset(caretPosition.container(), caretPosition.offset()); - return clientRects; - } - if (isElement$3(caretPosition.container())) { - if (caretPosition.isAtEnd()) { - node = resolveIndex(caretPosition.container(), caretPosition.offset()); - if (isText$4(node)) { - addCharacterOffset(node, node.data.length); - } - if (isValidElementCaretCandidate(node) && !isBr$3(node)) { - addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(node), false)); - } - } else { - node = resolveIndex(caretPosition.container(), caretPosition.offset()); - if (isText$4(node)) { - addCharacterOffset(node, 0); - } - if (isValidElementCaretCandidate(node) && caretPosition.isAtEnd()) { - addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(node), false)); - return clientRects; - } - beforeNode = resolveIndex(caretPosition.container(), caretPosition.offset() - 1); - if (isValidElementCaretCandidate(beforeNode) && !isBr$3(beforeNode)) { - if (isBlock$1(beforeNode) || isBlock$1(node) || !isValidElementCaretCandidate(node)) { - addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(beforeNode), false)); - } - } - if (isValidElementCaretCandidate(node)) { - addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(node), true)); - } - } - } - return clientRects; - }; - function CaretPosition(container, offset, clientRects) { - var isAtStart = function () { - if (isText$4(container)) { - return offset === 0; - } - return offset === 0; - }; - var isAtEnd = function () { - if (isText$4(container)) { - return offset >= container.data.length; - } - return offset >= container.childNodes.length; - }; - var toRange = function () { - var range = createRange(container.ownerDocument); - range.setStart(container, offset); - range.setEnd(container, offset); - return range; - }; - var getClientRects = function () { - if (!clientRects) { - clientRects = getCaretPositionClientRects(CaretPosition(container, offset)); - } - return clientRects; - }; - var isVisible = function () { - return getClientRects().length > 0; - }; - var isEqual = function (caretPosition) { - return caretPosition && container === caretPosition.container() && offset === caretPosition.offset(); - }; - var getNode = function (before) { - return resolveIndex(container, before ? offset - 1 : offset); - }; - return { - container: constant(container), - offset: constant(offset), - toRange: toRange, - getClientRects: getClientRects, - isVisible: isVisible, - isAtStart: isAtStart, - isAtEnd: isAtEnd, - isEqual: isEqual, - getNode: getNode - }; - } - (function (CaretPosition) { - CaretPosition.fromRangeStart = function (range) { - return CaretPosition(range.startContainer, range.startOffset); - }; - CaretPosition.fromRangeEnd = function (range) { - return CaretPosition(range.endContainer, range.endOffset); - }; - CaretPosition.after = function (node) { - return CaretPosition(node.parentNode, nodeIndex(node) + 1); - }; - CaretPosition.before = function (node) { - return CaretPosition(node.parentNode, nodeIndex(node)); - }; - CaretPosition.isAbove = function (pos1, pos2) { - return lift2(head(pos2.getClientRects()), last(pos1.getClientRects()), isAbove).getOr(false); - }; - CaretPosition.isBelow = function (pos1, pos2) { - return lift2(last(pos2.getClientRects()), head(pos1.getClientRects()), isBelow).getOr(false); - }; - CaretPosition.isAtStart = function (pos) { - return pos ? pos.isAtStart() : false; - }; - CaretPosition.isAtEnd = function (pos) { - return pos ? pos.isAtEnd() : false; - }; - CaretPosition.isTextPosition = function (pos) { - return pos ? isText$1(pos.container()) : false; - }; - CaretPosition.isElementPosition = function (pos) { - return CaretPosition.isTextPosition(pos) === false; - }; - }(CaretPosition || (CaretPosition = {}))); - var CaretPosition$1 = CaretPosition; - - var trimEmptyTextNode = function (dom, node) { - if (isText$1(node) && node.data.length === 0) { - dom.remove(node); - } - }; - var insertNode = function (dom, rng, node) { - rng.insertNode(node); - trimEmptyTextNode(dom, node.previousSibling); - trimEmptyTextNode(dom, node.nextSibling); - }; - var insertFragment = function (dom, rng, frag) { - var firstChild = Optional.from(frag.firstChild); - var lastChild = Optional.from(frag.lastChild); - rng.insertNode(frag); - firstChild.each(function (child) { - return trimEmptyTextNode(dom, child.previousSibling); - }); - lastChild.each(function (child) { - return trimEmptyTextNode(dom, child.nextSibling); - }); - }; - var rangeInsertNode = function (dom, rng, node) { - if (isDocumentFragment$1(node)) { - insertFragment(dom, rng, node); - } else { - insertNode(dom, rng, node); - } - }; - - var isText$5 = isText$1; - var isBogus$2 = isBogus; - var nodeIndex$1 = DOMUtils$1.nodeIndex; - var normalizedParent = function (node) { - var parentNode = node.parentNode; - if (isBogus$2(parentNode)) { - return normalizedParent(parentNode); - } - return parentNode; - }; - var getChildNodes = function (node) { - if (!node) { - return []; - } - return reduce(node.childNodes, function (result, node) { - if (isBogus$2(node) && node.nodeName !== 'BR') { - result = result.concat(getChildNodes(node)); - } else { - result.push(node); - } - return result; - }, []); - }; - var normalizedTextOffset = function (node, offset) { - while (node = node.previousSibling) { - if (!isText$5(node)) { - break; - } - offset += node.data.length; - } - return offset; - }; - var equal$1 = function (a) { - return function (b) { - return a === b; - }; - }; - var normalizedNodeIndex = function (node) { - var nodes, index; - nodes = getChildNodes(normalizedParent(node)); - index = findIndex$1(nodes, equal$1(node), node); - nodes = nodes.slice(0, index + 1); - var numTextFragments = reduce(nodes, function (result, node, i) { - if (isText$5(node) && isText$5(nodes[i - 1])) { - result++; - } - return result; - }, 0); - nodes = filter$2(nodes, matchNodeNames([node.nodeName])); - index = findIndex$1(nodes, equal$1(node), node); - return index - numTextFragments; - }; - var createPathItem = function (node) { - var name; - if (isText$5(node)) { - name = 'text()'; - } else { - name = node.nodeName.toLowerCase(); - } - return name + '[' + normalizedNodeIndex(node) + ']'; - }; - var parentsUntil = function (root, node, predicate) { - var parents = []; - for (node = node.parentNode; node !== root; node = node.parentNode) { - if (predicate && predicate(node)) { - break; - } - parents.push(node); - } - return parents; - }; - var create$3 = function (root, caretPosition) { - var container, offset, path = [], outputOffset, childNodes, parents; - container = caretPosition.container(); - offset = caretPosition.offset(); - if (isText$5(container)) { - outputOffset = normalizedTextOffset(container, offset); - } else { - childNodes = container.childNodes; - if (offset >= childNodes.length) { - outputOffset = 'after'; - offset = childNodes.length - 1; - } else { - outputOffset = 'before'; - } - container = childNodes[offset]; - } - path.push(createPathItem(container)); - parents = parentsUntil(root, container); - parents = filter$2(parents, not(isBogus)); - path = path.concat(map$2(parents, function (node) { - return createPathItem(node); - })); - return path.reverse().join('/') + ',' + outputOffset; - }; - var resolvePathItem = function (node, name, index) { - var nodes = getChildNodes(node); - nodes = filter$2(nodes, function (node, index) { - return !isText$5(node) || !isText$5(nodes[index - 1]); - }); - nodes = filter$2(nodes, matchNodeNames([name])); - return nodes[index]; - }; - var findTextPosition = function (container, offset) { - var node = container, targetOffset = 0, dataLen; - while (isText$5(node)) { - dataLen = node.data.length; - if (offset >= targetOffset && offset <= targetOffset + dataLen) { - container = node; - offset = offset - targetOffset; - break; - } - if (!isText$5(node.nextSibling)) { - container = node; - offset = dataLen; - break; - } - targetOffset += dataLen; - node = node.nextSibling; - } - if (isText$5(container) && offset > container.data.length) { - offset = container.data.length; - } - return CaretPosition$1(container, offset); - }; - var resolve$1 = function (root, path) { - var offset; - if (!path) { - return null; - } - var parts = path.split(','); - var paths = parts[0].split('/'); - offset = parts.length > 1 ? parts[1] : 'before'; - var container = reduce(paths, function (result, value) { - var match = /([\w\-\(\)]+)\[([0-9]+)\]/.exec(value); - if (!match) { - return null; - } - if (match[1] === 'text()') { - match[1] = '#text'; - } - return resolvePathItem(result, match[1], parseInt(match[2], 10)); - }, root); - if (!container) { - return null; - } - if (!isText$5(container)) { - if (offset === 'after') { - offset = nodeIndex$1(container) + 1; - } else { - offset = nodeIndex$1(container); - } - return CaretPosition$1(container.parentNode, offset); - } - return findTextPosition(container, parseInt(offset, 10)); - }; - - var isContentEditableFalse$2 = isContentEditableFalse; - var getNormalizedTextOffset = function (trim, container, offset) { - var node, trimmedOffset; - trimmedOffset = trim(container.data.slice(0, offset)).length; - for (node = container.previousSibling; node && isText$1(node); node = node.previousSibling) { - trimmedOffset += trim(node.data).length; - } - return trimmedOffset; - }; - var getPoint = function (dom, trim, normalized, rng, start) { - var container = rng[start ? 'startContainer' : 'endContainer']; - var offset = rng[start ? 'startOffset' : 'endOffset']; - var point = []; - var childNodes, after = 0; - var root = dom.getRoot(); - if (isText$1(container)) { - point.push(normalized ? getNormalizedTextOffset(trim, container, offset) : offset); - } else { - childNodes = container.childNodes; - if (offset >= childNodes.length && childNodes.length) { - after = 1; - offset = Math.max(0, childNodes.length - 1); - } - point.push(dom.nodeIndex(childNodes[offset], normalized) + after); - } - for (; container && container !== root; container = container.parentNode) { - point.push(dom.nodeIndex(container, normalized)); - } - return point; - }; - var getLocation = function (trim, selection, normalized, rng) { - var dom = selection.dom, bookmark = {}; - bookmark.start = getPoint(dom, trim, normalized, rng, true); - if (!selection.isCollapsed()) { - bookmark.end = getPoint(dom, trim, normalized, rng, false); - } - return bookmark; - }; - var findIndex$2 = function (dom, name, element) { - var count = 0; - Tools.each(dom.select(name), function (node) { - if (node.getAttribute('data-mce-bogus') === 'all') { - return; - } - if (node === element) { - return false; - } - count++; - }); - return count; - }; - var moveEndPoint = function (rng, start) { - var container, offset, childNodes; - var prefix = start ? 'start' : 'end'; - container = rng[prefix + 'Container']; - offset = rng[prefix + 'Offset']; - if (isElement$1(container) && container.nodeName === 'TR') { - childNodes = container.childNodes; - container = childNodes[Math.min(start ? offset : offset - 1, childNodes.length - 1)]; - if (container) { - offset = start ? 0 : container.childNodes.length; - rng['set' + (start ? 'Start' : 'End')](container, offset); - } - } - }; - var normalizeTableCellSelection = function (rng) { - moveEndPoint(rng, true); - moveEndPoint(rng, false); - return rng; - }; - var findSibling = function (node, offset) { - var sibling; - if (isElement$1(node)) { - node = getNode(node, offset); - if (isContentEditableFalse$2(node)) { - return node; - } - } - if (isCaretContainer(node)) { - if (isText$1(node) && isCaretContainerBlock(node)) { - node = node.parentNode; - } - sibling = node.previousSibling; - if (isContentEditableFalse$2(sibling)) { - return sibling; - } - sibling = node.nextSibling; - if (isContentEditableFalse$2(sibling)) { - return sibling; - } - } - }; - var findAdjacentContentEditableFalseElm = function (rng) { - return findSibling(rng.startContainer, rng.startOffset) || findSibling(rng.endContainer, rng.endOffset); - }; - var getOffsetBookmark = function (trim, normalized, selection) { - var element = selection.getNode(); - var name = element ? element.nodeName : null; - var rng = selection.getRng(); - if (isContentEditableFalse$2(element) || name === 'IMG') { - return { - name: name, - index: findIndex$2(selection.dom, name, element) - }; - } - var sibling = findAdjacentContentEditableFalseElm(rng); - if (sibling) { - name = sibling.tagName; - return { - name: name, - index: findIndex$2(selection.dom, name, sibling) - }; - } - return getLocation(trim, selection, normalized, rng); - }; - var getCaretBookmark = function (selection) { - var rng = selection.getRng(); - return { - start: create$3(selection.dom.getRoot(), CaretPosition$1.fromRangeStart(rng)), - end: create$3(selection.dom.getRoot(), CaretPosition$1.fromRangeEnd(rng)) - }; - }; - var getRangeBookmark = function (selection) { - return { rng: selection.getRng() }; - }; - var createBookmarkSpan = function (dom, id, filled) { - var args = { - 'data-mce-type': 'bookmark', - id: id, - 'style': 'overflow:hidden;line-height:0px' - }; - return filled ? dom.create('span', args, '') : dom.create('span', args); - }; - var getPersistentBookmark = function (selection, filled) { - var dom = selection.dom; - var rng = selection.getRng(); - var id = dom.uniqueId(); - var collapsed = selection.isCollapsed(); - var element = selection.getNode(); - var name = element.nodeName; - if (name === 'IMG') { - return { - name: name, - index: findIndex$2(dom, name, element) - }; - } - var rng2 = normalizeTableCellSelection(rng.cloneRange()); - if (!collapsed) { - rng2.collapse(false); - var endBookmarkNode = createBookmarkSpan(dom, id + '_end', filled); - rangeInsertNode(dom, rng2, endBookmarkNode); - } - rng = normalizeTableCellSelection(rng); - rng.collapse(true); - var startBookmarkNode = createBookmarkSpan(dom, id + '_start', filled); - rangeInsertNode(dom, rng, startBookmarkNode); - selection.moveToBookmark({ - id: id, - keep: true - }); - return { id: id }; - }; - var getBookmark = function (selection, type, normalized) { - if (type === 2) { - return getOffsetBookmark(trim$2, normalized, selection); - } else if (type === 3) { - return getCaretBookmark(selection); - } else if (type) { - return getRangeBookmark(selection); - } else { - return getPersistentBookmark(selection, false); - } - }; - var getUndoBookmark = curry(getOffsetBookmark, identity, true); - - var DOM$1 = DOMUtils$1.DOM; - var defaultPreviewStyles = 'font-family font-size font-weight font-style text-decoration text-transform color background-color border border-radius outline text-shadow'; - var getBodySetting = function (editor, name, defaultValue) { - var value = editor.getParam(name, defaultValue); - if (value.indexOf('=') !== -1) { - var bodyObj = editor.getParam(name, '', 'hash'); - return bodyObj.hasOwnProperty(editor.id) ? bodyObj[editor.id] : defaultValue; - } else { - return value; - } - }; - var getIframeAttrs = function (editor) { - return editor.getParam('iframe_attrs', {}); - }; - var getDocType = function (editor) { - return editor.getParam('doctype', ''); - }; - var getDocumentBaseUrl = function (editor) { - return editor.getParam('document_base_url', ''); - }; - var getBodyId = function (editor) { - return getBodySetting(editor, 'body_id', 'tinymce'); - }; - var getBodyClass = function (editor) { - return getBodySetting(editor, 'body_class', ''); - }; - var getContentSecurityPolicy = function (editor) { - return editor.getParam('content_security_policy', ''); - }; - var shouldPutBrInPre = function (editor) { - return editor.getParam('br_in_pre', true); - }; - var getForcedRootBlock = function (editor) { - if (editor.getParam('force_p_newlines', false)) { - return 'p'; - } - var block = editor.getParam('forced_root_block', 'p'); - if (block === false) { - return ''; - } else if (block === true) { - return 'p'; - } else { - return block; - } - }; - var getForcedRootBlockAttrs = function (editor) { - return editor.getParam('forced_root_block_attrs', {}); - }; - var getBrNewLineSelector = function (editor) { - return editor.getParam('br_newline_selector', '.mce-toc h2,figcaption,caption'); - }; - var getNoNewLineSelector = function (editor) { - return editor.getParam('no_newline_selector', ''); - }; - var shouldKeepStyles = function (editor) { - return editor.getParam('keep_styles', true); - }; - var shouldEndContainerOnEmptyBlock = function (editor) { - return editor.getParam('end_container_on_empty_block', false); - }; - var getFontStyleValues = function (editor) { - return Tools.explode(editor.getParam('font_size_style_values', 'xx-small,x-small,small,medium,large,x-large,xx-large')); - }; - var getFontSizeClasses = function (editor) { - return Tools.explode(editor.getParam('font_size_classes', '')); - }; - var getImagesDataImgFilter = function (editor) { - return editor.getParam('images_dataimg_filter', always, 'function'); - }; - var isAutomaticUploadsEnabled = function (editor) { - return editor.getParam('automatic_uploads', true, 'boolean'); - }; - var shouldReuseFileName = function (editor) { - return editor.getParam('images_reuse_filename', false, 'boolean'); - }; - var shouldReplaceBlobUris = function (editor) { - return editor.getParam('images_replace_blob_uris', true, 'boolean'); - }; - var getIconPackName = function (editor) { - return editor.getParam('icons', '', 'string'); - }; - var getIconsUrl = function (editor) { - return editor.getParam('icons_url', '', 'string'); - }; - var getImageUploadUrl = function (editor) { - return editor.getParam('images_upload_url', '', 'string'); - }; - var getImageUploadBasePath = function (editor) { - return editor.getParam('images_upload_base_path', '', 'string'); - }; - var getImagesUploadCredentials = function (editor) { - return editor.getParam('images_upload_credentials', false, 'boolean'); - }; - var getImagesUploadHandler = function (editor) { - return editor.getParam('images_upload_handler', null, 'function'); - }; - var shouldUseContentCssCors = function (editor) { - return editor.getParam('content_css_cors', false, 'boolean'); - }; - var getReferrerPolicy = function (editor) { - return editor.getParam('referrer_policy', '', 'string'); - }; - var getLanguageCode = function (editor) { - return editor.getParam('language', 'en', 'string'); - }; - var getLanguageUrl = function (editor) { - return editor.getParam('language_url', '', 'string'); - }; - var shouldIndentUseMargin = function (editor) { - return editor.getParam('indent_use_margin', false); - }; - var getIndentation = function (editor) { - return editor.getParam('indentation', '40px', 'string'); - }; - var getContentCss = function (editor) { - var contentCss = editor.getParam('content_css'); - if (isString(contentCss)) { - return map(contentCss.split(','), trim); - } else if (isArray(contentCss)) { - return contentCss; - } else if (contentCss === false || editor.inline) { - return []; - } else { - return ['default']; - } - }; - var getDirectionality = function (editor) { - return editor.getParam('directionality', I18n.isRtl() ? 'rtl' : undefined); - }; - var getInlineBoundarySelector = function (editor) { - return editor.getParam('inline_boundaries_selector', 'a[href],code,.mce-annotation', 'string'); - }; - var getObjectResizing = function (editor) { - var selector = editor.getParam('object_resizing'); - if (selector === false || Env.iOS) { - return false; - } else { - return isString(selector) ? selector : 'table,img,figure.image,div'; - } - }; - var getResizeImgProportional = function (editor) { - return editor.getParam('resize_img_proportional', true, 'boolean'); - }; - var getPlaceholder = function (editor) { - return editor.getParam('placeholder', DOM$1.getAttrib(editor.getElement(), 'placeholder'), 'string'); - }; - var getEventRoot = function (editor) { - return editor.getParam('event_root'); - }; - var getServiceMessage = function (editor) { - return editor.getParam('service_message'); - }; - var getTheme = function (editor) { - return editor.getParam('theme'); - }; - var shouldValidate = function (editor) { - return editor.getParam('validate'); - }; - var isInlineBoundariesEnabled = function (editor) { - return editor.getParam('inline_boundaries') !== false; - }; - var getFormats = function (editor) { - return editor.getParam('formats'); - }; - var getPreviewStyles = function (editor) { - var style = editor.getParam('preview_styles', defaultPreviewStyles); - if (isString(style)) { - return style; - } else { - return ''; - } - }; - var canFormatEmptyLines = function (editor) { - return editor.getParam('format_empty_lines', false, 'boolean'); - }; - var getCustomUiSelector = function (editor) { - return editor.getParam('custom_ui_selector', '', 'string'); - }; - var getThemeUrl = function (editor) { - return editor.getParam('theme_url'); - }; - var isInline$1 = function (editor) { - return editor.getParam('inline'); - }; - var hasHiddenInput = function (editor) { - return editor.getParam('hidden_input'); - }; - var shouldPatchSubmit = function (editor) { - return editor.getParam('submit_patch'); - }; - var isEncodingXml = function (editor) { - return editor.getParam('encoding') === 'xml'; - }; - var shouldAddFormSubmitTrigger = function (editor) { - return editor.getParam('add_form_submit_trigger'); - }; - var shouldAddUnloadTrigger = function (editor) { - return editor.getParam('add_unload_trigger'); - }; - var hasForcedRootBlock = function (editor) { - return getForcedRootBlock(editor) !== ''; - }; - var getCustomUndoRedoLevels = function (editor) { - return editor.getParam('custom_undo_redo_levels', 0, 'number'); - }; - var shouldDisableNodeChange = function (editor) { - return editor.getParam('disable_nodechange'); - }; - var isReadOnly = function (editor) { - return editor.getParam('readonly'); - }; - var hasContentCssCors = function (editor) { - return editor.getParam('content_css_cors'); - }; - var getPlugins = function (editor) { - return editor.getParam('plugins', '', 'string'); - }; - var getExternalPlugins = function (editor) { - return editor.getParam('external_plugins'); - }; - var shouldBlockUnsupportedDrop = function (editor) { - return editor.getParam('block_unsupported_drop', true, 'boolean'); - }; - var isVisualAidsEnabled = function (editor) { - return editor.getParam('visual', true, 'boolean'); - }; - var getVisualAidsTableClass = function (editor) { - return editor.getParam('visual_table_class', 'mce-item-table', 'string'); - }; - var getVisualAidsAnchorClass = function (editor) { - return editor.getParam('visual_anchor_class', 'mce-item-anchor', 'string'); - }; - - var isElement$4 = isElement$1; - var isText$6 = isText$1; - var removeNode = function (node) { - var parentNode = node.parentNode; - if (parentNode) { - parentNode.removeChild(node); - } - }; - var trimCount = function (text) { - var trimmedText = trim$2(text); - return { - count: text.length - trimmedText.length, - text: trimmedText - }; - }; - var deleteZwspChars = function (caretContainer) { - var idx; - while ((idx = caretContainer.data.lastIndexOf(ZWSP)) !== -1) { - caretContainer.deleteData(idx, 1); - } - }; - var removeUnchanged = function (caretContainer, pos) { - remove$5(caretContainer); - return pos; - }; - var removeTextAndReposition = function (caretContainer, pos) { - var before = trimCount(caretContainer.data.substr(0, pos.offset())); - var after = trimCount(caretContainer.data.substr(pos.offset())); - var text = before.text + after.text; - if (text.length > 0) { - deleteZwspChars(caretContainer); - return CaretPosition$1(caretContainer, pos.offset() - before.count); - } else { - return pos; - } - }; - var removeElementAndReposition = function (caretContainer, pos) { - var parentNode = pos.container(); - var newPosition = indexOf(from$1(parentNode.childNodes), caretContainer).map(function (index) { - return index < pos.offset() ? CaretPosition$1(parentNode, pos.offset() - 1) : pos; - }).getOr(pos); - remove$5(caretContainer); - return newPosition; - }; - var removeTextCaretContainer = function (caretContainer, pos) { - return isText$6(caretContainer) && pos.container() === caretContainer ? removeTextAndReposition(caretContainer, pos) : removeUnchanged(caretContainer, pos); - }; - var removeElementCaretContainer = function (caretContainer, pos) { - return pos.container() === caretContainer.parentNode ? removeElementAndReposition(caretContainer, pos) : removeUnchanged(caretContainer, pos); - }; - var removeAndReposition = function (container, pos) { - return CaretPosition$1.isTextPosition(pos) ? removeTextCaretContainer(container, pos) : removeElementCaretContainer(container, pos); - }; - var remove$5 = function (caretContainerNode) { - if (isElement$4(caretContainerNode) && isCaretContainer(caretContainerNode)) { - if (hasContent(caretContainerNode)) { - caretContainerNode.removeAttribute('data-mce-caret'); - } else { - removeNode(caretContainerNode); - } - } - if (isText$6(caretContainerNode)) { - deleteZwspChars(caretContainerNode); - if (caretContainerNode.data.length === 0) { - removeNode(caretContainerNode); - } - } - }; - - var browser$2 = detect$3().browser; - var isContentEditableFalse$3 = isContentEditableFalse; - var isMedia$1 = isMedia; - var isTableCell$2 = isTableCell; - var inlineFakeCaretSelector = '*[contentEditable=false],video,audio,embed,object'; - var getAbsoluteClientRect = function (root, element, before) { - var clientRect = collapse(element.getBoundingClientRect(), before); - var docElm, scrollX, scrollY, margin, rootRect; - if (root.tagName === 'BODY') { - docElm = root.ownerDocument.documentElement; - scrollX = root.scrollLeft || docElm.scrollLeft; - scrollY = root.scrollTop || docElm.scrollTop; - } else { - rootRect = root.getBoundingClientRect(); - scrollX = root.scrollLeft - rootRect.left; - scrollY = root.scrollTop - rootRect.top; - } - clientRect.left += scrollX; - clientRect.right += scrollX; - clientRect.top += scrollY; - clientRect.bottom += scrollY; - clientRect.width = 1; - margin = element.offsetWidth - element.clientWidth; - if (margin > 0) { - if (before) { - margin *= -1; - } - clientRect.left += margin; - clientRect.right += margin; - } - return clientRect; - }; - var trimInlineCaretContainers = function (root) { - var fakeCaretTargetNodes = descendants$1(SugarElement.fromDom(root), inlineFakeCaretSelector); - for (var i = 0; i < fakeCaretTargetNodes.length; i++) { - var node = fakeCaretTargetNodes[i].dom; - var sibling = node.previousSibling; - if (endsWithCaretContainer(sibling)) { - var data = sibling.data; - if (data.length === 1) { - sibling.parentNode.removeChild(sibling); - } else { - sibling.deleteData(data.length - 1, 1); - } - } - sibling = node.nextSibling; - if (startsWithCaretContainer(sibling)) { - var data = sibling.data; - if (data.length === 1) { - sibling.parentNode.removeChild(sibling); - } else { - sibling.deleteData(0, 1); - } - } - } - }; - var FakeCaret = function (editor, root, isBlock, hasFocus) { - var lastVisualCaret = Cell(Optional.none()); - var cursorInterval, caretContainerNode; - var rootBlock = getForcedRootBlock(editor); - var caretBlock = rootBlock.length > 0 ? rootBlock : 'p'; - var show = function (before, element) { - var clientRect, rng; - hide(); - if (isTableCell$2(element)) { - return null; - } - if (isBlock(element)) { - caretContainerNode = insertBlock(caretBlock, element, before); - clientRect = getAbsoluteClientRect(root, element, before); - DomQuery(caretContainerNode).css('top', clientRect.top); - var caret = DomQuery('
                                      ').css(clientRect).appendTo(root)[0]; - lastVisualCaret.set(Optional.some({ - caret: caret, - element: element, - before: before - })); - lastVisualCaret.get().each(function (caretState) { - if (before) { - DomQuery(caretState.caret).addClass('mce-visual-caret-before'); - } - }); - startBlink(); - rng = element.ownerDocument.createRange(); - rng.setStart(caretContainerNode, 0); - rng.setEnd(caretContainerNode, 0); - } else { - caretContainerNode = insertInline(element, before); - rng = element.ownerDocument.createRange(); - if (isInlineFakeCaretTarget(caretContainerNode.nextSibling)) { - rng.setStart(caretContainerNode, 0); - rng.setEnd(caretContainerNode, 0); - } else { - rng.setStart(caretContainerNode, 1); - rng.setEnd(caretContainerNode, 1); - } - return rng; - } - return rng; - }; - var hide = function () { - trimInlineCaretContainers(root); - if (caretContainerNode) { - remove$5(caretContainerNode); - caretContainerNode = null; - } - lastVisualCaret.get().each(function (caretState) { - DomQuery(caretState.caret).remove(); - lastVisualCaret.set(Optional.none()); - }); - if (cursorInterval) { - Delay.clearInterval(cursorInterval); - cursorInterval = null; - } - }; - var startBlink = function () { - cursorInterval = Delay.setInterval(function () { - if (hasFocus()) { - DomQuery('div.mce-visual-caret', root).toggleClass('mce-visual-caret-hidden'); - } else { - DomQuery('div.mce-visual-caret', root).addClass('mce-visual-caret-hidden'); - } - }, 500); - }; - var reposition = function () { - lastVisualCaret.get().each(function (caretState) { - var clientRect = getAbsoluteClientRect(root, caretState.element, caretState.before); - DomQuery(caretState.caret).css(__assign({}, clientRect)); - }); - }; - var destroy = function () { - return Delay.clearInterval(cursorInterval); - }; - var getCss = function () { - return '.mce-visual-caret {' + 'position: absolute;' + 'background-color: black;' + 'background-color: currentcolor;' + '}' + '.mce-visual-caret-hidden {' + 'display: none;' + '}' + '*[data-mce-caret] {' + 'position: absolute;' + 'left: -1000px;' + 'right: auto;' + 'top: 0;' + 'margin: 0;' + 'padding: 0;' + '}'; - }; - return { - show: show, - hide: hide, - getCss: getCss, - reposition: reposition, - destroy: destroy - }; - }; - var isFakeCaretTableBrowser = function () { - return browser$2.isIE() || browser$2.isEdge() || browser$2.isFirefox(); - }; - var isInlineFakeCaretTarget = function (node) { - return isContentEditableFalse$3(node) || isMedia$1(node); - }; - var isFakeCaretTarget = function (node) { - return isInlineFakeCaretTarget(node) || isTable(node) && isFakeCaretTableBrowser(); - }; - - var isContentEditableFalse$4 = isContentEditableFalse; - var isMedia$2 = isMedia; - var isBlockLike = matchStyleValues('display', 'block table table-cell table-caption list-item'); - var isCaretContainer$2 = isCaretContainer; - var isCaretContainerBlock$1 = isCaretContainerBlock; - var isElement$5 = isElement$1; - var isCaretCandidate$2 = isCaretCandidate; - var isForwards = function (direction) { - return direction > 0; - }; - var isBackwards = function (direction) { - return direction < 0; - }; - var skipCaretContainers = function (walk, shallow) { - var node; - while (node = walk(shallow)) { - if (!isCaretContainerBlock$1(node)) { - return node; - } - } - return null; - }; - var findNode = function (node, direction, predicateFn, rootNode, shallow) { - var walker = new DomTreeWalker(node, rootNode); - var isCefOrCaretContainer = isContentEditableFalse$4(node) || isCaretContainerBlock$1(node); - if (isBackwards(direction)) { - if (isCefOrCaretContainer) { - node = skipCaretContainers(walker.prev, true); - if (predicateFn(node)) { - return node; - } - } - while (node = skipCaretContainers(walker.prev, shallow)) { - if (predicateFn(node)) { - return node; - } - } - } - if (isForwards(direction)) { - if (isCefOrCaretContainer) { - node = skipCaretContainers(walker.next, true); - if (predicateFn(node)) { - return node; - } - } - while (node = skipCaretContainers(walker.next, shallow)) { - if (predicateFn(node)) { - return node; - } - } - } - return null; - }; - var getParentBlock = function (node, rootNode) { - while (node && node !== rootNode) { - if (isBlockLike(node)) { - return node; - } - node = node.parentNode; - } - return null; - }; - var isInSameBlock = function (caretPosition1, caretPosition2, rootNode) { - return getParentBlock(caretPosition1.container(), rootNode) === getParentBlock(caretPosition2.container(), rootNode); - }; - var getChildNodeAtRelativeOffset = function (relativeOffset, caretPosition) { - if (!caretPosition) { - return null; - } - var container = caretPosition.container(); - var offset = caretPosition.offset(); - if (!isElement$5(container)) { - return null; - } - return container.childNodes[offset + relativeOffset]; - }; - var beforeAfter = function (before, node) { - var range = node.ownerDocument.createRange(); - if (before) { - range.setStartBefore(node); - range.setEndBefore(node); - } else { - range.setStartAfter(node); - range.setEndAfter(node); - } - return range; - }; - var isNodesInSameBlock = function (root, node1, node2) { - return getParentBlock(node1, root) === getParentBlock(node2, root); - }; - var lean = function (left, root, node) { - var sibling, siblingName; - if (left) { - siblingName = 'previousSibling'; - } else { - siblingName = 'nextSibling'; - } - while (node && node !== root) { - sibling = node[siblingName]; - if (isCaretContainer$2(sibling)) { - sibling = sibling[siblingName]; - } - if (isContentEditableFalse$4(sibling) || isMedia$2(sibling)) { - if (isNodesInSameBlock(root, sibling, node)) { - return sibling; - } - break; - } - if (isCaretCandidate$2(sibling)) { - break; - } - node = node.parentNode; - } - return null; - }; - var before$2 = curry(beforeAfter, true); - var after$1 = curry(beforeAfter, false); - var normalizeRange = function (direction, root, range) { - var node, container, location; - var leanLeft = curry(lean, true, root); - var leanRight = curry(lean, false, root); - container = range.startContainer; - var offset = range.startOffset; - if (isCaretContainerBlock(container)) { - if (!isElement$5(container)) { - container = container.parentNode; - } - location = container.getAttribute('data-mce-caret'); - if (location === 'before') { - node = container.nextSibling; - if (isFakeCaretTarget(node)) { - return before$2(node); - } - } - if (location === 'after') { - node = container.previousSibling; - if (isFakeCaretTarget(node)) { - return after$1(node); - } - } - } - if (!range.collapsed) { - return range; - } - if (isText$1(container)) { - if (isCaretContainer$2(container)) { - if (direction === 1) { - node = leanRight(container); - if (node) { - return before$2(node); - } - node = leanLeft(container); - if (node) { - return after$1(node); - } - } - if (direction === -1) { - node = leanLeft(container); - if (node) { - return after$1(node); - } - node = leanRight(container); - if (node) { - return before$2(node); - } - } - return range; - } - if (endsWithCaretContainer(container) && offset >= container.data.length - 1) { - if (direction === 1) { - node = leanRight(container); - if (node) { - return before$2(node); - } - } - return range; - } - if (startsWithCaretContainer(container) && offset <= 1) { - if (direction === -1) { - node = leanLeft(container); - if (node) { - return after$1(node); - } - } - return range; - } - if (offset === container.data.length) { - node = leanRight(container); - if (node) { - return before$2(node); - } - return range; - } - if (offset === 0) { - node = leanLeft(container); - if (node) { - return after$1(node); - } - return range; - } - } - return range; - }; - var getRelativeCefElm = function (forward, caretPosition) { - return Optional.from(getChildNodeAtRelativeOffset(forward ? 0 : -1, caretPosition)).filter(isContentEditableFalse$4); - }; - var getNormalizedRangeEndPoint = function (direction, root, range) { - var normalizedRange = normalizeRange(direction, root, range); - if (direction === -1) { - return CaretPosition.fromRangeStart(normalizedRange); - } - return CaretPosition.fromRangeEnd(normalizedRange); - }; - var getElementFromPosition = function (pos) { - return Optional.from(pos.getNode()).map(SugarElement.fromDom); - }; - var getElementFromPrevPosition = function (pos) { - return Optional.from(pos.getNode(true)).map(SugarElement.fromDom); - }; - var getVisualCaretPosition = function (walkFn, caretPosition) { - while (caretPosition = walkFn(caretPosition)) { - if (caretPosition.isVisible()) { - return caretPosition; - } - } - return caretPosition; - }; - var isMoveInsideSameBlock = function (from, to) { - var inSameBlock = isInSameBlock(from, to); - if (!inSameBlock && isBr(from.getNode())) { - return true; - } - return inSameBlock; - }; - - var HDirection; - (function (HDirection) { - HDirection[HDirection['Backwards'] = -1] = 'Backwards'; - HDirection[HDirection['Forwards'] = 1] = 'Forwards'; - }(HDirection || (HDirection = {}))); - var isContentEditableFalse$5 = isContentEditableFalse; - var isText$7 = isText$1; - var isElement$6 = isElement$1; - var isBr$4 = isBr; - var isCaretCandidate$3 = isCaretCandidate; - var isAtomic$1 = isAtomic; - var isEditableCaretCandidate$1 = isEditableCaretCandidate; - var getParents = function (node, root) { - var parents = []; - while (node && node !== root) { - parents.push(node); - node = node.parentNode; - } - return parents; - }; - var nodeAtIndex = function (container, offset) { - if (container.hasChildNodes() && offset < container.childNodes.length) { - return container.childNodes[offset]; - } - return null; - }; - var getCaretCandidatePosition = function (direction, node) { - if (isForwards(direction)) { - if (isCaretCandidate$3(node.previousSibling) && !isText$7(node.previousSibling)) { - return CaretPosition$1.before(node); - } - if (isText$7(node)) { - return CaretPosition$1(node, 0); - } - } - if (isBackwards(direction)) { - if (isCaretCandidate$3(node.nextSibling) && !isText$7(node.nextSibling)) { - return CaretPosition$1.after(node); - } - if (isText$7(node)) { - return CaretPosition$1(node, node.data.length); - } - } - if (isBackwards(direction)) { - if (isBr$4(node)) { - return CaretPosition$1.before(node); - } - return CaretPosition$1.after(node); - } - return CaretPosition$1.before(node); - }; - var moveForwardFromBr = function (root, nextNode) { - var nextSibling = nextNode.nextSibling; - if (nextSibling && isCaretCandidate$3(nextSibling)) { - if (isText$7(nextSibling)) { - return CaretPosition$1(nextSibling, 0); - } else { - return CaretPosition$1.before(nextSibling); - } - } else { - return findCaretPosition(HDirection.Forwards, CaretPosition$1.after(nextNode), root); - } - }; - var findCaretPosition = function (direction, startPos, root) { - var node, nextNode, innerNode; - var caretPosition; - if (!isElement$6(root) || !startPos) { - return null; - } - if (startPos.isEqual(CaretPosition$1.after(root)) && root.lastChild) { - caretPosition = CaretPosition$1.after(root.lastChild); - if (isBackwards(direction) && isCaretCandidate$3(root.lastChild) && isElement$6(root.lastChild)) { - return isBr$4(root.lastChild) ? CaretPosition$1.before(root.lastChild) : caretPosition; - } - } else { - caretPosition = startPos; - } - var container = caretPosition.container(); - var offset = caretPosition.offset(); - if (isText$7(container)) { - if (isBackwards(direction) && offset > 0) { - return CaretPosition$1(container, --offset); - } - if (isForwards(direction) && offset < container.length) { - return CaretPosition$1(container, ++offset); - } - node = container; - } else { - if (isBackwards(direction) && offset > 0) { - nextNode = nodeAtIndex(container, offset - 1); - if (isCaretCandidate$3(nextNode)) { - if (!isAtomic$1(nextNode)) { - innerNode = findNode(nextNode, direction, isEditableCaretCandidate$1, nextNode); - if (innerNode) { - if (isText$7(innerNode)) { - return CaretPosition$1(innerNode, innerNode.data.length); - } - return CaretPosition$1.after(innerNode); - } - } - if (isText$7(nextNode)) { - return CaretPosition$1(nextNode, nextNode.data.length); - } - return CaretPosition$1.before(nextNode); - } - } - if (isForwards(direction) && offset < container.childNodes.length) { - nextNode = nodeAtIndex(container, offset); - if (isCaretCandidate$3(nextNode)) { - if (isBr$4(nextNode)) { - return moveForwardFromBr(root, nextNode); - } - if (!isAtomic$1(nextNode)) { - innerNode = findNode(nextNode, direction, isEditableCaretCandidate$1, nextNode); - if (innerNode) { - if (isText$7(innerNode)) { - return CaretPosition$1(innerNode, 0); - } - return CaretPosition$1.before(innerNode); - } - } - if (isText$7(nextNode)) { - return CaretPosition$1(nextNode, 0); - } - return CaretPosition$1.after(nextNode); - } - } - node = nextNode ? nextNode : caretPosition.getNode(); - } - if (isForwards(direction) && caretPosition.isAtEnd() || isBackwards(direction) && caretPosition.isAtStart()) { - node = findNode(node, direction, always, root, true); - if (isEditableCaretCandidate$1(node, root)) { - return getCaretCandidatePosition(direction, node); - } - } - nextNode = findNode(node, direction, isEditableCaretCandidate$1, root); - var rootContentEditableFalseElm = last$1(filter(getParents(container, root), isContentEditableFalse$5)); - if (rootContentEditableFalseElm && (!nextNode || !rootContentEditableFalseElm.contains(nextNode))) { - if (isForwards(direction)) { - caretPosition = CaretPosition$1.after(rootContentEditableFalseElm); - } else { - caretPosition = CaretPosition$1.before(rootContentEditableFalseElm); - } - return caretPosition; - } - if (nextNode) { - return getCaretCandidatePosition(direction, nextNode); - } - return null; - }; - var CaretWalker = function (root) { - return { - next: function (caretPosition) { - return findCaretPosition(HDirection.Forwards, caretPosition, root); - }, - prev: function (caretPosition) { - return findCaretPosition(HDirection.Backwards, caretPosition, root); - } - }; - }; - - var walkToPositionIn = function (forward, root, start) { - var position = forward ? CaretPosition$1.before(start) : CaretPosition$1.after(start); - return fromPosition(forward, root, position); - }; - var afterElement = function (node) { - return isBr(node) ? CaretPosition$1.before(node) : CaretPosition$1.after(node); - }; - var isBeforeOrStart = function (position) { - if (CaretPosition$1.isTextPosition(position)) { - return position.offset() === 0; - } else { - return isCaretCandidate(position.getNode()); - } - }; - var isAfterOrEnd = function (position) { - if (CaretPosition$1.isTextPosition(position)) { - var container = position.container(); - return position.offset() === container.data.length; - } else { - return isCaretCandidate(position.getNode(true)); - } - }; - var isBeforeAfterSameElement = function (from, to) { - return !CaretPosition$1.isTextPosition(from) && !CaretPosition$1.isTextPosition(to) && from.getNode() === to.getNode(true); - }; - var isAtBr = function (position) { - return !CaretPosition$1.isTextPosition(position) && isBr(position.getNode()); - }; - var shouldSkipPosition = function (forward, from, to) { - if (forward) { - return !isBeforeAfterSameElement(from, to) && !isAtBr(from) && isAfterOrEnd(from) && isBeforeOrStart(to); - } else { - return !isBeforeAfterSameElement(to, from) && isBeforeOrStart(from) && isAfterOrEnd(to); - } - }; - var fromPosition = function (forward, root, pos) { - var walker = CaretWalker(root); - return Optional.from(forward ? walker.next(pos) : walker.prev(pos)); - }; - var navigate = function (forward, root, from) { - return fromPosition(forward, root, from).bind(function (to) { - if (isInSameBlock(from, to, root) && shouldSkipPosition(forward, from, to)) { - return fromPosition(forward, root, to); - } else { - return Optional.some(to); - } - }); - }; - var navigateIgnore = function (forward, root, from, ignoreFilter) { - return navigate(forward, root, from).bind(function (pos) { - return ignoreFilter(pos) ? navigateIgnore(forward, root, pos, ignoreFilter) : Optional.some(pos); - }); - }; - var positionIn = function (forward, element) { - var startNode = forward ? element.firstChild : element.lastChild; - if (isText$1(startNode)) { - return Optional.some(CaretPosition$1(startNode, forward ? 0 : startNode.data.length)); - } else if (startNode) { - if (isCaretCandidate(startNode)) { - return Optional.some(forward ? CaretPosition$1.before(startNode) : afterElement(startNode)); - } else { - return walkToPositionIn(forward, element, startNode); - } - } else { - return Optional.none(); - } - }; - var nextPosition = curry(fromPosition, true); - var prevPosition = curry(fromPosition, false); - var firstPositionIn = curry(positionIn, true); - var lastPositionIn = curry(positionIn, false); - - var CARET_ID = '_mce_caret'; - var isCaretNode = function (node) { - return isElement$1(node) && node.id === CARET_ID; - }; - var getParentCaretContainer = function (body, node) { - while (node && node !== body) { - if (node.id === CARET_ID) { - return node; - } - node = node.parentNode; - } - return null; - }; - - var isStringPathBookmark = function (bookmark) { - return typeof bookmark.start === 'string'; - }; - var isRangeBookmark = function (bookmark) { - return bookmark.hasOwnProperty('rng'); - }; - var isIdBookmark = function (bookmark) { - return bookmark.hasOwnProperty('id'); - }; - var isIndexBookmark = function (bookmark) { - return bookmark.hasOwnProperty('name'); - }; - var isPathBookmark = function (bookmark) { - return Tools.isArray(bookmark.start); - }; - - var addBogus = function (dom, node) { - if (isElement$1(node) && dom.isBlock(node) && !node.innerHTML && !Env.ie) { - node.innerHTML = '
                                      '; - } - return node; - }; - var resolveCaretPositionBookmark = function (dom, bookmark) { - var pos; - var rng = dom.createRng(); - pos = resolve$1(dom.getRoot(), bookmark.start); - rng.setStart(pos.container(), pos.offset()); - pos = resolve$1(dom.getRoot(), bookmark.end); - rng.setEnd(pos.container(), pos.offset()); - return rng; - }; - var insertZwsp = function (node, rng) { - var textNode = node.ownerDocument.createTextNode(ZWSP); - node.appendChild(textNode); - rng.setStart(textNode, 0); - rng.setEnd(textNode, 0); - }; - var isEmpty$1 = function (node) { - return node.hasChildNodes() === false; - }; - var tryFindRangePosition = function (node, rng) { - return lastPositionIn(node).fold(function () { - return false; - }, function (pos) { - rng.setStart(pos.container(), pos.offset()); - rng.setEnd(pos.container(), pos.offset()); - return true; - }); - }; - var padEmptyCaretContainer = function (root, node, rng) { - if (isEmpty$1(node) && getParentCaretContainer(root, node)) { - insertZwsp(node, rng); - return true; - } else { - return false; - } - }; - var setEndPoint = function (dom, start, bookmark, rng) { - var point = bookmark[start ? 'start' : 'end']; - var i, node, offset, children; - var root = dom.getRoot(); - if (point) { - offset = point[0]; - for (node = root, i = point.length - 1; i >= 1; i--) { - children = node.childNodes; - if (padEmptyCaretContainer(root, node, rng)) { - return true; - } - if (point[i] > children.length - 1) { - if (padEmptyCaretContainer(root, node, rng)) { - return true; - } - return tryFindRangePosition(node, rng); - } - node = children[point[i]]; - } - if (node.nodeType === 3) { - offset = Math.min(point[0], node.nodeValue.length); - } - if (node.nodeType === 1) { - offset = Math.min(point[0], node.childNodes.length); - } - if (start) { - rng.setStart(node, offset); - } else { - rng.setEnd(node, offset); - } - } - return true; - }; - var isValidTextNode = function (node) { - return isText$1(node) && node.data.length > 0; - }; - var restoreEndPoint = function (dom, suffix, bookmark) { - var marker = dom.get(bookmark.id + '_' + suffix), node, idx, next, prev; - var keep = bookmark.keep; - var container, offset; - if (marker) { - node = marker.parentNode; - if (suffix === 'start') { - if (!keep) { - idx = dom.nodeIndex(marker); - } else { - if (marker.hasChildNodes()) { - node = marker.firstChild; - idx = 1; - } else if (isValidTextNode(marker.nextSibling)) { - node = marker.nextSibling; - idx = 0; - } else if (isValidTextNode(marker.previousSibling)) { - node = marker.previousSibling; - idx = marker.previousSibling.data.length; - } else { - node = marker.parentNode; - idx = dom.nodeIndex(marker) + 1; - } - } - container = node; - offset = idx; - } else { - if (!keep) { - idx = dom.nodeIndex(marker); - } else { - if (marker.hasChildNodes()) { - node = marker.firstChild; - idx = 1; - } else if (isValidTextNode(marker.previousSibling)) { - node = marker.previousSibling; - idx = marker.previousSibling.data.length; - } else { - node = marker.parentNode; - idx = dom.nodeIndex(marker); - } - } - container = node; - offset = idx; - } - if (!keep) { - prev = marker.previousSibling; - next = marker.nextSibling; - Tools.each(Tools.grep(marker.childNodes), function (node) { - if (isText$1(node)) { - node.nodeValue = node.nodeValue.replace(/\uFEFF/g, ''); - } - }); - while (marker = dom.get(bookmark.id + '_' + suffix)) { - dom.remove(marker, true); - } - if (prev && next && prev.nodeType === next.nodeType && isText$1(prev) && !Env.opera) { - idx = prev.nodeValue.length; - prev.appendData(next.nodeValue); - dom.remove(next); - container = prev; - offset = idx; - } - } - return Optional.some(CaretPosition$1(container, offset)); - } else { - return Optional.none(); - } - }; - var resolvePaths = function (dom, bookmark) { - var rng = dom.createRng(); - if (setEndPoint(dom, true, bookmark, rng) && setEndPoint(dom, false, bookmark, rng)) { - return Optional.some(rng); - } else { - return Optional.none(); - } - }; - var resolveId = function (dom, bookmark) { - var startPos = restoreEndPoint(dom, 'start', bookmark); - var endPos = restoreEndPoint(dom, 'end', bookmark); - return lift2(startPos, endPos.or(startPos), function (spos, epos) { - var rng = dom.createRng(); - rng.setStart(addBogus(dom, spos.container()), spos.offset()); - rng.setEnd(addBogus(dom, epos.container()), epos.offset()); - return rng; - }); - }; - var resolveIndex$1 = function (dom, bookmark) { - return Optional.from(dom.select(bookmark.name)[bookmark.index]).map(function (elm) { - var rng = dom.createRng(); - rng.selectNode(elm); - return rng; - }); - }; - var resolve$2 = function (selection, bookmark) { - var dom = selection.dom; - if (bookmark) { - if (isPathBookmark(bookmark)) { - return resolvePaths(dom, bookmark); - } else if (isStringPathBookmark(bookmark)) { - return Optional.some(resolveCaretPositionBookmark(dom, bookmark)); - } else if (isIdBookmark(bookmark)) { - return resolveId(dom, bookmark); - } else if (isIndexBookmark(bookmark)) { - return resolveIndex$1(dom, bookmark); - } else if (isRangeBookmark(bookmark)) { - return Optional.some(bookmark.rng); - } - } - return Optional.none(); - }; - - var getBookmark$1 = function (selection, type, normalized) { - return getBookmark(selection, type, normalized); - }; - var moveToBookmark = function (selection, bookmark) { - resolve$2(selection, bookmark).each(function (rng) { - selection.setRng(rng); - }); - }; - var isBookmarkNode$1 = function (node) { - return isElement$1(node) && node.tagName === 'SPAN' && node.getAttribute('data-mce-type') === 'bookmark'; - }; - - var is$2 = function (expected) { - return function (actual) { - return expected === actual; - }; - }; - var isNbsp = is$2(nbsp); - var isWhiteSpace$1 = function (chr) { - return chr !== '' && ' \f\n\r\t\x0B'.indexOf(chr) !== -1; - }; - var isContent$1 = function (chr) { - return !isWhiteSpace$1(chr) && !isNbsp(chr); - }; - - var isNode = function (node) { - return !!node.nodeType; - }; - var isInlineBlock = function (node) { - return node && /^(IMG)$/.test(node.nodeName); - }; - var moveStart = function (dom, selection, rng) { - var offset = rng.startOffset; - var container = rng.startContainer, walker, node, nodes; - if (rng.startContainer === rng.endContainer) { - if (isInlineBlock(rng.startContainer.childNodes[rng.startOffset])) { - return; - } - } - if (container.nodeType === 1) { - nodes = container.childNodes; - if (offset < nodes.length) { - container = nodes[offset]; - walker = new DomTreeWalker(container, dom.getParent(container, dom.isBlock)); - } else { - container = nodes[nodes.length - 1]; - walker = new DomTreeWalker(container, dom.getParent(container, dom.isBlock)); - walker.next(true); - } - for (node = walker.current(); node; node = walker.next()) { - if (node.nodeType === 3 && !isWhiteSpaceNode(node)) { - rng.setStart(node, 0); - selection.setRng(rng); - return; - } - } - } - }; - var getNonWhiteSpaceSibling = function (node, next, inc) { - if (node) { - var nextName = next ? 'nextSibling' : 'previousSibling'; - for (node = inc ? node : node[nextName]; node; node = node[nextName]) { - if (node.nodeType === 1 || !isWhiteSpaceNode(node)) { - return node; - } - } - } - }; - var isTextBlock$1 = function (editor, name) { - if (isNode(name)) { - name = name.nodeName; - } - return !!editor.schema.getTextBlockElements()[name.toLowerCase()]; - }; - var isValid = function (ed, parent, child) { - return ed.schema.isValidChild(parent, child); - }; - var isWhiteSpaceNode = function (node, allowSpaces) { - if (allowSpaces === void 0) { - allowSpaces = false; - } - if (isNonNullable(node) && isText$1(node)) { - var data = allowSpaces ? node.data.replace(/ /g, '\xA0') : node.data; - return isWhitespaceText(data); - } else { - return false; - } - }; - var isEmptyTextNode = function (node) { - return isNonNullable(node) && isText$1(node) && node.length === 0; - }; - var replaceVars = function (value, vars) { - if (typeof value !== 'string') { - value = value(vars); - } else if (vars) { - value = value.replace(/%(\w+)/g, function (str, name) { - return vars[name] || str; - }); - } - return value; - }; - var isEq = function (str1, str2) { - str1 = str1 || ''; - str2 = str2 || ''; - str1 = '' + (str1.nodeName || str1); - str2 = '' + (str2.nodeName || str2); - return str1.toLowerCase() === str2.toLowerCase(); - }; - var normalizeStyleValue = function (dom, value, name) { - if (name === 'color' || name === 'backgroundColor') { - value = dom.toHex(value); - } - if (name === 'fontWeight' && value === 700) { - value = 'bold'; - } - if (name === 'fontFamily') { - value = value.replace(/[\'\"]/g, '').replace(/,\s+/g, ','); - } - return '' + value; - }; - var getStyle = function (dom, node, name) { - return normalizeStyleValue(dom, dom.getStyle(node, name), name); - }; - var getTextDecoration = function (dom, node) { - var decoration; - dom.getParent(node, function (n) { - decoration = dom.getStyle(n, 'text-decoration'); - return decoration && decoration !== 'none'; - }); - return decoration; - }; - var getParents$1 = function (dom, node, selector) { - return dom.getParents(node, selector, dom.getRoot()); - }; - var isVariableFormatName = function (editor, formatName) { - var hasVariableValues = function (format) { - var isVariableValue = function (val) { - return val.length > 1 && val.charAt(0) === '%'; - }; - return exists([ - 'styles', - 'attributes' - ], function (key) { - return get$1(format, key).exists(function (field) { - var fieldValues = isArray(field) ? field : values(field); - return exists(fieldValues, isVariableValue); - }); - }); - }; - return exists(editor.formatter.get(formatName), hasVariableValues); - }; - var areSimilarFormats = function (editor, formatName, otherFormatName) { - var validKeys = [ - 'inline', - 'block', - 'selector', - 'attributes', - 'styles', - 'classes' - ]; - var filterObj = function (format) { - return filter$1(format, function (_, key) { - return exists(validKeys, function (validKey) { - return validKey === key; - }); - }); - }; - return exists(editor.formatter.get(formatName), function (fmt1) { - var filteredFmt1 = filterObj(fmt1); - return exists(editor.formatter.get(otherFormatName), function (fmt2) { - var filteredFmt2 = filterObj(fmt2); - return equal(filteredFmt1, filteredFmt2); - }); - }); - }; - var isBlockFormat = function (format) { - return hasNonNullableKey(format, 'block'); - }; - var isSelectorFormat = function (format) { - return hasNonNullableKey(format, 'selector'); - }; - var isInlineFormat = function (format) { - return hasNonNullableKey(format, 'inline'); - }; - - var isBookmarkNode$2 = isBookmarkNode$1; - var getParents$2 = getParents$1; - var isWhiteSpaceNode$1 = isWhiteSpaceNode; - var isTextBlock$2 = isTextBlock$1; - var isBogusBr = function (node) { - return isBr(node) && node.getAttribute('data-mce-bogus') && !node.nextSibling; - }; - var findParentContentEditable = function (dom, node) { - var parent = node; - while (parent) { - if (isElement$1(parent) && dom.getContentEditable(parent)) { - return dom.getContentEditable(parent) === 'false' ? parent : node; - } - parent = parent.parentNode; - } - return node; - }; - var walkText = function (start, node, offset, predicate) { - var str = node.data; - for (var i = offset; start ? i >= 0 : i < str.length; start ? i-- : i++) { - if (predicate(str.charAt(i))) { - return start ? i + 1 : i; - } - } - return -1; - }; - var findSpace = function (start, node, offset) { - return walkText(start, node, offset, function (c) { - return isNbsp(c) || isWhiteSpace$1(c); - }); - }; - var findContent = function (start, node, offset) { - return walkText(start, node, offset, isContent$1); - }; - var findWordEndPoint = function (dom, body, container, offset, start, includeTrailingSpaces) { - var lastTextNode; - var rootNode = dom.getParent(container, dom.isBlock) || body; - var walk = function (container, offset, pred) { - var textSeeker = TextSeeker(dom); - var walker = start ? textSeeker.backwards : textSeeker.forwards; - return Optional.from(walker(container, offset, function (text, textOffset) { - if (isBookmarkNode$2(text.parentNode)) { - return -1; - } else { - lastTextNode = text; - return pred(start, text, textOffset); - } - }, rootNode)); - }; - var spaceResult = walk(container, offset, findSpace); - return spaceResult.bind(function (result) { - return includeTrailingSpaces ? walk(result.container, result.offset + (start ? -1 : 0), findContent) : Optional.some(result); - }).orThunk(function () { - return lastTextNode ? Optional.some({ - container: lastTextNode, - offset: start ? 0 : lastTextNode.length - }) : Optional.none(); - }); - }; - var findSelectorEndPoint = function (dom, format, rng, container, siblingName) { - if (isText$1(container) && container.nodeValue.length === 0 && container[siblingName]) { - container = container[siblingName]; - } - var parents = getParents$2(dom, container); - for (var i = 0; i < parents.length; i++) { - for (var y = 0; y < format.length; y++) { - var curFormat = format[y]; - if ('collapsed' in curFormat && curFormat.collapsed !== rng.collapsed) { - continue; - } - if (dom.is(parents[i], curFormat.selector)) { - return parents[i]; - } - } - } - return container; - }; - var findBlockEndPoint = function (editor, format, container, siblingName) { - var node; - var dom = editor.dom; - var root = dom.getRoot(); - if (!format[0].wrapper) { - node = dom.getParent(container, format[0].block, root); - } - if (!node) { - var scopeRoot = dom.getParent(container, 'LI,TD,TH'); - node = dom.getParent(isText$1(container) ? container.parentNode : container, function (node) { - return node !== root && isTextBlock$2(editor, node); - }, scopeRoot); - } - if (node && format[0].wrapper) { - node = getParents$2(dom, node, 'ul,ol').reverse()[0] || node; - } - if (!node) { - node = container; - while (node[siblingName] && !dom.isBlock(node[siblingName])) { - node = node[siblingName]; - if (isEq(node, 'br')) { - break; - } - } - } - return node || container; - }; - var isAtBlockBoundary = function (dom, root, container, siblingName) { - var parent = container.parentNode; - if (isNonNullable(container[siblingName])) { - return false; - } else if (parent === root || isNullable(parent) || dom.isBlock(parent)) { - return true; - } else { - return isAtBlockBoundary(dom, root, parent, siblingName); - } - }; - var findParentContainer = function (dom, format, container, offset, start) { - var parent = container; - var sibling; - var siblingName = start ? 'previousSibling' : 'nextSibling'; - var root = dom.getRoot(); - if (isText$1(container) && !isWhiteSpaceNode$1(container)) { - if (start ? offset > 0 : offset < container.data.length) { - return container; - } - } - while (true) { - if (!format[0].block_expand && dom.isBlock(parent)) { - return parent; - } - for (sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) { - var allowSpaces = isText$1(sibling) && !isAtBlockBoundary(dom, root, sibling, siblingName); - if (!isBookmarkNode$2(sibling) && !isBogusBr(sibling) && !isWhiteSpaceNode$1(sibling, allowSpaces)) { - return parent; - } - } - if (parent === root || parent.parentNode === root) { - container = parent; - break; - } - parent = parent.parentNode; - } - return container; - }; - var isSelfOrParentBookmark = function (container) { - return isBookmarkNode$2(container.parentNode) || isBookmarkNode$2(container); - }; - var expandRng = function (editor, rng, format, includeTrailingSpace) { - if (includeTrailingSpace === void 0) { - includeTrailingSpace = false; - } - var startContainer = rng.startContainer, startOffset = rng.startOffset, endContainer = rng.endContainer, endOffset = rng.endOffset; - var dom = editor.dom; - if (isElement$1(startContainer) && startContainer.hasChildNodes()) { - startContainer = getNode(startContainer, startOffset); - if (isText$1(startContainer)) { - startOffset = 0; - } - } - if (isElement$1(endContainer) && endContainer.hasChildNodes()) { - endContainer = getNode(endContainer, rng.collapsed ? endOffset : endOffset - 1); - if (isText$1(endContainer)) { - endOffset = endContainer.nodeValue.length; - } - } - startContainer = findParentContentEditable(dom, startContainer); - endContainer = findParentContentEditable(dom, endContainer); - if (isSelfOrParentBookmark(startContainer)) { - startContainer = isBookmarkNode$2(startContainer) ? startContainer : startContainer.parentNode; - if (rng.collapsed) { - startContainer = startContainer.previousSibling || startContainer; - } else { - startContainer = startContainer.nextSibling || startContainer; - } - if (isText$1(startContainer)) { - startOffset = rng.collapsed ? startContainer.length : 0; - } - } - if (isSelfOrParentBookmark(endContainer)) { - endContainer = isBookmarkNode$2(endContainer) ? endContainer : endContainer.parentNode; - if (rng.collapsed) { - endContainer = endContainer.nextSibling || endContainer; - } else { - endContainer = endContainer.previousSibling || endContainer; - } - if (isText$1(endContainer)) { - endOffset = rng.collapsed ? 0 : endContainer.length; - } - } - if (rng.collapsed) { - var startPoint = findWordEndPoint(dom, editor.getBody(), startContainer, startOffset, true, includeTrailingSpace); - startPoint.each(function (_a) { - var container = _a.container, offset = _a.offset; - startContainer = container; - startOffset = offset; - }); - var endPoint = findWordEndPoint(dom, editor.getBody(), endContainer, endOffset, false, includeTrailingSpace); - endPoint.each(function (_a) { - var container = _a.container, offset = _a.offset; - endContainer = container; - endOffset = offset; - }); - } - if (format[0].inline || format[0].block_expand) { - if (!format[0].inline || (!isText$1(startContainer) || startOffset === 0)) { - startContainer = findParentContainer(dom, format, startContainer, startOffset, true); - } - if (!format[0].inline || (!isText$1(endContainer) || endOffset === endContainer.nodeValue.length)) { - endContainer = findParentContainer(dom, format, endContainer, endOffset, false); - } - } - if (format[0].selector && format[0].expand !== false && !format[0].inline) { - startContainer = findSelectorEndPoint(dom, format, rng, startContainer, 'previousSibling'); - endContainer = findSelectorEndPoint(dom, format, rng, endContainer, 'nextSibling'); - } - if (format[0].block || format[0].selector) { - startContainer = findBlockEndPoint(editor, format, startContainer, 'previousSibling'); - endContainer = findBlockEndPoint(editor, format, endContainer, 'nextSibling'); - if (format[0].block) { - if (!dom.isBlock(startContainer)) { - startContainer = findParentContainer(dom, format, startContainer, startOffset, true); - } - if (!dom.isBlock(endContainer)) { - endContainer = findParentContainer(dom, format, endContainer, endOffset, false); - } - } - } - if (isElement$1(startContainer)) { - startOffset = dom.nodeIndex(startContainer); - startContainer = startContainer.parentNode; - } - if (isElement$1(endContainer)) { - endOffset = dom.nodeIndex(endContainer) + 1; - endContainer = endContainer.parentNode; - } - return { - startContainer: startContainer, - startOffset: startOffset, - endContainer: endContainer, - endOffset: endOffset - }; - }; - - var clampToExistingChildren = function (container, index) { - var childNodes = container.childNodes; - if (index >= childNodes.length) { - index = childNodes.length - 1; - } else if (index < 0) { - index = 0; - } - return childNodes[index] || container; - }; - var getEndChild = function (container, index) { - return clampToExistingChildren(container, index - 1); - }; - var walk$1 = function (dom, rng, callback) { - var startContainer = rng.startContainer; - var startOffset = rng.startOffset; - var endContainer = rng.endContainer; - var endOffset = rng.endOffset; - var exclude = function (nodes) { - var node; - node = nodes[0]; - if (node.nodeType === 3 && node === startContainer && startOffset >= node.nodeValue.length) { - nodes.splice(0, 1); - } - node = nodes[nodes.length - 1]; - if (endOffset === 0 && nodes.length > 0 && node === endContainer && node.nodeType === 3) { - nodes.splice(nodes.length - 1, 1); - } - return nodes; - }; - var collectSiblings = function (node, name, endNode) { - var siblings = []; - for (; node && node !== endNode; node = node[name]) { - siblings.push(node); - } - return siblings; - }; - var findEndPoint = function (node, root) { - do { - if (node.parentNode === root) { - return node; - } - node = node.parentNode; - } while (node); - }; - var walkBoundary = function (startNode, endNode, next) { - var siblingName = next ? 'nextSibling' : 'previousSibling'; - for (var node = startNode, parent_1 = node.parentNode; node && node !== endNode; node = parent_1) { - parent_1 = node.parentNode; - var siblings_1 = collectSiblings(node === startNode ? node : node[siblingName], siblingName); - if (siblings_1.length) { - if (!next) { - siblings_1.reverse(); - } - callback(exclude(siblings_1)); - } - } - }; - if (startContainer.nodeType === 1 && startContainer.hasChildNodes()) { - startContainer = clampToExistingChildren(startContainer, startOffset); - } - if (endContainer.nodeType === 1 && endContainer.hasChildNodes()) { - endContainer = getEndChild(endContainer, endOffset); - } - if (startContainer === endContainer) { - return callback(exclude([startContainer])); - } - var ancestor = dom.findCommonAncestor(startContainer, endContainer); - for (var node = startContainer; node; node = node.parentNode) { - if (node === endContainer) { - return walkBoundary(startContainer, ancestor, true); - } - if (node === ancestor) { - break; - } - } - for (var node = endContainer; node; node = node.parentNode) { - if (node === startContainer) { - return walkBoundary(endContainer, ancestor); - } - if (node === ancestor) { - break; - } - } - var startPoint = findEndPoint(startContainer, ancestor) || startContainer; - var endPoint = findEndPoint(endContainer, ancestor) || endContainer; - walkBoundary(startContainer, startPoint, true); - var siblings = collectSiblings(startPoint === startContainer ? startPoint : startPoint.nextSibling, 'nextSibling', endPoint === endContainer ? endPoint.nextSibling : endPoint); - if (siblings.length) { - callback(exclude(siblings)); - } - walkBoundary(endContainer, endPoint); - }; - - var getRanges = function (selection) { - var ranges = []; - if (selection) { - for (var i = 0; i < selection.rangeCount; i++) { - ranges.push(selection.getRangeAt(i)); - } - } - return ranges; - }; - var getSelectedNodes = function (ranges) { - return bind(ranges, function (range) { - var node = getSelectedNode(range); - return node ? [SugarElement.fromDom(node)] : []; - }); - }; - var hasMultipleRanges = function (selection) { - return getRanges(selection).length > 1; - }; - - var getCellsFromRanges = function (ranges) { - return filter(getSelectedNodes(ranges), isTableCell$1); - }; - var getCellsFromElement = function (elm) { - return descendants$1(elm, 'td[data-mce-selected],th[data-mce-selected]'); - }; - var getCellsFromElementOrRanges = function (ranges, element) { - var selectedCells = getCellsFromElement(element); - return selectedCells.length > 0 ? selectedCells : getCellsFromRanges(ranges); - }; - var getCellsFromEditor = function (editor) { - return getCellsFromElementOrRanges(getRanges(editor.selection.getSel()), SugarElement.fromDom(editor.getBody())); - }; - - var getStartNode = function (rng) { - var sc = rng.startContainer, so = rng.startOffset; - if (isText$1(sc)) { - return so === 0 ? Optional.some(SugarElement.fromDom(sc)) : Optional.none(); - } else { - return Optional.from(sc.childNodes[so]).map(SugarElement.fromDom); - } - }; - var getEndNode = function (rng) { - var ec = rng.endContainer, eo = rng.endOffset; - if (isText$1(ec)) { - return eo === ec.data.length ? Optional.some(SugarElement.fromDom(ec)) : Optional.none(); - } else { - return Optional.from(ec.childNodes[eo - 1]).map(SugarElement.fromDom); - } - }; - var getFirstChildren = function (node) { - return firstChild(node).fold(constant([node]), function (child) { - return [node].concat(getFirstChildren(child)); - }); - }; - var getLastChildren = function (node) { - return lastChild(node).fold(constant([node]), function (child) { - if (name(child) === 'br') { - return prevSibling(child).map(function (sibling) { - return [node].concat(getLastChildren(sibling)); - }).getOr([]); - } else { - return [node].concat(getLastChildren(child)); - } - }); - }; - var hasAllContentsSelected = function (elm, rng) { - return lift2(getStartNode(rng), getEndNode(rng), function (startNode, endNode) { - var start = find(getFirstChildren(elm), curry(eq$2, startNode)); - var end = find(getLastChildren(elm), curry(eq$2, endNode)); - return start.isSome() && end.isSome(); - }).getOr(false); - }; - var moveEndPoint$1 = function (dom, rng, node, start) { - var root = node, walker = new DomTreeWalker(node, root); - var moveCaretBeforeOnEnterElementsMap = filter$1(dom.schema.getMoveCaretBeforeOnEnterElements(), function (_, name) { - return !contains([ - 'td', - 'th', - 'table' - ], name.toLowerCase()); - }); - do { - if (isText$1(node) && Tools.trim(node.nodeValue).length !== 0) { - if (start) { - rng.setStart(node, 0); - } else { - rng.setEnd(node, node.nodeValue.length); - } - return; - } - if (moveCaretBeforeOnEnterElementsMap[node.nodeName]) { - if (start) { - rng.setStartBefore(node); - } else { - if (node.nodeName === 'BR') { - rng.setEndBefore(node); - } else { - rng.setEndAfter(node); - } - } - return; - } - } while (node = start ? walker.next() : walker.prev()); - if (root.nodeName === 'BODY') { - if (start) { - rng.setStart(root, 0); - } else { - rng.setEnd(root, root.childNodes.length); - } - } - }; - var hasAnyRanges = function (editor) { - var sel = editor.selection.getSel(); - return sel && sel.rangeCount > 0; - }; - var runOnRanges = function (editor, executor) { - var fakeSelectionNodes = getCellsFromEditor(editor); - if (fakeSelectionNodes.length > 0) { - each(fakeSelectionNodes, function (elem) { - var node = elem.dom; - var fakeNodeRng = editor.dom.createRng(); - fakeNodeRng.setStartBefore(node); - fakeNodeRng.setEndAfter(node); - executor(fakeNodeRng, true); - }); - } else { - executor(editor.selection.getRng(), false); - } - }; - var preserve = function (selection, fillBookmark, executor) { - var bookmark = getPersistentBookmark(selection, fillBookmark); - executor(bookmark); - selection.moveToBookmark(bookmark); - }; - - function NodeValue (is, name) { - var get = function (element) { - if (!is(element)) { - throw new Error('Can only get ' + name + ' value of a ' + name + ' node'); - } - return getOption(element).getOr(''); - }; - var getOption = function (element) { - return is(element) ? Optional.from(element.dom.nodeValue) : Optional.none(); - }; - var set = function (element, value) { - if (!is(element)) { - throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node'); - } - element.dom.nodeValue = value; - }; - return { - get: get, - getOption: getOption, - set: set - }; - } - - var api = NodeValue(isText, 'text'); - var get$8 = function (element) { - return api.get(element); - }; - - var isZeroWidth = function (elem) { - return isText(elem) && get$8(elem) === ZWSP; - }; - var context = function (editor, elem, wrapName, nodeName) { - return parent(elem).fold(function () { - return 'skipping'; - }, function (parent) { - if (nodeName === 'br' || isZeroWidth(elem)) { - return 'valid'; - } else if (isAnnotation(elem)) { - return 'existing'; - } else if (isCaretNode(elem.dom)) { - return 'caret'; - } else if (!isValid(editor, wrapName, nodeName) || !isValid(editor, name(parent), wrapName)) { - return 'invalid-child'; - } else { - return 'valid'; - } - }); - }; - - var applyWordGrab = function (editor, rng) { - var r = expandRng(editor, rng, [{ inline: true }]); - rng.setStart(r.startContainer, r.startOffset); - rng.setEnd(r.endContainer, r.endOffset); - editor.selection.setRng(rng); - }; - var makeAnnotation = function (eDoc, _a, annotationName, decorate) { - var _b = _a.uid, uid = _b === void 0 ? generate$1('mce-annotation') : _b, data = __rest(_a, ['uid']); - var master = SugarElement.fromTag('span', eDoc); - add$3(master, annotation()); - set(master, '' + dataAnnotationId(), uid); - set(master, '' + dataAnnotation(), annotationName); - var _c = decorate(uid, data), _d = _c.attributes, attributes = _d === void 0 ? {} : _d, _e = _c.classes, classes = _e === void 0 ? [] : _e; - setAll(master, attributes); - add$4(master, classes); - return master; - }; - var annotate = function (editor, rng, annotationName, decorate, data) { - var newWrappers = []; - var master = makeAnnotation(editor.getDoc(), data, annotationName, decorate); - var wrapper = Cell(Optional.none()); - var finishWrapper = function () { - wrapper.set(Optional.none()); - }; - var getOrOpenWrapper = function () { - return wrapper.get().getOrThunk(function () { - var nu = shallow(master); - newWrappers.push(nu); - wrapper.set(Optional.some(nu)); - return nu; - }); - }; - var processElements = function (elems) { - each(elems, processElement); - }; - var processElement = function (elem) { - var ctx = context(editor, elem, 'span', name(elem)); - switch (ctx) { - case 'invalid-child': { - finishWrapper(); - var children$1 = children(elem); - processElements(children$1); - finishWrapper(); - break; - } - case 'valid': { - var w = getOrOpenWrapper(); - wrap(elem, w); - break; - } - } - }; - var processNodes = function (nodes) { - var elems = map(nodes, SugarElement.fromDom); - processElements(elems); - }; - walk$1(editor.dom, rng, function (nodes) { - finishWrapper(); - processNodes(nodes); - }); - return newWrappers; - }; - var annotateWithBookmark = function (editor, name, settings, data) { - editor.undoManager.transact(function () { - var selection = editor.selection; - var initialRng = selection.getRng(); - var hasFakeSelection = getCellsFromEditor(editor).length > 0; - if (initialRng.collapsed && !hasFakeSelection) { - applyWordGrab(editor, initialRng); - } - if (selection.getRng().collapsed && !hasFakeSelection) { - var wrapper = makeAnnotation(editor.getDoc(), data, name, settings.decorate); - set$1(wrapper, nbsp); - selection.getRng().insertNode(wrapper.dom); - selection.select(wrapper.dom); - } else { - preserve(selection, false, function () { - runOnRanges(editor, function (selectionRng) { - annotate(editor, selectionRng, name, settings.decorate, data); - }); - }); - } - }); - }; - - var Annotator = function (editor) { - var registry = create$2(); - setup$1(editor, registry); - var changes = setup(editor); - return { - register: function (name, settings) { - registry.register(name, settings); - }, - annotate: function (name, data) { - registry.lookup(name).each(function (settings) { - annotateWithBookmark(editor, name, settings, data); - }); - }, - annotationChanged: function (name, callback) { - changes.addListener(name, callback); - }, - remove: function (name) { - identify(editor, Optional.some(name)).each(function (_a) { - var elements = _a.elements; - each(elements, unwrap); - }); - }, - getAll: function (name) { - var directory = findAll(editor, name); - return map$1(directory, function (elems) { - return map(elems, function (elem) { - return elem.dom; - }); - }); - } - }; - }; - - function BookmarkManager(selection) { - return { - getBookmark: curry(getBookmark$1, selection), - moveToBookmark: curry(moveToBookmark, selection) - }; - } - (function (BookmarkManager) { - BookmarkManager.isBookmarkNode = isBookmarkNode$1; - }(BookmarkManager || (BookmarkManager = {}))); - var BookmarkManager$1 = BookmarkManager; - - var getContentEditableRoot = function (root, node) { - while (node && node !== root) { - if (isContentEditableTrue(node) || isContentEditableFalse(node)) { - return node; - } - node = node.parentNode; - } - return null; - }; - - var isXYWithinRange = function (clientX, clientY, range) { - if (range.collapsed) { - return false; - } - if (Env.browser.isIE() && range.startOffset === range.endOffset - 1 && range.startContainer === range.endContainer) { - var elm = range.startContainer.childNodes[range.startOffset]; - if (isElement$1(elm)) { - return exists(elm.getClientRects(), function (rect) { - return containsXY(rect, clientX, clientY); - }); - } - } - return exists(range.getClientRects(), function (rect) { - return containsXY(rect, clientX, clientY); - }); - }; - - var firePreProcess = function (editor, args) { - return editor.fire('PreProcess', args); - }; - var firePostProcess = function (editor, args) { - return editor.fire('PostProcess', args); - }; - var fireRemove = function (editor) { - return editor.fire('remove'); - }; - var fireDetach = function (editor) { - return editor.fire('detach'); - }; - var fireSwitchMode = function (editor, mode) { - return editor.fire('SwitchMode', { mode: mode }); - }; - var fireObjectResizeStart = function (editor, target, width, height, origin) { - editor.fire('ObjectResizeStart', { - target: target, - width: width, - height: height, - origin: origin - }); - }; - var fireObjectResized = function (editor, target, width, height, origin) { - editor.fire('ObjectResized', { - target: target, - width: width, - height: height, - origin: origin - }); - }; - var firePreInit = function (editor) { - return editor.fire('PreInit'); - }; - var firePostRender = function (editor) { - return editor.fire('PostRender'); - }; - var fireInit = function (editor) { - return editor.fire('Init'); - }; - var firePlaceholderToggle = function (editor, state) { - return editor.fire('PlaceholderToggle', { state: state }); - }; - var fireError = function (editor, errorType, error) { - return editor.fire(errorType, error); - }; - - var VK = { - BACKSPACE: 8, - DELETE: 46, - DOWN: 40, - ENTER: 13, - LEFT: 37, - RIGHT: 39, - SPACEBAR: 32, - TAB: 9, - UP: 38, - END: 35, - HOME: 36, - modifierPressed: function (e) { - return e.shiftKey || e.ctrlKey || e.altKey || this.metaKeyPressed(e); - }, - metaKeyPressed: function (e) { - return Env.mac ? e.metaKey : e.ctrlKey && !e.altKey; - } - }; - - var isContentEditableFalse$6 = isContentEditableFalse; - var ControlSelection = function (selection, editor) { - var dom = editor.dom, each = Tools.each; - var selectedElm, selectedElmGhost, resizeHelper, selectedHandle; - var startX, startY, selectedElmX, selectedElmY, startW, startH, ratio, resizeStarted; - var width, height; - var editableDoc = editor.getDoc(), rootDocument = document; - var abs = Math.abs, round = Math.round, rootElement = editor.getBody(); - var startScrollWidth, startScrollHeight; - var resizeHandles = { - nw: [ - 0, - 0, - -1, - -1 - ], - ne: [ - 1, - 0, - 1, - -1 - ], - se: [ - 1, - 1, - 1, - 1 - ], - sw: [ - 0, - 1, - -1, - 1 - ] - }; - var isImage = function (elm) { - return elm && (elm.nodeName === 'IMG' || editor.dom.is(elm, 'figure.image')); - }; - var isEventOnImageOutsideRange = function (evt, range) { - if (evt.type === 'longpress' || evt.type.indexOf('touch') === 0) { - var touch = evt.touches[0]; - return isImage(evt.target) && !isXYWithinRange(touch.clientX, touch.clientY, range); - } else { - return isImage(evt.target) && !isXYWithinRange(evt.clientX, evt.clientY, range); - } - }; - var contextMenuSelectImage = function (evt) { - var target = evt.target; - if (isEventOnImageOutsideRange(evt, editor.selection.getRng()) && !evt.isDefaultPrevented()) { - editor.selection.select(target); - } - }; - var getResizeTarget = function (elm) { - return editor.dom.is(elm, 'figure.image') ? elm.querySelector('img') : elm; - }; - var isResizable = function (elm) { - var selector = getObjectResizing(editor); - if (!selector) { - return false; - } - if (elm.getAttribute('data-mce-resize') === 'false') { - return false; - } - if (elm === editor.getBody()) { - return false; - } - return is$1(SugarElement.fromDom(elm), selector); - }; - var setGhostElmSize = function (ghostElm, width, height) { - dom.setStyles(getResizeTarget(ghostElm), { - width: width, - height: height - }); - }; - var resizeGhostElement = function (e) { - var deltaX, deltaY, proportional; - var resizeHelperX, resizeHelperY; - deltaX = e.screenX - startX; - deltaY = e.screenY - startY; - width = deltaX * selectedHandle[2] + startW; - height = deltaY * selectedHandle[3] + startH; - width = width < 5 ? 5 : width; - height = height < 5 ? 5 : height; - if (isImage(selectedElm) && getResizeImgProportional(editor) !== false) { - proportional = !VK.modifierPressed(e); - } else { - proportional = VK.modifierPressed(e); - } - if (proportional) { - if (abs(deltaX) > abs(deltaY)) { - height = round(width * ratio); - width = round(height / ratio); - } else { - width = round(height / ratio); - height = round(width * ratio); - } - } - setGhostElmSize(selectedElmGhost, width, height); - resizeHelperX = selectedHandle.startPos.x + deltaX; - resizeHelperY = selectedHandle.startPos.y + deltaY; - resizeHelperX = resizeHelperX > 0 ? resizeHelperX : 0; - resizeHelperY = resizeHelperY > 0 ? resizeHelperY : 0; - dom.setStyles(resizeHelper, { - left: resizeHelperX, - top: resizeHelperY, - display: 'block' - }); - resizeHelper.innerHTML = width + ' × ' + height; - if (selectedHandle[2] < 0 && selectedElmGhost.clientWidth <= width) { - dom.setStyle(selectedElmGhost, 'left', selectedElmX + (startW - width)); - } - if (selectedHandle[3] < 0 && selectedElmGhost.clientHeight <= height) { - dom.setStyle(selectedElmGhost, 'top', selectedElmY + (startH - height)); - } - deltaX = rootElement.scrollWidth - startScrollWidth; - deltaY = rootElement.scrollHeight - startScrollHeight; - if (deltaX + deltaY !== 0) { - dom.setStyles(resizeHelper, { - left: resizeHelperX - deltaX, - top: resizeHelperY - deltaY - }); - } - if (!resizeStarted) { - fireObjectResizeStart(editor, selectedElm, startW, startH, 'corner-' + selectedHandle.name); - resizeStarted = true; - } - }; - var endGhostResize = function () { - var wasResizeStarted = resizeStarted; - resizeStarted = false; - var setSizeProp = function (name, value) { - if (value) { - if (selectedElm.style[name] || !editor.schema.isValid(selectedElm.nodeName.toLowerCase(), name)) { - dom.setStyle(getResizeTarget(selectedElm), name, value); - } else { - dom.setAttrib(getResizeTarget(selectedElm), name, '' + value); - } - } - }; - if (wasResizeStarted) { - setSizeProp('width', width); - setSizeProp('height', height); - } - dom.unbind(editableDoc, 'mousemove', resizeGhostElement); - dom.unbind(editableDoc, 'mouseup', endGhostResize); - if (rootDocument !== editableDoc) { - dom.unbind(rootDocument, 'mousemove', resizeGhostElement); - dom.unbind(rootDocument, 'mouseup', endGhostResize); - } - dom.remove(selectedElmGhost); - dom.remove(resizeHelper); - showResizeRect(selectedElm); - if (wasResizeStarted) { - fireObjectResized(editor, selectedElm, width, height, 'corner-' + selectedHandle.name); - dom.setAttrib(selectedElm, 'style', dom.getAttrib(selectedElm, 'style')); - } - editor.nodeChanged(); - }; - var showResizeRect = function (targetElm) { - hideResizeRect(); - unbindResizeHandleEvents(); - var position = dom.getPos(targetElm, rootElement); - var selectedElmX = position.x; - var selectedElmY = position.y; - var rect = targetElm.getBoundingClientRect(); - var targetWidth = rect.width || rect.right - rect.left; - var targetHeight = rect.height || rect.bottom - rect.top; - if (selectedElm !== targetElm) { - selectedElm = targetElm; - width = height = 0; - } - var e = editor.fire('ObjectSelected', { target: targetElm }); - if (isResizable(targetElm) && !e.isDefaultPrevented()) { - each(resizeHandles, function (handle, name) { - var handleElm; - var startDrag = function (e) { - startX = e.screenX; - startY = e.screenY; - startW = getResizeTarget(selectedElm).clientWidth; - startH = getResizeTarget(selectedElm).clientHeight; - ratio = startH / startW; - selectedHandle = handle; - selectedHandle.name = name; - selectedHandle.startPos = { - x: targetWidth * handle[0] + selectedElmX, - y: targetHeight * handle[1] + selectedElmY - }; - startScrollWidth = rootElement.scrollWidth; - startScrollHeight = rootElement.scrollHeight; - selectedElmGhost = selectedElm.cloneNode(true); - dom.addClass(selectedElmGhost, 'mce-clonedresizable'); - dom.setAttrib(selectedElmGhost, 'data-mce-bogus', 'all'); - selectedElmGhost.contentEditable = false; - selectedElmGhost.unSelectabe = true; - dom.setStyles(selectedElmGhost, { - left: selectedElmX, - top: selectedElmY, - margin: 0 - }); - setGhostElmSize(selectedElmGhost, targetWidth, targetHeight); - selectedElmGhost.removeAttribute('data-mce-selected'); - rootElement.appendChild(selectedElmGhost); - dom.bind(editableDoc, 'mousemove', resizeGhostElement); - dom.bind(editableDoc, 'mouseup', endGhostResize); - if (rootDocument !== editableDoc) { - dom.bind(rootDocument, 'mousemove', resizeGhostElement); - dom.bind(rootDocument, 'mouseup', endGhostResize); - } - resizeHelper = dom.add(rootElement, 'div', { - 'class': 'mce-resize-helper', - 'data-mce-bogus': 'all' - }, startW + ' × ' + startH); - }; - handleElm = dom.get('mceResizeHandle' + name); - if (handleElm) { - dom.remove(handleElm); - } - handleElm = dom.add(rootElement, 'div', { - 'id': 'mceResizeHandle' + name, - 'data-mce-bogus': 'all', - 'class': 'mce-resizehandle', - 'unselectable': true, - 'style': 'cursor:' + name + '-resize; margin:0; padding:0' - }); - if (Env.ie === 11) { - handleElm.contentEditable = false; - } - dom.bind(handleElm, 'mousedown', function (e) { - e.stopImmediatePropagation(); - e.preventDefault(); - startDrag(e); - }); - handle.elm = handleElm; - dom.setStyles(handleElm, { - left: targetWidth * handle[0] + selectedElmX - handleElm.offsetWidth / 2, - top: targetHeight * handle[1] + selectedElmY - handleElm.offsetHeight / 2 - }); - }); - } else { - hideResizeRect(); - } - selectedElm.setAttribute('data-mce-selected', '1'); - }; - var hideResizeRect = function () { - unbindResizeHandleEvents(); - if (selectedElm) { - selectedElm.removeAttribute('data-mce-selected'); - } - each$1(resizeHandles, function (value, name) { - var handleElm = dom.get('mceResizeHandle' + name); - if (handleElm) { - dom.unbind(handleElm); - dom.remove(handleElm); - } - }); - }; - var updateResizeRect = function (e) { - var startElm, controlElm; - var isChildOrEqual = function (node, parent) { - if (node) { - do { - if (node === parent) { - return true; - } - } while (node = node.parentNode); - } - }; - if (resizeStarted || editor.removed) { - return; - } - each(dom.select('img[data-mce-selected],hr[data-mce-selected]'), function (img) { - img.removeAttribute('data-mce-selected'); - }); - controlElm = e.type === 'mousedown' ? e.target : selection.getNode(); - controlElm = dom.$(controlElm).closest('table,img,figure.image,hr')[0]; - if (isChildOrEqual(controlElm, rootElement)) { - disableGeckoResize(); - startElm = selection.getStart(true); - if (isChildOrEqual(startElm, controlElm) && isChildOrEqual(selection.getEnd(true), controlElm)) { - showResizeRect(controlElm); - return; - } - } - hideResizeRect(); - }; - var isWithinContentEditableFalse = function (elm) { - return isContentEditableFalse$6(getContentEditableRoot(editor.getBody(), elm)); - }; - var unbindResizeHandleEvents = function () { - each$1(resizeHandles, function (handle) { - if (handle.elm) { - dom.unbind(handle.elm); - delete handle.elm; - } - }); - }; - var disableGeckoResize = function () { - try { - editor.getDoc().execCommand('enableObjectResizing', false, 'false'); - } catch (ex) { - } - }; - editor.on('init', function () { - disableGeckoResize(); - if (Env.browser.isIE() || Env.browser.isEdge()) { - editor.on('mousedown click', function (e) { - var target = e.target, nodeName = target.nodeName; - if (!resizeStarted && /^(TABLE|IMG|HR)$/.test(nodeName) && !isWithinContentEditableFalse(target)) { - if (e.button !== 2) { - editor.selection.select(target, nodeName === 'TABLE'); - } - if (e.type === 'mousedown') { - editor.nodeChanged(); - } - } - }); - var handleMSControlSelect_1 = function (e) { - var delayedSelect = function (node) { - Delay.setEditorTimeout(editor, function () { - return editor.selection.select(node); - }); - }; - if (isWithinContentEditableFalse(e.target) || isMedia(e.target)) { - e.preventDefault(); - delayedSelect(e.target); - return; - } - if (/^(TABLE|IMG|HR)$/.test(e.target.nodeName)) { - e.preventDefault(); - if (e.target.tagName === 'IMG') { - delayedSelect(e.target); - } - } - }; - dom.bind(rootElement, 'mscontrolselect', handleMSControlSelect_1); - editor.on('remove', function () { - return dom.unbind(rootElement, 'mscontrolselect', handleMSControlSelect_1); - }); - } - var throttledUpdateResizeRect = Delay.throttle(function (e) { - if (!editor.composing) { - updateResizeRect(e); - } - }); - editor.on('nodechange ResizeEditor ResizeWindow ResizeContent drop FullscreenStateChanged', throttledUpdateResizeRect); - editor.on('keyup compositionend', function (e) { - if (selectedElm && selectedElm.nodeName === 'TABLE') { - throttledUpdateResizeRect(e); - } - }); - editor.on('hide blur', hideResizeRect); - editor.on('contextmenu longpress', contextMenuSelectImage, true); - }); - editor.on('remove', unbindResizeHandleEvents); - var destroy = function () { - selectedElm = selectedElmGhost = null; - }; - return { - isResizable: isResizable, - showResizeRect: showResizeRect, - hideResizeRect: hideResizeRect, - updateResizeRect: updateResizeRect, - destroy: destroy - }; - }; - - var hasCeProperty = function (node) { - return isContentEditableTrue(node) || isContentEditableFalse(node); - }; - var findParent = function (node, rootNode, predicate) { - while (node && node !== rootNode) { - if (predicate(node)) { - return node; - } - node = node.parentNode; - } - return null; - }; - var findClosestIeRange = function (clientX, clientY, doc) { - var rects; - var element = doc.elementFromPoint(clientX, clientY); - var rng = doc.body.createTextRange(); - if (!element || element.tagName === 'HTML') { - element = doc.body; - } - rng.moveToElementText(element); - rects = Tools.toArray(rng.getClientRects()); - rects = rects.sort(function (a, b) { - a = Math.abs(Math.max(a.top - clientY, a.bottom - clientY)); - b = Math.abs(Math.max(b.top - clientY, b.bottom - clientY)); - return a - b; - }); - if (rects.length > 0) { - clientY = (rects[0].bottom + rects[0].top) / 2; - try { - rng.moveToPoint(clientX, clientY); - rng.collapse(true); - return rng; - } catch (ex) { - } - } - return null; - }; - var moveOutOfContentEditableFalse = function (rng, rootNode) { - var parentElement = rng && rng.parentElement ? rng.parentElement() : null; - return isContentEditableFalse(findParent(parentElement, rootNode, hasCeProperty)) ? null : rng; - }; - var fromPoint$1 = function (clientX, clientY, doc) { - var rng, point; - var pointDoc = doc; - if (pointDoc.caretPositionFromPoint) { - point = pointDoc.caretPositionFromPoint(clientX, clientY); - if (point) { - rng = doc.createRange(); - rng.setStart(point.offsetNode, point.offset); - rng.collapse(true); - } - } else if (doc.caretRangeFromPoint) { - rng = doc.caretRangeFromPoint(clientX, clientY); - } else if (pointDoc.body.createTextRange) { - rng = pointDoc.body.createTextRange(); - try { - rng.moveToPoint(clientX, clientY); - rng.collapse(true); - } catch (ex) { - rng = findClosestIeRange(clientX, clientY, doc); - } - return moveOutOfContentEditableFalse(rng, doc.body); - } - return rng; - }; - - var isEq$1 = function (rng1, rng2) { - return rng1 && rng2 && (rng1.startContainer === rng2.startContainer && rng1.startOffset === rng2.startOffset) && (rng1.endContainer === rng2.endContainer && rng1.endOffset === rng2.endOffset); - }; - - var findParent$1 = function (node, rootNode, predicate) { - while (node && node !== rootNode) { - if (predicate(node)) { - return node; - } - node = node.parentNode; - } - return null; - }; - var hasParent = function (node, rootNode, predicate) { - return findParent$1(node, rootNode, predicate) !== null; - }; - var hasParentWithName = function (node, rootNode, name) { - return hasParent(node, rootNode, function (node) { - return node.nodeName === name; - }); - }; - var isTable$3 = function (node) { - return node && node.nodeName === 'TABLE'; - }; - var isTableCell$3 = function (node) { - return node && /^(TD|TH|CAPTION)$/.test(node.nodeName); - }; - var isCeFalseCaretContainer = function (node, rootNode) { - return isCaretContainer(node) && hasParent(node, rootNode, isCaretNode) === false; - }; - var hasBrBeforeAfter = function (dom, node, left) { - var walker = new DomTreeWalker(node, dom.getParent(node.parentNode, dom.isBlock) || dom.getRoot()); - while (node = walker[left ? 'prev' : 'next']()) { - if (isBr(node)) { - return true; - } - } - }; - var isPrevNode = function (node, name) { - return node.previousSibling && node.previousSibling.nodeName === name; - }; - var hasContentEditableFalseParent = function (body, node) { - while (node && node !== body) { - if (isContentEditableFalse(node)) { - return true; - } - node = node.parentNode; - } - return false; - }; - var findTextNodeRelative = function (dom, isAfterNode, collapsed, left, startNode) { - var lastInlineElement; - var body = dom.getRoot(); - var node; - var nonEmptyElementsMap = dom.schema.getNonEmptyElements(); - var parentBlockContainer = dom.getParent(startNode.parentNode, dom.isBlock) || body; - if (left && isBr(startNode) && isAfterNode && dom.isEmpty(parentBlockContainer)) { - return Optional.some(CaretPosition(startNode.parentNode, dom.nodeIndex(startNode))); - } - var walker = new DomTreeWalker(startNode, parentBlockContainer); - while (node = walker[left ? 'prev' : 'next']()) { - if (dom.getContentEditableParent(node) === 'false' || isCeFalseCaretContainer(node, body)) { - return Optional.none(); - } - if (isText$1(node) && node.nodeValue.length > 0) { - if (hasParentWithName(node, body, 'A') === false) { - return Optional.some(CaretPosition(node, left ? node.nodeValue.length : 0)); - } - return Optional.none(); - } - if (dom.isBlock(node) || nonEmptyElementsMap[node.nodeName.toLowerCase()]) { - return Optional.none(); - } - lastInlineElement = node; - } - if (collapsed && lastInlineElement) { - return Optional.some(CaretPosition(lastInlineElement, 0)); - } - return Optional.none(); - }; - var normalizeEndPoint = function (dom, collapsed, start, rng) { - var container, offset; - var body = dom.getRoot(); - var node; - var directionLeft, normalized = false; - container = rng[(start ? 'start' : 'end') + 'Container']; - offset = rng[(start ? 'start' : 'end') + 'Offset']; - var isAfterNode = isElement$1(container) && offset === container.childNodes.length; - var nonEmptyElementsMap = dom.schema.getNonEmptyElements(); - directionLeft = start; - if (isCaretContainer(container)) { - return Optional.none(); - } - if (isElement$1(container) && offset > container.childNodes.length - 1) { - directionLeft = false; - } - if (isDocument$1(container)) { - container = body; - offset = 0; - } - if (container === body) { - if (directionLeft) { - node = container.childNodes[offset > 0 ? offset - 1 : 0]; - if (node) { - if (isCaretContainer(node)) { - return Optional.none(); - } - if (nonEmptyElementsMap[node.nodeName] || isTable$3(node)) { - return Optional.none(); - } - } - } - if (container.hasChildNodes()) { - offset = Math.min(!directionLeft && offset > 0 ? offset - 1 : offset, container.childNodes.length - 1); - container = container.childNodes[offset]; - offset = isText$1(container) && isAfterNode ? container.data.length : 0; - if (!collapsed && container === body.lastChild && isTable$3(container)) { - return Optional.none(); - } - if (hasContentEditableFalseParent(body, container) || isCaretContainer(container)) { - return Optional.none(); - } - if (container.hasChildNodes() && isTable$3(container) === false) { - node = container; - var walker = new DomTreeWalker(container, body); - do { - if (isContentEditableFalse(node) || isCaretContainer(node)) { - normalized = false; - break; - } - if (isText$1(node) && node.nodeValue.length > 0) { - offset = directionLeft ? 0 : node.nodeValue.length; - container = node; - normalized = true; - break; - } - if (nonEmptyElementsMap[node.nodeName.toLowerCase()] && !isTableCell$3(node)) { - offset = dom.nodeIndex(node); - container = node.parentNode; - if (!directionLeft) { - offset++; - } - normalized = true; - break; - } - } while (node = directionLeft ? walker.next() : walker.prev()); - } - } - } - if (collapsed) { - if (isText$1(container) && offset === 0) { - findTextNodeRelative(dom, isAfterNode, collapsed, true, container).each(function (pos) { - container = pos.container(); - offset = pos.offset(); - normalized = true; - }); - } - if (isElement$1(container)) { - node = container.childNodes[offset]; - if (!node) { - node = container.childNodes[offset - 1]; - } - if (node && isBr(node) && !isPrevNode(node, 'A') && !hasBrBeforeAfter(dom, node, false) && !hasBrBeforeAfter(dom, node, true)) { - findTextNodeRelative(dom, isAfterNode, collapsed, true, node).each(function (pos) { - container = pos.container(); - offset = pos.offset(); - normalized = true; - }); - } - } - } - if (directionLeft && !collapsed && isText$1(container) && offset === container.nodeValue.length) { - findTextNodeRelative(dom, isAfterNode, collapsed, false, container).each(function (pos) { - container = pos.container(); - offset = pos.offset(); - normalized = true; - }); - } - return normalized ? Optional.some(CaretPosition(container, offset)) : Optional.none(); - }; - var normalize = function (dom, rng) { - var collapsed = rng.collapsed, normRng = rng.cloneRange(); - var startPos = CaretPosition.fromRangeStart(rng); - normalizeEndPoint(dom, collapsed, true, normRng).each(function (pos) { - if (!collapsed || !CaretPosition.isAbove(startPos, pos)) { - normRng.setStart(pos.container(), pos.offset()); - } - }); - if (!collapsed) { - normalizeEndPoint(dom, collapsed, false, normRng).each(function (pos) { - normRng.setEnd(pos.container(), pos.offset()); - }); - } - if (collapsed) { - normRng.collapse(true); - } - return isEq$1(rng, normRng) ? Optional.none() : Optional.some(normRng); - }; - - var splitText = function (node, offset) { - return node.splitText(offset); - }; - var split$1 = function (rng) { - var startContainer = rng.startContainer, startOffset = rng.startOffset, endContainer = rng.endContainer, endOffset = rng.endOffset; - if (startContainer === endContainer && isText$1(startContainer)) { - if (startOffset > 0 && startOffset < startContainer.nodeValue.length) { - endContainer = splitText(startContainer, startOffset); - startContainer = endContainer.previousSibling; - if (endOffset > startOffset) { - endOffset = endOffset - startOffset; - startContainer = endContainer = splitText(endContainer, endOffset).previousSibling; - endOffset = endContainer.nodeValue.length; - startOffset = 0; - } else { - endOffset = 0; - } - } - } else { - if (isText$1(startContainer) && startOffset > 0 && startOffset < startContainer.nodeValue.length) { - startContainer = splitText(startContainer, startOffset); - startOffset = 0; - } - if (isText$1(endContainer) && endOffset > 0 && endOffset < endContainer.nodeValue.length) { - endContainer = splitText(endContainer, endOffset).previousSibling; - endOffset = endContainer.nodeValue.length; - } - } - return { - startContainer: startContainer, - startOffset: startOffset, - endContainer: endContainer, - endOffset: endOffset - }; - }; - - function RangeUtils(dom) { - var walk = function (rng, callback) { - return walk$1(dom, rng, callback); - }; - var split = split$1; - var normalize$1 = function (rng) { - return normalize(dom, rng).fold(never, function (normalizedRng) { - rng.setStart(normalizedRng.startContainer, normalizedRng.startOffset); - rng.setEnd(normalizedRng.endContainer, normalizedRng.endOffset); - return true; - }); - }; - return { - walk: walk, - split: split, - normalize: normalize$1 - }; - } - (function (RangeUtils) { - RangeUtils.compareRanges = isEq$1; - RangeUtils.getCaretRangeFromPoint = fromPoint$1; - RangeUtils.getSelectedNode = getSelectedNode; - RangeUtils.getNode = getNode; - }(RangeUtils || (RangeUtils = {}))); - var RangeUtils$1 = RangeUtils; - - function Dimension (name, getOffset) { - var set = function (element, h) { - if (!isNumber(h) && !h.match(/^[0-9]+$/)) { - throw new Error(name + '.set accepts only positive integer values. Value was ' + h); - } - var dom = element.dom; - if (isSupported$1(dom)) { - dom.style[name] = h + 'px'; - } - }; - var get = function (element) { - var r = getOffset(element); - if (r <= 0 || r === null) { - var css = get$5(element, name); - return parseFloat(css) || 0; - } - return r; - }; - var getOuter = get; - var aggregate = function (element, properties) { - return foldl(properties, function (acc, property) { - var val = get$5(element, property); - var value = val === undefined ? 0 : parseInt(val, 10); - return isNaN(value) ? acc : acc + value; - }, 0); - }; - var max = function (element, value, properties) { - var cumulativeInclusions = aggregate(element, properties); - var absoluteMax = value > cumulativeInclusions ? value - cumulativeInclusions : 0; - return absoluteMax; - }; - return { - set: set, - get: get, - getOuter: getOuter, - aggregate: aggregate, - max: max - }; - } - - var api$1 = Dimension('height', function (element) { - var dom = element.dom; - return inBody(element) ? dom.getBoundingClientRect().height : dom.offsetHeight; - }); - var get$9 = function (element) { - return api$1.get(element); - }; - - var walkUp = function (navigation, doc) { - var frame = navigation.view(doc); - return frame.fold(constant([]), function (f) { - var parent = navigation.owner(f); - var rest = walkUp(navigation, parent); - return [f].concat(rest); - }); - }; - var pathTo = function (element, navigation) { - var d = navigation.owner(element); - return walkUp(navigation, d); - }; - - var view = function (doc) { - var _a; - var element = doc.dom === document ? Optional.none() : Optional.from((_a = doc.dom.defaultView) === null || _a === void 0 ? void 0 : _a.frameElement); - return element.map(SugarElement.fromDom); - }; - var owner$1 = function (element) { - return documentOrOwner(element); - }; - - var Navigation = /*#__PURE__*/Object.freeze({ - __proto__: null, - view: view, - owner: owner$1 - }); - - var find$2 = function (element) { - var doc = SugarElement.fromDom(document); - var scroll = get$2(doc); - var frames = pathTo(element, Navigation); - var offset = viewport(element); - var r = foldr(frames, function (b, a) { - var loc = viewport(a); - return { - left: b.left + loc.left, - top: b.top + loc.top - }; - }, { - left: 0, - top: 0 - }); - return SugarPosition(r.left + offset.left + scroll.left, r.top + offset.top + scroll.top); - }; - - var excludeFromDescend = function (element) { - return name(element) === 'textarea'; - }; - var fireScrollIntoViewEvent = function (editor, data) { - var scrollEvent = editor.fire('ScrollIntoView', data); - return scrollEvent.isDefaultPrevented(); - }; - var fireAfterScrollIntoViewEvent = function (editor, data) { - editor.fire('AfterScrollIntoView', data); - }; - var descend = function (element, offset) { - var children$1 = children(element); - if (children$1.length === 0 || excludeFromDescend(element)) { - return { - element: element, - offset: offset - }; - } else if (offset < children$1.length && !excludeFromDescend(children$1[offset])) { - return { - element: children$1[offset], - offset: 0 - }; - } else { - var last = children$1[children$1.length - 1]; - if (excludeFromDescend(last)) { - return { - element: element, - offset: offset - }; - } else { - if (name(last) === 'img') { - return { - element: last, - offset: 1 - }; - } else if (isText(last)) { - return { - element: last, - offset: get$8(last).length - }; - } else { - return { - element: last, - offset: children(last).length - }; - } - } - } - }; - var markerInfo = function (element, cleanupFun) { - var pos = absolute(element); - var height = get$9(element); - return { - element: element, - bottom: pos.top + height, - height: height, - pos: pos, - cleanup: cleanupFun - }; - }; - var createMarker = function (element, offset) { - var startPoint = descend(element, offset); - var span = SugarElement.fromHtml('' + ZWSP + ''); - before(startPoint.element, span); - return markerInfo(span, function () { - return remove(span); - }); - }; - var elementMarker = function (element) { - return markerInfo(SugarElement.fromDom(element), noop); - }; - var withMarker = function (editor, f, rng, alignToTop) { - preserveWith(editor, function (_s, _e) { - return applyWithMarker(editor, f, rng, alignToTop); - }, rng); - }; - var withScrollEvents = function (editor, doc, f, marker, alignToTop) { - var data = { - elm: marker.element.dom, - alignToTop: alignToTop - }; - if (fireScrollIntoViewEvent(editor, data)) { - return; - } - var scrollTop = get$2(doc).top; - f(doc, scrollTop, marker, alignToTop); - fireAfterScrollIntoViewEvent(editor, data); - }; - var applyWithMarker = function (editor, f, rng, alignToTop) { - var body = SugarElement.fromDom(editor.getBody()); - var doc = SugarElement.fromDom(editor.getDoc()); - reflow(body); - var marker = createMarker(SugarElement.fromDom(rng.startContainer), rng.startOffset); - withScrollEvents(editor, doc, f, marker, alignToTop); - marker.cleanup(); - }; - var withElement = function (editor, element, f, alignToTop) { - var doc = SugarElement.fromDom(editor.getDoc()); - withScrollEvents(editor, doc, f, elementMarker(element), alignToTop); - }; - var preserveWith = function (editor, f, rng) { - var startElement = rng.startContainer; - var startOffset = rng.startOffset; - var endElement = rng.endContainer; - var endOffset = rng.endOffset; - f(SugarElement.fromDom(startElement), SugarElement.fromDom(endElement)); - var newRng = editor.dom.createRng(); - newRng.setStart(startElement, startOffset); - newRng.setEnd(endElement, endOffset); - editor.selection.setRng(rng); - }; - var scrollToMarker = function (marker, viewHeight, alignToTop, doc) { - var pos = marker.pos; - if (alignToTop) { - to(pos.left, pos.top, doc); - } else { - var y = pos.top - viewHeight + marker.height; - to(pos.left, y, doc); - } - }; - var intoWindowIfNeeded = function (doc, scrollTop, viewHeight, marker, alignToTop) { - var viewportBottom = viewHeight + scrollTop; - var markerTop = marker.pos.top; - var markerBottom = marker.bottom; - var largerThanViewport = markerBottom - markerTop >= viewHeight; - if (markerTop < scrollTop) { - scrollToMarker(marker, viewHeight, alignToTop !== false, doc); - } else if (markerTop > viewportBottom) { - var align = largerThanViewport ? alignToTop !== false : alignToTop === true; - scrollToMarker(marker, viewHeight, align, doc); - } else if (markerBottom > viewportBottom && !largerThanViewport) { - scrollToMarker(marker, viewHeight, alignToTop === true, doc); - } - }; - var intoWindow = function (doc, scrollTop, marker, alignToTop) { - var viewHeight = doc.dom.defaultView.innerHeight; - intoWindowIfNeeded(doc, scrollTop, viewHeight, marker, alignToTop); - }; - var intoFrame = function (doc, scrollTop, marker, alignToTop) { - var frameViewHeight = doc.dom.defaultView.innerHeight; - intoWindowIfNeeded(doc, scrollTop, frameViewHeight, marker, alignToTop); - var op = find$2(marker.element); - var viewportBounds = getBounds(window); - if (op.top < viewportBounds.y) { - intoView(marker.element, alignToTop !== false); - } else if (op.top > viewportBounds.bottom) { - intoView(marker.element, alignToTop === true); - } - }; - var rangeIntoWindow = function (editor, rng, alignToTop) { - return withMarker(editor, intoWindow, rng, alignToTop); - }; - var elementIntoWindow = function (editor, element, alignToTop) { - return withElement(editor, element, intoWindow, alignToTop); - }; - var rangeIntoFrame = function (editor, rng, alignToTop) { - return withMarker(editor, intoFrame, rng, alignToTop); - }; - var elementIntoFrame = function (editor, element, alignToTop) { - return withElement(editor, element, intoFrame, alignToTop); - }; - var scrollElementIntoView = function (editor, element, alignToTop) { - var scroller = editor.inline ? elementIntoWindow : elementIntoFrame; - scroller(editor, element, alignToTop); - }; - var scrollRangeIntoView = function (editor, rng, alignToTop) { - var scroller = editor.inline ? rangeIntoWindow : rangeIntoFrame; - scroller(editor, rng, alignToTop); - }; - - var getDocument = function () { - return SugarElement.fromDom(document); - }; - - var focus = function (element) { - return element.dom.focus(); - }; - var hasFocus = function (element) { - var root = getRootNode(element).dom; - return element.dom === root.activeElement; - }; - var active = function (root) { - if (root === void 0) { - root = getDocument(); - } - return Optional.from(root.dom.activeElement).map(SugarElement.fromDom); - }; - var search = function (element) { - return active(getRootNode(element)).filter(function (e) { - return element.dom.contains(e.dom); - }); - }; - - var create$4 = function (start, soffset, finish, foffset) { - return { - start: start, - soffset: soffset, - finish: finish, - foffset: foffset - }; - }; - var SimRange = { create: create$4 }; - - var adt = Adt.generate([ - { before: ['element'] }, - { - on: [ - 'element', - 'offset' - ] - }, - { after: ['element'] } - ]); - var cata = function (subject, onBefore, onOn, onAfter) { - return subject.fold(onBefore, onOn, onAfter); - }; - var getStart = function (situ) { - return situ.fold(identity, identity, identity); - }; - var before$3 = adt.before; - var on = adt.on; - var after$2 = adt.after; - var Situ = { - before: before$3, - on: on, - after: after$2, - cata: cata, - getStart: getStart - }; - - var adt$1 = Adt.generate([ - { domRange: ['rng'] }, - { - relative: [ - 'startSitu', - 'finishSitu' - ] - }, - { - exact: [ - 'start', - 'soffset', - 'finish', - 'foffset' - ] - } - ]); - var exactFromRange = function (simRange) { - return adt$1.exact(simRange.start, simRange.soffset, simRange.finish, simRange.foffset); - }; - var getStart$1 = function (selection) { - return selection.match({ - domRange: function (rng) { - return SugarElement.fromDom(rng.startContainer); - }, - relative: function (startSitu, _finishSitu) { - return Situ.getStart(startSitu); - }, - exact: function (start, _soffset, _finish, _foffset) { - return start; - } - }); - }; - var domRange = adt$1.domRange; - var relative = adt$1.relative; - var exact = adt$1.exact; - var getWin = function (selection) { - var start = getStart$1(selection); - return defaultView(start); - }; - var range = SimRange.create; - var SimSelection = { - domRange: domRange, - relative: relative, - exact: exact, - exactFromRange: exactFromRange, - getWin: getWin, - range: range - }; - - var browser$3 = detect$3().browser; - var clamp = function (offset, element) { - var max = isText(element) ? get$8(element).length : children(element).length + 1; - if (offset > max) { - return max; - } else if (offset < 0) { - return 0; - } - return offset; - }; - var normalizeRng = function (rng) { - return SimSelection.range(rng.start, clamp(rng.soffset, rng.start), rng.finish, clamp(rng.foffset, rng.finish)); - }; - var isOrContains = function (root, elm) { - return !isRestrictedNode(elm.dom) && (contains$2(root, elm) || eq$2(root, elm)); - }; - var isRngInRoot = function (root) { - return function (rng) { - return isOrContains(root, rng.start) && isOrContains(root, rng.finish); - }; - }; - var shouldStore = function (editor) { - return editor.inline === true || browser$3.isIE(); - }; - var nativeRangeToSelectionRange = function (r) { - return SimSelection.range(SugarElement.fromDom(r.startContainer), r.startOffset, SugarElement.fromDom(r.endContainer), r.endOffset); - }; - var readRange = function (win) { - var selection = win.getSelection(); - var rng = !selection || selection.rangeCount === 0 ? Optional.none() : Optional.from(selection.getRangeAt(0)); - return rng.map(nativeRangeToSelectionRange); - }; - var getBookmark$2 = function (root) { - var win = defaultView(root); - return readRange(win.dom).filter(isRngInRoot(root)); - }; - var validate = function (root, bookmark) { - return Optional.from(bookmark).filter(isRngInRoot(root)).map(normalizeRng); - }; - var bookmarkToNativeRng = function (bookmark) { - var rng = document.createRange(); - try { - rng.setStart(bookmark.start.dom, bookmark.soffset); - rng.setEnd(bookmark.finish.dom, bookmark.foffset); - return Optional.some(rng); - } catch (_) { - return Optional.none(); - } - }; - var store = function (editor) { - var newBookmark = shouldStore(editor) ? getBookmark$2(SugarElement.fromDom(editor.getBody())) : Optional.none(); - editor.bookmark = newBookmark.isSome() ? newBookmark : editor.bookmark; - }; - var storeNative = function (editor, rng) { - var root = SugarElement.fromDom(editor.getBody()); - var range = shouldStore(editor) ? Optional.from(rng) : Optional.none(); - var newBookmark = range.map(nativeRangeToSelectionRange).filter(isRngInRoot(root)); - editor.bookmark = newBookmark.isSome() ? newBookmark : editor.bookmark; - }; - var getRng = function (editor) { - var bookmark = editor.bookmark ? editor.bookmark : Optional.none(); - return bookmark.bind(function (x) { - return validate(SugarElement.fromDom(editor.getBody()), x); - }).bind(bookmarkToNativeRng); - }; - var restore = function (editor) { - getRng(editor).each(function (rng) { - return editor.selection.setRng(rng); - }); - }; - - var isEditorUIElement = function (elm) { - var className = elm.className.toString(); - return className.indexOf('tox-') !== -1 || className.indexOf('mce-') !== -1; - }; - var FocusManager = { isEditorUIElement: isEditorUIElement }; - - var isManualNodeChange = function (e) { - return e.type === 'nodechange' && e.selectionChange; - }; - var registerPageMouseUp = function (editor, throttledStore) { - var mouseUpPage = function () { - throttledStore.throttle(); - }; - DOMUtils$1.DOM.bind(document, 'mouseup', mouseUpPage); - editor.on('remove', function () { - DOMUtils$1.DOM.unbind(document, 'mouseup', mouseUpPage); - }); - }; - var registerFocusOut = function (editor) { - editor.on('focusout', function () { - store(editor); - }); - }; - var registerMouseUp = function (editor, throttledStore) { - editor.on('mouseup touchend', function (_e) { - throttledStore.throttle(); - }); - }; - var registerEditorEvents = function (editor, throttledStore) { - var browser = detect$3().browser; - if (browser.isIE()) { - registerFocusOut(editor); - } else { - registerMouseUp(editor, throttledStore); - } - editor.on('keyup NodeChange', function (e) { - if (!isManualNodeChange(e)) { - store(editor); - } - }); - }; - var register = function (editor) { - var throttledStore = first(function () { - store(editor); - }, 0); - editor.on('init', function () { - if (editor.inline) { - registerPageMouseUp(editor, throttledStore); - } - registerEditorEvents(editor, throttledStore); - }); - editor.on('remove', function () { - throttledStore.cancel(); - }); - }; - - var documentFocusInHandler; - var DOM$2 = DOMUtils$1.DOM; - var isEditorUIElement$1 = function (elm) { - return FocusManager.isEditorUIElement(elm); - }; - var isEditorContentAreaElement = function (elm) { - var classList = elm.classList; - if (classList !== undefined) { - return classList.contains('tox-edit-area') || classList.contains('tox-edit-area__iframe') || classList.contains('mce-content-body'); - } else { - return false; - } - }; - var isUIElement = function (editor, elm) { - var customSelector = getCustomUiSelector(editor); - var parent = DOM$2.getParent(elm, function (elm) { - return isEditorUIElement$1(elm) || (customSelector ? editor.dom.is(elm, customSelector) : false); - }); - return parent !== null; - }; - var getActiveElement = function (editor) { - try { - var root = getRootNode(SugarElement.fromDom(editor.getElement())); - return active(root).fold(function () { - return document.body; - }, function (x) { - return x.dom; - }); - } catch (ex) { - return document.body; - } - }; - var registerEvents = function (editorManager, e) { - var editor = e.editor; - register(editor); - editor.on('focusin', function () { - var self = this; - var focusedEditor = editorManager.focusedEditor; - if (focusedEditor !== self) { - if (focusedEditor) { - focusedEditor.fire('blur', { focusedEditor: self }); - } - editorManager.setActive(self); - editorManager.focusedEditor = self; - self.fire('focus', { blurredEditor: focusedEditor }); - self.focus(true); - } - }); - editor.on('focusout', function () { - var self = this; - Delay.setEditorTimeout(self, function () { - var focusedEditor = editorManager.focusedEditor; - if (!isUIElement(self, getActiveElement(self)) && focusedEditor === self) { - self.fire('blur', { focusedEditor: null }); - editorManager.focusedEditor = null; - } - }); - }); - if (!documentFocusInHandler) { - documentFocusInHandler = function (e) { - var activeEditor = editorManager.activeEditor; - if (activeEditor) { - getOriginalEventTarget(e).each(function (target) { - if (target.ownerDocument === document) { - if (target !== document.body && !isUIElement(activeEditor, target) && editorManager.focusedEditor === activeEditor) { - activeEditor.fire('blur', { focusedEditor: null }); - editorManager.focusedEditor = null; - } - } - }); - } - }; - DOM$2.bind(document, 'focusin', documentFocusInHandler); - } - }; - var unregisterDocumentEvents = function (editorManager, e) { - if (editorManager.focusedEditor === e.editor) { - editorManager.focusedEditor = null; - } - if (!editorManager.activeEditor) { - DOM$2.unbind(document, 'focusin', documentFocusInHandler); - documentFocusInHandler = null; - } - }; - var setup$2 = function (editorManager) { - editorManager.on('AddEditor', curry(registerEvents, editorManager)); - editorManager.on('RemoveEditor', curry(unregisterDocumentEvents, editorManager)); - }; - - var getContentEditableHost = function (editor, node) { - return editor.dom.getParent(node, function (node) { - return editor.dom.getContentEditable(node) === 'true'; - }); - }; - var getCollapsedNode = function (rng) { - return rng.collapsed ? Optional.from(getNode(rng.startContainer, rng.startOffset)).map(SugarElement.fromDom) : Optional.none(); - }; - var getFocusInElement = function (root, rng) { - return getCollapsedNode(rng).bind(function (node) { - if (isTableSection(node)) { - return Optional.some(node); - } else if (contains$2(root, node) === false) { - return Optional.some(root); - } else { - return Optional.none(); - } - }); - }; - var normalizeSelection = function (editor, rng) { - getFocusInElement(SugarElement.fromDom(editor.getBody()), rng).bind(function (elm) { - return firstPositionIn(elm.dom); - }).fold(function () { - editor.selection.normalize(); - return; - }, function (caretPos) { - return editor.selection.setRng(caretPos.toRange()); - }); - }; - var focusBody = function (body) { - if (body.setActive) { - try { - body.setActive(); - } catch (ex) { - body.focus(); - } - } else { - body.focus(); - } - }; - var hasElementFocus = function (elm) { - return hasFocus(elm) || search(elm).isSome(); - }; - var hasIframeFocus = function (editor) { - return editor.iframeElement && hasFocus(SugarElement.fromDom(editor.iframeElement)); - }; - var hasInlineFocus = function (editor) { - var rawBody = editor.getBody(); - return rawBody && hasElementFocus(SugarElement.fromDom(rawBody)); - }; - var hasUiFocus = function (editor) { - return active().filter(function (elem) { - return !isEditorContentAreaElement(elem.dom) && isUIElement(editor, elem.dom); - }).isSome(); - }; - var hasFocus$1 = function (editor) { - return editor.inline ? hasInlineFocus(editor) : hasIframeFocus(editor); - }; - var hasEditorOrUiFocus = function (editor) { - return hasFocus$1(editor) || hasUiFocus(editor); - }; - var focusEditor = function (editor) { - var selection = editor.selection; - var body = editor.getBody(); - var rng = selection.getRng(); - editor.quirks.refreshContentEditable(); - if (editor.bookmark !== undefined && hasFocus$1(editor) === false) { - getRng(editor).each(function (bookmarkRng) { - editor.selection.setRng(bookmarkRng); - rng = bookmarkRng; - }); - } - var contentEditableHost = getContentEditableHost(editor, selection.getNode()); - if (editor.$.contains(body, contentEditableHost)) { - focusBody(contentEditableHost); - normalizeSelection(editor, rng); - activateEditor(editor); - return; - } - if (!editor.inline) { - if (!Env.opera) { - focusBody(body); - } - editor.getWin().focus(); - } - if (Env.gecko || editor.inline) { - focusBody(body); - normalizeSelection(editor, rng); - } - activateEditor(editor); - }; - var activateEditor = function (editor) { - return editor.editorManager.setActive(editor); - }; - var focus$1 = function (editor, skipFocus) { - if (editor.removed) { - return; - } - skipFocus ? activateEditor(editor) : focusEditor(editor); - }; - - var getEndpointElement = function (root, rng, start, real, resolve) { - var container = start ? rng.startContainer : rng.endContainer; - var offset = start ? rng.startOffset : rng.endOffset; - return Optional.from(container).map(SugarElement.fromDom).map(function (elm) { - return !real || !rng.collapsed ? child(elm, resolve(elm, offset)).getOr(elm) : elm; - }).bind(function (elm) { - return isElement(elm) ? Optional.some(elm) : parent(elm).filter(isElement); - }).map(function (elm) { - return elm.dom; - }).getOr(root); - }; - var getStart$2 = function (root, rng, real) { - return getEndpointElement(root, rng, true, real, function (elm, offset) { - return Math.min(childNodesCount(elm), offset); - }); - }; - var getEnd = function (root, rng, real) { - return getEndpointElement(root, rng, false, real, function (elm, offset) { - return offset > 0 ? offset - 1 : offset; - }); - }; - var skipEmptyTextNodes = function (node, forwards) { - var orig = node; - while (node && isText$1(node) && node.length === 0) { - node = forwards ? node.nextSibling : node.previousSibling; - } - return node || orig; - }; - var getNode$1 = function (root, rng) { - var elm, startContainer, endContainer; - if (!rng) { - return root; - } - startContainer = rng.startContainer; - endContainer = rng.endContainer; - var startOffset = rng.startOffset; - var endOffset = rng.endOffset; - elm = rng.commonAncestorContainer; - if (!rng.collapsed) { - if (startContainer === endContainer) { - if (endOffset - startOffset < 2) { - if (startContainer.hasChildNodes()) { - elm = startContainer.childNodes[startOffset]; - } - } - } - if (startContainer.nodeType === 3 && endContainer.nodeType === 3) { - if (startContainer.length === startOffset) { - startContainer = skipEmptyTextNodes(startContainer.nextSibling, true); - } else { - startContainer = startContainer.parentNode; - } - if (endOffset === 0) { - endContainer = skipEmptyTextNodes(endContainer.previousSibling, false); - } else { - endContainer = endContainer.parentNode; - } - if (startContainer && startContainer === endContainer) { - return startContainer; - } - } - } - if (elm && elm.nodeType === 3) { - return elm.parentNode; - } - return elm; - }; - var getSelectedBlocks = function (dom, rng, startElm, endElm) { - var node; - var selectedBlocks = []; - var root = dom.getRoot(); - startElm = dom.getParent(startElm || getStart$2(root, rng, rng.collapsed), dom.isBlock); - endElm = dom.getParent(endElm || getEnd(root, rng, rng.collapsed), dom.isBlock); - if (startElm && startElm !== root) { - selectedBlocks.push(startElm); - } - if (startElm && endElm && startElm !== endElm) { - node = startElm; - var walker = new DomTreeWalker(startElm, root); - while ((node = walker.next()) && node !== endElm) { - if (dom.isBlock(node)) { - selectedBlocks.push(node); - } - } - } - if (endElm && startElm !== endElm && endElm !== root) { - selectedBlocks.push(endElm); - } - return selectedBlocks; - }; - var select$1 = function (dom, node, content) { - return Optional.from(node).map(function (node) { - var idx = dom.nodeIndex(node); - var rng = dom.createRng(); - rng.setStart(node.parentNode, idx); - rng.setEnd(node.parentNode, idx + 1); - if (content) { - moveEndPoint$1(dom, rng, node, true); - moveEndPoint$1(dom, rng, node, false); - } - return rng; - }); - }; - - var processRanges = function (editor, ranges) { - return map(ranges, function (range) { - var evt = editor.fire('GetSelectionRange', { range: range }); - return evt.range !== range ? evt.range : range; - }); - }; - - var ensureIsRoot = function (isRoot) { - return isFunction(isRoot) ? isRoot : never; - }; - var ancestor$3 = function (scope, transform, isRoot) { - var element = scope.dom; - var stop = ensureIsRoot(isRoot); - while (element.parentNode) { - element = element.parentNode; - var el = SugarElement.fromDom(element); - var transformed = transform(el); - if (transformed.isSome()) { - return transformed; - } else if (stop(el)) { - break; - } - } - return Optional.none(); - }; - var closest$2 = function (scope, transform, isRoot) { - var current = transform(scope); - var stop = ensureIsRoot(isRoot); - return current.orThunk(function () { - return stop(scope) ? Optional.none() : ancestor$3(scope, transform, stop); - }); - }; - - var isEq$2 = isEq; - var matchesUnInheritedFormatSelector = function (ed, node, name) { - var formatList = ed.formatter.get(name); - if (formatList) { - for (var i = 0; i < formatList.length; i++) { - if (formatList[i].inherit === false && ed.dom.is(node, formatList[i].selector)) { - return true; - } - } - } - return false; - }; - var matchParents = function (editor, node, name, vars) { - var root = editor.dom.getRoot(); - if (node === root) { - return false; - } - node = editor.dom.getParent(node, function (node) { - if (matchesUnInheritedFormatSelector(editor, node, name)) { - return true; - } - return node.parentNode === root || !!matchNode(editor, node, name, vars, true); - }); - return matchNode(editor, node, name, vars); - }; - var matchName = function (dom, node, format) { - if (isEq$2(node, format.inline)) { - return true; - } - if (isEq$2(node, format.block)) { - return true; - } - if (format.selector) { - return node.nodeType === 1 && dom.is(node, format.selector); - } - }; - var matchItems = function (dom, node, format, itemName, similar, vars) { - var key, value; - var items = format[itemName]; - var i; - if (format.onmatch) { - return format.onmatch(node, format, itemName); - } - if (items) { - if (typeof items.length === 'undefined') { - for (key in items) { - if (items.hasOwnProperty(key)) { - if (itemName === 'attributes') { - value = dom.getAttrib(node, key); - } else { - value = getStyle(dom, node, key); - } - if (similar && !value && !format.exact) { - return; - } - if ((!similar || format.exact) && !isEq$2(value, normalizeStyleValue(dom, replaceVars(items[key], vars), key))) { - return; - } - } - } - } else { - for (i = 0; i < items.length; i++) { - if (itemName === 'attributes' ? dom.getAttrib(node, items[i]) : getStyle(dom, node, items[i])) { - return format; - } - } - } - } - return format; - }; - var matchNode = function (ed, node, name, vars, similar) { - var formatList = ed.formatter.get(name); - var format, i, x, classes; - var dom = ed.dom; - if (formatList && node) { - for (i = 0; i < formatList.length; i++) { - format = formatList[i]; - if (matchName(ed.dom, node, format) && matchItems(dom, node, format, 'attributes', similar, vars) && matchItems(dom, node, format, 'styles', similar, vars)) { - if (classes = format.classes) { - for (x = 0; x < classes.length; x++) { - if (!ed.dom.hasClass(node, classes[x])) { - return; - } - } - } - return format; - } - } - } - }; - var match = function (editor, name, vars, node) { - if (node) { - return matchParents(editor, node, name, vars); - } - node = editor.selection.getNode(); - if (matchParents(editor, node, name, vars)) { - return true; - } - var startNode = editor.selection.getStart(); - if (startNode !== node) { - if (matchParents(editor, startNode, name, vars)) { - return true; - } - } - return false; - }; - var matchAll = function (editor, names, vars) { - var matchedFormatNames = []; - var checkedMap = {}; - var startElement = editor.selection.getStart(); - editor.dom.getParent(startElement, function (node) { - for (var i = 0; i < names.length; i++) { - var name_1 = names[i]; - if (!checkedMap[name_1] && matchNode(editor, node, name_1, vars)) { - checkedMap[name_1] = true; - matchedFormatNames.push(name_1); - } - } - }, editor.dom.getRoot()); - return matchedFormatNames; - }; - var closest$3 = function (editor, names) { - var isRoot = function (elm) { - return eq$2(elm, SugarElement.fromDom(editor.getBody())); - }; - var match = function (elm, name) { - return matchNode(editor, elm.dom, name) ? Optional.some(name) : Optional.none(); - }; - return Optional.from(editor.selection.getStart(true)).bind(function (rawElm) { - return closest$2(SugarElement.fromDom(rawElm), function (elm) { - return findMap(names, function (name) { - return match(elm, name); - }); - }, isRoot); - }).getOrNull(); - }; - var canApply = function (editor, name) { - var formatList = editor.formatter.get(name); - var startNode, parents, i, x, selector; - var dom = editor.dom; - if (formatList) { - startNode = editor.selection.getStart(); - parents = getParents$1(dom, startNode); - for (x = formatList.length - 1; x >= 0; x--) { - selector = formatList[x].selector; - if (!selector || formatList[x].defaultBlock) { - return true; - } - for (i = parents.length - 1; i >= 0; i--) { - if (dom.is(parents[i], selector)) { - return true; - } - } - } - } - return false; - }; - var matchAllOnNode = function (editor, node, formatNames) { - return foldl(formatNames, function (acc, name) { - var matchSimilar = isVariableFormatName(editor, name); - if (editor.formatter.matchNode(node, name, {}, matchSimilar)) { - return acc.concat([name]); - } else { - return acc; - } - }, []); - }; - - var typeLookup = { - '#text': 3, - '#comment': 8, - '#cdata': 4, - '#pi': 7, - '#doctype': 10, - '#document-fragment': 11 - }; - var walk$2 = function (node, root, prev) { - var startName = prev ? 'lastChild' : 'firstChild'; - var siblingName = prev ? 'prev' : 'next'; - if (node[startName]) { - return node[startName]; - } - if (node !== root) { - var sibling = node[siblingName]; - if (sibling) { - return sibling; - } - for (var parent_1 = node.parent; parent_1 && parent_1 !== root; parent_1 = parent_1.parent) { - sibling = parent_1[siblingName]; - if (sibling) { - return sibling; - } - } - } - }; - var isEmptyTextNode$1 = function (node) { - if (!isWhitespaceText(node.value)) { - return false; - } - var parentNode = node.parent; - if (parentNode && (parentNode.name !== 'span' || parentNode.attr('style')) && /^[ ]+$/.test(node.value)) { - return false; - } - return true; - }; - var isNonEmptyElement = function (node) { - var isNamedAnchor = node.name === 'a' && !node.attr('href') && node.attr('id'); - return node.attr('name') || node.attr('id') && !node.firstChild || node.attr('data-mce-bookmark') || isNamedAnchor; - }; - var AstNode = function () { - function AstNode(name, type) { - this.name = name; - this.type = type; - if (type === 1) { - this.attributes = []; - this.attributes.map = {}; - } - } - AstNode.create = function (name, attrs) { - var node = new AstNode(name, typeLookup[name] || 1); - if (attrs) { - each$1(attrs, function (value, attrName) { - node.attr(attrName, value); - }); - } - return node; - }; - AstNode.prototype.replace = function (node) { - var self = this; - if (node.parent) { - node.remove(); - } - self.insert(node, self); - self.remove(); - return self; - }; - AstNode.prototype.attr = function (name, value) { - var self = this; - var attrs; - if (typeof name !== 'string') { - if (name !== undefined && name !== null) { - each$1(name, function (value, key) { - self.attr(key, value); - }); - } - return self; - } - if (attrs = self.attributes) { - if (value !== undefined) { - if (value === null) { - if (name in attrs.map) { - delete attrs.map[name]; - var i = attrs.length; - while (i--) { - if (attrs[i].name === name) { - attrs.splice(i, 1); - return self; - } - } - } - return self; - } - if (name in attrs.map) { - var i = attrs.length; - while (i--) { - if (attrs[i].name === name) { - attrs[i].value = value; - break; - } - } - } else { - attrs.push({ - name: name, - value: value - }); - } - attrs.map[name] = value; - return self; - } - return attrs.map[name]; - } - }; - AstNode.prototype.clone = function () { - var self = this; - var clone = new AstNode(self.name, self.type); - var selfAttrs; - if (selfAttrs = self.attributes) { - var cloneAttrs = []; - cloneAttrs.map = {}; - for (var i = 0, l = selfAttrs.length; i < l; i++) { - var selfAttr = selfAttrs[i]; - if (selfAttr.name !== 'id') { - cloneAttrs[cloneAttrs.length] = { - name: selfAttr.name, - value: selfAttr.value - }; - cloneAttrs.map[selfAttr.name] = selfAttr.value; - } - } - clone.attributes = cloneAttrs; - } - clone.value = self.value; - clone.shortEnded = self.shortEnded; - return clone; - }; - AstNode.prototype.wrap = function (wrapper) { - var self = this; - self.parent.insert(wrapper, self); - wrapper.append(self); - return self; - }; - AstNode.prototype.unwrap = function () { - var self = this; - for (var node = self.firstChild; node;) { - var next = node.next; - self.insert(node, self, true); - node = next; - } - self.remove(); - }; - AstNode.prototype.remove = function () { - var self = this, parent = self.parent, next = self.next, prev = self.prev; - if (parent) { - if (parent.firstChild === self) { - parent.firstChild = next; - if (next) { - next.prev = null; - } - } else { - prev.next = next; - } - if (parent.lastChild === self) { - parent.lastChild = prev; - if (prev) { - prev.next = null; - } - } else { - next.prev = prev; - } - self.parent = self.next = self.prev = null; - } - return self; - }; - AstNode.prototype.append = function (node) { - var self = this; - if (node.parent) { - node.remove(); - } - var last = self.lastChild; - if (last) { - last.next = node; - node.prev = last; - self.lastChild = node; - } else { - self.lastChild = self.firstChild = node; - } - node.parent = self; - return node; - }; - AstNode.prototype.insert = function (node, refNode, before) { - if (node.parent) { - node.remove(); - } - var parent = refNode.parent || this; - if (before) { - if (refNode === parent.firstChild) { - parent.firstChild = node; - } else { - refNode.prev.next = node; - } - node.prev = refNode.prev; - node.next = refNode; - refNode.prev = node; - } else { - if (refNode === parent.lastChild) { - parent.lastChild = node; - } else { - refNode.next.prev = node; - } - node.next = refNode.next; - node.prev = refNode; - refNode.next = node; - } - node.parent = parent; - return node; - }; - AstNode.prototype.getAll = function (name) { - var self = this; - var collection = []; - for (var node = self.firstChild; node; node = walk$2(node, self)) { - if (node.name === name) { - collection.push(node); - } - } - return collection; - }; - AstNode.prototype.empty = function () { - var self = this; - if (self.firstChild) { - var nodes = []; - for (var node = self.firstChild; node; node = walk$2(node, self)) { - nodes.push(node); - } - var i = nodes.length; - while (i--) { - var node = nodes[i]; - node.parent = node.firstChild = node.lastChild = node.next = node.prev = null; - } - } - self.firstChild = self.lastChild = null; - return self; - }; - AstNode.prototype.isEmpty = function (elements, whitespace, predicate) { - if (whitespace === void 0) { - whitespace = {}; - } - var self = this; - var node = self.firstChild; - if (isNonEmptyElement(self)) { - return false; - } - if (node) { - do { - if (node.type === 1) { - if (node.attr('data-mce-bogus')) { - continue; - } - if (elements[node.name]) { - return false; - } - if (isNonEmptyElement(node)) { - return false; - } - } - if (node.type === 8) { - return false; - } - if (node.type === 3 && !isEmptyTextNode$1(node)) { - return false; - } - if (node.type === 3 && node.parent && whitespace[node.parent.name] && isWhitespaceText(node.value)) { - return false; - } - if (predicate && predicate(node)) { - return false; - } - } while (node = walk$2(node, self)); - } - return true; - }; - AstNode.prototype.walk = function (prev) { - return walk$2(this, null, prev); - }; - return AstNode; - }(); - - var makeMap$3 = Tools.makeMap; - var Writer = function (settings) { - var html = []; - settings = settings || {}; - var indent = settings.indent; - var indentBefore = makeMap$3(settings.indent_before || ''); - var indentAfter = makeMap$3(settings.indent_after || ''); - var encode = Entities.getEncodeFunc(settings.entity_encoding || 'raw', settings.entities); - var htmlOutput = settings.element_format === 'html'; - return { - start: function (name, attrs, empty) { - var i, l, attr, value; - if (indent && indentBefore[name] && html.length > 0) { - value = html[html.length - 1]; - if (value.length > 0 && value !== '\n') { - html.push('\n'); - } - } - html.push('<', name); - if (attrs) { - for (i = 0, l = attrs.length; i < l; i++) { - attr = attrs[i]; - html.push(' ', attr.name, '="', encode(attr.value, true), '"'); - } - } - if (!empty || htmlOutput) { - html[html.length] = '>'; - } else { - html[html.length] = ' />'; - } - if (empty && indent && indentAfter[name] && html.length > 0) { - value = html[html.length - 1]; - if (value.length > 0 && value !== '\n') { - html.push('\n'); - } - } - }, - end: function (name) { - var value; - html.push(''); - if (indent && indentAfter[name] && html.length > 0) { - value = html[html.length - 1]; - if (value.length > 0 && value !== '\n') { - html.push('\n'); - } - } - }, - text: function (text, raw) { - if (text.length > 0) { - html[html.length] = raw ? text : encode(text); - } - }, - cdata: function (text) { - html.push(''); - }, - comment: function (text) { - html.push(''); - }, - pi: function (name, text) { - if (text) { - html.push(''); - } else { - html.push(''); - } - if (indent) { - html.push('\n'); - } - }, - doctype: function (text) { - html.push('', indent ? '\n' : ''); - }, - reset: function () { - html.length = 0; - }, - getContent: function () { - return html.join('').replace(/\n$/, ''); - } - }; - }; - - var HtmlSerializer = function (settings, schema) { - if (schema === void 0) { - schema = Schema(); - } - var writer = Writer(settings); - settings = settings || {}; - settings.validate = 'validate' in settings ? settings.validate : true; - var serialize = function (node) { - var validate = settings.validate; - var handlers = { - 3: function (node) { - writer.text(node.value, node.raw); - }, - 8: function (node) { - writer.comment(node.value); - }, - 7: function (node) { - writer.pi(node.name, node.value); - }, - 10: function (node) { - writer.doctype(node.value); - }, - 4: function (node) { - writer.cdata(node.value); - }, - 11: function (node) { - if (node = node.firstChild) { - do { - walk(node); - } while (node = node.next); - } - } - }; - writer.reset(); - var walk = function (node) { - var handler = handlers[node.type]; - var name, isEmpty, attrs, attrName, attrValue, sortedAttrs, i, l, elementRule; - if (!handler) { - name = node.name; - isEmpty = node.shortEnded; - attrs = node.attributes; - if (validate && attrs && attrs.length > 1) { - sortedAttrs = []; - sortedAttrs.map = {}; - elementRule = schema.getElementRule(node.name); - if (elementRule) { - for (i = 0, l = elementRule.attributesOrder.length; i < l; i++) { - attrName = elementRule.attributesOrder[i]; - if (attrName in attrs.map) { - attrValue = attrs.map[attrName]; - sortedAttrs.map[attrName] = attrValue; - sortedAttrs.push({ - name: attrName, - value: attrValue - }); - } - } - for (i = 0, l = attrs.length; i < l; i++) { - attrName = attrs[i].name; - if (!(attrName in sortedAttrs.map)) { - attrValue = attrs.map[attrName]; - sortedAttrs.map[attrName] = attrValue; - sortedAttrs.push({ - name: attrName, - value: attrValue - }); - } - } - attrs = sortedAttrs; - } - } - writer.start(node.name, attrs, isEmpty); - if (!isEmpty) { - if (node = node.firstChild) { - do { - walk(node); - } while (node = node.next); - } - writer.end(name); - } - } else { - handler(node); - } - }; - if (node.type === 1 && !settings.inner) { - walk(node); - } else { - handlers[11](node); - } - return writer.getContent(); - }; - return { serialize: serialize }; - }; - - var extractBase64DataUris = function (html) { - var dataImageUri = /data:[^;]+;base64,([a-z0-9\+\/=]+)/gi; - var chunks = []; - var uris = {}; - var prefix = generate$1('img'); - var matches; - var index = 0; - var count = 0; - while (matches = dataImageUri.exec(html)) { - var uri = matches[0]; - var imageId = prefix + '_' + count++; - uris[imageId] = uri; - if (index < matches.index) { - chunks.push(html.substr(index, matches.index - index)); - } - chunks.push(imageId); - index = matches.index + uri.length; - } - if (index === 0) { - return { - prefix: prefix, - uris: uris, - html: html - }; - } else { - if (index < html.length) { - chunks.push(html.substr(index)); - } - return { - prefix: prefix, - uris: uris, - html: chunks.join('') - }; - } - }; - var restoreDataUris = function (html, result) { - return html.replace(new RegExp(result.prefix + '_[0-9]+', 'g'), function (imageId) { - return get$1(result.uris, imageId).getOr(imageId); - }); - }; - var parseDataUri = function (uri) { - var matches = /data:([^;]+);base64,([a-z0-9\+\/=]+)/i.exec(uri); - if (matches) { - return Optional.some({ - type: matches[1], - data: decodeURIComponent(matches[2]) - }); - } else { - return Optional.none(); - } - }; - - var safeSvgDataUrlElements = [ - 'img', - 'video' - ]; - var isValidPrefixAttrName = function (name) { - return name.indexOf('data-') === 0 || name.indexOf('aria-') === 0; - }; - var blockSvgDataUris = function (allowSvgDataUrls, tagName) { - var allowed = isNullable(allowSvgDataUrls) ? contains(safeSvgDataUrlElements, tagName) : allowSvgDataUrls; - return !allowed; - }; - var isInvalidUri = function (settings, uri, tagName) { - if (settings.allow_html_data_urls) { - return false; - } else if (/^data:image\//i.test(uri)) { - return blockSvgDataUris(settings.allow_svg_data_urls, tagName) && /^data:image\/svg\+xml/i.test(uri); - } else { - return /^data:/i.test(uri); - } - }; - var findEndTagIndex = function (schema, html, startIndex) { - var count = 1, index, matches; - var shortEndedElements = schema.getShortEndedElements(); - var tokenRegExp = /<([!?\/])?([A-Za-z0-9\-_\:\.]+)((?:\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\/|\s+)>/g; - tokenRegExp.lastIndex = index = startIndex; - while (matches = tokenRegExp.exec(html)) { - index = tokenRegExp.lastIndex; - if (matches[1] === '/') { - count--; - } else if (!matches[1]) { - if (matches[2] in shortEndedElements) { - continue; - } - count++; - } - if (count === 0) { - break; - } - } - return index; - }; - var isConditionalComment = function (html, startIndex) { - return /^\s*\[if [\w\W]+\]>.*/.test(html.substr(startIndex)); - }; - var findCommentEndIndex = function (html, isBogus, startIndex) { - if (startIndex === void 0) { - startIndex = 0; - } - var lcHtml = html.toLowerCase(); - if (lcHtml.indexOf('[if ', startIndex) !== -1 && isConditionalComment(lcHtml, startIndex)) { - var endIfIndex = lcHtml.indexOf('[endif]', startIndex); - return lcHtml.indexOf('>', endIfIndex); - } else { - if (isBogus) { - var endIndex = lcHtml.indexOf('>', startIndex); - return endIndex !== -1 ? endIndex : lcHtml.length; - } else { - var endCommentRegexp = /--!?>/; - endCommentRegexp.lastIndex = startIndex; - var match = endCommentRegexp.exec(html); - return match ? match.index + match[0].length : lcHtml.length; - } - } - }; - var checkBogusAttribute = function (regExp, attrString) { - var matches = regExp.exec(attrString); - if (matches) { - var name_1 = matches[1]; - var value = matches[2]; - return typeof name_1 === 'string' && name_1.toLowerCase() === 'data-mce-bogus' ? value : null; - } else { - return null; - } - }; - function SaxParser(settings, schema) { - if (schema === void 0) { - schema = Schema(); - } - var noop = function () { - }; - settings = settings || {}; - if (settings.fix_self_closing !== false) { - settings.fix_self_closing = true; - } - var comment = settings.comment ? settings.comment : noop; - var cdata = settings.cdata ? settings.cdata : noop; - var text = settings.text ? settings.text : noop; - var start = settings.start ? settings.start : noop; - var end = settings.end ? settings.end : noop; - var pi = settings.pi ? settings.pi : noop; - var doctype = settings.doctype ? settings.doctype : noop; - var parseInternal = function (base64Extract, format) { - if (format === void 0) { - format = 'html'; - } - var html = base64Extract.html; - var matches, index = 0, value, endRegExp; - var stack = []; - var attrList, i, textData, name; - var isInternalElement, isShortEnded; - var elementRule, isValidElement, attr, attribsValue, validAttributesMap, validAttributePatterns; - var attributesRequired, attributesDefault, attributesForced; - var anyAttributesRequired, attrValue, idCount = 0; - var decode = Entities.decode; - var filteredUrlAttrs = Tools.makeMap('src,href,data,background,formaction,poster,xlink:href'); - var scriptUriRegExp = /((java|vb)script|mhtml):/i; - var parsingMode = format === 'html' ? 0 : 1; - var processEndTag = function (name) { - var pos, i; - pos = stack.length; - while (pos--) { - if (stack[pos].name === name) { - break; - } - } - if (pos >= 0) { - for (i = stack.length - 1; i >= pos; i--) { - name = stack[i]; - if (name.valid) { - end(name.name); - } - } - stack.length = pos; - } - }; - var processText = function (value, raw) { - return text(restoreDataUris(value, base64Extract), raw); - }; - var processComment = function (value) { - if (value === '') { - return; - } - if (value.charAt(0) === '>') { - value = ' ' + value; - } - if (!settings.allow_conditional_comments && value.substr(0, 3).toLowerCase() === '[if') { - value = ' ' + value; - } - comment(restoreDataUris(value, base64Extract)); - }; - var processAttr = function (value) { - return get$1(base64Extract.uris, value).getOr(value); - }; - var processMalformedComment = function (value, startIndex) { - var startTag = value || ''; - var isBogus = !startsWith(startTag, '--'); - var endIndex = findCommentEndIndex(html, isBogus, startIndex); - value = html.substr(startIndex, endIndex - startIndex); - processComment(isBogus ? startTag + value : value); - return endIndex + 1; - }; - var parseAttribute = function (tagName, name, value, val2, val3) { - var attrRule, i; - var trimRegExp = /[\s\u0000-\u001F]+/g; - name = name.toLowerCase(); - value = processAttr(name in fillAttrsMap ? name : decode(value || val2 || val3 || '')); - if (validate && !isInternalElement && isValidPrefixAttrName(name) === false) { - attrRule = validAttributesMap[name]; - if (!attrRule && validAttributePatterns) { - i = validAttributePatterns.length; - while (i--) { - attrRule = validAttributePatterns[i]; - if (attrRule.pattern.test(name)) { - break; - } - } - if (i === -1) { - attrRule = null; - } - } - if (!attrRule) { - return; - } - if (attrRule.validValues && !(value in attrRule.validValues)) { - return; - } - } - if (filteredUrlAttrs[name] && !settings.allow_script_urls) { - var uri = value.replace(trimRegExp, ''); - try { - uri = decodeURIComponent(uri); - } catch (ex) { - uri = unescape(uri); - } - if (scriptUriRegExp.test(uri)) { - return; - } - if (isInvalidUri(settings, uri, tagName)) { - return; - } - } - if (isInternalElement && (name in filteredUrlAttrs || name.indexOf('on') === 0)) { - return; - } - attrList.map[name] = value; - attrList.push({ - name: name, - value: value - }); - }; - var tokenRegExp = new RegExp('<(?:' + '(?:!--([\\w\\W]*?)--!?>)|' + '(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|' + '(?:![Dd][Oo][Cc][Tt][Yy][Pp][Ee]([\\w\\W]*?)>)|' + '(?:!(--)?)|' + '(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|' + '(?:\\/([A-Za-z][A-Za-z0-9\\-_\\:\\.]*)>)|' + '(?:([A-Za-z][A-Za-z0-9\\-_\\:\\.]*)((?:\\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\\/|\\s+)>)' + ')', 'g'); - var attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g; - var shortEndedElements = schema.getShortEndedElements(); - var selfClosing = settings.self_closing_elements || schema.getSelfClosingElements(); - var fillAttrsMap = schema.getBoolAttrs(); - var validate = settings.validate; - var removeInternalElements = settings.remove_internals; - var fixSelfClosing = settings.fix_self_closing; - var specialElements = schema.getSpecialElements(); - var processHtml = html + '>'; - while (matches = tokenRegExp.exec(processHtml)) { - var matchText = matches[0]; - if (index < matches.index) { - processText(decode(html.substr(index, matches.index - index))); - } - if (value = matches[7]) { - value = value.toLowerCase(); - if (value.charAt(0) === ':') { - value = value.substr(1); - } - processEndTag(value); - } else if (value = matches[8]) { - if (matches.index + matchText.length > html.length) { - processText(decode(html.substr(matches.index))); - index = matches.index + matchText.length; - continue; - } - value = value.toLowerCase(); - if (value.charAt(0) === ':') { - value = value.substr(1); - } - isShortEnded = value in shortEndedElements; - if (fixSelfClosing && selfClosing[value] && stack.length > 0 && stack[stack.length - 1].name === value) { - processEndTag(value); - } - var bogusValue = checkBogusAttribute(attrRegExp, matches[9]); - if (bogusValue !== null) { - if (bogusValue === 'all') { - index = findEndTagIndex(schema, html, tokenRegExp.lastIndex); - tokenRegExp.lastIndex = index; - continue; - } - isValidElement = false; - } - if (!validate || (elementRule = schema.getElementRule(value))) { - isValidElement = true; - if (validate) { - validAttributesMap = elementRule.attributes; - validAttributePatterns = elementRule.attributePatterns; - } - if (attribsValue = matches[9]) { - isInternalElement = attribsValue.indexOf('data-mce-type') !== -1; - if (isInternalElement && removeInternalElements) { - isValidElement = false; - } - attrList = []; - attrList.map = {}; - attribsValue.replace(attrRegExp, function (match, name, val, val2, val3) { - parseAttribute(value, name, val, val2, val3); - return ''; - }); - } else { - attrList = []; - attrList.map = {}; - } - if (validate && !isInternalElement) { - attributesRequired = elementRule.attributesRequired; - attributesDefault = elementRule.attributesDefault; - attributesForced = elementRule.attributesForced; - anyAttributesRequired = elementRule.removeEmptyAttrs; - if (anyAttributesRequired && !attrList.length) { - isValidElement = false; - } - if (attributesForced) { - i = attributesForced.length; - while (i--) { - attr = attributesForced[i]; - name = attr.name; - attrValue = attr.value; - if (attrValue === '{$uid}') { - attrValue = 'mce_' + idCount++; - } - attrList.map[name] = attrValue; - attrList.push({ - name: name, - value: attrValue - }); - } - } - if (attributesDefault) { - i = attributesDefault.length; - while (i--) { - attr = attributesDefault[i]; - name = attr.name; - if (!(name in attrList.map)) { - attrValue = attr.value; - if (attrValue === '{$uid}') { - attrValue = 'mce_' + idCount++; - } - attrList.map[name] = attrValue; - attrList.push({ - name: name, - value: attrValue - }); - } - } - } - if (attributesRequired) { - i = attributesRequired.length; - while (i--) { - if (attributesRequired[i] in attrList.map) { - break; - } - } - if (i === -1) { - isValidElement = false; - } - } - if (attr = attrList.map['data-mce-bogus']) { - if (attr === 'all') { - index = findEndTagIndex(schema, html, tokenRegExp.lastIndex); - tokenRegExp.lastIndex = index; - continue; - } - isValidElement = false; - } - } - if (isValidElement) { - start(value, attrList, isShortEnded); - } - } else { - isValidElement = false; - } - if (endRegExp = specialElements[value]) { - endRegExp.lastIndex = index = matches.index + matchText.length; - if (matches = endRegExp.exec(html)) { - if (isValidElement) { - textData = html.substr(index, matches.index - index); - } - index = matches.index + matches[0].length; - } else { - textData = html.substr(index); - index = html.length; - } - if (isValidElement) { - if (textData.length > 0) { - processText(textData, true); - } - end(value); - } - tokenRegExp.lastIndex = index; - continue; - } - if (!isShortEnded) { - if (!attribsValue || attribsValue.indexOf('/') !== attribsValue.length - 1) { - stack.push({ - name: value, - valid: isValidElement - }); - } else if (isValidElement) { - end(value); - } - } - } else if (value = matches[1]) { - processComment(value); - } else if (value = matches[2]) { - var isValidCdataSection = parsingMode === 1 || settings.preserve_cdata || stack.length > 0 && schema.isValidChild(stack[stack.length - 1].name, '#cdata'); - if (isValidCdataSection) { - cdata(value); - } else { - index = processMalformedComment('', matches.index + 2); - tokenRegExp.lastIndex = index; - continue; - } - } else if (value = matches[3]) { - doctype(value); - } else if ((value = matches[4]) || matchText === '= 0; i--) { - value = stack[i]; - if (value.valid) { - end(value.name); - } - } - }; - var parse = function (html, format) { - if (format === void 0) { - format = 'html'; - } - parseInternal(extractBase64DataUris(html), format); - }; - return { parse: parse }; - } - (function (SaxParser) { - SaxParser.findEndTag = findEndTagIndex; - }(SaxParser || (SaxParser = {}))); - var SaxParser$1 = SaxParser; - - var trimHtml = function (tempAttrs, html) { - var trimContentRegExp = new RegExp(['\\s?(' + tempAttrs.join('|') + ')="[^"]+"'].join('|'), 'gi'); - return html.replace(trimContentRegExp, ''); - }; - var trimInternal = function (serializer, html) { - var content = html; - var bogusAllRegExp = /<(\w+) [^>]*data-mce-bogus="all"[^>]*>/g; - var endTagIndex, index, matchLength, matches; - var schema = serializer.schema; - content = trimHtml(serializer.getTempAttrs(), content); - var shortEndedElements = schema.getShortEndedElements(); - while (matches = bogusAllRegExp.exec(content)) { - index = bogusAllRegExp.lastIndex; - matchLength = matches[0].length; - if (shortEndedElements[matches[1]]) { - endTagIndex = index; - } else { - endTagIndex = SaxParser$1.findEndTag(schema, content, index); - } - content = content.substring(0, index - matchLength) + content.substring(endTagIndex); - bogusAllRegExp.lastIndex = index - matchLength; - } - return trim$2(content); - }; - var trimExternal = trimInternal; - - var trimEmptyContents = function (editor, html) { - var blockName = getForcedRootBlock(editor); - var emptyRegExp = new RegExp('^(<' + blockName + '[^>]*>( | |\\s|\xA0|
                                      |)<\\/' + blockName + '>[\r\n]*|
                                      [\r\n]*)$'); - return html.replace(emptyRegExp, ''); - }; - var getContentFromBody = function (editor, args, format, body) { - var content; - args.format = format; - args.get = true; - args.getInner = true; - if (!args.no_events) { - editor.fire('BeforeGetContent', args); - } - if (args.format === 'raw') { - content = Tools.trim(trimExternal(editor.serializer, body.innerHTML)); - } else if (args.format === 'text') { - content = editor.dom.isEmpty(body) ? '' : trim$2(body.innerText || body.textContent); - } else if (args.format === 'tree') { - content = editor.serializer.serialize(body, args); - } else { - content = trimEmptyContents(editor, editor.serializer.serialize(body, args)); - } - if (!contains([ - 'text', - 'tree' - ], args.format) && !isWsPreserveElement(SugarElement.fromDom(body))) { - args.content = Tools.trim(content); - } else { - args.content = content; - } - if (!args.no_events) { - editor.fire('GetContent', args); - } - return args.content; - }; - var getContentInternal = function (editor, args, format) { - return Optional.from(editor.getBody()).fold(constant(args.format === 'tree' ? new AstNode('body', 11) : ''), function (body) { - return getContentFromBody(editor, args, format, body); - }); - }; - - var each$7 = Tools.each; - var ElementUtils = function (dom) { - this.compare = function (node1, node2) { - if (node1.nodeName !== node2.nodeName) { - return false; - } - var getAttribs = function (node) { - var attribs = {}; - each$7(dom.getAttribs(node), function (attr) { - var name = attr.nodeName.toLowerCase(); - if (name.indexOf('_') !== 0 && name !== 'style' && name.indexOf('data-') !== 0) { - attribs[name] = dom.getAttrib(node, name); - } - }); - return attribs; - }; - var compareObjects = function (obj1, obj2) { - var value, name; - for (name in obj1) { - if (obj1.hasOwnProperty(name)) { - value = obj2[name]; - if (typeof value === 'undefined') { - return false; - } - if (obj1[name] !== value) { - return false; - } - delete obj2[name]; - } - } - for (name in obj2) { - if (obj2.hasOwnProperty(name)) { - return false; - } - } - return true; - }; - if (!compareObjects(getAttribs(node1), getAttribs(node2))) { - return false; - } - if (!compareObjects(dom.parseStyle(dom.getAttrib(node1, 'style')), dom.parseStyle(dom.getAttrib(node2, 'style')))) { - return false; - } - return !isBookmarkNode$1(node1) && !isBookmarkNode$1(node2); - }; - }; - - var isChar = function (forward, predicate, pos) { - return Optional.from(pos.container()).filter(isText$1).exists(function (text) { - var delta = forward ? 0 : -1; - return predicate(text.data.charAt(pos.offset() + delta)); - }); - }; - var isBeforeSpace = curry(isChar, true, isWhiteSpace$1); - var isAfterSpace = curry(isChar, false, isWhiteSpace$1); - var isEmptyText = function (pos) { - var container = pos.container(); - return isText$1(container) && (container.data.length === 0 || isZwsp$1(container.data) && BookmarkManager$1.isBookmarkNode(container.parentNode)); - }; - var matchesElementPosition = function (before, predicate) { - return function (pos) { - return Optional.from(getChildNodeAtRelativeOffset(before ? 0 : -1, pos)).filter(predicate).isSome(); - }; - }; - var isImageBlock = function (node) { - return isImg(node) && get$5(SugarElement.fromDom(node), 'display') === 'block'; - }; - var isCefNode = function (node) { - return isContentEditableFalse(node) && !isBogusAll(node); - }; - var isBeforeImageBlock = matchesElementPosition(true, isImageBlock); - var isAfterImageBlock = matchesElementPosition(false, isImageBlock); - var isBeforeMedia = matchesElementPosition(true, isMedia); - var isAfterMedia = matchesElementPosition(false, isMedia); - var isBeforeTable = matchesElementPosition(true, isTable); - var isAfterTable = matchesElementPosition(false, isTable); - var isBeforeContentEditableFalse = matchesElementPosition(true, isCefNode); - var isAfterContentEditableFalse = matchesElementPosition(false, isCefNode); - - var getLastChildren$1 = function (elm) { - var children = []; - var rawNode = elm.dom; - while (rawNode) { - children.push(SugarElement.fromDom(rawNode)); - rawNode = rawNode.lastChild; - } - return children; - }; - var removeTrailingBr = function (elm) { - var allBrs = descendants$1(elm, 'br'); - var brs = filter(getLastChildren$1(elm).slice(-1), isBr$1); - if (allBrs.length === brs.length) { - each(brs, remove); - } - }; - var fillWithPaddingBr = function (elm) { - empty(elm); - append(elm, SugarElement.fromHtml('
                                      ')); - }; - var trimBlockTrailingBr = function (elm) { - lastChild(elm).each(function (lastChild) { - prevSibling(lastChild).each(function (lastChildPrevSibling) { - if (isBlock(elm) && isBr$1(lastChild) && isBlock(lastChildPrevSibling)) { - remove(lastChild); - } - }); - }); - }; - - var dropLast = function (xs) { - return xs.slice(0, -1); - }; - var parentsUntil$1 = function (start, root, predicate) { - if (contains$2(root, start)) { - return dropLast(parents(start, function (elm) { - return predicate(elm) || eq$2(elm, root); - })); - } else { - return []; - } - }; - var parents$1 = function (start, root) { - return parentsUntil$1(start, root, never); - }; - var parentsAndSelf = function (start, root) { - return [start].concat(parents$1(start, root)); - }; - - var navigateIgnoreEmptyTextNodes = function (forward, root, from) { - return navigateIgnore(forward, root, from, isEmptyText); - }; - var getClosestBlock = function (root, pos) { - return find(parentsAndSelf(SugarElement.fromDom(pos.container()), root), isBlock); - }; - var isAtBeforeAfterBlockBoundary = function (forward, root, pos) { - return navigateIgnoreEmptyTextNodes(forward, root.dom, pos).forall(function (newPos) { - return getClosestBlock(root, pos).fold(function () { - return isInSameBlock(newPos, pos, root.dom) === false; - }, function (fromBlock) { - return isInSameBlock(newPos, pos, root.dom) === false && contains$2(fromBlock, SugarElement.fromDom(newPos.container())); - }); - }); - }; - var isAtBlockBoundary$1 = function (forward, root, pos) { - return getClosestBlock(root, pos).fold(function () { - return navigateIgnoreEmptyTextNodes(forward, root.dom, pos).forall(function (newPos) { - return isInSameBlock(newPos, pos, root.dom) === false; - }); - }, function (parent) { - return navigateIgnoreEmptyTextNodes(forward, parent.dom, pos).isNone(); - }); - }; - var isAtStartOfBlock = curry(isAtBlockBoundary$1, false); - var isAtEndOfBlock = curry(isAtBlockBoundary$1, true); - var isBeforeBlock = curry(isAtBeforeAfterBlockBoundary, false); - var isAfterBlock = curry(isAtBeforeAfterBlockBoundary, true); - - var isBr$5 = function (pos) { - return getElementFromPosition(pos).exists(isBr$1); - }; - var findBr = function (forward, root, pos) { - var parentBlocks = filter(parentsAndSelf(SugarElement.fromDom(pos.container()), root), isBlock); - var scope = head(parentBlocks).getOr(root); - return fromPosition(forward, scope.dom, pos).filter(isBr$5); - }; - var isBeforeBr = function (root, pos) { - return getElementFromPosition(pos).exists(isBr$1) || findBr(true, root, pos).isSome(); - }; - var isAfterBr = function (root, pos) { - return getElementFromPrevPosition(pos).exists(isBr$1) || findBr(false, root, pos).isSome(); - }; - var findPreviousBr = curry(findBr, false); - var findNextBr = curry(findBr, true); - - var isInMiddleOfText = function (pos) { - return CaretPosition.isTextPosition(pos) && !pos.isAtStart() && !pos.isAtEnd(); - }; - var getClosestBlock$1 = function (root, pos) { - var parentBlocks = filter(parentsAndSelf(SugarElement.fromDom(pos.container()), root), isBlock); - return head(parentBlocks).getOr(root); - }; - var hasSpaceBefore = function (root, pos) { - if (isInMiddleOfText(pos)) { - return isAfterSpace(pos); - } else { - return isAfterSpace(pos) || prevPosition(getClosestBlock$1(root, pos).dom, pos).exists(isAfterSpace); - } - }; - var hasSpaceAfter = function (root, pos) { - if (isInMiddleOfText(pos)) { - return isBeforeSpace(pos); - } else { - return isBeforeSpace(pos) || nextPosition(getClosestBlock$1(root, pos).dom, pos).exists(isBeforeSpace); - } - }; - var isPreValue = function (value) { - return contains([ - 'pre', - 'pre-wrap' - ], value); - }; - var isInPre = function (pos) { - return getElementFromPosition(pos).bind(function (elm) { - return closest(elm, isElement); - }).exists(function (elm) { - return isPreValue(get$5(elm, 'white-space')); - }); - }; - var isAtBeginningOfBody = function (root, pos) { - return prevPosition(root.dom, pos).isNone(); - }; - var isAtEndOfBody = function (root, pos) { - return nextPosition(root.dom, pos).isNone(); - }; - var isAtLineBoundary = function (root, pos) { - return isAtBeginningOfBody(root, pos) || isAtEndOfBody(root, pos) || isAtStartOfBlock(root, pos) || isAtEndOfBlock(root, pos) || isAfterBr(root, pos) || isBeforeBr(root, pos); - }; - var needsToHaveNbsp = function (root, pos) { - if (isInPre(pos)) { - return false; - } else { - return isAtLineBoundary(root, pos) || hasSpaceBefore(root, pos) || hasSpaceAfter(root, pos); - } - }; - var needsToBeNbspLeft = function (root, pos) { - if (isInPre(pos)) { - return false; - } else { - return isAtStartOfBlock(root, pos) || isBeforeBlock(root, pos) || isAfterBr(root, pos) || hasSpaceBefore(root, pos); - } - }; - var leanRight = function (pos) { - var container = pos.container(); - var offset = pos.offset(); - if (isText$1(container) && offset < container.data.length) { - return CaretPosition(container, offset + 1); - } else { - return pos; - } - }; - var needsToBeNbspRight = function (root, pos) { - if (isInPre(pos)) { - return false; - } else { - return isAtEndOfBlock(root, pos) || isAfterBlock(root, pos) || isBeforeBr(root, pos) || hasSpaceAfter(root, pos); - } - }; - var needsToBeNbsp = function (root, pos) { - return needsToBeNbspLeft(root, pos) || needsToBeNbspRight(root, leanRight(pos)); - }; - var isNbspAt = function (text, offset) { - return isNbsp(text.charAt(offset)); - }; - var hasNbsp = function (pos) { - var container = pos.container(); - return isText$1(container) && contains$1(container.data, nbsp); - }; - var normalizeNbspMiddle = function (text) { - var chars = text.split(''); - return map(chars, function (chr, i) { - if (isNbsp(chr) && i > 0 && i < chars.length - 1 && isContent$1(chars[i - 1]) && isContent$1(chars[i + 1])) { - return ' '; - } else { - return chr; - } - }).join(''); - }; - var normalizeNbspAtStart = function (root, node) { - var text = node.data; - var firstPos = CaretPosition(node, 0); - if (isNbspAt(text, 0) && !needsToBeNbsp(root, firstPos)) { - node.data = ' ' + text.slice(1); - return true; - } else { - return false; - } - }; - var normalizeNbspInMiddleOfTextNode = function (node) { - var text = node.data; - var newText = normalizeNbspMiddle(text); - if (newText !== text) { - node.data = newText; - return true; - } else { - return false; - } - }; - var normalizeNbspAtEnd = function (root, node) { - var text = node.data; - var lastPos = CaretPosition(node, text.length - 1); - if (isNbspAt(text, text.length - 1) && !needsToBeNbsp(root, lastPos)) { - node.data = text.slice(0, -1) + ' '; - return true; - } else { - return false; - } - }; - var normalizeNbsps = function (root, pos) { - return Optional.some(pos).filter(hasNbsp).bind(function (pos) { - var container = pos.container(); - var normalized = normalizeNbspAtStart(root, container) || normalizeNbspInMiddleOfTextNode(container) || normalizeNbspAtEnd(root, container); - return normalized ? Optional.some(pos) : Optional.none(); - }); - }; - var normalizeNbspsInEditor = function (editor) { - var root = SugarElement.fromDom(editor.getBody()); - if (editor.selection.isCollapsed()) { - normalizeNbsps(root, CaretPosition.fromRangeStart(editor.selection.getRng())).each(function (pos) { - editor.selection.setRng(pos.toRange()); - }); - } - }; - - var normalizeContent = function (content, isStartOfContent, isEndOfContent) { - var result = foldl(content, function (acc, c) { - if (isWhiteSpace$1(c) || isNbsp(c)) { - if (acc.previousCharIsSpace || acc.str === '' && isStartOfContent || acc.str.length === content.length - 1 && isEndOfContent) { - return { - previousCharIsSpace: false, - str: acc.str + nbsp - }; - } else { - return { - previousCharIsSpace: true, - str: acc.str + ' ' - }; - } - } else { - return { - previousCharIsSpace: false, - str: acc.str + c - }; - } - }, { - previousCharIsSpace: false, - str: '' - }); - return result.str; - }; - var normalize$1 = function (node, offset, count) { - if (count === 0) { - return; - } - var elm = SugarElement.fromDom(node); - var root = ancestor(elm, isBlock).getOr(elm); - var whitespace = node.data.slice(offset, offset + count); - var isEndOfContent = offset + count >= node.data.length && needsToBeNbspRight(root, CaretPosition$1(node, node.data.length)); - var isStartOfContent = offset === 0 && needsToBeNbspLeft(root, CaretPosition$1(node, 0)); - node.replaceData(offset, count, normalizeContent(whitespace, isStartOfContent, isEndOfContent)); - }; - var normalizeWhitespaceAfter = function (node, offset) { - var content = node.data.slice(offset); - var whitespaceCount = content.length - lTrim(content).length; - return normalize$1(node, offset, whitespaceCount); - }; - var normalizeWhitespaceBefore = function (node, offset) { - var content = node.data.slice(0, offset); - var whitespaceCount = content.length - rTrim(content).length; - return normalize$1(node, offset - whitespaceCount, whitespaceCount); - }; - var mergeTextNodes = function (prevNode, nextNode, normalizeWhitespace, mergeToPrev) { - if (mergeToPrev === void 0) { - mergeToPrev = true; - } - var whitespaceOffset = rTrim(prevNode.data).length; - var newNode = mergeToPrev ? prevNode : nextNode; - var removeNode = mergeToPrev ? nextNode : prevNode; - if (mergeToPrev) { - newNode.appendData(removeNode.data); - } else { - newNode.insertData(0, removeNode.data); - } - remove(SugarElement.fromDom(removeNode)); - if (normalizeWhitespace) { - normalizeWhitespaceAfter(newNode, whitespaceOffset); - } - return newNode; - }; - - var needsReposition = function (pos, elm) { - var container = pos.container(); - var offset = pos.offset(); - return CaretPosition$1.isTextPosition(pos) === false && container === elm.parentNode && offset > CaretPosition$1.before(elm).offset(); - }; - var reposition = function (elm, pos) { - return needsReposition(pos, elm) ? CaretPosition$1(pos.container(), pos.offset() - 1) : pos; - }; - var beforeOrStartOf = function (node) { - return isText$1(node) ? CaretPosition$1(node, 0) : CaretPosition$1.before(node); - }; - var afterOrEndOf = function (node) { - return isText$1(node) ? CaretPosition$1(node, node.data.length) : CaretPosition$1.after(node); - }; - var getPreviousSiblingCaretPosition = function (elm) { - if (isCaretCandidate(elm.previousSibling)) { - return Optional.some(afterOrEndOf(elm.previousSibling)); - } else { - return elm.previousSibling ? lastPositionIn(elm.previousSibling) : Optional.none(); - } - }; - var getNextSiblingCaretPosition = function (elm) { - if (isCaretCandidate(elm.nextSibling)) { - return Optional.some(beforeOrStartOf(elm.nextSibling)); - } else { - return elm.nextSibling ? firstPositionIn(elm.nextSibling) : Optional.none(); - } - }; - var findCaretPositionBackwardsFromElm = function (rootElement, elm) { - var startPosition = CaretPosition$1.before(elm.previousSibling ? elm.previousSibling : elm.parentNode); - return prevPosition(rootElement, startPosition).fold(function () { - return nextPosition(rootElement, CaretPosition$1.after(elm)); - }, Optional.some); - }; - var findCaretPositionForwardsFromElm = function (rootElement, elm) { - return nextPosition(rootElement, CaretPosition$1.after(elm)).fold(function () { - return prevPosition(rootElement, CaretPosition$1.before(elm)); - }, Optional.some); - }; - var findCaretPositionBackwards = function (rootElement, elm) { - return getPreviousSiblingCaretPosition(elm).orThunk(function () { - return getNextSiblingCaretPosition(elm); - }).orThunk(function () { - return findCaretPositionBackwardsFromElm(rootElement, elm); - }); - }; - var findCaretPositionForward = function (rootElement, elm) { - return getNextSiblingCaretPosition(elm).orThunk(function () { - return getPreviousSiblingCaretPosition(elm); - }).orThunk(function () { - return findCaretPositionForwardsFromElm(rootElement, elm); - }); - }; - var findCaretPosition$1 = function (forward, rootElement, elm) { - return forward ? findCaretPositionForward(rootElement, elm) : findCaretPositionBackwards(rootElement, elm); - }; - var findCaretPosOutsideElmAfterDelete = function (forward, rootElement, elm) { - return findCaretPosition$1(forward, rootElement, elm).map(curry(reposition, elm)); - }; - var setSelection = function (editor, forward, pos) { - pos.fold(function () { - editor.focus(); - }, function (pos) { - editor.selection.setRng(pos.toRange(), forward); - }); - }; - var eqRawNode = function (rawNode) { - return function (elm) { - return elm.dom === rawNode; - }; - }; - var isBlock$2 = function (editor, elm) { - return elm && has(editor.schema.getBlockElements(), name(elm)); - }; - var paddEmptyBlock = function (elm) { - if (isEmpty(elm)) { - var br = SugarElement.fromHtml('
                                      '); - empty(elm); - append(elm, br); - return Optional.some(CaretPosition$1.before(br.dom)); - } else { - return Optional.none(); - } - }; - var deleteNormalized = function (elm, afterDeletePosOpt, normalizeWhitespace) { - var prevTextOpt = prevSibling(elm).filter(isText); - var nextTextOpt = nextSibling(elm).filter(isText); - remove(elm); - return lift3(prevTextOpt, nextTextOpt, afterDeletePosOpt, function (prev, next, pos) { - var prevNode = prev.dom, nextNode = next.dom; - var offset = prevNode.data.length; - mergeTextNodes(prevNode, nextNode, normalizeWhitespace); - return pos.container() === nextNode ? CaretPosition$1(prevNode, offset) : pos; - }).orThunk(function () { - if (normalizeWhitespace) { - prevTextOpt.each(function (elm) { - return normalizeWhitespaceBefore(elm.dom, elm.dom.length); - }); - nextTextOpt.each(function (elm) { - return normalizeWhitespaceAfter(elm.dom, 0); - }); - } - return afterDeletePosOpt; - }); - }; - var isInlineElement = function (editor, element) { - return has(editor.schema.getTextInlineElements(), name(element)); - }; - var deleteElement = function (editor, forward, elm, moveCaret) { - if (moveCaret === void 0) { - moveCaret = true; - } - var afterDeletePos = findCaretPosOutsideElmAfterDelete(forward, editor.getBody(), elm.dom); - var parentBlock = ancestor(elm, curry(isBlock$2, editor), eqRawNode(editor.getBody())); - var normalizedAfterDeletePos = deleteNormalized(elm, afterDeletePos, isInlineElement(editor, elm)); - if (editor.dom.isEmpty(editor.getBody())) { - editor.setContent(''); - editor.selection.setCursorLocation(); - } else { - parentBlock.bind(paddEmptyBlock).fold(function () { - if (moveCaret) { - setSelection(editor, forward, normalizedAfterDeletePos); - } - }, function (paddPos) { - if (moveCaret) { - setSelection(editor, forward, Optional.some(paddPos)); - } - }); - } - }; - - var tableCellRng = function (start, end) { - return { - start: start, - end: end - }; - }; - var tableSelection = function (rng, table, cells) { - return { - rng: rng, - table: table, - cells: cells - }; - }; - var deleteAction = Adt.generate([ - { removeTable: ['element'] }, - { emptyCells: ['cells'] }, - { - deleteCellSelection: [ - 'rng', - 'cell' - ] - } - ]); - var isRootFromElement = function (root) { - return function (cur) { - return eq$2(root, cur); - }; - }; - var getClosestCell = function (container, isRoot) { - return closest$1(SugarElement.fromDom(container), 'td,th', isRoot); - }; - var getClosestTable = function (cell, isRoot) { - return ancestor$1(cell, 'table', isRoot); - }; - var isExpandedCellRng = function (cellRng) { - return !eq$2(cellRng.start, cellRng.end); - }; - var getTableFromCellRng = function (cellRng, isRoot) { - return getClosestTable(cellRng.start, isRoot).bind(function (startParentTable) { - return getClosestTable(cellRng.end, isRoot).bind(function (endParentTable) { - return someIf(eq$2(startParentTable, endParentTable), startParentTable); - }); - }); - }; - var isSingleCellTable = function (cellRng, isRoot) { - return !isExpandedCellRng(cellRng) && getTableFromCellRng(cellRng, isRoot).exists(function (table) { - var rows = table.dom.rows; - return rows.length === 1 && rows[0].cells.length === 1; - }); - }; - var getTableCells = function (table) { - return descendants$1(table, 'td,th'); - }; - var getCellRng = function (rng, isRoot) { - var startCell = getClosestCell(rng.startContainer, isRoot); - var endCell = getClosestCell(rng.endContainer, isRoot); - return lift2(startCell, endCell, tableCellRng); - }; - var getCellRangeFromStartTable = function (cellRng, isRoot) { - return getClosestTable(cellRng.start, isRoot).bind(function (table) { - return last(getTableCells(table)).map(function (endCell) { - return tableCellRng(cellRng.start, endCell); - }); - }); - }; - var partialSelection = function (isRoot, rng) { - var startCell = getClosestCell(rng.startContainer, isRoot); - var endCell = getClosestCell(rng.endContainer, isRoot); - return rng.collapsed ? Optional.none() : lift2(startCell, endCell, tableCellRng).fold(function () { - return startCell.fold(function () { - return endCell.bind(function (endCell) { - return getClosestTable(endCell, isRoot).bind(function (table) { - return head(getTableCells(table)).map(function (startCell) { - return tableCellRng(startCell, endCell); - }); - }); - }); - }, function (startCell) { - return getClosestTable(startCell, isRoot).bind(function (table) { - return last(getTableCells(table)).map(function (endCell) { - return tableCellRng(startCell, endCell); - }); - }); - }); - }, function (cellRng) { - return isWithinSameTable(isRoot, cellRng) ? Optional.none() : getCellRangeFromStartTable(cellRng, isRoot); - }); - }; - var isWithinSameTable = function (isRoot, cellRng) { - return getTableFromCellRng(cellRng, isRoot).isSome(); - }; - var getTableSelectionFromCellRng = function (cellRng, isRoot) { - return getTableFromCellRng(cellRng, isRoot).map(function (table) { - return tableSelection(cellRng, table, getTableCells(table)); - }); - }; - var getTableSelection = function (optCellRng, rng, isRoot) { - return optCellRng.filter(function (cellRng) { - return isExpandedCellRng(cellRng) && isWithinSameTable(isRoot, cellRng); - }).orThunk(function () { - return partialSelection(isRoot, rng); - }).bind(function (cRng) { - return getTableSelectionFromCellRng(cRng, isRoot); - }); - }; - var getCellIndex = function (cells, cell) { - return findIndex(cells, function (x) { - return eq$2(x, cell); - }); - }; - var getSelectedCells = function (tableSelection) { - return lift2(getCellIndex(tableSelection.cells, tableSelection.rng.start), getCellIndex(tableSelection.cells, tableSelection.rng.end), function (startIndex, endIndex) { - return tableSelection.cells.slice(startIndex, endIndex + 1); - }); - }; - var isSingleCellTableContentSelected = function (optCellRng, rng, isRoot) { - return optCellRng.filter(function (cellRng) { - return isSingleCellTable(cellRng, isRoot) && hasAllContentsSelected(cellRng.start, rng); - }).map(function (cellRng) { - return cellRng.start; - }); - }; - var getAction = function (tableSelection) { - return getSelectedCells(tableSelection).map(function (selected) { - var cells = tableSelection.cells; - return selected.length === cells.length ? deleteAction.removeTable(tableSelection.table) : deleteAction.emptyCells(selected); - }); - }; - var getActionFromRange = function (root, rng) { - var isRoot = isRootFromElement(root); - var optCellRng = getCellRng(rng, isRoot); - return isSingleCellTableContentSelected(optCellRng, rng, isRoot).map(function (cell) { - return deleteAction.deleteCellSelection(rng, cell); - }).orThunk(function () { - return getTableSelection(optCellRng, rng, isRoot).bind(getAction); - }); - }; - - var freefallRtl = function (root) { - var child = isComment(root) ? prevSibling(root) : lastChild(root); - return child.bind(freefallRtl).orThunk(function () { - return Optional.some(root); - }); - }; - var emptyCells = function (editor, cells) { - each(cells, fillWithPaddingBr); - editor.selection.setCursorLocation(cells[0].dom, 0); - return true; - }; - var deleteCellContents = function (editor, rng, cell) { - rng.deleteContents(); - var lastNode = freefallRtl(cell).getOr(cell); - var lastBlock = SugarElement.fromDom(editor.dom.getParent(lastNode.dom, editor.dom.isBlock)); - if (isEmpty(lastBlock)) { - fillWithPaddingBr(lastBlock); - editor.selection.setCursorLocation(lastBlock.dom, 0); - } - if (!eq$2(cell, lastBlock)) { - var additionalCleanupNodes = parent(lastBlock).is(cell) ? [] : siblings(lastBlock); - each(additionalCleanupNodes.concat(children(cell)), function (node) { - if (!eq$2(node, lastBlock) && !contains$2(node, lastBlock)) { - remove(node); - } - }); - } - return true; - }; - var deleteTableElement = function (editor, table) { - deleteElement(editor, false, table); - return true; - }; - var deleteCellRange = function (editor, rootElm, rng) { - return getActionFromRange(rootElm, rng).map(function (action) { - return action.fold(curry(deleteTableElement, editor), curry(emptyCells, editor), curry(deleteCellContents, editor)); - }); - }; - var deleteCaptionRange = function (editor, caption) { - return emptyElement(editor, caption); - }; - var deleteTableRange = function (editor, rootElm, rng, startElm) { - return getParentCaption(rootElm, startElm).fold(function () { - return deleteCellRange(editor, rootElm, rng); - }, function (caption) { - return deleteCaptionRange(editor, caption); - }).getOr(false); - }; - var deleteRange = function (editor, startElm) { - var rootNode = SugarElement.fromDom(editor.getBody()); - var rng = editor.selection.getRng(); - var selectedCells = getCellsFromEditor(editor); - return selectedCells.length !== 0 ? emptyCells(editor, selectedCells) : deleteTableRange(editor, rootNode, rng, startElm); - }; - var getParentCell = function (rootElm, elm) { - return find(parentsAndSelf(elm, rootElm), isTableCell$1); - }; - var getParentCaption = function (rootElm, elm) { - return find(parentsAndSelf(elm, rootElm), function (elm) { - return name(elm) === 'caption'; - }); - }; - var deleteBetweenCells = function (editor, rootElm, forward, fromCell, from) { - return navigate(forward, editor.getBody(), from).bind(function (to) { - return getParentCell(rootElm, SugarElement.fromDom(to.getNode())).map(function (toCell) { - return eq$2(toCell, fromCell) === false; - }); - }); - }; - var emptyElement = function (editor, elm) { - fillWithPaddingBr(elm); - editor.selection.setCursorLocation(elm.dom, 0); - return Optional.some(true); - }; - var isDeleteOfLastCharPos = function (fromCaption, forward, from, to) { - return firstPositionIn(fromCaption.dom).bind(function (first) { - return lastPositionIn(fromCaption.dom).map(function (last) { - return forward ? from.isEqual(first) && to.isEqual(last) : from.isEqual(last) && to.isEqual(first); - }); - }).getOr(true); - }; - var emptyCaretCaption = function (editor, elm) { - return emptyElement(editor, elm); - }; - var validateCaretCaption = function (rootElm, fromCaption, to) { - return getParentCaption(rootElm, SugarElement.fromDom(to.getNode())).map(function (toCaption) { - return eq$2(toCaption, fromCaption) === false; - }); - }; - var deleteCaretInsideCaption = function (editor, rootElm, forward, fromCaption, from) { - return navigate(forward, editor.getBody(), from).bind(function (to) { - return isDeleteOfLastCharPos(fromCaption, forward, from, to) ? emptyCaretCaption(editor, fromCaption) : validateCaretCaption(rootElm, fromCaption, to); - }).or(Optional.some(true)); - }; - var deleteCaretCells = function (editor, forward, rootElm, startElm) { - var from = CaretPosition$1.fromRangeStart(editor.selection.getRng()); - return getParentCell(rootElm, startElm).bind(function (fromCell) { - return isEmpty(fromCell) ? emptyElement(editor, fromCell) : deleteBetweenCells(editor, rootElm, forward, fromCell, from); - }).getOr(false); - }; - var deleteCaretCaption = function (editor, forward, rootElm, fromCaption) { - var from = CaretPosition$1.fromRangeStart(editor.selection.getRng()); - return isEmpty(fromCaption) ? emptyElement(editor, fromCaption) : deleteCaretInsideCaption(editor, rootElm, forward, fromCaption, from); - }; - var isNearTable = function (forward, pos) { - return forward ? isBeforeTable(pos) : isAfterTable(pos); - }; - var isBeforeOrAfterTable = function (editor, forward) { - var fromPos = CaretPosition$1.fromRangeStart(editor.selection.getRng()); - return isNearTable(forward, fromPos) || fromPosition(forward, editor.getBody(), fromPos).exists(function (pos) { - return isNearTable(forward, pos); - }); - }; - var deleteCaret = function (editor, forward, startElm) { - var rootElm = SugarElement.fromDom(editor.getBody()); - return getParentCaption(rootElm, startElm).fold(function () { - return deleteCaretCells(editor, forward, rootElm, startElm) || isBeforeOrAfterTable(editor, forward); - }, function (fromCaption) { - return deleteCaretCaption(editor, forward, rootElm, fromCaption).getOr(false); - }); - }; - var backspaceDelete = function (editor, forward) { - var startElm = SugarElement.fromDom(editor.selection.getStart(true)); - var cells = getCellsFromEditor(editor); - return editor.selection.isCollapsed() && cells.length === 0 ? deleteCaret(editor, forward, startElm) : deleteRange(editor, startElm); - }; - - var createRange$1 = function (sc, so, ec, eo) { - var rng = document.createRange(); - rng.setStart(sc, so); - rng.setEnd(ec, eo); - return rng; - }; - var normalizeBlockSelectionRange = function (rng) { - var startPos = CaretPosition$1.fromRangeStart(rng); - var endPos = CaretPosition$1.fromRangeEnd(rng); - var rootNode = rng.commonAncestorContainer; - return fromPosition(false, rootNode, endPos).map(function (newEndPos) { - if (!isInSameBlock(startPos, endPos, rootNode) && isInSameBlock(startPos, newEndPos, rootNode)) { - return createRange$1(startPos.container(), startPos.offset(), newEndPos.container(), newEndPos.offset()); - } else { - return rng; - } - }).getOr(rng); - }; - var normalize$2 = function (rng) { - return rng.collapsed ? rng : normalizeBlockSelectionRange(rng); - }; - - var hasOnlyOneChild = function (node) { - return node.firstChild && node.firstChild === node.lastChild; - }; - var isPaddingNode = function (node) { - return node.name === 'br' || node.value === nbsp; - }; - var isPaddedEmptyBlock = function (schema, node) { - var blockElements = schema.getBlockElements(); - return blockElements[node.name] && hasOnlyOneChild(node) && isPaddingNode(node.firstChild); - }; - var isEmptyFragmentElement = function (schema, node) { - var nonEmptyElements = schema.getNonEmptyElements(); - return node && (node.isEmpty(nonEmptyElements) || isPaddedEmptyBlock(schema, node)); - }; - var isListFragment = function (schema, fragment) { - var firstChild = fragment.firstChild; - var lastChild = fragment.lastChild; - if (firstChild && firstChild.name === 'meta') { - firstChild = firstChild.next; - } - if (lastChild && lastChild.attr('id') === 'mce_marker') { - lastChild = lastChild.prev; - } - if (isEmptyFragmentElement(schema, lastChild)) { - lastChild = lastChild.prev; - } - if (!firstChild || firstChild !== lastChild) { - return false; - } - return firstChild.name === 'ul' || firstChild.name === 'ol'; - }; - var cleanupDomFragment = function (domFragment) { - var firstChild = domFragment.firstChild; - var lastChild = domFragment.lastChild; - if (firstChild && firstChild.nodeName === 'META') { - firstChild.parentNode.removeChild(firstChild); - } - if (lastChild && lastChild.id === 'mce_marker') { - lastChild.parentNode.removeChild(lastChild); - } - return domFragment; - }; - var toDomFragment = function (dom, serializer, fragment) { - var html = serializer.serialize(fragment); - var domFragment = dom.createFragment(html); - return cleanupDomFragment(domFragment); - }; - var listItems$1 = function (elm) { - return Tools.grep(elm.childNodes, function (child) { - return child.nodeName === 'LI'; - }); - }; - var isPadding = function (node) { - return node.data === nbsp || isBr(node); - }; - var isListItemPadded = function (node) { - return node && node.firstChild && node.firstChild === node.lastChild && isPadding(node.firstChild); - }; - var isEmptyOrPadded = function (elm) { - return !elm.firstChild || isListItemPadded(elm); - }; - var trimListItems = function (elms) { - return elms.length > 0 && isEmptyOrPadded(elms[elms.length - 1]) ? elms.slice(0, -1) : elms; - }; - var getParentLi = function (dom, node) { - var parentBlock = dom.getParent(node, dom.isBlock); - return parentBlock && parentBlock.nodeName === 'LI' ? parentBlock : null; - }; - var isParentBlockLi = function (dom, node) { - return !!getParentLi(dom, node); - }; - var getSplit = function (parentNode, rng) { - var beforeRng = rng.cloneRange(); - var afterRng = rng.cloneRange(); - beforeRng.setStartBefore(parentNode); - afterRng.setEndAfter(parentNode); - return [ - beforeRng.cloneContents(), - afterRng.cloneContents() - ]; - }; - var findFirstIn = function (node, rootNode) { - var caretPos = CaretPosition$1.before(node); - var caretWalker = CaretWalker(rootNode); - var newCaretPos = caretWalker.next(caretPos); - return newCaretPos ? newCaretPos.toRange() : null; - }; - var findLastOf = function (node, rootNode) { - var caretPos = CaretPosition$1.after(node); - var caretWalker = CaretWalker(rootNode); - var newCaretPos = caretWalker.prev(caretPos); - return newCaretPos ? newCaretPos.toRange() : null; - }; - var insertMiddle = function (target, elms, rootNode, rng) { - var parts = getSplit(target, rng); - var parentElm = target.parentNode; - parentElm.insertBefore(parts[0], target); - Tools.each(elms, function (li) { - parentElm.insertBefore(li, target); - }); - parentElm.insertBefore(parts[1], target); - parentElm.removeChild(target); - return findLastOf(elms[elms.length - 1], rootNode); - }; - var insertBefore = function (target, elms, rootNode) { - var parentElm = target.parentNode; - Tools.each(elms, function (elm) { - parentElm.insertBefore(elm, target); - }); - return findFirstIn(target, rootNode); - }; - var insertAfter = function (target, elms, rootNode, dom) { - dom.insertAfter(elms.reverse(), target); - return findLastOf(elms[0], rootNode); - }; - var insertAtCaret = function (serializer, dom, rng, fragment) { - var domFragment = toDomFragment(dom, serializer, fragment); - var liTarget = getParentLi(dom, rng.startContainer); - var liElms = trimListItems(listItems$1(domFragment.firstChild)); - var BEGINNING = 1, END = 2; - var rootNode = dom.getRoot(); - var isAt = function (location) { - var caretPos = CaretPosition$1.fromRangeStart(rng); - var caretWalker = CaretWalker(dom.getRoot()); - var newPos = location === BEGINNING ? caretWalker.prev(caretPos) : caretWalker.next(caretPos); - return newPos ? getParentLi(dom, newPos.getNode()) !== liTarget : true; - }; - if (isAt(BEGINNING)) { - return insertBefore(liTarget, liElms, rootNode); - } else if (isAt(END)) { - return insertAfter(liTarget, liElms, rootNode, dom); - } - return insertMiddle(liTarget, liElms, rootNode, rng); - }; - - var trimOrPadLeftRight = function (dom, rng, html) { - var root = SugarElement.fromDom(dom.getRoot()); - if (needsToBeNbspLeft(root, CaretPosition$1.fromRangeStart(rng))) { - html = html.replace(/^ /, ' '); - } else { - html = html.replace(/^ /, ' '); - } - if (needsToBeNbspRight(root, CaretPosition$1.fromRangeEnd(rng))) { - html = html.replace(/( | )()?$/, ' '); - } else { - html = html.replace(/ ()?$/, ' '); - } - return html; - }; - - var isTableCell$4 = isTableCell; - var isTableCellContentSelected = function (dom, rng, cell) { - if (cell !== null) { - var endCell = dom.getParent(rng.endContainer, isTableCell$4); - return cell === endCell && hasAllContentsSelected(SugarElement.fromDom(cell), rng); - } else { - return false; - } - }; - var validInsertion = function (editor, value, parentNode) { - if (parentNode.getAttribute('data-mce-bogus') === 'all') { - parentNode.parentNode.insertBefore(editor.dom.createFragment(value), parentNode); - } else { - var node = parentNode.firstChild; - var node2 = parentNode.lastChild; - if (!node || node === node2 && node.nodeName === 'BR') { - editor.dom.setHTML(parentNode, value); - } else { - editor.selection.setContent(value); - } - } - }; - var trimBrsFromTableCell = function (dom, elm) { - Optional.from(dom.getParent(elm, 'td,th')).map(SugarElement.fromDom).each(trimBlockTrailingBr); - }; - var reduceInlineTextElements = function (editor, merge) { - var textInlineElements = editor.schema.getTextInlineElements(); - var dom = editor.dom; - if (merge) { - var root_1 = editor.getBody(), elementUtils_1 = new ElementUtils(dom); - Tools.each(dom.select('*[data-mce-fragment]'), function (node) { - for (var testNode = node.parentNode; testNode && testNode !== root_1; testNode = testNode.parentNode) { - if (textInlineElements[node.nodeName.toLowerCase()] && elementUtils_1.compare(testNode, node)) { - dom.remove(node, true); - } - } - }); - } - }; - var markFragmentElements = function (fragment) { - var node = fragment; - while (node = node.walk()) { - if (node.type === 1) { - node.attr('data-mce-fragment', '1'); - } - } - }; - var unmarkFragmentElements = function (elm) { - Tools.each(elm.getElementsByTagName('*'), function (elm) { - elm.removeAttribute('data-mce-fragment'); - }); - }; - var isPartOfFragment = function (node) { - return !!node.getAttribute('data-mce-fragment'); - }; - var canHaveChildren = function (editor, node) { - return node && !editor.schema.getShortEndedElements()[node.nodeName]; - }; - var moveSelectionToMarker = function (editor, marker) { - var nextRng; - var dom = editor.dom, selection = editor.selection; - var node2; - var getContentEditableFalseParent = function (node) { - var root = editor.getBody(); - for (; node && node !== root; node = node.parentNode) { - if (dom.getContentEditable(node) === 'false') { - return node; - } - } - return null; - }; - if (!marker) { - return; - } - selection.scrollIntoView(marker); - var parentEditableFalseElm = getContentEditableFalseParent(marker); - if (parentEditableFalseElm) { - dom.remove(marker); - selection.select(parentEditableFalseElm); - return; - } - var rng = dom.createRng(); - var node = marker.previousSibling; - if (node && node.nodeType === 3) { - rng.setStart(node, node.nodeValue.length); - if (!Env.ie) { - node2 = marker.nextSibling; - if (node2 && node2.nodeType === 3) { - node.appendData(node2.data); - node2.parentNode.removeChild(node2); - } - } - } else { - rng.setStartBefore(marker); - rng.setEndBefore(marker); - } - var findNextCaretRng = function (rng) { - var caretPos = CaretPosition$1.fromRangeStart(rng); - var caretWalker = CaretWalker(editor.getBody()); - caretPos = caretWalker.next(caretPos); - if (caretPos) { - return caretPos.toRange(); - } - }; - var parentBlock = dom.getParent(marker, dom.isBlock); - dom.remove(marker); - if (parentBlock && dom.isEmpty(parentBlock)) { - editor.$(parentBlock).empty(); - rng.setStart(parentBlock, 0); - rng.setEnd(parentBlock, 0); - if (!isTableCell$4(parentBlock) && !isPartOfFragment(parentBlock) && (nextRng = findNextCaretRng(rng))) { - rng = nextRng; - dom.remove(parentBlock); - } else { - dom.add(parentBlock, dom.create('br', { 'data-mce-bogus': '1' })); - } - } - selection.setRng(rng); - }; - var deleteSelectedContent = function (editor) { - var dom = editor.dom; - var rng = normalize$2(editor.selection.getRng()); - editor.selection.setRng(rng); - var startCell = dom.getParent(rng.startContainer, isTableCell$4); - if (isTableCellContentSelected(dom, rng, startCell)) { - deleteCellContents(editor, rng, SugarElement.fromDom(startCell)); - } else { - editor.getDoc().execCommand('Delete', false, null); - } - }; - var insertHtmlAtCaret = function (editor, value, details) { - var parentNode, rootNode, args; - var marker, rng, node; - var selection = editor.selection, dom = editor.dom; - if (/^ | $/.test(value)) { - value = trimOrPadLeftRight(dom, selection.getRng(), value); - } - var parser = editor.parser; - var merge = details.merge; - var serializer = HtmlSerializer({ validate: shouldValidate(editor) }, editor.schema); - var bookmarkHtml = ''; - args = { - content: value, - format: 'html', - selection: true, - paste: details.paste - }; - args = editor.fire('BeforeSetContent', args); - if (args.isDefaultPrevented()) { - editor.fire('SetContent', { - content: args.content, - format: 'html', - selection: true, - paste: details.paste - }); - return; - } - value = args.content; - if (value.indexOf('{$caret}') === -1) { - value += '{$caret}'; - } - value = value.replace(/\{\$caret\}/, bookmarkHtml); - rng = selection.getRng(); - var caretElement = rng.startContainer || (rng.parentElement ? rng.parentElement() : null); - var body = editor.getBody(); - if (caretElement === body && selection.isCollapsed()) { - if (dom.isBlock(body.firstChild) && canHaveChildren(editor, body.firstChild) && dom.isEmpty(body.firstChild)) { - rng = dom.createRng(); - rng.setStart(body.firstChild, 0); - rng.setEnd(body.firstChild, 0); - selection.setRng(rng); - } - } - if (!selection.isCollapsed()) { - deleteSelectedContent(editor); - } - parentNode = selection.getNode(); - var parserArgs = { - context: parentNode.nodeName.toLowerCase(), - data: details.data, - insert: true - }; - var fragment = parser.parse(value, parserArgs); - if (details.paste === true && isListFragment(editor.schema, fragment) && isParentBlockLi(dom, parentNode)) { - rng = insertAtCaret(serializer, dom, selection.getRng(), fragment); - selection.setRng(rng); - editor.fire('SetContent', args); - return; - } - markFragmentElements(fragment); - node = fragment.lastChild; - if (node.attr('id') === 'mce_marker') { - marker = node; - for (node = node.prev; node; node = node.walk(true)) { - if (node.type === 3 || !dom.isBlock(node.name)) { - if (editor.schema.isValidChild(node.parent.name, 'span')) { - node.parent.insert(marker, node, node.name === 'br'); - } - break; - } - } - } - editor._selectionOverrides.showBlockCaretContainer(parentNode); - if (!parserArgs.invalid) { - value = serializer.serialize(fragment); - validInsertion(editor, value, parentNode); - } else { - editor.selection.setContent(bookmarkHtml); - parentNode = selection.getNode(); - rootNode = editor.getBody(); - if (parentNode.nodeType === 9) { - parentNode = node = rootNode; - } else { - node = parentNode; - } - while (node !== rootNode) { - parentNode = node; - node = node.parentNode; - } - value = parentNode === rootNode ? rootNode.innerHTML : dom.getOuterHTML(parentNode); - value = serializer.serialize(parser.parse(value.replace(//i, function () { - return serializer.serialize(fragment); - }))); - if (parentNode === rootNode) { - dom.setHTML(rootNode, value); - } else { - dom.setOuterHTML(parentNode, value); - } - } - reduceInlineTextElements(editor, merge); - moveSelectionToMarker(editor, dom.get('mce_marker')); - unmarkFragmentElements(editor.getBody()); - trimBrsFromTableCell(dom, selection.getStart()); - editor.fire('SetContent', args); - editor.addVisual(); - }; - - var traverse = function (node, fn) { - fn(node); - if (node.firstChild) { - traverse(node.firstChild, fn); - } - if (node.next) { - traverse(node.next, fn); - } - }; - var findMatchingNodes = function (nodeFilters, attributeFilters, node) { - var nodeMatches = {}; - var attrMatches = {}; - var matches = []; - if (node.firstChild) { - traverse(node.firstChild, function (node) { - each(nodeFilters, function (filter) { - if (filter.name === node.name) { - if (nodeMatches[filter.name]) { - nodeMatches[filter.name].nodes.push(node); - } else { - nodeMatches[filter.name] = { - filter: filter, - nodes: [node] - }; - } - } - }); - each(attributeFilters, function (filter) { - if (typeof node.attr(filter.name) === 'string') { - if (attrMatches[filter.name]) { - attrMatches[filter.name].nodes.push(node); - } else { - attrMatches[filter.name] = { - filter: filter, - nodes: [node] - }; - } - } - }); - }); - } - for (var name_1 in nodeMatches) { - if (nodeMatches.hasOwnProperty(name_1)) { - matches.push(nodeMatches[name_1]); - } - } - for (var name_2 in attrMatches) { - if (attrMatches.hasOwnProperty(name_2)) { - matches.push(attrMatches[name_2]); - } - } - return matches; - }; - var filter$3 = function (nodeFilters, attributeFilters, node) { - var matches = findMatchingNodes(nodeFilters, attributeFilters, node); - each(matches, function (match) { - each(match.filter.callbacks, function (callback) { - callback(match.nodes, match.filter.name, {}); - }); - }); - }; - - var defaultFormat = 'html'; - var isTreeNode = function (content) { - return content instanceof AstNode; - }; - var moveSelection = function (editor) { - if (hasFocus$1(editor)) { - firstPositionIn(editor.getBody()).each(function (pos) { - var node = pos.getNode(); - var caretPos = isTable(node) ? firstPositionIn(node).getOr(pos) : pos; - editor.selection.setRng(caretPos.toRange()); - }); - } - }; - var setEditorHtml = function (editor, html) { - editor.dom.setHTML(editor.getBody(), html); - moveSelection(editor); - }; - var setContentString = function (editor, body, content, args) { - var forcedRootBlockName, padd; - if (content.length === 0 || /^\s+$/.test(content)) { - padd = '
                                      '; - if (body.nodeName === 'TABLE') { - content = '' + padd + ''; - } else if (/^(UL|OL)$/.test(body.nodeName)) { - content = '
                                    • ' + padd + '
                                    • '; - } - forcedRootBlockName = getForcedRootBlock(editor); - if (forcedRootBlockName && editor.schema.isValidChild(body.nodeName.toLowerCase(), forcedRootBlockName.toLowerCase())) { - content = padd; - content = editor.dom.createHTML(forcedRootBlockName, getForcedRootBlockAttrs(editor), content); - } else if (!content) { - content = '
                                      '; - } - setEditorHtml(editor, content); - editor.fire('SetContent', args); - } else { - if (args.format !== 'raw') { - content = HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(editor.parser.parse(content, { - isRootContent: true, - insert: true - })); - } - args.content = isWsPreserveElement(SugarElement.fromDom(body)) ? content : Tools.trim(content); - setEditorHtml(editor, args.content); - if (!args.no_events) { - editor.fire('SetContent', args); - } - } - return args.content; - }; - var setContentTree = function (editor, body, content, args) { - filter$3(editor.parser.getNodeFilters(), editor.parser.getAttributeFilters(), content); - var html = HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(content); - args.content = isWsPreserveElement(SugarElement.fromDom(body)) ? html : Tools.trim(html); - setEditorHtml(editor, args.content); - if (!args.no_events) { - editor.fire('SetContent', args); - } - return content; - }; - var setContentInternal = function (editor, content, args) { - args.format = args.format ? args.format : defaultFormat; - args.set = true; - args.content = isTreeNode(content) ? '' : content; - if (!args.no_events) { - editor.fire('BeforeSetContent', args); - } - if (!isTreeNode(content)) { - content = args.content; - } - return Optional.from(editor.getBody()).fold(constant(content), function (body) { - return isTreeNode(content) ? setContentTree(editor, body, content, args) : setContentString(editor, body, content, args); - }); - }; - - var addVisualInternal = function (editor, elm) { - var dom = editor.dom; - var scope = isNonNullable(elm) ? elm : editor.getBody(); - if (isUndefined(editor.hasVisual)) { - editor.hasVisual = isVisualAidsEnabled(editor); - } - each(dom.select('table,a', scope), function (matchedElm) { - switch (matchedElm.nodeName) { - case 'TABLE': - var cls = getVisualAidsTableClass(editor); - var value = dom.getAttrib(matchedElm, 'border'); - if ((!value || value === '0') && editor.hasVisual) { - dom.addClass(matchedElm, cls); - } else { - dom.removeClass(matchedElm, cls); - } - break; - case 'A': - if (!dom.getAttrib(matchedElm, 'href')) { - var value_1 = dom.getAttrib(matchedElm, 'name') || matchedElm.id; - var cls_1 = getVisualAidsAnchorClass(editor); - if (value_1 && editor.hasVisual) { - dom.addClass(matchedElm, cls_1); - } else { - dom.removeClass(matchedElm, cls_1); - } - } - break; - } - }); - editor.fire('VisualAid', { - element: elm, - hasVisual: editor.hasVisual - }); - }; - - var sibling$2 = function (scope, predicate) { - return sibling(scope, predicate).isSome(); - }; - - var ZWSP$1 = ZWSP, CARET_ID$1 = '_mce_caret'; - var importNode = function (ownerDocument, node) { - return ownerDocument.importNode(node, true); - }; - var getEmptyCaretContainers = function (node) { - var nodes = []; - while (node) { - if (node.nodeType === 3 && node.nodeValue !== ZWSP$1 || node.childNodes.length > 1) { - return []; - } - if (node.nodeType === 1) { - nodes.push(node); - } - node = node.firstChild; - } - return nodes; - }; - var isCaretContainerEmpty = function (node) { - return getEmptyCaretContainers(node).length > 0; - }; - var findFirstTextNode = function (node) { - if (node) { - var walker = new DomTreeWalker(node, node); - for (node = walker.current(); node; node = walker.next()) { - if (isText$1(node)) { - return node; - } - } - } - return null; - }; - var createCaretContainer = function (fill) { - var caretContainer = SugarElement.fromTag('span'); - setAll(caretContainer, { - 'id': CARET_ID$1, - 'data-mce-bogus': '1', - 'data-mce-type': 'format-caret' - }); - if (fill) { - append(caretContainer, SugarElement.fromText(ZWSP$1)); - } - return caretContainer; - }; - var trimZwspFromCaretContainer = function (caretContainerNode) { - var textNode = findFirstTextNode(caretContainerNode); - if (textNode && textNode.nodeValue.charAt(0) === ZWSP$1) { - textNode.deleteData(0, 1); - } - return textNode; - }; - var removeCaretContainerNode = function (editor, node, moveCaret) { - if (moveCaret === void 0) { - moveCaret = true; - } - var dom = editor.dom, selection = editor.selection; - if (isCaretContainerEmpty(node)) { - deleteElement(editor, false, SugarElement.fromDom(node), moveCaret); - } else { - var rng = selection.getRng(); - var block = dom.getParent(node, dom.isBlock); - var startContainer = rng.startContainer; - var startOffset = rng.startOffset; - var endContainer = rng.endContainer; - var endOffset = rng.endOffset; - var textNode = trimZwspFromCaretContainer(node); - dom.remove(node, true); - if (startContainer === textNode && startOffset > 0) { - rng.setStart(textNode, startOffset - 1); - } - if (endContainer === textNode && endOffset > 0) { - rng.setEnd(textNode, endOffset - 1); - } - if (block && dom.isEmpty(block)) { - fillWithPaddingBr(SugarElement.fromDom(block)); - } - selection.setRng(rng); - } - }; - var removeCaretContainer = function (editor, node, moveCaret) { - if (moveCaret === void 0) { - moveCaret = true; - } - var dom = editor.dom, selection = editor.selection; - if (!node) { - node = getParentCaretContainer(editor.getBody(), selection.getStart()); - if (!node) { - while (node = dom.get(CARET_ID$1)) { - removeCaretContainerNode(editor, node, false); - } - } - } else { - removeCaretContainerNode(editor, node, moveCaret); - } - }; - var insertCaretContainerNode = function (editor, caretContainer, formatNode) { - var dom = editor.dom, block = dom.getParent(formatNode, curry(isTextBlock$1, editor)); - if (block && dom.isEmpty(block)) { - formatNode.parentNode.replaceChild(caretContainer, formatNode); - } else { - removeTrailingBr(SugarElement.fromDom(formatNode)); - if (dom.isEmpty(formatNode)) { - formatNode.parentNode.replaceChild(caretContainer, formatNode); - } else { - dom.insertAfter(caretContainer, formatNode); - } - } - }; - var appendNode = function (parentNode, node) { - parentNode.appendChild(node); - return node; - }; - var insertFormatNodesIntoCaretContainer = function (formatNodes, caretContainer) { - var innerMostFormatNode = foldr(formatNodes, function (parentNode, formatNode) { - return appendNode(parentNode, formatNode.cloneNode(false)); - }, caretContainer); - return appendNode(innerMostFormatNode, innerMostFormatNode.ownerDocument.createTextNode(ZWSP$1)); - }; - var cleanFormatNode = function (editor, caretContainer, formatNode, name, vars, similar) { - var formatter = editor.formatter; - var dom = editor.dom; - var validFormats = filter(keys(formatter.get()), function (formatName) { - return formatName !== name && !contains$1(formatName, 'removeformat'); - }); - var matchedFormats = matchAllOnNode(editor, formatNode, validFormats); - var uniqueFormats = filter(matchedFormats, function (fmtName) { - return !areSimilarFormats(editor, fmtName, name); - }); - if (uniqueFormats.length > 0) { - var clonedFormatNode = formatNode.cloneNode(false); - dom.add(caretContainer, clonedFormatNode); - formatter.remove(name, vars, clonedFormatNode, similar); - dom.remove(clonedFormatNode); - return Optional.some(clonedFormatNode); - } else { - return Optional.none(); - } - }; - var applyCaretFormat = function (editor, name, vars) { - var caretContainer, textNode; - var selection = editor.selection; - var selectionRng = selection.getRng(); - var offset = selectionRng.startOffset; - var container = selectionRng.startContainer; - var text = container.nodeValue; - caretContainer = getParentCaretContainer(editor.getBody(), selection.getStart()); - if (caretContainer) { - textNode = findFirstTextNode(caretContainer); - } - var wordcharRegex = /[^\s\u00a0\u00ad\u200b\ufeff]/; - if (text && offset > 0 && offset < text.length && wordcharRegex.test(text.charAt(offset)) && wordcharRegex.test(text.charAt(offset - 1))) { - var bookmark = selection.getBookmark(); - selectionRng.collapse(true); - var rng = expandRng(editor, selectionRng, editor.formatter.get(name)); - rng = split$1(rng); - editor.formatter.apply(name, vars, rng); - selection.moveToBookmark(bookmark); - } else { - if (!caretContainer || textNode.nodeValue !== ZWSP$1) { - caretContainer = importNode(editor.getDoc(), createCaretContainer(true).dom); - textNode = caretContainer.firstChild; - selectionRng.insertNode(caretContainer); - offset = 1; - editor.formatter.apply(name, vars, caretContainer); - } else { - editor.formatter.apply(name, vars, caretContainer); - } - selection.setCursorLocation(textNode, offset); - } - }; - var removeCaretFormat = function (editor, name, vars, similar) { - var dom = editor.dom; - var selection = editor.selection; - var hasContentAfter, node, formatNode; - var parents = []; - var rng = selection.getRng(); - var container = rng.startContainer; - var offset = rng.startOffset; - node = container; - if (container.nodeType === 3) { - if (offset !== container.nodeValue.length) { - hasContentAfter = true; - } - node = node.parentNode; - } - while (node) { - if (matchNode(editor, node, name, vars, similar)) { - formatNode = node; - break; - } - if (node.nextSibling) { - hasContentAfter = true; - } - parents.push(node); - node = node.parentNode; - } - if (!formatNode) { - return; - } - if (hasContentAfter) { - var bookmark = selection.getBookmark(); - rng.collapse(true); - var expandedRng = expandRng(editor, rng, editor.formatter.get(name), true); - expandedRng = split$1(expandedRng); - editor.formatter.remove(name, vars, expandedRng, similar); - selection.moveToBookmark(bookmark); - } else { - var caretContainer = getParentCaretContainer(editor.getBody(), formatNode); - var newCaretContainer = createCaretContainer(false).dom; - insertCaretContainerNode(editor, newCaretContainer, caretContainer !== null ? caretContainer : formatNode); - var cleanedFormatNode = cleanFormatNode(editor, newCaretContainer, formatNode, name, vars, similar); - var caretTextNode = insertFormatNodesIntoCaretContainer(parents.concat(cleanedFormatNode.toArray()), newCaretContainer); - removeCaretContainerNode(editor, caretContainer, false); - selection.setCursorLocation(caretTextNode, 1); - if (dom.isEmpty(formatNode)) { - dom.remove(formatNode); - } - } - }; - var disableCaretContainer = function (editor, keyCode) { - var selection = editor.selection, body = editor.getBody(); - removeCaretContainer(editor, null, false); - if ((keyCode === 8 || keyCode === 46) && selection.isCollapsed() && selection.getStart().innerHTML === ZWSP$1) { - removeCaretContainer(editor, getParentCaretContainer(body, selection.getStart())); - } - if (keyCode === 37 || keyCode === 39) { - removeCaretContainer(editor, getParentCaretContainer(body, selection.getStart())); - } - }; - var setup$3 = function (editor) { - editor.on('mouseup keydown', function (e) { - disableCaretContainer(editor, e.keyCode); - }); - }; - var replaceWithCaretFormat = function (targetNode, formatNodes) { - var caretContainer = createCaretContainer(false); - var innerMost = insertFormatNodesIntoCaretContainer(formatNodes, caretContainer.dom); - before(SugarElement.fromDom(targetNode), caretContainer); - remove(SugarElement.fromDom(targetNode)); - return CaretPosition$1(innerMost, 0); - }; - var isFormatElement = function (editor, element) { - var inlineElements = editor.schema.getTextInlineElements(); - return inlineElements.hasOwnProperty(name(element)) && !isCaretNode(element.dom) && !isBogus(element.dom); - }; - var isEmptyCaretFormatElement = function (element) { - return isCaretNode(element.dom) && isCaretContainerEmpty(element.dom); - }; - - var postProcessHooks = {}; - var filter$4 = filter$2; - var each$8 = each$2; - var addPostProcessHook = function (name, hook) { - var hooks = postProcessHooks[name]; - if (!hooks) { - postProcessHooks[name] = []; - } - postProcessHooks[name].push(hook); - }; - var postProcess = function (name, editor) { - each$8(postProcessHooks[name], function (hook) { - hook(editor); - }); - }; - addPostProcessHook('pre', function (editor) { - var rng = editor.selection.getRng(); - var blocks; - var hasPreSibling = function (pre) { - return isPre(pre.previousSibling) && indexOf$1(blocks, pre.previousSibling) !== -1; - }; - var joinPre = function (pre1, pre2) { - DomQuery(pre2).remove(); - DomQuery(pre1).append('

                                      ').append(pre2.childNodes); - }; - var isPre = matchNodeNames(['pre']); - if (!rng.collapsed) { - blocks = editor.selection.getSelectedBlocks(); - each$8(filter$4(filter$4(blocks, isPre), hasPreSibling), function (pre) { - joinPre(pre.previousSibling, pre); - }); - } - }); - - var each$9 = Tools.each; - var isElementNode = function (node) { - return isElement$1(node) && !isBookmarkNode$1(node) && !isCaretNode(node) && !isBogus(node); - }; - var findElementSibling = function (node, siblingName) { - var sibling; - for (sibling = node; sibling; sibling = sibling[siblingName]) { - if (isText$1(sibling) && sibling.nodeValue.length !== 0) { - return node; - } - if (isElement$1(sibling) && !isBookmarkNode$1(sibling)) { - return sibling; - } - } - return node; - }; - var mergeSiblingsNodes = function (dom, prev, next) { - var sibling, tmpSibling; - var elementUtils = new ElementUtils(dom); - if (prev && next) { - prev = findElementSibling(prev, 'previousSibling'); - next = findElementSibling(next, 'nextSibling'); - if (elementUtils.compare(prev, next)) { - for (sibling = prev.nextSibling; sibling && sibling !== next;) { - tmpSibling = sibling; - sibling = sibling.nextSibling; - prev.appendChild(tmpSibling); - } - dom.remove(next); - Tools.each(Tools.grep(next.childNodes), function (node) { - prev.appendChild(node); - }); - return prev; - } - } - return next; - }; - var mergeSiblings = function (dom, format, vars, node) { - if (node && format.merge_siblings !== false) { - var newNode = mergeSiblingsNodes(dom, getNonWhiteSpaceSibling(node), node); - mergeSiblingsNodes(dom, newNode, getNonWhiteSpaceSibling(newNode, true)); - } - }; - var clearChildStyles = function (dom, format, node) { - if (format.clear_child_styles) { - var selector = format.links ? '*:not(a)' : '*'; - each$9(dom.select(selector, node), function (node) { - if (isElementNode(node)) { - each$9(format.styles, function (value, name) { - dom.setStyle(node, name, ''); - }); - } - }); - } - }; - var processChildElements = function (node, filter, process) { - each$9(node.childNodes, function (node) { - if (isElementNode(node)) { - if (filter(node)) { - process(node); - } - if (node.hasChildNodes()) { - processChildElements(node, filter, process); - } - } - }); - }; - var unwrapEmptySpan = function (dom, node) { - if (node.nodeName === 'SPAN' && dom.getAttribs(node).length === 0) { - dom.remove(node, true); - } - }; - var hasStyle = function (dom, name) { - return function (node) { - return !!(node && getStyle(dom, node, name)); - }; - }; - var applyStyle = function (dom, name, value) { - return function (node) { - dom.setStyle(node, name, value); - if (node.getAttribute('style') === '') { - node.removeAttribute('style'); - } - unwrapEmptySpan(dom, node); - }; - }; - - var removeResult = Adt.generate([ - { keep: [] }, - { rename: ['name'] }, - { removed: [] } - ]); - var MCE_ATTR_RE = /^(src|href|style)$/; - var each$a = Tools.each; - var isEq$3 = isEq; - var isTableCellOrRow = function (node) { - return /^(TR|TH|TD)$/.test(node.nodeName); - }; - var isChildOfInlineParent = function (dom, node, parent) { - return dom.isChildOf(node, parent) && node !== parent && !dom.isBlock(parent); - }; - var getContainer = function (ed, rng, start) { - var container, offset; - container = rng[start ? 'startContainer' : 'endContainer']; - offset = rng[start ? 'startOffset' : 'endOffset']; - if (isElement$1(container)) { - var lastIdx = container.childNodes.length - 1; - if (!start && offset) { - offset--; - } - container = container.childNodes[offset > lastIdx ? lastIdx : offset]; - } - if (isText$1(container) && start && offset >= container.nodeValue.length) { - container = new DomTreeWalker(container, ed.getBody()).next() || container; - } - if (isText$1(container) && !start && offset === 0) { - container = new DomTreeWalker(container, ed.getBody()).prev() || container; - } - return container; - }; - var normalizeTableSelection = function (node, start) { - var prop = start ? 'firstChild' : 'lastChild'; - if (isTableCellOrRow(node) && node[prop]) { - var childNode = node[prop]; - if (node.nodeName === 'TR') { - return childNode[prop] || childNode; - } else { - return childNode; - } - } - return node; - }; - var wrap$2 = function (dom, node, name, attrs) { - var wrapper = dom.create(name, attrs); - node.parentNode.insertBefore(wrapper, node); - wrapper.appendChild(node); - return wrapper; - }; - var wrapWithSiblings = function (dom, node, next, name, attrs) { - var start = SugarElement.fromDom(node); - var wrapper = SugarElement.fromDom(dom.create(name, attrs)); - var siblings = next ? nextSiblings(start) : prevSiblings(start); - append$1(wrapper, siblings); - if (next) { - before(start, wrapper); - prepend(wrapper, start); - } else { - after(start, wrapper); - append(wrapper, start); - } - return wrapper.dom; - }; - var matchName$1 = function (dom, node, format) { - if (isEq$3(node, format.inline)) { - return true; - } - if (isEq$3(node, format.block)) { - return true; - } - if (format.selector) { - return isElement$1(node) && dom.is(node, format.selector); - } - }; - var isColorFormatAndAnchor = function (node, format) { - return format.links && node.nodeName === 'A'; - }; - var find$3 = function (dom, node, next, inc) { - node = getNonWhiteSpaceSibling(node, next, inc); - return !node || (node.nodeName === 'BR' || dom.isBlock(node)); - }; - var removeNode$1 = function (ed, node, format) { - var parentNode = node.parentNode; - var rootBlockElm; - var dom = ed.dom, forcedRootBlock = getForcedRootBlock(ed); - if (format.block) { - if (!forcedRootBlock) { - if (dom.isBlock(node) && !dom.isBlock(parentNode)) { - if (!find$3(dom, node, false) && !find$3(dom, node.firstChild, true, true)) { - node.insertBefore(dom.create('br'), node.firstChild); - } - if (!find$3(dom, node, true) && !find$3(dom, node.lastChild, false, true)) { - node.appendChild(dom.create('br')); - } - } - } else { - if (parentNode === dom.getRoot()) { - if (!format.list_block || !isEq$3(node, format.list_block)) { - each(from$1(node.childNodes), function (node) { - if (isValid(ed, forcedRootBlock, node.nodeName.toLowerCase())) { - if (!rootBlockElm) { - rootBlockElm = wrap$2(dom, node, forcedRootBlock); - dom.setAttribs(rootBlockElm, ed.settings.forced_root_block_attrs); - } else { - rootBlockElm.appendChild(node); - } - } else { - rootBlockElm = 0; - } - }); - } - } - } - } - if (format.selector && format.inline && !isEq$3(format.inline, node)) { - return; - } - dom.remove(node, true); - }; - var removeFormatInternal = function (ed, format, vars, node, compareNode) { - var stylesModified; - var dom = ed.dom; - if (!matchName$1(dom, node, format) && !isColorFormatAndAnchor(node, format)) { - return removeResult.keep(); - } - var elm = node; - if (format.inline && format.remove === 'all' && isArray(format.preserve_attributes)) { - var attrsToPreserve = filter(dom.getAttribs(elm), function (attr) { - return contains(format.preserve_attributes, attr.name.toLowerCase()); - }); - dom.removeAllAttribs(elm); - each(attrsToPreserve, function (attr) { - return dom.setAttrib(elm, attr.name, attr.value); - }); - if (attrsToPreserve.length > 0) { - return removeResult.rename('span'); - } - } - if (format.remove !== 'all') { - each$a(format.styles, function (value, name) { - value = normalizeStyleValue(dom, replaceVars(value, vars), name + ''); - if (isNumber(name)) { - name = value; - compareNode = null; - } - if (format.remove_similar || (!compareNode || isEq$3(getStyle(dom, compareNode, name), value))) { - dom.setStyle(elm, name, ''); - } - stylesModified = true; - }); - if (stylesModified && dom.getAttrib(elm, 'style') === '') { - elm.removeAttribute('style'); - elm.removeAttribute('data-mce-style'); - } - each$a(format.attributes, function (value, name) { - var valueOut; - value = replaceVars(value, vars); - if (isNumber(name)) { - name = value; - compareNode = null; - } - if (format.remove_similar || (!compareNode || isEq$3(dom.getAttrib(compareNode, name), value))) { - if (name === 'class') { - value = dom.getAttrib(elm, name); - if (value) { - valueOut = ''; - each(value.split(/\s+/), function (cls) { - if (/mce\-\w+/.test(cls)) { - valueOut += (valueOut ? ' ' : '') + cls; - } - }); - if (valueOut) { - dom.setAttrib(elm, name, valueOut); - return; - } - } - } - if (name === 'class') { - elm.removeAttribute('className'); - } - if (MCE_ATTR_RE.test(name)) { - elm.removeAttribute('data-mce-' + name); - } - elm.removeAttribute(name); - } - }); - each$a(format.classes, function (value) { - value = replaceVars(value, vars); - if (!compareNode || dom.hasClass(compareNode, value)) { - dom.removeClass(elm, value); - } - }); - var attrs = dom.getAttribs(elm); - for (var i = 0; i < attrs.length; i++) { - var attrName = attrs[i].nodeName; - if (attrName.indexOf('_') !== 0 && attrName.indexOf('data-') !== 0) { - return removeResult.keep(); - } - } - } - if (format.remove !== 'none') { - removeNode$1(ed, elm, format); - return removeResult.removed(); - } - return removeResult.keep(); - }; - var removeFormat = function (ed, format, vars, node, compareNode) { - return removeFormatInternal(ed, format, vars, node, compareNode).fold(never, function (newName) { - ed.dom.rename(node, newName); - return true; - }, always); - }; - var findFormatRoot = function (editor, container, name, vars, similar) { - var formatRoot; - each(getParents$1(editor.dom, container.parentNode).reverse(), function (parent) { - if (!formatRoot && parent.id !== '_start' && parent.id !== '_end') { - var format = matchNode(editor, parent, name, vars, similar); - if (format && format.split !== false) { - formatRoot = parent; - } - } - }); - return formatRoot; - }; - var removeFormatFromClone = function (editor, format, vars, clone) { - return removeFormatInternal(editor, format, vars, clone, clone).fold(constant(clone), function (newName) { - var fragment = editor.dom.createFragment(); - fragment.appendChild(clone); - return editor.dom.rename(clone, newName); - }, constant(null)); - }; - var wrapAndSplit = function (editor, formatList, formatRoot, container, target, split, format, vars) { - var clone, lastClone, firstClone; - var dom = editor.dom; - if (formatRoot) { - var formatRootParent = formatRoot.parentNode; - for (var parent_1 = container.parentNode; parent_1 && parent_1 !== formatRootParent; parent_1 = parent_1.parentNode) { - clone = dom.clone(parent_1, false); - for (var i = 0; i < formatList.length; i++) { - clone = removeFormatFromClone(editor, formatList[i], vars, clone); - if (clone === null) { - break; - } - } - if (clone) { - if (lastClone) { - clone.appendChild(lastClone); - } - if (!firstClone) { - firstClone = clone; - } - lastClone = clone; - } - } - if (split && (!format.mixed || !dom.isBlock(formatRoot))) { - container = dom.split(formatRoot, container); - } - if (lastClone) { - target.parentNode.insertBefore(lastClone, target); - firstClone.appendChild(target); - if (format.inline) { - mergeSiblings(dom, format, vars, lastClone); - } - } - } - return container; - }; - var remove$6 = function (ed, name, vars, node, similar) { - var formatList = ed.formatter.get(name); - var format = formatList[0]; - var contentEditable = true; - var dom = ed.dom; - var selection = ed.selection; - var splitToFormatRoot = function (container) { - var formatRoot = findFormatRoot(ed, container, name, vars, similar); - return wrapAndSplit(ed, formatList, formatRoot, container, container, true, format, vars); - }; - var isRemoveBookmarkNode = function (node) { - return isBookmarkNode$1(node) && isElement$1(node) && (node.id === '_start' || node.id === '_end'); - }; - var process = function (node) { - var lastContentEditable, hasContentEditableState; - if (isElement$1(node) && dom.getContentEditable(node)) { - lastContentEditable = contentEditable; - contentEditable = dom.getContentEditable(node) === 'true'; - hasContentEditableState = true; - } - var children = from$1(node.childNodes); - if (contentEditable && !hasContentEditableState) { - for (var i = 0; i < formatList.length; i++) { - if (removeFormat(ed, formatList[i], vars, node, node)) { - break; - } - } - } - if (format.deep) { - if (children.length) { - for (var i = 0; i < children.length; i++) { - process(children[i]); - } - if (hasContentEditableState) { - contentEditable = lastContentEditable; - } - } - } - }; - var unwrap = function (start) { - var node = dom.get(start ? '_start' : '_end'); - var out = node[start ? 'firstChild' : 'lastChild']; - if (isRemoveBookmarkNode(out)) { - out = out[start ? 'firstChild' : 'lastChild']; - } - if (isText$1(out) && out.data.length === 0) { - out = start ? node.previousSibling || node.nextSibling : node.nextSibling || node.previousSibling; - } - dom.remove(node, true); - return out; - }; - var removeRngStyle = function (rng) { - var startContainer, endContainer; - var expandedRng = expandRng(ed, rng, formatList, rng.collapsed); - if (format.split) { - expandedRng = split$1(expandedRng); - startContainer = getContainer(ed, expandedRng, true); - endContainer = getContainer(ed, expandedRng); - if (startContainer !== endContainer) { - startContainer = normalizeTableSelection(startContainer, true); - endContainer = normalizeTableSelection(endContainer, false); - if (isChildOfInlineParent(dom, startContainer, endContainer)) { - var marker = Optional.from(startContainer.firstChild).getOr(startContainer); - splitToFormatRoot(wrapWithSiblings(dom, marker, true, 'span', { - 'id': '_start', - 'data-mce-type': 'bookmark' - })); - unwrap(true); - return; - } - if (isChildOfInlineParent(dom, endContainer, startContainer)) { - var marker = Optional.from(endContainer.lastChild).getOr(endContainer); - splitToFormatRoot(wrapWithSiblings(dom, marker, false, 'span', { - 'id': '_end', - 'data-mce-type': 'bookmark' - })); - unwrap(false); - return; - } - startContainer = wrap$2(dom, startContainer, 'span', { - 'id': '_start', - 'data-mce-type': 'bookmark' - }); - endContainer = wrap$2(dom, endContainer, 'span', { - 'id': '_end', - 'data-mce-type': 'bookmark' - }); - var newRng = dom.createRng(); - newRng.setStartAfter(startContainer); - newRng.setEndBefore(endContainer); - walk$1(dom, newRng, function (nodes) { - each(nodes, function (n) { - if (!isBookmarkNode$1(n) && !isBookmarkNode$1(n.parentNode)) { - splitToFormatRoot(n); - } - }); - }); - splitToFormatRoot(startContainer); - splitToFormatRoot(endContainer); - startContainer = unwrap(true); - endContainer = unwrap(); - } else { - startContainer = endContainer = splitToFormatRoot(startContainer); - } - expandedRng.startContainer = startContainer.parentNode ? startContainer.parentNode : startContainer; - expandedRng.startOffset = dom.nodeIndex(startContainer); - expandedRng.endContainer = endContainer.parentNode ? endContainer.parentNode : endContainer; - expandedRng.endOffset = dom.nodeIndex(endContainer) + 1; - } - walk$1(dom, expandedRng, function (nodes) { - each(nodes, function (node) { - process(node); - var textDecorations = [ - 'underline', - 'line-through', - 'overline' - ]; - each(textDecorations, function (decoration) { - if (isElement$1(node) && ed.dom.getStyle(node, 'text-decoration') === decoration && node.parentNode && getTextDecoration(dom, node.parentNode) === decoration) { - removeFormat(ed, { - deep: false, - exact: true, - inline: 'span', - styles: { textDecoration: decoration } - }, null, node); - } - }); - }); - }); - }; - if (node) { - if (isNode(node)) { - var rng = dom.createRng(); - rng.setStartBefore(node); - rng.setEndAfter(node); - removeRngStyle(rng); - } else { - removeRngStyle(node); - } - return; - } - if (dom.getContentEditable(selection.getNode()) === 'false') { - node = selection.getNode(); - for (var i = 0; i < formatList.length; i++) { - if (formatList[i].ceFalseOverride) { - if (removeFormat(ed, formatList[i], vars, node, node)) { - break; - } - } - } - return; - } - if (!selection.isCollapsed() || !format.inline || getCellsFromEditor(ed).length) { - preserve(selection, true, function () { - runOnRanges(ed, removeRngStyle); - }); - if (format.inline && match(ed, name, vars, selection.getStart())) { - moveStart(dom, selection, selection.getRng()); - } - ed.nodeChanged(); - } else { - removeCaretFormat(ed, name, vars, similar); - } - }; - - var each$b = Tools.each; - var mergeTextDecorationsAndColor = function (dom, format, vars, node) { - var processTextDecorationsAndColor = function (n) { - if (n.nodeType === 1 && n.parentNode && n.parentNode.nodeType === 1) { - var textDecoration = getTextDecoration(dom, n.parentNode); - if (dom.getStyle(n, 'color') && textDecoration) { - dom.setStyle(n, 'text-decoration', textDecoration); - } else if (dom.getStyle(n, 'text-decoration') === textDecoration) { - dom.setStyle(n, 'text-decoration', null); - } - } - }; - if (format.styles && (format.styles.color || format.styles.textDecoration)) { - Tools.walk(node, processTextDecorationsAndColor, 'childNodes'); - processTextDecorationsAndColor(node); - } - }; - var mergeBackgroundColorAndFontSize = function (dom, format, vars, node) { - if (format.styles && format.styles.backgroundColor) { - processChildElements(node, hasStyle(dom, 'fontSize'), applyStyle(dom, 'backgroundColor', replaceVars(format.styles.backgroundColor, vars))); - } - }; - var mergeSubSup = function (dom, format, vars, node) { - if (format.inline === 'sub' || format.inline === 'sup') { - processChildElements(node, hasStyle(dom, 'fontSize'), applyStyle(dom, 'fontSize', '')); - dom.remove(dom.select(format.inline === 'sup' ? 'sub' : 'sup', node), true); - } - }; - var mergeWithChildren = function (editor, formatList, vars, node) { - each$b(formatList, function (format) { - each$b(editor.dom.select(format.inline, node), function (child) { - if (!isElementNode(child)) { - return; - } - removeFormat(editor, format, vars, child, format.exact ? child : null); - }); - clearChildStyles(editor.dom, format, node); - }); - }; - var mergeWithParents = function (editor, format, name, vars, node) { - if (matchNode(editor, node.parentNode, name, vars)) { - if (removeFormat(editor, format, vars, node)) { - return; - } - } - if (format.merge_with_parents) { - editor.dom.getParent(node.parentNode, function (parent) { - if (matchNode(editor, parent, name, vars)) { - removeFormat(editor, format, vars, node); - return true; - } - }); - } - }; - - var each$c = Tools.each; - var hasFormatProperty = function (format, prop) { - return hasNonNullableKey(format, prop); - }; - var isElementNode$1 = function (node) { - return node && node.nodeType === 1 && !isBookmarkNode$1(node) && !isCaretNode(node) && !isBogus(node); - }; - var canFormatBR = function (editor, format, node, parentName) { - if (canFormatEmptyLines(editor) && isInlineFormat(format)) { - var validBRParentElements = __assign(__assign({}, editor.schema.getTextBlockElements()), { - td: {}, - th: {}, - li: {}, - dt: {}, - dd: {}, - figcaption: {}, - caption: {}, - details: {}, - summary: {} - }); - var hasCaretNodeSibling = sibling$2(SugarElement.fromDom(node), function (sibling) { - return isCaretNode(sibling.dom); - }); - return hasNonNullableKey(validBRParentElements, parentName) && isEmpty(SugarElement.fromDom(node.parentNode), false) && !hasCaretNodeSibling; - } else { - return false; - } - }; - var applyFormat = function (ed, name, vars, node) { - var formatList = ed.formatter.get(name); - var format = formatList[0]; - var isCollapsed = !node && ed.selection.isCollapsed(); - var dom = ed.dom; - var selection = ed.selection; - var setElementFormat = function (elm, fmt) { - fmt = fmt || format; - if (elm) { - if (fmt.onformat) { - fmt.onformat(elm, fmt, vars, node); - } - each$c(fmt.styles, function (value, name) { - dom.setStyle(elm, name, replaceVars(value, vars)); - }); - if (fmt.styles) { - var styleVal = dom.getAttrib(elm, 'style'); - if (styleVal) { - dom.setAttrib(elm, 'data-mce-style', styleVal); - } - } - each$c(fmt.attributes, function (value, name) { - dom.setAttrib(elm, name, replaceVars(value, vars)); - }); - each$c(fmt.classes, function (value) { - value = replaceVars(value, vars); - if (!dom.hasClass(elm, value)) { - dom.addClass(elm, value); - } - }); - } - }; - var applyNodeStyle = function (formatList, node) { - var found = false; - if (!isSelectorFormat(format)) { - return false; - } - each$c(formatList, function (format) { - if ('collapsed' in format && format.collapsed !== isCollapsed) { - return; - } - if (dom.is(node, format.selector) && !isCaretNode(node)) { - setElementFormat(node, format); - found = true; - return false; - } - }); - return found; - }; - var applyRngStyle = function (dom, rng, bookmark, nodeSpecific) { - var newWrappers = []; - var contentEditable = true; - var wrapName = format.inline || format.block; - var wrapElm = dom.create(wrapName); - setElementFormat(wrapElm); - walk$1(dom, rng, function (nodes) { - var currentWrapElm; - var process = function (node) { - var hasContentEditableState = false; - var lastContentEditable = contentEditable; - var nodeName = node.nodeName.toLowerCase(); - var parentName = node.parentNode.nodeName.toLowerCase(); - if (isElement$1(node) && dom.getContentEditable(node)) { - lastContentEditable = contentEditable; - contentEditable = dom.getContentEditable(node) === 'true'; - hasContentEditableState = true; - } - if (isBr(node) && !canFormatBR(ed, format, node, parentName)) { - currentWrapElm = null; - if (isBlockFormat(format)) { - dom.remove(node); - } - return; - } - if (format.wrapper && matchNode(ed, node, name, vars)) { - currentWrapElm = null; - return; - } - if (contentEditable && !hasContentEditableState && isBlockFormat(format) && !format.wrapper && isTextBlock$1(ed, nodeName) && isValid(ed, parentName, wrapName)) { - var elm = dom.rename(node, wrapName); - setElementFormat(elm); - newWrappers.push(elm); - currentWrapElm = null; - return; - } - if (isSelectorFormat(format)) { - var found = applyNodeStyle(formatList, node); - if (!hasFormatProperty(format, 'inline') || found) { - currentWrapElm = null; - return; - } - } - if (contentEditable && !hasContentEditableState && isValid(ed, wrapName, nodeName) && isValid(ed, parentName, wrapName) && !(!nodeSpecific && node.nodeType === 3 && node.nodeValue.length === 1 && node.nodeValue.charCodeAt(0) === 65279) && !isCaretNode(node) && (!hasFormatProperty(format, 'inline') || !dom.isBlock(node))) { - if (!currentWrapElm) { - currentWrapElm = dom.clone(wrapElm, false); - node.parentNode.insertBefore(currentWrapElm, node); - newWrappers.push(currentWrapElm); - } - currentWrapElm.appendChild(node); - } else { - currentWrapElm = null; - each$c(Tools.grep(node.childNodes), process); - if (hasContentEditableState) { - contentEditable = lastContentEditable; - } - currentWrapElm = null; - } - }; - each$c(nodes, process); - }); - if (format.links === true) { - each$c(newWrappers, function (node) { - var process = function (node) { - if (node.nodeName === 'A') { - setElementFormat(node, format); - } - each$c(Tools.grep(node.childNodes), process); - }; - process(node); - }); - } - each$c(newWrappers, function (node) { - var getChildCount = function (node) { - var count = 0; - each$c(node.childNodes, function (node) { - if (!isEmptyTextNode(node) && !isBookmarkNode$1(node)) { - count++; - } - }); - return count; - }; - var getChildElementNode = function (root) { - var child = false; - each$c(root.childNodes, function (node) { - if (isElementNode$1(node)) { - child = node; - return false; - } - }); - return child; - }; - var mergeStyles = function (node) { - var clone; - var child = getChildElementNode(node); - if (child && !isBookmarkNode$1(child) && matchName(dom, child, format)) { - clone = dom.clone(child, false); - setElementFormat(clone); - dom.replace(clone, node, true); - dom.remove(child, true); - } - return clone || node; - }; - var childCount = getChildCount(node); - if ((newWrappers.length > 1 || !dom.isBlock(node)) && childCount === 0) { - dom.remove(node, true); - return; - } - if (isInlineFormat(format) || format.wrapper) { - if (!format.exact && childCount === 1) { - node = mergeStyles(node); - } - mergeWithChildren(ed, formatList, vars, node); - mergeWithParents(ed, format, name, vars, node); - mergeBackgroundColorAndFontSize(dom, format, vars, node); - mergeTextDecorationsAndColor(dom, format, vars, node); - mergeSubSup(dom, format, vars, node); - mergeSiblings(dom, format, vars, node); - } - }); - }; - if (dom.getContentEditable(selection.getNode()) === 'false') { - node = selection.getNode(); - for (var i = 0, l = formatList.length; i < l; i++) { - var formatItem = formatList[i]; - if (formatItem.ceFalseOverride && isSelectorFormat(formatItem) && dom.is(node, formatItem.selector)) { - setElementFormat(node, formatItem); - return; - } - } - return; - } - if (format) { - if (node) { - if (isNode(node)) { - if (!applyNodeStyle(formatList, node)) { - var rng = dom.createRng(); - rng.setStartBefore(node); - rng.setEndAfter(node); - applyRngStyle(dom, expandRng(ed, rng, formatList), null, true); - } - } else { - applyRngStyle(dom, node, null, true); - } - } else { - if (!isCollapsed || !isInlineFormat(format) || getCellsFromEditor(ed).length) { - var curSelNode = selection.getNode(); - var firstFormat = formatList[0]; - if (!ed.settings.forced_root_block && firstFormat.defaultBlock && !dom.getParent(curSelNode, dom.isBlock)) { - applyFormat(ed, firstFormat.defaultBlock); - } - selection.setRng(normalize$2(selection.getRng())); - preserve(selection, true, function (bookmark) { - runOnRanges(ed, function (selectionRng, fake) { - var expandedRng = fake ? selectionRng : expandRng(ed, selectionRng, formatList); - applyRngStyle(dom, expandedRng); - }); - }); - moveStart(dom, selection, selection.getRng()); - ed.nodeChanged(); - } else { - applyCaretFormat(ed, name, vars); - } - } - postProcess(name, ed); - } - }; - - var setup$4 = function (registeredFormatListeners, editor) { - var currentFormats = Cell({}); - registeredFormatListeners.set({}); - editor.on('NodeChange', function (e) { - updateAndFireChangeCallbacks(editor, e.element, currentFormats, registeredFormatListeners.get()); - }); - }; - var updateAndFireChangeCallbacks = function (editor, elm, currentFormats, formatChangeData) { - var formatsList = keys(currentFormats.get()); - var newFormats = {}; - var matchedFormats = {}; - var parents = filter(getParents$1(editor.dom, elm), function (node) { - return node.nodeType === 1 && !node.getAttribute('data-mce-bogus'); - }); - each$1(formatChangeData, function (data, format) { - Tools.each(parents, function (node) { - if (editor.formatter.matchNode(node, format, {}, data.similar)) { - if (formatsList.indexOf(format) === -1) { - each(data.callbacks, function (callback) { - callback(true, { - node: node, - format: format, - parents: parents - }); - }); - newFormats[format] = data.callbacks; - } - matchedFormats[format] = data.callbacks; - return false; - } - if (matchesUnInheritedFormatSelector(editor, node, format)) { - return false; - } - }); - }); - var remainingFormats = filterRemainingFormats(currentFormats.get(), matchedFormats, elm, parents); - currentFormats.set(__assign(__assign({}, newFormats), remainingFormats)); - }; - var filterRemainingFormats = function (currentFormats, matchedFormats, elm, parents) { - return bifilter(currentFormats, function (callbacks, format) { - if (!has(matchedFormats, format)) { - each(callbacks, function (callback) { - callback(false, { - node: elm, - format: format, - parents: parents - }); - }); - return false; - } else { - return true; - } - }).t; - }; - var addListeners = function (registeredFormatListeners, formats, callback, similar) { - var formatChangeItems = registeredFormatListeners.get(); - each(formats.split(','), function (format) { - if (!formatChangeItems[format]) { - formatChangeItems[format] = { - similar: similar, - callbacks: [] - }; - } - formatChangeItems[format].callbacks.push(callback); - }); - registeredFormatListeners.set(formatChangeItems); - }; - var removeListeners = function (registeredFormatListeners, formats, callback) { - var formatChangeItems = registeredFormatListeners.get(); - each(formats.split(','), function (format) { - formatChangeItems[format].callbacks = filter(formatChangeItems[format].callbacks, function (c) { - return c !== callback; - }); - if (formatChangeItems[format].callbacks.length === 0) { - delete formatChangeItems[format]; - } - }); - registeredFormatListeners.set(formatChangeItems); - }; - var formatChangedInternal = function (editor, registeredFormatListeners, formats, callback, similar) { - if (registeredFormatListeners.get() === null) { - setup$4(registeredFormatListeners, editor); - } - addListeners(registeredFormatListeners, formats, callback, similar); - return { - unbind: function () { - return removeListeners(registeredFormatListeners, formats, callback); - } - }; - }; - - var toggle = function (editor, name, vars, node) { - var fmt = editor.formatter.get(name); - if (match(editor, name, vars, node) && (!('toggle' in fmt[0]) || fmt[0].toggle)) { - remove$6(editor, name, vars, node); - } else { - applyFormat(editor, name, vars, node); - } - }; - - var fromElements = function (elements, scope) { - var doc = scope || document; - var fragment = doc.createDocumentFragment(); - each(elements, function (element) { - fragment.appendChild(element.dom); - }); - return SugarElement.fromDom(fragment); - }; - - var tableModel = function (element, width, rows) { - return { - element: element, - width: width, - rows: rows - }; - }; - var tableRow = function (element, cells) { - return { - element: element, - cells: cells - }; - }; - var cellPosition = function (x, y) { - return { - x: x, - y: y - }; - }; - var getSpan = function (td, key) { - var value = parseInt(get$4(td, key), 10); - return isNaN(value) ? 1 : value; - }; - var fillout = function (table, x, y, tr, td) { - var rowspan = getSpan(td, 'rowspan'); - var colspan = getSpan(td, 'colspan'); - var rows = table.rows; - for (var y2 = y; y2 < y + rowspan; y2++) { - if (!rows[y2]) { - rows[y2] = tableRow(deep(tr), []); - } - for (var x2 = x; x2 < x + colspan; x2++) { - var cells = rows[y2].cells; - cells[x2] = y2 === y && x2 === x ? td : shallow(td); - } - } - }; - var cellExists = function (table, x, y) { - var rows = table.rows; - var cells = rows[y] ? rows[y].cells : []; - return !!cells[x]; - }; - var skipCellsX = function (table, x, y) { - while (cellExists(table, x, y)) { - x++; - } - return x; - }; - var getWidth = function (rows) { - return foldl(rows, function (acc, row) { - return row.cells.length > acc ? row.cells.length : acc; - }, 0); - }; - var findElementPos = function (table, element) { - var rows = table.rows; - for (var y = 0; y < rows.length; y++) { - var cells = rows[y].cells; - for (var x = 0; x < cells.length; x++) { - if (eq$2(cells[x], element)) { - return Optional.some(cellPosition(x, y)); - } - } - } - return Optional.none(); - }; - var extractRows = function (table, sx, sy, ex, ey) { - var newRows = []; - var rows = table.rows; - for (var y = sy; y <= ey; y++) { - var cells = rows[y].cells; - var slice = sx < ex ? cells.slice(sx, ex + 1) : cells.slice(ex, sx + 1); - newRows.push(tableRow(rows[y].element, slice)); - } - return newRows; - }; - var subTable = function (table, startPos, endPos) { - var sx = startPos.x, sy = startPos.y; - var ex = endPos.x, ey = endPos.y; - var newRows = sy < ey ? extractRows(table, sx, sy, ex, ey) : extractRows(table, sx, ey, ex, sy); - return tableModel(table.element, getWidth(newRows), newRows); - }; - var createDomTable = function (table, rows) { - var tableElement = shallow(table.element); - var tableBody = SugarElement.fromTag('tbody'); - append$1(tableBody, rows); - append(tableElement, tableBody); - return tableElement; - }; - var modelRowsToDomRows = function (table) { - return map(table.rows, function (row) { - var cells = map(row.cells, function (cell) { - var td = deep(cell); - remove$1(td, 'colspan'); - remove$1(td, 'rowspan'); - return td; - }); - var tr = shallow(row.element); - append$1(tr, cells); - return tr; - }); - }; - var fromDom$1 = function (tableElm) { - var table = tableModel(shallow(tableElm), 0, []); - each(descendants$1(tableElm, 'tr'), function (tr, y) { - each(descendants$1(tr, 'td,th'), function (td, x) { - fillout(table, skipCellsX(table, x, y), y, tr, td); - }); - }); - return tableModel(table.element, getWidth(table.rows), table.rows); - }; - var toDom = function (table) { - return createDomTable(table, modelRowsToDomRows(table)); - }; - var subsection = function (table, startElement, endElement) { - return findElementPos(table, startElement).bind(function (startPos) { - return findElementPos(table, endElement).map(function (endPos) { - return subTable(table, startPos, endPos); - }); - }); - }; - - var findParentListContainer = function (parents) { - return find(parents, function (elm) { - return name(elm) === 'ul' || name(elm) === 'ol'; - }); - }; - var getFullySelectedListWrappers = function (parents, rng) { - return find(parents, function (elm) { - return name(elm) === 'li' && hasAllContentsSelected(elm, rng); - }).fold(constant([]), function (_li) { - return findParentListContainer(parents).map(function (listCont) { - var listElm = SugarElement.fromTag(name(listCont)); - var listStyles = filter$1(getAllRaw(listCont), function (_style, name) { - return startsWith(name, 'list-style'); - }); - setAll$1(listElm, listStyles); - return [ - SugarElement.fromTag('li'), - listElm - ]; - }).getOr([]); - }); - }; - var wrap$3 = function (innerElm, elms) { - var wrapped = foldl(elms, function (acc, elm) { - append(elm, acc); - return elm; - }, innerElm); - return elms.length > 0 ? fromElements([wrapped]) : wrapped; - }; - var directListWrappers = function (commonAnchorContainer) { - if (isListItem(commonAnchorContainer)) { - return parent(commonAnchorContainer).filter(isList).fold(constant([]), function (listElm) { - return [ - commonAnchorContainer, - listElm - ]; - }); - } else { - return isList(commonAnchorContainer) ? [commonAnchorContainer] : []; - } - }; - var getWrapElements = function (rootNode, rng) { - var commonAnchorContainer = SugarElement.fromDom(rng.commonAncestorContainer); - var parents = parentsAndSelf(commonAnchorContainer, rootNode); - var wrapElements = filter(parents, function (elm) { - return isInline(elm) || isHeading(elm); - }); - var listWrappers = getFullySelectedListWrappers(parents, rng); - var allWrappers = wrapElements.concat(listWrappers.length ? listWrappers : directListWrappers(commonAnchorContainer)); - return map(allWrappers, shallow); - }; - var emptyFragment = function () { - return fromElements([]); - }; - var getFragmentFromRange = function (rootNode, rng) { - return wrap$3(SugarElement.fromDom(rng.cloneContents()), getWrapElements(rootNode, rng)); - }; - var getParentTable = function (rootElm, cell) { - return ancestor$1(cell, 'table', curry(eq$2, rootElm)); - }; - var getTableFragment = function (rootNode, selectedTableCells) { - return getParentTable(rootNode, selectedTableCells[0]).bind(function (tableElm) { - var firstCell = selectedTableCells[0]; - var lastCell = selectedTableCells[selectedTableCells.length - 1]; - var fullTableModel = fromDom$1(tableElm); - return subsection(fullTableModel, firstCell, lastCell).map(function (sectionedTableModel) { - return fromElements([toDom(sectionedTableModel)]); - }); - }).getOrThunk(emptyFragment); - }; - var getSelectionFragment = function (rootNode, ranges) { - return ranges.length > 0 && ranges[0].collapsed ? emptyFragment() : getFragmentFromRange(rootNode, ranges[0]); - }; - var read$1 = function (rootNode, ranges) { - var selectedCells = getCellsFromElementOrRanges(ranges, rootNode); - return selectedCells.length > 0 ? getTableFragment(rootNode, selectedCells) : getSelectionFragment(rootNode, ranges); - }; - - var trimLeadingCollapsibleText = function (text) { - return text.replace(/^[ \f\n\r\t\v]+/, ''); - }; - var isCollapsibleWhitespace = function (text, index) { - return index >= 0 && index < text.length && isWhiteSpace$1(text.charAt(index)); - }; - var getInnerText = function (bin, shouldTrim) { - var text = trim$2(bin.innerText); - return shouldTrim ? trimLeadingCollapsibleText(text) : text; - }; - var getContextNodeName = function (parentBlockOpt) { - return parentBlockOpt.map(function (block) { - return block.nodeName; - }).getOr('div').toLowerCase(); - }; - var getTextContent = function (editor) { - return Optional.from(editor.selection.getRng()).map(function (rng) { - var parentBlockOpt = Optional.from(editor.dom.getParent(rng.commonAncestorContainer, editor.dom.isBlock)); - var body = editor.getBody(); - var contextNodeName = getContextNodeName(parentBlockOpt); - var shouldTrimSpaces = Env.browser.isIE() && contextNodeName !== 'pre'; - var bin = editor.dom.add(body, contextNodeName, { - 'data-mce-bogus': 'all', - 'style': 'overflow: hidden; opacity: 0;' - }, rng.cloneContents()); - var text = getInnerText(bin, shouldTrimSpaces); - var nonRenderedText = trim$2(bin.textContent); - editor.dom.remove(bin); - if (isCollapsibleWhitespace(nonRenderedText, 0) || isCollapsibleWhitespace(nonRenderedText, nonRenderedText.length - 1)) { - var parentBlock = parentBlockOpt.getOr(body); - var parentBlockText = getInnerText(parentBlock, shouldTrimSpaces); - var textIndex = parentBlockText.indexOf(text); - if (textIndex === -1) { - return text; - } else { - var hasProceedingSpace = isCollapsibleWhitespace(parentBlockText, textIndex - 1); - var hasTrailingSpace = isCollapsibleWhitespace(parentBlockText, textIndex + text.length); - return (hasProceedingSpace ? ' ' : '') + text + (hasTrailingSpace ? ' ' : ''); - } - } else { - return text; - } - }).getOr(''); - }; - var getSerializedContent = function (editor, args) { - var rng = editor.selection.getRng(), tmpElm = editor.dom.create('body'); - var sel = editor.selection.getSel(); - var ranges = processRanges(editor, getRanges(sel)); - var fragment = args.contextual ? read$1(SugarElement.fromDom(editor.getBody()), ranges).dom : rng.cloneContents(); - if (fragment) { - tmpElm.appendChild(fragment); - } - return editor.selection.serializer.serialize(tmpElm, args); - }; - var getSelectedContentInternal = function (editor, format, args) { - if (args === void 0) { - args = {}; - } - args.get = true; - args.format = format; - args.selection = true; - args = editor.fire('BeforeGetContent', args); - if (args.isDefaultPrevented()) { - editor.fire('GetContent', args); - return args.content; - } - if (args.format === 'text') { - return getTextContent(editor); - } else { - args.getInner = true; - var content = getSerializedContent(editor, args); - if (args.format === 'tree') { - return content; - } else { - args.content = editor.selection.isCollapsed() ? '' : content; - editor.fire('GetContent', args); - return args.content; - } - } - }; - - var KEEP = 0, INSERT = 1, DELETE = 2; - var diff = function (left, right) { - var size = left.length + right.length + 2; - var vDown = new Array(size); - var vUp = new Array(size); - var snake = function (start, end, diag) { - return { - start: start, - end: end, - diag: diag - }; - }; - var buildScript = function (start1, end1, start2, end2, script) { - var middle = getMiddleSnake(start1, end1, start2, end2); - if (middle === null || middle.start === end1 && middle.diag === end1 - end2 || middle.end === start1 && middle.diag === start1 - start2) { - var i = start1; - var j = start2; - while (i < end1 || j < end2) { - if (i < end1 && j < end2 && left[i] === right[j]) { - script.push([ - KEEP, - left[i] - ]); - ++i; - ++j; - } else { - if (end1 - start1 > end2 - start2) { - script.push([ - DELETE, - left[i] - ]); - ++i; - } else { - script.push([ - INSERT, - right[j] - ]); - ++j; - } - } - } - } else { - buildScript(start1, middle.start, start2, middle.start - middle.diag, script); - for (var i2 = middle.start; i2 < middle.end; ++i2) { - script.push([ - KEEP, - left[i2] - ]); - } - buildScript(middle.end, end1, middle.end - middle.diag, end2, script); - } - }; - var buildSnake = function (start, diag, end1, end2) { - var end = start; - while (end - diag < end2 && end < end1 && left[end] === right[end - diag]) { - ++end; - } - return snake(start, end, diag); - }; - var getMiddleSnake = function (start1, end1, start2, end2) { - var m = end1 - start1; - var n = end2 - start2; - if (m === 0 || n === 0) { - return null; - } - var delta = m - n; - var sum = n + m; - var offset = (sum % 2 === 0 ? sum : sum + 1) / 2; - vDown[1 + offset] = start1; - vUp[1 + offset] = end1 + 1; - var d, k, i, x, y; - for (d = 0; d <= offset; ++d) { - for (k = -d; k <= d; k += 2) { - i = k + offset; - if (k === -d || k !== d && vDown[i - 1] < vDown[i + 1]) { - vDown[i] = vDown[i + 1]; - } else { - vDown[i] = vDown[i - 1] + 1; - } - x = vDown[i]; - y = x - start1 + start2 - k; - while (x < end1 && y < end2 && left[x] === right[y]) { - vDown[i] = ++x; - ++y; - } - if (delta % 2 !== 0 && delta - d <= k && k <= delta + d) { - if (vUp[i - delta] <= vDown[i]) { - return buildSnake(vUp[i - delta], k + start1 - start2, end1, end2); - } - } - } - for (k = delta - d; k <= delta + d; k += 2) { - i = k + offset - delta; - if (k === delta - d || k !== delta + d && vUp[i + 1] <= vUp[i - 1]) { - vUp[i] = vUp[i + 1] - 1; - } else { - vUp[i] = vUp[i - 1]; - } - x = vUp[i] - 1; - y = x - start1 + start2 - k; - while (x >= start1 && y >= start2 && left[x] === right[y]) { - vUp[i] = x--; - y--; - } - if (delta % 2 === 0 && -d <= k && k <= d) { - if (vUp[i] <= vDown[i + delta]) { - return buildSnake(vUp[i], k + start1 - start2, end1, end2); - } - } - } - } - }; - var script = []; - buildScript(0, left.length, 0, right.length, script); - return script; - }; - - var getOuterHtml = function (elm) { - if (isElement$1(elm)) { - return elm.outerHTML; - } else if (isText$1(elm)) { - return Entities.encodeRaw(elm.data, false); - } else if (isComment$1(elm)) { - return ''; - } - return ''; - }; - var createFragment$1 = function (html) { - var node; - var container = document.createElement('div'); - var frag = document.createDocumentFragment(); - if (html) { - container.innerHTML = html; - } - while (node = container.firstChild) { - frag.appendChild(node); - } - return frag; - }; - var insertAt = function (elm, html, index) { - var fragment = createFragment$1(html); - if (elm.hasChildNodes() && index < elm.childNodes.length) { - var target = elm.childNodes[index]; - target.parentNode.insertBefore(fragment, target); - } else { - elm.appendChild(fragment); - } - }; - var removeAt = function (elm, index) { - if (elm.hasChildNodes() && index < elm.childNodes.length) { - var target = elm.childNodes[index]; - target.parentNode.removeChild(target); - } - }; - var applyDiff = function (diff, elm) { - var index = 0; - each(diff, function (action) { - if (action[0] === KEEP) { - index++; - } else if (action[0] === INSERT) { - insertAt(elm, action[1], index); - index++; - } else if (action[0] === DELETE) { - removeAt(elm, index); - } - }); - }; - var read$2 = function (elm) { - return filter(map(from$1(elm.childNodes), getOuterHtml), function (item) { - return item.length > 0; - }); - }; - var write = function (fragments, elm) { - var currentFragments = map(from$1(elm.childNodes), getOuterHtml); - applyDiff(diff(currentFragments, fragments), elm); - return elm; - }; - - var undoLevelDocument = Cell(Optional.none()); - var lazyTempDocument = function () { - return undoLevelDocument.get().getOrThunk(function () { - var doc = document.implementation.createHTMLDocument('undo'); - undoLevelDocument.set(Optional.some(doc)); - return doc; - }); - }; - var hasIframes = function (html) { - return html.indexOf('') !== -1; - }; - var createFragmentedLevel = function (fragments) { - return { - type: 'fragmented', - fragments: fragments, - content: '', - bookmark: null, - beforeBookmark: null - }; - }; - var createCompleteLevel = function (content) { - return { - type: 'complete', - fragments: null, - content: content, - bookmark: null, - beforeBookmark: null - }; - }; - var createFromEditor = function (editor) { - var fragments = read$2(editor.getBody()); - var trimmedFragments = bind(fragments, function (html) { - var trimmed = trimInternal(editor.serializer, html); - return trimmed.length > 0 ? [trimmed] : []; - }); - var content = trimmedFragments.join(''); - return hasIframes(content) ? createFragmentedLevel(trimmedFragments) : createCompleteLevel(content); - }; - var applyToEditor = function (editor, level, before) { - if (level.type === 'fragmented') { - write(level.fragments, editor.getBody()); - } else { - editor.setContent(level.content, { format: 'raw' }); - } - editor.selection.moveToBookmark(before ? level.beforeBookmark : level.bookmark); - }; - var getLevelContent = function (level) { - return level.type === 'fragmented' ? level.fragments.join('') : level.content; - }; - var getCleanLevelContent = function (level) { - var elm = SugarElement.fromTag('body', lazyTempDocument()); - set$1(elm, getLevelContent(level)); - each(descendants$1(elm, '*[data-mce-bogus]'), unwrap); - return get$7(elm); - }; - var hasEqualContent = function (level1, level2) { - return getLevelContent(level1) === getLevelContent(level2); - }; - var hasEqualCleanedContent = function (level1, level2) { - return getCleanLevelContent(level1) === getCleanLevelContent(level2); - }; - var isEq$4 = function (level1, level2) { - if (!level1 || !level2) { - return false; - } else if (hasEqualContent(level1, level2)) { - return true; - } else { - return hasEqualCleanedContent(level1, level2); - } - }; - - var isUnlocked = function (locks) { - return locks.get() === 0; - }; - - var setTyping = function (undoManager, typing, locks) { - if (isUnlocked(locks)) { - undoManager.typing = typing; - } - }; - var endTyping = function (undoManager, locks) { - if (undoManager.typing) { - setTyping(undoManager, false, locks); - undoManager.add(); - } - }; - var endTypingLevelIgnoreLocks = function (undoManager) { - if (undoManager.typing) { - undoManager.typing = false; - undoManager.add(); - } - }; - - var beforeChange = function (editor, locks, beforeBookmark) { - if (isUnlocked(locks)) { - beforeBookmark.set(Optional.some(getUndoBookmark(editor.selection))); - } - }; - var addUndoLevel = function (editor, undoManager, index, locks, beforeBookmark, level, event) { - var currentLevel = createFromEditor(editor); - level = level || {}; - level = Tools.extend(level, currentLevel); - if (isUnlocked(locks) === false || editor.removed) { - return null; - } - var lastLevel = undoManager.data[index.get()]; - if (editor.fire('BeforeAddUndo', { - level: level, - lastLevel: lastLevel, - originalEvent: event - }).isDefaultPrevented()) { - return null; - } - if (lastLevel && isEq$4(lastLevel, level)) { - return null; - } - if (undoManager.data[index.get()]) { - beforeBookmark.get().each(function (bm) { - undoManager.data[index.get()].beforeBookmark = bm; - }); - } - var customUndoRedoLevels = getCustomUndoRedoLevels(editor); - if (customUndoRedoLevels) { - if (undoManager.data.length > customUndoRedoLevels) { - for (var i = 0; i < undoManager.data.length - 1; i++) { - undoManager.data[i] = undoManager.data[i + 1]; - } - undoManager.data.length--; - index.set(undoManager.data.length); - } - } - level.bookmark = getUndoBookmark(editor.selection); - if (index.get() < undoManager.data.length - 1) { - undoManager.data.length = index.get() + 1; - } - undoManager.data.push(level); - index.set(undoManager.data.length - 1); - var args = { - level: level, - lastLevel: lastLevel, - originalEvent: event - }; - if (index.get() > 0) { - editor.setDirty(true); - editor.fire('AddUndo', args); - editor.fire('change', args); - } else { - editor.fire('AddUndo', args); - } - return level; - }; - var clear = function (editor, undoManager, index) { - undoManager.data = []; - index.set(0); - undoManager.typing = false; - editor.fire('ClearUndos'); - }; - var extra = function (editor, undoManager, index, callback1, callback2) { - if (undoManager.transact(callback1)) { - var bookmark = undoManager.data[index.get()].bookmark; - var lastLevel = undoManager.data[index.get() - 1]; - applyToEditor(editor, lastLevel, true); - if (undoManager.transact(callback2)) { - undoManager.data[index.get() - 1].beforeBookmark = bookmark; - } - } - }; - var redo = function (editor, index, data) { - var level; - if (index.get() < data.length - 1) { - index.set(index.get() + 1); - level = data[index.get()]; - applyToEditor(editor, level, false); - editor.setDirty(true); - editor.fire('Redo', { level: level }); - } - return level; - }; - var undo = function (editor, undoManager, locks, index) { - var level; - if (undoManager.typing) { - undoManager.add(); - undoManager.typing = false; - setTyping(undoManager, false, locks); - } - if (index.get() > 0) { - index.set(index.get() - 1); - level = undoManager.data[index.get()]; - applyToEditor(editor, level, true); - editor.setDirty(true); - editor.fire('Undo', { level: level }); - } - return level; - }; - var reset = function (undoManager) { - undoManager.clear(); - undoManager.add(); - }; - var hasUndo = function (editor, undoManager, index) { - return index.get() > 0 || undoManager.typing && undoManager.data[0] && !isEq$4(createFromEditor(editor), undoManager.data[0]); - }; - var hasRedo = function (undoManager, index) { - return index.get() < undoManager.data.length - 1 && !undoManager.typing; - }; - var transact = function (undoManager, locks, callback) { - endTyping(undoManager, locks); - undoManager.beforeChange(); - undoManager.ignore(callback); - return undoManager.add(); - }; - var ignore = function (locks, callback) { - try { - locks.set(locks.get() + 1); - callback(); - } finally { - locks.set(locks.get() - 1); - } - }; - - var isTreeNode$1 = function (content) { - return content instanceof AstNode; - }; - var runSerializerFiltersOnFragment = function (editor, fragment) { - filter$3(editor.serializer.getNodeFilters(), editor.serializer.getAttributeFilters(), fragment); - }; - var getInsertContext = function (editor) { - return Optional.from(editor.selection.getStart(true)).map(function (elm) { - return elm.nodeName.toLowerCase(); - }); - }; - var createDummyUndoLevel = function () { - return { - type: 'complete', - fragments: [], - content: '', - bookmark: null, - beforeBookmark: null - }; - }; - var makePlainAdaptor = function (editor) { - return { - undoManager: { - beforeChange: function (locks, beforeBookmark) { - return beforeChange(editor, locks, beforeBookmark); - }, - addUndoLevel: function (undoManager, index, locks, beforeBookmark, level, event) { - return addUndoLevel(editor, undoManager, index, locks, beforeBookmark, level, event); - }, - undo: function (undoManager, locks, index) { - return undo(editor, undoManager, locks, index); - }, - redo: function (index, data) { - return redo(editor, index, data); - }, - clear: function (undoManager, index) { - return clear(editor, undoManager, index); - }, - reset: function (undoManager) { - return reset(undoManager); - }, - hasUndo: function (undoManager, index) { - return hasUndo(editor, undoManager, index); - }, - hasRedo: function (undoManager, index) { - return hasRedo(undoManager, index); - }, - transact: function (undoManager, locks, callback) { - return transact(undoManager, locks, callback); - }, - ignore: function (locks, callback) { - return ignore(locks, callback); - }, - extra: function (undoManager, index, callback1, callback2) { - return extra(editor, undoManager, index, callback1, callback2); - } - }, - formatter: { - match: function (name, vars, node) { - return match(editor, name, vars, node); - }, - matchAll: function (names, vars) { - return matchAll(editor, names, vars); - }, - matchNode: function (node, name, vars, similar) { - return matchNode(editor, node, name, vars, similar); - }, - canApply: function (name) { - return canApply(editor, name); - }, - closest: function (names) { - return closest$3(editor, names); - }, - apply: function (name, vars, node) { - return applyFormat(editor, name, vars, node); - }, - remove: function (name, vars, node, similar) { - return remove$6(editor, name, vars, node, similar); - }, - toggle: function (name, vars, node) { - return toggle(editor, name, vars, node); - }, - formatChanged: function (registeredFormatListeners, formats, callback, similar) { - return formatChangedInternal(editor, registeredFormatListeners, formats, callback, similar); - } - }, - editor: { - getContent: function (args, format) { - return getContentInternal(editor, args, format); - }, - setContent: function (content, args) { - return setContentInternal(editor, content, args); - }, - insertContent: function (value, details) { - return insertHtmlAtCaret(editor, value, details); - }, - addVisual: function (elm) { - return addVisualInternal(editor, elm); - } - }, - selection: { - getContent: function (format, args) { - return getSelectedContentInternal(editor, format, args); - } - }, - raw: { - getModel: function () { - return Optional.none(); - } - } - }; - }; - var makeRtcAdaptor = function (tinymceEditor, rtcEditor) { - var defaultVars = function (vars) { - return isObject(vars) ? vars : {}; - }; - var unsupported = die('Unimplemented feature for rtc'); - var ignore = noop; - return { - undoManager: { - beforeChange: ignore, - addUndoLevel: unsupported, - undo: function () { - rtcEditor.undo(); - return createDummyUndoLevel(); - }, - redo: function () { - rtcEditor.redo(); - return createDummyUndoLevel(); - }, - clear: unsupported, - reset: unsupported, - hasUndo: function () { - return rtcEditor.hasUndo(); - }, - hasRedo: function () { - return rtcEditor.hasRedo(); - }, - transact: function (_undoManager, _locks, fn) { - rtcEditor.transact(fn); - return createDummyUndoLevel(); - }, - ignore: unsupported, - extra: unsupported - }, - formatter: { - match: function (name, vars, _node) { - return rtcEditor.matchFormat(name, defaultVars(vars)); - }, - matchAll: unsupported, - matchNode: unsupported, - canApply: function (name) { - return rtcEditor.canApplyFormat(name); - }, - closest: function (names) { - return rtcEditor.closestFormat(names); - }, - apply: function (name, vars, _node) { - return rtcEditor.applyFormat(name, defaultVars(vars)); - }, - remove: function (name, vars, _node, _similar) { - return rtcEditor.removeFormat(name, defaultVars(vars)); - }, - toggle: function (name, vars, _node) { - return rtcEditor.toggleFormat(name, defaultVars(vars)); - }, - formatChanged: function (_rfl, formats, callback, similar) { - return rtcEditor.formatChanged(formats, callback, similar); - } - }, - editor: { - getContent: function (args, format) { - if (format === 'html' || format === 'tree') { - var fragment = rtcEditor.getContent(); - var serializer = HtmlSerializer({ inner: true }); - runSerializerFiltersOnFragment(tinymceEditor, fragment); - return format === 'tree' ? fragment : serializer.serialize(fragment); - } else { - return makePlainAdaptor(tinymceEditor).editor.getContent(args, format); - } - }, - setContent: function (content, _args) { - var fragment = isTreeNode$1(content) ? content : tinymceEditor.parser.parse(content, { - isRootContent: true, - insert: true - }); - rtcEditor.setContent(fragment); - return content; - }, - insertContent: function (value, _details) { - var contextArgs = getInsertContext(tinymceEditor).fold(function () { - return {}; - }, function (context) { - return { context: context }; - }); - var fragment = isTreeNode$1(value) ? value : tinymceEditor.parser.parse(value, __assign(__assign({}, contextArgs), { insert: true })); - rtcEditor.insertContent(fragment); - }, - addVisual: function (_elm) { - } - }, - selection: { - getContent: function (format, args) { - if (format === 'html' || format === 'tree') { - var fragment = rtcEditor.getSelectedContent(); - var serializer = HtmlSerializer({}); - runSerializerFiltersOnFragment(tinymceEditor, fragment); - return format === 'tree' ? fragment : serializer.serialize(fragment); - } else { - return makePlainAdaptor(tinymceEditor).selection.getContent(format, args); - } - } - }, - raw: { - getModel: function () { - return Optional.some(rtcEditor.getRawModel()); - } - } - }; - }; - var isRtc = function (editor) { - return has(editor.plugins, 'rtc'); - }; - var setup$5 = function (editor) { - var editorCast = editor; - return get$1(editor.plugins, 'rtc').fold(function () { - editorCast.rtcInstance = makePlainAdaptor(editor); - return Optional.none(); - }, function (rtc) { - return Optional.some(rtc.setup().then(function (rtcEditor) { - editorCast.rtcInstance = makeRtcAdaptor(editor, rtcEditor); - return rtcEditor.isRemote; - })); - }); - }; - var getRtcInstanceWithFallback = function (editor) { - return editor.rtcInstance ? editor.rtcInstance : makePlainAdaptor(editor); - }; - var getRtcInstanceWithError = function (editor) { - var rtcInstance = editor.rtcInstance; - if (!rtcInstance) { - throw new Error('Failed to get RTC instance not yet initialized.'); - } else { - return rtcInstance; - } - }; - var beforeChange$1 = function (editor, locks, beforeBookmark) { - getRtcInstanceWithError(editor).undoManager.beforeChange(locks, beforeBookmark); - }; - var addUndoLevel$1 = function (editor, undoManager, index, locks, beforeBookmark, level, event) { - return getRtcInstanceWithError(editor).undoManager.addUndoLevel(undoManager, index, locks, beforeBookmark, level, event); - }; - var undo$1 = function (editor, undoManager, locks, index) { - return getRtcInstanceWithError(editor).undoManager.undo(undoManager, locks, index); - }; - var redo$1 = function (editor, index, data) { - return getRtcInstanceWithError(editor).undoManager.redo(index, data); - }; - var clear$1 = function (editor, undoManager, index) { - getRtcInstanceWithError(editor).undoManager.clear(undoManager, index); - }; - var reset$1 = function (editor, undoManager) { - getRtcInstanceWithError(editor).undoManager.reset(undoManager); - }; - var hasUndo$1 = function (editor, undoManager, index) { - return getRtcInstanceWithError(editor).undoManager.hasUndo(undoManager, index); - }; - var hasRedo$1 = function (editor, undoManager, index) { - return getRtcInstanceWithError(editor).undoManager.hasRedo(undoManager, index); - }; - var transact$1 = function (editor, undoManager, locks, callback) { - return getRtcInstanceWithError(editor).undoManager.transact(undoManager, locks, callback); - }; - var ignore$1 = function (editor, locks, callback) { - getRtcInstanceWithError(editor).undoManager.ignore(locks, callback); - }; - var extra$1 = function (editor, undoManager, index, callback1, callback2) { - getRtcInstanceWithError(editor).undoManager.extra(undoManager, index, callback1, callback2); - }; - var matchFormat = function (editor, name, vars, node) { - return getRtcInstanceWithError(editor).formatter.match(name, vars, node); - }; - var matchAllFormats = function (editor, names, vars) { - return getRtcInstanceWithError(editor).formatter.matchAll(names, vars); - }; - var matchNodeFormat = function (editor, node, name, vars, similar) { - return getRtcInstanceWithError(editor).formatter.matchNode(node, name, vars, similar); - }; - var canApplyFormat = function (editor, name) { - return getRtcInstanceWithError(editor).formatter.canApply(name); - }; - var closestFormat = function (editor, names) { - return getRtcInstanceWithError(editor).formatter.closest(names); - }; - var applyFormat$1 = function (editor, name, vars, node) { - getRtcInstanceWithError(editor).formatter.apply(name, vars, node); - }; - var removeFormat$1 = function (editor, name, vars, node, similar) { - getRtcInstanceWithError(editor).formatter.remove(name, vars, node, similar); - }; - var toggleFormat = function (editor, name, vars, node) { - getRtcInstanceWithError(editor).formatter.toggle(name, vars, node); - }; - var formatChanged = function (editor, registeredFormatListeners, formats, callback, similar) { - if (similar === void 0) { - similar = false; - } - return getRtcInstanceWithError(editor).formatter.formatChanged(registeredFormatListeners, formats, callback, similar); - }; - var getContent = function (editor, args, format) { - return getRtcInstanceWithFallback(editor).editor.getContent(args, format); - }; - var setContent = function (editor, content, args) { - return getRtcInstanceWithFallback(editor).editor.setContent(content, args); - }; - var insertContent = function (editor, value, details) { - return getRtcInstanceWithFallback(editor).editor.insertContent(value, details); - }; - var getSelectedContent = function (editor, format, args) { - return getRtcInstanceWithError(editor).selection.getContent(format, args); - }; - var addVisual = function (editor, elm) { - return getRtcInstanceWithError(editor).editor.addVisual(elm); - }; - - var getContent$1 = function (editor, args) { - if (args === void 0) { - args = {}; - } - var format = args.format ? args.format : 'html'; - return getSelectedContent(editor, format, args); - }; - - var removeEmpty = function (text) { - if (text.dom.length === 0) { - remove(text); - return Optional.none(); - } else { - return Optional.some(text); - } - }; - var walkPastBookmark = function (node, start) { - return node.filter(function (elm) { - return BookmarkManager$1.isBookmarkNode(elm.dom); - }).bind(start ? nextSibling : prevSibling); - }; - var merge = function (outer, inner, rng, start) { - var outerElm = outer.dom; - var innerElm = inner.dom; - var oldLength = start ? outerElm.length : innerElm.length; - if (start) { - mergeTextNodes(outerElm, innerElm, false, !start); - rng.setStart(innerElm, oldLength); - } else { - mergeTextNodes(innerElm, outerElm, false, !start); - rng.setEnd(innerElm, oldLength); - } - }; - var normalizeTextIfRequired = function (inner, start) { - parent(inner).each(function (root) { - var text = inner.dom; - if (start && needsToBeNbspLeft(root, CaretPosition$1(text, 0))) { - normalizeWhitespaceAfter(text, 0); - } else if (!start && needsToBeNbspRight(root, CaretPosition$1(text, text.length))) { - normalizeWhitespaceBefore(text, text.length); - } - }); - }; - var mergeAndNormalizeText = function (outerNode, innerNode, rng, start) { - outerNode.bind(function (outer) { - var normalizer = start ? normalizeWhitespaceBefore : normalizeWhitespaceAfter; - normalizer(outer.dom, start ? outer.dom.length : 0); - return innerNode.filter(isText).map(function (inner) { - return merge(outer, inner, rng, start); - }); - }).orThunk(function () { - var innerTextNode = walkPastBookmark(innerNode, start).or(innerNode).filter(isText); - return innerTextNode.map(function (inner) { - return normalizeTextIfRequired(inner, start); - }); - }); - }; - var rngSetContent = function (rng, fragment) { - var firstChild = Optional.from(fragment.firstChild).map(SugarElement.fromDom); - var lastChild = Optional.from(fragment.lastChild).map(SugarElement.fromDom); - rng.deleteContents(); - rng.insertNode(fragment); - var prevText = firstChild.bind(prevSibling).filter(isText).bind(removeEmpty); - var nextText = lastChild.bind(nextSibling).filter(isText).bind(removeEmpty); - mergeAndNormalizeText(prevText, firstChild, rng, true); - mergeAndNormalizeText(nextText, lastChild, rng, false); - rng.collapse(false); - }; - var setupArgs = function (args, content) { - return __assign(__assign({ format: 'html' }, args), { - set: true, - selection: true, - content: content - }); - }; - var cleanContent = function (editor, args) { - if (args.format !== 'raw') { - var rng = editor.selection.getRng(); - var contextBlock = editor.dom.getParent(rng.commonAncestorContainer, editor.dom.isBlock); - var contextArgs = contextBlock ? { context: contextBlock.nodeName.toLowerCase() } : {}; - var node = editor.parser.parse(args.content, __assign(__assign({ - isRootContent: true, - forced_root_block: false - }, contextArgs), args)); - return HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(node); - } else { - return args.content; - } - }; - var setContent$1 = function (editor, content, args) { - if (args === void 0) { - args = {}; - } - var contentArgs = setupArgs(args, content); - if (!contentArgs.no_events) { - contentArgs = editor.fire('BeforeSetContent', contentArgs); - if (contentArgs.isDefaultPrevented()) { - editor.fire('SetContent', contentArgs); - return; - } - } - args.content = cleanContent(editor, contentArgs); - var rng = editor.selection.getRng(); - rngSetContent(rng, rng.createContextualFragment(args.content)); - editor.selection.setRng(rng); - scrollRangeIntoView(editor, rng); - if (!contentArgs.no_events) { - editor.fire('SetContent', contentArgs); - } - }; - - var deleteFromCallbackMap = function (callbackMap, selector, callback) { - if (callbackMap && callbackMap.hasOwnProperty(selector)) { - var newCallbacks = filter(callbackMap[selector], function (cb) { - return cb !== callback; - }); - if (newCallbacks.length === 0) { - delete callbackMap[selector]; - } else { - callbackMap[selector] = newCallbacks; - } - } - }; - function SelectorChanged (dom, editor) { - var selectorChangedData; - var currentSelectors; - return { - selectorChangedWithUnbind: function (selector, callback) { - if (!selectorChangedData) { - selectorChangedData = {}; - currentSelectors = {}; - editor.on('NodeChange', function (e) { - var node = e.element, parents = dom.getParents(node, null, dom.getRoot()), matchedSelectors = {}; - Tools.each(selectorChangedData, function (callbacks, selector) { - Tools.each(parents, function (node) { - if (dom.is(node, selector)) { - if (!currentSelectors[selector]) { - Tools.each(callbacks, function (callback) { - callback(true, { - node: node, - selector: selector, - parents: parents - }); - }); - currentSelectors[selector] = callbacks; - } - matchedSelectors[selector] = callbacks; - return false; - } - }); - }); - Tools.each(currentSelectors, function (callbacks, selector) { - if (!matchedSelectors[selector]) { - delete currentSelectors[selector]; - Tools.each(callbacks, function (callback) { - callback(false, { - node: node, - selector: selector, - parents: parents - }); - }); - } - }); - }); - } - if (!selectorChangedData[selector]) { - selectorChangedData[selector] = []; - } - selectorChangedData[selector].push(callback); - return { - unbind: function () { - deleteFromCallbackMap(selectorChangedData, selector, callback); - deleteFromCallbackMap(currentSelectors, selector, callback); - } - }; - } - }; - } - - var isNativeIeSelection = function (rng) { - return !!rng.select; - }; - var isAttachedToDom = function (node) { - return !!(node && node.ownerDocument) && contains$2(SugarElement.fromDom(node.ownerDocument), SugarElement.fromDom(node)); - }; - var isValidRange = function (rng) { - if (!rng) { - return false; - } else if (isNativeIeSelection(rng)) { - return true; - } else { - return isAttachedToDom(rng.startContainer) && isAttachedToDom(rng.endContainer); - } - }; - var EditorSelection = function (dom, win, serializer, editor) { - var selectedRange; - var explicitRange; - var selectorChangedWithUnbind = SelectorChanged(dom, editor).selectorChangedWithUnbind; - var setCursorLocation = function (node, offset) { - var rng = dom.createRng(); - if (!node) { - moveEndPoint$1(dom, rng, editor.getBody(), true); - setRng(rng); - } else { - rng.setStart(node, offset); - rng.setEnd(node, offset); - setRng(rng); - collapse(false); - } - }; - var getContent = function (args) { - return getContent$1(editor, args); - }; - var setContent = function (content, args) { - return setContent$1(editor, content, args); - }; - var getStart = function (real) { - return getStart$2(editor.getBody(), getRng$1(), real); - }; - var getEnd$1 = function (real) { - return getEnd(editor.getBody(), getRng$1(), real); - }; - var getBookmark = function (type, normalized) { - return bookmarkManager.getBookmark(type, normalized); - }; - var moveToBookmark = function (bookmark) { - return bookmarkManager.moveToBookmark(bookmark); - }; - var select = function (node, content) { - select$1(dom, node, content).each(setRng); - return node; - }; - var isCollapsed = function () { - var rng = getRng$1(), sel = getSel(); - if (!rng || rng.item) { - return false; - } - if (rng.compareEndPoints) { - return rng.compareEndPoints('StartToEnd', rng) === 0; - } - return !sel || rng.collapsed; - }; - var collapse = function (toStart) { - var rng = getRng$1(); - rng.collapse(!!toStart); - setRng(rng); - }; - var getSel = function () { - return win.getSelection ? win.getSelection() : win.document.selection; - }; - var getRng$1 = function () { - var selection, rng, elm; - var tryCompareBoundaryPoints = function (how, sourceRange, destinationRange) { - try { - return sourceRange.compareBoundaryPoints(how, destinationRange); - } catch (ex) { - return -1; - } - }; - if (!win) { - return null; - } - var doc = win.document; - if (typeof doc === 'undefined' || doc === null) { - return null; - } - if (editor.bookmark !== undefined && hasFocus$1(editor) === false) { - var bookmark = getRng(editor); - if (bookmark.isSome()) { - return bookmark.map(function (r) { - return processRanges(editor, [r])[0]; - }).getOr(doc.createRange()); - } - } - try { - if ((selection = getSel()) && !isRestrictedNode(selection.anchorNode)) { - if (selection.rangeCount > 0) { - rng = selection.getRangeAt(0); - } else { - rng = selection.createRange ? selection.createRange() : doc.createRange(); - } - rng = processRanges(editor, [rng])[0]; - } - } catch (ex) { - } - if (!rng) { - rng = doc.createRange ? doc.createRange() : doc.body.createTextRange(); - } - if (rng.setStart && rng.startContainer.nodeType === 9 && rng.collapsed) { - elm = dom.getRoot(); - rng.setStart(elm, 0); - rng.setEnd(elm, 0); - } - if (selectedRange && explicitRange) { - if (tryCompareBoundaryPoints(rng.START_TO_START, rng, selectedRange) === 0 && tryCompareBoundaryPoints(rng.END_TO_END, rng, selectedRange) === 0) { - rng = explicitRange; - } else { - selectedRange = null; - explicitRange = null; - } - } - return rng; - }; - var setRng = function (rng, forward) { - var node; - if (!isValidRange(rng)) { - return; - } - var ieRange = isNativeIeSelection(rng) ? rng : null; - if (ieRange) { - explicitRange = null; - try { - ieRange.select(); - } catch (ex) { - } - return; - } - var sel = getSel(); - var evt = editor.fire('SetSelectionRange', { - range: rng, - forward: forward - }); - rng = evt.range; - if (sel) { - explicitRange = rng; - try { - sel.removeAllRanges(); - sel.addRange(rng); - } catch (ex) { - } - if (forward === false && sel.extend) { - sel.collapse(rng.endContainer, rng.endOffset); - sel.extend(rng.startContainer, rng.startOffset); - } - selectedRange = sel.rangeCount > 0 ? sel.getRangeAt(0) : null; - } - if (!rng.collapsed && rng.startContainer === rng.endContainer && sel.setBaseAndExtent && !Env.ie) { - if (rng.endOffset - rng.startOffset < 2) { - if (rng.startContainer.hasChildNodes()) { - node = rng.startContainer.childNodes[rng.startOffset]; - if (node && node.tagName === 'IMG') { - sel.setBaseAndExtent(rng.startContainer, rng.startOffset, rng.endContainer, rng.endOffset); - if (sel.anchorNode !== rng.startContainer || sel.focusNode !== rng.endContainer) { - sel.setBaseAndExtent(node, 0, node, 1); - } - } - } - } - } - editor.fire('AfterSetSelectionRange', { - range: rng, - forward: forward - }); - }; - var setNode = function (elm) { - setContent(dom.getOuterHTML(elm)); - return elm; - }; - var getNode = function () { - return getNode$1(editor.getBody(), getRng$1()); - }; - var getSelectedBlocks$1 = function (startElm, endElm) { - return getSelectedBlocks(dom, getRng$1(), startElm, endElm); - }; - var isForward = function () { - var sel = getSel(); - var anchorNode = sel === null || sel === void 0 ? void 0 : sel.anchorNode; - var focusNode = sel === null || sel === void 0 ? void 0 : sel.focusNode; - if (!sel || !anchorNode || !focusNode || isRestrictedNode(anchorNode) || isRestrictedNode(focusNode)) { - return true; - } - var anchorRange = dom.createRng(); - anchorRange.setStart(anchorNode, sel.anchorOffset); - anchorRange.collapse(true); - var focusRange = dom.createRng(); - focusRange.setStart(focusNode, sel.focusOffset); - focusRange.collapse(true); - return anchorRange.compareBoundaryPoints(anchorRange.START_TO_START, focusRange) <= 0; - }; - var normalize$1 = function () { - var rng = getRng$1(); - var sel = getSel(); - if (!hasMultipleRanges(sel) && hasAnyRanges(editor)) { - var normRng = normalize(dom, rng); - normRng.each(function (normRng) { - setRng(normRng, isForward()); - }); - return normRng.getOr(rng); - } - return rng; - }; - var selectorChanged = function (selector, callback) { - selectorChangedWithUnbind(selector, callback); - return exports; - }; - var getScrollContainer = function () { - var scrollContainer; - var node = dom.getRoot(); - while (node && node.nodeName !== 'BODY') { - if (node.scrollHeight > node.clientHeight) { - scrollContainer = node; - break; - } - node = node.parentNode; - } - return scrollContainer; - }; - var scrollIntoView = function (elm, alignToTop) { - return scrollElementIntoView(editor, elm, alignToTop); - }; - var placeCaretAt = function (clientX, clientY) { - return setRng(fromPoint$1(clientX, clientY, editor.getDoc())); - }; - var getBoundingClientRect = function () { - var rng = getRng$1(); - return rng.collapsed ? CaretPosition$1.fromRangeStart(rng).getClientRects()[0] : rng.getBoundingClientRect(); - }; - var destroy = function () { - win = selectedRange = explicitRange = null; - controlSelection.destroy(); - }; - var exports = { - bookmarkManager: null, - controlSelection: null, - dom: dom, - win: win, - serializer: serializer, - editor: editor, - collapse: collapse, - setCursorLocation: setCursorLocation, - getContent: getContent, - setContent: setContent, - getBookmark: getBookmark, - moveToBookmark: moveToBookmark, - select: select, - isCollapsed: isCollapsed, - isForward: isForward, - setNode: setNode, - getNode: getNode, - getSel: getSel, - setRng: setRng, - getRng: getRng$1, - getStart: getStart, - getEnd: getEnd$1, - getSelectedBlocks: getSelectedBlocks$1, - normalize: normalize$1, - selectorChanged: selectorChanged, - selectorChangedWithUnbind: selectorChangedWithUnbind, - getScrollContainer: getScrollContainer, - scrollIntoView: scrollIntoView, - placeCaretAt: placeCaretAt, - getBoundingClientRect: getBoundingClientRect, - destroy: destroy - }; - var bookmarkManager = BookmarkManager$1(exports); - var controlSelection = ControlSelection(exports, editor); - exports.bookmarkManager = bookmarkManager; - exports.controlSelection = controlSelection; - return exports; - }; - - var removeAttrs = function (node, names) { - each(names, function (name) { - node.attr(name, null); - }); - }; - var addFontToSpansFilter = function (domParser, styles, fontSizes) { - domParser.addNodeFilter('font', function (nodes) { - each(nodes, function (node) { - var props = styles.parse(node.attr('style')); - var color = node.attr('color'); - var face = node.attr('face'); - var size = node.attr('size'); - if (color) { - props.color = color; - } - if (face) { - props['font-family'] = face; - } - if (size) { - props['font-size'] = fontSizes[parseInt(node.attr('size'), 10) - 1]; - } - node.name = 'span'; - node.attr('style', styles.serialize(props)); - removeAttrs(node, [ - 'color', - 'face', - 'size' - ]); - }); - }); - }; - var addStrikeToSpanFilter = function (domParser, styles) { - domParser.addNodeFilter('strike', function (nodes) { - each(nodes, function (node) { - var props = styles.parse(node.attr('style')); - props['text-decoration'] = 'line-through'; - node.name = 'span'; - node.attr('style', styles.serialize(props)); - }); - }); - }; - var addFilters = function (domParser, settings) { - var styles = Styles(); - if (settings.convert_fonts_to_spans) { - addFontToSpansFilter(domParser, styles, Tools.explode(settings.font_size_legacy_values)); - } - addStrikeToSpanFilter(domParser, styles); - }; - var register$1 = function (domParser, settings) { - if (settings.inline_styles) { - addFilters(domParser, settings); - } - }; - - var blobUriToBlob = function (url) { - return new promiseObj(function (resolve, reject) { - var rejectWithError = function () { - reject('Cannot convert ' + url + ' to Blob. Resource might not exist or is inaccessible.'); - }; - try { - var xhr = new XMLHttpRequest(); - xhr.open('GET', url, true); - xhr.responseType = 'blob'; - xhr.onload = function () { - if (this.status === 200) { - resolve(this.response); - } else { - rejectWithError(); - } - }; - xhr.onerror = rejectWithError; - xhr.send(); - } catch (ex) { - rejectWithError(); - } - }); - }; - var parseDataUri$1 = function (uri) { - var type; - var uriParts = decodeURIComponent(uri).split(','); - var matches = /data:([^;]+)/.exec(uriParts[0]); - if (matches) { - type = matches[1]; - } - return { - type: type, - data: uriParts[1] - }; - }; - var buildBlob = function (type, data) { - var str; - try { - str = atob(data); - } catch (e) { - return Optional.none(); - } - var arr = new Uint8Array(str.length); - for (var i = 0; i < arr.length; i++) { - arr[i] = str.charCodeAt(i); - } - return Optional.some(new Blob([arr], { type: type })); - }; - var dataUriToBlob = function (uri) { - return new promiseObj(function (resolve) { - var _a = parseDataUri$1(uri), type = _a.type, data = _a.data; - buildBlob(type, data).fold(function () { - return resolve(new Blob([])); - }, resolve); - }); - }; - var uriToBlob = function (url) { - if (url.indexOf('blob:') === 0) { - return blobUriToBlob(url); - } - if (url.indexOf('data:') === 0) { - return dataUriToBlob(url); - } - return null; - }; - var blobToDataUri = function (blob) { - return new promiseObj(function (resolve) { - var reader = new FileReader(); - reader.onloadend = function () { - resolve(reader.result); - }; - reader.readAsDataURL(blob); - }); - }; - - var count = 0; - var uniqueId = function (prefix) { - return (prefix || 'blobid') + count++; - }; - var imageToBlobInfo = function (blobCache, img, resolve, reject) { - var base64, blobInfo; - if (img.src.indexOf('blob:') === 0) { - blobInfo = blobCache.getByUri(img.src); - if (blobInfo) { - resolve({ - image: img, - blobInfo: blobInfo - }); - } else { - uriToBlob(img.src).then(function (blob) { - blobToDataUri(blob).then(function (dataUri) { - base64 = parseDataUri$1(dataUri).data; - blobInfo = blobCache.create(uniqueId(), blob, base64); - blobCache.add(blobInfo); - resolve({ - image: img, - blobInfo: blobInfo - }); - }); - }, function (err) { - reject(err); - }); - } - return; - } - var _a = parseDataUri$1(img.src), data = _a.data, type = _a.type; - base64 = data; - blobInfo = blobCache.getByData(base64, type); - if (blobInfo) { - resolve({ - image: img, - blobInfo: blobInfo - }); - } else { - uriToBlob(img.src).then(function (blob) { - blobInfo = blobCache.create(uniqueId(), blob, base64); - blobCache.add(blobInfo); - resolve({ - image: img, - blobInfo: blobInfo - }); - }, function (err) { - reject(err); - }); - } - }; - var getAllImages = function (elm) { - return elm ? from$1(elm.getElementsByTagName('img')) : []; - }; - function ImageScanner(uploadStatus, blobCache) { - var cachedPromises = {}; - var findAll = function (elm, predicate) { - if (!predicate) { - predicate = always; - } - var images = filter(getAllImages(elm), function (img) { - var src = img.src; - if (!Env.fileApi) { - return false; - } - if (img.hasAttribute('data-mce-bogus')) { - return false; - } - if (img.hasAttribute('data-mce-placeholder')) { - return false; - } - if (!src || src === Env.transparentSrc) { - return false; - } - if (src.indexOf('blob:') === 0) { - return !uploadStatus.isUploaded(src) && predicate(img); - } - if (src.indexOf('data:') === 0) { - return predicate(img); - } - return false; - }); - var promises = map(images, function (img) { - if (cachedPromises[img.src] !== undefined) { - return new promiseObj(function (resolve) { - cachedPromises[img.src].then(function (imageInfo) { - if (typeof imageInfo === 'string') { - return imageInfo; - } - resolve({ - image: img, - blobInfo: imageInfo.blobInfo - }); - }); - }); - } - var newPromise = new promiseObj(function (resolve, reject) { - imageToBlobInfo(blobCache, img, resolve, reject); - }).then(function (result) { - delete cachedPromises[result.image.src]; - return result; - }).catch(function (error) { - delete cachedPromises[img.src]; - return error; - }); - cachedPromises[img.src] = newPromise; - return newPromise; - }); - return promiseObj.all(promises); - }; - return { findAll: findAll }; - } - - var paddEmptyNode = function (settings, args, blockElements, node) { - var brPreferred = settings.padd_empty_with_br || args.insert; - if (brPreferred && blockElements[node.name]) { - node.empty().append(new AstNode('br', 1)).shortEnded = true; - } else { - node.empty().append(new AstNode('#text', 3)).value = nbsp; - } - }; - var isPaddedWithNbsp = function (node) { - return hasOnlyChild(node, '#text') && node.firstChild.value === nbsp; - }; - var hasOnlyChild = function (node, name) { - return node && node.firstChild && node.firstChild === node.lastChild && node.firstChild.name === name; - }; - var isPadded = function (schema, node) { - var rule = schema.getElementRule(node.name); - return rule && rule.paddEmpty; - }; - var isEmpty$2 = function (schema, nonEmptyElements, whitespaceElements, node) { - return node.isEmpty(nonEmptyElements, whitespaceElements, function (node) { - return isPadded(schema, node); - }); - }; - var isLineBreakNode = function (node, blockElements) { - return node && (blockElements[node.name] || node.name === 'br'); - }; - - var isBogusImage = function (img) { - return img.attr('data-mce-bogus'); - }; - var isInternalImageSource = function (img) { - return img.attr('src') === Env.transparentSrc || img.attr('data-mce-placeholder'); - }; - var isValidDataImg = function (img, settings) { - if (settings.images_dataimg_filter) { - var imgElem_1 = new Image(); - imgElem_1.src = img.attr('src'); - each$1(img.attributes.map, function (value, key) { - imgElem_1.setAttribute(key, value); - }); - return settings.images_dataimg_filter(imgElem_1); - } else { - return true; - } - }; - var registerBase64ImageFilter = function (parser, settings) { - var blobCache = settings.blob_cache; - var processImage = function (img) { - var inputSrc = img.attr('src'); - if (isInternalImageSource(img) || isBogusImage(img)) { - return; - } - parseDataUri(inputSrc).filter(function () { - return isValidDataImg(img, settings); - }).bind(function (_a) { - var type = _a.type, data = _a.data; - return Optional.from(blobCache.getByData(data, type)).orThunk(function () { - return buildBlob(type, data).map(function (blob) { - var blobInfo = blobCache.create(uniqueId(), blob, data); - blobCache.add(blobInfo); - return blobInfo; - }); - }); - }).each(function (blobInfo) { - img.attr('src', blobInfo.blobUri()); - }); - }; - if (blobCache) { - parser.addAttributeFilter('src', function (nodes) { - return each(nodes, processImage); - }); - } - }; - var register$2 = function (parser, settings) { - var schema = parser.schema; - if (settings.remove_trailing_brs) { - parser.addNodeFilter('br', function (nodes, _, args) { - var i; - var l = nodes.length; - var node; - var blockElements = Tools.extend({}, schema.getBlockElements()); - var nonEmptyElements = schema.getNonEmptyElements(); - var parent, lastParent, prev, prevName; - var whiteSpaceElements = schema.getWhiteSpaceElements(); - var elementRule, textNode; - blockElements.body = 1; - for (i = 0; i < l; i++) { - node = nodes[i]; - parent = node.parent; - if (blockElements[node.parent.name] && node === parent.lastChild) { - prev = node.prev; - while (prev) { - prevName = prev.name; - if (prevName !== 'span' || prev.attr('data-mce-type') !== 'bookmark') { - if (prevName === 'br') { - node = null; - } - break; - } - prev = prev.prev; - } - if (node) { - node.remove(); - if (isEmpty$2(schema, nonEmptyElements, whiteSpaceElements, parent)) { - elementRule = schema.getElementRule(parent.name); - if (elementRule) { - if (elementRule.removeEmpty) { - parent.remove(); - } else if (elementRule.paddEmpty) { - paddEmptyNode(settings, args, blockElements, parent); - } - } - } - } - } else { - lastParent = node; - while (parent && parent.firstChild === lastParent && parent.lastChild === lastParent) { - lastParent = parent; - if (blockElements[parent.name]) { - break; - } - parent = parent.parent; - } - if (lastParent === parent && settings.padd_empty_with_br !== true) { - textNode = new AstNode('#text', 3); - textNode.value = nbsp; - node.replace(textNode); - } - } - } - }); - } - parser.addAttributeFilter('href', function (nodes) { - var i = nodes.length; - var appendRel = function (rel) { - var parts = rel.split(' ').filter(function (p) { - return p.length > 0; - }); - return parts.concat(['noopener']).sort().join(' '); - }; - var addNoOpener = function (rel) { - var newRel = rel ? Tools.trim(rel) : ''; - if (!/\b(noopener)\b/g.test(newRel)) { - return appendRel(newRel); - } else { - return newRel; - } - }; - if (!settings.allow_unsafe_link_target) { - while (i--) { - var node = nodes[i]; - if (node.name === 'a' && node.attr('target') === '_blank') { - node.attr('rel', addNoOpener(node.attr('rel'))); - } - } - } - }); - if (!settings.allow_html_in_named_anchor) { - parser.addAttributeFilter('id,name', function (nodes) { - var i = nodes.length, sibling, prevSibling, parent, node; - while (i--) { - node = nodes[i]; - if (node.name === 'a' && node.firstChild && !node.attr('href')) { - parent = node.parent; - sibling = node.lastChild; - do { - prevSibling = sibling.prev; - parent.insert(sibling, node); - sibling = prevSibling; - } while (sibling); - } - } - }); - } - if (settings.fix_list_elements) { - parser.addNodeFilter('ul,ol', function (nodes) { - var i = nodes.length, node, parentNode; - while (i--) { - node = nodes[i]; - parentNode = node.parent; - if (parentNode.name === 'ul' || parentNode.name === 'ol') { - if (node.prev && node.prev.name === 'li') { - node.prev.append(node); - } else { - var li = new AstNode('li', 1); - li.attr('style', 'list-style-type: none'); - node.wrap(li); - } - } - } - }); - } - if (settings.validate && schema.getValidClasses()) { - parser.addAttributeFilter('class', function (nodes) { - var i = nodes.length, node, classList, ci, className, classValue; - var validClasses = schema.getValidClasses(); - var validClassesMap, valid; - while (i--) { - node = nodes[i]; - classList = node.attr('class').split(' '); - classValue = ''; - for (ci = 0; ci < classList.length; ci++) { - className = classList[ci]; - valid = false; - validClassesMap = validClasses['*']; - if (validClassesMap && validClassesMap[className]) { - valid = true; - } - validClassesMap = validClasses[node.name]; - if (!valid && validClassesMap && validClassesMap[className]) { - valid = true; - } - if (valid) { - if (classValue) { - classValue += ' '; - } - classValue += className; - } - } - if (!classValue.length) { - classValue = null; - } - node.attr('class', classValue); - } - }); - } - registerBase64ImageFilter(parser, settings); - }; - - var makeMap$4 = Tools.makeMap, each$d = Tools.each, explode$2 = Tools.explode, extend$2 = Tools.extend; - var DomParser = function (settings, schema) { - if (schema === void 0) { - schema = Schema(); - } - var nodeFilters = {}; - var attributeFilters = []; - var matchedNodes = {}; - var matchedAttributes = {}; - settings = settings || {}; - settings.validate = 'validate' in settings ? settings.validate : true; - settings.root_name = settings.root_name || 'body'; - var fixInvalidChildren = function (nodes) { - var ni, node, parent, parents, newParent, currentNode, tempNode, childNode, i; - var sibling, nextNode; - var nonSplitableElements = makeMap$4('tr,td,th,tbody,thead,tfoot,table'); - var nonEmptyElements = schema.getNonEmptyElements(); - var whitespaceElements = schema.getWhiteSpaceElements(); - var textBlockElements = schema.getTextBlockElements(); - var specialElements = schema.getSpecialElements(); - for (ni = 0; ni < nodes.length; ni++) { - node = nodes[ni]; - if (!node.parent || node.fixed) { - continue; - } - if (textBlockElements[node.name] && node.parent.name === 'li') { - sibling = node.next; - while (sibling) { - if (textBlockElements[sibling.name]) { - sibling.name = 'li'; - sibling.fixed = true; - node.parent.insert(sibling, node.parent); - } else { - break; - } - sibling = sibling.next; - } - node.unwrap(node); - continue; - } - parents = [node]; - for (parent = node.parent; parent && !schema.isValidChild(parent.name, node.name) && !nonSplitableElements[parent.name]; parent = parent.parent) { - parents.push(parent); - } - if (parent && parents.length > 1) { - parents.reverse(); - newParent = currentNode = filterNode(parents[0].clone()); - for (i = 0; i < parents.length - 1; i++) { - if (schema.isValidChild(currentNode.name, parents[i].name)) { - tempNode = filterNode(parents[i].clone()); - currentNode.append(tempNode); - } else { - tempNode = currentNode; - } - for (childNode = parents[i].firstChild; childNode && childNode !== parents[i + 1];) { - nextNode = childNode.next; - tempNode.append(childNode); - childNode = nextNode; - } - currentNode = tempNode; - } - if (!isEmpty$2(schema, nonEmptyElements, whitespaceElements, newParent)) { - parent.insert(newParent, parents[0], true); - parent.insert(node, newParent); - } else { - parent.insert(node, parents[0], true); - } - parent = parents[0]; - if (isEmpty$2(schema, nonEmptyElements, whitespaceElements, parent) || hasOnlyChild(parent, 'br')) { - parent.empty().remove(); - } - } else if (node.parent) { - if (node.name === 'li') { - sibling = node.prev; - if (sibling && (sibling.name === 'ul' || sibling.name === 'ol')) { - sibling.append(node); - continue; - } - sibling = node.next; - if (sibling && (sibling.name === 'ul' || sibling.name === 'ol')) { - sibling.insert(node, sibling.firstChild, true); - continue; - } - node.wrap(filterNode(new AstNode('ul', 1))); - continue; - } - if (schema.isValidChild(node.parent.name, 'div') && schema.isValidChild('div', node.name)) { - node.wrap(filterNode(new AstNode('div', 1))); - } else { - if (specialElements[node.name]) { - node.empty().remove(); - } else { - node.unwrap(); - } - } - } - } - }; - var filterNode = function (node) { - var i, name, list; - name = node.name; - if (name in nodeFilters) { - list = matchedNodes[name]; - if (list) { - list.push(node); - } else { - matchedNodes[name] = [node]; - } - } - i = attributeFilters.length; - while (i--) { - name = attributeFilters[i].name; - if (name in node.attributes.map) { - list = matchedAttributes[name]; - if (list) { - list.push(node); - } else { - matchedAttributes[name] = [node]; - } - } - } - return node; - }; - var addNodeFilter = function (name, callback) { - each$d(explode$2(name), function (name) { - var list = nodeFilters[name]; - if (!list) { - nodeFilters[name] = list = []; - } - list.push(callback); - }); - }; - var getNodeFilters = function () { - var out = []; - for (var name_1 in nodeFilters) { - if (nodeFilters.hasOwnProperty(name_1)) { - out.push({ - name: name_1, - callbacks: nodeFilters[name_1] - }); - } - } - return out; - }; - var addAttributeFilter = function (name, callback) { - each$d(explode$2(name), function (name) { - var i; - for (i = 0; i < attributeFilters.length; i++) { - if (attributeFilters[i].name === name) { - attributeFilters[i].callbacks.push(callback); - return; - } - } - attributeFilters.push({ - name: name, - callbacks: [callback] - }); - }); - }; - var getAttributeFilters = function () { - return [].concat(attributeFilters); - }; - var parse = function (html, args) { - var nodes, i, l, fi, fl, list, name; - var invalidChildren = []; - var isInWhiteSpacePreservedElement; - var node; - var getRootBlockName = function (name) { - if (name === false) { - return ''; - } else if (name === true) { - return 'p'; - } else { - return name; - } - }; - args = args || {}; - matchedNodes = {}; - matchedAttributes = {}; - var blockElements = extend$2(makeMap$4('script,style,head,html,body,title,meta,param'), schema.getBlockElements()); - var nonEmptyElements = schema.getNonEmptyElements(); - var children = schema.children; - var validate = settings.validate; - var forcedRootBlockName = 'forced_root_block' in args ? args.forced_root_block : settings.forced_root_block; - var rootBlockName = getRootBlockName(forcedRootBlockName); - var whiteSpaceElements = schema.getWhiteSpaceElements(); - var startWhiteSpaceRegExp = /^[ \t\r\n]+/; - var endWhiteSpaceRegExp = /[ \t\r\n]+$/; - var allWhiteSpaceRegExp = /[ \t\r\n]+/g; - var isAllWhiteSpaceRegExp = /^[ \t\r\n]+$/; - isInWhiteSpacePreservedElement = whiteSpaceElements.hasOwnProperty(args.context) || whiteSpaceElements.hasOwnProperty(settings.root_name); - var addRootBlocks = function () { - var node = rootNode.firstChild, next, rootBlockNode; - var trim = function (rootBlockNode) { - if (rootBlockNode) { - node = rootBlockNode.firstChild; - if (node && node.type === 3) { - node.value = node.value.replace(startWhiteSpaceRegExp, ''); - } - node = rootBlockNode.lastChild; - if (node && node.type === 3) { - node.value = node.value.replace(endWhiteSpaceRegExp, ''); - } - } - }; - if (!schema.isValidChild(rootNode.name, rootBlockName.toLowerCase())) { - return; - } - while (node) { - next = node.next; - if (node.type === 3 || node.type === 1 && node.name !== 'p' && !blockElements[node.name] && !node.attr('data-mce-type')) { - if (!rootBlockNode) { - rootBlockNode = createNode(rootBlockName, 1); - rootBlockNode.attr(settings.forced_root_block_attrs); - rootNode.insert(rootBlockNode, node); - rootBlockNode.append(node); - } else { - rootBlockNode.append(node); - } - } else { - trim(rootBlockNode); - rootBlockNode = null; - } - node = next; - } - trim(rootBlockNode); - }; - var createNode = function (name, type) { - var node = new AstNode(name, type); - var list; - if (name in nodeFilters) { - list = matchedNodes[name]; - if (list) { - list.push(node); - } else { - matchedNodes[name] = [node]; - } - } - return node; - }; - var removeWhitespaceBefore = function (node) { - var textNode, textNodeNext, textVal, sibling; - var blockElements = schema.getBlockElements(); - for (textNode = node.prev; textNode && textNode.type === 3;) { - textVal = textNode.value.replace(endWhiteSpaceRegExp, ''); - if (textVal.length > 0) { - textNode.value = textVal; - return; - } - textNodeNext = textNode.next; - if (textNodeNext) { - if (textNodeNext.type === 3 && textNodeNext.value.length) { - textNode = textNode.prev; - continue; - } - if (!blockElements[textNodeNext.name] && textNodeNext.name !== 'script' && textNodeNext.name !== 'style') { - textNode = textNode.prev; - continue; - } - } - sibling = textNode.prev; - textNode.remove(); - textNode = sibling; - } - }; - var cloneAndExcludeBlocks = function (input) { - var name; - var output = {}; - for (name in input) { - if (name !== 'li' && name !== 'p') { - output[name] = input[name]; - } - } - return output; - }; - var parser = SaxParser$1({ - validate: validate, - allow_html_data_urls: settings.allow_html_data_urls, - allow_svg_data_urls: settings.allow_svg_data_urls, - allow_script_urls: settings.allow_script_urls, - allow_conditional_comments: settings.allow_conditional_comments, - preserve_cdata: settings.preserve_cdata, - self_closing_elements: cloneAndExcludeBlocks(schema.getSelfClosingElements()), - cdata: function (text) { - node.append(createNode('#cdata', 4)).value = text; - }, - text: function (text, raw) { - var textNode; - if (!isInWhiteSpacePreservedElement) { - text = text.replace(allWhiteSpaceRegExp, ' '); - if (isLineBreakNode(node.lastChild, blockElements)) { - text = text.replace(startWhiteSpaceRegExp, ''); - } - } - if (text.length !== 0) { - textNode = createNode('#text', 3); - textNode.raw = !!raw; - node.append(textNode).value = text; - } - }, - comment: function (text) { - node.append(createNode('#comment', 8)).value = text; - }, - pi: function (name, text) { - node.append(createNode(name, 7)).value = text; - removeWhitespaceBefore(node); - }, - doctype: function (text) { - var newNode = node.append(createNode('#doctype', 10)); - newNode.value = text; - removeWhitespaceBefore(node); - }, - start: function (name, attrs, empty) { - var newNode, attrFiltersLen, attrName, parent; - var elementRule = validate ? schema.getElementRule(name) : {}; - if (elementRule) { - newNode = createNode(elementRule.outputName || name, 1); - newNode.attributes = attrs; - newNode.shortEnded = empty; - node.append(newNode); - parent = children[node.name]; - if (parent && children[newNode.name] && !parent[newNode.name]) { - invalidChildren.push(newNode); - } - attrFiltersLen = attributeFilters.length; - while (attrFiltersLen--) { - attrName = attributeFilters[attrFiltersLen].name; - if (attrName in attrs.map) { - list = matchedAttributes[attrName]; - if (list) { - list.push(newNode); - } else { - matchedAttributes[attrName] = [newNode]; - } - } - } - if (blockElements[name]) { - removeWhitespaceBefore(newNode); - } - if (!empty) { - node = newNode; - } - if (!isInWhiteSpacePreservedElement && whiteSpaceElements[name]) { - isInWhiteSpacePreservedElement = true; - } - } - }, - end: function (name) { - var textNode, text, sibling, tempNode; - var elementRule = validate ? schema.getElementRule(name) : {}; - if (elementRule) { - if (blockElements[name]) { - if (!isInWhiteSpacePreservedElement) { - textNode = node.firstChild; - if (textNode && textNode.type === 3) { - text = textNode.value.replace(startWhiteSpaceRegExp, ''); - if (text.length > 0) { - textNode.value = text; - textNode = textNode.next; - } else { - sibling = textNode.next; - textNode.remove(); - textNode = sibling; - while (textNode && textNode.type === 3) { - text = textNode.value; - sibling = textNode.next; - if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) { - textNode.remove(); - textNode = sibling; - } - textNode = sibling; - } - } - } - textNode = node.lastChild; - if (textNode && textNode.type === 3) { - text = textNode.value.replace(endWhiteSpaceRegExp, ''); - if (text.length > 0) { - textNode.value = text; - textNode = textNode.prev; - } else { - sibling = textNode.prev; - textNode.remove(); - textNode = sibling; - while (textNode && textNode.type === 3) { - text = textNode.value; - sibling = textNode.prev; - if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) { - textNode.remove(); - textNode = sibling; - } - textNode = sibling; - } - } - } - } - } - if (isInWhiteSpacePreservedElement && whiteSpaceElements[name]) { - isInWhiteSpacePreservedElement = false; - } - if (elementRule.removeEmpty && isEmpty$2(schema, nonEmptyElements, whiteSpaceElements, node)) { - tempNode = node.parent; - if (blockElements[node.name]) { - node.empty().remove(); - } else { - node.unwrap(); - } - node = tempNode; - return; - } - if (elementRule.paddEmpty && (isPaddedWithNbsp(node) || isEmpty$2(schema, nonEmptyElements, whiteSpaceElements, node))) { - paddEmptyNode(settings, args, blockElements, node); - } - node = node.parent; - } - } - }, schema); - var rootNode = node = new AstNode(args.context || settings.root_name, 11); - parser.parse(html, args.format); - if (validate && invalidChildren.length) { - if (!args.context) { - fixInvalidChildren(invalidChildren); - } else { - args.invalid = true; - } - } - if (rootBlockName && (rootNode.name === 'body' || args.isRootContent)) { - addRootBlocks(); - } - if (!args.invalid) { - for (name in matchedNodes) { - if (!matchedNodes.hasOwnProperty(name)) { - continue; - } - list = nodeFilters[name]; - nodes = matchedNodes[name]; - fi = nodes.length; - while (fi--) { - if (!nodes[fi].parent) { - nodes.splice(fi, 1); - } - } - for (i = 0, l = list.length; i < l; i++) { - list[i](nodes, name, args); - } - } - for (i = 0, l = attributeFilters.length; i < l; i++) { - list = attributeFilters[i]; - if (list.name in matchedAttributes) { - nodes = matchedAttributes[list.name]; - fi = nodes.length; - while (fi--) { - if (!nodes[fi].parent) { - nodes.splice(fi, 1); - } - } - for (fi = 0, fl = list.callbacks.length; fi < fl; fi++) { - list.callbacks[fi](nodes, list.name, args); - } - } - } - } - return rootNode; - }; - var exports = { - schema: schema, - addAttributeFilter: addAttributeFilter, - getAttributeFilters: getAttributeFilters, - addNodeFilter: addNodeFilter, - getNodeFilters: getNodeFilters, - filterNode: filterNode, - parse: parse - }; - register$2(exports, settings); - register$1(exports, settings); - return exports; - }; - - var register$3 = function (htmlParser, settings, dom) { - htmlParser.addAttributeFilter('data-mce-tabindex', function (nodes, name) { - var i = nodes.length, node; - while (i--) { - node = nodes[i]; - node.attr('tabindex', node.attr('data-mce-tabindex')); - node.attr(name, null); - } - }); - htmlParser.addAttributeFilter('src,href,style', function (nodes, name) { - var i = nodes.length, node, value; - var internalName = 'data-mce-' + name; - var urlConverter = settings.url_converter; - var urlConverterScope = settings.url_converter_scope; - while (i--) { - node = nodes[i]; - value = node.attr(internalName); - if (value !== undefined) { - node.attr(name, value.length > 0 ? value : null); - node.attr(internalName, null); - } else { - value = node.attr(name); - if (name === 'style') { - value = dom.serializeStyle(dom.parseStyle(value), node.name); - } else if (urlConverter) { - value = urlConverter.call(urlConverterScope, value, name, node.name); - } - node.attr(name, value.length > 0 ? value : null); - } - } - }); - htmlParser.addAttributeFilter('class', function (nodes) { - var i = nodes.length, node, value; - while (i--) { - node = nodes[i]; - value = node.attr('class'); - if (value) { - value = node.attr('class').replace(/(?:^|\s)mce-item-\w+(?!\S)/g, ''); - node.attr('class', value.length > 0 ? value : null); - } - } - }); - htmlParser.addAttributeFilter('data-mce-type', function (nodes, name, args) { - var i = nodes.length, node; - while (i--) { - node = nodes[i]; - if (node.attr('data-mce-type') === 'bookmark' && !args.cleanup) { - var hasChildren = Optional.from(node.firstChild).exists(function (firstChild) { - return !isZwsp$1(firstChild.value); - }); - if (hasChildren) { - node.unwrap(); - } else { - node.remove(); - } - } - } - }); - htmlParser.addNodeFilter('noscript', function (nodes) { - var i = nodes.length, node; - while (i--) { - node = nodes[i].firstChild; - if (node) { - node.value = Entities.decode(node.value); - } - } - }); - htmlParser.addNodeFilter('script,style', function (nodes, name) { - var i = nodes.length, node, value, type; - var trim = function (value) { - return value.replace(/()/g, '\n').replace(/^[\r\n]*|[\r\n]*$/g, '').replace(/^\s*(()?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g, ''); - }; - while (i--) { - node = nodes[i]; - value = node.firstChild ? node.firstChild.value : ''; - if (name === 'script') { - type = node.attr('type'); - if (type) { - node.attr('type', type === 'mce-no/type' ? null : type.replace(/^mce\-/, '')); - } - if (settings.element_format === 'xhtml' && value.length > 0) { - node.firstChild.value = '// '; - } - } else { - if (settings.element_format === 'xhtml' && value.length > 0) { - node.firstChild.value = ''; - } - } - } - }); - htmlParser.addNodeFilter('#comment', function (nodes) { - var i = nodes.length, node; - while (i--) { - node = nodes[i]; - if (settings.preserve_cdata && node.value.indexOf('[CDATA[') === 0) { - node.name = '#cdata'; - node.type = 4; - node.value = dom.decode(node.value.replace(/^\[CDATA\[|\]\]$/g, '')); - } else if (node.value.indexOf('mce:protected ') === 0) { - node.name = '#text'; - node.type = 3; - node.raw = true; - node.value = unescape(node.value).substr(14); - } - } - }); - htmlParser.addNodeFilter('xml:namespace,input', function (nodes, name) { - var i = nodes.length, node; - while (i--) { - node = nodes[i]; - if (node.type === 7) { - node.remove(); - } else if (node.type === 1) { - if (name === 'input' && !node.attr('type')) { - node.attr('type', 'text'); - } - } - } - }); - htmlParser.addAttributeFilter('data-mce-type', function (nodes) { - each(nodes, function (node) { - if (node.attr('data-mce-type') === 'format-caret') { - if (node.isEmpty(htmlParser.schema.getNonEmptyElements())) { - node.remove(); - } else { - node.unwrap(); - } - } - }); - }); - htmlParser.addAttributeFilter('data-mce-src,data-mce-href,data-mce-style,' + 'data-mce-selected,data-mce-expando,' + 'data-mce-type,data-mce-resize,data-mce-placeholder', function (nodes, name) { - var i = nodes.length; - while (i--) { - nodes[i].attr(name, null); - } - }); - }; - var trimTrailingBr = function (rootNode) { - var isBr = function (node) { - return node && node.name === 'br'; - }; - var brNode1 = rootNode.lastChild; - if (isBr(brNode1)) { - var brNode2 = brNode1.prev; - if (isBr(brNode2)) { - brNode1.remove(); - brNode2.remove(); - } - } - }; - - var preProcess = function (editor, node, args) { - var doc, oldDoc; - var dom = editor.dom; - node = node.cloneNode(true); - var impl = document.implementation; - if (impl.createHTMLDocument) { - doc = impl.createHTMLDocument(''); - Tools.each(node.nodeName === 'BODY' ? node.childNodes : [node], function (node) { - doc.body.appendChild(doc.importNode(node, true)); - }); - if (node.nodeName !== 'BODY') { - node = doc.body.firstChild; - } else { - node = doc.body; - } - oldDoc = dom.doc; - dom.doc = doc; - } - firePreProcess(editor, __assign(__assign({}, args), { node: node })); - if (oldDoc) { - dom.doc = oldDoc; - } - return node; - }; - var shouldFireEvent = function (editor, args) { - return editor && editor.hasEventListeners('PreProcess') && !args.no_events; - }; - var process = function (editor, node, args) { - return shouldFireEvent(editor, args) ? preProcess(editor, node, args) : node; - }; - - var addTempAttr = function (htmlParser, tempAttrs, name) { - if (Tools.inArray(tempAttrs, name) === -1) { - htmlParser.addAttributeFilter(name, function (nodes, name) { - var i = nodes.length; - while (i--) { - nodes[i].attr(name, null); - } - }); - tempAttrs.push(name); - } - }; - var postProcess$1 = function (editor, args, content) { - if (!args.no_events && editor) { - var outArgs = firePostProcess(editor, __assign(__assign({}, args), { content: content })); - return outArgs.content; - } else { - return content; - } - }; - var getHtmlFromNode = function (dom, node, args) { - var html = trim$2(args.getInner ? node.innerHTML : dom.getOuterHTML(node)); - return args.selection || isWsPreserveElement(SugarElement.fromDom(node)) ? html : Tools.trim(html); - }; - var parseHtml = function (htmlParser, html, args) { - var parserArgs = args.selection ? __assign({ forced_root_block: false }, args) : args; - var rootNode = htmlParser.parse(html, parserArgs); - trimTrailingBr(rootNode); - return rootNode; - }; - var serializeNode = function (settings, schema, node) { - var htmlSerializer = HtmlSerializer(settings, schema); - return htmlSerializer.serialize(node); - }; - var toHtml = function (editor, settings, schema, rootNode, args) { - var content = serializeNode(settings, schema, rootNode); - return postProcess$1(editor, args, content); - }; - var DomSerializerImpl = function (settings, editor) { - var tempAttrs = ['data-mce-selected']; - var dom = editor && editor.dom ? editor.dom : DOMUtils$1.DOM; - var schema = editor && editor.schema ? editor.schema : Schema(settings); - settings.entity_encoding = settings.entity_encoding || 'named'; - settings.remove_trailing_brs = 'remove_trailing_brs' in settings ? settings.remove_trailing_brs : true; - var htmlParser = DomParser(settings, schema); - register$3(htmlParser, settings, dom); - var serialize = function (node, parserArgs) { - if (parserArgs === void 0) { - parserArgs = {}; - } - var args = __assign({ format: 'html' }, parserArgs); - var targetNode = process(editor, node, args); - var html = getHtmlFromNode(dom, targetNode, args); - var rootNode = parseHtml(htmlParser, html, args); - return args.format === 'tree' ? rootNode : toHtml(editor, settings, schema, rootNode, args); - }; - return { - schema: schema, - addNodeFilter: htmlParser.addNodeFilter, - addAttributeFilter: htmlParser.addAttributeFilter, - serialize: serialize, - addRules: function (rules) { - schema.addValidElements(rules); - }, - setRules: function (rules) { - schema.setValidElements(rules); - }, - addTempAttr: curry(addTempAttr, htmlParser, tempAttrs), - getTempAttrs: function () { - return tempAttrs; - }, - getNodeFilters: htmlParser.getNodeFilters, - getAttributeFilters: htmlParser.getAttributeFilters - }; - }; - - var DomSerializer = function (settings, editor) { - var domSerializer = DomSerializerImpl(settings, editor); - return { - schema: domSerializer.schema, - addNodeFilter: domSerializer.addNodeFilter, - addAttributeFilter: domSerializer.addAttributeFilter, - serialize: domSerializer.serialize, - addRules: domSerializer.addRules, - setRules: domSerializer.setRules, - addTempAttr: domSerializer.addTempAttr, - getTempAttrs: domSerializer.getTempAttrs, - getNodeFilters: domSerializer.getNodeFilters, - getAttributeFilters: domSerializer.getAttributeFilters - }; - }; - - var defaultFormat$1 = 'html'; - var getContent$2 = function (editor, args) { - if (args === void 0) { - args = {}; - } - var format = args.format ? args.format : defaultFormat$1; - return getContent(editor, args, format); - }; - - var setContent$2 = function (editor, content, args) { - if (args === void 0) { - args = {}; - } - return setContent(editor, content, args); - }; - - var DOM$3 = DOMUtils$1.DOM; - var restoreOriginalStyles = function (editor) { - DOM$3.setStyle(editor.id, 'display', editor.orgDisplay); - }; - var safeDestroy = function (x) { - return Optional.from(x).each(function (x) { - return x.destroy(); - }); - }; - var clearDomReferences = function (editor) { - editor.contentAreaContainer = editor.formElement = editor.container = editor.editorContainer = null; - editor.bodyElement = editor.contentDocument = editor.contentWindow = null; - editor.iframeElement = editor.targetElm = null; - if (editor.selection) { - editor.selection = editor.selection.win = editor.selection.dom = editor.selection.dom.doc = null; - } - }; - var restoreForm = function (editor) { - var form = editor.formElement; - if (form) { - if (form._mceOldSubmit) { - form.submit = form._mceOldSubmit; - form._mceOldSubmit = null; - } - DOM$3.unbind(form, 'submit reset', editor.formEventDelegate); - } - }; - var remove$7 = function (editor) { - if (!editor.removed) { - var _selectionOverrides = editor._selectionOverrides, editorUpload = editor.editorUpload; - var body = editor.getBody(); - var element = editor.getElement(); - if (body) { - editor.save({ is_removing: true }); - } - editor.removed = true; - editor.unbindAllNativeEvents(); - if (editor.hasHiddenInput && element) { - DOM$3.remove(element.nextSibling); - } - fireRemove(editor); - editor.editorManager.remove(editor); - if (!editor.inline && body) { - restoreOriginalStyles(editor); - } - fireDetach(editor); - DOM$3.remove(editor.getContainer()); - safeDestroy(_selectionOverrides); - safeDestroy(editorUpload); - editor.destroy(); - } - }; - var destroy = function (editor, automatic) { - var selection = editor.selection, dom = editor.dom; - if (editor.destroyed) { - return; - } - if (!automatic && !editor.removed) { - editor.remove(); - return; - } - if (!automatic) { - editor.editorManager.off('beforeunload', editor._beforeUnload); - if (editor.theme && editor.theme.destroy) { - editor.theme.destroy(); - } - safeDestroy(selection); - safeDestroy(dom); - } - restoreForm(editor); - clearDomReferences(editor); - editor.destroyed = true; - }; - - var hasOwnProperty$2 = Object.prototype.hasOwnProperty; - var deep$1 = function (old, nu) { - var bothObjects = isObject(old) && isObject(nu); - return bothObjects ? deepMerge(old, nu) : 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$2.call(curObject, key)) { - ret[key] = merger(ret[key], curObject[key]); - } - } - } - return ret; - }; - }; - var deepMerge = baseMerge(deep$1); - - var sectionResult = function (sections, settings) { - return { - sections: constant(sections), - settings: constant(settings) - }; - }; - var deviceDetection = detect$3().deviceType; - var isTouch = deviceDetection.isTouch(); - var isPhone = deviceDetection.isPhone(); - var isTablet = deviceDetection.isTablet(); - var legacyMobilePlugins = [ - 'lists', - 'autolink', - 'autosave' - ]; - var defaultTouchSettings = { - table_grid: false, - object_resizing: false, - resize: false - }; - var normalizePlugins = function (plugins) { - var pluginNames = isArray(plugins) ? plugins.join(' ') : plugins; - var trimmedPlugins = map(isString(pluginNames) ? pluginNames.split(' ') : [], trim); - return filter(trimmedPlugins, function (item) { - return item.length > 0; - }); - }; - var filterLegacyMobilePlugins = function (plugins) { - return filter(plugins, curry(contains, legacyMobilePlugins)); - }; - var extractSections = function (keys, settings) { - var result = bifilter(settings, function (value, key) { - return contains(keys, key); - }); - return sectionResult(result.t, result.f); - }; - var getSection = function (sectionResult, name, defaults) { - if (defaults === void 0) { - defaults = {}; - } - var sections = sectionResult.sections(); - var sectionSettings = sections.hasOwnProperty(name) ? sections[name] : {}; - return Tools.extend({}, defaults, sectionSettings); - }; - var hasSection = function (sectionResult, name) { - return sectionResult.sections().hasOwnProperty(name); - }; - var isSectionTheme = function (sectionResult, name, theme) { - var section = sectionResult.sections(); - return hasSection(sectionResult, name) && section[name].theme === theme; - }; - var getSectionConfig = function (sectionResult, name) { - return hasSection(sectionResult, name) ? sectionResult.sections()[name] : {}; - }; - var getToolbarMode = function (settings, defaultVal) { - return get$1(settings, 'toolbar_mode').orThunk(function () { - return get$1(settings, 'toolbar_drawer').map(function (val) { - return val === false ? 'wrap' : val; - }); - }).getOr(defaultVal); - }; - var getDefaultSettings = function (settings, id, documentBaseUrl, isTouch, editor) { - var baseDefaults = { - id: id, - theme: 'silver', - toolbar_mode: getToolbarMode(settings, 'floating'), - plugins: '', - document_base_url: documentBaseUrl, - add_form_submit_trigger: true, - submit_patch: true, - add_unload_trigger: true, - convert_urls: true, - relative_urls: true, - remove_script_host: true, - object_resizing: true, - doctype: '', - visual: true, - font_size_legacy_values: 'xx-small,small,medium,large,x-large,xx-large,300%', - forced_root_block: 'p', - hidden_input: true, - inline_styles: true, - convert_fonts_to_spans: true, - indent: true, - indent_before: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' + 'tfoot,tbody,tr,section,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist', - indent_after: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' + 'tfoot,tbody,tr,section,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist', - entity_encoding: 'named', - url_converter: editor.convertURL, - url_converter_scope: editor - }; - return __assign(__assign({}, baseDefaults), isTouch ? defaultTouchSettings : {}); - }; - var getDefaultMobileSettings = function (mobileSettings, isPhone) { - var defaultMobileSettings = { - resize: false, - toolbar_mode: getToolbarMode(mobileSettings, 'scrolling'), - toolbar_sticky: false - }; - var defaultPhoneSettings = { menubar: false }; - return __assign(__assign(__assign({}, defaultTouchSettings), defaultMobileSettings), isPhone ? defaultPhoneSettings : {}); - }; - var getExternalPlugins$1 = function (overrideSettings, settings) { - var userDefinedExternalPlugins = settings.external_plugins ? settings.external_plugins : {}; - if (overrideSettings && overrideSettings.external_plugins) { - return Tools.extend({}, overrideSettings.external_plugins, userDefinedExternalPlugins); - } else { - return userDefinedExternalPlugins; - } - }; - var combinePlugins = function (forcedPlugins, plugins) { - return [].concat(normalizePlugins(forcedPlugins)).concat(normalizePlugins(plugins)); - }; - var getPlatformPlugins = function (isMobileDevice, sectionResult, desktopPlugins, mobilePlugins) { - if (isMobileDevice && isSectionTheme(sectionResult, 'mobile', 'mobile')) { - return filterLegacyMobilePlugins(mobilePlugins); - } else if (isMobileDevice && hasSection(sectionResult, 'mobile')) { - return mobilePlugins; - } else { - return desktopPlugins; - } - }; - var processPlugins = function (isMobileDevice, sectionResult, defaultOverrideSettings, settings) { - var forcedPlugins = normalizePlugins(defaultOverrideSettings.forced_plugins); - var desktopPlugins = normalizePlugins(settings.plugins); - var mobileConfig = getSectionConfig(sectionResult, 'mobile'); - var mobilePlugins = mobileConfig.plugins ? normalizePlugins(mobileConfig.plugins) : desktopPlugins; - var platformPlugins = getPlatformPlugins(isMobileDevice, sectionResult, desktopPlugins, mobilePlugins); - var combinedPlugins = combinePlugins(forcedPlugins, platformPlugins); - if (Env.browser.isIE() && contains(combinedPlugins, 'rtc')) { - throw new Error('RTC plugin is not supported on IE 11.'); - } - return Tools.extend(settings, { plugins: combinedPlugins.join(' ') }); - }; - var isOnMobile = function (isMobileDevice, sectionResult) { - return isMobileDevice && hasSection(sectionResult, 'mobile'); - }; - var combineSettings = function (isMobileDevice, isPhone, defaultSettings, defaultOverrideSettings, settings) { - var defaultDeviceSettings = isMobileDevice ? { mobile: getDefaultMobileSettings(settings.mobile || {}, isPhone) } : {}; - var sectionResult = extractSections(['mobile'], deepMerge(defaultDeviceSettings, settings)); - var extendedSettings = Tools.extend(defaultSettings, defaultOverrideSettings, sectionResult.settings(), isOnMobile(isMobileDevice, sectionResult) ? getSection(sectionResult, 'mobile') : {}, { - validate: true, - external_plugins: getExternalPlugins$1(defaultOverrideSettings, sectionResult.settings()) - }); - return processPlugins(isMobileDevice, sectionResult, defaultOverrideSettings, extendedSettings); - }; - var getEditorSettings = function (editor, id, documentBaseUrl, defaultOverrideSettings, settings) { - var defaultSettings = getDefaultSettings(settings, id, documentBaseUrl, isTouch, editor); - return combineSettings(isPhone || isTablet, isPhone, defaultSettings, defaultOverrideSettings, settings); - }; - var getFiltered = function (predicate, editor, name) { - return Optional.from(editor.settings[name]).filter(predicate); - }; - var getParamObject = function (value) { - var output = {}; - if (typeof value === 'string') { - each(value.indexOf('=') > 0 ? value.split(/[;,](?![^=;,]*(?:[;,]|$))/) : value.split(','), function (val) { - var arr = val.split('='); - if (arr.length > 1) { - output[Tools.trim(arr[0])] = Tools.trim(arr[1]); - } else { - output[Tools.trim(arr[0])] = Tools.trim(arr[0]); - } - }); - } else { - output = value; - } - return output; - }; - var isArrayOf = function (p) { - return function (a) { - return isArray(a) && forall(a, p); - }; - }; - var getParam = function (editor, name, defaultVal, type) { - var value = name in editor.settings ? editor.settings[name] : defaultVal; - if (type === 'hash') { - return getParamObject(value); - } else if (type === 'string') { - return getFiltered(isString, editor, name).getOr(defaultVal); - } else if (type === 'number') { - return getFiltered(isNumber, editor, name).getOr(defaultVal); - } else if (type === 'boolean') { - return getFiltered(isBoolean, editor, name).getOr(defaultVal); - } else if (type === 'object') { - return getFiltered(isObject, editor, name).getOr(defaultVal); - } else if (type === 'array') { - return getFiltered(isArray, editor, name).getOr(defaultVal); - } else if (type === 'string[]') { - return getFiltered(isArrayOf(isString), editor, name).getOr(defaultVal); - } else if (type === 'function') { - return getFiltered(isFunction, editor, name).getOr(defaultVal); - } else { - return value; - } - }; - - var CreateIconManager = function () { - var lookup = {}; - var add = function (id, iconPack) { - lookup[id] = iconPack; - }; - var get = function (id) { - if (lookup[id]) { - return lookup[id]; - } - return { icons: {} }; - }; - var has$1 = function (id) { - return has(lookup, id); - }; - return { - add: add, - get: get, - has: has$1 - }; - }; - var IconManager = CreateIconManager(); - - var getProp = function (propName, elm) { - var rawElm = elm.dom; - return rawElm[propName]; - }; - var getComputedSizeProp = function (propName, elm) { - return parseInt(get$5(elm, propName), 10); - }; - var getClientWidth = curry(getProp, 'clientWidth'); - var getClientHeight = curry(getProp, 'clientHeight'); - var getMarginTop = curry(getComputedSizeProp, 'margin-top'); - var getMarginLeft = curry(getComputedSizeProp, 'margin-left'); - var getBoundingClientRect$1 = function (elm) { - return elm.dom.getBoundingClientRect(); - }; - var isInsideElementContentArea = function (bodyElm, clientX, clientY) { - var clientWidth = getClientWidth(bodyElm); - var clientHeight = getClientHeight(bodyElm); - return clientX >= 0 && clientY >= 0 && clientX <= clientWidth && clientY <= clientHeight; - }; - var transpose = function (inline, elm, clientX, clientY) { - var clientRect = getBoundingClientRect$1(elm); - var deltaX = inline ? clientRect.left + elm.dom.clientLeft + getMarginLeft(elm) : 0; - var deltaY = inline ? clientRect.top + elm.dom.clientTop + getMarginTop(elm) : 0; - var x = clientX - deltaX; - var y = clientY - deltaY; - return { - x: x, - y: y - }; - }; - var isXYInContentArea = function (editor, clientX, clientY) { - var bodyElm = SugarElement.fromDom(editor.getBody()); - var targetElm = editor.inline ? bodyElm : documentElement(bodyElm); - var transposedPoint = transpose(editor.inline, targetElm, clientX, clientY); - return isInsideElementContentArea(targetElm, transposedPoint.x, transposedPoint.y); - }; - var fromDomSafe = function (node) { - return Optional.from(node).map(SugarElement.fromDom); - }; - var isEditorAttachedToDom = function (editor) { - var rawContainer = editor.inline ? editor.getBody() : editor.getContentAreaContainer(); - return fromDomSafe(rawContainer).map(inBody).getOr(false); - }; - - function NotificationManagerImpl() { - var unimplemented = function () { - throw new Error('Theme did not provide a NotificationManager implementation.'); - }; - return { - open: unimplemented, - close: unimplemented, - reposition: unimplemented, - getArgs: unimplemented - }; - } - - function NotificationManager(editor) { - var notifications = []; - var getImplementation = function () { - var theme = editor.theme; - return theme && theme.getNotificationManagerImpl ? theme.getNotificationManagerImpl() : NotificationManagerImpl(); - }; - var getTopNotification = function () { - return Optional.from(notifications[0]); - }; - var isEqual = function (a, b) { - return a.type === b.type && a.text === b.text && !a.progressBar && !a.timeout && !b.progressBar && !b.timeout; - }; - var reposition = function () { - if (notifications.length > 0) { - getImplementation().reposition(notifications); - } - }; - var addNotification = function (notification) { - notifications.push(notification); - }; - var closeNotification = function (notification) { - findIndex(notifications, function (otherNotification) { - return otherNotification === notification; - }).each(function (index) { - notifications.splice(index, 1); - }); - }; - var open = function (spec, fireEvent) { - if (fireEvent === void 0) { - fireEvent = true; - } - if (editor.removed || !isEditorAttachedToDom(editor)) { - return; - } - if (fireEvent) { - editor.fire('BeforeOpenNotification', { notification: spec }); - } - return find(notifications, function (notification) { - return isEqual(getImplementation().getArgs(notification), spec); - }).getOrThunk(function () { - editor.editorManager.setActive(editor); - var notification = getImplementation().open(spec, function () { - closeNotification(notification); - reposition(); - getTopNotification().fold(function () { - return editor.focus(); - }, function (top) { - return focus(SugarElement.fromDom(top.getEl())); - }); - }); - addNotification(notification); - reposition(); - editor.fire('OpenNotification', __assign({}, notification)); - return notification; - }); - }; - var close = function () { - getTopNotification().each(function (notification) { - getImplementation().close(notification); - closeNotification(notification); - reposition(); - }); - }; - var getNotifications = function () { - return notifications; - }; - var registerEvents = function (editor) { - editor.on('SkinLoaded', function () { - var serviceMessage = getServiceMessage(editor); - if (serviceMessage) { - open({ - text: serviceMessage, - type: 'warning', - timeout: 0 - }, false); - } - }); - editor.on('ResizeEditor ResizeWindow NodeChange', function () { - Delay.requestAnimationFrame(reposition); - }); - editor.on('remove', function () { - each(notifications.slice(), function (notification) { - getImplementation().close(notification); - }); - }); - }; - registerEvents(editor); - return { - open: open, - close: close, - getNotifications: getNotifications - }; - } - - var PluginManager = AddOnManager$1.PluginManager; - - var ThemeManager = AddOnManager$1.ThemeManager; - - function WindowManagerImpl () { - var unimplemented = function () { - throw new Error('Theme did not provide a WindowManager implementation.'); - }; - return { - open: unimplemented, - openUrl: unimplemented, - alert: unimplemented, - confirm: unimplemented, - close: unimplemented, - getParams: unimplemented, - setParams: unimplemented - }; - } - - var WindowManager = function (editor) { - var dialogs = []; - var getImplementation = function () { - var theme = editor.theme; - return theme && theme.getWindowManagerImpl ? theme.getWindowManagerImpl() : WindowManagerImpl(); - }; - var funcBind = function (scope, f) { - return function () { - return f ? f.apply(scope, arguments) : undefined; - }; - }; - var fireOpenEvent = function (dialog) { - editor.fire('OpenWindow', { dialog: dialog }); - }; - var fireCloseEvent = function (dialog) { - editor.fire('CloseWindow', { dialog: dialog }); - }; - var addDialog = function (dialog) { - dialogs.push(dialog); - fireOpenEvent(dialog); - }; - var closeDialog = function (dialog) { - fireCloseEvent(dialog); - dialogs = filter(dialogs, function (otherDialog) { - return otherDialog !== dialog; - }); - if (dialogs.length === 0) { - editor.focus(); - } - }; - var getTopDialog = function () { - return Optional.from(dialogs[dialogs.length - 1]); - }; - var storeSelectionAndOpenDialog = function (openDialog) { - editor.editorManager.setActive(editor); - store(editor); - var dialog = openDialog(); - addDialog(dialog); - return dialog; - }; - var open = function (args, params) { - return storeSelectionAndOpenDialog(function () { - return getImplementation().open(args, params, closeDialog); - }); - }; - var openUrl = function (args) { - return storeSelectionAndOpenDialog(function () { - return getImplementation().openUrl(args, closeDialog); - }); - }; - var alert = function (message, callback, scope) { - getImplementation().alert(message, funcBind(scope ? scope : this, callback)); - }; - var confirm = function (message, callback, scope) { - getImplementation().confirm(message, funcBind(scope ? scope : this, callback)); - }; - var close = function () { - getTopDialog().each(function (dialog) { - getImplementation().close(dialog); - closeDialog(dialog); - }); - }; - editor.on('remove', function () { - each(dialogs, function (dialog) { - getImplementation().close(dialog); - }); - }); - return { - open: open, - openUrl: openUrl, - alert: alert, - confirm: confirm, - close: close - }; - }; - - var displayNotification = function (editor, message) { - editor.notificationManager.open({ - type: 'error', - text: message - }); - }; - var displayError = function (editor, message) { - if (editor._skinLoaded) { - displayNotification(editor, message); - } else { - editor.on('SkinLoaded', function () { - displayNotification(editor, message); - }); - } - }; - var uploadError = function (editor, message) { - displayError(editor, I18n.translate([ - 'Failed to upload image: {0}', - message - ])); - }; - var logError = function (editor, errorType, msg) { - fireError(editor, errorType, { message: msg }); - console.error(msg); - }; - var createLoadError = function (type, url, name) { - return name ? 'Failed to load ' + type + ': ' + name + ' from url ' + url : 'Failed to load ' + type + ' url: ' + url; - }; - var pluginLoadError = function (editor, url, name) { - logError(editor, 'PluginLoadError', createLoadError('plugin', url, name)); - }; - var iconsLoadError = function (editor, url, name) { - logError(editor, 'IconsLoadError', createLoadError('icons', url, name)); - }; - var languageLoadError = function (editor, url, name) { - logError(editor, 'LanguageLoadError', createLoadError('language', url, name)); - }; - var pluginInitError = function (editor, name, err) { - var message = I18n.translate([ - 'Failed to initialize plugin: {0}', - name - ]); - initError(message, err); - displayError(editor, message); - }; - var initError = function (message) { - var x = []; - for (var _i = 1; _i < arguments.length; _i++) { - x[_i - 1] = arguments[_i]; - } - var console = window.console; - if (console) { - if (console.error) { - console.error.apply(console, __spreadArrays([message], x)); - } else { - console.log.apply(console, __spreadArrays([message], x)); - } - } - }; - - var isContentCssSkinName = function (url) { - return /^[a-z0-9\-]+$/i.test(url); - }; - var getContentCssUrls = function (editor) { - var contentCss = getContentCss(editor); - var skinUrl = editor.editorManager.baseURL + '/skins/content'; - var suffix = editor.editorManager.suffix; - var contentCssFile = 'content' + suffix + '.css'; - var inline = editor.inline === true; - return map(contentCss, function (url) { - if (isContentCssSkinName(url) && !inline) { - return skinUrl + '/' + url + '/' + contentCssFile; - } else { - return editor.documentBaseURI.toAbsolute(url); - } - }); - }; - var appendContentCssFromSettings = function (editor) { - editor.contentCSS = editor.contentCSS.concat(getContentCssUrls(editor)); - }; - - function Uploader(uploadStatus, settings) { - var pendingPromises = {}; - var pathJoin = function (path1, path2) { - if (path1) { - return path1.replace(/\/$/, '') + '/' + path2.replace(/^\//, ''); - } - return path2; - }; - var defaultHandler = function (blobInfo, success, failure, progress) { - var xhr = new XMLHttpRequest(); - xhr.open('POST', settings.url); - xhr.withCredentials = settings.credentials; - xhr.upload.onprogress = function (e) { - progress(e.loaded / e.total * 100); - }; - xhr.onerror = function () { - failure('Image upload failed due to a XHR Transport error. Code: ' + xhr.status); - }; - xhr.onload = function () { - if (xhr.status < 200 || xhr.status >= 300) { - failure('HTTP Error: ' + xhr.status); - return; - } - var json = JSON.parse(xhr.responseText); - if (!json || typeof json.location !== 'string') { - failure('Invalid JSON: ' + xhr.responseText); - return; - } - success(pathJoin(settings.basePath, json.location)); - }; - var formData = new FormData(); - formData.append('file', blobInfo.blob(), blobInfo.filename()); - xhr.send(formData); - }; - var noUpload = function () { - return new promiseObj(function (resolve) { - resolve([]); - }); - }; - var handlerSuccess = function (blobInfo, url) { - return { - url: url, - blobInfo: blobInfo, - status: true - }; - }; - var handlerFailure = function (blobInfo, message, options) { - return { - url: '', - blobInfo: blobInfo, - status: false, - error: { - message: message, - options: options - } - }; - }; - var resolvePending = function (blobUri, result) { - Tools.each(pendingPromises[blobUri], function (resolve) { - resolve(result); - }); - delete pendingPromises[blobUri]; - }; - var uploadBlobInfo = function (blobInfo, handler, openNotification) { - uploadStatus.markPending(blobInfo.blobUri()); - return new promiseObj(function (resolve) { - var notification, progress; - var noop = function () { - }; - try { - var closeNotification_1 = function () { - if (notification) { - notification.close(); - progress = noop; - } - }; - var success = function (url) { - closeNotification_1(); - uploadStatus.markUploaded(blobInfo.blobUri(), url); - resolvePending(blobInfo.blobUri(), handlerSuccess(blobInfo, url)); - resolve(handlerSuccess(blobInfo, url)); - }; - var failure = function (error, options) { - var failureOptions = options ? options : {}; - closeNotification_1(); - uploadStatus.removeFailed(blobInfo.blobUri()); - resolvePending(blobInfo.blobUri(), handlerFailure(blobInfo, error, failureOptions)); - resolve(handlerFailure(blobInfo, error, failureOptions)); - }; - progress = function (percent) { - if (percent < 0 || percent > 100) { - return; - } - if (!notification) { - notification = openNotification(); - } - notification.progressBar.value(percent); - }; - handler(blobInfo, success, failure, progress); - } catch (ex) { - resolve(handlerFailure(blobInfo, ex.message, {})); - } - }); - }; - var isDefaultHandler = function (handler) { - return handler === defaultHandler; - }; - var pendingUploadBlobInfo = function (blobInfo) { - var blobUri = blobInfo.blobUri(); - return new promiseObj(function (resolve) { - pendingPromises[blobUri] = pendingPromises[blobUri] || []; - pendingPromises[blobUri].push(resolve); - }); - }; - var uploadBlobs = function (blobInfos, openNotification) { - blobInfos = Tools.grep(blobInfos, function (blobInfo) { - return !uploadStatus.isUploaded(blobInfo.blobUri()); - }); - return promiseObj.all(Tools.map(blobInfos, function (blobInfo) { - return uploadStatus.isPending(blobInfo.blobUri()) ? pendingUploadBlobInfo(blobInfo) : uploadBlobInfo(blobInfo, settings.handler, openNotification); - })); - }; - var upload = function (blobInfos, openNotification) { - return !settings.url && isDefaultHandler(settings.handler) ? noUpload() : uploadBlobs(blobInfos, openNotification); - }; - if (isFunction(settings.handler) === false) { - settings.handler = defaultHandler; - } - return { upload: upload }; - } - - function UploadStatus () { - var PENDING = 1, UPLOADED = 2; - var blobUriStatuses = {}; - var createStatus = function (status, resultUri) { - return { - status: status, - resultUri: resultUri - }; - }; - var hasBlobUri = function (blobUri) { - return blobUri in blobUriStatuses; - }; - var getResultUri = function (blobUri) { - var result = blobUriStatuses[blobUri]; - return result ? result.resultUri : null; - }; - var isPending = function (blobUri) { - return hasBlobUri(blobUri) ? blobUriStatuses[blobUri].status === PENDING : false; - }; - var isUploaded = function (blobUri) { - return hasBlobUri(blobUri) ? blobUriStatuses[blobUri].status === UPLOADED : false; - }; - var markPending = function (blobUri) { - blobUriStatuses[blobUri] = createStatus(PENDING, null); - }; - var markUploaded = function (blobUri, resultUri) { - blobUriStatuses[blobUri] = createStatus(UPLOADED, resultUri); - }; - var removeFailed = function (blobUri) { - delete blobUriStatuses[blobUri]; - }; - var destroy = function () { - blobUriStatuses = {}; - }; - return { - hasBlobUri: hasBlobUri, - getResultUri: getResultUri, - isPending: isPending, - isUploaded: isUploaded, - markPending: markPending, - markUploaded: markUploaded, - removeFailed: removeFailed, - destroy: destroy - }; - } - - var count$1 = 0; - var seed = function () { - var rnd = function () { - return Math.round(Math.random() * 4294967295).toString(36); - }; - var now = new Date().getTime(); - return 's' + now.toString(36) + rnd() + rnd() + rnd(); - }; - var uuid = function (prefix) { - return prefix + count$1++ + seed(); - }; - - var BlobCache = function () { - var cache = []; - var mimeToExt = function (mime) { - var mimes = { - 'image/jpeg': 'jpg', - 'image/jpg': 'jpg', - 'image/gif': 'gif', - 'image/png': 'png', - 'image/apng': 'apng', - 'image/avif': 'avif', - 'image/svg+xml': 'svg', - 'image/webp': 'webp', - 'image/bmp': 'bmp', - 'image/tiff': 'tiff' - }; - return mimes[mime.toLowerCase()] || 'dat'; - }; - var create = function (o, blob, base64, name, filename) { - if (isString(o)) { - var id = o; - return toBlobInfo({ - id: id, - name: name, - filename: filename, - blob: blob, - base64: base64 - }); - } else if (isObject(o)) { - return toBlobInfo(o); - } else { - throw new Error('Unknown input type'); - } - }; - var toBlobInfo = function (o) { - if (!o.blob || !o.base64) { - throw new Error('blob and base64 representations of the image are required for BlobInfo to be created'); - } - var id = o.id || uuid('blobid'); - var name = o.name || id; - var blob = o.blob; - return { - id: constant(id), - name: constant(name), - filename: constant(o.filename || name + '.' + mimeToExt(blob.type)), - blob: constant(blob), - base64: constant(o.base64), - blobUri: constant(o.blobUri || URL.createObjectURL(blob)), - uri: constant(o.uri) - }; - }; - var add = function (blobInfo) { - if (!get(blobInfo.id())) { - cache.push(blobInfo); - } - }; - var findFirst = function (predicate) { - return find(cache, predicate).getOrUndefined(); - }; - var get = function (id) { - return findFirst(function (cachedBlobInfo) { - return cachedBlobInfo.id() === id; - }); - }; - var getByUri = function (blobUri) { - return findFirst(function (blobInfo) { - return blobInfo.blobUri() === blobUri; - }); - }; - var getByData = function (base64, type) { - return findFirst(function (blobInfo) { - return blobInfo.base64() === base64 && blobInfo.blob().type === type; - }); - }; - var removeByUri = function (blobUri) { - cache = filter(cache, function (blobInfo) { - if (blobInfo.blobUri() === blobUri) { - URL.revokeObjectURL(blobInfo.blobUri()); - return false; - } - return true; - }); - }; - var destroy = function () { - each(cache, function (cachedBlobInfo) { - URL.revokeObjectURL(cachedBlobInfo.blobUri()); - }); - cache = []; - }; - return { - create: create, - add: add, - get: get, - getByUri: getByUri, - getByData: getByData, - findFirst: findFirst, - removeByUri: removeByUri, - destroy: destroy - }; - }; - - var UploadChangeHandler = function (editor) { - var lastChangedLevel = Cell(null); - editor.on('change AddUndo', function (e) { - lastChangedLevel.set(__assign({}, e.level)); - }); - var fireIfChanged = function () { - var data = editor.undoManager.data; - last(data).filter(function (level) { - return !isEq$4(lastChangedLevel.get(), level); - }).each(function (level) { - editor.setDirty(true); - editor.fire('change', { - level: level, - lastLevel: get(data, data.length - 2).getOrNull() - }); - }); - }; - return { fireIfChanged: fireIfChanged }; - }; - var EditorUpload = function (editor) { - var blobCache = BlobCache(); - var uploader, imageScanner; - var uploadStatus = UploadStatus(); - var urlFilters = []; - var changeHandler = UploadChangeHandler(editor); - var aliveGuard = function (callback) { - return function (result) { - if (editor.selection) { - return callback(result); - } - return []; - }; - }; - var cacheInvalidator = function (url) { - return url + (url.indexOf('?') === -1 ? '?' : '&') + new Date().getTime(); - }; - var replaceString = function (content, search, replace) { - var index = 0; - do { - index = content.indexOf(search, index); - if (index !== -1) { - content = content.substring(0, index) + replace + content.substr(index + search.length); - index += replace.length - search.length + 1; - } - } while (index !== -1); - return content; - }; - var replaceImageUrl = function (content, targetUrl, replacementUrl) { - var replacementString = 'src="' + replacementUrl + '"' + (replacementUrl === Env.transparentSrc ? ' data-mce-placeholder="1"' : ''); - content = replaceString(content, 'src="' + targetUrl + '"', replacementString); - content = replaceString(content, 'data-mce-src="' + targetUrl + '"', 'data-mce-src="' + replacementUrl + '"'); - return content; - }; - var replaceUrlInUndoStack = function (targetUrl, replacementUrl) { - each(editor.undoManager.data, function (level) { - if (level.type === 'fragmented') { - level.fragments = map(level.fragments, function (fragment) { - return replaceImageUrl(fragment, targetUrl, replacementUrl); - }); - } else { - level.content = replaceImageUrl(level.content, targetUrl, replacementUrl); - } - }); - }; - var openNotification = function () { - return editor.notificationManager.open({ - text: editor.translate('Image uploading...'), - type: 'info', - timeout: -1, - progressBar: true - }); - }; - var replaceImageUriInView = function (image, resultUri) { - var src = editor.convertURL(resultUri, 'src'); - replaceUrlInUndoStack(image.src, resultUri); - editor.$(image).attr({ - 'src': shouldReuseFileName(editor) ? cacheInvalidator(resultUri) : resultUri, - 'data-mce-src': src - }); - }; - var uploadImages = function (callback) { - if (!uploader) { - uploader = Uploader(uploadStatus, { - url: getImageUploadUrl(editor), - basePath: getImageUploadBasePath(editor), - credentials: getImagesUploadCredentials(editor), - handler: getImagesUploadHandler(editor) - }); - } - return scanForImages().then(aliveGuard(function (imageInfos) { - var blobInfos = map(imageInfos, function (imageInfo) { - return imageInfo.blobInfo; - }); - return uploader.upload(blobInfos, openNotification).then(aliveGuard(function (result) { - var imagesToRemove = []; - var filteredResult = map(result, function (uploadInfo, index) { - var blobInfo = imageInfos[index].blobInfo; - var image = imageInfos[index].image; - if (uploadInfo.status && shouldReplaceBlobUris(editor)) { - blobCache.removeByUri(image.src); - replaceImageUriInView(image, uploadInfo.url); - } else if (uploadInfo.error) { - if (uploadInfo.error.options.remove) { - replaceUrlInUndoStack(image.getAttribute('src'), Env.transparentSrc); - imagesToRemove.push(image); - } - uploadError(editor, uploadInfo.error.message); - } - return { - element: image, - status: uploadInfo.status, - uploadUri: uploadInfo.url, - blobInfo: blobInfo - }; - }); - if (filteredResult.length > 0) { - changeHandler.fireIfChanged(); - } - if (imagesToRemove.length > 0) { - if (isRtc(editor)) { - console.error('Removing images on failed uploads is currently unsupported for RTC'); - } else { - editor.undoManager.transact(function () { - each(imagesToRemove, function (element) { - editor.dom.remove(element); - blobCache.removeByUri(element.src); - }); - }); - } - } - if (callback) { - callback(filteredResult); - } - return filteredResult; - })); - })); - }; - var uploadImagesAuto = function (callback) { - if (isAutomaticUploadsEnabled(editor)) { - return uploadImages(callback); - } - }; - var isValidDataUriImage = function (imgElm) { - if (forall(urlFilters, function (filter) { - return filter(imgElm); - }) === false) { - return false; - } - if (imgElm.getAttribute('src').indexOf('data:') === 0) { - var dataImgFilter = getImagesDataImgFilter(editor); - return dataImgFilter(imgElm); - } - return true; - }; - var addFilter = function (filter) { - urlFilters.push(filter); - }; - var scanForImages = function () { - if (!imageScanner) { - imageScanner = ImageScanner(uploadStatus, blobCache); - } - return imageScanner.findAll(editor.getBody(), isValidDataUriImage).then(aliveGuard(function (result) { - result = filter(result, function (resultItem) { - if (typeof resultItem === 'string') { - displayError(editor, resultItem); - return false; - } - return true; - }); - each(result, function (resultItem) { - replaceUrlInUndoStack(resultItem.image.src, resultItem.blobInfo.blobUri()); - resultItem.image.src = resultItem.blobInfo.blobUri(); - resultItem.image.removeAttribute('data-mce-src'); - }); - return result; - })); - }; - var destroy = function () { - blobCache.destroy(); - uploadStatus.destroy(); - imageScanner = uploader = null; - }; - var replaceBlobUris = function (content) { - return content.replace(/src="(blob:[^"]+)"/g, function (match, blobUri) { - var resultUri = uploadStatus.getResultUri(blobUri); - if (resultUri) { - return 'src="' + resultUri + '"'; - } - var blobInfo = blobCache.getByUri(blobUri); - if (!blobInfo) { - blobInfo = foldl(editor.editorManager.get(), function (result, editor) { - return result || editor.editorUpload && editor.editorUpload.blobCache.getByUri(blobUri); - }, null); - } - if (blobInfo) { - var blob = blobInfo.blob(); - return 'src="data:' + blob.type + ';base64,' + blobInfo.base64() + '"'; - } - return match; - }); - }; - editor.on('SetContent', function () { - if (isAutomaticUploadsEnabled(editor)) { - uploadImagesAuto(); - } else { - scanForImages(); - } - }); - editor.on('RawSaveContent', function (e) { - e.content = replaceBlobUris(e.content); - }); - editor.on('GetContent', function (e) { - if (e.source_view || e.format === 'raw' || e.format === 'tree') { - return; - } - e.content = replaceBlobUris(e.content); - }); - editor.on('PostRender', function () { - editor.parser.addNodeFilter('img', function (images) { - each(images, function (img) { - var src = img.attr('src'); - if (blobCache.getByUri(src)) { - return; - } - var resultUri = uploadStatus.getResultUri(src); - if (resultUri) { - img.attr('src', resultUri); - } - }); - }); - }); - return { - blobCache: blobCache, - addFilter: addFilter, - uploadImages: uploadImages, - uploadImagesAuto: uploadImagesAuto, - scanForImages: scanForImages, - destroy: destroy - }; - }; - - var get$a = function (dom) { - var formats = { - valigntop: [{ - selector: 'td,th', - styles: { verticalAlign: 'top' } - }], - valignmiddle: [{ - selector: 'td,th', - styles: { verticalAlign: 'middle' } - }], - valignbottom: [{ - selector: 'td,th', - styles: { verticalAlign: 'bottom' } - }], - alignleft: [ - { - selector: 'figure.image', - collapsed: false, - classes: 'align-left', - ceFalseOverride: true, - preview: 'font-family font-size' - }, - { - selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', - styles: { textAlign: 'left' }, - inherit: false, - preview: false, - defaultBlock: 'div' - }, - { - selector: 'img,table', - collapsed: false, - styles: { float: 'left' }, - preview: 'font-family font-size' - } - ], - aligncenter: [ - { - selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', - styles: { textAlign: 'center' }, - inherit: false, - preview: 'font-family font-size', - defaultBlock: 'div' - }, - { - selector: 'figure.image', - collapsed: false, - classes: 'align-center', - ceFalseOverride: true, - preview: 'font-family font-size' - }, - { - selector: 'img', - collapsed: false, - styles: { - display: 'block', - marginLeft: 'auto', - marginRight: 'auto' - }, - preview: false - }, - { - selector: 'table', - collapsed: false, - styles: { - marginLeft: 'auto', - marginRight: 'auto' - }, - preview: 'font-family font-size' - } - ], - alignright: [ - { - selector: 'figure.image', - collapsed: false, - classes: 'align-right', - ceFalseOverride: true, - preview: 'font-family font-size' - }, - { - selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', - styles: { textAlign: 'right' }, - inherit: false, - preview: 'font-family font-size', - defaultBlock: 'div' - }, - { - selector: 'img,table', - collapsed: false, - styles: { float: 'right' }, - preview: 'font-family font-size' - } - ], - alignjustify: [{ - selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', - styles: { textAlign: 'justify' }, - inherit: false, - defaultBlock: 'div', - preview: 'font-family font-size' - }], - bold: [ - { - inline: 'strong', - remove: 'all', - preserve_attributes: [ - 'class', - 'style' - ] - }, - { - inline: 'span', - styles: { fontWeight: 'bold' } - }, - { - inline: 'b', - remove: 'all', - preserve_attributes: [ - 'class', - 'style' - ] - } - ], - italic: [ - { - inline: 'em', - remove: 'all', - preserve_attributes: [ - 'class', - 'style' - ] - }, - { - inline: 'span', - styles: { fontStyle: 'italic' } - }, - { - inline: 'i', - remove: 'all', - preserve_attributes: [ - 'class', - 'style' - ] - } - ], - underline: [ - { - inline: 'span', - styles: { textDecoration: 'underline' }, - exact: true - }, - { - inline: 'u', - remove: 'all', - preserve_attributes: [ - 'class', - 'style' - ] - } - ], - strikethrough: [ - { - inline: 'span', - styles: { textDecoration: 'line-through' }, - exact: true - }, - { - inline: 'strike', - remove: 'all', - preserve_attributes: [ - 'class', - 'style' - ] - }, - { - inline: 's', - remove: 'all', - preserve_attributes: [ - 'class', - 'style' - ] - } - ], - forecolor: { - inline: 'span', - styles: { color: '%value' }, - links: true, - remove_similar: true, - clear_child_styles: true - }, - hilitecolor: { - inline: 'span', - styles: { backgroundColor: '%value' }, - links: true, - remove_similar: true, - clear_child_styles: true - }, - fontname: { - inline: 'span', - toggle: false, - styles: { fontFamily: '%value' }, - clear_child_styles: true - }, - fontsize: { - inline: 'span', - toggle: false, - styles: { fontSize: '%value' }, - clear_child_styles: true - }, - lineheight: { - selector: 'h1,h2,h3,h4,h5,h6,p,li,td,th,div', - defaultBlock: 'p', - styles: { lineHeight: '%value' } - }, - fontsize_class: { - inline: 'span', - attributes: { class: '%value' } - }, - blockquote: { - block: 'blockquote', - wrapper: true, - remove: 'all' - }, - subscript: { inline: 'sub' }, - superscript: { inline: 'sup' }, - code: { inline: 'code' }, - link: { - inline: 'a', - selector: 'a', - remove: 'all', - split: true, - deep: true, - onmatch: function (node, _fmt, _itemName) { - return isElement$1(node) && node.hasAttribute('href'); - }, - onformat: function (elm, _fmt, vars) { - Tools.each(vars, function (value, key) { - dom.setAttrib(elm, key, value); - }); - } - }, - removeformat: [ - { - selector: 'b,strong,em,i,font,u,strike,s,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins', - remove: 'all', - split: true, - expand: false, - block_expand: true, - deep: true - }, - { - selector: 'span', - attributes: [ - 'style', - 'class' - ], - remove: 'empty', - split: true, - expand: false, - deep: true - }, - { - selector: '*', - attributes: [ - 'style', - 'class' - ], - split: false, - expand: false, - deep: true - } - ] - }; - Tools.each('p h1 h2 h3 h4 h5 h6 div address pre div dt dd samp'.split(/\s/), function (name) { - formats[name] = { - block: name, - remove: 'all' - }; - }); - return formats; - }; - - function FormatRegistry(editor) { - var formats = {}; - var get = function (name) { - return name ? formats[name] : formats; - }; - var has$1 = function (name) { - return has(formats, name); - }; - var register = function (name, format) { - if (name) { - if (typeof name !== 'string') { - Tools.each(name, function (format, name) { - register(name, format); - }); - } else { - if (!isArray(format)) { - format = [format]; - } - Tools.each(format, function (format) { - if (typeof format.deep === 'undefined') { - format.deep = !format.selector; - } - if (typeof format.split === 'undefined') { - format.split = !format.selector || format.inline; - } - if (typeof format.remove === 'undefined' && format.selector && !format.inline) { - format.remove = 'none'; - } - if (format.selector && format.inline) { - format.mixed = true; - format.block_expand = true; - } - if (typeof format.classes === 'string') { - format.classes = format.classes.split(/\s+/); - } - }); - formats[name] = format; - } - } - }; - var unregister = function (name) { - if (name && formats[name]) { - delete formats[name]; - } - return formats; - }; - register(get$a(editor.dom)); - register(getFormats(editor)); - return { - get: get, - has: has$1, - register: register, - unregister: unregister - }; - } - - var each$e = Tools.each; - var dom = DOMUtils$1.DOM; - var parsedSelectorToHtml = function (ancestry, editor) { - var elm, item, fragment; - var schema = editor && editor.schema || Schema({}); - var decorate = function (elm, item) { - if (item.classes.length) { - dom.addClass(elm, item.classes.join(' ')); - } - dom.setAttribs(elm, item.attrs); - }; - var createElement = function (sItem) { - item = typeof sItem === 'string' ? { - name: sItem, - classes: [], - attrs: {} - } : sItem; - var elm = dom.create(item.name); - decorate(elm, item); - return elm; - }; - var getRequiredParent = function (elm, candidate) { - var name = typeof elm !== 'string' ? elm.nodeName.toLowerCase() : elm; - var elmRule = schema.getElementRule(name); - var parentsRequired = elmRule && elmRule.parentsRequired; - if (parentsRequired && parentsRequired.length) { - return candidate && Tools.inArray(parentsRequired, candidate) !== -1 ? candidate : parentsRequired[0]; - } else { - return false; - } - }; - var wrapInHtml = function (elm, ancestry, siblings) { - var parent, parentCandidate; - var ancestor = ancestry.length > 0 && ancestry[0]; - var ancestorName = ancestor && ancestor.name; - var parentRequired = getRequiredParent(elm, ancestorName); - if (parentRequired) { - if (ancestorName === parentRequired) { - parentCandidate = ancestry[0]; - ancestry = ancestry.slice(1); - } else { - parentCandidate = parentRequired; - } - } else if (ancestor) { - parentCandidate = ancestry[0]; - ancestry = ancestry.slice(1); - } else if (!siblings) { - return elm; - } - if (parentCandidate) { - parent = createElement(parentCandidate); - parent.appendChild(elm); - } - if (siblings) { - if (!parent) { - parent = dom.create('div'); - parent.appendChild(elm); - } - Tools.each(siblings, function (sibling) { - var siblingElm = createElement(sibling); - parent.insertBefore(siblingElm, elm); - }); - } - return wrapInHtml(parent, ancestry, parentCandidate && parentCandidate.siblings); - }; - if (ancestry && ancestry.length) { - item = ancestry[0]; - elm = createElement(item); - fragment = dom.create('div'); - fragment.appendChild(wrapInHtml(elm, ancestry.slice(1), item.siblings)); - return fragment; - } else { - return ''; - } - }; - var parseSelectorItem = function (item) { - var tagName; - var obj = { - classes: [], - attrs: {} - }; - item = obj.selector = Tools.trim(item); - if (item !== '*') { - tagName = item.replace(/(?:([#\.]|::?)([\w\-]+)|(\[)([^\]]+)\]?)/g, function ($0, $1, $2, $3, $4) { - switch ($1) { - case '#': - obj.attrs.id = $2; - break; - case '.': - obj.classes.push($2); - break; - case ':': - if (Tools.inArray('checked disabled enabled read-only required'.split(' '), $2) !== -1) { - obj.attrs[$2] = $2; - } - break; - } - if ($3 === '[') { - var m = $4.match(/([\w\-]+)(?:\=\"([^\"]+))?/); - if (m) { - obj.attrs[m[1]] = m[2]; - } - } - return ''; - }); - } - obj.name = tagName || 'div'; - return obj; - }; - var parseSelector = function (selector) { - if (!selector || typeof selector !== 'string') { - return []; - } - selector = selector.split(/\s*,\s*/)[0]; - selector = selector.replace(/\s*(~\+|~|\+|>)\s*/g, '$1'); - return Tools.map(selector.split(/(?:>|\s+(?![^\[\]]+\]))/), function (item) { - var siblings = Tools.map(item.split(/(?:~\+|~|\+)/), parseSelectorItem); - var obj = siblings.pop(); - if (siblings.length) { - obj.siblings = siblings; - } - return obj; - }).reverse(); - }; - var getCssText = function (editor, format) { - var name, previewFrag; - var previewCss = '', parentFontSize; - var previewStyles = getPreviewStyles(editor); - if (previewStyles === '') { - return ''; - } - var removeVars = function (val) { - return val.replace(/%(\w+)/g, ''); - }; - if (typeof format === 'string') { - format = editor.formatter.get(format); - if (!format) { - return; - } - format = format[0]; - } - if ('preview' in format) { - var previewOpt = get$1(format, 'preview'); - if (previewOpt.is(false)) { - return ''; - } else { - previewStyles = previewOpt.getOr(previewStyles); - } - } - name = format.block || format.inline || 'span'; - var items = parseSelector(format.selector); - if (items.length) { - if (!items[0].name) { - items[0].name = name; - } - name = format.selector; - previewFrag = parsedSelectorToHtml(items, editor); - } else { - previewFrag = parsedSelectorToHtml([name], editor); - } - var previewElm = dom.select(name, previewFrag)[0] || previewFrag.firstChild; - each$e(format.styles, function (value, name) { - var newValue = removeVars(value); - if (newValue) { - dom.setStyle(previewElm, name, newValue); - } - }); - each$e(format.attributes, function (value, name) { - var newValue = removeVars(value); - if (newValue) { - dom.setAttrib(previewElm, name, newValue); - } - }); - each$e(format.classes, function (value) { - var newValue = removeVars(value); - if (!dom.hasClass(previewElm, newValue)) { - dom.addClass(previewElm, newValue); - } - }); - editor.fire('PreviewFormats'); - dom.setStyles(previewFrag, { - position: 'absolute', - left: -65535 - }); - editor.getBody().appendChild(previewFrag); - parentFontSize = dom.getStyle(editor.getBody(), 'fontSize', true); - parentFontSize = /px$/.test(parentFontSize) ? parseInt(parentFontSize, 10) : 0; - each$e(previewStyles.split(' '), function (name) { - var value = dom.getStyle(previewElm, name, true); - if (name === 'background-color' && /transparent|rgba\s*\([^)]+,\s*0\)/.test(value)) { - value = dom.getStyle(editor.getBody(), name, true); - if (dom.toHex(value).toLowerCase() === '#ffffff') { - return; - } - } - if (name === 'color') { - if (dom.toHex(value).toLowerCase() === '#000000') { - return; - } - } - if (name === 'font-size') { - if (/em|%$/.test(value)) { - if (parentFontSize === 0) { - return; - } - var numValue = parseFloat(value) / (/%$/.test(value) ? 100 : 1); - value = numValue * parentFontSize + 'px'; - } - } - if (name === 'border' && value) { - previewCss += 'padding:0 2px;'; - } - previewCss += name + ':' + value + ';'; - }); - editor.fire('AfterPreviewFormats'); - dom.remove(previewFrag); - return previewCss; - }; - - var setup$6 = function (editor) { - editor.addShortcut('meta+b', '', 'Bold'); - editor.addShortcut('meta+i', '', 'Italic'); - editor.addShortcut('meta+u', '', 'Underline'); - for (var i = 1; i <= 6; i++) { - editor.addShortcut('access+' + i, '', [ - 'FormatBlock', - false, - 'h' + i - ]); - } - editor.addShortcut('access+7', '', [ - 'FormatBlock', - false, - 'p' - ]); - editor.addShortcut('access+8', '', [ - 'FormatBlock', - false, - 'div' - ]); - editor.addShortcut('access+9', '', [ - 'FormatBlock', - false, - 'address' - ]); - }; - - var Formatter = function (editor) { - var formats = FormatRegistry(editor); - var formatChangeState = Cell(null); - setup$6(editor); - setup$3(editor); - return { - get: formats.get, - has: formats.has, - register: formats.register, - unregister: formats.unregister, - apply: function (name, vars, node) { - applyFormat$1(editor, name, vars, node); - }, - remove: function (name, vars, node, similar) { - removeFormat$1(editor, name, vars, node, similar); - }, - toggle: function (name, vars, node) { - toggleFormat(editor, name, vars, node); - }, - match: function (name, vars, node) { - return matchFormat(editor, name, vars, node); - }, - closest: function (names) { - return closestFormat(editor, names); - }, - matchAll: function (names, vars) { - return matchAllFormats(editor, names, vars); - }, - matchNode: function (node, names, vars, similar) { - return matchNodeFormat(editor, node, names, vars, similar); - }, - canApply: function (name) { - return canApplyFormat(editor, name); - }, - formatChanged: function (formats, callback, similar) { - return formatChanged(editor, formatChangeState, formats, callback, similar); - }, - getCssText: curry(getCssText, editor) - }; - }; - - var registerEvents$1 = function (editor, undoManager, locks) { - var isFirstTypedCharacter = Cell(false); - var addNonTypingUndoLevel = function (e) { - setTyping(undoManager, false, locks); - undoManager.add({}, e); - }; - editor.on('init', function () { - undoManager.add(); - }); - editor.on('BeforeExecCommand', function (e) { - var cmd = e.command.toLowerCase(); - if (cmd !== 'undo' && cmd !== 'redo' && cmd !== 'mcerepaint') { - endTyping(undoManager, locks); - undoManager.beforeChange(); - } - }); - editor.on('ExecCommand', function (e) { - var cmd = e.command.toLowerCase(); - if (cmd !== 'undo' && cmd !== 'redo' && cmd !== 'mcerepaint') { - addNonTypingUndoLevel(e); - } - }); - editor.on('ObjectResizeStart cut', function () { - undoManager.beforeChange(); - }); - editor.on('SaveContent ObjectResized blur', addNonTypingUndoLevel); - editor.on('dragend', addNonTypingUndoLevel); - editor.on('keyup', function (e) { - var keyCode = e.keyCode; - if (e.isDefaultPrevented()) { - return; - } - if (keyCode >= 33 && keyCode <= 36 || keyCode >= 37 && keyCode <= 40 || keyCode === 45 || e.ctrlKey) { - addNonTypingUndoLevel(); - editor.nodeChanged(); - } - if (keyCode === 46 || keyCode === 8) { - editor.nodeChanged(); - } - if (isFirstTypedCharacter.get() && undoManager.typing && isEq$4(createFromEditor(editor), undoManager.data[0]) === false) { - if (editor.isDirty() === false) { - editor.setDirty(true); - editor.fire('change', { - level: undoManager.data[0], - lastLevel: null - }); - } - editor.fire('TypingUndo'); - isFirstTypedCharacter.set(false); - editor.nodeChanged(); - } - }); - editor.on('keydown', function (e) { - var keyCode = e.keyCode; - if (e.isDefaultPrevented()) { - return; - } - if (keyCode >= 33 && keyCode <= 36 || keyCode >= 37 && keyCode <= 40 || keyCode === 45) { - if (undoManager.typing) { - addNonTypingUndoLevel(e); - } - return; - } - var modKey = e.ctrlKey && !e.altKey || e.metaKey; - if ((keyCode < 16 || keyCode > 20) && keyCode !== 224 && keyCode !== 91 && !undoManager.typing && !modKey) { - undoManager.beforeChange(); - setTyping(undoManager, true, locks); - undoManager.add({}, e); - isFirstTypedCharacter.set(true); - } - }); - editor.on('mousedown', function (e) { - if (undoManager.typing) { - addNonTypingUndoLevel(e); - } - }); - var isInsertReplacementText = function (event) { - return event.inputType === 'insertReplacementText'; - }; - var isInsertTextDataNull = function (event) { - return event.inputType === 'insertText' && event.data === null; - }; - var isInsertFromPasteOrDrop = function (event) { - return event.inputType === 'insertFromPaste' || event.inputType === 'insertFromDrop'; - }; - editor.on('input', function (e) { - if (e.inputType && (isInsertReplacementText(e) || isInsertTextDataNull(e) || isInsertFromPasteOrDrop(e))) { - addNonTypingUndoLevel(e); - } - }); - editor.on('AddUndo Undo Redo ClearUndos', function (e) { - if (!e.isDefaultPrevented()) { - editor.nodeChanged(); - } - }); - }; - var addKeyboardShortcuts = function (editor) { - editor.addShortcut('meta+z', '', 'Undo'); - editor.addShortcut('meta+y,meta+shift+z', '', 'Redo'); - }; - - var UndoManager = function (editor) { - var beforeBookmark = Cell(Optional.none()); - var locks = Cell(0); - var index = Cell(0); - var undoManager = { - data: [], - typing: false, - beforeChange: function () { - beforeChange$1(editor, locks, beforeBookmark); - }, - add: function (level, event) { - return addUndoLevel$1(editor, undoManager, index, locks, beforeBookmark, level, event); - }, - undo: function () { - return undo$1(editor, undoManager, locks, index); - }, - redo: function () { - return redo$1(editor, index, undoManager.data); - }, - clear: function () { - clear$1(editor, undoManager, index); - }, - reset: function () { - reset$1(editor, undoManager); - }, - hasUndo: function () { - return hasUndo$1(editor, undoManager, index); - }, - hasRedo: function () { - return hasRedo$1(editor, undoManager, index); - }, - transact: function (callback) { - return transact$1(editor, undoManager, locks, callback); - }, - ignore: function (callback) { - ignore$1(editor, locks, callback); - }, - extra: function (callback1, callback2) { - extra$1(editor, undoManager, index, callback1, callback2); - } - }; - if (!isRtc(editor)) { - registerEvents$1(editor, undoManager, locks); - } - addKeyboardShortcuts(editor); - return undoManager; - }; - - var nonTypingKeycodes = [ - 9, - 27, - VK.HOME, - VK.END, - 19, - 20, - 44, - 144, - 145, - 33, - 34, - 45, - 16, - 17, - 18, - 91, - 92, - 93, - VK.DOWN, - VK.UP, - VK.LEFT, - VK.RIGHT - ].concat(Env.browser.isFirefox() ? [224] : []); - var placeholderAttr = 'data-mce-placeholder'; - var isKeyboardEvent = function (e) { - return e.type === 'keydown' || e.type === 'keyup'; - }; - var isDeleteEvent = function (e) { - var keyCode = e.keyCode; - return keyCode === VK.BACKSPACE || keyCode === VK.DELETE; - }; - var isNonTypingKeyboardEvent = function (e) { - if (isKeyboardEvent(e)) { - var keyCode = e.keyCode; - return !isDeleteEvent(e) && (VK.metaKeyPressed(e) || e.altKey || keyCode >= 112 && keyCode <= 123 || contains(nonTypingKeycodes, keyCode)); - } else { - return false; - } - }; - var isTypingKeyboardEvent = function (e) { - return isKeyboardEvent(e) && !(isDeleteEvent(e) || e.type === 'keyup' && e.keyCode === 229); - }; - var isVisuallyEmpty = function (dom, rootElm, forcedRootBlock) { - if (isEmpty(SugarElement.fromDom(rootElm), false)) { - var isForcedRootBlockFalse = forcedRootBlock === ''; - var firstElement = rootElm.firstElementChild; - if (!firstElement) { - return true; - } else if (dom.getStyle(rootElm.firstElementChild, 'padding-left') || dom.getStyle(rootElm.firstElementChild, 'padding-right')) { - return false; - } else { - return isForcedRootBlockFalse ? !dom.isBlock(firstElement) : forcedRootBlock === firstElement.nodeName.toLowerCase(); - } - } else { - return false; - } - }; - var setup$7 = function (editor) { - var dom = editor.dom; - var rootBlock = getForcedRootBlock(editor); - var placeholder = getPlaceholder(editor); - var updatePlaceholder = function (e, initial) { - if (isNonTypingKeyboardEvent(e)) { - return; - } - var body = editor.getBody(); - var showPlaceholder = isTypingKeyboardEvent(e) ? false : isVisuallyEmpty(dom, body, rootBlock); - var isPlaceholderShown = dom.getAttrib(body, placeholderAttr) !== ''; - if (isPlaceholderShown !== showPlaceholder || initial) { - dom.setAttrib(body, placeholderAttr, showPlaceholder ? placeholder : null); - dom.setAttrib(body, 'aria-placeholder', showPlaceholder ? placeholder : null); - firePlaceholderToggle(editor, showPlaceholder); - editor.on(showPlaceholder ? 'keydown' : 'keyup', updatePlaceholder); - editor.off(showPlaceholder ? 'keyup' : 'keydown', updatePlaceholder); - } - }; - if (placeholder) { - editor.on('init', function (e) { - updatePlaceholder(e, true); - editor.on('change SetContent ExecCommand', updatePlaceholder); - editor.on('paste', function (e) { - return Delay.setEditorTimeout(editor, function () { - return updatePlaceholder(e); - }); - }); - }); - } - }; - - var strongRtl = /[\u0591-\u07FF\uFB1D-\uFDFF\uFE70-\uFEFC]/; - var hasStrongRtl = function (text) { - return strongRtl.test(text); - }; - - var isInlineTarget = function (editor, elm) { - return is$1(SugarElement.fromDom(elm), getInlineBoundarySelector(editor)); - }; - var isRtl$1 = function (element) { - return DOMUtils$1.DOM.getStyle(element, 'direction', true) === 'rtl' || hasStrongRtl(element.textContent); - }; - var findInlineParents = function (isInlineTarget, rootNode, pos) { - return filter(DOMUtils$1.DOM.getParents(pos.container(), '*', rootNode), isInlineTarget); - }; - var findRootInline = function (isInlineTarget, rootNode, pos) { - var parents = findInlineParents(isInlineTarget, rootNode, pos); - return Optional.from(parents[parents.length - 1]); - }; - var hasSameParentBlock = function (rootNode, node1, node2) { - var block1 = getParentBlock(node1, rootNode); - var block2 = getParentBlock(node2, rootNode); - return block1 && block1 === block2; - }; - var isAtZwsp = function (pos) { - return isBeforeInline(pos) || isAfterInline(pos); - }; - var normalizePosition = function (forward, pos) { - if (!pos) { - return pos; - } - var container = pos.container(), offset = pos.offset(); - if (forward) { - if (isCaretContainerInline(container)) { - if (isText$1(container.nextSibling)) { - return CaretPosition$1(container.nextSibling, 0); - } else { - return CaretPosition$1.after(container); - } - } else { - return isBeforeInline(pos) ? CaretPosition$1(container, offset + 1) : pos; - } - } else { - if (isCaretContainerInline(container)) { - if (isText$1(container.previousSibling)) { - return CaretPosition$1(container.previousSibling, container.previousSibling.data.length); - } else { - return CaretPosition$1.before(container); - } - } else { - return isAfterInline(pos) ? CaretPosition$1(container, offset - 1) : pos; - } - } - }; - var normalizeForwards = curry(normalizePosition, true); - var normalizeBackwards = curry(normalizePosition, false); - - var isBeforeRoot = function (rootNode) { - return function (elm) { - return eq$2(rootNode, SugarElement.fromDom(elm.dom.parentNode)); - }; - }; - var getParentBlock$1 = function (rootNode, elm) { - return contains$2(rootNode, elm) ? closest(elm, function (element) { - return isTextBlock(element) || isListItem(element); - }, isBeforeRoot(rootNode)) : Optional.none(); - }; - var placeCaretInEmptyBody = function (editor) { - var body = editor.getBody(); - var node = body.firstChild && editor.dom.isBlock(body.firstChild) ? body.firstChild : body; - editor.selection.setCursorLocation(node, 0); - }; - var paddEmptyBody = function (editor) { - if (editor.dom.isEmpty(editor.getBody())) { - editor.setContent(''); - placeCaretInEmptyBody(editor); - } - }; - var willDeleteLastPositionInElement = function (forward, fromPos, elm) { - return lift2(firstPositionIn(elm), lastPositionIn(elm), function (firstPos, lastPos) { - var normalizedFirstPos = normalizePosition(true, firstPos); - var normalizedLastPos = normalizePosition(false, lastPos); - var normalizedFromPos = normalizePosition(false, fromPos); - if (forward) { - return nextPosition(elm, normalizedFromPos).exists(function (nextPos) { - return nextPos.isEqual(normalizedLastPos) && fromPos.isEqual(normalizedFirstPos); - }); - } else { - return prevPosition(elm, normalizedFromPos).exists(function (prevPos) { - return prevPos.isEqual(normalizedFirstPos) && fromPos.isEqual(normalizedLastPos); - }); - } - }).getOr(true); - }; - - var blockPosition = function (block, position) { - return { - block: block, - position: position - }; - }; - var blockBoundary = function (from, to) { - return { - from: from, - to: to - }; - }; - var getBlockPosition = function (rootNode, pos) { - var rootElm = SugarElement.fromDom(rootNode); - var containerElm = SugarElement.fromDom(pos.container()); - return getParentBlock$1(rootElm, containerElm).map(function (block) { - return blockPosition(block, pos); - }); - }; - var isDifferentBlocks = function (blockBoundary) { - return eq$2(blockBoundary.from.block, blockBoundary.to.block) === false; - }; - var hasSameParent = function (blockBoundary) { - return parent(blockBoundary.from.block).bind(function (parent1) { - return parent(blockBoundary.to.block).filter(function (parent2) { - return eq$2(parent1, parent2); - }); - }).isSome(); - }; - var isEditable = function (blockBoundary) { - return isContentEditableFalse(blockBoundary.from.block.dom) === false && isContentEditableFalse(blockBoundary.to.block.dom) === false; - }; - var skipLastBr = function (rootNode, forward, blockPosition) { - if (isBr(blockPosition.position.getNode()) && isEmpty(blockPosition.block) === false) { - return positionIn(false, blockPosition.block.dom).bind(function (lastPositionInBlock) { - if (lastPositionInBlock.isEqual(blockPosition.position)) { - return fromPosition(forward, rootNode, lastPositionInBlock).bind(function (to) { - return getBlockPosition(rootNode, to); - }); - } else { - return Optional.some(blockPosition); - } - }).getOr(blockPosition); - } else { - return blockPosition; - } - }; - var readFromRange = function (rootNode, forward, rng) { - var fromBlockPos = getBlockPosition(rootNode, CaretPosition$1.fromRangeStart(rng)); - var toBlockPos = fromBlockPos.bind(function (blockPos) { - return fromPosition(forward, rootNode, blockPos.position).bind(function (to) { - return getBlockPosition(rootNode, to).map(function (blockPos) { - return skipLastBr(rootNode, forward, blockPos); - }); - }); - }); - return lift2(fromBlockPos, toBlockPos, blockBoundary).filter(function (blockBoundary) { - return isDifferentBlocks(blockBoundary) && hasSameParent(blockBoundary) && isEditable(blockBoundary); - }); - }; - var read$3 = function (rootNode, forward, rng) { - return rng.collapsed ? readFromRange(rootNode, forward, rng) : Optional.none(); - }; - - var getChildrenUntilBlockBoundary = function (block) { - var children$1 = children(block); - return findIndex(children$1, isBlock).fold(function () { - return children$1; - }, function (index) { - return children$1.slice(0, index); - }); - }; - var extractChildren = function (block) { - var children = getChildrenUntilBlockBoundary(block); - each(children, remove); - return children; - }; - var removeEmptyRoot = function (rootNode, block) { - var parents = parentsAndSelf(block, rootNode); - return find(parents.reverse(), function (element) { - return isEmpty(element); - }).each(remove); - }; - var isEmptyBefore = function (el) { - return filter(prevSiblings(el), function (el) { - return !isEmpty(el); - }).length === 0; - }; - var nestedBlockMerge = function (rootNode, fromBlock, toBlock, insertionPoint) { - if (isEmpty(toBlock)) { - fillWithPaddingBr(toBlock); - return firstPositionIn(toBlock.dom); - } - if (isEmptyBefore(insertionPoint) && isEmpty(fromBlock)) { - before(insertionPoint, SugarElement.fromTag('br')); - } - var position = prevPosition(toBlock.dom, CaretPosition$1.before(insertionPoint.dom)); - each(extractChildren(fromBlock), function (child) { - before(insertionPoint, child); - }); - removeEmptyRoot(rootNode, fromBlock); - return position; - }; - var sidelongBlockMerge = function (rootNode, fromBlock, toBlock) { - if (isEmpty(toBlock)) { - remove(toBlock); - if (isEmpty(fromBlock)) { - fillWithPaddingBr(fromBlock); - } - return firstPositionIn(fromBlock.dom); - } - var position = lastPositionIn(toBlock.dom); - each(extractChildren(fromBlock), function (child) { - append(toBlock, child); - }); - removeEmptyRoot(rootNode, fromBlock); - return position; - }; - var findInsertionPoint = function (toBlock, block) { - var parentsAndSelf$1 = parentsAndSelf(block, toBlock); - return Optional.from(parentsAndSelf$1[parentsAndSelf$1.length - 1]); - }; - var getInsertionPoint = function (fromBlock, toBlock) { - return contains$2(toBlock, fromBlock) ? findInsertionPoint(toBlock, fromBlock) : Optional.none(); - }; - var trimBr = function (first, block) { - positionIn(first, block.dom).map(function (position) { - return position.getNode(); - }).map(SugarElement.fromDom).filter(isBr$1).each(remove); - }; - var mergeBlockInto = function (rootNode, fromBlock, toBlock) { - trimBr(true, fromBlock); - trimBr(false, toBlock); - return getInsertionPoint(fromBlock, toBlock).fold(curry(sidelongBlockMerge, rootNode, fromBlock, toBlock), curry(nestedBlockMerge, rootNode, fromBlock, toBlock)); - }; - var mergeBlocks = function (rootNode, forward, block1, block2) { - return forward ? mergeBlockInto(rootNode, block2, block1) : mergeBlockInto(rootNode, block1, block2); - }; - - var backspaceDelete$1 = function (editor, forward) { - var rootNode = SugarElement.fromDom(editor.getBody()); - var position = read$3(rootNode.dom, forward, editor.selection.getRng()).bind(function (blockBoundary) { - return mergeBlocks(rootNode, forward, blockBoundary.from.block, blockBoundary.to.block); - }); - position.each(function (pos) { - editor.selection.setRng(pos.toRange()); - }); - return position.isSome(); - }; - - var deleteRangeMergeBlocks = function (rootNode, selection) { - var rng = selection.getRng(); - return lift2(getParentBlock$1(rootNode, SugarElement.fromDom(rng.startContainer)), getParentBlock$1(rootNode, SugarElement.fromDom(rng.endContainer)), function (block1, block2) { - if (eq$2(block1, block2) === false) { - rng.deleteContents(); - mergeBlocks(rootNode, true, block1, block2).each(function (pos) { - selection.setRng(pos.toRange()); - }); - return true; - } else { - return false; - } - }).getOr(false); - }; - var isRawNodeInTable = function (root, rawNode) { - var node = SugarElement.fromDom(rawNode); - var isRoot = curry(eq$2, root); - return ancestor(node, isTableCell$1, isRoot).isSome(); - }; - var isSelectionInTable = function (root, rng) { - return isRawNodeInTable(root, rng.startContainer) || isRawNodeInTable(root, rng.endContainer); - }; - var isEverythingSelected = function (root, rng) { - var noPrevious = prevPosition(root.dom, CaretPosition$1.fromRangeStart(rng)).isNone(); - var noNext = nextPosition(root.dom, CaretPosition$1.fromRangeEnd(rng)).isNone(); - return !isSelectionInTable(root, rng) && noPrevious && noNext; - }; - var emptyEditor = function (editor) { - editor.setContent(''); - editor.selection.setCursorLocation(); - return true; - }; - var deleteRange$1 = function (editor) { - var rootNode = SugarElement.fromDom(editor.getBody()); - var rng = editor.selection.getRng(); - return isEverythingSelected(rootNode, rng) ? emptyEditor(editor) : deleteRangeMergeBlocks(rootNode, editor.selection); - }; - var backspaceDelete$2 = function (editor, _forward) { - return editor.selection.isCollapsed() ? false : deleteRange$1(editor); - }; - - var isContentEditableTrue$2 = isContentEditableTrue; - var isContentEditableFalse$7 = isContentEditableFalse; - var showCaret = function (direction, editor, node, before, scrollIntoView) { - return Optional.from(editor._selectionOverrides.showCaret(direction, node, before, scrollIntoView)); - }; - var getNodeRange = function (node) { - var rng = node.ownerDocument.createRange(); - rng.selectNode(node); - return rng; - }; - var selectNode = function (editor, node) { - var e = editor.fire('BeforeObjectSelected', { target: node }); - if (e.isDefaultPrevented()) { - return Optional.none(); - } - return Optional.some(getNodeRange(node)); - }; - var renderCaretAtRange = function (editor, range, scrollIntoView) { - var normalizedRange = normalizeRange(1, editor.getBody(), range); - var caretPosition = CaretPosition$1.fromRangeStart(normalizedRange); - var caretPositionNode = caretPosition.getNode(); - if (isInlineFakeCaretTarget(caretPositionNode)) { - return showCaret(1, editor, caretPositionNode, !caretPosition.isAtEnd(), false); - } - var caretPositionBeforeNode = caretPosition.getNode(true); - if (isInlineFakeCaretTarget(caretPositionBeforeNode)) { - return showCaret(1, editor, caretPositionBeforeNode, false, false); - } - var ceRoot = editor.dom.getParent(caretPosition.getNode(), function (node) { - return isContentEditableFalse$7(node) || isContentEditableTrue$2(node); - }); - if (isInlineFakeCaretTarget(ceRoot)) { - return showCaret(1, editor, ceRoot, false, scrollIntoView); - } - return Optional.none(); - }; - var renderRangeCaret = function (editor, range, scrollIntoView) { - return range.collapsed ? renderCaretAtRange(editor, range, scrollIntoView).getOr(range) : range; - }; - - var isBeforeBoundary = function (pos) { - return isBeforeContentEditableFalse(pos) || isBeforeMedia(pos); - }; - var isAfterBoundary = function (pos) { - return isAfterContentEditableFalse(pos) || isAfterMedia(pos); - }; - var trimEmptyTextNode$1 = function (dom, node) { - if (isText$1(node) && node.data.length === 0) { - dom.remove(node); - } - }; - var deleteContentAndShowCaret = function (editor, range, node, direction, forward, peekCaretPosition) { - showCaret(direction, editor, peekCaretPosition.getNode(!forward), forward, true).each(function (caretRange) { - if (range.collapsed) { - var deleteRange = range.cloneRange(); - if (forward) { - deleteRange.setEnd(caretRange.startContainer, caretRange.startOffset); - } else { - deleteRange.setStart(caretRange.endContainer, caretRange.endOffset); - } - deleteRange.deleteContents(); - } else { - range.deleteContents(); - } - editor.selection.setRng(caretRange); - }); - trimEmptyTextNode$1(editor.dom, node); - return true; - }; - var deleteBoundaryText = function (editor, forward) { - var range = editor.selection.getRng(); - if (!isText$1(range.commonAncestorContainer)) { - return false; - } - var direction = forward ? HDirection.Forwards : HDirection.Backwards; - var caretWalker = CaretWalker(editor.getBody()); - var getNextPosFn = curry(getVisualCaretPosition, forward ? caretWalker.next : caretWalker.prev); - var isBeforeFn = forward ? isBeforeBoundary : isAfterBoundary; - var caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range); - var nextCaretPosition = normalizePosition(forward, getNextPosFn(caretPosition)); - if (!nextCaretPosition || !isMoveInsideSameBlock(caretPosition, nextCaretPosition)) { - return false; - } else if (isBeforeFn(nextCaretPosition)) { - return deleteContentAndShowCaret(editor, range, caretPosition.getNode(), direction, forward, nextCaretPosition); - } - var peekCaretPosition = getNextPosFn(nextCaretPosition); - if (peekCaretPosition && isBeforeFn(peekCaretPosition)) { - if (isMoveInsideSameBlock(nextCaretPosition, peekCaretPosition)) { - return deleteContentAndShowCaret(editor, range, caretPosition.getNode(), direction, forward, peekCaretPosition); - } - } - return false; - }; - var backspaceDelete$3 = function (editor, forward) { - return deleteBoundaryText(editor, forward); - }; - - var isCompoundElement = function (node) { - return isTableCell$1(SugarElement.fromDom(node)) || isListItem(SugarElement.fromDom(node)); - }; - var DeleteAction = Adt.generate([ - { remove: ['element'] }, - { moveToElement: ['element'] }, - { moveToPosition: ['position'] } - ]); - var isAtContentEditableBlockCaret = function (forward, from) { - var elm = from.getNode(forward === false); - var caretLocation = forward ? 'after' : 'before'; - return isElement$1(elm) && elm.getAttribute('data-mce-caret') === caretLocation; - }; - var isDeleteFromCefDifferentBlocks = function (root, forward, from, to) { - var inSameBlock = function (elm) { - return isInline(SugarElement.fromDom(elm)) && !isInSameBlock(from, to, root); - }; - return getRelativeCefElm(!forward, from).fold(function () { - return getRelativeCefElm(forward, to).fold(never, inSameBlock); - }, inSameBlock); - }; - var deleteEmptyBlockOrMoveToCef = function (root, forward, from, to) { - var toCefElm = to.getNode(forward === false); - return getParentBlock$1(SugarElement.fromDom(root), SugarElement.fromDom(from.getNode())).map(function (blockElm) { - return isEmpty(blockElm) ? DeleteAction.remove(blockElm.dom) : DeleteAction.moveToElement(toCefElm); - }).orThunk(function () { - return Optional.some(DeleteAction.moveToElement(toCefElm)); - }); - }; - var findCefPosition = function (root, forward, from) { - return fromPosition(forward, root, from).bind(function (to) { - if (isCompoundElement(to.getNode())) { - return Optional.none(); - } else if (isDeleteFromCefDifferentBlocks(root, forward, from, to)) { - return Optional.none(); - } else if (forward && isContentEditableFalse(to.getNode())) { - return deleteEmptyBlockOrMoveToCef(root, forward, from, to); - } else if (forward === false && isContentEditableFalse(to.getNode(true))) { - return deleteEmptyBlockOrMoveToCef(root, forward, from, to); - } else if (forward && isAfterContentEditableFalse(from)) { - return Optional.some(DeleteAction.moveToPosition(to)); - } else if (forward === false && isBeforeContentEditableFalse(from)) { - return Optional.some(DeleteAction.moveToPosition(to)); - } else { - return Optional.none(); - } - }); - }; - var getContentEditableBlockAction = function (forward, elm) { - if (forward && isContentEditableFalse(elm.nextSibling)) { - return Optional.some(DeleteAction.moveToElement(elm.nextSibling)); - } else if (forward === false && isContentEditableFalse(elm.previousSibling)) { - return Optional.some(DeleteAction.moveToElement(elm.previousSibling)); - } else { - return Optional.none(); - } - }; - var skipMoveToActionFromInlineCefToContent = function (root, from, deleteAction) { - return deleteAction.fold(function (elm) { - return Optional.some(DeleteAction.remove(elm)); - }, function (elm) { - return Optional.some(DeleteAction.moveToElement(elm)); - }, function (to) { - if (isInSameBlock(from, to, root)) { - return Optional.none(); - } else { - return Optional.some(DeleteAction.moveToPosition(to)); - } - }); - }; - var getContentEditableAction = function (root, forward, from) { - if (isAtContentEditableBlockCaret(forward, from)) { - return getContentEditableBlockAction(forward, from.getNode(forward === false)).fold(function () { - return findCefPosition(root, forward, from); - }, Optional.some); - } else { - return findCefPosition(root, forward, from).bind(function (deleteAction) { - return skipMoveToActionFromInlineCefToContent(root, from, deleteAction); - }); - } - }; - var read$4 = function (root, forward, rng) { - var normalizedRange = normalizeRange(forward ? 1 : -1, root, rng); - var from = CaretPosition$1.fromRangeStart(normalizedRange); - var rootElement = SugarElement.fromDom(root); - if (forward === false && isAfterContentEditableFalse(from)) { - return Optional.some(DeleteAction.remove(from.getNode(true))); - } else if (forward && isBeforeContentEditableFalse(from)) { - return Optional.some(DeleteAction.remove(from.getNode())); - } else if (forward === false && isBeforeContentEditableFalse(from) && isAfterBr(rootElement, from)) { - return findPreviousBr(rootElement, from).map(function (br) { - return DeleteAction.remove(br.getNode()); - }); - } else if (forward && isAfterContentEditableFalse(from) && isBeforeBr(rootElement, from)) { - return findNextBr(rootElement, from).map(function (br) { - return DeleteAction.remove(br.getNode()); - }); - } else { - return getContentEditableAction(root, forward, from); - } - }; - - var deleteElement$1 = function (editor, forward) { - return function (element) { - editor._selectionOverrides.hideFakeCaret(); - deleteElement(editor, forward, SugarElement.fromDom(element)); - return true; - }; - }; - var moveToElement = function (editor, forward) { - return function (element) { - var pos = forward ? CaretPosition$1.before(element) : CaretPosition$1.after(element); - editor.selection.setRng(pos.toRange()); - return true; - }; - }; - var moveToPosition = function (editor) { - return function (pos) { - editor.selection.setRng(pos.toRange()); - return true; - }; - }; - var getAncestorCe = function (editor, node) { - return Optional.from(getContentEditableRoot(editor.getBody(), node)); - }; - var backspaceDeleteCaret = function (editor, forward) { - var selectedNode = editor.selection.getNode(); - return getAncestorCe(editor, selectedNode).filter(isContentEditableFalse).fold(function () { - return read$4(editor.getBody(), forward, editor.selection.getRng()).exists(function (deleteAction) { - return deleteAction.fold(deleteElement$1(editor, forward), moveToElement(editor, forward), moveToPosition(editor)); - }); - }, always); - }; - var deleteOffscreenSelection = function (rootElement) { - each(descendants$1(rootElement, '.mce-offscreen-selection'), remove); - }; - var backspaceDeleteRange = function (editor, forward) { - var selectedNode = editor.selection.getNode(); - if (isContentEditableFalse(selectedNode)) { - var hasCefAncestor = getAncestorCe(editor, selectedNode.parentNode).filter(isContentEditableFalse); - return hasCefAncestor.fold(function () { - deleteOffscreenSelection(SugarElement.fromDom(editor.getBody())); - deleteElement(editor, forward, SugarElement.fromDom(editor.selection.getNode())); - paddEmptyBody(editor); - return true; - }, function () { - return true; - }); - } - return false; - }; - var paddEmptyElement = function (editor) { - var dom = editor.dom, selection = editor.selection; - var ceRoot = getContentEditableRoot(editor.getBody(), selection.getNode()); - if (isContentEditableTrue(ceRoot) && dom.isBlock(ceRoot) && dom.isEmpty(ceRoot)) { - var br = dom.create('br', { 'data-mce-bogus': '1' }); - dom.setHTML(ceRoot, ''); - ceRoot.appendChild(br); - selection.setRng(CaretPosition$1.before(br).toRange()); - } - return true; - }; - var backspaceDelete$4 = function (editor, forward) { - if (editor.selection.isCollapsed()) { - return backspaceDeleteCaret(editor, forward); - } else { - return backspaceDeleteRange(editor, forward); - } - }; - - var deleteCaret$1 = function (editor, forward) { - var fromPos = CaretPosition$1.fromRangeStart(editor.selection.getRng()); - return fromPosition(forward, editor.getBody(), fromPos).filter(function (pos) { - return forward ? isBeforeImageBlock(pos) : isAfterImageBlock(pos); - }).bind(function (pos) { - return Optional.from(getChildNodeAtRelativeOffset(forward ? 0 : -1, pos)); - }).exists(function (elm) { - editor.selection.select(elm); - return true; - }); - }; - var backspaceDelete$5 = function (editor, forward) { - return editor.selection.isCollapsed() ? deleteCaret$1(editor, forward) : false; - }; - - var isText$8 = isText$1; - var startsWithCaretContainer$1 = function (node) { - return isText$8(node) && node.data[0] === ZWSP; - }; - var endsWithCaretContainer$1 = function (node) { - return isText$8(node) && node.data[node.data.length - 1] === ZWSP; - }; - var createZwsp = function (node) { - return node.ownerDocument.createTextNode(ZWSP); - }; - var insertBefore$1 = function (node) { - if (isText$8(node.previousSibling)) { - if (endsWithCaretContainer$1(node.previousSibling)) { - return node.previousSibling; - } else { - node.previousSibling.appendData(ZWSP); - return node.previousSibling; - } - } else if (isText$8(node)) { - if (startsWithCaretContainer$1(node)) { - return node; - } else { - node.insertData(0, ZWSP); - return node; - } - } else { - var newNode = createZwsp(node); - node.parentNode.insertBefore(newNode, node); - return newNode; - } - }; - var insertAfter$1 = function (node) { - if (isText$8(node.nextSibling)) { - if (startsWithCaretContainer$1(node.nextSibling)) { - return node.nextSibling; - } else { - node.nextSibling.insertData(0, ZWSP); - return node.nextSibling; - } - } else if (isText$8(node)) { - if (endsWithCaretContainer$1(node)) { - return node; - } else { - node.appendData(ZWSP); - return node; - } - } else { - var newNode = createZwsp(node); - if (node.nextSibling) { - node.parentNode.insertBefore(newNode, node.nextSibling); - } else { - node.parentNode.appendChild(newNode); - } - return newNode; - } - }; - var insertInline$1 = function (before, node) { - return before ? insertBefore$1(node) : insertAfter$1(node); - }; - var insertInlineBefore = curry(insertInline$1, true); - var insertInlineAfter = curry(insertInline$1, false); - - var insertInlinePos = function (pos, before) { - if (isText$1(pos.container())) { - return insertInline$1(before, pos.container()); - } else { - return insertInline$1(before, pos.getNode()); - } - }; - var isPosCaretContainer = function (pos, caret) { - var caretNode = caret.get(); - return caretNode && pos.container() === caretNode && isCaretContainerInline(caretNode); - }; - var renderCaret = function (caret, location) { - return location.fold(function (element) { - remove$5(caret.get()); - var text = insertInlineBefore(element); - caret.set(text); - return Optional.some(CaretPosition$1(text, text.length - 1)); - }, function (element) { - return firstPositionIn(element).map(function (pos) { - if (!isPosCaretContainer(pos, caret)) { - remove$5(caret.get()); - var text = insertInlinePos(pos, true); - caret.set(text); - return CaretPosition$1(text, 1); - } else { - return CaretPosition$1(caret.get(), 1); - } - }); - }, function (element) { - return lastPositionIn(element).map(function (pos) { - if (!isPosCaretContainer(pos, caret)) { - remove$5(caret.get()); - var text = insertInlinePos(pos, false); - caret.set(text); - return CaretPosition$1(text, text.length - 1); - } else { - return CaretPosition$1(caret.get(), caret.get().length - 1); - } - }); - }, function (element) { - remove$5(caret.get()); - var text = insertInlineAfter(element); - caret.set(text); - return Optional.some(CaretPosition$1(text, 1)); - }); - }; - - var evaluateUntil = function (fns, args) { - for (var i = 0; i < fns.length; i++) { - var result = fns[i].apply(null, args); - if (result.isSome()) { - return result; - } - } - return Optional.none(); - }; - - var Location = Adt.generate([ - { before: ['element'] }, - { start: ['element'] }, - { end: ['element'] }, - { after: ['element'] } - ]); - var rescope = function (rootNode, node) { - var parentBlock = getParentBlock(node, rootNode); - return parentBlock ? parentBlock : rootNode; - }; - var before$4 = function (isInlineTarget, rootNode, pos) { - var nPos = normalizeForwards(pos); - var scope = rescope(rootNode, nPos.container()); - return findRootInline(isInlineTarget, scope, nPos).fold(function () { - return nextPosition(scope, nPos).bind(curry(findRootInline, isInlineTarget, scope)).map(function (inline) { - return Location.before(inline); - }); - }, Optional.none); - }; - var isNotInsideFormatCaretContainer = function (rootNode, elm) { - return getParentCaretContainer(rootNode, elm) === null; - }; - var findInsideRootInline = function (isInlineTarget, rootNode, pos) { - return findRootInline(isInlineTarget, rootNode, pos).filter(curry(isNotInsideFormatCaretContainer, rootNode)); - }; - var start = function (isInlineTarget, rootNode, pos) { - var nPos = normalizeBackwards(pos); - return findInsideRootInline(isInlineTarget, rootNode, nPos).bind(function (inline) { - var prevPos = prevPosition(inline, nPos); - return prevPos.isNone() ? Optional.some(Location.start(inline)) : Optional.none(); - }); - }; - var end = function (isInlineTarget, rootNode, pos) { - var nPos = normalizeForwards(pos); - return findInsideRootInline(isInlineTarget, rootNode, nPos).bind(function (inline) { - var nextPos = nextPosition(inline, nPos); - return nextPos.isNone() ? Optional.some(Location.end(inline)) : Optional.none(); - }); - }; - var after$3 = function (isInlineTarget, rootNode, pos) { - var nPos = normalizeBackwards(pos); - var scope = rescope(rootNode, nPos.container()); - return findRootInline(isInlineTarget, scope, nPos).fold(function () { - return prevPosition(scope, nPos).bind(curry(findRootInline, isInlineTarget, scope)).map(function (inline) { - return Location.after(inline); - }); - }, Optional.none); - }; - var isValidLocation = function (location) { - return isRtl$1(getElement(location)) === false; - }; - var readLocation = function (isInlineTarget, rootNode, pos) { - var location = evaluateUntil([ - before$4, - start, - end, - after$3 - ], [ - isInlineTarget, - rootNode, - pos - ]); - return location.filter(isValidLocation); - }; - var getElement = function (location) { - return location.fold(identity, identity, identity, identity); - }; - var getName = function (location) { - return location.fold(constant('before'), constant('start'), constant('end'), constant('after')); - }; - var outside = function (location) { - return location.fold(Location.before, Location.before, Location.after, Location.after); - }; - var inside = function (location) { - return location.fold(Location.start, Location.start, Location.end, Location.end); - }; - var isEq$5 = function (location1, location2) { - return getName(location1) === getName(location2) && getElement(location1) === getElement(location2); - }; - var betweenInlines = function (forward, isInlineTarget, rootNode, from, to, location) { - return lift2(findRootInline(isInlineTarget, rootNode, from), findRootInline(isInlineTarget, rootNode, to), function (fromInline, toInline) { - if (fromInline !== toInline && hasSameParentBlock(rootNode, fromInline, toInline)) { - return Location.after(forward ? fromInline : toInline); - } else { - return location; - } - }).getOr(location); - }; - var skipNoMovement = function (fromLocation, toLocation) { - return fromLocation.fold(always, function (fromLocation) { - return !isEq$5(fromLocation, toLocation); - }); - }; - var findLocationTraverse = function (forward, isInlineTarget, rootNode, fromLocation, pos) { - var from = normalizePosition(forward, pos); - var to = fromPosition(forward, rootNode, from).map(curry(normalizePosition, forward)); - var location = to.fold(function () { - return fromLocation.map(outside); - }, function (to) { - return readLocation(isInlineTarget, rootNode, to).map(curry(betweenInlines, forward, isInlineTarget, rootNode, from, to)).filter(curry(skipNoMovement, fromLocation)); - }); - return location.filter(isValidLocation); - }; - var findLocationSimple = function (forward, location) { - if (forward) { - return location.fold(compose(Optional.some, Location.start), Optional.none, compose(Optional.some, Location.after), Optional.none); - } else { - return location.fold(Optional.none, compose(Optional.some, Location.before), Optional.none, compose(Optional.some, Location.end)); - } - }; - var findLocation = function (forward, isInlineTarget, rootNode, pos) { - var from = normalizePosition(forward, pos); - var fromLocation = readLocation(isInlineTarget, rootNode, from); - return readLocation(isInlineTarget, rootNode, from).bind(curry(findLocationSimple, forward)).orThunk(function () { - return findLocationTraverse(forward, isInlineTarget, rootNode, fromLocation, pos); - }); - }; - var prevLocation = curry(findLocation, false); - var nextLocation = curry(findLocation, true); - - var hasSelectionModifyApi = function (editor) { - return isFunction(editor.selection.getSel().modify); - }; - var moveRel = function (forward, selection, pos) { - var delta = forward ? 1 : -1; - selection.setRng(CaretPosition$1(pos.container(), pos.offset() + delta).toRange()); - selection.getSel().modify('move', forward ? 'forward' : 'backward', 'word'); - return true; - }; - var moveByWord = function (forward, editor) { - var rng = editor.selection.getRng(); - var pos = forward ? CaretPosition$1.fromRangeEnd(rng) : CaretPosition$1.fromRangeStart(rng); - if (!hasSelectionModifyApi(editor)) { - return false; - } else if (forward && isBeforeInline(pos)) { - return moveRel(true, editor.selection, pos); - } else if (!forward && isAfterInline(pos)) { - return moveRel(false, editor.selection, pos); - } else { - return false; - } - }; - - var setCaretPosition = function (editor, pos) { - var rng = editor.dom.createRng(); - rng.setStart(pos.container(), pos.offset()); - rng.setEnd(pos.container(), pos.offset()); - editor.selection.setRng(rng); - }; - var setSelected = function (state, elm) { - if (state) { - elm.setAttribute('data-mce-selected', 'inline-boundary'); - } else { - elm.removeAttribute('data-mce-selected'); - } - }; - var renderCaretLocation = function (editor, caret, location) { - return renderCaret(caret, location).map(function (pos) { - setCaretPosition(editor, pos); - return location; - }); - }; - var findLocation$1 = function (editor, caret, forward) { - var rootNode = editor.getBody(); - var from = CaretPosition$1.fromRangeStart(editor.selection.getRng()); - var isInlineTarget$1 = curry(isInlineTarget, editor); - var location = findLocation(forward, isInlineTarget$1, rootNode, from); - return location.bind(function (location) { - return renderCaretLocation(editor, caret, location); - }); - }; - var toggleInlines = function (isInlineTarget, dom, elms) { - var inlineBoundaries = map(descendants$1(SugarElement.fromDom(dom.getRoot()), '*[data-mce-selected="inline-boundary"]'), function (e) { - return e.dom; - }); - var selectedInlines = filter(inlineBoundaries, isInlineTarget); - var targetInlines = filter(elms, isInlineTarget); - each(difference(selectedInlines, targetInlines), curry(setSelected, false)); - each(difference(targetInlines, selectedInlines), curry(setSelected, true)); - }; - var safeRemoveCaretContainer = function (editor, caret) { - if (editor.selection.isCollapsed() && editor.composing !== true && caret.get()) { - var pos = CaretPosition$1.fromRangeStart(editor.selection.getRng()); - if (CaretPosition$1.isTextPosition(pos) && isAtZwsp(pos) === false) { - setCaretPosition(editor, removeAndReposition(caret.get(), pos)); - caret.set(null); - } - } - }; - var renderInsideInlineCaret = function (isInlineTarget, editor, caret, elms) { - if (editor.selection.isCollapsed()) { - var inlines = filter(elms, isInlineTarget); - each(inlines, function (_inline) { - var pos = CaretPosition$1.fromRangeStart(editor.selection.getRng()); - readLocation(isInlineTarget, editor.getBody(), pos).bind(function (location) { - return renderCaretLocation(editor, caret, location); - }); - }); - } - }; - var move = function (editor, caret, forward) { - return isInlineBoundariesEnabled(editor) ? findLocation$1(editor, caret, forward).isSome() : false; - }; - var moveWord = function (forward, editor, _caret) { - return isInlineBoundariesEnabled(editor) ? moveByWord(forward, editor) : false; - }; - var setupSelectedState = function (editor) { - var caret = Cell(null); - var isInlineTarget$1 = curry(isInlineTarget, editor); - editor.on('NodeChange', function (e) { - if (isInlineBoundariesEnabled(editor) && !(Env.browser.isIE() && e.initial)) { - toggleInlines(isInlineTarget$1, editor.dom, e.parents); - safeRemoveCaretContainer(editor, caret); - renderInsideInlineCaret(isInlineTarget$1, editor, caret, e.parents); - } - }); - return caret; - }; - var moveNextWord = curry(moveWord, true); - var movePrevWord = curry(moveWord, false); - - var rangeFromPositions = function (from, to) { - var range = document.createRange(); - range.setStart(from.container(), from.offset()); - range.setEnd(to.container(), to.offset()); - return range; - }; - var hasOnlyTwoOrLessPositionsLeft = function (elm) { - return lift2(firstPositionIn(elm), lastPositionIn(elm), function (firstPos, lastPos) { - var normalizedFirstPos = normalizePosition(true, firstPos); - var normalizedLastPos = normalizePosition(false, lastPos); - return nextPosition(elm, normalizedFirstPos).forall(function (pos) { - return pos.isEqual(normalizedLastPos); - }); - }).getOr(true); - }; - var setCaretLocation = function (editor, caret) { - return function (location) { - return renderCaret(caret, location).exists(function (pos) { - setCaretPosition(editor, pos); - return true; - }); - }; - }; - var deleteFromTo = function (editor, caret, from, to) { - var rootNode = editor.getBody(); - var isInlineTarget$1 = curry(isInlineTarget, editor); - editor.undoManager.ignore(function () { - editor.selection.setRng(rangeFromPositions(from, to)); - editor.execCommand('Delete'); - readLocation(isInlineTarget$1, rootNode, CaretPosition$1.fromRangeStart(editor.selection.getRng())).map(inside).map(setCaretLocation(editor, caret)); - }); - editor.nodeChanged(); - }; - var rescope$1 = function (rootNode, node) { - var parentBlock = getParentBlock(node, rootNode); - return parentBlock ? parentBlock : rootNode; - }; - var backspaceDeleteCollapsed = function (editor, caret, forward, from) { - var rootNode = rescope$1(editor.getBody(), from.container()); - var isInlineTarget$1 = curry(isInlineTarget, editor); - var fromLocation = readLocation(isInlineTarget$1, rootNode, from); - return fromLocation.bind(function (location) { - if (forward) { - return location.fold(constant(Optional.some(inside(location))), Optional.none, constant(Optional.some(outside(location))), Optional.none); - } else { - return location.fold(Optional.none, constant(Optional.some(outside(location))), Optional.none, constant(Optional.some(inside(location)))); - } - }).map(setCaretLocation(editor, caret)).getOrThunk(function () { - var toPosition = navigate(forward, rootNode, from); - var toLocation = toPosition.bind(function (pos) { - return readLocation(isInlineTarget$1, rootNode, pos); - }); - return lift2(fromLocation, toLocation, function () { - return findRootInline(isInlineTarget$1, rootNode, from).exists(function (elm) { - if (hasOnlyTwoOrLessPositionsLeft(elm)) { - deleteElement(editor, forward, SugarElement.fromDom(elm)); - return true; - } else { - return false; - } - }); - }).orThunk(function () { - return toLocation.bind(function (_) { - return toPosition.map(function (to) { - if (forward) { - deleteFromTo(editor, caret, from, to); - } else { - deleteFromTo(editor, caret, to, from); - } - return true; - }); - }); - }).getOr(false); - }); - }; - var backspaceDelete$6 = function (editor, caret, forward) { - if (editor.selection.isCollapsed() && isInlineBoundariesEnabled(editor)) { - var from = CaretPosition$1.fromRangeStart(editor.selection.getRng()); - return backspaceDeleteCollapsed(editor, caret, forward, from); - } - return false; - }; - - var getParentInlines = function (rootElm, startElm) { - var parents = parentsAndSelf(startElm, rootElm); - return findIndex(parents, isBlock).fold(constant(parents), function (index) { - return parents.slice(0, index); - }); - }; - var hasOnlyOneChild$1 = function (elm) { - return children(elm).length === 1; - }; - var deleteLastPosition = function (forward, editor, target, parentInlines) { - var isFormatElement$1 = curry(isFormatElement, editor); - var formatNodes = map(filter(parentInlines, isFormatElement$1), function (elm) { - return elm.dom; - }); - if (formatNodes.length === 0) { - deleteElement(editor, forward, target); - } else { - var pos = replaceWithCaretFormat(target.dom, formatNodes); - editor.selection.setRng(pos.toRange()); - } - }; - var deleteCaret$2 = function (editor, forward) { - var rootElm = SugarElement.fromDom(editor.getBody()); - var startElm = SugarElement.fromDom(editor.selection.getStart()); - var parentInlines = filter(getParentInlines(rootElm, startElm), hasOnlyOneChild$1); - return last(parentInlines).exists(function (target) { - var fromPos = CaretPosition$1.fromRangeStart(editor.selection.getRng()); - if (willDeleteLastPositionInElement(forward, fromPos, target.dom) && !isEmptyCaretFormatElement(target)) { - deleteLastPosition(forward, editor, target, parentInlines); - return true; - } else { - return false; - } - }); - }; - var backspaceDelete$7 = function (editor, forward) { - return editor.selection.isCollapsed() ? deleteCaret$2(editor, forward) : false; - }; - - var deleteElement$2 = function (editor, forward, element) { - editor._selectionOverrides.hideFakeCaret(); - deleteElement(editor, forward, SugarElement.fromDom(element)); - return true; - }; - var deleteCaret$3 = function (editor, forward) { - var isNearMedia = forward ? isBeforeMedia : isAfterMedia; - var direction = forward ? HDirection.Forwards : HDirection.Backwards; - var fromPos = getNormalizedRangeEndPoint(direction, editor.getBody(), editor.selection.getRng()); - if (isNearMedia(fromPos)) { - return deleteElement$2(editor, forward, fromPos.getNode(!forward)); - } else { - return Optional.from(normalizePosition(forward, fromPos)).filter(function (pos) { - return isNearMedia(pos) && isMoveInsideSameBlock(fromPos, pos); - }).exists(function (pos) { - return deleteElement$2(editor, forward, pos.getNode(!forward)); - }); - } - }; - var deleteRange$2 = function (editor, forward) { - var selectedNode = editor.selection.getNode(); - return isMedia(selectedNode) ? deleteElement$2(editor, forward, selectedNode) : false; - }; - var backspaceDelete$8 = function (editor, forward) { - return editor.selection.isCollapsed() ? deleteCaret$3(editor, forward) : deleteRange$2(editor, forward); - }; - - var isEditable$1 = function (target) { - return closest(target, function (elm) { - return isContentEditableTrue(elm.dom) || isContentEditableFalse(elm.dom); - }).exists(function (elm) { - return isContentEditableTrue(elm.dom); - }); - }; - var parseIndentValue = function (value) { - var number = parseInt(value, 10); - return isNaN(number) ? 0 : number; - }; - var getIndentStyleName = function (useMargin, element) { - var indentStyleName = useMargin || isTable$1(element) ? 'margin' : 'padding'; - var suffix = get$5(element, 'direction') === 'rtl' ? '-right' : '-left'; - return indentStyleName + suffix; - }; - var indentElement = function (dom, command, useMargin, value, unit, element) { - var indentStyleName = getIndentStyleName(useMargin, SugarElement.fromDom(element)); - if (command === 'outdent') { - var styleValue = Math.max(0, parseIndentValue(element.style[indentStyleName]) - value); - dom.setStyle(element, indentStyleName, styleValue ? styleValue + unit : ''); - } else { - var styleValue = parseIndentValue(element.style[indentStyleName]) + value + unit; - dom.setStyle(element, indentStyleName, styleValue); - } - }; - var validateBlocks = function (editor, blocks) { - return forall(blocks, function (block) { - var indentStyleName = getIndentStyleName(shouldIndentUseMargin(editor), block); - var intentValue = getRaw(block, indentStyleName).map(parseIndentValue).getOr(0); - var contentEditable = editor.dom.getContentEditable(block.dom); - return contentEditable !== 'false' && intentValue > 0; - }); - }; - var canOutdent = function (editor) { - var blocks = getBlocksToIndent(editor); - return !editor.mode.isReadOnly() && (blocks.length > 1 || validateBlocks(editor, blocks)); - }; - var isListComponent = function (el) { - return isList(el) || isListItem(el); - }; - var parentIsListComponent = function (el) { - return parent(el).map(isListComponent).getOr(false); - }; - var getBlocksToIndent = function (editor) { - return filter(map(editor.selection.getSelectedBlocks(), SugarElement.fromDom), function (el) { - return !isListComponent(el) && !parentIsListComponent(el) && isEditable$1(el); - }); - }; - var handle = function (editor, command) { - var dom = editor.dom, selection = editor.selection, formatter = editor.formatter; - var indentation = getIndentation(editor); - var indentUnit = /[a-z%]+$/i.exec(indentation)[0]; - var indentValue = parseInt(indentation, 10); - var useMargin = shouldIndentUseMargin(editor); - var forcedRootBlock = getForcedRootBlock(editor); - if (!editor.queryCommandState('InsertUnorderedList') && !editor.queryCommandState('InsertOrderedList')) { - if (forcedRootBlock === '' && !dom.getParent(selection.getNode(), dom.isBlock)) { - formatter.apply('div'); - } - } - each(getBlocksToIndent(editor), function (block) { - indentElement(dom, command, useMargin, indentValue, indentUnit, block.dom); - }); - }; - - var backspaceDelete$9 = function (editor, _forward) { - if (editor.selection.isCollapsed() && canOutdent(editor)) { - var dom = editor.dom; - var rng = editor.selection.getRng(); - var pos = CaretPosition$1.fromRangeStart(rng); - var block = dom.getParent(rng.startContainer, dom.isBlock); - if (block !== null && isAtStartOfBlock(SugarElement.fromDom(block), pos)) { - handle(editor, 'outdent'); - return true; - } - } - return false; - }; - - var nativeCommand = function (editor, command) { - editor.getDoc().execCommand(command, false, null); - }; - var deleteCommand = function (editor, caret) { - if (backspaceDelete$9(editor)) { - return; - } else if (backspaceDelete$4(editor, false)) { - return; - } else if (backspaceDelete$3(editor, false)) { - return; - } else if (backspaceDelete$6(editor, caret, false)) { - return; - } else if (backspaceDelete$1(editor, false)) { - return; - } else if (backspaceDelete(editor)) { - return; - } else if (backspaceDelete$5(editor, false)) { - return; - } else if (backspaceDelete$8(editor, false)) { - return; - } else if (backspaceDelete$2(editor)) { - return; - } else if (backspaceDelete$7(editor, false)) { - return; - } else { - nativeCommand(editor, 'Delete'); - paddEmptyBody(editor); - } - }; - var forwardDeleteCommand = function (editor, caret) { - if (backspaceDelete$4(editor, true)) { - return; - } else if (backspaceDelete$3(editor, true)) { - return; - } else if (backspaceDelete$6(editor, caret, true)) { - return; - } else if (backspaceDelete$1(editor, true)) { - return; - } else if (backspaceDelete(editor)) { - return; - } else if (backspaceDelete$5(editor, true)) { - return; - } else if (backspaceDelete$8(editor, true)) { - return; - } else if (backspaceDelete$2(editor)) { - return; - } else if (backspaceDelete$7(editor, true)) { - return; - } else { - nativeCommand(editor, 'ForwardDelete'); - } - }; - var setup$8 = function (editor, caret) { - editor.addCommand('delete', function () { - deleteCommand(editor, caret); - }); - editor.addCommand('forwardDelete', function () { - forwardDeleteCommand(editor, caret); - }); - }; - - var SIGNIFICANT_MOVE = 5; - var LONGPRESS_DELAY = 400; - var getTouch = function (event) { - if (event.touches === undefined || event.touches.length !== 1) { - return Optional.none(); - } - return Optional.some(event.touches[0]); - }; - var isFarEnough = function (touch, data) { - var distX = Math.abs(touch.clientX - data.x); - var distY = Math.abs(touch.clientY - data.y); - return distX > SIGNIFICANT_MOVE || distY > SIGNIFICANT_MOVE; - }; - var setup$9 = function (editor) { - var startData = Cell(Optional.none()); - var longpressFired = Cell(false); - var debounceLongpress = last$2(function (e) { - editor.fire('longpress', __assign(__assign({}, e), { type: 'longpress' })); - longpressFired.set(true); - }, LONGPRESS_DELAY); - editor.on('touchstart', function (e) { - getTouch(e).each(function (touch) { - debounceLongpress.cancel(); - var data = { - x: touch.clientX, - y: touch.clientY, - target: e.target - }; - debounceLongpress.throttle(e); - longpressFired.set(false); - startData.set(Optional.some(data)); - }); - }, true); - editor.on('touchmove', function (e) { - debounceLongpress.cancel(); - getTouch(e).each(function (touch) { - startData.get().each(function (data) { - if (isFarEnough(touch, data)) { - startData.set(Optional.none()); - longpressFired.set(false); - editor.fire('longpresscancel'); - } - }); - }); - }, true); - editor.on('touchend touchcancel', function (e) { - debounceLongpress.cancel(); - if (e.type === 'touchcancel') { - return; - } - startData.get().filter(function (data) { - return data.target.isEqualNode(e.target); - }).each(function () { - if (longpressFired.get()) { - e.preventDefault(); - } else { - editor.fire('tap', __assign(__assign({}, e), { type: 'tap' })); - } - }); - }, true); - }; - - var isBlockElement = function (blockElements, node) { - return blockElements.hasOwnProperty(node.nodeName); - }; - var isValidTarget = function (blockElements, node) { - if (isText$1(node)) { - return true; - } else if (isElement$1(node)) { - return !isBlockElement(blockElements, node) && !isBookmarkNode$1(node); - } else { - return false; - } - }; - var hasBlockParent = function (blockElements, root, node) { - return exists(parents$1(SugarElement.fromDom(node), SugarElement.fromDom(root)), function (elm) { - return isBlockElement(blockElements, elm.dom); - }); - }; - var shouldRemoveTextNode = function (blockElements, node) { - if (isText$1(node)) { - if (node.nodeValue.length === 0) { - return true; - } else if (/^\s+$/.test(node.nodeValue) && (!node.nextSibling || isBlockElement(blockElements, node.nextSibling))) { - return true; - } - } - return false; - }; - var addRootBlocks = function (editor) { - var dom = editor.dom, selection = editor.selection; - var schema = editor.schema, blockElements = schema.getBlockElements(); - var node = selection.getStart(); - var rootNode = editor.getBody(); - var rootBlockNode, tempNode, wrapped; - var forcedRootBlock = getForcedRootBlock(editor); - if (!node || !isElement$1(node) || !forcedRootBlock) { - return; - } - var rootNodeName = rootNode.nodeName.toLowerCase(); - if (!schema.isValidChild(rootNodeName, forcedRootBlock.toLowerCase()) || hasBlockParent(blockElements, rootNode, node)) { - return; - } - var rng = selection.getRng(); - var startContainer = rng.startContainer; - var startOffset = rng.startOffset; - var endContainer = rng.endContainer; - var endOffset = rng.endOffset; - var restoreSelection = hasFocus$1(editor); - node = rootNode.firstChild; - while (node) { - if (isValidTarget(blockElements, node)) { - if (shouldRemoveTextNode(blockElements, node)) { - tempNode = node; - node = node.nextSibling; - dom.remove(tempNode); - continue; - } - if (!rootBlockNode) { - rootBlockNode = dom.create(forcedRootBlock, getForcedRootBlockAttrs(editor)); - node.parentNode.insertBefore(rootBlockNode, node); - wrapped = true; - } - tempNode = node; - node = node.nextSibling; - rootBlockNode.appendChild(tempNode); - } else { - rootBlockNode = null; - node = node.nextSibling; - } - } - if (wrapped && restoreSelection) { - rng.setStart(startContainer, startOffset); - rng.setEnd(endContainer, endOffset); - selection.setRng(rng); - editor.nodeChanged(); - } - }; - var setup$a = function (editor) { - if (getForcedRootBlock(editor)) { - editor.on('NodeChange', curry(addRootBlocks, editor)); - } - }; - - var findBlockCaretContainer = function (editor) { - return descendant(SugarElement.fromDom(editor.getBody()), '*[data-mce-caret]').fold(constant(null), function (elm) { - return elm.dom; - }); - }; - var removeIeControlRect = function (editor) { - editor.selection.setRng(editor.selection.getRng()); - }; - var showBlockCaretContainer = function (editor, blockCaretContainer) { - if (blockCaretContainer.hasAttribute('data-mce-caret')) { - showCaretContainerBlock(blockCaretContainer); - removeIeControlRect(editor); - editor.selection.scrollIntoView(blockCaretContainer); - } - }; - var handleBlockContainer = function (editor, e) { - var blockCaretContainer = findBlockCaretContainer(editor); - if (!blockCaretContainer) { - return; - } - if (e.type === 'compositionstart') { - e.preventDefault(); - e.stopPropagation(); - showBlockCaretContainer(editor, blockCaretContainer); - return; - } - if (hasContent(blockCaretContainer)) { - showBlockCaretContainer(editor, blockCaretContainer); - editor.undoManager.add(); - } - }; - var setup$b = function (editor) { - editor.on('keyup compositionstart', curry(handleBlockContainer, editor)); - }; - - var BreakType; - (function (BreakType) { - BreakType[BreakType['Br'] = 0] = 'Br'; - BreakType[BreakType['Block'] = 1] = 'Block'; - BreakType[BreakType['Wrap'] = 2] = 'Wrap'; - BreakType[BreakType['Eol'] = 3] = 'Eol'; - }(BreakType || (BreakType = {}))); - var flip = function (direction, positions) { - return direction === HDirection.Backwards ? reverse(positions) : positions; - }; - var walk$3 = function (direction, caretWalker, pos) { - return direction === HDirection.Forwards ? caretWalker.next(pos) : caretWalker.prev(pos); - }; - var getBreakType = function (scope, direction, currentPos, nextPos) { - if (isBr(nextPos.getNode(direction === HDirection.Forwards))) { - return BreakType.Br; - } else if (isInSameBlock(currentPos, nextPos) === false) { - return BreakType.Block; - } else { - return BreakType.Wrap; - } - }; - var getPositionsUntil = function (predicate, direction, scope, start) { - var caretWalker = CaretWalker(scope); - var currentPos = start, nextPos; - var positions = []; - while (currentPos) { - nextPos = walk$3(direction, caretWalker, currentPos); - if (!nextPos) { - break; - } - if (isBr(nextPos.getNode(false))) { - if (direction === HDirection.Forwards) { - return { - positions: flip(direction, positions).concat([nextPos]), - breakType: BreakType.Br, - breakAt: Optional.some(nextPos) - }; - } else { - return { - positions: flip(direction, positions), - breakType: BreakType.Br, - breakAt: Optional.some(nextPos) - }; - } - } - if (!nextPos.isVisible()) { - currentPos = nextPos; - continue; - } - if (predicate(currentPos, nextPos)) { - var breakType = getBreakType(scope, direction, currentPos, nextPos); - return { - positions: flip(direction, positions), - breakType: breakType, - breakAt: Optional.some(nextPos) - }; - } - positions.push(nextPos); - currentPos = nextPos; - } - return { - positions: flip(direction, positions), - breakType: BreakType.Eol, - breakAt: Optional.none() - }; - }; - var getAdjacentLinePositions = function (direction, getPositionsUntilBreak, scope, start) { - return getPositionsUntilBreak(scope, start).breakAt.map(function (pos) { - var positions = getPositionsUntilBreak(scope, pos).positions; - return direction === HDirection.Backwards ? positions.concat(pos) : [pos].concat(positions); - }).getOr([]); - }; - var findClosestHorizontalPositionFromPoint = function (positions, x) { - return foldl(positions, function (acc, newPos) { - return acc.fold(function () { - return Optional.some(newPos); - }, function (lastPos) { - return lift2(head(lastPos.getClientRects()), head(newPos.getClientRects()), function (lastRect, newRect) { - var lastDist = Math.abs(x - lastRect.left); - var newDist = Math.abs(x - newRect.left); - return newDist <= lastDist ? newPos : lastPos; - }).or(acc); - }); - }, Optional.none()); - }; - var findClosestHorizontalPosition = function (positions, pos) { - return head(pos.getClientRects()).bind(function (targetRect) { - return findClosestHorizontalPositionFromPoint(positions, targetRect.left); - }); - }; - var getPositionsUntilPreviousLine = curry(getPositionsUntil, CaretPosition.isAbove, -1); - var getPositionsUntilNextLine = curry(getPositionsUntil, CaretPosition.isBelow, 1); - var isAtFirstLine = function (scope, pos) { - return getPositionsUntilPreviousLine(scope, pos).breakAt.isNone(); - }; - var isAtLastLine = function (scope, pos) { - return getPositionsUntilNextLine(scope, pos).breakAt.isNone(); - }; - var getPositionsAbove = curry(getAdjacentLinePositions, -1, getPositionsUntilPreviousLine); - var getPositionsBelow = curry(getAdjacentLinePositions, 1, getPositionsUntilNextLine); - var getFirstLinePositions = function (scope) { - return firstPositionIn(scope).map(function (pos) { - return [pos].concat(getPositionsUntilNextLine(scope, pos).positions); - }).getOr([]); - }; - var getLastLinePositions = function (scope) { - return lastPositionIn(scope).map(function (pos) { - return getPositionsUntilPreviousLine(scope, pos).positions.concat(pos); - }).getOr([]); - }; - - var getNodeClientRects = function (node) { - var toArrayWithNode = function (clientRects) { - return map(clientRects, function (clientRect) { - clientRect = clone$2(clientRect); - clientRect.node = node; - return clientRect; - }); - }; - if (isElement$1(node)) { - return toArrayWithNode(node.getClientRects()); - } - if (isText$1(node)) { - var rng = node.ownerDocument.createRange(); - rng.setStart(node, 0); - rng.setEnd(node, node.data.length); - return toArrayWithNode(rng.getClientRects()); - } - }; - var getClientRects = function (nodes) { - return bind(nodes, getNodeClientRects); - }; - - var VDirection; - (function (VDirection) { - VDirection[VDirection['Up'] = -1] = 'Up'; - VDirection[VDirection['Down'] = 1] = 'Down'; - }(VDirection || (VDirection = {}))); - var findUntil$1 = function (direction, root, predicateFn, node) { - while (node = findNode(node, direction, isEditableCaretCandidate, root)) { - if (predicateFn(node)) { - return; - } - } - }; - var walkUntil = function (direction, isAboveFn, isBeflowFn, root, predicateFn, caretPosition) { - var line = 0; - var result = []; - var add = function (node) { - var i, clientRect, clientRects; - clientRects = getClientRects([node]); - if (direction === -1) { - clientRects = clientRects.reverse(); - } - for (i = 0; i < clientRects.length; i++) { - clientRect = clientRects[i]; - if (isBeflowFn(clientRect, targetClientRect)) { - continue; - } - if (result.length > 0 && isAboveFn(clientRect, last$1(result))) { - line++; - } - clientRect.line = line; - if (predicateFn(clientRect)) { - return true; - } - result.push(clientRect); - } - }; - var targetClientRect = last$1(caretPosition.getClientRects()); - if (!targetClientRect) { - return result; - } - var node = caretPosition.getNode(); - add(node); - findUntil$1(direction, root, add, node); - return result; - }; - var aboveLineNumber = function (lineNumber, clientRect) { - return clientRect.line > lineNumber; - }; - var isLineNumber = function (lineNumber, clientRect) { - return clientRect.line === lineNumber; - }; - var upUntil = curry(walkUntil, VDirection.Up, isAbove, isBelow); - var downUntil = curry(walkUntil, VDirection.Down, isBelow, isAbove); - var positionsUntil = function (direction, root, predicateFn, node) { - var caretWalker = CaretWalker(root); - var walkFn, isBelowFn, isAboveFn, caretPosition; - var result = []; - var line = 0, clientRect; - var getClientRect = function (caretPosition) { - if (direction === 1) { - return last$1(caretPosition.getClientRects()); - } - return last$1(caretPosition.getClientRects()); - }; - if (direction === 1) { - walkFn = caretWalker.next; - isBelowFn = isBelow; - isAboveFn = isAbove; - caretPosition = CaretPosition$1.after(node); - } else { - walkFn = caretWalker.prev; - isBelowFn = isAbove; - isAboveFn = isBelow; - caretPosition = CaretPosition$1.before(node); - } - var targetClientRect = getClientRect(caretPosition); - do { - if (!caretPosition.isVisible()) { - continue; - } - clientRect = getClientRect(caretPosition); - if (isAboveFn(clientRect, targetClientRect)) { - continue; - } - if (result.length > 0 && isBelowFn(clientRect, last$1(result))) { - line++; - } - clientRect = clone$2(clientRect); - clientRect.position = caretPosition; - clientRect.line = line; - if (predicateFn(clientRect)) { - return result; - } - result.push(clientRect); - } while (caretPosition = walkFn(caretPosition)); - return result; - }; - var isAboveLine = function (lineNumber) { - return function (clientRect) { - return aboveLineNumber(lineNumber, clientRect); - }; - }; - var isLine = function (lineNumber) { - return function (clientRect) { - return isLineNumber(lineNumber, clientRect); - }; - }; - - var isContentEditableFalse$8 = isContentEditableFalse; - var findNode$1 = findNode; - var distanceToRectLeft = function (clientRect, clientX) { - return Math.abs(clientRect.left - clientX); - }; - var distanceToRectRight = function (clientRect, clientX) { - return Math.abs(clientRect.right - clientX); - }; - var isInsideX = function (clientX, clientRect) { - return clientX >= clientRect.left && clientX <= clientRect.right; - }; - var isInsideY = function (clientY, clientRect) { - return clientY >= clientRect.top && clientY <= clientRect.bottom; - }; - var findClosestClientRect = function (clientRects, clientX) { - return reduce(clientRects, function (oldClientRect, clientRect) { - var oldDistance = Math.min(distanceToRectLeft(oldClientRect, clientX), distanceToRectRight(oldClientRect, clientX)); - var newDistance = Math.min(distanceToRectLeft(clientRect, clientX), distanceToRectRight(clientRect, clientX)); - if (isInsideX(clientX, clientRect)) { - return clientRect; - } - if (isInsideX(clientX, oldClientRect)) { - return oldClientRect; - } - if (newDistance === oldDistance && isContentEditableFalse$8(clientRect.node)) { - return clientRect; - } - if (newDistance < oldDistance) { - return clientRect; - } - return oldClientRect; - }); - }; - var walkUntil$1 = function (direction, root, predicateFn, startNode, includeChildren) { - var node = findNode$1(startNode, direction, isEditableCaretCandidate, root, !includeChildren); - do { - if (!node || predicateFn(node)) { - return; - } - } while (node = findNode$1(node, direction, isEditableCaretCandidate, root)); - }; - var findLineNodeRects = function (root, targetNodeRect, includeChildren) { - if (includeChildren === void 0) { - includeChildren = true; - } - var clientRects = []; - var collect = function (checkPosFn, node) { - var lineRects = filter(getClientRects([node]), function (clientRect) { - return !checkPosFn(clientRect, targetNodeRect); - }); - clientRects = clientRects.concat(lineRects); - return lineRects.length === 0; - }; - clientRects.push(targetNodeRect); - walkUntil$1(VDirection.Up, root, curry(collect, isAbove), targetNodeRect.node, includeChildren); - walkUntil$1(VDirection.Down, root, curry(collect, isBelow), targetNodeRect.node, includeChildren); - return clientRects; - }; - var getFakeCaretTargets = function (root) { - return filter(from$1(root.getElementsByTagName('*')), isFakeCaretTarget); - }; - var caretInfo = function (clientRect, clientX) { - return { - node: clientRect.node, - before: distanceToRectLeft(clientRect, clientX) < distanceToRectRight(clientRect, clientX) - }; - }; - var closestFakeCaret = function (root, clientX, clientY) { - var fakeTargetNodeRects = getClientRects(getFakeCaretTargets(root)); - var targetNodeRects = filter(fakeTargetNodeRects, curry(isInsideY, clientY)); - var closestNodeRect = findClosestClientRect(targetNodeRects, clientX); - if (closestNodeRect) { - var includeChildren = !isTable(closestNodeRect.node) && !isMedia(closestNodeRect.node); - closestNodeRect = findClosestClientRect(findLineNodeRects(root, closestNodeRect, includeChildren), clientX); - if (closestNodeRect && isFakeCaretTarget(closestNodeRect.node)) { - return caretInfo(closestNodeRect, clientX); - } - } - return null; - }; - - var moveToRange = function (editor, rng) { - editor.selection.setRng(rng); - scrollRangeIntoView(editor, editor.selection.getRng()); - }; - var renderRangeCaretOpt = function (editor, range, scrollIntoView) { - return Optional.some(renderRangeCaret(editor, range, scrollIntoView)); - }; - var moveHorizontally = function (editor, direction, range, isBefore, isAfter, isElement) { - var forwards = direction === HDirection.Forwards; - var caretWalker = CaretWalker(editor.getBody()); - var getNextPosFn = curry(getVisualCaretPosition, forwards ? caretWalker.next : caretWalker.prev); - var isBeforeFn = forwards ? isBefore : isAfter; - if (!range.collapsed) { - var node = getSelectedNode(range); - if (isElement(node)) { - return showCaret(direction, editor, node, direction === HDirection.Backwards, false); - } - } - var caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range); - if (isBeforeFn(caretPosition)) { - return selectNode(editor, caretPosition.getNode(!forwards)); - } - var nextCaretPosition = normalizePosition(forwards, getNextPosFn(caretPosition)); - var rangeIsInContainerBlock = isRangeInCaretContainerBlock(range); - if (!nextCaretPosition) { - return rangeIsInContainerBlock ? Optional.some(range) : Optional.none(); - } - if (isBeforeFn(nextCaretPosition)) { - return showCaret(direction, editor, nextCaretPosition.getNode(!forwards), forwards, false); - } - var peekCaretPosition = getNextPosFn(nextCaretPosition); - if (peekCaretPosition && isBeforeFn(peekCaretPosition)) { - if (isMoveInsideSameBlock(nextCaretPosition, peekCaretPosition)) { - return showCaret(direction, editor, peekCaretPosition.getNode(!forwards), forwards, false); - } - } - if (rangeIsInContainerBlock) { - return renderRangeCaretOpt(editor, nextCaretPosition.toRange(), false); - } - return Optional.none(); - }; - var moveVertically = function (editor, direction, range, isBefore, isAfter, isElement) { - var caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range); - var caretClientRect = last$1(caretPosition.getClientRects()); - var forwards = direction === VDirection.Down; - if (!caretClientRect) { - return Optional.none(); - } - var walkerFn = forwards ? downUntil : upUntil; - var linePositions = walkerFn(editor.getBody(), isAboveLine(1), caretPosition); - var nextLinePositions = filter(linePositions, isLine(1)); - var clientX = caretClientRect.left; - var nextLineRect = findClosestClientRect(nextLinePositions, clientX); - if (nextLineRect && isElement(nextLineRect.node)) { - var dist1 = Math.abs(clientX - nextLineRect.left); - var dist2 = Math.abs(clientX - nextLineRect.right); - return showCaret(direction, editor, nextLineRect.node, dist1 < dist2, false); - } - var currentNode; - if (isBefore(caretPosition)) { - currentNode = caretPosition.getNode(); - } else if (isAfter(caretPosition)) { - currentNode = caretPosition.getNode(true); - } else { - currentNode = getSelectedNode(range); - } - if (currentNode) { - var caretPositions = positionsUntil(direction, editor.getBody(), isAboveLine(1), currentNode); - var closestNextLineRect = findClosestClientRect(filter(caretPositions, isLine(1)), clientX); - if (closestNextLineRect) { - return renderRangeCaretOpt(editor, closestNextLineRect.position.toRange(), false); - } - closestNextLineRect = last$1(filter(caretPositions, isLine(0))); - if (closestNextLineRect) { - return renderRangeCaretOpt(editor, closestNextLineRect.position.toRange(), false); - } - } - if (nextLinePositions.length === 0) { - return getLineEndPoint(editor, forwards).filter(forwards ? isAfter : isBefore).map(function (pos) { - return renderRangeCaret(editor, pos.toRange(), false); - }); - } - return Optional.none(); - }; - var getLineEndPoint = function (editor, forward) { - var rng = editor.selection.getRng(); - var body = editor.getBody(); - if (forward) { - var from = CaretPosition$1.fromRangeEnd(rng); - var result = getPositionsUntilNextLine(body, from); - return last(result.positions); - } else { - var from = CaretPosition$1.fromRangeStart(rng); - var result = getPositionsUntilPreviousLine(body, from); - return head(result.positions); - } - }; - var moveToLineEndPoint = function (editor, forward, isElementPosition) { - return getLineEndPoint(editor, forward).filter(isElementPosition).exists(function (pos) { - editor.selection.setRng(pos.toRange()); - return true; - }); - }; - - var isContentEditableFalse$9 = isContentEditableFalse; - var moveToCeFalseHorizontally = function (direction, editor, range) { - return moveHorizontally(editor, direction, range, isBeforeContentEditableFalse, isAfterContentEditableFalse, isContentEditableFalse$9); - }; - var moveToCeFalseVertically = function (direction, editor, range) { - var isBefore = function (caretPosition) { - return isBeforeContentEditableFalse(caretPosition) || isBeforeTable(caretPosition); - }; - var isAfter = function (caretPosition) { - return isAfterContentEditableFalse(caretPosition) || isAfterTable(caretPosition); - }; - return moveVertically(editor, direction, range, isBefore, isAfter, isContentEditableFalse$9); - }; - var createTextBlock = function (editor) { - var textBlock = editor.dom.create(getForcedRootBlock(editor)); - if (!Env.ie || Env.ie >= 11) { - textBlock.innerHTML = '
                                      '; - } - return textBlock; - }; - var exitPreBlock = function (editor, direction, range) { - var caretWalker = CaretWalker(editor.getBody()); - var getVisualCaretPosition$1 = curry(getVisualCaretPosition, direction === 1 ? caretWalker.next : caretWalker.prev); - if (range.collapsed && hasForcedRootBlock(editor)) { - var pre = editor.dom.getParent(range.startContainer, 'PRE'); - if (!pre) { - return; - } - var caretPos = getVisualCaretPosition$1(CaretPosition$1.fromRangeStart(range)); - if (!caretPos) { - var newBlock = createTextBlock(editor); - if (direction === 1) { - editor.$(pre).after(newBlock); - } else { - editor.$(pre).before(newBlock); - } - editor.selection.select(newBlock, true); - editor.selection.collapse(); - } - } - }; - var getHorizontalRange = function (editor, forward) { - var direction = forward ? HDirection.Forwards : HDirection.Backwards; - var range = editor.selection.getRng(); - return moveToCeFalseHorizontally(direction, editor, range).orThunk(function () { - exitPreBlock(editor, direction, range); - return Optional.none(); - }); - }; - var getVerticalRange = function (editor, down) { - var direction = down ? 1 : -1; - var range = editor.selection.getRng(); - return moveToCeFalseVertically(direction, editor, range).orThunk(function () { - exitPreBlock(editor, direction, range); - return Optional.none(); - }); - }; - var moveH = function (editor, forward) { - return getHorizontalRange(editor, forward).exists(function (newRange) { - moveToRange(editor, newRange); - return true; - }); - }; - var moveV = function (editor, down) { - return getVerticalRange(editor, down).exists(function (newRange) { - moveToRange(editor, newRange); - return true; - }); - }; - var moveToLineEndPoint$1 = function (editor, forward) { - var isCefPosition = forward ? isAfterContentEditableFalse : isBeforeContentEditableFalse; - return moveToLineEndPoint(editor, forward, isCefPosition); - }; - - var isTarget = function (node) { - return contains(['figcaption'], name(node)); - }; - var rangeBefore = function (target) { - var rng = document.createRange(); - rng.setStartBefore(target.dom); - rng.setEndBefore(target.dom); - return rng; - }; - var insertElement = function (root, elm, forward) { - if (forward) { - append(root, elm); - } else { - prepend(root, elm); - } - }; - var insertBr = function (root, forward) { - var br = SugarElement.fromTag('br'); - insertElement(root, br, forward); - return rangeBefore(br); - }; - var insertBlock$1 = function (root, forward, blockName, attrs) { - var block = SugarElement.fromTag(blockName); - var br = SugarElement.fromTag('br'); - setAll(block, attrs); - append(block, br); - insertElement(root, block, forward); - return rangeBefore(br); - }; - var insertEmptyLine = function (root, rootBlockName, attrs, forward) { - if (rootBlockName === '') { - return insertBr(root, forward); - } else { - return insertBlock$1(root, forward, rootBlockName, attrs); - } - }; - var getClosestTargetBlock = function (pos, root) { - var isRoot = curry(eq$2, root); - return closest(SugarElement.fromDom(pos.container()), isBlock, isRoot).filter(isTarget); - }; - var isAtFirstOrLastLine = function (root, forward, pos) { - return forward ? isAtLastLine(root.dom, pos) : isAtFirstLine(root.dom, pos); - }; - var moveCaretToNewEmptyLine = function (editor, forward) { - var root = SugarElement.fromDom(editor.getBody()); - var pos = CaretPosition$1.fromRangeStart(editor.selection.getRng()); - var rootBlock = getForcedRootBlock(editor); - var rootBlockAttrs = getForcedRootBlockAttrs(editor); - return getClosestTargetBlock(pos, root).exists(function () { - if (isAtFirstOrLastLine(root, forward, pos)) { - var rng = insertEmptyLine(root, rootBlock, rootBlockAttrs, forward); - editor.selection.setRng(rng); - return true; - } else { - return false; - } - }); - }; - var moveV$1 = function (editor, forward) { - if (editor.selection.isCollapsed()) { - return moveCaretToNewEmptyLine(editor, forward); - } else { - return false; - } - }; - - var defaultPatterns = function (patterns) { - return map(patterns, function (pattern) { - return __assign({ - shiftKey: false, - altKey: false, - ctrlKey: false, - metaKey: false, - keyCode: 0, - action: noop - }, pattern); - }); - }; - var matchesEvent = function (pattern, evt) { - return evt.keyCode === pattern.keyCode && evt.shiftKey === pattern.shiftKey && evt.altKey === pattern.altKey && evt.ctrlKey === pattern.ctrlKey && evt.metaKey === pattern.metaKey; - }; - var match$1 = function (patterns, evt) { - return bind(defaultPatterns(patterns), function (pattern) { - return matchesEvent(pattern, evt) ? [pattern] : []; - }); - }; - var action = function (f) { - var x = []; - for (var _i = 1; _i < arguments.length; _i++) { - x[_i - 1] = arguments[_i]; - } - return function () { - return f.apply(null, x); - }; - }; - var execute = function (patterns, evt) { - return find(match$1(patterns, evt), function (pattern) { - return pattern.action(); - }); - }; - - var moveH$1 = function (editor, forward) { - var direction = forward ? HDirection.Forwards : HDirection.Backwards; - var range = editor.selection.getRng(); - return moveHorizontally(editor, direction, range, isBeforeMedia, isAfterMedia, isMedia).exists(function (newRange) { - moveToRange(editor, newRange); - return true; - }); - }; - var moveV$2 = function (editor, down) { - var direction = down ? 1 : -1; - var range = editor.selection.getRng(); - return moveVertically(editor, direction, range, isBeforeMedia, isAfterMedia, isMedia).exists(function (newRange) { - moveToRange(editor, newRange); - return true; - }); - }; - var moveToLineEndPoint$2 = function (editor, forward) { - var isNearMedia = forward ? isAfterMedia : isBeforeMedia; - return moveToLineEndPoint(editor, forward, isNearMedia); - }; - - var deflate = function (rect, delta) { - return { - left: rect.left - delta, - top: rect.top - delta, - right: rect.right + delta * 2, - bottom: rect.bottom + delta * 2, - width: rect.width + delta, - height: rect.height + delta - }; - }; - var getCorners = function (getYAxisValue, tds) { - return bind(tds, function (td) { - var rect = deflate(clone$2(td.getBoundingClientRect()), -1); - return [ - { - x: rect.left, - y: getYAxisValue(rect), - cell: td - }, - { - x: rect.right, - y: getYAxisValue(rect), - cell: td - } - ]; - }); - }; - var findClosestCorner = function (corners, x, y) { - return foldl(corners, function (acc, newCorner) { - return acc.fold(function () { - return Optional.some(newCorner); - }, function (oldCorner) { - var oldDist = Math.sqrt(Math.abs(oldCorner.x - x) + Math.abs(oldCorner.y - y)); - var newDist = Math.sqrt(Math.abs(newCorner.x - x) + Math.abs(newCorner.y - y)); - return Optional.some(newDist < oldDist ? newCorner : oldCorner); - }); - }, Optional.none()); - }; - var getClosestCell$1 = function (getYAxisValue, isTargetCorner, table, x, y) { - var cells = descendants$1(SugarElement.fromDom(table), 'td,th,caption').map(function (e) { - return e.dom; - }); - var corners = filter(getCorners(getYAxisValue, cells), function (corner) { - return isTargetCorner(corner, y); - }); - return findClosestCorner(corners, x, y).map(function (corner) { - return corner.cell; - }); - }; - var getBottomValue = function (rect) { - return rect.bottom; - }; - var getTopValue = function (rect) { - return rect.top; - }; - var isAbove$1 = function (corner, y) { - return corner.y < y; - }; - var isBelow$1 = function (corner, y) { - return corner.y > y; - }; - var getClosestCellAbove = curry(getClosestCell$1, getBottomValue, isAbove$1); - var getClosestCellBelow = curry(getClosestCell$1, getTopValue, isBelow$1); - var findClosestPositionInAboveCell = function (table, pos) { - return head(pos.getClientRects()).bind(function (rect) { - return getClosestCellAbove(table, rect.left, rect.top); - }).bind(function (cell) { - return findClosestHorizontalPosition(getLastLinePositions(cell), pos); - }); - }; - var findClosestPositionInBelowCell = function (table, pos) { - return last(pos.getClientRects()).bind(function (rect) { - return getClosestCellBelow(table, rect.left, rect.top); - }).bind(function (cell) { - return findClosestHorizontalPosition(getFirstLinePositions(cell), pos); - }); - }; - - var hasNextBreak = function (getPositionsUntil, scope, lineInfo) { - return lineInfo.breakAt.exists(function (breakPos) { - return getPositionsUntil(scope, breakPos).breakAt.isSome(); - }); - }; - var startsWithWrapBreak = function (lineInfo) { - return lineInfo.breakType === BreakType.Wrap && lineInfo.positions.length === 0; - }; - var startsWithBrBreak = function (lineInfo) { - return lineInfo.breakType === BreakType.Br && lineInfo.positions.length === 1; - }; - var isAtTableCellLine = function (getPositionsUntil, scope, pos) { - var lineInfo = getPositionsUntil(scope, pos); - if (startsWithWrapBreak(lineInfo) || !isBr(pos.getNode()) && startsWithBrBreak(lineInfo)) { - return !hasNextBreak(getPositionsUntil, scope, lineInfo); - } else { - return lineInfo.breakAt.isNone(); - } - }; - var isAtFirstTableCellLine = curry(isAtTableCellLine, getPositionsUntilPreviousLine); - var isAtLastTableCellLine = curry(isAtTableCellLine, getPositionsUntilNextLine); - var isCaretAtStartOrEndOfTable = function (forward, rng, table) { - var caretPos = CaretPosition$1.fromRangeStart(rng); - return positionIn(!forward, table).exists(function (pos) { - return pos.isEqual(caretPos); - }); - }; - var navigateHorizontally = function (editor, forward, table, _td) { - var rng = editor.selection.getRng(); - var direction = forward ? 1 : -1; - if (isFakeCaretTableBrowser() && isCaretAtStartOrEndOfTable(forward, rng, table)) { - showCaret(direction, editor, table, !forward, false).each(function (newRng) { - moveToRange(editor, newRng); - }); - return true; - } - return false; - }; - var getClosestAbovePosition = function (root, table, start) { - return findClosestPositionInAboveCell(table, start).orThunk(function () { - return head(start.getClientRects()).bind(function (rect) { - return findClosestHorizontalPositionFromPoint(getPositionsAbove(root, CaretPosition$1.before(table)), rect.left); - }); - }).getOr(CaretPosition$1.before(table)); - }; - var getClosestBelowPosition = function (root, table, start) { - return findClosestPositionInBelowCell(table, start).orThunk(function () { - return head(start.getClientRects()).bind(function (rect) { - return findClosestHorizontalPositionFromPoint(getPositionsBelow(root, CaretPosition$1.after(table)), rect.left); - }); - }).getOr(CaretPosition$1.after(table)); - }; - var getTable = function (previous, pos) { - var node = pos.getNode(previous); - return isElement$1(node) && node.nodeName === 'TABLE' ? Optional.some(node) : Optional.none(); - }; - var renderBlock = function (down, editor, table, pos) { - var forcedRootBlock = getForcedRootBlock(editor); - if (forcedRootBlock) { - editor.undoManager.transact(function () { - var element = SugarElement.fromTag(forcedRootBlock); - setAll(element, getForcedRootBlockAttrs(editor)); - append(element, SugarElement.fromTag('br')); - if (down) { - after(SugarElement.fromDom(table), element); - } else { - before(SugarElement.fromDom(table), element); - } - var rng = editor.dom.createRng(); - rng.setStart(element.dom, 0); - rng.setEnd(element.dom, 0); - moveToRange(editor, rng); - }); - } else { - moveToRange(editor, pos.toRange()); - } - }; - var moveCaret = function (editor, down, pos) { - var table = down ? getTable(true, pos) : getTable(false, pos); - var last = down === false; - table.fold(function () { - return moveToRange(editor, pos.toRange()); - }, function (table) { - return positionIn(last, editor.getBody()).filter(function (lastPos) { - return lastPos.isEqual(pos); - }).fold(function () { - return moveToRange(editor, pos.toRange()); - }, function (_) { - return renderBlock(down, editor, table, pos); - }); - }); - }; - var navigateVertically = function (editor, down, table, td) { - var rng = editor.selection.getRng(); - var pos = CaretPosition$1.fromRangeStart(rng); - var root = editor.getBody(); - if (!down && isAtFirstTableCellLine(td, pos)) { - var newPos = getClosestAbovePosition(root, table, pos); - moveCaret(editor, down, newPos); - return true; - } else if (down && isAtLastTableCellLine(td, pos)) { - var newPos = getClosestBelowPosition(root, table, pos); - moveCaret(editor, down, newPos); - return true; - } else { - return false; - } - }; - var move$1 = function (editor, forward, mover) { - return Optional.from(editor.dom.getParent(editor.selection.getNode(), 'td,th')).bind(function (td) { - return Optional.from(editor.dom.getParent(td, 'table')).map(function (table) { - return mover(editor, forward, table, td); - }); - }).getOr(false); - }; - var moveH$2 = function (editor, forward) { - return move$1(editor, forward, navigateHorizontally); - }; - var moveV$3 = function (editor, forward) { - return move$1(editor, forward, navigateVertically); - }; - - var executeKeydownOverride = function (editor, caret, evt) { - var os = detect$3().os; - execute([ - { - keyCode: VK.RIGHT, - action: action(moveH, editor, true) - }, - { - keyCode: VK.LEFT, - action: action(moveH, editor, false) - }, - { - keyCode: VK.UP, - action: action(moveV, editor, false) - }, - { - keyCode: VK.DOWN, - action: action(moveV, editor, true) - }, - { - keyCode: VK.RIGHT, - action: action(moveH$2, editor, true) - }, - { - keyCode: VK.LEFT, - action: action(moveH$2, editor, false) - }, - { - keyCode: VK.UP, - action: action(moveV$3, editor, false) - }, - { - keyCode: VK.DOWN, - action: action(moveV$3, editor, true) - }, - { - keyCode: VK.RIGHT, - action: action(moveH$1, editor, true) - }, - { - keyCode: VK.LEFT, - action: action(moveH$1, editor, false) - }, - { - keyCode: VK.UP, - action: action(moveV$2, editor, false) - }, - { - keyCode: VK.DOWN, - action: action(moveV$2, editor, true) - }, - { - keyCode: VK.RIGHT, - action: action(move, editor, caret, true) - }, - { - keyCode: VK.LEFT, - action: action(move, editor, caret, false) - }, - { - keyCode: VK.RIGHT, - ctrlKey: !os.isOSX(), - altKey: os.isOSX(), - action: action(moveNextWord, editor, caret) - }, - { - keyCode: VK.LEFT, - ctrlKey: !os.isOSX(), - altKey: os.isOSX(), - action: action(movePrevWord, editor, caret) - }, - { - keyCode: VK.UP, - action: action(moveV$1, editor, false) - }, - { - keyCode: VK.DOWN, - action: action(moveV$1, editor, true) - } - ], evt).each(function (_) { - evt.preventDefault(); - }); - }; - var setup$c = function (editor, caret) { - editor.on('keydown', function (evt) { - if (evt.isDefaultPrevented() === false) { - executeKeydownOverride(editor, caret, evt); - } - }); - }; - - var executeKeydownOverride$1 = function (editor, caret, evt) { - execute([ - { - keyCode: VK.BACKSPACE, - action: action(backspaceDelete$9, editor, false) - }, - { - keyCode: VK.BACKSPACE, - action: action(backspaceDelete$4, editor, false) - }, - { - keyCode: VK.DELETE, - action: action(backspaceDelete$4, editor, true) - }, - { - keyCode: VK.BACKSPACE, - action: action(backspaceDelete$3, editor, false) - }, - { - keyCode: VK.DELETE, - action: action(backspaceDelete$3, editor, true) - }, - { - keyCode: VK.BACKSPACE, - action: action(backspaceDelete$6, editor, caret, false) - }, - { - keyCode: VK.DELETE, - action: action(backspaceDelete$6, editor, caret, true) - }, - { - keyCode: VK.BACKSPACE, - action: action(backspaceDelete, editor, false) - }, - { - keyCode: VK.DELETE, - action: action(backspaceDelete, editor, true) - }, - { - keyCode: VK.BACKSPACE, - action: action(backspaceDelete$5, editor, false) - }, - { - keyCode: VK.DELETE, - action: action(backspaceDelete$5, editor, true) - }, - { - keyCode: VK.BACKSPACE, - action: action(backspaceDelete$8, editor, false) - }, - { - keyCode: VK.DELETE, - action: action(backspaceDelete$8, editor, true) - }, - { - keyCode: VK.BACKSPACE, - action: action(backspaceDelete$2, editor, false) - }, - { - keyCode: VK.DELETE, - action: action(backspaceDelete$2, editor, true) - }, - { - keyCode: VK.BACKSPACE, - action: action(backspaceDelete$1, editor, false) - }, - { - keyCode: VK.DELETE, - action: action(backspaceDelete$1, editor, true) - }, - { - keyCode: VK.BACKSPACE, - action: action(backspaceDelete$7, editor, false) - }, - { - keyCode: VK.DELETE, - action: action(backspaceDelete$7, editor, true) - } - ], evt).each(function (_) { - evt.preventDefault(); - }); - }; - var executeKeyupOverride = function (editor, evt) { - execute([ - { - keyCode: VK.BACKSPACE, - action: action(paddEmptyElement, editor) - }, - { - keyCode: VK.DELETE, - action: action(paddEmptyElement, editor) - } - ], evt); - }; - var setup$d = function (editor, caret) { - editor.on('keydown', function (evt) { - if (evt.isDefaultPrevented() === false) { - executeKeydownOverride$1(editor, caret, evt); - } - }); - editor.on('keyup', function (evt) { - if (evt.isDefaultPrevented() === false) { - executeKeyupOverride(editor, evt); - } - }); - }; - - var firstNonWhiteSpaceNodeSibling = function (node) { - while (node) { - if (node.nodeType === 1 || node.nodeType === 3 && node.data && /[\r\n\s]/.test(node.data)) { - return node; - } - node = node.nextSibling; - } - }; - var moveToCaretPosition = function (editor, root) { - var node, lastNode = root; - var dom = editor.dom; - var moveCaretBeforeOnEnterElementsMap = editor.schema.getMoveCaretBeforeOnEnterElements(); - if (!root) { - return; - } - if (/^(LI|DT|DD)$/.test(root.nodeName)) { - var firstChild = firstNonWhiteSpaceNodeSibling(root.firstChild); - if (firstChild && /^(UL|OL|DL)$/.test(firstChild.nodeName)) { - root.insertBefore(dom.doc.createTextNode(nbsp), root.firstChild); - } - } - var rng = dom.createRng(); - root.normalize(); - if (root.hasChildNodes()) { - var walker = new DomTreeWalker(root, root); - while (node = walker.current()) { - if (isText$1(node)) { - rng.setStart(node, 0); - rng.setEnd(node, 0); - break; - } - if (moveCaretBeforeOnEnterElementsMap[node.nodeName.toLowerCase()]) { - rng.setStartBefore(node); - rng.setEndBefore(node); - break; - } - lastNode = node; - node = walker.next(); - } - if (!node) { - rng.setStart(lastNode, 0); - rng.setEnd(lastNode, 0); - } - } else { - if (isBr(root)) { - if (root.nextSibling && dom.isBlock(root.nextSibling)) { - rng.setStartBefore(root); - rng.setEndBefore(root); - } else { - rng.setStartAfter(root); - rng.setEndAfter(root); - } - } else { - rng.setStart(root, 0); - rng.setEnd(root, 0); - } - } - editor.selection.setRng(rng); - scrollRangeIntoView(editor, rng); - }; - var getEditableRoot = function (dom, node) { - var root = dom.getRoot(); - var parent, editableRoot; - parent = node; - while (parent !== root && dom.getContentEditable(parent) !== 'false') { - if (dom.getContentEditable(parent) === 'true') { - editableRoot = parent; - } - parent = parent.parentNode; - } - return parent !== root ? editableRoot : root; - }; - var getParentBlock$2 = function (editor) { - return Optional.from(editor.dom.getParent(editor.selection.getStart(true), editor.dom.isBlock)); - }; - var getParentBlockName = function (editor) { - return getParentBlock$2(editor).fold(constant(''), function (parentBlock) { - return parentBlock.nodeName.toUpperCase(); - }); - }; - var isListItemParentBlock = function (editor) { - return getParentBlock$2(editor).filter(function (elm) { - return isListItem(SugarElement.fromDom(elm)); - }).isSome(); - }; - - var hasFirstChild = function (elm, name) { - return elm.firstChild && elm.firstChild.nodeName === name; - }; - var hasParent$1 = function (elm, parentName) { - return elm && elm.parentNode && elm.parentNode.nodeName === parentName; - }; - var isListBlock = function (elm) { - return elm && /^(OL|UL|LI)$/.test(elm.nodeName); - }; - var isNestedList = function (elm) { - return isListBlock(elm) && isListBlock(elm.parentNode); - }; - var getContainerBlock = function (containerBlock) { - var containerBlockParent = containerBlock.parentNode; - if (/^(LI|DT|DD)$/.test(containerBlockParent.nodeName)) { - return containerBlockParent; - } - return containerBlock; - }; - var isFirstOrLastLi = function (containerBlock, parentBlock, first) { - var node = containerBlock[first ? 'firstChild' : 'lastChild']; - while (node) { - if (isElement$1(node)) { - break; - } - node = node[first ? 'nextSibling' : 'previousSibling']; - } - return node === parentBlock; - }; - var insert = function (editor, createNewBlock, containerBlock, parentBlock, newBlockName) { - var dom = editor.dom; - var rng = editor.selection.getRng(); - if (containerBlock === editor.getBody()) { - return; - } - if (isNestedList(containerBlock)) { - newBlockName = 'LI'; - } - var newBlock = newBlockName ? createNewBlock(newBlockName) : dom.create('BR'); - if (isFirstOrLastLi(containerBlock, parentBlock, true) && isFirstOrLastLi(containerBlock, parentBlock, false)) { - if (hasParent$1(containerBlock, 'LI')) { - dom.insertAfter(newBlock, getContainerBlock(containerBlock)); - } else { - dom.replace(newBlock, containerBlock); - } - } else if (isFirstOrLastLi(containerBlock, parentBlock, true)) { - if (hasParent$1(containerBlock, 'LI')) { - dom.insertAfter(newBlock, getContainerBlock(containerBlock)); - newBlock.appendChild(dom.doc.createTextNode(' ')); - newBlock.appendChild(containerBlock); - } else { - containerBlock.parentNode.insertBefore(newBlock, containerBlock); - } - } else if (isFirstOrLastLi(containerBlock, parentBlock, false)) { - dom.insertAfter(newBlock, getContainerBlock(containerBlock)); - } else { - containerBlock = getContainerBlock(containerBlock); - var tmpRng = rng.cloneRange(); - tmpRng.setStartAfter(parentBlock); - tmpRng.setEndAfter(containerBlock); - var fragment = tmpRng.extractContents(); - if (newBlockName === 'LI' && hasFirstChild(fragment, 'LI')) { - newBlock = fragment.firstChild; - dom.insertAfter(fragment, containerBlock); - } else { - dom.insertAfter(fragment, containerBlock); - dom.insertAfter(newBlock, containerBlock); - } - } - dom.remove(parentBlock); - moveToCaretPosition(editor, newBlock); - }; - - var trimZwsp = function (fragment) { - each(descendants(SugarElement.fromDom(fragment), isText), function (text) { - var rawNode = text.dom; - rawNode.nodeValue = trim$2(rawNode.nodeValue); - }); - }; - var isEmptyAnchor = function (dom, elm) { - return elm && elm.nodeName === 'A' && dom.isEmpty(elm); - }; - var isTableCell$5 = function (node) { - return node && /^(TD|TH|CAPTION)$/.test(node.nodeName); - }; - var emptyBlock = function (elm) { - elm.innerHTML = '
                                      '; - }; - var containerAndSiblingName = function (container, nodeName) { - return container.nodeName === nodeName || container.previousSibling && container.previousSibling.nodeName === nodeName; - }; - var canSplitBlock = function (dom, node) { - return node && dom.isBlock(node) && !/^(TD|TH|CAPTION|FORM)$/.test(node.nodeName) && !/^(fixed|absolute)/i.test(node.style.position) && dom.getContentEditable(node) !== 'true'; - }; - var trimInlineElementsOnLeftSideOfBlock = function (dom, nonEmptyElementsMap, block) { - var node = block; - var firstChilds = []; - var i; - if (!node) { - return; - } - while (node = node.firstChild) { - if (dom.isBlock(node)) { - return; - } - if (isElement$1(node) && !nonEmptyElementsMap[node.nodeName.toLowerCase()]) { - firstChilds.push(node); - } - } - i = firstChilds.length; - while (i--) { - node = firstChilds[i]; - if (!node.hasChildNodes() || node.firstChild === node.lastChild && node.firstChild.nodeValue === '') { - dom.remove(node); - } else { - if (isEmptyAnchor(dom, node)) { - dom.remove(node); - } - } - } - }; - var normalizeZwspOffset = function (start, container, offset) { - if (isText$1(container) === false) { - return offset; - } else if (start) { - return offset === 1 && container.data.charAt(offset - 1) === ZWSP ? 0 : offset; - } else { - return offset === container.data.length - 1 && container.data.charAt(offset) === ZWSP ? container.data.length : offset; - } - }; - var includeZwspInRange = function (rng) { - var newRng = rng.cloneRange(); - newRng.setStart(rng.startContainer, normalizeZwspOffset(true, rng.startContainer, rng.startOffset)); - newRng.setEnd(rng.endContainer, normalizeZwspOffset(false, rng.endContainer, rng.endOffset)); - return newRng; - }; - var trimLeadingLineBreaks = function (node) { - do { - if (isText$1(node)) { - node.nodeValue = node.nodeValue.replace(/^[\r\n]+/, ''); - } - node = node.firstChild; - } while (node); - }; - var getEditableRoot$1 = function (dom, node) { - var root = dom.getRoot(); - var parent, editableRoot; - parent = node; - while (parent !== root && dom.getContentEditable(parent) !== 'false') { - if (dom.getContentEditable(parent) === 'true') { - editableRoot = parent; - } - parent = parent.parentNode; - } - return parent !== root ? editableRoot : root; - }; - var applyAttributes = function (editor, node, forcedRootBlockAttrs) { - var dom = editor.dom; - Optional.from(forcedRootBlockAttrs.style).map(dom.parseStyle).each(function (attrStyles) { - var currentStyles = getAllRaw(SugarElement.fromDom(node)); - var newStyles = __assign(__assign({}, currentStyles), attrStyles); - dom.setStyles(node, newStyles); - }); - var attrClassesOpt = Optional.from(forcedRootBlockAttrs.class).map(function (attrClasses) { - return attrClasses.split(/\s+/); - }); - var currentClassesOpt = Optional.from(node.className).map(function (currentClasses) { - return filter(currentClasses.split(/\s+/), function (clazz) { - return clazz !== ''; - }); - }); - lift2(attrClassesOpt, currentClassesOpt, function (attrClasses, currentClasses) { - var filteredClasses = filter(currentClasses, function (clazz) { - return !contains(attrClasses, clazz); - }); - var newClasses = __spreadArrays(attrClasses, filteredClasses); - dom.setAttrib(node, 'class', newClasses.join(' ')); - }); - var appliedAttrs = [ - 'style', - 'class' - ]; - var remainingAttrs = filter$1(forcedRootBlockAttrs, function (_, attrs) { - return !contains(appliedAttrs, attrs); - }); - dom.setAttribs(node, remainingAttrs); - }; - var setForcedBlockAttrs = function (editor, node) { - var forcedRootBlockName = getForcedRootBlock(editor); - if (forcedRootBlockName && forcedRootBlockName.toLowerCase() === node.tagName.toLowerCase()) { - var forcedRootBlockAttrs = getForcedRootBlockAttrs(editor); - applyAttributes(editor, node, forcedRootBlockAttrs); - } - }; - var wrapSelfAndSiblingsInDefaultBlock = function (editor, newBlockName, rng, container, offset) { - var newBlock, parentBlock, startNode, node, next, rootBlockName; - var blockName = newBlockName || 'P'; - var dom = editor.dom, editableRoot = getEditableRoot$1(dom, container); - parentBlock = dom.getParent(container, dom.isBlock); - if (!parentBlock || !canSplitBlock(dom, parentBlock)) { - parentBlock = parentBlock || editableRoot; - if (parentBlock === editor.getBody() || isTableCell$5(parentBlock)) { - rootBlockName = parentBlock.nodeName.toLowerCase(); - } else { - rootBlockName = parentBlock.parentNode.nodeName.toLowerCase(); - } - if (!parentBlock.hasChildNodes()) { - newBlock = dom.create(blockName); - setForcedBlockAttrs(editor, newBlock); - parentBlock.appendChild(newBlock); - rng.setStart(newBlock, 0); - rng.setEnd(newBlock, 0); - return newBlock; - } - node = container; - while (node.parentNode !== parentBlock) { - node = node.parentNode; - } - while (node && !dom.isBlock(node)) { - startNode = node; - node = node.previousSibling; - } - if (startNode && editor.schema.isValidChild(rootBlockName, blockName.toLowerCase())) { - newBlock = dom.create(blockName); - setForcedBlockAttrs(editor, newBlock); - startNode.parentNode.insertBefore(newBlock, startNode); - node = startNode; - while (node && !dom.isBlock(node)) { - next = node.nextSibling; - newBlock.appendChild(node); - node = next; - } - rng.setStart(container, offset); - rng.setEnd(container, offset); - } - } - return container; - }; - var addBrToBlockIfNeeded = function (dom, block) { - block.normalize(); - var lastChild = block.lastChild; - if (!lastChild || /^(left|right)$/gi.test(dom.getStyle(lastChild, 'float', true))) { - dom.add(block, 'br'); - } - }; - var insert$1 = function (editor, evt) { - var tmpRng, container, offset, parentBlock; - var newBlock, fragment, containerBlock, parentBlockName, newBlockName, isAfterLastNodeInContainer; - var dom = editor.dom; - var schema = editor.schema, nonEmptyElementsMap = schema.getNonEmptyElements(); - var rng = editor.selection.getRng(); - var createNewBlock = function (name) { - var node = container, block, clonedNode, caretNode; - var textInlineElements = schema.getTextInlineElements(); - if (name || parentBlockName === 'TABLE' || parentBlockName === 'HR') { - block = dom.create(name || newBlockName); - } else { - block = parentBlock.cloneNode(false); - } - caretNode = block; - if (shouldKeepStyles(editor) === false) { - dom.setAttrib(block, 'style', null); - dom.setAttrib(block, 'class', null); - } else { - do { - if (textInlineElements[node.nodeName]) { - if (isCaretNode(node) || isBookmarkNode$1(node)) { - continue; - } - clonedNode = node.cloneNode(false); - dom.setAttrib(clonedNode, 'id', ''); - if (block.hasChildNodes()) { - clonedNode.appendChild(block.firstChild); - block.appendChild(clonedNode); - } else { - caretNode = clonedNode; - block.appendChild(clonedNode); - } - } - } while ((node = node.parentNode) && node !== editableRoot); - } - setForcedBlockAttrs(editor, block); - emptyBlock(caretNode); - return block; - }; - var isCaretAtStartOrEndOfBlock = function (start) { - var node, name; - var normalizedOffset = normalizeZwspOffset(start, container, offset); - if (isText$1(container) && (start ? normalizedOffset > 0 : normalizedOffset < container.nodeValue.length)) { - return false; - } - if (container.parentNode === parentBlock && isAfterLastNodeInContainer && !start) { - return true; - } - if (start && isElement$1(container) && container === parentBlock.firstChild) { - return true; - } - if (containerAndSiblingName(container, 'TABLE') || containerAndSiblingName(container, 'HR')) { - return isAfterLastNodeInContainer && !start || !isAfterLastNodeInContainer && start; - } - var walker = new DomTreeWalker(container, parentBlock); - if (isText$1(container)) { - if (start && normalizedOffset === 0) { - walker.prev(); - } else if (!start && normalizedOffset === container.nodeValue.length) { - walker.next(); - } - } - while (node = walker.current()) { - if (isElement$1(node)) { - if (!node.getAttribute('data-mce-bogus')) { - name = node.nodeName.toLowerCase(); - if (nonEmptyElementsMap[name] && name !== 'br') { - return false; - } - } - } else if (isText$1(node) && !isWhitespaceText(node.nodeValue)) { - return false; - } - if (start) { - walker.prev(); - } else { - walker.next(); - } - } - return true; - }; - var insertNewBlockAfter = function () { - if (/^(H[1-6]|PRE|FIGURE)$/.test(parentBlockName) && containerBlockName !== 'HGROUP') { - newBlock = createNewBlock(newBlockName); - } else { - newBlock = createNewBlock(); - } - if (shouldEndContainerOnEmptyBlock(editor) && canSplitBlock(dom, containerBlock) && dom.isEmpty(parentBlock)) { - newBlock = dom.split(containerBlock, parentBlock); - } else { - dom.insertAfter(newBlock, parentBlock); - } - moveToCaretPosition(editor, newBlock); - }; - normalize(dom, rng).each(function (normRng) { - rng.setStart(normRng.startContainer, normRng.startOffset); - rng.setEnd(normRng.endContainer, normRng.endOffset); - }); - container = rng.startContainer; - offset = rng.startOffset; - newBlockName = getForcedRootBlock(editor); - var shiftKey = !!(evt && evt.shiftKey); - var ctrlKey = !!(evt && evt.ctrlKey); - if (isElement$1(container) && container.hasChildNodes()) { - isAfterLastNodeInContainer = offset > container.childNodes.length - 1; - container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container; - if (isAfterLastNodeInContainer && isText$1(container)) { - offset = container.nodeValue.length; - } else { - offset = 0; - } - } - var editableRoot = getEditableRoot$1(dom, container); - if (!editableRoot) { - return; - } - if (newBlockName && !shiftKey || !newBlockName && shiftKey) { - container = wrapSelfAndSiblingsInDefaultBlock(editor, newBlockName, rng, container, offset); - } - parentBlock = dom.getParent(container, dom.isBlock); - containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null; - parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ''; - var containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; - if (containerBlockName === 'LI' && !ctrlKey) { - parentBlock = containerBlock; - containerBlock = containerBlock.parentNode; - parentBlockName = containerBlockName; - } - if (/^(LI|DT|DD)$/.test(parentBlockName)) { - if (dom.isEmpty(parentBlock)) { - insert(editor, createNewBlock, containerBlock, parentBlock, newBlockName); - return; - } - } - if (newBlockName && parentBlock === editor.getBody()) { - return; - } - newBlockName = newBlockName || 'P'; - if (isCaretContainerBlock(parentBlock)) { - newBlock = showCaretContainerBlock(parentBlock); - if (dom.isEmpty(parentBlock)) { - emptyBlock(parentBlock); - } - setForcedBlockAttrs(editor, newBlock); - moveToCaretPosition(editor, newBlock); - } else if (isCaretAtStartOrEndOfBlock()) { - insertNewBlockAfter(); - } else if (isCaretAtStartOrEndOfBlock(true)) { - newBlock = parentBlock.parentNode.insertBefore(createNewBlock(), parentBlock); - moveToCaretPosition(editor, containerAndSiblingName(parentBlock, 'HR') ? newBlock : parentBlock); - } else { - tmpRng = includeZwspInRange(rng).cloneRange(); - tmpRng.setEndAfter(parentBlock); - fragment = tmpRng.extractContents(); - trimZwsp(fragment); - trimLeadingLineBreaks(fragment); - newBlock = fragment.firstChild; - dom.insertAfter(fragment, parentBlock); - trimInlineElementsOnLeftSideOfBlock(dom, nonEmptyElementsMap, newBlock); - addBrToBlockIfNeeded(dom, parentBlock); - if (dom.isEmpty(parentBlock)) { - emptyBlock(parentBlock); - } - newBlock.normalize(); - if (dom.isEmpty(newBlock)) { - dom.remove(newBlock); - insertNewBlockAfter(); - } else { - setForcedBlockAttrs(editor, newBlock); - moveToCaretPosition(editor, newBlock); - } - } - dom.setAttrib(newBlock, 'id', ''); - editor.fire('NewBlock', { newBlock: newBlock }); - }; - - var hasRightSideContent = function (schema, container, parentBlock) { - var walker = new DomTreeWalker(container, parentBlock); - var node; - var nonEmptyElementsMap = schema.getNonEmptyElements(); - while (node = walker.next()) { - if (nonEmptyElementsMap[node.nodeName.toLowerCase()] || node.length > 0) { - return true; - } - } - }; - var scrollToBr = function (dom, selection, brElm) { - var marker = dom.create('span', {}, ' '); - brElm.parentNode.insertBefore(marker, brElm); - selection.scrollIntoView(marker); - dom.remove(marker); - }; - var moveSelectionToBr = function (dom, selection, brElm, extraBr) { - var rng = dom.createRng(); - if (!extraBr) { - rng.setStartAfter(brElm); - rng.setEndAfter(brElm); - } else { - rng.setStartBefore(brElm); - rng.setEndBefore(brElm); - } - selection.setRng(rng); - }; - var insertBrAtCaret = function (editor, evt) { - var selection = editor.selection; - var dom = editor.dom; - var rng = selection.getRng(); - var brElm; - var extraBr; - normalize(dom, rng).each(function (normRng) { - rng.setStart(normRng.startContainer, normRng.startOffset); - rng.setEnd(normRng.endContainer, normRng.endOffset); - }); - var offset = rng.startOffset; - var container = rng.startContainer; - if (container.nodeType === 1 && container.hasChildNodes()) { - var isAfterLastNodeInContainer = offset > container.childNodes.length - 1; - container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container; - if (isAfterLastNodeInContainer && container.nodeType === 3) { - offset = container.nodeValue.length; - } else { - offset = 0; - } - } - var parentBlock = dom.getParent(container, dom.isBlock); - var containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null; - var containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; - var isControlKey = !!(evt && evt.ctrlKey); - if (containerBlockName === 'LI' && !isControlKey) { - parentBlock = containerBlock; - } - if (container && container.nodeType === 3 && offset >= container.nodeValue.length) { - if (!hasRightSideContent(editor.schema, container, parentBlock)) { - brElm = dom.create('br'); - rng.insertNode(brElm); - rng.setStartAfter(brElm); - rng.setEndAfter(brElm); - extraBr = true; - } - } - brElm = dom.create('br'); - rangeInsertNode(dom, rng, brElm); - scrollToBr(dom, selection, brElm); - moveSelectionToBr(dom, selection, brElm, extraBr); - editor.undoManager.add(); - }; - var insertBrBefore = function (editor, inline) { - var br = SugarElement.fromTag('br'); - before(SugarElement.fromDom(inline), br); - editor.undoManager.add(); - }; - var insertBrAfter = function (editor, inline) { - if (!hasBrAfter(editor.getBody(), inline)) { - after(SugarElement.fromDom(inline), SugarElement.fromTag('br')); - } - var br = SugarElement.fromTag('br'); - after(SugarElement.fromDom(inline), br); - scrollToBr(editor.dom, editor.selection, br.dom); - moveSelectionToBr(editor.dom, editor.selection, br.dom, false); - editor.undoManager.add(); - }; - var isBeforeBr$1 = function (pos) { - return isBr(pos.getNode()); - }; - var hasBrAfter = function (rootNode, startNode) { - if (isBeforeBr$1(CaretPosition$1.after(startNode))) { - return true; - } else { - return nextPosition(rootNode, CaretPosition$1.after(startNode)).map(function (pos) { - return isBr(pos.getNode()); - }).getOr(false); - } - }; - var isAnchorLink = function (elm) { - return elm && elm.nodeName === 'A' && 'href' in elm; - }; - var isInsideAnchor = function (location) { - return location.fold(never, isAnchorLink, isAnchorLink, never); - }; - var readInlineAnchorLocation = function (editor) { - var isInlineTarget$1 = curry(isInlineTarget, editor); - var position = CaretPosition$1.fromRangeStart(editor.selection.getRng()); - return readLocation(isInlineTarget$1, editor.getBody(), position).filter(isInsideAnchor); - }; - var insertBrOutsideAnchor = function (editor, location) { - location.fold(noop, curry(insertBrBefore, editor), curry(insertBrAfter, editor), noop); - }; - var insert$2 = function (editor, evt) { - var anchorLocation = readInlineAnchorLocation(editor); - if (anchorLocation.isSome()) { - anchorLocation.each(curry(insertBrOutsideAnchor, editor)); - } else { - insertBrAtCaret(editor, evt); - } - }; - - var matchesSelector = function (editor, selector) { - return getParentBlock$2(editor).filter(function (parentBlock) { - return selector.length > 0 && is$1(SugarElement.fromDom(parentBlock), selector); - }).isSome(); - }; - var shouldInsertBr = function (editor) { - return matchesSelector(editor, getBrNewLineSelector(editor)); - }; - var shouldBlockNewLine = function (editor) { - return matchesSelector(editor, getNoNewLineSelector(editor)); - }; - - var newLineAction = Adt.generate([ - { br: [] }, - { block: [] }, - { none: [] } - ]); - var shouldBlockNewLine$1 = function (editor, _shiftKey) { - return shouldBlockNewLine(editor); - }; - var isBrMode = function (requiredState) { - return function (editor, _shiftKey) { - var brMode = getForcedRootBlock(editor) === ''; - return brMode === requiredState; - }; - }; - var inListBlock = function (requiredState) { - return function (editor, _shiftKey) { - return isListItemParentBlock(editor) === requiredState; - }; - }; - var inBlock = function (blockName, requiredState) { - return function (editor, _shiftKey) { - var state = getParentBlockName(editor) === blockName.toUpperCase(); - return state === requiredState; - }; - }; - var inPreBlock = function (requiredState) { - return inBlock('pre', requiredState); - }; - var inSummaryBlock = function () { - return inBlock('summary', true); - }; - var shouldPutBrInPre$1 = function (requiredState) { - return function (editor, _shiftKey) { - return shouldPutBrInPre(editor) === requiredState; - }; - }; - var inBrContext = function (editor, _shiftKey) { - return shouldInsertBr(editor); - }; - var hasShiftKey = function (_editor, shiftKey) { - return shiftKey; - }; - var canInsertIntoEditableRoot = function (editor) { - var forcedRootBlock = getForcedRootBlock(editor); - var rootEditable = getEditableRoot(editor.dom, editor.selection.getStart()); - return rootEditable && editor.schema.isValidChild(rootEditable.nodeName, forcedRootBlock ? forcedRootBlock : 'P'); - }; - var match$2 = function (predicates, action) { - return function (editor, shiftKey) { - var isMatch = foldl(predicates, function (res, p) { - return res && p(editor, shiftKey); - }, true); - return isMatch ? Optional.some(action) : Optional.none(); - }; - }; - var getAction$1 = function (editor, evt) { - return evaluateUntil([ - match$2([shouldBlockNewLine$1], newLineAction.none()), - match$2([inSummaryBlock()], newLineAction.br()), - match$2([ - inPreBlock(true), - shouldPutBrInPre$1(false), - hasShiftKey - ], newLineAction.br()), - match$2([ - inPreBlock(true), - shouldPutBrInPre$1(false) - ], newLineAction.block()), - match$2([ - inPreBlock(true), - shouldPutBrInPre$1(true), - hasShiftKey - ], newLineAction.block()), - match$2([ - inPreBlock(true), - shouldPutBrInPre$1(true) - ], newLineAction.br()), - match$2([ - inListBlock(true), - hasShiftKey - ], newLineAction.br()), - match$2([inListBlock(true)], newLineAction.block()), - match$2([ - isBrMode(true), - hasShiftKey, - canInsertIntoEditableRoot - ], newLineAction.block()), - match$2([isBrMode(true)], newLineAction.br()), - match$2([inBrContext], newLineAction.br()), - match$2([ - isBrMode(false), - hasShiftKey - ], newLineAction.br()), - match$2([canInsertIntoEditableRoot], newLineAction.block()) - ], [ - editor, - !!(evt && evt.shiftKey) - ]).getOr(newLineAction.none()); - }; - - var insert$3 = function (editor, evt) { - getAction$1(editor, evt).fold(function () { - insert$2(editor, evt); - }, function () { - insert$1(editor, evt); - }, noop); - }; - - var handleEnterKeyEvent = function (editor, event) { - if (event.isDefaultPrevented()) { - return; - } - event.preventDefault(); - endTypingLevelIgnoreLocks(editor.undoManager); - editor.undoManager.transact(function () { - if (editor.selection.isCollapsed() === false) { - editor.execCommand('Delete'); - } - insert$3(editor, event); - }); - }; - var setup$e = function (editor) { - editor.on('keydown', function (event) { - if (event.keyCode === VK.ENTER) { - handleEnterKeyEvent(editor, event); - } - }); - }; - - var executeKeydownOverride$2 = function (editor, evt) { - execute([ - { - keyCode: VK.END, - action: action(moveToLineEndPoint$1, editor, true) - }, - { - keyCode: VK.HOME, - action: action(moveToLineEndPoint$1, editor, false) - }, - { - keyCode: VK.END, - action: action(moveToLineEndPoint$2, editor, true) - }, - { - keyCode: VK.HOME, - action: action(moveToLineEndPoint$2, editor, false) - } - ], evt).each(function (_) { - evt.preventDefault(); - }); - }; - var setup$f = function (editor) { - editor.on('keydown', function (evt) { - if (evt.isDefaultPrevented() === false) { - executeKeydownOverride$2(editor, evt); - } - }); - }; - - var browser$4 = detect$3().browser; - var setupIeInput = function (editor) { - var keypressThrotter = first(function () { - if (!editor.composing) { - normalizeNbspsInEditor(editor); - } - }, 0); - if (browser$4.isIE()) { - editor.on('keypress', function (_e) { - keypressThrotter.throttle(); - }); - editor.on('remove', function (_e) { - keypressThrotter.cancel(); - }); - } - }; - var setup$g = function (editor) { - setupIeInput(editor); - editor.on('input', function (e) { - if (e.isComposing === false) { - normalizeNbspsInEditor(editor); - } - }); - }; - - var insertTextAtPosition = function (text, pos) { - var container = pos.container(); - var offset = pos.offset(); - if (isText$1(container)) { - container.insertData(offset, text); - return Optional.some(CaretPosition(container, offset + text.length)); - } else { - return getElementFromPosition(pos).map(function (elm) { - var textNode = SugarElement.fromText(text); - if (pos.isAtEnd()) { - after(elm, textNode); - } else { - before(elm, textNode); - } - return CaretPosition(textNode.dom, text.length); - }); - } - }; - var insertNbspAtPosition = curry(insertTextAtPosition, nbsp); - var insertSpaceAtPosition = curry(insertTextAtPosition, ' '); - - var locationToCaretPosition = function (root) { - return function (location) { - return location.fold(function (element) { - return prevPosition(root.dom, CaretPosition$1.before(element)); - }, function (element) { - return firstPositionIn(element); - }, function (element) { - return lastPositionIn(element); - }, function (element) { - return nextPosition(root.dom, CaretPosition$1.after(element)); - }); - }; - }; - var insertInlineBoundarySpaceOrNbsp = function (root, pos) { - return function (checkPos) { - return needsToHaveNbsp(root, checkPos) ? insertNbspAtPosition(pos) : insertSpaceAtPosition(pos); - }; - }; - var setSelection$1 = function (editor) { - return function (pos) { - editor.selection.setRng(pos.toRange()); - editor.nodeChanged(); - return true; - }; - }; - var insertSpaceOrNbspAtSelection = function (editor) { - var pos = CaretPosition$1.fromRangeStart(editor.selection.getRng()); - var root = SugarElement.fromDom(editor.getBody()); - if (editor.selection.isCollapsed()) { - var isInlineTarget$1 = curry(isInlineTarget, editor); - var caretPosition = CaretPosition$1.fromRangeStart(editor.selection.getRng()); - return readLocation(isInlineTarget$1, editor.getBody(), caretPosition).bind(locationToCaretPosition(root)).bind(insertInlineBoundarySpaceOrNbsp(root, pos)).exists(setSelection$1(editor)); - } else { - return false; - } - }; - - var executeKeydownOverride$3 = function (editor, evt) { - execute([{ - keyCode: VK.SPACEBAR, - action: action(insertSpaceOrNbspAtSelection, editor) - }], evt).each(function (_) { - evt.preventDefault(); - }); - }; - var setup$h = function (editor) { - editor.on('keydown', function (evt) { - if (evt.isDefaultPrevented() === false) { - executeKeydownOverride$3(editor, evt); - } - }); - }; - - var registerKeyboardOverrides = function (editor) { - var caret = setupSelectedState(editor); - setup$b(editor); - setup$c(editor, caret); - setup$d(editor, caret); - setup$e(editor); - setup$h(editor); - setup$g(editor); - setup$f(editor); - return caret; - }; - var setup$i = function (editor) { - if (!isRtc(editor)) { - return registerKeyboardOverrides(editor); - } else { - return Cell(null); - } - }; - - var NodeChange = function () { - function NodeChange(editor) { - this.lastPath = []; - this.editor = editor; - var lastRng; - var self = this; - if (!('onselectionchange' in editor.getDoc())) { - editor.on('NodeChange click mouseup keyup focus', function (e) { - var nativeRng = editor.selection.getRng(); - var fakeRng = { - startContainer: nativeRng.startContainer, - startOffset: nativeRng.startOffset, - endContainer: nativeRng.endContainer, - endOffset: nativeRng.endOffset - }; - if (e.type === 'nodechange' || !isEq$1(fakeRng, lastRng)) { - editor.fire('SelectionChange'); - } - lastRng = fakeRng; - }); - } - editor.on('contextmenu', function () { - editor.fire('SelectionChange'); - }); - editor.on('SelectionChange', function () { - var startElm = editor.selection.getStart(true); - if (!startElm || !Env.range && editor.selection.isCollapsed()) { - return; - } - if (hasAnyRanges(editor) && !self.isSameElementPath(startElm) && editor.dom.isChildOf(startElm, editor.getBody())) { - editor.nodeChanged({ selectionChange: true }); - } - }); - editor.on('mouseup', function (e) { - if (!e.isDefaultPrevented() && hasAnyRanges(editor)) { - if (editor.selection.getNode().nodeName === 'IMG') { - Delay.setEditorTimeout(editor, function () { - editor.nodeChanged(); - }); - } else { - editor.nodeChanged(); - } - } - }); - } - NodeChange.prototype.nodeChanged = function (args) { - var selection = this.editor.selection; - var node, parents, root; - if (this.editor.initialized && selection && !shouldDisableNodeChange(this.editor) && !this.editor.mode.isReadOnly()) { - root = this.editor.getBody(); - node = selection.getStart(true) || root; - if (node.ownerDocument !== this.editor.getDoc() || !this.editor.dom.isChildOf(node, root)) { - node = root; - } - parents = []; - this.editor.dom.getParent(node, function (node) { - if (node === root) { - return true; - } - parents.push(node); - }); - args = args || {}; - args.element = node; - args.parents = parents; - this.editor.fire('NodeChange', args); - } - }; - NodeChange.prototype.isSameElementPath = function (startElm) { - var i; - var currentPath = this.editor.$(startElm).parentsUntil(this.editor.getBody()).add(startElm); - if (currentPath.length === this.lastPath.length) { - for (i = currentPath.length; i >= 0; i--) { - if (currentPath[i] !== this.lastPath[i]) { - break; - } - } - if (i === -1) { - this.lastPath = currentPath; - return true; - } - } - this.lastPath = currentPath; - return false; - }; - return NodeChange; - }(); - - var preventSummaryToggle = function (editor) { - editor.on('click', function (e) { - if (editor.dom.getParent(e.target, 'details')) { - e.preventDefault(); - } - }); - }; - var filterDetails = function (editor) { - editor.parser.addNodeFilter('details', function (elms) { - each(elms, function (details) { - details.attr('data-mce-open', details.attr('open')); - details.attr('open', 'open'); - }); - }); - editor.serializer.addNodeFilter('details', function (elms) { - each(elms, function (details) { - var open = details.attr('data-mce-open'); - details.attr('open', isString(open) ? open : null); - details.attr('data-mce-open', null); - }); - }); - }; - var setup$j = function (editor) { - preventSummaryToggle(editor); - filterDetails(editor); - }; - - var isTextBlockNode = function (node) { - return isElement$1(node) && isTextBlock(SugarElement.fromDom(node)); - }; - var normalizeSelection$1 = function (editor) { - var rng = editor.selection.getRng(); - var startPos = CaretPosition.fromRangeStart(rng); - var endPos = CaretPosition.fromRangeEnd(rng); - if (CaretPosition.isElementPosition(startPos)) { - var container = startPos.container(); - if (isTextBlockNode(container)) { - firstPositionIn(container).each(function (pos) { - return rng.setStart(pos.container(), pos.offset()); - }); - } - } - if (CaretPosition.isElementPosition(endPos)) { - var container = startPos.container(); - if (isTextBlockNode(container)) { - lastPositionIn(container).each(function (pos) { - return rng.setEnd(pos.container(), pos.offset()); - }); - } - } - editor.selection.setRng(normalize$2(rng)); - }; - var setup$k = function (editor) { - editor.on('click', function (e) { - if (e.detail >= 3) { - normalizeSelection$1(editor); - } - }); - }; - - var value$1 = 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 getAbsolutePosition = function (elm) { - var clientRect = elm.getBoundingClientRect(); - var doc = elm.ownerDocument; - var docElem = doc.documentElement; - var win = doc.defaultView; - return { - top: clientRect.top + win.pageYOffset - docElem.clientTop, - left: clientRect.left + win.pageXOffset - docElem.clientLeft - }; - }; - var getBodyPosition = function (editor) { - return editor.inline ? getAbsolutePosition(editor.getBody()) : { - left: 0, - top: 0 - }; - }; - var getScrollPosition = function (editor) { - var body = editor.getBody(); - return editor.inline ? { - left: body.scrollLeft, - top: body.scrollTop - } : { - left: 0, - top: 0 - }; - }; - var getBodyScroll = function (editor) { - var body = editor.getBody(), docElm = editor.getDoc().documentElement; - var inlineScroll = { - left: body.scrollLeft, - top: body.scrollTop - }; - var iframeScroll = { - left: body.scrollLeft || docElm.scrollLeft, - top: body.scrollTop || docElm.scrollTop - }; - return editor.inline ? inlineScroll : iframeScroll; - }; - var getMousePosition = function (editor, event) { - if (event.target.ownerDocument !== editor.getDoc()) { - var iframePosition = getAbsolutePosition(editor.getContentAreaContainer()); - var scrollPosition = getBodyScroll(editor); - return { - left: event.pageX - iframePosition.left + scrollPosition.left, - top: event.pageY - iframePosition.top + scrollPosition.top - }; - } - return { - left: event.pageX, - top: event.pageY - }; - }; - var calculatePosition = function (bodyPosition, scrollPosition, mousePosition) { - return { - pageX: mousePosition.left - bodyPosition.left + scrollPosition.left, - pageY: mousePosition.top - bodyPosition.top + scrollPosition.top - }; - }; - var calc = function (editor, event) { - return calculatePosition(getBodyPosition(editor), getScrollPosition(editor), getMousePosition(editor, event)); - }; - - var isContentEditableFalse$a = isContentEditableFalse, isContentEditableTrue$3 = isContentEditableTrue; - var isDraggable = function (rootElm, elm) { - return isContentEditableFalse$a(elm) && elm !== rootElm; - }; - var isValidDropTarget = function (editor, targetElement, dragElement) { - if (targetElement === dragElement || editor.dom.isChildOf(targetElement, dragElement)) { - return false; - } - return !isContentEditableFalse$a(targetElement); - }; - var cloneElement = function (elm) { - var cloneElm = elm.cloneNode(true); - cloneElm.removeAttribute('data-mce-selected'); - return cloneElm; - }; - var createGhost = function (editor, elm, width, height) { - var dom = editor.dom; - var clonedElm = elm.cloneNode(true); - dom.setStyles(clonedElm, { - width: width, - height: height - }); - dom.setAttrib(clonedElm, 'data-mce-selected', null); - var ghostElm = dom.create('div', { - 'class': 'mce-drag-container', - 'data-mce-bogus': 'all', - 'unselectable': 'on', - 'contenteditable': 'false' - }); - dom.setStyles(ghostElm, { - position: 'absolute', - opacity: 0.5, - overflow: 'hidden', - border: 0, - padding: 0, - margin: 0, - width: width, - height: height - }); - dom.setStyles(clonedElm, { - margin: 0, - boxSizing: 'border-box' - }); - ghostElm.appendChild(clonedElm); - return ghostElm; - }; - var appendGhostToBody = function (ghostElm, bodyElm) { - if (ghostElm.parentNode !== bodyElm) { - bodyElm.appendChild(ghostElm); - } - }; - var moveGhost = function (ghostElm, position, width, height, maxX, maxY) { - var overflowX = 0, overflowY = 0; - ghostElm.style.left = position.pageX + 'px'; - ghostElm.style.top = position.pageY + 'px'; - if (position.pageX + width > maxX) { - overflowX = position.pageX + width - maxX; - } - if (position.pageY + height > maxY) { - overflowY = position.pageY + height - maxY; - } - ghostElm.style.width = width - overflowX + 'px'; - ghostElm.style.height = height - overflowY + 'px'; - }; - var removeElement = function (elm) { - if (elm && elm.parentNode) { - elm.parentNode.removeChild(elm); - } - }; - var isLeftMouseButtonPressed = function (e) { - return e.button === 0; - }; - var applyRelPos = function (state, position) { - return { - pageX: position.pageX - state.relX, - pageY: position.pageY + 5 - }; - }; - var start$1 = function (state, editor) { - return function (e) { - if (isLeftMouseButtonPressed(e)) { - var ceElm = find(editor.dom.getParents(e.target), or(isContentEditableFalse$a, isContentEditableTrue$3)).getOr(null); - if (isDraggable(editor.getBody(), ceElm)) { - var elmPos = editor.dom.getPos(ceElm); - var bodyElm = editor.getBody(); - var docElm = editor.getDoc().documentElement; - state.set({ - element: ceElm, - dragging: false, - screenX: e.screenX, - screenY: e.screenY, - maxX: (editor.inline ? bodyElm.scrollWidth : docElm.offsetWidth) - 2, - maxY: (editor.inline ? bodyElm.scrollHeight : docElm.offsetHeight) - 2, - relX: e.pageX - elmPos.x, - relY: e.pageY - elmPos.y, - width: ceElm.offsetWidth, - height: ceElm.offsetHeight, - ghost: createGhost(editor, ceElm, ceElm.offsetWidth, ceElm.offsetHeight) - }); - } - } - }; - }; - var move$2 = function (state, editor) { - var throttledPlaceCaretAt = Delay.throttle(function (clientX, clientY) { - editor._selectionOverrides.hideFakeCaret(); - editor.selection.placeCaretAt(clientX, clientY); - }, 0); - editor.on('remove', throttledPlaceCaretAt.stop); - return function (e) { - return state.on(function (state) { - var movement = Math.max(Math.abs(e.screenX - state.screenX), Math.abs(e.screenY - state.screenY)); - if (!state.dragging && movement > 10) { - var args = editor.fire('dragstart', { target: state.element }); - if (args.isDefaultPrevented()) { - return; - } - state.dragging = true; - editor.focus(); - } - if (state.dragging) { - var targetPos = applyRelPos(state, calc(editor, e)); - appendGhostToBody(state.ghost, editor.getBody()); - moveGhost(state.ghost, targetPos, state.width, state.height, state.maxX, state.maxY); - throttledPlaceCaretAt(e.clientX, e.clientY); - } - }); - }; - }; - var getRawTarget = function (selection) { - var rng = selection.getSel().getRangeAt(0); - var startContainer = rng.startContainer; - return startContainer.nodeType === 3 ? startContainer.parentNode : startContainer; - }; - var drop = function (state, editor) { - return function (e) { - state.on(function (state) { - if (state.dragging) { - if (isValidDropTarget(editor, getRawTarget(editor.selection), state.element)) { - var targetClone_1 = cloneElement(state.element); - var args = editor.fire('drop', { - clientX: e.clientX, - clientY: e.clientY - }); - if (!args.isDefaultPrevented()) { - editor.undoManager.transact(function () { - removeElement(state.element); - editor.insertContent(editor.dom.getOuterHTML(targetClone_1)); - editor._selectionOverrides.hideFakeCaret(); - }); - } - } - } - }); - removeDragState(state); - }; - }; - var stop = function (state, editor) { - return function () { - state.on(function (state) { - if (state.dragging) { - editor.fire('dragend'); - } - }); - removeDragState(state); - }; - }; - var removeDragState = function (state) { - state.on(function (state) { - removeElement(state.ghost); - }); - state.clear(); - }; - var bindFakeDragEvents = function (editor) { - var state = value$1(); - var pageDom = DOMUtils$1.DOM; - var rootDocument = document; - var dragStartHandler = start$1(state, editor); - var dragHandler = move$2(state, editor); - var dropHandler = drop(state, editor); - var dragEndHandler = stop(state, editor); - editor.on('mousedown', dragStartHandler); - editor.on('mousemove', dragHandler); - editor.on('mouseup', dropHandler); - pageDom.bind(rootDocument, 'mousemove', dragHandler); - pageDom.bind(rootDocument, 'mouseup', dragEndHandler); - editor.on('remove', function () { - pageDom.unbind(rootDocument, 'mousemove', dragHandler); - pageDom.unbind(rootDocument, 'mouseup', dragEndHandler); - }); - }; - var blockIeDrop = function (editor) { - editor.on('drop', function (e) { - var realTarget = typeof e.clientX !== 'undefined' ? editor.getDoc().elementFromPoint(e.clientX, e.clientY) : null; - if (isContentEditableFalse$a(realTarget) || editor.dom.getContentEditableParent(realTarget) === 'false') { - e.preventDefault(); - } - }); - }; - var blockUnsupportedFileDrop = function (editor) { - var preventFileDrop = function (e) { - if (!e.defaultPrevented) { - var dataTransfer = e.dataTransfer; - if (dataTransfer && (contains(dataTransfer.types, 'Files') || dataTransfer.files.length > 0)) { - e.preventDefault(); - if (e.type === 'drop') { - displayError(editor, 'Dropped file type is not supported'); - } - } - } - }; - var preventFileDropIfUIElement = function (e) { - if (isUIElement(editor, e.target)) { - preventFileDrop(e); - } - }; - var setup = function () { - var pageDom = DOMUtils$1.DOM; - var dom = editor.dom; - var doc = document; - var editorRoot = editor.inline ? editor.getBody() : editor.getDoc(); - var eventNames = [ - 'drop', - 'dragover' - ]; - each(eventNames, function (name) { - pageDom.bind(doc, name, preventFileDropIfUIElement); - dom.bind(editorRoot, name, preventFileDrop); - }); - editor.on('remove', function () { - each(eventNames, function (name) { - pageDom.unbind(doc, name, preventFileDropIfUIElement); - dom.unbind(editorRoot, name, preventFileDrop); - }); - }); - }; - editor.on('init', function () { - Delay.setEditorTimeout(editor, setup, 0); - }); - }; - var init = function (editor) { - bindFakeDragEvents(editor); - blockIeDrop(editor); - if (shouldBlockUnsupportedDrop(editor)) { - blockUnsupportedFileDrop(editor); - } - }; - - var setup$l = function (editor) { - var renderFocusCaret = first(function () { - if (!editor.removed && editor.getBody().contains(document.activeElement)) { - var rng = editor.selection.getRng(); - if (rng.collapsed) { - var caretRange = renderRangeCaret(editor, rng, false); - editor.selection.setRng(caretRange); - } - } - }, 0); - editor.on('focus', function () { - renderFocusCaret.throttle(); - }); - editor.on('blur', function () { - renderFocusCaret.cancel(); - }); - }; - - var setup$m = function (editor) { - editor.on('init', function () { - editor.on('focusin', function (e) { - var target = e.target; - if (isMedia(target)) { - var ceRoot = getContentEditableRoot(editor.getBody(), target); - var node = isContentEditableFalse(ceRoot) ? ceRoot : target; - if (editor.selection.getNode() !== node) { - selectNode(editor, node).each(function (rng) { - return editor.selection.setRng(rng); - }); - } - } - }); - }); - }; - - var isContentEditableTrue$4 = isContentEditableTrue; - var isContentEditableFalse$b = isContentEditableFalse; - var getContentEditableRoot$1 = function (editor, node) { - return getContentEditableRoot(editor.getBody(), node); - }; - var SelectionOverrides = function (editor) { - var selection = editor.selection, dom = editor.dom; - var isBlock = dom.isBlock; - var rootNode = editor.getBody(); - var fakeCaret = FakeCaret(editor, rootNode, isBlock, function () { - return hasFocus$1(editor); - }); - var realSelectionId = 'sel-' + dom.uniqueId(); - var elementSelectionAttr = 'data-mce-selected'; - var selectedElement; - var isFakeSelectionElement = function (node) { - return dom.hasClass(node, 'mce-offscreen-selection'); - }; - var isFakeSelectionTargetElement = function (node) { - return node !== rootNode && (isContentEditableFalse$b(node) || isMedia(node)) && dom.isChildOf(node, rootNode); - }; - var isNearFakeSelectionElement = function (pos) { - return isBeforeContentEditableFalse(pos) || isAfterContentEditableFalse(pos) || isBeforeMedia(pos) || isAfterMedia(pos); - }; - var getRealSelectionElement = function () { - var container = dom.get(realSelectionId); - return container ? container.getElementsByTagName('*')[0] : container; - }; - var setRange = function (range) { - if (range) { - selection.setRng(range); - } - }; - var getRange = selection.getRng; - var showCaret = function (direction, node, before, scrollIntoView) { - if (scrollIntoView === void 0) { - scrollIntoView = true; - } - var e = editor.fire('ShowCaret', { - target: node, - direction: direction, - before: before - }); - if (e.isDefaultPrevented()) { - return null; - } - if (scrollIntoView) { - selection.scrollIntoView(node, direction === -1); - } - return fakeCaret.show(before, node); - }; - var showBlockCaretContainer = function (blockCaretContainer) { - if (blockCaretContainer.hasAttribute('data-mce-caret')) { - showCaretContainerBlock(blockCaretContainer); - setRange(getRange()); - selection.scrollIntoView(blockCaretContainer); - } - }; - var registerEvents = function () { - editor.on('mouseup', function (e) { - var range = getRange(); - if (range.collapsed && isXYInContentArea(editor, e.clientX, e.clientY)) { - renderCaretAtRange(editor, range, false).each(setRange); - } - }); - editor.on('click', function (e) { - var contentEditableRoot = getContentEditableRoot$1(editor, e.target); - if (contentEditableRoot) { - if (isContentEditableFalse$b(contentEditableRoot)) { - e.preventDefault(); - editor.focus(); - } - if (isContentEditableTrue$4(contentEditableRoot)) { - if (dom.isChildOf(contentEditableRoot, selection.getNode())) { - removeElementSelection(); - } - } - } - }); - editor.on('blur NewBlock', removeElementSelection); - editor.on('ResizeWindow FullscreenStateChanged', fakeCaret.reposition); - var hasNormalCaretPosition = function (elm) { - var caretWalker = CaretWalker(elm); - if (!elm.firstChild) { - return false; - } - var startPos = CaretPosition$1.before(elm.firstChild); - var newPos = caretWalker.next(startPos); - return newPos && !isNearFakeSelectionElement(newPos); - }; - var isInSameBlock = function (node1, node2) { - var block1 = dom.getParent(node1, isBlock); - var block2 = dom.getParent(node2, isBlock); - return block1 === block2; - }; - var hasBetterMouseTarget = function (targetNode, caretNode) { - var targetBlock = dom.getParent(targetNode, isBlock); - var caretBlock = dom.getParent(caretNode, isBlock); - if (targetBlock && targetNode !== caretBlock && dom.isChildOf(targetBlock, caretBlock) && isContentEditableFalse$b(getContentEditableRoot$1(editor, targetBlock)) === false) { - return true; - } - return targetBlock && !isInSameBlock(targetBlock, caretBlock) && hasNormalCaretPosition(targetBlock); - }; - editor.on('tap', function (e) { - var targetElm = e.target; - var contentEditableRoot = getContentEditableRoot$1(editor, targetElm); - if (isContentEditableFalse$b(contentEditableRoot)) { - e.preventDefault(); - selectNode(editor, contentEditableRoot).each(setElementSelection); - } else if (isFakeSelectionTargetElement(targetElm)) { - selectNode(editor, targetElm).each(setElementSelection); - } - }, true); - editor.on('mousedown', function (e) { - var targetElm = e.target; - if (targetElm !== rootNode && targetElm.nodeName !== 'HTML' && !dom.isChildOf(targetElm, rootNode)) { - return; - } - if (isXYInContentArea(editor, e.clientX, e.clientY) === false) { - return; - } - var contentEditableRoot = getContentEditableRoot$1(editor, targetElm); - if (contentEditableRoot) { - if (isContentEditableFalse$b(contentEditableRoot)) { - e.preventDefault(); - selectNode(editor, contentEditableRoot).each(setElementSelection); - } else { - removeElementSelection(); - if (!(isContentEditableTrue$4(contentEditableRoot) && e.shiftKey) && !isXYWithinRange(e.clientX, e.clientY, selection.getRng())) { - hideFakeCaret(); - selection.placeCaretAt(e.clientX, e.clientY); - } - } - } else if (isFakeSelectionTargetElement(targetElm)) { - selectNode(editor, targetElm).each(setElementSelection); - } else if (isFakeCaretTarget(targetElm) === false) { - removeElementSelection(); - hideFakeCaret(); - var fakeCaretInfo = closestFakeCaret(rootNode, e.clientX, e.clientY); - if (fakeCaretInfo) { - if (!hasBetterMouseTarget(targetElm, fakeCaretInfo.node)) { - e.preventDefault(); - var range = showCaret(1, fakeCaretInfo.node, fakeCaretInfo.before, false); - editor.getBody().focus(); - setRange(range); - } - } - } - }); - editor.on('keypress', function (e) { - if (VK.modifierPressed(e)) { - return; - } - if (isContentEditableFalse$b(selection.getNode())) { - e.preventDefault(); - } - }); - editor.on('GetSelectionRange', function (e) { - var rng = e.range; - if (selectedElement) { - if (!selectedElement.parentNode) { - selectedElement = null; - return; - } - rng = rng.cloneRange(); - rng.selectNode(selectedElement); - e.range = rng; - } - }); - editor.on('SetSelectionRange', function (e) { - e.range = normalizeShortEndedElementSelection(e.range); - var rng = setElementSelection(e.range, e.forward); - if (rng) { - e.range = rng; - } - }); - var isPasteBin = function (node) { - return node.id === 'mcepastebin'; - }; - editor.on('AfterSetSelectionRange', function (e) { - var rng = e.range; - var parentNode = rng.startContainer.parentNode; - if (!isRangeInCaretContainer(rng) && !isPasteBin(parentNode)) { - hideFakeCaret(); - } - if (!isFakeSelectionElement(parentNode)) { - removeElementSelection(); - } - }); - editor.on('copy', function (e) { - var clipboardData = e.clipboardData; - if (!e.isDefaultPrevented() && e.clipboardData && !Env.ie) { - var realSelectionElement = getRealSelectionElement(); - if (realSelectionElement) { - e.preventDefault(); - clipboardData.clearData(); - clipboardData.setData('text/html', realSelectionElement.outerHTML); - clipboardData.setData('text/plain', realSelectionElement.outerText || realSelectionElement.innerText); - } - } - }); - init(editor); - setup$l(editor); - setup$m(editor); - }; - var isWithinCaretContainer = function (node) { - return isCaretContainer(node) || startsWithCaretContainer(node) || endsWithCaretContainer(node); - }; - var isRangeInCaretContainer = function (rng) { - return isWithinCaretContainer(rng.startContainer) || isWithinCaretContainer(rng.endContainer); - }; - var normalizeShortEndedElementSelection = function (rng) { - var shortEndedElements = editor.schema.getShortEndedElements(); - var newRng = dom.createRng(); - var startContainer = rng.startContainer; - var startOffset = rng.startOffset; - var endContainer = rng.endContainer; - var endOffset = rng.endOffset; - if (has(shortEndedElements, startContainer.nodeName.toLowerCase())) { - if (startOffset === 0) { - newRng.setStartBefore(startContainer); - } else { - newRng.setStartAfter(startContainer); - } - } else { - newRng.setStart(startContainer, startOffset); - } - if (has(shortEndedElements, endContainer.nodeName.toLowerCase())) { - if (endOffset === 0) { - newRng.setEndBefore(endContainer); - } else { - newRng.setEndAfter(endContainer); - } - } else { - newRng.setEnd(endContainer, endOffset); - } - return newRng; - }; - var setupOffscreenSelection = function (node, targetClone, origTargetClone) { - var $ = editor.$; - var $realSelectionContainer = descendant(SugarElement.fromDom(editor.getBody()), '#' + realSelectionId).fold(function () { - return $([]); - }, function (elm) { - return $([elm.dom]); - }); - if ($realSelectionContainer.length === 0) { - $realSelectionContainer = $('
                                      ').attr('id', realSelectionId); - $realSelectionContainer.appendTo(editor.getBody()); - } - var newRange = dom.createRng(); - if (targetClone === origTargetClone && Env.ie) { - $realSelectionContainer.empty().append('

                                      \xA0

                                      ').append(targetClone); - newRange.setStartAfter($realSelectionContainer[0].firstChild.firstChild); - newRange.setEndAfter(targetClone); - } else { - $realSelectionContainer.empty().append(nbsp).append(targetClone).append(nbsp); - newRange.setStart($realSelectionContainer[0].firstChild, 1); - newRange.setEnd($realSelectionContainer[0].lastChild, 0); - } - $realSelectionContainer.css({ top: dom.getPos(node, editor.getBody()).y }); - $realSelectionContainer[0].focus(); - var sel = selection.getSel(); - sel.removeAllRanges(); - sel.addRange(newRange); - return newRange; - }; - var selectElement = function (elm) { - var targetClone = elm.cloneNode(true); - var e = editor.fire('ObjectSelected', { - target: elm, - targetClone: targetClone - }); - if (e.isDefaultPrevented()) { - return null; - } - var range = setupOffscreenSelection(elm, e.targetClone, targetClone); - var nodeElm = SugarElement.fromDom(elm); - each(descendants$1(SugarElement.fromDom(editor.getBody()), '*[data-mce-selected]'), function (elm) { - if (!eq$2(nodeElm, elm)) { - remove$1(elm, elementSelectionAttr); - } - }); - if (!dom.getAttrib(elm, elementSelectionAttr)) { - elm.setAttribute(elementSelectionAttr, '1'); - } - selectedElement = elm; - hideFakeCaret(); - return range; - }; - var setElementSelection = function (range, forward) { - if (!range) { - return null; - } - if (range.collapsed) { - if (!isRangeInCaretContainer(range)) { - var dir = forward ? 1 : -1; - var caretPosition = getNormalizedRangeEndPoint(dir, rootNode, range); - var beforeNode = caretPosition.getNode(!forward); - if (isFakeCaretTarget(beforeNode)) { - return showCaret(dir, beforeNode, forward ? !caretPosition.isAtEnd() : false, false); - } - var afterNode = caretPosition.getNode(forward); - if (isFakeCaretTarget(afterNode)) { - return showCaret(dir, afterNode, forward ? false : !caretPosition.isAtEnd(), false); - } - } - return null; - } - var startContainer = range.startContainer; - var startOffset = range.startOffset; - var endOffset = range.endOffset; - if (startContainer.nodeType === 3 && startOffset === 0 && isContentEditableFalse$b(startContainer.parentNode)) { - startContainer = startContainer.parentNode; - startOffset = dom.nodeIndex(startContainer); - startContainer = startContainer.parentNode; - } - if (startContainer.nodeType !== 1) { - return null; - } - if (endOffset === startOffset + 1 && startContainer === range.endContainer) { - var node = startContainer.childNodes[startOffset]; - if (isFakeSelectionTargetElement(node)) { - return selectElement(node); - } - } - return null; - }; - var removeElementSelection = function () { - if (selectedElement) { - selectedElement.removeAttribute(elementSelectionAttr); - } - descendant(SugarElement.fromDom(editor.getBody()), '#' + realSelectionId).each(remove); - selectedElement = null; - }; - var destroy = function () { - fakeCaret.destroy(); - selectedElement = null; - }; - var hideFakeCaret = function () { - fakeCaret.hide(); - }; - if (Env.ceFalse) { - registerEvents(); - } - return { - showCaret: showCaret, - showBlockCaretContainer: showBlockCaretContainer, - hideFakeCaret: hideFakeCaret, - destroy: destroy - }; - }; - - var Quirks = function (editor) { - var each = Tools.each; - var BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE, dom = editor.dom, selection = editor.selection, parser = editor.parser; - var isGecko = Env.gecko, isIE = Env.ie, isWebKit = Env.webkit; - var mceInternalUrlPrefix = 'data:text/mce-internal,'; - var mceInternalDataType = isIE ? 'Text' : 'URL'; - var setEditorCommandState = function (cmd, state) { - try { - editor.getDoc().execCommand(cmd, false, state); - } catch (ex) { - } - }; - var isDefaultPrevented = function (e) { - return e.isDefaultPrevented(); - }; - var setMceInternalContent = function (e) { - var selectionHtml, internalContent; - if (e.dataTransfer) { - if (editor.selection.isCollapsed() && e.target.tagName === 'IMG') { - selection.select(e.target); - } - selectionHtml = editor.selection.getContent(); - if (selectionHtml.length > 0) { - internalContent = mceInternalUrlPrefix + escape(editor.id) + ',' + escape(selectionHtml); - e.dataTransfer.setData(mceInternalDataType, internalContent); - } - } - }; - var getMceInternalContent = function (e) { - var internalContent; - if (e.dataTransfer) { - internalContent = e.dataTransfer.getData(mceInternalDataType); - if (internalContent && internalContent.indexOf(mceInternalUrlPrefix) >= 0) { - internalContent = internalContent.substr(mceInternalUrlPrefix.length).split(','); - return { - id: unescape(internalContent[0]), - html: unescape(internalContent[1]) - }; - } - } - return null; - }; - var insertClipboardContents = function (content, internal) { - if (editor.queryCommandSupported('mceInsertClipboardContent')) { - editor.execCommand('mceInsertClipboardContent', false, { - content: content, - internal: internal - }); - } else { - editor.execCommand('mceInsertContent', false, content); - } - }; - var emptyEditorWhenDeleting = function () { - var serializeRng = function (rng) { - var body = dom.create('body'); - var contents = rng.cloneContents(); - body.appendChild(contents); - return selection.serializer.serialize(body, { format: 'html' }); - }; - var allContentsSelected = function (rng) { - var selection = serializeRng(rng); - var allRng = dom.createRng(); - allRng.selectNode(editor.getBody()); - var allSelection = serializeRng(allRng); - return selection === allSelection; - }; - editor.on('keydown', function (e) { - var keyCode = e.keyCode; - var isCollapsed, body; - if (!isDefaultPrevented(e) && (keyCode === DELETE || keyCode === BACKSPACE)) { - isCollapsed = editor.selection.isCollapsed(); - body = editor.getBody(); - if (isCollapsed && !dom.isEmpty(body)) { - return; - } - if (!isCollapsed && !allContentsSelected(editor.selection.getRng())) { - return; - } - e.preventDefault(); - editor.setContent(''); - if (body.firstChild && dom.isBlock(body.firstChild)) { - editor.selection.setCursorLocation(body.firstChild, 0); - } else { - editor.selection.setCursorLocation(body, 0); - } - editor.nodeChanged(); - } - }); - }; - var selectAll = function () { - editor.shortcuts.add('meta+a', null, 'SelectAll'); - }; - var inputMethodFocus = function () { - if (!editor.inline) { - dom.bind(editor.getDoc(), 'mousedown mouseup', function (e) { - var rng; - if (e.target === editor.getDoc().documentElement) { - rng = selection.getRng(); - editor.getBody().focus(); - if (e.type === 'mousedown') { - if (isCaretContainer(rng.startContainer)) { - return; - } - selection.placeCaretAt(e.clientX, e.clientY); - } else { - selection.setRng(rng); - } - } - }); - } - }; - var removeHrOnBackspace = function () { - editor.on('keydown', function (e) { - if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) { - if (!editor.getBody().getElementsByTagName('hr').length) { - return; - } - if (selection.isCollapsed() && selection.getRng().startOffset === 0) { - var node = selection.getNode(); - var previousSibling = node.previousSibling; - if (node.nodeName === 'HR') { - dom.remove(node); - e.preventDefault(); - return; - } - if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === 'hr') { - dom.remove(previousSibling); - e.preventDefault(); - } - } - } - }); - }; - var focusBody = function () { - if (!Range.prototype.getClientRects) { - editor.on('mousedown', function (e) { - if (!isDefaultPrevented(e) && e.target.nodeName === 'HTML') { - var body_1 = editor.getBody(); - body_1.blur(); - Delay.setEditorTimeout(editor, function () { - body_1.focus(); - }); - } - }); - } - }; - var selectControlElements = function () { - editor.on('click', function (e) { - var target = e.target; - if (/^(IMG|HR)$/.test(target.nodeName) && dom.getContentEditableParent(target) !== 'false') { - e.preventDefault(); - editor.selection.select(target); - editor.nodeChanged(); - } - if (target.nodeName === 'A' && dom.hasClass(target, 'mce-item-anchor')) { - e.preventDefault(); - selection.select(target); - } - }); - }; - var removeStylesWhenDeletingAcrossBlockElements = function () { - var getAttributeApplyFunction = function () { - var template = dom.getAttribs(selection.getStart().cloneNode(false)); - return function () { - var target = selection.getStart(); - if (target !== editor.getBody()) { - dom.setAttrib(target, 'style', null); - each(template, function (attr) { - target.setAttributeNode(attr.cloneNode(true)); - }); - } - }; - }; - var isSelectionAcrossElements = function () { - return !selection.isCollapsed() && dom.getParent(selection.getStart(), dom.isBlock) !== dom.getParent(selection.getEnd(), dom.isBlock); - }; - editor.on('keypress', function (e) { - var applyAttributes; - if (!isDefaultPrevented(e) && (e.keyCode === 8 || e.keyCode === 46) && isSelectionAcrossElements()) { - applyAttributes = getAttributeApplyFunction(); - editor.getDoc().execCommand('delete', false, null); - applyAttributes(); - e.preventDefault(); - return false; - } - }); - dom.bind(editor.getDoc(), 'cut', function (e) { - var applyAttributes; - if (!isDefaultPrevented(e) && isSelectionAcrossElements()) { - applyAttributes = getAttributeApplyFunction(); - Delay.setEditorTimeout(editor, function () { - applyAttributes(); - }); - } - }); - }; - var disableBackspaceIntoATable = function () { - editor.on('keydown', function (e) { - if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) { - if (selection.isCollapsed() && selection.getRng().startOffset === 0) { - var previousSibling = selection.getNode().previousSibling; - if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === 'table') { - e.preventDefault(); - return false; - } - } - } - }); - }; - var removeBlockQuoteOnBackSpace = function () { - editor.on('keydown', function (e) { - var rng, parent; - if (isDefaultPrevented(e) || e.keyCode !== VK.BACKSPACE) { - return; - } - rng = selection.getRng(); - var container = rng.startContainer; - var offset = rng.startOffset; - var root = dom.getRoot(); - parent = container; - if (!rng.collapsed || offset !== 0) { - return; - } - while (parent && parent.parentNode && parent.parentNode.firstChild === parent && parent.parentNode !== root) { - parent = parent.parentNode; - } - if (parent.tagName === 'BLOCKQUOTE') { - editor.formatter.toggle('blockquote', null, parent); - rng = dom.createRng(); - rng.setStart(container, 0); - rng.setEnd(container, 0); - selection.setRng(rng); - } - }); - }; - var setGeckoEditingOptions = function () { - var setOpts = function () { - setEditorCommandState('StyleWithCSS', false); - setEditorCommandState('enableInlineTableEditing', false); - if (!getObjectResizing(editor)) { - setEditorCommandState('enableObjectResizing', false); - } - }; - if (!isReadOnly(editor)) { - editor.on('BeforeExecCommand mousedown', setOpts); - } - }; - var addBrAfterLastLinks = function () { - var fixLinks = function () { - each(dom.select('a'), function (node) { - var parentNode = node.parentNode; - var root = dom.getRoot(); - if (parentNode.lastChild === node) { - while (parentNode && !dom.isBlock(parentNode)) { - if (parentNode.parentNode.lastChild !== parentNode || parentNode === root) { - return; - } - parentNode = parentNode.parentNode; - } - dom.add(parentNode, 'br', { 'data-mce-bogus': 1 }); - } - }); - }; - editor.on('SetContent ExecCommand', function (e) { - if (e.type === 'setcontent' || e.command === 'mceInsertLink') { - fixLinks(); - } - }); - }; - var setDefaultBlockType = function () { - if (getForcedRootBlock(editor)) { - editor.on('init', function () { - setEditorCommandState('DefaultParagraphSeparator', getForcedRootBlock(editor)); - }); - } - }; - var normalizeSelection = function () { - editor.on('keyup focusin mouseup', function (e) { - if (!VK.modifierPressed(e)) { - selection.normalize(); - } - }, true); - }; - var showBrokenImageIcon = function () { - editor.contentStyles.push('img:-moz-broken {' + '-moz-force-broken-image-icon:1;' + 'min-width:24px;' + 'min-height:24px' + '}'); - }; - var restoreFocusOnKeyDown = function () { - if (!editor.inline) { - editor.on('keydown', function () { - if (document.activeElement === document.body) { - editor.getWin().focus(); - } - }); - } - }; - var bodyHeight = function () { - if (!editor.inline) { - editor.contentStyles.push('body {min-height: 150px}'); - editor.on('click', function (e) { - var rng; - if (e.target.nodeName === 'HTML') { - if (Env.ie > 11) { - editor.getBody().focus(); - return; - } - rng = editor.selection.getRng(); - editor.getBody().focus(); - editor.selection.setRng(rng); - editor.selection.normalize(); - editor.nodeChanged(); - } - }); - } - }; - var blockCmdArrowNavigation = function () { - if (Env.mac) { - editor.on('keydown', function (e) { - if (VK.metaKeyPressed(e) && !e.shiftKey && (e.keyCode === 37 || e.keyCode === 39)) { - e.preventDefault(); - var selection_1 = editor.selection.getSel(); - selection_1.modify('move', e.keyCode === 37 ? 'backward' : 'forward', 'lineboundary'); - } - }); - } - }; - var disableAutoUrlDetect = function () { - setEditorCommandState('AutoUrlDetect', false); - }; - var tapLinksAndImages = function () { - editor.on('click', function (e) { - var elm = e.target; - do { - if (elm.tagName === 'A') { - e.preventDefault(); - return; - } - } while (elm = elm.parentNode); - }); - editor.contentStyles.push('.mce-content-body {-webkit-touch-callout: none}'); - }; - var blockFormSubmitInsideEditor = function () { - editor.on('init', function () { - editor.dom.bind(editor.getBody(), 'submit', function (e) { - e.preventDefault(); - }); - }); - }; - var removeAppleInterchangeBrs = function () { - parser.addNodeFilter('br', function (nodes) { - var i = nodes.length; - while (i--) { - if (nodes[i].attr('class') === 'Apple-interchange-newline') { - nodes[i].remove(); - } - } - }); - }; - var ieInternalDragAndDrop = function () { - editor.on('dragstart', function (e) { - setMceInternalContent(e); - }); - editor.on('drop', function (e) { - if (!isDefaultPrevented(e)) { - var internalContent = getMceInternalContent(e); - if (internalContent && internalContent.id !== editor.id) { - e.preventDefault(); - var rng = fromPoint$1(e.x, e.y, editor.getDoc()); - selection.setRng(rng); - insertClipboardContents(internalContent.html, true); - } - } - }); - }; - var refreshContentEditable = function () { - }; - var isHidden = function () { - if (!isGecko || editor.removed) { - return false; - } - var sel = editor.selection.getSel(); - return !sel || !sel.rangeCount || sel.rangeCount === 0; - }; - removeBlockQuoteOnBackSpace(); - emptyEditorWhenDeleting(); - if (!Env.windowsPhone) { - normalizeSelection(); - } - if (isWebKit) { - inputMethodFocus(); - selectControlElements(); - setDefaultBlockType(); - blockFormSubmitInsideEditor(); - disableBackspaceIntoATable(); - removeAppleInterchangeBrs(); - if (Env.iOS) { - restoreFocusOnKeyDown(); - bodyHeight(); - tapLinksAndImages(); - } else { - selectAll(); - } - } - if (Env.ie >= 11) { - bodyHeight(); - disableBackspaceIntoATable(); - } - if (Env.ie) { - selectAll(); - disableAutoUrlDetect(); - ieInternalDragAndDrop(); - } - if (isGecko) { - removeHrOnBackspace(); - focusBody(); - removeStylesWhenDeletingAcrossBlockElements(); - setGeckoEditingOptions(); - addBrAfterLastLinks(); - showBrokenImageIcon(); - blockCmdArrowNavigation(); - disableBackspaceIntoATable(); - } - return { - refreshContentEditable: refreshContentEditable, - isHidden: isHidden - }; - }; - - var DOM$4 = DOMUtils$1.DOM; - var appendStyle = function (editor, text) { - var body = SugarElement.fromDom(editor.getBody()); - var container = getStyleContainer(getRootNode(body)); - var style = SugarElement.fromTag('style'); - set(style, 'type', 'text/css'); - append(style, SugarElement.fromText(text)); - append(container, style); - editor.on('remove', function () { - remove(style); - }); - }; - var getRootName = function (editor) { - return editor.inline ? editor.getElement().nodeName.toLowerCase() : undefined; - }; - var removeUndefined = function (obj) { - return filter$1(obj, function (v) { - return isUndefined(v) === false; - }); - }; - var mkParserSettings = function (editor) { - var settings = editor.settings; - var blobCache = editor.editorUpload.blobCache; - return removeUndefined({ - allow_conditional_comments: settings.allow_conditional_comments, - allow_html_data_urls: settings.allow_html_data_urls, - allow_svg_data_urls: settings.allow_svg_data_urls, - allow_html_in_named_anchor: settings.allow_html_in_named_anchor, - allow_script_urls: settings.allow_script_urls, - allow_unsafe_link_target: settings.allow_unsafe_link_target, - convert_fonts_to_spans: settings.convert_fonts_to_spans, - fix_list_elements: settings.fix_list_elements, - font_size_legacy_values: settings.font_size_legacy_values, - forced_root_block: settings.forced_root_block, - forced_root_block_attrs: settings.forced_root_block_attrs, - padd_empty_with_br: settings.padd_empty_with_br, - preserve_cdata: settings.preserve_cdata, - remove_trailing_brs: settings.remove_trailing_brs, - inline_styles: settings.inline_styles, - root_name: getRootName(editor), - validate: true, - blob_cache: blobCache, - images_dataimg_filter: settings.images_dataimg_filter - }); - }; - var mkSerializerSettings = function (editor) { - var settings = editor.settings; - return __assign(__assign({}, mkParserSettings(editor)), removeUndefined({ - url_converter: settings.url_converter, - url_converter_scope: settings.url_converter_scope, - element_format: settings.element_format, - entities: settings.entities, - entity_encoding: settings.entity_encoding, - indent: settings.indent, - indent_after: settings.indent_after, - indent_before: settings.indent_before, - block_elements: settings.block_elements, - boolean_attributes: settings.boolean_attributes, - custom_elements: settings.custom_elements, - extended_valid_elements: settings.extended_valid_elements, - invalid_elements: settings.invalid_elements, - invalid_styles: settings.invalid_styles, - move_caret_before_on_enter_elements: settings.move_caret_before_on_enter_elements, - non_empty_elements: settings.non_empty_elements, - schema: settings.schema, - self_closing_elements: settings.self_closing_elements, - short_ended_elements: settings.short_ended_elements, - special: settings.special, - text_block_elements: settings.text_block_elements, - text_inline_elements: settings.text_inline_elements, - valid_children: settings.valid_children, - valid_classes: settings.valid_classes, - valid_elements: settings.valid_elements, - valid_styles: settings.valid_styles, - verify_html: settings.verify_html, - whitespace_elements: settings.whitespace_elements - })); - }; - var createParser = function (editor) { - var parser = DomParser(mkParserSettings(editor), editor.schema); - parser.addAttributeFilter('src,href,style,tabindex', function (nodes, name) { - var i = nodes.length, node, value; - var dom = editor.dom; - var internalName = 'data-mce-' + name; - while (i--) { - node = nodes[i]; - value = node.attr(name); - if (value && !node.attr(internalName)) { - if (value.indexOf('data:') === 0 || value.indexOf('blob:') === 0) { - continue; - } - if (name === 'style') { - value = dom.serializeStyle(dom.parseStyle(value), node.name); - if (!value.length) { - value = null; - } - node.attr(internalName, value); - node.attr(name, value); - } else if (name === 'tabindex') { - node.attr(internalName, value); - node.attr(name, null); - } else { - node.attr(internalName, editor.convertURL(value, name, node.name)); - } - } - } - }); - parser.addNodeFilter('script', function (nodes) { - var i = nodes.length; - while (i--) { - var node = nodes[i]; - var type = node.attr('type') || 'no/type'; - if (type.indexOf('mce-') !== 0) { - node.attr('type', 'mce-' + type); - } - } - }); - if (editor.settings.preserve_cdata) { - parser.addNodeFilter('#cdata', function (nodes) { - var i = nodes.length; - while (i--) { - var node = nodes[i]; - node.type = 8; - node.name = '#comment'; - node.value = '[CDATA[' + editor.dom.encode(node.value) + ']]'; - } - }); - } - parser.addNodeFilter('p,h1,h2,h3,h4,h5,h6,div', function (nodes) { - var i = nodes.length; - var nonEmptyElements = editor.schema.getNonEmptyElements(); - while (i--) { - var node = nodes[i]; - if (node.isEmpty(nonEmptyElements) && node.getAll('br').length === 0) { - node.append(new AstNode('br', 1)).shortEnded = true; - } - } - }); - return parser; - }; - var autoFocus = function (editor) { - if (editor.settings.auto_focus) { - Delay.setEditorTimeout(editor, function () { - var focusEditor; - if (editor.settings.auto_focus === true) { - focusEditor = editor; - } else { - focusEditor = editor.editorManager.get(editor.settings.auto_focus); - } - if (!focusEditor.destroyed) { - focusEditor.focus(); - } - }, 100); - } - }; - var moveSelectionToFirstCaretPosition = function (editor) { - var root = editor.dom.getRoot(); - if (!editor.inline && (!hasAnyRanges(editor) || editor.selection.getStart(true) === root)) { - firstPositionIn(root).each(function (pos) { - var node = pos.getNode(); - var caretPos = isTable(node) ? firstPositionIn(node).getOr(pos) : pos; - if (Env.browser.isIE()) { - storeNative(editor, caretPos.toRange()); - } else { - editor.selection.setRng(caretPos.toRange()); - } - }); - } - }; - var initEditor = function (editor) { - editor.bindPendingEventDelegates(); - editor.initialized = true; - fireInit(editor); - editor.focus(true); - moveSelectionToFirstCaretPosition(editor); - editor.nodeChanged({ initial: true }); - editor.execCallback('init_instance_callback', editor); - autoFocus(editor); - }; - var getStyleSheetLoader = function (editor) { - return editor.inline ? editor.ui.styleSheetLoader : editor.dom.styleSheetLoader; - }; - var loadContentCss = function (editor, css) { - var styleSheetLoader = getStyleSheetLoader(editor); - var loaded = function () { - editor.on('remove', function () { - return styleSheetLoader.unloadAll(css); - }); - initEditor(editor); - }; - styleSheetLoader.loadAll(css, loaded, loaded); - }; - var preInit = function (editor, rtcMode) { - var settings = editor.settings, doc = editor.getDoc(), body = editor.getBody(); - if (!settings.browser_spellcheck && !settings.gecko_spellcheck) { - doc.body.spellcheck = false; - DOM$4.setAttrib(body, 'spellcheck', 'false'); - } - editor.quirks = Quirks(editor); - firePostRender(editor); - var directionality = getDirectionality(editor); - if (directionality !== undefined) { - body.dir = directionality; - } - if (settings.protect) { - editor.on('BeforeSetContent', function (e) { - Tools.each(settings.protect, function (pattern) { - e.content = e.content.replace(pattern, function (str) { - return ''; - }); - }); - }); - } - editor.on('SetContent', function () { - editor.addVisual(editor.getBody()); - }); - if (rtcMode === false) { - editor.load({ - initial: true, - format: 'html' - }); - } - editor.startContent = editor.getContent({ format: 'raw' }); - editor.on('compositionstart compositionend', function (e) { - editor.composing = e.type === 'compositionstart'; - }); - if (editor.contentStyles.length > 0) { - var contentCssText_1 = ''; - Tools.each(editor.contentStyles, function (style) { - contentCssText_1 += style + '\r\n'; - }); - editor.dom.addStyle(contentCssText_1); - } - loadContentCss(editor, editor.contentCSS); - if (settings.content_style) { - appendStyle(editor, settings.content_style); - } - }; - var initContentBody = function (editor, skipWrite) { - var settings = editor.settings; - var targetElm = editor.getElement(); - var doc = editor.getDoc(); - if (!settings.inline) { - editor.getElement().style.visibility = editor.orgVisibility; - } - if (!skipWrite && !editor.inline) { - doc.open(); - doc.write(editor.iframeHTML); - doc.close(); - } - if (editor.inline) { - DOM$4.addClass(targetElm, 'mce-content-body'); - editor.contentDocument = doc = document; - editor.contentWindow = window; - editor.bodyElement = targetElm; - editor.contentAreaContainer = targetElm; - } - var body = editor.getBody(); - body.disabled = true; - editor.readonly = !!settings.readonly; - if (!editor.readonly) { - if (editor.inline && DOM$4.getStyle(body, 'position', true) === 'static') { - body.style.position = 'relative'; - } - body.contentEditable = editor.getParam('content_editable_state', true); - } - body.disabled = false; - editor.editorUpload = EditorUpload(editor); - editor.schema = Schema(settings); - editor.dom = DOMUtils$1(doc, { - keep_values: true, - url_converter: editor.convertURL, - url_converter_scope: editor, - hex_colors: settings.force_hex_style_colors, - update_styles: true, - root_element: editor.inline ? editor.getBody() : null, - collect: function () { - return editor.inline; - }, - schema: editor.schema, - contentCssCors: shouldUseContentCssCors(editor), - referrerPolicy: getReferrerPolicy(editor), - onSetAttrib: function (e) { - editor.fire('SetAttrib', e); - } - }); - editor.parser = createParser(editor); - editor.serializer = DomSerializer(mkSerializerSettings(editor), editor); - editor.selection = EditorSelection(editor.dom, editor.getWin(), editor.serializer, editor); - editor.annotator = Annotator(editor); - editor.formatter = Formatter(editor); - editor.undoManager = UndoManager(editor); - editor._nodeChangeDispatcher = new NodeChange(editor); - editor._selectionOverrides = SelectionOverrides(editor); - setup$9(editor); - setup$j(editor); - if (!isRtc(editor)) { - setup$k(editor); - } - var caret = setup$i(editor); - setup$8(editor, caret); - setup$a(editor); - setup$7(editor); - firePreInit(editor); - setup$5(editor).fold(function () { - preInit(editor, false); - }, function (loadingRtc) { - editor.setProgressState(true); - loadingRtc.then(function (rtcMode) { - editor.setProgressState(false); - preInit(editor, rtcMode); - }); - }); - }; - - var DOM$5 = DOMUtils$1.DOM; - var relaxDomain = function (editor, ifr) { - if (document.domain !== window.location.hostname && Env.browser.isIE()) { - var bodyUuid = uuid('mce'); - editor[bodyUuid] = function () { - initContentBody(editor); - }; - var domainRelaxUrl = 'javascript:(function(){' + 'document.open();document.domain="' + document.domain + '";' + 'var ed = window.parent.tinymce.get("' + editor.id + '");document.write(ed.iframeHTML);' + 'document.close();ed.' + bodyUuid + '(true);})()'; - DOM$5.setAttrib(ifr, 'src', domainRelaxUrl); - return true; - } - return false; - }; - var createIframeElement = function (id, title, height, customAttrs) { - var iframe = SugarElement.fromTag('iframe'); - setAll(iframe, customAttrs); - setAll(iframe, { - id: id + '_ifr', - frameBorder: '0', - allowTransparency: 'true', - title: title - }); - add$3(iframe, 'tox-edit-area__iframe'); - return iframe; - }; - var getIframeHtml = function (editor) { - var iframeHTML = getDocType(editor) + ''; - if (getDocumentBaseUrl(editor) !== editor.documentBaseUrl) { - iframeHTML += ''; - } - iframeHTML += ''; - var bodyId = getBodyId(editor); - var bodyClass = getBodyClass(editor); - if (getContentSecurityPolicy(editor)) { - iframeHTML += ''; - } - iframeHTML += '
                                      '; - return iframeHTML; - }; - var createIframe = function (editor, o) { - var title = editor.editorManager.translate('Rich Text Area. Press ALT-0 for help.'); - var ifr = createIframeElement(editor.id, title, o.height, getIframeAttrs(editor)).dom; - ifr.onload = function () { - ifr.onload = null; - editor.fire('load'); - }; - var isDomainRelaxed = relaxDomain(editor, ifr); - editor.contentAreaContainer = o.iframeContainer; - editor.iframeElement = ifr; - editor.iframeHTML = getIframeHtml(editor); - DOM$5.add(o.iframeContainer, ifr); - return isDomainRelaxed; - }; - var init$1 = function (editor, boxInfo) { - var isDomainRelaxed = createIframe(editor, boxInfo); - if (boxInfo.editorContainer) { - DOM$5.get(boxInfo.editorContainer).style.display = editor.orgDisplay; - editor.hidden = DOM$5.isHidden(boxInfo.editorContainer); - } - editor.getElement().style.display = 'none'; - DOM$5.setAttrib(editor.id, 'aria-hidden', 'true'); - if (!isDomainRelaxed) { - initContentBody(editor); - } - }; - - var DOM$6 = DOMUtils$1.DOM; - var initPlugin = function (editor, initializedPlugins, plugin) { - var Plugin = PluginManager.get(plugin); - var pluginUrl = PluginManager.urls[plugin] || editor.documentBaseUrl.replace(/\/$/, ''); - plugin = Tools.trim(plugin); - if (Plugin && Tools.inArray(initializedPlugins, plugin) === -1) { - Tools.each(PluginManager.dependencies(plugin), function (dep) { - initPlugin(editor, initializedPlugins, dep); - }); - if (editor.plugins[plugin]) { - return; - } - try { - var pluginInstance = new Plugin(editor, pluginUrl, editor.$); - editor.plugins[plugin] = pluginInstance; - if (pluginInstance.init) { - pluginInstance.init(editor, pluginUrl); - initializedPlugins.push(plugin); - } - } catch (e) { - pluginInitError(editor, plugin, e); - } - } - }; - var trimLegacyPrefix = function (name) { - return name.replace(/^\-/, ''); - }; - var initPlugins = function (editor) { - var initializedPlugins = []; - Tools.each(getPlugins(editor).split(/[ ,]/), function (name) { - initPlugin(editor, initializedPlugins, trimLegacyPrefix(name)); - }); - }; - var initIcons = function (editor) { - var iconPackName = Tools.trim(getIconPackName(editor)); - var currentIcons = editor.ui.registry.getAll().icons; - var loadIcons = __assign(__assign({}, IconManager.get('default').icons), IconManager.get(iconPackName).icons); - each$1(loadIcons, function (svgData, icon) { - if (!has(currentIcons, icon)) { - editor.ui.registry.addIcon(icon, svgData); - } - }); - }; - var initTheme = function (editor) { - var theme = getTheme(editor); - if (isString(theme)) { - editor.settings.theme = trimLegacyPrefix(theme); - var Theme = ThemeManager.get(theme); - editor.theme = new Theme(editor, ThemeManager.urls[theme]); - if (editor.theme.init) { - editor.theme.init(editor, ThemeManager.urls[theme] || editor.documentBaseUrl.replace(/\/$/, ''), editor.$); - } - } else { - editor.theme = {}; - } - }; - var renderFromLoadedTheme = function (editor) { - return editor.theme.renderUI(); - }; - var renderFromThemeFunc = function (editor) { - var elm = editor.getElement(); - var theme = getTheme(editor); - var info = theme(editor, elm); - if (info.editorContainer.nodeType) { - info.editorContainer.id = info.editorContainer.id || editor.id + '_parent'; - } - if (info.iframeContainer && info.iframeContainer.nodeType) { - info.iframeContainer.id = info.iframeContainer.id || editor.id + '_iframecontainer'; - } - info.height = info.iframeHeight ? info.iframeHeight : elm.offsetHeight; - return info; - }; - var createThemeFalseResult = function (element) { - return { - editorContainer: element, - iframeContainer: element, - api: {} - }; - }; - var renderThemeFalseIframe = function (targetElement) { - var iframeContainer = DOM$6.create('div'); - DOM$6.insertAfter(iframeContainer, targetElement); - return createThemeFalseResult(iframeContainer); - }; - var renderThemeFalse = function (editor) { - var targetElement = editor.getElement(); - return editor.inline ? createThemeFalseResult(null) : renderThemeFalseIframe(targetElement); - }; - var renderThemeUi = function (editor) { - var elm = editor.getElement(); - editor.orgDisplay = elm.style.display; - if (isString(getTheme(editor))) { - return renderFromLoadedTheme(editor); - } else if (isFunction(getTheme(editor))) { - return renderFromThemeFunc(editor); - } else { - return renderThemeFalse(editor); - } - }; - var augmentEditorUiApi = function (editor, api) { - var uiApiFacade = { - show: Optional.from(api.show).getOr(noop), - hide: Optional.from(api.hide).getOr(noop), - disable: Optional.from(api.disable).getOr(noop), - isDisabled: Optional.from(api.isDisabled).getOr(never), - enable: function () { - if (!editor.mode.isReadOnly()) { - Optional.from(api.enable).map(call); - } - } - }; - editor.ui = __assign(__assign({}, editor.ui), uiApiFacade); - }; - var init$2 = function (editor) { - editor.fire('ScriptsLoaded'); - initIcons(editor); - initTheme(editor); - initPlugins(editor); - var renderInfo = renderThemeUi(editor); - augmentEditorUiApi(editor, Optional.from(renderInfo.api).getOr({})); - var boxInfo = { - editorContainer: renderInfo.editorContainer, - iframeContainer: renderInfo.iframeContainer - }; - editor.editorContainer = boxInfo.editorContainer ? boxInfo.editorContainer : null; - appendContentCssFromSettings(editor); - if (editor.inline) { - return initContentBody(editor); - } else { - return init$1(editor, boxInfo); - } - }; - - var DOM$7 = DOMUtils$1.DOM; - var hasSkipLoadPrefix = function (name) { - return name.charAt(0) === '-'; - }; - var loadLanguage = function (scriptLoader, editor) { - var languageCode = getLanguageCode(editor); - var languageUrl = getLanguageUrl(editor); - if (I18n.hasCode(languageCode) === false && languageCode !== 'en') { - var url_1 = languageUrl !== '' ? languageUrl : editor.editorManager.baseURL + '/langs/' + languageCode + '.js'; - scriptLoader.add(url_1, noop, undefined, function () { - languageLoadError(editor, url_1, languageCode); - }); - } - }; - var loadTheme = function (scriptLoader, editor, suffix, callback) { - var theme = getTheme(editor); - if (isString(theme)) { - if (!hasSkipLoadPrefix(theme) && !ThemeManager.urls.hasOwnProperty(theme)) { - var themeUrl = getThemeUrl(editor); - if (themeUrl) { - ThemeManager.load(theme, editor.documentBaseURI.toAbsolute(themeUrl)); - } else { - ThemeManager.load(theme, 'themes/' + theme + '/theme' + suffix + '.js'); - } - } - scriptLoader.loadQueue(function () { - ThemeManager.waitFor(theme, callback); - }); - } else { - callback(); - } - }; - var getIconsUrlMetaFromUrl = function (editor) { - return Optional.from(getIconsUrl(editor)).filter(function (url) { - return url.length > 0; - }).map(function (url) { - return { - url: url, - name: Optional.none() - }; - }); - }; - var getIconsUrlMetaFromName = function (editor, name, suffix) { - return Optional.from(name).filter(function (name) { - return name.length > 0 && !IconManager.has(name); - }).map(function (name) { - return { - url: editor.editorManager.baseURL + '/icons/' + name + '/icons' + suffix + '.js', - name: Optional.some(name) - }; - }); - }; - var loadIcons = function (scriptLoader, editor, suffix) { - var defaultIconsUrl = getIconsUrlMetaFromName(editor, 'default', suffix); - var customIconsUrl = getIconsUrlMetaFromUrl(editor).orThunk(function () { - return getIconsUrlMetaFromName(editor, getIconPackName(editor), ''); - }); - each(cat([ - defaultIconsUrl, - customIconsUrl - ]), function (urlMeta) { - scriptLoader.add(urlMeta.url, noop, undefined, function () { - iconsLoadError(editor, urlMeta.url, urlMeta.name.getOrUndefined()); - }); - }); - }; - var loadPlugins = function (editor, suffix) { - Tools.each(getExternalPlugins(editor), function (url, name) { - PluginManager.load(name, url, noop, undefined, function () { - pluginLoadError(editor, url, name); - }); - editor.settings.plugins += ' ' + name; - }); - Tools.each(getPlugins(editor).split(/[ ,]/), function (plugin) { - plugin = Tools.trim(plugin); - if (plugin && !PluginManager.urls[plugin]) { - if (hasSkipLoadPrefix(plugin)) { - plugin = plugin.substr(1, plugin.length); - var dependencies = PluginManager.dependencies(plugin); - Tools.each(dependencies, function (depPlugin) { - var defaultSettings = { - prefix: 'plugins/', - resource: depPlugin, - suffix: '/plugin' + suffix + '.js' - }; - var dep = PluginManager.createUrl(defaultSettings, depPlugin); - PluginManager.load(dep.resource, dep, noop, undefined, function () { - pluginLoadError(editor, dep.prefix + dep.resource + dep.suffix, dep.resource); - }); - }); - } else { - var url_2 = { - prefix: 'plugins/', - resource: plugin, - suffix: '/plugin' + suffix + '.js' - }; - PluginManager.load(plugin, url_2, noop, undefined, function () { - pluginLoadError(editor, url_2.prefix + url_2.resource + url_2.suffix, plugin); - }); - } - } - }); - }; - var loadScripts = function (editor, suffix) { - var scriptLoader = ScriptLoader.ScriptLoader; - loadTheme(scriptLoader, editor, suffix, function () { - loadLanguage(scriptLoader, editor); - loadIcons(scriptLoader, editor, suffix); - loadPlugins(editor, suffix); - scriptLoader.loadQueue(function () { - if (!editor.removed) { - init$2(editor); - } - }, editor, function () { - if (!editor.removed) { - init$2(editor); - } - }); - }); - }; - var getStyleSheetLoader$1 = function (element, editor) { - return instance.forElement(element, { - contentCssCors: hasContentCssCors(editor), - referrerPolicy: getReferrerPolicy(editor) - }); - }; - var render = function (editor) { - var id = editor.id; - I18n.setCode(getLanguageCode(editor)); - var readyHandler = function () { - DOM$7.unbind(window, 'ready', readyHandler); - editor.render(); - }; - if (!EventUtils.Event.domLoaded) { - DOM$7.bind(window, 'ready', readyHandler); - return; - } - if (!editor.getElement()) { - return; - } - if (!Env.contentEditable) { - return; - } - var element = SugarElement.fromDom(editor.getElement()); - var snapshot = clone(element); - editor.on('remove', function () { - eachr(element.dom.attributes, function (attr) { - return remove$1(element, attr.name); - }); - setAll(element, snapshot); - }); - editor.ui.styleSheetLoader = getStyleSheetLoader$1(element, editor); - if (!isInline$1(editor)) { - editor.orgVisibility = editor.getElement().style.visibility; - editor.getElement().style.visibility = 'hidden'; - } else { - editor.inline = true; - } - var form = editor.getElement().form || DOM$7.getParent(id, 'form'); - if (form) { - editor.formElement = form; - if (hasHiddenInput(editor) && !isTextareaOrInput(editor.getElement())) { - DOM$7.insertAfter(DOM$7.create('input', { - type: 'hidden', - name: id - }), id); - editor.hasHiddenInput = true; - } - editor.formEventDelegate = function (e) { - editor.fire(e.type, e); - }; - DOM$7.bind(form, 'submit reset', editor.formEventDelegate); - editor.on('reset', function () { - editor.resetContent(); - }); - if (shouldPatchSubmit(editor) && !form.submit.nodeType && !form.submit.length && !form._mceOldSubmit) { - form._mceOldSubmit = form.submit; - form.submit = function () { - editor.editorManager.triggerSave(); - editor.setDirty(false); - return form._mceOldSubmit(form); - }; - } - } - editor.windowManager = WindowManager(editor); - editor.notificationManager = NotificationManager(editor); - if (isEncodingXml(editor)) { - editor.on('GetContent', function (e) { - if (e.save) { - e.content = DOM$7.encode(e.content); - } - }); - } - if (shouldAddFormSubmitTrigger(editor)) { - editor.on('submit', function () { - if (editor.initialized) { - editor.save(); - } - }); - } - if (shouldAddUnloadTrigger(editor)) { - editor._beforeUnload = function () { - if (editor.initialized && !editor.destroyed && !editor.isHidden()) { - editor.save({ - format: 'raw', - no_events: true, - set_dirty: false - }); - } - }; - editor.editorManager.on('BeforeUnload', editor._beforeUnload); - } - editor.editorManager.add(editor); - loadScripts(editor, editor.suffix); - }; - - var addVisual$1 = function (editor, elm) { - return addVisual(editor, elm); - }; - - var legacyPropNames = { - 'font-size': 'size', - 'font-family': 'face' - }; - var getSpecifiedFontProp = function (propName, rootElm, elm) { - var getProperty = function (elm) { - return getRaw(elm, propName).orThunk(function () { - if (name(elm) === 'font') { - return get$1(legacyPropNames, propName).bind(function (legacyPropName) { - return getOpt(elm, legacyPropName); - }); - } else { - return Optional.none(); - } - }); - }; - var isRoot = function (elm) { - return eq$2(SugarElement.fromDom(rootElm), elm); - }; - return closest$2(SugarElement.fromDom(elm), function (elm) { - return getProperty(elm); - }, isRoot); - }; - var normalizeFontFamily = function (fontFamily) { - return fontFamily.replace(/[\'\"\\]/g, '').replace(/,\s+/g, ','); - }; - var getComputedFontProp = function (propName, elm) { - return Optional.from(DOMUtils$1.DOM.getStyle(elm, propName, true)); - }; - var getFontProp = function (propName) { - return function (rootElm, elm) { - return Optional.from(elm).map(SugarElement.fromDom).filter(isElement).bind(function (element) { - return getSpecifiedFontProp(propName, rootElm, element.dom).or(getComputedFontProp(propName, element.dom)); - }).getOr(''); - }; - }; - var getFontSize = getFontProp('font-size'); - var getFontFamily = compose(normalizeFontFamily, getFontProp('font-family')); - - var findFirstCaretElement = function (editor) { - return firstPositionIn(editor.getBody()).map(function (caret) { - var container = caret.container(); - return isText$1(container) ? container.parentNode : container; - }); - }; - var getCaretElement = function (editor) { - return Optional.from(editor.selection.getRng()).bind(function (rng) { - var root = editor.getBody(); - var atStartOfNode = rng.startContainer === root && rng.startOffset === 0; - return atStartOfNode ? Optional.none() : Optional.from(editor.selection.getStart(true)); - }); - }; - var mapRange = function (editor, mapper) { - return getCaretElement(editor).orThunk(curry(findFirstCaretElement, editor)).map(SugarElement.fromDom).filter(isElement).map(mapper); - }; - - var fromFontSizeNumber = function (editor, value) { - if (/^[0-9.]+$/.test(value)) { - var fontSizeNumber = parseInt(value, 10); - if (fontSizeNumber >= 1 && fontSizeNumber <= 7) { - var fontSizes = getFontStyleValues(editor); - var fontClasses = getFontSizeClasses(editor); - if (fontClasses) { - return fontClasses[fontSizeNumber - 1] || value; - } else { - return fontSizes[fontSizeNumber - 1] || value; - } - } else { - return value; - } - } else { - return value; - } - }; - var normalizeFontNames = function (font) { - var fonts = font.split(/\s*,\s*/); - return map(fonts, function (font) { - if (font.indexOf(' ') !== -1 && !(startsWith(font, '"') || startsWith(font, '\''))) { - return '\'' + font + '\''; - } else { - return font; - } - }).join(','); - }; - var fontNameAction = function (editor, value) { - var font = fromFontSizeNumber(editor, value); - editor.formatter.toggle('fontname', { value: normalizeFontNames(font) }); - editor.nodeChanged(); - }; - var fontNameQuery = function (editor) { - return mapRange(editor, function (elm) { - return getFontFamily(editor.getBody(), elm.dom); - }).getOr(''); - }; - var fontSizeAction = function (editor, value) { - editor.formatter.toggle('fontsize', { value: fromFontSizeNumber(editor, value) }); - editor.nodeChanged(); - }; - var fontSizeQuery = function (editor) { - return mapRange(editor, function (elm) { - return getFontSize(editor.getBody(), elm.dom); - }).getOr(''); - }; - - var lineHeightQuery = function (editor) { - return mapRange(editor, function (elm) { - var root = SugarElement.fromDom(editor.getBody()); - var specifiedStyle = closest$2(elm, function (elm) { - return getRaw(elm, 'line-height'); - }, curry(eq$2, root)); - var computedStyle = function () { - var lineHeight = parseFloat(get$5(elm, 'line-height')); - var fontSize = parseFloat(get$5(elm, 'font-size')); - return String(lineHeight / fontSize); - }; - return specifiedStyle.getOrThunk(computedStyle); - }).getOr(''); - }; - var lineHeightAction = function (editor, lineHeight) { - editor.undoManager.transact(function () { - editor.formatter.toggle('lineheight', { value: String(lineHeight) }); - editor.nodeChanged(); - }); - }; - - var processValue = function (value) { - var details; - if (typeof value !== 'string') { - details = Tools.extend({ - paste: value.paste, - data: { paste: value.paste } - }, value); - return { - content: value.content, - details: details - }; - } - return { - content: value, - details: {} - }; - }; - var insertAtCaret$1 = function (editor, value) { - var result = processValue(value); - insertContent(editor, result.content, result.details); - }; - - var each$f = Tools.each; - var map$3 = Tools.map, inArray$2 = Tools.inArray; - var EditorCommands = function () { - function EditorCommands(editor) { - this.commands = { - state: {}, - exec: {}, - value: {} - }; - this.editor = editor; - this.setupCommands(editor); - } - EditorCommands.prototype.execCommand = function (command, ui, value, args) { - var func, state = false; - var self = this; - if (self.editor.removed) { - return; - } - if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(command) && (!args || !args.skip_focus)) { - self.editor.focus(); - } else { - restore(self.editor); - } - args = self.editor.fire('BeforeExecCommand', { - command: command, - ui: ui, - value: value - }); - if (args.isDefaultPrevented()) { - return false; - } - var customCommand = command.toLowerCase(); - if (func = self.commands.exec[customCommand]) { - func(customCommand, ui, value); - self.editor.fire('ExecCommand', { - command: command, - ui: ui, - value: value - }); - return true; - } - each$f(this.editor.plugins, function (p) { - if (p.execCommand && p.execCommand(command, ui, value)) { - self.editor.fire('ExecCommand', { - command: command, - ui: ui, - value: value - }); - state = true; - return false; - } - }); - if (state) { - return state; - } - if (self.editor.theme && self.editor.theme.execCommand && self.editor.theme.execCommand(command, ui, value)) { - self.editor.fire('ExecCommand', { - command: command, - ui: ui, - value: value - }); - return true; - } - try { - state = self.editor.getDoc().execCommand(command, ui, value); - } catch (ex) { - } - if (state) { - self.editor.fire('ExecCommand', { - command: command, - ui: ui, - value: value - }); - return true; - } - return false; - }; - EditorCommands.prototype.queryCommandState = function (command) { - var func; - if (this.editor.quirks.isHidden() || this.editor.removed) { - return; - } - command = command.toLowerCase(); - if (func = this.commands.state[command]) { - return func(command); - } - try { - return this.editor.getDoc().queryCommandState(command); - } catch (ex) { - } - return false; - }; - EditorCommands.prototype.queryCommandValue = function (command) { - var func; - if (this.editor.quirks.isHidden() || this.editor.removed) { - return; - } - command = command.toLowerCase(); - if (func = this.commands.value[command]) { - return func(command); - } - try { - return this.editor.getDoc().queryCommandValue(command); - } catch (ex) { - } - }; - EditorCommands.prototype.addCommands = function (commandList, type) { - if (type === void 0) { - type = 'exec'; - } - var self = this; - each$f(commandList, function (callback, command) { - each$f(command.toLowerCase().split(','), function (command) { - self.commands[type][command] = callback; - }); - }); - }; - EditorCommands.prototype.addCommand = function (command, callback, scope) { - var _this = this; - command = command.toLowerCase(); - this.commands.exec[command] = function (command, ui, value, args) { - return callback.call(scope || _this.editor, ui, value, args); - }; - }; - EditorCommands.prototype.queryCommandSupported = function (command) { - command = command.toLowerCase(); - if (this.commands.exec[command]) { - return true; - } - try { - return this.editor.getDoc().queryCommandSupported(command); - } catch (ex) { - } - return false; - }; - EditorCommands.prototype.addQueryStateHandler = function (command, callback, scope) { - var _this = this; - command = command.toLowerCase(); - this.commands.state[command] = function () { - return callback.call(scope || _this.editor); - }; - }; - EditorCommands.prototype.addQueryValueHandler = function (command, callback, scope) { - var _this = this; - command = command.toLowerCase(); - this.commands.value[command] = function () { - return callback.call(scope || _this.editor); - }; - }; - EditorCommands.prototype.hasCustomCommand = function (command) { - command = command.toLowerCase(); - return !!this.commands.exec[command]; - }; - EditorCommands.prototype.execNativeCommand = function (command, ui, value) { - if (ui === undefined) { - ui = false; - } - if (value === undefined) { - value = null; - } - return this.editor.getDoc().execCommand(command, ui, value); - }; - EditorCommands.prototype.isFormatMatch = function (name) { - return this.editor.formatter.match(name); - }; - EditorCommands.prototype.toggleFormat = function (name, value) { - this.editor.formatter.toggle(name, value ? { value: value } : undefined); - this.editor.nodeChanged(); - }; - EditorCommands.prototype.storeSelection = function (type) { - this.selectionBookmark = this.editor.selection.getBookmark(type); - }; - EditorCommands.prototype.restoreSelection = function () { - this.editor.selection.moveToBookmark(this.selectionBookmark); - }; - EditorCommands.prototype.setupCommands = function (editor) { - var self = this; - this.addCommands({ - 'mceResetDesignMode,mceBeginUndoLevel': function () { - }, - 'mceEndUndoLevel,mceAddUndoLevel': function () { - editor.undoManager.add(); - }, - 'Cut,Copy,Paste': function (command) { - var doc = editor.getDoc(); - var failed; - try { - self.execNativeCommand(command); - } catch (ex) { - failed = true; - } - if (command === 'paste' && !doc.queryCommandEnabled(command)) { - failed = true; - } - if (failed || !doc.queryCommandSupported(command)) { - var msg = editor.translate('Your browser doesn\'t support direct access to the clipboard. ' + 'Please use the Ctrl+X/C/V keyboard shortcuts instead.'); - if (Env.mac) { - msg = msg.replace(/Ctrl\+/g, '\u2318+'); - } - editor.notificationManager.open({ - text: msg, - type: 'error' - }); - } - }, - 'unlink': function () { - if (editor.selection.isCollapsed()) { - var elm = editor.dom.getParent(editor.selection.getStart(), 'a'); - if (elm) { - editor.dom.remove(elm, true); - } - return; - } - editor.formatter.remove('link'); - }, - 'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull,JustifyNone': function (command) { - var align = command.substring(7); - if (align === 'full') { - align = 'justify'; - } - each$f('left,center,right,justify'.split(','), function (name) { - if (align !== name) { - editor.formatter.remove('align' + name); - } - }); - if (align !== 'none') { - self.toggleFormat('align' + align); - } - }, - 'InsertUnorderedList,InsertOrderedList': function (command) { - var listParent; - self.execNativeCommand(command); - var listElm = editor.dom.getParent(editor.selection.getNode(), 'ol,ul'); - if (listElm) { - listParent = listElm.parentNode; - if (/^(H[1-6]|P|ADDRESS|PRE)$/.test(listParent.nodeName)) { - self.storeSelection(); - editor.dom.split(listParent, listElm); - self.restoreSelection(); - } - } - }, - 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function (command) { - self.toggleFormat(command); - }, - 'ForeColor,HiliteColor': function (command, ui, value) { - self.toggleFormat(command, value); - }, - 'FontName': function (command, ui, value) { - fontNameAction(editor, value); - }, - 'FontSize': function (command, ui, value) { - fontSizeAction(editor, value); - }, - 'LineHeight': function (command, ui, value) { - lineHeightAction(editor, value); - }, - 'RemoveFormat': function (command) { - editor.formatter.remove(command); - }, - 'mceBlockQuote': function () { - self.toggleFormat('blockquote'); - }, - 'FormatBlock': function (command, ui, value) { - return self.toggleFormat(value || 'p'); - }, - 'mceCleanup': function () { - var bookmark = editor.selection.getBookmark(); - editor.setContent(editor.getContent()); - editor.selection.moveToBookmark(bookmark); - }, - 'mceRemoveNode': function (command, ui, value) { - var node = value || editor.selection.getNode(); - if (node !== editor.getBody()) { - self.storeSelection(); - editor.dom.remove(node, true); - self.restoreSelection(); - } - }, - 'mceSelectNodeDepth': function (command, ui, value) { - var counter = 0; - editor.dom.getParent(editor.selection.getNode(), function (node) { - if (node.nodeType === 1 && counter++ === value) { - editor.selection.select(node); - return false; - } - }, editor.getBody()); - }, - 'mceSelectNode': function (command, ui, value) { - editor.selection.select(value); - }, - 'mceInsertContent': function (command, ui, value) { - insertAtCaret$1(editor, value); - }, - 'mceInsertRawHTML': function (command, ui, value) { - editor.selection.setContent('tiny_mce_marker'); - var content = editor.getContent(); - editor.setContent(content.replace(/tiny_mce_marker/g, function () { - return value; - })); - }, - 'mceInsertNewLine': function (command, ui, value) { - insert$3(editor, value); - }, - 'mceToggleFormat': function (command, ui, value) { - self.toggleFormat(value); - }, - 'mceSetContent': function (command, ui, value) { - editor.setContent(value); - }, - 'Indent,Outdent': function (command) { - handle(editor, command); - }, - 'mceRepaint': function () { - }, - 'InsertHorizontalRule': function () { - editor.execCommand('mceInsertContent', false, '
                                      '); - }, - 'mceToggleVisualAid': function () { - editor.hasVisual = !editor.hasVisual; - editor.addVisual(); - }, - 'mceReplaceContent': function (command, ui, value) { - editor.execCommand('mceInsertContent', false, value.replace(/\{\$selection\}/g, editor.selection.getContent({ format: 'text' }))); - }, - 'mceInsertLink': function (command, ui, value) { - if (typeof value === 'string') { - value = { href: value }; - } - var anchor = editor.dom.getParent(editor.selection.getNode(), 'a'); - value.href = value.href.replace(/ /g, '%20'); - if (!anchor || !value.href) { - editor.formatter.remove('link'); - } - if (value.href) { - editor.formatter.apply('link', value, anchor); - } - }, - 'selectAll': function () { - var editingHost = editor.dom.getParent(editor.selection.getStart(), isContentEditableTrue); - if (editingHost) { - var rng = editor.dom.createRng(); - rng.selectNodeContents(editingHost); - editor.selection.setRng(rng); - } - }, - 'mceNewDocument': function () { - editor.setContent(''); - }, - 'InsertLineBreak': function (command, ui, value) { - insert$2(editor, value); - return true; - } - }); - var alignStates = function (name) { - return function () { - var selection = editor.selection; - var nodes = selection.isCollapsed() ? [editor.dom.getParent(selection.getNode(), editor.dom.isBlock)] : selection.getSelectedBlocks(); - var matches = map$3(nodes, function (node) { - return !!editor.formatter.matchNode(node, name); - }); - return inArray$2(matches, true) !== -1; - }; - }; - self.addCommands({ - 'JustifyLeft': alignStates('alignleft'), - 'JustifyCenter': alignStates('aligncenter'), - 'JustifyRight': alignStates('alignright'), - 'JustifyFull': alignStates('alignjustify'), - 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function (command) { - return self.isFormatMatch(command); - }, - 'mceBlockQuote': function () { - return self.isFormatMatch('blockquote'); - }, - 'Outdent': function () { - return canOutdent(editor); - }, - 'InsertUnorderedList,InsertOrderedList': function (command) { - var list = editor.dom.getParent(editor.selection.getNode(), 'ul,ol'); - return list && (command === 'insertunorderedlist' && list.tagName === 'UL' || command === 'insertorderedlist' && list.tagName === 'OL'); - } - }, 'state'); - self.addCommands({ - Undo: function () { - editor.undoManager.undo(); - }, - Redo: function () { - editor.undoManager.redo(); - } - }); - self.addQueryValueHandler('FontName', function () { - return fontNameQuery(editor); - }, this); - self.addQueryValueHandler('FontSize', function () { - return fontSizeQuery(editor); - }, this); - self.addQueryValueHandler('LineHeight', function () { - return lineHeightQuery(editor); - }, this); - }; - return EditorCommands; - }(); - - var internalContentEditableAttr = 'data-mce-contenteditable'; - var toggleClass = function (elm, cls, state) { - if (has$2(elm, cls) && state === false) { - remove$4(elm, cls); - } else if (state) { - add$3(elm, cls); - } - }; - var setEditorCommandState = function (editor, cmd, state) { - try { - editor.getDoc().execCommand(cmd, false, String(state)); - } catch (ex) { - } - }; - var setContentEditable = function (elm, state) { - elm.dom.contentEditable = state ? 'true' : 'false'; - }; - var switchOffContentEditableTrue = function (elm) { - each(descendants$1(elm, '*[contenteditable="true"]'), function (elm) { - set(elm, internalContentEditableAttr, 'true'); - setContentEditable(elm, false); - }); - }; - var switchOnContentEditableTrue = function (elm) { - each(descendants$1(elm, '*[' + internalContentEditableAttr + '="true"]'), function (elm) { - remove$1(elm, internalContentEditableAttr); - setContentEditable(elm, true); - }); - }; - var removeFakeSelection = function (editor) { - Optional.from(editor.selection.getNode()).each(function (elm) { - elm.removeAttribute('data-mce-selected'); - }); - }; - var restoreFakeSelection = function (editor) { - editor.selection.setRng(editor.selection.getRng()); - }; - var toggleReadOnly = function (editor, state) { - var body = SugarElement.fromDom(editor.getBody()); - toggleClass(body, 'mce-content-readonly', state); - if (state) { - editor.selection.controlSelection.hideResizeRect(); - editor._selectionOverrides.hideFakeCaret(); - removeFakeSelection(editor); - editor.readonly = true; - setContentEditable(body, false); - switchOffContentEditableTrue(body); - } else { - editor.readonly = false; - setContentEditable(body, true); - switchOnContentEditableTrue(body); - setEditorCommandState(editor, 'StyleWithCSS', false); - setEditorCommandState(editor, 'enableInlineTableEditing', false); - setEditorCommandState(editor, 'enableObjectResizing', false); - if (hasEditorOrUiFocus(editor)) { - editor.focus(); - } - restoreFakeSelection(editor); - editor.nodeChanged(); - } - }; - var isReadOnly$1 = function (editor) { - return editor.readonly; - }; - var registerFilters = function (editor) { - editor.parser.addAttributeFilter('contenteditable', function (nodes) { - if (isReadOnly$1(editor)) { - each(nodes, function (node) { - node.attr(internalContentEditableAttr, node.attr('contenteditable')); - node.attr('contenteditable', 'false'); - }); - } - }); - editor.serializer.addAttributeFilter(internalContentEditableAttr, function (nodes) { - if (isReadOnly$1(editor)) { - each(nodes, function (node) { - node.attr('contenteditable', node.attr(internalContentEditableAttr)); - }); - } - }); - editor.serializer.addTempAttr(internalContentEditableAttr); - }; - var registerReadOnlyContentFilters = function (editor) { - if (editor.serializer) { - registerFilters(editor); - } else { - editor.on('PreInit', function () { - registerFilters(editor); - }); - } - }; - var isClickEvent = function (e) { - return e.type === 'click'; - }; - var getAnchorHrefOpt = function (editor, elm) { - var isRoot = function (elm) { - return eq$2(elm, SugarElement.fromDom(editor.getBody())); - }; - return closest$1(elm, 'a', isRoot).bind(function (a) { - return getOpt(a, 'href'); - }); - }; - var processReadonlyEvents = function (editor, e) { - if (isClickEvent(e) && !VK.metaKeyPressed(e)) { - var elm = SugarElement.fromDom(e.target); - getAnchorHrefOpt(editor, elm).each(function (href) { - e.preventDefault(); - if (/^#/.test(href)) { - var targetEl = editor.dom.select(href + ',[name="' + removeLeading(href, '#') + '"]'); - if (targetEl.length) { - editor.selection.scrollIntoView(targetEl[0], true); - } - } else { - window.open(href, '_blank', 'rel=noopener noreferrer,menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes,scrollbars=yes'); - } - }); - } - }; - var registerReadOnlySelectionBlockers = function (editor) { - editor.on('ShowCaret', function (e) { - if (isReadOnly$1(editor)) { - e.preventDefault(); - } - }); - editor.on('ObjectSelected', function (e) { - if (isReadOnly$1(editor)) { - e.preventDefault(); - } - }); - }; - - var nativeEvents = Tools.makeMap('focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange ' + 'mouseout mouseenter mouseleave wheel keydown keypress keyup input beforeinput contextmenu dragstart dragend dragover ' + 'draggesture dragdrop drop drag submit ' + 'compositionstart compositionend compositionupdate touchstart touchmove touchend touchcancel', ' '); - var EventDispatcher = function () { - function EventDispatcher(settings) { - this.bindings = {}; - this.settings = settings || {}; - this.scope = this.settings.scope || this; - this.toggleEvent = this.settings.toggleEvent || never; - } - EventDispatcher.isNative = function (name) { - return !!nativeEvents[name.toLowerCase()]; - }; - EventDispatcher.prototype.fire = function (nameIn, argsIn) { - var name = nameIn.toLowerCase(); - var args = argsIn || {}; - args.type = name; - if (!args.target) { - args.target = this.scope; - } - if (!args.preventDefault) { - args.preventDefault = function () { - args.isDefaultPrevented = always; - }; - args.stopPropagation = function () { - args.isPropagationStopped = always; - }; - args.stopImmediatePropagation = function () { - args.isImmediatePropagationStopped = always; - }; - args.isDefaultPrevented = never; - args.isPropagationStopped = never; - args.isImmediatePropagationStopped = never; - } - if (this.settings.beforeFire) { - this.settings.beforeFire(args); - } - var handlers = this.bindings[name]; - if (handlers) { - for (var i = 0, l = handlers.length; i < l; i++) { - var callback = handlers[i]; - if (callback.once) { - this.off(name, callback.func); - } - if (args.isImmediatePropagationStopped()) { - args.stopPropagation(); - return args; - } - if (callback.func.call(this.scope, args) === false) { - args.preventDefault(); - return args; - } - } - } - return args; - }; - EventDispatcher.prototype.on = function (name, callback, prepend, extra) { - if (callback === false) { - callback = never; - } - if (callback) { - var wrappedCallback = { func: callback }; - if (extra) { - Tools.extend(wrappedCallback, extra); - } - var names = name.toLowerCase().split(' '); - var i = names.length; - while (i--) { - var currentName = names[i]; - var handlers = this.bindings[currentName]; - if (!handlers) { - handlers = this.bindings[currentName] = []; - this.toggleEvent(currentName, true); - } - if (prepend) { - handlers.unshift(wrappedCallback); - } else { - handlers.push(wrappedCallback); - } - } - } - return this; - }; - EventDispatcher.prototype.off = function (name, callback) { - var _this = this; - if (name) { - var names = name.toLowerCase().split(' '); - var i = names.length; - while (i--) { - var currentName = names[i]; - var handlers = this.bindings[currentName]; - if (!currentName) { - each$1(this.bindings, function (_value, bindingName) { - _this.toggleEvent(bindingName, false); - delete _this.bindings[bindingName]; - }); - return this; - } - if (handlers) { - if (!callback) { - handlers.length = 0; - } else { - var hi = handlers.length; - while (hi--) { - if (handlers[hi].func === callback) { - handlers = handlers.slice(0, hi).concat(handlers.slice(hi + 1)); - this.bindings[currentName] = handlers; - } - } - } - if (!handlers.length) { - this.toggleEvent(name, false); - delete this.bindings[currentName]; - } - } - } - } else { - each$1(this.bindings, function (_value, name) { - _this.toggleEvent(name, false); - }); - this.bindings = {}; - } - return this; - }; - EventDispatcher.prototype.once = function (name, callback, prepend) { - return this.on(name, callback, prepend, { once: true }); - }; - EventDispatcher.prototype.has = function (name) { - name = name.toLowerCase(); - return !(!this.bindings[name] || this.bindings[name].length === 0); - }; - return EventDispatcher; - }(); - - var getEventDispatcher = function (obj) { - if (!obj._eventDispatcher) { - obj._eventDispatcher = new EventDispatcher({ - scope: obj, - toggleEvent: function (name, state) { - if (EventDispatcher.isNative(name) && obj.toggleNativeEvent) { - obj.toggleNativeEvent(name, state); - } - } - }); - } - return obj._eventDispatcher; - }; - var Observable = { - fire: function (name, args, bubble) { - var self = this; - if (self.removed && name !== 'remove' && name !== 'detach') { - return args; - } - var dispatcherArgs = getEventDispatcher(self).fire(name, args); - if (bubble !== false && self.parent) { - var parent_1 = self.parent(); - while (parent_1 && !dispatcherArgs.isPropagationStopped()) { - parent_1.fire(name, dispatcherArgs, false); - parent_1 = parent_1.parent(); - } - } - return dispatcherArgs; - }, - on: function (name, callback, prepend) { - return getEventDispatcher(this).on(name, callback, prepend); - }, - off: function (name, callback) { - return getEventDispatcher(this).off(name, callback); - }, - once: function (name, callback) { - return getEventDispatcher(this).once(name, callback); - }, - hasEventListeners: function (name) { - return getEventDispatcher(this).has(name); - } - }; - - var DOM$8 = DOMUtils$1.DOM; - var customEventRootDelegates; - var getEventTarget = function (editor, eventName) { - if (eventName === 'selectionchange') { - return editor.getDoc(); - } - if (!editor.inline && /^mouse|touch|click|contextmenu|drop|dragover|dragend/.test(eventName)) { - return editor.getDoc().documentElement; - } - var eventRoot = getEventRoot(editor); - if (eventRoot) { - if (!editor.eventRoot) { - editor.eventRoot = DOM$8.select(eventRoot)[0]; - } - return editor.eventRoot; - } - return editor.getBody(); - }; - var isListening = function (editor) { - return !editor.hidden && !isReadOnly$1(editor); - }; - var fireEvent = function (editor, eventName, e) { - if (isListening(editor)) { - editor.fire(eventName, e); - } else if (isReadOnly$1(editor)) { - processReadonlyEvents(editor, e); - } - }; - var bindEventDelegate = function (editor, eventName) { - var delegate; - if (!editor.delegates) { - editor.delegates = {}; - } - if (editor.delegates[eventName] || editor.removed) { - return; - } - var eventRootElm = getEventTarget(editor, eventName); - if (getEventRoot(editor)) { - if (!customEventRootDelegates) { - customEventRootDelegates = {}; - editor.editorManager.on('removeEditor', function () { - if (!editor.editorManager.activeEditor) { - if (customEventRootDelegates) { - each$1(customEventRootDelegates, function (_value, name) { - editor.dom.unbind(getEventTarget(editor, name)); - }); - customEventRootDelegates = null; - } - } - }); - } - if (customEventRootDelegates[eventName]) { - return; - } - delegate = function (e) { - var target = e.target; - var editors = editor.editorManager.get(); - var i = editors.length; - while (i--) { - var body = editors[i].getBody(); - if (body === target || DOM$8.isChildOf(target, body)) { - fireEvent(editors[i], eventName, e); - } - } - }; - customEventRootDelegates[eventName] = delegate; - DOM$8.bind(eventRootElm, eventName, delegate); - } else { - delegate = function (e) { - fireEvent(editor, eventName, e); - }; - DOM$8.bind(eventRootElm, eventName, delegate); - editor.delegates[eventName] = delegate; - } - }; - var EditorObservable = __assign(__assign({}, Observable), { - bindPendingEventDelegates: function () { - var self = this; - Tools.each(self._pendingNativeEvents, function (name) { - bindEventDelegate(self, name); - }); - }, - toggleNativeEvent: function (name, state) { - var self = this; - if (name === 'focus' || name === 'blur') { - return; - } - if (state) { - if (self.initialized) { - bindEventDelegate(self, name); - } else { - if (!self._pendingNativeEvents) { - self._pendingNativeEvents = [name]; - } else { - self._pendingNativeEvents.push(name); - } - } - } else if (self.initialized) { - self.dom.unbind(getEventTarget(self, name), name, self.delegates[name]); - delete self.delegates[name]; - } - }, - unbindAllNativeEvents: function () { - var self = this; - var body = self.getBody(); - var dom = self.dom; - if (self.delegates) { - each$1(self.delegates, function (value, name) { - self.dom.unbind(getEventTarget(self, name), name, value); - }); - delete self.delegates; - } - if (!self.inline && body && dom) { - body.onload = null; - dom.unbind(self.getWin()); - dom.unbind(self.getDoc()); - } - if (dom) { - dom.unbind(body); - dom.unbind(self.getContainer()); - } - } - }); - - var defaultModes = [ - 'design', - 'readonly' - ]; - var switchToMode = function (editor, activeMode, availableModes, mode) { - var oldMode = availableModes[activeMode.get()]; - var newMode = availableModes[mode]; - try { - newMode.activate(); - } catch (e) { - console.error('problem while activating editor mode ' + mode + ':', e); - return; - } - oldMode.deactivate(); - if (oldMode.editorReadOnly !== newMode.editorReadOnly) { - toggleReadOnly(editor, newMode.editorReadOnly); - } - activeMode.set(mode); - fireSwitchMode(editor, mode); - }; - var setMode = function (editor, availableModes, activeMode, mode) { - if (mode === activeMode.get()) { - return; - } else if (!has(availableModes, mode)) { - throw new Error('Editor mode \'' + mode + '\' is invalid'); - } - if (editor.initialized) { - switchToMode(editor, activeMode, availableModes, mode); - } else { - editor.on('init', function () { - return switchToMode(editor, activeMode, availableModes, mode); - }); - } - }; - var registerMode = function (availableModes, mode, api) { - var _a; - if (contains(defaultModes, mode)) { - throw new Error('Cannot override default mode ' + mode); - } - return __assign(__assign({}, availableModes), (_a = {}, _a[mode] = __assign(__assign({}, api), { - deactivate: function () { - try { - api.deactivate(); - } catch (e) { - console.error('problem while deactivating editor mode ' + mode + ':', e); - } - } - }), _a)); - }; - - var create$5 = function (editor) { - var activeMode = Cell('design'); - var availableModes = Cell({ - design: { - activate: noop, - deactivate: noop, - editorReadOnly: false - }, - readonly: { - activate: noop, - deactivate: noop, - editorReadOnly: true - } - }); - registerReadOnlyContentFilters(editor); - registerReadOnlySelectionBlockers(editor); - return { - isReadOnly: function () { - return isReadOnly$1(editor); - }, - set: function (mode) { - return setMode(editor, availableModes.get(), activeMode, mode); - }, - get: function () { - return activeMode.get(); - }, - register: function (mode, api) { - availableModes.set(registerMode(availableModes.get(), mode, api)); - } - }; - }; - - var each$g = Tools.each, explode$3 = Tools.explode; - var keyCodeLookup = { - f1: 112, - f2: 113, - f3: 114, - f4: 115, - f5: 116, - f6: 117, - f7: 118, - f8: 119, - f9: 120, - f10: 121, - f11: 122, - f12: 123 - }; - var modifierNames = Tools.makeMap('alt,ctrl,shift,meta,access'); - var Shortcuts = function () { - function Shortcuts(editor) { - this.shortcuts = {}; - this.pendingPatterns = []; - this.editor = editor; - var self = this; - editor.on('keyup keypress keydown', function (e) { - if ((self.hasModifier(e) || self.isFunctionKey(e)) && !e.isDefaultPrevented()) { - each$g(self.shortcuts, function (shortcut) { - if (self.matchShortcut(e, shortcut)) { - self.pendingPatterns = shortcut.subpatterns.slice(0); - if (e.type === 'keydown') { - self.executeShortcutAction(shortcut); - } - return true; - } - }); - if (self.matchShortcut(e, self.pendingPatterns[0])) { - if (self.pendingPatterns.length === 1) { - if (e.type === 'keydown') { - self.executeShortcutAction(self.pendingPatterns[0]); - } - } - self.pendingPatterns.shift(); - } - } - }); - } - Shortcuts.prototype.add = function (pattern, desc, cmdFunc, scope) { - var self = this; - var func = self.normalizeCommandFunc(cmdFunc); - each$g(explode$3(Tools.trim(pattern)), function (pattern) { - var shortcut = self.createShortcut(pattern, desc, func, scope); - self.shortcuts[shortcut.id] = shortcut; - }); - return true; - }; - Shortcuts.prototype.remove = function (pattern) { - var shortcut = this.createShortcut(pattern); - if (this.shortcuts[shortcut.id]) { - delete this.shortcuts[shortcut.id]; - return true; - } - return false; - }; - Shortcuts.prototype.normalizeCommandFunc = function (cmdFunc) { - var self = this; - var cmd = cmdFunc; - if (typeof cmd === 'string') { - return function () { - self.editor.execCommand(cmd, false, null); - }; - } else if (Tools.isArray(cmd)) { - return function () { - self.editor.execCommand(cmd[0], cmd[1], cmd[2]); - }; - } else { - return cmd; - } - }; - Shortcuts.prototype.parseShortcut = function (pattern) { - var key; - var shortcut = {}; - each$g(explode$3(pattern.toLowerCase(), '+'), function (value) { - if (value in modifierNames) { - shortcut[value] = true; - } else { - if (/^[0-9]{2,}$/.test(value)) { - shortcut.keyCode = parseInt(value, 10); - } else { - shortcut.charCode = value.charCodeAt(0); - shortcut.keyCode = keyCodeLookup[value] || value.toUpperCase().charCodeAt(0); - } - } - }); - var id = [shortcut.keyCode]; - for (key in modifierNames) { - if (shortcut[key]) { - id.push(key); - } else { - shortcut[key] = false; - } - } - shortcut.id = id.join(','); - if (shortcut.access) { - shortcut.alt = true; - if (Env.mac) { - shortcut.ctrl = true; - } else { - shortcut.shift = true; - } - } - if (shortcut.meta) { - if (Env.mac) { - shortcut.meta = true; - } else { - shortcut.ctrl = true; - shortcut.meta = false; - } - } - return shortcut; - }; - Shortcuts.prototype.createShortcut = function (pattern, desc, cmdFunc, scope) { - var shortcuts = Tools.map(explode$3(pattern, '>'), this.parseShortcut); - shortcuts[shortcuts.length - 1] = Tools.extend(shortcuts[shortcuts.length - 1], { - func: cmdFunc, - scope: scope || this.editor - }); - return Tools.extend(shortcuts[0], { - desc: this.editor.translate(desc), - subpatterns: shortcuts.slice(1) - }); - }; - Shortcuts.prototype.hasModifier = function (e) { - return e.altKey || e.ctrlKey || e.metaKey; - }; - Shortcuts.prototype.isFunctionKey = function (e) { - return e.type === 'keydown' && e.keyCode >= 112 && e.keyCode <= 123; - }; - Shortcuts.prototype.matchShortcut = function (e, shortcut) { - if (!shortcut) { - return false; - } - if (shortcut.ctrl !== e.ctrlKey || shortcut.meta !== e.metaKey) { - return false; - } - if (shortcut.alt !== e.altKey || shortcut.shift !== e.shiftKey) { - return false; - } - if (e.keyCode === shortcut.keyCode || e.charCode && e.charCode === shortcut.charCode) { - e.preventDefault(); - return true; - } - return false; - }; - Shortcuts.prototype.executeShortcutAction = function (shortcut) { - return shortcut.func ? shortcut.func.call(shortcut.scope) : null; - }; - return Shortcuts; - }(); - - var create$6 = function () { - var buttons = {}; - var menuItems = {}; - var popups = {}; - var icons = {}; - var contextMenus = {}; - var contextToolbars = {}; - var sidebars = {}; - var add = function (collection, type) { - return function (name, spec) { - return collection[name.toLowerCase()] = __assign(__assign({}, spec), { type: type }); - }; - }; - var addIcon = function (name, svgData) { - return icons[name.toLowerCase()] = svgData; - }; - return { - addButton: add(buttons, 'button'), - addGroupToolbarButton: add(buttons, 'grouptoolbarbutton'), - addToggleButton: add(buttons, 'togglebutton'), - addMenuButton: add(buttons, 'menubutton'), - addSplitButton: add(buttons, 'splitbutton'), - addMenuItem: add(menuItems, 'menuitem'), - addNestedMenuItem: add(menuItems, 'nestedmenuitem'), - addToggleMenuItem: add(menuItems, 'togglemenuitem'), - addAutocompleter: add(popups, 'autocompleter'), - addContextMenu: add(contextMenus, 'contextmenu'), - addContextToolbar: add(contextToolbars, 'contexttoolbar'), - addContextForm: add(contextToolbars, 'contextform'), - addSidebar: add(sidebars, 'sidebar'), - addIcon: addIcon, - getAll: function () { - return { - buttons: buttons, - menuItems: menuItems, - icons: icons, - popups: popups, - contextMenus: contextMenus, - contextToolbars: contextToolbars, - sidebars: sidebars - }; - } - }; - }; - - var registry = function () { - var bridge = create$6(); - return { - addAutocompleter: bridge.addAutocompleter, - addButton: bridge.addButton, - addContextForm: bridge.addContextForm, - addContextMenu: bridge.addContextMenu, - addContextToolbar: bridge.addContextToolbar, - addIcon: bridge.addIcon, - addMenuButton: bridge.addMenuButton, - addMenuItem: bridge.addMenuItem, - addNestedMenuItem: bridge.addNestedMenuItem, - addSidebar: bridge.addSidebar, - addSplitButton: bridge.addSplitButton, - addToggleButton: bridge.addToggleButton, - addGroupToolbarButton: bridge.addGroupToolbarButton, - addToggleMenuItem: bridge.addToggleMenuItem, - getAll: bridge.getAll - }; - }; - - var each$h = Tools.each, trim$4 = Tools.trim; - var queryParts = 'source protocol authority userInfo user password host port relative path directory file query anchor'.split(' '); - var DEFAULT_PORTS = { - ftp: 21, - http: 80, - https: 443, - mailto: 25 - }; - var URI = function () { - function URI(url, settings) { - url = trim$4(url); - this.settings = settings || {}; - var baseUri = this.settings.base_uri; - var self = this; - if (/^([\w\-]+):([^\/]{2})/i.test(url) || /^\s*#/.test(url)) { - self.source = url; - return; - } - var isProtocolRelative = url.indexOf('//') === 0; - if (url.indexOf('/') === 0 && !isProtocolRelative) { - url = (baseUri ? baseUri.protocol || 'http' : 'http') + '://mce_host' + url; - } - if (!/^[\w\-]*:?\/\//.test(url)) { - var baseUrl = this.settings.base_uri ? this.settings.base_uri.path : new URI(document.location.href).directory; - if (this.settings.base_uri && this.settings.base_uri.protocol == '') { - url = '//mce_host' + self.toAbsPath(baseUrl, url); - } else { - var match = /([^#?]*)([#?]?.*)/.exec(url); - url = (baseUri && baseUri.protocol || 'http') + '://mce_host' + self.toAbsPath(baseUrl, match[1]) + match[2]; - } - } - url = url.replace(/@@/g, '(mce_at)'); - var urlMatch = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(url); - each$h(queryParts, function (v, i) { - var part = urlMatch[i]; - if (part) { - part = part.replace(/\(mce_at\)/g, '@@'); - } - self[v] = part; - }); - if (baseUri) { - if (!self.protocol) { - self.protocol = baseUri.protocol; - } - if (!self.userInfo) { - self.userInfo = baseUri.userInfo; - } - if (!self.port && self.host === 'mce_host') { - self.port = baseUri.port; - } - if (!self.host || self.host === 'mce_host') { - self.host = baseUri.host; - } - self.source = ''; - } - if (isProtocolRelative) { - self.protocol = ''; - } - } - URI.parseDataUri = function (uri) { - var type; - var uriComponents = decodeURIComponent(uri).split(','); - var matches = /data:([^;]+)/.exec(uriComponents[0]); - if (matches) { - type = matches[1]; - } - return { - type: type, - data: uriComponents[1] - }; - }; - URI.getDocumentBaseUrl = function (loc) { - var baseUrl; - if (loc.protocol.indexOf('http') !== 0 && loc.protocol !== 'file:') { - baseUrl = loc.href; - } else { - baseUrl = loc.protocol + '//' + loc.host + loc.pathname; - } - if (/^[^:]+:\/\/\/?[^\/]+\//.test(baseUrl)) { - baseUrl = baseUrl.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, ''); - if (!/[\/\\]$/.test(baseUrl)) { - baseUrl += '/'; - } - } - return baseUrl; - }; - URI.prototype.setPath = function (path) { - var pathMatch = /^(.*?)\/?(\w+)?$/.exec(path); - this.path = pathMatch[0]; - this.directory = pathMatch[1]; - this.file = pathMatch[2]; - this.source = ''; - this.getURI(); - }; - URI.prototype.toRelative = function (uri) { - var output; - if (uri === './') { - return uri; - } - var relativeUri = new URI(uri, { base_uri: this }); - if (relativeUri.host !== 'mce_host' && this.host !== relativeUri.host && relativeUri.host || this.port !== relativeUri.port || this.protocol !== relativeUri.protocol && relativeUri.protocol !== '') { - return relativeUri.getURI(); - } - var tu = this.getURI(), uu = relativeUri.getURI(); - if (tu === uu || tu.charAt(tu.length - 1) === '/' && tu.substr(0, tu.length - 1) === uu) { - return tu; - } - output = this.toRelPath(this.path, relativeUri.path); - if (relativeUri.query) { - output += '?' + relativeUri.query; - } - if (relativeUri.anchor) { - output += '#' + relativeUri.anchor; - } - return output; - }; - URI.prototype.toAbsolute = function (uri, noHost) { - var absoluteUri = new URI(uri, { base_uri: this }); - return absoluteUri.getURI(noHost && this.isSameOrigin(absoluteUri)); - }; - URI.prototype.isSameOrigin = function (uri) { - if (this.host == uri.host && this.protocol == uri.protocol) { - if (this.port == uri.port) { - return true; - } - var defaultPort = DEFAULT_PORTS[this.protocol]; - if (defaultPort && (this.port || defaultPort) == (uri.port || defaultPort)) { - return true; - } - } - return false; - }; - URI.prototype.toRelPath = function (base, path) { - var breakPoint = 0, out = '', i, l; - var normalizedBase = base.substring(0, base.lastIndexOf('/')).split('/'); - var items = path.split('/'); - if (normalizedBase.length >= items.length) { - for (i = 0, l = normalizedBase.length; i < l; i++) { - if (i >= items.length || normalizedBase[i] !== items[i]) { - breakPoint = i + 1; - break; - } - } - } - if (normalizedBase.length < items.length) { - for (i = 0, l = items.length; i < l; i++) { - if (i >= normalizedBase.length || normalizedBase[i] !== items[i]) { - breakPoint = i + 1; - break; - } - } - } - if (breakPoint === 1) { - return path; - } - for (i = 0, l = normalizedBase.length - (breakPoint - 1); i < l; i++) { - out += '../'; - } - for (i = breakPoint - 1, l = items.length; i < l; i++) { - if (i !== breakPoint - 1) { - out += '/' + items[i]; - } else { - out += items[i]; - } - } - return out; - }; - URI.prototype.toAbsPath = function (base, path) { - var i, nb = 0, o = [], outPath; - var tr = /\/$/.test(path) ? '/' : ''; - var normalizedBase = base.split('/'); - var normalizedPath = path.split('/'); - each$h(normalizedBase, function (k) { - if (k) { - o.push(k); - } - }); - normalizedBase = o; - for (i = normalizedPath.length - 1, o = []; i >= 0; i--) { - if (normalizedPath[i].length === 0 || normalizedPath[i] === '.') { - continue; - } - if (normalizedPath[i] === '..') { - nb++; - continue; - } - if (nb > 0) { - nb--; - continue; - } - o.push(normalizedPath[i]); - } - i = normalizedBase.length - nb; - if (i <= 0) { - outPath = reverse(o).join('/'); - } else { - outPath = normalizedBase.slice(0, i).join('/') + '/' + reverse(o).join('/'); - } - if (outPath.indexOf('/') !== 0) { - outPath = '/' + outPath; - } - if (tr && outPath.lastIndexOf('/') !== outPath.length - 1) { - outPath += tr; - } - return outPath; - }; - URI.prototype.getURI = function (noProtoHost) { - if (noProtoHost === void 0) { - noProtoHost = false; - } - var s; - if (!this.source || noProtoHost) { - s = ''; - if (!noProtoHost) { - if (this.protocol) { - s += this.protocol + '://'; - } else { - s += '//'; - } - if (this.userInfo) { - s += this.userInfo + '@'; - } - if (this.host) { - s += this.host; - } - if (this.port) { - s += ':' + this.port; - } - } - if (this.path) { - s += this.path; - } - if (this.query) { - s += '?' + this.query; - } - if (this.anchor) { - s += '#' + this.anchor; - } - this.source = s; - } - return this.source; - }; - return URI; - }(); - - var DOM$9 = DOMUtils$1.DOM; - var extend$3 = Tools.extend, each$i = Tools.each; - var resolve$3 = Tools.resolve; - var ie$1 = Env.ie; - var Editor = function () { - function Editor(id, settings, editorManager) { - var _this = this; - this.plugins = {}; - this.contentCSS = []; - this.contentStyles = []; - this.loadedCSS = {}; - this.isNotDirty = false; - this.editorManager = editorManager; - this.documentBaseUrl = editorManager.documentBaseURL; - extend$3(this, EditorObservable); - this.settings = getEditorSettings(this, id, this.documentBaseUrl, editorManager.defaultSettings, settings); - if (this.settings.suffix) { - editorManager.suffix = this.settings.suffix; - } - this.suffix = editorManager.suffix; - if (this.settings.base_url) { - editorManager._setBaseUrl(this.settings.base_url); - } - this.baseUri = editorManager.baseURI; - if (this.settings.referrer_policy) { - ScriptLoader.ScriptLoader._setReferrerPolicy(this.settings.referrer_policy); - DOMUtils$1.DOM.styleSheetLoader._setReferrerPolicy(this.settings.referrer_policy); - } - AddOnManager$1.languageLoad = this.settings.language_load; - AddOnManager$1.baseURL = editorManager.baseURL; - this.id = id; - this.setDirty(false); - this.documentBaseURI = new URI(this.settings.document_base_url, { base_uri: this.baseUri }); - this.baseURI = this.baseUri; - this.inline = !!this.settings.inline; - this.shortcuts = new Shortcuts(this); - this.editorCommands = new EditorCommands(this); - if (this.settings.cache_suffix) { - Env.cacheSuffix = this.settings.cache_suffix.replace(/^[\?\&]+/, ''); - } - this.ui = { - registry: registry(), - styleSheetLoader: undefined, - show: noop, - hide: noop, - enable: noop, - disable: noop, - isDisabled: never - }; - var self = this; - var modeInstance = create$5(self); - this.mode = modeInstance; - this.setMode = modeInstance.set; - editorManager.fire('SetupEditor', { editor: this }); - this.execCallback('setup', this); - this.$ = DomQuery.overrideDefaults(function () { - return { - context: _this.inline ? _this.getBody() : _this.getDoc(), - element: _this.getBody() - }; - }); - } - Editor.prototype.render = function () { - render(this); - }; - Editor.prototype.focus = function (skipFocus) { - focus$1(this, skipFocus); - }; - Editor.prototype.hasFocus = function () { - return hasFocus$1(this); - }; - Editor.prototype.execCallback = function (name) { - var x = []; - for (var _i = 1; _i < arguments.length; _i++) { - x[_i - 1] = arguments[_i]; - } - var self = this; - var callback = self.settings[name], scope; - if (!callback) { - return; - } - if (self.callbackLookup && (scope = self.callbackLookup[name])) { - callback = scope.func; - scope = scope.scope; - } - if (typeof callback === 'string') { - scope = callback.replace(/\.\w+$/, ''); - scope = scope ? resolve$3(scope) : 0; - callback = resolve$3(callback); - self.callbackLookup = self.callbackLookup || {}; - self.callbackLookup[name] = { - func: callback, - scope: scope - }; - } - return callback.apply(scope || self, x); - }; - Editor.prototype.translate = function (text) { - return I18n.translate(text); - }; - Editor.prototype.getParam = function (name, defaultVal, type) { - return getParam(this, name, defaultVal, type); - }; - Editor.prototype.hasPlugin = function (name, loaded) { - var hasPlugin = contains(getPlugins(this).split(/[ ,]/), name); - if (hasPlugin) { - return loaded ? PluginManager.get(name) !== undefined : true; - } else { - return false; - } - }; - Editor.prototype.nodeChanged = function (args) { - this._nodeChangeDispatcher.nodeChanged(args); - }; - Editor.prototype.addCommand = function (name, callback, scope) { - this.editorCommands.addCommand(name, callback, scope); - }; - Editor.prototype.addQueryStateHandler = function (name, callback, scope) { - this.editorCommands.addQueryStateHandler(name, callback, scope); - }; - Editor.prototype.addQueryValueHandler = function (name, callback, scope) { - this.editorCommands.addQueryValueHandler(name, callback, scope); - }; - Editor.prototype.addShortcut = function (pattern, desc, cmdFunc, scope) { - this.shortcuts.add(pattern, desc, cmdFunc, scope); - }; - Editor.prototype.execCommand = function (cmd, ui, value, args) { - return this.editorCommands.execCommand(cmd, ui, value, args); - }; - Editor.prototype.queryCommandState = function (cmd) { - return this.editorCommands.queryCommandState(cmd); - }; - Editor.prototype.queryCommandValue = function (cmd) { - return this.editorCommands.queryCommandValue(cmd); - }; - Editor.prototype.queryCommandSupported = function (cmd) { - return this.editorCommands.queryCommandSupported(cmd); - }; - Editor.prototype.show = function () { - var self = this; - if (self.hidden) { - self.hidden = false; - if (self.inline) { - self.getBody().contentEditable = 'true'; - } else { - DOM$9.show(self.getContainer()); - DOM$9.hide(self.id); - } - self.load(); - self.fire('show'); - } - }; - Editor.prototype.hide = function () { - var self = this, doc = self.getDoc(); - if (!self.hidden) { - if (ie$1 && doc && !self.inline) { - doc.execCommand('SelectAll'); - } - self.save(); - if (self.inline) { - self.getBody().contentEditable = 'false'; - if (self === self.editorManager.focusedEditor) { - self.editorManager.focusedEditor = null; - } - } else { - DOM$9.hide(self.getContainer()); - DOM$9.setStyle(self.id, 'display', self.orgDisplay); - } - self.hidden = true; - self.fire('hide'); - } - }; - Editor.prototype.isHidden = function () { - return !!this.hidden; - }; - Editor.prototype.setProgressState = function (state, time) { - this.fire('ProgressState', { - state: state, - time: time - }); - }; - Editor.prototype.load = function (args) { - var self = this; - var elm = self.getElement(), html; - if (self.removed) { - return ''; - } - if (elm) { - args = args || {}; - args.load = true; - var value = isTextareaOrInput(elm) ? elm.value : elm.innerHTML; - html = self.setContent(value, args); - args.element = elm; - if (!args.no_events) { - self.fire('LoadContent', args); - } - args.element = elm = null; - return html; - } - }; - Editor.prototype.save = function (args) { - var self = this; - var elm = self.getElement(), html, form; - if (!elm || !self.initialized || self.removed) { - return; - } - args = args || {}; - args.save = true; - args.element = elm; - html = args.content = self.getContent(args); - if (!args.no_events) { - self.fire('SaveContent', args); - } - if (args.format === 'raw') { - self.fire('RawSaveContent', args); - } - html = args.content; - if (!isTextareaOrInput(elm)) { - if (args.is_removing || !self.inline) { - elm.innerHTML = html; - } - if (form = DOM$9.getParent(self.id, 'form')) { - each$i(form.elements, function (elm) { - if (elm.name === self.id) { - elm.value = html; - return false; - } - }); - } - } else { - elm.value = html; - } - args.element = elm = null; - if (args.set_dirty !== false) { - self.setDirty(false); - } - return html; - }; - Editor.prototype.setContent = function (content, args) { - return setContent$2(this, content, args); - }; - Editor.prototype.getContent = function (args) { - return getContent$2(this, args); - }; - Editor.prototype.insertContent = function (content, args) { - if (args) { - content = extend$3({ content: content }, args); - } - this.execCommand('mceInsertContent', false, content); - }; - Editor.prototype.resetContent = function (initialContent) { - if (initialContent === undefined) { - setContent$2(this, this.startContent, { format: 'raw' }); - } else { - setContent$2(this, initialContent); - } - this.undoManager.reset(); - this.setDirty(false); - this.nodeChanged(); - }; - Editor.prototype.isDirty = function () { - return !this.isNotDirty; - }; - Editor.prototype.setDirty = function (state) { - var oldState = !this.isNotDirty; - this.isNotDirty = !state; - if (state && state !== oldState) { - this.fire('dirty'); - } - }; - Editor.prototype.getContainer = function () { - var self = this; - if (!self.container) { - self.container = DOM$9.get(self.editorContainer || self.id + '_parent'); - } - return self.container; - }; - Editor.prototype.getContentAreaContainer = function () { - return this.contentAreaContainer; - }; - Editor.prototype.getElement = function () { - if (!this.targetElm) { - this.targetElm = DOM$9.get(this.id); - } - return this.targetElm; - }; - Editor.prototype.getWin = function () { - var self = this; - var elm; - if (!self.contentWindow) { - elm = self.iframeElement; - if (elm) { - self.contentWindow = elm.contentWindow; - } - } - return self.contentWindow; - }; - Editor.prototype.getDoc = function () { - var self = this; - var win; - if (!self.contentDocument) { - win = self.getWin(); - if (win) { - self.contentDocument = win.document; - } - } - return self.contentDocument; - }; - Editor.prototype.getBody = function () { - var doc = this.getDoc(); - return this.bodyElement || (doc ? doc.body : null); - }; - Editor.prototype.convertURL = function (url, name, elm) { - var self = this, settings = self.settings; - if (settings.urlconverter_callback) { - return self.execCallback('urlconverter_callback', url, elm, true, name); - } - if (!settings.convert_urls || elm && elm.nodeName === 'LINK' || url.indexOf('file:') === 0 || url.length === 0) { - return url; - } - if (settings.relative_urls) { - return self.documentBaseURI.toRelative(url); - } - url = self.documentBaseURI.toAbsolute(url, settings.remove_script_host); - return url; - }; - Editor.prototype.addVisual = function (elm) { - addVisual$1(this, elm); - }; - Editor.prototype.remove = function () { - remove$7(this); - }; - Editor.prototype.destroy = function (automatic) { - destroy(this, automatic); - }; - Editor.prototype.uploadImages = function (callback) { - return this.editorUpload.uploadImages(callback); - }; - Editor.prototype._scanForImages = function () { - return this.editorUpload.scanForImages(); - }; - Editor.prototype.addButton = function () { - throw new Error('editor.addButton has been removed in tinymce 5x, use editor.ui.registry.addButton or editor.ui.registry.addToggleButton or editor.ui.registry.addSplitButton instead'); - }; - Editor.prototype.addSidebar = function () { - throw new Error('editor.addSidebar has been removed in tinymce 5x, use editor.ui.registry.addSidebar instead'); - }; - Editor.prototype.addMenuItem = function () { - throw new Error('editor.addMenuItem has been removed in tinymce 5x, use editor.ui.registry.addMenuItem instead'); - }; - Editor.prototype.addContextToolbar = function () { - throw new Error('editor.addContextToolbar has been removed in tinymce 5x, use editor.ui.registry.addContextToolbar instead'); - }; - return Editor; - }(); - - var DOM$a = DOMUtils$1.DOM; - var explode$4 = Tools.explode, each$j = Tools.each, extend$4 = Tools.extend; - var instanceCounter = 0, boundGlobalEvents = false; - var beforeUnloadDelegate; - var legacyEditors = []; - var editors = []; - var isValidLegacyKey = function (id) { - return id !== 'length'; - }; - var globalEventDelegate = function (e) { - var type = e.type; - each$j(EditorManager.get(), function (editor) { - switch (type) { - case 'scroll': - editor.fire('ScrollWindow', e); - break; - case 'resize': - editor.fire('ResizeWindow', e); - break; - } - }); - }; - var toggleGlobalEvents = function (state) { - if (state !== boundGlobalEvents) { - if (state) { - DomQuery(window).on('resize scroll', globalEventDelegate); - } else { - DomQuery(window).off('resize scroll', globalEventDelegate); - } - boundGlobalEvents = state; - } - }; - var removeEditorFromList = function (targetEditor) { - var oldEditors = editors; - delete legacyEditors[targetEditor.id]; - for (var i = 0; i < legacyEditors.length; i++) { - if (legacyEditors[i] === targetEditor) { - legacyEditors.splice(i, 1); - break; - } - } - editors = filter(editors, function (editor) { - return targetEditor !== editor; - }); - if (EditorManager.activeEditor === targetEditor) { - EditorManager.activeEditor = editors.length > 0 ? editors[0] : null; - } - if (EditorManager.focusedEditor === targetEditor) { - EditorManager.focusedEditor = null; - } - return oldEditors.length !== editors.length; - }; - var purgeDestroyedEditor = function (editor) { - if (editor && editor.initialized && !(editor.getContainer() || editor.getBody()).parentNode) { - removeEditorFromList(editor); - editor.unbindAllNativeEvents(); - editor.destroy(true); - editor.removed = true; - editor = null; - } - return editor; - }; - var isQuirksMode = document.compatMode !== 'CSS1Compat'; - var EditorManager = __assign(__assign({}, Observable), { - baseURI: null, - baseURL: null, - defaultSettings: {}, - documentBaseURL: null, - suffix: null, - $: DomQuery, - majorVersion: '5', - minorVersion: '6.2', - releaseDate: '2020-12-08', - editors: legacyEditors, - i18n: I18n, - activeEditor: null, - focusedEditor: null, - settings: {}, - setup: function () { - var self = this; - var baseURL, documentBaseURL, suffix = ''; - documentBaseURL = URI.getDocumentBaseUrl(document.location); - if (/^[^:]+:\/\/\/?[^\/]+\//.test(documentBaseURL)) { - documentBaseURL = documentBaseURL.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, ''); - if (!/[\/\\]$/.test(documentBaseURL)) { - documentBaseURL += '/'; - } - } - var preInit = window.tinymce || window.tinyMCEPreInit; - if (preInit) { - baseURL = preInit.base || preInit.baseURL; - suffix = preInit.suffix; - } else { - var scripts = document.getElementsByTagName('script'); - for (var i = 0; i < scripts.length; i++) { - var src = scripts[i].src || ''; - if (src === '') { - continue; - } - var srcScript = src.substring(src.lastIndexOf('/')); - if (/tinymce(\.full|\.jquery|)(\.min|\.dev|)\.js/.test(src)) { - if (srcScript.indexOf('.min') !== -1) { - suffix = '.min'; - } - baseURL = src.substring(0, src.lastIndexOf('/')); - break; - } - } - if (!baseURL && document.currentScript) { - var src = document.currentScript.src; - if (src.indexOf('.min') !== -1) { - suffix = '.min'; - } - baseURL = src.substring(0, src.lastIndexOf('/')); - } - } - self.baseURL = new URI(documentBaseURL).toAbsolute(baseURL); - self.documentBaseURL = documentBaseURL; - self.baseURI = new URI(self.baseURL); - self.suffix = suffix; - setup$2(self); - }, - overrideDefaults: function (defaultSettings) { - var baseUrl = defaultSettings.base_url; - if (baseUrl) { - this._setBaseUrl(baseUrl); - } - var suffix = defaultSettings.suffix; - if (defaultSettings.suffix) { - this.suffix = suffix; - } - this.defaultSettings = defaultSettings; - var pluginBaseUrls = defaultSettings.plugin_base_urls; - if (pluginBaseUrls !== undefined) { - each$1(pluginBaseUrls, function (pluginBaseUrl, pluginName) { - AddOnManager$1.PluginManager.urls[pluginName] = pluginBaseUrl; - }); - } - }, - init: function (settings) { - var self = this; - var result; - var invalidInlineTargets = Tools.makeMap('area base basefont br col frame hr img input isindex link meta param embed source wbr track ' + 'colgroup option table tbody tfoot thead tr th td script noscript style textarea video audio iframe object menu', ' '); - var isInvalidInlineTarget = function (settings, elm) { - return settings.inline && elm.tagName.toLowerCase() in invalidInlineTargets; - }; - var createId = function (elm) { - var id = elm.id; - if (!id) { - id = get$1(elm, 'name').filter(function (name) { - return !DOM$a.get(name); - }).getOrThunk(DOM$a.uniqueId); - elm.setAttribute('id', id); - } - return id; - }; - var execCallback = function (name) { - var callback = settings[name]; - if (!callback) { - return; - } - return callback.apply(self, Array.prototype.slice.call(arguments, 2)); - }; - var hasClass = function (elm, className) { - return className.constructor === RegExp ? className.test(elm.className) : DOM$a.hasClass(elm, className); - }; - var findTargets = function (settings) { - var targets = []; - if (Env.browser.isIE() && Env.browser.version.major < 11) { - initError('TinyMCE does not support the browser you are using. For a list of supported' + ' browsers please see: https://www.tinymce.com/docs/get-started/system-requirements/'); - return []; - } else if (isQuirksMode) { - initError('Failed to initialize the editor as the document is not in standards mode. ' + 'TinyMCE requires standards mode.'); - return []; - } - if (settings.types) { - each$j(settings.types, function (type) { - targets = targets.concat(DOM$a.select(type.selector)); - }); - return targets; - } else if (settings.selector) { - return DOM$a.select(settings.selector); - } else if (settings.target) { - return [settings.target]; - } - switch (settings.mode) { - case 'exact': - var l = settings.elements || ''; - if (l.length > 0) { - each$j(explode$4(l), function (id) { - var elm = DOM$a.get(id); - if (elm) { - targets.push(elm); - } else { - each$j(document.forms, function (f) { - each$j(f.elements, function (e) { - if (e.name === id) { - id = 'mce_editor_' + instanceCounter++; - DOM$a.setAttrib(e, 'id', id); - targets.push(e); - } - }); - }); - } - }); - } - break; - case 'textareas': - case 'specific_textareas': - each$j(DOM$a.select('textarea'), function (elm) { - if (settings.editor_deselector && hasClass(elm, settings.editor_deselector)) { - return; - } - if (!settings.editor_selector || hasClass(elm, settings.editor_selector)) { - targets.push(elm); - } - }); - break; - } - return targets; - }; - var provideResults = function (editors) { - result = editors; - }; - var initEditors = function () { - var initCount = 0; - var editors = []; - var targets; - var createEditor = function (id, settings, targetElm) { - var editor = new Editor(id, settings, self); - editors.push(editor); - editor.on('init', function () { - if (++initCount === targets.length) { - provideResults(editors); - } - }); - editor.targetElm = editor.targetElm || targetElm; - editor.render(); - }; - DOM$a.unbind(window, 'ready', initEditors); - execCallback('onpageload'); - targets = DomQuery.unique(findTargets(settings)); - if (settings.types) { - each$j(settings.types, function (type) { - Tools.each(targets, function (elm) { - if (DOM$a.is(elm, type.selector)) { - createEditor(createId(elm), extend$4({}, settings, type), elm); - return false; - } - return true; - }); - }); - return; - } - Tools.each(targets, function (elm) { - purgeDestroyedEditor(self.get(elm.id)); - }); - targets = Tools.grep(targets, function (elm) { - return !self.get(elm.id); - }); - if (targets.length === 0) { - provideResults([]); - } else { - each$j(targets, function (elm) { - if (isInvalidInlineTarget(settings, elm)) { - initError('Could not initialize inline editor on invalid inline target element', elm); - } else { - createEditor(createId(elm), settings, elm); - } - }); - } - }; - self.settings = settings; - DOM$a.bind(window, 'ready', initEditors); - return new promiseObj(function (resolve) { - if (result) { - resolve(result); - } else { - provideResults = function (editors) { - resolve(editors); - }; - } - }); - }, - get: function (id) { - if (arguments.length === 0) { - return editors.slice(0); - } else if (isString(id)) { - return find(editors, function (editor) { - return editor.id === id; - }).getOr(null); - } else if (isNumber(id)) { - return editors[id] ? editors[id] : null; - } else { - return null; - } - }, - add: function (editor) { - var self = this; - var existingEditor = legacyEditors[editor.id]; - if (existingEditor === editor) { - return editor; - } - if (self.get(editor.id) === null) { - if (isValidLegacyKey(editor.id)) { - legacyEditors[editor.id] = editor; - } - legacyEditors.push(editor); - editors.push(editor); - } - toggleGlobalEvents(true); - self.activeEditor = editor; - self.fire('AddEditor', { editor: editor }); - if (!beforeUnloadDelegate) { - beforeUnloadDelegate = function (e) { - var event = self.fire('BeforeUnload'); - if (event.returnValue) { - e.preventDefault(); - e.returnValue = event.returnValue; - return event.returnValue; - } - }; - window.addEventListener('beforeunload', beforeUnloadDelegate); - } - return editor; - }, - createEditor: function (id, settings) { - return this.add(new Editor(id, settings, this)); - }, - remove: function (selector) { - var self = this; - var i, editor; - if (!selector) { - for (i = editors.length - 1; i >= 0; i--) { - self.remove(editors[i]); - } - return; - } - if (isString(selector)) { - each$j(DOM$a.select(selector), function (elm) { - editor = self.get(elm.id); - if (editor) { - self.remove(editor); - } - }); - return; - } - editor = selector; - if (isNull(self.get(editor.id))) { - return null; - } - if (removeEditorFromList(editor)) { - self.fire('RemoveEditor', { editor: editor }); - } - if (editors.length === 0) { - window.removeEventListener('beforeunload', beforeUnloadDelegate); - } - editor.remove(); - toggleGlobalEvents(editors.length > 0); - return editor; - }, - execCommand: function (cmd, ui, value) { - var self = this, editor = self.get(value); - switch (cmd) { - case 'mceAddEditor': - if (!self.get(value)) { - new Editor(value, self.settings, self).render(); - } - return true; - case 'mceRemoveEditor': - if (editor) { - editor.remove(); - } - return true; - case 'mceToggleEditor': - if (!editor) { - self.execCommand('mceAddEditor', 0, value); - return true; - } - if (editor.isHidden()) { - editor.show(); - } else { - editor.hide(); - } - return true; - } - if (self.activeEditor) { - return self.activeEditor.execCommand(cmd, ui, value); - } - return false; - }, - triggerSave: function () { - each$j(editors, function (editor) { - editor.save(); - }); - }, - addI18n: function (code, items) { - I18n.add(code, items); - }, - translate: function (text) { - return I18n.translate(text); - }, - setActive: function (editor) { - var activeEditor = this.activeEditor; - if (this.activeEditor !== editor) { - if (activeEditor) { - activeEditor.fire('deactivate', { relatedTarget: editor }); - } - editor.fire('activate', { relatedTarget: activeEditor }); - } - this.activeEditor = editor; - }, - _setBaseUrl: function (baseUrl) { - this.baseURL = new URI(this.documentBaseURL).toAbsolute(baseUrl.replace(/\/+$/, '')); - this.baseURI = new URI(this.baseURL); - } - }); - EditorManager.setup(); - - var min = Math.min, max = Math.max, round$1 = Math.round; - var relativePosition = function (rect, targetRect, rel) { - var x = targetRect.x; - var y = targetRect.y; - var w = rect.w; - var h = rect.h; - var targetW = targetRect.w; - var targetH = targetRect.h; - var relChars = (rel || '').split(''); - if (relChars[0] === 'b') { - y += targetH; - } - if (relChars[1] === 'r') { - x += targetW; - } - if (relChars[0] === 'c') { - y += round$1(targetH / 2); - } - if (relChars[1] === 'c') { - x += round$1(targetW / 2); - } - if (relChars[3] === 'b') { - y -= h; - } - if (relChars[4] === 'r') { - x -= w; - } - if (relChars[3] === 'c') { - y -= round$1(h / 2); - } - if (relChars[4] === 'c') { - x -= round$1(w / 2); - } - return create$7(x, y, w, h); - }; - var findBestRelativePosition = function (rect, targetRect, constrainRect, rels) { - var pos, i; - for (i = 0; i < rels.length; i++) { - pos = relativePosition(rect, targetRect, rels[i]); - if (pos.x >= constrainRect.x && pos.x + pos.w <= constrainRect.w + constrainRect.x && pos.y >= constrainRect.y && pos.y + pos.h <= constrainRect.h + constrainRect.y) { - return rels[i]; - } - } - return null; - }; - var inflate = function (rect, w, h) { - return create$7(rect.x - w, rect.y - h, rect.w + w * 2, rect.h + h * 2); - }; - var intersect = function (rect, cropRect) { - var x1 = max(rect.x, cropRect.x); - var y1 = max(rect.y, cropRect.y); - var x2 = min(rect.x + rect.w, cropRect.x + cropRect.w); - var y2 = min(rect.y + rect.h, cropRect.y + cropRect.h); - if (x2 - x1 < 0 || y2 - y1 < 0) { - return null; - } - return create$7(x1, y1, x2 - x1, y2 - y1); - }; - var clamp$1 = function (rect, clampRect, fixedSize) { - var x1 = rect.x; - var y1 = rect.y; - var x2 = rect.x + rect.w; - var y2 = rect.y + rect.h; - var cx2 = clampRect.x + clampRect.w; - var cy2 = clampRect.y + clampRect.h; - var underflowX1 = max(0, clampRect.x - x1); - var underflowY1 = max(0, clampRect.y - y1); - var overflowX2 = max(0, x2 - cx2); - var overflowY2 = max(0, y2 - cy2); - x1 += underflowX1; - y1 += underflowY1; - if (fixedSize) { - x2 += underflowX1; - y2 += underflowY1; - x1 -= overflowX2; - y1 -= overflowY2; - } - x2 -= overflowX2; - y2 -= overflowY2; - return create$7(x1, y1, x2 - x1, y2 - y1); - }; - var create$7 = function (x, y, w, h) { - return { - x: x, - y: y, - w: w, - h: h - }; - }; - var fromClientRect = function (clientRect) { - return create$7(clientRect.left, clientRect.top, clientRect.width, clientRect.height); - }; - var Rect = { - inflate: inflate, - relativePosition: relativePosition, - findBestRelativePosition: findBestRelativePosition, - intersect: intersect, - clamp: clamp$1, - create: create$7, - fromClientRect: fromClientRect - }; - - var awaiter = function (resolveCb, rejectCb, timeout) { - if (timeout === void 0) { - timeout = 1000; - } - var done = false; - var timer = null; - var complete = function (completer) { - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - if (!done) { - done = true; - if (timer !== null) { - clearTimeout(timer); - timer = null; - } - completer.apply(null, args); - } - }; - }; - var resolve = complete(resolveCb); - var reject = complete(rejectCb); - var start = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - if (!done && timer === null) { - timer = setTimeout(function () { - return reject.apply(null, args); - }, timeout); - } - }; - return { - start: start, - resolve: resolve, - reject: reject - }; - }; - var create$8 = function () { - var tasks = {}; - var resultFns = {}; - var load = function (id, url) { - var loadErrMsg = 'Script at URL "' + url + '" failed to load'; - var runErrMsg = 'Script at URL "' + url + '" did not call `tinymce.Resource.add(\'' + id + '\', data)` within 1 second'; - if (tasks[id] !== undefined) { - return tasks[id]; - } else { - var task = new promiseObj(function (resolve, reject) { - var waiter = awaiter(resolve, reject); - resultFns[id] = waiter.resolve; - ScriptLoader.ScriptLoader.loadScript(url, function () { - return waiter.start(runErrMsg); - }, function () { - return waiter.reject(loadErrMsg); - }); - }); - tasks[id] = task; - return task; - } - }; - var add = function (id, data) { - if (resultFns[id] !== undefined) { - resultFns[id](data); - delete resultFns[id]; - } - tasks[id] = promiseObj.resolve(data); - }; - return { - load: load, - add: add - }; - }; - var Resource = create$8(); - - var each$k = Tools.each, extend$5 = Tools.extend; - var extendClass, initializing; - var Class = function () { - }; - Class.extend = extendClass = function (props) { - var self = this; - var _super = self.prototype; - var Class = function () { - var i, mixins, mixin; - var self = this; - if (!initializing) { - if (self.init) { - self.init.apply(self, arguments); - } - mixins = self.Mixins; - if (mixins) { - i = mixins.length; - while (i--) { - mixin = mixins[i]; - if (mixin.init) { - mixin.init.apply(self, arguments); - } - } - } - } - }; - var dummy = function () { - return this; - }; - var createMethod = function (name, fn) { - return function () { - var self = this; - var tmp = self._super; - self._super = _super[name]; - var ret = fn.apply(self, arguments); - self._super = tmp; - return ret; - }; - }; - initializing = true; - var prototype = new self(); - initializing = false; - if (props.Mixins) { - each$k(props.Mixins, function (mixin) { - for (var name_1 in mixin) { - if (name_1 !== 'init') { - props[name_1] = mixin[name_1]; - } - } - }); - if (_super.Mixins) { - props.Mixins = _super.Mixins.concat(props.Mixins); - } - } - if (props.Methods) { - each$k(props.Methods.split(','), function (name) { - props[name] = dummy; - }); - } - if (props.Properties) { - each$k(props.Properties.split(','), function (name) { - var fieldName = '_' + name; - props[name] = function (value) { - var self = this; - if (value !== undefined) { - self[fieldName] = value; - return self; - } - return self[fieldName]; - }; - }); - } - if (props.Statics) { - each$k(props.Statics, function (func, name) { - Class[name] = func; - }); - } - if (props.Defaults && _super.Defaults) { - props.Defaults = extend$5({}, _super.Defaults, props.Defaults); - } - each$1(props, function (member, name) { - if (typeof member === 'function' && _super[name]) { - prototype[name] = createMethod(name, member); - } else { - prototype[name] = member; - } - }); - Class.prototype = prototype; - Class.constructor = Class; - Class.extend = extendClass; - return Class; - }; - - var min$1 = Math.min, max$1 = Math.max, round$2 = Math.round; - var Color = function (value) { - var self = {}; - var r = 0, g = 0, b = 0; - var rgb2hsv = function (r, g, b) { - var h, s, v; - h = 0; - s = 0; - v = 0; - r = r / 255; - g = g / 255; - b = b / 255; - var minRGB = min$1(r, min$1(g, b)); - var maxRGB = max$1(r, max$1(g, b)); - if (minRGB === maxRGB) { - v = minRGB; - return { - h: 0, - s: 0, - v: v * 100 - }; - } - var d = r === minRGB ? g - b : b === minRGB ? r - g : b - r; - h = r === minRGB ? 3 : b === minRGB ? 1 : 5; - h = 60 * (h - d / (maxRGB - minRGB)); - s = (maxRGB - minRGB) / maxRGB; - v = maxRGB; - return { - h: round$2(h), - s: round$2(s * 100), - v: round$2(v * 100) - }; - }; - var hsvToRgb = function (hue, saturation, brightness) { - hue = (parseInt(hue, 10) || 0) % 360; - saturation = parseInt(saturation, 10) / 100; - brightness = parseInt(brightness, 10) / 100; - saturation = max$1(0, min$1(saturation, 1)); - brightness = max$1(0, min$1(brightness, 1)); - if (saturation === 0) { - r = g = b = round$2(255 * brightness); - return; - } - var side = hue / 60; - var chroma = brightness * saturation; - var x = chroma * (1 - Math.abs(side % 2 - 1)); - var match = brightness - chroma; - switch (Math.floor(side)) { - case 0: - r = chroma; - g = x; - b = 0; - break; - case 1: - r = x; - g = chroma; - b = 0; - break; - case 2: - r = 0; - g = chroma; - b = x; - break; - case 3: - r = 0; - g = x; - b = chroma; - break; - case 4: - r = x; - g = 0; - b = chroma; - break; - case 5: - r = chroma; - g = 0; - b = x; - break; - default: - r = g = b = 0; - } - r = round$2(255 * (r + match)); - g = round$2(255 * (g + match)); - b = round$2(255 * (b + match)); - }; - var toHex = function () { - var hex = function (val) { - val = parseInt(val, 10).toString(16); - return val.length > 1 ? val : '0' + val; - }; - return '#' + hex(r) + hex(g) + hex(b); - }; - var toRgb = function () { - return { - r: r, - g: g, - b: b - }; - }; - var toHsv = function () { - return rgb2hsv(r, g, b); - }; - var parse = function (value) { - var matches; - if (typeof value === 'object') { - if ('r' in value) { - r = value.r; - g = value.g; - b = value.b; - } else if ('v' in value) { - hsvToRgb(value.h, value.s, value.v); - } - } else { - if (matches = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)[^\)]*\)/gi.exec(value)) { - r = parseInt(matches[1], 10); - g = parseInt(matches[2], 10); - b = parseInt(matches[3], 10); - } else if (matches = /#([0-F]{2})([0-F]{2})([0-F]{2})/gi.exec(value)) { - r = parseInt(matches[1], 16); - g = parseInt(matches[2], 16); - b = parseInt(matches[3], 16); - } else if (matches = /#([0-F])([0-F])([0-F])/gi.exec(value)) { - r = parseInt(matches[1] + matches[1], 16); - g = parseInt(matches[2] + matches[2], 16); - b = parseInt(matches[3] + matches[3], 16); - } - } - r = r < 0 ? 0 : r > 255 ? 255 : r; - g = g < 0 ? 0 : g > 255 ? 255 : g; - b = b < 0 ? 0 : b > 255 ? 255 : b; - return self; - }; - if (value) { - parse(value); - } - self.toRgb = toRgb; - self.toHsv = toHsv; - self.toHex = toHex; - self.parse = parse; - return self; - }; - - var serialize = function (obj) { - var data = JSON.stringify(obj); - if (!isString(data)) { - return data; - } - return data.replace(/[\u0080-\uFFFF]/g, function (match) { - var hexCode = match.charCodeAt(0).toString(16); - return '\\u' + '0000'.substring(hexCode.length) + hexCode; - }); - }; - var JSONUtils = { - serialize: serialize, - parse: function (text) { - try { - return JSON.parse(text); - } catch (ex) { - } - } - }; - - var JSONP = { - callbacks: {}, - count: 0, - send: function (settings) { - var self = this, dom = DOMUtils$1.DOM, count = settings.count !== undefined ? settings.count : self.count; - var id = 'tinymce_jsonp_' + count; - self.callbacks[count] = function (json) { - dom.remove(id); - delete self.callbacks[count]; - settings.callback(json); - }; - dom.add(dom.doc.body, 'script', { - id: id, - src: settings.url, - type: 'text/javascript' - }); - self.count++; - } - }; - - var XHR = __assign(__assign({}, Observable), { - send: function (settings) { - var xhr, count = 0; - var ready = function () { - if (!settings.async || xhr.readyState === 4 || count++ > 10000) { - if (settings.success && count < 10000 && xhr.status === 200) { - settings.success.call(settings.success_scope, '' + xhr.responseText, xhr, settings); - } else if (settings.error) { - settings.error.call(settings.error_scope, count > 10000 ? 'TIMED_OUT' : 'GENERAL', xhr, settings); - } - xhr = null; - } else { - Delay.setTimeout(ready, 10); - } - }; - settings.scope = settings.scope || this; - settings.success_scope = settings.success_scope || settings.scope; - settings.error_scope = settings.error_scope || settings.scope; - settings.async = settings.async !== false; - settings.data = settings.data || ''; - XHR.fire('beforeInitialize', { settings: settings }); - xhr = new XMLHttpRequest(); - if (xhr.overrideMimeType) { - xhr.overrideMimeType(settings.content_type); - } - xhr.open(settings.type || (settings.data ? 'POST' : 'GET'), settings.url, settings.async); - if (settings.crossDomain) { - xhr.withCredentials = true; - } - if (settings.content_type) { - xhr.setRequestHeader('Content-Type', settings.content_type); - } - if (settings.requestheaders) { - Tools.each(settings.requestheaders, function (header) { - xhr.setRequestHeader(header.key, header.value); - }); - } - xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); - xhr = XHR.fire('beforeSend', { - xhr: xhr, - settings: settings - }).xhr; - xhr.send(settings.data); - if (!settings.async) { - return ready(); - } - Delay.setTimeout(ready, 10); - } - }); - - var extend$6 = Tools.extend; - var JSONRequest = function () { - function JSONRequest(settings) { - this.settings = extend$6({}, settings); - this.count = 0; - } - JSONRequest.sendRPC = function (o) { - return new JSONRequest().send(o); - }; - JSONRequest.prototype.send = function (args) { - var ecb = args.error, scb = args.success; - var xhrArgs = extend$6(this.settings, args); - xhrArgs.success = function (c, x) { - c = JSONUtils.parse(c); - if (typeof c === 'undefined') { - c = { error: 'JSON Parse error.' }; - } - if (c.error) { - ecb.call(xhrArgs.error_scope || xhrArgs.scope, c.error, x); - } else { - scb.call(xhrArgs.success_scope || xhrArgs.scope, c.result); - } - }; - xhrArgs.error = function (ty, x) { - if (ecb) { - ecb.call(xhrArgs.error_scope || xhrArgs.scope, ty, x); - } - }; - xhrArgs.data = JSONUtils.serialize({ - id: args.id || 'c' + this.count++, - method: args.method, - params: args.params - }); - xhrArgs.content_type = 'application/json'; - XHR.send(xhrArgs); - }; - return JSONRequest; - }(); - - var create$9 = function () { - return function () { - var data = {}; - var keys = []; - var storage = { - getItem: function (key) { - var item = data[key]; - return item ? item : null; - }, - setItem: function (key, value) { - keys.push(key); - data[key] = String(value); - }, - key: function (index) { - return keys[index]; - }, - removeItem: function (key) { - keys = keys.filter(function (k) { - return k === key; - }); - delete data[key]; - }, - clear: function () { - keys = []; - data = {}; - }, - length: 0 - }; - Object.defineProperty(storage, 'length', { - get: function () { - return keys.length; - }, - configurable: false, - enumerable: false - }); - return storage; - }(); - }; - - var localStorage; - try { - var test = '__storage_test__'; - localStorage = window.localStorage; - localStorage.setItem(test, test); - localStorage.removeItem(test); - } catch (e) { - localStorage = create$9(); - } - var LocalStorage = localStorage; - - var publicApi = { - geom: { Rect: Rect }, - util: { - Promise: promiseObj, - Delay: Delay, - Tools: Tools, - VK: VK, - URI: URI, - Class: Class, - EventDispatcher: EventDispatcher, - Observable: Observable, - I18n: I18n, - XHR: XHR, - JSON: JSONUtils, - JSONRequest: JSONRequest, - JSONP: JSONP, - LocalStorage: LocalStorage, - Color: Color - }, - dom: { - EventUtils: EventUtils, - Sizzle: Sizzle, - DomQuery: DomQuery, - TreeWalker: DomTreeWalker, - TextSeeker: TextSeeker, - DOMUtils: DOMUtils$1, - ScriptLoader: ScriptLoader, - RangeUtils: RangeUtils$1, - Serializer: DomSerializer, - StyleSheetLoader: StyleSheetLoader, - ControlSelection: ControlSelection, - BookmarkManager: BookmarkManager$1, - Selection: EditorSelection, - Event: EventUtils.Event - }, - html: { - Styles: Styles, - Entities: Entities, - Node: AstNode, - Schema: Schema, - SaxParser: SaxParser$1, - DomParser: DomParser, - Writer: Writer, - Serializer: HtmlSerializer - }, - Env: Env, - AddOnManager: AddOnManager$1, - Annotator: Annotator, - Formatter: Formatter, - UndoManager: UndoManager, - EditorCommands: EditorCommands, - WindowManager: WindowManager, - NotificationManager: NotificationManager, - EditorObservable: EditorObservable, - Shortcuts: Shortcuts, - Editor: Editor, - FocusManager: FocusManager, - EditorManager: EditorManager, - DOM: DOMUtils$1.DOM, - ScriptLoader: ScriptLoader.ScriptLoader, - PluginManager: PluginManager, - ThemeManager: ThemeManager, - IconManager: IconManager, - Resource: Resource, - trim: Tools.trim, - isArray: Tools.isArray, - is: Tools.is, - toArray: Tools.toArray, - makeMap: Tools.makeMap, - each: Tools.each, - map: Tools.map, - grep: Tools.grep, - inArray: Tools.inArray, - extend: Tools.extend, - create: Tools.create, - walk: Tools.walk, - createNS: Tools.createNS, - resolve: Tools.resolve, - explode: Tools.explode, - _addCacheSuffix: Tools._addCacheSuffix, - isOpera: Env.opera, - isWebKit: Env.webkit, - isIE: Env.ie, - isGecko: Env.gecko, - isMac: Env.mac - }; - var tinymce = Tools.extend(EditorManager, publicApi); - - var exportToModuleLoaders = function (tinymce) { - if (typeof module === 'object') { - try { - module.exports = tinymce; - } catch (_) { - } - } - }; - var exportToWindowGlobal = function (tinymce) { - window.tinymce = tinymce; - window.tinyMCE = tinymce; - }; - exportToWindowGlobal(tinymce); - exportToModuleLoaders(tinymce); - -}()); diff --git a/src/plugin/admin/public/component/pear/module/tools.js b/src/plugin/admin/public/component/pear/module/tools.js new file mode 100644 index 00000000..373ac01e --- /dev/null +++ b/src/plugin/admin/public/component/pear/module/tools.js @@ -0,0 +1,40 @@ +layui.define(['jquery', 'element'], + function (exports) { + + var $ = layui.jquery; + var tools = new function () { + + /** + * @since 防抖算法 + * + * @param fn 要执行的方法 + * @param time 防抖时间参数 + */ + this.debounce = function (fn, time) { + var timer = null + return function () { + var arguments = arguments[0] + if (timer) { + clearTimeout(timer) + } + timer = setTimeout(function () { + fn(arguments) + }, time) + } + } + + // 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('tools', tools); + }) diff --git a/src/plugin/admin/public/component/pear/module/topBar.js b/src/plugin/admin/public/component/pear/module/topBar.js deleted file mode 100644 index e71c586f..00000000 --- a/src/plugin/admin/public/component/pear/module/topBar.js +++ /dev/null @@ -1,13 +0,0 @@ -layui.define(['jquery', 'element','util'], function(exports) { - "use strict"; - - var MOD_NAME = 'topBar', - $ = layui.jquery, - util = layui.util, - element = layui.element; - - var topBar = new function() { - util.fixbar({}); - } - exports(MOD_NAME,topBar); -}); \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/module/treetable.js b/src/plugin/admin/public/component/pear/module/treetable.js deleted file mode 100644 index 264467f0..00000000 --- a/src/plugin/admin/public/component/pear/module/treetable.js +++ /dev/null @@ -1,287 +0,0 @@ -layui.define(['layer', 'table'], function (exports) { - var $ = layui.jquery; - var layer = layui.layer; - var table = layui.table; - - var instances = []; - - var treetable = { - - render: function (param) { - param.method = param.method?param.method:"GET"; - if (!treetable.checkParam(param)) { - return; - } - if (param.data) { - treetable.init(param, param.data); - } else { - if(param.method === 'post' || param.method === 'POST') { - $.post(param.url, param.where, function(res){ - if(param.parseData){ - res = param.parseData(res); - param.data = res.data; - } - treetable.init(param, res.data); - }); - } else { - $.get(param.url, param.where, function(res){ - if(param.parseData){ - res = param.parseData(res); - param.data = res.data; - } - treetable.init(param, res.data); - }); - } - } - }, - // 渲染表格 - init: function (param, data) { - var mData = []; - var doneCallback = param.done; - var tNodes = data; - for (var i = 0; i < tNodes.length; i++) { - var tt = tNodes[i]; - if (!tt.id) { - tt.id = tt[param.treeIdName]; - } - if (!tt.pid) { - tt.pid = tt[param.treePidName] || 0; //变更 - } - } - - /*var sort = function (s_pid, data) { - for (var i = 0; i < data.length; i++) { - if (data[i].pid == s_pid) { - var len = mData.length; - if (len > 0 && mData[len - 1].id == s_pid) { - mData[len - 1].isParent = true; - } - mData.push(data[i]); - sort(data[i].id, data); - } - } - }; - sort(param.treeSpid, tNodes);*/ - - var map = {}; // 变更 - for (var k in data) { - map[data[k].id] = data[k]; - } - for (var j in map) { - if(map[j].pid && map[map[j].pid]) { - var parent = map[map[j].pid]; - if (!parent.children) { - parent.children = []; - parent.isParent = true; - } - parent.children.push(map[j]); - } - } - var tree = []; - for (var l in map) { - if (!map[l].pid || !map[map[l].pid]) { - map[l].isRoot = true; - tree.push(map[l]); - } - } - function travel(item) - { - mData.push(item); - if (item.children) { - for (var g in item.children) { - travel(item.children[g]); - } - } - } - for (var h in tree) { - travel(tree[h]); - } - - param.prevUrl = param.url; - param.url = undefined; - param.data = mData; - param.page = { - count: param.data.length, - limit: param.data.length - }; - param.cols[0][param.treeColIndex].templet = function (d) { - var mId = d.id; - var mPid = d.pid; - var isDir = d.isParent; - var emptyNum = treetable.getEmptyNum(mPid, mData); - var iconHtml = ''; - for (var i = 0; i < emptyNum; i++) { - iconHtml += ''; - } - if (isDir) { - iconHtml += ' '; - } else { - iconHtml += ''; - } - iconHtml += '  '; - var ttype = isDir ? 'dir' : 'file'; - var vg = ''; - return vg + iconHtml + d[param.cols[0][param.treeColIndex].field] + '' - }; - - param.done = function (res, curr, count) { - $(param.elem).next().addClass('treeTable'); - $('.treeTable .layui-table-page').css('display', 'none'); - $(param.elem).next().attr('treeLinkage', param.treeLinkage); - if (param.treeDefaultClose) { - treetable.foldAll(param.elem); - } - if (doneCallback) { - doneCallback(res, curr, count); - } - }; - - // 渲染表格 - table.render(param); - var result = instances.some(item=>item.key===param.elem); - if(!result){ - instances.push({key:param.elem,value:param}); - } - }, - reload: function(elem) { - instances.forEach(function(item){ - if(item.key === elem) { - $(elem).next().remove(); - item.value.data = undefined; - item.value.url = item.value.prevUrl; - treetable.render(item.value); - } - }) - }, - search: function(elem,keyword) { - var $tds = $(elem).next('.treeTable').find('.layui-table-body tbody tr td'); - if (!keyword) { - $tds.css('background-color', 'transparent'); - layer.msg("请输入关键字", {icon: 5}); - return; - } - var searchCount = 0; - $tds.each(function () { - $(this).css('background-color', 'transparent'); - if ($(this).text().indexOf(keyword) >= 0) { - $(this).css('background-color', 'rgba(250,230,160,0.5)'); - if (searchCount == 0) { - $('body,html').stop(true); - $('body,html').animate({scrollTop: $(this).offset().top - 150}, 500); - } - searchCount++; - } - }); - if (searchCount == 0) { - layer.msg("没有匹配结果", {icon: 5}); - } else { - treetable.expandAll(elem); - } - }, - getEmptyNum: function (pid, data) { - var num = 0; - if (!pid) { - return num; - } - var tPid; - for (var i = 0; i < data.length; i++) { - if (pid == data[i].id) { - num += 1; - tPid = data[i].pid; - break; - } - } - return num + treetable.getEmptyNum(tPid, data); - }, - // 展开/折叠行 - toggleRows: function ($dom, linkage) { - var type = $dom.attr('lay-ttype'); - if ('file' == type) { - return; - } - var mId = $dom.attr('lay-tid'); - var isOpen = $dom.hasClass('open'); - if (isOpen) { - $dom.removeClass('open'); - } else { - $dom.addClass('open'); - } - $dom.closest('tbody').find('tr').each(function () { - var $ti = $(this).find('.treeTable-icon'); - var pid = $ti.attr('lay-tpid'); - var ttype = $ti.attr('lay-ttype'); - var tOpen = $ti.hasClass('open'); - if (mId == pid) { - if (isOpen) { - $(this).hide(); - if ('dir' == ttype && tOpen == isOpen) { - $ti.trigger('click'); - } - } else { - $(this).show(); - if (linkage && 'dir' == ttype && tOpen == isOpen) { - $ti.trigger('click'); - } - } - } - }); - }, - // 检查参数 - checkParam: function (param) { - /*if (!param.treeSpid && param.treeSpid != 0) { - layer.msg('参数treeSpid不能为空', {icon: 5}); - return false; - }*/ - - if (!param.treeIdName) { - layer.msg('参数treeIdName不能为空', {icon: 5}); - return false; - } - - if (!param.treePidName) { - layer.msg('参数treePidName不能为空', {icon: 5}); - return false; - } - - if (!param.treeColIndex && param.treeColIndex != 0) { - layer.msg('参数treeColIndex不能为空', {icon: 5}); - return false; - } - return true; - }, - // 展开所有 - expandAll: function (dom) { - $(dom).next('.treeTable').find('.layui-table-body tbody tr').each(function () { - var $ti = $(this).find('.treeTable-icon'); - var ttype = $ti.attr('lay-ttype'); - var tOpen = $ti.hasClass('open'); - if ('dir' == ttype && !tOpen) { - $ti.trigger('click'); - } - }); - }, - // 折叠所有 - foldAll: function (dom) { - $(dom).next('.treeTable').find('.layui-table-body tbody tr').each(function () { - var $ti = $(this).find('.treeTable-icon'); - var ttype = $ti.attr('lay-ttype'); - var tOpen = $ti.hasClass('open'); - if ('dir' == ttype && tOpen) { - $ti.trigger('click'); - } - }); - } - }; - - // 给图标列绑定事件 - $('body').on('click', '.treeTable .treeTable-icon', function () { - var treeLinkage = $(this).parents('.treeTable').attr('treeLinkage'); - if ('true' == treeLinkage) { - treetable.toggleRows($(this), true); - } else { - treetable.toggleRows($(this), false); - } - }); - - exports('treetable', treetable); -}); \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/module/watermark/watermark.js b/src/plugin/admin/public/component/pear/module/watermark/watermark.js deleted file mode 100644 index 6c23455e..00000000 --- a/src/plugin/admin/public/component/pear/module/watermark/watermark.js +++ /dev/null @@ -1,224 +0,0 @@ -/* global Watermark */ -layui.define(['jquery', 'element'], function(exports) { - var $=layui.$; - var _parentEle; - var _wmContainer; - var _wmObserver; - var _wmParentObserver; - var _resizeHandler; - var _windowsWidth = window.outerWidth; - var _windowsHeight = window.outerHeight; - - var _left = 0; - var _top = 0; - - /** - * Create DOM of watermark's container - * @param {Watermark} watermark - */ - var _createContainer = function (watermark) { - watermark._container = document.createElement('div'); - watermark._container.classList.add('cell-watermark-container'); - watermark._container.style.cssText = 'display: block; pointer-events: none;'; - watermark._container.setAttribute('aria-hidden', true); - _parentEle = document.querySelector(watermark.options.appendTo) || document.body; - //获取页面最大宽度 - _windowsWidth = Math.min(_parentEle.scrollWidth, _parentEle.clientWidth); - //获取页面最大高度 - _windowsHeight = Math.min(_parentEle.scrollHeight, _parentEle.clientHeight); - _parentEle.appendChild(watermark._container); - }; - - /** - * Create watermark's DOM - * @param {Watermark} watermark - * @param {Object} options - */ - var _createWatermark = function (watermark, options) { - options.rowSpacing = options.rowSpacing || 60; - options.colSpacing = options.colSpacing || 30; - options.width = options.width || 150; - options.height = options.height || 20; - - let rows = parseInt(_windowsHeight / (options.height + options.rowSpacing)); - let cols = parseInt(_windowsWidth / (options.width + options.colSpacing)); - let offsetLeft =_left+ (_windowsWidth - options.width * cols - options.colSpacing * (cols - 1)) / 2; - let offsetTop = _top+(_windowsHeight - options.height * rows - options.rowSpacing * (rows - 1)) / 2; - let watermarkBase = document.createElement('div'); - watermarkBase.classList.add('cell-watermark'); - watermarkBase.style.cssText = - 'transform: rotate(15deg); opacity: 0.1; font-size: 0.85rem; text-align: center;' + - 'position: absolute; user-select: none; word-break: break-all; overflow: hidden; z-index: 999999;'; - for (let row = 0; row < rows; row++) { - let top = offsetTop + (options.rowSpacing + options.height) * row; - let tempCols = cols; - row % 2 !== 0 && tempCols++; - for (let col = 0; col < tempCols; col++) { - let left = offsetLeft + (options.colSpacing + options.width) * col; - tempCols !== cols && (left -= (options.colSpacing + options.width) / 2); - let watermarkEle = watermarkBase.cloneNode(); - watermarkEle.style.cssText += `left: ${left}px; top: ${top}px; width: ${options.width}px; height: ${options.height}px`; - watermarkEle.style.transform = `rotate(${options.rotate}deg)`; - watermarkEle.style.opacity = options.opacity; - watermarkEle.style.fontSize = `${options.fontSize}rem`; - watermarkEle.style.fontFamily = options.fontFamily; - watermarkEle.innerHTML = options.content; - watermark._container.appendChild(watermarkEle); - } - } - //Backup for recover the watermark's container when the its DOM is removed - _wmContainer = watermark._container; - }; - - /** - * Rerender watermark - * @param {Watermark} watermark - * @param {Object} options - */ - var _render = function (watermark, options) { - _wmObserver.disconnect(); - watermark._container.innerHTML = ''; - _createWatermark(watermark, options); - _wmObserver.observe(watermark._container, { - attributes: true, - childList: true, - characterData: true, - subtree: true - }); - }; - - /** - * Observe watermark and watermark's parentNode mutations - * @param {Watermark} watermark - */ - var _addObserve = function (watermark) { - //Observe watermark element and its child element - _wmObserver = new MutationObserver(function (mutations, observer) { - _render(watermark, watermark.options); - }); - _wmObserver.observe(watermark._container, { - attributes: true, - childList: true, - characterData: true, - subtree: true - }); - //Observe parent element, recreate if the element is deleted - _wmParentObserver = new MutationObserver(function (mutations) { - for (let m of mutations) { - if ( - m.type === 'childList' && - m.removedNodes.length > 0 && - document.querySelectorAll('.cell-watermark-container').length === 0 - ) { - _parentEle.appendChild(_wmContainer); - } - } - }); - _wmParentObserver.observe(watermark._container.parentNode, { - childList: true, - subtree: true - }); - }; - - /** - * Window's resize listener - * @param {Watermark} watermark - */ - var _addResizeListener = function (watermark) { - _resizeHandler = function () { - - //获取页面最大宽度 - var _windowsWidth_n = Math.max(_parentEle.scrollWidth, _parentEle.clientWidth); - //获取页面最大高度 - var _windowsHeight_n = Math.max(_parentEle.scrollHeight, _parentEle.clientHeight); - - - /*if (window.outerHeight !== _windowsHeight || window.outerWidth !== _windowsWidth) { - _windowsHeight = window.outerHeight; - _windowsWidth = window.outerWidth; - _render(watermark, watermark.options); - }*/ - if (_windowsHeight_n !== _windowsHeight || _windowsWidth_n !== _windowsWidth) { - _windowsHeight = _windowsHeight_n; - _windowsWidth = _windowsWidth_n; - _render(watermark, watermark.options); - } - - - }; - window.addEventListener('resize', _resizeHandler); - }; - - /** - * Watermark. - * Create watermark for webpage and automatic adjust when windows resize. - * @param {Object} options - * @param {String} [options.content] watermark's text - * @param {String} [options.appendTo='body'] parent of watermark's container - * @param {Number} [options.width=150] watermark's width. unit: px - * @param {Number} [options.height=20] watermark's height. unit: px - * @param {Number} [options.rowSpacing=60] row spacing of watermarks. unit: px - * @param {Number} [options.colSpacing=30] col spacing of watermarks. unit: px - * @param {Number} [options.rotate=15] watermark's tangent angle. unit: deg - * @param {Number} [options.opacity=0.1] watermark's transparency - * @param {Number} [options.fontSize=0.85] watermark's fontSize. unit: rem - * @param {Number} [options.fontFamily='inherit'] watermark's fontFamily. - * @namespace Watermark - * @class Watermark - * @version 1.0.3 - * @author @Lruihao https://lruihao.cn - */ - function Watermark(options = {}) { - var _proto = Watermark.prototype; - this.options = options; - _createContainer(this); - _createWatermark(this, this.options); - _addObserve(this); - _addResizeListener(this); - - /** - * Upload watermark's text content - * @param {String} content watermark's text - */ - _proto.upload = function (content) { - if (!content) { - return; - } - _wmParentObserver.disconnect(); - _wmObserver.disconnect(); - this.options.content = content; - for (const watermark of this._container.querySelectorAll('.cell-watermark')) { - watermark.innerHTML = content; - } - _wmParentObserver.observe(this._container.parentNode, { - childList: true, - subtree: true - }); - _wmObserver.observe(this._container, { - attributes: true, - childList: true, - characterData: true, - subtree: true - }); - }; - - /** - * Rerender watermark - * @param {Object} options - */ - _proto.render = function (options = {}) { - _render(this, Object.assign(this.options, options)); - }; - - /** - * Force destroy watermark - */ - _proto.destroy = function () { - _wmObserver.disconnect(); - _wmParentObserver.disconnect(); - window.removeEventListener('resize', _resizeHandler); - this._container.parentNode.removeChild(this._container); - }; - } - exports("watermark",Watermark); -}) \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/module/xm-select.js b/src/plugin/admin/public/component/pear/module/xmSelect.js similarity index 99% rename from src/plugin/admin/public/component/pear/module/xm-select.js rename to src/plugin/admin/public/component/pear/module/xmSelect.js index 9b04d5bd..bf44849b 100644 --- a/src/plugin/admin/public/component/pear/module/xm-select.js +++ b/src/plugin/admin/public/component/pear/module/xmSelect.js @@ -1,8 +1,8 @@ -/*! - * @Title: xm-select - * @Version: 1.2.4 - * @Description:基于layui的多选解决方案 - * @Site: https://gitee.com/maplemei/xm-select - * @Author: maplemei - * @License:Apache License 2.0 +/*! + * @Title: xm-select + * @Version: 1.2.4 + * @Description:基于layui的多选解决方案 + * @Site: https://gitee.com/maplemei/xm-select + * @Author: maplemei + * @License:Apache License 2.0 */!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="./",n(n.s=214)}({1:function(e,t,n){"use strict";function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:100,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=this,r=!1;return function(){for(var i=arguments.length,a=new Array(i),l=0;l>>0;for(t&&(n=t),o=new Array(a),r=0;r>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(n=t),o=0;o>>0;if("function"!=typeof e)throw new TypeError;for(var o=[],r=arguments[1],i=0;i>>0,r=arguments[1],i=0;i .xm-tips {\n color: #999999;\n padding: 0 10px;\n position: absolute;\n display: flex;\n height: 100%;\n align-items: center;\n}\nxm-select > .xm-icon {\n display: inline-block;\n overflow: hidden;\n position: absolute;\n width: 0;\n height: 0;\n right: 10px;\n top: 50%;\n margin-top: -3px;\n cursor: pointer;\n border: 6px dashed transparent;\n border-top-color: #C2C2C2;\n border-top-style: solid;\n transition: all 0.3s;\n -webkit-transition: all 0.3s;\n}\nxm-select > .xm-icon-expand {\n margin-top: -9px;\n transform: rotate(180deg);\n}\nxm-select > .xm-label.single-row {\n position: absolute;\n top: 0;\n bottom: 0px;\n left: 0px;\n right: 30px;\n overflow: auto hidden;\n}\nxm-select > .xm-label.single-row .scroll {\n overflow-y: hidden;\n}\nxm-select > .xm-label.single-row .label-content {\n flex-wrap: nowrap;\n white-space: nowrap;\n}\nxm-select > .xm-label.auto-row .label-content {\n flex-wrap: wrap;\n padding-right: 30px !important;\n}\nxm-select > .xm-label.auto-row .xm-label-block > span {\n white-space: unset;\n height: 100%;\n}\nxm-select > .xm-label .scroll .label-content {\n display: flex;\n padding: 3px 10px;\n}\nxm-select > .xm-label .xm-label-block {\n display: flex;\n position: relative;\n padding: 0px 5px;\n margin: 2px 5px 2px 0;\n border-radius: 3px;\n align-items: baseline;\n color: #FFF;\n}\nxm-select > .xm-label .xm-label-block > span {\n display: flex;\n color: #FFF;\n white-space: nowrap;\n}\nxm-select > .xm-label .xm-label-block > i {\n color: #FFF;\n margin-left: 8px;\n font-size: 12px;\n cursor: pointer;\n display: flex;\n}\nxm-select > .xm-label .xm-label-block.disabled {\n background-color: #C2C2C2 !important;\n cursor: no-drop !important;\n}\nxm-select > .xm-label .xm-label-block.disabled > i {\n cursor: no-drop !important;\n}\nxm-select > .xm-body {\n position: absolute;\n left: 0;\n top: 42px;\n padding: 5px 0;\n z-index: 999;\n width: 100%;\n min-width: fit-content;\n border: 1px solid #E6E6E6;\n background-color: #fff;\n border-radius: 2px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);\n animation-name: xm-upbit;\n animation-duration: 0.3s;\n animation-fill-mode: both;\n}\nxm-select > .xm-body .scroll-body {\n overflow-x: hidden;\n overflow-y: auto;\n}\nxm-select > .xm-body .scroll-body::-webkit-scrollbar {\n width: 8px;\n}\nxm-select > .xm-body .scroll-body::-webkit-scrollbar-track {\n -webkit-border-radius: 2em;\n -moz-border-radius: 2em;\n -ms-border-radius: 2em;\n border-radius: 2em;\n background-color: #FFF;\n}\nxm-select > .xm-body .scroll-body::-webkit-scrollbar-thumb {\n -webkit-border-radius: 2em;\n -moz-border-radius: 2em;\n -ms-border-radius: 2em;\n border-radius: 2em;\n background-color: #C2C2C2;\n}\nxm-select > .xm-body.up {\n top: auto;\n bottom: 42px;\n}\nxm-select > .xm-body.relative {\n position: relative;\n display: block !important;\n top: 0;\n box-shadow: none;\n border: none;\n animation-name: none;\n animation-duration: 0;\n min-width: 100%;\n}\nxm-select > .xm-body .xm-group {\n cursor: default;\n}\nxm-select > .xm-body .xm-group-item {\n display: inline-block;\n cursor: pointer;\n padding: 0 10px;\n color: #999;\n font-size: 12px;\n}\nxm-select > .xm-body .xm-option {\n display: flex;\n align-items: center;\n position: relative;\n padding: 0 10px;\n cursor: pointer;\n}\nxm-select > .xm-body .xm-option-icon {\n color: transparent;\n display: flex;\n border: 1px solid #E6E6E6;\n border-radius: 3px;\n justify-content: center;\n align-items: center;\n}\nxm-select > .xm-body .xm-option-icon.xm-custom-icon {\n color: unset;\n border: unset;\n}\nxm-select > .xm-body .xm-option-icon-hidden {\n margin-right: -10px;\n}\nxm-select > .xm-body .xm-option-icon.xm-icon-danx {\n border-radius: 100%;\n}\nxm-select > .xm-body .xm-option-content {\n display: flex;\n position: relative;\n padding-left: 15px;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n color: #666;\n width: calc(100% - 20px);\n}\nxm-select > .xm-body .xm-option.hide-icon .xm-option-content {\n padding-left: 0;\n}\nxm-select > .xm-body .xm-option.selected.hide-icon .xm-option-content {\n color: #FFF !important;\n}\nxm-select > .xm-body .xm-option .loader {\n width: 0.8em;\n height: 0.8em;\n margin-right: 6px;\n color: #C2C2C2;\n}\nxm-select > .xm-body .xm-select-empty {\n text-align: center;\n color: #999;\n}\nxm-select > .xm-body .disabled {\n cursor: no-drop;\n}\nxm-select > .xm-body .disabled:hover {\n background-color: #FFF;\n}\nxm-select > .xm-body .disabled .xm-option-icon {\n border-color: #C2C2C2 !important;\n}\nxm-select > .xm-body .disabled .xm-option-content {\n color: #C2C2C2 !important;\n}\nxm-select > .xm-body .disabled.selected > .xm-option-icon {\n color: #C2C2C2 !important;\n}\nxm-select > .xm-body .xm-search {\n background-color: #FFF !important;\n position: relative;\n padding: 0 10px;\n margin-bottom: 5px;\n cursor: pointer;\n}\nxm-select > .xm-body .xm-search > i {\n position: absolute;\n color: #666;\n}\nxm-select > .xm-body .xm-search-input {\n border: none;\n border-bottom: 1px solid #E6E6E6;\n padding-left: 27px;\n cursor: text;\n}\nxm-select > .xm-body .xm-paging {\n padding: 0 10px;\n display: flex;\n margin-top: 5px;\n}\nxm-select > .xm-body .xm-paging > span:first-child {\n border-radius: 2px 0 0 2px;\n}\nxm-select > .xm-body .xm-paging > span:last-child {\n border-radius: 0 2px 2px 0;\n}\nxm-select > .xm-body .xm-paging > span {\n display: flex;\n flex: auto;\n justify-content: center;\n vertical-align: middle;\n margin: 0 -1px 0 0;\n background-color: #fff;\n color: #333;\n font-size: 12px;\n border: 1px solid #e2e2e2;\n flex-wrap: nowrap;\n width: 100%;\n overflow: hidden;\n min-width: 50px;\n}\nxm-select > .xm-body .xm-toolbar {\n padding: 0 10px;\n display: flex;\n margin: -3px 0;\n cursor: default;\n}\nxm-select > .xm-body .xm-toolbar .toolbar-tag {\n cursor: pointer;\n display: flex;\n margin-right: 20px;\n color: #666;\n align-items: baseline;\n}\nxm-select > .xm-body .xm-toolbar .toolbar-tag:hover {\n opacity: 0.8;\n}\nxm-select > .xm-body .xm-toolbar .toolbar-tag:active {\n opacity: 1;\n}\nxm-select > .xm-body .xm-toolbar .toolbar-tag > i {\n margin-right: 2px;\n font-size: 14px;\n}\nxm-select > .xm-body .xm-toolbar .toolbar-tag:last-child {\n margin-right: 0;\n}\nxm-select > .xm-body .xm-body-custom {\n line-height: initial;\n cursor: default;\n}\nxm-select > .xm-body .xm-body-custom * {\n box-sizing: initial;\n}\nxm-select > .xm-body .xm-tree {\n position: relative;\n}\nxm-select > .xm-body .xm-tree-icon {\n display: inline-block;\n margin-right: 3px;\n cursor: pointer;\n border: 6px dashed transparent;\n border-left-color: #C2C2C2;\n border-left-style: solid;\n transition: all 0.3s;\n -webkit-transition: all 0.3s;\n z-index: 2;\n visibility: hidden;\n}\nxm-select > .xm-body .xm-tree-icon.expand {\n margin-top: 3px;\n margin-right: 5px;\n margin-left: -2px;\n transform: rotate(90deg);\n}\nxm-select > .xm-body .xm-tree-icon.xm-visible {\n visibility: visible;\n}\nxm-select > .xm-body .xm-tree .left-line {\n position: absolute;\n left: 13px;\n width: 0;\n z-index: 1;\n border-left: 1px dotted #c0c4cc !important;\n}\nxm-select > .xm-body .xm-tree .top-line {\n position: absolute;\n left: 13px;\n height: 0;\n z-index: 1;\n border-top: 1px dotted #c0c4cc !important;\n}\nxm-select > .xm-body .xm-tree .xm-tree-icon + .top-line {\n margin-left: 1px;\n}\nxm-select > .xm-body .scroll-body > .xm-tree > .xm-option > .top-line,\nxm-select > .xm-body .scroll-body > .xm-option > .top-line {\n width: 0 !important;\n}\nxm-select > .xm-body .xm-cascader-box {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n padding: 5px 0;\n border: 1px solid #E6E6E6;\n background-color: #fff;\n border-radius: 2px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);\n margin: -1px;\n}\nxm-select > .xm-body .xm-cascader-box::before {\n content: ' ';\n position: absolute;\n width: 0;\n height: 0;\n border: 6px solid transparent;\n border-right-color: #E6E6E6;\n top: 10px;\n left: -12px;\n}\nxm-select > .xm-body .xm-cascader-box::after {\n content: ' ';\n position: absolute;\n width: 0;\n height: 0;\n border: 6px solid transparent;\n border-right-color: #fff;\n top: 10px;\n left: -11px;\n}\nxm-select > .xm-body .xm-cascader-scroll {\n height: 100%;\n overflow-x: hidden;\n overflow-y: auto;\n}\nxm-select > .xm-body.cascader {\n width: unset;\n min-width: unset;\n}\nxm-select > .xm-body.cascader .xm-option-content {\n padding-left: 8px;\n}\nxm-select > .xm-body.cascader .disabled .xm-right-arrow {\n color: #C2C2C2 !important;\n}\nxm-select > .xm-body.cascader .hide-icon.disabled .xm-right-arrow {\n color: #999 !important;\n}\nxm-select .xm-input {\n cursor: pointer;\n border-radius: 2px;\n border-width: 1px;\n border-style: solid;\n border-color: #E6E6E6;\n display: block;\n width: 100%;\n box-sizing: border-box;\n background-color: #FFF;\n line-height: 1.3;\n padding-left: 10px;\n outline: 0;\n user-select: text;\n -ms-user-select: text;\n -moz-user-select: text;\n -webkit-user-select: text;\n}\nxm-select .dis {\n display: none;\n}\nxm-select .loading {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: rgba(255, 255, 255, 0.6);\n display: flex;\n align-items: center;\n justify-content: center;\n}\nxm-select .loader {\n border: 0.2em dotted currentcolor;\n border-radius: 50%;\n -webkit-animation: 1s loader linear infinite;\n animation: 1s loader linear infinite;\n display: inline-block;\n width: 1em;\n height: 1em;\n color: inherit;\n vertical-align: middle;\n pointer-events: none;\n}\nxm-select .xm-select-default {\n position: absolute;\n width: 100%;\n height: 100%;\n border: none;\n visibility: hidden;\n}\nxm-select .xm-select-disabled {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n cursor: no-drop;\n z-index: 2;\n opacity: 0.3;\n background-color: #FFF;\n}\nxm-select .item--divided {\n border-top: 1px solid #ebeef5;\n width: calc(100% - 20px);\n cursor: initial;\n}\nxm-select .xm-right-arrow {\n position: absolute;\n color: #666;\n right: 5px;\n top: -1px;\n font-weight: 700;\n transform: scale(0.6, 1);\n}\nxm-select .xm-right-arrow::after {\n content: '>';\n}\nxm-select[size='large'] {\n min-height: 40px;\n line-height: 40px;\n}\nxm-select[size='large'] .xm-input {\n height: 40px;\n}\nxm-select[size='large'] .xm-label .scroll .label-content {\n line-height: 34px;\n}\nxm-select[size='large'] .xm-label .xm-label-block {\n height: 30px;\n line-height: 30px;\n}\nxm-select[size='large'] .xm-body .xm-option .xm-option-icon {\n height: 20px;\n width: 20px;\n font-size: 20px;\n}\nxm-select[size='large'] .xm-paging > span {\n height: 34px;\n line-height: 34px;\n}\nxm-select[size='large'] .xm-tree .left-line {\n height: 100%;\n bottom: 20px;\n}\nxm-select[size='large'] .xm-tree .left-line-group {\n height: calc(100% - 40px);\n}\nxm-select[size='large'] .xm-tree .xm-tree-icon.xm-hidden + .top-line {\n top: 19px;\n}\nxm-select[size='large'] .item--divided {\n margin: 10px;\n}\nxm-select {\n min-height: 36px;\n line-height: 36px;\n}\nxm-select .xm-input {\n height: 36px;\n}\nxm-select .xm-label .scroll .label-content {\n line-height: 30px;\n}\nxm-select .xm-label .xm-label-block {\n height: 26px;\n line-height: 26px;\n}\nxm-select .xm-body .xm-option .xm-option-icon {\n height: 18px;\n width: 18px;\n font-size: 18px;\n}\nxm-select .xm-paging > span {\n height: 30px;\n line-height: 30px;\n}\nxm-select .xm-tree .left-line {\n height: 100%;\n bottom: 18px;\n}\nxm-select .xm-tree .left-line-group {\n height: calc(100% - 36px);\n}\nxm-select .xm-tree .xm-tree-icon.xm-hidden + .top-line {\n top: 17px;\n}\nxm-select .item--divided {\n margin: 9px;\n}\nxm-select[size='small'] {\n min-height: 32px;\n line-height: 32px;\n}\nxm-select[size='small'] .xm-input {\n height: 32px;\n}\nxm-select[size='small'] .xm-label .scroll .label-content {\n line-height: 26px;\n}\nxm-select[size='small'] .xm-label .xm-label-block {\n height: 22px;\n line-height: 22px;\n}\nxm-select[size='small'] .xm-body .xm-option .xm-option-icon {\n height: 16px;\n width: 16px;\n font-size: 16px;\n}\nxm-select[size='small'] .xm-paging > span {\n height: 26px;\n line-height: 26px;\n}\nxm-select[size='small'] .xm-tree .left-line {\n height: 100%;\n bottom: 16px;\n}\nxm-select[size='small'] .xm-tree .left-line-group {\n height: calc(100% - 32px);\n}\nxm-select[size='small'] .xm-tree .xm-tree-icon.xm-hidden + .top-line {\n top: 15px;\n}\nxm-select[size='small'] .item--divided {\n margin: 8px;\n}\nxm-select[size='mini'] {\n min-height: 28px;\n line-height: 28px;\n}\nxm-select[size='mini'] .xm-input {\n height: 28px;\n}\nxm-select[size='mini'] .xm-label .scroll .label-content {\n line-height: 22px;\n}\nxm-select[size='mini'] .xm-label .xm-label-block {\n height: 18px;\n line-height: 18px;\n}\nxm-select[size='mini'] .xm-body .xm-option .xm-option-icon {\n height: 14px;\n width: 14px;\n font-size: 14px;\n}\nxm-select[size='mini'] .xm-paging > span {\n height: 22px;\n line-height: 22px;\n}\nxm-select[size='mini'] .xm-tree .left-line {\n height: 100%;\n bottom: 14px;\n}\nxm-select[size='mini'] .xm-tree .left-line-group {\n height: calc(100% - 28px);\n}\nxm-select[size='mini'] .xm-tree .xm-tree-icon.xm-hidden + .top-line {\n top: 13px;\n}\nxm-select[size='mini'] .item--divided {\n margin: 7px;\n}\n.layui-form-pane xm-select {\n margin: -1px -1px -1px 0;\n}\n",""]),e.exports=t},221:function(e,t){(function(t){e.exports=t}).call(this,{})},27:function(e,t,n){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"==typeof btoa){var r=function(e){var t=btoa(unescape(encodeURIComponent(JSON.stringify(e)))),n="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(t);return"/*# ".concat(n," */")}(o),i=o.sources.map((function(e){return"/*# sourceURL=".concat(o.sourceRoot||"").concat(e," */")}));return[n].concat(i).concat([r]).join("\n")}return[n].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,o){"string"==typeof e&&(e=[[null,e,""]]);var r={};if(o)for(var i=0;i=0&&p.splice(t,1)}function y(e){var t=document.createElement("style");if(void 0===e.attrs.type&&(e.attrs.type="text/css"),void 0===e.attrs.nonce){var o=function(){0;return n.nc}();o&&(e.attrs.nonce=o)}return x(t,e.attrs),m(e,t),t}function x(e,t){Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])}))}function v(e,t){var n,o,r,i;if(t.transform&&e.css){if(!(i="function"==typeof t.transform?t.transform(e.css):t.transform.default(e.css)))return function(){};e.css=i}if(t.singleton){var a=u++;n=c||(c=y(t)),o=w.bind(null,n,a,!1),r=w.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",x(t,e.attrs),m(e,t),t}(t),o=O.bind(null,n,t),r=function(){b(n),n.href&&URL.revokeObjectURL(n.href)}):(n=y(t),o=k.bind(null,n),r=function(){b(n)});return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else r()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=a()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=h(e,t);return d(n,t),function(e){for(var o=[],r=0;r3)for(n=[n],o=3;o1&&E(r,t,n),t=O(n,r,r,e.__k,null,r.__e,t),"function"==typeof e.type&&(e.__d=t)))}function A(e,t,n,r,i,a,l,s,c){var u,p,f,h,m,b,v,g,_,w,O,C=t.type;if(void 0!==t.constructor)return null;(u=o.__b)&&u(t);try{e:if("function"==typeof C){if(g=t.props,_=(u=C.contextType)&&r[u.__c],w=u?_?_.props.value:u.__:r,n.__c?v=(p=t.__c=n.__c).__=p.__E:("prototype"in C&&C.prototype.render?t.__c=p=new C(g,w):(t.__c=p=new x(g,w),p.constructor=C,p.render=M),_&&_.sub(p),p.props=g,p.state||(p.state={}),p.context=w,p.__n=r,f=p.__d=!0,p.__h=[]),null==p.__s&&(p.__s=p.state),null!=C.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=d({},p.__s)),d(p.__s,C.getDerivedStateFromProps(g,p.__s))),h=p.props,m=p.state,f)null==C.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==C.getDerivedStateFromProps&&g!==h&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(g,w),!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(g,p.__s,w)||t.__v===n.__v){p.props=g,p.state=p.__s,t.__v!==n.__v&&(p.__d=!1),p.__v=t,t.__e=n.__e,t.__k=n.__k,p.__h.length&&l.push(p),E(t,s,e);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(g,p.__s,w),null!=p.componentDidUpdate&&p.__h.push((function(){p.componentDidUpdate(h,m,b)}))}p.context=w,p.props=g,p.state=p.__s,(u=o.__r)&&u(t),p.__d=!1,p.__v=t,p.__P=e,u=p.render(p.props,p.state,p.context),p.state=p.__s,null!=p.getChildContext&&(r=d(d({},r),p.getChildContext())),f||null==p.getSnapshotBeforeUpdate||(b=p.getSnapshotBeforeUpdate(h,m)),O=null!=u&&u.type==y&&null==u.key?u.props.children:u,k(e,Array.isArray(O)?O:[O],t,n,r,i,a,l,s,c),p.base=t.__e,p.__h.length&&l.push(p),v&&(p.__E=p.__=null),p.__e=!1}else null==a&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=P(n.__e,t,n,r,i,a,l,c);(u=o.diffed)&&u(t)}catch(e){t.__v=null,o.__e(e,t,n)}return t.__e}function R(e,t){o.__c&&o.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){o.__e(e,t.__v)}}))}function P(e,t,n,o,r,i,a,l){var s,c,f,d,h,m=n.props,b=t.props;if(r="svg"===t.type||r,null!=i)for(s=0;se.length)&&(t=e.length);for(var n=0,o=new Array(t);nr?n-r:r,a=this.labelRef.scrollLeft+e.deltaY;a<0&&(a=0),a>i&&(a=i),this.labelRef.scrollLeft=a}}},{key:"blur",value:function(){var e=this.base.querySelector(".label-search-input");e&&e.blur()}},{key:"labelDrag",value:function(e,t){for(var n=t.type,o=t.target;;){if(!o||"I"===o.tagName)return;if("DIV"===o.tagName&&"fixed"!==o.style.position)break;o=o.parentNode}if(console.log(t),"mousedown"===n){var r=o.cloneNode(!0),i=t.pageX,a=t.pageY,l=t.offsetX,s=t.offsetY;console.log(i,a,l,s),r.style.position="fixed",r.style.left=i-l+"px",r.style.top=a-s+"px",o.appendChild(r),console.log(r),r.onmousemove=function(e){r.style.left=e.pageX-l+"px",r.style.top=e.pageY-s+"px"},r.mouseup=function(){r.parentNode.removeChild(r),r.onmousemove=null,r.mouseup=null,r.mouseleave=null},r.mouseleave=function(){console.log("mouseleave")}}else if("mouseup"===n)for(var c=o.childNodes,u=0;ue.length)&&(t=e.length);for(var n=0,o=new Array(t);n0&&void 0!==arguments[0]||this.size;var e=this.state.pageIndex;e<=1||(this.changePageIndex(e-1),this.props.pageRemote&&this.postData(e-1,!0))}},{key:"pageNextClick",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.size,t=this.state.pageIndex;t>=e||(this.changePageIndex(t+1),this.props.pageRemote&&this.postData(t+1,!0))}},{key:"changePageIndex",value:function(e){this.setState({pageIndex:e})}},{key:"labelSearch",value:function(e){"input"==e.type?this.searchInput(e):this.handleComposition(e)}},{key:"searchInput",value:function(e){var t=this,n=e.target.value;n!==this.__value&&(this.searchCid&&clearTimeout(this.searchCid),this.inputOver&&(this.__value=n,this.searchCid=setTimeout((function(){t.callback=!0,t.setState({filterValue:t.__value,remote:!0,pageIndex:1})}),this.props.delay)))}},{key:"focus",value:function(){this.searchInputRef&&this.searchInputRef.focus()}},{key:"blur",value:function(){this.searchInputRef&&this.searchInputRef.blur()}},{key:"handleComposition",value:function(e){var t=e.type;"compositionstart"===t?(this.inputOver=!1,this.searchCid&&clearTimeout(this.searchCid)):"compositionend"===t&&(this.inputOver=!0,this.searchInput(e))}},{key:"postData",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state.pageIndex,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(this.state.remote||n)&&(this.callback=!1,this.setState({loading:!0,remote:!1}),this.blur(),this.props.remoteMethod(this.state.filterValue,(function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;setTimeout((function(){e.focus(),e.callback=!0,e.setState({loading:!1,totalSize:n}),e.props.onReset(t,"data")}),10)}),this.props.show,t))}},{key:"keydown",value:function(e,t){var n=this,o=t.keyCode;if("div"===e&&(27===o||9===o?this.props.onReset(!1,"close"):37===o?this.pagePrevClick():39===o&&this.pageNextClick()),this.props.enableKeyboard){var r=this.props.prop,i=r.value,a=r.optgroup,l=r.disabled,s=this.tempData.filter((function(e){return!e[a]&&!e[l]})),c=s.length-1;if(-1===c)return;var u=s.findIndex((function(e){return e[i]===n.state.val}));if(38===o){u<=0?u=c:u>0&&(u-=1);var p=s[u][i];this.setState({val:p}),this.viewTo(p)}else if(40===o){-1===u||u===c?u=0:uM&&(T=M),M>0&&T<=0&&(T=1),!x){var z=(T-1)*e.pageSize,L=z+e.pageSize;S=S.slice(z,L)}var V={cursor:"no-drop",color:"#d2d2d2"},F={},U={};T<=1&&(F=V),T==M&&(U=V),this.state.pageIndex!==T&&this.changePageIndex(T),this.size=M,D=m("div",{class:"xm-paging"},m("span",{style:F,onClick:this.pagePrevClick.bind(this,M)},e.languageProp.paging.prev),m("span",null,this.state.pageIndex," / ",M),m("span",{style:U,onClick:this.pageNextClick.bind(this,M)},e.languageProp.paging.next))}else e.showCount>0&&(S=S.slice(0,e.showCount));var N,B,K=[],H={__tmp:!0};H[j]=!0,S.forEach((function(e){var t=I[e.__group__index];delete e.__group__index,N&&!t&&(t=H),t!=N&&(N=t,t&&K.push(N)),K.push(e)})),S=K,t&&null!=(t=y(this.state.filterValue,Object(c.b)([],S)))&&(B=S).splice.apply(B,[0,0].concat(J((Object(c.d)(t)?t:[t]).map((function(e){return Z(Z({},e),{},{__node:{}})})))));var q=Object(c.b)([],S);this.tempData=q;var Y=m("div",{class:"xm-toolbar"},e.toolbar.list.map((function(t){var o,r=e.languageProp.toolbar[t];o="ALL"===t?{icon:"xm-iconfont xm-icon-quanxuan",name:r,method:function(e){var t=i.optgroup,o=i.disabled,r=e.filter((function(e){return!e[t]})).filter((function(e){return!e[o]})),a=u.filter((function(e){return e[i.disabled]})),l=[];l=s?a.length?a:r.slice(0,1):v>0?a.length>=v?a:Object(c.f)(r.slice(0,v-a.length),a,i):Object(c.f)(r,u,i),n.props.onReset(l,"sels")}}:"CLEAR"===t?{icon:"xm-iconfont xm-icon-qingkong",name:r,method:function(e){n.props.onReset(u.filter((function(e){return e[i.disabled]})),"sels")}}:"REVERSE"===t?{icon:"xm-iconfont xm-icon-fanxuan",name:r,method:function(e){var t=i.optgroup,o=i.disabled,r=e.filter((function(e){return!e[t]})).filter((function(e){return!e[o]})),a=[];u.forEach((function(e){var t=r.findIndex((function(t){return t[k]===e[k]}));-1==t?a.push(e):r.splice(t,1)}));var l=a.filter((function(e){return e[i.disabled]})),p=[];p=s?l.length?l:r.slice(0,1):v>0?l.length>=v?l:Object(c.f)(r.slice(0,v-l.length),l,i):Object(c.f)(r,a,i),n.props.onReset(p,"sels")}}:t;var a=function(e){"mouseenter"===e.type&&(e.target.style.color=l.color),"mouseleave"===e.type&&(e.target.style.color="")};return m("div",{class:"toolbar-tag",style:{},onClick:function(){Object(c.e)(o.method)&&o.method(q),n.focus()},onMouseEnter:a,onMouseLeave:a},e.toolbar.showIcon&&m("i",{class:o.icon}),m("span",null,o.name))})).filter((function(e){return e}))),Q="hidden"!=e.model.icon;return(S=S.map((function(t){return t[j]?t.__tmp?m("div",{class:"item--divided"}):m("div",{class:"xm-group"},m("div",{class:"xm-group-item",onClick:n.groupClick.bind(n,t)},t[w])):function(t){var r=!!u.find((function(e){return e[k]==t[k]})),i=r?{color:l.color,border:"none"}:{borderColor:l.color},c={};g&&t[k]===n.state.val&&(c.backgroundColor=l.hover),!Q&&r&&(c.backgroundColor=l.color,t[O]&&(c.backgroundColor="#C2C2C2"));var p,f,d=["xm-option",t[O]?" disabled":"",r?" selected":"",Q?"show-icon":"hide-icon"].join(" "),h=["xm-option-icon",(p=e.iconfont.select,f=e.iconfont.unselect,(p?!r&&f?f+" xm-custom-icon":p:0)||"xm-iconfont "+(s?"xm-icon-danx":"xm-icon-duox"))].join(" "),b=function(e){"mouseenter"===e.type?t[O]||(g?n.setState({val:t[k]}):e.target.style.backgroundColor=l.hover):"mouseleave"===e.type&&(t[O]||g||(e.target.style.backgroundColor=""))};return m("div",{class:d,style:c,value:t[k],onClick:n.optionClick.bind(n,t,r,t[O]),onMouseEnter:b,onMouseLeave:b},Q&&m("i",{class:h,style:i}),m("div",{class:"xm-option-content",dangerouslySetInnerHTML:{__html:a({data:o,item:t,arr:u,name:t[w],value:t[k]})}}))}(t)}))).length?_&&this.state.val==ne&&this.keydown("div",{keyCode:40}):(!e.pageEmptyShow&&(D=""),S.push(m("div",{class:"xm-select-empty"},p))),m("div",{onClick:this.blockClick,tabindex:"1",style:"outline: none;"},m("div",null,e.toolbar.show&&Y,P,m("div",{class:"scroll-body",style:{maxHeight:e.height}},S),e.paging&&D),this.state.loading&&m("div",{class:"loading"},m("span",{class:"loader"})))}},{key:"componentDidMount",value:function(){var e=this.base.querySelector(".xm-search-input");e&&(e.addEventListener("compositionstart",this.handleComposition.bind(this)),e.addEventListener("compositionupdate",this.handleComposition.bind(this)),e.addEventListener("compositionend",this.handleComposition.bind(this)),e.addEventListener("input",this.searchInput.bind(this)),this.searchInputRef=e),this.base.addEventListener("keydown",this.keydown.bind(this,"div"))}},{key:"componentDidUpdate",value:function(){if(this.callback){this.callback=!1;var e=this.props.filterDone;Object(c.e)(e)&&e(this.state.filterValue,this.tempData||[])}}}])&&G(t.prototype,n),o&&G(t,o),i}(x);function re(e){return(re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ie(e,t){for(var n=0;n0||p.lazy&&!1!==e.__node.loading)?"xm-visible":"xm-hidden"].join(" "),j=[];p.showFolderIcon&&(j.push(m("i",{class:C,type:"expand"})),p.showLine&&(o&&j.push(m("i",{class:"left-line",style:{left:t-p.indent+3+"px"}})),j.push(m("i",{class:"top-line",style:{left:t-p.indent+3+"px",width:p.indent+(0===o?10:-2)+"px"}}))));var S=function(t){"mouseenter"===t.type?e[g]||(y?n.setState({val:e[v]}):t.target.style.backgroundColor=a.hover):"mouseleave"===t.type&&(e[g]||y||(t.target.style.backgroundColor=""))};return m("div",{class:w,style:h,value:e[v],onClick:n.optionClick.bind(n,e,r,e[g],"line"),onMouseEnter:S,onMouseLeave:S},j,e.__node.loading&&m("span",{class:"loader"}),k&&m("i",{class:O,style:d,onClick:n.optionClick.bind(n,e,r,e[g],"checkbox")}),m("div",{class:"xm-option-content",dangerouslySetInnerHTML:{__html:s({data:u,item:e,arr:i,name:e[x],value:e[v]})}}))};f&&(d?this.postData():this.filterData(u,this.state.filterValue));var C=Object(c.b)([],u),j=Object(c.b)([],i);this.tempData=C;var S=u.map((function(e){return function e(t,o){if(!t.__node.hidn){var r=t[_];if(o+=p.indent,r){var i=-1!==n.state.expandedKeys.findIndex((function(e){return t[v]===e}));return 0===r.length&&(i=!1),m("div",{class:"xm-tree"},p.showFolderIcon&&p.showLine&&i&&r.length>0&&m("i",{class:"left-line left-line-group",style:{left:o+3+"px"}}),O(t,o,0===r.length&&(!p.lazy||p.lazy&&!1===t.__node.loading)?0:i),i&&m("div",{class:"xm-tree-box"},r.map((function(t){return e(t,o)}))))}return O(t,o,0)}}(e,10-p.indent)})).filter((function(e){return e}));function E(e,t){t.forEach((function(t){t[w]?(p.strict||"hidden"===b.parent||e.push(t),E(e,t[_])):e.push(t)}))}var A=m("div",{class:"xm-toolbar"},e.toolbar.list.map((function(t){var r,s=e.languageProp.toolbar[t];r="ALL"===t?{icon:"xm-iconfont xm-icon-quanxuan",name:s,method:function(e){var t=[];E(t,e),t=t.filter((function(e){return!e[g]&&!e.__node.hidn})),n.props.onReset(l?t.slice(0,1):Object(c.f)(t,i,o),"treeData")}}:"CLEAR"===t?{icon:"xm-iconfont xm-icon-qingkong",name:s,method:function(e){n.props.onReset(i.filter((function(e){return e[o.disabled]})),"treeData")}}:"REVERSE"===t?{icon:"xm-iconfont xm-icon-fanxuan",name:s,method:function(e){var t=[];E(t,e),t=t.filter((function(e){return!e[g]&&!e.__node.hidn}));var r=[];i.forEach((function(e){var n=t.findIndex((function(t){return t[v]===e[v]}));-1==n?r.push(e):t.splice(n,1)})),n.props.onReset(l?r.slice(0,1):Object(c.f)(t,r,o),"treeData")}}:t;var u=function(e){"mouseenter"===e.type&&(e.target.style.color=a.color),"mouseleave"===e.type&&(e.target.style.color="")};return m("div",{class:"toolbar-tag",onClick:function(){Object(c.e)(r.method)&&r.method(C,j)},onMouseEnter:u,onMouseLeave:u},e.toolbar.showIcon&&m("i",{class:r.icon}),m("span",null,r.name))})).filter((function(e){return e}))),R=m("div",{class:f?"xm-search":"xm-search dis"},m("i",{class:"xm-iconfont xm-icon-sousuo"}),m("input",{class:"xm-input xm-search-input",placeholder:h}));return S.length||S.push(m("div",{class:"xm-select-empty"},r)),m("div",{onClick:this.blockClick,class:"xm-body-tree"},e.toolbar.show&&A,R,m("div",{class:"scroll-body",style:{maxHeight:e.height}},S),this.state.loading&&m("div",{class:"loading"},m("span",{class:"loader"})))}},{key:"componentDidMount",value:function(){var e=this.base.querySelector(".xm-search-input");e&&(e.addEventListener("compositionstart",this.handleComposition.bind(this)),e.addEventListener("compositionupdate",this.handleComposition.bind(this)),e.addEventListener("compositionend",this.handleComposition.bind(this)),e.addEventListener("input",this.searchInput.bind(this)),this.searchInputRef=e)}},{key:"componentDidUpdate",value:function(){if(this.callback){this.callback=!1;var e=this.props.filterDone;Object(c.e)(e)&&e(this.state.filterValue,this.tempData||[])}}}])&&fe(t.prototype,n),o&&fe(t,o),i}(x);function ve(e){return(ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ge(e,t){for(var n=0;n0,O={backgroundColor:"transparent"},C=["xm-option",g?" disabled":"",v?" selected":"",y?"show-icon":"hide-icon"].join(" "),j=k&&"hidden"===e.iconfont.parent?"xm-option-icon-hidden":["xm-option-icon",(_?e.iconfont.half?e.iconfont.half+" xm-custom-icon":0:k&&e.iconfont.parent?e.iconfont.parent+" xm-custom-icon":v?e.iconfont.select?e.iconfont.select:0:e.iconfont.unselect?e.iconfont.unselect+" xm-custom-icon":0)||"xm-iconfont "+(l?"xm-icon-danx":u.strict&&_?"xm-icon-banxuan":"xm-icon-duox")].join(" ");t[f]===n.state.val&&(O.backgroundColor=a.hover),!y&&v&&(O.backgroundColor=a.color,g&&(O.backgroundColor="#C2C2C2"));var S={},E={};x&&(S.color=a.color,S.fontWeight=700,E.color=a.color);var A=function(e){"mouseenter"===e.type?t[d]||n.setState({val:t[f]}):"mouseleave"===e.type&&n.setState({val:""})};return m("div",{class:C,style:O,value:t[f],onClick:n.optionClick.bind(n,t,v,g,"line",r),onMouseEnter:A,onMouseLeave:A},y&&m("i",{class:j,style:w,onClick:n.optionClick.bind(n,t,v,g,"checkbox",r)}),m("div",{class:"xm-option-content",style:S,dangerouslySetInnerHTML:{__html:s({data:c,item:t,arr:i,name:t[p],value:t[f]})}}),t[b]&&m("div",{class:"xm-right-arrow",style:E}))}(o,0,v,_)},g=c.map((function(e){return v(e,2,0)})).concat(x).filter((function(e){return e}));return g.length||g.push(m("div",{class:"xm-select-empty"},r)),m("div",{onClick:this.blockClick,class:"xm-body-cascader scroll-body",style:{width:u.indent+"px",maxHeight:e.height}},g)}},{key:"componentDidMount",value:function(){this.props.onReset("cascader","class")}}])&&ge(t.prototype,n),o&&ge(t,o),i}(x);function je(){return(je=Object.assign||function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,o=new Array(t);n1&&(n=n.slice(0,1),(l.show&&l.strict||s.show&&s.strict)&&this.clearAndReset(o,n,!1)),this.setState({sels:n,dataObj:c,flatData:u})}return this.setState({data:o}),n}},{key:"upDate",value:function(e,t){var n=this.state.dataObj,o=this.props,r=o.prop,i=o.tree,a=o.cascader,l=r.value,s=r.disabled,u=r.children;e.map((function(e){return n["object"===Ie(e)?e[l]:e]})).filter((function(e){return e})).forEach((function(e){if(e[s]=!t,i.show&&i.strict||a.show&&a.strict){if(t)for(var n=e;n;)n[s]=!1,n=n.__node.parent;!function e(n){n[s]=!t;var o=n[u];o&&Object(c.d)(o)&&o.forEach((function(t){return e(t)}))}(e)}})),this.setState({dataObj:n})}},{key:"exchangeValue",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state.dataObj,o=this.props,r=o.prop,i=o.tree,a=o.cascader,l=(o.data,r.children),s=r.value,u=e.map((function(e){return"object"===Ie(e)?Re(Re({},e),{},{__node:{}}):n[e]})).filter((function(e){return e})),p=Se(u);if(i.show&&i.strict||a.show&&a.strict){var f=function e(t,n){var o=n[l];o&&Object(c.d)(o)&&o.forEach((function(n){-1===u.findIndex((function(e){return e[s]===n[s]}))&&t.push(n),e(t,n)}))},d={};d[l]=u,f(p,d),p=p.filter((function(e){return!0!==e[t.props.prop.optgroup]}))}return p}},{key:"value",value:function(e,t,n,o){var r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];!1!==t&&!0!==t&&(t=this.state.show);var i=this.props,a=i.prop,l=i.tree,s=i.cascader,c=this.exchangeValue(e);if(!this.checkMax(c,c,!0)){if(l.show&&l.strict||s.show&&s.strict){var u=this.state.data;this.clearAndReset(u,c,!1),c=this.init({data:u,prop:a},!0)}this.resetSelectValue(c,o||c,r,n),this.setState({show:t})}}},{key:"clearAndReset",value:function(e,t,n){var o=this,r=this.props.prop,i=r.selected,a=r.disabled,l=r.children,s=r.value;e.forEach((function(e){e[i]=-1!=t.findIndex((function(t){return t[s]===e[s]}))||n;var r=e[l];if(r&&Object(c.d)(r)&&r.length>0){o.clearAndReset(r,t,e[i]);var u=r.length,p=r.filter((function(e){return!0===e[i]||!0===e.__node.selected})).length;e.__node.selected=p===u,e.__node.half=p>0&&p0,e.__node.disabled=r.filter((function(e){return!0===e[a]||!0===e.__node.disabled})).length===u}}))}},{key:"load",value:function(e,t,n,o){var r=this,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5?arguments[5]:void 0,l=this.props,s=l.prop,u=l.tree,p=l.cascader,f=s.children,d=s.optgroup,h=s.value,m=s.selected,b=s.disabled;e.forEach((function(e){e.__node={parent:o,level:i,loading:e.__node&&e.__node.loading},a&&(delete e[m],a.find((function(t){return t===e[h]}))&&(e[m]=!0)),t[e[h]]=e,n.push(e);var l=e[f];if(l&&Object(c.d)(l)){var s=l.length;if(s>0){r.load(l,t,n,e,i+1,a),e[d]=!0,(u.show&&u.strict||p.show&&p.strict)&&(!0===e[m]&&(delete e[m],l.forEach((function(e){return e[m]=!0}))),!0===e[b]&&(delete e[b],l.forEach((function(e){return e[b]=!0}))));var y=l.filter((function(e){return!0===e[m]||!0===e.__node.selected})).length;e.__node.selected=y===s,e.__node.half=y>0&&y0,e.__node.disabled=l.filter((function(e){return!0===e[b]||!0===e.__node.disabled})).length===s}}}))}},{key:"resetSelectValue",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=this.props.on;if(Object(c.e)(r)&&this.prepare&&o){var i=r({arr:e,change:t,isAdd:n});if(Object(c.d)(i))return this.value(i,null,!1)}this.setState({sels:e})}},{key:"updateBorderColor",value:function(e){this.setState({tmpColor:e})}},{key:"treeHandler",value:function(e,t,n,o,r){var i=this,a=this.props.prop,l=a.value,s=(a.selected,a.disabled),c=a.children,u=a.optgroup,p=t[c];if(p.filter((function(e){return!(e[s]||e.__node.disabled)})).forEach((function(t){if(t[u])i.treeHandler(e,t,n,o,r);else{var a=e.findIndex((function(e){return e[l]==t[l]}));"del"===o?-1!=a&&(e.splice(a,1),n.push(t)):"half"!==o&&"add"!==o||-1==a&&(e.push(t),n.push(t))}})),r){var f=p.length,d=p.filter((function(t){return-1!==e.findIndex((function(e){return e[l]===t[l]}))||!0===t.__node.selected})).length;t.__node.selected=d===f,t.__node.half=d>0&&dl;if(l>0&&s)return this.updateBorderColor(a.maxColor),i&&Object(c.e)(i)&&i(t,e),!0}},{key:"itemClick",value:function(e,t,n,o){var r=this.props,i=(r.theme,r.prop),a=r.radio,l=r.repeat,s=r.clickClose,c=(r.max,r.maxMethod,r.tree),u=r.cascader,p=r.data,f=Se(this.state.sels),d=i.value,h=(i.selected,i.disabled,i.children),m=i.optgroup;if(!n){if(e[m]&&(c.show&&c.strict||u.show&&u.strict)){e[h];var b,y=[],x=!0;if(e.__node.selected?(b="del",x=!1):e.__node.half?(b="half",this.treeHandler(f,e,y,b),0===y.length&&(b="del",x=!1)):b="add","half"!=b&&this.treeHandler(f,e,y,b),this.checkMax(y,f))return;f=Se(this.state.sels),y=[],this.treeHandler(f,e,y,b,!0),this.resetSelectValue(f,y,x),this.setState({data:this.state.data})}else if(!t||l&&!o){if(this.checkMax(e,f))return;f=a?[e]:[].concat(Se(f),[e]),this.clearAndReset(p,f,t),this.resetSelectValue(f,[e],!t)}else{var v=f.findIndex((function(t){return t[d]==e[d]}));-1!=v&&(f.splice(v,1),this.resetSelectValue(f,[e],!t))}var g=e.__node.parent;if(g){for(;g;){var _=g[h],w=_.length,k=_.filter((function(e){return-1!==f.findIndex((function(t){return t[d]===e[d]}))||!0===e.__node.selected})).length;g.__node.selected=k===w,g.__node.half=k>0&&k0,g=g.__node.parent}this.setState({data:this.state.data})}s&&!o&&this.onClick()}}},{key:"onClick",value:function(e){var t=this;if("relative"!==this.props.model.type)if(this.props.disabled)!1!==this.state.show&&this.setState({show:!1});else{var n=!this.state.show;if(n){if(this.props.show&&0==this.props.show())return;Object.keys(Xe).filter((function(e){return e!=t.props.el})).forEach((function(e){return Xe[e].closed()}))}else{if(this.props.hide&&0==this.props.hide())return;this.bodyView.scroll&&this.bodyView.scroll(0,0)}this.setState({show:n}),e&&e.stopPropagation()}}},{key:"onReset",value:function(e,t){var n=this;if("data"===t){var o=e.filter((function(e){return!0===e[n.props.prop.selected]}));this.resetSelectValue(Object(c.f)(o,this.state.sels,this.props.prop),o,!0);var r=[];this.load(e,{},r),this.setState({data:e,flatData:r})}else"sels"===t?this.resetSelectValue(e,e,!0):"append"===t?this.append(e):"delete"===t?this.del(e):"auto"===t?this.auto(e):"treeData"===t?this.value(e,null,!0,!1,!1):"close"===t?this.onClick():"class"===t?this.setState({bodyClass:e}):"labelSearchBlur"===t?this.labelRef.blur(e):"labelSearch"===t&&this.generalRef.labelSearch(e)}},{key:"append",value:function(e){var t=this.exchangeValue(e);this.value(Object(c.f)(t,this.state.sels,this.props.prop),this.props.show,!0,t)}},{key:"del",value:function(e){var t=this.props.prop.value,n=this.state.sels,o=this.exchangeValue(e);o.forEach((function(e){var o=n.findIndex((function(n){return n[t]===e[t]}));-1!=o&&n.splice(o,1)})),this.value(n,this.props.show,!0,o,!1)}},{key:"auto",value:function(e){var t=this,n=this.props.prop.value;e.filter((function(e){return-1!=t.state.sels.findIndex((function(t){return t[n]===e[n]}))})).length==e.length?this.del(e):this.append(e)}},{key:"changeExpandedKeys",value:function(e){var t=this.props,n=t.tree,o=t.prop,r=this.state,i=r.dataObj,a=r.flatData;n.show&&this.treeRef.init({dataObj:i,flatData:a,prop:o,tree:{expandedKeys:e}})}},{key:"calcPosition",value:function(){if(this.state.show&&"fixed"===this.props.model.type){var e=this.base.getBoundingClientRect();return Date.now()-this.state.time>10&&this.setState({time:Date.now()}),{position:"fixed",left:e.x,top:e.y+e.height+4,width:e.width}}return{}}},{key:"componentWillReceiveProps",value:function(e){this.init(e,e.updateData)}},{key:"componentWillMount",value:function(){this.init(this.props,!0)}},{key:"render",value:function(e,t){var n=this,o=e.theme,r=e.prop,i=(e.radio,e.repeat,e.clickClose,e.on,e.max,e.maxMethod,e.content),a=e.disabled,l=e.tree,s=e.submitConversion,u={borderColor:o.color},p=t.data,f=t.dataObj,d=t.flatData,h=t.sels,b=t.show,y=t.tmpColor,x=t.bodyClass;a&&(b=!1);var v={style:Re(Re({},e.style),b?u:{}),onClick:this.onClick.bind(this),ua:Object(c.a)(),size:e.size,tabindex:1};y&&(v.style.borderColor=y,setTimeout((function(){v.style.borderColor="",n.updateBorderColor("")}),300)),r.value;var g=Re(Re({},e),{},{data:p,sels:h,ck:this.itemClick.bind(this),title:h.map((function(e){return e[r.name]})).join(","),onReset:this.onReset.bind(this)}),_=Re(Re({},e),{},{data:p,dataObj:f,flatData:d,sels:h,ck:this.itemClick.bind(this),show:b,onReset:this.onReset.bind(this)}),w=i?m(ue,_):l.show?m(xe,je({},_,{ref:function(e){return n.treeRef=e}})):e.cascader.show?m(Ce,_):m(oe,je({},_,{ref:function(e){return n.generalRef=e}})),k=this.calcPosition();return m("xm-select",v,m("input",{class:"xm-select-default","lay-verify":e.layVerify,"lay-verType":e.layVerType,"lay-reqText":e.layReqText,name:e.name,value:s(h,r)}),m("i",{class:b?"xm-icon xm-icon-expand":"xm-icon"}),0===h.length&&m("div",{class:"xm-tips"},e.tips),m(H,je({},g,{ref:function(e){return n.labelRef=e}})),m("div",{class:["xm-body",x,e.model.type,b?"":"dis"].join(" "),style:k,ref:function(e){return n.bodyView=e}},w),a&&m("div",{class:"xm-select-disabled"}))}},{key:"componentDidMount",value:function(){var e=this;this.prepare=!0,this.base.addEventListener("keydown",(function(t){13===t.keyCode&&e.onClick(t)})),this.input=this.base.querySelector(".xm-select-default");var t=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;t&&new t((function(t){t.forEach((function(t){"attributes"==t.type&&"class"===t.attributeName&&-1!==e.input.className.indexOf("layui-form-danger")&&(e.input.className="xm-select-default",e.base.style.borderColor=e.props.theme.maxColor,e.base.scrollIntoView&&e.base.scrollIntoView({behavior:"smooth"}))}))})).observe(this.input,{attributes:!0});for(var n=this.base;n;){if("FORM"===n.tagName){var o=n.querySelector('button[type="reset"]');o&&o.addEventListener("click",(function(t){e.init(e.props,!0)}));break}n=n.parentElement}var r=this.props.done;r&&r()}},{key:"componentDidUpdate",value:function(){var e=this.props,t=e.direction,n=e.model;if("relative"!==n.type&&"fixed"!==n.type){var o=this.base.getBoundingClientRect();if("auto"===t){this.bodyView.style.display="block",this.bodyView.style.visibility="hidden";var r=this.bodyView.getBoundingClientRect().height;this.bodyView.style.display="",this.bodyView.style.visibility="";var i=o.y||o.top||0,a=document.documentElement.clientHeight-i-o.height-20;t=a>r||i0&&void 0!==arguments[0]?arguments[0]:"zn",t=Ne[e]||Ue;return{language:e,languageProp:t,data:[],content:"",name:"select",layVerify:"",layVerType:"",layReqText:"",size:"medium",disabled:!1,initValue:null,create:null,tips:t.tips,empty:t.empty,delay:500,searchTips:t.searchTips,filterable:!1,filterMethod:function(e,t,n,o){return!e||-1!=t[o.name].indexOf(e)},remoteSearch:!1,remoteMethod:function(e,t){t([])},direction:"auto",style:{},height:"200px",autoRow:!1,paging:!1,pageSize:10,pageEmptyShow:!0,pageRemote:!1,radio:!1,repeat:!1,clickClose:!1,max:0,maxMethod:function(e,t){},showCount:0,enableKeyboard:!0,enableHoverFirst:!0,selectedKeyCode:13,toolbar:{show:!1,showIcon:!0,list:["ALL","CLEAR"]},tree:{show:!1,showFolderIcon:!0,showLine:!0,indent:20,expandedKeys:[],strict:!0,lazy:!1,load:null,simple:!1,nodeType:"__node_type",clickExpand:!0,clickCheck:!0},cascader:{show:!1,indent:100,strict:!0},prop:{name:"name",value:"value",selected:"selected",disabled:"disabled",children:"children",optgroup:"optgroup",click:"click"},theme:{color:"#009688",maxColor:"#e54d42",hover:"#f2f2f2"},model:{label:{type:"block",text:{left:"",right:"",separator:", "},block:{showCount:0,showIcon:!0,template:null},count:{template:function(e,t){return"已选中 ".concat(t.length," 项, 共 ").concat(e.length," 项")}}},icon:"show",type:"absolute"},iconfont:{select:"",unselect:"",half:"",parent:""},show:function(){},hide:function(){},template:function(e){e.item,e.sels;var t=e.name;return e.value,t},on:function(e){e.arr,e.item,e.selected},submitConversion:function(e,t){return e.map((function(e){return e[t.value]})).join(",")},done:function(){}}}(e.language),this.update(e)}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=!!e.data;this.options=Object(c.b)(this.options,e),this.options.__render_success=!1;var n=this.options.dom;if(n){var o=this.options.data||[];if("function"==typeof o&&(o=o(),this.options.data=o),Object(c.d)(o))return T(m(Fe,qe({},this.options,{__update:Date.now(),updateData:t})),n),this.options.__render_success=!0,this;Object(c.k)("data数据必须为数组类型, 不能是".concat("undefined"==typeof data?"undefined":Ye(data),"类型"))}else Object(c.k)("没有找到渲染对象: ".concat(e.el,", 请检查"))}},{key:"reset",value:function(){var e=this.options.el;return this.init($e[e]),et[e].init(this.options,!0),this}},{key:"opened",value:function(){var e=et[this.options.el];return!e.state.show&&e.onClick(),this}},{key:"closed",value:function(){var e=et[this.options.el];return e.state.show&&e.onClick(),this}},{key:"getValue",value:function(e){var t=this,n=this.options,o=n.tree,r=n.prop,i=n.data,a=et[this.options.el].state.sels,l=a;o.show&&o.strict&&o.simple&&(l=[],Object(c.j)(i,a,l,r));var s=Object(c.c)(l,r.children,["__node"]);return"name"===e?s.map((function(e){return e[t.options.prop.name]})):"nameStr"===e?s.map((function(e){return e[t.options.prop.name]})).join(","):"value"===e?s.map((function(e){return e[t.options.prop.value]})):"valueStr"===e?s.map((function(e){return e[t.options.prop.value]})).join(","):s}},{key:"setValue",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(Object(c.d)(e))return et[this.options.el].value(this.options.radio?e.slice(0,1):e,t,n),this;Object(c.k)("请传入数组结构...")}},{key:"append",value:function(e){if(Object(c.d)(e))return et[this.options.el].append(e),this;Object(c.k)("请传入数组结构...")}},{key:"delete",value:function(e){if(Object(c.d)(e))return et[this.options.el].del(e),this;Object(c.k)("请传入数组结构...")}},{key:"warning",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e||this.options.theme.maxColor;return!0===t?et[this.options.el].base.style.borderColor=n:et[this.options.el].updateBorderColor(n),this}},{key:"getTreeValue",value:function(e,t){var n=this.options,o=n.tree,r=n.cascader,i=n.prop,a=i.value;if(!o.show&&!r.show)return this.getValue(e);for(var l=et[this.options.el].state.sels,s=[],u=o.nodeType,p=function(e,t){s.find((function(t){return t[a]===e[a]}))||((e=Ke({},e))[u]=t,s.push(e))},f=0;fe.length)&&(t=e.length);for(var n=0,o=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"pid",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"id",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"children",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i={};return safety(e).filter((function(e){var a=e[n],l=e[t],s=i[a],c=i[l];return s&&(e[o]=s[o]),i[a]=e,c||(c=Je({},o,[]),i[l]=c),c.push(e),n==r}))}}}}); \ No newline at end of file diff --git a/src/plugin/admin/public/component/pear/pear.js b/src/plugin/admin/public/component/pear/pear.js index 87d3248d..6c1fac09 100644 --- a/src/plugin/admin/public/component/pear/pear.js +++ b/src/plugin/admin/public/component/pear/pear.js @@ -7,45 +7,81 @@ window.rootPath = (function (src) { layui.config({ base: rootPath + "module/", - version: "3.10.0" + version: "4.0.3" }).extend({ - admin: "admin", // 框架布局组件 - menu: "menu", // 数据菜单组件 - frame: "frame", // 内容页面组件 - tab: "tab", // 多选项卡组件 - echarts: "echarts", // 数据图表组件 - echartsTheme: "echartsTheme", // 数据图表主题 - encrypt: "encrypt", // 数据加密组件 - select: "select", // 下拉多选组件 - xmSelect: "xm-select", // 下拉多选组件 //变更 - drawer: "drawer", // 抽屉弹层组件 - notice: "notice", // 消息提示组件 - step:"step", // 分布表单组件 - tag:"tag", // 多标签页组件 - popup:"popup", // 弹层封装 - treetable:"treetable", // 树状表格 - dtree:"dtree", // 树结构 - tinymce:"tinymce/tinymce", // 编辑器 - area:"area", // 省市级联 - count:"count", // 数字滚动 - topBar: "topBar", // 置顶组件 - button: "button", // 加载按钮 - design: "design", // 表单设计 - card: "card", // 数据卡片组件 - loading: "loading", // 加载组件 - cropper:"cropper", // 裁剪组件 - convert:"convert", // 数据转换 - yaml:"yaml", // yaml 解析组件 - context: "context", // 上下文组件 - http: "http", // ajax请求组件 - theme: "theme", // 主题转换 - message: "message", // 通知组件 - toast: "toast", // 消息通知 - iconPicker: "iconPicker",// 图标选择 - nprogress: "nprogress", // 进度过渡 - watermark:"watermark/watermark", //水印 - fullscreen:"fullscreen", //全屏组件 - popover:"popover/popover" //汽泡组件 -}).use(['layer', 'theme'], function () { - layui.theme.changeTheme(window, false); + admin: "admin", + page: "page", + tabPage: "tabPage", + menu: "menu", + fullscreen: "fullscreen", + messageCenter: "messageCenter", + menuSearch: "menuSearch", + button: "button", + tools: "tools", + popup: "extends/popup", + count: "extends/count", + toast: "extends/toast", + nprogress: "extends/nprogress", + echarts: "extends/echarts", + echartsTheme: "extends/echartsTheme", + yaml: "extends/yaml" +}).use(['admin'], function (){ + const $ = layui.$; + + function changeDarkTheme() { + let dark = localStorage.getItem('dark') + if (dark === 'true') { + layui.$('body').addClass('pear-admin-dark') + } else { + layui.$('body').removeClass('pear-admin-dark') + } + } + layui.admin.changeTheme() + changeDarkTheme() + window.addEventListener('storage',ev => { + if (ev.key === 'theme-color-color') { + layui.admin.changeTheme() + } + if (ev.key === 'dark') { + changeDarkTheme() + } + }) + + function applyButtonStyles() { + // 为 Pear 按钮添加对应的 Layui 样式类 + const buttonMap = [ + ['.pear-btn', 'layui-btn'], + ['.pear-btn-primary', 'layui-btn-primary'], + ['.pear-btn-danger', 'layui-btn-danger'], + ['.pear-btn-warm', 'layui-btn-warm'], + ['.pear-btn-success', 'layui-btn-success'], + ]; + + buttonMap.forEach(([selector, className]) => { + $(selector).each(function() { + if (!$(this).hasClass(className)) { + $(this).addClass(className); + } + }); + }); + } + + // 初始应用样式 + applyButtonStyles(); + + // 使用 MutationObserver 监听新添加的元素 + const observer = new MutationObserver(function(mutationsList) { + for(let mutation of mutationsList) { + if (mutation.type === 'childList') { + applyButtonStyles(); + break; + } + } + }); + + // 开始观察 body 及其子元素的变化 + observer.observe(document.body, { + childList: true, + subtree: true + }); }); \ No newline at end of file diff --git a/src/plugin/admin/public/config/pear.config.json b/src/plugin/admin/public/config/pear.config.json index 954f8f0e..2c1334d5 100644 --- a/src/plugin/admin/public/config/pear.config.json +++ b/src/plugin/admin/public/config/pear.config.json @@ -1,16 +1,16 @@ { "logo": { - "title": "Webman Admin", - "image": "/app/admin/admin/images/logo.png" + "title": "Pear Admin", + "image": "admin/images/logo.png" }, "menu": { - "data": "/app/admin/rule/get", + "data": "admin/data/menu.json", "method": "GET", "accordion": true, "collapse": false, "control": false, - "controlWidth": 2000, - "select": "0", + "controlWidth": 500, + "select": "10", "async": true }, "tab": { @@ -20,14 +20,14 @@ "preload": false, "max": "30", "index": { - "id": "0", - "href": "/app/admin/index/dashboard", - "title": "仪表盘" + "id": "10", + "href": "view/console/console1.html", + "title": "首页" } }, "theme": { "defaultColor": "2", - "defaultMenu": "light-theme", + "defaultMenu": "dark-theme", "defaultHeader": "light-theme", "allowCustom": true, "banner": false @@ -35,13 +35,13 @@ "colors": [ { "id": "1", - "color": "#36b368", - "second": "#f0f9eb" + "color": "#2d8cf0", + "second": "#ecf5ff" }, { "id": "2", - "color": "#2d8cf0", - "second": "#ecf5ff" + "color": "#36b368", + "second": "#f0f9eb" }, { "id": "3", @@ -60,11 +60,11 @@ } ], "other": { - "keepLoad": "500", + "keepLoad": "1200", "autoHead": false, "footer": false }, "header": { - "message": false + "message": "admin/data/message.json" } } \ No newline at end of file diff --git a/src/plugin/admin/public/config/pear.config.yml b/src/plugin/admin/public/config/pear.config.yml new file mode 100644 index 00000000..708601af --- /dev/null +++ b/src/plugin/admin/public/config/pear.config.yml @@ -0,0 +1,84 @@ +## 网站配置 +logo: + ## 网站名称 + title: "Pear Admin" + ## 网站图标 + image: "admin/images/logo.png" +## 菜单配置 +menu: + ## 菜单数据 + data: "admin/data/menu.json" + ## GET / POST + method: "GET" + ## 菜单手风琴 + accordion: true + ## 默认折叠状态 + collapse: false + ## 多菜单模式 + control: false + ## 默认选中的菜单项 + select: "10" + ## 是否开启异步菜单,false 时 data 属性设置为静态数据,true 时为后端接口 + async: true +## 视图内容配置 +tab: + ## 是否开启多选项卡 + enable: true + ## 保持视图状态 + keepState: true + ## 开启选项卡记忆 + session: true + ## 浏览器刷新时是否预加载非激活标签页 + preload: true + ## 可打开的数量, false 不限制极值 + max: "30" + ## 首页 + index: + id: "10" ## 标识 ID , 建议与菜单项中的 ID 一致 + href: "view/analysis/index.html" ## 页面地址 + title: "首页" ## 标题 +## 主题配置 +theme: + ## 默认主题色,对应 colors 配置中的 ID 标识 + defaultColor: "2" + ## 默认的菜单主题 dark-theme 黑 / light-theme 白 + defaultMenu: "dark-theme" + ## 默认的顶部主题 dark-theme 黑 / light-theme 白 + defaultHeader: "light-theme" + ## 是否允许用户切换主题,false 时关闭自定义主题面板 + allowCustom: true + ## 通栏配置 + banner: false + dark: true +## 主题色配置列表 +colors: +- id: "1" + color: "#16baaa" + second: "#ecf5ff" +- id: "2" + color: "#009688" + second: "#ecf5ff" +- id: "3" + color: "#36b368" + second: "#f0f9eb" +- id: "4" + color: "#f6ad55" + second: "#fdf6ec" +- id: "5" + color: "#f56c6c" + second: "#fef0f0" +- id: "6" + color: "#3963bc" + second: "#ecf5ff" +## 其他配置 +other: + ## 主页动画时长 + keepLoad: "1200" + ## 布局顶部主题 + autoHead: false + ## 页脚 + footer: false +## 头部配置 +header: + ## 站内消息,通过 false 设置关闭 + message: "admin/data/message.json" \ No newline at end of file diff --git a/src/plugin/admin/public/css/form-box.css b/src/plugin/admin/public/css/form-box.css new file mode 100644 index 00000000..cb0b77c9 --- /dev/null +++ b/src/plugin/admin/public/css/form-box.css @@ -0,0 +1,66 @@ + +.mainBox::-webkit-scrollbar { + width: 0px; + height: 0px; +} + +.mainBox::-webkit-scrollbar { + width: 6px; + height: 6px; +} + +.mainBox::-webkit-scrollbar-track { + background: white; + border-radius: 2px; +} + +.mainBox::-webkit-scrollbar-thumb { + background: #E6E6E6; + border-radius: 2px; +} + +.mainBox::-webkit-scrollbar-thumb:hover { + background: #E6E6E6; +} + +.mainBox::-webkit-scrollbar-corner { + background: #f6f6f6; +} + +.mainBox { + width: 100%; + position: absolute; + top: 0px; + left: 0px; + bottom: 50px; + overflow: auto; +} + +.bottom { + width: 100%; + position: absolute; + bottom: 0px; + left: 0px; + height: 50px; + line-height: 50px; + background-color: #F8F8F8; + border-top: 1px solid #eee; +} + +.button-container { + position: absolute; + right: 15px; +} + +.main-container { + margin: 15px; +} + +.main-container .layui-form-item { + margin-bottom: 15px !important; + margin-top: 10px !important; +} + +.main-container.mr-5{ + margin-right: 48px; +} \ No newline at end of file diff --git a/src/plugin/admin/public/css/index.css b/src/plugin/admin/public/css/index.css new file mode 100644 index 00000000..ad17119a --- /dev/null +++ b/src/plugin/admin/public/css/index.css @@ -0,0 +1,3 @@ +.pear-tab-page .layui-tab-content .layui-tab-item:has(iframe){ + overflow-y: hidden; +} \ No newline at end of file diff --git a/src/plugin/admin/public/demos/css/console1.css b/src/plugin/admin/public/css/index/dashboard.css similarity index 98% rename from src/plugin/admin/public/demos/css/console1.css rename to src/plugin/admin/public/css/index/dashboard.css index e175df84..c2d2af9a 100644 --- a/src/plugin/admin/public/demos/css/console1.css +++ b/src/plugin/admin/public/css/index/dashboard.css @@ -21,7 +21,7 @@ } .pear-container { - background-color: whitesmoke; + /*background-color: whitesmoke;*/ margin: 10px; } diff --git a/src/plugin/admin/public/admin/css/pages/login.css b/src/plugin/admin/public/css/login.css similarity index 96% rename from src/plugin/admin/public/admin/css/pages/login.css rename to src/plugin/admin/public/css/login.css index b1f22cf3..43addcac 100644 --- a/src/plugin/admin/public/admin/css/pages/login.css +++ b/src/plugin/admin/public/css/login.css @@ -1,7 +1,9 @@ .layui-form { width: 320px !important; margin: auto !important; - margin-top: 160px !important; +} +body[background] .layui-form { + padding-top: 160px !important; } .layui-form button { diff --git a/src/plugin/admin/public/css/style.css b/src/plugin/admin/public/css/style.css new file mode 100644 index 00000000..cc3e2802 --- /dev/null +++ b/src/plugin/admin/public/css/style.css @@ -0,0 +1,124 @@ +@import "/app/admin/component/pear/css/pear.css"; +@import "/app/admin/admin/css/admin.css"; +@import "/app/admin/admin/css/admin.dark.css"; +@import "/app/admin/admin/css/variables.css"; +@import "/app/admin/admin/css/reset.css"; +@import "/app/admin/css/form-box.css"; +i[class^=layui-icon-] { + font-family: layui-icon !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.pear-nav-tree .layui-nav-child dd a i.layui-icon { + display: inline-block; + margin-left: 26px; + margin-right: 6px; +} +.pear-nav-tree .layui-nav-child dd a i.layui-icon + span { + margin-left: 0 !important; +} +.pear-nav-tree .layui-nav-item a:hover { + background-color: var(--global-primary-color); + color: white !important; + opacity: 0.6; +} +.pear-nav-tree .layui-nav-item a:hover > .layui-nav-more { + color: white !important; +} + +.layui-tab-brief > .layui-tab-title .layui-this { + color: var(--global-primary-color); +} +.layui-tab-brief > .layui-tab-title .layui-this::after { + border-bottom-color: var(--global-primary-color); +} +.layui-tab-brief > .layui-tab-more li.layui-this::after { + border-bottom-color: var(--global-primary-color); +} + +.layui-btn { + background-color: transparent; + color: #5f5f5f; + border-color: #d2d2d2; +} +.layui-btn:hover { + opacity: 0.8; + color: inherit; +} +.layui-btn.layui-btn-primary { + background-color: var(--global-primary-color); + color: #fff; +} +.layui-btn.layui-btn-primary:hover { + background-color: var(--global-primary-color); + color: #fff; +} +.layui-btn.layui-btn-danger { + background-color: #ff5722; + color: white; +} +.layui-btn.layui-btn-danger:hover { + color: white; +} +.layui-btn.layui-btn-success { + background-color: #16baaa; + color: white; +} +.layui-btn.layui-btn-success:hover { + color: white; +} + +.layui-laypage .layui-laypage-curr .layui-laypage-em { + background-color: var(--global-primary-color); +} + +.layui-form-checked[lay-skin=primary] > i, +.layui-form-onswitch { + background-color: var(--global-primary-color); + border-color: var(--global-primary-color); +} + +.layui-form-label.required::after { + content: "*"; + color: red; + display: inline-block; + padding: 7px 5px; + line-height: 20px; + text-align: right; + position: absolute; + right: 0; + top: 5px; +} + +/* dark theme */ +.pear-admin-dark .layui-table .layui-table-click, .pear-admin-dark .layui-table .layui-table-hover, .pear-admin-dark .layui-table .layui-table[lay-even] tbody tr:nth-child(2n) { + background-color: rgba(0, 0, 0, 0.85); +} +.pear-admin-dark .layui-table .layui-table-grid-down, .pear-admin-dark .layui-table .layui-table-cell-c { + background-color: rgb(112, 112, 112); + color: white; + border-width: 0; +} +.pear-admin-dark .layui-form .layui-form-label { + color: white; +} +.pear-admin-dark .layui-form xm-select { + background-color: rgba(0, 0, 0, 0.85); +} +.pear-admin-dark .layui-form xm-select .label-content { + color: white; +} +.pear-admin-dark .layui-form .bottom { + background-color: rgba(0, 0, 0, 0.85); +} +.pear-admin-dark .layui-form .layui-iconpicker .layui-anim, .pear-admin-dark .layui-form .layui-iconpicker .layui-iconpicker-list { + background-color: rgba(0, 0, 0, 0.85) !important; + color: white; +} +.pear-admin-dark .layui-form .layui-iconpicker .layui-iconpicker-icon { + background-color: rgba(0, 0, 0, 0.85); + color: white; +} diff --git a/src/plugin/admin/public/css/style.scss b/src/plugin/admin/public/css/style.scss new file mode 100644 index 00000000..0019e4b3 --- /dev/null +++ b/src/plugin/admin/public/css/style.scss @@ -0,0 +1,178 @@ +@import "/app/admin/component/pear/css/pear.css"; +@import "/app/admin/admin/css/admin.css"; +@import "/app/admin/admin/css/admin.dark.css"; +@import "/app/admin/admin/css/variables.css"; +@import "/app/admin/admin/css/reset.css"; +@import "/app/admin/css/form-box.css"; + +i[class^="layui-icon-"] { + font-family: layui-icon !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.pear-nav-tree { + .layui-nav-child { + dd { + a { + i { + &.layui-icon { + display: inline-block; + margin-left: 26px; + margin-right: 6px; + + & + span { + margin-left: 0 !important; + } + } + } + } + } + } + + .layui-nav-item { + a { + &:hover { + background-color: var(--global-primary-color); + color: white !important; + opacity: 0.6; + + > .layui-nav-more { + color: white !important; + } + } + } + } +} + +.layui-tab-brief { + > { + .layui-tab-title { + .layui-this { + color: var(--global-primary-color); + + &::after { + border-bottom-color: var(--global-primary-color); + } + } + } + + .layui-tab-more li.layui-this::after { + border-bottom-color: var(--global-primary-color); + } + } +} + +.layui-btn { + background-color: transparent; + color: #5f5f5f; + border-color: #d2d2d2; + + &:hover { + opacity: 0.8; + color: inherit; + } + + &.layui-btn-primary { + background-color: var(--global-primary-color); + color: #fff; + + &:hover { + background-color: var(--global-primary-color); + color: #fff; + } + } + + &.layui-btn-danger { + background-color: #ff5722; + color: white; + + &:hover { + color: white; + } + } + + &.layui-btn-success { + background-color: #16BAAAFF; + color: white; + + &:hover { + color: white; + } + } +} + +.layui-laypage { + .layui-laypage-curr { + .layui-laypage-em { + background-color: var(--global-primary-color); + } + } +} + +.layui-form-checked[lay-skin="primary"] > i, +.layui-form-onswitch { + background-color: var(--global-primary-color); + border-color: var(--global-primary-color); +} + +.layui-form-label.required::after { + content: "*"; + color: red; + display: inline-block; + padding: 7px 5px; + line-height: 20px; + text-align: right; + position: absolute; + right: 0; + top: 5px; +} + + +/* dark theme */ + +.pear-admin-dark { + .layui-table { + .layui-table-click, .layui-table-hover, .layui-table[lay-even] tbody tr:nth-child(2n) { + background-color: rgba(0, 0, 0, .85); + } + + .layui-table-grid-down, .layui-table-cell-c { + background-color: rgb(112, 112, 112); + color: white; + border-width: 0; + } + } + + .layui-form { + .layui-form-label { + color: white; + } + + xm-select { + background-color: rgba(0, 0, 0, .85); + + .label-content { + color: white; + } + } + + .bottom { + background-color: rgba(0, 0, 0, .85); + } + + .layui-iconpicker { + .layui-anim, .layui-iconpicker-list { + background-color: rgba(0, 0, 0, .85) !important; + color: white; + } + + .layui-iconpicker-icon { + background-color: rgba(0, 0, 0, .85); + color: white; + } + } + } +} \ No newline at end of file diff --git a/src/plugin/admin/public/demos/LICENSE b/src/plugin/admin/public/demos/LICENSE deleted file mode 100644 index dbdff04a..00000000 --- a/src/plugin/admin/public/demos/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 就眠儀式 pearadmin.com - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/src/plugin/admin/public/demos/console/console1.html b/src/plugin/admin/public/demos/console/console1.html deleted file mode 100644 index 7954a61b..00000000 --- a/src/plugin/admin/public/demos/console/console1.html +++ /dev/null @@ -1,451 +0,0 @@ - - - - - 控制后台 - - - - - - - -
                                      -
                                      -
                                      -
                                      -
                                      今日访问
                                      -
                                      -
                                      -
                                      - 0 -
                                      -
                                      - - - - - - - - - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      提交次数
                                      -
                                      -
                                      -
                                      - 0 -
                                      -
                                      - - - - - - - - - - - - - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      下载数量
                                      -
                                      -
                                      -
                                      - 0 -
                                      -
                                      - - - - - - - - - - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      流量统计
                                      -
                                      -
                                      -
                                      - 0 -
                                      -
                                      - - - - - - - - - - - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      动态
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      七彩枫叶 在 Pear Admin 专区 回答问题

                                      - 几秒前 -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      简 在 Pear Admin 专区 进行了 提问

                                      - 2天前 -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      恒宇少年 将 Pear Admin 更新至 2.3.0 - 版本

                                      - 7天前 -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      如花 在 Pear Admin 社区 发布了 建议

                                      - 7天前 -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      就眠仪式 在 Pear Admin 社区 发布了 建议

                                      - 8天前 -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      贤心 在 Pear Admin 专区 进行了 提问

                                      - 8天前 -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      更 新
                                      -
                                      -
                                        -
                                      • 优化代码格式2021-09-06 11:28
                                      • -
                                      • 新增消息组件2021-09-06 11:28
                                      • -
                                      • 移动端兼容2021-09-06 11:28
                                      • -
                                      • 系统布局优化2021-09-06 11:28
                                      • -
                                      • 兼容多系统菜单模式2021-09-06 11:28
                                      • -
                                      • 兼容多标签页切换2021-09-06 11:28
                                      • -
                                      • 扩展下拉组件2021-09-06 11:28
                                      • -
                                      • 扩展卡片样式2021-09-06 11:28
                                      • -
                                      -
                                      -
                                      -
                                      -
                                      - 链接 -
                                      -
                                      - 官 - 网 -
                                      - 下 载 -
                                      - 后 端 -
                                      -
                                      -
                                      -
                                      - 寄语 -
                                      -
                                      - 原想将澎湃的爱平平稳稳放置你手心,奈何我徒有一股蛮劲,只顾向你跑去,一个不稳跌的满身脏兮兮。试图爬起的我, - 心想你会不会笑我 " 献爱献的这样笨拙, 怎么不知避开爱里的埋伏 " -
                                      -
                                      -
                                      -
                                      -
                                      - - - - - - diff --git a/src/plugin/admin/public/demos/console/console2.html b/src/plugin/admin/public/demos/console/console2.html deleted file mode 100644 index a2f4a7c4..00000000 --- a/src/plugin/admin/public/demos/console/console2.html +++ /dev/null @@ -1,502 +0,0 @@ - - - - - 数据分析 - - - - - - - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - 快捷菜单 -
                                      -
                                      -
                                      -
                                      -
                                      - -
                                      - 主页 -
                                      -
                                      -
                                      - -
                                      - 弹层 -
                                      -
                                      -
                                      - -
                                      - 聊天 -
                                      -
                                      -
                                      - -
                                      - 相机 -
                                      -
                                      -
                                      - -
                                      - 表单 -
                                      -
                                      -
                                      - -
                                      - 安全 -
                                      -
                                      -
                                      - -
                                      - 公告 -
                                      -
                                      -
                                      - -
                                      - 更多 -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - 代办任务 -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      待审评论
                                      -
                                      21
                                      -
                                      -
                                      -
                                      -
                                      -
                                      待审帖子
                                      -
                                      32
                                      -
                                      -
                                      -
                                      -
                                      -
                                      待审文章
                                      -
                                      14
                                      -
                                      -
                                      -
                                      -
                                      -
                                      待审用户
                                      -
                                      63
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - 使用记录 -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      留言板
                                      -
                                      -
                                        -
                                      • -

                                        要不要作为我的家人,搬来我家。

                                        - 12月25日 19:92 - 回复 -
                                      • -
                                      • -

                                        快乐的时候不敢尽兴,频繁警戒自己保持清醒。

                                        - 4月30日 22:43 - 回复 -
                                      • -
                                      • -

                                        夏天真的来了,尽管它还有些犹豫。

                                        - 4月30日 22:43 - 回复 -
                                      • -
                                      • -

                                        看似不可达到的高度,只要坚持不懈就可能到达。

                                        - 4月30日 22:43 - 回复 -
                                      • -
                                      • -

                                        当浑浊变成了一种常态,那么清白就成了一种罪过。

                                        - 4月30日 22:43 - 回复 -
                                      • -
                                      • -

                                        那是一种内在的东西,他们到达不了,也无法触及!

                                        - 5月12日 01:25 - 回复 -
                                      • - -
                                      • -

                                        希望是一个好东西,也许是最好的,好东西是不会消亡的!

                                        - 6月11日 15:33 - 回复 -
                                      • -
                                      • -

                                        一切都在不可避免的走向庸俗。

                                        - 2月09日 13:40 - 回复 -
                                      • -
                                      • -

                                        路上没有灯火的时候,就点亮自己的头颅。

                                        - 3月11日 12:30 - 回复 -
                                      • - -
                                      • -

                                        我们应该不虚度一生,应该能够说:"我已经做了我能做的事。"

                                        - 4月30日 22:43 - 回复 -
                                      • - -
                                      • -

                                        接近,是我对一切的态度,是我对一切态度的距离

                                        - 6月11日 15:33 - 回复 -
                                      • -
                                      • -

                                        没有锚的船当然也可以航行,只是紧张充满你的一生。

                                        - 2月09日 13:40 - 回复 -
                                      • -
                                      -
                                      -
                                      -
                                      -
                                      - - - - - - diff --git a/src/plugin/admin/public/demos/css/console2.css b/src/plugin/admin/public/demos/css/console2.css deleted file mode 100644 index 4aaa7e51..00000000 --- a/src/plugin/admin/public/demos/css/console2.css +++ /dev/null @@ -1,121 +0,0 @@ -.pear-container { - background-color: whitesmoke; - margin: 10px; -} - -.pear-card { - width: 100%; - height: 66px; - background-color: #F8F8F8; - display: inline-block; - border-radius: 5px; - text-align: center; - margin-bottom: 3px; -} - -.pear-card:hover, -.pear-card2:hover { - box-shadow: 2px 0 8px 0 lightgray !important; -} - -.pear-card2 { - width: 100%; - height: 90px; - background-color: #F8F8F8; - display: inline-block; - border-radius: 5px; - text-align: center; - margin-bottom: 3px; -} - -.pear-card2 i { - font-size: 30px; - height: 90px; - line-height: 90px; -} - -.pear-card i { - font-size: 30px; - height: 66px; - line-height: 66px; -} - -.layui-col-md3 { - text-align: center; -} - -.pear-card-title { - margin-top: 3px; -} - -.person img { - width: 90px; - height: 90px; - border-radius: 4px; - margin-top: 8px; - margin-left: 8px; -} - -.pear-card2 .count { - color: #51A351; - font-size: 30px; - margin-top: 12px; -} - -.pear-card2 .title { - color: gray; - font-size: 14px; - margin-top: 14px; -} - -.pear-card-status { - padding: 0 10px 10px; -} - -.pear-card-status li { - position: relative; - padding: 10px 0; - border-bottom: 1px solid #EEE; -} - -.pear-card-status li h3 { - padding-bottom: 5px; - font-weight: 700; -} - -.pear-card-status li p { - padding-bottom: 10px; - padding-top: 3px; -} - -.pear-card-status li>span { - color: #999; - height: 24px; - line-height: 24px; -} - -.pear-reply { - position: absolute; - right: 20px; - bottom: 12px; - height: 24px; - line-height: 24px; -} - -.person .title { - font-size: 17px; - font-weight: 600; - margin-left: 18px; - margin-top: 16px; - position: absolute; - display: inline-block; -} - -.person .desc { - font-size: 16px; - font-weight: 600; - margin-left: 115px; - margin-top: -30px; - position: absolute; - display: inline-block; -} diff --git a/src/plugin/admin/public/demos/css/department.css b/src/plugin/admin/public/demos/css/department.css deleted file mode 100644 index d6898b7d..00000000 --- a/src/plugin/admin/public/demos/css/department.css +++ /dev/null @@ -1,6 +0,0 @@ -.organizationTree { - width: 100% !important; - height: -webkit-calc(100vh - 130px); - height: -moz-calc(100vh - 130px); - height: calc(100vh - 130px); -} diff --git a/src/plugin/admin/public/demos/css/error.css b/src/plugin/admin/public/demos/css/error.css deleted file mode 100644 index 37d4c0e6..00000000 --- a/src/plugin/admin/public/demos/css/error.css +++ /dev/null @@ -1,76 +0,0 @@ -* { - padding: 0; - margin: 0; - font-size: 0.38rem; -} - -ul { - list-style: none; -} - -a { - text-decoration: none; - -webkit-tap-highlight-color: transparent -} - -.clearfix:after { - content: ''; - width: 0; - height: 0; - display: block; - clear: both; -} - -html { - height: 100%; - width: 100%; -} - -body { - font-size: 0.28rem; - height: 100%; - width: 100%; - display: flex; - flex-direction: column; - position: relative; - background-color: white !important; -} - -.content { - position: absolute; - top: 50%; - transform: translateY(-50%); - width: 100%; - text-align: center; -} - -.content>img { - height: 300px; - max-width: 370px; - margin-right: 180px; -} - -.content>* { - display: inline-block; -} - -.content-r { - vertical-align: top; -} - -.content-r>h1 { - font-size: 72px; - color: #434e59; - margin-bottom: 24px; - font-weight: 600; -} - -.content-r>p { - font-size: 20px; - color: rgba(0, 0, 0, .45); - margin-bottom: 16px; -} - -button { - margin-top: 20px; -} diff --git a/src/plugin/admin/public/demos/css/icon.css b/src/plugin/admin/public/demos/css/icon.css deleted file mode 100644 index cd1a6ce3..00000000 --- a/src/plugin/admin/public/demos/css/icon.css +++ /dev/null @@ -1,531 +0,0 @@ -/* Logo 字体 */ -@font-face { - font-family: "iconfont logo"; - src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834'); - src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834#iefix') format('embedded-opentype'), - url('https://at.alicdn.com/t/font_985780_km7mi63cihi.woff?t=1545807318834') format('woff'), - url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'), - url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') format('svg'); -} - -.logo { - font-family: "iconfont logo"; - font-size: 160px; - font-style: normal; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -/* tabs */ -.nav-tabs { - position: relative; -} - -.nav-tabs .nav-more { - position: absolute; - right: 0; - bottom: 0; - height: 42px; - line-height: 42px; - color: #666; -} - -#tabs { - border-bottom: 1px solid #eee; -} - -#tabs li { - cursor: pointer; - width: 100px; - height: 40px; - line-height: 40px; - text-align: center; - font-size: 16px; - border-bottom: 2px solid transparent; - position: relative; - z-index: 1; - margin-bottom: -1px; - color: #666; -} - - -#tabs .active { - border-bottom-color: #f00; - color: #222; -} - -.tab-container .content { - display: none; -} - -/* 页面布局 */ -.main { - padding: 30px 100px; - width: 960px; - margin: 0 auto; -} - -.main .logo { - color: #333; - text-align: left; - margin-bottom: 30px; - line-height: 1; - height: 110px; - margin-top: -50px; - overflow: hidden; - *zoom: 1; -} - -.main .logo a { - font-size: 160px; - color: #333; -} - -.helps { - margin-top: 40px; -} - -.helps pre { - padding: 20px; - margin: 10px 0; - border: solid 1px #e7e1cd; - background-color: #fffdef; - overflow: auto; -} - -.icon_lists { - width: 100% !important; - overflow: hidden; - *zoom: 1; -} - -.icon_lists li { - width: 100px; - margin-bottom: 10px; - margin-right: 20px; - text-align: center; - list-style: none !important; - cursor: default; -} - -.icon_lists li .code-name { - line-height: 1.2; -} - -.icon_lists .icon { - display: block; - height: 100px; - line-height: 100px; - font-size: 42px; - margin: 10px auto; - color: #333; - -webkit-transition: font-size 0.25s linear, width 0.25s linear; - -moz-transition: font-size 0.25s linear, width 0.25s linear; - transition: font-size 0.25s linear, width 0.25s linear; -} - -.icon_lists .icon:hover { - font-size: 100px; -} - -.icon_lists .svg-icon { - /* 通过设置 font-size 来改变图标大小 */ - width: 1em; - /* 图标和文字相邻时,垂直对齐 */ - vertical-align: -0.15em; - /* 通过设置 color 来改变 SVG 的颜色/fill */ - fill: currentColor; - /* path 和 stroke 溢出 viewBox 部分在 IE 下会显示 - normalize.css 中也包含这行 */ - overflow: hidden; -} - -.icon_lists li .name, -.icon_lists li .code-name { - color: #666; -} - -/* markdown 样式 */ -.markdown { - color: #666; - font-size: 14px; - line-height: 1.8; -} - -.highlight { - line-height: 1.5; -} - -.markdown img { - vertical-align: middle; - max-width: 100%; -} - -.markdown h1 { - color: #404040; - font-weight: 500; - line-height: 40px; - margin-bottom: 24px; -} - -.markdown h2, -.markdown h3, -.markdown h4, -.markdown h5, -.markdown h6 { - color: #404040; - margin: 1.6em 0 0.6em 0; - font-weight: 500; - clear: both; -} - -.markdown h1 { - font-size: 28px; -} - -.markdown h2 { - font-size: 22px; -} - -.markdown h3 { - font-size: 16px; -} - -.markdown h4 { - font-size: 14px; -} - -.markdown h5 { - font-size: 12px; -} - -.markdown h6 { - font-size: 12px; -} - -.markdown hr { - height: 1px; - border: 0; - background: #e9e9e9; - margin: 16px 0; - clear: both; -} - -.markdown p { - margin: 1em 0; -} - -.markdown>p, -.markdown>blockquote, -.markdown>.highlight, -.markdown>ol, -.markdown>ul { - width: 80%; -} - -.markdown ul>li { - list-style: circle; -} - -.markdown>ul li, -.markdown blockquote ul>li { - margin-left: 20px; - padding-left: 4px; -} - -.markdown>ul li p, -.markdown>ol li p { - margin: 0.6em 0; -} - -.markdown ol>li { - list-style: decimal; -} - -.markdown>ol li, -.markdown blockquote ol>li { - margin-left: 20px; - padding-left: 4px; -} - -.markdown code { - margin: 0 3px; - padding: 0 5px; - background: #eee; - border-radius: 3px; -} - -.markdown strong, -.markdown b { - font-weight: 600; -} - -.markdown>table { - border-collapse: collapse; - border-spacing: 0px; - empty-cells: show; - border: 1px solid #e9e9e9; - width: 95%; - margin-bottom: 24px; -} - -.markdown>table th { - white-space: nowrap; - color: #333; - font-weight: 600; -} - -.markdown>table th, -.markdown>table td { - border: 1px solid #e9e9e9; - padding: 8px 16px; - text-align: left; -} - -.markdown>table th { - background: #F7F7F7; -} - -.markdown blockquote { - font-size: 90%; - color: #999; - border-left: 4px solid #e9e9e9; - padding-left: 0.8em; - margin: 1em 0; -} - -.markdown blockquote p { - margin: 0; -} - -.markdown .anchor { - opacity: 0; - transition: opacity 0.3s ease; - margin-left: 8px; -} - -.markdown .waiting { - color: #ccc; -} - -.markdown h1:hover .anchor, -.markdown h2:hover .anchor, -.markdown h3:hover .anchor, -.markdown h4:hover .anchor, -.markdown h5:hover .anchor, -.markdown h6:hover .anchor { - opacity: 1; - display: inline-block; -} - -.markdown>br, -.markdown>p>br { - clear: both; -} - - -.hljs { - display: block; - background: white; - padding: 0.5em; - color: #333333; - overflow-x: auto; -} - -.hljs-comment, -.hljs-meta { - color: #969896; -} - -.hljs-string, -.hljs-variable, -.hljs-template-variable, -.hljs-strong, -.hljs-emphasis, -.hljs-quote { - color: #df5000; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-type { - color: #a71d5d; -} - -.hljs-literal, -.hljs-symbol, -.hljs-bullet, -.hljs-attribute { - color: #0086b3; -} - -.hljs-section, -.hljs-name { - color: #63a35c; -} - -.hljs-tag { - color: #333333; -} - -.hljs-title, -.hljs-attr, -.hljs-selector-id, -.hljs-selector-class, -.hljs-selector-attr, -.hljs-selector-pseudo { - color: #795da3; -} - -.hljs-addition { - color: #55a532; - background-color: #eaffea; -} - -.hljs-deletion { - color: #bd2c00; - background-color: #ffecec; -} - -.hljs-link { - text-decoration: underline; -} - -code[class*="language-"], -pre[class*="language-"] { - color: black; - background: none; - text-shadow: 0 1px white; - font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - word-wrap: normal; - line-height: 1.5; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -pre[class*="language-"]::-moz-selection, -pre[class*="language-"] ::-moz-selection, -code[class*="language-"]::-moz-selection, -code[class*="language-"] ::-moz-selection { - text-shadow: none; - background: #b3d4fc; -} - -pre[class*="language-"]::selection, -pre[class*="language-"] ::selection, -code[class*="language-"]::selection, -code[class*="language-"] ::selection { - text-shadow: none; - background: #b3d4fc; -} - -@media print { - - code[class*="language-"], - pre[class*="language-"] { - text-shadow: none; - } -} - -/* Code blocks */ -pre[class*="language-"] { - padding: 1em; - margin: .5em 0; - overflow: auto; -} - -:not(pre)>code[class*="language-"], -pre[class*="language-"] { - background: #f5f2f0; -} - -/* Inline code */ -:not(pre)>code[class*="language-"] { - padding: .1em; - border-radius: .3em; - white-space: normal; -} - -.token.comment, -.token.prolog, -.token.doctype, -.token.cdata { - color: slategray; -} - -.token.punctuation { - color: #999; -} - -.namespace { - opacity: .7; -} - -.token.property, -.token.tag, -.token.boolean, -.token.number, -.token.constant, -.token.symbol, -.token.deleted { - color: #905; -} - -.token.selector, -.token.attr-name, -.token.string, -.token.char, -.token.builtin, -.token.inserted { - color: #690; -} - -.token.operator, -.token.entity, -.token.url, -.language-css .token.string, -.style .token.string { - color: #9a6e3a; - background: hsla(0, 0%, 100%, .5); -} - -.token.atrule, -.token.attr-value, -.token.keyword { - color: #07a; -} - -.token.function, -.token.class-name { - color: #DD4A68; -} - -.token.regex, -.token.important, -.token.variable { - color: #e90; -} - -.token.important, -.token.bold { - font-weight: bold; -} - -.token.italic { - font-style: italic; -} - -.token.entity { - cursor: help; -} diff --git a/src/plugin/admin/public/demos/css/login.css b/src/plugin/admin/public/demos/css/login.css deleted file mode 100644 index 70d5346e..00000000 --- a/src/plugin/admin/public/demos/css/login.css +++ /dev/null @@ -1,99 +0,0 @@ -.layui-form { - width: 320px !important; - margin: auto !important; - margin-top: 160px !important; -} - -.layui-form button { - width: 100% !important; - height: 44px !important; - line-height: 44px !important; - font-size: 16px !important; - background-color: #5FB878 !important; - font-weight: 550 !important; -} - -.layui-form-checked[lay-skin=primary] i { - border-color: #5FB878 !important; - background-color: #5FB878 !important; - color: #fff !important; -} - -.layui-tab-content { - margin-top: 15px !important; - padding-left: 0px !important; - padding-right: 0px !important; -} - -.layui-form-item { - margin-top: 20px !important; -} - -.layui-input { - height: 44px !important; - line-height: 44px !important; - padding-left: 15px !important; - border-radius: 3px !important; -} - -.layui-input:focus { - box-shadow: 0px 0px 2px 1px #5FB878 !important; -} - -.layui-form-danger:focus{ - box-shadow: 0px 0px 2px 1px #f56c6c !important; -} - -.logo { - width: 40px !important; - margin-top: 10px !important; - margin-bottom: 10px !important; - margin-left: 20px !important; -} - -.title { - font-size: 26px !important; - font-weight: 550 !important; - margin-left: 10px !important; - color: #5FB878 !important; - display: inline-block !important; - height: 60px !important; - line-height: 60px !important; - margin-top: 10px !important; - position: absolute !important; -} - -.desc { - width: 100% !important; - text-align: center !important; - color: gray !important; - height: 60px !important; - line-height: 60px !important; -} - -body { - background-repeat:no-repeat; - background-color: whitesmoke; - background-size: 100%; - height: 100%; - } - -.code { - float: left; - margin-right: 13px; - margin: 0px !important; - border: #e6e6e6 1px solid; - display: inline-block!important; -} - -.codeImage { - float: right; - height: 42px; - border: #e6e6e6 1px solid; -} - -@media (max-width:768px){ - body{ - background-position:center; - } -} diff --git a/src/plugin/admin/public/demos/css/person.css b/src/plugin/admin/public/demos/css/person.css deleted file mode 100644 index 53c787a7..00000000 --- a/src/plugin/admin/public/demos/css/person.css +++ /dev/null @@ -1,80 +0,0 @@ -.pear-container { - background-color: whitesmoke; - margin: 10px; -} -.layui-body { - padding: 25px; -} -.text-center { - text-align: center; -} -.user-info-head { - width: 110px; - height: 110px; - line-height: 110px; - position: relative; - display: inline-block; - border-radius: 50%; - overflow: hidden; - cursor: pointer; - margin: 0 auto; -} -.layui-line-dash { - border-bottom: 1px dashed #ccc; - margin: 15px 0; -} -.comment { - position: absolute; - bottom: 3px; - right: 10px; - font-size: 12px; - color: dimgray; -} -.content { - padding-left: 13px; - font-size: 13px; - color: dimgray; -} -.title { - padding-left: 13.5px; -} -.layui-tab-title { - border-bottom: none; -} -.fl-item { - height: 30px; - font-size: 13.5; -} -.dot { - width: 10px; - height: 10px; - border-radius: 50px; - background-color: gray; - display: inline-block; - margin-right: 10px; -} - -.list .list-item { - height: 32px; - line-height: 32px; - color: gray; - padding: 5px; - padding-left: 15px; - border-radius: 4px; - margin-top: 5.2px; -} - -.list .list-item:hover { - background-color: whitesmoke; -} - -.list .list-item .title { - font-size: 13px; - width: 100%; -} - -.list .list-item .footer { - position: absolute; - right: 30px; - font-size: 12px; -} diff --git a/src/plugin/admin/public/demos/data/card.json b/src/plugin/admin/public/demos/data/card.json deleted file mode 100644 index e2385906..00000000 --- a/src/plugin/admin/public/demos/data/card.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "msg": "not data", - "count": 30, - "data": [{ - "id": "1", - "image": "https://gw.alipayobjects.com/zos/rmsportal/gLaIAoVWTtLbBWZNYEMg.png", - "title": "Alipay", - "remark": "那是一种内在的东西, 他们到达不了,也无法触及的", - "time": "几秒前" - }, { - "id": "2", - "image": "https://gw.alipayobjects.com/zos/rmsportal/iXjVmWVHbCJAyqvDxdtx.png", - "title": "Layui", - "remark": "生命就像一盒巧克力,结果往往出人意料", - "time": "几秒前" - }, { - "id": "3", - "image": "https://gw.alipayobjects.com/zos/rmsportal/iZBVOIhGJiAnhplqjvZW.png", - "title": "Angular", - "remark": "希望是一个好东西,也许是最好的,好东西是不会消亡的", - "time": "几秒前" - }, - { - "id": "4", - "image": "https://gw.alipayobjects.com/zos/rmsportal/uMfMFlvUuceEyPpotzlq.png", - "title": "React", - "remark": "那是一种内在的东西, 他们到达不了,也无法触及的", - "time": "几秒前" - }, { - "id": "5", - "image": "https://gw.alipayobjects.com/zos/rmsportal/gLaIAoVWTtLbBWZNYEMg.png", - "title": "Alipay", - "remark": "那是一种内在的东西, 他们到达不了,也无法触及的", - "time": "几秒前" - }, { - "id": "6", - "image": "https://gw.alipayobjects.com/zos/rmsportal/iXjVmWVHbCJAyqvDxdtx.png", - "title": "Layui", - "remark": "生命就像一盒巧克力,结果往往出人意料", - "time": "几秒前" - }, { - "id": "7", - "image": "https://gw.alipayobjects.com/zos/rmsportal/iZBVOIhGJiAnhplqjvZW.png", - "title": "Angular", - "remark": "希望是一个好东西,也许是最好的,好东西是不会消亡的", - "time": "几秒前" - }, - { - "id": "8", - "image": "https://gw.alipayobjects.com/zos/rmsportal/uMfMFlvUuceEyPpotzlq.png", - "title": "React", - "remark": "那是一种内在的东西, 他们到达不了,也无法触及的", - "time": "几秒前" - } - ], - "code": 0 -} diff --git a/src/plugin/admin/public/demos/data/dataMenu.json b/src/plugin/admin/public/demos/data/dataMenu.json deleted file mode 100644 index 18c5adb7..00000000 --- a/src/plugin/admin/public/demos/data/dataMenu.json +++ /dev/null @@ -1,377 +0,0 @@ -{ - "code": 0, - "msg": "ok", - "data": [{ - "id": 1, - "title": "工作空间", - "type": 0, - "icon": "layui-icon layui-icon-console", - "href": "", - "children": [{ - "id": 10, - "title": "控制后台", - "icon": "layui-icon layui-icon-console", - "type": 1, - "openType": "_iframe", - "href": "view/console/console1.html" - }, { - "id": 13, - "title": "数据分析", - "icon": "layui-icon layui-icon-console", - "type": 1, - "openType": "_iframe", - "href": "view/console/console2.html" - }, { - "id": 14, - "title": "百度一下", - "icon": "layui-icon layui-icon-console", - "type": 1, - "openType": "_iframe", - "href": "http://www.baidu.com" - }, { - "id": 15, - "title": "主题预览", - "icon": "layui-icon layui-icon-console", - "type": 1, - "openType": "_iframe", - "href": "view/system/theme.html" - }] - }, - { - "id": "component", - "title": "常用组件", - "icon": "layui-icon layui-icon-component", - "type": 0, - "href": "", - "children": [{ - "id": 201, - "title": "基础组件", - "icon": "layui-icon layui-icon-console", - "type": 0, - "children": [{ - "id": 2011, - "title": "功能按钮", - "icon": "layui-icon layui-icon-face-smile", - "type": 1, - "openType": "_iframe", - "href": "view/document/button.html" - }, { - "id": 2014, - "title": "表单集合", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/form.html" - }, { - "id": 2010, - "title": "字体图标", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/icon.html" - }, { - "id": 2012, - "title": "多选下拉", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/select.html" - }, { - "id": 2013, - "title": "动态标签", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/tag.html" - }] - }, { - "id": 203, - "title": "进阶组件", - "icon": "layui-icon layui-icon-console", - "type": 0, - "children": [{ - "id": 2031, - "title": "数据表格", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/table.html" - }, { - "id": 2032, - "title": "分布表单", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/step.html" - }, { - "id": 2033, - "title": "树形表格", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/treetable.html" - }, { - "id": 2034, - "title": "树状结构", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/dtree.html" - }, { - "id": 2035, - "title": "文本编辑", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/tinymce.html" - }, { - "id": 2036, - "title": "卡片组件", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/card.html" - }] - }, { - "id": 202, - "title": "弹层组件", - "icon": "layui-icon layui-icon-console", - "type": 0, - "children": [{ - "id": 2021, - "title": "抽屉组件", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/drawer.html" - }, { - "id": 2022, - "title": "消息通知", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/notice.html" - }, { - "id": 2024, - "title": "加载组件", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/loading.html" - }, { - "id": 2023, - "title": "弹层组件", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/popup.html" - }] - }, { - "id": 60331, - "title": "高级组件", - "icon": "layui-icon layui-icon-console", - "type": 0, - "children": [{ - "id": 60131, - "title": "多选项卡", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/tab.html" - }, { - "id": 60132, - "title": "数据菜单", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/menu.html" - }] - }, { - "id": 204, - "title": "其他组件", - "icon": "layui-icon layui-icon-console", - "type": 0, - "children": [{ - "id": 2041, - "title": "哈希加密", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/hash.html" - }, - { - "id": 2042, - "title": "图标选择", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/iconPicker.html" - }, - { - "id": 2043, - "title": "省市级联", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/area.html" - }, - { - "id": 2044, - "title": "数字滚动", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/count.html" - }, - { - "id": 2045, - "title": "顶部返回", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/topBar.html" - } - ] - }] - }, - { - "id": "result", - "title": "结果页面", - "icon": "layui-icon layui-icon-auz", - "type": 0, - "href": "", - "children": [{ - "id": "success", - "title": "成功", - "icon": "layui-icon layui-icon-face-smile", - "type": 1, - "openType": "_iframe", - "href": "view/result/success.html" - }, - { - "id": "failure", - "title": "失败", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/result/error.html" - } - ] - }, - { - "id": "error", - "title": "错误页面", - "icon": "layui-icon layui-icon-face-cry", - "type": 0, - "href": "", - "children": [{ - "id": 403, - "title": "403", - "icon": "layui-icon layui-icon-face-smile", - "type": 1, - "openType": "_iframe", - "href": "view/error/403.html" - }, - { - "id": 404, - "title": "404", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/error/404.html" - }, - - { - "id": 500, - "title": "500", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/error/500.html" - } - - ] - }, - { - "id": "system", - "title": "系统管理", - "icon": "layui-icon layui-icon-set-fill", - "type": 0, - "href": "", - "children": [{ - "id": 601, - "title": "用户管理", - "icon": "layui-icon layui-icon-face-smile", - "type": 1, - "openType": "_iframe", - "href": "view/system/user.html" - }, - { - "id": 602, - "title": "角色管理", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/system/role.html" - }, - - { - "id": 603, - "title": "权限管理", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/system/power.html" - }, - - { - "id": 604, - "title": "部门管理", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/system/deptment.html" - }, - { - "id": 605, - "title": "行为日志", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/system/log.html" - }, { - "id": 606, - "title": "数据字典", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/system/dict.html" - } - - ] - }, - { - "id": "common", - "title": "常用页面", - "icon": "layui-icon layui-icon-template-1", - "type": 0, - "href": "", - "children": [{ - "id": 701, - "title": "登录页面", - "icon": "layui-icon layui-icon-face-smile", - "type": 1, - "openType": "_iframe", - "href": "login.html" - }, { - "id": 702, - "title": "空白页面", - "icon": "layui-icon layui-icon-face-smile", - "type": 1, - "openType": "_iframe", - "href": "view/system/space.html" - }] - } - ] -} - diff --git a/src/plugin/admin/public/demos/data/dataTree2.json b/src/plugin/admin/public/demos/data/dataTree2.json deleted file mode 100644 index 86e8923c..00000000 --- a/src/plugin/admin/public/demos/data/dataTree2.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "status": { - "code": 200, - "message": "操作成功" - }, - "data": [{ - "id": "001", - "title": "湖南省", - "checkArr": "0", - "parentId": "0" - }, - { - "id": "002", - "title": "湖北省", - "checkArr": "0", - "parentId": "0" - }, - { - "id": "003", - "title": "广东省", - "checkArr": "0", - "parentId": "0" - }, - { - "id": "004", - "title": "浙江省", - "checkArr": "0", - "parentId": "0" - }, - { - "id": "005", - "title": "福建省", - "checkArr": "0", - "parentId": "0" - } - ] -} diff --git a/src/plugin/admin/public/demos/data/dictData.json b/src/plugin/admin/public/demos/data/dictData.json deleted file mode 100644 index db7ae118..00000000 --- a/src/plugin/admin/public/demos/data/dictData.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "code": 0, - "msg": null, - "count": 2, - "data": [{ - "createTime": null, - "createBy": null, - "createName": null, - "updateTime": null, - "updateBy": null, - "updateName": null, - "remark": "男 : body", - "params": null, - "dataId": "1317401149287956480", - "dataLabel": "男", - "dataValue": "boy", - "typeCode": "user_sex", - "isDefault": null, - "enable": "0" - }, { - "createTime": null, - "createBy": null, - "createName": null, - "updateTime": null, - "updateBy": null, - "updateName": null, - "remark": "女 : girl", - "params": null, - "dataId": "1317402976670711808", - "dataLabel": "女", - "dataValue": "girl", - "typeCode": "user_sex", - "isDefault": null, - "enable": "0" - }] -} diff --git a/src/plugin/admin/public/demos/data/dictType.json b/src/plugin/admin/public/demos/data/dictType.json deleted file mode 100644 index 3b9ab26e..00000000 --- a/src/plugin/admin/public/demos/data/dictType.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "code": 0, - "msg": null, - "count": 6, - "data": [{ - "createTime": null, - "createBy": null, - "createName": null, - "updateTime": null, - "updateBy": null, - "updateName": null, - "remark": null, - "params": null, - "id": "1304489072256876544", - "typeName": "用户状态", - "typeCode": "user_status", - "description": "用户状态", - "enable": "0" - }, { - "createTime": null, - "createBy": null, - "createName": null, - "updateTime": null, - "updateBy": null, - "updateName": null, - "remark": null, - "params": null, - "id": "1317360314219495424", - "typeName": "登录类型", - "typeCode": "login", - "description": "登录类型", - "enable": "0" - }, { - "createTime": null, - "createBy": null, - "createName": null, - "updateTime": null, - "updateBy": null, - "updateName": null, - "remark": null, - "params": null, - "id": "1317400519127334912", - "typeName": "用户类型", - "typeCode": "user_status", - "description": "用户类型", - "enable": "0" - }, { - "createTime": null, - "createBy": null, - "createName": null, - "updateTime": null, - "updateBy": null, - "updateName": null, - "remark": null, - "params": null, - "id": "1317400823096934400", - "typeName": "配置类型", - "typeCode": "config_type", - "description": "配置类型", - "enable": "0" - }, { - "createTime": null, - "createBy": null, - "createName": null, - "updateTime": null, - "updateBy": null, - "updateName": null, - "remark": null, - "params": null, - "id": "455184568505470976", - "typeName": "用户性别", - "typeCode": "user_sex", - "description": "用户性别", - "enable": "0" - }, { - "createTime": null, - "createBy": null, - "createName": null, - "updateTime": null, - "updateBy": null, - "updateName": null, - "remark": null, - "params": null, - "id": "455184935989415936", - "typeName": "全局状态", - "typeCode": "sys_status", - "description": "状态描述\n", - "enable": "0" - }] -} diff --git a/src/plugin/admin/public/demos/data/dtree.json b/src/plugin/admin/public/demos/data/dtree.json deleted file mode 100644 index 376d9b0d..00000000 --- a/src/plugin/admin/public/demos/data/dtree.json +++ /dev/null @@ -1,181 +0,0 @@ -{ - "status": { - "code": 200, - "message": "操作成功" - }, - "data": [{ - "id": "001", - "title": "湖南省", - "parentId": "0", - "children": [{ - "id": "001001", - "title": "长沙市", - "last": true, - "parentId": "001" - }, - { - "id": "001002", - "title": "株洲市", - "last": true, - "parentId": "001" - }, - { - "id": "001003", - "title": "湘潭市", - "last": true, - "parentId": "001" - }, - { - "id": "001004", - "title": "衡阳市", - "last": true, - "parentId": "001" - }, - { - "id": "001005", - "title": "郴州市", - "last": true, - "parentId": "001" - } - ] - }, - { - "id": "002", - "title": "湖北省", - "parentId": "0", - "children": [{ - "id": "002001", - "title": "武汉市", - "last": true, - "parentId": "002" - }, - { - "id": "002002", - "title": "黄冈市", - "last": true, - "parentId": "002" - }, - { - "id": "002003", - "title": "潜江市", - "last": true, - "parentId": "002" - }, - { - "id": "002004", - "title": "荆州市", - "last": true, - "parentId": "002" - }, - { - "id": "002005", - "title": "襄阳市", - "last": true, - "parentId": "002" - } - ] - }, - { - "id": "003", - "title": "广东省", - "parentId": "0", - "children": [{ - "id": "003001", - "title": "广州市", - "last": false, - "parentId": "003", - "children": [{ - "id": "003001001", - "title": "天河区", - "last": true, - "parentId": "003001" - }, - { - "id": "003001002", - "title": "花都区", - "last": true, - "parentId": "003001" - } - ] - }, - { - "id": "003002", - "title": "深圳市", - "last": true, - "parentId": "003" - }, - { - "id": "003003", - "title": "中山市", - "last": true, - "parentId": "003" - }, - { - "id": "003004", - "title": "东莞市", - "last": true, - "parentId": "003" - }, - { - "id": "003005", - "title": "珠海市", - "last": true, - "parentId": "003" - }, - { - "id": "003006", - "title": "韶关市", - "last": true, - "parentId": "003" - } - ] - }, - { - "id": "004", - "title": "浙江省", - "parentId": "0", - "children": [{ - "id": "004001", - "title": "杭州市", - "last": true, - "parentId": "004" - }, - { - "id": "004002", - "title": "温州市", - "last": true, - "parentId": "004" - }, - { - "id": "004003", - "title": "绍兴市", - "last": true, - "parentId": "004" - }, - { - "id": "004004", - "title": "金华市", - "last": true, - "parentId": "004" - }, - { - "id": "004005", - "title": "义乌市", - "last": true, - "parentId": "004" - } - ] - }, - { - "id": "005", - "title": "福建省", - "parentId": "0", - "children": [{ - "id": "005001", - "title": "厦门市", - "last": true, - "parentId": "005" - }] - } - ] -} diff --git a/src/plugin/admin/public/demos/data/loginLog.json b/src/plugin/admin/public/demos/data/loginLog.json deleted file mode 100644 index eb39552f..00000000 --- a/src/plugin/admin/public/demos/data/loginLog.json +++ /dev/null @@ -1,211 +0,0 @@ -{ - "createTime": null, - "createBy": null, - "updateTime": null, - "updateBy": null, - "remark": null, - "code": 0, - "msg": null, - "count": 167, - "data": [{ - "id": "1305106851892822016", - "title": "登录", - "description": "登录成功", - "businessType": "OTHER", - "requestMethod": "POST", - "method": "/login", - "operateUrl": "/login", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "LOGIN", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T11:31:36.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }, { - "id": "1305101593019940864", - "title": "登录", - "description": "登录成功", - "businessType": "OTHER", - "requestMethod": "POST", - "method": "/login", - "operateUrl": "/login", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "LOGIN", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T11:10:42.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }, { - "id": "1305101247900024832", - "title": "登录", - "description": "登录成功", - "businessType": "OTHER", - "requestMethod": "POST", - "method": "/login", - "operateUrl": "/login", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "LOGIN", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T11:09:20.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }, { - "id": "1305099674977304576", - "title": "登录", - "description": "登录成功", - "businessType": "OTHER", - "requestMethod": "POST", - "method": "/login", - "operateUrl": "/login", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "LOGIN", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T11:03:05.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }, { - "id": "1305095186061197312", - "title": "登录", - "description": "登录成功", - "businessType": "OTHER", - "requestMethod": "POST", - "method": "/login", - "operateUrl": "/login", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "LOGIN", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T10:45:15.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }, { - "id": "1305092027951611904", - "title": "登录", - "description": "登录成功", - "businessType": "OTHER", - "requestMethod": "POST", - "method": "/login", - "operateUrl": "/login", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "LOGIN", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T10:32:42.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }, { - "id": "1305082862634008576", - "title": "登录", - "description": "登录成功", - "businessType": "OTHER", - "requestMethod": "POST", - "method": "/login", - "operateUrl": "/login", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "LOGIN", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T09:56:16.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }, { - "id": "1305071134877679616", - "title": "登录", - "description": "登录成功", - "businessType": "OTHER", - "requestMethod": "POST", - "method": "/login", - "operateUrl": "/login", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "LOGIN", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T09:09:40.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }, { - "id": "1305070481803575296", - "title": "登录", - "description": "登录成功", - "businessType": "OTHER", - "requestMethod": "POST", - "method": "/login", - "operateUrl": "/login", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "LOGIN", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T09:07:05.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }, { - "id": "1305064691009060864", - "title": "登录", - "description": "登录成功", - "businessType": "OTHER", - "requestMethod": "POST", - "method": "/login", - "operateUrl": "/login", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "LOGIN", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T08:44:04.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }] -} diff --git a/src/plugin/admin/public/demos/data/menu.json b/src/plugin/admin/public/demos/data/menu.json deleted file mode 100644 index 3a20b6e4..00000000 --- a/src/plugin/admin/public/demos/data/menu.json +++ /dev/null @@ -1,444 +0,0 @@ -[{ - "id": 1, - "title": "工作空间", - "icon": "layui-icon layui-icon-console", - "type": 0, - "href": "", - "children": [{ - "id": 10, - "title": "控制后台", - "icon": "layui-icon layui-icon-console", - "type": 1, - "openType": "_iframe", - "href": "view/console/console1.html" - }, { - "id": 13, - "title": "数据分析", - "icon": "layui-icon layui-icon-console", - "type": 1, - "openType": "_iframe", - "href": "view/console/console2.html" - }, { - "id": 14, - "title": "百度一下", - "icon": "layui-icon layui-icon-console", - "type": 1, - "openType": "_iframe", - "href": "http://www.bing.com" - }, { - "id": 15, - "title": "主题预览", - "icon": "layui-icon layui-icon-console", - "type": 1, - "openType": "_iframe", - "href": "view/system/theme.html" - }, { - "id": 16, - "title": "酸爽翻倍", - "icon": "layui-icon layui-icon-console", - "type": 1, - "openType": "_iframe", - "href": "view/document/core.html" - }] - }, - { - "id": "component", - "title": "常用组件", - "icon": "layui-icon layui-icon-component", - "type": 0, - "href": "", - "children": [{ - "id": 201, - "title": "基础组件", - "icon": "layui-icon layui-icon-console", - "type": 0, - "children": [ - { - "id": 2011, - "title": "功能按钮", - "icon": "layui-icon layui-icon-face-smile", - "type": 1, - "openType": "_iframe", - "href": "view/document/button.html" - }, { - "id": 2014, - "title": "表单集合", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/form.html" - }, { - "id": 2010, - "title": "字体图标", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/icon.html" - }, { - "id": 2012, - "title": "多选下拉", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/select.html" - }, { - "id": 2013, - "title": "动态标签", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/tag.html" - }] - }, { - "id": 203, - "title": "进阶组件", - "icon": "layui-icon layui-icon-console", - "type": 0, - "children": [{ - "id": 2031, - "title": "数据表格", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/table.html" - }, { - "id": 2032, - "title": "分布表单", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/step.html" - }, { - "id": 2033, - "title": "树形表格", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/treetable.html" - }, { - "id": 2034, - "title": "树状结构", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/dtree.html" - }, { - "id": 2035, - "title": "文本编辑", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/tinymce.html" - }, { - "id": 2036, - "title": "卡片组件", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/card.html" - }] - }, { - "id": 202, - "title": "弹层组件", - "icon": "layui-icon layui-icon-console", - "type": 0, - "children": [{ - "id": 2021, - "title": "抽屉组件", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/drawer.html" - }, { - "id": 2022, - "title": "消息通知 (过时)", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/notice.html" - }, { - "id": 2025, - "title": "消息通知 (新增)", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/toast.html" - }, { - "id": 2024, - "title": "加载组件", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/loading.html" - }, { - "id": 2023, - "title": "弹层组件", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/popup.html" - }] - },{ - "id": 60331, - "title": "高级组件", - "icon": "layui-icon layui-icon-console", - "type": 0, - "children": [{ - "id": 60131, - "title": "多选项卡", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/tab.html" - },{ - "id": 60132, - "title": "数据菜单", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/menu.html" - }] - }, { - "id": 204, - "title": "其他组件", - "icon": "layui-icon layui-icon-console", - "type": 0, - "children": [{ - "id": 2041, - "title": "哈希加密", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/encrypt.html" - }, - { - "id": 2042, - "title": "图标选择", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/iconPicker.html" - }, - { - "id": 2043, - "title": "省市级联", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/area.html" - }, - { - "id": 2044, - "title": "数字滚动", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/count.html" - }, - { - "id": 2045, - "title": "顶部返回", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/document/topBar.html" - }, - { - "id": 2046, - "title": "水印组件", - "type": 1, - "openType": "_iframe", - "href": "view/document/watermark.html" - }, - { - "id": 2047, - "title": "全屏组件", - "type": 1, - "openType": "_iframe", - "href": "view/document/fullscreen.html" - }, - { - "id": 2048, - "title": "汽泡组件", - "type": 1, - "openType": "_iframe", - "href": "view/document/popover.html" - } - ] - }] - }, - { - "id": "result", - "title": "结果页面", - "icon": "layui-icon layui-icon-auz", - "type": 0, - "href": "", - "children": [{ - "id": "success", - "title": "成功", - "icon": "layui-icon layui-icon-face-smile", - "type": 1, - "openType": "_iframe", - "href": "view/result/success.html" - }, - { - "id": "failure", - "title": "失败", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/result/error.html" - } - ] - }, - { - "id": "error", - "title": "错误页面", - "icon": "layui-icon layui-icon-face-cry", - "type": 0, - "href": "", - "children": [{ - "id": 403, - "title": "403", - "icon": "layui-icon layui-icon-face-smile", - "type": 1, - "openType": "_iframe", - "href": "view/error/403.html" - }, - { - "id": 404, - "title": "404", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/error/404.html" - }, - - { - "id": 500, - "title": "500", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/error/500.html" - } - - ] - }, - { - "id": "system", - "title": "系统管理", - "icon": "layui-icon layui-icon-set-fill", - "type": 0, - "href": "", - "children": [{ - "id": 601, - "title": "用户管理", - "icon": "layui-icon layui-icon-face-smile", - "type": 1, - "openType": "_iframe", - "href": "view/system/user.html" - }, - { - "id": 602, - "title": "角色管理", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/system/role.html" - }, - - { - "id": 603, - "title": "权限管理", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/system/power.html" - }, - - { - "id": 604, - "title": "部门管理", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/system/deptment.html" - }, - { - "id": 605, - "title": "行为日志", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/system/log.html" - }, { - "id": 606, - "title": "数据字典", - "icon": "layui-icon layui-icon-face-cry", - "type": 1, - "openType": "_iframe", - "href": "view/system/dict.html" - } - - ] - }, - { - "id": "common", - "title": "常用页面", - "icon": "layui-icon layui-icon-template-1", - "type": 0, - "href": "", - "children": [{ - "id": 701, - "title": "登录页面", - "icon": "layui-icon layui-icon-face-smile", - "type": 1, - "openType": "_iframe", - "href": "login.html" - }, { - "id": 702, - "title": "空白页面", - "icon": "layui-icon layui-icon-face-smile", - "type": 1, - "openType": "_iframe", - "href": "view/system/space.html" - }] - }, { - "id": "echarts", - "title": "数据图表", - "icon": "layui-icon layui-icon-chart", - "type": 0, - "href": "", - "children": [{ - "id": 12121, - "title": "折线图", - "icon": "layui-icon layui-icon-face-smile", - "type": 1, - "openType": "_iframe", - "href": "view/echarts/line.html" - }, { - "id": 121212, - "title": "柱状图", - "icon": "layui-icon layui-icon-face-smile", - "type": 1, - "openType": "_iframe", - "href": "view/echarts/column.html" - }] - }, - { - "id": "code", - "title": "开发工具", - "icon": "layui-icon layui-icon-util", - "type": 0, - "href": "", - "children": [{ - "id": 801, - "title": "表单构建", - "icon": "layui-icon layui-icon-util", - "type": 1, - "openType": "_iframe", - "href": "component/code/index.html" - }] - } -] \ No newline at end of file diff --git a/src/plugin/admin/public/demos/data/message.json b/src/plugin/admin/public/demos/data/message.json deleted file mode 100644 index 7cf92633..00000000 --- a/src/plugin/admin/public/demos/data/message.json +++ /dev/null @@ -1,90 +0,0 @@ -[{ - "id": 1, - "title": "通知", - "children": [{ - "id": 11, - "avatar":"https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png", - "title": "你收到了 14 份新周报", - "context": "这是消息内容。", - "form": "就眠仪式", - "time": "刚刚" - }, { - "id": 12, - "avatar":"https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png", - "title": "曲妮妮 已通过第三轮面试", - "context": "这是消息内容。", - "form": "就眠仪式", - "time": "刚刚" - }, - { - "id": 11, - "avatar":"https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png", - "title": "可以区分多种通知类型", - "context": "这是消息内容。", - "form": "就眠仪式", - "time": "刚刚" - }, { - "id": 12, - "avatar":"https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png", - "title": "左侧图标用于区分不同的类型", - "context": "这是消息内容。", - "form": "就眠仪式", - "time": "刚刚" - }, - { - "id": 11, - "avatar":"https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png", - "title": "内容不要超过两行字", - "context": "这是消息内容。", - "form": "就眠仪式", - "time": "刚刚" - }] - }, - { - "id": 2, - "title": "消息", - "children": [{ - "id": 11, - "avatar":"https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png", - "title": "你收到了 14 份新周报", - "context": "这是消息内容。", - "form": "就眠仪式", - "time": "刚刚" - }, { - "id": 12, - "avatar":"https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png", - "title": "曲妮妮 已通过第三轮面试", - "context": "这是消息内容。", - "form": "就眠仪式", - "time": "刚刚" - }, - { - "id": 11, - "avatar":"https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png", - "title": "可以区分多种通知类型", - "context": "这是消息内容。", - "form": "就眠仪式", - "time": "刚刚" - }, { - "id": 12, - "avatar":"https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png", - "title": "左侧图标用于区分不同的类型", - "context": "这是消息内容。", - "form": "就眠仪式", - "time": "刚刚" - }, - { - "id": 11, - "avatar":"https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png", - "title": "内容不要超过两行字", - "context": "这是消息内容。", - "form": "就眠仪式", - "time": "刚刚" - }] - }, - { - "id": 3, - "title": "代办", - "children": [] - } -] diff --git a/src/plugin/admin/public/demos/data/operateLog.json b/src/plugin/admin/public/demos/data/operateLog.json deleted file mode 100644 index 79e5454b..00000000 --- a/src/plugin/admin/public/demos/data/operateLog.json +++ /dev/null @@ -1,211 +0,0 @@ -{ - "createTime": null, - "createBy": null, - "updateTime": null, - "updateBy": null, - "remark": null, - "code": 0, - "msg": null, - "count": 178, - "data": [{ - "id": "1305106857240559616", - "title": "主页", - "description": "返回 Index 主页视图", - "businessType": "ADD", - "requestMethod": "GET", - "method": "/index", - "operateUrl": "/index", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "OPERATE", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T11:31:37.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }, { - "id": "1305101599714050048", - "title": "主页", - "description": "返回 Index 主页视图", - "businessType": "ADD", - "requestMethod": "GET", - "method": "/index", - "operateUrl": "/index", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "OPERATE", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T11:10:44.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }, { - "id": "1305101253352620032", - "title": "主页", - "description": "返回 Index 主页视图", - "businessType": "ADD", - "requestMethod": "GET", - "method": "/index", - "operateUrl": "/index", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "OPERATE", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T11:09:21.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }, { - "id": "1305099681512030208", - "title": "主页", - "description": "返回 Index 主页视图", - "businessType": "ADD", - "requestMethod": "GET", - "method": "/index", - "operateUrl": "/index", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "OPERATE", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T11:03:06.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }, { - "id": "1305095191291494400", - "title": "主页", - "description": "返回 Index 主页视图", - "businessType": "ADD", - "requestMethod": "GET", - "method": "/index", - "operateUrl": "/index", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "OPERATE", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T10:45:16.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }, { - "id": "1305092034448588800", - "title": "主页", - "description": "返回 Index 主页视图", - "businessType": "ADD", - "requestMethod": "GET", - "method": "/index", - "operateUrl": "/index", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "OPERATE", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T10:32:43.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }, { - "id": "1305082868002717696", - "title": "主页", - "description": "返回 Index 主页视图", - "businessType": "ADD", - "requestMethod": "GET", - "method": "/index", - "operateUrl": "/index", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "OPERATE", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T09:56:18.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }, { - "id": "1305071141362073600", - "title": "主页", - "description": "返回 Index 主页视图", - "businessType": "ADD", - "requestMethod": "GET", - "method": "/index", - "operateUrl": "/index", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "OPERATE", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T09:09:42.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }, { - "id": "1305070488145362944", - "title": "主页", - "description": "返回 Index 主页视图", - "businessType": "ADD", - "requestMethod": "GET", - "method": "/index", - "operateUrl": "/index", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "OPERATE", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T09:07:06.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }, { - "id": "1305064697174687744", - "title": "主页", - "description": "返回 Index 主页视图", - "businessType": "ADD", - "requestMethod": "GET", - "method": "/index", - "operateUrl": "/index", - "operateAddress": "127.0.0.1", - "requestParam": null, - "requestBody": "", - "responseBody": null, - "success": true, - "loggingType": "OPERATE", - "errorMsg": null, - "systemOs": "Windows", - "createTime": "2020-09-13T08:44:05.000+0000", - "operateName": "admin", - "map": {}, - "browser": "谷歌浏览器" - }] -} diff --git a/src/plugin/admin/public/demos/data/organization.json b/src/plugin/admin/public/demos/data/organization.json deleted file mode 100644 index ff1626b0..00000000 --- a/src/plugin/admin/public/demos/data/organization.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "code": 0, - "msg": "...", - "count": 3, - "data": [{ - "name": "软件部", - "userCount": 324, - "location": "二楼201", - "leader": "皮卡丘" - }, { - "name": "美工部", - "userCount": 98, - "location": "二楼101", - "leader": "皮卡丘" - }, { - "name": "设计部", - "userCount": 43, - "location": "六楼602", - "leader": "皮卡丘" - }, { - "name": "销售部", - "userCount": 12, - "location": "一楼131", - "leader": "皮卡丘" - }, { - "name": "产品部", - "userCount": 128, - "location": "四楼401", - "leader": "皮卡丘" - }, { - "name": "财务部", - "userCount": 23, - "location": "三楼105", - "leader": "皮卡丘" - }, { - "name": "人事部", - "userCount": 67, - "location": "二楼201", - "leader": "皮卡丘" - }] -} diff --git a/src/plugin/admin/public/demos/data/organizationtree.json b/src/plugin/admin/public/demos/data/organizationtree.json deleted file mode 100644 index 262594fe..00000000 --- a/src/plugin/admin/public/demos/data/organizationtree.json +++ /dev/null @@ -1,143 +0,0 @@ -{ - "status": { - "code": 200, - "message": "操作成功" - }, - "data": [{ - "id": "0", - "title": "济南总部", - "last": false, - "parentId": "9527", - "children": [{ - "id": "001", - "title": "杭州市", - "last": false, - "parentId": "0", - "children": [{ - "id": "001001", - "title": "软件部", - "last": true, - "parentId": "001" - }, - { - "id": "001002", - "title": "销售部", - "last": true, - "parentId": "001" - }, - { - "id": "001003", - "title": "财务部", - "last": true, - "parentId": "001" - }, - { - "id": "001004", - "title": "人事部", - "last": true, - "parentId": "001" - }, - { - "id": "001005", - "title": "行政部", - "last": true, - "parentId": "001" - } - ] - }, - { - "id": "002", - "title": "湖北省", - "last": false, - "parentId": "0", - "children": [{ - "id": "002001", - "title": "武汉市", - "last": true, - "parentId": "002" - }, - { - "id": "002002", - "title": "黄冈市", - "last": true, - "parentId": "002" - }, - { - "id": "002003", - "title": "潜江市", - "last": true, - "parentId": "002" - }, - { - "id": "002004", - "title": "荆州市", - "last": true, - "parentId": "002" - }, - { - "id": "002005", - "title": "襄阳市", - "last": true, - "parentId": "002" - } - ] - }, - { - "id": "003", - "title": "广东省", - "last": false, - "parentId": "0", - "children": [{ - "id": "003001", - "title": "广州市", - "last": false, - "parentId": "003", - "children": [{ - "id": "003001001", - "title": "天河区", - "last": true, - "parentId": "003001" - }, - { - "id": "003001002", - "title": "花都区", - "last": true, - "parentId": "003001" - } - ] - }, - { - "id": "003002", - "title": "深圳市", - "last": true, - "parentId": "003" - }, - { - "id": "003003", - "title": "中山市", - "last": true, - "parentId": "003" - }, - { - "id": "003004", - "title": "东莞市", - "last": true, - "parentId": "003" - }, - { - "id": "003005", - "title": "珠海市", - "last": true, - "parentId": "003" - }, - { - "id": "003006", - "title": "韶关市", - "last": true, - "parentId": "003" - } - ] - } - ] - }] -} \ No newline at end of file diff --git a/src/plugin/admin/public/demos/data/power.json b/src/plugin/admin/public/demos/data/power.json deleted file mode 100644 index db7ace11..00000000 --- a/src/plugin/admin/public/demos/data/power.json +++ /dev/null @@ -1,185 +0,0 @@ -{ - "code": 0, - "msg": "...", - "count": null, - "data": [{ - "powerId": "1", - "powerName": "系统管理", - "powerType": "0", - "powerCode": "", - "powerUrl": "", - "openType": null, - "parentId": "0", - "icon": "layui-icon-set-fill", - "sort": 1, - "enable": 1, - "checkArr": "0" - }, { - "powerId": "2", - "powerName": "用户管理", - "powerType": "1", - "powerCode": "sys:user:main", - "powerUrl": "/system/user/main", - "openType": null, - "parentId": "1", - "icon": "layui-icon-username", - "sort": null, - "enable": 1, - "checkArr": "0" - }, { - "powerId": "3", - "powerName": "角色管理", - "powerType": "1", - "powerCode": "sys:role:main", - "powerUrl": "/system/role/main", - "openType": null, - "parentId": "1", - "icon": "layui-icon-user", - "sort": null, - "enable": 1, - "checkArr": "0" - }, { - "powerId": "4", - "powerName": "权限管理", - "powerType": "1", - "powerCode": "sys:power:main", - "powerUrl": "/system/power/main", - "openType": null, - "parentId": "1", - "icon": "layui-icon-vercode", - "sort": null, - "checkArr": "0" - }, { - "powerId": "442359447487123456", - "powerName": "角色列表", - "powerType": "2", - "powerCode": "sys:role:data", - "powerUrl": "", - "openType": null, - "parentId": "3", - "icon": "layui-icon-rate", - "sort": 1, - "checkArr": "0" - }, { - "powerId": "442417411065516032", - "powerName": "敏捷开发", - "powerType": "0", - "powerCode": "", - "powerUrl": "", - "openType": null, - "parentId": "0", - "icon": "layui-icon-senior", - "sort": 2, - "checkArr": "0" - }, { - "powerId": "442418188639145984", - "powerName": "模板管理", - "powerType": "1", - "powerCode": "exp:template:main", - "powerUrl": "/system/user/main", - "openType": null, - "parentId": "442417411065516032", - "icon": "layui-icon-template-1", - "sort": null, - "checkArr": "0" - }, { - "powerId": "442520236248403968", - "powerName": "数据监控", - "powerType": "1", - "powerCode": "/druid/index.html", - "powerUrl": "/druid/index.html", - "openType": null, - "parentId": "694203021537574912", - "icon": "layui-icon-chart", - "sort": 1, - "checkArr": "0" - }, { - "powerId": "442650387514789888", - "powerName": "定时任务", - "powerType": "0", - "powerCode": "", - "powerUrl": "", - "openType": null, - "parentId": "0", - "icon": "layui-icon-log", - "sort": 5, - "checkArr": "0" - }, { - "powerId": "442650770626711552", - "powerName": "任务管理", - "powerType": "1", - "powerCode": "qrt:task:main", - "powerUrl": "/qrt/task/main", - "openType": null, - "parentId": "442650387514789888", - "icon": "layui-icon-chat", - "sort": 1, - "checkArr": "0" - }, { - "powerId": "442651158935375872", - "powerName": "任务日志", - "powerType": "1", - "powerCode": "qrt:log:main", - "powerUrl": "/qrt/log/main", - "openType": null, - "parentId": "442650387514789888", - "icon": "layui-icon-file", - "sort": 2, - "checkArr": "0" - }, { - "powerId": "442722702474743808", - "powerName": "数据字典", - "powerType": "1", - "powerCode": "system:dictType:main", - "powerUrl": "/system/dictType/main", - "openType": null, - "parentId": "1", - "icon": "layui-icon-form", - "sort": 1, - "checkArr": "0" - }, { - "powerId": "5", - "powerName": "工作流程", - "powerType": "0", - "powerCode": "", - "powerUrl": "", - "openType": null, - "parentId": "0", - "icon": "layui-icon-util", - "sort": 3, - "checkArr": "0" - }, { - "powerId": "6", - "powerName": "模型管理", - "powerType": "1", - "powerCode": null, - "powerUrl": null, - "openType": null, - "parentId": "5", - "icon": "layui-icon layui-icon-edit", - "sort": null, - "checkArr": "0" - }, { - "powerId": "694203021537574912", - "powerName": "系统监控", - "powerType": "0", - "powerCode": "", - "powerUrl": "", - "openType": null, - "parentId": "0", - "icon": "layui-icon-console", - "sort": 4, - "checkArr": "0" - }, { - "powerId": "694203311615639552", - "powerName": "接口文档", - "powerType": "1", - "powerCode": "", - "powerUrl": "/swagger-ui.html", - "openType": null, - "parentId": "694203021537574912", - "icon": "layui-icon-chart", - "sort": 1, - "checkArr": "0" - }] -} diff --git a/src/plugin/admin/public/demos/data/role.json b/src/plugin/admin/public/demos/data/role.json deleted file mode 100644 index 42bd0647..00000000 --- a/src/plugin/admin/public/demos/data/role.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "code": 0, - "msg": "...", - "count": 3, - "data": [{ - "createTime": null, - "createBy": null, - "updateTime": null, - "updateBy": null, - "remark": null, - "roleId": "1", - "roleName": "超级管理员", - "roleCode": "admin", - "enable": "1", - "details": "超级管理员", - "checked": false - }, { - "createTime": null, - "createBy": null, - "updateTime": null, - "updateBy": null, - "remark": null, - "roleId": "2", - "roleName": "普通管理员", - "roleCode": "manager", - "enable": "0", - "details": "普通管理员", - "checked": false - }, { - "createTime": null, - "createBy": null, - "updateTime": null, - "updateBy": null, - "remark": null, - "roleId": "3", - "roleName": "普通用户", - "roleCode": "pearson", - "enable": "0", - "details": "普通用户", - "checked": false - }] -} diff --git a/src/plugin/admin/public/demos/data/table.json b/src/plugin/admin/public/demos/data/table.json deleted file mode 100644 index 8f148860..00000000 --- a/src/plugin/admin/public/demos/data/table.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "code": 0, - "msg": "...", - "count": 3, - "data": [{ - "userId": "1", - "username": "admin", - "password": "$2a$10$1K7E1.IYCrsoZVCb6utOo.5jENtfOzhdKWhc49t2lk.UQd7Oam4FG", - "salt": null, - "status": null, - "realName": "超级'管'理员", - "email": "854085'4@'qq.com", - "avatar": null, - "sex": "1", - "phone": "15543526531", - "enable": "1", - "login": "1", - "roleIds": null - }, { - "userId": "2", - "username": "854085467", - "password": null, - "salt": null, - "status": null, - "realName": "就\"眠\"仪式", - "email": null, - "avatar": null, - "sex": "1", - "phone": "1555324324234", - "enable": "1", - "login": "1", - "roleIds": null - }, { - "userId": "3", - "username": "970796069", - "password": null, - "salt": null, - "status": null, - "realName": "王二麻子", - "email": null, - "avatar": null, - "sex": "1", - "phone": "1555324324234", - "enable": "1", - "login": "1", - "roleIds": null - }, { - "userId": "4", - "username": "admin", - "password": "$2a$10$1K7E1.IYCrsoZVCb6utOo.5jENtfOzhdKWhc49t2lk.UQd7Oam4FG", - "salt": null, - "status": null, - "realName": "超级管理员", - "email": "8540854@qq.com", - "avatar": null, - "sex": "1", - "phone": "15543526531", - "enable": "1", - "login": "1", - "roleIds": null - }, { - "userId": "5", - "username": "854085467", - "password": null, - "salt": null, - "status": null, - "realName": "就眠仪式", - "email": null, - "avatar": null, - "sex": "1", - "phone": "1555324324234", - "enable": "1", - "login": "1", - "roleIds": null - }, { - "userId": "6", - "username": "970796069", - "password": null, - "salt": null, - "status": null, - "realName": "王二麻子", - "email": null, - "avatar": null, - "sex": "1", - "phone": "1555324324234", - "enable": "1", - "login": "1", - "roleIds": null - }, { - "userId": "7", - "username": "admin", - "password": "$2a$10$1K7E1.IYCrsoZVCb6utOo.5jENtfOzhdKWhc49t2lk.UQd7Oam4FG", - "salt": null, - "status": null, - "realName": "超级管理员", - "email": "8540854@qq.com", - "avatar": null, - "sex": "1", - "phone": "15543526531", - "enable": "1", - "login": "1", - "roleIds": null - }, { - "userId": "8", - "username": "854085467", - "password": null, - "salt": null, - "status": null, - "realName": "就眠仪式", - "email": null, - "avatar": null, - "sex": "1", - "phone": "1555324324234", - "enable": "1", - "login": "1", - "roleIds": null - }, { - "userId": "9", - "username": "970796069", - "password": null, - "salt": null, - "status": null, - "realName": "王二麻子", - "email": null, - "avatar": null, - "sex": "1", - "phone": "1555324324234", - "enable": "1", - "login": "1", - "roleIds": null - }] -} diff --git a/src/plugin/admin/public/demos/data/user.json b/src/plugin/admin/public/demos/data/user.json deleted file mode 100644 index 2e927acc..00000000 --- a/src/plugin/admin/public/demos/data/user.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "code": 0, - "msg": "...", - "count": 3, - "data": [{ - "userId": "1", - "username": "admin", - "password": "$2a$10$1K7E1.IYCrsoZVCb6utOo.5jENtfOzhdKWhc49t2lk.UQd7Oam4FG", - "salt": null, - "status": null, - "realName": "超级管理员", - "email": "8540854@qq.com", - "avatar": null, - "sex": "1", - "phone": "15543526531", - "enable": "1", - "login": "1", - "roleIds": null - }, { - "userId": "442488661347536896", - "username": "854085467", - "password": null, - "salt": null, - "status": null, - "realName": "就眠仪式", - "email": null, - "avatar": null, - "sex": "1", - "phone": "1555324324234", - "enable": "0", - "login": "1", - "roleIds": null - }, { - "userId": "442492965651353600", - "username": "970796069", - "password": null, - "salt": null, - "status": null, - "realName": "王二麻子", - "email": null, - "avatar": null, - "sex": "1", - "phone": "1555324324234", - "enable": "1", - "login": "1", - "roleIds": null - }, { - "userId": "1", - "username": "admin", - "password": "$2a$10$1K7E1.IYCrsoZVCb6utOo.5jENtfOzhdKWhc49t2lk.UQd7Oam4FG", - "salt": null, - "status": null, - "realName": "超级管理员", - "email": "8540854@qq.com", - "avatar": null, - "sex": "1", - "phone": "15543526531", - "enable": "1", - "login": "1", - "roleIds": null - }, { - "userId": "442488661347536896", - "username": "854085467", - "password": null, - "salt": null, - "status": null, - "realName": "就眠仪式", - "email": null, - "avatar": null, - "sex": "1", - "phone": "1555324324234", - "enable": "1", - "login": "1", - "roleIds": null - }, { - "userId": "442492965651353600", - "username": "970796069", - "password": null, - "salt": null, - "status": null, - "realName": "王二麻子", - "email": null, - "avatar": null, - "sex": "1", - "phone": "1555324324234", - "enable": "1", - "login": "1", - "roleIds": null - }, { - "userId": "1", - "username": "admin", - "password": "$2a$10$1K7E1.IYCrsoZVCb6utOo.5jENtfOzhdKWhc49t2lk.UQd7Oam4FG", - "salt": null, - "status": null, - "realName": "超级管理员", - "email": "8540854@qq.com", - "avatar": null, - "sex": "1", - "phone": "15543526531", - "enable": "1", - "login": "1", - "roleIds": null - }, { - "userId": "442488661347536896", - "username": "854085467", - "password": null, - "salt": null, - "status": null, - "realName": "就眠仪式", - "email": null, - "avatar": null, - "sex": "1", - "phone": "1555324324234", - "enable": "1", - "login": "1", - "roleIds": null - }] -} diff --git a/src/plugin/admin/public/demos/demo/index.html b/src/plugin/admin/public/demos/demo/index.html deleted file mode 100644 index 5525c9bc..00000000 --- a/src/plugin/admin/public/demos/demo/index.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - -
                                      -
                                      -
                                      - -
                                      - - - - - diff --git a/src/plugin/admin/public/demos/document/area.html b/src/plugin/admin/public/demos/document/area.html deleted file mode 100644 index 87165f1e..00000000 --- a/src/plugin/admin/public/demos/document/area.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - 区域选择 - - - -
                                      -
                                      -
                                      -
                                      开发环境
                                      -
                                      - Area 省市级联 选择组件 -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -							    <link rel="stylesheet" href="component/pear/css/pear.css" />
                                      -							    并
                                      -							    <script src="component/layui/layui.js"></script>
                                      -						        并
                                      -							    <script src="component/pear/pear.js"></script>
                                      -							
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - 基本使用 -
                                      -
                                      -
                                      -
                                      -
                                      网点地址
                                      -
                                      - -
                                      -
                                      - -
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - 基本使用 -
                                      -
                                      -
                                      -
                                      -
                                      网点地址
                                      -
                                      - -
                                      -
                                      - -
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -							layui.use(['area'], function () {
                                      -							    var area = layui.area;
                                      -								 
                                      -							    area.render({
                                      -							        elem: '#area-picker',
                                      -							        change: function (res) {
                                      -							            console.log(res);
                                      -							        }
                                      -							    });
                                      -							});
                                      -						
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - - - - - - diff --git a/src/plugin/admin/public/demos/document/button.html b/src/plugin/admin/public/demos/document/button.html deleted file mode 100644 index 311e7b28..00000000 --- a/src/plugin/admin/public/demos/document/button.html +++ /dev/null @@ -1,305 +0,0 @@ - - - - - 按钮组件 - - - -
                                      -
                                      -
                                      -
                                      - 开发环境 -
                                      -
                                      - Pear Button 参考 Element UI 样式 ,提供 Button 服务 -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -								<link rel="stylesheet" href="component/pear/css/pear.css" />
                                      -								或
                                      -								<link rel="stylesheet" href="component/pear/css/pear-module/button.css" />
                                      -							
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - 简单使用 -
                                      -
                                      -    -    -
                                      -
                                      -    -    -    -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -								
                                      -								
                                      -															
                                      -								
                                      -								
                                      -							
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - 简约样式 -
                                      -
                                      -    -    -    -    -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -								
                                      -								
                                      -															
                                      -								
                                      -								
                                      -							
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - 按钮大小 -
                                      -
                                      -    -    -    -    -
                                      -
                                      -    -    -    -    -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -								  
                                      -								  
                                      -								  
                                      -								  
                                      -							
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - 按钮组 -
                                      -
                                      -
                                      - - - -
                                      -
                                      -
                                      -
                                      - - - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -								
                                      - - - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - Load 自动 -
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -								layui.use(["button"], function() {
                                      -								    var button = layui.button;
                                      -								    
                                      -									button.load({
                                      -								        elem:'[load]',
                                      -								        time: 600,
                                      -								        done: function(){
                                      -									        popup.success("加载完成");
                                      -								        }
                                      -								    })
                                      -								})
                                      -							
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - Load 手动 -
                                      -
                                      - - - - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -								layui.use(["button"], function() {
                                      -								    var button = layui.button;
                                      -								    
                                      -									var dom = button.load({
                                      -								        elem:'[load]',
                                      -								    })
                                      -									
                                      -								    dom.stop(function() {
                                      -								        popup.failure("已停止");
                                      -								    });
                                      -								})
                                      -							
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - 本页跳转 -
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -								layui.use(["jquery"], function() {
                                      -								    var $ = layui.jquery;
                                      -								    
                                      -								    $("[to]").click(function(){
                                      -								        top.layui.frame.changePageByElement("content","http://www.baidu.com","百度一下",true)
                                      -								    })
                                      -								})
                                      -							
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - - - - - diff --git a/src/plugin/admin/public/demos/document/card.html b/src/plugin/admin/public/demos/document/card.html deleted file mode 100644 index 08ff0fbf..00000000 --- a/src/plugin/admin/public/demos/document/card.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - 数据卡片 - - - -
                                      -
                                      -
                                      -
                                      - -
                                      - -
                                      - -
                                      - -
                                      -
                                      - - - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - - - - - diff --git a/src/plugin/admin/public/demos/document/core.html b/src/plugin/admin/public/demos/document/core.html deleted file mode 100644 index 1c81d151..00000000 --- a/src/plugin/admin/public/demos/document/core.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - - 数据卡片 - - - -
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                      方法描述参数备注
                                      admin.collapseSide侧边收缩无模式限制
                                      admin.refreshThis刷新当前无模式限制
                                      admin.refresh刷新指定id: 编号仅限 TAB 模式
                                      admin.addTab新增卡片id:编号,title:标题,url:路径仅限 TAB 模式
                                      admin.changeTabTitle修改标题id:编号,title:标题仅限 TAB 模式
                                      admin.closeTab关闭卡片id:编号仅限 TAB 模式
                                      admin.closeCurrentTab关闭当前仅限 TAB 模式
                                      admin.closeAllTab关闭所有仅限 TAB 模式
                                      admin.closeOtherTab关闭其他仅限 TAB 模式
                                      admin.changeIframe切换页面id:编号,title:标题,url:路径仅限 IFRAME 模式
                                      admin.jump兼容切换id:编号,title:标题,url:路径无模式限制
                                      admin.fullScreen全屏模式无模式限制
                                      -
                                      -
                                      - - - - - diff --git a/src/plugin/admin/public/demos/document/count.html b/src/plugin/admin/public/demos/document/count.html deleted file mode 100644 index 39f93de4..00000000 --- a/src/plugin/admin/public/demos/document/count.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - 数字滚动 - - - -
                                      -
                                      -
                                      -
                                      - 开发环境 -
                                      -
                                      - Pear Count 数据滚动特效 -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -								<script src="component/layui/layui.js"></script>
                                      -								 并
                                      -								<script src="component/pear/pear.js"></script>
                                      -							
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - 简单使用 -
                                      -
                                      -

                                      0

                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -								layui.use(['count'], function() {
                                      -								    var count = layui.count;
                                      -									
                                      -								    count.up("number1", {
                                      -								        time: 8000,
                                      -								        num: 4540.34,
                                      -								        regulator: 100
                                      -								    })
                                      -								})
                                      -							
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - 保留小数 -
                                      -
                                      -

                                      0

                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -							layui.use(['count'], function() {
                                      -							    var count = layui.count;
                                      -								
                                      -							    count.up("number2", {
                                      -							        time: 8000,
                                      -							        num: 4540.34,
                                      -							        bit: 2,
                                      -							        regulator: 100
                                      -							    })
                                      -							})
                                      -						
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - - -
                                      - - - - - diff --git a/src/plugin/admin/public/demos/document/drawer.html b/src/plugin/admin/public/demos/document/drawer.html deleted file mode 100644 index a97e4d0f..00000000 --- a/src/plugin/admin/public/demos/document/drawer.html +++ /dev/null @@ -1,597 +0,0 @@ - - - - - 抽屉组件 - - - - -
                                      -
                                      -
                                      -
                                      开发环境
                                      -
                                      - Drawer 在 弹出层 UI 上带来不一样的体验. -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -								<script src="component/layui/layui.js"></script>
                                      -								 并
                                      -								<script src="component/pear/pear.js"></script>
                                      -							
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      抽屉
                                      -
                                      - - - - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -								layui.use(['drawer'], function() {
                                      -									var drawer = layui.drawer;
                                      -
                                      -								    drawer.open({
                                      -								        direction: "right",
                                      -								        dom: ".layer-top",
                                      -								        distance: "30%"
                                      -								    });
                                      -								})
                                      -							
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      进阶
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -								var dom;
                                      -
                                      -								$(".drawer-close-mask").click(function() {
                                      -								    dom = drawer.open({
                                      -								        direction: "right",
                                      -								        dom: ".layer-close-mask",
                                      -								        distance: "30%",
                                      -								        maskClose: false
                                      -								    });
                                      -								})
                                      -
                                      -								$("#btnClose").click(function() {
                                      -								    dom.close();
                                      -								})
                                      -
                                      -							
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      扩展
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -								layui.use(['drawer'], function() {
                                      -									var drawer = layui.drawer;
                                      -
                                      -								    $(".drawer-auto-close").click(function() {
                                      -								        dom = drawer.open({
                                      -								            direction: "right",
                                      -								            dom: ".layer-auto-close",
                                      -								            distance: "30%",
                                      -								            maskClose: false,
                                      -								            time: 1000
                                      -								        });
                                      -								    })
                                      -								})
                                      -							
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      扩展
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -								layui.use(['drawer'], function() {
                                      -									var drawer = layui.drawer;
                                      -
                                      -								    $(".drawer-auto-close").click(function() {
                                      -								        dom = drawer.open({
                                      -								            direction: "right",
                                      -								            dom: ".layer-auto-close",
                                      -								            distance: "30%",
                                      -								            success:function(){
                                      -								                layer.msg("触发回调函数");
                                      -								            }
                                      -								        });
                                      -								    })
                                      -								})
                                      -							
                                      -
                                      -
                                      -
                                      -
                                      - -
                                      -
                                      -
                                      扩展
                                      -
                                      -
                                      - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -									layui.use(['drawer'], function() {
                                      -									  var drawer = layui.drawer;
                                      -									    $("#targetDemo").click(function () {
                                      -									      drawer.open({
                                      -									      // 指定挂载节点
                                      -									      target: "#targetEl"
                                      -									      direction: "right",
                                      -									      dom: ".layer-right",
                                      -									      distance: "50%",
                                      -									      });
                                      -									})
                                      -							
                                      -
                                      -
                                      -
                                      -
                                      - -
                                      -
                                      -
                                      基于 layer 的抽屉扩展
                                      -
                                      -

                                      兼容原版 drawer 所有参数,要使用 layer 扩展,设置 legacy 选项为 false 即可

                                      - - - - - - - - -
                                      - -
                                      -
                                      指定容器内打开,需使用 layer 捕获层模式,并设置目标容器 style="overflow: hidden; - position: relative;"
                                      -
                                      - 使用 url 参数指定抽屉代码片段地址,会使用 ajax 请求将代码片段拼接到抽屉中,和原来的页面在同一个页面上, 传值更方便。注意片段和原页面不能出现相同的 ID。 -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -											$("#layerDrawerLeft").click(function(){
                                      -											  drawer.open({
                                      -											    legacy: false,
                                      -											    offset: 'l',
                                      -											    area: "30%",
                                      -											    content: "left内容",
                                      -											  })
                                      -											})
                                      -											$("#layerDrawerRight").click(function () {
                                      -											  drawer.open({
                                      -											    legacy: false,
                                      -											    offset: 'r',
                                      -											    area: "30%",
                                      -											    content: "right内容",
                                      -											  })
                                      -											})
                                      -											$("#layerDrawerTop").click(function () {
                                      -											  drawer.open({
                                      -											    legacy: false,
                                      -										      offset: "t",
                                      -											    content: "top内容",
                                      -											  })
                                      -											})
                                      -											$("#layerDrawerBottom").click(function () {
                                      -											  drawer.open({
                                      -											    legacy: false,
                                      -											    offset: "b",
                                      -											    content: "bottom内容",
                                      -											  })
                                      -											})
                                      -
                                      -											$("#layerDrawer").click(function () {
                                      -											  var index = drawer.open({
                                      -											    legacy: false,
                                      -											    title: ['标题', 'font-size:16px;color:#2d8cf0'],
                                      -											    maxmin: true,
                                      -											    offset: "r",
                                      -											    area: "30%",
                                      -											    content: "抽屉内容",
                                      -											    btn:"关闭",
                                      -											    yes:function(index,layero){
                                      -											      drawer.close(index);
                                      -											      console.log(index,layero);
                                      -											    },
                                      -											    btnAlign: "l",
                                      -											    closeBtn: 1,
                                      -											  })
                                      -											})
                                      -
                                      -											$("#layerDrawerParent").click(function () {
                                      -
                                      -											  var index = parent.layui.drawer.open({
                                      -												    legacy: false,
                                      -												    title: ['标题', 'font-size:16px;color:#2d8cf0'],
                                      -												    maxmin: true,
                                      -												    offset: "r",
                                      -												    area: "30%",
                                      -												    content: "抽屉内容",
                                      -												    btn:"关闭",
                                      -												    yes:function(index,layero){
                                      -												      drawer.close(index);
                                      -												      console.log(index,layero);
                                      -												    },
                                      -												    btnAlign: "l",
                                      -												    closeBtn: 1,
                                      -												})
                                      -											})
                                      -
                                      -											$("#layertargetDemo").click(function () {
                                      -											    drawer.open({
                                      -											    legacy: false,
                                      -											    target: "#layertargetEl",
                                      -											    direction: "right",
                                      -											    dom: ".layer-right",
                                      -											    distance: "50%",
                                      -											    });
                                      -											})
                                      -
                                      -											$("#layerDrawerIframe").click(function () {
                                      -											  drawer.open({
                                      -											  legacy: false,
                                      -											  title: ['用户管理', 'font-size:16px;color:#2d8cf0'],
                                      -											  offset: 'r',
                                      -											  area: "80%",
                                      -											   maxmin: true,
                                      -											   closeBtn: 1,
                                      -											   iframe: window.location.origin + "/view/document/table.html"
                                      -											  })
                                      -											})
                                      -
                                      -											$("#layerDrawerURL").click(function () {
                                      -											   drawer.open({
                                      -										     legacy: false,
                                      -										     title: ['用户管理', 'font-size:16px;color:#2d8cf0'],
                                      -											   offset: 'r',
                                      -											   area: "80%",
                                      -											   maxmin: true,
                                      -											   closeBtn: 1,
                                      -											   url: window.location.origin + "/view/document/drawerFragment.html"
                                      -											   })
                                      -											})
                                      -							
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - - - - - - - - - - - - - - - - diff --git a/src/plugin/admin/public/demos/document/drawerFragment.html b/src/plugin/admin/public/demos/document/drawerFragment.html deleted file mode 100644 index 0630bb86..00000000 --- a/src/plugin/admin/public/demos/document/drawerFragment.html +++ /dev/null @@ -1,385 +0,0 @@ - -
                                      -
                                      -
                                      -
                                      -
                                      - -
                                      - -
                                      -
                                      -
                                      - -
                                      - -
                                      -
                                      -
                                      - -
                                      - -
                                      -
                                      -
                                      - -
                                      - -
                                      -
                                      -
                                      - -
                                      - -
                                      -
                                      -
                                      - - - -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - - - - - - - - - - - - - diff --git a/src/plugin/admin/public/demos/document/dtree.html b/src/plugin/admin/public/demos/document/dtree.html deleted file mode 100644 index 2560b2fb..00000000 --- a/src/plugin/admin/public/demos/document/dtree.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - 树形结构 - - - -
                                      -
                                      -
                                      -
                                      开发环境
                                      -
                                      Dtree 提供 树状态 的数据结构展示
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -

                                      显示代码

                                      -
                                      -
                                      -								<link href="component/pear/css/pear.css" rel="stylesheet" />
                                      -								 并
                                      -								<script src="component/layui/layui.js"></script>
                                      -								 并
                                      -								<script src="component/pear/pear.js"></script>
                                      -							
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      -
                                      - 嵌套数据格式 -
                                      -
                                      -
                                        -
                                        -
                                        -
                                        -
                                        -
                                        -
                                        -

                                        显示代码

                                        -
                                        -
                                        -								layui.use(['dtree'], function () {
                                        -								    dtree = layui.dtree;
                                        -								 
                                        -								    dtree.render({
                                        -								        elem: "#demoTree",
                                        -								        initLevel: "1",
                                        -								        method: 'get',
                                        -								        url: "admin/data/dtree.json"
                                        -								    });
                                        -								});
                                        -							
                                        -
                                        -
                                        -
                                        -
                                        -
                                        -
                                        -
                                        - 嵌套数据格式 -
                                        -
                                        -
                                          -
                                          -
                                          -
                                          -
                                          -
                                          -
                                          -

                                          显示代码

                                          -
                                          -
                                          -								layui.use(['dtree'], function () {
                                          -								    dtree = layui.dtree;
                                          -								 
                                          -								    dtree.render({
                                          -								        elem: "#demoTree",
                                          -								        initLevel: "1",
                                          -								        method: 'get',
                                          -								        url: "admin/data/dtree.json",
                                          -								        dataFormat: "list", 
                                          -								        checkbar: true
                                          -								    });
                                          -								});
                                          -							
                                          -
                                          -
                                          -
                                          -
                                          -
                                          -
                                          -
                                          - 下拉树 -
                                          -
                                          -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								layui.use(['dtree'], function () {
                                            -								    dtree = layui.dtree;
                                            -								 
                                            -								    dtree.render({
                                            -								        elem: "#demoTree2",
                                            -								        initLevel: "1",
                                            -								        method: 'get',
                                            -								        url: "admin/data/dtree.json",
                                            -								        select: true
                                            -								    });
                                            -								});
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - \ No newline at end of file diff --git a/src/plugin/admin/public/demos/document/encrypt.html b/src/plugin/admin/public/demos/document/encrypt.html deleted file mode 100644 index e6054f32..00000000 --- a/src/plugin/admin/public/demos/document/encrypt.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - 哈希加密 - - - -
                                            -
                                            -
                                            -
                                            - 开发环境 -
                                            -
                                            - Pear encrypt 为前端开发 提供 加密服务 -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								<script src="component/layui/layui.js"></script>
                                            -								 并
                                            -								<script src="component/pear/pear.js"></script>
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            加密操作
                                            -
                                            -
                                            -
                                            - -
                                            -
                                            - -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            加密结果
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								layui.use(['encrypt'], function() {
                                            -									var encrypt = layui.encrypt;
                                            -								
                                            -								    encrypt.md5( str );
                                            -									
                                            -								    encrypt.sha1( str );
                                            -									
                                            -								    encrypt.sha256( str );
                                            -								})
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            API 文档
                                            -
                                            -
                                            - encrypt.md5( str ) -- MD5加密 -
                                            -
                                            - encrypt.sha1( str ) -- SHA1加密 -
                                            -
                                            - encrypt.sha256( str ) -- SHA256加密 -
                                            -
                                            - encrypt.sha512( str ) -- SHA512加密 -
                                            -
                                            - encrypt.rmd160( str ) -- RMD160加密 -
                                            -
                                            - encrypt.crc32( str ) -- CRC32加密 -
                                            -
                                            - encrypt.Base64Encode( str ) -- BASE64加密 -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - diff --git a/src/plugin/admin/public/demos/document/form.html b/src/plugin/admin/public/demos/document/form.html deleted file mode 100644 index 0ce7861d..00000000 --- a/src/plugin/admin/public/demos/document/form.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - 表单页面 - - - -
                                            -
                                            -
                                            -
                                            开发环境
                                            -
                                            - Pear 基于 Form 的基础上扩展样式 -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								<link rel="stylesheet" href="component/pear/css/pear.css" />
                                            -								 或
                                            -								<link rel="stylesheet" href="component/pear/css/pear-module/form.css" />
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            输入框
                                            -
                                            -
                                            - -
                                            -
                                            - -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            下拉选择框
                                            -
                                            -
                                            - -
                                            -
                                            - -
                                            -
                                            - -
                                            -
                                            - -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            复选框
                                            -
                                            -
                                            - - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            扩展样式
                                            -
                                            -
                                            - -
                                            -
                                            - -
                                            -
                                            - -
                                            - -
                                            -
                                            -
                                            -
                                            文本域
                                            -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            开关
                                            -
                                            -
                                            -    -    -    -    -
                                            -
                                            -
                                            -
                                            -
                                            单选框
                                            -
                                            -
                                            - - - -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - diff --git a/src/plugin/admin/public/demos/document/fullscreen.html b/src/plugin/admin/public/demos/document/fullscreen.html deleted file mode 100644 index adade74a..00000000 --- a/src/plugin/admin/public/demos/document/fullscreen.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - 全屏组件 - - - - -
                                            -
                                            -
                                            -
                                            开发环境
                                            -
                                            - fullscreen 用于控制页面或元素全屏 -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -                <link rel="stylesheet" href="component/pear/css/pear.css" />
                                            -                 并
                                            -                <script src="component/layui/layui.js"></script>
                                            -                 并
                                            -                <script src="component/pear/pear.js"></script>
                                            -            
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            全屏控制
                                            -
                                            - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -				layui.use(['fullscreen'], function() {
                                            -    var fullscreen = layui.fullscreen;
                                            -     fullscreen.fullScreen();
                                            -	    fullscreen.fullClose();
                                            -	    fullscreen.fullScreen("#fulltarget");
                                            -	    fullscreen.isFullscreen();
                                            -
                                            -			})
                                            -			
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            指定容器全屏
                                            -
                                            -
                                            - - -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - diff --git a/src/plugin/admin/public/demos/document/icon.html b/src/plugin/admin/public/demos/document/icon.html deleted file mode 100644 index de000943..00000000 --- a/src/plugin/admin/public/demos/document/icon.html +++ /dev/null @@ -1,2195 +0,0 @@ - - - - - 图标列表 - - - - - - - - - - -
                                            - -
                                            -
                                            -
                                              - -
                                            • - -
                                              加载
                                              -
                                              &#xe6f0;
                                              -
                                            • - -
                                            • - -
                                              download
                                              -
                                              &#xe68d;
                                              -
                                            • - -
                                            • - -
                                              electronics
                                              -
                                              &#xe68e;
                                              -
                                            • - -
                                            • - -
                                              drag
                                              -
                                              &#xe68f;
                                              -
                                            • - -
                                            • - -
                                              elipsis
                                              -
                                              &#xe690;
                                              -
                                            • - -
                                            • - -
                                              export
                                              -
                                              &#xe691;
                                              -
                                            • - -
                                            • - -
                                              explain
                                              -
                                              &#xe692;
                                              -
                                            • - -
                                            • - -
                                              edit
                                              -
                                              &#xe693;
                                              -
                                            • - -
                                            • - -
                                              eye-close
                                              -
                                              &#xe694;
                                              -
                                            • - -
                                            • - -
                                              email
                                              -
                                              &#xe695;
                                              -
                                            • - -
                                            • - -
                                              error
                                              -
                                              &#xe696;
                                              -
                                            • - -
                                            • - -
                                              favorite
                                              -
                                              &#xe697;
                                              -
                                            • - -
                                            • - -
                                              file-common
                                              -
                                              &#xe698;
                                              -
                                            • - -
                                            • - -
                                              file-delete
                                              -
                                              &#xe699;
                                              -
                                            • - -
                                            • - -
                                              file-add
                                              -
                                              &#xe69a;
                                              -
                                            • - -
                                            • - -
                                              film
                                              -
                                              &#xe69b;
                                              -
                                            • - -
                                            • - -
                                              fabulous
                                              -
                                              &#xe69c;
                                              -
                                            • - -
                                            • - -
                                              file
                                              -
                                              &#xe69d;
                                              -
                                            • - -
                                            • - -
                                              folder-close
                                              -
                                              &#xe69e;
                                              -
                                            • - -
                                            • - -
                                              filter
                                              -
                                              &#xe69f;
                                              -
                                            • - -
                                            • - -
                                              good
                                              -
                                              &#xe6a0;
                                              -
                                            • - -
                                            • - -
                                              hide
                                              -
                                              &#xe6a1;
                                              -
                                            • - -
                                            • - -
                                              home
                                              -
                                              &#xe6a2;
                                              -
                                            • - -
                                            • - -
                                              history
                                              -
                                              &#xe6a3;
                                              -
                                            • - -
                                            • - -
                                              file-open
                                              -
                                              &#xe6a4;
                                              -
                                            • - -
                                            • - -
                                              forward
                                              -
                                              &#xe6a5;
                                              -
                                            • - -
                                            • - -
                                              import
                                              -
                                              &#xe6a6;
                                              -
                                            • - -
                                            • - -
                                              image-text
                                              -
                                              &#xe6a7;
                                              -
                                            • - -
                                            • - -
                                              keyboard-26
                                              -
                                              &#xe6a8;
                                              -
                                            • - -
                                            • - -
                                              keyboard-9
                                              -
                                              &#xe6a9;
                                              -
                                            • - -
                                            • - -
                                              link
                                              -
                                              &#xe6aa;
                                              -
                                            • - -
                                            • - -
                                              layout
                                              -
                                              &#xe6ab;
                                              -
                                            • - -
                                            • - -
                                              fullscreen-shrink
                                              -
                                              &#xe6ac;
                                              -
                                            • - -
                                            • - -
                                              layers
                                              -
                                              &#xe6ad;
                                              -
                                            • - -
                                            • - -
                                              lock
                                              -
                                              &#xe6ae;
                                              -
                                            • - -
                                            • - -
                                              fullscreen-expand
                                              -
                                              &#xe6af;
                                              -
                                            • - -
                                            • - -
                                              map
                                              -
                                              &#xe6b0;
                                              -
                                            • - -
                                            • - -
                                              meh
                                              -
                                              &#xe6b1;
                                              -
                                            • - -
                                            • - -
                                              menu
                                              -
                                              &#xe6b2;
                                              -
                                            • - -
                                            • - -
                                              loading
                                              -
                                              &#xe6b3;
                                              -
                                            • - -
                                            • - -
                                              help
                                              -
                                              &#xe6b4;
                                              -
                                            • - -
                                            • - -
                                              minus-circle
                                              -
                                              &#xe6b5;
                                              -
                                            • - -
                                            • - -
                                              modular
                                              -
                                              &#xe6b6;
                                              -
                                            • - -
                                            • - -
                                              notification
                                              -
                                              &#xe6b7;
                                              -
                                            • - -
                                            • - -
                                              mic
                                              -
                                              &#xe6b8;
                                              -
                                            • - -
                                            • - -
                                              more
                                              -
                                              &#xe6b9;
                                              -
                                            • - -
                                            • - -
                                              pad
                                              -
                                              &#xe6ba;
                                              -
                                            • - -
                                            • - -
                                              operation
                                              -
                                              &#xe6bb;
                                              -
                                            • - -
                                            • - -
                                              play
                                              -
                                              &#xe6bc;
                                              -
                                            • - -
                                            • - -
                                              print
                                              -
                                              &#xe6bd;
                                              -
                                            • - -
                                            • - -
                                              mobile-phone
                                              -
                                              &#xe6be;
                                              -
                                            • - -
                                            • - -
                                              minus
                                              -
                                              &#xe6bf;
                                              -
                                            • - -
                                            • - -
                                              navigation
                                              -
                                              &#xe6c0;
                                              -
                                            • - -
                                            • - -
                                              pdf
                                              -
                                              &#xe6c1;
                                              -
                                            • - -
                                            • - -
                                              prompt
                                              -
                                              &#xe6c2;
                                              -
                                            • - -
                                            • - -
                                              move
                                              -
                                              &#xe6c3;
                                              -
                                            • - -
                                            • - -
                                              refresh
                                              -
                                              &#xe6c4;
                                              -
                                            • - -
                                            • - -
                                              run-up
                                              -
                                              &#xe6c5;
                                              -
                                            • - -
                                            • - -
                                              picture
                                              -
                                              &#xe6c6;
                                              -
                                            • - -
                                            • - -
                                              run-in
                                              -
                                              &#xe6c7;
                                              -
                                            • - -
                                            • - -
                                              pin
                                              -
                                              &#xe6c8;
                                              -
                                            • - -
                                            • - -
                                              save
                                              -
                                              &#xe6c9;
                                              -
                                            • - -
                                            • - -
                                              search
                                              -
                                              &#xe6ca;
                                              -
                                            • - -
                                            • - -
                                              share
                                              -
                                              &#xe6cb;
                                              -
                                            • - -
                                            • - -
                                              scanning
                                              -
                                              &#xe6cc;
                                              -
                                            • - -
                                            • - -
                                              security
                                              -
                                              &#xe6cd;
                                              -
                                            • - -
                                            • - -
                                              sign-out
                                              -
                                              &#xe6ce;
                                              -
                                            • - -
                                            • - -
                                              select
                                              -
                                              &#xe6cf;
                                              -
                                            • - -
                                            • - -
                                              stop
                                              -
                                              &#xe6d0;
                                              -
                                            • - -
                                            • - -
                                              success
                                              -
                                              &#xe6d1;
                                              -
                                            • - -
                                            • - -
                                              smile
                                              -
                                              &#xe6d2;
                                              -
                                            • - -
                                            • - -
                                              switch
                                              -
                                              &#xe6d3;
                                              -
                                            • - -
                                            • - -
                                              setting
                                              -
                                              &#xe6d4;
                                              -
                                            • - -
                                            • - -
                                              survey
                                              -
                                              &#xe6d5;
                                              -
                                            • - -
                                            • - -
                                              task
                                              -
                                              &#xe6d6;
                                              -
                                            • - -
                                            • - -
                                              skip
                                              -
                                              &#xe6d7;
                                              -
                                            • - -
                                            • - -
                                              text
                                              -
                                              &#xe6d8;
                                              -
                                            • - -
                                            • - -
                                              time
                                              -
                                              &#xe6d9;
                                              -
                                            • - -
                                            • - -
                                              telephone-out
                                              -
                                              &#xe6da;
                                              -
                                            • - -
                                            • - -
                                              toggle-left
                                              -
                                              &#xe6db;
                                              -
                                            • - -
                                            • - -
                                              toggle-right
                                              -
                                              &#xe6dc;
                                              -
                                            • - -
                                            • - -
                                              telephone
                                              -
                                              &#xe6dd;
                                              -
                                            • - -
                                            • - -
                                              top
                                              -
                                              &#xe6de;
                                              -
                                            • - -
                                            • - -
                                              unlock
                                              -
                                              &#xe6df;
                                              -
                                            • - -
                                            • - -
                                              user
                                              -
                                              &#xe6e0;
                                              -
                                            • - -
                                            • - -
                                              upload
                                              -
                                              &#xe6e1;
                                              -
                                            • - -
                                            • - -
                                              work
                                              -
                                              &#xe6e2;
                                              -
                                            • - -
                                            • - -
                                              training
                                              -
                                              &#xe6e3;
                                              -
                                            • - -
                                            • - -
                                              warning
                                              -
                                              &#xe6e4;
                                              -
                                            • - -
                                            • - -
                                              zoom-in
                                              -
                                              &#xe6e5;
                                              -
                                            • - -
                                            • - -
                                              zoom-out
                                              -
                                              &#xe6e6;
                                              -
                                            • - -
                                            • - -
                                              add-bold
                                              -
                                              &#xe6e7;
                                              -
                                            • - -
                                            • - -
                                              arrow-left-bold
                                              -
                                              &#xe6e8;
                                              -
                                            • - -
                                            • - -
                                              arrow-up-bold
                                              -
                                              &#xe6e9;
                                              -
                                            • - -
                                            • - -
                                              close-bold
                                              -
                                              &#xe6ea;
                                              -
                                            • - -
                                            • - -
                                              arrow-down-bold
                                              -
                                              &#xe6eb;
                                              -
                                            • - -
                                            • - -
                                              minus-bold
                                              -
                                              &#xe6ec;
                                              -
                                            • - -
                                            • - -
                                              arrow-right-bold
                                              -
                                              &#xe6ed;
                                              -
                                            • - -
                                            • - -
                                              select-bold
                                              -
                                              &#xe6ee;
                                              -
                                            • - -
                                            • - -
                                              column-3
                                              -
                                              &#xe663;
                                              -
                                            • - -
                                            • - -
                                              column-4
                                              -
                                              &#xe664;
                                              -
                                            • - -
                                            • - -
                                              add
                                              -
                                              &#xe665;
                                              -
                                            • - -
                                            • - -
                                              add-circle
                                              -
                                              &#xe666;
                                              -
                                            • - -
                                            • - -
                                              adjust
                                              -
                                              &#xe667;
                                              -
                                            • - -
                                            • - -
                                              arrow-up-circle
                                              -
                                              &#xe668;
                                              -
                                            • - -
                                            • - -
                                              arrow-right-circle
                                              -
                                              &#xe669;
                                              -
                                            • - -
                                            • - -
                                              arrow-down
                                              -
                                              &#xe66a;
                                              -
                                            • - -
                                            • - -
                                              ashbin
                                              -
                                              &#xe66b;
                                              -
                                            • - -
                                            • - -
                                              arrow-right
                                              -
                                              &#xe66c;
                                              -
                                            • - -
                                            • - -
                                              browse
                                              -
                                              &#xe66d;
                                              -
                                            • - -
                                            • - -
                                              bottom
                                              -
                                              &#xe66e;
                                              -
                                            • - -
                                            • - -
                                              back
                                              -
                                              &#xe66f;
                                              -
                                            • - -
                                            • - -
                                              bad
                                              -
                                              &#xe670;
                                              -
                                            • - -
                                            • - -
                                              arrow-double-left
                                              -
                                              &#xe671;
                                              -
                                            • - -
                                            • - -
                                              arrow-left-circle
                                              -
                                              &#xe672;
                                              -
                                            • - -
                                            • - -
                                              arrow-double-right
                                              -
                                              &#xe673;
                                              -
                                            • - -
                                            • - -
                                              caps-lock
                                              -
                                              &#xe674;
                                              -
                                            • - -
                                            • - -
                                              camera
                                              -
                                              &#xe675;
                                              -
                                            • - -
                                            • - -
                                              chart-bar
                                              -
                                              &#xe676;
                                              -
                                            • - -
                                            • - -
                                              attachment
                                              -
                                              &#xe677;
                                              -
                                            • - -
                                            • - -
                                              code
                                              -
                                              &#xe678;
                                              -
                                            • - -
                                            • - -
                                              close
                                              -
                                              &#xe679;
                                              -
                                            • - -
                                            • - -
                                              check-item
                                              -
                                              &#xe67a;
                                              -
                                            • - -
                                            • - -
                                              calendar
                                              -
                                              &#xe67b;
                                              -
                                            • - -
                                            • - -
                                              comment
                                              -
                                              &#xe67c;
                                              -
                                            • - -
                                            • - -
                                              column-vertical
                                              -
                                              &#xe67d;
                                              -
                                            • - -
                                            • - -
                                              column-horizontal
                                              -
                                              &#xe67e;
                                              -
                                            • - -
                                            • - -
                                              complete
                                              -
                                              &#xe67f;
                                              -
                                            • - -
                                            • - -
                                              chart-pie
                                              -
                                              &#xe680;
                                              -
                                            • - -
                                            • - -
                                              cry
                                              -
                                              &#xe681;
                                              -
                                            • - -
                                            • - -
                                              customer-service
                                              -
                                              &#xe682;
                                              -
                                            • - -
                                            • - -
                                              delete
                                              -
                                              &#xe683;
                                              -
                                            • - -
                                            • - -
                                              direction-down
                                              -
                                              &#xe684;
                                              -
                                            • - -
                                            • - -
                                              copy
                                              -
                                              &#xe685;
                                              -
                                            • - -
                                            • - -
                                              cut
                                              -
                                              &#xe686;
                                              -
                                            • - -
                                            • - -
                                              data-view
                                              -
                                              &#xe687;
                                              -
                                            • - -
                                            • - -
                                              direction-down-circle
                                              -
                                              &#xe688;
                                              -
                                            • - -
                                            • - -
                                              direction-right
                                              -
                                              &#xe689;
                                              -
                                            • - -
                                            • - -
                                              direction-up
                                              -
                                              &#xe68a;
                                              -
                                            • - -
                                            • - -
                                              discount
                                              -
                                              &#xe68b;
                                              -
                                            • - -
                                            • - -
                                              direction-left
                                              -
                                              &#xe68c;
                                              -
                                            • -
                                            -
                                            -
                                            -
                                              - -
                                            • - -
                                              - 加载 -
                                              -
                                              .pear-icon-load -
                                              -
                                            • - -
                                            • - -
                                              - download -
                                              -
                                              .pear-icon-download -
                                              -
                                            • - -
                                            • - -
                                              - electronics -
                                              -
                                              .pear-icon-electronics -
                                              -
                                            • - -
                                            • - -
                                              - drag -
                                              -
                                              .pear-icon-drag -
                                              -
                                            • - -
                                            • - -
                                              - elipsis -
                                              -
                                              .pear-icon-elipsis -
                                              -
                                            • - -
                                            • - -
                                              - export -
                                              -
                                              .pear-icon-export -
                                              -
                                            • - -
                                            • - -
                                              - explain -
                                              -
                                              .pear-icon-explain -
                                              -
                                            • - -
                                            • - -
                                              - edit -
                                              -
                                              .pear-icon-edit -
                                              -
                                            • - -
                                            • - -
                                              - eye-close -
                                              -
                                              .pear-icon-eye-close -
                                              -
                                            • - -
                                            • - -
                                              - email -
                                              -
                                              .pear-icon-email -
                                              -
                                            • - -
                                            • - -
                                              - error -
                                              -
                                              .pear-icon-error -
                                              -
                                            • - -
                                            • - -
                                              - favorite -
                                              -
                                              .pear-icon-favorite -
                                              -
                                            • - -
                                            • - -
                                              - file-common -
                                              -
                                              .pear-icon-file-common -
                                              -
                                            • - -
                                            • - -
                                              - file-delete -
                                              -
                                              .pear-icon-file-delete -
                                              -
                                            • - -
                                            • - -
                                              - file-add -
                                              -
                                              .pear-icon-file-add -
                                              -
                                            • - -
                                            • - -
                                              - film -
                                              -
                                              .pear-icon-film -
                                              -
                                            • - -
                                            • - -
                                              - fabulous -
                                              -
                                              .pear-icon-fabulous -
                                              -
                                            • - -
                                            • - -
                                              - file -
                                              -
                                              .pear-icon-file -
                                              -
                                            • - -
                                            • - -
                                              - folder-close -
                                              -
                                              .pear-icon-folder-close -
                                              -
                                            • - -
                                            • - -
                                              - filter -
                                              -
                                              .pear-icon-filter -
                                              -
                                            • - -
                                            • - -
                                              - good -
                                              -
                                              .pear-icon-good -
                                              -
                                            • - -
                                            • - -
                                              - hide -
                                              -
                                              .pear-icon-hide -
                                              -
                                            • - -
                                            • - -
                                              - home -
                                              -
                                              .pear-icon-home -
                                              -
                                            • - -
                                            • - -
                                              - history -
                                              -
                                              .pear-icon-history -
                                              -
                                            • - -
                                            • - -
                                              - file-open -
                                              -
                                              .pear-icon-file-open -
                                              -
                                            • - -
                                            • - -
                                              - forward -
                                              -
                                              .pear-icon-forward -
                                              -
                                            • - -
                                            • - -
                                              - import -
                                              -
                                              .pear-icon-import -
                                              -
                                            • - -
                                            • - -
                                              - image-text -
                                              -
                                              .pear-icon-image-text -
                                              -
                                            • - -
                                            • - -
                                              - keyboard-26 -
                                              -
                                              .pear-icon-keyboard-26 -
                                              -
                                            • - -
                                            • - -
                                              - keyboard-9 -
                                              -
                                              .pear-icon-keyboard-9 -
                                              -
                                            • - -
                                            • - -
                                              - link -
                                              -
                                              .pear-icon-link -
                                              -
                                            • - -
                                            • - -
                                              - layout -
                                              -
                                              .pear-icon-layout -
                                              -
                                            • - -
                                            • - -
                                              - fullscreen-shrink -
                                              -
                                              .pear-icon-fullscreen-shrink -
                                              -
                                            • - -
                                            • - -
                                              - layers -
                                              -
                                              .pear-icon-layers -
                                              -
                                            • - -
                                            • - -
                                              - lock -
                                              -
                                              .pear-icon-lock -
                                              -
                                            • - -
                                            • - -
                                              - fullscreen-expand -
                                              -
                                              .pear-icon-fullscreen-expand -
                                              -
                                            • - -
                                            • - -
                                              - map -
                                              -
                                              .pear-icon-map -
                                              -
                                            • - -
                                            • - -
                                              - meh -
                                              -
                                              .pear-icon-meh -
                                              -
                                            • - -
                                            • - -
                                              - menu -
                                              -
                                              .pear-icon-menu -
                                              -
                                            • - -
                                            • - -
                                              - loading -
                                              -
                                              .pear-icon-loading -
                                              -
                                            • - -
                                            • - -
                                              - help -
                                              -
                                              .pear-icon-help -
                                              -
                                            • - -
                                            • - -
                                              - minus-circle -
                                              -
                                              .pear-icon-minus-circle -
                                              -
                                            • - -
                                            • - -
                                              - modular -
                                              -
                                              .pear-icon-modular -
                                              -
                                            • - -
                                            • - -
                                              - notification -
                                              -
                                              .pear-icon-notification -
                                              -
                                            • - -
                                            • - -
                                              - mic -
                                              -
                                              .pear-icon-mic -
                                              -
                                            • - -
                                            • - -
                                              - more -
                                              -
                                              .pear-icon-more -
                                              -
                                            • - -
                                            • - -
                                              - pad -
                                              -
                                              .pear-icon-pad -
                                              -
                                            • - -
                                            • - -
                                              - operation -
                                              -
                                              .pear-icon-operation -
                                              -
                                            • - -
                                            • - -
                                              - play -
                                              -
                                              .pear-icon-play -
                                              -
                                            • - -
                                            • - -
                                              - print -
                                              -
                                              .pear-icon-print -
                                              -
                                            • - -
                                            • - -
                                              - mobile-phone -
                                              -
                                              .pear-icon-mobile-phone -
                                              -
                                            • - -
                                            • - -
                                              - minus -
                                              -
                                              .pear-icon-minus -
                                              -
                                            • - -
                                            • - -
                                              - navigation -
                                              -
                                              .pear-icon-navigation -
                                              -
                                            • - -
                                            • - -
                                              - pdf -
                                              -
                                              .pear-icon-pdf -
                                              -
                                            • - -
                                            • - -
                                              - prompt -
                                              -
                                              .pear-icon-prompt -
                                              -
                                            • - -
                                            • - -
                                              - move -
                                              -
                                              .pear-icon-move -
                                              -
                                            • - -
                                            • - -
                                              - refresh -
                                              -
                                              .pear-icon-refresh -
                                              -
                                            • - -
                                            • - -
                                              - run-up -
                                              -
                                              .pear-icon-run-up -
                                              -
                                            • - -
                                            • - -
                                              - picture -
                                              -
                                              .pear-icon-picture -
                                              -
                                            • - -
                                            • - -
                                              - run-in -
                                              -
                                              .pear-icon-run-in -
                                              -
                                            • - -
                                            • - -
                                              - pin -
                                              -
                                              .pear-icon-pin -
                                              -
                                            • - -
                                            • - -
                                              - save -
                                              -
                                              .pear-icon-save -
                                              -
                                            • - -
                                            • - -
                                              - search -
                                              -
                                              .pear-icon-search -
                                              -
                                            • - -
                                            • - -
                                              - share -
                                              -
                                              .pear-icon-share -
                                              -
                                            • - -
                                            • - -
                                              - scanning -
                                              -
                                              .pear-icon-scanning -
                                              -
                                            • - -
                                            • - -
                                              - security -
                                              -
                                              .pear-icon-security -
                                              -
                                            • - -
                                            • - -
                                              - sign-out -
                                              -
                                              .pear-icon-sign-out -
                                              -
                                            • - -
                                            • - -
                                              - select -
                                              -
                                              .pear-icon-select -
                                              -
                                            • - -
                                            • - -
                                              - stop -
                                              -
                                              .pear-icon-stop -
                                              -
                                            • - -
                                            • - -
                                              - success -
                                              -
                                              .pear-icon-success -
                                              -
                                            • - -
                                            • - -
                                              - smile -
                                              -
                                              .pear-icon-smile -
                                              -
                                            • - -
                                            • - -
                                              - switch -
                                              -
                                              .pear-icon-switch -
                                              -
                                            • - -
                                            • - -
                                              - setting -
                                              -
                                              .pear-icon-setting -
                                              -
                                            • - -
                                            • - -
                                              - survey -
                                              -
                                              .pear-icon-survey -
                                              -
                                            • - -
                                            • - -
                                              - task -
                                              -
                                              .pear-icon-task -
                                              -
                                            • - -
                                            • - -
                                              - skip -
                                              -
                                              .pear-icon-skip -
                                              -
                                            • - -
                                            • - -
                                              - text -
                                              -
                                              .pear-icon-text -
                                              -
                                            • - -
                                            • - -
                                              - time -
                                              -
                                              .pear-icon-time -
                                              -
                                            • - -
                                            • - -
                                              - telephone-out -
                                              -
                                              .pear-icon-telephone-out -
                                              -
                                            • - -
                                            • - -
                                              - toggle-left -
                                              -
                                              .pear-icon-toggle-left -
                                              -
                                            • - -
                                            • - -
                                              - toggle-right -
                                              -
                                              .pear-icon-toggle-right -
                                              -
                                            • - -
                                            • - -
                                              - telephone -
                                              -
                                              .pear-icon-telephone -
                                              -
                                            • - -
                                            • - -
                                              - top -
                                              -
                                              .pear-icon-top -
                                              -
                                            • - -
                                            • - -
                                              - unlock -
                                              -
                                              .pear-icon-unlock -
                                              -
                                            • - -
                                            • - -
                                              - user -
                                              -
                                              .pear-icon-user -
                                              -
                                            • - -
                                            • - -
                                              - upload -
                                              -
                                              .pear-icon-upload -
                                              -
                                            • - -
                                            • - -
                                              - work -
                                              -
                                              .pear-icon-work -
                                              -
                                            • - -
                                            • - -
                                              - training -
                                              -
                                              .pear-icon-training -
                                              -
                                            • - -
                                            • - -
                                              - warning -
                                              -
                                              .pear-icon-warning -
                                              -
                                            • - -
                                            • - -
                                              - zoom-in -
                                              -
                                              .pear-icon-zoom-in -
                                              -
                                            • - -
                                            • - -
                                              - zoom-out -
                                              -
                                              .pear-icon-zoom-out -
                                              -
                                            • - -
                                            • - -
                                              - add-bold -
                                              -
                                              .pear-icon-add-bold -
                                              -
                                            • - -
                                            • - -
                                              - arrow-left-bold -
                                              -
                                              .pear-icon-arrow-left-bold -
                                              -
                                            • - -
                                            • - -
                                              - arrow-up-bold -
                                              -
                                              .pear-icon-arrow-up-bold -
                                              -
                                            • - -
                                            • - -
                                              - close-bold -
                                              -
                                              .pear-icon-close-bold -
                                              -
                                            • - -
                                            • - -
                                              - arrow-down-bold -
                                              -
                                              .pear-icon-arrow-down-bold -
                                              -
                                            • - -
                                            • - -
                                              - minus-bold -
                                              -
                                              .pear-icon-minus-bold -
                                              -
                                            • - -
                                            • - -
                                              - arrow-right-bold -
                                              -
                                              .pear-icon-arrow-right-bold -
                                              -
                                            • - -
                                            • - -
                                              - select-bold -
                                              -
                                              .pear-icon-select-bold -
                                              -
                                            • - -
                                            • - -
                                              - column-3 -
                                              -
                                              .pear-icon-3column -
                                              -
                                            • - -
                                            • - -
                                              - column-4 -
                                              -
                                              .pear-icon-column-4 -
                                              -
                                            • - -
                                            • - -
                                              - add -
                                              -
                                              .pear-icon-add -
                                              -
                                            • - -
                                            • - -
                                              - add-circle -
                                              -
                                              .pear-icon-add-circle -
                                              -
                                            • - -
                                            • - -
                                              - adjust -
                                              -
                                              .pear-icon-adjust -
                                              -
                                            • - -
                                            • - -
                                              - arrow-up-circle -
                                              -
                                              .pear-icon-arrow-up-circle -
                                              -
                                            • - -
                                            • - -
                                              - arrow-right-circle -
                                              -
                                              .pear-icon-arrow-right-circle -
                                              -
                                            • - -
                                            • - -
                                              - arrow-down -
                                              -
                                              .pear-icon-arrow-down -
                                              -
                                            • - -
                                            • - -
                                              - ashbin -
                                              -
                                              .pear-icon-ashbin -
                                              -
                                            • - -
                                            • - -
                                              - arrow-right -
                                              -
                                              .pear-icon-arrow-right -
                                              -
                                            • - -
                                            • - -
                                              - browse -
                                              -
                                              .pear-icon-browse -
                                              -
                                            • - -
                                            • - -
                                              - bottom -
                                              -
                                              .pear-icon-bottom -
                                              -
                                            • - -
                                            • - -
                                              - back -
                                              -
                                              .pear-icon-back -
                                              -
                                            • - -
                                            • - -
                                              - bad -
                                              -
                                              .pear-icon-bad -
                                              -
                                            • - -
                                            • - -
                                              - arrow-double-left -
                                              -
                                              .pear-icon-arrow-double-left -
                                              -
                                            • - -
                                            • - -
                                              - arrow-left-circle -
                                              -
                                              .pear-icon-arrow-left-circle -
                                              -
                                            • - -
                                            • - -
                                              - arrow-double-right -
                                              -
                                              .pear-icon-arrow-double-right -
                                              -
                                            • - -
                                            • - -
                                              - caps-lock -
                                              -
                                              .pear-icon-caps-lock -
                                              -
                                            • - -
                                            • - -
                                              - camera -
                                              -
                                              .pear-icon-camera -
                                              -
                                            • - -
                                            • - -
                                              - chart-bar -
                                              -
                                              .pear-icon-chart-bar -
                                              -
                                            • - -
                                            • - -
                                              - attachment -
                                              -
                                              .pear-icon-attachment -
                                              -
                                            • - -
                                            • - -
                                              - code -
                                              -
                                              .pear-icon-code -
                                              -
                                            • - -
                                            • - -
                                              - close -
                                              -
                                              .pear-icon-close -
                                              -
                                            • - -
                                            • - -
                                              - check-item -
                                              -
                                              .pear-icon-check-item -
                                              -
                                            • - -
                                            • - -
                                              - calendar -
                                              -
                                              .pear-icon-calendar -
                                              -
                                            • - -
                                            • - -
                                              - comment -
                                              -
                                              .pear-icon-comment -
                                              -
                                            • - -
                                            • - -
                                              - column-vertical -
                                              -
                                              .pear-icon-column-vertical -
                                              -
                                            • - -
                                            • - -
                                              - column-horizontal -
                                              -
                                              .pear-icon-column-horizontal -
                                              -
                                            • - -
                                            • - -
                                              - complete -
                                              -
                                              .pear-icon-complete -
                                              -
                                            • - -
                                            • - -
                                              - chart-pie -
                                              -
                                              .pear-icon-chart-pie -
                                              -
                                            • - -
                                            • - -
                                              - cry -
                                              -
                                              .pear-icon-cry -
                                              -
                                            • - -
                                            • - -
                                              - customer-service -
                                              -
                                              .pear-icon-customer-service -
                                              -
                                            • - -
                                            • - -
                                              - delete -
                                              -
                                              .pear-icon-delete -
                                              -
                                            • - -
                                            • - -
                                              - direction-down -
                                              -
                                              .pear-icon-direction-down -
                                              -
                                            • - -
                                            • - -
                                              - copy -
                                              -
                                              .pear-icon-copy -
                                              -
                                            • - -
                                            • - -
                                              - cut -
                                              -
                                              .pear-icon-cut -
                                              -
                                            • - -
                                            • - -
                                              - data-view -
                                              -
                                              .pear-icon-data-view -
                                              -
                                            • - -
                                            • - -
                                              - direction-down-circle -
                                              -
                                              .pear-icon-direction-down-circle -
                                              -
                                            • - -
                                            • - -
                                              - direction-right -
                                              -
                                              .pear-icon-direction-right -
                                              -
                                            • - -
                                            • - -
                                              - direction-up -
                                              -
                                              .pear-icon-direction-up -
                                              -
                                            • - -
                                            • - -
                                              - discount -
                                              -
                                              .pear-icon-discount -
                                              -
                                            • - -
                                            • - -
                                              - direction-left -
                                              -
                                              .pear-icon-direction-left -
                                              -
                                            • - -
                                            - -
                                            -
                                            - - -
                                            - -
                                            -
                                            - - - \ No newline at end of file diff --git a/src/plugin/admin/public/demos/document/iconPicker.html b/src/plugin/admin/public/demos/document/iconPicker.html deleted file mode 100644 index 2c7e926c..00000000 --- a/src/plugin/admin/public/demos/document/iconPicker.html +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - Document - - - -
                                            -
                                            -
                                            -
                                            开发环境
                                            -
                                            - IconPicker 提供图标选择功能 -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								<link rel="stylesheet" href="component/pear/css/pear.css" />
                                            -								 并
                                            -								<script src="component/layui/layui.js"></script>
                                            -								 并
                                            -								<script src="component/pear/pear.js"></script>
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - 默认图标 -
                                            -
                                            -
                                            -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								layui.use(['iconPicker'], function() {
                                            -								    var iconPicker = layui.iconPicker;
                                            -								
                                            -								    iconPicker.render({
                                            -								        elem: '#iconPicker',
                                            -								        type: 'fontClass',
                                            -								        search: true,
                                            -								        page: true,
                                            -								        limit: 16,
                                            -								        click: function(data) {
                                            -								           console.log(data);
                                            -								        },
                                            -								        success: function(d) {
                                            -								            console.log(d);
                                            -								        }
                                            -								    });
                                            -									
                                            -								});
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            默认选中
                                            -
                                            -
                                            -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								layui.use(['iconPicker'], function() {
                                            -								    var iconPicker = layui.iconPicker;
                                            -								
                                            -								    iconPicker.render({
                                            -								        elem: '#iconPicker2',
                                            -								        type: 'fontClass',
                                            -								        search: true,
                                            -								        page: true,
                                            -								        limit: 16,
                                            -								        click: function(data) {
                                            -								           console.log(data);
                                            -								        },
                                            -								        success: function(d) {
                                            -								            console.log(d);
                                            -								        }
                                            -								    });
                                            -									
                                            -								});
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            不分页
                                            -
                                            -
                                            -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								layui.use(['iconPicker'], function() {
                                            -								    var iconPicker = layui.iconPicker;
                                            -								
                                            -								    iconPicker.render({
                                            -								        elem: '#iconPicker',
                                            -								        type: 'fontClass',
                                            -								        search: true,
                                            -								        page: false,
                                            -								        limit: 16,
                                            -								        click: function(data) {
                                            -								           console.log(data);
                                            -								        },
                                            -								        success: function(d) {
                                            -								            console.log(d);
                                            -								        }
                                            -								    });
                                            -									
                                            -								});
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - \ No newline at end of file diff --git a/src/plugin/admin/public/demos/document/loading.html b/src/plugin/admin/public/demos/document/loading.html deleted file mode 100644 index 9140e9d4..00000000 --- a/src/plugin/admin/public/demos/document/loading.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - 加载组件 - - - - -
                                            -
                                            加载组件
                                            -
                                            -
                                            - loading.Load(1,message); -
                                            -
                                            - loading.Load(2,message); -
                                            -
                                            - loading.Load(3,message); -
                                            -
                                            - loading.Load(4,message); -
                                            -
                                            - loading.Load(5,message); -
                                            -
                                            - loading.remove(time); -
                                            -
                                            -
                                            - - - - - -
                                            -
                                            - -
                                            -
                                            加载组件
                                            -
                                            - - - - - - - - -
                                            - -
                                            -
                                            - -
                                            - -
                                            - - - - - - diff --git a/src/plugin/admin/public/demos/document/menu.html b/src/plugin/admin/public/demos/document/menu.html deleted file mode 100644 index 49e9272d..00000000 --- a/src/plugin/admin/public/demos/document/menu.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - 数据菜单 - - - -
                                            -
                                            -
                                            -
                                            开发环境
                                            -
                                            - Menu 数据菜单对普通菜单的深度封装 -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								<link rel="stylesheet" href="component/pear/css/pear.css" />
                                            -								 并
                                            -								<script src="component/layui/layui.js"></script>
                                            -								 并
                                            -								<script src="component/pear/pear.js"></script>
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            实例
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								
                                            -								var sideMenu = menu.render({
                                            -								    elem: 'sideMenu',
                                            -								    async: true,
                                            -								    theme: "light-theme",
                                            -								    height: '300px',
                                            -								    control: false, 
                                            -								    defaultMenu: 0,
                                            -								    accordion: true,
                                            -								    url: "../../demos/data/menu.json",
                                            -								    parseData: false,
                                            -								    done: function() {
                                            -								        layer.msg("加载完成")
                                            -								    }
                                            -								});
                                            -								
                                            -								sideMenu.click(function(dom, data) {
                                            -								    
                                            -									layer.msg("菜单点击 : " + JSON.stringify(data));
                                            -								})
                                            -						
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - diff --git a/src/plugin/admin/public/demos/document/notice.html b/src/plugin/admin/public/demos/document/notice.html deleted file mode 100644 index 81c42006..00000000 --- a/src/plugin/admin/public/demos/document/notice.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - 通知组件 - - - -
                                            -
                                            -
                                            -
                                            -
                                            开发环境
                                            -
                                            - Notice 用于 消息通知 场景 -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -									<link rel="stylesheet" href="component/pear/css/pear.css" />
                                            -									 或
                                            -									<link rel="stylesheet" href="component/pear/css/pear-module/notice.css" />
                                            -									 并
                                            -									<script src="component/layui/layui.js"></script>
                                            -									 并
                                            -									<script src="component/pear/pear.js"></script>
                                            -								
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            消息提醒
                                            -
                                            -
                                            - notice.success("成功消息") -
                                            -
                                            - notice.error("危险消息") -
                                            -
                                            - notice.warning("警告消息") -
                                            -
                                            - notice.info("通用消息") -
                                            -
                                            -
                                            - - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -									layui.use(['notice', 'jquery', 'layer', 'code'], function() {
                                            -									    var notice = layui.notice;
                                            -										                         
                                            -									    notice.success("成功消息")
                                            -									    notice.error("危险消息")
                                            -									    notice.warning("警告消息")
                                            -									    notice.info("通用消息")
                                            -									})
                                            -								
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - 消息移除 -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -									layui.use(['notice', 'jquery', 'layer', 'code'], function() {
                                            -									    var notice = layui.notice;
                                            -										                         
                                            -									    notice.clear();
                                            -									})
                                            -								
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - - diff --git a/src/plugin/admin/public/demos/document/popover.html b/src/plugin/admin/public/demos/document/popover.html deleted file mode 100644 index bb192fb7..00000000 --- a/src/plugin/admin/public/demos/document/popover.html +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - 汽泡组件 - - - -
                                            -
                                            -
                                            -
                                            -
                                            开发环境
                                            -
                                            - popover 用于 汽泡显示 场景 -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -                            <link rel="stylesheet" href="component/pear/css/pear.css" />
                                            -                             并
                                            -                            <script src="component/layui/layui.js"></script>
                                            -                             并
                                            -                            <script src="component/pear/pear.js"></script>
                                            -                        
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            汽泡控制
                                            -
                                            - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -									layui.use(['popover', 'jquery', 'layer', 'code'], function() {
                                            -									   var popover = layui.popover;
                                            -    popover.show('#el1');
                                            -    popover.hide('#el1'); //或 $('#el1').webuiPopover('hide');
                                            -
                                            -
                                            -									})
                                            -								
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - 不同方式 -
                                            -
                                            - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -									layui.use(['toast', 'jquery', 'layer', 'code'], function() {
                                            -									    var popover = layui.popover;
                                            -    popover.create('#el1',{title:' hello popover-manual',content:'这里显示内容',trigger:'manual',placement:'auto',
                                            -        animation:'pop',
                                            -        closeable:true,
                                            -        delay: {
                                            -            //show and hide delay time of the popover, works only when trigger is 'hover',the value can be number or object
                                            -            show: null,
                                            -            hide: 100
                                            -        },
                                            -        opacity:0.98,
                                            -        type:'html',//content type, values:'html','iframe','async'
                                            -    });
                                            -
                                            -									})
                                            -								
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - 隐藏 -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -									layui.use(['popover', 'jquery', 'layer', 'code'], function() {
                                            -									    var popover = layui.popover;
                                            -									    popover.hideAll();
                                            -									})
                                            -								
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - - diff --git a/src/plugin/admin/public/demos/document/popup.html b/src/plugin/admin/public/demos/document/popup.html deleted file mode 100644 index d9960233..00000000 --- a/src/plugin/admin/public/demos/document/popup.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - 封装弹窗 - - - -
                                            -
                                            -
                                            -
                                            开发环境
                                            -
                                            - Popup 基于 Layer 的 二次封装, 提供简洁高效的 API 调用 -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								<link rel="stylesheet" href="component/pear/css/pear.css" />
                                            -								 并
                                            -								<script src="component/layui/layui.js"></script>
                                            -								 并
                                            -								<script src="component/pear/pear.js"></script>
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            提示消息
                                            -
                                            - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								layui.use(['popup'], function() {
                                            -								    var popup = layui.popup;
                                            -								  
                                            -								    popup.success("成功消息")
                                            -								    popup.failure("失败消息")
                                            -								    popup.warning("警告消息")
                                            -								})
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            回调函数
                                            -
                                            - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								layui.use(['popup'], function() {
                                            -								    var popup = layui.popup;
                                            -								  
                                            -								    popup.success("成功消息",callback)
                                            -								    popup.failure("失败消息",callback)
                                            -								    popup.warning("警告消息",callback)
                                            -								})
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - diff --git a/src/plugin/admin/public/demos/document/select.html b/src/plugin/admin/public/demos/document/select.html deleted file mode 100644 index e22feb63..00000000 --- a/src/plugin/admin/public/demos/document/select.html +++ /dev/null @@ -1,218 +0,0 @@ - - - - - 多选组件 - - - -
                                            -
                                            -
                                            -
                                            - 开发环境 -
                                            -
                                            - Select 应用于 多选 场景 -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								<link href="component/pear/css/pear.css" rel="stylesheet" />
                                            -								 并
                                            -								<script src="component/layui/layui.js"></script>
                                            -								 并
                                            -								<script src="component/pear/pear.js"></script>
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - 默认主题 -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -      								
                                            -      							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - 绿色主题 -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - 通用主题 -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - 警告主题 -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - 危险主题 -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - - diff --git a/src/plugin/admin/public/demos/document/step.html b/src/plugin/admin/public/demos/document/step.html deleted file mode 100644 index f1647c4d..00000000 --- a/src/plugin/admin/public/demos/document/step.html +++ /dev/null @@ -1,256 +0,0 @@ - - - - - 分布表单 - - - -
                                            -
                                            -
                                            -
                                            开发环境
                                            -
                                            Step 步骤表单
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								<link rel="stylesheet" href="component/pear/css/pear.css" />
                                            -								 并
                                            -								<script src="component/layui/layui.js"></script>
                                            -								 并
                                            -								<script src="component/pear/pear.js"></script>
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -		                        layui.use(['form', 'step','element'], function() {
                                            -		                            var $ = layui.$,
                                            -		                            form = layui.form,
                                            -		                            step = layui.step;
                                            -		                            
                                            -		                            step.render({
                                            -		                                elem: '#stepForm',
                                            -		                                filter: 'stepForm',
                                            -		                                width: '100%',
                                            -		                                stepWidth: '600px',
                                            -		                                height: '500px',
                                            -		                                stepItems: [{
                                            -		                                    title: '填写'
                                            -		                                }, {
                                            -		                                    title: '确认'
                                            -		                                }, {
                                            -		                                    title: '完成'
                                            -		                                }]
                                            -		                            });
                                            -		                         
                                            -		                            form.on('submit(formStep)', function(data) {
                                            -		                                step.next('#stepForm');
                                            -		                                return false;
                                            -		                            });
                                            -		                         
                                            -		                            form.on('submit(formStep2)', function(data) {
                                            -		                                step.next('#stepForm');
                                            -		                                return false;
                                            -		                            });
                                            -		                         
                                            -		                            $('.pre').click(function() {
                                            -		                                step.pre('#stepForm');
                                            -		                                return false;
                                            -		                            });
                                            -		                         
                                            -		                            $('.next').click(function() {
                                            -		                                step.next('#stepForm');
                                            -		                                return false;
                                            -		                            });
                                            -		                        })
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - diff --git a/src/plugin/admin/public/demos/document/tab.html b/src/plugin/admin/public/demos/document/tab.html deleted file mode 100644 index f6fcd057..00000000 --- a/src/plugin/admin/public/demos/document/tab.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - 多选项卡 - - - -
                                            -
                                            -
                                            -
                                            开发环境
                                            -
                                            - Tab.js 是一个多视图组件,你可在任何地方内嵌它,并执行常用操作,Admin 正式使用该组件进行路由切换 -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -							    <link rel="stylesheet" href="component/pear/css/pear.css" />
                                            -							    并
                                            -							    <script src="component/layui/layui.js"></script>
                                            -							    并
                                            -							    <script src="component/pear/pear.js"></script>
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - 常用操作 -
                                            -
                                            - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - 基本使用 -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								
                                            -								tab.render({
                                            -								    elem: 'contents',
                                            -								    roll: false,
                                            -								    tool: false,
                                            -								    width: '100%',
                                            -								    height: '480px',
                                            -								    index: 0,
                                            -								    tabMax: 30,
                                            -								    closeEvent: function(id) {
                                            -										
                                            -								        // do something
                                            -								    },
                                            -								    data: [{
                                            -								        id: "1",
                                            -								        title: "首页",
                                            -								        url: "http://www.baidu.com",
                                            -								        close: false
                                            -								    },{
                                            -								        id: "2",
                                            -								        title: "百度一下",
                                            -								        url: "http://www.baidu.com",
                                            -								        close: false
                                            -								    }]
                                            -								});
                                            -								
                                            -								
                                            -						
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - - diff --git a/src/plugin/admin/public/demos/document/tabContent.html b/src/plugin/admin/public/demos/document/tabContent.html deleted file mode 100644 index d01129bf..00000000 --- a/src/plugin/admin/public/demos/document/tabContent.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - 多选项卡内容 - - - -
                                            -
                                            -
                                            - - -
                                            -
                                            - - - - - diff --git a/src/plugin/admin/public/demos/document/table.html b/src/plugin/admin/public/demos/document/table.html deleted file mode 100644 index 8785c326..00000000 --- a/src/plugin/admin/public/demos/document/table.html +++ /dev/null @@ -1,412 +0,0 @@ - - - - - - 数据表格 - - - - - -
                                            -
                                            -
                                            -
                                            -
                                            - -
                                            - -
                                            -
                                            -
                                            - -
                                            - -
                                            -
                                            -
                                            - -
                                            - -
                                            -
                                            -
                                            - -
                                            - -
                                            -
                                            -
                                            - -
                                            - -
                                            -
                                            -
                                            - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - - - - - - - - - -
                                            -
                                            -
                                            -

                                            上侧弹层内容...

                                            -
                                            -
                                            - - - - - - - diff --git a/src/plugin/admin/public/demos/document/tag.html b/src/plugin/admin/public/demos/document/tag.html deleted file mode 100644 index e6478bbd..00000000 --- a/src/plugin/admin/public/demos/document/tag.html +++ /dev/null @@ -1,265 +0,0 @@ - - - - - 标签组件 - - - - - - -
                                            -
                                            -
                                            -
                                            开发环境
                                            -
                                            - Tag 标签组件 -
                                            -
                                            -
                                            - -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								<link rel="stylesheet" href="component/pear/css/pear.css" />
                                            -								 并
                                            -								<script src="component/layui/layui.js"></script>
                                            -								 并
                                            -								<script src="component/pear/pear.js"></script>
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            主题风格
                                            -
                                            -
                                            - - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -							
                                            - - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            动态操作
                                            -
                                            -
                                            - - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								tag.add('demo', {text: '新选项',id: 12})
                                            -								 
                                            -								tag.delete('demo', '44');
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            圆角风格
                                            -
                                            -
                                            - - - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								
                                            - - - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            删除功能
                                            -
                                            -
                                            - - - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								
                                            - - - - -
                                            - - tag.on('delete(demo)', function(data) { - console.log('删除'); - console.log(this); - console.log(data.index); - console.log(data.elem); - console.log(data.othis); - }); -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            新建功能
                                            -
                                            -
                                            - - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -							
                                            - - - - -
                                            - - tag.on('add(demo)', function(data) { - console.log('新建'); - console.log(this); - console.log(data.index); - console.log(data.elem); - }); -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - diff --git a/src/plugin/admin/public/demos/document/tinymce.html b/src/plugin/admin/public/demos/document/tinymce.html deleted file mode 100644 index 9ba01e55..00000000 --- a/src/plugin/admin/public/demos/document/tinymce.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - 文本编辑 - - - -
                                            -
                                            -
                                            -
                                            - 开发环境 -
                                            -
                                            - Tinymce 文本编辑器 -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								<link href="component/pear/css/pear.css" rel="stylesheet" />
                                            -								 并
                                            -								<script src="component/layui/layui.js"></script>
                                            -								 并
                                            -								<script src="component/pear/pear.js"></script>
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            富文本编辑器
                                            -
                                            - -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								layui.use(['tinymce'], function() {
                                            -								    var tinymce = layui.tinymce
                                            -								
                                            -								    var edit = tinymce.render({
                                            -								        elem: "#edit",
                                            -								        height: 400
                                            -								    });
                                            -									
                                            -								    edit.getContent()
                                            -								});
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - diff --git a/src/plugin/admin/public/demos/document/toast.html b/src/plugin/admin/public/demos/document/toast.html deleted file mode 100644 index eb276cdc..00000000 --- a/src/plugin/admin/public/demos/document/toast.html +++ /dev/null @@ -1,291 +0,0 @@ - - - - - - - 通知组件 - - - -
                                            -
                                            -
                                            -
                                            -
                                            开发环境
                                            -
                                            - toast 用于 消息通知 场景 -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -									<link rel="stylesheet" href="component/pear/css/pear.css" />
                                            -									 或
                                            -									<link rel="stylesheet" href="component/pear/css/pear-module/toast.css" />
                                            -									 并
                                            -									<script src="component/layui/layui.js"></script>
                                            -									 并
                                            -									<script src="component/pear/pear.js"></script>
                                            -								
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            消息提醒
                                            -
                                            -
                                            - toast.success({title:"成功消息",message:"消息描述"}) -
                                            -
                                            - toast.error({title:"危险消息",message:"消息描述"}) -
                                            -
                                            - toast.warning({title:"警告消息",message:"消息描述"}) -
                                            -
                                            - toast.info({title:"通知消息",message:"消息描述"}) -
                                            -
                                            -
                                            - - - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -									layui.use(['toast', 'jquery', 'layer', 'code'], function() {
                                            -									    var toast = layui.toast;
                                            -										                         
                                            -									    toast.success({title: 'Caution',message: 'You forgot important data',position: 'topRight'});
                                            -									    
                                            -										toast.info({title: 'Caution',message: 'You forgot important data',position: 'topRight'});
                                            -									    
                                            -										toast.warning({title: 'Caution',message: 'You forgot important data',position: 'topRight'});
                                            -									    
                                            -										toast.error({title: 'Caution',message: 'You forgot important data',position: 'topRight'});
                                            -									    
                                            -										toast.question({title: 'Caution',message: 'You forgot important data',position: 'topRight'});
                                            -									})
                                            -								
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - 不同位置 -
                                            -
                                            - - - - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -									layui.use(['toast', 'jquery', 'layer', 'code'], function() {
                                            -									    var toast = layui.toast;
                                            -										                         
                                            -									    $(".toast-top-left-btn").click(function(){
                                            -									        toast.success({title: 'Caution',message: 'You forgot important data',position: 'topLeft'});
                                            -									    })
                                            -									    $(".toast-top-center-btn").click(function(){
                                            -									        toast.success({title: 'Caution',message: 'You forgot important data',position: 'topCenter'});
                                            -									    })
                                            -									    $(".toast-top-right-btn").click(function(){
                                            -									        toast.success({title: 'Caution',message: 'You forgot important data',position: 'topRight'});
                                            -									    })
                                            -									    $(".toast-bottom-left-btn").click(function(){
                                            -									        toast.success({title: 'Caution',message: 'You forgot important data',position: 'bottomLeft'});
                                            -									    })
                                            -									    $(".toast-bottom-center-btn").click(function(){
                                            -									        toast.success({title: 'Caution',message: 'You forgot important data',position: 'bottomCenter'});
                                            -									    })
                                            -									    $(".toast-bottom-right-btn").click(function(){
                                            -									        toast.success({title: 'Caution',message: 'You forgot important data',position: 'bottomRight'});
                                            -									    })
                                            -									})
                                            -								
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - 消息移除 -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -									layui.use(['toast', 'jquery', 'layer', 'code'], function() {
                                            -									    var toast = layui.toast;
                                            -										                         
                                            -									    toast.destroy();
                                            -									})
                                            -								
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - - diff --git a/src/plugin/admin/public/demos/document/topBar.html b/src/plugin/admin/public/demos/document/topBar.html deleted file mode 100644 index b1a4cf06..00000000 --- a/src/plugin/admin/public/demos/document/topBar.html +++ /dev/null @@ -1,279 +0,0 @@ - - - - - 回到顶部 - - - - - - - -
                                            -
                                            - -
                                            -
                                            动态
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            七彩枫叶 在 Pear Admin 专区 回答问题

                                            - 几秒前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            简 在 Pear Admin 专区 进行了 提问

                                            - 2天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            恒宇少年 将 Pear Admin 更新至 2.3.0 版本

                                            - 7天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            如花 在 Pear Admin 社区 发布了 建议

                                            - 7天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            就眠仪式 在 Pear Admin 社区 发布了 建议

                                            - 8天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            贤心 在 Pear Admin 专区 进行了 提问

                                            - 8天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            七彩枫叶 在 Pear Admin 专区 回答问题

                                            - 几秒前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            简 在 Pear Admin 专区 进行了 提问

                                            - 2天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            恒宇少年 将 Pear Admin 更新至 2.3.0 版本

                                            - 7天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            如花 在 Pear Admin 社区 发布了 建议

                                            - 7天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            就眠仪式 在 Pear Admin 社区 发布了 建议

                                            - 8天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            贤心 在 Pear Admin 专区 进行了 提问

                                            - 8天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            七彩枫叶 在 Pear Admin 专区 回答问题

                                            - 几秒前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            简 在 Pear Admin 专区 进行了 提问

                                            - 2天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            恒宇少年 将 Pear Admin 更新至 2.3.0 版本

                                            - 7天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            如花 在 Pear Admin 社区 发布了 建议

                                            - 7天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            就眠仪式 在 Pear Admin 社区 发布了 建议

                                            - 8天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            贤心 在 Pear Admin 专区 进行了 提问

                                            - 8天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            七彩枫叶 在 Pear Admin 专区 回答问题

                                            - 几秒前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            简 在 Pear Admin 专区 进行了 提问

                                            - 2天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            恒宇少年 将 Pear Admin 更新至 2.3.0 版本

                                            - 7天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            如花 在 Pear Admin 社区 发布了 建议

                                            - 7天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            就眠仪式 在 Pear Admin 社区 发布了 建议

                                            - 8天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            次等水货 在 Pear Admin 专区 进行了 提问

                                            - 8天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            七彩枫叶 在 Pear Admin 专区 回答问题

                                            - 几秒前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            简 在 Pear Admin 专区 进行了 提问

                                            - 2天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            恒宇少年 将 Pear Admin 更新至 2.3.0 版本

                                            - 7天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            如花 在 Pear Admin 社区 发布了 建议

                                            - 7天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            就眠仪式 在 Pear Admin 社区 发布了 建议

                                            - 8天前 -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            微笑刺客 在 Pear Admin 专区 进行了 提问

                                            - 8天前 -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - -
                                            -
                                            - - - - - - diff --git a/src/plugin/admin/public/demos/document/treetable.html b/src/plugin/admin/public/demos/document/treetable.html deleted file mode 100644 index 68617fee..00000000 --- a/src/plugin/admin/public/demos/document/treetable.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - - 树形表格 - - - -
                                            -
                                            -
                                            -
                                            - -
                                            - -
                                            - - -
                                            -
                                            -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/plugin/admin/public/demos/document/watermark.html b/src/plugin/admin/public/demos/document/watermark.html deleted file mode 100644 index a4562e00..00000000 --- a/src/plugin/admin/public/demos/document/watermark.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - 水印组件 - - - -
                                            -
                                            -
                                            -
                                            开发环境
                                            -
                                            - watermark 用于水印叠加 -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -                        <link rel="stylesheet" href="component/pear/css/pear.css" />
                                            -                         并
                                            -                        <script src="component/layui/layui.js"></script>
                                            -                         并
                                            -                        <script src="component/pear/pear.js"></script>
                                            -                    
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            水印创建
                                            -
                                            - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								layui.use(['watermark'], function() {
                                            -								    var watermark = layui.watermark;
                                            -
                                            -    var mark_node=new watermark({
                                            -        content: "单行水印"
                                            -    });
                                            -
                                            -    new watermark({
                                            -        content: "多行水印1
                                            多行水印2", - height:40 - }); - - new watermark({ - content: "指定容器上", - appendTo:'#water_div', - }); - - }) -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            指定容器水印
                                            -
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            移除水印
                                            -
                                            - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -

                                            显示代码

                                            -
                                            -
                                            -								layui.use(['watermark'], function() {
                                            -								    var popup = layui.popup;
                                            -                                    mark_node.destroy();
                                            -								})
                                            -							
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - diff --git a/src/plugin/admin/public/demos/echarts/column.html b/src/plugin/admin/public/demos/echarts/column.html deleted file mode 100644 index 44bcb275..00000000 --- a/src/plugin/admin/public/demos/echarts/column.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - 条状图表 - - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - - - - diff --git a/src/plugin/admin/public/demos/echarts/line.html b/src/plugin/admin/public/demos/echarts/line.html deleted file mode 100644 index 1b5c9cc6..00000000 --- a/src/plugin/admin/public/demos/echarts/line.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - 折线图表 - - - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            - - - - - - - - diff --git a/src/plugin/admin/public/demos/echarts/script/column1.js b/src/plugin/admin/public/demos/echarts/script/column1.js deleted file mode 100644 index db5e817f..00000000 --- a/src/plugin/admin/public/demos/echarts/script/column1.js +++ /dev/null @@ -1,137 +0,0 @@ -layui.use(['echarts'], function() { - let echarts = layui.echarts; - var column1 = echarts.init(document.getElementById('column1'),null, { - width: 600, - height: 400 - }); -option = { - tooltip: { - trigger: 'axis', - axisPointer: { - type: 'shadow' , - color: '#fff', - fontSize: '26' - } - }, - legend: { - top:'5%', - right:'10%', - data: ['猕猴桃', '香蕉'], - fontSize:12, - color:'#808080', - icon:'rect' - }, - grid: { - top:60, - left:50, - bottom:60, - right:60 - }, - xAxis: [{ - type: 'category', - axisTick:{ - show:false - }, - axisLine:{ - show:false - }, - axisLabel:{ - color:'#4D4D4D', - fontSize:14, - margin:21, - fontWeight:'bold' - }, - data: ['第一周', '第二周', '第三周', '第四周'], - - }], - yAxis: [{ - name:'单位:万', - nameTextStyle:{ - color:'#808080', - fontSize:12, - padding:[0, 0, 0, -5] - }, - max: function(value) { - if(value.max<5){ - return 5 - }else{ - return value.max - } - }, - type: 'value', - axisLine:{ - show:false - }, - axisLabel:{ - color:'#808080', - fontSize:12, - margin:5 - }, - splitLine:{ - show:false - }, - axisTick:{ - show:false - } - }], - series: [ - { - name: '猕猴桃', - type: 'bar', - label:{ - show:true, - position:'top', - fontSize:14, - color:'#3DC3F0', - fontWeight:'bold' - }, - barMaxWidth:60, - color: { - type: 'linear', - x: 0, - y: 0, - x2: 0, - y2: 1, - colorStops: [{ - offset: 0, color: '#3DC3F0' // 0% 处的颜色 - }, { - offset: 1, color: '#CCF2FF' // 100% 处的颜色 - }] - }, - data: [60, 110, 180, 100] - }, - { - name: '香蕉', - type: 'bar', - label:{ - show:true, - position:'top', - fontSize:14, - color:'#3D8BF0', - fontWeight:'bold' - }, - barMaxWidth:60, - color: { - type: 'linear', - x: 0, - y: 0, - x2: 0, - y2: 1, - colorStops: [{ - offset: 0, color: '#3D8BF0' // 0% 处的颜色 - }, { - offset: 1, color: '#CCE2FF' // 100% 处的颜色 - }] - }, - data: [90, 130, 170, 130] - } - ] -}; - - column1.setOption(option); - - window.onresize = function() { - column1.resize(); - } - -}) diff --git a/src/plugin/admin/public/demos/echarts/script/column2.js b/src/plugin/admin/public/demos/echarts/script/column2.js deleted file mode 100644 index 6393cce1..00000000 --- a/src/plugin/admin/public/demos/echarts/script/column2.js +++ /dev/null @@ -1,73 +0,0 @@ -layui.use(['echarts'], function() { - let echarts = layui.echarts; - var column2 = echarts.init(document.getElementById('column2'),null, { - width: 600, - height: 400 - }); - - var data = [1000, 600, 500, 300]; - option = { - backgroundColor: '#ffffff', - title: { - text: 'ETC交易成功率', - left: 'center', - top: 2, - fontSize: 20 - }, - color: ['#fed46b','#2194ff', ], - tooltip: { - trigger: 'axis', - axisPointer: { // 坐标轴指示器,坐标轴触发有效 - type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' - } - }, - grid: { - left: '3%', - right: '4%', - bottom: '10%', - containLabel: true - }, - legend: { - left: 'center', - bottom: '2%', - data: ['去年', '今年', ] - }, - xAxis: [{ - type: 'category', - data: ['09-22', '09-22', '09-22', '09-22', '09-22', '09-22', '09-22'], - axisTick: { - alignWithLabel: true - } - }], - yAxis: [{ - type: 'value' - }], - barMaxWidth: '30', - label:{ - show:true, - position:'top', - formatter:function(params){ - return params.value+'%' - } - }, - series: [ - - { - name: '去年', - type: 'bar', - data: [90, 52, 90, 80, 90, 70, 90] - }, - { - name: '今年', - type: 'bar', - data: [10, 52, 90, 70, 90, 70, 90] - }, - ] - }; - column2.setOption(option); - - window.onresize = function() { - column2.resize(); - } - -}) diff --git a/src/plugin/admin/public/demos/echarts/script/column3.js b/src/plugin/admin/public/demos/echarts/script/column3.js deleted file mode 100644 index 897e4950..00000000 --- a/src/plugin/admin/public/demos/echarts/script/column3.js +++ /dev/null @@ -1,120 +0,0 @@ -layui.use(['echarts'], function() { - let echarts = layui.echarts; - var column3 = echarts.init(document.getElementById('column3'),null, { - width: 600, - height: 400 - }); - - const colorList = ["#9E87FF", '#73DDFF', '#fe9a8b', '#F56948', '#9E87FF'] - -option = { - backgroundColor: '#fff', - tooltip: { - trigger: "axis", - padding: [8, 10], - backgroundColor: 'rgba(255,255,255,0.5)', - axisPointer: { - type: "shadow", - color: "#fff" - } - }, - legend: { - data: ['新开会员', '激活会员', '关闭会员'], - align: 'left', - right: 0, - - color: "#333", - fontSize: 14, - fontWeight: 200, - - itemWidth: 14, - itemHeight: 14, - itemGap: 35 - }, - grid: { - left: '0', - right: '0', - bottom: '8%', - top: '15%', - containLabel: true - }, - label: { - show: true, - position: 'top', - color: '#333', - fontSize: 14, - fontWeight: 700 - }, - xAxis: [{ - type: 'category', - offset: 10, - data: ['团队1', '团队2', '团队3', '团队4'], - axisLine: { - show: false - }, - axisTick: { - show: false - }, - axisLabel: { - show: true, - color: "#333", - fontSize: 16, - fontWeight: 200 - - }, - }], - yAxis: [{ - type: 'value', - axisLabel: { - show: false - }, - axisTick: { - show: false - }, - axisLine: { - show: false - }, - splitLine: { - show: false - } - }], - series: [{ - name: '新开会员', - type: 'bar', - data: [20, 34, 18, 14, 16], - barWidth: 22, //柱子宽度 - barGap: 1, //柱子之间间距 - itemStyle: { - color: '#0071c8', - opacity: 1, - } - }, { - name: '激活会员', - type: 'bar', - data: [10, 24, 5, 24, 16], - barWidth: 22, - barGap: 1, - itemStyle: { - color: '#fdc508', - opacity: 1, - } - }, { - name: '关闭会员', - type: 'bar', - data: [7, 24, 18, 20, 6], - barWidth: 22, - barGap: 1, - itemStyle: { - color: '#dfeafc', - opacity: 1, - } - }] -}; - - column3.setOption(option); - - window.onresize = function() { - column3.resize(); - } - -}) diff --git a/src/plugin/admin/public/demos/echarts/script/column4.js b/src/plugin/admin/public/demos/echarts/script/column4.js deleted file mode 100644 index 6cd871f4..00000000 --- a/src/plugin/admin/public/demos/echarts/script/column4.js +++ /dev/null @@ -1,84 +0,0 @@ -layui.use(['echarts'], function() { - let echarts = layui.echarts; - var column4 = echarts.init(document.getElementById('column4'),null, { - width: 600, - height: 400 - }); - option = { - backgroundColor:'#fff', - title:{ - text:"描边柱状图", - top:10, - left:15, - color:"#35598d", - fontSize:16, - fontWeight:'normal' - }, - tooltip: { - trigger: 'axis', - formatter:'{b}:{c}', - }, - grid: { - left: '5%', - right: '6%', - bottom: '3%', - top: '20%', - containLabel: true - }, - xAxis :{ - type : 'category', - data : ['策略1','策略2','策略3','策略4','策略5','策略6','策略7','策略8','策略9'], - axisLabel:{ //坐标轴字体颜色 - color: '#9eaaba' - }, - axisLine:{ - lineStyle:{ - color:"#e5e5e5" - } - }, - axisTick:{ //y轴刻度线 - show:false - }, - splitLine:{ //网格 - show: false, - } - }, - yAxis :{ - type : 'value', - axisLabel:{ //坐标轴字体颜色 - color: '#9eaaba' - }, - axisLine:{ - show:false, - }, - axisTick:{ //y轴刻度线 - show:false - }, - splitLine:{ //网格 - show: true, - lineStyle:{ - color:'#dadde4', - type:"dashed" //坐标网线类型 - } - } - }, - series:{ - name:'', - type:'bar', - barWidth : '40%', //柱子宽度 - itemStyle:{ //柱子颜色 - borderWidth: 2, - borderColor: 'rgb(79, 116, 223)', - color:'rgba(79, 116, 223, .3)', - }, - data:[320, 332, 301, 334, 390, 330, 320, 230, 156] - } - }; - - column4.setOption(option); - - window.onresize = function() { - column4.resize(); - } - -}) diff --git a/src/plugin/admin/public/demos/echarts/script/line1.js b/src/plugin/admin/public/demos/echarts/script/line1.js deleted file mode 100644 index 1a0ce7b3..00000000 --- a/src/plugin/admin/public/demos/echarts/script/line1.js +++ /dev/null @@ -1,236 +0,0 @@ -layui.use(['echarts'], function() { - let echarts = layui.echarts; - var line2 = echarts.init(document.getElementById('line2'),null, { - width: 600, - height: 400 - }); - - const colorList = ["#9E87FF", '#73DDFF', '#fe9a8b', '#F56948', '#9E87FF'] - option = { - backgroundColor: '#fff', - title: { - text: '全国6月销售统计', - fontSize: 12, - fontWeight: 400, - left: 'center', - top: '5%' - }, - legend: { - icon: 'circle', - top: '5%', - right: '5%', - itemWidth: 6, - itemGap: 20, - color: '#556677' - }, - tooltip: { - trigger: 'axis', - axisPointer: { - label: { - show: true, - backgroundColor: '#fff', - color: '#556677', - borderColor: 'rgba(0,0,0,0)', - shadowColor: 'rgba(0,0,0,0)', - shadowOffsetY: 0 - }, - lineStyle: { - width: 0 - } - }, - backgroundColor: '#fff', - color: '#5c6c7c', - padding: [10, 10], - extraCssText: 'box-shadow: 1px 0 2px 0 rgba(163,163,163,0.5)' - }, - grid: { - top: '15%' - }, - xAxis: [{ - type: 'category', - data: ['北京', '上海', '广州', '深圳', '香港', '澳门', '台湾'], - axisLine: { - lineStyle: { - color: '#DCE2E8' - } - }, - axisTick: { - show: false - }, - axisLabel: { - interval: 0, - color: '#556677', - // 默认x轴字体大小 - fontSize: 12, - // margin:文字到x轴的距离 - margin: 15 - }, - axisPointer: { - label: { - // padding: [11, 5, 7], - padding: [0, 0, 10, 0], - - // 这里的margin和axisLabel的margin要一致! - margin: 15, - // 移入时的字体大小 - fontSize: 12, - backgroundColor: { - type: 'linear', - x: 0, - y: 0, - x2: 0, - y2: 1, - colorStops: [{ - offset: 0, - color: '#fff' // 0% 处的颜色 - }, { - // offset: 0.9, - offset: 0.86, - - color: '#fff' // 0% 处的颜色 - }, { - offset: 0.86, - color: '#33c0cd' // 0% 处的颜色 - }, { - offset: 1, - color: '#33c0cd' // 100% 处的颜色 - }], - global: false // 缺省为 false - } - } - }, - boundaryGap: false - }], - yAxis: [{ - type: 'value', - axisTick: { - show: false - }, - axisLine: { - show: true, - lineStyle: { - color: '#DCE2E8' - } - }, - axisLabel: { - color: '#556677', - }, - splitLine: { - show: false - } - }, { - type: 'value', - position: 'right', - axisTick: { - show: false - }, - axisLabel: { - color: '#556677', - formatter: '{value}' - }, - axisLine: { - show: true, - lineStyle: { - color: '#DCE2E8' - } - }, - splitLine: { - show: false - } - }], - series: [{ - name: 'Adidas', - type: 'line', - data: [10, 10, 30, 12, 15, 3, 7], - symbolSize: 1, - symbol: 'circle', - smooth: true, - yAxisIndex: 0, - showSymbol: true, - lineStyle: { - width: 5, - color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{ - offset: 0, - color: '#9effff' - }, - { - offset: 1, - color: '#9E87FF' - } - ]), - shadowColor: 'rgba(158,135,255, 0.3)', - shadowBlur: 10, - shadowOffsetY: 20 - }, - itemStyle: { - color: colorList[0], - borderColor: colorList[0] - } - }, { - name: 'Nike', - type: 'line', - data: [5, 12, 11, 14, 25, 16, 10], - symbolSize: 1, - symbol: 'circle', - smooth: true, - yAxisIndex: 0, - showSymbol: true, - lineStyle: { - width: 5, - color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [{ - offset: 0, - color: '#73DD39' - }, - { - offset: 1, - color: '#73DDFF' - } - ]), - shadowColor: 'rgba(115,221,255, 0.3)', - shadowBlur: 10, - shadowOffsetY: 20 - }, - itemStyle: { - color: colorList[1], - borderColor: colorList[1] - } - }, - { - name: '老北京布鞋', - type: 'line', - data: [150, 120, 170, 140, 500, 160, 110], - symbolSize: 1, - yAxisIndex: 1, - symbol: 'circle', - smooth: true, - showSymbol: true, - lineStyle: { - width: 5, - color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ - offset: 0, - color: '#fe9a' - }, - { - offset: 1, - color: '#fe9a8b' - } - ]), - shadowColor: 'rgba(254,154,139, 0.3)', - shadowBlur: 10, - shadowOffsetY: 20 - }, - itemStyle: { - color: colorList[2], - borderColor: colorList[2] - } - } - ] - }; - - line2.setOption(option); - - window.onresize = function() { - line2.resize(); - } - -}) diff --git a/src/plugin/admin/public/demos/echarts/script/line2.js b/src/plugin/admin/public/demos/echarts/script/line2.js deleted file mode 100644 index c0bb5319..00000000 --- a/src/plugin/admin/public/demos/echarts/script/line2.js +++ /dev/null @@ -1,148 +0,0 @@ -layui.use(['echarts'], function() { - let echarts = layui.echarts; - var line1 = echarts.init(document.getElementById('line1'),null, { - width: 600, - height: 400 - }); - - const colorList = ["#9E87FF", '#73DDFF', '#fe9a8b', '#F56948', '#9E87FF'] - option = { - - backgroundColor: '#fff', - tooltip: { - show: false - }, - grid: { - top: '10%', - bottom: '6%', - left: '6%', - right: '6%', - containLabel: true - }, - xAxis: [{ - type: 'category', - boundaryGap: false, - axisLine: { - show: false - }, - axisTick: { - show: false - }, - axisLabel: { - margin: 10, - fontSize: 14, - color: 'rgba(#999)' - }, - splitLine: { - show: true, - lineStyle: { - color: '#939ab6', - opacity: .15 - } - }, - data: ['10:00', '10:10', '10:10', '10:30', '10:40', '10:50'] - },], - yAxis: [{ - type: 'value', - offset: 15, - max: 100, - min: 0, - axisTick: { - show: false - }, - axisLine: { - show: false - }, - axisLabel: { - margin: 10, - fontSize: 14, - color: '#999' - - }, - splitLine: { - show: false - } - - }], - series: [{ - name: '2', - type: 'line', - z: 3, - showSymbol: false, - smoothMonotone: 'x', - lineStyle: { - width: 3, - color: { - type: 'linear', - x: 0, - y: 0, - x2: 0, - y2: 1, - colorStops: [{ - offset: 0, color: 'rgba(59,102,246)' // 0% 处的颜色 - }, { - offset: 1, color: 'rgba(118,237,252)' // 100% 处的颜色 - }] - }, - shadowBlur: 4, - shadowColor: 'rgba(69,126,247,.2)', - shadowOffsetY: 4 - }, - areaStyle: { - color: { - type: 'linear', - x: 0, - y: 0, - x2: 0, - y2: 1, - colorStops: [{ - offset: 0, color: 'rgba(227,233,250,.9)' // 0% 处的颜色 - }, { - offset: 1, color: 'rgba(248,251,252,.3)' // 100% 处的颜色 - }] - } - }, - smooth: true, - data: [20, 56, 17, 40, 68, 42] - },{ - name: '1', - type: 'line', - showSymbol: false, - smoothMonotone: 'x', - - lineStyle: { - width: 3, - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ - offset: 0, - color: 'rgba(255,84,108)' - }, { - offset: 1, - color: 'rgba(252,140,118)' - }], false), - shadowBlur: 4, - shadowColor: 'rgba(253,121,128,.2)', - shadowOffsetY: 4 - }, - areaStyle: { - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ - offset: 0, - color: 'rgba(255,84,108,.15)' - }, { - offset: 1, - color: 'rgba(252,140,118,0)' - }], false), - }, - smooth: true, - data: [20, 71, 8, 50, 57, 32] - } - ] - - }; - - line1.setOption(option); - - window.onresize = function() { - line1.resize(); - } - -}) diff --git a/src/plugin/admin/public/demos/echarts/script/line3.js b/src/plugin/admin/public/demos/echarts/script/line3.js deleted file mode 100644 index 12bfbc7b..00000000 --- a/src/plugin/admin/public/demos/echarts/script/line3.js +++ /dev/null @@ -1,102 +0,0 @@ -layui.use(['echarts'], function() { - let echarts = layui.echarts; - - var line3 = echarts.init(document.getElementById('line3'),null, { - width: 600, - height: 400 - }); - - const colorList = ["#9E87FF", '#73DDFF', '#fe9a8b', '#F56948', '#9E87FF'] - - option = { - backgroundColor: '#fff', - title: { - text: "告警数", - left: "18px", - top: "0", - color: "#999", - fontSize: 12, - fontWeight: '400' - }, - color: ['#73A0FA', '#73DEB3', '#FFB761'], - tooltip: { - trigger: 'axis', - axisPointer: { - type: 'cross', - crossStyle: { - color: '#999' - }, - lineStyle: { - type: 'dashed' - } - } - }, - grid: { - left: '25', - right: '25', - bottom: '24', - top: '75', - containLabel: true - }, - legend: { - data: ['上周', '本周'], - orient: 'horizontal', - icon: "rect", - show: true, - left: 20, - top: 25, - }, - xAxis: { - type: 'category', - data: ['爱立信端局', '中兴端局', '爱立信HSS', '中兴HSS', '华为HSS', '华为智能网', '中兴VIMS'], - splitLine: { - show: false - }, - axisTick: { - show: false - }, - axisLine: { - show: false - }, - }, - yAxis: { - type: 'value', - axisLabel: { - color: '#999', - fontSize: 12 - }, - splitLine: { - show: true, - lineStyle: { - color: '#F3F4F4' - } - }, - axisTick: { - show: false - }, - axisLine: { - show: false - }, - }, - series: [{ - name: '上周', - type: 'line', - smooth: true, - data: [1800, 1000, 2000, 1000, 500, 100, 1200] - }, - { - name: '本周', - type: 'line', - smooth: true, - data: [1700, 999, 1100, 899, 199, 99, 1000] - } - ] - }; - - line3.setOption(option); - - window.onresize = function() { - line3.resize(); - } - -}) diff --git a/src/plugin/admin/public/demos/echarts/script/line4.js b/src/plugin/admin/public/demos/echarts/script/line4.js deleted file mode 100644 index 19e9f790..00000000 --- a/src/plugin/admin/public/demos/echarts/script/line4.js +++ /dev/null @@ -1,167 +0,0 @@ -layui.use(['echarts'], function() { - let echarts = layui.echarts; - - var line4 = echarts.init(document.getElementById('line4'),null, { - width: 600, - height: 400 - }); - - const colorList = ["#9E87FF", '#73DDFF', '#fe9a8b', '#F56948', '#9E87FF'] - option = { - title: { - text: '用电量' - }, - tooltip: { - trigger: 'axis' - }, - legend: { - data: ['2018', '2019'] - }, - grid: { - left: '3%', - right: '4%', - bottom: '3%', - containLabel: true - }, - toolbox: { - feature: { - saveAsImage: {} - } - }, - xAxis: { - type: 'category', - boundaryGap: false,//坐标轴两边留白 - data: ['12201', '12202', '12203','12204','12301','12302','12303','12304','12401', '12402', '12403','12404'], - axisLabel: { //坐标轴刻度标签的相关设置。 - interval: 0,//设置为 1,表示『隔一个标签显示一个标签』 - // margin:15, - - color: '#1B253A', - fontStyle: 'normal', - fontFamily: '微软雅黑', - fontSize: 12, - - formatter:function(params) { - var newParamsName = ""; - var paramsNameNumber = params.length; - var provideNumber = 4; //一行显示几个字 - var rowNumber = Math.ceil(paramsNameNumber / provideNumber); - if (paramsNameNumber > provideNumber) { - for (var p = 0; p < rowNumber; p++) { - var tempStr = ""; - var start = p * provideNumber; - var end = start + provideNumber; - if (p == rowNumber - 1) { - tempStr = params.substring(start, paramsNameNumber); - } else { - tempStr = params.substring(start, end) + "\n"; - } - newParamsName += tempStr; - } - - } else { - newParamsName = params; - } - return newParamsName - }, - //rotate:50, - }, - axisTick:{//坐标轴刻度相关设置。 - show: false, - }, - axisLine:{//坐标轴轴线相关设置 - lineStyle:{ - color:'#E5E9ED', - // opacity:0.2 - } - }, - splitLine: { //坐标轴在 grid 区域中的分隔线。 - show: true, - lineStyle: { - color: '#E5E9ED', - // opacity:0.1 - } - } - }, - yAxis: [ - { - type: 'value', - splitNumber: 5, - axisLabel: { - - color: '#a8aab0', - fontStyle: 'normal', - fontFamily: '微软雅黑', - fontSize: 12 - - }, - axisLine:{ - show: false - }, - axisTick:{ - show: false - }, - splitLine: { - show: true, - lineStyle: { - color: '#E5E9ED', - // opacity:0.1 - } - } - - } - ], - series: [ - { - name: '2018', - type: 'line', - itemStyle: { - color:'#3A84FF', - lineStyle: { - color: "#3A84FF", - width:1 - }, - areaStyle: { - color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{ - offset: 0, - color: 'rgba(58,132,255,0)' - }, { - offset: 1, - color: 'rgba(58,132,255,0.35)' - }]), - } - }, - data: [ 1, 2, 3, 3, 5, 6, 5, 3, 6, 5, 5, 4] - }, - { - name: '2019', - type: 'line', - itemStyle: { - color:'rgba(255,80,124,1)', - lineStyle: { - color: "rgba(255,80,124,1)", - width:1 - }, - areaStyle: { - color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{ - offset: 0, - color: 'rgba(255,80,124,0)' - }, { - offset: 1, - color: 'rgba(255,80,124,0.35)' - }]), - } - }, - data: [9, 5,7,8,6,7,8,7,7,6,8,6] - } - ] - }; - - - line4.setOption(option); - - window.onresize = function() { - line4.resize(); - } - -}) diff --git a/src/plugin/admin/public/demos/error/403.html b/src/plugin/admin/public/demos/error/403.html deleted file mode 100644 index 3c6db3b6..00000000 --- a/src/plugin/admin/public/demos/error/403.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - -
                                            - -
                                            -

                                            403

                                            -

                                            抱歉,你无权访问该页面

                                            - -
                                            -
                                            - - - - \ No newline at end of file diff --git a/src/plugin/admin/public/demos/error/404.html b/src/plugin/admin/public/demos/error/404.html deleted file mode 100644 index 9311a45b..00000000 --- a/src/plugin/admin/public/demos/error/404.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - -
                                            - -
                                            -

                                            404

                                            -

                                            抱歉,你访问的页面不存在或仍在开发中

                                            - -
                                            -
                                            - - - - \ No newline at end of file diff --git a/src/plugin/admin/public/demos/error/500.html b/src/plugin/admin/public/demos/error/500.html deleted file mode 100644 index 75e87821..00000000 --- a/src/plugin/admin/public/demos/error/500.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - -
                                            - -
                                            -

                                            500

                                            -

                                            抱歉,服务器出错了

                                            - -
                                            -
                                            - - - - \ No newline at end of file diff --git a/src/plugin/admin/public/demos/result/error.html b/src/plugin/admin/public/demos/result/error.html deleted file mode 100644 index e4780483..00000000 --- a/src/plugin/admin/public/demos/result/error.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - 失败 - - - - -
                                            -
                                            -
                                            -
                                            - -
                                            -

                                            提交失败

                                            -

                                            - 请核对并修改以下信息后,再重新提交。如果仅是简单操作,使用 Message 全局提示反馈即可。 - 本文字区域可以展示简单的补充说明,如果有类似展示 - “单据”的需求,下面这个灰色区域可以呈现比较复杂的内容。 -

                                            -
                                            - -
                                            -
                                            - -     - -
                                            -
                                            -
                                            -
                                            - - - - - diff --git a/src/plugin/admin/public/demos/result/success.html b/src/plugin/admin/public/demos/result/success.html deleted file mode 100644 index 1010cbeb..00000000 --- a/src/plugin/admin/public/demos/result/success.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - 成功 - - - - -
                                            -
                                            -
                                            -
                                            - -
                                            -

                                            提交成功

                                            -

                                            - 提交结果页用于反馈一系列操作任务的处理结果, - 如果仅是简单操作,使用 Message 全局提示反馈即可。 - 本文字区域可以展示简单的补充说明,如果有类似展示 - “单据”的需求,下面这个灰色区域可以呈现比较复杂的内容。 -

                                            -
                                            - -
                                            -
                                            - -     - -
                                            -
                                            -
                                            -
                                            - - - - diff --git a/src/plugin/admin/public/demos/system/deptment.html b/src/plugin/admin/public/demos/system/deptment.html deleted file mode 100644 index 7d4cc955..00000000 --- a/src/plugin/admin/public/demos/system/deptment.html +++ /dev/null @@ -1,289 +0,0 @@ - - - - - 部门管理 - - - - -
                                            -
                                            -
                                            -
                                            -
                                            - -
                                            - -
                                            -
                                            -
                                            - -
                                            - -
                                            -
                                            -
                                            - -
                                            - -
                                            -
                                            -
                                            - - -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                            -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              - - - - - - - - - diff --git a/src/plugin/admin/public/demos/system/dict.html b/src/plugin/admin/public/demos/system/dict.html deleted file mode 100644 index e08ee15a..00000000 --- a/src/plugin/admin/public/demos/system/dict.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - 数据字典 - - - -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              - -
                                              - -
                                              - - -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              - - - - - - - - - - - - - - - - -
                                              -
                                              -
                                              -
                                              -
                                              - - - - - - - - - - - - - - - - - diff --git a/src/plugin/admin/public/demos/system/log.html b/src/plugin/admin/public/demos/system/log.html deleted file mode 100644 index 100b5eda..00000000 --- a/src/plugin/admin/public/demos/system/log.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - 行为日志 - - - -
                                              -
                                              -
                                              -
                                                -
                                              • 登录日志
                                              • -
                                              • 操作日志
                                              • -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              - - - - - - - - - - \ No newline at end of file diff --git a/src/plugin/admin/public/demos/system/operate.html b/src/plugin/admin/public/demos/system/operate.html deleted file mode 100644 index fec1c876..00000000 --- a/src/plugin/admin/public/demos/system/operate.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - 表单页面 - - - -
                                              -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - - -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              - - -
                                              -
                                              -
                                              - - - - - diff --git a/src/plugin/admin/public/demos/system/operate/add.html b/src/plugin/admin/public/demos/system/operate/add.html deleted file mode 100644 index 82ecdf33..00000000 --- a/src/plugin/admin/public/demos/system/operate/add.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - 新增页面 - - - -
                                              -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - - -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              - - -
                                              -
                                              -
                                              - - - - - - diff --git a/src/plugin/admin/public/demos/system/operate/edit.html b/src/plugin/admin/public/demos/system/operate/edit.html deleted file mode 100644 index 82dbce82..00000000 --- a/src/plugin/admin/public/demos/system/operate/edit.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - 修改页面 - - - -
                                              -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - - -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              - - -
                                              -
                                              -
                                              - - - - - - diff --git a/src/plugin/admin/public/demos/system/operate/profile.html b/src/plugin/admin/public/demos/system/operate/profile.html deleted file mode 100644 index 60410055..00000000 --- a/src/plugin/admin/public/demos/system/operate/profile.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - 头像上传 - - - -
                                              -
                                              -
                                              - -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              - - - - - -
                                              -
                                              建议:图片的尺寸宽高比为1:1,大小在5m以内。
                                              -
                                              -
                                              - - - - - - \ No newline at end of file diff --git a/src/plugin/admin/public/demos/system/person.html b/src/plugin/admin/public/demos/system/person.html deleted file mode 100644 index a40abc4f..00000000 --- a/src/plugin/admin/public/demos/system/person.html +++ /dev/null @@ -1,183 +0,0 @@ - - - - - 个人资料 - - - - -
                                              -
                                              -
                                              -
                                              -
                                              - -

                                              就眠仪式

                                              -

                                              China , 中国

                                              -
                                              -
                                              -
                                              - 今日事 ,今日毕 -
                                              -
                                              - -
                                              -
                                              - 归档 -
                                              -
                                              -
                                                -
                                              • 优化代码格式2020-06-04 11:28
                                              • -
                                              • 新增消息组件2020-06-01 04:23
                                              • -
                                              • 移动端兼容2020-05-22 21:38
                                              • -
                                              • 系统布局优化2020-05-15 14:26
                                              • -
                                              • 兼容多系统菜单模式2020-05-13 16:32
                                              • -
                                              • 兼容多标签页切换2019-12-9 14:58
                                              • -
                                              • 扩展下拉组件2019-12-7 9:06
                                              • -
                                              • 扩展卡片样式2019-12-1 10:26
                                              • -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              - 我的文章 -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              - -
                                              -
                                              -
                                              为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?
                                              -
                                              - “Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~ -
                                              -
                                              2020-06-12        评论 5 点赞 12 转发 4
                                              -
                                              -
                                              -
                                              -
                                              - -
                                              -
                                              -
                                              为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?
                                              -
                                              - “Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~ -
                                              -
                                              2020-06-12        评论 5 点赞 12 转发 4
                                              -
                                              -
                                              -
                                              -
                                              - -
                                              -
                                              -
                                              为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?
                                              -
                                              - “Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~ -
                                              -
                                              2020-06-12        评论 5 点赞 12 转发 4
                                              -
                                              -
                                              -
                                              -
                                              - -
                                              -
                                              -
                                              为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?
                                              -
                                              - “Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~ -
                                              -
                                              2020-06-12        评论 5 点赞 12 转发 4
                                              -
                                              -
                                              -
                                              -
                                              - -
                                              -
                                              -
                                              为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?
                                              -
                                              - “Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~ -
                                              -
                                              2020-06-12        评论 5 点赞 12 转发 4
                                              -
                                              -
                                              -
                                              -
                                              - -
                                              -
                                              -
                                              为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?
                                              -
                                              - “Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~ -
                                              -
                                              2020-06-12        评论 5 点赞 12 转发 4
                                              -
                                              -
                                              -
                                              -
                                              - -
                                              -
                                              -
                                              为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?
                                              -
                                              - “Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~ -
                                              -
                                              2020-06-12        评论 5 点赞 12 转发 4
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              - - - - - diff --git a/src/plugin/admin/public/demos/system/power.html b/src/plugin/admin/public/demos/system/power.html deleted file mode 100644 index 5535c0c4..00000000 --- a/src/plugin/admin/public/demos/system/power.html +++ /dev/null @@ -1,241 +0,0 @@ - - - - - 权限管理 - - - -
                                              -
                                              -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - - -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/plugin/admin/public/demos/system/profile.html b/src/plugin/admin/public/demos/system/profile.html deleted file mode 100644 index 60410055..00000000 --- a/src/plugin/admin/public/demos/system/profile.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - 头像上传 - - - -
                                              -
                                              -
                                              - -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              - - - - - -
                                              -
                                              建议:图片的尺寸宽高比为1:1,大小在5m以内。
                                              -
                                              -
                                              - - - - - - \ No newline at end of file diff --git a/src/plugin/admin/public/demos/system/role.html b/src/plugin/admin/public/demos/system/role.html deleted file mode 100644 index ec3d42b5..00000000 --- a/src/plugin/admin/public/demos/system/role.html +++ /dev/null @@ -1,226 +0,0 @@ - - - - - 角色管理 - - - -
                                              -
                                              -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - - -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              - - - - - - - - - - - - diff --git a/src/plugin/admin/public/demos/system/space.html b/src/plugin/admin/public/demos/system/space.html deleted file mode 100644 index 8ab19e39..00000000 --- a/src/plugin/admin/public/demos/system/space.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - 空白页面 - - - - -
                                              -
                                              -
                                              -

                                              Space Page

                                              -
                                              -
                                              - - - - diff --git a/src/plugin/admin/public/demos/system/theme.html b/src/plugin/admin/public/demos/system/theme.html deleted file mode 100644 index b5ef6726..00000000 --- a/src/plugin/admin/public/demos/system/theme.html +++ /dev/null @@ -1,300 +0,0 @@ - - - - - 主题预览 - - - -
                                              -
                                              按钮
                                              -
                                              - - -
                                              -
                                              -
                                              -
                                              输入框
                                              -
                                              -
                                              -
                                              - -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              复选框
                                              -
                                              -
                                              - - - - - - -
                                              -
                                              -
                                              -
                                              -
                                              开关
                                              -
                                              -
                                              -    -    -    -    -
                                              -
                                              -
                                              -
                                              -
                                              单选框
                                              -
                                              -
                                              - - - -
                                              -
                                              -
                                              -
                                              -
                                              下拉
                                              -
                                              - -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              - - - - - - - - - - - - - -
                                              -
                                              选项卡
                                              -
                                              -
                                              -
                                                -
                                              • 网站设置
                                              • -
                                              • 用户管理
                                              • -
                                              • 权限分配
                                              • -
                                              • 商品管理
                                              • -
                                              • 订单管理
                                              • -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              进度条
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              分页
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              辅助元素
                                              -
                                              -
                                              快乐的时候不敢尽兴,频繁警戒自己保持清醒.
                                              -
                                              路上没有灯火的时候,就点亮自己的头颅.
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                                -
                                              • - -
                                                -

                                                8月18日

                                                -

                                                - layui 2.0 的一切准备工作似乎都已到位。发布之弦,一触即发。 -

                                                -
                                                -
                                              • -
                                              • - -
                                                -

                                                8月16日

                                                -

                                                杜甫的思想核心是儒家的仁政思想,他有“致君尧舜上,再使风俗淳”的宏伟抱负。个人最爱的名篇有:

                                                -
                                                -
                                              • -
                                              • - -
                                                -

                                                8月15日

                                                -

                                                - 中国人民抗日战争胜利72周年 -

                                                -
                                                -
                                              • -
                                              -
                                              -
                                              -
                                              -
                                              日期选择
                                              -
                                              - -
                                              -
                                              - - - - - - - - diff --git a/src/plugin/admin/public/demos/system/user.html b/src/plugin/admin/public/demos/system/user.html deleted file mode 100644 index 3acd98d7..00000000 --- a/src/plugin/admin/public/demos/system/user.html +++ /dev/null @@ -1,298 +0,0 @@ - - - - - 用户管理 - - - -
                                              -
                                              -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - -
                                              - -
                                              -
                                              -
                                              - - -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              -
                                              - - - - - - - - - - - - - - - - - - diff --git a/src/plugin/admin/public/admin/js/common.js b/src/plugin/admin/public/js/common.js similarity index 99% rename from src/plugin/admin/public/admin/js/common.js rename to src/plugin/admin/public/js/common.js index 3b8fb23f..c9ddd7aa 100644 --- a/src/plugin/admin/public/admin/js/common.js +++ b/src/plugin/admin/public/js/common.js @@ -35,4 +35,3 @@ function toggleSearchFormShow() layui.$(function () { toggleSearchFormShow(); }); - diff --git a/src/plugin/admin/public/admin/js/permission.js b/src/plugin/admin/public/js/permission.js similarity index 99% rename from src/plugin/admin/public/admin/js/permission.js rename to src/plugin/admin/public/js/permission.js index aa4e4f8d..49986c26 100644 --- a/src/plugin/admin/public/admin/js/permission.js +++ b/src/plugin/admin/public/js/permission.js @@ -31,4 +31,4 @@ layui.$(function () { } } }); -}); \ No newline at end of file +}); diff --git a/src/plugin/admin/public/view/analysis/index.html b/src/plugin/admin/public/view/analysis/index.html new file mode 100644 index 00000000..0a164371 --- /dev/null +++ b/src/plugin/admin/public/view/analysis/index.html @@ -0,0 +1,394 @@ + + + + + + 分析页 + + + + + + + +
                                              +
                                              +
                                              +
                                              +
                                              今日访问
                                              +
                                              +
                                              +
                                              + 0 +
                                              +
                                              + + + + + + + +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              提交次数
                                              +
                                              +
                                              +
                                              + 0 +
                                              +
                                              + + + + + + + +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              下载数量
                                              +
                                              +
                                              +
                                              + 0 +
                                              +
                                              + + + + + + + +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              流量统计
                                              +
                                              +
                                              +
                                              + 0 +
                                              +
                                              + + + + + + +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              最初,Layui 在爱与期许中孵化。
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              最初,Layui 在爱与期许中孵化。
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              最初,Layui 在爱与期许中孵化。
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              最初,Layui 在爱与期许中孵化。
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              最初,Layui 在爱与期许中孵化。
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              最初,Layui 在爱与期许中孵化。
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              最初,Layui 在爱与期许中孵化。
                                              +
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +

                                              就眠儀式 在 讨论区 回答了 夏娜 提出得问题 +

                                              + 昨天 +
                                              +
                                              +
                                              +
                                              +
                                              +

                                              就眠儀式 在 讨论区 回答了 夏娜 提出得问题 +

                                              + 昨天 +
                                              +
                                              +
                                              +
                                              +
                                              +

                                              就眠儀式 在 讨论区 回答了 夏娜 提出得问题 +

                                              + 昨天 +
                                              +
                                              +
                                              +
                                              +
                                              +

                                              就眠儀式 在 讨论区 回答了 夏娜 提出得问题 +

                                              + 昨天 +
                                              +
                                              +
                                              +
                                              +
                                              +

                                              就眠儀式 在 讨论区 回答了 夏娜 提出得问题 +

                                              + 昨天 +
                                              +
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              Hello Word
                                              +
                                              +
                                              +
                                              +
                                              + 寄语 +
                                              +
                                              + 原想将澎湃的爱平平稳稳放置你手心,奈何我徒有一股蛮劲,只顾向你跑去,一个不稳跌的满身脏兮兮。试图爬起的我, + 心想你会不会笑我 " 献爱献的这样笨拙, 怎么不知避开爱里的埋伏 " +
                                              +
                                              +
                                              +
                                              +
                                              + + + + \ No newline at end of file diff --git a/src/plugin/admin/public/view/component/admin.html b/src/plugin/admin/public/view/component/admin.html new file mode 100644 index 00000000..b9423973 --- /dev/null +++ b/src/plugin/admin/public/view/component/admin.html @@ -0,0 +1,104 @@ + + + +
                                              +
                                              +
                                              +
                                              +
                                              + PearAdmin【兼容 tabPage 与 page 模式】 +
                                              +
                                              + + +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              + PearAdmin.tabPage +
                                              +
                                              + + + + +
                                              +
                                              +
                                              +
                                              +
                                              + + + + + \ No newline at end of file diff --git a/src/plugin/admin/public/view/component/grid.html b/src/plugin/admin/public/view/component/grid.html new file mode 100644 index 00000000..2d305a80 --- /dev/null +++ b/src/plugin/admin/public/view/component/grid.html @@ -0,0 +1,92 @@ +
                                              +
                                              +
                                              基础使用
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              栅格偏移
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              自适应性
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              + + \ No newline at end of file diff --git a/src/plugin/admin/public/view/component/nprogress.html b/src/plugin/admin/public/view/component/nprogress.html new file mode 100644 index 00000000..b7cf45cb --- /dev/null +++ b/src/plugin/admin/public/view/component/nprogress.html @@ -0,0 +1,25 @@ +
                                              +
                                              +
                                              基础使用
                                              +
                                              + + +
                                              +
                                              +
                                              + + \ No newline at end of file diff --git a/src/plugin/admin/public/view/component/toast.html b/src/plugin/admin/public/view/component/toast.html new file mode 100644 index 00000000..c959a700 --- /dev/null +++ b/src/plugin/admin/public/view/component/toast.html @@ -0,0 +1,111 @@ + + + + + + + 通知组件 + + +
                                              +
                                              +
                                              +
                                              +
                                              基础使用
                                              +
                                              + + + + + +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              位置选项
                                              +
                                              + + + + + + +
                                              +
                                              +
                                              +
                                              +
                                              + + + + \ No newline at end of file diff --git a/src/plugin/admin/public/view/console/index.html b/src/plugin/admin/public/view/console/index.html new file mode 100644 index 00000000..856e3dae --- /dev/null +++ b/src/plugin/admin/public/view/console/index.html @@ -0,0 +1,567 @@ + + + + + + 工作台 + + + + + + + +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              + 快捷菜单 +
                                              +
                                              +
                                              +
                                              +
                                              + +
                                              + 主页 +
                                              +
                                              +
                                              + +
                                              + 弹层 +
                                              +
                                              +
                                              + +
                                              + 聊天 +
                                              +
                                              +
                                              + +
                                              + 相机 +
                                              +
                                              +
                                              + +
                                              + 表单 +
                                              +
                                              +
                                              + +
                                              + 安全 +
                                              +
                                              +
                                              + +
                                              + 公告 +
                                              +
                                              +
                                              + +
                                              + 更多 +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              + 代办任务 +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              待审评论
                                              +
                                              21
                                              +
                                              +
                                              +
                                              +
                                              +
                                              待审帖子
                                              +
                                              32
                                              +
                                              +
                                              +
                                              +
                                              +
                                              待审文章
                                              +
                                              14
                                              +
                                              +
                                              +
                                              +
                                              +
                                              待审用户
                                              +
                                              63
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              留言板
                                              +
                                              +
                                                +
                                              • +

                                                要不要作为我的家人,搬来我家。

                                                + 12月25日 19:92 + 回复 +
                                              • +
                                              • +

                                                快乐的时候不敢尽兴,频繁警戒自己保持清醒。

                                                + 4月30日 22:43 + 回复 +
                                              • +
                                              • +

                                                夏天真的来了,尽管它还有些犹豫。

                                                + 4月30日 22:43 + 回复 +
                                              • +
                                              • +

                                                看似不可达到的高度,只要坚持不懈就可能到达。

                                                + 4月30日 22:43 + 回复 +
                                              • +
                                              • +

                                                当浑浊变成了一种常态,那么清白就成了一种罪过。

                                                + 4月30日 22:43 + 回复 +
                                              • +
                                              • +

                                                那是一种内在的东西,他们到达不了,也无法触及!

                                                + 5月12日 01:25 + 回复 +
                                              • + +
                                              • +

                                                希望是一个好东西,也许是最好的,好东西是不会消亡的!

                                                + 6月11日 15:33 + 回复 +
                                              • +
                                              • +

                                                一切都在不可避免的走向庸俗。

                                                + 2月09日 13:40 + 回复 +
                                              • +
                                              • +

                                                路上没有灯火的时候,就点亮自己的头颅。

                                                + 3月11日 12:30 + 回复 +
                                              • + +
                                              • +

                                                我们应该不虚度一生,应该能够说:"我已经做了我能做的事。"

                                                + 4月30日 22:43 + 回复 +
                                              • + +
                                              • +

                                                接近,是我对一切的态度,是我对一切态度的距离

                                                + 6月11日 15:33 + 回复 +
                                              • +
                                              • +

                                                没有锚的船当然也可以航行,只是紧张充满你的一生。

                                                + 2月09日 13:40 + 回复 +
                                              • +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              + + + + \ No newline at end of file diff --git a/src/plugin/admin/public/view/exception/403.html b/src/plugin/admin/public/view/exception/403.html new file mode 100644 index 00000000..8f949039 --- /dev/null +++ b/src/plugin/admin/public/view/exception/403.html @@ -0,0 +1,16 @@ + + +
                                              +
                                              +
                                              + +
                                              +
                                              +
                                              +

                                              403

                                              +
                                              +
                                              + 抱歉, 你无权访问该页面. +
                                              +
                                              +
                                              diff --git a/src/plugin/admin/public/view/exception/404.html b/src/plugin/admin/public/view/exception/404.html new file mode 100644 index 00000000..931e6f0b --- /dev/null +++ b/src/plugin/admin/public/view/exception/404.html @@ -0,0 +1,16 @@ + + +
                                              +
                                              +
                                              + +
                                              +
                                              +
                                              +

                                              404

                                              +
                                              +
                                              + 抱歉, 你访问的页面不存在. +
                                              +
                                              +
                                              \ No newline at end of file diff --git a/src/plugin/admin/public/view/exception/500.html b/src/plugin/admin/public/view/exception/500.html new file mode 100644 index 00000000..f7d0fff8 --- /dev/null +++ b/src/plugin/admin/public/view/exception/500.html @@ -0,0 +1,16 @@ + + +
                                              +
                                              +
                                              + +
                                              +
                                              +
                                              +

                                              500

                                              +
                                              +
                                              + 抱歉, 服务器出错了. +
                                              +
                                              +
                                              \ No newline at end of file diff --git a/src/plugin/admin/public/view/listing/table.html b/src/plugin/admin/public/view/listing/table.html new file mode 100644 index 00000000..46da4c78 --- /dev/null +++ b/src/plugin/admin/public/view/listing/table.html @@ -0,0 +1,359 @@ + + + + + + table 组件综合演示 - Layui + + + + + + +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              + + + + + + \ No newline at end of file diff --git a/src/plugin/admin/public/view/profile/index.html b/src/plugin/admin/public/view/profile/index.html new file mode 100644 index 00000000..3dc62859 --- /dev/null +++ b/src/plugin/admin/public/view/profile/index.html @@ -0,0 +1,207 @@ + + + +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              + +

                                              就眠仪式

                                              +

                                              China , 中国

                                              +
                                              +
                                              +
                                              + 今日事 ,今日毕 +
                                              +
                                              + +
                                              +
                                              留言板
                                              +
                                              +
                                                +
                                              • +

                                                快乐的时候不敢尽兴,频繁警戒自己保持清醒。

                                                + 4月30日 22:43 + 回复 +
                                              • +
                                              • +

                                                夏天真的来了,尽管它还有些犹豫。

                                                + 4月30日 22:43 + 回复 +
                                              • +
                                              • +

                                                要不要作为我的家人,搬来我家。

                                                + 12月25日 19:92 + 回复 +
                                              • +
                                              • +

                                                接近,是我对一切的态度,是我对一切态度的距离

                                                + 6月11日 15:33 + 回复 +
                                              • +
                                              • +

                                                没有锚的船当然也可以航行,只是紧张充满你的一生。

                                                + 2月09日 13:40 + 回复 +
                                              • +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              + 我的文章 +
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              +
                                              为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?
                                              +
                                              + “Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~ +
                                              +
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              +
                                              为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?
                                              +
                                              + “Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~ +
                                              +
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              +
                                              为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?
                                              +
                                              + “Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~ +
                                              +
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              +
                                              为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?
                                              +
                                              + “Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~ +
                                              +
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              +
                                              为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?
                                              +
                                              + “Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~ +
                                              +
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              +
                                              为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?
                                              +
                                              + “Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~ +
                                              +
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              +
                                              为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?
                                              +
                                              + “Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~ +
                                              +
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              +
                                              为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?
                                              +
                                              + “Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~ +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              + + + + + \ No newline at end of file diff --git a/src/plugin/admin/public/view/result/error.html b/src/plugin/admin/public/view/result/error.html new file mode 100644 index 00000000..e9dbcbf2 --- /dev/null +++ b/src/plugin/admin/public/view/result/error.html @@ -0,0 +1,66 @@ + + + + + + 失败 + + + + +
                                              +
                                              +
                                              +
                                              +
                                              + +
                                              +

                                              提交失败

                                              +

                                              + 请核对并修改以下信息后,再重新提交。如果仅是简单操作,使用 Message 全局提示反馈即可。 + 本文字区域可以展示简单的补充说明,如果有类似展示 + “单据”的需求,下面这个灰色区域可以呈现比较复杂的内容。 +

                                              +
                                              + +     + +
                                              +
                                              + 您提交的内容有如下错误: +
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              您的账户已被冻结 + 立即解冻 +
                                              +
                                              +
                                              +
                                              + +
                                              +
                                              您的账户还不具备申请资格 + 立即升级 +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              + + + \ No newline at end of file diff --git a/src/plugin/admin/public/view/result/success.html b/src/plugin/admin/public/view/result/success.html new file mode 100644 index 00000000..2eaef251 --- /dev/null +++ b/src/plugin/admin/public/view/result/success.html @@ -0,0 +1,47 @@ + + + + + + 成功 + + + + +
                                              +
                                              +
                                              +
                                              +
                                              + +
                                              +

                                              提交成功

                                              +

                                              + 提交结果页用于反馈一系列操作任务的处理结果, + 如果仅是简单操作,使用 Message 全局提示反馈即可。 + 本文字区域可以展示简单的补充说明,如果有类似展示 + “单据”的需求,下面这个灰色区域可以呈现比较复杂的内容。 +

                                              +
                                              + +     + +
                                              +
                                              + 已提交申请,等待部门审核。 +
                                              +
                                              +
                                              +
                                              +
                                              + + + \ No newline at end of file