Skip to content

Commit 02a74b0

Browse files
authored
Merge pull request #39 from SpringRoll/release/1.1.0
Release/1.1.0
2 parents 9067ba6 + 108724a commit 02a74b0

File tree

6 files changed

+71
-13
lines changed

6 files changed

+71
-13
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.1.0] - 2021-08-16
8+
### Added
9+
- JSON Editor mode switch. Allows toggling between 'code' and 'form' modes, for better usability.
10+
### Fixed
11+
- Overflow: scroll causing 3-4 scroll bar regions to show up when unecessary
12+
- Fixed styles for caption preview next/previous buttons so they properly show up side by side
13+
714
## [1.0.0] - 2020-03-31
815
### Added
916
- Unit tests added for caption studio components and classes
17+
1018
### Changed
1119
- Caption Studio now reads audio files directly from project root, or user specified audio directory
1220
- Caption studio now allows for saving/opening caption JSON files directly from projects

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "springroll-studio",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"private": true,
55
"scripts": {
66
"test": "npm run lint && npm run unit:renderer",
@@ -88,4 +88,4 @@
8888
"last 2 versions",
8989
"not dead"
9090
]
91-
}
91+
}

src/renderer/App.vue

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ html {
2525
html, body, #app {
2626
width: 100%;
2727
height: 100%;
28-
overflow: scroll;
2928
}
3029
3130
#app {

src/renderer/class/CaptionManager.js

+4
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ class CaptionManager {
7474
store.dispatch('setIsUnsavedChanges', { isUnsavedChanges: true });
7575
}
7676

77+
// reset the data obect everytime the JSON updates rather than just update the captions that need it
78+
// because otherwise when the editor is in "code" mode, any deletions will get overwritten
79+
this.data = {};
80+
7781
Object.keys($event).forEach((key) => {
7882
$event[key].forEach((caption, index) => {
7983

src/renderer/components/caption-studio/CaptionPreview.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<v-btn
77
color="accent"
88
class="font-semi-bold font-16 capitalize"
9-
:block="true"
109
:disabled="atStart"
1110
@click="prev"
1211
>
@@ -15,7 +14,7 @@
1514
<v-btn
1615
color="accent"
1716
class="font-semi-bold font-16 capitalize"
18-
:block="true"
17+
1918
:disabled="atEnd"
2019
@click="next"
2120
>
@@ -117,6 +116,10 @@ export default {
117116
}
118117
this.data = $event;
119118
this.captionPlayer.captions = CaptionFactory.createCaptionMap($event);
119+
120+
if (!this.name) {
121+
return;
122+
}
120123
this.captionPlayer.start(
121124
this.name,
122125
this.data[this.name][this.index].start
@@ -175,6 +178,7 @@ export default {
175178
.v-btn {
176179
border-radius: 0;
177180
margin: 0 0.09rem;
181+
width: 50%;
178182
}
179183
}
180184
}

src/renderer/components/caption-studio/JsonPreview.vue

+51-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="json">
33
<v-jsoneditor ref="jsonEditor" class="json__editor" :options="options" :plus="false" height="446px" />
4-
<div class="json__button-group">
4+
<div class="json__button-group" :class="{'--code': currentMode === 'code'}">
55
<v-dialog v-model="saveErrorDialog" width="500">
66
<v-card>
77
<v-card-title class="error" primary-title>
@@ -83,10 +83,12 @@ export default {
8383
origin: 'JsonPreview',
8484
activeFile: '',
8585
fileNameMap: {},
86+
currentMode: 'form',
8687
options: {
87-
onChangeJSON: this.onEdit,
88-
mode: 'form',
89-
onEvent: this.onEvent
88+
onChangeText: this.onEdit,
89+
modes: [ 'form', 'code' ],
90+
onEvent: this.onEvent,
91+
onModeChange: this.onModeChange,
9092
},
9193
};
9294
},
@@ -143,11 +145,27 @@ export default {
143145
* Handles JSON Editor changes
144146
*/
145147
onEdit($event) {
146-
this.checkErrors($event, this.origin);
148+
let parsed;
149+
150+
//the code will work without this block, but the console.errors will fill up the console
151+
try {
152+
parsed = JSON.parse($event);
153+
} catch {
154+
return;
155+
}
156+
157+
this.checkErrors(parsed, this.origin);
158+
147159
if (this.jsonErrors) {
148160
return;
149161
}
150-
EventBus.$emit('json_update', $event, this.origin);
162+
EventBus.$emit('json_update', parsed, this.origin);
163+
},
164+
/**
165+
* handles JSON viewer mode change (text or form)
166+
*/
167+
onModeChange(newMode) {
168+
this.currentMode = newMode;
151169
},
152170
/**
153171
* Handles the save caption event from app menu or keyboard shortcut
@@ -207,6 +225,10 @@ export default {
207225
const index = node.path[1];
208226
const indexDelta = index - this.currentIndex;
209227
228+
if (this.currentIndex === index) {
229+
return;
230+
}
231+
210232
if (this.activeFile === node.path[0]) {
211233
EventBus.$emit('caption_move_index', indexDelta, this.origin);
212234
return;
@@ -320,6 +342,10 @@ export default {
320342
321343
const file = json[key];
322344
345+
if (!file) {
346+
return;
347+
}
348+
323349
if (!Array.isArray(file)) {
324350
return;
325351
}
@@ -376,6 +402,20 @@ $menu-height: 5.6rem;
376402
&__editor {
377403
width: 100%;
378404
}
405+
.jsoneditor-contextmenu {
406+
.jsoneditor-menu {
407+
border-radius: 10px;
408+
color: white;
409+
410+
button {
411+
color: $white;
412+
413+
&:hover {
414+
color: $black;
415+
}
416+
}
417+
}
418+
}
379419
380420
.jsoneditor-menu {
381421
background-color: $accent;
@@ -404,8 +444,6 @@ $menu-height: 5.6rem;
404444
}
405445
406446
&__errors {
407-
position: relative;
408-
top: 2.25rem;
409447
color: red;
410448
}
411449
@@ -428,10 +466,15 @@ $menu-height: 5.6rem;
428466
&-group {
429467
display: flex;
430468
width: 100%;
469+
margin-top: 2.2rem;
431470
min-height: 3.6rem;
432471
align-items: center;
433472
border-radius: 2rem;
434473
474+
&.--code {
475+
margin-top: 5.2rem;
476+
}
477+
435478
&>* {
436479
width: 50%;
437480
}

0 commit comments

Comments
 (0)