mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 09:41:49 +08:00
Registry and webpack
This commit is contained in:
parent
a18e64c47f
commit
3b2d3dc8bc
46
js/CustomLoader.js
Normal file
46
js/CustomLoader.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
// Hi early reviewer! I'm a temporary file and
|
||||
// will be moved to the Flarum webpack config soon!
|
||||
|
||||
const loaderUtils = require('loader-utils');
|
||||
|
||||
module.exports = function (source) {
|
||||
// Custom loader logic
|
||||
|
||||
// Exclude asynchronous modules
|
||||
if (!source.includes('//Flarum Asynchronous Module')) {
|
||||
|
||||
// Get the type of the module to be exported
|
||||
const location = loaderUtils.interpolateName(this, '[folder]/', {
|
||||
context: this.rootContext || this.context,
|
||||
});
|
||||
|
||||
// Get the name of module to be exported
|
||||
const moduleName = loaderUtils.interpolateName(this, '[name]', {
|
||||
context: this.rootContext || this.context,
|
||||
});
|
||||
|
||||
// Don't export low level files
|
||||
if (/.*\/(admin|forum)$/.test(location) || /(index|app|compat|FlarumRegistry)$/.test(moduleName)) {
|
||||
return source;
|
||||
}
|
||||
|
||||
let addition = "";
|
||||
|
||||
// Find the export names
|
||||
const matches = [...source.matchAll(/export\s+?(?:default\s?|function|abstract\s?|class)+?\s([^(\s<;]*)/gm)];
|
||||
matches.map(match => {
|
||||
let name = match[1]
|
||||
|
||||
if (!name || name === 'interface') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add code at the end of the file to add the file to registry
|
||||
addition += `\nwindow.flreg.add('${location}${name}', ${name})`
|
||||
});
|
||||
|
||||
return source + addition;
|
||||
} else {
|
||||
return source;
|
||||
}
|
||||
}
|
|
@ -7,5 +7,7 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
flarum.exports = [];
|
||||
|
||||
export * from './src/common';
|
||||
export * from './src/admin';
|
||||
|
|
2
js/dist/admin/flarum-core.js
vendored
2
js/dist/admin/flarum-core.js
vendored
File diff suppressed because one or more lines are too long
2
js/dist/admin/flarum-core.js.map
vendored
2
js/dist/admin/flarum-core.js.map
vendored
File diff suppressed because one or more lines are too long
1
js/dist/admin/flarum-core~runtime.js.map
vendored
1
js/dist/admin/flarum-core~runtime.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -1,2 +1,2 @@
|
|||
(()=>{"use strict";var e,r={},t={};function o(e){var n=t[e];if(void 0!==n)return n.exports;var l=t[e]={exports:{}};return r[e].call(l.exports,l,l.exports,o),l.exports}o.m=r,e=[],o.O=(r,t,n,l)=>{if(!t){var a=1/0;for(f=0;f<e.length;f++){for(var[t,n,l]=e[f],i=!0,u=0;u<t.length;u++)(!1&l||a>=l)&&Object.keys(o.O).every((e=>o.O[e](t[u])))?t.splice(u--,1):(i=!1,l<a&&(a=l));i&&(e.splice(f--,1),r=n())}return r}l=l||0;for(var f=e.length;f>0&&e[f-1][2]>l;f--)e[f]=e[f-1];e[f]=[t,n,l]},o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={120:0};o.O.j=r=>0===e[r];var r=(r,t)=>{var n,l,[a,i,u]=t,f=0;for(n in i)o.o(i,n)&&(o.m[n]=i[n]);for(u&&u(o),r&&r(t);f<a.length;f++)l=a[f],o.o(e,l)&&e[l]&&e[l][0](),e[a[f]]=0;o.O()},t=self.webpackChunkflarum_core=self.webpackChunkflarum_core||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),o.O()})();
|
||||
//# sourceMappingURL=flarum-core~runtime.js.map
|
||||
(()=>{"use strict";var e,r={},t={};function o(e){var n=t[e];if(void 0!==n)return n.exports;var l=t[e]={exports:{}};return r[e].call(l.exports,l,l.exports,o),l.exports}o.m=r,e=[],o.O=(r,t,n,l)=>{if(!t){var a=1/0;for(f=0;f<e.length;f++){for(var[t,n,l]=e[f],i=!0,u=0;u<t.length;u++)(!1&l||a>=l)&&Object.keys(o.O).every((e=>o.O[e](t[u])))?t.splice(u--,1):(i=!1,l<a&&(a=l));i&&(e.splice(f--,1),r=n())}return r}l=l||0;for(var f=e.length;f>0&&e[f-1][2]>l;f--)e[f]=e[f-1];e[f]=[t,n,l]},o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={93:0};o.O.j=r=>0===e[r];var r=(r,t)=>{var n,l,[a,i,u]=t,f=0;for(n in i)o.o(i,n)&&(o.m[n]=i[n]);for(u&&u(o),r&&r(t);f<a.length;f++)l=a[f],o.o(e,l)&&e[l]&&e[l][0](),e[a[f]]=0;o.O()},t=self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),o.O()})();
|
||||
//# sourceMappingURL=runtime.js.map
|
1
js/dist/admin/runtime.js.map
vendored
Normal file
1
js/dist/admin/runtime.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
2
js/dist/common/common.js
vendored
2
js/dist/common/common.js
vendored
File diff suppressed because one or more lines are too long
2
js/dist/common/common.js.map
vendored
2
js/dist/common/common.js.map
vendored
File diff suppressed because one or more lines are too long
2
js/dist/common/components/TextEditor.js
vendored
2
js/dist/common/components/TextEditor.js
vendored
File diff suppressed because one or more lines are too long
2
js/dist/common/components/TextEditor.js.map
vendored
2
js/dist/common/components/TextEditor.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -1,2 +1,2 @@
|
|||
(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[437],{2099:(t,s,e)=>{"use strict";e.r(s),e.d(s,{default:()=>a});var o=e(1788),i=e(8098),r=e(8165),n=e(9015),a=function(t){function s(){return t.apply(this,arguments)||this}(0,o.Z)(s,t),s.initAttrs=function(s){t.initAttrs.call(this,s),s.placeholder=s.placeholder||(0,r.Z)(app.translator.trans("core.forum.composer_discussion.body_placeholder")),s.submitLabel=s.submitLabel||app.translator.trans("core.forum.composer_discussion.submit_button"),s.confirmExit=s.confirmExit||(0,r.Z)(app.translator.trans("core.forum.composer_discussion.discard_confirmation")),s.titlePlaceholder=s.titlePlaceholder||(0,r.Z)(app.translator.trans("core.forum.composer_discussion.title_placeholder")),s.className="ComposerBody--discussion"};var e=s.prototype;return e.oninit=function(s){t.prototype.oninit.call(this,s),this.composer.fields.title=this.composer.fields.title||(0,n.Z)(""),this.title=this.composer.fields.title},e.headerItems=function(){var s=t.prototype.headerItems.call(this);return s.add("title",m("h3",null,app.translator.trans("core.forum.composer_discussion.title")),100),s.add("discussionTitle",m("h3",null,m("input",{className:"FormControl",bidi:this.title,placeholder:this.attrs.titlePlaceholder,disabled:!!this.attrs.disabled,onkeydown:this.onkeydown.bind(this)}))),s},e.onkeydown=function(t){13===t.which&&(t.preventDefault(),this.composer.editor.moveCursorTo(0)),t.redraw=!1},e.hasChanges=function(){return this.title()||this.composer.fields.content()},e.data=function(){return{title:this.title(),content:this.composer.fields.content()}},e.onsubmit=function(){var t=this;this.loading=!0;var s=this.data();app.store.createRecord("discussions").save(s).then((function(s){t.composer.hide(),app.discussions.refresh({deferClear:!0}),m.route.set(app.route.discussion(s))}),this.loaded.bind(this))},s}(i.Z)}}]);
|
||||
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[437],{3406:(t,s,e)=>{"use strict";e.r(s),e.d(s,{default:()=>a});var o=e(1788),i=e(4810),r=e(5731),n=e(1024),a=function(t){function s(){return t.apply(this,arguments)||this}(0,o.Z)(s,t),s.initAttrs=function(s){t.initAttrs.call(this,s),s.placeholder=s.placeholder||(0,r.Z)(app.translator.trans("core.forum.composer_discussion.body_placeholder")),s.submitLabel=s.submitLabel||app.translator.trans("core.forum.composer_discussion.submit_button"),s.confirmExit=s.confirmExit||(0,r.Z)(app.translator.trans("core.forum.composer_discussion.discard_confirmation")),s.titlePlaceholder=s.titlePlaceholder||(0,r.Z)(app.translator.trans("core.forum.composer_discussion.title_placeholder")),s.className="ComposerBody--discussion"};var e=s.prototype;return e.oninit=function(s){t.prototype.oninit.call(this,s),this.composer.fields.title=this.composer.fields.title||(0,n.Z)(""),this.title=this.composer.fields.title},e.headerItems=function(){var s=t.prototype.headerItems.call(this);return s.add("title",m("h3",null,app.translator.trans("core.forum.composer_discussion.title")),100),s.add("discussionTitle",m("h3",null,m("input",{className:"FormControl",bidi:this.title,placeholder:this.attrs.titlePlaceholder,disabled:!!this.attrs.disabled,onkeydown:this.onkeydown.bind(this)}))),s},e.onkeydown=function(t){13===t.which&&(t.preventDefault(),this.composer.editor.moveCursorTo(0)),t.redraw=!1},e.hasChanges=function(){return this.title()||this.composer.fields.content()},e.data=function(){return{title:this.title(),content:this.composer.fields.content()}},e.onsubmit=function(){var t=this;this.loading=!0;var s=this.data();app.store.createRecord("discussions").save(s).then((function(s){t.composer.hide(),app.discussions.refresh({deferClear:!0}),m.route.set(app.route.discussion(s))}),this.loaded.bind(this))},s}(i.Z)}}]);
|
||||
//# sourceMappingURL=DiscussionComposer.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"sources":["webpack://@flarum/core/./src/forum/components/DiscussionComposer.js"],"names":["DiscussionComposer","initAttrs","attrs","placeholder","extractText","app","translator","trans","submitLabel","confirmExit","titlePlaceholder","className","oninit","vnode","this","composer","fields","title","Stream","headerItems","items","add","bidi","disabled","onkeydown","bind","e","which","preventDefault","editor","moveCursorTo","redraw","hasChanges","content","data","onsubmit","loading","store","createRecord","save","then","discussion","hide","discussions","refresh","deferClear","m","route","set","loaded","ComposerBody"],"mappings":"mLAeqBA,E,6EACZC,UAAP,SAAiBC,GACf,EAAMD,UAAN,UAAgBC,GAEhBA,EAAMC,YAAcD,EAAMC,cAAeC,OAAYC,IAAIC,WAAWC,MAAM,oDAC1EL,EAAMM,YAAcN,EAAMM,aAAeH,IAAIC,WAAWC,MAAM,gDAC9DL,EAAMO,YAAcP,EAAMO,cAAeL,OAAYC,IAAIC,WAAWC,MAAM,wDAC1EL,EAAMQ,iBAAmBR,EAAMQ,mBAAoBN,OAAYC,IAAIC,WAAWC,MAAM,qDACpFL,EAAMS,UAAY,4B,2BAGpBC,OAAA,SAAOC,GACL,YAAMD,OAAN,UAAaC,GAEbC,KAAKC,SAASC,OAAOC,MAAQH,KAAKC,SAASC,OAAOC,QAASC,OAAO,IAOlEJ,KAAKG,MAAQH,KAAKC,SAASC,OAAOC,O,EAGpCE,YAAA,WACE,IAAMC,EAAQ,EAAH,UAASD,YAAT,WAiBX,OAfAC,EAAMC,IAAI,QAAS,YAAKhB,IAAIC,WAAWC,MAAM,yCAA+C,KAE5Fa,EAAMC,IACJ,kBACA,YACE,WACEV,UAAU,cACVW,KAAMR,KAAKG,MACXd,YAAaW,KAAKZ,MAAMQ,iBACxBa,WAAYT,KAAKZ,MAAMqB,SACvBC,UAAWV,KAAKU,UAAUC,KAAKX,UAK9BM,G,EASTI,UAAA,SAAUE,GACQ,KAAZA,EAAEC,QAEJD,EAAEE,iBACFd,KAAKC,SAASc,OAAOC,aAAa,IAGpCJ,EAAEK,QAAS,G,EAGbC,WAAA,WACE,OAAOlB,KAAKG,SAAWH,KAAKC,SAASC,OAAOiB,W,EAQ9CC,KAAA,WACE,MAAO,CACLjB,MAAOH,KAAKG,QACZgB,QAASnB,KAAKC,SAASC,OAAOiB,Y,EAIlCE,SAAA,WAAW,WACTrB,KAAKsB,SAAU,EAEf,IAAMF,EAAOpB,KAAKoB,OAElB7B,IAAIgC,MACDC,aAAa,eACbC,KAAKL,GACLM,MAAK,SAACC,GACL,EAAK1B,SAAS2B,OACdrC,IAAIsC,YAAYC,QAAQ,CAAEC,YAAY,IACtCC,EAAEC,MAAMC,IAAI3C,IAAI0C,MAAMN,WAAWA,MAChC3B,KAAKmC,OAAOxB,KAAKX,Q,GAzFsBoC","file":"forum/components/DiscussionComposer.js","sourcesContent":["import ComposerBody from './ComposerBody';\nimport extractText from '../../common/utils/extractText';\nimport Stream from '../../common/utils/Stream';\n\n/**\n * The `DiscussionComposer` component displays the composer content for starting\n * a new discussion. It adds a text field as a header control so the user can\n * enter the title of their discussion. It also overrides the `submit` and\n * `willExit` actions to account for the title.\n *\n * ### Attrs\n *\n * - All of the attrs for ComposerBody\n * - `titlePlaceholder`\n */\nexport default class DiscussionComposer extends ComposerBody {\n static initAttrs(attrs) {\n super.initAttrs(attrs);\n\n attrs.placeholder = attrs.placeholder || extractText(app.translator.trans('core.forum.composer_discussion.body_placeholder'));\n attrs.submitLabel = attrs.submitLabel || app.translator.trans('core.forum.composer_discussion.submit_button');\n attrs.confirmExit = attrs.confirmExit || extractText(app.translator.trans('core.forum.composer_discussion.discard_confirmation'));\n attrs.titlePlaceholder = attrs.titlePlaceholder || extractText(app.translator.trans('core.forum.composer_discussion.title_placeholder'));\n attrs.className = 'ComposerBody--discussion';\n }\n\n oninit(vnode) {\n super.oninit(vnode);\n\n this.composer.fields.title = this.composer.fields.title || Stream('');\n\n /**\n * The value of the title input.\n *\n * @type {Function}\n */\n this.title = this.composer.fields.title;\n }\n\n headerItems() {\n const items = super.headerItems();\n\n items.add('title', <h3>{app.translator.trans('core.forum.composer_discussion.title')}</h3>, 100);\n\n items.add(\n 'discussionTitle',\n <h3>\n <input\n className=\"FormControl\"\n bidi={this.title}\n placeholder={this.attrs.titlePlaceholder}\n disabled={!!this.attrs.disabled}\n onkeydown={this.onkeydown.bind(this)}\n />\n </h3>\n );\n\n return items;\n }\n\n /**\n * Handle the title input's keydown event. When the return key is pressed,\n * move the focus to the start of the text editor.\n *\n * @param {Event} e\n */\n onkeydown(e) {\n if (e.which === 13) {\n // Return\n e.preventDefault();\n this.composer.editor.moveCursorTo(0);\n }\n\n e.redraw = false;\n }\n\n hasChanges() {\n return this.title() || this.composer.fields.content();\n }\n\n /**\n * Get the data to submit to the server when the discussion is saved.\n *\n * @return {Object}\n */\n data() {\n return {\n title: this.title(),\n content: this.composer.fields.content(),\n };\n }\n\n onsubmit() {\n this.loading = true;\n\n const data = this.data();\n\n app.store\n .createRecord('discussions')\n .save(data)\n .then((discussion) => {\n this.composer.hide();\n app.discussions.refresh({ deferClear: true });\n m.route.set(app.route.discussion(discussion));\n }, this.loaded.bind(this));\n }\n}\n"],"sourceRoot":""}
|
||||
{"version":3,"sources":["webpack://@flarum/core/./src/forum/components/DiscussionComposer.js"],"names":["DiscussionComposer","initAttrs","attrs","placeholder","extractText","app","translator","trans","submitLabel","confirmExit","titlePlaceholder","className","oninit","vnode","this","composer","fields","title","Stream","headerItems","items","add","bidi","disabled","onkeydown","bind","e","which","preventDefault","editor","moveCursorTo","redraw","hasChanges","content","data","onsubmit","loading","store","createRecord","save","then","discussion","hide","discussions","refresh","deferClear","m","route","set","loaded","ComposerBody"],"mappings":"qLAeqBA,E,6EACZC,UAAP,SAAiBC,GACf,EAAMD,UAAN,UAAgBC,GAEhBA,EAAMC,YAAcD,EAAMC,cAAeC,OAAYC,IAAIC,WAAWC,MAAM,oDAC1EL,EAAMM,YAAcN,EAAMM,aAAeH,IAAIC,WAAWC,MAAM,gDAC9DL,EAAMO,YAAcP,EAAMO,cAAeL,OAAYC,IAAIC,WAAWC,MAAM,wDAC1EL,EAAMQ,iBAAmBR,EAAMQ,mBAAoBN,OAAYC,IAAIC,WAAWC,MAAM,qDACpFL,EAAMS,UAAY,4B,2BAGpBC,OAAA,SAAOC,GACL,YAAMD,OAAN,UAAaC,GAEbC,KAAKC,SAASC,OAAOC,MAAQH,KAAKC,SAASC,OAAOC,QAASC,OAAO,IAOlEJ,KAAKG,MAAQH,KAAKC,SAASC,OAAOC,O,EAGpCE,YAAA,WACE,IAAMC,EAAQ,EAAH,UAASD,YAAT,WAiBX,OAfAC,EAAMC,IAAI,QAAS,YAAKhB,IAAIC,WAAWC,MAAM,yCAA+C,KAE5Fa,EAAMC,IACJ,kBACA,YACE,WACEV,UAAU,cACVW,KAAMR,KAAKG,MACXd,YAAaW,KAAKZ,MAAMQ,iBACxBa,WAAYT,KAAKZ,MAAMqB,SACvBC,UAAWV,KAAKU,UAAUC,KAAKX,UAK9BM,G,EASTI,UAAA,SAAUE,GACQ,KAAZA,EAAEC,QAEJD,EAAEE,iBACFd,KAAKC,SAASc,OAAOC,aAAa,IAGpCJ,EAAEK,QAAS,G,EAGbC,WAAA,WACE,OAAOlB,KAAKG,SAAWH,KAAKC,SAASC,OAAOiB,W,EAQ9CC,KAAA,WACE,MAAO,CACLjB,MAAOH,KAAKG,QACZgB,QAASnB,KAAKC,SAASC,OAAOiB,Y,EAIlCE,SAAA,WAAW,WACTrB,KAAKsB,SAAU,EAEf,IAAMF,EAAOpB,KAAKoB,OAElB7B,IAAIgC,MACDC,aAAa,eACbC,KAAKL,GACLM,MAAK,SAACC,GACL,EAAK1B,SAAS2B,OACdrC,IAAIsC,YAAYC,QAAQ,CAAEC,YAAY,IACtCC,EAAEC,MAAMC,IAAI3C,IAAI0C,MAAMN,WAAWA,MAChC3B,KAAKmC,OAAOxB,KAAKX,Q,GAzFsBoC","file":"forum/components/DiscussionComposer.js","sourcesContent":["import ComposerBody from './ComposerBody';\nimport extractText from '../../common/utils/extractText';\nimport Stream from '../../common/utils/Stream';\n\n/**\n * The `DiscussionComposer` component displays the composer content for starting\n * a new discussion. It adds a text field as a header control so the user can\n * enter the title of their discussion. It also overrides the `submit` and\n * `willExit` actions to account for the title.\n *\n * ### Attrs\n *\n * - All of the attrs for ComposerBody\n * - `titlePlaceholder`\n */\nexport default class DiscussionComposer extends ComposerBody {\n static initAttrs(attrs) {\n super.initAttrs(attrs);\n\n attrs.placeholder = attrs.placeholder || extractText(app.translator.trans('core.forum.composer_discussion.body_placeholder'));\n attrs.submitLabel = attrs.submitLabel || app.translator.trans('core.forum.composer_discussion.submit_button');\n attrs.confirmExit = attrs.confirmExit || extractText(app.translator.trans('core.forum.composer_discussion.discard_confirmation'));\n attrs.titlePlaceholder = attrs.titlePlaceholder || extractText(app.translator.trans('core.forum.composer_discussion.title_placeholder'));\n attrs.className = 'ComposerBody--discussion';\n }\n\n oninit(vnode) {\n super.oninit(vnode);\n\n this.composer.fields.title = this.composer.fields.title || Stream('');\n\n /**\n * The value of the title input.\n *\n * @type {Function}\n */\n this.title = this.composer.fields.title;\n }\n\n headerItems() {\n const items = super.headerItems();\n\n items.add('title', <h3>{app.translator.trans('core.forum.composer_discussion.title')}</h3>, 100);\n\n items.add(\n 'discussionTitle',\n <h3>\n <input\n className=\"FormControl\"\n bidi={this.title}\n placeholder={this.attrs.titlePlaceholder}\n disabled={!!this.attrs.disabled}\n onkeydown={this.onkeydown.bind(this)}\n />\n </h3>\n );\n\n return items;\n }\n\n /**\n * Handle the title input's keydown event. When the return key is pressed,\n * move the focus to the start of the text editor.\n *\n * @param {Event} e\n */\n onkeydown(e) {\n if (e.which === 13) {\n // Return\n e.preventDefault();\n this.composer.editor.moveCursorTo(0);\n }\n\n e.redraw = false;\n }\n\n hasChanges() {\n return this.title() || this.composer.fields.content();\n }\n\n /**\n * Get the data to submit to the server when the discussion is saved.\n *\n * @return {Object}\n */\n data() {\n return {\n title: this.title(),\n content: this.composer.fields.content(),\n };\n }\n\n onsubmit() {\n this.loading = true;\n\n const data = this.data();\n\n app.store\n .createRecord('discussions')\n .save(data)\n .then((discussion) => {\n this.composer.hide();\n app.discussions.refresh({ deferClear: true });\n m.route.set(app.route.discussion(discussion));\n }, this.loaded.bind(this));\n }\n}\n//Flarum Asynchronous Module\n"],"sourceRoot":""}
|
|
@ -1,2 +1,2 @@
|
|||
(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[799],{3928:(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>i});var n=s(1788),r=s(5308),o=s(2415),a=s(93),i=function(t){function e(){return t.apply(this,arguments)||this}(0,n.Z)(e,t);var s=e.prototype;return s.oninit=function(e){t.prototype.oninit.call(this,e),this.loadUser(m.route.param("username"))},s.show=function(e){t.prototype.show.call(this,e),this.state=new a.Z({q:"author:"+e.username(),sort:"newest"}),this.state.refresh()},s.content=function(){return m("div",{className:"DiscussionsUserPage"},o.Z.component({state:this.state}))},e}(r.Z)}}]);
|
||||
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[799],{5813:(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>u});var n=s(1788),r=s(5456),o=s.n(r),a=s(486),i=s(2060),u=function(t){function e(){return t.apply(this,arguments)||this}(0,n.Z)(e,t);var s=e.prototype;return s.oninit=function(e){t.prototype.oninit.call(this,e),this.loadUser(m.route.param("username"))},s.show=function(e){t.prototype.show.call(this,e),this.state=new i.Z({q:"author:"+e.username(),sort:"newest"}),this.state.refresh()},s.content=function(){return m("div",{className:"DiscussionsUserPage"},a.Z.component({state:this.state}))},e}(o())}}]);
|
||||
//# sourceMappingURL=DiscussionsUserPage.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"sources":["webpack://@flarum/core/./src/forum/components/DiscussionsUserPage.js"],"names":["DiscussionsUserPage","oninit","vnode","this","loadUser","m","route","param","show","user","state","DiscussionListState","q","username","sort","refresh","content","className","DiscussionList","UserPage"],"mappings":"iLAQqBA,E,sGACnBC,OAAA,SAAOC,GACL,YAAMD,OAAN,UAAaC,GAEbC,KAAKC,SAASC,EAAEC,MAAMC,MAAM,c,EAG9BC,KAAA,SAAKC,GACH,YAAMD,KAAN,UAAWC,GAEXN,KAAKO,MAAQ,IAAIC,IAAoB,CACnCC,EAAG,UAAYH,EAAKI,WACpBC,KAAM,WAGRX,KAAKO,MAAMK,W,EAGbC,QAAA,WACE,OAAO,SAAKC,UAAU,uBAAuBC,cAAyB,CAAER,MAAOP,KAAKO,U,GAnBvCS","file":"forum/components/DiscussionsUserPage.js","sourcesContent":["import UserPage from './UserPage';\nimport DiscussionList from './DiscussionList';\nimport DiscussionListState from '../states/DiscussionListState';\n\n/**\n * The `DiscussionsUserPage` component shows a discussion list inside of a user\n * page.\n */\nexport default class DiscussionsUserPage extends UserPage {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loadUser(m.route.param('username'));\n }\n\n show(user) {\n super.show(user);\n\n this.state = new DiscussionListState({\n q: 'author:' + user.username(),\n sort: 'newest',\n });\n\n this.state.refresh();\n }\n\n content() {\n return <div className=\"DiscussionsUserPage\">{DiscussionList.component({ state: this.state })}</div>;\n }\n}\n"],"sourceRoot":""}
|
||||
{"version":3,"sources":["webpack://@flarum/core/./src/forum/components/DiscussionsUserPage.js"],"names":["DiscussionsUserPage","oninit","vnode","this","loadUser","m","route","param","show","user","state","DiscussionListState","q","username","sort","refresh","content","className","DiscussionList","UserPage"],"mappings":"6LAQqBA,E,sGACnBC,OAAA,SAAOC,GACL,YAAMD,OAAN,UAAaC,GAEbC,KAAKC,SAASC,EAAEC,MAAMC,MAAM,c,EAG9BC,KAAA,SAAKC,GACH,YAAMD,KAAN,UAAWC,GAEXN,KAAKO,MAAQ,IAAIC,IAAoB,CACnCC,EAAG,UAAYH,EAAKI,WACpBC,KAAM,WAGRX,KAAKO,MAAMK,W,EAGbC,QAAA,WACE,OAAO,SAAKC,UAAU,uBAAuBC,cAAyB,CAAER,MAAOP,KAAKO,U,GAnBvCS","file":"forum/components/DiscussionsUserPage.js","sourcesContent":["import UserPage from 'flarum/components/UserPage';\nimport DiscussionList from './DiscussionList';\nimport DiscussionListState from '../states/DiscussionListState';\n\n/**\n * The `DiscussionsUserPage` component shows a discussion list inside of a user\n * page.\n */\nexport default class DiscussionsUserPage extends UserPage {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loadUser(m.route.param('username'));\n }\n\n show(user) {\n super.show(user);\n\n this.state = new DiscussionListState({\n q: 'author:' + user.username(),\n sort: 'newest',\n });\n\n this.state.refresh();\n }\n\n content() {\n return <div className=\"DiscussionsUserPage\">{DiscussionList.component({ state: this.state })}</div>;\n }\n}\n//Flarum Asynchronous Module\n"],"sourceRoot":""}
|
2
js/dist/forum/components/EditPostComposer.js
vendored
Normal file
2
js/dist/forum/components/EditPostComposer.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[293],{763:(t,o,s)=>{"use strict";s.r(o),s.d(o,{default:()=>u});var e=s(1788),r=s(4810),n=s(2587),i=s(8046),a=s(9100);function p(t){app.composer.isFullScreen()&&(app.composer.minimize(),t.stopPropagation())}var u=function(t){function o(){return t.apply(this,arguments)||this}(0,e.Z)(o,t),o.initAttrs=function(o){t.initAttrs.call(this,o),o.submitLabel=o.submitLabel||app.translator.trans("core.forum.composer_edit.submit_button"),o.confirmExit=o.confirmExit||app.translator.trans("core.forum.composer_edit.discard_confirmation"),o.originalContent=o.originalContent||o.post.content(),o.user=o.user||o.post.user(),o.post.editedContent=o.originalContent};var s=o.prototype;return s.headerItems=function(){var o=t.prototype.headerItems.call(this),s=this.attrs.post;return o.add("title",m("h3",null,(0,a.Z)("fas fa-pencil-alt")," ",m(i.Z,{href:app.route.discussion(s.discussion(),s.number()),onclick:p},app.translator.trans("core.forum.composer_edit.post_link",{number:s.number(),discussion:s.discussion().title()})))),o},s.jumpToPreview=function(t){p(t),m.route.set(app.route.post(this.attrs.post))},s.data=function(){return{content:this.composer.fields.content()}},s.onsubmit=function(){var t=this,o=this.attrs.post.discussion();this.loading=!0;var s=this.data();this.attrs.post.save(s).then((function(s){if(app.viewingDiscussion(o))app.current.get("stream").goToNumber(s.number());else{var e,r=n.Z.component({className:"Button Button--link",onclick:function(){m.route.set(app.route.post(s)),app.alerts.dismiss(e)}},app.translator.trans("core.forum.composer_edit.view_button"));e=app.alerts.show({type:"success",controls:[r]},app.translator.trans("core.forum.composer_edit.edited_message"))}t.composer.hide()}),this.loaded.bind(this))},o}(r.Z);window.flreg.add("components/EditPostComposer",u)}}]);
|
||||
//# sourceMappingURL=EditPostComposer.js.map
|
1
js/dist/forum/components/EditPostComposer.js.map
vendored
Normal file
1
js/dist/forum/components/EditPostComposer.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
2
js/dist/forum/components/EditUserModal.js
vendored
2
js/dist/forum/components/EditUserModal.js
vendored
|
@ -1,2 +1,2 @@
|
|||
(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[352],{9106:(s,r,t)=>{"use strict";t.r(r),t.d(r,{default:()=>p});var e=t(1788),a=t(8292),i=t(5462),n=t(512),o=t(442),d=t(8165),u=t(7037),l=t(9015),p=function(s){function r(){return s.apply(this,arguments)||this}(0,e.Z)(r,s);var t=r.prototype;return t.oninit=function(r){var t=this;s.prototype.oninit.call(this,r);var e=this.attrs.user;this.username=(0,l.Z)(e.username()||""),this.email=(0,l.Z)(e.email()||""),this.isEmailConfirmed=(0,l.Z)(e.isEmailConfirmed()||!1),this.setPassword=(0,l.Z)(!1),this.password=(0,l.Z)(e.password()||""),this.groups={},app.store.all("groups").filter((function(s){return-1===[o.Z.GUEST_ID,o.Z.MEMBER_ID].indexOf(s.id())})).forEach((function(s){return t.groups[s.id()]=(0,l.Z)(-1!==e.groups().indexOf(s))}))},t.className=function(){return"EditUserModal Modal--small"},t.title=function(){return app.translator.trans("core.forum.edit_user.title")},t.content=function(){var s=this.fields().toArray();return m("div",{className:"Modal-body"},s.length>1?m("div",{className:"Form"},this.fields().toArray()):app.translator.trans("core.forum.edit_user.nothing_available"))},t.fields=function(){var s=this,r=new u.Z;return app.session.user.canEditCredentials()&&(r.add("username",m("div",{className:"Form-group"},m("label",null,app.translator.trans("core.forum.edit_user.username_heading")),m("input",{className:"FormControl",placeholder:(0,d.Z)(app.translator.trans("core.forum.edit_user.username_label")),bidi:this.username,disabled:this.nonAdminEditingAdmin()})),40),app.session.user!==this.attrs.user&&(r.add("email",m("div",{className:"Form-group"},m("label",null,app.translator.trans("core.forum.edit_user.email_heading")),m("div",null,m("input",{className:"FormControl",placeholder:(0,d.Z)(app.translator.trans("core.forum.edit_user.email_label")),bidi:this.email,disabled:this.nonAdminEditingAdmin()})),!this.isEmailConfirmed()&&this.userIsAdmin(app.session.user)?m("div",null,i.Z.component({className:"Button Button--block",loading:this.loading,onclick:this.activate.bind(this)},app.translator.trans("core.forum.edit_user.activate_button"))):""),30),r.add("password",m("div",{className:"Form-group"},m("label",null,app.translator.trans("core.forum.edit_user.password_heading")),m("div",null,m("label",{className:"checkbox"},m("input",{type:"checkbox",onchange:function(r){s.setPassword(r.target.checked),m.redraw.sync(),r.target.checked&&s.$("[name=password]").select(),r.redraw=!1},disabled:this.nonAdminEditingAdmin()}),app.translator.trans("core.forum.edit_user.set_password_label")),this.setPassword()?m("input",{className:"FormControl",type:"password",name:"password",placeholder:(0,d.Z)(app.translator.trans("core.forum.edit_user.password_label")),bidi:this.password,disabled:this.nonAdminEditingAdmin()}):"")),20))),app.session.user.canEditGroups()&&r.add("groups",m("div",{className:"Form-group EditUserModal-groups"},m("label",null,app.translator.trans("core.forum.edit_user.groups_heading")),m("div",null,Object.keys(this.groups).map((function(s){return app.store.getById("groups",s)})).map((function(r){return m("label",{className:"checkbox"},m("input",{type:"checkbox",bidi:s.groups[r.id()],disabled:r.id()===o.Z.ADMINISTRATOR_ID&&(s.attrs.user===app.session.user||!s.userIsAdmin(app.session.user))}),n.Z.component({group:r,label:""})," ",r.nameSingular())})))),10),r.add("submit",m("div",{className:"Form-group"},i.Z.component({className:"Button Button--primary",type:"submit",loading:this.loading},app.translator.trans("core.forum.edit_user.submit_button"))),-10),r},t.activate=function(){var s=this;this.loading=!0;var r={username:this.username(),isEmailConfirmed:!0};this.attrs.user.save(r,{errorHandler:this.onerror.bind(this)}).then((function(){s.isEmailConfirmed(!0),s.loading=!1,m.redraw()})).catch((function(){s.loading=!1,m.redraw()}))},t.data=function(){var s=this,r={relationships:{}};return this.attrs.user.canEditCredentials()&&!this.nonAdminEditingAdmin()&&(r.username=this.username(),app.session.user!==this.attrs.user&&(r.email=this.email()),this.setPassword()&&(r.password=this.password())),this.attrs.user.canEditGroups()&&(r.relationships.groups=Object.keys(this.groups).filter((function(r){return s.groups[r]()})).map((function(s){return app.store.getById("groups",s)}))),r},t.onsubmit=function(s){var r=this;s.preventDefault(),this.loading=!0,this.attrs.user.save(this.data(),{errorHandler:this.onerror.bind(this)}).then(this.hide.bind(this)).catch((function(){r.loading=!1,m.redraw()}))},t.nonAdminEditingAdmin=function(){return this.userIsAdmin(this.attrs.user)&&!this.userIsAdmin(app.session.user)},t.userIsAdmin=function(s){return s.groups().some((function(s){return s.id()===o.Z.ADMINISTRATOR_ID}))},r}(a.Z)}}]);
|
||||
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[352],{3089:(s,r,t)=>{"use strict";t.r(r),t.d(r,{default:()=>p});var e=t(1788),a=t(5556),i=t(2587),n=t(7880),o=t(4032),d=t(5731),u=t(4594),l=t(1024),p=function(s){function r(){return s.apply(this,arguments)||this}(0,e.Z)(r,s);var t=r.prototype;return t.oninit=function(r){var t=this;s.prototype.oninit.call(this,r);var e=this.attrs.user;this.username=(0,l.Z)(e.username()||""),this.email=(0,l.Z)(e.email()||""),this.isEmailConfirmed=(0,l.Z)(e.isEmailConfirmed()||!1),this.setPassword=(0,l.Z)(!1),this.password=(0,l.Z)(e.password()||""),this.groups={},app.store.all("groups").filter((function(s){return-1===[o.Z.GUEST_ID,o.Z.MEMBER_ID].indexOf(s.id())})).forEach((function(s){return t.groups[s.id()]=(0,l.Z)(-1!==e.groups().indexOf(s))}))},t.className=function(){return"EditUserModal Modal--small"},t.title=function(){return app.translator.trans("core.forum.edit_user.title")},t.content=function(){var s=this.fields().toArray();return m("div",{className:"Modal-body"},s.length>1?m("div",{className:"Form"},this.fields().toArray()):app.translator.trans("core.forum.edit_user.nothing_available"))},t.fields=function(){var s=this,r=new u.Z;return app.session.user.canEditCredentials()&&(r.add("username",m("div",{className:"Form-group"},m("label",null,app.translator.trans("core.forum.edit_user.username_heading")),m("input",{className:"FormControl",placeholder:(0,d.Z)(app.translator.trans("core.forum.edit_user.username_label")),bidi:this.username,disabled:this.nonAdminEditingAdmin()})),40),app.session.user!==this.attrs.user&&(r.add("email",m("div",{className:"Form-group"},m("label",null,app.translator.trans("core.forum.edit_user.email_heading")),m("div",null,m("input",{className:"FormControl",placeholder:(0,d.Z)(app.translator.trans("core.forum.edit_user.email_label")),bidi:this.email,disabled:this.nonAdminEditingAdmin()})),!this.isEmailConfirmed()&&this.userIsAdmin(app.session.user)?m("div",null,i.Z.component({className:"Button Button--block",loading:this.loading,onclick:this.activate.bind(this)},app.translator.trans("core.forum.edit_user.activate_button"))):""),30),r.add("password",m("div",{className:"Form-group"},m("label",null,app.translator.trans("core.forum.edit_user.password_heading")),m("div",null,m("label",{className:"checkbox"},m("input",{type:"checkbox",onchange:function(r){s.setPassword(r.target.checked),m.redraw.sync(),r.target.checked&&s.$("[name=password]").select(),r.redraw=!1},disabled:this.nonAdminEditingAdmin()}),app.translator.trans("core.forum.edit_user.set_password_label")),this.setPassword()?m("input",{className:"FormControl",type:"password",name:"password",placeholder:(0,d.Z)(app.translator.trans("core.forum.edit_user.password_label")),bidi:this.password,disabled:this.nonAdminEditingAdmin()}):"")),20))),app.session.user.canEditGroups()&&r.add("groups",m("div",{className:"Form-group EditUserModal-groups"},m("label",null,app.translator.trans("core.forum.edit_user.groups_heading")),m("div",null,Object.keys(this.groups).map((function(s){return app.store.getById("groups",s)})).map((function(r){return m("label",{className:"checkbox"},m("input",{type:"checkbox",bidi:s.groups[r.id()],disabled:r.id()===o.Z.ADMINISTRATOR_ID&&(s.attrs.user===app.session.user||!s.userIsAdmin(app.session.user))}),n.Z.component({group:r,label:""})," ",r.nameSingular())})))),10),r.add("submit",m("div",{className:"Form-group"},i.Z.component({className:"Button Button--primary",type:"submit",loading:this.loading},app.translator.trans("core.forum.edit_user.submit_button"))),-10),r},t.activate=function(){var s=this;this.loading=!0;var r={username:this.username(),isEmailConfirmed:!0};this.attrs.user.save(r,{errorHandler:this.onerror.bind(this)}).then((function(){s.isEmailConfirmed(!0),s.loading=!1,m.redraw()})).catch((function(){s.loading=!1,m.redraw()}))},t.data=function(){var s=this,r={relationships:{}};return this.attrs.user.canEditCredentials()&&!this.nonAdminEditingAdmin()&&(r.username=this.username(),app.session.user!==this.attrs.user&&(r.email=this.email()),this.setPassword()&&(r.password=this.password())),this.attrs.user.canEditGroups()&&(r.relationships.groups=Object.keys(this.groups).filter((function(r){return s.groups[r]()})).map((function(s){return app.store.getById("groups",s)}))),r},t.onsubmit=function(s){var r=this;s.preventDefault(),this.loading=!0,this.attrs.user.save(this.data(),{errorHandler:this.onerror.bind(this)}).then(this.hide.bind(this)).catch((function(){r.loading=!1,m.redraw()}))},t.nonAdminEditingAdmin=function(){return this.userIsAdmin(this.attrs.user)&&!this.userIsAdmin(app.session.user)},t.userIsAdmin=function(s){return s.groups().some((function(s){return s.id()===o.Z.ADMINISTRATOR_ID}))},r}(a.Z)}}]);
|
||||
//# sourceMappingURL=EditUserModal.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,2 +1,2 @@
|
|||
(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[502],{5999:(t,o,r)=>{"use strict";r.r(o),r.d(o,{default:()=>l});var a=r(1788),s=r(8292),e=r(5462),n=r(8165),i=r(9015),l=function(t){function o(){return t.apply(this,arguments)||this}(0,a.Z)(o,t);var r=o.prototype;return r.oninit=function(o){t.prototype.oninit.call(this,o),this.email=(0,i.Z)(this.attrs.email||""),this.success=!1},r.className=function(){return"ForgotPasswordModal Modal--small"},r.title=function(){return app.translator.trans("core.forum.forgot_password.title")},r.content=function(){return this.success?m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("p",{className:"helpText"},app.translator.trans("core.forum.forgot_password.email_sent_message")),m("div",{className:"Form-group"},m(e.Z,{className:"Button Button--primary Button--block",onclick:this.hide.bind(this)},app.translator.trans("core.forum.forgot_password.dismiss_button"))))):m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("p",{className:"helpText"},app.translator.trans("core.forum.forgot_password.text")),m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"email",type:"email",placeholder:(0,n.Z)(app.translator.trans("core.forum.forgot_password.email_placeholder")),bidi:this.email,disabled:this.loading})),m("div",{className:"Form-group"},e.Z.component({className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("core.forum.forgot_password.submit_button")))))},r.onsubmit=function(t){var o=this;t.preventDefault(),this.loading=!0,app.request({method:"POST",url:app.forum.attribute("apiUrl")+"/forgot",body:{email:this.email()},errorHandler:this.onerror.bind(this)}).then((function(){o.success=!0,o.alert=null})).catch((function(){})).then(this.loaded.bind(this))},r.onerror=function(o){404===o.status&&(o.alert.content=app.translator.trans("core.forum.forgot_password.not_found_message")),t.prototype.onerror.call(this,o)},o}(s.Z)}}]);
|
||||
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[502],{5833:(t,o,r)=>{"use strict";r.r(o),r.d(o,{default:()=>l});var a=r(1788),s=r(5556),e=r(2587),n=r(5731),i=r(1024),l=function(t){function o(){return t.apply(this,arguments)||this}(0,a.Z)(o,t);var r=o.prototype;return r.oninit=function(o){t.prototype.oninit.call(this,o),this.email=(0,i.Z)(this.attrs.email||""),this.success=!1},r.className=function(){return"ForgotPasswordModal Modal--small"},r.title=function(){return app.translator.trans("core.forum.forgot_password.title")},r.content=function(){return this.success?m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("p",{className:"helpText"},app.translator.trans("core.forum.forgot_password.email_sent_message")),m("div",{className:"Form-group"},m(e.Z,{className:"Button Button--primary Button--block",onclick:this.hide.bind(this)},app.translator.trans("core.forum.forgot_password.dismiss_button"))))):m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("p",{className:"helpText"},app.translator.trans("core.forum.forgot_password.text")),m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"email",type:"email",placeholder:(0,n.Z)(app.translator.trans("core.forum.forgot_password.email_placeholder")),bidi:this.email,disabled:this.loading})),m("div",{className:"Form-group"},e.Z.component({className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("core.forum.forgot_password.submit_button")))))},r.onsubmit=function(t){var o=this;t.preventDefault(),this.loading=!0,app.request({method:"POST",url:app.forum.attribute("apiUrl")+"/forgot",body:{email:this.email()},errorHandler:this.onerror.bind(this)}).then((function(){o.success=!0,o.alert=null})).catch((function(){})).then(this.loaded.bind(this))},r.onerror=function(o){404===o.status&&(o.alert.content=app.translator.trans("core.forum.forgot_password.not_found_message")),t.prototype.onerror.call(this,o)},o}(s.Z)}}]);
|
||||
//# sourceMappingURL=ForgotPasswordModal.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"sources":["webpack://@flarum/core/./src/forum/components/ForgotPasswordModal.js"],"names":["ForgotPasswordModal","oninit","vnode","this","email","Stream","attrs","success","className","title","app","translator","trans","content","onclick","hide","bind","name","type","placeholder","extractText","bidi","disabled","loading","Button","onsubmit","e","preventDefault","request","method","url","forum","attribute","body","errorHandler","onerror","then","alert","loaded","error","status","Modal"],"mappings":"6LAaqBA,E,sGACnBC,OAAA,SAAOC,GACL,YAAMD,OAAN,UAAaC,GAObC,KAAKC,OAAQC,OAAOF,KAAKG,MAAMF,OAAS,IAOxCD,KAAKI,SAAU,G,EAGjBC,UAAA,WACE,MAAO,oC,EAGTC,MAAA,WACE,OAAOC,IAAIC,WAAWC,MAAM,qC,EAG9BC,QAAA,WACE,OAAIV,KAAKI,QAEL,SAAKC,UAAU,cACb,SAAKA,UAAU,uBACb,OAAGA,UAAU,YAAYE,IAAIC,WAAWC,MAAM,kDAC9C,SAAKJ,UAAU,cACb,EAAC,IAAD,CAAQA,UAAU,uCAAuCM,QAASX,KAAKY,KAAKC,KAAKb,OAC9EO,IAAIC,WAAWC,MAAM,iDAShC,SAAKJ,UAAU,cACb,SAAKA,UAAU,uBACb,OAAGA,UAAU,YAAYE,IAAIC,WAAWC,MAAM,oCAC9C,SAAKJ,UAAU,cACb,WACEA,UAAU,cACVS,KAAK,QACLC,KAAK,QACLC,aAAaC,OAAYV,IAAIC,WAAWC,MAAM,iDAC9CS,KAAMlB,KAAKC,MACXkB,SAAUnB,KAAKoB,WAGnB,SAAKf,UAAU,cACZgB,cACC,CACEhB,UAAW,uCACXU,KAAM,SACNK,QAASpB,KAAKoB,SAEhBb,IAAIC,WAAWC,MAAM,iD,EAQjCa,SAAA,SAASC,GAAG,WACVA,EAAEC,iBAEFxB,KAAKoB,SAAU,EAEfb,IACGkB,QAAQ,CACPC,OAAQ,OACRC,IAAKpB,IAAIqB,MAAMC,UAAU,UAAY,UACrCC,KAAM,CAAE7B,MAAOD,KAAKC,SACpB8B,aAAc/B,KAAKgC,QAAQnB,KAAKb,QAEjCiC,MAAK,WACJ,EAAK7B,SAAU,EACf,EAAK8B,MAAQ,QATjB,OAWS,eACND,KAAKjC,KAAKmC,OAAOtB,KAAKb,Q,EAG3BgC,QAAA,SAAQI,GACe,MAAjBA,EAAMC,SACRD,EAAMF,MAAMxB,QAAUH,IAAIC,WAAWC,MAAM,iDAG7C,YAAMuB,QAAN,UAAcI,I,GAjG+BE","file":"forum/components/ForgotPasswordModal.js","sourcesContent":["import Modal from '../../common/components/Modal';\nimport Button from '../../common/components/Button';\nimport extractText from '../../common/utils/extractText';\nimport Stream from '../../common/utils/Stream';\n\n/**\n * The `ForgotPasswordModal` component displays a modal which allows the user to\n * enter their email address and request a link to reset their password.\n *\n * ### Attrs\n *\n * - `email`\n */\nexport default class ForgotPasswordModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n /**\n * The value of the email input.\n *\n * @type {Function}\n */\n this.email = Stream(this.attrs.email || '');\n\n /**\n * Whether or not the password reset email was sent successfully.\n *\n * @type {Boolean}\n */\n this.success = false;\n }\n\n className() {\n return 'ForgotPasswordModal Modal--small';\n }\n\n title() {\n return app.translator.trans('core.forum.forgot_password.title');\n }\n\n content() {\n if (this.success) {\n return (\n <div className=\"Modal-body\">\n <div className=\"Form Form--centered\">\n <p className=\"helpText\">{app.translator.trans('core.forum.forgot_password.email_sent_message')}</p>\n <div className=\"Form-group\">\n <Button className=\"Button Button--primary Button--block\" onclick={this.hide.bind(this)}>\n {app.translator.trans('core.forum.forgot_password.dismiss_button')}\n </Button>\n </div>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"Modal-body\">\n <div className=\"Form Form--centered\">\n <p className=\"helpText\">{app.translator.trans('core.forum.forgot_password.text')}</p>\n <div className=\"Form-group\">\n <input\n className=\"FormControl\"\n name=\"email\"\n type=\"email\"\n placeholder={extractText(app.translator.trans('core.forum.forgot_password.email_placeholder'))}\n bidi={this.email}\n disabled={this.loading}\n />\n </div>\n <div className=\"Form-group\">\n {Button.component(\n {\n className: 'Button Button--primary Button--block',\n type: 'submit',\n loading: this.loading,\n },\n app.translator.trans('core.forum.forgot_password.submit_button')\n )}\n </div>\n </div>\n </div>\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n app\n .request({\n method: 'POST',\n url: app.forum.attribute('apiUrl') + '/forgot',\n body: { email: this.email() },\n errorHandler: this.onerror.bind(this),\n })\n .then(() => {\n this.success = true;\n this.alert = null;\n })\n .catch(() => {})\n .then(this.loaded.bind(this));\n }\n\n onerror(error) {\n if (error.status === 404) {\n error.alert.content = app.translator.trans('core.forum.forgot_password.not_found_message');\n }\n\n super.onerror(error);\n }\n}\n"],"sourceRoot":""}
|
||||
{"version":3,"sources":["webpack://@flarum/core/./src/forum/components/ForgotPasswordModal.js"],"names":["ForgotPasswordModal","oninit","vnode","this","email","Stream","attrs","success","className","title","app","translator","trans","content","onclick","hide","bind","name","type","placeholder","extractText","bidi","disabled","loading","Button","onsubmit","e","preventDefault","request","method","url","forum","attribute","body","errorHandler","onerror","then","alert","loaded","error","status","Modal"],"mappings":"+LAaqBA,E,sGACnBC,OAAA,SAAOC,GACL,YAAMD,OAAN,UAAaC,GAObC,KAAKC,OAAQC,OAAOF,KAAKG,MAAMF,OAAS,IAOxCD,KAAKI,SAAU,G,EAGjBC,UAAA,WACE,MAAO,oC,EAGTC,MAAA,WACE,OAAOC,IAAIC,WAAWC,MAAM,qC,EAG9BC,QAAA,WACE,OAAIV,KAAKI,QAEL,SAAKC,UAAU,cACb,SAAKA,UAAU,uBACb,OAAGA,UAAU,YAAYE,IAAIC,WAAWC,MAAM,kDAC9C,SAAKJ,UAAU,cACb,EAAC,IAAD,CAAQA,UAAU,uCAAuCM,QAASX,KAAKY,KAAKC,KAAKb,OAC9EO,IAAIC,WAAWC,MAAM,iDAShC,SAAKJ,UAAU,cACb,SAAKA,UAAU,uBACb,OAAGA,UAAU,YAAYE,IAAIC,WAAWC,MAAM,oCAC9C,SAAKJ,UAAU,cACb,WACEA,UAAU,cACVS,KAAK,QACLC,KAAK,QACLC,aAAaC,OAAYV,IAAIC,WAAWC,MAAM,iDAC9CS,KAAMlB,KAAKC,MACXkB,SAAUnB,KAAKoB,WAGnB,SAAKf,UAAU,cACZgB,cACC,CACEhB,UAAW,uCACXU,KAAM,SACNK,QAASpB,KAAKoB,SAEhBb,IAAIC,WAAWC,MAAM,iD,EAQjCa,SAAA,SAASC,GAAG,WACVA,EAAEC,iBAEFxB,KAAKoB,SAAU,EAEfb,IACGkB,QAAQ,CACPC,OAAQ,OACRC,IAAKpB,IAAIqB,MAAMC,UAAU,UAAY,UACrCC,KAAM,CAAE7B,MAAOD,KAAKC,SACpB8B,aAAc/B,KAAKgC,QAAQnB,KAAKb,QAEjCiC,MAAK,WACJ,EAAK7B,SAAU,EACf,EAAK8B,MAAQ,QATjB,OAWS,eACND,KAAKjC,KAAKmC,OAAOtB,KAAKb,Q,EAG3BgC,QAAA,SAAQI,GACe,MAAjBA,EAAMC,SACRD,EAAMF,MAAMxB,QAAUH,IAAIC,WAAWC,MAAM,iDAG7C,YAAMuB,QAAN,UAAcI,I,GAjG+BE","file":"forum/components/ForgotPasswordModal.js","sourcesContent":["import Modal from '../../common/components/Modal';\nimport Button from '../../common/components/Button';\nimport extractText from '../../common/utils/extractText';\nimport Stream from '../../common/utils/Stream';\n\n/**\n * The `ForgotPasswordModal` component displays a modal which allows the user to\n * enter their email address and request a link to reset their password.\n *\n * ### Attrs\n *\n * - `email`\n */\nexport default class ForgotPasswordModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n /**\n * The value of the email input.\n *\n * @type {Function}\n */\n this.email = Stream(this.attrs.email || '');\n\n /**\n * Whether or not the password reset email was sent successfully.\n *\n * @type {Boolean}\n */\n this.success = false;\n }\n\n className() {\n return 'ForgotPasswordModal Modal--small';\n }\n\n title() {\n return app.translator.trans('core.forum.forgot_password.title');\n }\n\n content() {\n if (this.success) {\n return (\n <div className=\"Modal-body\">\n <div className=\"Form Form--centered\">\n <p className=\"helpText\">{app.translator.trans('core.forum.forgot_password.email_sent_message')}</p>\n <div className=\"Form-group\">\n <Button className=\"Button Button--primary Button--block\" onclick={this.hide.bind(this)}>\n {app.translator.trans('core.forum.forgot_password.dismiss_button')}\n </Button>\n </div>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"Modal-body\">\n <div className=\"Form Form--centered\">\n <p className=\"helpText\">{app.translator.trans('core.forum.forgot_password.text')}</p>\n <div className=\"Form-group\">\n <input\n className=\"FormControl\"\n name=\"email\"\n type=\"email\"\n placeholder={extractText(app.translator.trans('core.forum.forgot_password.email_placeholder'))}\n bidi={this.email}\n disabled={this.loading}\n />\n </div>\n <div className=\"Form-group\">\n {Button.component(\n {\n className: 'Button Button--primary Button--block',\n type: 'submit',\n loading: this.loading,\n },\n app.translator.trans('core.forum.forgot_password.submit_button')\n )}\n </div>\n </div>\n </div>\n );\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n app\n .request({\n method: 'POST',\n url: app.forum.attribute('apiUrl') + '/forgot',\n body: { email: this.email() },\n errorHandler: this.onerror.bind(this),\n })\n .then(() => {\n this.success = true;\n this.alert = null;\n })\n .catch(() => {})\n .then(this.loaded.bind(this));\n }\n\n onerror(error) {\n if (error.status === 404) {\n error.alert.content = app.translator.trans('core.forum.forgot_password.not_found_message');\n }\n\n super.onerror(error);\n }\n}\n//Flarum Asynchronous Module\n"],"sourceRoot":""}
|
2
js/dist/forum/components/IndexPage.js
vendored
2
js/dist/forum/components/IndexPage.js
vendored
File diff suppressed because one or more lines are too long
2
js/dist/forum/components/IndexPage.js.map
vendored
2
js/dist/forum/components/IndexPage.js.map
vendored
File diff suppressed because one or more lines are too long
2
js/dist/forum/components/LogInModal.js
vendored
2
js/dist/forum/components/LogInModal.js
vendored
|
@ -1,2 +1,2 @@
|
|||
(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[460],{5127:(t,o,i)=>{"use strict";i.r(o),i.d(o,{default:()=>c});var n=i(1788),r=i(8292),a=i(5462),e=i(6349),s=i(8165),l=i(7037),d=i(9015),c=function(t){function o(){return t.apply(this,arguments)||this}(0,n.Z)(o,t);var r=o.prototype;return r.oninit=function(o){t.prototype.oninit.call(this,o),this.identification=(0,d.Z)(this.attrs.identification||""),this.password=(0,d.Z)(this.attrs.password||""),this.remember=(0,d.Z)(!!this.attrs.remember)},r.className=function(){return"LogInModal Modal--small"},r.title=function(){return app.translator.trans("core.forum.log_in.title")},r.content=function(){return[m("div",{className:"Modal-body"},this.body()),m("div",{className:"Modal-footer"},this.footer())]},r.body=function(){return[m(e.Z,null),m("div",{className:"Form Form--centered"},this.fields().toArray())]},r.fields=function(){var t=new l.Z;return t.add("identification",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"identification",type:"text",placeholder:(0,s.Z)(app.translator.trans("core.forum.log_in.username_or_email_placeholder")),bidi:this.identification,disabled:this.loading})),30),t.add("password",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"password",type:"password",placeholder:(0,s.Z)(app.translator.trans("core.forum.log_in.password_placeholder")),bidi:this.password,disabled:this.loading})),20),t.add("remember",m("div",{className:"Form-group"},m("div",null,m("label",{className:"checkbox"},m("input",{type:"checkbox",bidi:this.remember,disabled:this.loading}),app.translator.trans("core.forum.log_in.remember_me_label")))),10),t.add("submit",m("div",{className:"Form-group"},a.Z.component({className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("core.forum.log_in.submit_button"))),-10),t},r.footer=function(){return[m("p",{className:"LogInModal-forgotPassword"},m("a",{onclick:this.forgotPassword.bind(this)},app.translator.trans("core.forum.log_in.forgot_password_link"))),app.forum.attribute("allowSignUp")?m("p",{className:"LogInModal-signUp"},app.translator.trans("core.forum.log_in.sign_up_text",{a:m("a",{onclick:this.signUp.bind(this)})})):""]},r.forgotPassword=function(){var t=this.identification(),o=-1!==t.indexOf("@")?{email:t}:void 0;app.modal.show((function(){return i.e(502).then(i.bind(i,5999))}),o)},r.signUp=function(){var t={password:this.password()},o=this.identification();t[-1!==o.indexOf("@")?"email":"username"]=o,app.modal.show((function(){return i.e(395).then(i.bind(i,6999))}),t)},r.onready=function(){this.$("[name="+(this.identification()?"password":"identification")+"]").select()},r.onsubmit=function(t){t.preventDefault(),this.loading=!0;var o=this.identification(),i=this.password(),n=this.remember();app.session.login({identification:o,password:i,remember:n},{errorHandler:this.onerror.bind(this)}).then((function(){return window.location.reload()}),this.loaded.bind(this))},r.onerror=function(o){401===o.status&&(o.alert.content=app.translator.trans("core.forum.log_in.invalid_login_message")),t.prototype.onerror.call(this,o)},o}(r.Z)}}]);
|
||||
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[460],{7527:(t,o,i)=>{"use strict";i.d(o,{Z:()=>e});var n=i(1788),r=i(8931),a=i(4594),e=function(t){function o(){return t.apply(this,arguments)||this}(0,n.Z)(o,t);var i=o.prototype;return i.view=function(){return m("div",{className:"LogInButtons"},this.items().toArray())},i.items=function(){return new a.Z},o}(r.Z);window.flreg.add("components/LogInButtons",e)},1498:(t,o,i)=>{"use strict";i.r(o),i.d(o,{default:()=>c});var n=i(1788),r=i(5556),a=i(2587),e=i(7527),s=i(5731),l=i(4594),d=i(1024),c=function(t){function o(){return t.apply(this,arguments)||this}(0,n.Z)(o,t);var r=o.prototype;return r.oninit=function(o){t.prototype.oninit.call(this,o),this.identification=(0,d.Z)(this.attrs.identification||""),this.password=(0,d.Z)(this.attrs.password||""),this.remember=(0,d.Z)(!!this.attrs.remember)},r.className=function(){return"LogInModal Modal--small"},r.title=function(){return app.translator.trans("core.forum.log_in.title")},r.content=function(){return[m("div",{className:"Modal-body"},this.body()),m("div",{className:"Modal-footer"},this.footer())]},r.body=function(){return[m(e.Z,null),m("div",{className:"Form Form--centered"},this.fields().toArray())]},r.fields=function(){var t=new l.Z;return t.add("identification",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"identification",type:"text",placeholder:(0,s.Z)(app.translator.trans("core.forum.log_in.username_or_email_placeholder")),bidi:this.identification,disabled:this.loading})),30),t.add("password",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"password",type:"password",placeholder:(0,s.Z)(app.translator.trans("core.forum.log_in.password_placeholder")),bidi:this.password,disabled:this.loading})),20),t.add("remember",m("div",{className:"Form-group"},m("div",null,m("label",{className:"checkbox"},m("input",{type:"checkbox",bidi:this.remember,disabled:this.loading}),app.translator.trans("core.forum.log_in.remember_me_label")))),10),t.add("submit",m("div",{className:"Form-group"},a.Z.component({className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("core.forum.log_in.submit_button"))),-10),t},r.footer=function(){return[m("p",{className:"LogInModal-forgotPassword"},m("a",{onclick:this.forgotPassword.bind(this)},app.translator.trans("core.forum.log_in.forgot_password_link"))),app.forum.attribute("allowSignUp")?m("p",{className:"LogInModal-signUp"},app.translator.trans("core.forum.log_in.sign_up_text",{a:m("a",{onclick:this.signUp.bind(this)})})):""]},r.forgotPassword=function(){var t=this.identification(),o=-1!==t.indexOf("@")?{email:t}:void 0;app.modal.show((function(){return i.e(502).then(i.bind(i,5833))}),o)},r.signUp=function(){var t={password:this.password()},o=this.identification();t[-1!==o.indexOf("@")?"email":"username"]=o,app.modal.show((function(){return i.e(395).then(i.bind(i,3235))}),t)},r.onready=function(){this.$("[name="+(this.identification()?"password":"identification")+"]").select()},r.onsubmit=function(t){t.preventDefault(),this.loading=!0;var o=this.identification(),i=this.password(),n=this.remember();app.session.login({identification:o,password:i,remember:n},{errorHandler:this.onerror.bind(this)}).then((function(){return window.location.reload()}),this.loaded.bind(this))},r.onerror=function(o){401===o.status&&(o.alert.content=app.translator.trans("core.forum.log_in.invalid_login_message")),t.prototype.onerror.call(this,o)},o}(r.Z)}}]);
|
||||
//# sourceMappingURL=LogInModal.js.map
|
2
js/dist/forum/components/LogInModal.js.map
vendored
2
js/dist/forum/components/LogInModal.js.map
vendored
File diff suppressed because one or more lines are too long
2
js/dist/forum/components/NotificationList.js
vendored
2
js/dist/forum/components/NotificationList.js
vendored
|
@ -1,2 +1,2 @@
|
|||
(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[77],{2047:(t,i,n)=>{"use strict";n.r(i),n.d(i,{default:()=>h});var o=n(1788),s=n(6366),a=n(1698),e=n(5462),r=n(9236),c=n(2232),u=n(2242),l=n(6149),f=n(5052),p=n(7603),d=function(t){function i(){return t.apply(this,arguments)||this}(0,o.Z)(i,t);var n=i.prototype;return n.icon=function(){return"fas fa-pencil-alt"},n.href=function(){var t=this.attrs.notification;return app.route.discussion(t.subject(),t.content().postNumber)},n.content=function(){return app.translator.trans("core.forum.notifications.discussion_renamed_text",{user:this.attrs.notification.fromUser()})},i}(function(t){function i(){return t.apply(this,arguments)||this}(0,o.Z)(i,t);var n=i.prototype;return n.view=function(){var t=this,i=this.attrs.notification,n=this.href();return m(r.Z,{className:"Notification Notification--"+i.contentType()+" "+(i.isRead()?"":"unread"),href:n,external:n.includes("://"),onclick:this.markAsRead.bind(this)},!i.isRead()&&e.Z.component({className:"Notification-action Button Button--icon Button--link",icon:"fas fa-check",title:app.translator.trans("core.forum.notifications.mark_as_read_tooltip"),onclick:function(i){i.preventDefault(),i.stopPropagation(),t.markAsRead()}}),(0,l.Z)(i.fromUser()),(0,f.Z)(this.icon(),{className:"Notification-icon"}),m("span",{className:"Notification-content"},this.content()),(0,p.Z)(i.createdAt()),m("div",{className:"Notification-excerpt"},this.excerpt()))},n.icon=function(){},n.href=function(){},n.content=function(){},n.excerpt=function(){},n.markAsRead=function(){this.attrs.notification.isRead()||(app.session.user.pushAttributes({unreadNotificationCount:app.session.user.unreadNotificationCount()-1}),this.attrs.notification.save({isRead:!0}))},i}(s.Z)),h=function(t){function i(){return t.apply(this,arguments)||this}(0,o.Z)(i,t);var n=i.prototype;return n.view=function(){var t=this,i=this.attrs.state,n=i.getNotificationPages();return m("div",{className:"NotificationList"},m("div",{className:"NotificationList-header"},m("div",{className:"App-primaryControl"},e.Z.component({className:"Button Button--icon Button--link",icon:"fas fa-check",title:app.translator.trans("core.forum.notifications.mark_all_as_read_tooltip"),onclick:i.markAllAsRead.bind(i)})),m("h4",{className:"App-titleControl App-titleControl--text"},app.translator.trans("core.forum.notifications.title"))),m("div",{className:"NotificationList-content"},n.length?n.map((function(i){var n=[],o={};return i.forEach((function(t){var i=t.subject();if(void 0!==i){var s=!1;i instanceof u.Z?s=i:i&&i.discussion&&(s=i.discussion());var a=s?s.id():0;o[a]=o[a]||{discussion:s,notifications:[]},o[a].notifications.push(t),-1===n.indexOf(o[a])&&n.push(o[a])}})),n.map((function(i){var n=i.discussion&&i.discussion.badges().toArray();return m("div",{className:"NotificationGroup"},i.discussion?m(r.Z,{className:"NotificationGroup-header",href:app.route.discussion(i.discussion)},n&&n.length?m("ul",{className:"NotificationGroup-badges badges"},(0,a.Z)(n)):"",i.discussion.title()):m("div",{className:"NotificationGroup-header"},app.forum.attribute("title")),m("ul",{className:"NotificationGroup-content"},i.notifications.map((function(i){var n=t.notificationComponents()[i.contentType()];return n?m("li",null,n.component({notification:i})):""}))))}))})):"",i.isLoading()?m(c.Z,{className:"LoadingIndicator--block"}):n.length?"":m("div",{className:"NotificationList-empty"},app.translator.trans("core.forum.notifications.empty_text"))))},n.notificationComponents=function(){return{discussionRenamed:d}},n.oncreate=function(i){t.prototype.oncreate.call(this,i),this.$notifications=this.$(".NotificationList-content"),this.$scrollParent=this.inPanel()?this.$notifications:$(window),this.boundScrollHandler=this.scrollHandler.bind(this),this.$scrollParent.on("scroll",this.boundScrollHandler)},n.onremove=function(){this.$scrollParent.off("scroll",this.boundScrollHandler)},n.scrollHandler=function(){var t=this.attrs.state,i=this.inPanel()?this.$scrollParent[0]:document.documentElement,n=Math.abs(i.scrollHeight-i.scrollTop-i.clientHeight)<=1;t.hasMoreResults()&&!t.isLoading()&&n&&t.loadMore()},n.inPanel=function(){return"auto"===this.$notifications.css("overflow")},i}(s.Z)}}]);
|
||||
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[77],{3490:(t,i,n)=>{"use strict";n.r(i),n.d(i,{default:()=>N});var o=n(1788),a=n(8931),s=n(7473),e=n(2587),r=n(8046),c=n(8726),l=n(8197),u=n(9908),f=n(9100),p=n(6961),d=function(t){function i(){return t.apply(this,arguments)||this}(0,o.Z)(i,t);var n=i.prototype;return n.view=function(){var t=this,i=this.attrs.notification,n=this.href();return m(r.Z,{className:"Notification Notification--"+i.contentType()+" "+(i.isRead()?"":"unread"),href:n,external:n.includes("://"),onclick:this.markAsRead.bind(this)},!i.isRead()&&e.Z.component({className:"Notification-action Button Button--icon Button--link",icon:"fas fa-check",title:app.translator.trans("core.forum.notifications.mark_as_read_tooltip"),onclick:function(i){i.preventDefault(),i.stopPropagation(),t.markAsRead()}}),(0,u.Z)(i.fromUser()),(0,f.Z)(this.icon(),{className:"Notification-icon"}),m("span",{className:"Notification-content"},this.content()),(0,p.Z)(i.createdAt()),m("div",{className:"Notification-excerpt"},this.excerpt()))},n.icon=function(){},n.href=function(){},n.content=function(){},n.excerpt=function(){},n.markAsRead=function(){this.attrs.notification.isRead()||(app.session.user.pushAttributes({unreadNotificationCount:app.session.user.unreadNotificationCount()-1}),this.attrs.notification.save({isRead:!0}))},i}(a.Z);window.flreg.add("components/Notification",d);var h=function(t){function i(){return t.apply(this,arguments)||this}(0,o.Z)(i,t);var n=i.prototype;return n.icon=function(){return"fas fa-pencil-alt"},n.href=function(){var t=this.attrs.notification;return app.route.discussion(t.subject(),t.content().postNumber)},n.content=function(){return app.translator.trans("core.forum.notifications.discussion_renamed_text",{user:this.attrs.notification.fromUser()})},i}(d);window.flreg.add("components/DiscussionRenamedNotification",h);var N=function(t){function i(){return t.apply(this,arguments)||this}(0,o.Z)(i,t);var n=i.prototype;return n.view=function(){var t=this,i=this.attrs.state,n=i.getNotificationPages();return m("div",{className:"NotificationList"},m("div",{className:"NotificationList-header"},m("div",{className:"App-primaryControl"},e.Z.component({className:"Button Button--icon Button--link",icon:"fas fa-check",title:app.translator.trans("core.forum.notifications.mark_all_as_read_tooltip"),onclick:i.markAllAsRead.bind(i)})),m("h4",{className:"App-titleControl App-titleControl--text"},app.translator.trans("core.forum.notifications.title"))),m("div",{className:"NotificationList-content"},n.length?n.map((function(i){var n=[],o={};return i.forEach((function(t){var i=t.subject();if(void 0!==i){var a=!1;i instanceof l.Z?a=i:i&&i.discussion&&(a=i.discussion());var s=a?a.id():0;o[s]=o[s]||{discussion:a,notifications:[]},o[s].notifications.push(t),-1===n.indexOf(o[s])&&n.push(o[s])}})),n.map((function(i){var n=i.discussion&&i.discussion.badges().toArray();return m("div",{className:"NotificationGroup"},i.discussion?m(r.Z,{className:"NotificationGroup-header",href:app.route.discussion(i.discussion)},n&&n.length?m("ul",{className:"NotificationGroup-badges badges"},(0,s.Z)(n)):"",i.discussion.title()):m("div",{className:"NotificationGroup-header"},app.forum.attribute("title")),m("ul",{className:"NotificationGroup-content"},i.notifications.map((function(i){var n=t.notificationComponents()[i.contentType()];return n?m("li",null,n.component({notification:i})):""}))))}))})):"",i.isLoading()?m(c.Z,{className:"LoadingIndicator--block"}):n.length?"":m("div",{className:"NotificationList-empty"},app.translator.trans("core.forum.notifications.empty_text"))))},n.notificationComponents=function(){return{discussionRenamed:h}},n.oncreate=function(i){t.prototype.oncreate.call(this,i),this.$notifications=this.$(".NotificationList-content"),this.$scrollParent=this.inPanel()?this.$notifications:$(window),this.boundScrollHandler=this.scrollHandler.bind(this),this.$scrollParent.on("scroll",this.boundScrollHandler)},n.onremove=function(){this.$scrollParent.off("scroll",this.boundScrollHandler)},n.scrollHandler=function(){var t=this.attrs.state,i=this.inPanel()?this.$scrollParent[0]:document.documentElement,n=Math.abs(i.scrollHeight-i.scrollTop-i.clientHeight)<=1;t.hasMoreResults()&&!t.isLoading()&&n&&t.loadMore()},n.inPanel=function(){return"auto"===this.$notifications.css("overflow")},i}(a.Z)}}]);
|
||||
//# sourceMappingURL=NotificationList.js.map
|
File diff suppressed because one or more lines are too long
2
js/dist/forum/components/Post.js
vendored
Normal file
2
js/dist/forum/components/Post.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
js/dist/forum/components/Post.js.map
vendored
Normal file
1
js/dist/forum/components/Post.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
2
js/dist/forum/components/PostStream.js
vendored
2
js/dist/forum/components/PostStream.js
vendored
File diff suppressed because one or more lines are too long
2
js/dist/forum/components/PostStream.js.map
vendored
2
js/dist/forum/components/PostStream.js.map
vendored
File diff suppressed because one or more lines are too long
2
js/dist/forum/components/PostUser.js
vendored
Normal file
2
js/dist/forum/components/PostUser.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
js/dist/forum/components/PostUser.js.map
vendored
Normal file
1
js/dist/forum/components/PostUser.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
2
js/dist/forum/components/PostsUserPage.js
vendored
2
js/dist/forum/components/PostsUserPage.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
js/dist/forum/components/SettingsPage.js
vendored
2
js/dist/forum/components/SettingsPage.js
vendored
File diff suppressed because one or more lines are too long
2
js/dist/forum/components/SettingsPage.js.map
vendored
2
js/dist/forum/components/SettingsPage.js.map
vendored
File diff suppressed because one or more lines are too long
2
js/dist/forum/components/SignUpModal.js
vendored
2
js/dist/forum/components/SignUpModal.js
vendored
|
@ -1,2 +1,2 @@
|
|||
(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[395],{6999:(t,a,s)=>{"use strict";s.r(a),s.d(a,{default:()=>u});var r=s(1788),e=s(8292),i=s(5462),o=s(6349),n=s(8165),l=s(7037),d=s(9015),u=function(t){function a(){return t.apply(this,arguments)||this}(0,r.Z)(a,t);var e=a.prototype;return e.oninit=function(a){t.prototype.oninit.call(this,a),this.username=(0,d.Z)(this.attrs.username||""),this.email=(0,d.Z)(this.attrs.email||""),this.password=(0,d.Z)(this.attrs.password||"")},e.className=function(){return"Modal--small SignUpModal"},e.title=function(){return app.translator.trans("core.forum.sign_up.title")},e.content=function(){return[m("div",{className:"Modal-body"},this.body()),m("div",{className:"Modal-footer"},this.footer())]},e.isProvided=function(t){return this.attrs.provided&&-1!==this.attrs.provided.indexOf(t)},e.body=function(){return[this.attrs.token?"":m(o.Z,null),m("div",{className:"Form Form--centered"},this.fields().toArray())]},e.fields=function(){var t=new l.Z;return t.add("username",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"username",type:"text",placeholder:(0,n.Z)(app.translator.trans("core.forum.sign_up.username_placeholder")),bidi:this.username,disabled:this.loading||this.isProvided("username")})),30),t.add("email",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"email",type:"email",placeholder:(0,n.Z)(app.translator.trans("core.forum.sign_up.email_placeholder")),bidi:this.email,disabled:this.loading||this.isProvided("email")})),20),this.attrs.token||t.add("password",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"password",type:"password",placeholder:(0,n.Z)(app.translator.trans("core.forum.sign_up.password_placeholder")),bidi:this.password,disabled:this.loading})),10),t.add("submit",m("div",{className:"Form-group"},m(i.Z,{className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("core.forum.sign_up.submit_button"))),-10),t},e.footer=function(){return[m("p",{className:"SignUpModal-logIn"},app.translator.trans("core.forum.sign_up.log_in_text",{a:m("a",{onclick:this.logIn.bind(this)})}))]},e.logIn=function(){var t={identification:this.email()||this.username(),password:this.password()};app.modal.show((function(){return s.e(460).then(s.bind(s,5127))}),t)},e.onready=function(){this.attrs.username&&!this.attrs.email?this.$("[name=email]").select():this.$("[name=username]").select()},e.onsubmit=function(t){t.preventDefault(),this.loading=!0;var a=this.submitData();app.request({url:app.forum.attribute("baseUrl")+"/register",method:"POST",body:a,errorHandler:this.onerror.bind(this)}).then((function(){return window.location.reload()}),this.loaded.bind(this))},e.submitData=function(){var t={username:this.username(),email:this.email()};return this.attrs.token?t.token=this.attrs.token:t.password=this.password(),t},a}(e.Z)}}]);
|
||||
(self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[]).push([[395],{7527:(t,s,r)=>{"use strict";r.d(s,{Z:()=>n});var a=r(1788),e=r(8931),i=r(4594),n=function(t){function s(){return t.apply(this,arguments)||this}(0,a.Z)(s,t);var r=s.prototype;return r.view=function(){return m("div",{className:"LogInButtons"},this.items().toArray())},r.items=function(){return new i.Z},s}(e.Z);window.flreg.add("components/LogInButtons",n)},3235:(t,s,r)=>{"use strict";r.r(s),r.d(s,{default:()=>d});var a=r(1788),e=r(5556),i=r(2587),n=r(7527),o=r(5731),l=r(4594),u=r(1024),d=function(t){function s(){return t.apply(this,arguments)||this}(0,a.Z)(s,t);var e=s.prototype;return e.oninit=function(s){t.prototype.oninit.call(this,s),this.username=(0,u.Z)(this.attrs.username||""),this.email=(0,u.Z)(this.attrs.email||""),this.password=(0,u.Z)(this.attrs.password||"")},e.className=function(){return"Modal--small SignUpModal"},e.title=function(){return app.translator.trans("core.forum.sign_up.title")},e.content=function(){return[m("div",{className:"Modal-body"},this.body()),m("div",{className:"Modal-footer"},this.footer())]},e.isProvided=function(t){return this.attrs.provided&&-1!==this.attrs.provided.indexOf(t)},e.body=function(){return[this.attrs.token?"":m(n.Z,null),m("div",{className:"Form Form--centered"},this.fields().toArray())]},e.fields=function(){var t=new l.Z;return t.add("username",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"username",type:"text",placeholder:(0,o.Z)(app.translator.trans("core.forum.sign_up.username_placeholder")),bidi:this.username,disabled:this.loading||this.isProvided("username")})),30),t.add("email",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"email",type:"email",placeholder:(0,o.Z)(app.translator.trans("core.forum.sign_up.email_placeholder")),bidi:this.email,disabled:this.loading||this.isProvided("email")})),20),this.attrs.token||t.add("password",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"password",type:"password",placeholder:(0,o.Z)(app.translator.trans("core.forum.sign_up.password_placeholder")),bidi:this.password,disabled:this.loading})),10),t.add("submit",m("div",{className:"Form-group"},m(i.Z,{className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("core.forum.sign_up.submit_button"))),-10),t},e.footer=function(){return[m("p",{className:"SignUpModal-logIn"},app.translator.trans("core.forum.sign_up.log_in_text",{a:m("a",{onclick:this.logIn.bind(this)})}))]},e.logIn=function(){var t={identification:this.email()||this.username(),password:this.password()};app.modal.show((function(){return r.e(460).then(r.bind(r,1498))}),t)},e.onready=function(){this.attrs.username&&!this.attrs.email?this.$("[name=email]").select():this.$("[name=username]").select()},e.onsubmit=function(t){t.preventDefault(),this.loading=!0;var s=this.submitData();app.request({url:app.forum.attribute("baseUrl")+"/register",method:"POST",body:s,errorHandler:this.onerror.bind(this)}).then((function(){return window.location.reload()}),this.loaded.bind(this))},e.submitData=function(){var t={username:this.username(),email:this.email()};return this.attrs.token?t.token=this.attrs.token:t.password=this.password(),t},s}(e.Z)}}]);
|
||||
//# sourceMappingURL=SignUpModal.js.map
|
2
js/dist/forum/components/SignUpModal.js.map
vendored
2
js/dist/forum/components/SignUpModal.js.map
vendored
File diff suppressed because one or more lines are too long
2
js/dist/forum/flarum-core.js
vendored
2
js/dist/forum/flarum-core.js
vendored
File diff suppressed because one or more lines are too long
2
js/dist/forum/flarum-core.js.map
vendored
2
js/dist/forum/flarum-core.js.map
vendored
File diff suppressed because one or more lines are too long
2
js/dist/forum/flarum-core~runtime.js
vendored
2
js/dist/forum/flarum-core~runtime.js
vendored
|
@ -1,2 +0,0 @@
|
|||
(()=>{"use strict";var e,o,r,t={},n={};function a(e){var o=n[e];if(void 0!==o)return o.exports;var r=n[e]={exports:{}};return t[e].call(r.exports,r,r.exports,a),r.exports}a.m=t,e=[],a.O=(o,r,t,n)=>{if(!r){var s=1/0;for(l=0;l<e.length;l++){for(var[r,t,n]=e[l],i=!0,u=0;u<r.length;u++)(!1&n||s>=n)&&Object.keys(a.O).every((e=>a.O[e](r[u])))?r.splice(u--,1):(i=!1,n<s&&(s=n));i&&(e.splice(l--,1),o=t())}return o}n=n||0;for(var l=e.length;l>0&&e[l-1][2]>n;l--)e[l]=e[l-1];e[l]=[r,t,n]},a.n=e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return a.d(o,{a:o}),o},a.d=(e,o)=>{for(var r in o)a.o(o,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce(((o,r)=>(a.f[r](e,o),o)),[])),a.u=e=>({28:"forum/components/PostsUserPage",77:"forum/components/NotificationList",247:"common/components/TextEditor",352:"forum/components/EditUserModal",395:"forum/components/SignUpModal",437:"forum/components/DiscussionComposer",460:"forum/components/LogInModal",502:"forum/components/ForgotPasswordModal",563:"forum/components/PostStream",799:"forum/components/DiscussionsUserPage",826:"forum/components/SettingsPage",847:"forum/components/IndexPage"}[e]+".js"),a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),o={},r="flarum.core:",a.l=(e,t,n,s)=>{if(o[e])o[e].push(t);else{var i,u;if(void 0!==n)for(var l=document.getElementsByTagName("script"),c=0;c<l.length;c++){var f=l[c];if(f.getAttribute("src")==e||f.getAttribute("data-webpack")==r+n){i=f;break}}i||(u=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.setAttribute("data-webpack",r+n),i.src=e),o[e]=[t];var d=(r,t)=>{i.onerror=i.onload=null,clearTimeout(m);var n=o[e];if(delete o[e],i.parentNode&&i.parentNode.removeChild(i),n&&n.forEach((e=>e(t))),r)return r(t)},m=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),u&&document.head.appendChild(i)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.p="/assets/",(()=>{var e={638:0};a.f.j=(o,r)=>{var t=a.o(e,o)?e[o]:void 0;if(0!==t)if(t)r.push(t[2]);else if(638!=o){var n=new Promise(((r,n)=>t=e[o]=[r,n]));r.push(t[2]=n);var s=a.p+a.u(o),i=new Error;a.l(s,(r=>{if(a.o(e,o)&&(0!==(t=e[o])&&(e[o]=void 0),t)){var n=r&&("load"===r.type?"missing":r.type),s=r&&r.target&&r.target.src;i.message="Loading chunk "+o+" failed.\n("+n+": "+s+")",i.name="ChunkLoadError",i.type=n,i.request=s,t[1](i)}}),"chunk-"+o,o)}else e[o]=0},a.O.j=o=>0===e[o];var o=(o,r)=>{var t,n,[s,i,u]=r,l=0;for(t in i)a.o(i,t)&&(a.m[t]=i[t]);for(u&&u(a),o&&o(r);l<s.length;l++)n=s[l],a.o(e,n)&&e[n]&&e[n][0](),e[s[l]]=0;a.O()},r=self.webpackChunkflarum_core=self.webpackChunkflarum_core||[];r.forEach(o.bind(null,0)),r.push=o.bind(null,r.push.bind(r))})(),a.O()})();
|
||||
//# sourceMappingURL=flarum-core~runtime.js.map
|
1
js/dist/forum/flarum-core~runtime.js.map
vendored
1
js/dist/forum/flarum-core~runtime.js.map
vendored
File diff suppressed because one or more lines are too long
2
js/dist/forum/runtime.js
vendored
Normal file
2
js/dist/forum/runtime.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
(()=>{"use strict";var e,o,r,t,n,a,s,i,u={},c={};function l(e){var o=c[e];if(void 0!==o)return o.exports;var r=c[e]={exports:{}};return u[e].call(r.exports,r,r.exports,l),r.exports}l.m=u,e="function"==typeof Symbol?Symbol("webpack then"):"__webpack_then__",o="function"==typeof Symbol?Symbol("webpack exports"):"__webpack_exports__",r=e=>{e&&(e.forEach((e=>e.r--)),e.forEach((e=>e.r--?e.r++:e())))},t=e=>!--e.r&&e(),n=(e,o)=>e?e.push(o):t(o),l.a=(a,s,i)=>{var u,c,l,p=i&&[],f=a.exports,m=!0,d=!1,b=(o,r,t)=>{d||(d=!0,r.r+=o.length,o.map(((o,n)=>o[e](r,t))),d=!1)},h=new Promise(((e,o)=>{l=o,c=()=>(e(f),r(p),p=0)}));h[o]=f,h[e]=(e,o)=>{if(m)return t(e);u&&b(u,e,o),n(p,e),h.catch(o)},a.exports=h,s((a=>{if(!a)return c();var s,i;u=(a=>a.map((a=>{if(null!==a&&"object"==typeof a){if(a[e])return a;if(a.then){var s=[];a.then((e=>{i[o]=e,r(s),s=0}));var i={[e]:(e,o)=>(n(s,e),a.catch(o))};return i}}return{[e]:e=>t(e),[o]:a}})))(a);var l=new Promise(((e,r)=>{(s=()=>e(i=u.map((e=>e[o])))).r=0,b(u,s,r)}));return s.r?l:i})).then(c,l),m=!1},a=[],l.O=(e,o,r,t)=>{if(!o){var n=1/0;for(u=0;u<a.length;u++){for(var[o,r,t]=a[u],s=!0,i=0;i<o.length;i++)(!1&t||n>=t)&&Object.keys(l.O).every((e=>l.O[e](o[i])))?o.splice(i--,1):(s=!1,t<n&&(n=t));s&&(a.splice(u--,1),e=r())}return e}t=t||0;for(var u=a.length;u>0&&a[u-1][2]>t;u--)a[u]=a[u-1];a[u]=[o,r,t]},l.n=e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return l.d(o,{a:o}),o},l.d=(e,o)=>{for(var r in o)l.o(o,r)&&!l.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},l.f={},l.e=e=>Promise.all(Object.keys(l.f).reduce(((o,r)=>(l.f[r](e,o),o)),[])),l.u=e=>({28:"forum/components/PostsUserPage",77:"forum/components/NotificationList",192:"forum/components/Post",247:"common/components/TextEditor",293:"forum/components/EditPostComposer",352:"forum/components/EditUserModal",395:"forum/components/SignUpModal",437:"forum/components/DiscussionComposer",460:"forum/components/LogInModal",502:"forum/components/ForgotPasswordModal",563:"forum/components/PostStream",779:"forum/components/PostUser",799:"forum/components/DiscussionsUserPage",826:"forum/components/SettingsPage",847:"forum/components/IndexPage"}[e]+".js"),l.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),l.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),s={},i="@flarum/core:",l.l=(e,o,r,t)=>{if(s[e])s[e].push(o);else{var n,a;if(void 0!==r)for(var u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var p=u[c];if(p.getAttribute("src")==e||p.getAttribute("data-webpack")==i+r){n=p;break}}n||(a=!0,(n=document.createElement("script")).charset="utf-8",n.timeout=120,l.nc&&n.setAttribute("nonce",l.nc),n.setAttribute("data-webpack",i+r),n.src=e),s[e]=[o];var f=(o,r)=>{n.onerror=n.onload=null,clearTimeout(m);var t=s[e];if(delete s[e],n.parentNode&&n.parentNode.removeChild(n),t&&t.forEach((e=>e(r))),o)return o(r)},m=setTimeout(f.bind(null,void 0,{type:"timeout",target:n}),12e4);n.onerror=f.bind(null,n.onerror),n.onload=f.bind(null,n.onload),a&&document.head.appendChild(n)}},l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.p="/assets/",(()=>{var e={406:0};l.f.j=(o,r)=>{var t=l.o(e,o)?e[o]:void 0;if(0!==t)if(t)r.push(t[2]);else if(406!=o){var n=new Promise(((r,n)=>t=e[o]=[r,n]));r.push(t[2]=n);var a=l.p+l.u(o),s=new Error;l.l(a,(r=>{if(l.o(e,o)&&(0!==(t=e[o])&&(e[o]=void 0),t)){var n=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;s.message="Loading chunk "+o+" failed.\n("+n+": "+a+")",s.name="ChunkLoadError",s.type=n,s.request=a,t[1](s)}}),"chunk-"+o,o)}else e[o]=0},l.O.j=o=>0===e[o];var o=(o,r)=>{var t,n,[a,s,i]=r,u=0;for(t in s)l.o(s,t)&&(l.m[t]=s[t]);for(i&&i(l),o&&o(r);u<a.length;u++)n=a[u],l.o(e,n)&&e[n]&&e[n][0](),e[a[u]]=0;l.O()},r=self.webpackChunk_flarum_core=self.webpackChunk_flarum_core||[];r.forEach(o.bind(null,0)),r.push=o.bind(null,r.push.bind(r))})(),l.O()})();
|
||||
//# sourceMappingURL=runtime.js.map
|
1
js/dist/forum/runtime.js.map
vendored
Normal file
1
js/dist/forum/runtime.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
2
js/dist/forum/vendor.js
vendored
2
js/dist/forum/vendor.js
vendored
File diff suppressed because one or more lines are too long
2
js/dist/forum/vendor.js.map
vendored
2
js/dist/forum/vendor.js.map
vendored
File diff suppressed because one or more lines are too long
800
js/package-lock.json
generated
800
js/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,6 @@
|
|||
"clsx": "^1.1.1",
|
||||
"color-thief-browser": "^2.0.2",
|
||||
"dayjs": "^1.10.4",
|
||||
"expose-loader": "^1.0.3",
|
||||
"jquery": "^3.6.0",
|
||||
"jquery.hotkeys": "^0.1.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
|
@ -16,6 +15,7 @@
|
|||
"textarea-caret": "^3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/plugin-proposal-export-default-from": "^7.12.13",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||
"@babel/plugin-syntax-top-level-await": "^7.12.13",
|
||||
"@babel/preset-typescript": "^7.13.0",
|
||||
|
@ -26,10 +26,13 @@
|
|||
"@types/textarea-caret": "^3.0.0",
|
||||
"babel-plugin-add-module-exports": "^1.0.4",
|
||||
"bundlewatch": "^0.3.2",
|
||||
"expose-loader": "^2.0.0",
|
||||
"flarum-webpack-config": "0.1.0-beta.10",
|
||||
"husky": "^4.3.8",
|
||||
"loader-utils": "^1.4.0",
|
||||
"prettier": "^2.2.1",
|
||||
"terser-webpack-plugin": "~5.1.1",
|
||||
"ts-loader": "^9.1.0",
|
||||
"webpack": "~5.33.2",
|
||||
"webpack-cli": "~4.6.0",
|
||||
"webpack-merge": "~5.7.3"
|
||||
|
|
3
js/shims.d.ts
vendored
3
js/shims.d.ts
vendored
|
@ -8,6 +8,8 @@ import * as _$ from 'jquery';
|
|||
// Globals from flarum/core
|
||||
import Application from './src/common/Application';
|
||||
|
||||
import FlarumRegistry from './src/common/FlarumRegistry';
|
||||
|
||||
/**
|
||||
* flarum/core exposes several extensions globally:
|
||||
*
|
||||
|
@ -41,4 +43,5 @@ declare global {
|
|||
*/
|
||||
declare global {
|
||||
const app: Application;
|
||||
const flreg: FlarumRegistry;
|
||||
}
|
||||
|
|
|
@ -3,11 +3,3 @@ import app from './app';
|
|||
export { app };
|
||||
|
||||
// Export public API
|
||||
|
||||
// Export compat API
|
||||
import compatObj from './compat';
|
||||
import proxifyCompat from '../common/utils/proxifyCompat';
|
||||
|
||||
compatObj.app = app;
|
||||
|
||||
export const compat = proxifyCompat(compatObj, 'admin');
|
||||
|
|
53
js/src/common/FlarumRegistry.ts
Normal file
53
js/src/common/FlarumRegistry.ts
Normal file
|
@ -0,0 +1,53 @@
|
|||
interface ExportRegistry {
|
||||
moduleExports: object;
|
||||
|
||||
onLoads: object;
|
||||
|
||||
/**
|
||||
* Add an instance to the registry.
|
||||
* This serves as the equivalent of `flarum.core.compat[id] = object`
|
||||
*/
|
||||
add(id: string, object: any);
|
||||
|
||||
/**
|
||||
* Add a function to run when object of id "id" is added (or overriden).
|
||||
* If such an object is already registered, the handler will be applied immediately.
|
||||
*/
|
||||
onLoad(id: string, handler: Function);
|
||||
|
||||
/**
|
||||
* Retrieve an object of type `id` from the registry.
|
||||
*/
|
||||
get(id: string): any;
|
||||
}
|
||||
|
||||
export default class FlarumRegistry implements ExportRegistry {
|
||||
moduleExports = {};
|
||||
|
||||
onLoads = {};
|
||||
|
||||
add(id: string, object: any) {
|
||||
const onLoads = this.onLoads[id];
|
||||
if (onLoads) {
|
||||
onLoads.map((onLoad) => {
|
||||
object = onLoad(object);
|
||||
});
|
||||
}
|
||||
|
||||
this.moduleExports[id] = object;
|
||||
}
|
||||
|
||||
onLoad(id: string, handler: Function) {
|
||||
const loadedObject = this.moduleExports[id];
|
||||
if (loadedObject) {
|
||||
this.moduleExports[id] = handler(loadedObject);
|
||||
} else {
|
||||
this.onLoads[id] = this.onLoads[id] || [];
|
||||
this.onLoads[id].push(handler);
|
||||
}
|
||||
}
|
||||
|
||||
get(id: string): any {
|
||||
return this.moduleExports[id];
|
||||
}
|
||||
}
|
|
@ -1,150 +0,0 @@
|
|||
import * as extend from './extend';
|
||||
import Session from './Session';
|
||||
import Store from './Store';
|
||||
import BasicEditorDriver from './utils/BasicEditorDriver';
|
||||
import evented from './utils/evented';
|
||||
import liveHumanTimes from './utils/liveHumanTimes';
|
||||
import ItemList from './utils/ItemList';
|
||||
import mixin from './utils/mixin';
|
||||
import humanTime from './utils/humanTime';
|
||||
import computed from './utils/computed';
|
||||
import Drawer from './utils/Drawer';
|
||||
import anchorScroll from './utils/anchorScroll';
|
||||
import RequestError from './utils/RequestError';
|
||||
import abbreviateNumber from './utils/abbreviateNumber';
|
||||
import * as string from './utils/string';
|
||||
import Stream from './utils/Stream';
|
||||
import SubtreeRetainer from './utils/SubtreeRetainer';
|
||||
import setRouteWithForcedRefresh from './utils/setRouteWithForcedRefresh';
|
||||
import extract from './utils/extract';
|
||||
import ScrollListener from './utils/ScrollListener';
|
||||
import stringToColor from './utils/stringToColor';
|
||||
import subclassOf from './utils/subclassOf';
|
||||
import patchMithril from './utils/patchMithril';
|
||||
import proxifyCompat from './utils/proxifyCompat';
|
||||
import classList from './utils/classList';
|
||||
import extractText from './utils/extractText';
|
||||
import formatNumber from './utils/formatNumber';
|
||||
import mapRoutes from './utils/mapRoutes';
|
||||
import withAttr from './utils/withAttr';
|
||||
import Notification from './models/Notification';
|
||||
import User from './models/User';
|
||||
import Post from './models/Post';
|
||||
import Discussion from './models/Discussion';
|
||||
import Group from './models/Group';
|
||||
import Forum from './models/Forum';
|
||||
import Component from './Component';
|
||||
import Translator from './Translator';
|
||||
import AlertManager from './components/AlertManager';
|
||||
import Page from './components/Page';
|
||||
import Switch from './components/Switch';
|
||||
import Badge from './components/Badge';
|
||||
import LoadingIndicator from './components/LoadingIndicator';
|
||||
import Placeholder from './components/Placeholder';
|
||||
import Separator from './components/Separator';
|
||||
import Dropdown from './components/Dropdown';
|
||||
import SplitDropdown from './components/SplitDropdown';
|
||||
import RequestErrorModal from './components/RequestErrorModal';
|
||||
import FieldSet from './components/FieldSet';
|
||||
import Select from './components/Select';
|
||||
import Navigation from './components/Navigation';
|
||||
import Alert from './components/Alert';
|
||||
import Link from './components/Link';
|
||||
import LinkButton from './components/LinkButton';
|
||||
import Checkbox from './components/Checkbox';
|
||||
import SelectDropdown from './components/SelectDropdown';
|
||||
import ModalManager from './components/ModalManager';
|
||||
import Button from './components/Button';
|
||||
import Modal from './components/Modal';
|
||||
import GroupBadge from './components/GroupBadge';
|
||||
//import TextEditorButton from './components/TextEditorButton';
|
||||
import Model from './Model';
|
||||
import Application from './Application';
|
||||
import fullTime from './helpers/fullTime';
|
||||
import avatar from './helpers/avatar';
|
||||
import icon from './helpers/icon';
|
||||
import humanTimeHelper from './helpers/humanTime';
|
||||
import punctuateSeries from './helpers/punctuateSeries';
|
||||
import highlight from './helpers/highlight';
|
||||
import username from './helpers/username';
|
||||
import userOnline from './helpers/userOnline';
|
||||
import listItems from './helpers/listItems';
|
||||
import Fragment from './Fragment';
|
||||
import DefaultResolver from './resolvers/DefaultResolver';
|
||||
|
||||
export default {
|
||||
extend: extend,
|
||||
Session: Session,
|
||||
Store: Store,
|
||||
'utils/BasicEditorDriver': BasicEditorDriver,
|
||||
'utils/evented': evented,
|
||||
'utils/liveHumanTimes': liveHumanTimes,
|
||||
'utils/ItemList': ItemList,
|
||||
'utils/mixin': mixin,
|
||||
'utils/humanTime': humanTime,
|
||||
'utils/computed': computed,
|
||||
'utils/Drawer': Drawer,
|
||||
'utils/anchorScroll': anchorScroll,
|
||||
'utils/RequestError': RequestError,
|
||||
'utils/abbreviateNumber': abbreviateNumber,
|
||||
'utils/string': string,
|
||||
'utils/SubtreeRetainer': SubtreeRetainer,
|
||||
'utils/extract': extract,
|
||||
'utils/ScrollListener': ScrollListener,
|
||||
'utils/stringToColor': stringToColor,
|
||||
'utils/Stream': Stream,
|
||||
'utils/subclassOf': subclassOf,
|
||||
'utils/setRouteWithForcedRefresh': setRouteWithForcedRefresh,
|
||||
'utils/patchMithril': patchMithril,
|
||||
'utils/proxifyCompat': proxifyCompat,
|
||||
'utils/classList': classList,
|
||||
'utils/extractText': extractText,
|
||||
'utils/formatNumber': formatNumber,
|
||||
'utils/mapRoutes': mapRoutes,
|
||||
'utils/withAttr': withAttr,
|
||||
'models/Notification': Notification,
|
||||
'models/User': User,
|
||||
'models/Post': Post,
|
||||
'models/Discussion': Discussion,
|
||||
'models/Group': Group,
|
||||
'models/Forum': Forum,
|
||||
Component: Component,
|
||||
Fragment: Fragment,
|
||||
Translator: Translator,
|
||||
'components/AlertManager': AlertManager,
|
||||
'components/Page': Page,
|
||||
'components/Switch': Switch,
|
||||
'components/Badge': Badge,
|
||||
'components/LoadingIndicator': LoadingIndicator,
|
||||
'components/Placeholder': Placeholder,
|
||||
'components/Separator': Separator,
|
||||
'components/Dropdown': Dropdown,
|
||||
'components/SplitDropdown': SplitDropdown,
|
||||
'components/RequestErrorModal': RequestErrorModal,
|
||||
'components/FieldSet': FieldSet,
|
||||
'components/Select': Select,
|
||||
'components/Navigation': Navigation,
|
||||
'components/Alert': Alert,
|
||||
'components/Link': Link,
|
||||
'components/LinkButton': LinkButton,
|
||||
'components/Checkbox': Checkbox,
|
||||
'components/SelectDropdown': SelectDropdown,
|
||||
'components/ModalManager': ModalManager,
|
||||
'components/Button': Button,
|
||||
'components/Modal': Modal,
|
||||
'components/GroupBadge': GroupBadge,
|
||||
//'components/TextEditor': TextEditor,
|
||||
//'components/TextEditorButton': TextEditorButton,
|
||||
Model: Model,
|
||||
Application: Application,
|
||||
'helpers/fullTime': fullTime,
|
||||
'helpers/avatar': avatar,
|
||||
'helpers/icon': icon,
|
||||
'helpers/humanTime': humanTimeHelper,
|
||||
'helpers/punctuateSeries': punctuateSeries,
|
||||
'helpers/highlight': highlight,
|
||||
'helpers/username': username,
|
||||
'helpers/userOnline': userOnline,
|
||||
'helpers/listItems': listItems,
|
||||
'resolvers/DefaultResolver': DefaultResolver,
|
||||
};
|
|
@ -146,3 +146,4 @@ export default class TextEditor extends Component {
|
|||
this.attrs.onsubmit(this.value);
|
||||
}
|
||||
}
|
||||
// Flarum Asynchronous Module
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Expose jQuery, mithril and dayjs to the window browser object
|
||||
import 'expose-loader?exposes[]=$&exposes[]=jQuery!jquery';
|
||||
import 'expose-loader?exposes=$,jQuery!jquery';
|
||||
import 'expose-loader?exposes=m!mithril';
|
||||
import 'expose-loader?exposes=dayjs!dayjs';
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function bidi(node, prop) {
|
||||
var type = node.tag === 'select' ? (node.attrs.multi ? 'multi' : 'select') : node.attrs.type;
|
||||
let type = node.tag === 'select' ? (node.attrs.multi ? 'multi' : 'select') : node.attrs.type;
|
||||
|
||||
// Setup: bind listeners
|
||||
if (type === 'multi') {
|
||||
|
@ -46,5 +46,5 @@ function bidi(node, prop) {
|
|||
bidi.view = function (ctrl, node, prop) {
|
||||
return bidi(node, node.attrs.bidi);
|
||||
};
|
||||
|
||||
window.flreg = new (require('../FlarumRegistry').default)();
|
||||
export default bidi;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export default (compat: { [key: string]: any }, namespace: string) => {
|
||||
export default function proxifyCompat(compat: { [key: string]: any }, namespace: string) {
|
||||
// regex to replace common/ and NAMESPACE/ for core & core extensions
|
||||
// e.g. admin/utils/extract --> utils/extract
|
||||
// e.g. tags/common/utils/sortTags --> tags/utils/sortTags
|
||||
|
@ -7,4 +7,4 @@ export default (compat: { [key: string]: any }, namespace: string) => {
|
|||
return new Proxy(compat, {
|
||||
get: (obj, prop: string) => obj[prop] || obj[prop.replace(regex, '$1')],
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
* Replaces m.withAttr for Mithril 2.0.
|
||||
* @see https://mithril.js.org/archive/v0.2.5/mithril.withAttr.html
|
||||
*/
|
||||
export default (key: string, cb: Function) =>
|
||||
function (this: Element) {
|
||||
export default function withAttr(key: string, cb: Function) {
|
||||
return function (this: Element) {
|
||||
cb(this.getAttribute(key) || this[key]);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,153 +0,0 @@
|
|||
import compat from '../common/compat';
|
||||
|
||||
import PostControls from './utils/PostControls';
|
||||
import KeyboardNavigatable from './utils/KeyboardNavigatable';
|
||||
import slidable from './utils/slidable';
|
||||
import History from './utils/History';
|
||||
import DiscussionControls from './utils/DiscussionControls';
|
||||
import alertEmailConfirmation from './utils/alertEmailConfirmation';
|
||||
import UserControls from './utils/UserControls';
|
||||
import Pane from './utils/Pane';
|
||||
import ComposerState from './states/ComposerState';
|
||||
import DiscussionListState from './states/DiscussionListState';
|
||||
import GlobalSearchState from './states/GlobalSearchState';
|
||||
import NotificationListState from './states/NotificationListState';
|
||||
import PostStreamState from './states/PostStreamState';
|
||||
import SearchState from './states/SearchState';
|
||||
import AffixedSidebar from './components/AffixedSidebar';
|
||||
//import DiscussionPage from './components/DiscussionPage';
|
||||
import DiscussionListPane from './components/DiscussionListPane';
|
||||
//import LogInModal from './components/LogInModal';
|
||||
//import ComposerBody from './components/ComposerBody';
|
||||
//import ForgotPasswordModal from './components/ForgotPasswordModal';
|
||||
//import Notification from './components/Notification';
|
||||
import LogInButton from './components/LogInButton';
|
||||
//import DiscussionsUserPage from './components/DiscussionsUserPage';
|
||||
//import Composer from './components/Composer';
|
||||
import SessionDropdown from './components/SessionDropdown';
|
||||
import HeaderPrimary from './components/HeaderPrimary';
|
||||
import PostEdited from './components/PostEdited';
|
||||
//import PostStream from './components/PostStream';
|
||||
import ChangePasswordModal from './components/ChangePasswordModal';
|
||||
//import IndexPage from './components/IndexPage';
|
||||
//import DiscussionRenamedNotification from './components/DiscussionRenamedNotification';
|
||||
import DiscussionsSearchSource from './components/DiscussionsSearchSource';
|
||||
import HeaderSecondary from './components/HeaderSecondary';
|
||||
import ComposerButton from './components/ComposerButton';
|
||||
import DiscussionList from './components/DiscussionList';
|
||||
//import ReplyPlaceholder from './components/ReplyPlaceholder';
|
||||
import AvatarEditor from './components/AvatarEditor';
|
||||
import Post from './components/Post';
|
||||
//import SettingsPage from './components/SettingsPage';
|
||||
import TerminalPost from './components/TerminalPost';
|
||||
import ChangeEmailModal from './components/ChangeEmailModal';
|
||||
import NotificationsDropdown from './components/NotificationsDropdown';
|
||||
//import UserPage from './components/UserPage';
|
||||
import PostUser from './components/PostUser';
|
||||
import UserCard from './components/UserCard';
|
||||
import UsersSearchSource from './components/UsersSearchSource';
|
||||
//import NotificationGrid from './components/NotificationGrid';
|
||||
import PostPreview from './components/PostPreview';
|
||||
import EventPost from './components/EventPost';
|
||||
import DiscussionHero from './components/DiscussionHero';
|
||||
import PostMeta from './components/PostMeta';
|
||||
//import EditUserModal from './components/EditUserModal';
|
||||
import SearchSource from './components/SearchSource';
|
||||
//import DiscussionRenamedPost from './components/DiscussionRenamedPost';
|
||||
//import DiscussionComposer from './components/DiscussionComposer';
|
||||
import LogInButtons from './components/LogInButtons';
|
||||
//import NotificationList from './components/NotificationList';
|
||||
import WelcomeHero from './components/WelcomeHero';
|
||||
//import SignUpModal from './components/SignUpModal';
|
||||
//import CommentPost from './components/CommentPost';
|
||||
import ComposerPostPreview from './components/ComposerPostPreview';
|
||||
//import ReplyComposer from './components/ReplyComposer';
|
||||
//import NotificationsPage from './components/NotificationsPage';
|
||||
//import PostStreamScrubber from './components/PostStreamScrubber';
|
||||
//import EditPostComposer from './components/EditPostComposer';
|
||||
import RenameDiscussionModal from './components/RenameDiscussionModal';
|
||||
import Search from './components/Search';
|
||||
//import DiscussionListItem from './components/DiscussionListItem';
|
||||
import LoadingPost from './components/LoadingPost';
|
||||
//import PostsUserPage from './components/PostsUserPage';
|
||||
import DiscussionPageResolver from './resolvers/DiscussionPageResolver';
|
||||
import BasicEditorDriver from '../common/utils/BasicEditorDriver';
|
||||
import routes from './routes';
|
||||
import ForumApplication from './ForumApplication';
|
||||
|
||||
export default Object.assign(compat, {
|
||||
'utils/PostControls': PostControls,
|
||||
'utils/KeyboardNavigatable': KeyboardNavigatable,
|
||||
'utils/slidable': slidable,
|
||||
'utils/History': History,
|
||||
'utils/DiscussionControls': DiscussionControls,
|
||||
'utils/alertEmailConfirmation': alertEmailConfirmation,
|
||||
'utils/UserControls': UserControls,
|
||||
'utils/Pane': Pane,
|
||||
'utils/BasicEditorDriver': BasicEditorDriver,
|
||||
'states/ComposerState': ComposerState,
|
||||
'states/DiscussionListState': DiscussionListState,
|
||||
'states/GlobalSearchState': GlobalSearchState,
|
||||
'states/NotificationListState': NotificationListState,
|
||||
'states/PostStreamState': PostStreamState,
|
||||
'states/SearchState': SearchState,
|
||||
'components/AffixedSidebar': AffixedSidebar,
|
||||
//'components/DiscussionPage': DiscussionPage,
|
||||
'components/DiscussionListPane': DiscussionListPane,
|
||||
//'components/LogInModal': LogInModal,
|
||||
//'components/ComposerBody': ComposerBody,
|
||||
//'components/ForgotPasswordModal': ForgotPasswordModal,
|
||||
//'components/Notification': Notification,
|
||||
'components/LogInButton': LogInButton,
|
||||
//'components/DiscussionsUserPage': DiscussionsUserPage,
|
||||
//'components/Composer': Composer,
|
||||
'components/SessionDropdown': SessionDropdown,
|
||||
'components/HeaderPrimary': HeaderPrimary,
|
||||
'components/PostEdited': PostEdited,
|
||||
//'components/PostStream': PostStream,
|
||||
'components/ChangePasswordModal': ChangePasswordModal,
|
||||
//'components/IndexPage': IndexPage,
|
||||
//'components/DiscussionRenamedNotification': DiscussionRenamedNotification,
|
||||
'components/DiscussionsSearchSource': DiscussionsSearchSource,
|
||||
'components/HeaderSecondary': HeaderSecondary,
|
||||
'components/ComposerButton': ComposerButton,
|
||||
'components/DiscussionList': DiscussionList,
|
||||
//'components/ReplyPlaceholder': ReplyPlaceholder,
|
||||
'components/AvatarEditor': AvatarEditor,
|
||||
'components/Post': Post,
|
||||
//'components/SettingsPage': SettingsPage,
|
||||
'components/TerminalPost': TerminalPost,
|
||||
'components/ChangeEmailModal': ChangeEmailModal,
|
||||
'components/NotificationsDropdown': NotificationsDropdown,
|
||||
//'components/UserPage': UserPage,
|
||||
'components/PostUser': PostUser,
|
||||
'components/UserCard': UserCard,
|
||||
'components/UsersSearchSource': UsersSearchSource,
|
||||
//'components/NotificationGrid': NotificationGrid,
|
||||
'components/PostPreview': PostPreview,
|
||||
'components/EventPost': EventPost,
|
||||
'components/DiscussionHero': DiscussionHero,
|
||||
'components/PostMeta': PostMeta,
|
||||
//'components/EditUserModal': EditUserModal,
|
||||
'components/SearchSource': SearchSource,
|
||||
//'components/DiscussionRenamedPost': DiscussionRenamedPost,
|
||||
//'components/DiscussionComposer': DiscussionComposer,
|
||||
'components/LogInButtons': LogInButtons,
|
||||
//'components/NotificationList': NotificationList,
|
||||
'components/WelcomeHero': WelcomeHero,
|
||||
//'components/SignUpModal': SignUpModal,
|
||||
//'components/CommentPost': CommentPost,
|
||||
'components/ComposerPostPreview': ComposerPostPreview,
|
||||
//'components/ReplyComposer': ReplyComposer,
|
||||
//'components/NotificationsPage': NotificationsPage,
|
||||
//'components/PostStreamScrubber': PostStreamScrubber,
|
||||
//'components/EditPostComposer': EditPostComposer,
|
||||
'components/RenameDiscussionModal': RenameDiscussionModal,
|
||||
'components/Search': Search,
|
||||
//'components/DiscussionListItem': DiscussionListItem,
|
||||
'components/LoadingPost': LoadingPost,
|
||||
//'components/PostsUserPage': PostsUserPage,
|
||||
'resolvers/DiscussionPageResolver': DiscussionPageResolver,
|
||||
routes: routes,
|
||||
ForumApplication: ForumApplication,
|
||||
});
|
|
@ -1,6 +1,4 @@
|
|||
import Post from './Post';
|
||||
import classList from '../../common/utils/classList';
|
||||
import PostUser from './PostUser';
|
||||
import PostMeta from './PostMeta';
|
||||
import PostEdited from './PostEdited';
|
||||
import ItemList from '../../common/utils/ItemList';
|
||||
|
@ -8,6 +6,9 @@ import listItems from '../../common/helpers/listItems';
|
|||
import Button from '../../common/components/Button';
|
||||
import ComposerPostPreview from './ComposerPostPreview';
|
||||
|
||||
const Post = await import(/* webpackChunkName: "forum/components/Post" */ './Post');
|
||||
const PostUser = await import(/* webpackChunkName: "forum/components/PostUser" */ './PostUser');
|
||||
|
||||
/**
|
||||
* The `CommentPost` component displays a standard `comment`-typed post. This
|
||||
* includes a number of item lists (controls, header, and footer) surrounding
|
||||
|
@ -17,7 +18,7 @@ import ComposerPostPreview from './ComposerPostPreview';
|
|||
*
|
||||
* - `post`
|
||||
*/
|
||||
export default class CommentPost extends Post {
|
||||
export default class CommentPost extends Post.default {
|
||||
oninit(vnode) {
|
||||
super.oninit(vnode);
|
||||
|
||||
|
@ -127,7 +128,7 @@ export default class CommentPost extends Post {
|
|||
|
||||
items.add(
|
||||
'user',
|
||||
PostUser.component({
|
||||
PostUser.default.component({
|
||||
post,
|
||||
cardVisible: this.cardVisible,
|
||||
oncardshow: () => {
|
||||
|
|
|
@ -105,3 +105,4 @@ export default class DiscussionComposer extends ComposerBody {
|
|||
}, this.loaded.bind(this));
|
||||
}
|
||||
}
|
||||
//Flarum Asynchronous Module
|
||||
|
|
|
@ -64,7 +64,7 @@ export default class DiscussionListItem extends Component {
|
|||
const isRead = discussion.isRead();
|
||||
const showUnread = !this.showRepliesCount() && isUnread;
|
||||
let jumpTo = 0;
|
||||
const controls = DiscussionControls.controls(discussion, this).toArray();
|
||||
const controls = new DiscussionControls().controls(discussion, this).toArray();
|
||||
const attrs = this.elementAttrs();
|
||||
|
||||
if (this.attrs.params.q) {
|
||||
|
|
|
@ -197,7 +197,7 @@ export default class DiscussionPage extends Page {
|
|||
buttonClassName: 'Button--primary',
|
||||
accessibleToggleLabel: app.translator.trans('core.forum.discussion_controls.toggle_dropdown_accessible_label'),
|
||||
},
|
||||
DiscussionControls.controls(this.discussion, this).toArray()
|
||||
new DiscussionControls().controls(this.discussion, this).toArray()
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import UserPage from './UserPage';
|
||||
import UserPage from 'flarum/components/UserPage';
|
||||
import DiscussionList from './DiscussionList';
|
||||
import DiscussionListState from '../states/DiscussionListState';
|
||||
|
||||
|
@ -28,3 +28,4 @@ export default class DiscussionsUserPage extends UserPage {
|
|||
return <div className="DiscussionsUserPage">{DiscussionList.component({ state: this.state })}</div>;
|
||||
}
|
||||
}
|
||||
//Flarum Asynchronous Module
|
||||
|
|
|
@ -244,3 +244,4 @@ export default class EditUserModal extends Modal {
|
|||
return user.groups().some((g) => g.id() === Group.ADMINISTRATOR_ID);
|
||||
}
|
||||
}
|
||||
//Flarum Asynchronous Module
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import Post from './Post';
|
||||
import { ucfirst } from '../../common/utils/string';
|
||||
import usernameHelper from '../../common/helpers/username';
|
||||
import icon from '../../common/helpers/icon';
|
||||
import Link from '../../common/components/Link';
|
||||
|
||||
const Post = await import(/* webpackChunkName: "forum/components/Post" */ './Post');
|
||||
|
||||
/**
|
||||
* The `EventPost` component displays a post which indicating a discussion
|
||||
* event, like a discussion being renamed or stickied. Subclasses must implement
|
||||
|
@ -15,7 +16,7 @@ import Link from '../../common/components/Link';
|
|||
*
|
||||
* @abstract
|
||||
*/
|
||||
export default class EventPost extends Post {
|
||||
export default class EventPost extends Post.default {
|
||||
elementAttrs() {
|
||||
const attrs = super.elementAttrs();
|
||||
|
||||
|
|
|
@ -111,3 +111,4 @@ export default class ForgotPasswordModal extends Modal {
|
|||
super.onerror(error);
|
||||
}
|
||||
}
|
||||
//Flarum Asynchronous Module
|
||||
|
|
|
@ -323,3 +323,4 @@ export default class IndexPage extends Page {
|
|||
}
|
||||
}
|
||||
}
|
||||
//Flarum Asynchronous Module
|
||||
|
|
|
@ -190,3 +190,4 @@ export default class LogInModal extends Modal {
|
|||
super.onerror(error);
|
||||
}
|
||||
}
|
||||
//Flarum Asynchronous Module
|
||||
|
|
|
@ -147,3 +147,4 @@ export default class NotificationList extends Component {
|
|||
return this.$notifications.css('overflow') === 'auto';
|
||||
}
|
||||
}
|
||||
//Flarum Asynchronous Module
|
||||
|
|
|
@ -43,7 +43,7 @@ export default class Post extends Component {
|
|||
|
||||
attrs.className = this.classes(attrs.className).join(' ');
|
||||
|
||||
const controls = PostControls.controls(this.attrs.post, this).toArray();
|
||||
const controls = new PostControls().controls(this.attrs.post, this).toArray();
|
||||
|
||||
return (
|
||||
<article {...attrs}>
|
||||
|
|
|
@ -438,3 +438,4 @@ export default class PostStream extends Component {
|
|||
});
|
||||
}
|
||||
}
|
||||
//Flarum Asynchronous Module
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import UserPage from './UserPage';
|
||||
import UserPage from 'flarum/components/UserPage';
|
||||
import LoadingIndicator from '../../common/components/LoadingIndicator';
|
||||
import Button from '../../common/components/Button';
|
||||
import Link from '../../common/components/Link';
|
||||
|
@ -156,3 +156,4 @@ export default class PostsUserPage extends UserPage {
|
|||
return results;
|
||||
}
|
||||
}
|
||||
//Flarum Asynchronous Module
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import UserPage from './UserPage';
|
||||
import UserPage from 'flarum/components/UserPage';
|
||||
import ItemList from '../../common/utils/ItemList';
|
||||
import Switch from '../../common/components/Switch';
|
||||
import Button from '../../common/components/Button';
|
||||
|
@ -116,3 +116,4 @@ export default class SettingsPage extends UserPage {
|
|||
return items;
|
||||
}
|
||||
}
|
||||
//Flarum Asynchronous Module
|
||||
|
|
|
@ -193,3 +193,4 @@ export default class SignUpModal extends Modal {
|
|||
return data;
|
||||
}
|
||||
}
|
||||
//Flarum Asynchronous Module
|
||||
|
|
|
@ -25,7 +25,7 @@ import listItems from '../../common/helpers/listItems';
|
|||
export default class UserCard extends Component {
|
||||
view() {
|
||||
const user = this.attrs.user;
|
||||
const controls = UserControls.controls(user, this).toArray();
|
||||
const controls = new UserControls().controls(user, this).toArray();
|
||||
const color = user.color();
|
||||
const badges = user.badges().toArray();
|
||||
|
||||
|
|
|
@ -9,11 +9,3 @@ export { app };
|
|||
// Export public API
|
||||
// export { default as Extend } from './Extend';
|
||||
// export { IndexPage, DicsussionList } from './components';
|
||||
|
||||
// Export compat API
|
||||
import compatObj from './compat';
|
||||
import proxifyCompat from '../common/utils/proxifyCompat';
|
||||
|
||||
compatObj.app = app;
|
||||
|
||||
export const compat = proxifyCompat(compatObj, 'forum');
|
||||
|
|
|
@ -9,7 +9,7 @@ import extractText from '../../common/utils/extractText';
|
|||
* The `DiscussionControls` utility constructs a list of buttons for a
|
||||
* discussion which perform actions on it.
|
||||
*/
|
||||
export default {
|
||||
export default class DiscussionControls {
|
||||
/**
|
||||
* Get a list of controls for a discussion.
|
||||
*
|
||||
|
@ -31,7 +31,7 @@ export default {
|
|||
});
|
||||
|
||||
return items;
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Get controls for a discussion pertaining to the current user (e.g. reply,
|
||||
|
@ -80,7 +80,7 @@ export default {
|
|||
}
|
||||
|
||||
return items;
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Get controls for a discussion pertaining to moderation (e.g. rename, lock).
|
||||
|
@ -108,7 +108,7 @@ export default {
|
|||
}
|
||||
|
||||
return items;
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Get controls for a discussion which are destructive (e.g. delete).
|
||||
|
@ -164,7 +164,7 @@ export default {
|
|||
}
|
||||
|
||||
return items;
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the reply composer for the discussion. A promise will be returned,
|
||||
|
@ -208,7 +208,7 @@ export default {
|
|||
|
||||
return reject();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide a discussion.
|
||||
|
@ -219,7 +219,7 @@ export default {
|
|||
this.pushAttributes({ hiddenAt: new Date(), hiddenUser: app.session.user });
|
||||
|
||||
return this.save({ isHidden: true });
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore a discussion.
|
||||
|
@ -230,7 +230,7 @@ export default {
|
|||
this.pushAttributes({ hiddenAt: null, hiddenUser: null });
|
||||
|
||||
return this.save({ isHidden: false });
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the discussion after confirming with the user.
|
||||
|
@ -247,7 +247,7 @@ export default {
|
|||
|
||||
return this.delete().then(() => app.discussions.removeDiscussion(this));
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename the discussion.
|
||||
|
@ -259,5 +259,5 @@ export default {
|
|||
currentTitle: this.title(),
|
||||
discussion: this,
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import extractText from '../../common/utils/extractText';
|
|||
* The `PostControls` utility constructs a list of buttons for a post which
|
||||
* perform actions on it.
|
||||
*/
|
||||
export default {
|
||||
export default class PostControls {
|
||||
/**
|
||||
* Get a list of controls for a post.
|
||||
*
|
||||
|
@ -30,7 +30,7 @@ export default {
|
|||
});
|
||||
|
||||
return items;
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Get controls for a post pertaining to the current user (e.g. report).
|
||||
|
@ -43,7 +43,7 @@ export default {
|
|||
*/
|
||||
userControls(post, context) {
|
||||
return new ItemList();
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Get controls for a post pertaining to moderation (e.g. edit).
|
||||
|
@ -73,7 +73,7 @@ export default {
|
|||
}
|
||||
|
||||
return items;
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Get controls for a post that are destructive (e.g. delete).
|
||||
|
@ -128,7 +128,7 @@ export default {
|
|||
}
|
||||
|
||||
return items;
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the composer to edit a post.
|
||||
|
@ -142,7 +142,7 @@ export default {
|
|||
|
||||
return resolve();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide a post.
|
||||
|
@ -154,7 +154,7 @@ export default {
|
|||
this.pushAttributes({ hiddenAt: new Date(), hiddenUser: app.session.user });
|
||||
|
||||
return this.save({ isHidden: true }).then(() => m.redraw());
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore a post.
|
||||
|
@ -165,7 +165,7 @@ export default {
|
|||
this.pushAttributes({ hiddenAt: null, hiddenUser: null });
|
||||
|
||||
return this.save({ isHidden: false }).then(() => m.redraw());
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a post.
|
||||
|
@ -197,5 +197,5 @@ export default {
|
|||
if (context) context.loading = false;
|
||||
m.redraw();
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import ItemList from '../../common/utils/ItemList';
|
|||
* The `UserControls` utility constructs a list of buttons for a user which
|
||||
* perform actions on it.
|
||||
*/
|
||||
export default {
|
||||
export default class UserControls {
|
||||
/**
|
||||
* Get a list of controls for a user.
|
||||
*
|
||||
|
@ -29,7 +29,7 @@ export default {
|
|||
});
|
||||
|
||||
return items;
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Get controls for a user pertaining to the current user (e.g. poke, follow).
|
||||
|
@ -42,7 +42,7 @@ export default {
|
|||
*/
|
||||
userControls() {
|
||||
return new ItemList();
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Get controls for a user pertaining to moderation (e.g. suspend, edit).
|
||||
|
@ -66,7 +66,7 @@ export default {
|
|||
}
|
||||
|
||||
return items;
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Get controls for a user which are destructive (e.g. delete).
|
||||
|
@ -90,7 +90,7 @@ export default {
|
|||
}
|
||||
|
||||
return items;
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the user.
|
||||
|
@ -113,7 +113,7 @@ export default {
|
|||
}
|
||||
})
|
||||
.catch(() => this.showDeletionAlert(user, 'error'));
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Show deletion alert of user.
|
||||
|
@ -129,7 +129,7 @@ export default {
|
|||
}[type];
|
||||
|
||||
app.alerts.show({ type }, app.translator.trans(message, { username, email }));
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit the user.
|
||||
|
@ -140,5 +140,5 @@ export default {
|
|||
const EditUserModal = () => import(/* webpackChunkName: "forum/components/EditUserModal" */ '../components/EditUserModal');
|
||||
|
||||
app.modal.show(EditUserModal, { user });
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,18 +3,26 @@ const path = require('path');
|
|||
const webpack = require('webpack');
|
||||
const TerserPlugin = require("terser-webpack-plugin");
|
||||
|
||||
module.exports = function(options = {}) {
|
||||
process.traceDeprecation = true;
|
||||
|
||||
module.exports = function (options = {}) {
|
||||
return {
|
||||
// Set up entry points for each of the forum + admin apps, but only
|
||||
// if they exist.
|
||||
entry: function() {
|
||||
entry: function () {
|
||||
const entries = {};
|
||||
|
||||
for (const app of ['forum', 'admin']) {
|
||||
const file = path.resolve(process.cwd(), app+'.js');
|
||||
const file = path.resolve(process.cwd(), app + '.js');
|
||||
if (fs.existsSync(file)) {
|
||||
const entry = `/${app}/${require(path.resolve(process.cwd(), 'package.json')).name.replace('@', '').replace('/', '-')}`
|
||||
entries[entry] = file;
|
||||
entries[app] = {
|
||||
import: file,
|
||||
filename: `${app}/${require(path.resolve(process.cwd(), 'package.json')).name.replace('@', '').replace('/', '-')}.js`,
|
||||
library: {
|
||||
name: `flarum.core`,
|
||||
type: 'assign',
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,10 +33,13 @@ module.exports = function(options = {}) {
|
|||
extensions: ['.ts', '.tsx', '.js', '.json'],
|
||||
},
|
||||
|
||||
experiments: {
|
||||
topLevelAwait: true
|
||||
},
|
||||
|
||||
optimization: {
|
||||
optimization: {
|
||||
runtimeChunk: {
|
||||
name: entrypoint => `${entrypoint.name}~runtime`
|
||||
name: entrypoint => `${entrypoint.name}/runtime`
|
||||
},
|
||||
splitChunks: {
|
||||
chunks: 'all',
|
||||
|
@ -39,14 +50,14 @@ module.exports = function(options = {}) {
|
|||
test: /[\\/]node_modules[\\/]/,
|
||||
priority: -10,
|
||||
name(module, entry) {
|
||||
return `${entry[0].name.match(/[^\/]*\/[^\/]*/)[0]}/vendor`;
|
||||
return `${entry[0].name}/vendor`;
|
||||
}
|
||||
},
|
||||
common: {
|
||||
test: /[\\/]common[\\/]/,
|
||||
priority: -20,
|
||||
reuseExistingChunk: true,
|
||||
name: '/common/common'
|
||||
name: 'common/common'
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -87,34 +98,37 @@ module.exports = function(options = {}) {
|
|||
{
|
||||
test: /\.(tsx?|js)$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: [
|
||||
['@babel/preset-env', {modules: false, loose: true}],
|
||||
['@babel/preset-react'],
|
||||
['@babel/preset-typescript']
|
||||
],
|
||||
plugins: [
|
||||
['@babel/plugin-transform-runtime', {useESModules: true}],
|
||||
['@babel/plugin-proposal-class-properties'],
|
||||
['@babel/plugin-transform-react-jsx', {pragma: 'm'}],
|
||||
['@babel/plugin-transform-object-assign'],
|
||||
['@babel/plugin-syntax-dynamic-import']
|
||||
]
|
||||
use: [
|
||||
{
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: [
|
||||
['@babel/preset-env', {modules: false, loose: true}],
|
||||
['@babel/preset-react'],
|
||||
['@babel/preset-typescript']
|
||||
],
|
||||
plugins: [
|
||||
['@babel/plugin-transform-runtime', {useESModules: true}],
|
||||
['@babel/plugin-proposal-class-properties'],
|
||||
['@babel/plugin-transform-react-jsx', {pragma: 'm'}],
|
||||
['@babel/plugin-transform-object-assign'],
|
||||
['@babel/plugin-syntax-dynamic-import'],
|
||||
['@babel/plugin-proposal-export-default-from']
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: path.resolve(__dirname, 'CustomLoader.js')
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
output: {
|
||||
path: path.resolve(process.cwd(), 'dist'),
|
||||
library: 'flarum.core',
|
||||
libraryTarget: 'assign',
|
||||
chunkFilename: '[name].js',
|
||||
publicPath: "/assets/",
|
||||
filename: '[name].js',
|
||||
devtoolNamespace: require(path.resolve(process.cwd(), 'package.json')).name
|
||||
},
|
||||
|
||||
|
@ -125,14 +139,14 @@ module.exports = function(options = {}) {
|
|||
'jquery': 'jQuery'
|
||||
},
|
||||
|
||||
function() {
|
||||
function () {
|
||||
const externals = {};
|
||||
|
||||
if (options.useExtensions) {
|
||||
for (const extension of options.useExtensions) {
|
||||
externals['@'+extension] =
|
||||
externals['@'+extension+'/forum'] =
|
||||
externals['@'+extension+'/admin'] = "flarum.extensions['"+extension+"']";
|
||||
externals['@' + extension] =
|
||||
externals['@' + extension + '/forum'] =
|
||||
externals['@' + extension + '/admin'] = "flarum.extensions['" + extension + "']";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,12 +154,12 @@ module.exports = function(options = {}) {
|
|||
}(),
|
||||
|
||||
// Support importing old-style core modules.
|
||||
function(context, request, callback) {
|
||||
function ({context, request}, cb) {
|
||||
let matches;
|
||||
if ((matches = /^flarum\/(.+)$/.exec(request))) {
|
||||
return callback(null, 'root flarum.core.compat[\'' + matches[1] + '\']');
|
||||
return cb(null, `window.flreg.get('${matches[1]}')`);
|
||||
}
|
||||
callback();
|
||||
cb();
|
||||
}
|
||||
],
|
||||
|
||||
|
|
|
@ -45,15 +45,16 @@ class JsCompiler extends RevisionCompiler
|
|||
if ($source instanceof FolderSource) {
|
||||
foreach ($content as $file) {
|
||||
$filepath = $source->getPath().'/'.$file;
|
||||
$destination = $source->getDirectoryName().'/'.$file;
|
||||
if (is_dir($filepath)) {
|
||||
$this->levelN($filepath, $source, $file);
|
||||
} else {
|
||||
if (pathinfo($filepath, PATHINFO_EXTENSION) !== 'js') {
|
||||
$this->assetsDir->put($source->getDirectoryName().'/'.$file, file_get_contents($filepath));
|
||||
$this->assetsDir->put($destination, file_get_contents($filepath));
|
||||
} else {
|
||||
$content = file_get_contents($filepath);
|
||||
$cacheDifferentiator = hash('crc32b', serialize(array_merge($source->getCacheDifferentiator(), [$content])));
|
||||
$this->putFile($source->getDirectoryName().'/'.$file, $cacheDifferentiator, $content);
|
||||
$this->putFile($destination, $cacheDifferentiator, $content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +65,7 @@ class JsCompiler extends RevisionCompiler
|
|||
if (file_exists($sourceMap)) {
|
||||
$map->concat($sourceMap, $line);
|
||||
}
|
||||
$output[] = 'var module={};';
|
||||
}
|
||||
|
||||
$content = $this->format($content);
|
||||
|
@ -88,7 +90,7 @@ class JsCompiler extends RevisionCompiler
|
|||
|
||||
private function levelN($filepath, $source, $file)
|
||||
{
|
||||
$this->assetsDir->makeDirectory($file);
|
||||
$this->assetsDir->makeDirectory($source->getDirectoryName().'/'.$file);
|
||||
foreach (array_diff(scandir($filepath), ['.', '..']) as $levelNFile) {
|
||||
$filepath2 = $filepath.'/'.$levelNFile;
|
||||
if (is_dir($filepath2)) {
|
||||
|
|
|
@ -20,7 +20,7 @@ class RevisionCompiler implements CompilerInterface
|
|||
|
||||
const EMPTY_REVISION = 'empty';
|
||||
|
||||
protected $ignoredDirectories = [
|
||||
protected $ignoredItems = [
|
||||
'fonts'
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user