简体   繁体   English

如何以编程方式删除 <H1> 〜 <H6> 标签?

[英]How do I programmatically remove <H1>~<H6> tags?

I'm currently Working on a OSX Application, which uses a editable WebView. 我当前正在使用可编辑WebView的OSX应用程序。
I use a 我用

[webView stringByEvaluatingJavaScriptFromString:@"document.execCommand(\"FormatBlock\", false, \"<H1>\")"];

command to give the selected paragraph(or the paragraph where the cursor is located) a H1 tag. 命令给选定的段落(或光标所在的段落)一个H1标签。
Is there a way to remove the < H1 >~< H6 > (And if possible < Blockquote >) tags? 有没有一种方法可以删除<H1>〜<H6>(如果可能的话,请使用<Blockquote>)标签?
Even better, Is there a way to change the tags into a < div > tag instead? 更好的是,有没有办法将标签更改为<div>标签?

I just found a similar question at JavaScript document.execCommand remove formatBlock formatting? 我刚刚在JavaScript document.execCommand删除formatBlock格式找到了类似的问题

All I needed to do was 我要做的就是

[webView stringByEvaluatingJavaScriptFromString:@"document.execCommand(\"FormatBlock\", false, \"<div>\")"];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM