mirror of
https://github.com/flarum/framework.git
synced 2024-12-03 15:43:59 +08:00
f67b5f3742
Includes transpiled JS/TS. [skip ci]
1 line
15 KiB
Plaintext
1 line
15 KiB
Plaintext
{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3ER,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,+BCLvD,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,gC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,kC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,kC,aCAzC,SAASC,EAAgBhB,EAAGiB,GAMzC,OALAD,EAAkBf,OAAOiB,gBAAkB,SAAyBlB,EAAGiB,GAErE,OADAjB,EAAEmB,UAAYF,EACPjB,GAGFgB,EAAgBhB,EAAGiB,GCLb,SAASG,EAAeC,EAAUC,GAC/CD,EAASd,UAAYN,OAAOsB,OAAOD,EAAWf,WAC9Cc,EAASd,UAAUiB,YAAcH,EACjCH,EAAeG,EAAUC,GCJ3B,MAAM,EAA+BT,OAA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AYC,mBAAoB,SAACC,GAAD,OAAcC,gBAAkBD,IACxFnE,KAAKiD,uBAAuBoB,WAE/B,Y","sources":["webpack://@flarum/markdown/webpack/bootstrap","webpack://@flarum/markdown/webpack/runtime/compat get default export","webpack://@flarum/markdown/webpack/runtime/define property getters","webpack://@flarum/markdown/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/markdown/webpack/runtime/make namespace object","webpack://@flarum/markdown/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/components/TextEditor']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/utils/BasicEditorDriver']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/utils/styleSelectedText']\"","webpack://@flarum/markdown/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@flarum/markdown/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@flarum/markdown/external root \"flarum.core.compat['common/Component']\"","webpack://@flarum/markdown/./src/forum/components/MarkdownToolbar.js","webpack://@flarum/markdown/external root \"flarum.core.compat['common/helpers/icon']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/components/Tooltip']\"","webpack://@flarum/markdown/./src/forum/components/MarkdownButton.js","webpack://@flarum/markdown/external root \"flarum.core.compat['common/utils/ItemList']\"","webpack://@flarum/markdown/./src/forum/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/TextEditor'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/BasicEditorDriver'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/styleSelectedText'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","import Component from 'flarum/common/Component';\n\nexport default class MarkdownToolbar extends Component {\n view(vnode) {\n return <div class=\"MarkdownToolbar\">{vnode.children}</div>;\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/icon'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Tooltip'];","import Component from 'flarum/common/Component';\nimport icon from 'flarum/common/helpers/icon';\nimport Tooltip from 'flarum/common/components/Tooltip';\n\nexport default class MarkdownButton extends Component {\n oncreate(vnode) {\n super.oncreate(vnode);\n }\n\n view() {\n const button = (\n <button\n className=\"Button Button--icon Button--link\"\n type=\"button\"\n data-hotkey={this.attrs.hotkey}\n onkeydown={this.keydown.bind(this)}\n onclick={this.attrs.onclick}\n >\n {icon(this.attrs.icon)}\n </button>\n );\n\n if (this.attrs.title) {\n return <Tooltip text={this.attrs.title}>{button}</Tooltip>;\n }\n\n return button;\n }\n\n keydown(event) {\n if (event.key === ' ' || event.key === 'Enter') {\n event.preventDefault();\n this.element.click();\n }\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/ItemList'];","/*!\n * Includes modified code from GitHub Markdown Toolbar Element\n * https://github.com/github/markdown-toolbar-element/\n *\n * Original Copyright GitHub, Inc.\n * Released under the MIT license\n * https://github.com/github/markdown-toolbar-element/blob/master/LICENSE\n */\n\nimport app from 'flarum/forum/app';\nimport { extend, override } from 'flarum/common/extend';\nimport TextEditor from 'flarum/common/components/TextEditor';\nimport BasicEditorDriver from 'flarum/common/utils/BasicEditorDriver';\nimport styleSelectedText from 'flarum/common/utils/styleSelectedText';\n\nimport MarkdownToolbar from './components/MarkdownToolbar';\nimport MarkdownButton from './components/MarkdownButton';\nimport ItemList from 'flarum/common/utils/ItemList';\n\nconst modifierKey = navigator.userAgent.match(/Macintosh/) ? '⌘' : 'ctrl';\n\nconst styles = {\n header: { prefix: '### ' },\n bold: { prefix: '**', suffix: '**', trimFirst: true },\n italic: { prefix: '_', suffix: '_', trimFirst: true },\n strikethrough: { prefix: '~~', suffix: '~~', trimFirst: true },\n quote: { prefix: '> ', multiline: true, surroundWithNewlines: true },\n code: { prefix: '`', suffix: '`', blockPrefix: '```', blockSuffix: '```' },\n link: { prefix: '[', suffix: '](https://)', replaceNext: 'https://', scanFor: 'https?://' },\n image: { prefix: '![', suffix: '](https://)', replaceNext: 'https://', scanFor: 'https?://' },\n unordered_list: { prefix: '- ', multiline: true, surroundWithNewlines: true },\n ordered_list: { prefix: '1. ', multiline: true, orderedList: true },\n spoiler: { prefix: '>!', suffix: '!<', blockPrefix: '>! ', multiline: true, trimFirst: true },\n};\n\nconst applyStyle = (id, editorDriver) => {\n // This is a nasty hack that breaks encapsulation of the editor.\n // In future releases, we'll need to tweak the editor driver interface\n // to support triggering events like this.\n styleSelectedText(editorDriver.el, styles[id]);\n};\n\nfunction makeShortcut(id, key, editorDriver) {\n return function (e) {\n if (e.key === key && ((e.metaKey && modifierKey === '⌘') || (e.ctrlKey && modifierKey === 'ctrl'))) {\n e.preventDefault();\n applyStyle(id, editorDriver);\n }\n };\n}\n\nfunction markdownToolbarItems(oldFunc) {\n const items = typeof oldFunc === 'function' ? oldFunc() : new ItemList();\n\n function tooltip(name, hotkey) {\n return app.translator.trans(`flarum-markdown.forum.composer.${name}_tooltip`) + (hotkey ? ` <${modifierKey}-${hotkey}>` : '');\n }\n\n const makeApplyStyle = (id) => {\n return () => applyStyle(id, this.attrs.composer.editor);\n };\n\n items.add('header', <MarkdownButton title={tooltip('header')} icon=\"fas fa-heading\" onclick={makeApplyStyle('header')} />, 1000);\n items.add('bold', <MarkdownButton title={tooltip('bold', 'b')} icon=\"fas fa-bold\" onclick={makeApplyStyle('bold')} />, 900);\n items.add('italic', <MarkdownButton title={tooltip('italic', 'i')} icon=\"fas fa-italic\" onclick={makeApplyStyle('italic')} />, 800);\n items.add(\n 'strikethrough',\n <MarkdownButton title={tooltip('strikethrough')} icon=\"fas fa-strikethrough\" onclick={makeApplyStyle('strikethrough')} />,\n 700\n );\n items.add('quote', <MarkdownButton title={tooltip('quote')} icon=\"fas fa-quote-left\" onclick={makeApplyStyle('quote')} />, 600);\n items.add('spoiler', <MarkdownButton title={tooltip('spoiler')} icon=\"fas fa-exclamation-triangle\" onclick={makeApplyStyle('spoiler')} />, 500);\n items.add('code', <MarkdownButton title={tooltip('code')} icon=\"fas fa-code\" onclick={makeApplyStyle('code')} />, 400);\n items.add('link', <MarkdownButton title={tooltip('link')} icon=\"fas fa-link\" onclick={makeApplyStyle('link')} />, 300);\n items.add('image', <MarkdownButton title={tooltip('image')} icon=\"fas fa-image\" onclick={makeApplyStyle('image')} />, 200);\n items.add(\n 'unordered_list',\n <MarkdownButton title={tooltip('unordered_list')} icon=\"fas fa-list-ul\" onclick={makeApplyStyle('unordered_list')} />,\n 100\n );\n items.add('ordered_list', <MarkdownButton title={tooltip('ordered_list')} icon=\"fas fa-list-ol\" onclick={makeApplyStyle('ordered_list')} />, 0);\n\n return items;\n}\n\napp.initializers.add('flarum-markdown', function (app) {\n extend(BasicEditorDriver.prototype, 'keyHandlers', function (items) {\n items.add('bold', makeShortcut('bold', 'b', this));\n items.add('italic', makeShortcut('italic', 'i', this));\n });\n\n if (TextEditor.prototype.markdownToolbarItems) {\n override(TextEditor.prototype, 'markdownToolbarItems', markdownToolbarItems);\n } else {\n TextEditor.prototype.markdownToolbarItems = markdownToolbarItems;\n }\n\n extend(TextEditor.prototype, 'toolbarItems', function (items) {\n items.add(\n 'markdown',\n <MarkdownToolbar for={this.textareaId} setShortcutHandler={(handler) => (shortcutHandler = handler)}>\n {this.markdownToolbarItems().toArray()}\n </MarkdownToolbar>,\n 100\n );\n });\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","create","constructor","MarkdownToolbar","view","vnode","class","children","Component","MarkdownButton","oncreate","button","className","type","this","attrs","hotkey","onkeydown","keydown","bind","onclick","icon","title","text","event","preventDefault","element","click","modifierKey","navigator","userAgent","match","styles","header","prefix","bold","suffix","trimFirst","italic","strikethrough","quote","multiline","surroundWithNewlines","code","blockPrefix","blockSuffix","link","replaceNext","scanFor","image","unordered_list","ordered_list","orderedList","spoiler","applyStyle","id","editorDriver","styleSelectedText","el","makeShortcut","e","metaKey","ctrlKey","markdownToolbarItems","oldFunc","items","ItemList","tooltip","name","app","makeApplyStyle","composer","editor","add","extend","BasicEditorDriver","TextEditor","override","for","textareaId","setShortcutHandler","handler","shortcutHandler","toArray"],"sourceRoot":""} |