diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index cbb28f4..eb02c82 100644 --- a/js/dist/admin.js.map +++ b/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://@fof/drafts/webpack/bootstrap","webpack://@fof/drafts/external \"flarum.core.compat['extend']\"","webpack://@fof/drafts/external \"flarum.extensions['fof-components']\"","webpack://@fof/drafts/external \"flarum.core.compat['components/PermissionGrid']\"","webpack://@fof/drafts/./src/admin/index.js","webpack://@fof/drafts/external \"flarum.core.compat['app']\""],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","extensions","SettingsModal","settings","BooleanItem","items","app","initializers","add","extensionSettings","modal","show","title","translator","trans","type","extend","required","permission","push","PermissionGrid","icon","label"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAA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AUC,GACnC,wBAAfA,GACAD,EAASE,KAAK,sBAItBH,iBAAOI,IAAe1B,UAAW,cAAc,SAACW,GAC5CA,EAAMG,IAAI,mBAAoB,CAC1Ba,KAAM,aACNC,MAAOhB,EAAIO,WAAWC,MAAM,sCAC5BI,WAAY,oBAGhBb,EAAMG,IAAI,qBAAsB,CAC5Ba,KAAM,uBACNC,MAAOhB,EAAIO,WAAWC,MAAM,yCAC5BI,WAAY,+B,gBCnDxBrD,EAAOD,QAAUkC,OAAOC,KAAKC,OAAY","file":"admin.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 28);\n","module.exports = flarum.core.compat['extend'];","module.exports = flarum.extensions['fof-components'];","module.exports = flarum.core.compat['components/PermissionGrid'];","/*\n *\n * This file is part of fof/drafts.\n *\n * Copyright (c) 2019 FriendsOfFlarum.\n *\n * For the full copyright and license information, please view the LICENSE.md\n * file that was distributed with this source code.\n *\n */\n\nimport app from 'flarum/app';\nimport { extend } from 'flarum/extend';\nimport PermissionGrid from 'flarum/components/PermissionGrid';\nimport { settings } from '@fof-components';\n\nconst {\n SettingsModal,\n items: { BooleanItem },\n} = settings;\n\napp.initializers.add('fof-drafts', (app) => {\n app.extensionSettings['fof-drafts'] = () =>\n app.modal.show(\n new SettingsModal({\n title: app.translator.trans('fof-drafts.admin.settings.title'),\n type: 'small',\n items: [\n \n {app.translator.trans('fof-drafts.admin.settings.enable_scheduled_drafts')}\n ,\n ],\n })\n );\n\n extend(app, 'getRequiredPermissions', function (required, permission) {\n if (permission === 'user.scheduleDrafts') {\n required.push('user.saveDrafts');\n }\n });\n\n extend(PermissionGrid.prototype, 'startItems', (items) => {\n items.add('fof-draft-create', {\n icon: 'fa fa-edit',\n label: app.translator.trans('fof-drafts.admin.permissions.start'),\n permission: 'user.saveDrafts',\n });\n\n items.add('fof-draft-schedule', {\n icon: 'fas fa-calendar-plus',\n label: app.translator.trans('fof-drafts.admin.permissions.schedule'),\n permission: 'user.scheduleDrafts',\n });\n });\n});\n","module.exports = flarum.core.compat['app'];"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/drafts/webpack/bootstrap","webpack://@fof/drafts/external \"flarum.core.compat['extend']\"","webpack://@fof/drafts/external \"flarum.extensions['fof-components']\"","webpack://@fof/drafts/external \"flarum.core.compat['components/PermissionGrid']\"","webpack://@fof/drafts/./src/admin/index.js","webpack://@fof/drafts/external \"flarum.core.compat['app']\""],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","extensions","SettingsModal","settings","BooleanItem","items","app","initializers","add","extensionSettings","modal","show","title","translator","trans","type","extend","required","permission","push","PermissionGrid","icon","label"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ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E,IAAIC,aAAaC,IAAI,cAAc,SAACF,GAChCA,EAAIG,kBAAkB,cAAgB,kBAClCH,EAAII,MAAMC,KACN,IAAIT,EAAc,CACdU,MAAON,EAAIO,WAAWC,MAAM,mCAC5BC,KAAM,QACNV,MAAO,CACH,EAACD,EAAD,CAAaf,IAAI,sCACZiB,EAAIO,WAAWC,MAAM,2DAM1CE,iBAAOV,EAAK,0BAA0B,SAAUW,EAAUC,GACnC,wBAAfA,GACAD,EAASE,KAAK,sBAItBH,iBAAOI,IAAe1B,UAAW,cAAc,SAACW,GAC5CA,EAAMG,IAAI,mBAAoB,CAC1Ba,KAAM,aACNC,MAAOhB,EAAIO,WAAWC,MAAM,sCAC5BI,WAAY,oBAGhBb,EAAMG,IAAI,qBAAsB,CAC5Ba,KAAM,uBACNC,MAAOhB,EAAIO,WAAWC,MAAM,yCAC5BI,WAAY,+B,gBCnDxBrD,EAAOD,QAAUkC,OAAOC,KAAKC,OAAY","file":"admin.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 28);\n","module.exports = flarum.core.compat['extend'];","module.exports = flarum.extensions['fof-components'];","module.exports = flarum.core.compat['components/PermissionGrid'];","/*\r\n *\r\n * This file is part of fof/drafts.\r\n *\r\n * Copyright (c) 2019 FriendsOfFlarum.\r\n *\r\n * For the full copyright and license information, please view the LICENSE.md\r\n * file that was distributed with this source code.\r\n *\r\n */\r\n\r\nimport app from 'flarum/app';\r\nimport { extend } from 'flarum/extend';\r\nimport PermissionGrid from 'flarum/components/PermissionGrid';\r\nimport { settings } from '@fof-components';\r\n\r\nconst {\r\n SettingsModal,\r\n items: { BooleanItem },\r\n} = settings;\r\n\r\napp.initializers.add('fof-drafts', (app) => {\r\n app.extensionSettings['fof-drafts'] = () =>\r\n app.modal.show(\r\n new SettingsModal({\r\n title: app.translator.trans('fof-drafts.admin.settings.title'),\r\n type: 'small',\r\n items: [\r\n \r\n {app.translator.trans('fof-drafts.admin.settings.enable_scheduled_drafts')}\r\n ,\r\n ],\r\n })\r\n );\r\n\r\n extend(app, 'getRequiredPermissions', function (required, permission) {\r\n if (permission === 'user.scheduleDrafts') {\r\n required.push('user.saveDrafts');\r\n }\r\n });\r\n\r\n extend(PermissionGrid.prototype, 'startItems', (items) => {\r\n items.add('fof-draft-create', {\r\n icon: 'fa fa-edit',\r\n label: app.translator.trans('fof-drafts.admin.permissions.start'),\r\n permission: 'user.saveDrafts',\r\n });\r\n\r\n items.add('fof-draft-schedule', {\r\n icon: 'fas fa-calendar-plus',\r\n label: app.translator.trans('fof-drafts.admin.permissions.schedule'),\r\n permission: 'user.scheduleDrafts',\r\n });\r\n });\r\n});\r\n","module.exports = flarum.core.compat['app'];"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index 2a9c8b3..147d037 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -module.exports=function(t){var e={};function a(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,a),n.l=!0,n.exports}return a.m=t,a.c=e,a.d=function(t,e,r){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)a.d(r,n,function(e){return t[e]}.bind(null,n));return r},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=27)}([function(t,e){t.exports=flarum.core.compat.extend},function(t,e){t.exports=flarum.core.compat.Model},function(t,e){t.exports=flarum.core.compat["components/Button"]},function(t,e){t.exports=flarum.core.compat["components/Composer"]},function(t,e){t.exports=flarum.core.compat.app},function(t,e){t.exports=flarum.core.compat["components/DiscussionComposer"]},function(t,e){t.exports=flarum.core.compat["components/ReplyComposer"]},function(t,e){t.exports=flarum.core.compat["utils/ItemList"]},function(t,e){t.exports=flarum.core.compat["components/LoadingIndicator"]},function(t,e){t.exports=flarum.core.compat["components/SettingsPage"]},function(t,e){t.exports=flarum.core.compat["models/User"]},function(t,e){t.exports=flarum.core.compat["components/Alert"]},,function(t,e){t.exports=flarum.core.compat["utils/mixin"]},function(t,e){t.exports=flarum.core.compat["components/Page"]},function(t,e){t.exports=flarum.core.compat.Component},function(t,e){t.exports=flarum.core.compat["helpers/avatar"]},function(t,e){t.exports=flarum.core.compat["helpers/icon"]},function(t,e){t.exports=flarum.core.compat["helpers/humanTime"]},function(t,e){t.exports=flarum.core.compat["utils/string"]},function(t,e){t.exports=flarum.core.compat["components/Modal"]},function(t,e){t.exports=flarum.core.compat["components/HeaderSecondary"]},function(t,e){t.exports=flarum.core.compat["components/NotificationsDropdown"]},function(t,e){t.exports=flarum.core.compat["components/FieldSet"]},function(t,e){t.exports=flarum.core.compat["components/Switch"]},,function(t,e){t.exports=flarum.extensions["fof-byobu"]},function(t,e,a){"use strict";function r(){return(r=Object.assign||function(t){for(var e=1;e=o.length)break;c=o[i++]}else{if((i=o.next()).done)break;c=i.value}var u=c;if(!a&&n(u)||n(u)!=a.data.attributes[u])return!0}if(!e.relationships)return!1;for(var p=function(t,e,a){if(!(t.relationships[a].length||a in e.relationships()&&e.relationships()[a].data.length))return!0;if(!(a in e.relationships())||t.relationships[a].length!==e.relationships()[a].data.length)return!1;var r=function(t){return"function"==typeof t.id?t.id():t.id},n=d(t.relationships[a],r),o=d(e.relationships()[a].data,r);return!n.some((function(t,e){return t!==o[e]}))},l=0,f=Object.keys(e.relationships);l=o.length)break;c=o[i++]}else{if((i=o.next()).done)break;c=i.value}var u=c;if(!a&&n(u)||a&&n(u)!=a.data.attributes[u])return!0}if(!e.relationships)return!1;for(var p=function(t,e,a){if(!(t.relationships[a].length||a in e.relationships()&&e.relationships()[a].data.length))return!0;if(!(a in e.relationships())||t.relationships[a].length!==e.relationships()[a].data.length)return!1;var r=function(t){return"function"==typeof t.id?t.id():t.id},n=d(t.relationships[a],r),o=d(e.relationships()[a].data,r);return!n.some((function(t,e){return t!==o[e]}))},l=0,f=Object.keys(e.relationships);l (Array.isArray(data) ? data.map(map).sort() : map(data));\n","/*\n *\n * This file is part of fof/drafts.\n *\n * Copyright (c) 2019 FriendsOfFlarum.\n *\n * For the full copyright and license information, please view the LICENSE.md\n * file that was distributed with this source code.\n *\n */\nimport Model from 'flarum/Model';\nimport ItemList from 'flarum/utils/ItemList';\nimport mixin from 'flarum/utils/mixin';\nimport fillRelationship from '../utils/fillRelationship';\n\nexport default class Draft extends mixin(Model, {\n user: Model.hasOne('user'),\n content: Model.attribute('content'),\n title: Model.attribute('title'),\n scheduledValidationError: Model.attribute('scheduledValidationError'),\n relationships: Model.attribute('relationships'),\n scheduledFor: Model.attribute('scheduledFor', Model.transformDate),\n updatedAt: Model.attribute('updatedAt', Model.transformDate),\n\n loadedRelationships: null,\n\n type() {\n const relationships = this.loadRelationships();\n if ('discussion' in relationships) {\n return 'reply';\n } else if (app.initializers.has('fof-byobu') && ('recipientGroups' in relationships || 'recipientUsers' in relationships)) {\n return 'privateDiscussion';\n } else {\n return 'discussion';\n }\n },\n\n icon() {\n switch (this.type()) {\n case 'discussion':\n return 'fas fa-edit';\n case 'reply':\n return 'fas fa-reply';\n case 'privateDiscussion':\n return 'fas fa-eye-slash';\n }\n },\n\n loadRelationships(force) {\n if (!force && this.loadedRelationships) {\n return this.loadedRelationships;\n }\n\n this.loadedRelationships = {};\n\n const relationships = this.relationships();\n\n if (relationships) {\n Object.keys(relationships).forEach((relationshipName) => {\n const relationship = relationships[relationshipName];\n\n if (!relationship || !relationship.data) return;\n\n this.loadedRelationships[relationshipName] = fillRelationship(relationship.data, (model) => app.store.getById(model.type, model.id));\n });\n }\n\n if ('recipientUsers' in this.loadedRelationships || 'recipientGroups' in this.loadedRelationships) {\n const recipients = new ItemList();\n\n (this.loadedRelationships['recipientUsers'] || []).forEach((user) => {\n if (user) recipients.add('users:' + user.id(), user);\n });\n (this.loadedRelationships['recipientGroups'] || []).forEach((group) => {\n if (group) recipients.add('groups:' + group.id(), group);\n });\n\n this.loadedRelationships['recipients'] = recipients;\n }\n\n return this.loadedRelationships;\n },\n\n compileData() {\n const data = {\n originalContent: this.content(),\n title: this.title(),\n user: app.session.user,\n confirmExit: app.translator.trans('fof-drafts.forum.composer.exit_alert'),\n draft: this,\n };\n\n Object.assign(data, this.loadRelationships());\n\n return data;\n },\n}) {}\n","/**\n * Simple resource loader based on David Walsh's tutorial\n * https://davidwalsh.name/javascript-loader\n * https://davidwalsh.name/javascript-functions\n */\nexport default (function() {\n // Function which returns a function\n function _load(tag) {\n return function(url) {\n // This promise will be used by Promise.all to determine success or failure\n return new Promise(function(resolve, reject) {\n var element = document.createElement(tag);\n var parent = \"body\";\n var attr = \"src\";\n\n // Important success and error for the promise\n element.onload = function() {\n resolve(url);\n };\n element.onerror = function() {\n reject(url);\n };\n\n // Need to set different attributes depending on tag type\n switch (tag) {\n case \"script\":\n element.async = true;\n break;\n case \"link\":\n element.type = \"text/css\";\n element.rel = \"stylesheet\";\n attr = \"href\";\n parent = \"head\";\n }\n\n // Inject into document to kick off loading\n element[attr] = url;\n document[parent].appendChild(element);\n });\n };\n }\n\n return {\n css: _load(\"link\"),\n js: _load(\"script\"),\n img: _load(\"img\")\n };\n})();\n","import Alert from 'flarum/components/Alert';\nimport Button from 'flarum/components/Button';\nimport Modal from 'flarum/components/Modal';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\n\nimport load from 'external-load';\n\nexport default class ScheduleDraftModal extends Modal {\n init() {\n super.init();\n\n this.loading = false;\n }\n\n className() {\n return 'ScheduleDraftModal';\n }\n\n title() {\n return app.translator.trans('fof-drafts.forum.schedule_draft_modal.title');\n }\n\n content() {\n if (this.loading) {\n return ;\n }\n\n return [\n this.props.draft.scheduledFor() ? (\n
\n \n {app.translator.trans('fof-drafts.forum.schedule_draft_modal.scheduled_text', {\n datetime: moment(this.props.draft.scheduledFor()).format('LLLL'),\n })}\n \n
\n ) : (\n ''\n ),\n this.props.draft.scheduledValidationError() ? (\n
\n \n {app.translator.trans('fof-drafts.forum.schedule_draft_modal.scheduled_error', {\n error: this.props.draft.scheduledValidationError(),\n })}\n \n
\n ) : (\n ''\n ),\n ,\n
\n
\n

