Skip to content

Commit fac74af

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

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

javascript/src/ycell.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -793,12 +793,8 @@ 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;
801-
}
796+
let _text = text instanceof Array ? text.join() : text as string;
797+
newText.insert(0, _text);
802798
_newOutput1['text'] = newText;
803799
} else {
804800
_newOutput1 = output;

0 commit comments

Comments
 (0)