mirror of
https://github.com/EthanShoeDev/fressh.git
synced 2026-01-11 06:12:51 +00:00
stuff
This commit is contained in:
18
packages/react-native-xtermjs-webview/index.dev.html
Normal file
18
packages/react-native-xtermjs-webview/index.dev.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!doctype html>
|
||||
<html style="margin: 0; padding: 0; width: 100%; height: 100%">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"
|
||||
/>
|
||||
</head>
|
||||
<body style="margin: 0; padding: 0px; width: 100%; height: 100%">
|
||||
<div
|
||||
id="terminal"
|
||||
style="margin: 0; padding: 0; width: 100%; height: 100%"
|
||||
></div>
|
||||
<script type="module" src="/src-internal/main.tsx"></script>
|
||||
<script type="module" src="/src-internal/dev.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
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',
|
||||
|
||||
@@ -2,9 +2,13 @@ import { defineConfig } from 'vite';
|
||||
import { viteSingleFile } from 'vite-plugin-singlefile';
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [viteSingleFile()],
|
||||
build: {
|
||||
outDir: 'dist-internal',
|
||||
},
|
||||
export default defineConfig((ctx) => {
|
||||
const input = ctx.command === 'serve' ? 'index.html' : 'index.build.html';
|
||||
console.log('Vite Internal Working with input', input);
|
||||
return {
|
||||
plugins: [viteSingleFile()],
|
||||
build: {
|
||||
outDir: 'dist-internal',
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user