re-introduce KTxt2Editor js

This commit is contained in:
2021-10-29 09:39:23 -04:00
parent 7ae6991fd7
commit 3a99733cb0
2 changed files with 7 additions and 21 deletions

View File

@@ -4,7 +4,8 @@
(var &mut :Element content) (var &mut :Element content)
(var &mut :Array<KTxt2Element> ktxt2Elements) (var &mut :Array<KTxt2Element> ktxt2Elements)
// Free-wheeling without externs for now: // Free-wheeling without externs for now.
// This value is provided by other <script> tags in the editor's HTML skeleton.
(var &mut :Dynamic monaco) (var &mut :Dynamic monaco)
(function main [] (function main []
@@ -24,7 +25,8 @@
(otherType (throw "bad message $event for KTxt2Editor")))) (otherType (throw "bad message $event for KTxt2Editor"))))
(whenLet [state (the Dynamic (vscode.getState))] (whenLet [state (the Dynamic (vscode.getState))]
(updateContent state.text))) // Wait to set up the UI until monaco is loaded from the other scripts:
(window.addEventListener "load" ->(updateContent state.text))))
(var &mut :Map<Int,Int> editTimeoutHandles (new Map)) (var &mut :Map<Int,Int> editTimeoutHandles (new Map))
(var EDIT_TIMEOUT_MILLI 2000) (var EDIT_TIMEOUT_MILLI 2000)

View File

@@ -76,8 +76,8 @@
(webview.asWebviewUri (Uri.joinPath monacoDir "editor" "editor.main.nls.js")) (webview.asWebviewUri (Uri.joinPath monacoDir "editor" "editor.main.nls.js"))
monacoEditorUri monacoEditorUri
(webview.asWebviewUri (Uri.joinPath monacoDir "editor" "editor.main.js")) (webview.asWebviewUri (Uri.joinPath monacoDir "editor" "editor.main.js"))
scriptContent ktxt2EditorScriptUri
(File.getContent .fsPath (Uri.joinPath (Uri.parse this.context.extensionUri) "bin" "ktxt2editor.js"))] (webview.asWebviewUri (Uri.joinPath (Uri.parse this.context.extensionUri) "bin" "ktxt2editor.js"))]
~"<!DOCTYPE html> ~"<!DOCTYPE html>
<html> <html>
<head> <head>
@@ -97,29 +97,13 @@
</style> </style>
</head> </head>
<body> <body>
<div id=\"container\" style=\"width:800px;height:200px;border:1px solid grey\"></div> <script src=\"${ktxt2EditorScriptUri}\"></script>
<script> <script>
var require = { paths: { vs: \"${requireConfigDir}\" } }; var require = { paths: { vs: \"${requireConfigDir}\" } };
</script> </script>
<script src=\"${monacoLoaderUri}\"></script> <script src=\"${monacoLoaderUri}\"></script>
<script src=\"${monacoEditorNlsUri}\"></script> <script src=\"${monacoEditorNlsUri}\"></script>
<script src=\"${monacoEditorUri}\"></script> <script src=\"${monacoEditorUri}\"></script>
<script>
var p = document.createElement(\"p\");
p.innerHTML = \"shtuff\";
document.body.appendChild(p);
</script>
<script>
var p = document.createElement(\"p\");
p.innerHTML = \"shtuff\";
document.body.appendChild(p);
if (monaco !== undefined) {
var p = document.createElement(\"p\");
p.innerHTML = \"shtuff\";
document.body.appendChild(p);
}
</script>
</body> </body>
</html>")) </html>"))