Next.js Discord

Discord Forum

Save document data to encoded text

Unanswered
Atlantic mackerel posted this in #help-forum
Open in Discord
Atlantic mackerelOP
Hey guys, I want to save my contenteditable div encode via URL.createObjectURL so I tried this:

    <div className="focus:outline-none" contentEditable={true} suppressContentEditableWarning={true}
             onInput={async (event) => {
                 let value = event.currentTarget.innerHTML;

                 let data = URL.createObjectURL(
                     new Blob([event.currentTarget.outerHTML], {type: 'text/html'})
                 );

                 await saveToServer(base64, data);
                 setTitle(value)
             }}>
</div>

I got this u4: 4639824e-68aa-4164-916d-051e0d4622ff

But I wonder how to decode this u4

is there any way to load data from u4?

5 Replies

Barbary Lion
Which function returned the u4 ? Generally, the u4 is a hashed value - you cant dehash it - theres infinite possible ways to generate the same u4, therefore its impossible to 'decode' it as well.
Please note that outerHTML returns the containing element as well - not just the editable content.
@Barbary Lion Please note that `outerHTML` returns the containing element as well - not just the editable content.
Atlantic mackerelOP
I found tiptap api I think I have to use it
@Atlantic mackerel I found `tiptap` api I think I have to use it
Barbary Lion
You have to ? Or its easier than building it for yourself ? (which it is 😄 )
@Barbary Lion You have to ? Or its easier than building it for yourself ? (which it is 😄 )
Atlantic mackerelOP
Oh easier to build for me hahaha Thank uu