extensions
extensions copied to clipboard
Added HTML Inputs Extension
HTML Extension
Hi there!
This extension allows you to insert HTML inputs on the canvas.
Here are the blocks.
You can :
- create/delete inputs and select menus.
- set/get their values, dimentions, position.
- Hide/show them...
Here's the extension. Here's the exemple's .sb3 / compiled html.
Enjoy!
Isn't the position functionality already in the iframe extension?
Isn't the position functionality already in the iframe extension?
Yes, it is. But, let me explain a little bit :
In the iframe extension, the Scratch VM will create a div over the canvas to add the iframe. But, when you insert HTML, it will just create a data URL for the code and set it as the iframe's source.
Example:
<h1>It works!</h1> will become <iframe src="data:text/html;,%3Ch1%3EIt%20works!%3C%2Fh1%3E"></iframe>
You can't get an input's value and change the elements' coordinates individually.
With my extension, you can.
In my extension, the Scratch VM will create a div over the canvas to add the element. It will do this for every single element.
Isn't the position functionality already in the iframe extension?
Yes, it is. But, let me explain a little bit : In the iframe extension, the Scratch VM will create a div over the canvas to add the iframe. But, when you insert HTML, it will just create a data URL for the code and set it as the iframe's source. Example:
<h1>It works!</h1>will become<iframe src="data:text/html;,%3Ch1%3EIt%20works!%3C%2Fh1%3E"></iframe>You can't get an input's value and change the elements' coordinates individually. With my extension, you can. In my extension, the Scratch VM will create a div over the canvas to add the element. It will do this for every single element.
seems interesting, should probably add a simplified version of what you said to the description of the extension so people get the difference
Yea, considering what this extension does, maybe it should be called something like "HTML Inputs" or something.
Yea, considering what this extension does, maybe it should be called something like "HTML Inputs" or something.
Done!
Closed for being stale.
I'm going to work on it! (Yep, I know, I'm 11 months late)
okay, I will reopen the PR
!format
The formatting bot didn't find any formatting issues. It currently only checks the extensions folder. To format all files, the pull request's author can manually run the 'Format pull request' workflow from the 'Actions' tab on the fork.
Forgot to add Scratch.translate
Okay! My pull request is validated!
Finally done!