【发布时间】:2014-10-20 10:22:38
【问题描述】:
我在粘贴到 Froala 时遇到了一些问题。我有一个自定义代码按钮,它添加了<pre><code>Code here</code></pre> 标签:
$('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();
}
}
}
});
我希望能够将代码粘贴到编辑器中,删除样式但保留换行符和缩进。与CNTL+K 在 SO 上类似。这可能吗?
【问题讨论】:
标签: jquery wysiwyg indentation paste froala