Added javascript render support by adding <script> tags to output if …#12
Open
itsKaspar wants to merge 1 commit intonetizenorg:masterfrom
Open
Added javascript render support by adding <script> tags to output if …#12itsKaspar wants to merge 1 commit intonetizenorg:masterfrom
itsKaspar wants to merge 1 commit intonetizenorg:masterfrom
Conversation
…the language "javascript" is selected. and added the opportunity to add a library through opts.library. sorry for sorta lazy code, trying a quick fix to get this working on my website before tommorrow, and thought I'd try and commit something for the first time to understand the process, refusal of commit is expected nppp
Contributor
|
@itsKaspar ...sry for taking so long to reply to this!!! i was going to suggest to that u update the const ne = new Netitor({
ele: '#editor',
render: '#output',
language: 'javascript',
code: `
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
ellipse(50,50,80,80);
}
`
})
ne.update(`
<script src="https://cdn.jsdelivr.net/npm/p5@1.5.0/lib/p5.js"><\/script>
<script>{{code}}<\/script>
`)think this would solve ur usecase right? as well as all sorts of other alternatives |
Author
|
Ah yes ! That is pretty awesome, so the ne.update function adds some code
beforehand ? I’m going to be finally back at it real soon and reintegrate
it on some web dev. Thanks for letting me know !
On Sat 29 Oct 2022 at 01:16, Nick Briz ***@***.***> wrote:
@itsKaspar <https://github.com/itsKaspar> ...sry for taking so long to
reply to this!!!
i was going to suggest to that u update the library property from a
String to an Array (so that folks could in theory pass multiple
libraries)... but as i've been working on adding mult-file projects to
netnet realized that there are actually other situations where we'd want
the render to render alternative code besides adding a the <script> tags
like u did (this works great for javascript, but what about working on a
CSS file?) ...so i solved this problem a slightly different way... u can
now do something like this:
const ne = new Netitor({
ele: '#editor',
render: '#output',
language: 'javascript',
code: ` function setup() { createCanvas(400, 400); } function draw() { background(220); ellipse(50,50,80,80); } `})
ne.update(` <script ***@***.***/lib/p5.js"><\/script> <script>{{code}}<\/script>`)
think this would solve ur usecase right? as well as all sorts of other
alternatives
—
Reply to this email directly, view it on GitHub
<#12 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACCEZJHEIM4XC7VNXW3E5HLWFRNFXANCNFSM5ZQYIHJA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
- Kaspar Ravel
w. kaspar.wtf
ig. instagram.com/kaspar.wtf/ <http://www.instagram.com/kaspar.wtf/>
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
added support for javascript rendering when the language "javascript" is selected. and added the opportunity to add a library through opts.library. sorry for sorta lazy code, trying a quick fix to get this working on my website before tommorrow, and thought I'd try and commit something for the first time to understand the process, refusal of commit is expected nppp