autopair 0.1.2 → 1.0.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/README.md +4 -0
- package/index.html +3 -2
- package/package.json +21 -3
- package/src/autopair.js +1 -11
package/README.md
CHANGED
package/index.html
CHANGED
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
<h1>Autopair Test</h1>
|
|
9
9
|
<textarea id="editor" rows="10" cols="50" autofocus></textarea>
|
|
10
10
|
|
|
11
|
-
<script
|
|
12
|
-
|
|
11
|
+
<script type="module">
|
|
12
|
+
import autopair from './src/autopair.js';
|
|
13
|
+
|
|
13
14
|
// Use the autopair module
|
|
14
15
|
const textarea = document.getElementById('editor');
|
|
15
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autopair",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Automatically closes parentheses and similar characters.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Dennis Hackethal <engineering@dennishackethal.com>",
|
|
@@ -8,9 +8,27 @@
|
|
|
8
8
|
"homepage": "https://github.com/dchacke/autopair.js",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/dchacke/autopair.js.git"
|
|
11
|
+
"url": "git+https://github.com/dchacke/autopair.js.git"
|
|
12
12
|
},
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/dchacke/autopair.js/issues"
|
|
15
|
-
}
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"autopair",
|
|
18
|
+
"auto-pair",
|
|
19
|
+
"pairing",
|
|
20
|
+
"autocomplete",
|
|
21
|
+
"text",
|
|
22
|
+
"textarea",
|
|
23
|
+
"editor",
|
|
24
|
+
"brackets",
|
|
25
|
+
"parentheses",
|
|
26
|
+
"quotes",
|
|
27
|
+
"typethrough",
|
|
28
|
+
"markdown",
|
|
29
|
+
"syntax",
|
|
30
|
+
"input",
|
|
31
|
+
"javascript",
|
|
32
|
+
"web"
|
|
33
|
+
]
|
|
16
34
|
}
|
package/src/autopair.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function autopair(textarea, pairs = {
|
|
1
|
+
export default function autopair(textarea, pairs = {
|
|
2
2
|
'(': ')',
|
|
3
3
|
'[': ']',
|
|
4
4
|
'{': '}',
|
|
@@ -67,13 +67,3 @@ function autopair(textarea, pairs = {
|
|
|
67
67
|
textarea.selectionStart = textarea.selectionEnd = start + 1;
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
// Export for Node
|
|
72
|
-
if (typeof module !== 'undefined' && module.exports) {
|
|
73
|
-
module.exports = autopair;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Attach to window for browser
|
|
77
|
-
if (typeof window !== 'undefined') {
|
|
78
|
-
window.autopair = autopair;
|
|
79
|
-
}
|