D
D
Dima2018-04-17 18:20:55
JavaScript
Dima, 2018-04-17 18:20:55

The problem with replacing a new line with a new line with a space, how to solve?

There is such a small script for replacing the input of a new line with a new line with a space, made using vue

new Vue ({
  el: '#app',
  data: {
    input: '',
  },
    methods: {
    onInput() {
      this.input = this.input.split('\n').join('⠀\n');
    }
  }
});

But at work, textarea behaves inappropriately, creates a lot of extra spaces and, in the process of printing and line wrapping, creates new lines. Here's a video
5ad6106fa85d8937973876.png
. What's the best way to implement this feature? Make a replacement when you press the Enter button?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0xD34F, 2018-04-17
@qpz

Make a replacement when you press the Enter button?

As an option .

I
Interface, 2018-04-17
@Interface

https://codepen.io/Int0h/pen/QrLroj
so for example (line 13 in js)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question