🐛 Fix Chinese input method Enter
This commit is contained in:
2
src-tauri/Cargo.lock
generated
2
src-tauri/Cargo.lock
generated
@@ -3494,7 +3494,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-plugin-window-state"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=dev#dce0f02bc571128308c30278cde3233f341e6a50"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v1#0863f800b81925884a6a37c042f3d92d433d4a37"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"bitflags 2.3.3",
|
||||
|
||||
@@ -18,7 +18,7 @@ tauri-build = { version = "1.4.0", features = [] }
|
||||
serde_json = "1.0.96"
|
||||
serde = { version = "1.0.163", features = ["derive"] }
|
||||
tauri = { version = "1.4.1", features = ["api-all", "system-tray"] }
|
||||
tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||
tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
|
||||
|
||||
[dev-dependencies]
|
||||
cargo-bloat = "0.11.1"
|
||||
|
||||
BIN
src-tauri/icons/wechat.icns
Normal file
BIN
src-tauri/icons/wechat.icns
Normal file
Binary file not shown.
45
src-tauri/src/inject/component.js
vendored
45
src-tauri/src/inject/component.js
vendored
@@ -96,18 +96,18 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const urlSubmit = document.getElementById('pakeUrlSubmit');
|
||||
const urlClose = document.getElementById('pakeUrlClose');
|
||||
|
||||
urlSubmit.onclick = function () {
|
||||
urlSubmit.onclick = function() {
|
||||
const url = urlInput.value;
|
||||
if (url) {
|
||||
window.location.href = url;
|
||||
}
|
||||
};
|
||||
|
||||
urlClose.onclick = function () {
|
||||
urlClose.onclick = function() {
|
||||
urlModal.style.display = 'none';
|
||||
};
|
||||
|
||||
urlInput.addEventListener('keydown', function (event) {
|
||||
urlInput.addEventListener('keydown', function(event) {
|
||||
if (event.key === 'Enter') {
|
||||
const url = urlInput.value;
|
||||
if (url) {
|
||||
@@ -116,13 +116,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', function (event) {
|
||||
document.addEventListener('keydown', function(event) {
|
||||
if (event.key === 'Escape' && urlModal.style.display === 'block') {
|
||||
urlModal.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
window.showUrlModal = function () {
|
||||
window.showUrlModal = function() {
|
||||
urlModal.style.display = 'block';
|
||||
urlInput.focus();
|
||||
};
|
||||
@@ -134,11 +134,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
m.style.cssText =
|
||||
'max-width:60%;min-width: 80px;padding:0 12px;height: 32px;color: rgb(255, 255, 255);line-height: 32px;text-align: center;border-radius: 8px;position: fixed; bottom:24px;right: 28px;z-index: 999999;background: rgba(0, 0, 0,.8);font-size: 13px;';
|
||||
document.body.appendChild(m);
|
||||
setTimeout(function () {
|
||||
setTimeout(function() {
|
||||
const d = 0.5;
|
||||
m.style.transition = 'transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
|
||||
m.style.opacity = '0';
|
||||
setTimeout(function () {
|
||||
setTimeout(function() {
|
||||
document.body.removeChild(m);
|
||||
}, d * 1000);
|
||||
}, 3000);
|
||||
@@ -146,35 +146,4 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
window.pakeToast = pakeToast;
|
||||
|
||||
// chatgpt supports unlimited times of GPT4-Mobile
|
||||
if (window.location.hostname === 'chat.openai.com') {
|
||||
const originFetch = fetch;
|
||||
window.fetch = (url, options) => {
|
||||
return originFetch(url, options).then(async response => {
|
||||
if (url.indexOf('/backend-api/models') === -1) {
|
||||
return response;
|
||||
}
|
||||
const responseClone = response.clone();
|
||||
let res = await responseClone.json();
|
||||
res.models = res.models.map(m => {
|
||||
m.tags = m.tags.filter(t => {
|
||||
return t !== 'mobile';
|
||||
});
|
||||
if (m.slug === 'gpt-4-mobile') {
|
||||
res.categories.push({
|
||||
browsing_model: null,
|
||||
category: 'gpt_4',
|
||||
code_interpreter_model: null,
|
||||
default_model: 'gpt-4-mobile',
|
||||
human_category_name: 'GPT-4-Mobile',
|
||||
plugins_model: null,
|
||||
subscription_level: 'plus',
|
||||
});
|
||||
}
|
||||
return m;
|
||||
});
|
||||
return new Response(JSON.stringify(res), response);
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
6
src-tauri/src/inject/event.js
vendored
6
src-tauri/src/inject/event.js
vendored
@@ -163,6 +163,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
// Fix Chinese input method "Enter" on Safari
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (e.keyCode === 229) e.stopPropagation();
|
||||
}, true);
|
||||
|
||||
});
|
||||
|
||||
function setDefaultZoom() {
|
||||
|
||||
Reference in New Issue
Block a user