mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
refactor(editor): simplify attachment and image upload handling (#11987)
Closes: [BS-3303](https://linear.app/affine-design/issue/BS-3303/改進-pack-attachment-props-流程) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced attachment and image uploads with improved file size validation and clearer notifications. - Upload telemetry tracking added for attachments to monitor upload success or failure. - **Refactor** - Streamlined and unified the process of adding attachments and images, making uploads more reliable and efficient. - Parameter names updated for clarity across attachment and image insertion features. - **Documentation** - Updated API documentation to reflect parameter name changes for consistency. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -764,7 +764,7 @@ export class Store {
|
||||
* Add sibling blocks to the store
|
||||
* @param targetModel - The target block model
|
||||
* @param props - Array of block properties
|
||||
* @param place - Optional position to place the new blocks ('after' or 'before')
|
||||
* @param placement - Optional position to place the new blocks ('after' or 'before')
|
||||
* @returns Array of IDs of the newly created blocks
|
||||
*
|
||||
* @category Block CRUD
|
||||
@@ -772,7 +772,7 @@ export class Store {
|
||||
addSiblingBlocks(
|
||||
targetModel: BlockModel,
|
||||
props: Array<Partial<BlockProps>>,
|
||||
place: 'after' | 'before' = 'after'
|
||||
placement: 'after' | 'before' = 'after'
|
||||
): string[] {
|
||||
if (!props.length) return [];
|
||||
const parent = this.getParent(targetModel);
|
||||
@@ -780,7 +780,7 @@ export class Store {
|
||||
|
||||
const targetIndex =
|
||||
parent.children.findIndex(({ id }) => id === targetModel.id) ?? 0;
|
||||
const insertIndex = place === 'before' ? targetIndex : targetIndex + 1;
|
||||
const insertIndex = placement === 'before' ? targetIndex : targetIndex + 1;
|
||||
|
||||
if (props.length <= 1) {
|
||||
if (!props[0]?.flavour) return [];
|
||||
|
||||
Reference in New Issue
Block a user