带有显示的跨度:没有一个没有显示Firefox中的空间棒

发布于 2025-01-24 19:31:33 字数 660 浏览 2 评论 0原文

我们有一个用例,其中一些具有显示的跨度:无添加到我们的内容可编辑的div中。

因此,当用户以某种方式降落在跨度上并尝试添加内容时,空间条就会在跨度内添加,从而不会在UI中显示。所有其他字符都可以正常工作。这个问题仅在空间上。

这似乎是一个唯一的问题。 Chrome工作正常。

能够使用此JSfiddle-> https://jsfiddle.net/senths/senths/senths/ehlp86zy/3/3/3/ (单击(单击)您好& amp;尝试添加空间)

”小提琴演示“

使用的firefox版本:91.8.0esr(64位)

这是Firefox中预期的这种行为吗?

任何铅都值得赞赏。提前致谢。

We had a use case where some spans with display:none is added to our content editable div.

So when the user somehow lands on the span and tries to add content, the space bars are getting added inside the span, thereby not showing up in the UI. All other characters are working fine. The issue is only with the space.

This seems to be a Firefox only issue. Chrome is working fine.

Was able to reproduce the issue using this jsfiddle -> https://jsfiddle.net/senths/ehLp86zy/3/ (click b/w hello & world and try to add space)

Fiddle demo

Firefox Version Used: 91.8.0esr (64-bit)

Is this behaviour expected in Firefox?

Any lead is appreciated. Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

空城之時有危險 2025-01-31 19:31:33

对另一个答案感到困惑,据我所知,这里的解决方案恰恰相反。如果将contenditable =“ false”添加到span,它将阻止空格添加到隐藏的span

<div id="parent">
  <div contenteditable="true" id="editor2">
    hello<span style="display: none" id="dummy_bkm" contenteditable="false"> </span>world
  </div>
</div>

要了解正在发生的事情,请尝试在下面的代码中插入一个空间(没有显示:无,并且没有contineDectibal =“ false”

<div id="parent">
  <div contenteditable="true" id="editor2">
    hello<span style="background: green;" id="dummy_bkm" > </span>world
  </div>
</div>

Confused by the other answer, to the best of my knowledge the solution here is the exact opposite. If you add contenteditable="false" to the span it will prevent spaces getting added to the hidden span.

<div id="parent">
  <div contenteditable="true" id="editor2">
    hello<span style="display: none" id="dummy_bkm" contenteditable="false"> </span>world
  </div>
</div>

To understand what's happening try inserting a space in the below code (without the display: none and without the contenteditable="false"

<div id="parent">
  <div contenteditable="true" id="editor2">
    hello<span style="background: green;" id="dummy_bkm" > </span>world
  </div>
</div>

碍人泪离人颜 2025-01-31 19:31:33

如果您在跨度标签中设置continedable =“ true”,则我相信(我相信)您在Firefox中的意图如何工作。

Firefox中有一个已知的虫子已有4年的历史了。有关此信息的信息是: https://bugzilla.mozilla.mozilla.org/show_bug.cgi.cgi.cgi? id = 1489481

If you set contenteditable="true" inside the span tag this will work how (I believe) you intent it to in Firefox.

There is a know reported bug in Firefox that is 4 years old. Information about that is at: https://bugzilla.mozilla.org/show_bug.cgi?id=1489481

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文