Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copying text copies line numbers as well. #63

Open
TeddyBonkerz opened this issue Mar 2, 2021 · 1 comment
Open

Copying text copies line numbers as well. #63

TeddyBonkerz opened this issue Mar 2, 2021 · 1 comment

Comments

@TeddyBonkerz
Copy link

Is there anyway to prevent the '+' and line number from being copied ?
image

@therealryan
Copy link

therealryan commented Aug 24, 2021

You can set the user-select CSS property to none on those elements. Ideally this would be built in to this project, but until that happens you can do the following in your component that uses td-ngx-text-diff.

Configure the component to allow CSS from the parent to apply to child components with encapsulation: ViewEncapsulation.None, e.g.:

@Component({
  selector: 'app-foobar',
  templateUrl: './foobar.component.html',
  styleUrls: ['./foobar.component.css'],
  encapsulation: ViewEncapsulation.None
})

Add the styles to foobar.component.css:

.td-wrapper .line-number-col {
  user-select: none;
}
.td-wrapper .line-number-col-left {
  user-select: none;
}
.td-wrapper .prefix-col {
  user-select: none;
}

Note that since we're taking the unusual step of allowing CSS from the parent to affect child components were taking extra care to target the elements of interest. If there's zero chance of your component using, e.g.: class="prefix-col" outside of the diff component then you can omit the leading .td-wrapper selector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants