UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

1 lines 4.1 kB
module.exports=function(i){var n={};function l(e){if(n[e])return n[e].exports;var t=n[e]={exports:{},id:e,loaded:!1};return i[e].call(t.exports,t,t.exports,l),t.loaded=!0,t.exports}return l.m=i,l.c=n,l.p="",l(0)}({0:function(e,t,i){e.exports=i(996)},3:function(e,t){e.exports=function(){throw Error("define cannot be used indirect")}},996:function(e,t,i){var n;i(3),i=[i(997)],void 0===(t="function"==typeof(n=function(){var m=window.kendo.jQuery,o=void 0,e=window.kendo,a=e.Class,s=m.extend,d=e.ui.editor,c=d.Dom,t=d.EditorUtils,i=t.registerTool,n=d.Command,l=d.Tool,f=d.ToolTemplate,u=d.RangeUtils,p=c.blockElements,v=d.BlockFormatFinder,b=d.BlockFormatter;function h(e,t){var i=m(e).css("direction")=="rtl",n=i?"Right":"Left",l=c.name(e)!="td"?"margin"+n:"padding"+n;if(t===o)return e.style[l]||0;else if(t>0)e.style[l]=t+"px";else{e.style[l]="";if(!e.style.cssText)e.removeAttribute("style")}}var r=a.extend({init:function(){this.finder=new v([{tags:c.blockElements}])},apply:function(e){e=c.filterBy(e,c.htmlIndentSpace,true);var t=this.finder.findSuitable(e),i=[],n,f,l,r,o;t=this.mapImmutables(t);if(t.length){for(n=0,f=t.length;n<f;n++)if(c.is(t[n],"li")){if(!m(t[n]).index())i.push(t[n].parentNode);else if(m.inArray(t[n].parentNode,i)<0)i.push(t[n])}else i.push(t[n]);while(i.length){l=i.shift();if(c.is(l,"li")){r=l.parentNode;o=m(l).prev("li");var a=o.find("ul,ol").last();var s=m(l).children("ul,ol")[0];if(s&&o[0])if(a[0]){a.append(l);a.append(m(s).children());c.remove(s)}else{o.append(s);s.insertBefore(l,s.firstChild)}else{s=o.children("ul,ol")[0];if(!s){s=c.create(l.ownerDocument,c.name(r),this.getListTypeAttr(r));o.append(s)}while(l&&l.parentNode==r){s.appendChild(l);l=i.shift()}}}else{var u=parseInt(h(l),10)+30;h(l,u);for(var d=0;d<i.length;d++)if(m.contains(l,i[d]))i.splice(d,1)}}}else{var p=new b([{tags:["p"]}],{style:{marginLeft:30}});p.apply(e)}},getListTypeAttr:function(e){var t=e.getAttribute("type");var i=e.style.listStyleType;return t?{type:t}:{style:{listStyleType:i}}},mapImmutables:function(e){if(!this.immutables)return e;else{var i=[];return m.map(e,function(e){var t=d.Immutables.immutableParent(e);if(t)if(m.inArray(t,i)===-1)i.push(t);else return null;return t||e})}},remove:function(e){e=c.filterBy(e,c.htmlIndentSpace,true);var t=this.finder.findSuitable(e),i,n,l,r,o,a,s,d;t=this.mapImmutables(t);for(n=0,l=t.length;n<l;n++){s=m(t[n]);if(s.is("li")){r=s.parent();o=r.parent();if(o.is("li,ul,ol")&&!h(r[0])){if(i&&m.contains(i,o[0]))continue;a=s.nextAll("li");if(a.length)m(r[0].cloneNode(false)).appendTo(s).append(a);if(o.is("li"))s.insertAfter(o);else s.appendTo(o);if(!r.children("li").length)r.remove();continue}else{if(i==r[0])continue;i=r[0]}}else i=t[n];d=parseInt(h(i),10)-30;h(i,d)}}}),y=n.extend({init:function(e){var t=this;e.formatter={toggle:function(e){var t=new r;t.immutables=this.editor&&this.editor.options.immutables;t.apply(u.nodes(e))}.bind(t)};n.fn.init.call(this,e)}}),g=n.extend({init:function(e){var t=this;e.formatter={toggle:function(e){var t=new r;t.immutables=this.editor&&this.editor.options.immutables;t.remove(u.nodes(e))}.bind(t)};n.fn.init.call(this,e)}}),x=l.extend({init:function(e){l.fn.init.call(this,e);this.finder=new v([{tags:p}])},initialize:function(e,t){l.fn.initialize.call(this,e,t);m.extend(this.options,{immutables:t.editor&&t.editor.options.immutables});e.addClass("k-disabled")},update:function(e,t){var i=this.finder.findSuitable(t),n,l,r,o,a,s;for(r=0,o=i.length;r<o;r++){a=i[r];if(this.options.immutables){s=d.Immutables.immutableParent(a);if(s)a=s}n=h(a);if(!n){l=m(a).parents("ul,ol").length;n=c.is(a,"li")&&(l>1||h(a.parentNode))||c.ofType(a,["ul","ol"])&&l>0}if(n){e.removeClass("k-disabled");return}}e.addClass("k-disabled").removeClass("k-hover")}});s(d,{IndentFormatter:r,IndentCommand:y,OutdentCommand:g,OutdentTool:x}),i("indent",new l({command:y,template:new f({template:t.buttonTemplate,title:"Indent"})})),i("outdent",new x({command:g,template:new f({template:t.buttonTemplate,title:"Outdent"})}))})?n.apply(t,i):n)||(e.exports=t)},997:function(e,t){e.exports=require("./formatblock")}});