UNPKG

@uiw/react-md-editor

Version:

A markdown editor with preview, implemented with React.js and TypeScript.

48 lines (46 loc) 1.92 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"]; Object.defineProperty(exports, "__esModule", { value: true }); exports.issue = void 0; var _react = _interopRequireDefault(require("react")); var _markdownUtils = require("../utils/markdownUtils"); var _jsxRuntime = require("react/jsx-runtime"); var issue = exports.issue = { name: 'issue', keyCommand: 'issue', prefix: '#', suffix: '', buttonProps: { 'aria-label': 'Add issue', title: 'Add issue' }, icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", { role: "img", width: "12", height: "12", viewBox: "0 0 448 512", children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { fill: "currentColor", d: "M181.3 32.4c17.4 2.9 29.2 19.4 26.3 36.8L197.8 128h95.1l11.5-69.3c2.9-17.4 19.4-29.2 36.8-26.3s29.2 19.4 26.3 36.8L357.8 128H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H347.1L325.8 320H384c17.7 0 32 14.3 32 32s-14.3 32-32 32H315.1l-11.5 69.3c-2.9 17.4-19.4 29.2-36.826.3s-29.2-19.4-26.3-36.8l9.8-58.7H155.1l-11.5 69.3c-2.9 17.4-19.4 29.2-36.8 26.3s-29.2-19.4-26.3-36.8L90.2 384H32c-17.7 0-32-14.3-32-32s14.3-32 32-32h68.9l21.3-128H64c-17.7 0-32-14.3-32-32s14.3-32 32-32h68.9l11.5-69.3c2.9-17.4 19.4-29.2 36.8-26.3zM187.1 192L165.8320h95.1l21.3-128H187.1z" //Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com }) }), execute: function execute(state, api) { var newSelectionRange = (0, _markdownUtils.selectWord)({ text: state.text, selection: state.selection, prefix: state.command.prefix, suffix: state.command.suffix }); var state1 = api.setSelectionRange(newSelectionRange); (0, _markdownUtils.executeCommand)({ api: api, selectedText: state1.selectedText, selection: state.selection, prefix: state.command.prefix, suffix: state.command.suffix }); } };