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8C,EAAQ,QAAS/C,KAAK,cAAcD,QAASoD,EAAe,UAAa,KAClHN,EAAMS,IAAI,QAASrE,EAACG,EAAc,CAACa,MAAO8C,EAAQ,SAAU/C,KAAK,eAAeD,QAASoD,EAAe,WAAc,KACtHN,EAAMS,IACJ,iBACArE,EAACG,EAAc,CAACa,MAAO8C,EAAQ,kBAAmB/C,KAAK,iBAAiBD,QAASoD,EAAe,oBAChG,KAEFN,EAAMS,IAAI,eAAgBrE,EAACG,EAAc,CAACa,MAAO8C,EAAQ,gBAAiB/C,KAAK,iBAAiBD,QAASoD,EAAe,kBAAqB,GAEtIN,CACT,CChFAI,IAAAA,aAAAA,IAAqB,mBDkFd,SAAoBA,IACzBM,EAAAA,EAAAA,QAAOC,IAAAA,UAA6B,eAAe,SAAUX,GAC3DA,EAAMS,IAAI,OAAQf,EAAa,OAAQ,IAAK9C,OAC5CoD,EAAMS,IAAI,SAAUf,EAAa,SAAU,IAAK9C,MAClD,IAEIgE,IAAAA,UAAAA,sBACFC,EAAAA,EAAAA,UAASD,IAAAA,UAAsB,uBAAwBd,GAEvDc,IAAAA,UAAAA,qBAA4Cd,GAG9CY,EAAAA,EAAAA,QAAOE,IAAAA,UAAsB,gBAAgB,SAAUZ,GACrDA,EAAMS,IACJ,WACArE,EAACJ,EAAe,CAAC8E,IAAKlE,KAAKmE,WAAYC,mBAAqBC,GAAaC,gBAAkBD,GACxFrE,KAAKkD,uBAAuBqB,WAE/B,IAEJ,GACF","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['admin/app']\"","webpack://@flarum/markdown/external root \"flarum.core.compat['common/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/external root \"flarum.core.compat['common/Component']\"","webpack://@flarum/markdown/./src/common/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/common/components/MarkdownButton.js","webpack://@flarum/markdown/external root \"flarum.core.compat['common/utils/ItemList']\"","webpack://@flarum/markdown/./src/common/index.js","webpack://@flarum/markdown/./src/admin/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['admin/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/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'];","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
{vnode.children}
;\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 \n {icon(this.attrs.icon)}\n \n );\n\n if (this.attrs.title) {\n return {button};\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/common/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.lib.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', , 1000);\n items.add('bold', , 900);\n items.add('italic', , 800);\n items.add(\n 'strikethrough',\n ,\n 700\n );\n items.add('quote', , 600);\n items.add('spoiler', , 500);\n items.add('code', , 400);\n items.add('link', , 300);\n items.add('image', , 200);\n items.add(\n 'unordered_list',\n ,\n 100\n );\n items.add('ordered_list', , 0);\n\n return items;\n}\n\nexport function initialize(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 (shortcutHandler = handler)}>\n {this.markdownToolbarItems().toArray()}\n ,\n 100\n );\n });\n}\n","import app from 'flarum/admin/app';\nimport { initialize } from '../common/index';\n\napp.initializers.add('flarum-markdown', initialize);\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","MarkdownToolbar","Component","view","vnode","m","className","children","MarkdownButton","oncreate","super","button","type","this","attrs","hotkey","onkeydown","keydown","bind","onclick","icon","title","Tooltip","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","concat","makeApplyStyle","composer","editor","add","extend","BasicEditorDriver","TextEditor","override","for","textareaId","setShortcutHandler","handler","shortcutHandler","toArray"],"sourceRoot":""}