diff options
| author | bobzel <zzzman@gmail.com> | 2025-04-30 14:43:29 -0400 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2025-04-30 14:43:29 -0400 |
| commit | 0317a667a5d4a0f298522eeddb8afa96e7b7ecfc (patch) | |
| tree | 2d66c3caa5c102a3ca78837b87e61c16fd07fc01 /src/client/views/nodes/scrapbook/EmbeddedDocView.tsx | |
| parent | 9ec7df6af508eccdfda3a195a69c8bb1f86c41ea (diff) | |
| parent | 2296c314be710f983d595de37c9d8039d73568a6 (diff) | |
Merge branch 'master' into task_nodes_aarav
Diffstat (limited to 'src/client/views/nodes/scrapbook/EmbeddedDocView.tsx')
| -rw-r--r-- | src/client/views/nodes/scrapbook/EmbeddedDocView.tsx | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/client/views/nodes/scrapbook/EmbeddedDocView.tsx b/src/client/views/nodes/scrapbook/EmbeddedDocView.tsx new file mode 100644 index 000000000..e99bf67c7 --- /dev/null +++ b/src/client/views/nodes/scrapbook/EmbeddedDocView.tsx @@ -0,0 +1,52 @@ +//IGNORE FOR NOW, CURRENTLY NOT USED IN SCRAPBOOK IMPLEMENTATION +import * as React from "react"; +import { observer } from "mobx-react"; +import { Doc } from "../../../../fields/Doc"; +import { DocumentView } from "../DocumentView"; +import { Transform } from "../../../util/Transform"; + +interface EmbeddedDocViewProps { + doc: Doc; + width?: number; + height?: number; + slotId?: string; +} + +@observer +export class EmbeddedDocView extends React.Component<EmbeddedDocViewProps> { + render() { + const { doc, width = 300, height = 200, slotId } = this.props; + + // Use either an existing embedding or create one + let docToDisplay = doc; + + // If we need an embedding, create or use one + if (!docToDisplay.isEmbedding) { + docToDisplay = Doc.BestEmbedding(doc) || Doc.MakeEmbedding(doc); + // Set the container to the slot's ID so we can track it + if (slotId) { + docToDisplay.embedContainer = `scrapbook-slot-${slotId}`; + } + } + + return ( + <DocumentView + Document={docToDisplay} + renderDepth={0} + // Required sizing functions + NativeWidth={() => width} + NativeHeight={() => height} + PanelWidth={() => width} + PanelHeight={() => height} + // Required state functions + isContentActive={() => true} + childFilters={() => []} + ScreenToLocalTransform={() => new Transform()} + // Display options + hideDeleteButton={true} + hideDecorations={true} + hideResizeHandles={true} + /> + ); + } +}
\ No newline at end of file |
