简体   繁体   English

在Firefox浏览器中,contenteditable = false

[英]contenteditable = false in firefox browser

I have a problem with firefox. 我的Firefox有问题。 Cursor jumps into div where i have set an attribute contenteditable = false when i click backspace, instead of deleting whole div which I excpect (works on chrome and safari) The structure: 当我单击退格键时,光标会跳到div处,在该处我设置了一个属性contenteditable = false,而不是删除我期望的整个div(适用于chrome和safari)结构:

<div contenteditable="true">
     <div contenteditable="false">
        ### CONTENT ###
     </div> 
</div>

Also each nested HTML component has an attribute contenteditable="false" 此外,每个嵌套的HTML组件都有一个属性contenteditable =“ false”

How to solve this incompatibility problem? 如何解决这个不兼容的问题?

Unfortunately this seems to be a known Firefox Bug ... 不幸的是,这似乎是已知的Firefox错误 ...

I've used this solution here to counter that problem. 我在这里使用此解决方案来解决该问题。 It detects backspaces and checks if the element right before the caret has contenteditable set to false . 它检测退格并检查插入符号前的元素是否将contenteditable设置为false If so it removes it. 如果是这样,它将删除它。 Works like a charm. 奇迹般有效。

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

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