And from the jQuery text() documentation (used by your blur event handler): 由于不同浏览器中HTML解析器的不同,因此文本 返回的内容可能在换行符和其他空白处有所不同. Due to variations in the HTML parsers in different browsers, the text returned may vary in newlines and other white space.我不是markdown专家,但在我看来,markdown取决于空白-如果行首有#",但是如果换行符位于#"之前,则会出现较大的标题缺少,降价促销不会给您带来大的标头.因此,如果您的空白被弄乱了,这可能是由于text()调用与contenteditable pre的结果相互作用所导致的,这将导致markdown变得混乱.I'm no markdown expert, but it looks to me like markdown depends on whitespace - you get a big header if there is a "#" at the beginning of a line, but if the line feed before the "#" is missing, markdown won't give you a big header. So if your whitespace is messed up, as can be caused by the text() call interacting with the results of the contenteditable pre, this would cause the markdown to get messed up.那你该怎么办呢?设置带有剔除的点击以进行编辑.您可以在 http://adventuresindotnet上了解它的工作原理. blogspot.com/2012/04/knockout-and-click-to-edit.html 和 http://knockoutjs.com/documentation/hasfocus-binding.htmlSo what can you do instead? Set up click-to-edit with knockout. You can see how this works at http://adventuresindotnet.blogspot.com/2012/04/knockout-and-click-to-edit.html and http://knockoutjs.com/documentation/hasfocus-binding.html在 http://jsfiddle.net/tlarson/w93BR/基本思想是拥有一个只读元素和一个可编辑元素,并且取决于您是否处于编辑模式,一次只能显示其中一个.The basic idea is to have a read-only element and an editable element, and only one of them appears at a time depending on whether you are in edit mode or not.<pre data-bind="text: text, visible: !editingText(), click: textClick"></pre><textarea data-bind="value: text, valueUpdate: 'afterkeyup', visible: editingText, hasfocus: editingText" type='text'"></textarea> 这篇关于淘汰赛,内容可编辑(和减价)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-30 10:52