-
Notifications
You must be signed in to change notification settings - Fork 939
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
feat: Add CodeMirror editor to control panel #1656
feat: Add CodeMirror editor to control panel #1656
Conversation
} | ||
</style> | ||
<script type="text/javascript"> | ||
let keywords = ["for", "range", "if", "else", "template", "end", "true", "false", "nil", "gt", "lt", "len", "index"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why specifically these keywords? Why lt
and not le
and the same for gt
not le
. What are we classing as "keywords" because there's several other operators or control modifiers we could use here too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi.
I got those keywords from the HLJS implementation that already exists. You can check the contents in the Permalink that I provided in the description of the PR. As for why they made the decision to not include the keywords you mentioned, I don't know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing implementation also includes all of templates.StandardFuncMap
Nevermind, I missed that they're added below
The other missing block actions and functions from text/template were probably just an oversight and should be added here.
Yes, @Ranger-4297 . That distinction can be added easily, and I did test it. Judging by the image I included and comparing it to what existed before, I'd say it's a lot more helpful than just using "mode": "go", for example (it's what you'd get for using I'm aware improvements can be made, but this isn't broken. As for the operators, I agree, and I'll add a different color for them tomorrow, once I wake up. |
Ok, cool. Just glad we're on the same page |
…ered vanilla go codeMirror tokenizer (rangers suggestion)
Please, @Ranger-4297 , try it now: |
Co-authored-by: Galen CC <[email protected]>
…itcmd.html and go.js
Prepare for the upcoming CodeMirror addition to the CC edit page in light of botlabs-gg/yagpdb#1656. The CSS is blatantly copied from https://codemirror.net/5/theme/ with a few removals to make it work with the implementation. If you're reading this and use this theme do let me know of any visual bugs. Signed-off-by: Luca Zeuch <[email protected]>
Code Mirror Editor for Control Panel
This PR adds CodeMirror to YAGPDB bot, by implementing the unused vendor package
CodeMirror
. There are style inconsistencies, but an admin told me it was alright, as users wouldn't care. I included a CSS file of a theme that I like, downloaded from their website directly. It should function as reference if someone ever wants to write the CSS to match the style of the highlight.js that is already included in this page Permalink.Why did I alter
spongebob.js
I had to alter this file because I used a go template inside my code to access the keywords, and since a new textarea is created every time a button is clicked, I removed the jquery from
spongebob.js
and rewrote it in modern syntax, implementing the code mirror instance every click.About themes
I think it'll take a while for the team to decide which theme should be used, or maybe not, idk. In case you guys didn't like the theme I chose, just pick one from here and i'll update the code.
My Discord is currently
shar_alter
.