thredded 0.13.1 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/javascripts/thredded/components/post_form.es6 +1 -1
- data/app/assets/javascripts/thredded/components/topic_form.es6 +1 -1
- data/app/assets/javascripts/thredded/components/users_select.es6 +1 -1
- data/app/assets/javascripts/thredded/dependencies.js +1 -1
- data/app/assets/javascripts/thredded/dependencies/autosize.js +1 -0
- data/config/locales/ru.yml +1 -1
- data/lib/thredded/html_pipeline/onebox_filter.rb +2 -1
- data/lib/thredded/version.rb +1 -1
- data/vendor/assets/javascripts/autosize.min.js +6 -0
- data/vendor/assets/javascripts/textcomplete.min.js +2 -1
- metadata +4 -3
- data/vendor/assets/javascripts/autosize.js +0 -290
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7416385c145b5e7eeba5d467af646575c446bb36
|
|
4
|
+
data.tar.gz: d38d5a6a62ac0a7c6c55bd447d3017212bd56497
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f01171d77c219e0b99d9fbbfcbe3952d4608538dba57e0ae24fed859592be1393f80d22bda591dc4ab08c9b59e588589599029d11318a407dc3fe65130e8f9bd
|
|
7
|
+
data.tar.gz: 1553e44d9c615400ff486999cca6dfade9532531f66b268995bb1537d0c5d4faf54a1ba432852a8ee1b2ec52ff11fff933d202317987b18f5c4e58d15a6b5fe1
|
data/README.md
CHANGED
|
@@ -98,7 +98,7 @@ Then, see the rest of this Readme for more information about using and customizi
|
|
|
98
98
|
Add the gem to your Gemfile:
|
|
99
99
|
|
|
100
100
|
```ruby
|
|
101
|
-
gem 'thredded', '~> 0.13.
|
|
101
|
+
gem 'thredded', '~> 0.13.2'
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
Add the Thredded [initializer] to your parent app by running the install generator.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//= require thredded/dependencies/timeago
|
|
2
2
|
//= require thredded/dependencies/ujs
|
|
3
|
-
//= require autosize
|
|
3
|
+
//= require thredded/dependencies/autosize
|
|
4
4
|
//= require thredded/dependencies/textcomplete
|
|
5
5
|
|
|
6
6
|
// We are not currently using any features that require the Babel polyfill
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//= require autosize.min
|
data/config/locales/ru.yml
CHANGED
|
@@ -114,7 +114,7 @@ ru:
|
|
|
114
114
|
updated_notice: Ваши настройки были обновлены.
|
|
115
115
|
private_posts:
|
|
116
116
|
form:
|
|
117
|
-
content_label:
|
|
117
|
+
content_label: Сообщение
|
|
118
118
|
create_btn: Послать сообщение
|
|
119
119
|
create_btn_submitting: Посылаю...
|
|
120
120
|
update_btn_submitting: :thredded.form.update_btn_submitting
|
|
@@ -13,7 +13,8 @@ module Thredded
|
|
|
13
13
|
add_attributes: {
|
|
14
14
|
'iframe' => {
|
|
15
15
|
'seamless' => 'seamless',
|
|
16
|
-
'sandbox' => 'allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox'
|
|
16
|
+
'sandbox' => 'allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox' \
|
|
17
|
+
' allow-presentation',
|
|
17
18
|
}
|
|
18
19
|
},
|
|
19
20
|
transformers: (Sanitize::Config::ONEBOX[:transformers] || []) + [
|
data/lib/thredded/version.rb
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
Autosize 4.0.0
|
|
3
|
+
license: MIT
|
|
4
|
+
http://www.jacklmoore.com/autosize
|
|
5
|
+
*/
|
|
6
|
+
!function(e,t){if("function"==typeof define&&define.amd)define(["exports","module"],t);else if("undefined"!=typeof exports&&"undefined"!=typeof module)t(exports,module);else{var n={exports:{}};t(n.exports,n),e.autosize=n.exports}}(this,function(e,t){"use strict";function n(e){function t(){var t=window.getComputedStyle(e,null);"vertical"===t.resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),s="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),isNaN(s)&&(s=0),l()}function n(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function o(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}function r(){var t=e.style.height,n=o(e),r=document.documentElement&&document.documentElement.scrollTop;e.style.height="";var i=e.scrollHeight+s;return 0===e.scrollHeight?void(e.style.height=t):(e.style.height=i+"px",u=e.clientWidth,n.forEach(function(e){e.node.scrollTop=e.scrollTop}),void(r&&(document.documentElement.scrollTop=r)))}function l(){r();var t=Math.round(parseFloat(e.style.height)),o=window.getComputedStyle(e,null),i="content-box"===o.boxSizing?Math.round(parseFloat(o.height)):e.offsetHeight;if(i!==t?"hidden"===o.overflowY&&(n("scroll"),r(),i="content-box"===o.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight):"hidden"!==o.overflowY&&(n("hidden"),r(),i="content-box"===o.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight),a!==i){a=i;var l=d("autosize:resized");try{e.dispatchEvent(l)}catch(e){}}}if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!i.has(e)){var s=null,u=e.clientWidth,a=null,c=function(){e.clientWidth!==u&&l()},p=function(t){window.removeEventListener("resize",c,!1),e.removeEventListener("input",l,!1),e.removeEventListener("keyup",l,!1),e.removeEventListener("autosize:destroy",p,!1),e.removeEventListener("autosize:update",l,!1),Object.keys(t).forEach(function(n){e.style[n]=t[n]}),i.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",p,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",l,!1),window.addEventListener("resize",c,!1),e.addEventListener("input",l,!1),e.addEventListener("autosize:update",l,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",i.set(e,{destroy:p,update:l}),t()}}function o(e){var t=i.get(e);t&&t.destroy()}function r(e){var t=i.get(e);t&&t.update()}var i="function"==typeof Map?new Map:function(){var e=[],t=[];return{has:function(t){return e.indexOf(t)>-1},get:function(n){return t[e.indexOf(n)]},set:function(n,o){e.indexOf(n)===-1&&(e.push(n),t.push(o))},delete:function(n){var o=e.indexOf(n);o>-1&&(e.splice(o,1),t.splice(o,1))}}}(),d=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){d=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}var l=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?(l=function(e){return e},l.destroy=function(e){return e},l.update=function(e){return e}):(l=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return n(e,t)}),e},l.destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],o),e},l.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],r),e}),t.exports=l});
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=11)}([function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,r,i){n(this,e),this.data=t,this.term=r,this.strategy=i}return r(e,[{key:"replace",value:function(e,t){var n=this.strategy.replace(this.data);if(null!==n){Array.isArray(n)&&(t=n[1]+t,n=n[0]);var r=this.strategy.matchText(e);return n=n.replace(/\$&/g,r[0]).replace(/\$(\d+)/g,function(e,t){return r[parseInt(t,10)]}),[[e.slice(0,r.index),n,e.slice(r.index+r[0].length)].join(""),t]}}},{key:"render",value:function(){return this.strategy.template(this.data,this.term)}}]),e}();t.default=i},function(e){"use strict";function t(){}function n(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function r(){this._events=new t,this._eventsCount=0}var i=Object.prototype.hasOwnProperty,o="~";Object.create&&(t.prototype=Object.create(null),(new t).__proto__||(o=!1)),r.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)i.call(e,t)&&n.push(o?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},r.prototype.listeners=function(e,t){var n=o?o+e:e,r=this._events[n];if(t)return!!r;if(!r)return[];if(r.fn)return[r.fn];for(var i=0,s=r.length,u=new Array(s);i<s;i++)u[i]=r[i].fn;return u},r.prototype.emit=function(e,t,n,r,i,s){var u=o?o+e:e;if(!this._events[u])return!1;var a,l,c=this._events[u],h=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),h){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,r),!0;case 5:return c.fn.call(c.context,t,n,r,i),!0;case 6:return c.fn.call(c.context,t,n,r,i,s),!0}for(l=1,a=new Array(h-1);l<h;l++)a[l-1]=arguments[l];c.fn.apply(c.context,a)}else{var f,d=c.length;for(l=0;l<d;l++)switch(c[l].once&&this.removeListener(e,c[l].fn,void 0,!0),h){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,t);break;case 3:c[l].fn.call(c[l].context,t,n);break;case 4:c[l].fn.call(c[l].context,t,n,r);break;default:if(!a)for(f=1,a=new Array(h-1);f<h;f++)a[f-1]=arguments[f];c[l].fn.apply(c[l].context,a)}}return!0},r.prototype.on=function(e,t,r){var i=new n(t,r||this),s=o?o+e:e;return this._events[s]?this._events[s].fn?this._events[s]=[this._events[s],i]:this._events[s].push(i):(this._events[s]=i,this._eventsCount++),this},r.prototype.once=function(e,t,r){var i=new n(t,r||this,!0),s=o?o+e:e;return this._events[s]?this._events[s].fn?this._events[s]=[this._events[s],i]:this._events[s].push(i):(this._events[s]=i,this._eventsCount++),this},r.prototype.removeListener=function(e,n,r,i){var s=o?o+e:e;if(!this._events[s])return this;if(!n)return 0==--this._eventsCount?this._events=new t:delete this._events[s],this;var u=this._events[s];if(u.fn)u.fn!==n||i&&!u.once||r&&u.context!==r||(0==--this._eventsCount?this._events=new t:delete this._events[s]);else{for(var a=0,l=[],c=u.length;a<c;a++)(u[a].fn!==n||i&&!u[a].once||r&&u[a].context!==r)&&l.push(u[a]);l.length?this._events[s]=1===l.length?l[0]:l:0==--this._eventsCount?this._events=new t:delete this._events[s]}return this},r.prototype.removeAllListeners=function(e){var n;return e?(n=o?o+e:e,this._events[n]&&(0==--this._eventsCount?this._events=new t:delete this._events[n])):(this._events=new t,this._eventsCount=0),this},r.prototype.off=r.prototype.removeListener,r.prototype.addListener=r.prototype.on,r.prototype.setMaxListeners=function(){return this},r.prefixed=o,r.EventEmitter=r,e.exports=r},function(e,t){"use strict";function n(e){var t=e.getBoundingClientRect(),n=e.ownerDocument,r=n.defaultView,i=n.documentElement,o={top:t.top+r.pageYOffset,left:t.left+r.pageXOffset};return i&&(o.top-=i.clientTop,o.left-=i.clientLeft),o}function r(e){return e>=o&&e<=s}function i(e){var t=window.getComputedStyle(e);if(r(t.lineHeight.charCodeAt(0)))return r(t.lineHeight.charCodeAt(t.lineHeight.length-1))?parseFloat(t.lineHeight,10)*parseFloat(t.fontSize,10):parseFloat(t.lineHeight,10);var n=document.body;if(!n)return 0;var i=document.createElement(e.nodeName);i.innerHTML=" ",i.style.fontSize=t.fontSize,i.style.fontFamily=t.fontFamily,n.appendChild(i);var o=i.offsetHeight;return n.removeChild(i),o}Object.defineProperty(t,"__esModule",{value:!0}),t.calculateElementOffset=n,t.getLineHeightPx=i;var o=(t.createCustomEvent=function(){return"function"==typeof window.CustomEvent?function(e,t){return new document.defaultView.CustomEvent(e,{cancelable:t&&t.cancelable||!1,detail:t&&t.detail||void 0})}:function(e,t){var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,!1,t&&t.cancelable||!1,t&&t.detail||void 0),n}}(),"0".charCodeAt(0)),s="9".charCodeAt(0)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(2),l=n(0),c=(r(l),n(1)),h=r(c),f=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,e),u(t,[{key:"destroy",value:function(){return this}},{key:"applySearchResult",value:function(){throw new Error("Not implemented.")}},{key:"getCursorOffset",value:function(){throw new Error("Not implemented.")}},{key:"getBeforeCursor",value:function(){throw new Error("Not implemented.")}},{key:"getAfterCursor",value:function(){throw new Error("Not implemented.")}},{key:"emitMoveEvent",value:function(e){var t=(0,a.createCustomEvent)("move",{cancelable:!0,detail:{code:e}});return this.emit("move",t),t}},{key:"emitEnterEvent",value:function(){var e=(0,a.createCustomEvent)("enter",{cancelable:!0});return this.emit("enter",e),e}},{key:"emitChangeEvent",value:function(){var e=(0,a.createCustomEvent)("change",{detail:{beforeCursor:this.getBeforeCursor()}});return this.emit("change",e),e}},{key:"emitEscEvent",value:function(){var e=(0,a.createCustomEvent)("esc",{cancelable:!0});return this.emit("esc",e),e}},{key:"getCode",value:function(e){return 8===e.keyCode?"BS":9===e.keyCode?"ENTER":13===e.keyCode?"ENTER":27===e.keyCode?"ESC":38===e.keyCode?"UP":40===e.keyCode?"DOWN":78===e.keyCode&&e.ctrlKey?"DOWN":80===e.keyCode&&e.ctrlKey?"UP":"OTHER"}}]),t}(h.default);t.default=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return e}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(12),u=function(e){return e&&e.__esModule?e:{default:e}}(s),a=function(){function e(t){r(this,e),this.props=t,this.cache=t.cache?{}:null}return o(e,[{key:"destroy",value:function(){return this.cache=null,this}},{key:"buildQuery",value:function(e){if("function"==typeof this.props.context){var t=this.props.context(e);if("string"==typeof t)e=t;else if(!t)return null}var n=this.matchText(e);return n?new u.default(this,n[this.index],n):null}},{key:"search",value:function(e,t,n){this.cache?this.searchWithCache(e,t,n):this.props.search(e,t,n)}},{key:"replace",value:function(e){return this.props.replace(e)}},{key:"searchWithCache",value:function(e,t,n){var r=this;this.cache&&this.cache[e]?t(this.cache[e]):this.props.search(e,function(n){r.cache&&(r.cache[e]=n),t(n)},n)}},{key:"matchText",value:function(e){return"function"==typeof this.match?this.match(e):e.match(this.match)}},{key:"match",get:function(){return this.props.match}},{key:"index",get:function(){return"number"==typeof this.props.index?this.props.index:2}},{key:"template",get:function(){return this.props.template||i}}]),e}();t.default=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var s=i.get;if(void 0!==s)return s.call(r)},l=n(3),c=r(l),h=n(2),f=n(0),d=(r(f),n(13)),p=["onInput","onKeydown"],v=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.el=e,p.forEach(function(e){n[e]=n[e].bind(n)}),n.startListening(),n}return s(t,e),u(t,[{key:"destroy",value:function(){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this),this.stopListening(),this.el=null,this}},{key:"applySearchResult",value:function(e){var t=e.replace(this.getBeforeCursor(),this.getAfterCursor());Array.isArray(t)&&(this.el.value=t[0]+t[1],this.el.selectionStart=this.el.selectionEnd=t[0].length,this.el.dispatchEvent(new Event("input"))),this.el.focus()}},{key:"getCursorOffset",value:function(){var e=(0,h.calculateElementOffset)(this.el),t=this.getElScroll(),n=this.getCursorPosition(),r=(0,h.getLineHeightPx)(this.el),i=e.top-t.top+n.top+r,o=e.left-t.left+n.left;if("rtl"!==this.el.dir)return{top:i,left:o,lineHeight:r};if(document.documentElement){return{top:i,right:document.documentElement.clientWidth-o,lineHeight:r}}}},{key:"getBeforeCursor",value:function(){return this.el.value.substring(0,this.el.selectionEnd)}},{key:"getAfterCursor",value:function(){return this.el.value.substring(this.el.selectionEnd)}},{key:"getElScroll",value:function(){return{top:this.el.scrollTop,left:this.el.scrollLeft}}},{key:"getCursorPosition",value:function(){return d(this.el,this.el.selectionEnd)}},{key:"onInput",value:function(){this.emitChangeEvent()}},{key:"onKeydown",value:function(e){var t=this.getCode(e),n=void 0;"UP"===t||"DOWN"===t?n=this.emitMoveEvent(t):"ENTER"===t?n=this.emitEnterEvent():"ESC"===t&&(n=this.emitEscEvent()),n&&n.defaultPrevented&&e.preventDefault()}},{key:"startListening",value:function(){this.el.addEventListener("input",this.onInput),this.el.addEventListener("keydown",this.onKeydown)}},{key:"stopListening",value:function(){this.el.removeEventListener("input",this.onInput),this.el.removeEventListener("keydown",this.onKeydown)}}]),t}(c.default);t.default=v},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(8),l=r(a),c=n(3),h=(r(c),n(9)),f=r(h),d=n(4),p=r(d),v=n(0),y=(r(v),n(1)),m=r(y),g=["handleChange","handleEnter","handleEsc","handleHit","handleMove","handleSelect"],b=function(e){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r.completer=new l.default,r.isQueryInFlight=!1,r.nextPendingQuery=null,r.dropdown=new f.default(n.dropdown||{}),r.editor=e,r.options=n,g.forEach(function(e){r[e]=r[e].bind(r)}),r.startListening(),r}return s(t,e),u(t,[{key:"destroy",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.completer.destroy(),this.dropdown.destroy(),e&&this.editor.destroy(),this.stopListening(),this}},{key:"register",value:function(e){var t=this;return e.forEach(function(e){t.completer.registerStrategy(new p.default(e))}),this}},{key:"trigger",value:function(e){return this.isQueryInFlight?this.nextPendingQuery=e:(this.isQueryInFlight=!0,this.nextPendingQuery=null,this.completer.run(e)),this}},{key:"handleHit",value:function(e){var t=e.searchResults;t.length?this.dropdown.render(t,this.editor.getCursorOffset()):this.dropdown.deactivate(),this.isQueryInFlight=!1,null!==this.nextPendingQuery&&this.trigger(this.nextPendingQuery)}},{key:"handleMove",value:function(e){"UP"===e.detail.code?this.dropdown.up(e):this.dropdown.down(e)}},{key:"handleEnter",value:function(e){var t=this.dropdown.getActiveItem();t&&(this.dropdown.select(t),e.preventDefault())}},{key:"handleEsc",value:function(e){this.dropdown.shown&&(this.dropdown.deactivate(),e.preventDefault())}},{key:"handleChange",value:function(e){this.trigger(e.detail.beforeCursor)}},{key:"handleSelect",value:function(e){this.emit("select",e),e.defaultPrevented||this.editor.applySearchResult(e.detail.searchResult)}},{key:"startListening",value:function(){var e=this;this.editor.on("move",this.handleMove).on("enter",this.handleEnter).on("esc",this.handleEsc).on("change",this.handleChange),this.dropdown.on("select",this.handleSelect),["show","shown","render","rendered","selected","hidden","hide"].forEach(function(t){e.dropdown.on(t,function(){return e.emit(t)})}),this.completer.on("hit",this.handleHit)}},{key:"stopListening",value:function(){this.completer.removeAllListeners(),this.dropdown.removeAllListeners(),this.editor.removeListener("move",this.handleMove).removeListener("enter",this.handleEnter).removeListener("esc",this.handleEsc).removeListener("change",this.handleChange)}}]),t}(m.default);t.default=b},function(e){var t;t=function(){return this}();try{t=t||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(t=window)}e.exports=t},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(1),l=r(a),c=n(4),h=(r(c),n(0)),f=(r(h),["handleQueryResult"]),d=function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.strategies=[],f.forEach(function(t){e[t]=e[t].bind(e)}),e}return s(t,e),u(t,[{key:"destroy",value:function(){return this.strategies.forEach(function(e){return e.destroy()}),this}},{key:"registerStrategy",value:function(e){return this.strategies.push(e),this}},{key:"run",value:function(e){var t=this.extractQuery(e);t?t.execute(this.handleQueryResult):this.handleQueryResult([])}},{key:"extractQuery",value:function(e){for(var t=0;t<this.strategies.length;t++){var n=this.strategies[t].buildQuery(e);if(n)return n}return null}},{key:"handleQueryResult",value:function(e){this.emit("hit",{searchResults:e})}}]),t}(l.default);t.default=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(10),l=r(a),c=n(0),h=(r(c),n(2)),f=n(1),d=r(f),p="dropdown-menu textcomplete-dropdown",v=function(e){function t(e){var n=e.className,r=void 0===n?p:n,s=e.footer,u=e.header,a=e.maxCount,l=void 0===a?10:a,c=e.placement,h=e.rotate,f=void 0===h||h,d=e.style;i(this,t);var v=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return v.shown=!1,v.items=[],v.footer=s,v.header=u,v.maxCount=l,v.el.className=r,v.rotate=f,v.placement=c,d&&Object.keys(d).forEach(function(e){v.el.style[e]=d[e]}),v}return s(t,e),u(t,null,[{key:"createElement",value:function(){var e=document.createElement("ul"),t=e.style;t.display="none",t.position="absolute",t.zIndex="10000";var n=document.body;return n&&n.appendChild(e),e}}]),u(t,[{key:"destroy",value:function(){var e=this.el.parentNode;return e&&e.removeChild(this.el),this.clear()._el=null,this}},{key:"render",value:function(e,t){var n=(0,h.createCustomEvent)("render",{cancelable:!0});if(this.emit("render",n),n.defaultPrevented)return this;var r=e.map(function(e){return e.data}),i=e.slice(0,this.maxCount||e.length).map(function(e){return new l.default(e)});return this.clear().setStrategyId(e[0]).renderEdge(r,"header").append(i).renderEdge(r,"footer").setOffset(t).show(),this.emit("rendered",(0,h.createCustomEvent)("rendered")),this}},{key:"deactivate",value:function(){return this.hide().clear()}},{key:"select",value:function(e){var t={searchResult:e.searchResult},n=(0,h.createCustomEvent)("select",{cancelable:!0,detail:t});return this.emit("select",n),n.defaultPrevented?this:(this.deactivate(),this.emit("selected",(0,h.createCustomEvent)("selected",{detail:t})),this)}},{key:"up",value:function(e){return this.shown?this.moveActiveItem("prev",e):this}},{key:"down",value:function(e){return this.shown?this.moveActiveItem("next",e):this}},{key:"getActiveItem",value:function(){return this.items.find(function(e){return e.active})}},{key:"append",value:function(e){var t=this,n=document.createDocumentFragment();return e.forEach(function(e){t.items.push(e),e.appended(t),n.appendChild(e.el)}),this.el.appendChild(n),this}},{key:"setOffset",value:function(e){if(e.left?this.el.style.left=e.left+"px":e.right&&(this.el.style.right=e.right+"px"),this.isPlacementTop()){var t=document.documentElement;t&&(this.el.style.bottom=t.clientHeight-e.top+e.lineHeight+"px")}else this.el.style.top=e.top+"px";return this}},{key:"show",value:function(){if(!this.shown){var e=(0,h.createCustomEvent)("show",{cancelable:!0});if(this.emit("show",e),e.defaultPrevented)return this;this.el.style.display="block",this.shown=!0,this.emit("shown",(0,h.createCustomEvent)("shown"))}return this}},{key:"hide",value:function(){if(this.shown){var e=(0,h.createCustomEvent)("hide",{cancelable:!0});if(this.emit("hide",e),e.defaultPrevented)return this;this.el.style.display="none",this.shown=!1,this.emit("hidden",(0,h.createCustomEvent)("hidden"))}return this}},{key:"clear",value:function(){return this.el.innerHTML="",this.items.forEach(function(e){return e.destroy()}),this.items=[],this}},{key:"moveActiveItem",value:function(e,t){var n=this.getActiveItem(),r=void 0;return r=n?n[e]:"next"===e?this.items[0]:this.items[this.items.length-1],r&&(r.activate(),t.preventDefault()),this}},{key:"setStrategyId",value:function(e){var t=e&&e.strategy.props.id;return t?this.el.setAttribute("data-strategy",t):this.el.removeAttribute("data-strategy"),this}},{key:"renderEdge",value:function(e,t){var n=("header"===t?this.header:this.footer)||"",r="function"==typeof n?n(e):n,i=document.createElement("li");return i.classList.add("textcomplete-"+t),i.innerHTML=r,this.el.appendChild(i),this}},{key:"isPlacementTop",value:function(){return"top"===this.placement}},{key:"el",get:function(){return this._el||(this._el=t.createElement()),this._el}}]),t}(d.default);t.default=v},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.CLASS_NAME=void 0;var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(0),s=(function(e){e&&e.__esModule}(o),t.CLASS_NAME="textcomplete-item"),u=s+" active",a=["onClick","onMouseover"],l=function(){function e(t){var n=this;r(this,e),this.searchResult=t,this.active=!1,a.forEach(function(e){n[e]=n[e].bind(n)})}return i(e,[{key:"destroy",value:function(){this.el.removeEventListener("mousedown",this.onClick,!1),this.el.removeEventListener("mouseover",this.onMouseover,!1),this.el.removeEventListener("touchstart",this.onClick,!1),this._el=null}},{key:"appended",value:function(e){this.dropdown=e,this.siblings=e.items,this.index=this.siblings.length-1}},{key:"activate",value:function(){if(!this.active){var e=this.dropdown.getActiveItem();e&&e.deactivate(),this.active=!0,this.el.className=u}return this}},{key:"deactivate",value:function(){return this.active&&(this.active=!1,this.el.className=s),this}},{key:"onClick",value:function(e){e.preventDefault(),this.dropdown.select(this)}},{key:"onMouseover",value:function(){this.activate()}},{key:"el",get:function(){if(this._el)return this._el;var e=document.createElement("li");e.className=this.active?u:s;var t=document.createElement("a");return t.innerHTML=this.searchResult.render(),e.appendChild(t),this._el=e,e.addEventListener("mousedown",this.onClick),e.addEventListener("mouseover",this.onMouseover),e.addEventListener("touchstart",this.onClick),e}},{key:"next",get:function(){var e=void 0;if(this.index===this.siblings.length-1){if(!this.dropdown.rotate)return null;e=0}else e=this.index+1;return this.siblings[e]}},{key:"prev",get:function(){var e=void 0;if(0===this.index){if(!this.dropdown.rotate)return null;e=this.siblings.length-1}else e=this.index-1;return this.siblings[e]}}]),e}();t.default=l},function(e,t,n){"use strict";(function(e){function t(e){return e&&e.__esModule?e:{default:e}}var r=n(6),i=t(r),o=n(5),s=t(o),u=void 0;u=e.Textcomplete&&e.Textcomplete.editors?e.Textcomplete.editors:{},u.Textarea=s.default,e.Textcomplete=i.default,e.Textcomplete.editors=u}).call(t,n(7))},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(0),s=function(e){return e&&e.__esModule?e:{default:e}}(o),u=function(){function e(t,n,i){r(this,e),this.strategy=t,this.term=n,this.match=i}return i(e,[{key:"execute",value:function(e){var t=this;this.strategy.search(this.term,function(n){e(n.map(function(e){return new s.default(e,t.term,t.strategy)}))},this.match)}}]),e}();t.default=u},function(e){!function(){function t(e,t,o){if(!r)throw new Error("textarea-caret-position#getCaretCoordinates should only be called in a browser");var s=o&&o.debug||!1;if(s){var u=document.querySelector("#input-textarea-caret-position-mirror-div");u&&u.parentNode.removeChild(u)}var a=document.createElement("div");a.id="input-textarea-caret-position-mirror-div",document.body.appendChild(a);var l=a.style,c=window.getComputedStyle?getComputedStyle(e):e.currentStyle;l.whiteSpace="pre-wrap","INPUT"!==e.nodeName&&(l.wordWrap="break-word"),l.position="absolute",s||(l.visibility="hidden"),n.forEach(function(e){l[e]=c[e]}),i?e.scrollHeight>parseInt(c.height)&&(l.overflowY="scroll"):l.overflow="hidden",a.textContent=e.value.substring(0,t),"INPUT"===e.nodeName&&(a.textContent=a.textContent.replace(/\s/g," "));var h=document.createElement("span");h.textContent=e.value.substring(t)||".",a.appendChild(h);var f={top:h.offsetTop+parseInt(c.borderTopWidth),left:h.offsetLeft+parseInt(c.borderLeftWidth)};return s?h.style.backgroundColor="#aaa":document.body.removeChild(a),f}var n=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"],r="undefined"!=typeof window,i=r&&null!=window.mozInnerScreenX;void 0!==e&&void 0!==e.exports?e.exports=t:r&&(window.getCaretCoordinates=t)}()}]);
|
|
1
|
+
/** https://unpkg.com/textcomplete@0.13.1/dist/textcomplete.min.js */
|
|
2
|
+
!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=11)}([function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(1),s=(function(e){e&&e.__esModule}(o),function(){function e(t,n,i){r(this,e),this.data=t,this.term=n,this.strategy=i}return i(e,[{key:"replace",value:function(e,t){var n=this.strategy.replace(this.data);if(null!==n){Array.isArray(n)&&(t=n[1]+t,n=n[0]);var r=this.strategy.matchText(e);if(r)return n=n.replace(/\$&/g,r[0]).replace(/\$(\d+)/g,function(e,t){return r[parseInt(t,10)]}),[[e.slice(0,r.index),n,e.slice(r.index+r[0].length)].join(""),t]}}},{key:"render",value:function(){return this.strategy.template(this.data,this.term)}}]),e}());t.default=s},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return e}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(12),u=function(e){return e&&e.__esModule?e:{default:e}}(s),a=function(){function e(t){r(this,e),this.props=t,this.cache=t.cache?{}:null}return o(e,[{key:"destroy",value:function(){return this.cache=null,this}},{key:"buildQuery",value:function(e){if("function"==typeof this.props.context){var t=this.props.context(e);if("string"==typeof t)e=t;else if(!t)return null}var n=this.matchText(e);return n?new u.default(this,n[this.index],n):null}},{key:"search",value:function(e,t,n){this.cache?this.searchWithCache(e,t,n):this.props.search(e,t,n)}},{key:"replace",value:function(e){return this.props.replace(e)}},{key:"searchWithCache",value:function(e,t,n){var r=this;this.cache&&this.cache[e]?t(this.cache[e]):this.props.search(e,function(n){r.cache&&(r.cache[e]=n),t(n)},n)}},{key:"matchText",value:function(e){return"function"==typeof this.match?this.match(e):e.match(this.match)}},{key:"match",get:function(){return this.props.match}},{key:"index",get:function(){return"number"==typeof this.props.index?this.props.index:2}},{key:"template",get:function(){return this.props.template||i}}]),e}();t.default=a},function(e){"use strict";function t(){}function n(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function r(){this._events=new t,this._eventsCount=0}var i=Object.prototype.hasOwnProperty,o="~";Object.create&&(t.prototype=Object.create(null),(new t).__proto__||(o=!1)),r.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)i.call(e,t)&&n.push(o?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},r.prototype.listeners=function(e,t){var n=o?o+e:e,r=this._events[n];if(t)return!!r;if(!r)return[];if(r.fn)return[r.fn];for(var i=0,s=r.length,u=new Array(s);i<s;i++)u[i]=r[i].fn;return u},r.prototype.emit=function(e,t,n,r,i,s){var u=o?o+e:e;if(!this._events[u])return!1;var a,l,c=this._events[u],h=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),h){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,r),!0;case 5:return c.fn.call(c.context,t,n,r,i),!0;case 6:return c.fn.call(c.context,t,n,r,i,s),!0}for(l=1,a=new Array(h-1);l<h;l++)a[l-1]=arguments[l];c.fn.apply(c.context,a)}else{var f,d=c.length;for(l=0;l<d;l++)switch(c[l].once&&this.removeListener(e,c[l].fn,void 0,!0),h){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,t);break;case 3:c[l].fn.call(c[l].context,t,n);break;case 4:c[l].fn.call(c[l].context,t,n,r);break;default:if(!a)for(f=1,a=new Array(h-1);f<h;f++)a[f-1]=arguments[f];c[l].fn.apply(c[l].context,a)}}return!0},r.prototype.on=function(e,t,r){var i=new n(t,r||this),s=o?o+e:e;return this._events[s]?this._events[s].fn?this._events[s]=[this._events[s],i]:this._events[s].push(i):(this._events[s]=i,this._eventsCount++),this},r.prototype.once=function(e,t,r){var i=new n(t,r||this,!0),s=o?o+e:e;return this._events[s]?this._events[s].fn?this._events[s]=[this._events[s],i]:this._events[s].push(i):(this._events[s]=i,this._eventsCount++),this},r.prototype.removeListener=function(e,n,r,i){var s=o?o+e:e;if(!this._events[s])return this;if(!n)return 0==--this._eventsCount?this._events=new t:delete this._events[s],this;var u=this._events[s];if(u.fn)u.fn!==n||i&&!u.once||r&&u.context!==r||(0==--this._eventsCount?this._events=new t:delete this._events[s]);else{for(var a=0,l=[],c=u.length;a<c;a++)(u[a].fn!==n||i&&!u[a].once||r&&u[a].context!==r)&&l.push(u[a]);l.length?this._events[s]=1===l.length?l[0]:l:0==--this._eventsCount?this._events=new t:delete this._events[s]}return this},r.prototype.removeAllListeners=function(e){var n;return e?(n=o?o+e:e,this._events[n]&&(0==--this._eventsCount?this._events=new t:delete this._events[n])):(this._events=new t,this._eventsCount=0),this},r.prototype.off=r.prototype.removeListener,r.prototype.addListener=r.prototype.on,r.prototype.setMaxListeners=function(){return this},r.prefixed=o,r.EventEmitter=r,e.exports=r},function(e,t){"use strict";function n(e){var t=e.getBoundingClientRect(),n=e.ownerDocument,r=n.defaultView,i=n.documentElement,o={top:t.top+r.pageYOffset,left:t.left+r.pageXOffset};return i&&(o.top-=i.clientTop,o.left-=i.clientLeft),o}function r(e){return e>=o&&e<=s}function i(e){var t=window.getComputedStyle(e);if(r(t.lineHeight.charCodeAt(0)))return r(t.lineHeight.charCodeAt(t.lineHeight.length-1))?parseFloat(t.lineHeight)*parseFloat(t.fontSize):parseFloat(t.lineHeight);var n=document.body;if(!n)return 0;var i=document.createElement(e.nodeName);i.innerHTML=" ",i.style.fontSize=t.fontSize,i.style.fontFamily=t.fontFamily,n.appendChild(i);var o=i.offsetHeight;return n.removeChild(i),o}Object.defineProperty(t,"__esModule",{value:!0}),t.calculateElementOffset=n,t.getLineHeightPx=i;var o=(t.createCustomEvent=function(){return"function"==typeof window.CustomEvent?function(e,t){return new document.defaultView.CustomEvent(e,{cancelable:t&&t.cancelable||!1,detail:t&&t.detail||void 0})}:function(e,t){var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,!1,t&&t.cancelable||!1,t&&t.detail||void 0),n}}(),"0".charCodeAt(0)),s="9".charCodeAt(0)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(2),l=r(a),c=n(10),h=r(c),f=n(0),d=(r(f),n(3)),p="dropdown-menu textcomplete-dropdown",v=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));n.shown=!1,n.items=[],n.footer=e.footer,n.header=e.header,n.maxCount=e.maxCount||10,n.el.className=e.className||p,n.rotate=!e.hasOwnProperty("rotate")||e.rotate,n.placement=e.placement;var r=e.style;return r&&Object.keys(r).forEach(function(e){n.el.style[e]=r[e]}),n}return s(t,e),u(t,null,[{key:"createElement",value:function(){var e=document.createElement("ul"),t=e.style;t.display="none",t.position="absolute",t.zIndex="10000";var n=document.body;return n&&n.appendChild(e),e}}]),u(t,[{key:"destroy",value:function(){var e=this.el.parentNode;return e&&e.removeChild(this.el),this.clear()._el=null,this}},{key:"render",value:function(e,t){var n=(0,d.createCustomEvent)("render",{cancelable:!0});if(this.emit("render",n),n.defaultPrevented)return this;var r=e.map(function(e){return e.data}),i=e.slice(0,this.maxCount||e.length).map(function(e){return new h.default(e)});return this.clear().setStrategyId(e[0]).renderEdge(r,"header").append(i).renderEdge(r,"footer").setOffset(t).show(),this.emit("rendered",(0,d.createCustomEvent)("rendered")),this}},{key:"deactivate",value:function(){return this.hide().clear()}},{key:"select",value:function(e){var t={searchResult:e.searchResult},n=(0,d.createCustomEvent)("select",{cancelable:!0,detail:t});return this.emit("select",n),n.defaultPrevented?this:(this.deactivate(),this.emit("selected",(0,d.createCustomEvent)("selected",{detail:t})),this)}},{key:"up",value:function(e){return this.shown?this.moveActiveItem("prev",e):this}},{key:"down",value:function(e){return this.shown?this.moveActiveItem("next",e):this}},{key:"getActiveItem",value:function(){return this.items.find(function(e){return e.active})}},{key:"append",value:function(e){var t=this,n=document.createDocumentFragment();return e.forEach(function(e){t.items.push(e),e.appended(t),n.appendChild(e.el)}),this.el.appendChild(n),this}},{key:"setOffset",value:function(e){if(e.left?this.el.style.left=e.left+"px":e.right&&(this.el.style.right=e.right+"px"),this.isPlacementTop()){var t=document.documentElement;t&&(this.el.style.bottom=t.clientHeight-e.top+e.lineHeight+"px")}else this.el.style.top=e.top+"px";return this}},{key:"show",value:function(){if(!this.shown){var e=(0,d.createCustomEvent)("show",{cancelable:!0});if(this.emit("show",e),e.defaultPrevented)return this;this.el.style.display="block",this.shown=!0,this.emit("shown",(0,d.createCustomEvent)("shown"))}return this}},{key:"hide",value:function(){if(this.shown){var e=(0,d.createCustomEvent)("hide",{cancelable:!0});if(this.emit("hide",e),e.defaultPrevented)return this;this.el.style.display="none",this.shown=!1,this.emit("hidden",(0,d.createCustomEvent)("hidden"))}return this}},{key:"clear",value:function(){return this.el.innerHTML="",this.items.forEach(function(e){return e.destroy()}),this.items=[],this}},{key:"moveActiveItem",value:function(e,t){var n=this.getActiveItem(),r=void 0;return r=n?n[e]:"next"===e?this.items[0]:this.items[this.items.length-1],r&&(r.activate(),t.preventDefault()),this}},{key:"setStrategyId",value:function(e){var t=e&&e.strategy.props.id;return t?this.el.setAttribute("data-strategy",t):this.el.removeAttribute("data-strategy"),this}},{key:"renderEdge",value:function(e,t){var n=("header"===t?this.header:this.footer)||"",r="function"==typeof n?n(e):n,i=document.createElement("li");return i.classList.add("textcomplete-"+t),i.innerHTML=r,this.el.appendChild(i),this}},{key:"isPlacementTop",value:function(){return"top"===this.placement}},{key:"el",get:function(){return this._el||(this._el=t.createElement()),this._el}}]),t}(l.default);t.default=v},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(2),l=r(a),c=n(3),h=n(0),f=(r(h),function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,e),u(t,[{key:"destroy",value:function(){return this}},{key:"applySearchResult",value:function(){throw new Error("Not implemented.")}},{key:"getCursorOffset",value:function(){throw new Error("Not implemented.")}},{key:"getBeforeCursor",value:function(){throw new Error("Not implemented.")}},{key:"getAfterCursor",value:function(){throw new Error("Not implemented.")}},{key:"emitMoveEvent",value:function(e){var t=(0,c.createCustomEvent)("move",{cancelable:!0,detail:{code:e}});return this.emit("move",t),t}},{key:"emitEnterEvent",value:function(){var e=(0,c.createCustomEvent)("enter",{cancelable:!0});return this.emit("enter",e),e}},{key:"emitChangeEvent",value:function(){var e=(0,c.createCustomEvent)("change",{detail:{beforeCursor:this.getBeforeCursor()}});return this.emit("change",e),e}},{key:"emitEscEvent",value:function(){var e=(0,c.createCustomEvent)("esc",{cancelable:!0});return this.emit("esc",e),e}},{key:"getCode",value:function(e){return 8===e.keyCode?"BS":9===e.keyCode?"ENTER":13===e.keyCode?"ENTER":16===e.keyCode?"META":17===e.keyCode?"META":18===e.keyCode?"META":27===e.keyCode?"ESC":38===e.keyCode?"UP":40===e.keyCode?"DOWN":78===e.keyCode&&e.ctrlKey?"DOWN":80===e.keyCode&&e.ctrlKey?"UP":91===e.keyCode?"META":93===e.keyCode?"META":"OTHER"}}]),t}(l.default));t.default=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var s=i.get;if(void 0!==s)return s.call(r)},l=n(14),c=r(l),h=n(5),f=r(h),d=n(3),p=n(0),v=(r(p),n(13)),y=["onInput","onKeydown"],m=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.el=e,y.forEach(function(e){n[e]=n[e].bind(n)}),n.startListening(),n}return s(t,e),u(t,[{key:"destroy",value:function(){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this),this.stopListening(),this.el=null,this}},{key:"applySearchResult",value:function(e){var t=e.replace(this.getBeforeCursor(),this.getAfterCursor());this.el.focus(),Array.isArray(t)&&((0,c.default)(this.el,t[0],t[1]),this.el.dispatchEvent(new Event("input")))}},{key:"getCursorOffset",value:function(){var e=(0,d.calculateElementOffset)(this.el),t=this.getElScroll(),n=this.getCursorPosition(),r=(0,d.getLineHeightPx)(this.el),i=e.top-t.top+n.top+r,o=e.left-t.left+n.left;return"rtl"!==this.el.dir?{top:i,left:o,lineHeight:r}:{top:i,right:document.documentElement?document.documentElement.clientWidth-o:0,lineHeight:r}}},{key:"getBeforeCursor",value:function(){return this.el.value.substring(0,this.el.selectionEnd)}},{key:"getAfterCursor",value:function(){return this.el.value.substring(this.el.selectionEnd)}},{key:"getElScroll",value:function(){return{top:this.el.scrollTop,left:this.el.scrollLeft}}},{key:"getCursorPosition",value:function(){return v(this.el,this.el.selectionEnd)}},{key:"onInput",value:function(){this.emitChangeEvent()}},{key:"onKeydown",value:function(e){var t=this.getCode(e),n=void 0;"UP"===t||"DOWN"===t?n=this.emitMoveEvent(t):"ENTER"===t?n=this.emitEnterEvent():"ESC"===t&&(n=this.emitEscEvent()),n&&n.defaultPrevented&&e.preventDefault()}},{key:"startListening",value:function(){this.el.addEventListener("input",this.onInput),this.el.addEventListener("keydown",this.onKeydown)}},{key:"stopListening",value:function(){this.el.removeEventListener("input",this.onInput),this.el.removeEventListener("keydown",this.onKeydown)}}]),t}(f.default);t.default=m},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(9),l=r(a),c=n(5),h=(r(c),n(4)),f=r(h),d=n(1),p=r(d),v=n(0),y=(r(v),n(2)),m=r(y),g=["handleChange","handleEnter","handleEsc","handleHit","handleMove","handleSelect"],b=function(e){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r.completer=new l.default,r.isQueryInFlight=!1,r.nextPendingQuery=null,r.dropdown=new f.default(n.dropdown||{}),r.editor=e,r.options=n,g.forEach(function(e){r[e]=r[e].bind(r)}),r.startListening(),r}return s(t,e),u(t,[{key:"destroy",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.completer.destroy(),this.dropdown.destroy(),e&&this.editor.destroy(),this.stopListening(),this}},{key:"register",value:function(e){var t=this;return e.forEach(function(e){t.completer.registerStrategy(new p.default(e))}),this}},{key:"trigger",value:function(e){return this.isQueryInFlight?this.nextPendingQuery=e:(this.isQueryInFlight=!0,this.nextPendingQuery=null,this.completer.run(e)),this}},{key:"handleHit",value:function(e){var t=e.searchResults;t.length?this.dropdown.render(t,this.editor.getCursorOffset()):this.dropdown.deactivate(),this.isQueryInFlight=!1,null!==this.nextPendingQuery&&this.trigger(this.nextPendingQuery)}},{key:"handleMove",value:function(e){"UP"===e.detail.code?this.dropdown.up(e):this.dropdown.down(e)}},{key:"handleEnter",value:function(e){var t=this.dropdown.getActiveItem();t&&(this.dropdown.select(t),e.preventDefault())}},{key:"handleEsc",value:function(e){this.dropdown.shown&&(this.dropdown.deactivate(),e.preventDefault())}},{key:"handleChange",value:function(e){this.trigger(e.detail.beforeCursor)}},{key:"handleSelect",value:function(e){this.emit("select",e),e.defaultPrevented||this.editor.applySearchResult(e.detail.searchResult)}},{key:"startListening",value:function(){var e=this;this.editor.on("move",this.handleMove).on("enter",this.handleEnter).on("esc",this.handleEsc).on("change",this.handleChange),this.dropdown.on("select",this.handleSelect),["show","shown","render","rendered","selected","hidden","hide"].forEach(function(t){e.dropdown.on(t,function(){return e.emit(t)})}),this.completer.on("hit",this.handleHit)}},{key:"stopListening",value:function(){this.completer.removeAllListeners(),this.dropdown.removeAllListeners(),this.editor.removeListener("move",this.handleMove).removeListener("enter",this.handleEnter).removeListener("esc",this.handleEsc).removeListener("change",this.handleChange)}}]),t}(m.default);t.default=b},function(e){var t;t=function(){return this}();try{t=t||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(t=window)}e.exports=t},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(2),l=r(a),c=n(1),h=(r(c),n(0)),f=(r(h),["handleQueryResult"]),d=function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.strategies=[],f.forEach(function(t){e[t]=e[t].bind(e)}),e}return s(t,e),u(t,[{key:"destroy",value:function(){return this.strategies.forEach(function(e){return e.destroy()}),this}},{key:"registerStrategy",value:function(e){return this.strategies.push(e),this}},{key:"run",value:function(e){var t=this.extractQuery(e);t?t.execute(this.handleQueryResult):this.handleQueryResult([])}},{key:"extractQuery",value:function(e){for(var t=0;t<this.strategies.length;t++){var n=this.strategies[t].buildQuery(e);if(n)return n}return null}},{key:"handleQueryResult",value:function(e){this.emit("hit",{searchResults:e})}}]),t}(l.default);t.default=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.CLASS_NAME=void 0;var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(4),u=(r(s),n(0)),a=(r(u),t.CLASS_NAME="textcomplete-item"),l=a+" active",c=["onClick","onMouseover"],h=function(){function e(t){var n=this;i(this,e),this.searchResult=t,this.active=!1,c.forEach(function(e){n[e]=n[e].bind(n)})}return o(e,[{key:"destroy",value:function(){this.el.removeEventListener("mousedown",this.onClick,!1),this.el.removeEventListener("mouseover",this.onMouseover,!1),this.el.removeEventListener("touchstart",this.onClick,!1),this._el=null}},{key:"appended",value:function(e){this.dropdown=e,this.siblings=e.items,this.index=this.siblings.length-1}},{key:"activate",value:function(){if(!this.active){var e=this.dropdown.getActiveItem();e&&e.deactivate(),this.active=!0,this.el.className=l}return this}},{key:"deactivate",value:function(){return this.active&&(this.active=!1,this.el.className=a),this}},{key:"onClick",value:function(e){e.preventDefault(),this.dropdown.select(this)}},{key:"onMouseover",value:function(){this.activate()}},{key:"el",get:function(){if(this._el)return this._el;var e=document.createElement("li");e.className=this.active?l:a;var t=document.createElement("a");return t.innerHTML=this.searchResult.render(),e.appendChild(t),this._el=e,e.addEventListener("mousedown",this.onClick),e.addEventListener("mouseover",this.onMouseover),e.addEventListener("touchstart",this.onClick),e}},{key:"next",get:function(){var e=void 0;if(this.index===this.siblings.length-1){if(!this.dropdown.rotate)return null;e=0}else e=this.index+1;return this.siblings[e]}},{key:"prev",get:function(){var e=void 0;if(0===this.index){if(!this.dropdown.rotate)return null;e=this.siblings.length-1}else e=this.index-1;return this.siblings[e]}}]),e}();t.default=h},function(e,t,n){"use strict";(function(e){function t(e){return e&&e.__esModule?e:{default:e}}var r=n(7),i=t(r),o=n(6),s=t(o),u=void 0;u=e.Textcomplete&&e.Textcomplete.editors?e.Textcomplete.editors:{},u.Textarea=s.default,e.Textcomplete=i.default,e.Textcomplete.editors=u}).call(t,n(8))},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(0),u=r(s),a=n(1),l=(r(a),function(){function e(t,n,r){i(this,e),this.strategy=t,this.term=n,this.match=r}return o(e,[{key:"execute",value:function(e){var t=this;this.strategy.search(this.term,function(n){e(n.map(function(e){return new u.default(e,t.term,t.strategy)}))},this.match)}}]),e}());t.default=l},function(e){!function(){function t(e,t,o){if(!r)throw new Error("textarea-caret-position#getCaretCoordinates should only be called in a browser");var s=o&&o.debug||!1;if(s){var u=document.querySelector("#input-textarea-caret-position-mirror-div");u&&u.parentNode.removeChild(u)}var a=document.createElement("div");a.id="input-textarea-caret-position-mirror-div",document.body.appendChild(a);var l=a.style,c=window.getComputedStyle?getComputedStyle(e):e.currentStyle;l.whiteSpace="pre-wrap","INPUT"!==e.nodeName&&(l.wordWrap="break-word"),l.position="absolute",s||(l.visibility="hidden"),n.forEach(function(e){l[e]=c[e]}),i?e.scrollHeight>parseInt(c.height)&&(l.overflowY="scroll"):l.overflow="hidden",a.textContent=e.value.substring(0,t),"INPUT"===e.nodeName&&(a.textContent=a.textContent.replace(/\s/g,"Â "));var h=document.createElement("span");h.textContent=e.value.substring(t)||".",a.appendChild(h);var f={top:h.offsetTop+parseInt(c.borderTopWidth),left:h.offsetLeft+parseInt(c.borderLeftWidth)};return s?h.style.backgroundColor="#aaa":document.body.removeChild(a),f}var n=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"],r="undefined"!=typeof window,i=r&&null!=window.mozInnerScreenX;void 0!==e&&void 0!==e.exports?e.exports=t:r&&(window.getCaretCoordinates=t)}()},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){for(var r=e.value,i=t+(n||""),o=document.activeElement,s=0,u=0;r[s]===i[s];)s++;for(;r[r.length-u-1]===i[i.length-u-1];)u++;s=Math.min(s,r.length-u),e.setSelectionRange(s,r.length-u);var a=i.substring(s,i.length-u);return e.focus(),document.execCommand("insertText",!1,a)||(e.value=i),o&&o.focus(),e.setSelectionRange(t.length,t.length),e}}]);
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: thredded
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.13.
|
|
4
|
+
version: 0.13.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joel Oliveira
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2017-
|
|
12
|
+
date: 2017-07-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: pundit
|
|
@@ -700,6 +700,7 @@ files:
|
|
|
700
700
|
- app/assets/javascripts/thredded/core/serialize_form.es6
|
|
701
701
|
- app/assets/javascripts/thredded/core/thredded.es6
|
|
702
702
|
- app/assets/javascripts/thredded/dependencies.js
|
|
703
|
+
- app/assets/javascripts/thredded/dependencies/autosize.js
|
|
703
704
|
- app/assets/javascripts/thredded/dependencies/textcomplete.js
|
|
704
705
|
- app/assets/javascripts/thredded/dependencies/timeago.js
|
|
705
706
|
- app/assets/javascripts/thredded/dependencies/ujs.js
|
|
@@ -1010,7 +1011,7 @@ files:
|
|
|
1010
1011
|
- lib/thredded/version.rb
|
|
1011
1012
|
- lib/thredded/view_hooks/config.rb
|
|
1012
1013
|
- lib/thredded/view_hooks/renderer.rb
|
|
1013
|
-
- vendor/assets/javascripts/autosize.js
|
|
1014
|
+
- vendor/assets/javascripts/autosize.min.js
|
|
1014
1015
|
- vendor/assets/javascripts/textcomplete.min.js
|
|
1015
1016
|
homepage: https://thredded.org
|
|
1016
1017
|
licenses:
|
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
Autosize 3.0.20
|
|
3
|
-
license: MIT
|
|
4
|
-
http://www.jacklmoore.com/autosize
|
|
5
|
-
*/
|
|
6
|
-
(function (global, factory) {
|
|
7
|
-
if (typeof define === 'function' && define.amd) {
|
|
8
|
-
define(['exports', 'module'], factory);
|
|
9
|
-
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
|
|
10
|
-
factory(exports, module);
|
|
11
|
-
} else {
|
|
12
|
-
var mod = {
|
|
13
|
-
exports: {}
|
|
14
|
-
};
|
|
15
|
-
factory(mod.exports, mod);
|
|
16
|
-
global.autosize = mod.exports;
|
|
17
|
-
}
|
|
18
|
-
})(this, function (exports, module) {
|
|
19
|
-
'use strict';
|
|
20
|
-
|
|
21
|
-
var map = typeof Map === "function" ? new Map() : (function () {
|
|
22
|
-
var keys = [];
|
|
23
|
-
var values = [];
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
has: function has(key) {
|
|
27
|
-
return keys.indexOf(key) > -1;
|
|
28
|
-
},
|
|
29
|
-
get: function get(key) {
|
|
30
|
-
return values[keys.indexOf(key)];
|
|
31
|
-
},
|
|
32
|
-
set: function set(key, value) {
|
|
33
|
-
if (keys.indexOf(key) === -1) {
|
|
34
|
-
keys.push(key);
|
|
35
|
-
values.push(value);
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
'delete': function _delete(key) {
|
|
39
|
-
var index = keys.indexOf(key);
|
|
40
|
-
if (index > -1) {
|
|
41
|
-
keys.splice(index, 1);
|
|
42
|
-
values.splice(index, 1);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
})();
|
|
47
|
-
|
|
48
|
-
var createEvent = function createEvent(name) {
|
|
49
|
-
return new Event(name, { bubbles: true });
|
|
50
|
-
};
|
|
51
|
-
try {
|
|
52
|
-
new Event('test');
|
|
53
|
-
} catch (e) {
|
|
54
|
-
// IE does not support `new Event()`
|
|
55
|
-
createEvent = function (name) {
|
|
56
|
-
var evt = document.createEvent('Event');
|
|
57
|
-
evt.initEvent(name, true, false);
|
|
58
|
-
return evt;
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function assign(ta) {
|
|
63
|
-
if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
|
|
64
|
-
|
|
65
|
-
var heightOffset = null;
|
|
66
|
-
var clientWidth = ta.clientWidth;
|
|
67
|
-
var cachedHeight = null;
|
|
68
|
-
|
|
69
|
-
function init() {
|
|
70
|
-
var style = window.getComputedStyle(ta, null);
|
|
71
|
-
|
|
72
|
-
if (style.resize === 'vertical') {
|
|
73
|
-
ta.style.resize = 'none';
|
|
74
|
-
} else if (style.resize === 'both') {
|
|
75
|
-
ta.style.resize = 'horizontal';
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (style.boxSizing === 'content-box') {
|
|
79
|
-
heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
|
|
80
|
-
} else {
|
|
81
|
-
heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
|
|
82
|
-
}
|
|
83
|
-
// Fix when a textarea is not on document body and heightOffset is Not a Number
|
|
84
|
-
if (isNaN(heightOffset)) {
|
|
85
|
-
heightOffset = 0;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
update();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function changeOverflow(value) {
|
|
92
|
-
{
|
|
93
|
-
// Chrome/Safari-specific fix:
|
|
94
|
-
// When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
|
|
95
|
-
// made available by removing the scrollbar. The following forces the necessary text reflow.
|
|
96
|
-
var width = ta.style.width;
|
|
97
|
-
ta.style.width = '0px';
|
|
98
|
-
// Force reflow:
|
|
99
|
-
/* jshint ignore:start */
|
|
100
|
-
ta.offsetWidth;
|
|
101
|
-
/* jshint ignore:end */
|
|
102
|
-
ta.style.width = width;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
ta.style.overflowY = value;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function getParentOverflows(el) {
|
|
109
|
-
var arr = [];
|
|
110
|
-
|
|
111
|
-
while (el && el.parentNode && el.parentNode instanceof Element) {
|
|
112
|
-
if (el.parentNode.scrollTop) {
|
|
113
|
-
arr.push({
|
|
114
|
-
node: el.parentNode,
|
|
115
|
-
scrollTop: el.parentNode.scrollTop
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
el = el.parentNode;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return arr;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function resize() {
|
|
125
|
-
var originalHeight = ta.style.height;
|
|
126
|
-
var overflows = getParentOverflows(ta);
|
|
127
|
-
var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
|
|
128
|
-
|
|
129
|
-
ta.style.height = 'auto';
|
|
130
|
-
|
|
131
|
-
var endHeight = ta.scrollHeight + heightOffset;
|
|
132
|
-
|
|
133
|
-
if (ta.scrollHeight === 0) {
|
|
134
|
-
// If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
|
|
135
|
-
ta.style.height = originalHeight;
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
ta.style.height = endHeight + 'px';
|
|
140
|
-
|
|
141
|
-
// used to check if an update is actually necessary on window.resize
|
|
142
|
-
clientWidth = ta.clientWidth;
|
|
143
|
-
|
|
144
|
-
// prevents scroll-position jumping
|
|
145
|
-
overflows.forEach(function (el) {
|
|
146
|
-
el.node.scrollTop = el.scrollTop;
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
if (docTop) {
|
|
150
|
-
document.documentElement.scrollTop = docTop;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function update() {
|
|
155
|
-
resize();
|
|
156
|
-
|
|
157
|
-
var styleHeight = Math.round(parseFloat(ta.style.height));
|
|
158
|
-
var computed = window.getComputedStyle(ta, null);
|
|
159
|
-
var actualHeight = Math.round(parseFloat(computed.height));
|
|
160
|
-
|
|
161
|
-
// The actual height not matching the style height (set via the resize method) indicates that
|
|
162
|
-
// the max-height has been exceeded, in which case the overflow should be set to visible.
|
|
163
|
-
if (actualHeight !== styleHeight) {
|
|
164
|
-
if (computed.overflowY !== 'visible') {
|
|
165
|
-
changeOverflow('visible');
|
|
166
|
-
resize();
|
|
167
|
-
actualHeight = Math.round(parseFloat(window.getComputedStyle(ta, null).height));
|
|
168
|
-
}
|
|
169
|
-
} else {
|
|
170
|
-
// Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
|
|
171
|
-
if (computed.overflowY !== 'hidden') {
|
|
172
|
-
changeOverflow('hidden');
|
|
173
|
-
resize();
|
|
174
|
-
actualHeight = Math.round(parseFloat(window.getComputedStyle(ta, null).height));
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
if (cachedHeight !== actualHeight) {
|
|
179
|
-
cachedHeight = actualHeight;
|
|
180
|
-
var evt = createEvent('autosize:resized');
|
|
181
|
-
try {
|
|
182
|
-
ta.dispatchEvent(evt);
|
|
183
|
-
} catch (err) {
|
|
184
|
-
// Firefox will throw an error on dispatchEvent for a detached element
|
|
185
|
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=889376
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
var pageResize = function pageResize() {
|
|
191
|
-
if (ta.clientWidth !== clientWidth) {
|
|
192
|
-
update();
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
var destroy = (function (style) {
|
|
197
|
-
window.removeEventListener('resize', pageResize, false);
|
|
198
|
-
ta.removeEventListener('input', update, false);
|
|
199
|
-
ta.removeEventListener('keyup', update, false);
|
|
200
|
-
ta.removeEventListener('autosize:destroy', destroy, false);
|
|
201
|
-
ta.removeEventListener('autosize:update', update, false);
|
|
202
|
-
|
|
203
|
-
Object.keys(style).forEach(function (key) {
|
|
204
|
-
ta.style[key] = style[key];
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
map['delete'](ta);
|
|
208
|
-
}).bind(ta, {
|
|
209
|
-
height: ta.style.height,
|
|
210
|
-
resize: ta.style.resize,
|
|
211
|
-
overflowY: ta.style.overflowY,
|
|
212
|
-
overflowX: ta.style.overflowX,
|
|
213
|
-
wordWrap: ta.style.wordWrap
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
ta.addEventListener('autosize:destroy', destroy, false);
|
|
217
|
-
|
|
218
|
-
// IE9 does not fire onpropertychange or oninput for deletions,
|
|
219
|
-
// so binding to onkeyup to catch most of those events.
|
|
220
|
-
// There is no way that I know of to detect something like 'cut' in IE9.
|
|
221
|
-
if ('onpropertychange' in ta && 'oninput' in ta) {
|
|
222
|
-
ta.addEventListener('keyup', update, false);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
window.addEventListener('resize', pageResize, false);
|
|
226
|
-
ta.addEventListener('input', update, false);
|
|
227
|
-
ta.addEventListener('autosize:update', update, false);
|
|
228
|
-
ta.style.overflowX = 'hidden';
|
|
229
|
-
ta.style.wordWrap = 'break-word';
|
|
230
|
-
|
|
231
|
-
map.set(ta, {
|
|
232
|
-
destroy: destroy,
|
|
233
|
-
update: update
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
init();
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function destroy(ta) {
|
|
240
|
-
var methods = map.get(ta);
|
|
241
|
-
if (methods) {
|
|
242
|
-
methods.destroy();
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
function update(ta) {
|
|
247
|
-
var methods = map.get(ta);
|
|
248
|
-
if (methods) {
|
|
249
|
-
methods.update();
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
var autosize = null;
|
|
254
|
-
|
|
255
|
-
// Do nothing in Node.js environment and IE8 (or lower)
|
|
256
|
-
if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
|
|
257
|
-
autosize = function (el) {
|
|
258
|
-
return el;
|
|
259
|
-
};
|
|
260
|
-
autosize.destroy = function (el) {
|
|
261
|
-
return el;
|
|
262
|
-
};
|
|
263
|
-
autosize.update = function (el) {
|
|
264
|
-
return el;
|
|
265
|
-
};
|
|
266
|
-
} else {
|
|
267
|
-
autosize = function (el, options) {
|
|
268
|
-
if (el) {
|
|
269
|
-
Array.prototype.forEach.call(el.length ? el : [el], function (x) {
|
|
270
|
-
return assign(x, options);
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
return el;
|
|
274
|
-
};
|
|
275
|
-
autosize.destroy = function (el) {
|
|
276
|
-
if (el) {
|
|
277
|
-
Array.prototype.forEach.call(el.length ? el : [el], destroy);
|
|
278
|
-
}
|
|
279
|
-
return el;
|
|
280
|
-
};
|
|
281
|
-
autosize.update = function (el) {
|
|
282
|
-
if (el) {
|
|
283
|
-
Array.prototype.forEach.call(el.length ? el : [el], update);
|
|
284
|
-
}
|
|
285
|
-
return el;
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
module.exports = autosize;
|
|
290
|
-
});
|