Skip to content

Commit 453f4c1

Browse files
authored
Middle click in url bar should paste and go #227 (#253)
* Past&Go feature partially solved. It pastes, but the `go` par still needs to be worked on. At the moment it only pastes whenever the middle mouse is clicked. I think the part to load the website must be in there, since the browser does just that when the `Enter key` is pressed. * Code cleanups and style matching I ran `npm run lint` for this. It checks the code style. * Middle mouse button paste&go resolved * Cleanups I reverted yarn and package.json to the default version from main --------- Co-authored-by: Arsene Ulrich Mugneghe Kankeu <[email protected]>
1 parent 47464d7 commit 453f4c1

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,6 @@ package-lock.json
133133

134134
# This gets generated post install
135135
app/version.js
136+
137+
# This gets generated when I open in a Container
138+
.devcontainer

app/ui/omni-box.js

+11
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,17 @@ class OmniBox extends HTMLElement {
107107
this.forwardButton.addEventListener('click', () => {
108108
this.dispatchEvent(new CustomEvent('forward'))
109109
})
110+
111+
// middle mouse click paste&go
112+
this.input.addEventListener('paste', (e) => {
113+
e.preventDefault()
114+
const url = e.clipboardData.getData('text')
115+
116+
if (isURL(url)) {
117+
e.preventDefault()
118+
this.dispatchEvent(new CustomEvent('navigate', { detail: { url } }))
119+
}
120+
})
110121
}
111122

112123
clearOptions () {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,4 +215,4 @@
215215
"whatwg-mimetype": "https://github.com/jsdom/whatwg-mimetype#v2.3.0",
216216
"wrtc": "^0.4.7"
217217
}
218-
}
218+
}

yarn.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -7525,4 +7525,4 @@ z32@^1.0.1:
75257525
resolved "https://registry.yarnpkg.com/z32/-/z32-1.0.1.tgz#074b37ddd61d58b746bfb50b31cf0895700d3685"
75267526
integrity sha512-Uytfqf6VEVchHKZDw0NRdCViOARHP84uzvOw0CXCMLOwhgHZUL9XibpEPLLQN10mCVLxOlGCQWbkV7km7yNYcw==
75277527
dependencies:
7528-
b4a "^1.5.3"
7528+
b4a "^1.5.3"

0 commit comments

Comments
 (0)