0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-27 01:44:10 -05:00
forgejo/public/vendor/plugins/tribute/tribute.min.js

2 lines
26 KiB
JavaScript
Raw Normal View History

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Tribute=e()}}(function(){return function e(t,n,i){function r(u,l){if(!n[u]){if(!t[u]){var a="function"==typeof require&&require;if(!l&&a)return a(u,!0);if(o)return o(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var s=n[u]={exports:{}};t[u][0].call(s.exports,function(e){var n=t[u][1][e];return r(n?n:e)},s,s.exports,e,t,n,i)}return n[u].exports}for(var o="function"==typeof require&&require,u=0;u<i.length;u++)r(i[u]);return r}({1:[function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),u=e("./utils"),l=(i(u),e("./TributeEvents")),a=i(l),c=e("./TributeMenuEvents"),s=i(c),d=e("./TributeRange"),f=i(d),h=e("./TributeSearch"),v=i(h),p=function(){function e(t){var n=this,i=t.values,o=void 0===i?null:i,u=t.iframe,l=void 0===u?null:u,c=t.selectClass,d=void 0===c?"highlight":c,h=t.trigger,p=void 0===h?"@":h,g=t.selectTemplate,m=void 0===g?null:g,b=t.menuItemTemplate,y=void 0===b?null:b,w=t.lookup,T=void 0===w?"key":w,E=t.fillAttr,S=void 0===E?"value":E,k=t.collection,x=void 0===k?null:k,C=t.menuContainer,A=void 0===C?null:C,N=t.noMatchTemplate,M=void 0===N?null:N,I=t.requireLeadingSpace,P=void 0===I||I,L=t.allowSpaces,D=void 0!==L&&L,O=t.replaceTextSuffix,R=void 0===O?null:O;if(r(this,e),this.menuSelected=0,this.current={},this.inputEvent=!1,this.isActive=!1,this.menuContainer=A,this.allowSpaces=D,this.replaceTextSuffix=R,o)this.collection=[{trigger:p,iframe:l,selectClass:d,selectTemplate:(m||e.defaultSelectTemplate).bind(this),menuItemTemplate:(y||e.defaultMenuItemTemplate).bind(this),noMatchTemplate:function(e){return"function"==typeof e?e.bind(n):function(){return'<li class="no-match">No match!</li>'}.bind(n)}(M),lookup:T,fillAttr:S,values:o,requireLeadingSpace:P}];else{if(!x)throw new Error("[Tribute] No collection specified.");this.collection=x.map(function(t){return{trigger:t.trigger||p,iframe:t.iframe||l,selectClass:t.selectClass||d,selectTemplate:(t.selectTemplate||e.defaultSelectTemplate).bind(n),menuItemTemplate:(t.menuItemTemplate||e.defaultMenuItemTemplate).bind(n),noMatchTemplate:function(e){return"function"==typeof e?e.bind(n):null}(M),lookup:t.lookup||T,fillAttr:t.fillAttr||S,values:t.values,requireLeadingSpace:t.requireLeadingSpace}})}new f.default(this),new a.default(this),new s.default(this),new v.default(this)}return o(e,[{key:"triggers",value:function(){return this.collection.map(function(e){return e.trigger})}},{key:"attach",value:function(e){if(!e)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if("undefined"!=typeof jQuery&&e instanceof jQuery&&(e=e.get()),e.constructor===NodeList||e.constructor===HTMLCollection||e.constructor===Array)for(var t=e.length,n=0;n<t;++n)this._attach(e[n]);else this._attach(e)}},{key:"_attach",value:function(e){e.hasAttribute("data-tribute")&&console.warn("Tribute was already bound to "+e.nodeName),this.ensureEditable(e),this.events.bind(e),e.setAttribute("data-tribute",!0)}},{key:"ensureEditable",value:function(t){if(e.inputTypes().indexOf(t.nodeName)===-1){if(!t.contentEditable)throw new Error("[Tribute] Cannot bind to "+t.nodeName);t.contentEditable=!0}}},{key:"createMenu",value:function(){var e=this.range.getDocument().createElement("div"),t=this.range.getDocument().createElement("ul");return e.className="tribute-container",e.appendChild(t),this.menuContainer?this.menuContainer.appendChild(e):this.range.getDocument().body.appendChild(e)}},{key:"showMen
//# sourceMappingURL=tribute.min.js.map