a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

somewhat fix pasting images onto canvas

+21 -14
+21 -14
components/Blocks/TextBlock/useHandlePaste.ts
··· 60 60 ) { 61 61 children.forEach((child, index) => { 62 62 createBlockFromHTML(child, { 63 + parentType: propsRef.current.pageType, 63 64 first: index === 0, 64 65 activeBlockProps: propsRef, 65 66 entity_set, ··· 69 70 : propsRef.current.parent, 70 71 getPosition: () => { 71 72 currentPosition = generateKeyBetween( 72 - currentPosition, 73 + currentPosition || null, 73 74 propsRef.current.nextPosition, 74 75 ); 75 76 return currentPosition; ··· 77 78 last: index === children.length - 1, 78 79 }); 79 80 }); 80 - return true; 81 81 } 82 82 } 83 83 ··· 133 133 entity_set, 134 134 getPosition, 135 135 parent, 136 + parentType, 136 137 }: { 138 + parentType: "canvas" | "doc"; 137 139 parent: string; 138 140 first: boolean; 139 141 last: boolean; ··· 160 162 entity_set, 161 163 getPosition, 162 164 parent, 165 + parentType, 163 166 }); 164 167 } 165 168 } ··· 205 208 let entityID: string; 206 209 let position: string; 207 210 if ( 208 - first && 209 - (activeBlockProps?.current.type === "heading" || 210 - type === activeBlockProps?.current.type) 211 + (parentType === "canvas" && activeBlockProps?.current) || 212 + (first && 213 + (activeBlockProps?.current.type === "heading" || 214 + type === activeBlockProps?.current.type)) 211 215 ) 212 216 entityID = activeBlockProps.current.entityID; 213 217 else { 214 218 entityID = v7(); 215 - position = getPosition(); 216 - rep.mutate.addBlock({ 217 - permission_set: entity_set.set, 218 - factID: v7(), 219 - newEntityID: entityID, 220 - parent: parent, 221 - type: type, 222 - position, 223 - }); 219 + if (parentType === "doc") { 220 + position = getPosition(); 221 + rep.mutate.addBlock({ 222 + permission_set: entity_set.set, 223 + factID: v7(), 224 + newEntityID: entityID, 225 + parent: parent, 226 + type: type, 227 + position, 228 + }); 229 + } 224 230 if (type === "heading" && headingLevel) { 225 231 rep.mutate.assertFact({ 226 232 entity: entityID, ··· 336 342 hasChildren = true; 337 343 let currentPosition: string | null = null; 338 344 createBlockFromHTML(ul, { 345 + parentType, 339 346 first: false, 340 347 last: last, 341 348 activeBlockProps,