UNPKG

@progress/kendo-ui

Version:

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

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