[fix] sending messages
This commit is contained in:
parent
0dfcbf17d8
commit
c59edb71a2
6 changed files with 147 additions and 13 deletions
41
webapp/static/ace/esm.html
Normal file
41
webapp/static/ace/esm.html
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width,height=device-height" />
|
||||
<title>BaseX LSP</title>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div>something<button onclick="foo()">send</button><a href="/dba/logs" target="_blank">dba</a></div>
|
||||
<div id="editor" style="height: 100px">some text</div>
|
||||
<script type="module">
|
||||
import * as ace from "https://www.unpkg.com/ace-code@latest/src-noconflict/ace.js";
|
||||
import { Mode as JSONMode } from "ace-code/src/mode/json"; //any mode you want
|
||||
import { AceLanguageClient } from "ace-linters/build/ace-language-client";
|
||||
|
||||
// Create a web socket
|
||||
const serverData = {
|
||||
module: () => import("ace-linters/build/language-client"),
|
||||
modes: "json|json5",
|
||||
type: "socket",
|
||||
socket: new WebSocket("ws://127.0.0.1:3000/exampleServer"), // address of your websocket server
|
||||
}
|
||||
// Create an Ace editor
|
||||
let editor = ace.edit("container", {
|
||||
mode: new JSONMode() // Set the mode of the editor to JSON
|
||||
});
|
||||
|
||||
// Create a language provider for web socket
|
||||
let languageProvider = AceLanguageClient.for(serverData);
|
||||
|
||||
// Register the editor with the language provider
|
||||
languageProvider.registerEditor(editor);
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue