wangeditor富文本编辑器中,对应修改字体后源代码中添加的时候font标签,如何将font标签更改为div标签呢
1个回答
展开全部
1)把当前的编辑器form表单提交修改为Javascript方式提交。
<form action="index.php" method="POST" name="myForm">
form表单加入name元素。
<button class="btn2">提交</button>
submit提交改为button方式。
<script type="text/javascript">
function submitForm(){
document.myForm.action = document.myForm.action;
document.myForm.submit();
}
$(".btn2").click(function(){
submitForm();
})
</script>
2)通过UEditor API中的editor.execCommand( 'source')方法事件,在源代码状态提交时切换为编辑模式。
<script type="text/javascript">
var ue = UE.getEditor('editor',{
toolbars: [["undo","redo","|","bold","italic","underline","strikethrough","|","fontsize","forecolor","backcolor","|","removeformat","|","selectall","cleardoc","source","|","unlink","link","|","insertimage"]],wordCount:false
});
function submitForm(){
document.myForm.action = document.myForm.action;
document.myForm.submit();
}
$(".btn2").click(function(){
ue.execCommand('source');
submitForm();
})
</script>
<form action="index.php" method="POST" name="myForm">
form表单加入name元素。
<button class="btn2">提交</button>
submit提交改为button方式。
<script type="text/javascript">
function submitForm(){
document.myForm.action = document.myForm.action;
document.myForm.submit();
}
$(".btn2").click(function(){
submitForm();
})
</script>
2)通过UEditor API中的editor.execCommand( 'source')方法事件,在源代码状态提交时切换为编辑模式。
<script type="text/javascript">
var ue = UE.getEditor('editor',{
toolbars: [["undo","redo","|","bold","italic","underline","strikethrough","|","fontsize","forecolor","backcolor","|","removeformat","|","selectall","cleardoc","source","|","unlink","link","|","insertimage"]],wordCount:false
});
function submitForm(){
document.myForm.action = document.myForm.action;
document.myForm.submit();
}
$(".btn2").click(function(){
ue.execCommand('source');
submitForm();
})
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询