UNPKG

@uiw/react-markdown-editor

Version:

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

46 lines (42 loc) 1.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.underline = void 0; var _state = require("@codemirror/state"); var _jsxRuntime = require("react/jsx-runtime"); var underline = { name: 'underline', keyCommand: 'underline', button: { 'aria-label': 'Add underline text' }, icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 20 20", children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { fill: "currentColor", d: "M10 17c3.3 0 6-2.7 6-6V3.5c0-.8-.7-1.5-1.5-1.5S13 2.7 13 3.5V11c0 1.7-1.3 3-3 3s-3-1.3-3-3V3.5C7 2.7 6.3 2 5.5 2S4 2.7 4 3.5V11c0 3.3 2.7 6 6 6zM16.5 19h-13c-.3 0-.5.2-.5.5s.2.5.5.5h13c.3 0 .5-.2.5-.5s-.2-.5-.5-.5z" }) }), 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: '<u>' }, { from: range.to, insert: '</u>' }], range: _state.EditorSelection.range(range.from + 3, range.to + 3) }; })); } }; exports.underline = underline; //# sourceMappingURL=underline.js.map