fix: added mousetrap class to input fields
Makes shortcuts fire in input fields as well as outside
mellbacon committed
Jul 8, 2023 at 14:56 UTC
1aa74d674e6c5d6af6e19957266a34ceb21d1d9d
3 files changed
+7
-1
src/lib/Editor.svelte
+1
@@ -61,6 +61,7 @@
61
doc: content
62
})
63
})
64
+ editorView.contentDOM.classList.add("mousetrap");
65
});
66
async function updateContent() {
67
await tick();
src/lib/utility/Input.svelte
+1
-1
@@ -12,7 +12,7 @@
12
<label for="textInput">{label}:</label>
13
{/if}
14
15
- <input class:readonly bind:value type="text" name="textInput" id="textInput" readonly={readonly} placeholder={placeholder}>
15
+ <input class="mousetrap" class:readonly bind:value type="text" name="textInput" id="textInput" readonly={readonly} placeholder={placeholder}>
16
</div>
17
18
<style lang="scss">
yarn.lock
+5
@@ -991,6 +991,11 @@ mkdirp@^0.5.1:
991
dependencies:
992
minimist "^1.2.6"
993
994
+mousetrap@^1.6.5:
995
+ version "1.6.5"
996
+ resolved "https://registry.yarnpkg.com/mousetrap/-/mousetrap-1.6.5.tgz#8a766d8c272b08393d5f56074e0b5ec183485bf9"
997
+ integrity sha512-QNo4kEepaIBwiT8CDhP98umTetp+JNfQYBWvC1pc6/OAibuXtRcxZ58Qz8skvEHYvURne/7R8T5VoOI7rDsEUA==
998
+
999
mri@^1.1.0:
1000
version "1.2.0"
1001
resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b"