Skip to content

Commit 4826325

Browse files
committed
Improve notebook output stream initialization
1 parent fd184a5 commit 4826325

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

javascript/src/ycell.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -793,12 +793,13 @@ export class YCodeCell
793793
const { text, ...outputWithoutText } = output;
794794
_newOutput1 = outputWithoutText;
795795
const newText = new Y.Text();
796-
let length = 0;
797-
// text is a list of strings
798-
for (const str of text as string[]) {
799-
newText.insert(length, str);
800-
length += str.length;
796+
let _text: string;
797+
if (text instanceof Array) {
798+
_text = text.join();
799+
} else {
800+
_text = text as string;
801801
}
802+
newText.insert(0, _text);
802803
_newOutput1['text'] = newText;
803804
} else {
804805
_newOutput1 = output;

0 commit comments

Comments
 (0)