在单个页面上实现moowmd多编辑器时遇到问题

时间:2011-07-09 07:43:28

标签: asp.net-mvc-3

想要使用此编辑器:http://moowmd.awardspace.info/moowmd-tutorial.html

只获得textarea ..不显示按钮栏和&预览

我的代码:       

<script type="text/javascript">
function loaded()
{
var WConfig=[
{
    input: 'some-id',
    postfix: 'XXX'
}

]; window.addEvent( 'domready中',函数(){     window.MyWMD = new mooWMD.WMD(window.WConfig);     window.MyWMD.start(); } }     

.... ....

            @ Model.CommentText

1 个答案:

答案 0 :(得分:0)

MooWMD编辑器有几个依赖项:

  • MooTools库
  • moowmd.js
  • wmd.css
  • 图像

确保已将所有这些依赖项包含在项目中。

所以这是一个完整的工作示例(下载moowmd包并将其内容放入您网站的moowmd文件夹中):

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/moowmd/wmd.css")" rel="stylesheet" type="text/css" />
    <style> 
    textarea {
        width: 500px;
        height: 200px;
    }
    .wmd-panel {
        width: 300px;
        background-color: white;
    }
    ul {
        list-style: none;
    }
    </style> 
</head>
<body>
    <div id="wmd-editor-uno" class="wmd-panel"> 
        <div id="wmd-button-bar-uno" class="wmd-button-bar"></div> 
        <textarea name="id-uno" id="id-uno"></textarea> 
    </div> 

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/mootools/1.2.3/mootools-yui-compressed.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/moowmd/moowmd.js")"></script>
    <script type="text/javascript">
    var WConfig = [
        {
            input: 'id-uno',
            postfix: '-uno'
        }
    ];

    window.addEvent('domready', function () {
        window.MyWMD = new mooWMD.WMD(window.WConfig);
        window.MyWMD.start();
    });
    </script>
</body>
</html>