diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml
index 927cd4cb..9aef1086 100644
--- a/.github/workflows/pr.yaml
+++ b/.github/workflows/pr.yaml
@@ -1,5 +1,8 @@
name: Publish Extension
-on: pull_request
+
+on:
+ pull_request:
+ workflow_dispatch:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
diff --git a/package-lock.json b/package-lock.json
index b09d775f..da3aea5f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,6 +10,7 @@
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
+ "@nanopub/sign": "^0.1.4",
"@samepage/external": "^0.71.10",
"@tldraw/tldraw": "^2.0.0-alpha.12",
"contrast-color": "^1.0.1",
@@ -1965,6 +1966,11 @@
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
+ "node_modules/@nanopub/sign": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/@nanopub/sign/-/sign-0.1.4.tgz",
+ "integrity": "sha512-QoPBC5Fg20GcTPz/Rtlkq3E8DnwpsAIKSLaTpTp/1bTWY8ZlHZh1ik4pQSZZfUwOWiNtZTwdiO2/GtKY0krZkw=="
+ },
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -10943,6 +10949,11 @@
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
+ "@nanopub/sign": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/@nanopub/sign/-/sign-0.1.4.tgz",
+ "integrity": "sha512-QoPBC5Fg20GcTPz/Rtlkq3E8DnwpsAIKSLaTpTp/1bTWY8ZlHZh1ik4pQSZZfUwOWiNtZTwdiO2/GtKY0krZkw=="
+ },
"@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
diff --git a/package.json b/package.json
index 6e2cc107..4b10c731 100644
--- a/package.json
+++ b/package.json
@@ -26,6 +26,7 @@
"widgets"
],
"dependencies": {
+ "@nanopub/sign": "^0.1.4",
"@samepage/external": "^0.71.10",
"@tldraw/tldraw": "^2.0.0-alpha.12",
"contrast-color": "^1.0.1",
diff --git a/src/components/Export.tsx b/src/components/Export.tsx
index babaf008..5defb66f 100644
--- a/src/components/Export.tsx
+++ b/src/components/Export.tsx
@@ -50,6 +50,8 @@ import localStorageSet from "roamjs-components/util/localStorageSet";
import isLiveBlock from "roamjs-components/queries/isLiveBlock";
import createPage from "roamjs-components/writes/createPage";
import { createInitialTldrawProps } from "../utils/createInitialTldrawProps";
+import { render as renderNanopub } from "./nanopub/ExportNanopub";
+import { OnloadArgs } from "roamjs-components/types";
const ExportProgress = ({ id }: { id: string }) => {
const [progress, setProgress] = useState(0);
@@ -99,6 +101,7 @@ const EXPORT_DESTINATIONS = [
{ id: "app", label: "Store in Roam", active: false },
{ id: "samepage", label: "Store with SamePage", active: false },
{ id: "github", label: "Send to GitHub", active: true },
+ { id: "nanopub", label: "Publish as Nanopub", active: true },
];
const SEND_TO_DESTINATIONS = ["page", "graph"];
@@ -525,6 +528,7 @@ const ExportDialog: ExportDialogComponent = ({
items={exportTypes.map((e) => e.name)}
activeItem={activeExportType}
onItemSelect={(et) => setActiveExportType(et)}
+ disabled={activeExportType === "nanopub"}
/>
@@ -646,6 +650,16 @@ const ExportDialog: ExportDialogComponent = ({
const exportType = exportTypes.find(
(e) => e.name === activeExportType
);
+
+ if (activeExportDestination === "nanopub") {
+ const allResults =
+ typeof results === "function"
+ ? await results(isSamePageEnabled)
+ : results || [];
+ handleNanopubExport(allResults, getExtensionAPI());
+ return;
+ }
+
if (exportType && window.RoamLazy) {
setDialogOpen(true);
setLoading(false);
@@ -804,6 +818,18 @@ const ExportDialog: ExportDialogComponent = ({
>
);
+ const handleNanopubExport = (
+ results: Result[],
+ extensionAPI: OnloadArgs["extensionAPI"]
+ ) => {
+ onClose();
+ renderNanopub({
+ results,
+ onClose: () => {},
+ extensionAPI,
+ });
+ };
+
return (
<>