seemore 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/app/entry.client.tsx +3 -0
- package/src/app/lib/copyBridge.ts +28 -0
package/README.md
CHANGED
|
@@ -131,7 +131,7 @@ export default defineConfig({
|
|
|
131
131
|
nav: [{ text: 'GitHub', link: 'https://github.com/you/repo' }],
|
|
132
132
|
footer: { text: '© 2026' },
|
|
133
133
|
editLink: { base: 'https://github.com/you/repo/edit/main/docs' },
|
|
134
|
-
search: 'static',
|
|
134
|
+
search: 'static', // or { provider: 'orama-cloud', endpoint, apiKey } / { provider: 'algolia', appId, apiKey, indexName }
|
|
135
135
|
exclude: ['drafts/**'],
|
|
136
136
|
});
|
|
137
137
|
```
|
package/package.json
CHANGED
package/src/app/entry.client.tsx
CHANGED
|
@@ -4,9 +4,12 @@ import { RouterProvider, createBrowserRouter } from 'react-router';
|
|
|
4
4
|
import { config } from 'virtual:seemore/config';
|
|
5
5
|
import { decodePath, stripBase, toBasename } from '../shared/base.js';
|
|
6
6
|
import { createRouteObjects } from './router.js';
|
|
7
|
+
import { installCopyBridge } from './lib/copyBridge.js';
|
|
7
8
|
import { preloadPage } from './lib/pages.js';
|
|
8
9
|
import './styles/globals.css';
|
|
9
10
|
|
|
11
|
+
installCopyBridge();
|
|
12
|
+
|
|
10
13
|
const container = document.getElementById('root');
|
|
11
14
|
if (container === null) throw new Error('seemore: #root is missing from the page shell.');
|
|
12
15
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Answers a clipboard-copy request from an embedding parent frame (the seemore VS Code
|
|
3
|
+
* extension's webview shell — see `panelHtml.ts`/`panel.ts` in that package).
|
|
4
|
+
*
|
|
5
|
+
* Embedded there, this page runs inside a nested, cross-origin iframe, and the host's own
|
|
6
|
+
* Ctrl+C/Cmd+C keybinding never reaches this document's native selection-copy at all — the
|
|
7
|
+
* extension asks for the current selection over `postMessage` instead and writes it to the
|
|
8
|
+
* clipboard itself. Outside that embedding, nothing ever posts this message, so the listener
|
|
9
|
+
* is otherwise inert.
|
|
10
|
+
*/
|
|
11
|
+
interface CopyRequest {
|
|
12
|
+
type: 'seemore:copy-request';
|
|
13
|
+
requestId: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function isCopyRequest(value: unknown): value is CopyRequest {
|
|
17
|
+
if (typeof value !== 'object' || value === null) return false;
|
|
18
|
+
const candidate = value as Record<string, unknown>;
|
|
19
|
+
return candidate.type === 'seemore:copy-request' && typeof candidate.requestId === 'string';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function installCopyBridge(): void {
|
|
23
|
+
window.addEventListener('message', (event) => {
|
|
24
|
+
if (event.source !== window.parent || !isCopyRequest(event.data)) return;
|
|
25
|
+
const text = window.getSelection()?.toString() ?? '';
|
|
26
|
+
window.parent.postMessage({ type: 'seemore:copy-response', requestId: event.data.requestId, text }, '*');
|
|
27
|
+
});
|
|
28
|
+
}
|