如何保存添加到AJAX HTML编辑器中的文本,作为一个html文件? [英] How do I save the text added to an ajax html editor, as an html document?

查看:74
本文介绍了如何保存添加到AJAX HTML编辑器中的文本,作为一个html文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了一个AJAX HTML编辑器,我的ASP.NET web应用程序,这是工作的罚款。然而,当我编辑的内容保存到我的SQL数据库,它只是保存的HTML。我需要将其保存为HTML文档。有没有一种方法以编程的内容保存在数据库中的文档,然后可以使用我的asp.net应用程序打开?此外,有没有办法使用的HTML编辑器来固定在编辑器中添加的文本部分?

I added an AJAX html editor to my ASP.NET web app and it is working fine. However, when I save the contents of the editor to my sql database it just saves the html. I need to save this as an html document. Is there a way to programatically save the contents as a document in the database, which can then be opened using my asp.net app? Also, is there a way to use the html editor to anchor sections of the text added in the editor?

感谢您的所有帮助,

推荐答案

大多数HTML编辑器只能插入HTML代码段,所以你可以做的就是把编辑的内容,并添加到HTML文档中,插入数据库之前

Most html editors only insert snippets of html, so what you can do is take the contents of the editor and add into an html document, before inserting into the database.

string.Concat('<html><body>', editor_contents, '</body></html>');

您必须修改这个以满足您的特定需求,但这应该让你开始。为了锚文本,你只需要一个ID添加到您想挂靠的部分。

You will have to modify this to suit your specific needs, but this should get you started. To anchor text you just need to add an id to the section you would like anchored.

<a href="#someID">Go to section</a>
<div id="someID">Section</div>

这篇关于如何保存添加到AJAX HTML编辑器中的文本,作为一个html文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