Back to Editor Md

插入字符 / 设置和获取光标位置 / 设置、获取和替换选中的文本

examples/set-get-replace-selection.html

1.5.0653 B
Original Source

Examples javascript var testEditormd; $(function() { testEditormd = editormd("test-editormd", { width: "90%", height: 640, path : '../lib/' }); }); $("#btn1").click(function(){ testEditormd.setCursor({line:1, ch:2}); }); $("#btn2").click(function(){ console.log("getCursor =\>", testEditormd.getCursor()); }); $("#btn3").click(function(){ testEditormd.setSelection({line:1, ch:0}, {line:5, ch:100}); }); $("#btn4").click(function(){ console.log("getSelection =\>", testEditormd.getSelection()); }); $("#btn5").click(function(){ testEditormd.replaceSelection("$$$$$$$$$"); }); $("#btn6").click(function(){ testEditormd.insertValue("????"); });