export bug fix

This commit is contained in:
Hugh Bord 2021-08-05 15:38:01 +10:00
parent d2f38f822c
commit a1e27a8e22
5 changed files with 57 additions and 77 deletions

View File

@ -486,9 +486,9 @@ export const exportMirc = () => {
const zeroPad = (num, places) => String(num).padStart(places, '0');
output.push(
`\u0003${zeroPad(
curBlock.fg ?? this.options.defaultFg,
curBlock.fg ?? store.getters.options.defaultFg,
2,
)},${zeroPad(curBlock.bg ?? this.options.defaultBg, 2)}`,
)},${zeroPad(curBlock.bg ?? store.getters.options.defaultBg, 2)}`,
);
}

View File

@ -30,22 +30,15 @@
max="128"
/>
<hr class="mt-5 mb-5">
<hr class="mt-5 mb-5" />
<template v-slot:footer>
<div
class="flex justify-between"
@click="$store.commit('closeModal', 'edit-ascii')"
>
<t-button type="button">
Cancel
</t-button>
<t-button
type="button"
@click="updateAscii()"
>
Update
</t-button>
<t-button type="button"> Cancel </t-button>
<t-button type="button" @click="updateAscii()"> Update </t-button>
</div>
</template>
</t-modal>
@ -53,7 +46,7 @@
<script>
export default {
name: 'EditAsciiModal',
name: "EditAsciiModal",
created() {
this.forms.editAscii = this.currentAscii;
},
@ -62,7 +55,7 @@ export default {
editAscii: {
width: 80,
height: 30,
title: 'ascii',
title: "ascii",
},
},
}),
@ -81,24 +74,24 @@ export default {
showEditAsciiModal(val) {
if (val === true) {
this.open();
}
}
if (val === false) {
this.close();
}
}
},
},
methods: {
updateAscii() {
this.$store.commit('updateAscii', this.forms.editAscii);
this.close()
this.$store.commit("updateAscii", this.forms.editAscii);
this.close();
},
open() {
this.forms.editAscii = this.currentAscii;
this.$modal.show('edit-ascii-modal');
this.$modal.show("edit-ascii-modal");
},
close() {
this.$modal.hide('edit-ascii-modal');
this.$modal.hide("edit-ascii-modal");
},
},
};

View File

@ -35,32 +35,25 @@
class="flex justify-between"
@click="$store.commit('closeModal', 'new-ascii')"
>
<t-button type="button">
Cancel
</t-button>
<t-button
type="button"
@click="initiateNewAscii()"
>
Ok
</t-button>
<t-button type="button"> Cancel </t-button>
<t-button type="button" @click="initiateNewAscii()"> Ok </t-button>
</div>
</template>
</t-modal>
</template>
<script>
import createNewASCII from '../../ascii';
import createNewASCII from "../../ascii";
export default {
name: 'NewAsciiModal',
name: "NewAsciiModal",
created() {},
data: () => ({
forms: {
createAscii: {
width: 80,
height: 30,
title: 'ascii',
title: "ascii",
},
},
}),
@ -73,26 +66,28 @@ export default {
showNewAsciiModal(val) {
if (val === true) {
this.open();
}
}
if (val === false) {
this.close();
}
}
},
},
methods: {
open() {
this.$modal.show('new-ascii-modal');
this.forms.createAscii.title = `New ASCII ${this.$store.getters.asciibirdMeta.length + 1}`;
this.$modal.show("new-ascii-modal");
this.forms.createAscii.title = `New ASCII ${
this.$store.getters.asciibirdMeta.length + 1
}`;
},
close() {
this.$modal.hide('new-ascii-modal');
this.$modal.hide("new-ascii-modal");
this.forms.createAscii.width = 80;
this.forms.createAscii.height = 30;
this.forms.createAscii.title = 'New ASCII';
this.forms.createAscii.title = "New ASCII";
},
initiateNewAscii() {
createNewASCII(this.forms);
createNewASCII(this.forms);
},
},
};

View File

@ -7,26 +7,16 @@
@closed="$store.commit('closeModal', 'paste-ascii')"
>
Title
<t-input
type="text"
name="title"
v-model="title"
max="128"
/>
<t-input type="text" name="title" v-model="title" max="128" />
<t-textarea
v-model="pasteContent"
name="paste-ascii"
rows="10"
/>
<t-textarea v-model="pasteContent" name="paste-ascii" rows="10" />
<template v-slot:footer>
<div
class="flex justify-between"
>
<t-button
<div class="flex justify-between">
<t-button
type="button"
@click="$store.commit('closeModal', 'paste-ascii')">
@click="$store.commit('closeModal', 'paste-ascii')"
>
Cancel
</t-button>
<t-button
@ -43,14 +33,14 @@
<script>
//
import { parseMircAscii } from '../../ascii';
import { parseMircAscii } from "../../ascii";
export default {
name: 'PasteAsciiModal',
name: "PasteAsciiModal",
created() {},
data: () => ({
pasteContent: '',
title: 'clipboard.txt',
pasteContent: "",
title: "clipboard.txt",
}),
computed: {
showPasteAscii() {
@ -64,28 +54,26 @@ export default {
showPasteAscii(val, old) {
if (val === true) {
this.open();
}
}
if (val === false) {
this.close();
}
}
},
},
methods: {
open() {
this.$modal.show('paste-ascii-modal');
// this.$store.commit('openModal', 'paste-ascii')
this.$modal.show("paste-ascii-modal");
},
close() {
console.log("close")
this.pasteContent = '';
this.title = 'clipboard.txt';
this.$modal.hide('paste-ascii-modal');
console.log("close");
this.pasteContent = "";
this.title = "clipboard.txt";
this.$modal.hide("paste-ascii-modal");
},
importPasteAscii() {
parseMircAscii(this.pasteContent, this.title);
this.close()
parseMircAscii(this.pasteContent, this.title);
this.close();
},
},
};

View File

@ -2,7 +2,10 @@ import Vue from 'vue';
import Vuex from 'vuex';
import VuexPersistence from 'vuex-persist';
import LZString from 'lz-string';
import { blockWidth, blockHeight } from "../ascii";
import {
blockWidth,
blockHeight
} from "../ascii";
Vue.use(Vuex);
const vuexLocal = new VuexPersistence({
@ -220,7 +223,8 @@ export default new Vuex.Store({
getChar: (state) => state.toolbarState.selectedChar,
currentTab: (state) => state.tab,
currentAscii: (state) => state.asciibirdMeta[state.tab] ?? false,
currentAsciiBlocks: (state) => JSON.parse(LZString.decompressFromUTF16(state.asciibirdMeta[state.tab].blocks)) || [],
currentAsciiBlocks: (state) => JSON.parse(LZString.decompressFromUTF16(state.asciibirdMeta[
state.tab].blocks)) || [],
asciibirdMeta: (state) => state.asciibirdMeta,
nextTabValue: (state) => state.asciibirdMeta.length,
brushSizeHeight: (state) => state.toolbarState.brushSizeHeight,
@ -230,11 +234,11 @@ export default new Vuex.Store({
brushBlocks: (state) => JSON.parse(LZString.decompressFromUTF16(state.brushBlocks)) || [],
selectBlocks: (state) => JSON.parse(LZString.decompressFromUTF16(state.selectBlocks)) || [],
isModalOpen: (state) => {
for (const modalState in state.modalState) {
if (state.modalState[modalState] === true)
return true
}
return false
for (const modalState in state.modalState) {
if (state.modalState[modalState] === true)
return true
}
return false
},
},
actions: {},