Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

109
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.

7 months 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.

7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos