File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -3,15 +3,18 @@ import type { Page } from "@cosense/types/rest";
33import type { Change } from "./change.ts" ;
44import { findMetadata , getHelpfeels } from "./findMetadata.ts" ;
55import { isSameArray } from "./isSameArray.ts" ;
6+ import { isString } from "@core/unknownutil/is/string" ;
67
78export function * makeChanges (
89 before : Page ,
9- after : string [ ] ,
10+ after : ( string | { text : string } ) [ ] ,
1011 userId : string ,
1112) : Generator < Change , void , unknown > {
1213 // Prevent newline characters from being included in the text
1314 // This ensures consistent line handling across different platforms
14- const after_ = after . flatMap ( ( text ) => text . split ( "\n" ) ) ;
15+ const after_ = after . flatMap ( ( text ) =>
16+ ( isString ( text ) ? text : text . text ) . split ( "\n" )
17+ ) ;
1518
1619 // First, yield changes in the main content
1720 // Content changes must be processed before metadata to maintain consistency
Original file line number Diff line number Diff line change @@ -48,7 +48,10 @@ export const patch = (
4848 update : (
4949 lines : BaseLine [ ] ,
5050 metadata : PatchMetadata ,
51- ) => string [ ] | undefined | Promise < string [ ] | undefined > ,
51+ ) =>
52+ | ( string | { text : string } ) [ ]
53+ | undefined
54+ | Promise < ( string | { text : string } ) [ ] | undefined > ,
5255 options ?: PatchOptions ,
5356) : Promise < Result < string , PushError | Socket . DisconnectReason > > =>
5457 push (
You can’t perform that action at this time.
0 commit comments