2
我試圖插入一個引號,然後將光標移動到編輯器的末尾。目前,我插入報價,光標結束了報價,所以如果你要開始輸入,用戶將添加到報價這不是我想要發生的報價使用SCEditor將光標設置到文本的末尾
我試過了documentation弄清楚如何做到這一點,但我不認爲我引用的理解
這裏是我當前的代碼:
$(document.body).on('click', '.action.quote', function() {
var $target = $($(this).data('target'));
var editor = $('#reply-body').sceditor('instance');
var bodyText = $target.html();
editor.insert('[quote=author]' + bodyText + '[/quote]');
editor.focus();
smoothScroll('#new-comment');
});
是否有一個快速的方法來做到這一點?我對SCEditor非常陌生,所以對我來說都是新的
這是否幫助呢? https://www.sceditor.com/documentation/custom-bbcodes/#format + https://www.sceditor.com/documentation/custom-commands/#exec – brunoais
我不確定這就是我要找的。我可以插入報價,但光標的位置並不在[/ quote]之後,而是位於該標籤之前,因此當您打字時,不會在 – Ben