akkoma/priv/static/packs/share.js

2 lines
76 KiB
JavaScript
Raw Normal View History

webpackJsonp([26],{303:function(e,t,n){"use strict";n.d(t,"a",function(){return A});var o,a,i,r=n(2),s=n.n(r),c=n(1),l=n.n(c),u=n(3),d=n.n(u),p=n(4),h=n.n(p),m=n(0),f=n.n(m),g=n(304),v=n(102),y=n(13),b=n.n(y),k=n(5),_=n.n(k),w=n(305),x=n(307),C=n(312),j=n(6),O=n(314),S=n(315),M=n(317),D=n(319),N=n(320),T=n(322),P=n(328),F=n(35),z=n(11),I=n.n(z),E=n(99),R=(n.n(E),n(330)),q=n(12),U=Object(j.f)({placeholder:{id:"compose_form.placeholder",defaultMessage:"What is on your mind?"},spoiler_placeholder:{id:"compose_form.spoiler_placeholder",defaultMessage:"Write your warning here"},publish:{id:"compose_form.publish",defaultMessage:"Toot"},publishLoud:{id:"compose_form.publish_loud",defaultMessage:"{publish}!"}}),A=Object(j.g)((i=a=function(e){function t(){var n,o,a;l()(this,t);for(var i=arguments.length,r=Array(i),s=0;s<i;s++)r[s]=arguments[s];return n=o=d()(this,e.call.apply(e,[this].concat(r))),o.handleChange=function(e){o.props.onChange(e.target.value)},o.handleKeyDown=function(e){13===e.keyCode&&(e.ctrlKey||e.metaKey)&&o.handleSubmit()},o.handleSubmit=function(){o.props.text!==o.autosuggestTextarea.textarea.value&&o.props.onChange(o.autosuggestTextarea.textarea.value);var e=o.props,t=e.is_submitting,n=e.is_uploading,a=e.anyMedia,i=[o.props.spoiler_text,Object(R.a)(o.props.text)].join("");t||n||Object(E.length)(i)>q.c||0!==i.length&&0===i.trim().length&&!a||o.props.onSubmit()},o.onSuggestionsClearRequested=function(){o.props.onClearSuggestions()},o.onSuggestionsFetchRequested=function(e){o.props.onFetchSuggestions(e)},o.onSuggestionSelected=function(e,t,n){o._restoreCaret=null,o.props.onSuggestionSelected(e,t,n)},o.handleChangeSpoilerText=function(e){o.props.onChangeSpoilerText(e.target.value)},o.setAutosuggestTextarea=function(e){o.autosuggestTextarea=e},o.handleEmojiPick=function(e){var t=o.autosuggestTextarea.textarea.selectionStart,n=e.native;o._restoreCaret=t+n.length+1,o.props.onPickEmoji(t,e)},a=n,d()(o,a)}return h()(t,e),t.prototype.componentWillReceiveProps=function(e){!e.is_uploading&&this.props.is_uploading&&(this._restoreCaret=this.autosuggestTextarea.textarea.selectionStart)},t.prototype.componentDidUpdate=function(e){if(this.props.focusDate!==e.focusDate||e.is_uploading&&!this.props.is_uploading&&"number"==typeof this._restoreCaret){var t=void 0,n=void 0;this.props.preselectDate!==e.preselectDate?(t=this.props.text.length,n=this.props.text.search(/\s/)+1):"number"==typeof this._restoreCaret?(n=this._restoreCaret,t=this._restoreCaret):(t=this.props.text.length,n=t),this.autosuggestTextarea.textarea.setSelectionRange(n,t),this.autosuggestTextarea.textarea.focus()}else e.is_submitting&&!this.props.is_submitting&&this.autosuggestTextarea.textarea.focus()},t.prototype.render=function(){var e=this.props,t=e.intl,n=e.onPaste,o=e.showSearch,a=e.anyMedia,i=this.props.is_submitting,r=[this.props.spoiler_text,Object(R.a)(this.props.text)].join(""),c=i||this.props.is_uploading||Object(E.length)(r)>q.c||0!==r.length&&0===r.trim().length&&!a,l="";return l="private"===this.props.privacy||"direct"===this.props.privacy?s()("span",{className:"compose-form__publish-private"},void 0,s()("i",{className:"fa fa-lock"})," ",t.formatMessage(U.publish)):"unlisted"!==this.props.privacy?t.formatMessage(U.publishLoud,{publish:t.formatMessage(U.publish)}):t.formatMessage(U.publish),s()("div",{className:"compose-form"},void 0,s()(P.a,{}),s()(O.a,{isVisible:this.props.spoiler,fullHeight:50},void 0,s()("div",{className:"spoiler-input"},void 0,s()("label",{},void 0,s()("span",{style:{display:"none"}},void 0,t.formatMessage(U.spoiler_placeholder)),s()("input",{placeholder:t.formatMessage(U.spoiler_placeholder),value:this.props.spoiler_text,onChange:this.handleChangeSpoilerText,onKeyDown:this.handleKeyDown,type:"text",className:"spoiler-input__input",id:"cw-spoiler-input"})))),s()(w.a,{}),s()("div",{className:"compose-form__autosuggest-wrapper"},void 0,f.a.createElement(x.a,{ref:this.setAutosuggestTextarea,placeholder:t.formatMessage(U.placeholder),disabled:i,value:this.props.text,onChange:this.handleChange,suggestions:this.props.suggestions,onKey
//# sourceMappingURL=share.js.map