-
Couldn't load subscription status.
- Fork 29
Description
I'm thinking:
<code-input language="javascript" placeholder="JavaScript code, highlighted"><textarea data-code-input-fallback placeholder="JavaScript code, not highlighted">// This is a demo file
console.log("Hello, World!");
</textarea></code-input>If this syntax (including the data-code-input-fallback) conflicts with anyone's usage so far I'll be incredibly surprised; if HTML is written inside a code-input and contains a textarea[data-code-input-fallback], the <s can be replaced with <s.
Very little code: just detect the textarea, transfer its value to the code-input value if it's present, and transfer textareaSyncAttributes to the code-input if the code-input doesn't already have them. CSS must be updated to override invisible text in textarea[data-code-input-fallback] - maybe always make it black on white.
This is useful because code-input can be used with HTML forms and no extra JavaScript.