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.
69 lines
1.6 KiB
69 lines
1.6 KiB
<template>
|
|
<div id="regex-create">
|
|
<div>
|
|
<div>
|
|
<input v-model="name"
|
|
type="text"
|
|
placeholder="Enter searcher name"
|
|
class="input">
|
|
</div>
|
|
|
|
<button @click="onSave" :disabled=" ! name || ! pattern">
|
|
Save
|
|
</button>
|
|
</div>
|
|
|
|
<div class="regex-box">
|
|
<div class="main">
|
|
<pattern-box v-model="pattern"></pattern-box>
|
|
|
|
<text-box :pattern="pattern"
|
|
:flags="flags">
|
|
</text-box>
|
|
|
|
<flags v-model="flags"></flags>
|
|
</div>
|
|
|
|
<aside>
|
|
<side-bar></side-bar>
|
|
</aside>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import {Component, Vue} from "vue-property-decorator";
|
|
import TextBox from './TextBox.vue';
|
|
import PatternBox from './PatternBox.vue';
|
|
import Flags from './Flags.vue';
|
|
import SideBar from './SideBar.vue';
|
|
|
|
@Component({
|
|
components: {
|
|
TextBox,
|
|
PatternBox,
|
|
Flags,
|
|
SideBar,
|
|
},
|
|
})
|
|
|
|
export default class Create extends Vue {
|
|
private name: string = '';
|
|
private pattern: string = '';
|
|
private flags: Array<string> = ['g', 'i'];
|
|
|
|
async onSave() {
|
|
try {
|
|
const { data } = await (window as any).axios.post('/regex', {
|
|
name: this.name,
|
|
expression: this.pattern,
|
|
});
|
|
|
|
alert('Saved.');
|
|
} catch (e) {
|
|
console.log(e);
|
|
console.log('Something went wrong.');
|
|
}
|
|
}
|
|
};
|
|
</script>
|