Add Windows save instructions UI and fix URL #296

- Add Windows instruction dialog when saving scripts for Windows.
- Fix incorrect macOS download URL given for Linux instructions.
- Refactor UI rendering, eleminating the use of `v-html` and JavaScript
  variables to hold HTML code.
This commit is contained in:
undergroundwires
2024-01-15 22:38:39 +01:00
parent e09db0f1bd
commit 756c736e21
24 changed files with 705 additions and 537 deletions

View File

@@ -5,8 +5,8 @@
:icon-name="isRunningAsDesktopApplication ? 'floppy-disk' : 'file-arrow-down'"
@click="saveCode"
/>
<ModalDialog v-if="instructions" v-model="areInstructionsVisible">
<InstructionList :data="instructions" />
<ModalDialog v-model="areInstructionsVisible">
<RunInstructions :filename="filename" />
</ModalDialog>
</div>
</template>
@@ -22,14 +22,12 @@ import { IScriptingDefinition } from '@/domain/IScriptingDefinition';
import { ScriptFilename } from '@/application/CodeRunner/ScriptFilename';
import { Dialog, FileType } from '@/presentation/common/Dialog';
import IconButton from '../IconButton.vue';
import InstructionList from './Instructions/InstructionList.vue';
import { IInstructionListData } from './Instructions/InstructionListData';
import { getInstructions } from './Instructions/InstructionListDataFactory';
import RunInstructions from './RunInstructions/RunInstructions.vue';
export default defineComponent({
components: {
IconButton,
InstructionList,
RunInstructions,
ModalDialog,
},
setup() {
@@ -39,10 +37,6 @@ export default defineComponent({
const areInstructionsVisible = ref(false);
const filename = computed<string>(() => buildFilename(currentState.value.collection.scripting));
const instructions = computed<IInstructionListData | undefined>(() => getInstructions(
currentState.value.collection.os,
filename.value,
));
async function saveCode() {
const { success, error } = await dialog.saveFile(
@@ -59,8 +53,8 @@ export default defineComponent({
return {
isRunningAsDesktopApplication,
instructions,
areInstructionsVisible,
filename,
saveCode,
};
},