Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

175
Visualizações
load json data into editorjs

On my webpage, I have an editorjs. The user types in the information, and it is saved into my mongodb (as JSON). If I want to edit the information, I'm trying to get that information from the database and load it back into the editorjs. I've tried a couple different thing; none of which are working. This is what I have in my editorjs.js file:

const description = data.description; // My JSON that was saved.
console.log(description); // So far so good, console logs just what should be expected.

const editor = new EditorJS({
  holderID: 'editorjs',
  tools: {
    // toolbar configuration here
  },
  data: description // This doesn't work, however if I copy and paste
                    // the data that the console logged from earlier,
                    // it loads correctly into the editorjs
});

// My newest attempt here
editor.isReady.then(() => {
  console.log('ok'); // Works so far
  console.log(description); // Also works, logging the same information as earlier
  editor.render({
    description
  });
}).catch((err) => {
  console.log(err);
});

I'm open to suggestions.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I said this in the comments but i will say it here so others can see it more clearly when they come to this post. He was missing JSON.parse() to parse the JSON.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda