60 lines
1.7 KiB
HTML
60 lines
1.7 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>CodeMirror: Autocomplete Demo</title>
|
|
<link rel="stylesheet" href="../lib/codemirror.css">
|
|
<script src="../lib/codemirror.js"></script>
|
|
<script src="../addon/edit/matchbrackets.js"></script>
|
|
<script src="../mode/htmlmixed/htmlmixed.js"></script>
|
|
<script src="../mode/xml/xml.js"></script>
|
|
<script src="../mode/javascript/javascript.js"></script>
|
|
<script src="../mode/css/css.js"></script>
|
|
<script src="../mode/clike/clike.js"></script>
|
|
|
|
<script src="../addon/hint/show-hint.js"></script>
|
|
<link rel="stylesheet" href="../addon/hint/show-hint.css">
|
|
<script src="../addon/hint/php-hint.js"></script>
|
|
<script src="../mode/php/php.js"></script>
|
|
<link rel="stylesheet" href="../doc/docs.css">
|
|
</head>
|
|
<body>
|
|
<h2>CodeMirror: Autocomplete demo</h2>
|
|
|
|
<form><textarea id="code" name="code">
|
|
<?php
|
|
|
|
function getData($data) {
|
|
$tre = $data . " fff ";
|
|
return $tre;
|
|
}
|
|
|
|
$sa =
|
|
PMFAddInputDocument(
|
|
|
|
$list = array("a" => 1, "b" => 2, "c" => 4 );
|
|
|
|
?>
|
|
</textarea></form>
|
|
|
|
<p>Press <strong>ctrl-space</strong> to activate autocompletion. See
|
|
the code (<a href="../addon/hint/show-hint.js">here</a>
|
|
and <a href="../addon/hint/php-hint.js">here</a>) to figure out
|
|
how it works.</p>
|
|
|
|
<script>
|
|
CodeMirror.commands.autocomplete = function(cm) {
|
|
CodeMirror.showHint(cm, CodeMirror.phpHint);
|
|
}
|
|
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
|
lineNumbers: true,
|
|
matchBrackets: true,
|
|
mode: "application/x-httpd-php",
|
|
indentUnit: 2,
|
|
indentWithTabs: true,
|
|
extraKeys: {"Ctrl-Space": "autocomplete"}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|