{app.translator.trans('fof-drafts.forum.schedule_draft_modal.text')}

\n
\n \n
\n
\n {Button.component({\n className: 'Button Button--block' + (this.unscheduleMode() ? ' Button--danger' : ' Button--primary'),\n type: 'submit',\n loading: this.loading,\n children: this.unscheduleMode()\n ? app.translator.trans('fof-drafts.forum.schedule_draft_modal.unschedule_button')\n : this.rescheduleMode()\n ? app.translator.trans('fof-drafts.forum.schedule_draft_modal.reschedule_button')\n : app.translator.trans('fof-drafts.forum.schedule_draft_modal.schedule_button'),\n })}\n
\n
\n
,\n ];\n }\n\n config(isInitialized) {\n if (isInitialized) return;\n\n const url = app.forum.attribute('baseUrl') + '/assets/extensions/fof-drafts/flatpickr';\n\n this.loading = true;\n\n Promise.all(typeof flatpickr === 'undefined' ? [load.js(`${url}.js`), load.css(`${url}.css`)] : []).then(() => {\n this.loading = false;\n\n m.redraw();\n\n this.flatpickr = flatpickr('.flatpickr-input', {\n enableTime: true,\n enableSeconds: false,\n minDate: Date.now(),\n maxDate: new Date(9999, 12, 31),\n defaultDate: this.props.draft.scheduledFor(),\n });\n });\n }\n\n scheduledFor() {\n return new Date($('input[name=scheduledFor]').val());\n }\n\n changed() {\n const getTimeOrNull = (date) => (date ? date.getTime() : null);\n\n return getTimeOrNull(this.scheduledFor()) !== getTimeOrNull(this.props.draft.scheduledFor());\n }\n\n unscheduleMode() {\n return !this.changed() && this.props.draft.scheduledFor();\n }\n\n rescheduleMode() {\n return this.changed() && this.props.draft.scheduledFor();\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.props.draft\n .save({ scheduledFor: this.unscheduleMode() ? null : this.scheduledFor(), clearValidationError: true, scheduledValidationError: '' })\n .then(() => (this.success = true))\n .catch(() => {})\n .then(this.loaded.bind(this));\n }\n}\n","/*\n *\n * This file is part of fof/drafts.\n *\n * Copyright (c) 2019 FriendsOfFlarum.\n *\n * For the full copyright and license information, please view the LICENSE.md\n * file that was distributed with this source code.\n *\n */\n\nimport Component from 'flarum/Component';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport DiscussionComposer from 'flarum/components/DiscussionComposer';\nimport ReplyComposer from 'flarum/components/ReplyComposer';\nimport avatar from 'flarum/helpers/avatar';\nimport icon from 'flarum/helpers/icon';\nimport humanTime from 'flarum/helpers/humanTime';\nimport { truncate } from 'flarum/utils/string';\nimport Button from 'flarum/components/Button';\nimport ScheduleDraftModal from './ScheduleDraftModal';\nimport fillRelationship from '../utils/fillRelationship';\n\nexport default class DraftsList extends Component {\n config(isInitialized) {\n if (!isInitialized) return;\n\n $('.draft--delete').on('click tap', function (event) {\n event.stopPropagation();\n });\n }\n\n view() {\n const drafts = app.store.all('drafts');\n\n return (\n
\n
\n

{app.translator.trans('fof-drafts.forum.dropdown.title')}

\n
\n
\n \n
\n
\n );\n }\n\n deleteDraft(draft) {\n this.loading = true;\n\n if (!window.confirm(app.translator.trans('fof-drafts.forum.dropdown.alert'))) return;\n\n draft.delete().then(() => {\n if (app.composer.component && app.composer.component.draft.id() === draft.id() && !app.composer.changed()) {\n app.composer.hide();\n }\n\n this.loading = false;\n m.redraw();\n });\n }\n\n scheduleDraft(draft) {\n if (!app.forum.attribute('canScheduleDrafts') || !app.forum.attribute('drafts.enableScheduledDrafts')) return;\n\n app.modal.show(new ScheduleDraftModal({ draft }));\n }\n\n showComposer(draft) {\n if (this.loading) return;\n\n const deferred = m.deferred();\n\n let componentClass;\n\n switch (draft.type()) {\n case 'privateDiscussion':\n componentClass = require('@fof-byobu').components['PrivateDiscussionComposer'];\n break;\n case 'reply':\n componentClass = ReplyComposer;\n break;\n default:\n componentClass = DiscussionComposer;\n }\n\n const component = new componentClass(draft.compileData());\n\n app.composer.load(component);\n app.composer.show();\n\n deferred.resolve(component);\n\n return deferred.promise;\n }\n\n load() {\n if (app.cache.draftsLoaded) {\n return;\n }\n\n this.loading = true;\n m.redraw();\n\n app.store\n .find('drafts')\n .then(\n () => (app.cache.draftsLoaded = true),\n () => {}\n )\n .then(() => {\n this.loading = false;\n m.redraw();\n });\n }\n}\n","/*\n *\n * This file is part of fof/drafts.\n *\n * Copyright (c) 2019 FriendsOfFlarum.\n *\n * For the full copyright and license information, please view the LICENSE.md\n * file that was distributed with this source code.\n *\n */\n\nimport Page from 'flarum/components/Page';\n\nimport DraftsList from './DraftsList';\n\nexport default class DraftsPage extends Page {\n init() {\n super.init();\n\n app.history.push('drafts');\n\n this.list = new DraftsList();\n\n this.bodyClass = 'App--drafts';\n }\n\n view() {\n return
{this.list.render()}
;\n }\n}\n","/*\n *\n * This file is part of fof/drafts.\n *\n * Copyright (c) 2019 FriendsOfFlarum.\n *\n * For the full copyright and license information, please view the LICENSE.md\n * file that was distributed with this source code.\n *\n */\n\nimport NotificationsDropdown from 'flarum/components/NotificationsDropdown';\n\nimport DraftsList from './DraftsList';\n\nexport default class DraftsDropdown extends NotificationsDropdown {\n static initProps(props) {\n props.label = props.label || app.translator.trans('fof-drafts.forum.dropdown.tooltip');\n props.icon = props.icon || 'fas fa-edit';\n\n super.initProps(props);\n }\n\n init() {\n super.init();\n\n this.list = new DraftsList();\n }\n\n goToRoute() {\n m.route(app.route('drafts'));\n }\n\n getUnreadCount() {\n if (app.cache.draftsLoaded) {\n return app.store.all('drafts').length;\n }\n\n return app.store.all('drafts').length + app.session.user.draftCount();\n }\n\n getNewCount() {\n return this.getUnreadCount();\n }\n}\n","/*\n *\n * This file is part of fof/drafts.\n *\n * Copyright (c) 2019 FriendsOfFlarum.\n *\n * For the full copyright and license information, please view the LICENSE.md\n * file that was distributed with this source code.\n *\n */\n\nimport { extend, override } from 'flarum/extend';\nimport User from 'flarum/models/User';\nimport Model from 'flarum/Model';\nimport Draft from './models/Draft';\nimport DraftsPage from './components/DraftsPage';\nimport addDraftsDropdown from './addDraftsDropdown';\nimport addPreferences from './addPreferences';\nimport Composer from 'flarum/components/Composer';\nimport DiscussionComposer from 'flarum/components/DiscussionComposer';\nimport ReplyComposer from 'flarum/components/ReplyComposer';\nimport Button from 'flarum/components/Button';\nimport DraftsList from './components/DraftsList';\nimport fillRelationship from './utils/fillRelationship';\n\napp.initializers.add('fof-drafts', () => {\n app.store.models.drafts = Draft;\n User.prototype.drafts = Model.hasMany('drafts');\n User.prototype.draftCount = Model.attribute('draftCount');\n\n app.routes.drafts = { path: '/drafts', component: };\n\n Composer.prototype['changed'] = function () {\n if (!this.component) return false;\n\n const data = this.component.data();\n const draft = this.component.draft;\n\n const fields = Object.keys(data).filter((element) => element !== 'relationships');\n\n if (!fields) {\n return false;\n }\n\n const getData = (field) => (field === 'content' ? this.component.editor.value() : data[field]) || '';\n\n for (const field of fields) {\n if ((!draft && getData(field)) || getData(field) != draft.data.attributes[field]) {\n return true;\n }\n }\n\n if (!data.relationships) {\n return false;\n }\n\n const relationships = Object.keys(data.relationships);\n\n const equalRelationships = (data, draft, relationship) => {\n if (\n !data.relationships[relationship].length &&\n (!(relationship in draft.relationships()) || !draft.relationships()[relationship].data.length)\n ) {\n return true;\n } else if (\n !(relationship in draft.relationships()) ||\n data.relationships[relationship].length !== draft.relationships()[relationship].data.length\n ) {\n return false;\n }\n\n const getId = (element) => (typeof element.id == 'function' ? element.id() : element.id);\n\n const dataIds = fillRelationship(data.relationships[relationship], getId);\n const draftIds = fillRelationship(draft.relationships()[relationship].data, getId);\n\n return !dataIds.some((id, i) => id !== draftIds[i]);\n };\n\n for (const relationship of relationships) {\n if (!draft) {\n if (data.relationships[relationship]) {\n return true;\n }\n } else {\n if (!equalRelationships(data, draft, relationship)) {\n return true;\n }\n }\n }\n\n return false;\n };\n\n Composer.prototype['saveDraft'] = function () {\n this.saving = true;\n m.redraw();\n\n const afterSave = () => {\n this.saving = false;\n this.justSaved = true;\n setTimeout(() => {\n this.justSaved = false;\n m.redraw();\n }, 300);\n m.redraw();\n };\n\n if (this.component.draft) {\n delete this.component.draft.data.attributes.relationships;\n\n this.component.draft.save(Object.assign(this.component.draft.data.attributes, this.component.data())).then(() => afterSave());\n } else {\n app.store\n .createRecord('drafts')\n .save(this.component.data())\n .then((draft) => {\n draft.loadRelationships(true);\n this.component.draft = draft;\n afterSave();\n });\n }\n };\n\n extend(Composer.prototype, 'controlItems', function (items) {\n if (\n !(this.component instanceof DiscussionComposer || this.component instanceof ReplyComposer) ||\n !app.forum.attribute('canSaveDrafts') ||\n this.position === Composer.PositionEnum.MINIMIZED\n )\n return;\n\n const classNames = ['Button', 'Button--icon', 'Button--link'];\n\n if (this.saving) {\n classNames.push('saving');\n }\n\n if (this.justSaved) {\n classNames.push('justSaved');\n }\n\n items.add(\n 'save-draft',\n Button.component({\n icon: this.justSaved ? 'fas fa-check' : this.saving ? 'fas fa-spinner fa-spin' : 'fas fa-save',\n className: classNames.join(' '),\n itemClassName: 'App-backControl',\n title: app.translator.trans('fof-drafts.forum.composer.title'),\n disabled: this.saving || this.justSaved,\n onclick: this.saveDraft.bind(this),\n }),\n 20\n );\n });\n\n extend(Composer.prototype, 'show', function () {\n if (!app.forum.attribute('canSaveDrafts')) return;\n\n if (app.session.user.preferences().draftAutosaveEnable) {\n this.autosaveInterval = setInterval(() => {\n if (this.changed() && !this.saving) {\n this.saveDraft();\n }\n }, 1000 * app.session.user.preferences().draftAutosaveInterval);\n }\n });\n\n extend(Composer.prototype, 'close', function () {\n if (this.autosaveInterval) clearInterval(this.autosaveInterval);\n });\n\n override(Composer.prototype, 'preventExit', function (original) {\n if (this.component && this.component.draft) {\n this.component.props.confirmExit = app.translator.trans('fof-drafts.forum.composer.exit_alert');\n }\n\n let prevented = false;\n if (this.changed()) {\n prevented = original();\n }\n\n if (prevented) return prevented;\n\n if (!this.component) return;\n\n const draft = this.component.draft;\n if (draft && !draft.title() && !draft.content() && confirm(app.translator.trans('fof-drafts.forum.composer.discard_empty_draft_alert'))) {\n draft.delete();\n }\n\n return prevented;\n });\n\n function initComposerBody() {\n Object.keys(this.props).forEach((key) => {\n if (!['originalContent', 'title', 'user'].includes(key)) {\n this[key] = this.props[key];\n } else if (key === 'title') {\n this.title = m.prop(this.props.title);\n }\n });\n }\n\n extend(DiscussionComposer.prototype, 'init', initComposerBody);\n extend(ReplyComposer.prototype, 'init', initComposerBody);\n\n function deleteDraftsOnSubmit() {\n if (this.draft) {\n this.draft.delete();\n }\n }\n\n extend(DiscussionComposer.prototype, 'onsubmit', deleteDraftsOnSubmit);\n extend(ReplyComposer.prototype, 'onsubmit', deleteDraftsOnSubmit);\n\n addDraftsDropdown();\n addPreferences();\n});\n","/*\n *\n * This file is part of fof/drafts.\n *\n * Copyright (c) 2019 FriendsOfFlarum.\n *\n * For the full copyright and license information, please view the LICENSE.md\n * file that was distributed with this source code.\n *\n */\n\nimport { extend } from 'flarum/extend';\nimport app from 'flarum/app';\nimport HeaderSecondary from 'flarum/components/HeaderSecondary';\nimport DraftsDropdown from './components/DraftsDropdown';\n\nexport default function () {\n extend(HeaderSecondary.prototype, 'items', function (items) {\n if (!app.session.user || !app.forum.attribute('canSaveDrafts')) return;\n\n items.add('Drafts', , 20);\n });\n}\n","import { extend, override } from 'flarum/extend';\nimport Button from 'flarum/components/Button';\nimport FieldSet from 'flarum/components/FieldSet';\nimport SettingsPage from 'flarum/components/SettingsPage';\nimport Switch from 'flarum/components/Switch';\nimport ItemList from 'flarum/utils/ItemList';\n\nexport default function () {\n extend(SettingsPage.prototype, 'init', function () {\n this.draftAutosaveInterval = m.prop(this.user.preferences().draftAutosaveInterval);\n });\n\n extend(SettingsPage.prototype, 'settingsItems', function (items) {\n items.add(\n 'drafts',\n FieldSet.component({\n label: app.translator.trans('fof-drafts.forum.user.settings.drafts_heading'),\n className: 'Settings-drafts',\n children: this.draftsItems().toArray(),\n })\n );\n });\n\n SettingsPage.prototype['draftsItems'] = function () {\n const items = new ItemList();\n\n items.add(\n 'draft-autosave-enable',\n Switch.component({\n children: app.translator.trans('fof-drafts.forum.user.settings.draft_autosave_enable'),\n state: this.user.preferences().draftAutosaveEnable,\n onchange: (value, component) => this.preferenceSaver('draftAutosaveEnable')(value, component),\n })\n );\n\n items.add(\n 'draft-autosave-interval',\n this.user.preferences().draftAutosaveEnable ? (\n \n ) : (\n ''\n )\n );\n\n return items;\n };\n}\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/drafts/webpack/bootstrap","webpack://@fof/drafts/external \"flarum.core.compat['extend']\"","webpack://@fof/drafts/external \"flarum.core.compat['Model']\"","webpack://@fof/drafts/external \"flarum.core.compat['components/Button']\"","webpack://@fof/drafts/external \"flarum.core.compat['components/Composer']\"","webpack://@fof/drafts/external \"flarum.core.compat['app']\"","webpack://@fof/drafts/external \"flarum.core.compat['components/DiscussionComposer']\"","webpack://@fof/drafts/external \"flarum.core.compat['components/ReplyComposer']\"","webpack://@fof/drafts/external \"flarum.core.compat['utils/ItemList']\"","webpack://@fof/drafts/external \"flarum.core.compat['components/LoadingIndicator']\"","webpack://@fof/drafts/external \"flarum.core.compat['components/SettingsPage']\"","webpack://@fof/drafts/external \"flarum.core.compat['models/User']\"","webpack://@fof/drafts/external \"flarum.core.compat['components/Alert']\"","webpack://@fof/drafts/external \"flarum.core.compat['utils/mixin']\"","webpack://@fof/drafts/external \"flarum.core.compat['components/Page']\"","webpack://@fof/drafts/external \"flarum.core.compat['Component']\"","webpack://@fof/drafts/external \"flarum.core.compat['helpers/avatar']\"","webpack://@fof/drafts/external \"flarum.core.compat['helpers/icon']\"","webpack://@fof/drafts/external \"flarum.core.compat['helpers/humanTime']\"","webpack://@fof/drafts/external \"flarum.core.compat['utils/string']\"","webpack://@fof/drafts/external \"flarum.core.compat['components/Modal']\"","webpack://@fof/drafts/external \"flarum.core.compat['components/HeaderSecondary']\"","webpack://@fof/drafts/external \"flarum.core.compat['components/NotificationsDropdown']\"","webpack://@fof/drafts/external \"flarum.core.compat['components/FieldSet']\"","webpack://@fof/drafts/external \"flarum.core.compat['components/Switch']\"","webpack://@fof/drafts/external \"flarum.extensions['fof-byobu']\"","webpack://@fof/drafts/./node_modules/@babel/runtime/helpers/esm/extends.js","webpack://@fof/drafts/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/drafts/./src/forum/utils/fillRelationship.js","webpack://@fof/drafts/./src/forum/models/Draft.js","webpack://@fof/drafts/./node_modules/external-load/index.js","webpack://@fof/drafts/./src/forum/components/ScheduleDraftModal.js","webpack://@fof/drafts/./src/forum/components/DraftsList.js","webpack://@fof/drafts/./src/forum/components/DraftsPage.js","webpack://@fof/drafts/./src/forum/components/DraftsDropdown.js","webpack://@fof/drafts/./src/forum/index.js","webpack://@fof/drafts/./src/forum/addDraftsDropdown.js","webpack://@fof/drafts/./src/forum/addPreferences.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","extensions","_extends","assign","target","arguments","length","source","apply","this","_inheritsLoose","subClass","superClass","constructor","__proto__","data","map","Array","isArray","sort","Draft","mixin","Model","user","hasOne","content","attribute","title","scheduledValidationError","relationships","scheduledFor","transformDate","updatedAt","loadedRelationships","type","loadRelationships","components","icon","force","keys","forEach","relationshipName","relationship","fillRelationship","model","app","store","getById","id","recipients","ItemList","add","group","compileData","originalContent","session","confirmExit","translator","trans","draft","_load","tag","url","Promise","resolve","reject","element","document","createElement","parent","attr","onload","onerror","async","rel","appendChild","css","js","img","ScheduleDraftModal","init","loading","className","props","dismissible","datetime","moment","format","error","style","data-input","onchange","redraw","Button","component","unscheduleMode","children","rescheduleMode","config","isInitialized","forum","all","flatpickr","load","then","enableTime","enableSeconds","minDate","Date","now","maxDate","defaultDate","$","val","changed","getTimeOrNull","date","getTime","onsubmit","e","preventDefault","save","clearValidationError","success","loaded","Modal","DraftsList","on","event","stopPropagation","view","drafts","a","b","onclick","showComposer","avatar","discussion","humanTime","deleteDraft","scheduleDraft","truncate","LoadingIndicator","window","confirm","composer","hide","modal","show","componentClass","deferred","require","ReplyComposer","DiscussionComposer","promise","cache","draftsLoaded","find","Component","DraftsPage","history","push","list","bodyClass","render","Page","DraftsDropdown","initProps","label","goToRoute","route","getUnreadCount","draftCount","getNewCount","NotificationsDropdown","initializers","initComposerBody","includes","prop","deleteDraftsOnSubmit","models","User","hasMany","routes","path","Composer","fields","filter","getData","field","editor","attributes","equalRelationships","getId","dataIds","draftIds","some","saving","afterSave","justSaved","setTimeout","createRecord","extend","items","position","PositionEnum","MINIMIZED","classNames","join","itemClassName","disabled","saveDraft","preferences","draftAutosaveEnable","autosaveInterval","setInterval","draftAutosaveInterval","clearInterval","override","original","prevented","HeaderSecondary","SettingsPage","FieldSet","draftsItems","toArray","Switch","state","preferenceSaver","min","withAttr","str","Math","round","draftAutosaveIntervalInvalid","class"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EA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AO1N,KAAKc,KAAK6L,cAAcC,oBAC/B1H,SAAU,SAAC5G,EAAO+G,GAAR,OAAsB,EAAKsI,gBAAgB,sBAArB,CAA4CrP,EAAO+G,OAI3F6G,EAAMxJ,IACF,0BACA1C,KAAKc,KAAK6L,cAAcC,oBACpB,eACI,WAAIxK,IAAIY,WAAWC,MAAM,iEACzB,WACIwB,UAAU,cACVhD,KAAK,SACLmM,IAAI,IACJtP,MAAO0B,KAAK+M,wBACZ7H,SAAUzH,EAAEoQ,SAAS,QAAS7N,KAAK+M,yBAEtC3H,IAAOC,UAAU,CACdZ,UAAW,yBACXc,SAAUnD,IAAIY,WAAWC,MAAM,iEAC/B4E,QAAS,WACL,IAAeiG,EACX,EAAKf,wBAA0B,IADpBe,EACgC,EAAKf,0BADtBgB,KAAKC,MAAMF,IAErC,EAAKG,8BAA+B,EACpC,EAAKlB,sBAAsB,EAAKjM,KAAK6L,cAAcI,uBACnDtP,EAAE0H,WAEF,EAAK8I,8BAA+B,EACpC,EAAKN,gBAAgB,wBAArB,CAA8C,EAAKZ,6BAI9D/M,KAAKiO,6BACF,OAAGC,MAAM,mBACL,eAAQ9L,IAAIY,WAAWC,MAAM,oEAGjC,IAIR,IAIDiJ","file":"forum.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 27);\n","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['components/Composer'];","module.exports = flarum.core.compat['app'];","module.exports = flarum.core.compat['components/DiscussionComposer'];","module.exports = flarum.core.compat['components/ReplyComposer'];","module.exports = flarum.core.compat['utils/ItemList'];","module.exports = flarum.core.compat['components/LoadingIndicator'];","module.exports = flarum.core.compat['components/SettingsPage'];","module.exports = flarum.core.compat['models/User'];","module.exports = flarum.core.compat['components/Alert'];","module.exports = flarum.core.compat['utils/mixin'];","module.exports = flarum.core.compat['components/Page'];","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['helpers/avatar'];","module.exports = flarum.core.compat['helpers/icon'];","module.exports = flarum.core.compat['helpers/humanTime'];","module.exports = flarum.core.compat['utils/string'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['components/HeaderSecondary'];","module.exports = flarum.core.compat['components/NotificationsDropdown'];","module.exports = flarum.core.compat['components/FieldSet'];","module.exports = flarum.core.compat['components/Switch'];","module.exports = flarum.extensions['fof-byobu'];","export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","export default (data, map) => (Array.isArray(data) ? data.map(map).sort() : map(data));\r\n","/*\r\n *\r\n * This file is part of fof/drafts.\r\n *\r\n * Copyright (c) 2019 FriendsOfFlarum.\r\n *\r\n * For the full copyright and license information, please view the LICENSE.md\r\n * file that was distributed with this source code.\r\n *\r\n */\r\nimport Model from 'flarum/Model';\r\nimport ItemList from 'flarum/utils/ItemList';\r\nimport mixin from 'flarum/utils/mixin';\r\nimport fillRelationship from '../utils/fillRelationship';\r\n\r\nexport default class Draft extends mixin(Model, {\r\n user: Model.hasOne('user'),\r\n content: Model.attribute('content'),\r\n title: Model.attribute('title'),\r\n scheduledValidationError: Model.attribute('scheduledValidationError'),\r\n relationships: Model.attribute('relationships'),\r\n scheduledFor: Model.attribute('scheduledFor', Model.transformDate),\r\n updatedAt: Model.attribute('updatedAt', Model.transformDate),\r\n\r\n loadedRelationships: null,\r\n\r\n type() {\r\n const relationships = this.loadRelationships();\r\n if ('discussion' in relationships) {\r\n return 'reply';\r\n } else if (\r\n flarum.extensions['fof-byobu'] &&\r\n flarum.extensions['fof-byobu'].components && // If private discussion composer is not exported, we can't support PM drafts.\r\n ('recipientGroups' in relationships || 'recipientUsers' in relationships)\r\n ) {\r\n return 'privateDiscussion';\r\n } else {\r\n return 'discussion';\r\n }\r\n },\r\n\r\n icon() {\r\n switch (this.type()) {\r\n case 'discussion':\r\n return 'fas fa-edit';\r\n case 'reply':\r\n return 'fas fa-reply';\r\n case 'privateDiscussion':\r\n return 'fas fa-eye-slash';\r\n }\r\n },\r\n\r\n loadRelationships(force) {\r\n if (!force && this.loadedRelationships) {\r\n return this.loadedRelationships;\r\n }\r\n\r\n this.loadedRelationships = {};\r\n\r\n const relationships = this.relationships();\r\n\r\n if (relationships) {\r\n Object.keys(relationships).forEach((relationshipName) => {\r\n const relationship = relationships[relationshipName];\r\n\r\n if (!relationship || !relationship.data) return;\r\n\r\n this.loadedRelationships[relationshipName] = fillRelationship(relationship.data, (model) => app.store.getById(model.type, model.id));\r\n });\r\n }\r\n\r\n if ('recipientUsers' in this.loadedRelationships || 'recipientGroups' in this.loadedRelationships) {\r\n const recipients = new ItemList();\r\n\r\n (this.loadedRelationships['recipientUsers'] || []).forEach((user) => {\r\n if (user) recipients.add('users:' + user.id(), user);\r\n });\r\n (this.loadedRelationships['recipientGroups'] || []).forEach((group) => {\r\n if (group) recipients.add('groups:' + group.id(), group);\r\n });\r\n\r\n this.loadedRelationships['recipients'] = recipients;\r\n }\r\n\r\n return this.loadedRelationships;\r\n },\r\n\r\n compileData() {\r\n const data = {\r\n originalContent: this.content(),\r\n title: this.title(),\r\n user: app.session.user,\r\n confirmExit: app.translator.trans('fof-drafts.forum.composer.exit_alert'),\r\n draft: this,\r\n };\r\n\r\n Object.assign(data, this.loadRelationships());\r\n\r\n return data;\r\n },\r\n}) {}\r\n","/**\n * Simple resource loader based on David Walsh's tutorial\n * https://davidwalsh.name/javascript-loader\n * https://davidwalsh.name/javascript-functions\n */\nexport default (function() {\n // Function which returns a function\n function _load(tag) {\n return function(url) {\n // This promise will be used by Promise.all to determine success or failure\n return new Promise(function(resolve, reject) {\n var element = document.createElement(tag);\n var parent = \"body\";\n var attr = \"src\";\n\n // Important success and error for the promise\n element.onload = function() {\n resolve(url);\n };\n element.onerror = function() {\n reject(url);\n };\n\n // Need to set different attributes depending on tag type\n switch (tag) {\n case \"script\":\n element.async = true;\n break;\n case \"link\":\n element.type = \"text/css\";\n element.rel = \"stylesheet\";\n attr = \"href\";\n parent = \"head\";\n }\n\n // Inject into document to kick off loading\n element[attr] = url;\n document[parent].appendChild(element);\n });\n };\n }\n\n return {\n css: _load(\"link\"),\n js: _load(\"script\"),\n img: _load(\"img\")\n };\n})();\n","import Alert from 'flarum/components/Alert';\r\nimport Button from 'flarum/components/Button';\r\nimport Modal from 'flarum/components/Modal';\r\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\r\n\r\nimport load from 'external-load';\r\n\r\nexport default class ScheduleDraftModal extends Modal {\r\n init() {\r\n super.init();\r\n\r\n this.loading = false;\r\n }\r\n\r\n className() {\r\n return 'ScheduleDraftModal';\r\n }\r\n\r\n title() {\r\n return app.translator.trans('fof-drafts.forum.schedule_draft_modal.title');\r\n }\r\n\r\n content() {\r\n if (this.loading) {\r\n return ;\r\n }\r\n\r\n return [\r\n this.props.draft.scheduledFor() ? (\r\n
\r\n \r\n {app.translator.trans('fof-drafts.forum.schedule_draft_modal.scheduled_text', {\r\n datetime: moment(this.props.draft.scheduledFor()).format('LLLL'),\r\n })}\r\n \r\n
\r\n ) : (\r\n ''\r\n ),\r\n this.props.draft.scheduledValidationError() ? (\r\n
\r\n \r\n {app.translator.trans('fof-drafts.forum.schedule_draft_modal.scheduled_error', {\r\n error: this.props.draft.scheduledValidationError(),\r\n })}\r\n \r\n
\r\n ) : (\r\n ''\r\n ),\r\n ,\r\n
\r\n
\r\n

