MooWMD Undefined?

First of all, this is the code!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <link href="content/wmd.css" rel="stylesheet" type="text/css" />
    <title>some title </title>
</head>
<body>
    <div class="main">
        <form>
            <h2>Only teaxt area</h2>
            <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>
        </form>
    </div>
    <script type='text/javascript' src="Scripts/mootools-yui-compressed.js"></script>
    <script type='text/javascript' src="Scripts/moowmd.js"></script>
    <script type="text/javascript">
        var MyConfig = [
        {
            input: 'id-uno',
            postfix: '-uno'
         }];
         window.addEvent('domready', function() {
             window.MyMooWMD = new mooWMD.WMD(window.MyConfig);
             window.MyMooWMD.start();
         });
    </script>
</body>
</html>  

Bam!

My problem is that this does not work, as an example in the mooWMD tutorial , all I get is an empty text area with wmd.css. I canโ€™t understand what I can do wrong. All file locations are correct, but I get "mooWMD" undefined. I am at a loss, and all suggestions are welcome.

+3
source share
3 answers

The problem (for future generations) is that IE does not accept the following syntax:

{
   att1: 'value',
   att2: 'value'
}

In other browsers. I changed it to

{
   'att1': 'value',
   'att2': 'value'
}

And now all is well. (using the mailing list, I would get my attention earlier)

+1
source

javascript , . , moowmd.js .

:

<script type="text/javascript">
    function loaded() {
        var MyConfig = [
        {
            input: 'id-uno',
            postfix: '-uno'
         }];
         window.addEvent('domready', function() {
             window.MyMooWMD = new mooWMD.WMD(window.MyConfig);
             window.MyMooWMD.start();
         });}
</script>

onload body:

    <body onload="loaded();">

onload , javascript, , css ..

+1
 <head>
       <title>some title </title>
       <link rel="stylesheet" type="text/css" href="Content/wmd.css" />
       <script type="text/javascript" src="Scripts/showdown.js"></script>
     </head>
     <body>
        <div class="main">
            <div id="wmd-editor" class="wmd-panel">
                <div id="wmd-button-bar">
                </div>
                <textarea id="wmd-input"></textarea>
            </div>
            <div id="wmd-preview" class="wmd-panel">
            </div>
            <div id="wmd-output" class="wmd-panel">
            </div>
        </div>
        <script type="text/javascript" src="Scripts/wmd.js"></script>
    </body>

moowmd, IE. , moowmd, , . stackoverflow wmd, .

0

Source: https://habr.com/ru/post/1715593/


All Articles