XWWitPark/witpark_jzzs/xw_jzzs_web/public/lib/summernote/summernote.min.js

2 lines
68 KiB
JavaScript
Raw Permalink Normal View History

2024-09-12 00:10:00 +00:00
/* 2020-9-22 15:23:19 | 版权所有 军懋国兴 */
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(window.jQuery)}(function(N){Array.prototype.reduce||(Array.prototype.reduce=function(e){var t,n=Object(this),o=n.length>>>0,i=0;if(2===arguments.length)t=arguments[1];else{for(;i<o&&!(i in n);)i++;if(o<=i)throw new TypeError("Reduce of empty array with no initial value");t=n[i++]}for(;i<o;i++)i in n&&(t=e(t,n[i],i,n));return t}),"function"!=typeof Array.prototype.filter&&(Array.prototype.filter=function(e){for(var t,n=Object(this),o=n.length>>>0,i=[],r=2<=arguments.length?arguments[1]:void 0,a=0;a<o;a++){a in n&&(t=n[a],e.call(r,t,a,n)&&i.push(t))}return i});function f(t){function e(e){null!==e.contents&&t.html(e.contents),null!==e.bookmark&&M.createFromBookmark(i,e.bookmark).select()}var n=[],o=-1,i=t[0];this.undo=function(){0<o&&e(n[--o])},this.redo=function(){n.length-1>o&&e(n[++o])},this.recordUndo=function(){var e;o++,n.length>o&&(n=n.slice(0,o)),n.push((e=M.create(),{contents:t.html(),bookmark:e?e.bookmark(i):{s:{path:[],offset:0},e:{path:[],offset:0}}}))},this.recordUndo()}function l(){this.stylePara=function(e,n){N.each(e.nodes(E.isPara,{includeAncestor:!0}),function(e,t){N(t).css(n)})},this.styleNodes=function(e,t){e=e.splitText();var n=t&&t.nodeName||"SPAN",o=!(!t||!t.expandClosestSibling),i=!(!t||!t.onlyPartialContains);if(e.isCollapsed())return e.insertNode(E.create(n));var r,a=E.makePredByNodeName(n),s=N.map(e.nodes(E.isText,{fullyContains:!0}),function(e){return E.singleChildAncestor(e,a)||E.wrap(e,n)});return o?(i&&(r=e.nodes(),a=P.and(a,function(e){return I.contains(r,e)})),N.map(s,function(e){var t=E.withClosestSiblings(e,a),n=I.head(t),o=I.tail(t);return N.each(o,function(e,t){E.appendChildNodes(n,t.childNodes),E.remove(t)}),I.head(t)})):s},this.current=function(e,t){var n,o=function(n,e){if(F.jqueryVersion<1.9){var o={};return N.each(e,function(e,t){o[t]=n.css(t)}),o}return n.css.call(n,e)}(N(E.isText(e.sc)?e.sc.parentNode:e.sc),["font-family","font-size","text-align","list-style-type","line-height"])||{};o["font-size"]=parseInt(o["font-size"],10),o["font-bold"]=document.queryCommandState("bold")?"bold":"normal",o["font-italic"]=document.queryCommandState("italic")?"italic":"normal",o["font-underline"]=document.queryCommandState("underline")?"underline":"normal",o["font-strikethrough"]=document.queryCommandState("strikeThrough")?"strikethrough":"normal",o["font-superscript"]=document.queryCommandState("superscript")?"superscript":"normal",o["font-subscript"]=document.queryCommandState("subscript")?"subscript":"normal",e.isOnList()?(n=-1<N.inArray(o["list-style-type"],["circle","disc","disc-leading-zero","square"]),o["list-style"]=n?"unordered":"ordered"):o["list-style"]="none";var i,r=E.ancestor(e.sc,E.isPara);return r&&r.style["line-height"]?o["line-height"]=r.style.lineHeight:(i=parseInt(o["line-height"],10)/parseInt(o["font-size"],10),o["line-height"]=i.toFixed(1)),o.image=E.isImg(t)&&t,o.anchor=e.isOnAnchor()&&E.ancestor(e.sc,E.isAnchor),o.ancestors=E.listAncestor(e.sc,E.isEditable),o.range=e,o}}function d(){this.insertTab=function(e,t,n){var o=E.createText(new Array(n+1).join(E.NBSP_CHAR));(t=t.deleteContents()).insertNode(o,!0),(t=M.create(o,n)).select()},this.insertParagraph=function(){var e=M.create();e=(e=e.deleteContents()).wrapBodyInlineWithPara();var t,n,o,i=E.ancestor(e.sc,E.isPara);i?(o=E.splitTree(i,e.getStartPoint()),t=(t=E.listDescendant(i,E.isEmptyAnchor)).concat(E.listDescendant(o,E.isEmptyAnchor)),N.each(t,function(e,t){E.remove(t)})):(n=e.sc.childNodes[e.so],o=N(E.emptyPara)[0],n?e.sc.insertBefore(o,n):e.sc.appendChild(o)),M.create(o,0).normalize().select()}}function c(){this.tab=function(e,t){var n=E.ancestor(e.commonAncestor(),E.isCell),o=E.ancestor(n,E.isTable),i=E.listDescendant(o,E.isCell),r=I[t?"prev":"next"](i,n);r&&M.create(r,0).select()},this.createTable=function(e,t){for(var n,o=[],i=0;i<e;i++)o.push("<td>"+E.blank+"</td>");n=o.join("");for(var r,a=[],s=0;s<t;s++)a.push("<tr>"+n+"</tr>");return r=a.join(""),N('<table class="table table-bordered">'+r+"</table>")[0]}}function p(){this.insertOrderedLi