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

  1. <template>
  2. <div id="regex-create">
  3. <div>
  4. <div>
  5. <input v-model="name"
  6. type="text"
  7. placeholder="Enter searcher name"
  8. class="input">
  9. </div>
  10. <button @click="onSave" :disabled=" ! name || ! pattern">
  11. Save
  12. </button>
  13. </div>
  14. <div class="regex-box">
  15. <div class="main">
  16. <pattern-box v-model="pattern"></pattern-box>
  17. <text-box :pattern="pattern"
  18. :flags="flags">
  19. </text-box>
  20. <flags v-model="flags"></flags>
  21. </div>
  22. <aside>
  23. <side-bar></side-bar>
  24. </aside>
  25. </div>
  26. </div>
  27. </template>
  28. <script lang="ts">
  29. import {Component, Vue} from "vue-property-decorator";
  30. import TextBox from './TextBox.vue';
  31. import PatternBox from './PatternBox.vue';
  32. import Flags from './Flags.vue';
  33. import SideBar from './SideBar.vue';
  34. @Component({
  35. components: {
  36. TextBox,
  37. PatternBox,
  38. Flags,
  39. SideBar,
  40. },
  41. })
  42. export default class Create extends Vue {
  43. private name: string = '';
  44. private pattern: string = '';
  45. private flags: Array<string> = ['g', 'i'];
  46. async onSave() {
  47. try {
  48. const { data } = await (window as any).axios.post('/regex', {
  49. name: this.name,
  50. expression: this.pattern,
  51. });
  52. alert('Saved.');
  53. } catch (e) {
  54. console.log(e);
  55. console.log('Something went wrong.');
  56. }
  57. }
  58. };
  59. </script>