关于用App Dev Pack 1.0.5的domino-db/richtext包复现富文本附件工作流的问询
Can App Dev Pack 1.0.5's domino-db/richtext Packages Support This Rich Text Attachment Workflow?
Great question! The short answer is yes — you can absolutely replicate your desired workflow using the domino-db and richtext packages included in App Dev Pack 1.0.5. Let’s break down how each component contributes, and outline the key steps to implement it:
Core Capabilities of the Packages
1. richtext Package
This package is built specifically for working with Domino rich text content, and version 1.0.5 includes full support for:
- Embedding attachments directly into rich text items during document creation or editing
- Parsing existing rich text content to pull out attachment metadata (like filenames, file sizes) and raw binary data
- Generating valid Domino-rich-text structures that include attachments, ready to be saved back to the database
2. domino-db Package
As the primary bridge between your app and the Domino database, domino-db handles:
- Saving documents with rich text items (and their embedded attachments) to the Domino server
- Retrieving saved documents (along with their rich text and attachments) for user display
- Ensuring binary attachment data is transmitted and stored without corruption
Step-by-Step Implementation
Here’s how to map your workflow to the packages’ APIs:
1. User Editing & Attachment Addition
- When the user selects the rich text field and clicks your attachment button, use frontend file picker logic to let them select files.
- Use the
richtextpackage’s dedicated methods (likeaddAttachment) to embed the selected file(s) into an in-memory rich text structure. This converts the file into a format compatible with Domino’s rich text storage system.
2. Saving the Document
- Prepare your document data, making sure the rich text field is structured as a
RichTextItemwith embedded attachments included. - Use
domino-db’screateDocumentorupdateDocumentmethod to send the full document to the Domino database. The package automatically handles transmitting the binary attachment data alongside the rest of the document content.
3. Viewing/Saving Attachments Post-Save
- When fetching the saved document via
domino-db, extract the rich text item from the returned document data. - Use the
richtextpackage to parse the rich text and pull out each attachment’s binary data and metadata. - For image attachments: Convert the binary data to a browser-compatible format (like an Object URL or Data URL) and render it directly in your UI for preview. Add a download button that triggers saving the blob to the user’s device.
- For non-image attachments: Provide a download link that uses the extracted binary data to let users save the file locally.
Key Notes to Keep in Mind
- Ensure you’re handling binary data correctly in your frontend code to avoid corruption during upload or download.
- The
richtextpackage’s attachment-focused APIs are straightforward, but be sure to reference the local documentation bundled with App Dev Pack 1.0.5 for exact method details. - Test end-to-end with different file types and sizes to confirm attachments save properly and can be retrieved/previewed without issues.
内容的提问来源于stack exchange,提问作者Vomste
相关产品推荐
相关产品推荐

