You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
10 KiB
1 line
10 KiB
2 years ago
|
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=D.isEmpty(e);return!(t&&D.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=D.create("span",{"data-mce-type":"bookmark"}),i.hasChildNodes()?(o=Math.min(o,i.childNodes.length-1),t?i.insertBefore(r,i.childNodes[o]):D.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 p(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,D.remove(o)),e[t?"startContainer":"endContainer"]=r,e[t?"startOffset":"endOffset"]=i)}t(!0),t();var n=D.createRng();n.setStart(e.startContainer,e.startOffset),e.endContainer&&n.setEnd(e.endContainer,e.endOffset),M.setRng(d(n))}function m(t,n){var r,i,o,a=D.createFragment(),s=e.schema.getBlockElements();if(e.settings.forced_root_block&&(n=n||e.settings.forced_root_block),n&&(i=D.create(n),i.tagName===e.settings.forced_root_block&&D.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=D.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(D.create("br",{"data-mce-bogus":"1"})):a.appendChild(D.create("br")),a}function g(){return tinymce.grep(M.getSelectedBlocks(),function(e){return i(e)})}function h(e,t,n){function r(e){tinymce.each(a,function(n){e.parentNode.insertBefore(n,t.parentNode)}),D.remove(e)}var i,o,a,s;for(a=D.select('span[data-mce-type="bookmark"]',e),n=n||m(t),i=D.createRng(),i.setStartAfter(t),i.setEndAfter(e),o=i.extractContents(),s=o.firstChild;s;s=s.firstChild)if("LI"==s.nodeName&&D.isEmpty(s)){D.remove(s);break}D.isEmpty(o)||D.insertAfter(o,e),D.insertAfter(n,e),c(t.parentNode)&&r(t.parentNode),D.remove(t),c(e)&&D.remove(e)}function v(e){var t,n;if(t=e.nextSibling,t&&r(t)&&t.nodeName==e.nodeName&&L(e,t)){for(;n=t.firstChild;)e.appendChild(n);D.remove(t)}if(t=e.previousSibling,t&&r(t)&&t.nodeName==e.nodeName&&L(e,t)){for(;n=t.lastChild;)e.insertBefore(n,e.firstChild);D.remove(t)}}function b(e){tinymce.each(tinymce.grep(D.select("ol,ul",e)),y)}function y(e){var t,n=e.parentNode;"LI"==n.nodeName&&n.firstChild==e&&(t=n.previousSibling,t&&"LI"==t.nodeName?(t.appendChild(e),c(n)&&D.remove(n)):D.setStyle(n,"listStyleType","none")),r(n)&&(t=n.previousSibling,t&&"LI"==t.nodeName&&t.appendChild(e))}function x(e){function t(e){c(e)&&D.remove(e)}var n,i=e.parentNode,s=i.parentNode;return!!l(i)||("DD"==e.nodeName?(D.rename(e,"DT"),!0):o(e)&&a(e)?("LI"==s.nodeName?(D.insertAfter(e,s),t(s),D.remove(i)):r(s)?D.remove(i,!0):(s.insertBefore(m(e),i),D.remove(i)),!0):o(e)?("LI"==s.nodeName?(D.insertAfter(e,s),e.appendChild(i),t(s)):r(s)?s.insertBefore(e,i):(s.ins
|