Scriptaculous Ajax.InPlaceEditor 不适用于 HTML
我正在使用 Scriptaculous Ajax.InPlaceEditor 编辑数据库中的数据。
实际上,当数据库中没有数据时,它一开始工作得很好; 以下是我的导航器源代码中的内容:
<p id="edit" title="Click to edit" >
New text to edit here
</p>
由于 Ajax.InPlaceEditor,我可以创建一条新记录,自动添加一些 HTML 来更改设计,并且一次又一次地更改,没有任何问题。 此时,源代码如下所示:
<p id="edit" title="Click to edit" >
<ol>
<li>item1</li>
<li>item2</li>
</ol>
</p>
好的,这非常完美。 这在数据库中也是完美的...
如果我重新加载整个页面,那么可编辑段落的初始值现在是直接来自数据库的 HTML,这就是我在源代码中的内容:
<p id="edit" title="Click to edit"/>
<ol>
<li>item1</li>
<li>item2</li>
</ol>
但是 看,< /p> 神秘地失踪了,并且该段落不再可编辑...... 里奇注意到该段落实际上是自动关闭的...... 我也尝试手动将 HTML 文本设置到数据库中,结果是相同的: < /p> 丢失了...
您知道发生了什么事以及如何解决它吗?
太感谢了..
I'm using the Scriptaculous Ajax.InPlaceEditor to edit data from my database.
Actually, it works perfectly at first, when there is no data in the database ;
Here is what I have in my navigator source code :
<p id="edit" title="Click to edit" >
New text to edit here
</p>
I can create a new record, automaticly add some HTML to change design, and change again and again with no problem thanks to the Ajax.InPlaceEditor.
At this time, here is how looks the source code :
<p id="edit" title="Click to edit" >
<ol>
<li>item1</li>
<li>item2</li>
</ol>
</p>
Ok, this is just perfect. And this is perfect too in the database...
But if I reload the full page, then the initial value of the editable paragraph is now HTML coming straight from the database, and here is what I have in the source code :
<p id="edit" title="Click to edit"/>
<ol>
<li>item1</li>
<li>item2</li>
</ol>
As you can see, the < / p > is mysterously missing, and the paragraph is not editable any more...
Rich noticed that the paragraph was actually self closing...
I also tried to manually set HTML text into the database, and the result is the same :
< / p > is missing...
Would you have any idea of what's going on, and how to fix it ?
Thank you so much..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不能将
ol
包裹在p
中。 也就是说,比您想象的更早关闭
p
。 我建议使用div
intsead。You can't wrap
ol
s inp
s. That is, the<ol>
closes thep
earlier than you think. I suggest using adiv
intsead.假设您正确复制了 HTML,则原始 HTML 块末尾的 p 标记是多余的,因为您已使用斜杠关闭了第一个块中的 p 标记:
我假设编辑器“修复”了 HTML,因此删除了最后的结束 p标签,因为 p 标签在有序列表开始之前已关闭
Assuming you copied the HTML correctly, the p tag at the end of the original HTML block is superfluous, since you have closed the p tag in the first block with the slash:
I assume the editor "fixes" HTML so removed the final closing p tag since the p tag was closed before the ordered list begins