chaodyz / ngx-line-truncation

An Angular line truncating solution. Truncate text block by given line number and add ellipsis to the end.

Home Page:https://line-truncation-site.appspot.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Produced values of output of `hasTruncated` is confusing

rqman opened this issue · comments

In case of using input watchChanges and too long text on each update hasTruncated - will produce two values.

  • First value emited after acutal value change.
  • The second will be emitted after line-truncation finish work and provide truncated value to DOM.
    So hasTruncated will emit isTruncated = false however actually text has been truncated.

Environment: See example

  • Editor that allow to write a long notes.
  • Note preview should display a few first lines.
  • Allow view all note's text by clicking on show more/ show less.

Step to reproduce:

  • Change text into textarea (Text should have enought symbols to apply truncation)
  • Press Save / sync changes button

image

Expected behavior:

  • hasTruncated - should emit one value true

Actual Behaviour:

  • hasTruncated - emitted true
  • hasTruncated - emitted false