Fixed #259: when having a JSONEditor inside an HTML form, clicking an entry in the context menu did submit the form
This commit is contained in:
parent
f4492de1ca
commit
ec2511793a
|
@ -7,6 +7,8 @@ https://github.com/josdejong/jsoneditor
|
||||||
|
|
||||||
- Improvements in sanitizing invalid JSON.
|
- Improvements in sanitizing invalid JSON.
|
||||||
- Fixed clicking format/compact not triggering an onChange event.
|
- Fixed clicking format/compact not triggering an onChange event.
|
||||||
|
- Fixed #259: when having a JSONEditor inside an HTML form, clicking an entry
|
||||||
|
in the context menu did submit the form.
|
||||||
|
|
||||||
|
|
||||||
## 2016-01-16, version 5.1.1
|
## 2016-01-16, version 5.1.1
|
||||||
|
|
|
@ -73,6 +73,7 @@ function ContextMenu (items, options) {
|
||||||
}
|
}
|
||||||
if (item.click) {
|
if (item.click) {
|
||||||
button.onclick = function () {
|
button.onclick = function () {
|
||||||
|
event.preventDefault();
|
||||||
me.hide();
|
me.hide();
|
||||||
item.click();
|
item.click();
|
||||||
};
|
};
|
||||||
|
@ -113,7 +114,8 @@ function ContextMenu (items, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// attach a handler to expand/collapse the submenu
|
// attach a handler to expand/collapse the submenu
|
||||||
buttonSubmenu.onclick = function () {
|
buttonSubmenu.onclick = function (event) {
|
||||||
|
event.preventDefault();
|
||||||
me._onExpandItem(domItem);
|
me._onExpandItem(domItem);
|
||||||
buttonSubmenu.focus();
|
buttonSubmenu.focus();
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,7 +33,9 @@
|
||||||
<code>editor.setMode(mode)</code>, try it in the console of your browser.
|
<code>editor.setMode(mode)</code>, try it in the console of your browser.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div id="jsoneditor"></div>
|
<form>
|
||||||
|
<div id="jsoneditor"></div>
|
||||||
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var container, options, json, editor;
|
var container, options, json, editor;
|
||||||
|
|
Loading…
Reference in New Issue