我使用Medium-editor作为内容编辑器。我可以通过链接按钮创建链接,但当我将光标移动到输入框(链接输入框-占位符txtbox)时,文本选择就消失了。如果可以保持选择?Click to see the image reference
在这里,我附加了图像。
发布于 2017-02-10 17:23:13
可以,您可以在显示textbox之前使用saveSelection()方法来记住选择。稍后,当您希望恢复它时,只需调用restoreSelection()。
在内部,这些帮助器方法只是调用exportSelection()并在内部存储选择数据,然后调用importSelection(selection)并将存储的值传递给它。
这里有一些关于如何使用这些方法的附加文档,您可以在here中找到
示例:
var editor = new MediumEditor('.editable');
// ------------------
// Later, before you display your textbox
editor.saveSelection();
// Display the textbox
// ------------------
// Later, when you want to restore the selection to what it was before
editor.restoreSelection();https://stackoverflow.com/questions/35873999
复制相似问题