2016-03-08 71 views

回答

0

是的,您可以在顯示文本框以記住選擇之前使用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();