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