菜鸟教程小白 发表于 2022-12-12 20:24:09

ios - 具有 contenteditable 的 UIWebview - 上标和下标不起作用


                                            <p><p>我有带有 contenteditable 的 webview 并使用 javascript 进行富文本编辑。它适用于以下一些命令,例如“粗体”和“斜体”:</p>

<pre><code>;

;
</code></pre>

<p>但不知何故下面的“上标”和“下标”,它不起作用:</p>

<pre><code>;

;
</code></pre>

<p>谁知道,在iOS下,我们有没有类似的<a href="https://developer.mozilla.org/en-US/docs/Rich-Text_Editing_in_Mozilla#Executing_Commands" rel="noreferrer noopener nofollow">Rich-Text Editing in Mozilla</a> ,这样我就可以知道哪些命令在 Safari-UIWebview 下可以工作?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>刚刚在我的 iOS7.1 iPad 上测试了这个页面:</p>

<p> <a href="http://quirksmode.org/dom/execCommand/" rel="noreferrer noopener nofollow">http://quirksmode.org/dom/execCommand/</a> </p>

<p>上标和下标都有效。看源码,执行如下命令:<code>document.execCommand("superscript", false, null);</code></p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 具有 contenteditable 的 UIWebview - 上标和下标不起作用,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/22430956/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/22430956/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 具有 contenteditable 的 UIWebview - 上标和下标不起作用