paseo-plugin-genui 0.1.2 → 0.1.3

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.
@@ -2,7 +2,7 @@ import { Icon as PaseoIcon, Modal } from "@getpaseo/plugin/client/react-native";
2
2
  import { ImageLightbox } from "./image-lightbox";
3
3
  import { ExternalLink } from "@getpaseo/plugin/client/ui";
4
4
  import React, { useContext, useEffect, useState } from "react";
5
- import { Image as RNImage, Pressable, StyleSheet, Text as RNText, View } from "react-native";
5
+ import { Image as RNImage, Platform, Pressable, StyleSheet, Text as RNText, View } from "react-native";
6
6
  import { keyValuePairs } from "../../shared/logic/content-model";
7
7
  import { parseListRows } from "../../shared/logic/explain-logic";
8
8
  import { resolveIconName } from "../../shared/logic/icons";
@@ -275,11 +275,12 @@ export function File({ props }: { props: Props }) {
275
275
  const line = finiteNumber(props.line);
276
276
  const label = line !== null ? `${filePath}:${Math.round(line)}` : filePath;
277
277
 
278
- return (
278
+ const onWeb = Platform.OS === "web";
279
+ const chip = (
279
280
  <Pressable
280
281
  accessibilityRole="button"
281
282
  onPress={() => {
282
- if (openFile) void openFile(filePath, line ?? undefined);
283
+ if (!onWeb && openFile) void openFile(filePath, line ?? undefined);
283
284
  }}
284
285
  style={{
285
286
  alignSelf: "flex-start",
@@ -300,6 +301,23 @@ export function File({ props }: { props: Props }) {
300
301
  </RNText>
301
302
  </Pressable>
302
303
  );
304
+ if (!onWeb) return chip;
305
+
306
+ // Paseo renders chat file links as `<a style="display: contents">`. Plugins such as
307
+ // wiki-viewer catch clicks on those and replay the click when they decline, so the
308
+ // anchor's own handler is the fallback that opens a Paseo file tab.
309
+ return React.createElement(
310
+ "a",
311
+ {
312
+ href: label,
313
+ style: { display: "contents" },
314
+ onClick: (event: { preventDefault(): void }) => {
315
+ event.preventDefault();
316
+ if (openFile) void openFile(filePath, line ?? undefined);
317
+ },
318
+ },
319
+ chip,
320
+ );
303
321
  }
304
322
 
305
323
  export function Entity({ props }: { props: Props }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paseo-plugin-genui",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Paseo plugin: agents answer with charts, diagrams, maps, plans and forms rendered inline in the chat.",
5
5
  "keywords": [
6
6
  "paseo",