Skip to content

Commit

Permalink
fix(page): link disapper when paste (toeverything#6135)
Browse files Browse the repository at this point in the history
  • Loading branch information
regischen authored Jan 26, 2024
1 parent 55f5733 commit 5cd16d3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/blocks/src/_common/transformers/middlewares.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,22 @@ export const replaceIdMiddleware: JobMiddleware = ({ slots, workspace }) => {
const delta: DeltaOperation[] = [];
for (const d of model.text.toDelta()) {
if (d.attributes?.reference?.pageId) {
const newId = idMap.get(d.attributes.reference.pageId);
if (!newId) {
prev += d.insert?.length ?? 0;
continue;
}

if (prev > 0) {
delta.push({ retain: prev });
}

delta.push({
retain: d.insert?.length ?? 0,
attributes: {
reference: {
...d.attributes.reference,
pageId: idMap.get(d.attributes.reference.pageId)!,
pageId: newId,
},
},
});
Expand Down

1 comment on commit 5cd16d3

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size Report

Bundles

Entry Size Gzip Brotli
examples/basic 13.4 MB (+15 kB) 2.79 MB (+2.08 kB) 1.74 MB (+1.03 kB)

Packages

Name Size Gzip Brotli
blocks 2.4 MB (+1.12 kB) 545 kB (+249 B) 400 kB (+585 B)
editor 84 B 89 B 63 B
store 83 B (-64.5 kB) 88 B (-18.5 kB) 63 B (-16.6 kB)
inline 84 B (-33.6 kB) 88 B (-9 kB) 63 B (-8.09 kB)

Please sign in to comment.