UNPKG

@uiw/react-markdown-editor

Version:

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

43 lines (42 loc) 1.69 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.bold = void 0; var _state = require("@codemirror/state"); var _jsxRuntime = require("react/jsx-runtime"); var bold = { name: 'bold', keyCommand: 'bold', button: { 'aria-label': 'Add bold text' }, icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", { width: "13", height: "13", viewBox: "0 0 384 512", children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { fill: "currentColor", d: "M304.793 243.891c33.639-18.537 53.657-54.16 53.657-95.693 0-48.236-26.25-87.626-68.626-104.179C265.138 34.01 240.849 32 209.661 32H24c-8.837 0-16 7.163-16 16v33.049c0 8.837 7.163 16 16 16h33.113v318.53H24c-8.837 0-16 7.163-16 16V464c0 8.837 7.163 16 16 16h195.69c24.203 0 44.834-1.289 66.866-7.584C337.52 457.193 376 410.647 376 350.014c0-52.168-26.573-91.684-71.207-106.123zM142.217 100.809h67.444c16.294 0 27.536 2.019 37.525 6.717 15.828 8.479 24.906 26.502 24.906 49.446 0 35.029-20.32 56.79-53.029 56.79h-76.846V100.809zm112.642 305.475c-10.14 4.056-22.677 4.907-31.409 4.907h-81.233V281.943h84.367c39.645 0 63.057 25.38 63.057 63.057.001 28.425-13.66 52.483-34.782 61.284z" }) }), execute: function execute(_ref) { var state = _ref.state, view = _ref.view; if (!state || !view) return; view.dispatch(view.state.changeByRange(function (range) { return { changes: [{ from: range.from, insert: '**' }, { from: range.to, insert: '**' }], range: _state.EditorSelection.range(range.from + 2, range.to + 2) }; })); } }; exports.bold = bold; //# sourceMappingURL=bold.js.map