fix add bug
fixed the bug that didn't allow to add new items to objects
This commit is contained in:
parent
a098d0e448
commit
984a57b0b3
File diff suppressed because one or more lines are too long
|
@ -143,6 +143,11 @@ $(document).on('page:editor', function() {
|
||||||
block.append('<div id="' + newID + '-' + $('#' + input + ' > div').length + '" data-type="array-item"><input name="' + newID + ':auto" id="' + newID + '"></input><span class="actions"> <button class="delete">−</button></span></div></div>');
|
block.append('<div id="' + newID + '-' + $('#' + input + ' > div').length + '" data-type="array-item"><input name="' + newID + ':auto" id="' + newID + '"></input><span class="actions"> <button class="delete">−</button></span></div></div>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (blockType == "object" && !block.hasClass("frontmatter")) {
|
||||||
|
block.append('<div class="block" id="' + defaultID + '"></div>');
|
||||||
|
blockType = "object";
|
||||||
|
}
|
||||||
|
|
||||||
// If the Block is an object
|
// If the Block is an object
|
||||||
if (blockType == "object") {
|
if (blockType == "object") {
|
||||||
newItem = $("#" + defaultID);
|
newItem = $("#" + defaultID);
|
||||||
|
@ -162,6 +167,7 @@ $(document).on('page:editor', function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$(field).keypress(function(event) {
|
$(field).keypress(function(event) {
|
||||||
|
console.log('got it');
|
||||||
// When you press enter within the new name field:
|
// When you press enter within the new name field:
|
||||||
if (event.which == 13) {
|
if (event.which == 13) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -193,8 +199,6 @@ $(document).on('page:editor', function() {
|
||||||
|
|
||||||
field.remove();
|
field.remove();
|
||||||
|
|
||||||
// TODO: continue here. :) 04/02/2016
|
|
||||||
|
|
||||||
if (typeof blockID === "undefined") {
|
if (typeof blockID === "undefined") {
|
||||||
blockID = elements[0];
|
blockID = elements[0];
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue