Skip to content

Commit

Permalink
Merge pull request #11 from thedarkvessle/master
Browse files Browse the repository at this point in the history
QOL Patches
  • Loading branch information
zetoken authored Jul 11, 2020
2 parents 8061b7c + 9ec8ff7 commit 7d571ac
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 19 deletions.
36 changes: 17 additions & 19 deletions Json Editor/Forms/JsonEditorMainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Json Editor/Forms/JsonEditorMainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public JsonEditorMainForm()
OpenedFileName = null;
}
}
//auto create empty object
newJsonObjectToolStripMenuItem_Click(this, null);

}

#endregion
Expand Down Expand Up @@ -301,6 +304,10 @@ private void JsonValidationTimerHandler()
try
{
jTokenTree.UpdateSelected(jsonValueTextBox.Text);
//reformat json to be pretty
jsonValueTextBox.Text = JsonConvert.SerializeObject(
JsonConvert.DeserializeObject(jsonValueTextBox.Text),
Formatting.Indented);

SetJsonStatus("Json format validated.", false);
}
Expand All @@ -315,5 +322,15 @@ private void JsonValidationTimerHandler()
SetJsonStatus("INVALID Json format", true);
}
}

private void jsonValueTextBox_KeyDown(object sender, KeyEventArgs e)
{
//remove styles from richtextbox
if (e.Control && e.KeyCode == Keys.V)
{
((RichTextBox)sender).Paste(DataFormats.GetFormat("Text"));
e.Handled = true;
}
}
}
}

0 comments on commit 7d571ac

Please sign in to comment.