1
我在粘贴到Froala时遇到了一些麻烦。我有一个自定义代码按钮,增加了<pre><code>Code here</code></pre>
标签:Froala编辑器在粘贴代码时保持缩进
$('textarea[name="description"]').editable({
customButtons: {
insertCode: {
title: 'Insert code',
icon: {
type: 'font',
value: 'fa fa-code'
},
callback: function() {
if (!this.selectionInEditor()) {
this.$element.focus(); // Focus on editor if it's not.
}
var html = '<pre><code>' + (this.text() || '​') + '</code></pre>';
this.insertHTML(html);
this.saveUndoStep();
}
}
}
});
我希望能够代码粘贴到编辑器中删除的造型,但保留换行符和缩进。与SO类似,与CNTL+K
相似。这可能吗?