agenda-libre-ruby/public/assets/tinymce/plugins/lists/plugin.js

1 line
10 KiB
JavaScript
Raw Normal View History

tinymce.PluginManager.add("lists",function(e){function t(t){return e.$.contains(e.getBody(),t)}function n(e){return e&&"BR"==e.nodeName}function r(e){return e&&/^(OL|UL|DL)$/.test(e.nodeName)&&t(e)}function i(e){return e&&/^(LI|DT|DD)$/.test(e.nodeName)}function o(e){return e.parentNode.firstChild==e}function a(e){return e.parentNode.lastChild==e}function s(t){return t&&!!e.schema.getTextBlockElements()[t.nodeName]}function l(t){return t===e.getBody()}function c(e){return e&&3===e.nodeType}function u(e,t){var n=tinymce.dom.RangeUtils.getNode(e,t);if(i(e)&&c(n)){var r=t>=e.childNodes.length?n.data.length:0;return{container:n,offset:r}}return{container:e,offset:t}}function d(e){var t=e.cloneRange(),n=u(e.startContainer,e.startOffset);t.setStart(n.container,n.offset);var r=u(e.endContainer,e.endOffset);return t.setEnd(r.container,r.offset),t}var f=this;e.on("init",function(){function c(e,t){var n=L.isEmpty(e);return!(t&&L.select("span[data-mce-type=bookmark]").length>0)&&n}function u(e){function t(t){var r,i,o;i=e[t?"startContainer":"endContainer"],o=e[t?"startOffset":"endOffset"],1==i.nodeType&&(r=L.create("span",{"data-mce-type":"bookmark"}),i.hasChildNodes()?(o=Math.min(o,i.childNodes.length-1),t?i.insertBefore(r,i.childNodes[o]):L.insertAfter(r,i.childNodes[o])):i.appendChild(r),i=r,o=0),n[t?"startContainer":"endContainer"]=i,n[t?"startOffset":"endOffset"]=o}var n={};return t(!0),e.collapsed||t(),n}function h(e){function t(t){function n(e){for(var t=e.parentNode.firstChild,n=0;t;){if(t==e)return n;1==t.nodeType&&"bookmark"==t.getAttribute("data-mce-type")||n++,t=t.nextSibling}return-1}var r,i,o;r=o=e[t?"startContainer":"endContainer"],i=e[t?"startOffset":"endOffset"],r&&(1==r.nodeType&&(i=n(r),r=r.parentNode,L.remove(o)),e[t?"startContainer":"endContainer"]=r,e[t?"startOffset":"endOffset"]=i)}t(!0),t();var n=L.createRng();n.setStart(e.startContainer,e.startOffset),e.endContainer&&n.setEnd(e.endContainer,e.endOffset),M.setRng(d(n))}function p(t,n){var r,i,o,a=L.createFragment(),s=e.schema.getBlockElements();if(e.settings.forced_root_block&&(n=n||e.settings.forced_root_block),n&&(i=L.create(n),i.tagName===e.settings.forced_root_block&&L.setAttribs(i,e.settings.forced_root_block_attrs),a.appendChild(i)),t)for(;r=t.firstChild;){var l=r.nodeName;o||"SPAN"==l&&"bookmark"==r.getAttribute("data-mce-type")||(o=!0),s[l]?(a.appendChild(r),i=null):n?(i||(i=L.create(n),a.appendChild(i)),i.appendChild(r)):a.appendChild(r)}return e.settings.forced_root_block?o||tinymce.Env.ie&&!(tinymce.Env.ie>10)||i.appendChild(L.create("br",{"data-mce-bogus":"1"})):a.appendChild(L.create("br")),a}function m(){return tinymce.grep(M.getSelectedBlocks(),function(e){return i(e)})}function g(e,t,n){function r(e){tinymce.each(a,function(n){e.parentNode.insertBefore(n,t.parentNode)}),L.remove(e)}var i,o,a,s;for(a=L.select('span[data-mce-type="bookmark"]',e),n=n||p(t),i=L.createRng(),i.setStartAfter(t),i.setEndAfter(e),o=i.extractContents(),s=o.firstChild;s;s=s.firstChild)if("LI"==s.nodeName&&L.isEmpty(s)){L.remove(s);break}L.isEmpty(o)||L.insertAfter(o,e),L.insertAfter(n,e),c(t.parentNode)&&r(t.parentNode),L.remove(t),c(e)&&L.remove(e)}function v(e){var t,n;if(t=e.nextSibling,t&&r(t)&&t.nodeName==e.nodeName&&P(e,t)){for(;n=t.firstChild;)e.appendChild(n);L.remove(t)}if(t=e.previousSibling,t&&r(t)&&t.nodeName==e.nodeName&&P(e,t)){for(;n=t.lastChild;)e.insertBefore(n,e.firstChild);L.remove(t)}}function y(e){tinymce.each(tinymce.grep(L.select("ol,ul",e)),b)}function b(e){var t,n=e.parentNode;"LI"==n.nodeName&&n.firstChild==e&&(t=n.previousSibling,t&&"LI"==t.nodeName?(t.appendChild(e),c(n)&&L.remove(n)):L.setStyle(n,"listStyleType","none")),r(n)&&(t=n.previousSibling,t&&"LI"==t.nodeName&&t.appendChild(e))}function C(e){function t(e){c(e)&&L.remove(e)}var n,i=e.parentNode,s=i.parentNode;return!!l(i)||("DD"==e.nodeName?(L.rename(e,"DT"),!0):o(e)&&a(e)?("LI"==s.nodeName?(L.insertAfter(e,s),t(s),L.remove(i)):r(s)?L.remove(i,!0):(s.insertBefore(p(e),i),L.remove(i)),!0):o(e)?("LI"==s.nodeName?(L.insertAfter(e,s),e.appendChild(i),t(s)):r(s)?s.insertBefore(e,i):(s.ins