{app.translator.trans('fof-drafts.forum.schedule_draft_modal.text')}

\r\n
\r\n \r\n
\r\n
\r\n {Button.component({\r\n className: 'Button Button--block' + (this.unscheduleMode() ? ' Button--danger' : ' Button--primary'),\r\n type: 'submit',\r\n loading: this.loading,\r\n children: this.unscheduleMode()\r\n ? app.translator.trans('fof-drafts.forum.schedule_draft_modal.unschedule_button')\r\n : this.rescheduleMode()\r\n ? app.translator.trans('fof-drafts.forum.schedule_draft_modal.reschedule_button')\r\n : app.translator.trans('fof-drafts.forum.schedule_draft_modal.schedule_button'),\r\n })}\r\n
\r\n
\r\n
,\r\n ];\r\n }\r\n\r\n config(isInitialized) {\r\n if (isInitialized) return;\r\n\r\n const url = app.forum.attribute('baseUrl') + '/assets/extensions/fof-drafts/flatpickr';\r\n\r\n this.loading = true;\r\n\r\n Promise.all(typeof flatpickr === 'undefined' ? [load.js(`${url}.js`), load.css(`${url}.css`)] : []).then(() => {\r\n this.loading = false;\r\n\r\n m.redraw();\r\n\r\n this.flatpickr = flatpickr('.flatpickr-input', {\r\n enableTime: true,\r\n enableSeconds: false,\r\n minDate: Date.now(),\r\n maxDate: new Date(9999, 12, 31),\r\n defaultDate: this.props.draft.scheduledFor(),\r\n });\r\n });\r\n }\r\n\r\n scheduledFor() {\r\n return new Date($('input[name=scheduledFor]').val());\r\n }\r\n\r\n changed() {\r\n const getTimeOrNull = (date) => (date ? date.getTime() : null);\r\n\r\n return getTimeOrNull(this.scheduledFor()) !== getTimeOrNull(this.props.draft.scheduledFor());\r\n }\r\n\r\n unscheduleMode() {\r\n return !this.changed() && this.props.draft.scheduledFor();\r\n }\r\n\r\n rescheduleMode() {\r\n return this.changed() && this.props.draft.scheduledFor();\r\n }\r\n\r\n onsubmit(e) {\r\n e.preventDefault();\r\n\r\n this.loading = true;\r\n\r\n this.props.draft\r\n .save({ scheduledFor: this.unscheduleMode() ? null : this.scheduledFor(), clearValidationError: true, scheduledValidationError: '' })\r\n .then(() => (this.success = true))\r\n .catch(() => {})\r\n .then(this.loaded.bind(this));\r\n }\r\n}\r\n","/*\r\n *\r\n * This file is part of fof/drafts.\r\n *\r\n * Copyright (c) 2019 FriendsOfFlarum.\r\n *\r\n * For the full copyright and license information, please view the LICENSE.md\r\n * file that was distributed with this source code.\r\n *\r\n */\r\n\r\nimport Component from 'flarum/Component';\r\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\r\nimport DiscussionComposer from 'flarum/components/DiscussionComposer';\r\nimport ReplyComposer from 'flarum/components/ReplyComposer';\r\nimport avatar from 'flarum/helpers/avatar';\r\nimport icon from 'flarum/helpers/icon';\r\nimport humanTime from 'flarum/helpers/humanTime';\r\nimport { truncate } from 'flarum/utils/string';\r\nimport Button from 'flarum/components/Button';\r\nimport ScheduleDraftModal from './ScheduleDraftModal';\r\nimport fillRelationship from '../utils/fillRelationship';\r\n\r\nexport default class DraftsList extends Component {\r\n config(isInitialized) {\r\n if (!isInitialized) return;\r\n\r\n $('.draft--delete').on('click tap', function (event) {\r\n event.stopPropagation();\r\n });\r\n }\r\n\r\n view() {\r\n const drafts = app.store.all('drafts');\r\n\r\n return (\r\n
\r\n
\r\n

{app.translator.trans('fof-drafts.forum.dropdown.title')}

\r\n
\r\n
\r\n \r\n
\r\n
\r\n );\r\n }\r\n\r\n deleteDraft(draft) {\r\n this.loading = true;\r\n\r\n if (!window.confirm(app.translator.trans('fof-drafts.forum.dropdown.alert'))) return;\r\n\r\n draft.delete().then(() => {\r\n if (app.composer.component && app.composer.component.draft.id() === draft.id() && !app.composer.changed()) {\r\n app.composer.hide();\r\n }\r\n\r\n this.loading = false;\r\n m.redraw();\r\n });\r\n }\r\n\r\n scheduleDraft(draft) {\r\n if (!app.forum.attribute('canScheduleDrafts') || !app.forum.attribute('drafts.enableScheduledDrafts')) return;\r\n\r\n app.modal.show(new ScheduleDraftModal({ draft }));\r\n }\r\n\r\n showComposer(draft) {\r\n if (this.loading) return;\r\n\r\n const deferred = m.deferred();\r\n\r\n let componentClass;\r\n\r\n switch (draft.type()) {\r\n case 'privateDiscussion':\r\n componentClass = require('@fof-byobu').components['PrivateDiscussionComposer'];\r\n break;\r\n case 'reply':\r\n componentClass = ReplyComposer;\r\n break;\r\n default:\r\n componentClass = DiscussionComposer;\r\n }\r\n\r\n const component = new componentClass(draft.compileData());\r\n\r\n app.composer.load(component);\r\n app.composer.show();\r\n\r\n deferred.resolve(component);\r\n\r\n return deferred.promise;\r\n }\r\n\r\n load() {\r\n if (app.cache.draftsLoaded) {\r\n return;\r\n }\r\n\r\n this.loading = true;\r\n m.redraw();\r\n\r\n app.store\r\n .find('drafts')\r\n .then(\r\n () => (app.cache.draftsLoaded = true),\r\n () => {}\r\n )\r\n .then(() => {\r\n this.loading = false;\r\n m.redraw();\r\n });\r\n }\r\n}\r\n","/*\r\n *\r\n * This file is part of fof/drafts.\r\n *\r\n * Copyright (c) 2019 FriendsOfFlarum.\r\n *\r\n * For the full copyright and license information, please view the LICENSE.md\r\n * file that was distributed with this source code.\r\n *\r\n */\r\n\r\nimport Page from 'flarum/components/Page';\r\n\r\nimport DraftsList from './DraftsList';\r\n\r\nexport default class DraftsPage extends Page {\r\n init() {\r\n super.init();\r\n\r\n app.history.push('drafts');\r\n\r\n this.list = new DraftsList();\r\n\r\n this.bodyClass = 'App--drafts';\r\n }\r\n\r\n view() {\r\n return
{this.list.render()}
;\r\n }\r\n}\r\n","/*\r\n *\r\n * This file is part of fof/drafts.\r\n *\r\n * Copyright (c) 2019 FriendsOfFlarum.\r\n *\r\n * For the full copyright and license information, please view the LICENSE.md\r\n * file that was distributed with this source code.\r\n *\r\n */\r\n\r\nimport NotificationsDropdown from 'flarum/components/NotificationsDropdown';\r\n\r\nimport DraftsList from './DraftsList';\r\n\r\nexport default class DraftsDropdown extends NotificationsDropdown {\r\n static initProps(props) {\r\n props.label = props.label || app.translator.trans('fof-drafts.forum.dropdown.tooltip');\r\n props.icon = props.icon || 'fas fa-edit';\r\n\r\n super.initProps(props);\r\n }\r\n\r\n init() {\r\n super.init();\r\n\r\n this.list = new DraftsList();\r\n }\r\n\r\n goToRoute() {\r\n m.route(app.route('drafts'));\r\n }\r\n\r\n getUnreadCount() {\r\n if (app.cache.draftsLoaded) {\r\n return app.store.all('drafts').length;\r\n }\r\n\r\n return app.store.all('drafts').length + app.session.user.draftCount();\r\n }\r\n\r\n getNewCount() {\r\n return this.getUnreadCount();\r\n }\r\n}\r\n","/*\r\n *\r\n * This file is part of fof/drafts.\r\n *\r\n * Copyright (c) 2019 FriendsOfFlarum.\r\n *\r\n * For the full copyright and license information, please view the LICENSE.md\r\n * file that was distributed with this source code.\r\n *\r\n */\r\n\r\nimport { extend, override } from 'flarum/extend';\r\nimport User from 'flarum/models/User';\r\nimport Model from 'flarum/Model';\r\nimport Draft from './models/Draft';\r\nimport DraftsPage from './components/DraftsPage';\r\nimport addDraftsDropdown from './addDraftsDropdown';\r\nimport addPreferences from './addPreferences';\r\nimport Composer from 'flarum/components/Composer';\r\nimport DiscussionComposer from 'flarum/components/DiscussionComposer';\r\nimport ReplyComposer from 'flarum/components/ReplyComposer';\r\nimport Button from 'flarum/components/Button';\r\nimport DraftsList from './components/DraftsList';\r\nimport fillRelationship from './utils/fillRelationship';\r\n\r\napp.initializers.add('fof-drafts', () => {\r\n app.store.models.drafts = Draft;\r\n User.prototype.drafts = Model.hasMany('drafts');\r\n User.prototype.draftCount = Model.attribute('draftCount');\r\n\r\n app.routes.drafts = { path: '/drafts', component: };\r\n\r\n Composer.prototype['changed'] = function () {\r\n if (!this.component) return false;\r\n\r\n const data = this.component.data();\r\n const draft = this.component.draft;\r\n\r\n const fields = Object.keys(data).filter((element) => element !== 'relationships');\r\n\r\n if (!fields) {\r\n return false;\r\n }\r\n\r\n const getData = (field) => (field === 'content' ? this.component.editor.value() : data[field]) || '';\r\n\r\n for (const field of fields) {\r\n if ((!draft && getData(field)) || (draft && getData(field) != draft.data.attributes[field])) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!data.relationships) {\r\n return false;\r\n }\r\n\r\n const relationships = Object.keys(data.relationships);\r\n\r\n const equalRelationships = (data, draft, relationship) => {\r\n if (\r\n !data.relationships[relationship].length &&\r\n (!(relationship in draft.relationships()) || !draft.relationships()[relationship].data.length)\r\n ) {\r\n return true;\r\n } else if (\r\n !(relationship in draft.relationships()) ||\r\n data.relationships[relationship].length !== draft.relationships()[relationship].data.length\r\n ) {\r\n return false;\r\n }\r\n\r\n const getId = (element) => (typeof element.id == 'function' ? element.id() : element.id);\r\n\r\n const dataIds = fillRelationship(data.relationships[relationship], getId);\r\n const draftIds = fillRelationship(draft.relationships()[relationship].data, getId);\r\n\r\n return !dataIds.some((id, i) => id !== draftIds[i]);\r\n };\r\n\r\n for (const relationship of relationships) {\r\n if (!draft) {\r\n if (data.relationships[relationship]) {\r\n return true;\r\n }\r\n } else {\r\n if (!equalRelationships(data, draft, relationship)) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n };\r\n\r\n Composer.prototype['saveDraft'] = function () {\r\n this.saving = true;\r\n m.redraw();\r\n\r\n const afterSave = () => {\r\n this.saving = false;\r\n this.justSaved = true;\r\n setTimeout(() => {\r\n this.justSaved = false;\r\n m.redraw();\r\n }, 300);\r\n m.redraw();\r\n };\r\n\r\n if (this.component.draft) {\r\n delete this.component.draft.data.attributes.relationships;\r\n\r\n this.component.draft.save(Object.assign(this.component.draft.data.attributes, this.component.data())).then(() => afterSave());\r\n } else {\r\n app.store\r\n .createRecord('drafts')\r\n .save(this.component.data())\r\n .then((draft) => {\r\n draft.loadRelationships(true);\r\n this.component.draft = draft;\r\n afterSave();\r\n });\r\n }\r\n };\r\n\r\n extend(Composer.prototype, 'controlItems', function (items) {\r\n if (\r\n !(this.component instanceof DiscussionComposer || this.component instanceof ReplyComposer) ||\r\n !app.forum.attribute('canSaveDrafts') ||\r\n this.position === Composer.PositionEnum.MINIMIZED\r\n )\r\n return;\r\n\r\n const classNames = ['Button', 'Button--icon', 'Button--link'];\r\n\r\n if (this.saving) {\r\n classNames.push('saving');\r\n }\r\n\r\n if (this.justSaved) {\r\n classNames.push('justSaved');\r\n }\r\n\r\n items.add(\r\n 'save-draft',\r\n Button.component({\r\n icon: this.justSaved ? 'fas fa-check' : this.saving ? 'fas fa-spinner fa-spin' : 'fas fa-save',\r\n className: classNames.join(' '),\r\n itemClassName: 'App-backControl',\r\n title: app.translator.trans('fof-drafts.forum.composer.title'),\r\n disabled: this.saving || this.justSaved,\r\n onclick: this.saveDraft.bind(this),\r\n }),\r\n 20\r\n );\r\n });\r\n\r\n extend(Composer.prototype, 'show', function () {\r\n if (!app.forum.attribute('canSaveDrafts')) return;\r\n\r\n if (app.session.user.preferences().draftAutosaveEnable) {\r\n this.autosaveInterval = setInterval(() => {\r\n if (this.changed() && !this.saving) {\r\n this.saveDraft();\r\n }\r\n }, 1000 * app.session.user.preferences().draftAutosaveInterval);\r\n }\r\n });\r\n\r\n extend(Composer.prototype, 'close', function () {\r\n if (this.autosaveInterval) clearInterval(this.autosaveInterval);\r\n });\r\n\r\n override(Composer.prototype, 'preventExit', function (original) {\r\n if (this.component && this.component.draft) {\r\n this.component.props.confirmExit = app.translator.trans('fof-drafts.forum.composer.exit_alert');\r\n }\r\n\r\n let prevented = false;\r\n if (this.changed()) {\r\n prevented = original();\r\n }\r\n\r\n if (prevented) return prevented;\r\n\r\n if (!this.component) return;\r\n\r\n const draft = this.component.draft;\r\n if (draft && !draft.title() && !draft.content() && confirm(app.translator.trans('fof-drafts.forum.composer.discard_empty_draft_alert'))) {\r\n draft.delete();\r\n }\r\n\r\n return prevented;\r\n });\r\n\r\n function initComposerBody() {\r\n Object.keys(this.props).forEach((key) => {\r\n if (!['originalContent', 'title', 'user'].includes(key)) {\r\n this[key] = this.props[key];\r\n } else if (key === 'title') {\r\n this.title = m.prop(this.props.title);\r\n }\r\n });\r\n }\r\n\r\n extend(DiscussionComposer.prototype, 'init', initComposerBody);\r\n extend(ReplyComposer.prototype, 'init', initComposerBody);\r\n\r\n function deleteDraftsOnSubmit() {\r\n if (this.draft) {\r\n this.draft.delete();\r\n }\r\n }\r\n\r\n extend(DiscussionComposer.prototype, 'onsubmit', deleteDraftsOnSubmit);\r\n extend(ReplyComposer.prototype, 'onsubmit', deleteDraftsOnSubmit);\r\n\r\n addDraftsDropdown();\r\n addPreferences();\r\n});\r\n","/*\r\n *\r\n * This file is part of fof/drafts.\r\n *\r\n * Copyright (c) 2019 FriendsOfFlarum.\r\n *\r\n * For the full copyright and license information, please view the LICENSE.md\r\n * file that was distributed with this source code.\r\n *\r\n */\r\n\r\nimport { extend } from 'flarum/extend';\r\nimport app from 'flarum/app';\r\nimport HeaderSecondary from 'flarum/components/HeaderSecondary';\r\nimport DraftsDropdown from './components/DraftsDropdown';\r\n\r\nexport default function () {\r\n extend(HeaderSecondary.prototype, 'items', function (items) {\r\n if (!app.session.user || !app.forum.attribute('canSaveDrafts')) return;\r\n\r\n items.add('Drafts', , 20);\r\n });\r\n}\r\n","import { extend, override } from 'flarum/extend';\r\nimport Button from 'flarum/components/Button';\r\nimport FieldSet from 'flarum/components/FieldSet';\r\nimport SettingsPage from 'flarum/components/SettingsPage';\r\nimport Switch from 'flarum/components/Switch';\r\nimport ItemList from 'flarum/utils/ItemList';\r\n\r\nexport default function () {\r\n extend(SettingsPage.prototype, 'init', function () {\r\n this.draftAutosaveInterval = m.prop(this.user.preferences().draftAutosaveInterval);\r\n });\r\n\r\n extend(SettingsPage.prototype, 'settingsItems', function (items) {\r\n items.add(\r\n 'drafts',\r\n FieldSet.component({\r\n label: app.translator.trans('fof-drafts.forum.user.settings.drafts_heading'),\r\n className: 'Settings-drafts',\r\n children: this.draftsItems().toArray(),\r\n })\r\n );\r\n });\r\n\r\n SettingsPage.prototype['draftsItems'] = function () {\r\n const items = new ItemList();\r\n\r\n items.add(\r\n 'draft-autosave-enable',\r\n Switch.component({\r\n children: app.translator.trans('fof-drafts.forum.user.settings.draft_autosave_enable'),\r\n state: this.user.preferences().draftAutosaveEnable,\r\n onchange: (value, component) => this.preferenceSaver('draftAutosaveEnable')(value, component),\r\n })\r\n );\r\n\r\n items.add(\r\n 'draft-autosave-interval',\r\n this.user.preferences().draftAutosaveEnable ? (\r\n \r\n ) : (\r\n ''\r\n )\r\n );\r\n\r\n return items;\r\n };\r\n}\r\n"],"sourceRoot":""} \ No newline at end of file