mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 06:03:39 +08:00
48b29b90db
Includes transpiled JS/TS. [skip ci]
2 lines
4.5 KiB
JavaScript
2 lines
4.5 KiB
JavaScript
module.exports=function(t){var e={};function o(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,o),n.l=!0,n.exports}return o.m=t,o.c=e,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=7)}([function(t,e){t.exports=flarum.core.compat["common/Component"]},function(t,e){t.exports=flarum.core.compat.extend},function(t,e){t.exports=flarum.core.compat["common/components/TextEditor"]},function(t,e){t.exports=flarum.core.compat["common/utils/BasicEditorDriver"]},function(t,e){t.exports=flarum.core.compat["common/utils/styleSelectedText"]},function(t,e){t.exports=flarum.core.compat["common/helpers/icon"]},function(t,e){t.exports=flarum.core.compat["common/components/Tooltip"]},function(t,e,o){"use strict";o.r(e);var r=o(1),n=o(2),i=o.n(n),c=o(3),l=o.n(c),a=o(4),u=o.n(a);function f(t,e){return(f=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,f(t,e)}var p=o(0),d=o.n(p),x=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.view=function(t){return m("div",{class:"MarkdownToolbar"},t.children)},e}(d.a),h=o(5),k=o.n(h),y=o(6),b=o.n(y),v=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var o=e.prototype;return o.oncreate=function(e){t.prototype.oncreate.call(this,e)},o.view=function(){var t=m("button",{className:"Button Button--icon Button--link",type:"button","data-hotkey":this.attrs.hotkey,onkeydown:this.keydown.bind(this),onclick:this.attrs.onclick},k()(this.attrs.icon));return this.attrs.title?m(b.a,{text:this.attrs.title},t):t},o.keydown=function(t){" "!==t.key&&"Enter"!==t.key||(t.preventDefault(),this.element.click())},e}(d.a),_=navigator.userAgent.match(/Macintosh/)?"⌘":"ctrl",g={header:{prefix:"### "},bold:{prefix:"**",suffix:"**",trimFirst:!0},italic:{prefix:"_",suffix:"_",trimFirst:!0},strikethrough:{prefix:"~~",suffix:"~~",trimFirst:!0},quote:{prefix:"> ",multiline:!0,surroundWithNewlines:!0},code:{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"},link:{prefix:"[",suffix:"](https://)",replaceNext:"https://",scanFor:"https?://"},image:{prefix:"![",suffix:"](https://)",replaceNext:"https://",scanFor:"https?://"},unordered_list:{prefix:"- ",multiline:!0,surroundWithNewlines:!0},ordered_list:{prefix:"1. ",multiline:!0,orderedList:!0},spoiler:{prefix:">!",suffix:"!<",blockPrefix:">! ",multiline:!0,trimFirst:!0}},w=function(t){u()(app.composer.editor.el,g[t])};function O(t,e){return function(o){o.key===e&&(o.metaKey&&"⌘"===_||o.ctrlKey&&"ctrl"===_)&&(o.preventDefault(),w(t))}}app.initializers.add("flarum-markdown",(function(t){Object(r.extend)(l.a.prototype,"keyHandlers",(function(t){t.add("bold",O("bold","b")),t.add("italic",O("italic","i"))})),Object(r.extend)(i.a.prototype,"toolbarItems",(function(e){var o=function(e,o){return t.translator.trans("flarum-markdown.forum.composer."+e+"_tooltip")+(o?" <"+_+"-"+o+">":"")},r=function(t){return function(){return w(t)}};e.add("markdown",m(x,{for:this.textareaId,setShortcutHandler:function(t){return shortcutHandler=t}},m(v,{title:o("header"),icon:"fas fa-heading",onclick:r("header")}),m(v,{title:o("bold","b"),icon:"fas fa-bold",onclick:r("bold")}),m(v,{title:o("italic","i"),icon:"fas fa-italic",onclick:r("italic")}),m(v,{title:o("strikethrough"),icon:"fas fa-strikethrough",onclick:r("strikethrough")}),m(v,{title:o("quote"),icon:"fas fa-quote-left",onclick:r("quote")}),m(v,{title:o("spoiler"),icon:"fas fa-exclamation-triangle",onclick:r("spoiler")}),m(v,{title:o("code"),icon:"fas fa-code",onclick:r("code")}),m(v,{title:o("link"),icon:"fas fa-link",onclick:r("link")}),m(v,{title:o("image"),icon:"fas fa-image",onclick:r("image")}),m(v,{title:o("unordered_list"),icon:"fas fa-list-ul",onclick:r("unordered_list")}),m(v,{title:o("ordered_list"),icon:"fas fa-list-ol",onclick:r("ordered_list")})),100)}))}))}]);
|
|
//# sourceMappingURL=forum.js.map
|