Skip to content

Commit

Permalink
v0.12.1
Browse files Browse the repository at this point in the history
- fixed auto-completion error which occurred rarely
- refactored JSON renderer
- bridge. prediction improvements
  • Loading branch information
solvedDev committed Apr 13, 2019
1 parent 8f653e4 commit d58f65b
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 38 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bridge",
"productName": "bridge.",
"version": "0.12.0",
"version": "0.12.1",
"author": "solvedDev <[email protected]>",
"description": "A powerful add-on editor",
"license": null,
Expand Down
26 changes: 2 additions & 24 deletions src/renderer/components/editor_shell/JsonEditor/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
v-for="e in render_object.children"
:key="e.uuid"
:ref="`${object_key}/${(e.key + '').replace(/\//g, '#;slash;#')}`"
:open="e.open"
>
<object-key
@mainClick="click($event, `load(${tab_id}):${object_key}/${e.key}`, e.key)"
Expand All @@ -21,7 +22,6 @@
/>

<json-editor-main
:uuid="uuid"
:glob_object="first ? render_object : glob_object"
:object="e"
:first="false"
Expand Down Expand Up @@ -102,7 +102,6 @@
type: Boolean
},
tab_id: Number,
uuid: String,
object_key: {
type: String,
default: "global"
Expand All @@ -113,11 +112,6 @@
}
},
mounted() {
//console.log("Listening: " + `load(${this.tab_id}):${this.object_key}`);
this.$root.$on(`load(${this.tab_id}):${this.object_key}`, () => {
this.open = true;
});
if(this.first) {
EventBus.on("updateFileNavigation", () => {
this.file_navigation = TabSystem.getCurrentNavigation();
Expand All @@ -130,17 +124,9 @@
this.$nextTick(() => this.openAllChildren());
else
this.$store.commit("removeLoadingWindow", { id: "open-file" });
}
if(!this.first && this.render_object.open) {
this.open = true;
this.$parent.$refs[this.object_key][0].open = true;
this.$root.$emit(`load(${this.tab_id}):${this.object_key}`, true);
}
}
},
beforeDestroy() {
this.$root.$off(`load(${this.tab_id}):${this.object_key}`);
if(this.first) {
EventBus.off("updateFileNavigation");
EventBus.off("updateCurrentContent");
Expand Down Expand Up @@ -231,14 +217,6 @@
isKnownFileType() {
return FileType.get() !== "unknown";
}
},
watch: {
render_object(new_val, prev_val) {
if(new_val && prev_val && new_val.open && new_val.open != prev_val.open) {
this.$root.$emit(`load(${this.tab_id}:)${this.object_key}`, true);
if(this.object_key != "global") this.$parent.$refs[this.object_key][0].open = true;
}
}
}
}
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@
dense
class="json-input-menu"
></v-combobox>
<v-btn @click="click">
+

<v-btn @click="click(null, 'object')">
<v-icon>mdi-code-braces</v-icon>
</v-btn>
<v-tooltip bottom>
<v-btn slot="activator" @click="click(null, 'value')">
<v-icon>mdi-format-quote-close</v-icon>
</v-btn>
<span>Shift + Enter</span>
</v-tooltip>
</v-layout>
</v-flex>
</template>
Expand Down Expand Up @@ -67,19 +74,25 @@
}
},
methods: {
click() {
if(this.value == "" || this.value === undefined) return;
let current = this.render_object.get(this.file_navigation);
let is_data_path = TabSystem.getSelected().content.isDataPath(this.file_navigation);
click(event, force) {
if(this.value === "" || this.value === undefined || this.value === null) return;
if(force !== undefined)
this.mode = force;
else if(event !== null && event.shiftKey)
this.mode = "value";
let current = this.render_object.get(this.file_navigation);
if(this.mode === "object") {
let node = new JSONTree(this.value + "");
current.add(node, true).openNode();
EventBus.trigger("setWatcherInactive");
current.add(node, true);
current.type = "object";
current.openNode();
this.expandPath(this.value);
} else if(this.file_navigation !== "global" && this.mode === "value") {
TabSystem.getHistory().add(new JSONAction("edit-data", current, current.data));
current.edit(this.value + "");
current.type = typeof this.value;
this.navigationBack();
Expand All @@ -91,7 +104,7 @@
}
TabSystem.setCurrentUnsaved();
EventBus.trigger("updateCurrentContent");
// EventBus.trigger("updateCurrentContent");
this.$nextTick(() => {
this.value = "";
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/scripts/constants/app_version.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
* Version number is in a dedicated file because it's also used by the main thread.
* Otherwise, any changes to the main constant file would completely restart "bridge." (in development mode).
*/
export default "v0.12.0";
export default "v0.12.1";
2 changes: 1 addition & 1 deletion src/renderer/scripts/editor/JsonTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export default class JSONTree {
*/
add(child, update_history=false) {
this.updateUUID();

if(!this.is_array) {
for(let c of this.children) {
if(c.parsed_key == child.parsed_key) return c;
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/scripts/editor/autoCompletions.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ let LIB = {
try {
return Object.keys(TabSystem.getSelected().content.get("minecraft:entity/events").toJSON());
} catch(e) {
console.log(e);
return [];
}
},
Expand Down Expand Up @@ -223,7 +224,7 @@ class Provider {

if(typeof current[key] === "string") {
let o = this.omegaExpression(current[key], null, null, false);
if(!current[key].startsWith("$dynamic."))
if(typeof current !== "string" && !current[key].startsWith("$dynamic."))
current[key] = o;
else
return this.walk(path_arr, o);
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/store/data/settings
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"is_dev_mode":false,"is_dark_mode":true,"inversed_arrows":false,"use_tabs":true,"line_wraps":false,"auto_completions":true,"auto_fill_inputs":true,"open_all_nodes":false,"default_project":"Tests","target_version":"v1.11","snippet_scope":"Default","when_error":"On File Change","error_icon_indicator":true,"error_auto_fix":true,"custom_snippets":[],"focus_json_inputs":false,"cade_node_click":false,"auto_scroll_json":false,"bridge_predictions":true}
{"is_dev_mode":false,"is_dark_mode":true,"inversed_arrows":false,"use_tabs":true,"line_wraps":false,"auto_completions":true,"auto_fill_inputs":true,"open_all_nodes":false,"default_project":"Tests","target_version":"v1.11","snippet_scope":"Default","when_error":"On File Change","error_icon_indicator":true,"error_auto_fix":true,"custom_snippets":[],"focus_json_inputs":false,"cade_node_click":false,"auto_scroll_json":false,"bridge_predictions":false}

0 comments on commit d58f65b

Please sign in to comment.