You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# code-input
2
2
3
+
> **:warning: This document is a work in progress for the next release. [Read latest released instructions.](https://github.com/WebCoder49/code-input/tree/v2.5.1/README.md)**
4
+
3
5
[](https://github.com/WebCoder49/code-input)[](https://www.npmjs.com/package/@webcoder49/code-input)
4
6
5
7
[](LICENSE)[](https://github.com/WebCoder49/code-input/releases)[](https://codepen.io/WebCoder49/full/jOypJOx)
@@ -117,18 +119,18 @@ The next step is to set up a `template` to link `code-input` to your syntax-high
117
119
</script>
118
120
```
119
121
120
-
> ⚠️ Unfortunately placing multiple plugins of the same type in a template can currently cause errors and undefined behaviour, even if such a configuration makes logical sense. [This is issue #118](https://github.com/WebCoder49/code-input/issues/118) and will be fixed as soon as possible - if you'd like to help and have the time you're welcome, but it's also at the top of the maintainer's To-Do list.
122
+
> ⚠️ Unfortunately placing multiple plugins of the same type in a template can currently cause errors and undefined behaviour, even if such a configuration makes logical sense. [This is issue #118](https://github.com/WebCoder49/code-input/issues/118)~~and will be fixed as soon as possible - if you'd like to help and have the time you're welcome, but it's also at the top of the maintainer's To-Do list.~~ and should be fixed in major version 3 - right now, I don't believe there's much demand or use, and workarounds are not too complex.
121
123
122
124
To see a full list of plugins and their functions, please see [plugins/README.md](./plugins/README.md).
123
125
124
126
### 4. Using the component
125
-
Now that you have registered a template, you can use the custom `<code-input>` element in HTML. If you have more than one template registered, you need to add the template name as the `template` attribute. With the element, using the `language` attribute will add a `language-{value}` class to the `pre code` block. You can now use HTML attributes and events, as well as CSS styles, to make your element as simple or interactive as you like, as if it were a `textarea` element!
127
+
Now that you have registered a template, you can use the custom `<code-input>` element in HTML. I recommend it surrounds a fallback `<textarea code-input-fallback>` element which will be used instead when JavaScript support is absent, and will pass its attributes to the `<code-input>` element otherwise, as shown below. If you have more than one template registered, you need to add the template name as the `template` attribute. With the element, using the `language` attribute will add a `language-{value}` class to the `pre code` block. You can now use HTML attributes and events, as well as CSS styles, to make your element as simple or interactive as you like, as if it were a `textarea` element!
> ⚠️ At the moment, you need to set the `--padding` property rather than `padding` for a `code-input` element's CSS. All other properties should work as normal.
Copy file name to clipboardExpand all lines: code-input.css
+49-22Lines changed: 49 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,9 @@ code-input {
12
12
top:0;
13
13
left:0;
14
14
15
+
color: black;
16
+
background-color: white;
17
+
15
18
/* Normal inline styles */
16
19
margin:8px;
17
20
--padding:16px;
@@ -38,8 +41,8 @@ code-input textarea, code-input:not(.code-input_pre-element-styled) pre code, co
38
41
margin:0px!important;
39
42
padding:var(--padding,16px)!important;
40
43
border:0;
41
-
min-width:calc(100%-var(--padding) *2);
42
-
min-height:calc(100%-var(--padding) *2);
44
+
min-width:calc(100%-var(--padding,16px) *2);
45
+
min-height:calc(100%-var(--padding,16px) *2);
43
46
box-sizing: content-box; /* Make height, width work consistently no matter the box-sizing of ancestors; dialogs can be styled as wanted so are excluded. */
content:"Use codeInput.registerTemplate to set up.";
141
+
content:"No-JavaScript fallback. For highlighting and plugins: as a user use a newer browser/enable JavaScript support; as a developer use codeInput.registerTemplate.";
0 commit comments