• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

253
Vistas
Insert tab character into SlateJS text editor

How to insert tab characters into SlateJS?

So inserting   is a tab character, however, when inserting this as text, it appears as the literal characters   not the text with a tab spacing.

// Don't work, inserts literal characters
const insertText = (editor, format) => {
    Editor.insertText(editor, ` ')
}

Is there any simple way to insert a   and have Slatejs recognise it as the html, not as pure text?

Based on my rough understanding, it might be I'll need to serialise and deserialise html before inserting it. Maybe even inserting <pre> </pre> blocks with the spacing included.

about 3 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Just dawned on me I could insert 4 spaces instead of a tab character... Although, this isn't perfect, you have to backspace 4 times instead of a single time like tabs.

const insertText = (editor, format) => {
    Editor.insertText(editor, '    ')
}

Could also insert tab space characters in the insert text, like the tabs in this article, can't copy paste their tabs as SO turns it into spaces. Seems to work perfectly fine, functionally a tab space.

about 3 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda