mirror of
https://github.com/EthanShoeDev/fressh.git
synced 2026-01-12 23:02:49 +00:00
stuff
This commit is contained in:
14
packages/react-native-xtermjs-webview/src-internal/dev.ts
Normal file
14
packages/react-native-xtermjs-webview/src-internal/dev.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
// This file is only loaded in dev mode.
|
||||
|
||||
// These lines should replicate injectedJavaScriptBeforeContentLoaded from src/index.tsx
|
||||
document.body.style.backgroundColor = '#0B1324';
|
||||
|
||||
// Replicate injectedJavaScriptObject from src/index.tsx
|
||||
window.ReactNativeWebView = {
|
||||
postMessage: (data: string) => {
|
||||
console.log('postMessage', data);
|
||||
},
|
||||
injectedObjectJson: () => {
|
||||
return JSON.stringify({});
|
||||
},
|
||||
};
|
||||
@@ -153,7 +153,19 @@ window.onload = () => {
|
||||
window.addEventListener('message', handler);
|
||||
|
||||
// Initial handshake (send once)
|
||||
setTimeout(() => sendToRn({ type: 'initialized' }), 100);
|
||||
setTimeout(() => {
|
||||
const ta = document.querySelector(
|
||||
'.xterm-helper-textarea',
|
||||
) as HTMLTextAreaElement | null;
|
||||
if (!ta) throw new Error('xterm-helper-textarea not found');
|
||||
ta.setAttribute('autocomplete', 'off');
|
||||
ta.setAttribute('autocorrect', 'off');
|
||||
ta.setAttribute('autocapitalize', 'none');
|
||||
ta.setAttribute('spellcheck', 'false');
|
||||
ta.setAttribute('inputmode', 'verbatim');
|
||||
|
||||
return sendToRn({ type: 'initialized' });
|
||||
}, 200);
|
||||
} catch (e) {
|
||||
sendToRn({
|
||||
type: 'debug',
|
||||
|
||||
Reference in New Issue
Block a user