Delta not work for new Y.Text

i tried to follow the example Delta Format - Yjs Docs
if i use getText from doc like the example, it is working well

const ytext = ydoc.getText()

ytext.toDelta() // => []
ytext.insert(0, 'World', { bold: true })
ytext.insert(0, 'Hello ')
ytext.toDelta() // => [{ insert: 'Hello ' }, { insert: 'World', attributes: { bold: true } }]

But if i create a new Y.Text() object, delta not working, when i call toDelta in second time, it is still empty array

const ytext = new Y.Text()

ytext.toDelta() // => []
ytext.insert(0, 'World', { bold: true })
ytext.insert(0, 'Hello ')
ytext.toDelta() // => []

Shared types must be attached to a Doc to work.

Either use Doc.getText to get a top-level Y.Text, or add the new Y.Text to an existing Y.Map.

I see, thank you for explain that!