This repository was archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 124
Make site into an editable playground with monaco editor #139
Open
alejandrogarciasalas
wants to merge
16
commits into
microsoft:master
Choose a base branch
from
alejandrogarciasalas:make-site-into-an-editable-playground
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Make site into an editable playground with monaco editor #139
alejandrogarciasalas
wants to merge
16
commits into
microsoft:master
from
alejandrogarciasalas:make-site-into-an-editable-playground
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add monaco editor to side panel
Contributor
|
You evil genius. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes the site into an editable playground.
Side Editor
Multiple Themes
The editor I am using is monaco the same editor used in VSCode wink wink.
Unfortunately since we are not using webpack or any bundler I had to copy paste the minified monaco files into the repo which makes this PR a little hard to read. I can probably break this PR into smaller chunks if necessary. Other than that the new JS, CSS should not be that hard to follow. Most of the logic is contained in the JS. I also, had to refactor
divcontainers a little bit so that the side panel for editor was easier to implement.Also, one thing to note is that only edits inside the div containing the
playground-editable-areaid will have any effect. If I allowed any code to be editable this would be too meta and would re-render everything on any edit. Theplayground-editable-areaid can be moved to a differentdivthough. Ideally any code outside of this area would be displayed but not be editable (perhaps with a muted style) but monaco makes it a little tricky to do this since you can only apply styling to specific line ranges which could break if the html code changes. I guess in this case done is better than perfect 🤷♂️ . I might revisit this later..I did this mostly just for fun, let me know if there's any questions or feedback on the code and I'll try to address it.