@uiw/react-markdown-editor
Version:
A markdown editor with preview, implemented with React.js and TypeScript.
51 lines (46 loc) • 1.48 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.olist = void 0;
var _jsxRuntime = require("react/jsx-runtime");
var olist = {
name: 'olist',
keyCommand: 'olist',
button: {
'aria-label': 'Add olist text'
},
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
width: "12",
height: "12",
viewBox: "0 0 32 32",
children: /*#__PURE__*/(0, _jsxRuntime.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: function execute(_ref) {
var state = _ref.state,
view = _ref.view;
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: "".concat(mark).concat(lineInfo.text)
},
// selection: EditorSelection.range(lineInfo.from + mark.length, lineInfo.to),
selection: {
anchor: view.state.selection.main.from + mark.length
}
});
}
};
exports.olist = olist;
//# sourceMappingURL=olist.js.map