-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add MonacoEditor.jl #75
base: main
Are you sure you want to change the base?
Add MonacoEditor.jl #75
Conversation
What we need is adding a frontmatter something like:
|
Hey @terasakisatoshi, thanks for your notebook! Your notebook is a bit unexpected, I thought you would use PlutoMonacoEditor.jl to use rust/python/js inside Pluto! This notebook explains how to PlutoMonacoEditor.jl was made, but don't you want to tell people to just use PlutoMonacoEditor.jl instead? The current notebook about how PlutoMonacoEditor is very cool for me personally 🌟, but I'm worried that it might be too intimidating for a wider audience:
I would really like more JS + Pluto notebooks, like https://featured.plutojl.org/web/threejs.html, but I think we need to be careful to not scare people away. Perhaps we can pick a subset of topics from this notebook, and show them on their own? For example: PlutoMonacoEditor.jl + Or: PlutoMonacoEditor.jl + Or a notebook like https://featured.plutojl.org/web/threejs.html . In that case, the focus should be on explaining step-by-step what JS techniques are used, and why. But I think other packages would be better fit, since monaco needs One other difficulty is that we use PlutoSliderServer.jl on a server to host these notebooks interactively online. We can't combine |
I played around a bit and I was able to get it to work without
# wrong order:
pE.dispatchEvent(new CustomEvent("update"));
pE.value = editorValue; And I moved the The new code is: @bind tsmonacofield @htl """
<div>
<style>
#mymonacoeditor {
width: 100%;
height: 200px;
border: 1px solid #ddd;
}
</style>
<div id="mymonacoeditor"></div>
<script>
const monaco = await import('https://cdn.jsdelivr.net/npm/[email protected]/+esm');
const monEditor = monaco.editor.create(document.getElementById('mymonacoeditor'), {
value: [
'function greet(name: string): string{',
'\treturn \`Hello, \\\${name}!\`;',
'}',
'console.log(greet("Update me"));'
].join('\\n'),
language: 'typescript'
});
const pE = currentScript.parentElement;
function update_bond() {
pE.value = monEditor.getValue();
pE.dispatchEvent(new CustomEvent("update"));
}
const myEditor = pE.querySelector("#mymonacoeditor");
myEditor.addEventListener("input", e=>{
update_bond();
})
update_bond();
</script>
</div>
""" |
If possile, it would be nice to use PlutoMonacoEditor.jl. However, since PlutoMonacoEditor.jl is not currently unregistered, I worried about if I could use the PlutoMonacoEditor.jl package. Also I have no idea how to test/maintain PlutoMonacoEditor.jl. Need to investigate how widgets in PlutoUI.jl are tested. |
Thank you. I'll try it. |
I can show audiences how to use Python and JavaSript inside Pluto because we have PythonCall.jl and JavaScript originally. I ould not find a compiler for Rust e.g., something like rustc_jll. I also worried about that PythonCall.jl requires to install Conda(micromamba technically) which takes a little time to setup Pluto notebook. Is that O.K.? If this is no problem for this repository I will rewrite and use Python as an example of how to use PlutoMonacoEditor.jl |
I've updated the code based on your suggested one. The Base64.jl package allows us to input source code in a more intuitive way. |
Sorry for the late reply. Through some trial and error I have come to realize that PlutoMonacoEditor.jl is needed by many people and I am going to register it in the General registry. I will then create a new notebook using PlutoMonacoEditor.jl. |
Hello, @fonsp . As we discussed in the aforementioned pull request on GitHub (AtelierArith/PlutoMonacoEditor.jl#1), I am making a new pull request for this repository. This new pull request adds the file
src/web/MonacoEditor.jl
, which demonstrates how to implement a rich text editor using Monaco Editor inside Pluto.