UNPKG

@uiw/react-markdown-editor

Version:

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

44 lines (42 loc) 1.29 kB
import { jsx as _jsx } from "react/jsx-runtime"; export var olist = { name: 'olist', keyCommand: 'olist', button: { 'aria-label': 'Add olist text' }, icon: /*#__PURE__*/_jsx("svg", { width: "12", height: "12", viewBox: "0 0 32 32", children: /*#__PURE__*/_jsx("path", { fill: "currentColor", d: "M12 2h20v4h-20v-4zM12 14h20v4h-20v-4zM12 26h20v4h-20v-4zM0 4c0 2.209 1.791 4 4 4s4-1.791 4-4c0-2.209-1.791-4-4-4s-4 1.791-4 4zM0 16c0 2.209 1.791 4 4 4s4-1.791 4-4c0-2.209-1.791-4-4-4s-4 1.791-4 4zM0 28c0 2.209 1.791 4 4 4s4-1.791 4-4c0-2.209-1.791-4-4-4s-4 1.791-4 4z" }) }), execute: _ref => { var { state, view } = _ref; if (!state || !view) return; var lineInfo = view.state.doc.lineAt(view.state.selection.main.from); var mark = '- '; var matchMark = lineInfo.text.match(/^-/); if (matchMark && matchMark[0]) { mark = ''; } view.dispatch({ changes: { from: lineInfo.from, to: lineInfo.to, insert: "" + mark + lineInfo.text }, // selection: EditorSelection.range(lineInfo.from + mark.length, lineInfo.to), selection: { anchor: view.state.selection.main.from + mark.length } }); } }; //# sourceMappingURL=olist.js.map