Forgot password?
 Create new account
View 370|Reply 8

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

[Copy link]

701

Threads

110K

Posts

910K

Credits

Credits
94145
QQ

Show all posts

kuing Posted at 2024-2-21 17:57:36 |Read mode
Last edited by hbghlyj at 2025-4-6 07:18:20kuing.cjhb.site/forum.php?mod=viewthread&tid=11983
該函數把innerHTML做了替换,然後把innerHTML設置回去,DOM仍在,但元素都重新創建了,導致MathJax給公式添加的“右键eventListener”全部丢失了。

所以凡是点过右上的👁之后就算再切换回公式,MathJax的右键菜单也没了,也是同样道理?

Related threads

701

Threads

110K

Posts

910K

Credits

Credits
94145
QQ

Show all posts

 Author| kuing Posted at 2025-4-6 14:22:32
Last edited by kuing at 2025-4-6 14:34:49测试:行内 `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



(上面有两个空行)

701

Threads

110K

Posts

910K

Credits

Credits
94145
QQ

Show all posts

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

但显示代码有问题:

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

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

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

701

Threads

110K

Posts

910K

Credits

Credits
94145
QQ

Show all posts

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

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

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

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

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

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

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

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

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

Ok

3148

Threads

8489

Posts

610K

Credits

Credits
66148
QQ

Show all posts

hbghlyj Posted at 2025-4-6 19:19:40
kuing 发表于 2025-4-6 08:18
如果再编辑,空行会多一个,需要手动删除。

找到了,是model_forum_post.php的问题,已将\n\n改为1个\n

701

Threads

110K

Posts

910K

Credits

Credits
94145
QQ

Show all posts

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

手机版Mobile version|Leisure Math Forum

2025-4-20 11:49 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list