Forgot password?
 Register account
View 549|Reply 8

凡是点过右上的👁之后就算再切换回公式,MathJax的右键菜单也没了

[Copy link]

682

Threads

110K

Posts

910K

Credits

Credits
90973
QQ

Show all posts

kuing Posted 2024-2-21 17:57 |Read mode
Last edited by hbghlyj 2025-4-6 07:18forum.php?mod=viewthread&tid=11983
該函數把innerHTML做了替换,然後把innerHTML設置回去,DOM仍在,但元素都重新創建了,導致MathJax給公式添加的“右键eventListener”全部丢失了。
所以凡是点过右上的👁之后就算再切换回公式,MathJax的右键菜单也没了,也是同样道理?

Related threads

682

Threads

110K

Posts

910K

Credits

Credits
90973
QQ

Show all posts

 Author| kuing Posted 2025-4-6 14:22
Last edited by kuing 2025-4-6 14:34测试:行内 `A` 公式,行间
\begin{align*}
A&=B\\
C&=D
\end{align*}
公式,行内的多行公式块 `\led
a&=b\\
c&=d
\endled`。

行间公式后的空行,看替换后如何
\[a^2+b^2=c^2\]


(上面有两个空行,如果显示的也是两个,则正常,下同)

引用后的 <br>:
引用

(上面有两个空行)

代码块后的 <br>,及代码块的换行:
  1. 代码
  2. 代码
  3. 代码
Copy the Code


(上面有两个空行)

682

Threads

110K

Posts

910K

Credits

Credits
90973
QQ

Show all posts

 Author| kuing Posted 2025-4-6 14:32
Last edited by kuing 2025-4-6 14:54替换 <br> 正常。

但显示代码有问题:

一、点击👁后,显示出来的代码中,没了换行;(title 反而有换行)
要解决可以考虑添加 white-space: pre-wrap; ?

二、再次点击👁变回公式,此时:
右键公式 -> show math as -> tex commands,则 & 变成了 &amp;(copy to clipboard 也是)

细节方面,由于新的👁里没有 href,所以鼠标移到👁上不会变成小手手,可以在 style 里加 cursor: pointer;

682

Threads

110K

Posts

910K

Credits

Credits
90973
QQ

Show all posts

 Author| kuing Posted 2025-4-6 15:18
Last edited by kuing 2025-4-6 17:11看看引用楼层的换行如何

结果:引用楼层时,如果不再编辑,则显示正常(无空行)。如果再编辑,空行会多一个,需要手动删除。

难怪我当年在我的代码注释里说:
  1.             //去编辑痕迹、引用后的1-2个br,代码块后的1个br
Copy the Code
为什么引用后去除的是 1-2 个,原因应该就在此。

3152

Threads

7905

Posts

610K

Credits

Credits
64068
QQ

Show all posts

hbghlyj Posted 2025-4-6 18:54
kuing 发表于 2025-4-6 07:32
右键公式 -> show math as -> tex commands,则 & 变成了 &amp;
通过把innerHTML改为innerText解决了这个

3152

Threads

7905

Posts

610K

Credits

Credits
64068
QQ

Show all posts

hbghlyj Posted 2025-4-6 19:02
kuing 发表于 2025-4-6 07:32
一、点击👁后,显示出来的代码中,没了换行;(title 反而有换行)
要解决可以考虑添加 white-space: pre-wrap; ?
Ok

3152

Threads

7905

Posts

610K

Credits

Credits
64068
QQ

Show all posts

hbghlyj Posted 2025-4-6 19:04
kuing 发表于 2025-4-6 07:32
细节方面,由于新的👁里没有 href,所以鼠标移到👁上不会变成小手手,可以在 style 里加 cursor: pointer;
Ok

3152

Threads

7905

Posts

610K

Credits

Credits
64068
QQ

Show all posts

hbghlyj Posted 2025-4-6 19:19
kuing 发表于 2025-4-6 08:18
如果再编辑,空行会多一个,需要手动删除。
找到了,是model_forum_post.php的问题,已将\n\n改为1个\n

682

Threads

110K

Posts

910K

Credits

Credits
90973
QQ

Show all posts

 Author| kuing Posted 2025-4-6 19:58
好,暂时没发现什么问题😇

Mobile version|Discuz Math Forum

2025-6-4 17:17 GMT+8

Powered by Discuz!

× Quick Reply To Top Edit