(fix) create key flow

This commit is contained in:
Ishaan Jaff 2024-03-29 10:08:35 -07:00
parent fae935cdb2
commit d3e72e1c3b
144 changed files with 53398 additions and 50 deletions

1
node_modules/toggle-selection/.npmignore generated vendored Normal file
View file

@ -0,0 +1 @@
node_modules

18
node_modules/toggle-selection/README.md generated vendored Normal file
View file

@ -0,0 +1,18 @@
# Toggle Selection
Simple module exposing function that deselects current browser selection and returns function that restores selection.
```
var deselect = require('toggle-selection');
var reselect = deselect(); // remove all selection
// …
// do something with current selection, text, etc;
// …
reselect(); // restore selection
```
All credits go to [@shvaikalesh](https://github.com/shvaikalesh).
# [Example](https://github.com/sudodoki/toggle-selection/blob/master/example)
![example recording](http://g.recordit.co/YPu6mHvcKe.gif)

16
node_modules/toggle-selection/example/demo.js generated vendored Normal file
View file

@ -0,0 +1,16 @@
var selection = document.getSelection();
document.addEventListener('DOMContentLoaded', function(event) {
setTimeout(function() {
if (!selection.rangeCount) { // for demo purposes only
return;
}
reselect = module.exports();
setTimeout(function() {
reselect();
console.log('reselected');
}, 1000);
console.log('deselected');
}, 2000);
});

26
node_modules/toggle-selection/example/index.html generated vendored Normal file
View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Page</title>
<script src="../index.js"></script>
<script src="demo.js"></script>
</head>
<body>
<textarea cols="30" rows="10">Some random stuff.</textarea>
<textarea cols="30" rows="10">Some random stuff.</textarea>
<textarea cols="30" rows="10">Some random stuff.</textarea>
<div contentEditable>Some random stuff.</div>
<input value="Some random stuff.">
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aenean commodo ligula eget dolor. Aenean massa.
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.
Nulla consequat massa quis enim.
Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.
In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.
Nullam dictum felis eu pede mollis pretium. Integer tincidunt.
</p>
</body>
</html>

39
node_modules/toggle-selection/index.js generated vendored Normal file
View file

@ -0,0 +1,39 @@
module.exports = function () {
var selection = document.getSelection();
if (!selection.rangeCount) {
return function () {};
}
var active = document.activeElement;
var ranges = [];
for (var i = 0; i < selection.rangeCount; i++) {
ranges.push(selection.getRangeAt(i));
}
switch (active.tagName.toUpperCase()) { // .toUpperCase handles XHTML
case 'INPUT':
case 'TEXTAREA':
active.blur();
break;
default:
active = null;
break;
}
selection.removeAllRanges();
return function () {
selection.type === 'Caret' &&
selection.removeAllRanges();
if (!selection.rangeCount) {
ranges.forEach(function(range) {
selection.addRange(range);
});
}
active &&
active.focus();
};
};

27
node_modules/toggle-selection/package.json generated vendored Normal file
View file

@ -0,0 +1,27 @@
{
"name": "toggle-selection",
"version": "1.0.6",
"description": "Toggle current selected content in browser",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/sudodoki/toggle-selection"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"selection",
"toggle",
"browser",
"deselect"
],
"author": "sudodoki <smd.deluzion@gmail.com> (sudodoki.name)",
"license": "MIT",
"contributors": [
{
"name": "Aleksej Shvajka",
"url": "https://github.com/shvaikalesh"
}
]
}