@webcoder49/code-input 2.7.0 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/code-input.css +9 -3
- package/code-input.min.css +1 -1
- package/docs/_index.md +15 -15
- package/docs/plugins/_index.md +34 -34
- package/esm/plugins/autocomplete.mjs +1 -0
- package/package.json +1 -1
- package/plugins/autocomplete.css +3 -4
- package/plugins/autocomplete.js +1 -0
- package/plugins/autocomplete.min.css +1 -1
- package/plugins/autocomplete.min.js +1 -1
package/code-input.css
CHANGED
|
@@ -37,6 +37,7 @@ code-input {
|
|
|
37
37
|
--padding-right: var(--padding, 16px);
|
|
38
38
|
--padding-top: var(--padding, 16px);
|
|
39
39
|
--padding-bottom: var(--padding, 16px);
|
|
40
|
+
|
|
40
41
|
height: 250px;
|
|
41
42
|
font-size: inherit;
|
|
42
43
|
font-family: monospace;
|
|
@@ -62,20 +63,19 @@ code-input textarea, code-input:not(.code-input_pre-element-styled) pre code, co
|
|
|
62
63
|
padding-top: var(--padding-top, 16px)!important;
|
|
63
64
|
padding-bottom: var(--padding-bottom, 16px)!important;
|
|
64
65
|
border: 0;
|
|
66
|
+
|
|
65
67
|
min-width: calc(100% - var(--padding-left, 16px) - var(--padding-right, 16px));
|
|
66
68
|
min-height: calc(100% - var(--padding-top, 16px) - var(--padding-bottom, 16px));
|
|
67
|
-
overflow: hidden;
|
|
68
69
|
resize: none;
|
|
70
|
+
overflow: hidden;
|
|
69
71
|
grid-row: 1;
|
|
70
72
|
grid-column: 1;
|
|
71
73
|
display: block;
|
|
72
74
|
}
|
|
73
|
-
|
|
74
75
|
code-input:not(.code-input_pre-element-styled) pre code, code-input.code-input_pre-element-styled pre {
|
|
75
76
|
height: max-content;
|
|
76
77
|
width: max-content;
|
|
77
78
|
|
|
78
|
-
|
|
79
79
|
/* Allow colour change to reflect properly;
|
|
80
80
|
transition-behavior: allow-discrete could be used but this is better supported and
|
|
81
81
|
works with the color property. */
|
|
@@ -87,6 +87,9 @@ code-input:not(.code-input_pre-element-styled) pre, code-input.code-input_pre-el
|
|
|
87
87
|
margin: 0!important;
|
|
88
88
|
padding: 0!important;
|
|
89
89
|
border: 0!important;
|
|
90
|
+
|
|
91
|
+
min-width: 100%;
|
|
92
|
+
min-height: 100%;
|
|
90
93
|
}
|
|
91
94
|
|
|
92
95
|
code-input textarea, code-input pre, code-input pre * {
|
|
@@ -97,6 +100,9 @@ code-input textarea, code-input pre, code-input pre * {
|
|
|
97
100
|
tab-size: inherit!important;
|
|
98
101
|
text-align: inherit!important;
|
|
99
102
|
}
|
|
103
|
+
code-input textarea, code-input pre, code-input pre code {
|
|
104
|
+
overflow: visible!important;
|
|
105
|
+
}
|
|
100
106
|
|
|
101
107
|
/* Make changing the text direction propogate */
|
|
102
108
|
code-input textarea[dir=auto] + pre {
|
package/code-input.min.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
code-input{color:var(--code-input_no-override-color,black);caret-color:var(--code-input_default-caret-color,inherit);--padding:16px;--padding-left:var(--padding,16px);--padding-right:var(--padding,16px);--padding-top:var(--padding,16px);--padding-bottom:var(--padding,16px);height:250px;font-size:inherit;text-align:start;tab-size:2;white-space:pre;background-color:#fff;grid-template-rows:100%;grid-template-columns:100%;margin:8px;font-family:monospace;line-height:1.5;display:grid;position:relative;top:0;left:0;overflow:auto;padding:0!important}code-input :not(.code-input_dialog-container *){box-sizing:content-box}code-input textarea,code-input:not(.code-input_pre-element-styled) pre code,code-input.code-input_pre-element-styled pre{min-width:calc(100% - var(--padding-left,16px) - var(--padding-right,16px));min-height:calc(100% - var(--padding-top,16px) - var(--padding-bottom,16px));resize:none;border:0;grid-area:1/1;display:block;overflow:hidden;padding-left:var(--padding-left,16px)!important;padding-right:var(--padding-right,16px)!important;padding-top:var(--padding-top,16px)!important;padding-bottom:var(--padding-bottom,16px)!important;margin:0!important}code-input:not(.code-input_pre-element-styled) pre code,code-input.code-input_pre-element-styled pre{width:max-content;height:max-content;transition:color 1ms}code-input:not(.code-input_pre-element-styled) pre,code-input.code-input_pre-element-styled pre code{border:0!important;margin:0!important;padding:0!important}code-input textarea,code-input pre,code-input pre *{font-size:inherit!important;font-family:inherit!important;line-height:inherit!important;tab-size:inherit!important;text-align:inherit!important}code-input textarea[dir=auto]+pre{unicode-bidi:plaintext}code-input textarea[dir=ltr]+pre{direction:ltr}code-input textarea[dir=rtl]+pre{direction:rtl}code-input textarea,code-input pre{grid-area:1/1}code-input textarea:not([data-code-input-fallback]){z-index:1}code-input pre{z-index:0}code-input textarea:not([data-code-input-fallback]){color:#0000;caret-color:inherit;background:0 0}code-input textarea:not([data-code-input-fallback]):placeholder-shown{color:var(--code-input_highlight-text-color,inherit)}code-input textarea,code-input pre{white-space:inherit;word-spacing:normal;word-break:normal;word-wrap:normal}code-input textarea{resize:none;outline:none!important}code-input:has(textarea:focus):not(.code-input_mouse-focused){outline:2px solid}code-input .code-input_dialog-container{z-index:2;width:100%;height:0;text-align:inherit;color:inherit;grid-area:1/1;margin:0;padding:0;transition:color 1ms;position:sticky;top:0;left:0}[dir=rtl] code-input .code-input_dialog-container,code-input[dir=rtl] .code-input_dialog-container{left:unset;right:0}code-input .code-input_dialog-container .code-input_keyboard-navigation-instructions{color:#fff;padding:2px;padding-left:var(--padding-left,16px);padding-right:var(--padding-right,16px);text-wrap:balance;box-sizing:border-box;background-color:#000;width:100%;height:3em;margin:0;display:block;position:absolute;top:0;left:0;overflow:hidden auto}code-input:not(:has(textarea:not([data-code-input-fallback]):focus)) .code-input_dialog-container .code-input_keyboard-navigation-instructions,code-input.code-input_mouse-focused .code-input_dialog-container .code-input_keyboard-navigation-instructions,code-input .code-input_dialog-container .code-input_keyboard-navigation-instructions:empty{display:none}code-input:not(:has(.code-input_keyboard-navigation-instructions:empty)):has(textarea:not([data-code-input-fallback]):focus):not(.code-input_mouse-focused) textarea,code-input:not(:has(.code-input_keyboard-navigation-instructions:empty)):has(textarea:not([data-code-input-fallback]):focus):not(.code-input_mouse-focused):not(.code-input_pre-element-styled) pre code,code-input:not(:has(.code-input_keyboard-navigation-instructions:empty)):has(textarea:not([data-code-input-fallback]):focus):not(.code-input_mouse-focused).code-input_pre-element-styled pre{min-height:calc(100% - var(--padding-top,16px) - 3em - var(--padding-bottom,16px));padding-top:calc(var(--padding-top,16px) + 3em)!important}code-input:not(.code-input_loaded){box-sizing:border-box;display:block;overflow:hidden;padding-left:var(--padding-left,16px)!important;padding-right:var(--padding-right,16px)!important;padding:var(--padding-top,16px)!important;padding:var(--padding-bottom,16px)!important}code-input:not(.code-input_loaded):after{content:"No highlighting. JavaScript support is disabled or insufficient, or codeInput.registerTemplate has not been called.";bottom:0;left:var(--padding-left,16px);width:calc(100% - var(--padding-left,1.6px) - var(--padding-right,1.6px));outline-top:0;background-color:inherit;color:inherit;border-top:1px solid;height:2em;margin:0;padding:0;display:block;position:absolute;overflow-x:auto}code-input:not(.code-input_loaded) pre,code-input:not(.code-input_loaded) textarea:not([data-code-input-fallback]){opacity:0}code-input:has(textarea[data-code-input-fallback]){box-sizing:content-box;caret-color:revert;padding:0!important}code-input textarea[data-code-input-fallback]{background-color:inherit;color:var(--code-input_highlight-text-color,inherit);min-height:calc(100% - var(--padding-top,16px) - 2em - var(--padding-bottom,16px));overflow:auto}
|
|
1
|
+
code-input{color:var(--code-input_no-override-color,black);caret-color:var(--code-input_default-caret-color,inherit);--padding:16px;--padding-left:var(--padding,16px);--padding-right:var(--padding,16px);--padding-top:var(--padding,16px);--padding-bottom:var(--padding,16px);height:250px;font-size:inherit;text-align:start;tab-size:2;white-space:pre;background-color:#fff;grid-template-rows:100%;grid-template-columns:100%;margin:8px;font-family:monospace;line-height:1.5;display:grid;position:relative;top:0;left:0;overflow:auto;padding:0!important}code-input :not(.code-input_dialog-container *){box-sizing:content-box}code-input textarea,code-input:not(.code-input_pre-element-styled) pre code,code-input.code-input_pre-element-styled pre{min-width:calc(100% - var(--padding-left,16px) - var(--padding-right,16px));min-height:calc(100% - var(--padding-top,16px) - var(--padding-bottom,16px));resize:none;border:0;grid-area:1/1;display:block;overflow:hidden;padding-left:var(--padding-left,16px)!important;padding-right:var(--padding-right,16px)!important;padding-top:var(--padding-top,16px)!important;padding-bottom:var(--padding-bottom,16px)!important;margin:0!important}code-input:not(.code-input_pre-element-styled) pre code,code-input.code-input_pre-element-styled pre{width:max-content;height:max-content;transition:color 1ms}code-input:not(.code-input_pre-element-styled) pre,code-input.code-input_pre-element-styled pre code{min-width:100%;min-height:100%;border:0!important;margin:0!important;padding:0!important}code-input textarea,code-input pre,code-input pre *{font-size:inherit!important;font-family:inherit!important;line-height:inherit!important;tab-size:inherit!important;text-align:inherit!important}code-input textarea,code-input pre,code-input pre code{overflow:visible!important}code-input textarea[dir=auto]+pre{unicode-bidi:plaintext}code-input textarea[dir=ltr]+pre{direction:ltr}code-input textarea[dir=rtl]+pre{direction:rtl}code-input textarea,code-input pre{grid-area:1/1}code-input textarea:not([data-code-input-fallback]){z-index:1}code-input pre{z-index:0}code-input textarea:not([data-code-input-fallback]){color:#0000;caret-color:inherit;background:0 0}code-input textarea:not([data-code-input-fallback]):placeholder-shown{color:var(--code-input_highlight-text-color,inherit)}code-input textarea,code-input pre{white-space:inherit;word-spacing:normal;word-break:normal;word-wrap:normal}code-input textarea{resize:none;outline:none!important}code-input:has(textarea:focus):not(.code-input_mouse-focused){outline:2px solid}code-input .code-input_dialog-container{z-index:2;width:100%;height:0;text-align:inherit;color:inherit;grid-area:1/1;margin:0;padding:0;transition:color 1ms;position:sticky;top:0;left:0}[dir=rtl] code-input .code-input_dialog-container,code-input[dir=rtl] .code-input_dialog-container{left:unset;right:0}code-input .code-input_dialog-container .code-input_keyboard-navigation-instructions{color:#fff;padding:2px;padding-left:var(--padding-left,16px);padding-right:var(--padding-right,16px);text-wrap:balance;box-sizing:border-box;background-color:#000;width:100%;height:3em;margin:0;display:block;position:absolute;top:0;left:0;overflow:hidden auto}code-input:not(:has(textarea:not([data-code-input-fallback]):focus)) .code-input_dialog-container .code-input_keyboard-navigation-instructions,code-input.code-input_mouse-focused .code-input_dialog-container .code-input_keyboard-navigation-instructions,code-input .code-input_dialog-container .code-input_keyboard-navigation-instructions:empty{display:none}code-input:not(:has(.code-input_keyboard-navigation-instructions:empty)):has(textarea:not([data-code-input-fallback]):focus):not(.code-input_mouse-focused) textarea,code-input:not(:has(.code-input_keyboard-navigation-instructions:empty)):has(textarea:not([data-code-input-fallback]):focus):not(.code-input_mouse-focused):not(.code-input_pre-element-styled) pre code,code-input:not(:has(.code-input_keyboard-navigation-instructions:empty)):has(textarea:not([data-code-input-fallback]):focus):not(.code-input_mouse-focused).code-input_pre-element-styled pre{min-height:calc(100% - var(--padding-top,16px) - 3em - var(--padding-bottom,16px));padding-top:calc(var(--padding-top,16px) + 3em)!important}code-input:not(.code-input_loaded){box-sizing:border-box;display:block;overflow:hidden;padding-left:var(--padding-left,16px)!important;padding-right:var(--padding-right,16px)!important;padding:var(--padding-top,16px)!important;padding:var(--padding-bottom,16px)!important}code-input:not(.code-input_loaded):after{content:"No highlighting. JavaScript support is disabled or insufficient, or codeInput.registerTemplate has not been called.";bottom:0;left:var(--padding-left,16px);width:calc(100% - var(--padding-left,1.6px) - var(--padding-right,1.6px));outline-top:0;background-color:inherit;color:inherit;border-top:1px solid;height:2em;margin:0;padding:0;display:block;position:absolute;overflow-x:auto}code-input:not(.code-input_loaded) pre,code-input:not(.code-input_loaded) textarea:not([data-code-input-fallback]){opacity:0}code-input:has(textarea[data-code-input-fallback]){box-sizing:content-box;caret-color:revert;padding:0!important}code-input textarea[data-code-input-fallback]{background-color:inherit;color:var(--code-input_highlight-text-color,inherit);min-height:calc(100% - var(--padding-top,16px) - 2em - var(--padding-bottom,16px));overflow:auto}
|
package/docs/_index.md
CHANGED
|
@@ -13,7 +13,7 @@ more use cases.
|
|
|
13
13
|
|
|
14
14
|
## Download
|
|
15
15
|
|
|
16
|
-
*code-input.js is free, libre, open source software under the MIT (AKA Expat) license.* **Download it [from the Git repository](https://github.com/WebCoder49/code-input/tree/v2.7.
|
|
16
|
+
*code-input.js is free, libre, open source software under the MIT (AKA Expat) license.* **Download it [from the Git repository](https://github.com/WebCoder49/code-input/tree/v2.7.1), [in a ZIP archive](/release/code-input-js-v2.7.1.zip), [in a TAR.GZ archive](/release/code-input-js-v2.7.1.tar.gz), or from `@webcoder49/code-input` on the NPM registry ([Yarn](https://yarnpkg.com/package?name=@webcoder49/code-input), [NPM](https://npmjs.com/package/@webcoder49/code-input), etc.).**
|
|
17
17
|
|
|
18
18
|
[Want to contribute to the code? You're very welcome to! See here.](#contributing)
|
|
19
19
|
|
|
@@ -37,9 +37,9 @@ more use cases.
|
|
|
37
37
|
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.30/components/prism-core.min.js" data-manual></script><!--Remove data-manual if also using Prism normally-->
|
|
38
38
|
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.30/plugins/autoloader/prism-autoloader.min.js"></script>
|
|
39
39
|
<!--2. Import code-input-js-->
|
|
40
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
41
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
42
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
40
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.js"></script>
|
|
41
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.css">
|
|
42
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/indent.min.js"></script>
|
|
43
43
|
<!--3. Join code-input-js to highlighter-->
|
|
44
44
|
<script>codeInput.registerTemplate("syntax-highlighted", new codeInput.templates.Prism(Prism, [new codeInput.plugins.Indent()]));</script>
|
|
45
45
|
</head>
|
|
@@ -76,13 +76,13 @@ console.log("Hello, World!");</textarea></code-input>
|
|
|
76
76
|
|
|
77
77
|
<!--Import code-input-->
|
|
78
78
|
<!--The same goes for downloaded versions.-->
|
|
79
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
80
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
79
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.js"></script>
|
|
80
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.css">
|
|
81
81
|
|
|
82
82
|
<!--Import some code-input plugins-->
|
|
83
83
|
<!--The same goes for downloaded versions.-->
|
|
84
84
|
<!--Plugin files are here: https://code-input-js.org/plugins.-->
|
|
85
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
85
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/indent.min.js"></script>
|
|
86
86
|
|
|
87
87
|
<!--Register code-input template-->
|
|
88
88
|
<!--This can be before the code-input element is created, in which case it will defer the registration of all code-input
|
|
@@ -136,13 +136,13 @@ console.log("Hello, World!");</textarea></code-input>
|
|
|
136
136
|
|
|
137
137
|
<!--Import code-input-->
|
|
138
138
|
<!--The same goes for downloaded versions.-->
|
|
139
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
140
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
139
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.js"></script>
|
|
140
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.css">
|
|
141
141
|
|
|
142
142
|
<!--Import some code-input plugins-->
|
|
143
143
|
<!--The same goes for downloaded versions.-->
|
|
144
144
|
<!--Plugin files are here: https://code-input-js.org/plugins.-->
|
|
145
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
145
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/indent.min.js"></script>
|
|
146
146
|
|
|
147
147
|
<!--Register code-input template-->
|
|
148
148
|
<!--This can be before the code-input element is created, in which case it will defer the registration of all code-input
|
|
@@ -184,13 +184,13 @@ console.log("Hello, World!");</textarea></code-input>
|
|
|
184
184
|
|
|
185
185
|
<!--Import code-input-->
|
|
186
186
|
<!--The same goes for downloaded versions.-->
|
|
187
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
188
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
187
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.js"></script>
|
|
188
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.css">
|
|
189
189
|
|
|
190
190
|
<!--Import some code-input plugins-->
|
|
191
191
|
<!--The same goes for downloaded versions.-->
|
|
192
192
|
<!--Plugin files are here: https://code-input-js.org/plugins.-->
|
|
193
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
193
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/indent.min.js"></script>
|
|
194
194
|
|
|
195
195
|
<!--Register code-input template-->
|
|
196
196
|
<!--This can be before the code-input element is created, in which case it will defer the registration of all code-input
|
|
@@ -312,13 +312,13 @@ something like [CodeMirror](https://codemirror.net/),
|
|
|
312
312
|
[Ace](https://ace.c9.io/) or
|
|
313
313
|
[Monaco](https://microsoft.github.io/monaco-editor/).
|
|
314
314
|
|
|
315
|
-
`code-input.js` is also improving and an even more lightweight, flexible and clean major version 3 is being planned. Please come and participate with your feedback/ideas [on GitHub](https://github.com/WebCoder49/code-input/issues/190) or [via email to code-input-js+v3@webcoder49.dev](mailto:code-input-js+v3@webcoder49.dev)!
|
|
316
|
-
|
|
317
315
|
## Read Enough?
|
|
318
316
|
**If you don't need web framework integration, get started with the commented tutorials by example on this page, for [Prism.js](#playground-preset-prism), [highlight.js](#playground-preset-hljs), or [another highlighter](#playground-preset-custom). If you're using ECMAScript modules or a web framework, start [here](modules-and-frameworks).**
|
|
319
317
|
|
|
320
318
|
## Contribute Bug Reports / Code / Docs {#contributing}
|
|
321
319
|
|
|
320
|
+
**An even more lightweight, flexible and clean major version 3 is being planned. Please come and participate with your feedback/ideas [on GitHub](https://github.com/WebCoder49/code-input/issues/190) or [via email to code-input-js+v3@webcoder49.dev](mailto:code-input-js+v3@webcoder49.dev)!**
|
|
321
|
+
|
|
322
322
|
🎉 code-input.js is collaboratively developed by many people, which is what keeps it going strong. Many have reported bugs and suggestions, and [10 people (see them on GitHub)](https://github.com/WebCoder49/code-input/graphs/contributors) have contributed code or documentation directly. If you have found a bug, would like to help with the code or documentation, or have additional suggestions, for plugins or core functionality, [please look at GitHub](https://github.com/WebCoder49/code-input/tree/main/CONTRIBUTING.md) or [get in touch via email so I can add it for you](mailto:code-input-js@webcoder49.dev). **Found a security vulnerability? [Please use this email address](mailto:security@webcoder49.dev), after reading ([this page with an encryption key](https://oliver.geer.im/#email)).**
|
|
323
323
|
|
|
324
324
|
*I'm looking into mirroring code-input.js onto Codeberg as well as GitHub for more flexibility and freedom - if you have ideas for this please get in touch!*
|
package/docs/plugins/_index.md
CHANGED
|
@@ -23,13 +23,13 @@ Right now, you can only add one plugin of each type (e.g. one SelectTokenCallbac
|
|
|
23
23
|
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js" data-manual></script><!--Remove data-manual if also using Prism normally-->
|
|
24
24
|
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
|
|
25
25
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism.min.css"></link>
|
|
26
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
27
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
26
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.js"></script>
|
|
27
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.css">
|
|
28
28
|
|
|
29
29
|
<!--Import-->
|
|
30
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
30
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/auto-close-brackets.min.js"></script>
|
|
31
31
|
<!--Not necessary, but works very well with the Indent plugin-->
|
|
32
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
32
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/indent.min.js"></script>
|
|
33
33
|
|
|
34
34
|
<script>
|
|
35
35
|
codeInput.registerTemplate("syntax-highlighted", new codeInput.templates.Prism(Prism, [
|
|
@@ -60,12 +60,12 @@ Right now, you can only add one plugin of each type (e.g. one SelectTokenCallbac
|
|
|
60
60
|
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js" data-manual></script><!--Remove data-manual if also using Prism normally-->
|
|
61
61
|
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
|
|
62
62
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism.min.css"></link>
|
|
63
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
64
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
63
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.js"></script>
|
|
64
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.css">
|
|
65
65
|
|
|
66
66
|
<!--Import-->
|
|
67
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
68
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
67
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/autocomplete.min.js"></script>
|
|
68
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/autocomplete.min.css">
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
<script>
|
|
@@ -135,12 +135,12 @@ Right now, you can only add one plugin of each type (e.g. one SelectTokenCallbac
|
|
|
135
135
|
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js" data-manual></script><!--Remove data-manual if also using Prism normally-->
|
|
136
136
|
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
|
|
137
137
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism.min.css"></link>
|
|
138
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
139
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
138
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.js"></script>
|
|
139
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.css">
|
|
140
140
|
|
|
141
141
|
<!--Import-->
|
|
142
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
143
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
142
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/find-and-replace.min.js"></script>
|
|
143
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/find-and-replace.min.css"/>
|
|
144
144
|
|
|
145
145
|
<script>
|
|
146
146
|
let findAndReplacePlugin = new codeInput.plugins.FindAndReplace(
|
|
@@ -184,14 +184,14 @@ Hickory dickory dock.</code-input>
|
|
|
184
184
|
<!--Not necessary, but works very well with the Prism line-numbers plugin-->
|
|
185
185
|
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
|
|
186
186
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/line-numbers/prism-line-numbers.min.css">
|
|
187
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
188
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
187
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.js"></script>
|
|
188
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.css">
|
|
189
189
|
|
|
190
190
|
<!--Import-->
|
|
191
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
192
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
191
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/go-to-line.min.js"></script>
|
|
192
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/go-to-line.min.css"/>
|
|
193
193
|
<!--Not necessary, but works very well with the Prism line-numbers plugin-->
|
|
194
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
194
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/prism-line-numbers.min.css"/>
|
|
195
195
|
|
|
196
196
|
<script>
|
|
197
197
|
let goToLinePlugin = new codeInput.plugins.GoToLine(
|
|
@@ -228,11 +228,11 @@ Hickory dickory dock.</code-input>
|
|
|
228
228
|
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js" data-manual></script><!--Remove data-manual if also using Prism normally-->
|
|
229
229
|
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
|
|
230
230
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism.min.css"></link>
|
|
231
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
232
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
231
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.js"></script>
|
|
232
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.css">
|
|
233
233
|
|
|
234
234
|
<!--Import-->
|
|
235
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
235
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/indent.min.js"></script>
|
|
236
236
|
|
|
237
237
|
<script>
|
|
238
238
|
// Programatically opening the dialogs, to integrate with your user interface
|
|
@@ -501,11 +501,11 @@ Hickory dickory dock.</code-input>
|
|
|
501
501
|
</script>
|
|
502
502
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/match-braces/prism-match-braces.min.css"/>
|
|
503
503
|
|
|
504
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
505
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
504
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.js"></script>
|
|
505
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.css">
|
|
506
506
|
|
|
507
507
|
<!--Import-->
|
|
508
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
508
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/select-token-callbacks.min.js"></script>
|
|
509
509
|
</head>
|
|
510
510
|
<body>
|
|
511
511
|
<!--For convenience, this demo uses files from JSDelivr CDN; for more privacy and security download and host them yourself.-->
|
|
@@ -568,12 +568,12 @@ See https://github.com/WebCoder49/code-input/issues?q=is%3Aissue%20state%3Aopen%
|
|
|
568
568
|
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js" data-manual></script><!--Remove data-manual if also using Prism normally-->
|
|
569
569
|
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
|
|
570
570
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism.min.css"></link>
|
|
571
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
572
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
571
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.js"></script>
|
|
572
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.css">
|
|
573
573
|
|
|
574
574
|
<!--Import-->
|
|
575
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
576
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
575
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/special-chars.min.js"></script>
|
|
576
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/special-chars.min.css"></script>
|
|
577
577
|
|
|
578
578
|
<script>
|
|
579
579
|
codeInput.registerTemplate("syntax-highlighted", new codeInput.templates.Prism(Prism, [
|
|
@@ -613,12 +613,12 @@ See https://github.com/WebCoder49/code-input/issues?q=is%3Aissue%20state%3Aopen%
|
|
|
613
613
|
<!--highlight.js+code-input-->
|
|
614
614
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/default.min.css">
|
|
615
615
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js"></script>
|
|
616
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
617
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
616
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.js"></script>
|
|
617
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.css">
|
|
618
618
|
|
|
619
619
|
|
|
620
620
|
<!--Import-->
|
|
621
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
621
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/autodetect.min.js"></script>
|
|
622
622
|
|
|
623
623
|
<script>
|
|
624
624
|
codeInput.registerTemplate("syntax-highlighted", new codeInput.templates.Hljs(hljs, [
|
|
@@ -626,7 +626,7 @@ See https://github.com/WebCoder49/code-input/issues?q=is%3Aissue%20state%3Aopen%
|
|
|
626
626
|
new codeInput.plugins.Autodetect()
|
|
627
627
|
]));
|
|
628
628
|
</script>
|
|
629
|
-
<p>Start typing code of any language. <
|
|
629
|
+
<p>Start typing code of any language. <strong>Detected language: <span id="language"></span></strong>. Inaccurate language detection should be reported to <a target="_blank" href="https://highlightjs.org">highlight.js</a>, not code-input-js.</p>
|
|
630
630
|
<code-input oninput="document.getElementById('language').textContent = this.getAttribute('language');"></code-input>
|
|
631
631
|
<p></p>
|
|
632
632
|
</body>
|
|
@@ -646,14 +646,14 @@ See https://github.com/WebCoder49/code-input/issues?q=is%3Aissue%20state%3Aopen%
|
|
|
646
646
|
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js" data-manual></script><!--Remove data-manual if also using Prism normally-->
|
|
647
647
|
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
|
|
648
648
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism.min.css"></link>
|
|
649
|
-
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
650
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
649
|
+
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.js"></script>
|
|
650
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/code-input.min.css">
|
|
651
651
|
|
|
652
652
|
|
|
653
653
|
<!--Import-->
|
|
654
654
|
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
|
|
655
655
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/line-numbers/prism-line-numbers.min.css">
|
|
656
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.
|
|
656
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.7/plugins/prism-line-numbers.min.css"/>
|
|
657
657
|
|
|
658
658
|
<script>
|
|
659
659
|
codeInput.registerTemplate("syntax-highlighted", new codeInput.templates.Prism(Prism, [
|
|
@@ -36,6 +36,7 @@ plugins.Autocomplete = class extends Plugin {
|
|
|
36
36
|
codeInput.appendChild(popupElem);
|
|
37
37
|
|
|
38
38
|
let testPosPre = document.createElement("pre");
|
|
39
|
+
testPosPre.classList.add("code-input_autocomplete_invisiblepre"); // Hide visually
|
|
39
40
|
testPosPre.setAttribute("aria-hidden", true); // Hide for screen readers
|
|
40
41
|
if(codeInput.templateObject.preElementStyled) {
|
|
41
42
|
testPosPre.classList.add("code-input_autocomplete_testpos");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webcoder49/code-input",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "An editable <textarea> that supports *any* syntax highlighting algorithm, for code or something else. Also, added plugins.",
|
|
5
5
|
"browser": "code-input.js",
|
|
6
6
|
"exports": {
|
package/plugins/autocomplete.css
CHANGED
package/plugins/autocomplete.js
CHANGED
|
@@ -32,6 +32,7 @@ codeInput.plugins.Autocomplete = class extends codeInput.Plugin {
|
|
|
32
32
|
codeInput.appendChild(popupElem);
|
|
33
33
|
|
|
34
34
|
let testPosPre = document.createElement("pre");
|
|
35
|
+
testPosPre.classList.add("code-input_autocomplete_invisiblepre"); // Hide visually
|
|
35
36
|
testPosPre.setAttribute("aria-hidden", true); // Hide for screen readers
|
|
36
37
|
if(codeInput.templateObject.preElementStyled) {
|
|
37
38
|
testPosPre.classList.add("code-input_autocomplete_testpos");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
code-input .code-input_autocomplete_popup{z-index:100;margin-top:1em;display:block;position:absolute}code-input .code-
|
|
1
|
+
code-input .code-input_autocomplete_popup{z-index:100;margin-top:1em;display:block;position:absolute}code-input pre.code-input_autocomplete_invisiblepre{opacity:0!important}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";codeInput.plugins.Autocomplete=class extends codeInput.Plugin{constructor(a){super([]),this.updatePopupCallback=a}updatePopup(a,b){let c=a.textareaElement,d=this.getCaretCoordinates(a,c,c.selectionEnd,b),e=a.querySelector(".code-input_autocomplete_popup");e.style.top=d.top+"px",e.style.left=d.left+"px",b||this.updatePopupCallback(e,c,c.selectionEnd,c.selectionStart)}afterElementsAdded(a){let b=document.createElement("div");b.classList.add("code-input_autocomplete_popup"),a.appendChild(b);let c=document.createElement("pre");if(c.setAttribute("aria-hidden",!0),a.templateObject.preElementStyled)c.classList.add("code-input_autocomplete_testpos"),a.appendChild(c);else{let b=document.createElement("code");b.classList.add("code-input_autocomplete_testpos"),c.appendChild(b),a.appendChild(c)}let d=a.textareaElement;d.addEventListener("input",()=>{this.updatePopup(a,!1)}),d.addEventListener("selectionchange",()=>{this.updatePopup(a,!1)})}getCaretCoordinates(a,b,c,d){let e;if(d){let d=a.querySelector(".code-input_autocomplete_testpos").querySelectorAll("span");if(2>d.length)return this.getCaretCoordinates(a,b,c,!1);e=d[1]}else{let d=a.querySelector(".code-input_autocomplete_testpos"),f=document.createElement("span");for(f.textContent=b.value.substring(0,c),e=document.createElement("span"),e.textContent=".";d.firstChild;)d.removeChild(d.firstChild);d.appendChild(f),d.appendChild(e)}return{top:e.offsetTop-b.scrollTop,left:e.offsetLeft-b.scrollLeft}}updatePopupCallback=function(){}};
|
|
1
|
+
"use strict";codeInput.plugins.Autocomplete=class extends codeInput.Plugin{constructor(a){super([]),this.updatePopupCallback=a}updatePopup(a,b){let c=a.textareaElement,d=this.getCaretCoordinates(a,c,c.selectionEnd,b),e=a.querySelector(".code-input_autocomplete_popup");e.style.top=d.top+"px",e.style.left=d.left+"px",b||this.updatePopupCallback(e,c,c.selectionEnd,c.selectionStart)}afterElementsAdded(a){let b=document.createElement("div");b.classList.add("code-input_autocomplete_popup"),a.appendChild(b);let c=document.createElement("pre");if(c.classList.add("code-input_autocomplete_invisiblepre"),c.setAttribute("aria-hidden",!0),a.templateObject.preElementStyled)c.classList.add("code-input_autocomplete_testpos"),a.appendChild(c);else{let b=document.createElement("code");b.classList.add("code-input_autocomplete_testpos"),c.appendChild(b),a.appendChild(c)}let d=a.textareaElement;d.addEventListener("input",()=>{this.updatePopup(a,!1)}),d.addEventListener("selectionchange",()=>{this.updatePopup(a,!1)})}getCaretCoordinates(a,b,c,d){let e;if(d){let d=a.querySelector(".code-input_autocomplete_testpos").querySelectorAll("span");if(2>d.length)return this.getCaretCoordinates(a,b,c,!1);e=d[1]}else{let d=a.querySelector(".code-input_autocomplete_testpos"),f=document.createElement("span");for(f.textContent=b.value.substring(0,c),e=document.createElement("span"),e.textContent=".";d.firstChild;)d.removeChild(d.firstChild);d.appendChild(f),d.appendChild(e)}return{top:e.offsetTop-b.scrollTop,left:e.offsetLeft-b.scrollLeft}}updatePopupCallback=function(){}};
|