diff --git a/apps/client/src/widgets/NoteDetail.tsx b/apps/client/src/widgets/NoteDetail.tsx index e65f8ec66..af25ac905 100644 --- a/apps/client/src/widgets/NoteDetail.tsx +++ b/apps/client/src/widgets/NoteDetail.tsx @@ -11,6 +11,7 @@ import { TypeWidgetProps } from "./type_widgets/type_widget"; import ProtectedSession from "./type_widgets/ProtectedSession"; import Book from "./type_widgets/Book"; import ContentWidget from "./type_widgets/ContentWidget"; +import WebView from "./type_widgets/WebView"; /** * A `NoteType` altered by the note detail widget, taking into consideration whether the note is editable or not and adding special note types such as an empty one, @@ -64,6 +65,7 @@ function getCorrespondingWidget(noteType: ExtendedNoteType | undefined, props: T case "protectedSession": return case "book": return case "contentWidget": return + case "webView": return default: break; } } diff --git a/apps/client/src/widgets/type_widgets/WebView.tsx b/apps/client/src/widgets/type_widgets/WebView.tsx new file mode 100644 index 000000000..fd4d364c6 --- /dev/null +++ b/apps/client/src/widgets/type_widgets/WebView.tsx @@ -0,0 +1,37 @@ +import { t } from "../../services/i18n"; +import utils from "../../services/utils"; +import Alert from "../react/Alert"; +import { useNoteLabel } from "../react/hooks"; +import { TypeWidgetProps } from "./type_widget"; + +const isElectron = utils.isElectron(); + +export default function WebView({ note }: TypeWidgetProps) { + const [ webViewSrc ] = useNoteLabel(note, "webViewSrc"); + + return ( +
+ {webViewSrc + ? + : } +
+ ) +} + +function WebViewContent({ src }: { src: string }) { + if (!isElectron) { + return `; } else { - return ``; + return ``; } } diff --git a/packages/commons/src/lib/attribute_names.ts b/packages/commons/src/lib/attribute_names.ts index 8b8de89c1..ed527308a 100644 --- a/packages/commons/src/lib/attribute_names.ts +++ b/packages/commons/src/lib/attribute_names.ts @@ -39,6 +39,9 @@ type Labels = { "board:groupBy": string; maxNestingDepth: number; includeArchived: boolean; + + // Note-type specific + webViewSrc: string; } /**