diff --git a/addon/hint/html-hint.js b/addon/hint/html-hint.js index addd9b7bc0be8ebca9ab081d9560b201067a1dea..992218f2883155fab542271f19082ed9c769ea52 100755 --- a/addon/hint/html-hint.js +++ b/addon/hint/html-hint.js @@ -3,9 +3,9 @@ (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); + mod(require("../../lib/codemirror", "./xml-hint")); else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); + define(["../../lib/codemirror", "./xml-hint"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { diff --git a/demo/requirejs.html b/demo/requirejs.html new file mode 100644 index 0000000000000000000000000000000000000000..6399f8d769cb884a75e456ada9045666adf71043 --- /dev/null +++ b/demo/requirejs.html @@ -0,0 +1,52 @@ +<!doctype html> + +<head> + <title>CodeMirror: HTML completion demo</title> + <meta charset="utf-8"/> + <link rel=stylesheet href="../doc/docs.css"> + + <link rel="stylesheet" href="../lib/codemirror.css"> + <link rel="stylesheet" href="../addon/hint/show-hint.css"> + <script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.14/require.min.js"></script> + <style type="text/css"> + .CodeMirror {border-top: 1px solid #888; border-bottom: 1px solid #888;} + </style> +</head> + +<body> + <div id=nav> + <a href="http://codemirror.net"><img id=logo src="../doc/logo.png"></a> + <ul> + <li><a href="../index.html">Home</a> + <li><a href="../doc/manual.html">Manual</a> + <li><a href="https://github.com/marijnh/codemirror">Code</a> + </ul> + <ul> + <li><a class=active href="#">HTML completion</a> + </ul> + </div> + + <article> + <h2>RequireJS module loading demo</h2> + + <p>This demo does the same thing as + the <a href="html5complete.html">HTML5 completion demo</a>, but + loads its dependencies + with <a href="http://requirejs.org/">Require.js</a>, rather than + explicitly. Press <strong>ctrl-space</strong> to activate + completion.</p> + + <div id="code"></div> + + <script type="text/javascript"> + require(["../lib/codemirror", "../mode/htmlmixed/htmlmixed", + "../addon/hint/show-hint", "../addon/hint/html-hint"], function(CodeMirror) { + editor = CodeMirror(document.getElementById("code"), { + mode: "text/html", + extraKeys: {"Ctrl-Space": "autocomplete"}, + value: document.documentElement.innerHTML + }); + }); + </script> + </article> +</body>