From 496edece798ecece1d96eba1439a547f882d2fdc Mon Sep 17 00:00:00 2001 From: Clark Winkelmann Date: Wed, 6 Jan 2021 14:50:07 +0100 Subject: [PATCH] Backport fix for #22 for beta 13 --- js/dist/admin.js | 2 +- js/dist/admin.js.map | 2 +- js/src/admin/components/StringLocale.js | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/js/dist/admin.js b/js/dist/admin.js index 95f02db..d431768 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,2 +1,2 @@ -module.exports=function(t){var n={};function i(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=n,i.d=function(t,n,e){i.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,n){if(1&n&&(t=i(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(i.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var r in t)i.d(e,r,function(n){return t[n]}.bind(null,r));return e},i.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(n,"a",n),n},i.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},i.p="",i(i.s=14)}([function(t,n){t.exports=flarum.core.compat.app},function(t,n){t.exports=flarum.core.compat["components/Button"]},function(t,n){t.exports=flarum.core.compat.Model},function(t,n){t.exports=flarum.core.compat.Component},function(t,n){t.exports=flarum.core.compat["utils/mixin"]},function(t,n){t.exports=flarum.core.compat["components/Dropdown"]},function(t,n){t.exports=flarum.core.compat.extend},function(t,n){t.exports=flarum.core.compat["components/AdminNav"]},function(t,n){t.exports=flarum.core.compat["components/AdminLinkButton"]},function(t,n){t.exports=flarum.core.compat["components/ExtensionsPage"]},function(t,n){t.exports=flarum.core.compat["components/Alert"]},function(t,n){t.exports=flarum.core.compat["components/LoadingModal"]},function(t,n){t.exports=flarum.core.compat["utils/extractText"]},function(t,n){t.exports=flarum.core.compat["utils/ItemList"]},function(t,n,i){"use strict";i.r(n);var e=i(0),r=i.n(e);function o(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}var a=i(2),s=i.n(a),l=i(4),u=i.n(l),c=function(t){function n(){return t.apply(this,arguments)||this}return o(n,t),n}(u()(s.a,{key:s.a.attribute("key"),locales:s.a.attribute("locales")})),f=function(t){function n(){return t.apply(this,arguments)||this}return o(n,t),n.prototype.apiEndpoint=function(){return"/fof/linguist/strings"+(this.exists?"/"+this.data.id:"")},n}(u()(s.a,{key:s.a.attribute("key"),locale:s.a.attribute("locale"),value:s.a.attribute("value")})),h=i(6),p=i(7),g=i.n(p),d=i(8),y=i.n(d),v=i(3),w=i.n(v),b=i(1),x=i.n(b),F=i(5),k=i.n(F),O=i(9),L=i.n(O),T=i(10),S=i.n(T),I=i(11),B=i.n(I),E=i(12),K=i.n(E),N=function(){var t=[];for(var n in r.a.data.locales)r.a.data.locales.hasOwnProperty(n)&&t.push({key:n,name:r.a.data.locales[n]});return t},P=i(13),C=i.n(P),j=function(t,n){if(!n)return t;var i=n.toLowerCase(),e=new RegExp(i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"i");return t.replace(e,"$&").split("").map((function(t){return t.toLowerCase()===i?m("span.FoF-Linguist-Highlight",t):t}))},A=function(t){function n(){return t.apply(this,arguments)||this}o(n,t);var i=n.prototype;return i.init=function(){var t=this;this.stringKey=this.props.stringKey,this.locale=this.props.locale,this.localeKey=this.locale?this.locale.key:null,this.originalString=this.localeKey&&this.stringKey.locales().hasOwnProperty(this.localeKey)?this.stringKey.locales()[this.localeKey]:null,this.string=r.a.store.all("fof-linguist-string").find((function(n){return n.key()===t.stringKey.key()&&n.locale()===t.localeKey})),this.value=this.string?this.string.value():"",this.dirty=!1,this.processing=!1,this.inputType="input",(-1!==this.value.indexOf("\n")||this.originalString&&-1!==this.originalString.indexOf("\n"))&&(this.inputType="textarea")},i.view=function(){var t=this,n=this.originalString?this.originalString:"("+r.a.translator.trans("fof-linguist.admin.placeholder."+(this.localeKey?"not-translated":"all-locales"))+")";return m(".FoF-Linguist-Locale",[m("label.FoF-Linguist-Label",this.localeName()),m(".FoF-Linguist-Field",{className:(this.value?"FoF-Linguist-Field--with-value":"")+(this.originalString?" FoF-Linguist-Field--with-original-string":""),title:n},[m(".FoF-Linguist-Field-Wrap",[m(this.inputType,{className:"FormControl FoF-Linguist-Input",value:this.value,oninput:m.withAttr("value",(function(n){t.value=n,t.dirty=!0,t.value||t.string||(t.dirty=!1)})),disabled:this.processing}),m(".FoF-Linguist-Placeholder",[m("span.FoF-Linguist-Placeholder-Hint",r.a.translator.trans("fof-linguist.admin.placeholder.hint"))," ",m("span",this.originalString?j(n,this.props.highlight):n)])])]),m(".FoF-Linguist-Controls",this.actions().toArray())])},i.localeName=function(){return this.locale?[this.locale.name+" (",m("code",this.locale.key),")"]:r.a.translator.trans("fof-linguist.admin.locales.all")},i.actions=function(){var t=this,n=new C.a;return n.add("apply",x.a.component({type:"button",className:"Button Button--primary",children:r.a.translator.trans("fof-linguist.admin.buttons.apply"),loading:this.processing,disabled:!this.dirty,onclick:function(){t.saveString()}})),n.add("reset",x.a.component({type:"button",className:"Button",children:r.a.translator.trans("fof-linguist.admin.buttons.reset"),loading:this.processing,disabled:!this.dirty&&!this.string,onclick:function(){t.deleteString()}})),this.originalString&&n.add("copy-original",x.a.component({type:"button",className:"Button",children:r.a.translator.trans("fof-linguist.admin.buttons.copy-original"),loading:this.processing,onclick:function(){t.value=t.originalString,t.dirty=!0}})),n},i.saveString=function(){var t=this;this.value?(this.string||(this.string=r.a.store.createRecord("fof-linguist-string",{attributes:{key:this.stringKey.key(),locale:this.localeKey,value:""}})),this.string.data.attributes.value=this.value,this.string.locale()||delete this.string.data.attributes.locale,this.processing=!0,this.string.save(this.string.data.attributes).then((function(){t.processing=!1,t.dirty=!1,t.props.onchange(),m.redraw()})).catch((function(n){throw t.processing=!1,n}))):this.deleteString()},i.deleteString=function(){var t=this;this.string?(this.processing=!0,this.string.delete().then((function(){t.processing=!1,t.dirty=!1,t.string=null,t.value="",t.props.onchange(),m.redraw()})).catch((function(n){throw t.processing=!1,n}))):(this.value="",this.dirty=!1)},n}(w.a),q=function(t){function n(){return t.apply(this,arguments)||this}return o(n,t),n.prototype.view=function(){var t=this.props,n=t.stringKey,i=t.highlight,e=t.onchange;return m(".FoF-Linguist-Key",[m(".FoF-Linguist-Key-Code",m("code",j(n.key(),i))),m(".FoF-Linguist-Locales",[N().map((function(t){return m(A,{key:t.key,locale:t,stringKey:n,highlight:i,onchange:e})})),m(A,{key:"all",locale:null,stringKey:n,highlight:i,onchange:e})])])},n}(w.a);function _(t,n){var i;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(i=function(t,n){if(!t)return;if("string"==typeof t)return M(t,n);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return M(t,n)}(t))||n&&t&&"number"==typeof t.length){i&&(t=i);var e=0;return function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(i=t[Symbol.iterator]()).next.bind(i)}function M(t,n){(null==n||n>t.length)&&(n=t.length);for(var i=0,e=new Array(n);in.length?x.a.component({className:"Button",onclick:function(){t.numberOfResultsToShow+=20}},r.a.translator.trans("fof-linguist.admin.buttons.load-more")):null])])},i.applyFilters=function(){var t=this;this.numberOfResultsToShow=20;var n=r.a.store.all("fof-linguist-string").map((function(t){return t.key()})),i="";this.filters.search&&(i=this.filters.search.toLowerCase()),this.results=r.a.store.all("fof-linguist-string-key").filter((function(e){if(t.filters.withOwnTranslations&&-1===n.indexOf(e.key()))return!1;for(var r,o=_(t.filters.withOriginalTranslationsInLocales);!(r=o()).done;){var a=r.value;if(!e.locales().hasOwnProperty(a))return!1}for(var s,l=_(t.filters.withoutOriginalTranslationsInLocales);!(s=l()).done;){var u=s.value;if(e.locales().hasOwnProperty(u))return!1}if(t.filters.forExtension&&0!==e.key().indexOf(t.filters.forExtension+"."))return!1;if(i){if(-1!==e.key().toLowerCase().indexOf(i))return!0;var c=e.locales();for(var f in c)if(c.hasOwnProperty(f)&&-1!==c[f].toLowerCase().indexOf(i))return!0;return!1}return!0})),m.redraw()},n}(w.a);r.a.initializers.add("fof-linguist",(function(t){t.store.models["fof-linguist-string-key"]=c,t.store.models["fof-linguist-string"]=f,r.a.routes["fof-linguist-strings"]={path:"/linguist",component:R.component()},r.a.extensionSettings["fof-linguist"]=function(){return m.route(r.a.route("fof-linguist-strings"))},Object(h.extend)(g.a.prototype,"items",(function(t){t.add("fof-linguist-strings",y.a.component({href:r.a.route("fof-linguist-strings"),icon:"fas fa-italic",children:r.a.translator.trans("fof-linguist.admin.menu.title"),description:r.a.translator.trans("fof-linguist.admin.menu.description")}))}))}))}]); +module.exports=function(t){var n={};function i(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=n,i.d=function(t,n,e){i.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,n){if(1&n&&(t=i(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(i.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var r in t)i.d(e,r,function(n){return t[n]}.bind(null,r));return e},i.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(n,"a",n),n},i.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},i.p="",i(i.s=14)}([function(t,n){t.exports=flarum.core.compat.app},function(t,n){t.exports=flarum.core.compat["components/Button"]},function(t,n){t.exports=flarum.core.compat.Model},function(t,n){t.exports=flarum.core.compat.Component},function(t,n){t.exports=flarum.core.compat["utils/mixin"]},function(t,n){t.exports=flarum.core.compat["components/Dropdown"]},function(t,n){t.exports=flarum.core.compat.extend},function(t,n){t.exports=flarum.core.compat["components/AdminNav"]},function(t,n){t.exports=flarum.core.compat["components/AdminLinkButton"]},function(t,n){t.exports=flarum.core.compat["components/ExtensionsPage"]},function(t,n){t.exports=flarum.core.compat["components/Alert"]},function(t,n){t.exports=flarum.core.compat["components/LoadingModal"]},function(t,n){t.exports=flarum.core.compat["utils/extractText"]},function(t,n){t.exports=flarum.core.compat["utils/ItemList"]},function(t,n,i){"use strict";i.r(n);var e=i(0),r=i.n(e);function o(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}var a=i(2),s=i.n(a),l=i(4),u=i.n(l),c=function(t){function n(){return t.apply(this,arguments)||this}return o(n,t),n}(u()(s.a,{key:s.a.attribute("key"),locales:s.a.attribute("locales")})),f=function(t){function n(){return t.apply(this,arguments)||this}return o(n,t),n.prototype.apiEndpoint=function(){return"/fof/linguist/strings"+(this.exists?"/"+this.data.id:"")},n}(u()(s.a,{key:s.a.attribute("key"),locale:s.a.attribute("locale"),value:s.a.attribute("value")})),h=i(6),p=i(7),g=i.n(p),d=i(8),y=i.n(d),v=i(3),w=i.n(v),b=i(1),x=i.n(b),F=i(5),k=i.n(F),O=i(9),L=i.n(O),T=i(10),S=i.n(T),I=i(11),K=i.n(I),B=i(12),E=i.n(B),N=function(){var t=[];for(var n in r.a.data.locales)r.a.data.locales.hasOwnProperty(n)&&t.push({key:n,name:r.a.data.locales[n]});return t},P=i(13),j=i.n(P),C=function(t,n){if(!n)return t;var i=n.toLowerCase(),e=new RegExp(i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"i");return t.replace(e,"$&").split("").map((function(t){return t.toLowerCase()===i?m("span.FoF-Linguist-Highlight",t):t}))},A=function(t){function n(){return t.apply(this,arguments)||this}o(n,t);var i=n.prototype;return i.init=function(){var t=this;this.stringKey=this.props.stringKey,this.locale=this.props.locale,this.localeKey=this.locale?this.locale.key:null,this.originalString=this.localeKey&&this.stringKey.locales().hasOwnProperty(this.localeKey)?this.stringKey.locales()[this.localeKey]:null,this.string=r.a.store.all("fof-linguist-string").find((function(n){return n.key()===t.stringKey.key()&&n.locale()===t.localeKey})),this.value=this.string?this.string.value():"",this.dirty=!1,this.processing=!1;var n=Object.keys(this.stringKey.locales()).some((function(n){return-1!==t.stringKey.locales()[n].indexOf("\n")}));this.inputType="input",(n||-1!==this.value.indexOf("\n"))&&(this.inputType="textarea")},i.view=function(){var t=this,n=this.originalString?this.originalString:"("+r.a.translator.trans("fof-linguist.admin.placeholder."+(this.localeKey?"not-translated":"all-locales"))+")";return m(".FoF-Linguist-Locale",[m("label.FoF-Linguist-Label",this.localeName()),m(".FoF-Linguist-Field",{className:(this.value?"FoF-Linguist-Field--with-value":"")+(this.originalString?" FoF-Linguist-Field--with-original-string":""),title:n},[m(".FoF-Linguist-Field-Wrap",[m(this.inputType,{className:"FormControl FoF-Linguist-Input",value:this.value,oninput:m.withAttr("value",(function(n){t.value=n,t.dirty=!0,t.value||t.string||(t.dirty=!1)})),disabled:this.processing}),m(".FoF-Linguist-Placeholder",[m("span.FoF-Linguist-Placeholder-Hint",r.a.translator.trans("fof-linguist.admin.placeholder.hint"))," ",m("span",this.originalString?C(n,this.props.highlight):n)])])]),m(".FoF-Linguist-Controls",this.actions().toArray())])},i.localeName=function(){return this.locale?[this.locale.name+" (",m("code",this.locale.key),")"]:r.a.translator.trans("fof-linguist.admin.locales.all")},i.actions=function(){var t=this,n=new j.a;return n.add("apply",x.a.component({type:"button",className:"Button Button--primary",children:r.a.translator.trans("fof-linguist.admin.buttons.apply"),loading:this.processing,disabled:!this.dirty,onclick:function(){t.saveString()}})),n.add("reset",x.a.component({type:"button",className:"Button",children:r.a.translator.trans("fof-linguist.admin.buttons.reset"),loading:this.processing,disabled:!this.dirty&&!this.string,onclick:function(){t.deleteString()}})),this.originalString&&n.add("copy-original",x.a.component({type:"button",className:"Button",children:r.a.translator.trans("fof-linguist.admin.buttons.copy-original"),loading:this.processing,onclick:function(){t.value=t.originalString,t.dirty=!0}})),n},i.saveString=function(){var t=this;this.value?(this.string||(this.string=r.a.store.createRecord("fof-linguist-string",{attributes:{key:this.stringKey.key(),locale:this.localeKey,value:""}})),this.string.data.attributes.value=this.value,this.string.locale()||delete this.string.data.attributes.locale,this.processing=!0,this.string.save(this.string.data.attributes).then((function(){t.processing=!1,t.dirty=!1,t.props.onchange(),m.redraw()})).catch((function(n){throw t.processing=!1,n}))):this.deleteString()},i.deleteString=function(){var t=this;this.string?(this.processing=!0,this.string.delete().then((function(){t.processing=!1,t.dirty=!1,t.string=null,t.value="",t.props.onchange(),m.redraw()})).catch((function(n){throw t.processing=!1,n}))):(this.value="",this.dirty=!1)},n}(w.a),q=function(t){function n(){return t.apply(this,arguments)||this}return o(n,t),n.prototype.view=function(){var t=this.props,n=t.stringKey,i=t.highlight,e=t.onchange;return m(".FoF-Linguist-Key",[m(".FoF-Linguist-Key-Code",m("code",C(n.key(),i))),m(".FoF-Linguist-Locales",[N().map((function(t){return m(A,{key:t.key,locale:t,stringKey:n,highlight:i,onchange:e})})),m(A,{key:"all",locale:null,stringKey:n,highlight:i,onchange:e})])])},n}(w.a);function _(t,n){var i;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(i=function(t,n){if(!t)return;if("string"==typeof t)return M(t,n);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return M(t,n)}(t))||n&&t&&"number"==typeof t.length){i&&(t=i);var e=0;return function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(i=t[Symbol.iterator]()).next.bind(i)}function M(t,n){(null==n||n>t.length)&&(n=t.length);for(var i=0,e=new Array(n);in.length?x.a.component({className:"Button",onclick:function(){t.numberOfResultsToShow+=20}},r.a.translator.trans("fof-linguist.admin.buttons.load-more")):null])])},i.applyFilters=function(){var t=this;this.numberOfResultsToShow=20;var n=r.a.store.all("fof-linguist-string").map((function(t){return t.key()})),i="";this.filters.search&&(i=this.filters.search.toLowerCase()),this.results=r.a.store.all("fof-linguist-string-key").filter((function(e){if(t.filters.withOwnTranslations&&-1===n.indexOf(e.key()))return!1;for(var r,o=_(t.filters.withOriginalTranslationsInLocales);!(r=o()).done;){var a=r.value;if(!e.locales().hasOwnProperty(a))return!1}for(var s,l=_(t.filters.withoutOriginalTranslationsInLocales);!(s=l()).done;){var u=s.value;if(e.locales().hasOwnProperty(u))return!1}if(t.filters.forExtension&&0!==e.key().indexOf(t.filters.forExtension+"."))return!1;if(i){if(-1!==e.key().toLowerCase().indexOf(i))return!0;var c=e.locales();for(var f in c)if(c.hasOwnProperty(f)&&-1!==c[f].toLowerCase().indexOf(i))return!0;return!1}return!0})),m.redraw()},n}(w.a);r.a.initializers.add("fof-linguist",(function(t){t.store.models["fof-linguist-string-key"]=c,t.store.models["fof-linguist-string"]=f,r.a.routes["fof-linguist-strings"]={path:"/linguist",component:R.component()},r.a.extensionSettings["fof-linguist"]=function(){return m.route(r.a.route("fof-linguist-strings"))},Object(h.extend)(g.a.prototype,"items",(function(t){t.add("fof-linguist-strings",y.a.component({href:r.a.route("fof-linguist-strings"),icon:"fas fa-italic",children:r.a.translator.trans("fof-linguist.admin.menu.title"),description:r.a.translator.trans("fof-linguist.admin.menu.description")}))}))}))}]); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index 5d76d9f..5332f48 100644 --- a/js/dist/admin.js.map +++ b/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://@fof/linguist/webpack/bootstrap","webpack://@fof/linguist/external \"flarum.core.compat['app']\"","webpack://@fof/linguist/external \"flarum.core.compat['components/Button']\"","webpack://@fof/linguist/external \"flarum.core.compat['Model']\"","webpack://@fof/linguist/external \"flarum.core.compat['Component']\"","webpack://@fof/linguist/external \"flarum.core.compat['utils/mixin']\"","webpack://@fof/linguist/external \"flarum.core.compat['components/Dropdown']\"","webpack://@fof/linguist/external \"flarum.core.compat['extend']\"","webpack://@fof/linguist/external \"flarum.core.compat['components/AdminNav']\"","webpack://@fof/linguist/external \"flarum.core.compat['components/AdminLinkButton']\"","webpack://@fof/linguist/external \"flarum.core.compat['components/ExtensionsPage']\"","webpack://@fof/linguist/external \"flarum.core.compat['components/Alert']\"","webpack://@fof/linguist/external \"flarum.core.compat['components/LoadingModal']\"","webpack://@fof/linguist/external \"flarum.core.compat['utils/extractText']\"","webpack://@fof/linguist/external \"flarum.core.compat['utils/ItemList']\"","webpack://@fof/linguist/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/linguist/./src/admin/models/StringKey.js","webpack://@fof/linguist/./src/admin/models/TextString.js","webpack://@fof/linguist/./src/admin/utils/localesAsArray.js","webpack://@fof/linguist/./src/admin/utils/highlightMithril.js","webpack://@fof/linguist/./src/admin/components/StringLocale.js","webpack://@fof/linguist/./src/admin/components/StringKey.js","webpack://@fof/linguist/./src/admin/panes/LinguistStringsPane.js","webpack://@fof/linguist/./src/admin/index.js","webpack://@fof/linguist/./src/admin/addLinguistStringsPane.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","_inheritsLoose","subClass","superClass","constructor","__proto__","StringKey","mixin","Model","attribute","locales","TextString","apiEndpoint","this","exists","data","id","locale","app","push","string","highlight","lowercaseHighliht","toLowerCase","regex","RegExp","replace","HIGHLIGHT_DELIMITER","split","map","text","StringLocale","init","stringKey","props","localeKey","originalString","store","all","find","dirty","processing","inputType","indexOf","view","placeholderText","translator","trans","localeName","className","title","oninput","withAttr","disabled","highlightMithril","actions","toArray","items","ItemList","add","Button","component","type","children","loading","onclick","saveString","deleteString","createRecord","attributes","save","then","onchange","redraw","err","Component","localesAsArray","LinguistStringsPane","numberOfResultsToShow","filters","search","withOwnTranslations","withOriginalTranslationsInLocales","withoutOriginalTranslationsInLocales","forExtension","results","extensions","sync","request","method","url","forum","result","pushPayload","keys","forEach","extensionId","extension","ExtensionsPage","isEnabled","extra","canBeTranslated","findIndex","applyFilters","slice","settings","Alert","dismissible","controls","modal","show","LoadingModal","window","location","reload","placeholder","icon","Dropdown","buttonClassName","label","extensionData","event","stopPropagation","alert","extractText","namespace","length","includes","filter","shown","total","keysWithCustomTranslations","lowercaseSearch","initializers","models","routes","path","extensionSettings","route","extend","AdminNav","AdminLinkButton","href","description"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAo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UAEpB,IAAK,IAAIO,KAAUP,EACf,GAAIA,EAAQf,eAAesB,KAAuE,IAA5DP,EAAQO,GAAQM,cAAcoB,QAAQyF,GACxE,OAAO,EAIf,OAAO,EAGX,OAAO,KAGXlK,EAAEuG,U,GAnPuCE,KCRjDzD,IAAImH,aAAa1E,IAAI,gBAAgB,SAAAzC,GACjCA,EAAImB,MAAMiG,OAAO,2BAA6BhI,EAC9CY,EAAImB,MAAMiG,OAAO,uBAAyB3H,ECA1CO,IAAIqH,OAAO,wBAA0B,CACjCC,KAAM,YACN3E,UAAWgB,EAAoBhB,aAGnC3C,IAAIuH,kBAAkB,gBAAkB,kBAAMvK,EAAEwK,MAAMxH,IAAIwH,MAAM,0BAEhEC,iBAAOC,IAASlJ,UAAW,SAAS,SAAA+D,GAChCA,EAAME,IAAI,uBAAwBkF,IAAgBhF,UAAU,CACxDiF,KAAM5H,IAAIwH,MAAM,wBAChBtB,KAAM,gBACNrD,SAAU7C,IAAI4B,WAAWC,MAAM,iCAC/BgG,YAAa7H,IAAI4B,WAAWC,MAAM","file":"admin.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 14);\n","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['utils/mixin'];","module.exports = flarum.core.compat['components/Dropdown'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['components/AdminNav'];","module.exports = flarum.core.compat['components/AdminLinkButton'];","module.exports = flarum.core.compat['components/ExtensionsPage'];","module.exports = flarum.core.compat['components/Alert'];","module.exports = flarum.core.compat['components/LoadingModal'];","module.exports = flarum.core.compat['utils/extractText'];","module.exports = flarum.core.compat['utils/ItemList'];","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\n\nexport default class StringKey extends mixin(Model, {\n key: Model.attribute('key'),\n locales: Model.attribute('locales'),\n}) {\n //\n}\n","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\n\nexport default class TextString extends mixin(Model, {\n key: Model.attribute('key'),\n locale: Model.attribute('locale'),\n value: Model.attribute('value'),\n}) {\n /**\n * @inheritDoc\n */\n apiEndpoint() {\n return '/fof/linguist/strings' + (this.exists ? '/' + this.data.id : '');\n }\n}\n","import app from 'flarum/app';\n\nexport default function () {\n let locales = [];\n\n for (let key in app.data.locales) {\n if (!app.data.locales.hasOwnProperty(key)) {\n continue;\n }\n\n locales.push({\n key,\n name: app.data.locales[key],\n });\n }\n\n return locales;\n}\n","const HIGHLIGHT_DELIMITER = '';\n\n// Takes a string and highlight a keyword with a span with mithril template\n// The output will be an array if a keyword is given\nexport default function (string, highlight) {\n if (!highlight) {\n return string;\n }\n\n const lowercaseHighliht = highlight.toLowerCase();\n\n // Regex to match the highlighted work in a case-insensitive manner\n const regex = new RegExp(lowercaseHighliht.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'), 'i');\n\n return string\n .replace(regex, HIGHLIGHT_DELIMITER + '$&' + HIGHLIGHT_DELIMITER)\n .split(HIGHLIGHT_DELIMITER)\n .map(text => {\n if (text.toLowerCase() === lowercaseHighliht) {\n return m('span.FoF-Linguist-Highlight', text);\n }\n\n return text;\n });\n}\n","import app from 'flarum/app';\nimport Component from 'flarum/Component';\nimport ItemList from 'flarum/utils/ItemList';\nimport Button from 'flarum/components/Button';\nimport highlightMithril from '../utils/highlightMithril';\n\nexport default class StringLocale extends Component {\n init() {\n this.stringKey = this.props.stringKey;\n this.locale = this.props.locale;\n this.localeKey = this.locale ? this.locale.key : null;\n this.originalString = this.localeKey && this.stringKey.locales().hasOwnProperty(this.localeKey) ? this.stringKey.locales()[this.localeKey] : null;\n\n this.string = app.store.all('fof-linguist-string').find(\n string => string.key() === this.stringKey.key() && string.locale() === this.localeKey\n );\n\n this.value = this.string ? this.string.value() : '';\n this.dirty = false;\n this.processing = false;\n\n this.inputType = 'input';\n\n if (this.value.indexOf('\\n') !== -1 || (this.originalString && this.originalString.indexOf('\\n') !== -1)) {\n this.inputType = 'textarea';\n }\n }\n\n view() {\n const placeholderText = this.originalString ? this.originalString : '(' + app.translator.trans('fof-linguist.admin.placeholder.' + (this.localeKey ? 'not-translated' : 'all-locales')) + ')';\n\n return m('.FoF-Linguist-Locale', [\n m('label.FoF-Linguist-Label', this.localeName()),\n m('.FoF-Linguist-Field', {\n className: (this.value ? 'FoF-Linguist-Field--with-value' : '') + (this.originalString ? ' FoF-Linguist-Field--with-original-string' : ''),\n title: placeholderText,\n }, [\n m('.FoF-Linguist-Field-Wrap', [\n m(this.inputType, {\n className: 'FormControl FoF-Linguist-Input',\n value: this.value,\n oninput: m.withAttr('value', value => {\n this.value = value;\n this.dirty = true;\n\n // Remove dirty state if the user erased his text without saving\n if (!this.value && !this.string) {\n this.dirty = false;\n }\n }),\n disabled: this.processing,\n }),\n m('.FoF-Linguist-Placeholder', [\n m('span.FoF-Linguist-Placeholder-Hint', app.translator.trans('fof-linguist.admin.placeholder.hint')),\n ' ',\n m('span', this.originalString ? highlightMithril(placeholderText, this.props.highlight) : placeholderText),\n ]),\n ]),\n ]),\n m('.FoF-Linguist-Controls', this.actions().toArray()),\n ]);\n }\n\n localeName() {\n if (this.locale) {\n return [this.locale.name + ' (', m('code', this.locale.key), ')'];\n } else {\n return app.translator.trans('fof-linguist.admin.locales.all');\n }\n }\n\n actions() {\n const items = new ItemList();\n\n items.add('apply', Button.component({\n type: 'button',\n className: 'Button Button--primary',\n children: app.translator.trans('fof-linguist.admin.buttons.apply'),\n loading: this.processing,\n disabled: !this.dirty,\n onclick: () => {\n this.saveString();\n },\n }));\n\n items.add('reset', Button.component({\n type: 'button',\n className: 'Button',\n children: app.translator.trans('fof-linguist.admin.buttons.reset'),\n loading: this.processing,\n disabled: !this.dirty && !this.string,\n onclick: () => {\n this.deleteString();\n },\n }));\n\n if (this.originalString) {\n items.add('copy-original', Button.component({\n type: 'button',\n className: 'Button',\n children: app.translator.trans('fof-linguist.admin.buttons.copy-original'),\n loading: this.processing,\n onclick: () => {\n this.value = this.originalString;\n this.dirty = true;\n },\n }));\n }\n\n return items;\n }\n\n saveString() {\n if (!this.value) {\n this.deleteString();\n\n return;\n }\n\n if (!this.string) {\n this.string = app.store.createRecord('fof-linguist-string', {\n attributes: {\n key: this.stringKey.key(),\n locale: this.localeKey,\n value: '',\n },\n });\n }\n\n this.string.data.attributes.value = this.value;\n\n if (!this.string.locale()) delete this.string.data.attributes.locale;\n\n this.processing = true;\n\n this.string.save(this.string.data.attributes).then(() => {\n this.processing = false;\n this.dirty = false;\n\n this.props.onchange();\n\n m.redraw();\n }).catch(err => {\n this.processing = false;\n\n throw err;\n });\n }\n\n deleteString() {\n if (this.string) {\n this.processing = true;\n\n this.string.delete().then(() => {\n this.processing = false;\n this.dirty = false;\n\n this.string = null;\n this.value = '';\n\n this.props.onchange();\n\n m.redraw();\n }).catch(err => {\n this.processing = false;\n\n throw err;\n });\n } else {\n this.value = '';\n this.dirty = false;\n }\n }\n}\n","import Component from 'flarum/Component';\nimport StringLocale from '../components/StringLocale';\nimport localesAsArray from '../utils/localesAsArray';\nimport highlightMithril from '../utils/highlightMithril';\n\nexport default class StringKey extends Component {\n view() {\n const {\n stringKey,\n highlight,\n onchange,\n } = this.props;\n\n return m('.FoF-Linguist-Key', [\n m('.FoF-Linguist-Key-Code', m('code', highlightMithril(stringKey.key(), highlight))),\n m('.FoF-Linguist-Locales', [\n localesAsArray().map(locale => m(StringLocale, {\n key: locale.key,\n locale,\n stringKey,\n highlight,\n onchange,\n })),\n m(StringLocale, {\n key: 'all',\n locale: null,\n stringKey,\n highlight,\n onchange,\n }),\n ]),\n ]);\n }\n}\n","import app from 'flarum/app';\nimport Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport Dropdown from 'flarum/components/Dropdown';\nimport ExtensionsPage from 'flarum/components/ExtensionsPage';\nimport Alert from 'flarum/components/Alert';\nimport LoadingModal from 'flarum/components/LoadingModal';\nimport extractText from 'flarum/utils/extractText';\nimport localesAsArray from '../utils/localesAsArray';\nimport StringKey from '../components/StringKey';\n\nconst RESULTS_PER_PAGE = 20;\n\nexport default class LinguistStringsPane extends Component {\n init() {\n this.numberOfResultsToShow = RESULTS_PER_PAGE;\n\n this.filters = {\n search: '',\n withOwnTranslations: false,\n withOriginalTranslationsInLocales: [],\n withoutOriginalTranslationsInLocales: [],\n forExtension: null,\n };\n\n this.results = [];\n\n this.extensions = [];\n\n m.sync([\n app.request({\n method: 'GET',\n url: app.forum.attribute('apiUrl') + '/fof/linguist/strings',\n }).then(result => {\n app.store.pushPayload(result);\n }),\n app.request({\n method: 'GET',\n url: app.forum.attribute('apiUrl') + '/fof/linguist/string-keys',\n }).then(result => {\n const keys = app.store.pushPayload(result);\n\n Object.keys(app.data.extensions).forEach(extensionId => {\n const extension = app.data.extensions[extensionId];\n\n // We don't show disabled extensions and language packs\n if (!ExtensionsPage.prototype.isEnabled(extensionId) || extension.extra.hasOwnProperty('flarum-locale')) {\n return;\n }\n\n this.extensions.push({\n extension,\n // canBeTranslated means translations exist with that extension's ID as prefix\n canBeTranslated: keys.findIndex(key => key.key().indexOf(extensionId + '.') === 0) !== -1,\n });\n });\n }),\n ]).then(() => {\n this.applyFilters();\n });\n }\n\n view() {\n const keys = this.results.slice(0, this.numberOfResultsToShow);\n\n return m('.container', [\n m('div', { // The div with key needs to be outside of the ternary operation because null would break DOM ordering\n key: 'clear-cache',\n }, app.data.settings['fof.linguist.should-clear-cache'] === '1' ? Alert.component({\n children: app.translator.trans('fof-linguist.admin.clear-cache.text'),\n dismissible: false,\n controls: [Button.component({\n className: 'Button Button--link',\n onclick() {\n // Same logic as in core StatusWidget\n app.modal.show(new LoadingModal());\n\n app.request({\n method: 'DELETE',\n url: app.forum.attribute('apiUrl') + '/cache',\n }).then(() => window.location.reload());\n },\n children: app.translator.trans('fof-linguist.admin.clear-cache.button'),\n })],\n }) : null),\n m('.FoF-Linguist-Filters', {\n key: 'filters',\n }, [\n m('input.FormControl', {\n key: 'search',\n value: this.filters.search,\n oninput: m.withAttr('value', value => {\n this.filters.search = value;\n this.applyFilters();\n }),\n placeholder: app.translator.trans('fof-linguist.admin.filters.search'),\n }),\n Button.component({\n className: 'Button' + (this.filters.withOwnTranslations ? ' FoF-Linguist-Filter--Selected' : ''),\n icon: `far fa-${this.filters.withOwnTranslations ? 'check-square' : 'square'}`,\n onclick: () => {\n this.filters.withOwnTranslations = !this.filters.withOwnTranslations;\n this.applyFilters();\n },\n }, app.translator.trans('fof-linguist.admin.filters.with-own-translations')),\n Dropdown.component({\n buttonClassName: 'Button' + (this.filters.forExtension ? ' FoF-Linguist-Filter--Selected' : ''),\n label: app.translator.trans('fof-linguist.admin.filters.for-extension'),\n }, this.extensions.map(\n extensionData => Button.component({\n className: 'Button' + (extensionData.canBeTranslated ? '' : ' disabled'),\n icon: `far fa-${this.filters.forExtension === extensionData.extension.id ? 'check-square' : 'square'}`,\n onclick: event => {\n if (!extensionData.canBeTranslated) {\n event.stopPropagation();\n\n // Provide an explanation why some extensions might not be offered for translation\n alert(extractText(app.translator.trans('fof-linguist.admin.filters.for-extension-unavailable', {\n namespace: extensionData.extension.id,\n })));\n\n return;\n }\n\n if (this.filters.forExtension === extensionData.extension.id) {\n this.filters.forExtension = null;\n } else {\n this.filters.forExtension = extensionData.extension.id;\n }\n\n this.applyFilters();\n },\n }, extensionData.extension.extra['flarum-extension'].title)\n )),\n Dropdown.component({\n buttonClassName: 'Button' + (this.filters.withoutOriginalTranslationsInLocales.length ? ' FoF-Linguist-Filter--Selected' : ''),\n label: app.translator.trans('fof-linguist.admin.filters.without-original-translations-in-locales'),\n }, localesAsArray().map(\n locale => Button.component({\n className: 'Button',\n icon: `far fa-${this.filters.withoutOriginalTranslationsInLocales.includes(locale.key) ? 'check-square' : 'square'}`,\n onclick: () => {\n if (this.filters.withoutOriginalTranslationsInLocales.indexOf(locale.key) !== -1) {\n this.filters.withoutOriginalTranslationsInLocales = this.filters.withoutOriginalTranslationsInLocales.filter(\n key => key !== locale.key\n );\n } else {\n this.filters.withoutOriginalTranslationsInLocales.push(locale.key);\n }\n\n this.applyFilters();\n },\n }, locale.name + ' (' + locale.key + ')')\n )),\n Dropdown.component({\n buttonClassName: 'Button' + (this.filters.withOriginalTranslationsInLocales.length ? ' FoF-Linguist-Filter--Selected' : ''),\n label: app.translator.trans('fof-linguist.admin.filters.with-original-translations-in-locales'),\n }, localesAsArray().map(\n locale => Button.component({\n className: 'Button',\n icon: `far fa-${this.filters.withOriginalTranslationsInLocales.includes(locale.key) ? 'check-square' : 'square'}`,\n onclick: () => {\n if (this.filters.withOriginalTranslationsInLocales.indexOf(locale.key) !== -1) {\n this.filters.withOriginalTranslationsInLocales = this.filters.withOriginalTranslationsInLocales.filter(\n key => key !== locale.key\n );\n } else {\n this.filters.withOriginalTranslationsInLocales.push(locale.key);\n }\n\n this.applyFilters();\n },\n }, locale.name + ' (' + locale.key + ')')\n )),\n ]),\n keys.map(stringKey => m(StringKey, {\n key: stringKey.id(),\n stringKey,\n highlight: this.filters.search,\n onchange: () => {\n // We use the setting and not a local variable because we need to preserve state\n // if we navigate away and back to the Linguist page without refreshing the admin panel\n app.data.settings['fof.linguist.should-clear-cache'] = '1';\n },\n })),\n m('.FoF-Linguist-Results', {\n key: 'results-stats',\n }, [\n app.translator.trans('fof-linguist.admin.filters.results', {\n shown: keys.length + '', // cast to string otherwise number isn't displayed\n total: this.results.length + '',\n }),\n ' ',\n (this.results.length > keys.length ? Button.component({\n className: 'Button',\n onclick: () => {\n this.numberOfResultsToShow += RESULTS_PER_PAGE;\n },\n }, app.translator.trans('fof-linguist.admin.buttons.load-more')) : null),\n ]),\n ]);\n }\n\n applyFilters() {\n this.numberOfResultsToShow = RESULTS_PER_PAGE;\n\n const keysWithCustomTranslations = app.store.all('fof-linguist-string').map(string => string.key());\n\n let lowercaseSearch = '';\n\n if (this.filters.search) {\n lowercaseSearch = this.filters.search.toLowerCase();\n }\n\n this.results = app.store.all('fof-linguist-string-key').filter(key => {\n if (this.filters.withOwnTranslations && keysWithCustomTranslations.indexOf(key.key()) === -1) {\n return false;\n }\n\n for (let locale of this.filters.withOriginalTranslationsInLocales) {\n if (!key.locales().hasOwnProperty(locale)) {\n return false;\n }\n }\n\n for (let locale of this.filters.withoutOriginalTranslationsInLocales) {\n if (key.locales().hasOwnProperty(locale)) {\n return false;\n }\n }\n\n if (this.filters.forExtension) {\n if (key.key().indexOf(this.filters.forExtension + '.') !== 0) {\n return false;\n }\n }\n\n if (lowercaseSearch) {\n if (key.key().toLowerCase().indexOf(lowercaseSearch) !== -1) {\n return true;\n }\n\n const locales = key.locales();\n\n for (let locale in locales) {\n if (locales.hasOwnProperty(locale) && locales[locale].toLowerCase().indexOf(lowercaseSearch) !== -1) {\n return true;\n }\n }\n\n return false;\n }\n\n return true;\n });\n\n m.redraw();\n }\n}\n","import app from 'flarum/app';\nimport StringKey from './models/StringKey';\nimport TextString from './models/TextString';\nimport addLinguistStringsPane from './addLinguistStringsPane';\n\napp.initializers.add('fof-linguist', app => {\n app.store.models['fof-linguist-string-key'] = StringKey;\n app.store.models['fof-linguist-string'] = TextString;\n\n addLinguistStringsPane();\n});\n","import {extend} from 'flarum/extend';\nimport app from 'flarum/app';\nimport AdminNav from 'flarum/components/AdminNav';\nimport AdminLinkButton from 'flarum/components/AdminLinkButton';\nimport LinguistStringsPane from './panes/LinguistStringsPane';\n\nexport default function () {\n app.routes['fof-linguist-strings'] = {\n path: '/linguist',\n component: LinguistStringsPane.component(),\n };\n\n app.extensionSettings['fof-linguist'] = () => m.route(app.route('fof-linguist-strings'));\n\n extend(AdminNav.prototype, 'items', items => {\n items.add('fof-linguist-strings', AdminLinkButton.component({\n href: app.route('fof-linguist-strings'),\n icon: 'fas fa-italic',\n children: app.translator.trans('fof-linguist.admin.menu.title'),\n description: app.translator.trans('fof-linguist.admin.menu.description'),\n }));\n });\n}\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/linguist/webpack/bootstrap","webpack://@fof/linguist/external \"flarum.core.compat['app']\"","webpack://@fof/linguist/external \"flarum.core.compat['components/Button']\"","webpack://@fof/linguist/external \"flarum.core.compat['Model']\"","webpack://@fof/linguist/external \"flarum.core.compat['Component']\"","webpack://@fof/linguist/external \"flarum.core.compat['utils/mixin']\"","webpack://@fof/linguist/external \"flarum.core.compat['components/Dropdown']\"","webpack://@fof/linguist/external \"flarum.core.compat['extend']\"","webpack://@fof/linguist/external \"flarum.core.compat['components/AdminNav']\"","webpack://@fof/linguist/external \"flarum.core.compat['components/AdminLinkButton']\"","webpack://@fof/linguist/external \"flarum.core.compat['components/ExtensionsPage']\"","webpack://@fof/linguist/external \"flarum.core.compat['components/Alert']\"","webpack://@fof/linguist/external \"flarum.core.compat['components/LoadingModal']\"","webpack://@fof/linguist/external \"flarum.core.compat['utils/extractText']\"","webpack://@fof/linguist/external \"flarum.core.compat['utils/ItemList']\"","webpack://@fof/linguist/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/linguist/./src/admin/models/StringKey.js","webpack://@fof/linguist/./src/admin/models/TextString.js","webpack://@fof/linguist/./src/admin/utils/localesAsArray.js","webpack://@fof/linguist/./src/admin/utils/highlightMithril.js","webpack://@fof/linguist/./src/admin/components/StringLocale.js","webpack://@fof/linguist/./src/admin/components/StringKey.js","webpack://@fof/linguist/./src/admin/panes/LinguistStringsPane.js","webpack://@fof/linguist/./src/admin/index.js","webpack://@fof/linguist/./src/admin/addLinguistStringsPane.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","_inheritsLoose","subClass","superClass","constructor","__proto__","StringKey","mixin","Model","attribute","locales","TextString","apiEndpoint","this","exists","data","id","locale","app","push","string","highlight","lowercaseHighliht","toLowerCase","regex","RegExp","replace","HIGHLIGHT_DELIMITER","split","map","text","StringLocale","init","stringKey","props","localeKey","originalString","store","all","find","dirty","processing","originalHasNewLine","keys","some","indexOf","inputType","view","placeholderText","translator","trans","localeName","className","title","oninput","withAttr","disabled","highlightMithril","actions","toArray","items","ItemList","add","Button","component","type","children","loading","onclick","saveString","deleteString","createRecord","attributes","save","then","onchange","redraw","err","Component","localesAsArray","LinguistStringsPane","numberOfResultsToShow","filters","search","withOwnTranslations","withOriginalTranslationsInLocales","withoutOriginalTranslationsInLocales","forExtension","results","extensions","sync","request","method","url","forum","result","pushPayload","forEach","extensionId","extension","ExtensionsPage","isEnabled","extra","canBeTranslated","findIndex","applyFilters","slice","settings","Alert","dismissible","controls","modal","show","LoadingModal","window","location","reload","placeholder","icon","Dropdown","buttonClassName","label","extensionData","event","stopPropagation","alert","extractText","namespace","length","includes","filter","shown","total","keysWithCustomTranslations","lowercaseSearch","initializers","models","routes","path","extensionSettings","route","extend","AdminNav","AdminLinkButton","href","description"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA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5B,EAAIqB,UAAUf,eAAesB,GAC7B,OAAO,EAIf,GAAI,EAAKiE,QAAQK,cAC8C,IAAvDlG,EAAIA,MAAMwD,QAAQ,EAAKqC,QAAQK,aAAe,KAC9C,OAAO,EAIf,GAAI+C,EAAiB,CACjB,IAA0D,IAAtDjJ,EAAIA,MAAMkC,cAAcsB,QAAQyF,GAChC,OAAO,EAGX,IAAM5H,EAAUrB,EAAIqB,UAEpB,IAAK,IAAIO,KAAUP,EACf,GAAIA,EAAQf,eAAesB,KAAuE,IAA5DP,EAAQO,GAAQM,cAAcsB,QAAQyF,GACxE,OAAO,EAIf,OAAO,EAGX,OAAO,KAGXpK,EAAE0G,U,GAnPuCE,KCRjD5D,IAAIqH,aAAazE,IAAI,gBAAgB,SAAA5C,GACjCA,EAAImB,MAAMmG,OAAO,2BAA6BlI,EAC9CY,EAAImB,MAAMmG,OAAO,uBAAyB7H,ECA1CO,IAAIuH,OAAO,wBAA0B,CACjCC,KAAM,YACN1E,UAAWgB,EAAoBhB,aAGnC9C,IAAIyH,kBAAkB,gBAAkB,kBAAMzK,EAAE0K,MAAM1H,IAAI0H,MAAM,0BAEhEC,iBAAOC,IAASpJ,UAAW,SAAS,SAAAkE,GAChCA,EAAME,IAAI,uBAAwBiF,IAAgB/E,UAAU,CACxDgF,KAAM9H,IAAI0H,MAAM,wBAChBtB,KAAM,gBACNpD,SAAUhD,IAAI+B,WAAWC,MAAM,iCAC/B+F,YAAa/H,IAAI+B,WAAWC,MAAM","file":"admin.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 14);\n","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['utils/mixin'];","module.exports = flarum.core.compat['components/Dropdown'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['components/AdminNav'];","module.exports = flarum.core.compat['components/AdminLinkButton'];","module.exports = flarum.core.compat['components/ExtensionsPage'];","module.exports = flarum.core.compat['components/Alert'];","module.exports = flarum.core.compat['components/LoadingModal'];","module.exports = flarum.core.compat['utils/extractText'];","module.exports = flarum.core.compat['utils/ItemList'];","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\n\nexport default class StringKey extends mixin(Model, {\n key: Model.attribute('key'),\n locales: Model.attribute('locales'),\n}) {\n //\n}\n","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\n\nexport default class TextString extends mixin(Model, {\n key: Model.attribute('key'),\n locale: Model.attribute('locale'),\n value: Model.attribute('value'),\n}) {\n /**\n * @inheritDoc\n */\n apiEndpoint() {\n return '/fof/linguist/strings' + (this.exists ? '/' + this.data.id : '');\n }\n}\n","import app from 'flarum/app';\n\nexport default function () {\n let locales = [];\n\n for (let key in app.data.locales) {\n if (!app.data.locales.hasOwnProperty(key)) {\n continue;\n }\n\n locales.push({\n key,\n name: app.data.locales[key],\n });\n }\n\n return locales;\n}\n","const HIGHLIGHT_DELIMITER = '';\n\n// Takes a string and highlight a keyword with a span with mithril template\n// The output will be an array if a keyword is given\nexport default function (string, highlight) {\n if (!highlight) {\n return string;\n }\n\n const lowercaseHighliht = highlight.toLowerCase();\n\n // Regex to match the highlighted work in a case-insensitive manner\n const regex = new RegExp(lowercaseHighliht.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'), 'i');\n\n return string\n .replace(regex, HIGHLIGHT_DELIMITER + '$&' + HIGHLIGHT_DELIMITER)\n .split(HIGHLIGHT_DELIMITER)\n .map(text => {\n if (text.toLowerCase() === lowercaseHighliht) {\n return m('span.FoF-Linguist-Highlight', text);\n }\n\n return text;\n });\n}\n","import app from 'flarum/app';\nimport Component from 'flarum/Component';\nimport ItemList from 'flarum/utils/ItemList';\nimport Button from 'flarum/components/Button';\nimport highlightMithril from '../utils/highlightMithril';\n\nexport default class StringLocale extends Component {\n init() {\n this.stringKey = this.props.stringKey;\n this.locale = this.props.locale;\n this.localeKey = this.locale ? this.locale.key : null;\n this.originalString = this.localeKey && this.stringKey.locales().hasOwnProperty(this.localeKey) ? this.stringKey.locales()[this.localeKey] : null;\n\n this.string = app.store.all('fof-linguist-string').find(\n string => string.key() === this.stringKey.key() && string.locale() === this.localeKey\n );\n\n this.value = this.string ? this.string.value() : '';\n this.dirty = false;\n this.processing = false;\n\n // We check whether any original translation in any language has a newline\n // By not hard-coding to English, this should work pretty well even if the fallback locale is modified,\n // or if a text happens to not be available in the fallback language\n const originalHasNewLine = Object.keys(this.stringKey.locales()).some(key => this.stringKey.locales()[key].indexOf('\\n') !== -1);\n\n this.inputType = 'input';\n\n // We will enable multi-line editing if the original has a newline, or if the current custom value already has one\n if (originalHasNewLine || this.value.indexOf('\\n') !== -1) {\n this.inputType = 'textarea';\n }\n }\n\n view() {\n const placeholderText = this.originalString ? this.originalString : '(' + app.translator.trans('fof-linguist.admin.placeholder.' + (this.localeKey ? 'not-translated' : 'all-locales')) + ')';\n\n return m('.FoF-Linguist-Locale', [\n m('label.FoF-Linguist-Label', this.localeName()),\n m('.FoF-Linguist-Field', {\n className: (this.value ? 'FoF-Linguist-Field--with-value' : '') + (this.originalString ? ' FoF-Linguist-Field--with-original-string' : ''),\n title: placeholderText,\n }, [\n m('.FoF-Linguist-Field-Wrap', [\n m(this.inputType, {\n className: 'FormControl FoF-Linguist-Input',\n value: this.value,\n oninput: m.withAttr('value', value => {\n this.value = value;\n this.dirty = true;\n\n // Remove dirty state if the user erased his text without saving\n if (!this.value && !this.string) {\n this.dirty = false;\n }\n }),\n disabled: this.processing,\n }),\n m('.FoF-Linguist-Placeholder', [\n m('span.FoF-Linguist-Placeholder-Hint', app.translator.trans('fof-linguist.admin.placeholder.hint')),\n ' ',\n m('span', this.originalString ? highlightMithril(placeholderText, this.props.highlight) : placeholderText),\n ]),\n ]),\n ]),\n m('.FoF-Linguist-Controls', this.actions().toArray()),\n ]);\n }\n\n localeName() {\n if (this.locale) {\n return [this.locale.name + ' (', m('code', this.locale.key), ')'];\n } else {\n return app.translator.trans('fof-linguist.admin.locales.all');\n }\n }\n\n actions() {\n const items = new ItemList();\n\n items.add('apply', Button.component({\n type: 'button',\n className: 'Button Button--primary',\n children: app.translator.trans('fof-linguist.admin.buttons.apply'),\n loading: this.processing,\n disabled: !this.dirty,\n onclick: () => {\n this.saveString();\n },\n }));\n\n items.add('reset', Button.component({\n type: 'button',\n className: 'Button',\n children: app.translator.trans('fof-linguist.admin.buttons.reset'),\n loading: this.processing,\n disabled: !this.dirty && !this.string,\n onclick: () => {\n this.deleteString();\n },\n }));\n\n if (this.originalString) {\n items.add('copy-original', Button.component({\n type: 'button',\n className: 'Button',\n children: app.translator.trans('fof-linguist.admin.buttons.copy-original'),\n loading: this.processing,\n onclick: () => {\n this.value = this.originalString;\n this.dirty = true;\n },\n }));\n }\n\n return items;\n }\n\n saveString() {\n if (!this.value) {\n this.deleteString();\n\n return;\n }\n\n if (!this.string) {\n this.string = app.store.createRecord('fof-linguist-string', {\n attributes: {\n key: this.stringKey.key(),\n locale: this.localeKey,\n value: '',\n },\n });\n }\n\n this.string.data.attributes.value = this.value;\n\n if (!this.string.locale()) delete this.string.data.attributes.locale;\n\n this.processing = true;\n\n this.string.save(this.string.data.attributes).then(() => {\n this.processing = false;\n this.dirty = false;\n\n this.props.onchange();\n\n m.redraw();\n }).catch(err => {\n this.processing = false;\n\n throw err;\n });\n }\n\n deleteString() {\n if (this.string) {\n this.processing = true;\n\n this.string.delete().then(() => {\n this.processing = false;\n this.dirty = false;\n\n this.string = null;\n this.value = '';\n\n this.props.onchange();\n\n m.redraw();\n }).catch(err => {\n this.processing = false;\n\n throw err;\n });\n } else {\n this.value = '';\n this.dirty = false;\n }\n }\n}\n","import Component from 'flarum/Component';\nimport StringLocale from '../components/StringLocale';\nimport localesAsArray from '../utils/localesAsArray';\nimport highlightMithril from '../utils/highlightMithril';\n\nexport default class StringKey extends Component {\n view() {\n const {\n stringKey,\n highlight,\n onchange,\n } = this.props;\n\n return m('.FoF-Linguist-Key', [\n m('.FoF-Linguist-Key-Code', m('code', highlightMithril(stringKey.key(), highlight))),\n m('.FoF-Linguist-Locales', [\n localesAsArray().map(locale => m(StringLocale, {\n key: locale.key,\n locale,\n stringKey,\n highlight,\n onchange,\n })),\n m(StringLocale, {\n key: 'all',\n locale: null,\n stringKey,\n highlight,\n onchange,\n }),\n ]),\n ]);\n }\n}\n","import app from 'flarum/app';\nimport Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport Dropdown from 'flarum/components/Dropdown';\nimport ExtensionsPage from 'flarum/components/ExtensionsPage';\nimport Alert from 'flarum/components/Alert';\nimport LoadingModal from 'flarum/components/LoadingModal';\nimport extractText from 'flarum/utils/extractText';\nimport localesAsArray from '../utils/localesAsArray';\nimport StringKey from '../components/StringKey';\n\nconst RESULTS_PER_PAGE = 20;\n\nexport default class LinguistStringsPane extends Component {\n init() {\n this.numberOfResultsToShow = RESULTS_PER_PAGE;\n\n this.filters = {\n search: '',\n withOwnTranslations: false,\n withOriginalTranslationsInLocales: [],\n withoutOriginalTranslationsInLocales: [],\n forExtension: null,\n };\n\n this.results = [];\n\n this.extensions = [];\n\n m.sync([\n app.request({\n method: 'GET',\n url: app.forum.attribute('apiUrl') + '/fof/linguist/strings',\n }).then(result => {\n app.store.pushPayload(result);\n }),\n app.request({\n method: 'GET',\n url: app.forum.attribute('apiUrl') + '/fof/linguist/string-keys',\n }).then(result => {\n const keys = app.store.pushPayload(result);\n\n Object.keys(app.data.extensions).forEach(extensionId => {\n const extension = app.data.extensions[extensionId];\n\n // We don't show disabled extensions and language packs\n if (!ExtensionsPage.prototype.isEnabled(extensionId) || extension.extra.hasOwnProperty('flarum-locale')) {\n return;\n }\n\n this.extensions.push({\n extension,\n // canBeTranslated means translations exist with that extension's ID as prefix\n canBeTranslated: keys.findIndex(key => key.key().indexOf(extensionId + '.') === 0) !== -1,\n });\n });\n }),\n ]).then(() => {\n this.applyFilters();\n });\n }\n\n view() {\n const keys = this.results.slice(0, this.numberOfResultsToShow);\n\n return m('.container', [\n m('div', { // The div with key needs to be outside of the ternary operation because null would break DOM ordering\n key: 'clear-cache',\n }, app.data.settings['fof.linguist.should-clear-cache'] === '1' ? Alert.component({\n children: app.translator.trans('fof-linguist.admin.clear-cache.text'),\n dismissible: false,\n controls: [Button.component({\n className: 'Button Button--link',\n onclick() {\n // Same logic as in core StatusWidget\n app.modal.show(new LoadingModal());\n\n app.request({\n method: 'DELETE',\n url: app.forum.attribute('apiUrl') + '/cache',\n }).then(() => window.location.reload());\n },\n children: app.translator.trans('fof-linguist.admin.clear-cache.button'),\n })],\n }) : null),\n m('.FoF-Linguist-Filters', {\n key: 'filters',\n }, [\n m('input.FormControl', {\n key: 'search',\n value: this.filters.search,\n oninput: m.withAttr('value', value => {\n this.filters.search = value;\n this.applyFilters();\n }),\n placeholder: app.translator.trans('fof-linguist.admin.filters.search'),\n }),\n Button.component({\n className: 'Button' + (this.filters.withOwnTranslations ? ' FoF-Linguist-Filter--Selected' : ''),\n icon: `far fa-${this.filters.withOwnTranslations ? 'check-square' : 'square'}`,\n onclick: () => {\n this.filters.withOwnTranslations = !this.filters.withOwnTranslations;\n this.applyFilters();\n },\n }, app.translator.trans('fof-linguist.admin.filters.with-own-translations')),\n Dropdown.component({\n buttonClassName: 'Button' + (this.filters.forExtension ? ' FoF-Linguist-Filter--Selected' : ''),\n label: app.translator.trans('fof-linguist.admin.filters.for-extension'),\n }, this.extensions.map(\n extensionData => Button.component({\n className: 'Button' + (extensionData.canBeTranslated ? '' : ' disabled'),\n icon: `far fa-${this.filters.forExtension === extensionData.extension.id ? 'check-square' : 'square'}`,\n onclick: event => {\n if (!extensionData.canBeTranslated) {\n event.stopPropagation();\n\n // Provide an explanation why some extensions might not be offered for translation\n alert(extractText(app.translator.trans('fof-linguist.admin.filters.for-extension-unavailable', {\n namespace: extensionData.extension.id,\n })));\n\n return;\n }\n\n if (this.filters.forExtension === extensionData.extension.id) {\n this.filters.forExtension = null;\n } else {\n this.filters.forExtension = extensionData.extension.id;\n }\n\n this.applyFilters();\n },\n }, extensionData.extension.extra['flarum-extension'].title)\n )),\n Dropdown.component({\n buttonClassName: 'Button' + (this.filters.withoutOriginalTranslationsInLocales.length ? ' FoF-Linguist-Filter--Selected' : ''),\n label: app.translator.trans('fof-linguist.admin.filters.without-original-translations-in-locales'),\n }, localesAsArray().map(\n locale => Button.component({\n className: 'Button',\n icon: `far fa-${this.filters.withoutOriginalTranslationsInLocales.includes(locale.key) ? 'check-square' : 'square'}`,\n onclick: () => {\n if (this.filters.withoutOriginalTranslationsInLocales.indexOf(locale.key) !== -1) {\n this.filters.withoutOriginalTranslationsInLocales = this.filters.withoutOriginalTranslationsInLocales.filter(\n key => key !== locale.key\n );\n } else {\n this.filters.withoutOriginalTranslationsInLocales.push(locale.key);\n }\n\n this.applyFilters();\n },\n }, locale.name + ' (' + locale.key + ')')\n )),\n Dropdown.component({\n buttonClassName: 'Button' + (this.filters.withOriginalTranslationsInLocales.length ? ' FoF-Linguist-Filter--Selected' : ''),\n label: app.translator.trans('fof-linguist.admin.filters.with-original-translations-in-locales'),\n }, localesAsArray().map(\n locale => Button.component({\n className: 'Button',\n icon: `far fa-${this.filters.withOriginalTranslationsInLocales.includes(locale.key) ? 'check-square' : 'square'}`,\n onclick: () => {\n if (this.filters.withOriginalTranslationsInLocales.indexOf(locale.key) !== -1) {\n this.filters.withOriginalTranslationsInLocales = this.filters.withOriginalTranslationsInLocales.filter(\n key => key !== locale.key\n );\n } else {\n this.filters.withOriginalTranslationsInLocales.push(locale.key);\n }\n\n this.applyFilters();\n },\n }, locale.name + ' (' + locale.key + ')')\n )),\n ]),\n keys.map(stringKey => m(StringKey, {\n key: stringKey.id(),\n stringKey,\n highlight: this.filters.search,\n onchange: () => {\n // We use the setting and not a local variable because we need to preserve state\n // if we navigate away and back to the Linguist page without refreshing the admin panel\n app.data.settings['fof.linguist.should-clear-cache'] = '1';\n },\n })),\n m('.FoF-Linguist-Results', {\n key: 'results-stats',\n }, [\n app.translator.trans('fof-linguist.admin.filters.results', {\n shown: keys.length + '', // cast to string otherwise number isn't displayed\n total: this.results.length + '',\n }),\n ' ',\n (this.results.length > keys.length ? Button.component({\n className: 'Button',\n onclick: () => {\n this.numberOfResultsToShow += RESULTS_PER_PAGE;\n },\n }, app.translator.trans('fof-linguist.admin.buttons.load-more')) : null),\n ]),\n ]);\n }\n\n applyFilters() {\n this.numberOfResultsToShow = RESULTS_PER_PAGE;\n\n const keysWithCustomTranslations = app.store.all('fof-linguist-string').map(string => string.key());\n\n let lowercaseSearch = '';\n\n if (this.filters.search) {\n lowercaseSearch = this.filters.search.toLowerCase();\n }\n\n this.results = app.store.all('fof-linguist-string-key').filter(key => {\n if (this.filters.withOwnTranslations && keysWithCustomTranslations.indexOf(key.key()) === -1) {\n return false;\n }\n\n for (let locale of this.filters.withOriginalTranslationsInLocales) {\n if (!key.locales().hasOwnProperty(locale)) {\n return false;\n }\n }\n\n for (let locale of this.filters.withoutOriginalTranslationsInLocales) {\n if (key.locales().hasOwnProperty(locale)) {\n return false;\n }\n }\n\n if (this.filters.forExtension) {\n if (key.key().indexOf(this.filters.forExtension + '.') !== 0) {\n return false;\n }\n }\n\n if (lowercaseSearch) {\n if (key.key().toLowerCase().indexOf(lowercaseSearch) !== -1) {\n return true;\n }\n\n const locales = key.locales();\n\n for (let locale in locales) {\n if (locales.hasOwnProperty(locale) && locales[locale].toLowerCase().indexOf(lowercaseSearch) !== -1) {\n return true;\n }\n }\n\n return false;\n }\n\n return true;\n });\n\n m.redraw();\n }\n}\n","import app from 'flarum/app';\nimport StringKey from './models/StringKey';\nimport TextString from './models/TextString';\nimport addLinguistStringsPane from './addLinguistStringsPane';\n\napp.initializers.add('fof-linguist', app => {\n app.store.models['fof-linguist-string-key'] = StringKey;\n app.store.models['fof-linguist-string'] = TextString;\n\n addLinguistStringsPane();\n});\n","import {extend} from 'flarum/extend';\nimport app from 'flarum/app';\nimport AdminNav from 'flarum/components/AdminNav';\nimport AdminLinkButton from 'flarum/components/AdminLinkButton';\nimport LinguistStringsPane from './panes/LinguistStringsPane';\n\nexport default function () {\n app.routes['fof-linguist-strings'] = {\n path: '/linguist',\n component: LinguistStringsPane.component(),\n };\n\n app.extensionSettings['fof-linguist'] = () => m.route(app.route('fof-linguist-strings'));\n\n extend(AdminNav.prototype, 'items', items => {\n items.add('fof-linguist-strings', AdminLinkButton.component({\n href: app.route('fof-linguist-strings'),\n icon: 'fas fa-italic',\n children: app.translator.trans('fof-linguist.admin.menu.title'),\n description: app.translator.trans('fof-linguist.admin.menu.description'),\n }));\n });\n}\n"],"sourceRoot":""} \ No newline at end of file diff --git a/js/src/admin/components/StringLocale.js b/js/src/admin/components/StringLocale.js index 28a218e..551e3b2 100644 --- a/js/src/admin/components/StringLocale.js +++ b/js/src/admin/components/StringLocale.js @@ -19,9 +19,15 @@ export default class StringLocale extends Component { this.dirty = false; this.processing = false; + // We check whether any original translation in any language has a newline + // By not hard-coding to English, this should work pretty well even if the fallback locale is modified, + // or if a text happens to not be available in the fallback language + const originalHasNewLine = Object.keys(this.stringKey.locales()).some(key => this.stringKey.locales()[key].indexOf('\n') !== -1); + this.inputType = 'input'; - if (this.value.indexOf('\n') !== -1 || (this.originalString && this.originalString.indexOf('\n') !== -1)) { + // We will enable multi-line editing if the original has a newline, or if the current custom value already has one + if (originalHasNewLine || this.value.indexOf('\n') !== -1) { this.inputType = 'textarea'; } }