Repo for the search and displace core module including the interface to select files and search and displace operations to run on them.
https://searchanddisplace.com
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<template> <div id="text-box" class="text-box"> <div ref="backdrop" class="backdrop"> <div class="matches" v-html="matches"></div> </div>
<textarea ref="text" v-model="text" placeholder="Enter text to check matches" @scroll="handleScroll"> </textarea> </div> </template>
<script lang="ts"> import {Component, Prop, Vue} from "vue-property-decorator";
@Component export default class TextBox extends Vue { private text: string = '';
@Prop({default: ''}) public readonly pattern!: string; @Prop() public readonly flags!: Array<string>;
getMatches() { return this.text .replace(/\n$/g, '\n\n') .replace(new RegExp(this.pattern, this.flags.join('')), '<mark>$&</mark>'); }
handleScroll() { // this.$refs.backdrop.scrollTop = this.$refs.text.scrollTop;
}
get matches(): string { return this.getMatches(); } }; </script>
|