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