yavsc/Yavsc/wwwroot/js/quill.min.js

5 lines
118 KiB
JavaScript

8 years ago
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Quill=t()}}(function(){var t;return function e(t,n,r){function i(s,l){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!l&&u)return u(s,!0);if(o)return o(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,n,r){(function(e){(function(){function i(t,e,n){for(var r=t.length,i=n?r:-1;n?i--:++i<r;)if(e(t[i],i,t))return i;return-1}function o(t,e,n){if(e!==e)return u(t,n);for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}function s(t){return"function"==typeof t||!1}function l(t){return"string"==typeof t?t:null==t?"":t+""}function u(t,e,n){for(var r=t.length,i=e+(n?0:-1);n?i--:++i<r;){var o=t[i];if(o!==o)return i}return-1}function a(t){return!!t&&"object"==typeof t}function c(t,e){for(var n=-1,r=t.length,i=-1,o=[];++n<r;)t[n]===e&&(t[n]=Le,o[++i]=n);return o}function h(){}function f(){}function p(t){this.__wrapped__=t,this.__actions__=null,this.__dir__=1,this.__dropCount__=0,this.__filtered__=!1,this.__iteratees__=null,this.__takeCount__=Rn,this.__views__=null}function d(t){var e=t?t.length:0;for(this.data={hash:Cn(null),set:new Nn};e--;)this.push(t[e])}function g(t,e){var n=t.data,r="string"==typeof e||Xt(e)?n.set.has(e):n.hash[e];return r?0:-1}function v(t){var e=this.data;"string"==typeof t||Xt(t)?e.set.add(t):e.hash[t]=!0}function m(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}function y(t,e){for(var n=-1,r=t.length;++n<r&&e(t[n],n,t)!==!1;);return t}function b(t,e){for(var n=-1,r=t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function _(t,e){for(var n=-1,r=t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function E(t,e,n,r){var i=-1,o=t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function T(t,e){for(var n=-1,r=t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function A(t,e){return t===he?e:t}function x(t,e,n){for(var r=-1,i=gr(e),o=i.length;++r<o;){var s=i[r],l=t[s],u=n(l,e[s],s,t,e);(u===u?u===l:l!==l)&&(l!==he||s in t)||(t[s]=u)}return t}function L(t,e){return null==e?t:N(e,gr(e),t)}function N(t,e,n){n||(n={});for(var r=-1,i=e.length;++r<i;){var o=e[r];n[o]=t[o]}return n}function q(t,e,n){var r=typeof t;return"function"==r?e===he?t:$(t,e,n):null==t?se:"object"==r?H(t):e===he?ae(t):K(t,e)}function S(t,e,n,r,i,o,s){var l;if(n&&(l=i?n(t,r,i):n(t)),l!==he)return l;if(!Xt(t))return t;var u=cr(t);if(u){if(l=Et(t),!e)return m(t,l)}else{var a=_n.call(t),c=a==ke;if(a!=De&&a!=Ne&&(!c||i))return sn[a]?At(t,a,e):i?t:{};if(l=Tt(c?{}:t),!e)return L(l,t)}o||(o=[]),s||(s=[]);for(var h=o.length;h--;)if(o[h]==t)return s[h];return o.push(t),s.push(l),(u?y:M)(t,function(r,i){l[i]=S(r,e,n,i,t,o,s)}),l}function w(t,e,n){if("function"!=typeof t)throw new TypeError(xe);return setTimeout(function(){t.apply(he,n)},e)}function C(t,e){var n=t?t.length:0,r=[];if(!n)return r;var i=-1,s=yt(),l=s==o,u=l&&e.length>=200?Xn(e):null,a=e.length;u&&(s=g,l=!1,e=u);t:for(;++i<n;){var c=t[i];if(l&&c===c){for(var h=a;h--;)if(e[h]===c)continue t;r.push(c)}else s(e,c,0)<0&&r.push(c)}return r}function k(t,e){var n=!0;return Vn(t,function(t,r,i){return n=!!e(t,r,i)}),n}function I(t,e,n,r){var i;return n(t,function(t,n,o){return e(t,n,o)?(i=r?n:t,!1):void 0}),i}function O(t,e,n){for(var r=-1,i=t.length,o=-1,s=[];++r<i;){var l=t[r];if(a(l)&&Lt(l)&&(n||cr(l)||Vt(l))){e&&(l=O(l,e,n));for(var u=-1,c=l.length;++u<c;)s[++o]=l[u]}else n||(s[++o]=l)}return s}function D(t,e){return Yn(t,e,te)}function M(t,e){return Yn(t,e,gr)}function R(t,e,n){if(null!=t){n!==he&&n in jt(t)&&(e=[n]);for(var r=0,i=e.length;null!=t&&i>r;)t=t[e[r++]];return r&&r==i?t:he}}function U(t,e,n,r,i,o){ret
}n-=s}}),e.chop()},l.prototype.transform=function(t,e){if(e=!!e,i.number(t))return this.transformPosition(t,e);for(var n=o.iterator(this.ops),r=o.iterator(t.ops),s=new l;n.hasNext()||r.hasNext();)if("insert"!==n.peekType()||!e&&"insert"===r.peekType())if("insert"===r.peekType())s.push(r.next());else{var u=Math.min(n.peekLength(),r.peekLength()),a=n.next(u),c=r.next(u);if(a["delete"])continue;c["delete"]?s.push(c):s.retain(u,o.attributes.transform(a.attributes,c.attributes,e))}else s.retain(o.length(n.next()));return s.chop()},l.prototype.transformPosition=function(t,e){e=!!e;for(var n=o.iterator(this.ops),r=0;n.hasNext()&&t>=r;){var i=n.peekLength(),s=n.peekType();n.next(),"delete"!==s?("insert"===s&&(t>r||!e)&&(t+=i),r+=i):t-=Math.min(i,t-r)}return t},e.exports=l},{"./is":4,"./op":5,"fast-diff":6}],4:[function(t,e,n){e.exports={equal:function(t,e){if(t===e)return!0;if(null==t&&null==e)return!0;if(null==t||null==e)return!1;if(!this.object(t)||!this.object(e))return!1;if(Object.keys(t).length!=Object.keys(e).length)return!1;for(var n in t)if(t[n]!==e[n])return!1;return!0},array:function(t){return Array.isArray(t)},number:function(t){return"number"==typeof t?!0:"object"==typeof t&&"[object Number]"===Object.prototype.toString.call(t)?!0:!1},object:function(t){return t?"function"==typeof t||"object"==typeof t:!1},string:function(t){return"string"==typeof t?!0:"object"==typeof t&&"[object String]"===Object.prototype.toString.call(t)?!0:!1}}},{}],5:[function(t,e,n){function r(t){this.ops=t,this.index=0,this.offset=0}var i=t("./is"),o={attributes:{clone:function(t,e){return i.object(t)?Object.keys(t).reduce(function(n,r){return void 0===t[r]||null===t[r]&&!e||(n[r]=t[r]),n},{}):{}},compose:function(t,e,n){i.object(t)||(t={}),i.object(e)||(e={});var r=this.clone(e,n);for(var o in t)void 0!==t[o]&&void 0===e[o]&&(r[o]=t[o]);return Object.keys(r).length>0?r:void 0},diff:function(t,e){i.object(t)||(t={}),i.object(e)||(e={});var n=Object.keys(t).concat(Object.keys(e)).reduce(function(n,r){return t[r]!==e[r]&&(n[r]=void 0===e[r]?null:e[r]),n},{});return Object.keys(n).length>0?n:void 0},transform:function(t,e,n){if(!i.object(t))return e;if(!i.object(e))return void 0;if(!n)return e;var r=Object.keys(e).reduce(function(n,r){return void 0===t[r]&&(n[r]=e[r]),n},{});return Object.keys(r).length>0?r:void 0}},clone:function(t){var e=this.attributes.clone(t);return i.object(e.attributes)&&(e.attributes=this.attributes.clone(e.attributes,!0)),e},iterator:function(t){return new r(t)},length:function(t){return i.number(t["delete"])?t["delete"]:i.number(t.retain)?t.retain:i.string(t.insert)?t.insert.length:1}};r.prototype.hasNext=function(){return this.peekLength()<1/0},r.prototype.next=function(t){t||(t=1/0);var e=this.ops[this.index];if(e){var n=this.offset,r=o.length(e);if(t>=r-n?(t=r-n,this.index+=1,this.offset=0):this.offset+=t,i.number(e["delete"]))return{"delete":t};var s={};return e.attributes&&(s.attributes=e.attributes),i.number(e.retain)?s.retain=t:s.insert=i.string(e.insert)?e.insert.substr(n,t):e.insert,s}return{retain:1/0}},r.prototype.peekLength=function(){return this.ops[this.index]?o.length(this.ops[this.index])-this.offset:1/0},r.prototype.peekType=function(){return this.ops[this.index]?i.number(this.ops[this.index]["delete"])?"delete":i.number(this.ops[this.index].retain)?"retain":"insert":"retain"},e.exports=o},{"./is":4}],6:[function(t,e,n){function r(t,e){if(t==e)return t?[[p,t]]:[];var n=l(t,e),r=t.substring(0,n);t=t.substring(n),e=e.substring(n),n=u(t,e);var o=t.substring(t.length-n);t=t.substring(0,t.length-n),e=e.substring(0,e.length-n);var s=i(t,e);return r&&s.unshift([p,r]),o&&s.push([p,o]),c(s),s}function i(t,e){var n;if(!t)return[[f,e]];if(!e)return[[h,t]];var i=t.length>e.length?t:e,s=t.length>e.length?e:t,l=i.indexOf(s);if(-1!=l)return n=[[f,i.substring(0,l)],[p,s],[f,i.substring(l+s.length)]],t.length>e.length&&(n[0][0]=n[2][0]=h),n;if(1==s.length)return[[h,t],[f,e]];var u=a(t,e);if(u){var c=u[0],d=u[1],g=u[2],v=u[3],m=u[4],y=r(c,g),b=r(d,v);return y.concat([[p,m]],b)}return o(t,e)}function o(t,e){for(var n=t.
i=s[0],o=s[1],i.node.scrollIntoView(!1)):u.top<0?(l=n.doc.findLineAt(this.range.start),i=l[0],o=l[1],i.node.scrollIntoView()):void 0},t.prototype.setRange=function(t,e){var n,r,i,o,s,l,u;return null!=t?(i=this._indexToPosition(t.start),l=i[0],u=i[1],t.isCollapsed()?(o=[l,u],n=o[0],r=o[1]):(s=this._indexToPosition(t.end),n=s[0],r=s[1]),this._setNativeRange(l,u,n,r)):this._setNativeRange(null),this.update(e)},t.prototype.shiftAfter=function(t,e,n){var r;return r=this.getRange(),n(),null!=r?(r.shift(t,e),this.setRange(r,"silent")):void 0},t.prototype.update=function(t){var e,n,r,i;return n=this.checkFocus(),r=this.getRange(!0),e="silent"!==t&&(!o.compare(r,this.range)||n!==this.focus),i=n?r:null,null!==i||"user"!==t||this.nullDelay?(this.nullDelay=!1,this.range=r,this.focus=n,e?this.emitter.emit(this.emitter.constructor.events.SELECTION_CHANGE,i,t):void 0):this.nullDelay=!0},t.prototype._decodePosition=function(t,e){var n;return u(t).isElement()&&(n=u(t.parentNode).childNodes().indexOf(t),e+=n,t=t.parentNode),[t,e]},t.prototype._encodePosition=function(t,e){for(var n;;){if(u(t).isTextNode()||t.tagName===u.DEFAULT_BREAK_TAG||null!=u.EMBED_TAGS[t.tagName])return[t,e];if(e<t.childNodes.length)t=t.childNodes[e],e=0;else{if(0===t.childNodes.length)return null==this.doc.normalizer.whitelist.tags[t.tagName]&&(n=document.createTextNode(""),t.appendChild(n),t=n),[t,0];if(t=t.lastChild,!u(t).isElement())return[t,u(t).length()];if(t.tagName===u.DEFAULT_BREAK_TAG||null!=u.EMBED_TAGS[t.tagName])return[t,1];e=t.childNodes.length}}},t.prototype._getNativeRange=function(){var t,e;return e=document.getSelection(),(null!=e?e.rangeCount:void 0)>0&&(t=e.getRangeAt(0),u(t.startContainer).isAncestor(this.doc.root,!0)&&(t.startContainer===t.endContainer||u(t.endContainer).isAncestor(this.doc.root,!0)))?t:null},t.prototype._indexToPosition=function(t){var e,n,r;return 0===this.doc.lines.length?[this.doc.root,0]:(r=this.doc.findLeafAt(t,!0),e=r[0],n=r[1],this._decodePosition(e.node,n))},t.prototype._positionToIndex=function(t,e){var n,r,i,o,s,l;if(u.isIE(10)&&"BR"===t.tagName&&1===e&&(e=0),l=this._encodePosition(t,e),r=l[0],e=l[1],o=this.doc.findLine(r),null==o)return 0;for(n=o.findLeaf(r),s=0;null!=o.prev;)o=o.prev,s+=o.length;if(null==n)return s;for(i=0;null!=n.prev;)n=n.prev,i+=n.length;return s+i+e},t.prototype._setNativeRange=function(t,e,n,r){var i,o;if(o=document.getSelection())if(null!=t){if(this.checkFocus()||this.doc.root.focus(),i=this._getNativeRange(),null==i||t!==i.startContainer||e!==i.startOffset||n!==i.endContainer||r!==i.endOffset)return o.removeAllRanges(),i=document.createRange(),i.setStart(t,e),i.setEnd(n,r),o.addRange(i)}else if(o.removeAllRanges(),this.doc.root.blur(),u.isIE(11)&&!u.isIE(9))return document.body.focus()},t}(),e.exports=s},{"../lib/dom":17,"../lib/range":20,"./leaf":11,"./normalizer":13,lodash:1}],15:[function(t,e,n){t("./modules/authorship"),t("./modules/image-tooltip"),t("./modules/keyboard"),t("./modules/link-tooltip"),t("./modules/multi-cursor"),t("./modules/paste-manager"),t("./modules/toolbar"),t("./modules/tooltip"),t("./modules/undo-manager"),e.exports=t("./quill")},{"./modules/authorship":21,"./modules/image-tooltip":22,"./modules/keyboard":23,"./modules/link-tooltip":24,"./modules/multi-cursor":25,"./modules/paste-manager":26,"./modules/toolbar":27,"./modules/tooltip":28,"./modules/undo-manager":29,"./quill":30}],16:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;o=t("./dom"),i=t("./picker"),r=function(t){function e(){e.__super__.constructor.apply(this,arguments),o(this.container).addClass("ql-color-picker")}return s(e,t),e.prototype.buildItem=function(t,n,r){var i;return i=e.__super__.buildItem.call(this,t,n,r),i.style.backgroundColor=n.value,i},e}(i),e.exports=r},{"./dom":17,"./picker":19}],17:[function(t,e,n){var r,i,o,s,l,u=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function n(){this.constructor=t}for(
var n,r;return n=this.quill.getBounds(t.index),null==n?this.removeCursor(t.userId):(t.elem.style.top=n.top+this.quill.container.scrollTop+"px",t.elem.style.left=n.left+"px",t.elem.style.height=n.height+"px",r=t.elem.querySelector(".cursor-flag"),l(t.elem).toggleClass("top",parseInt(t.elem.style.top)<=r.offsetHeight).toggleClass("left",parseInt(t.elem.style.left)<=r.offsetWidth).toggleClass("right",this.quill.root.offsetWidth-parseInt(t.elem.style.left)<=r.offsetWidth),this.emit(e.events.CURSOR_MOVED,t))},e}(r),o.registerModule("multi-cursor",i),e.exports=i},{"../quill":30,eventemitter2:2}],26:[function(t,e,n){var r,i,o,s,l,u,a=function(t,e){return function(){return t.apply(e,arguments)}};s=t("../quill"),i=t("../core/document"),l=s.require("lodash"),u=s.require("dom"),r=s.require("delta"),o=function(){function t(e,n){var r;this.quill=e,this._onConvert=a(this._onConvert,this),this.container=this.quill.addContainer("ql-paste-manager"),this.container.setAttribute("contenteditable",!0),this.container.setAttribute("tabindex","-1"),u(this.quill.root).on("paste",l.bind(this._paste,this)),this.options=l.defaults(n,t.DEFAULTS),null==(r=this.options).onConvert&&(r.onConvert=this._onConvert)}return t.DEFAULTS={onConvert:null},t.prototype._onConvert=function(t){var e,n,o;return n=new i(t,this.quill.options),e=n.toDelta(),o=e.length(),0===o?e:e.compose((new r).retain(o-1)["delete"](1))},t.prototype._paste=function(){var t,e;return t=this.quill.getLength(),e=this.quill.getSelection(),null!=e?(this.container.focus(),l.defer(function(t){return function(){var n,r;return n=t.options.onConvert(t.container),r=n.length(),r>0&&(e.start>0&&n.ops.unshift({retain:e.start}),n["delete"](e.end-e.start),t.quill.updateContents(n,"user")),t.quill.setSelection(e.start+r,e.start+r),t.quill.editor.selection.scrollIntoView(),t.container.innerHTML=""}}(this))):void 0},t}(),s.registerModule("paste-manager",o),e.exports=o},{"../core/document":8,"../quill":30}],27:[function(t,e,n){var r,i,o,s;r=t("../quill"),o=r.require("lodash"),s=r.require("dom"),i=function(){function t(e,n){if(this.quill=e,this.options=n,(o.isString(this.options)||o.isElement(this.options))&&(this.options={container:this.options}),null==this.options.container)throw new Error("container required for toolbar",this.options);this.container=o.isString(this.options.container)?document.querySelector(this.options.container):this.options.container,this.inputs={},this.preventUpdate=!1,this.triggering=!1,o.each(this.quill.options.formats,function(e){return function(n){return null==t.formats.TOOLTIP[n]?e.initFormat(n,o.bind(e._applyFormat,e,n)):void 0}}(this)),this.quill.on(r.events.FORMAT_INIT,function(e){return function(n){return null==t.formats.TOOLTIP[n]?e.initFormat(n,o.bind(e._applyFormat,e,n)):void 0}}(this)),this.quill.on(r.events.SELECTION_CHANGE,function(t){return function(e){return null!=e?t.updateActive(e):void 0}}(this)),this.quill.on(r.events.TEXT_CHANGE,function(t){return function(){return t.updateActive()}}(this)),this.quill.onModuleLoad("keyboard",function(t){return function(e){return e.addHotkey([s.KEYS.BACKSPACE,s.KEYS.DELETE],function(){return o.defer(o.bind(t.updateActive,t))})}}(this)),s(this.container).addClass("ql-toolbar"),s.isIOS()&&s(this.container).addClass("ios")}return t.DEFAULTS={container:null},t.formats={LINE:{align:"align",bullet:"bullet",list:"list"},SELECT:{align:"align",background:"background",color:"color",font:"font",size:"size"},TOGGLE:{bold:"bold",bullet:"bullet",image:"image",italic:"italic",link:"link",list:"list",strike:"strike",underline:"underline"},TOOLTIP:{image:"image",link:"link"}},t.prototype.initFormat=function(e,n){var r,i,o;return o=".ql-"+e,null!=t.formats.SELECT[e]?(o="select"+o,r="change"):r="click",i=this.container.querySelector(o),null!=i?(this.inputs[e]=i,s(i).on(r,function(t){return function(){var e,o;return o="change"===r?s(i).value():!s(i).hasClass("ql-active"),t.preventUpdate=!0,t.quill.focus(),e=t.quill.getSelection(),null!=e&&n(e,o),s.isIE(11)&&t.quill.editor.selection.scrollIntoView(),t.preventUpdate=!1,!1}}(this))):void 0},t.prototype