diff --git a/assets/public/css/styles.css b/assets/public/css/styles.css index e79d5785..7fcd44e8 100644 --- a/assets/public/css/styles.css +++ b/assets/public/css/styles.css @@ -637,3 +637,6 @@ i.spin { #editor textarea[name="content"] { display: none; } +#editor fieldset fieldset { + margin-left: 1em; +} diff --git a/assets/public/js/application.js b/assets/public/js/application.js index b1758541..555dba61 100644 --- a/assets/public/js/application.js +++ b/assets/public/js/application.js @@ -477,8 +477,135 @@ var handleEditorPage = function () { }); } + let deleteFrontMatterItemButtons = document.getElementsByClassName('delete'); + Array.from(deleteFrontMatterItemButtons).forEach(button => { + button.addEventListener('click', deleteFrontMatterItem); + }); return false; } + +var deleteFrontMatterItem = function(event) { + event.preventDefault(); + document.getElementById(this.dataset.delete).remove(); +} + +var addFrontMatterItem = function(event) { + /* + event.preventDefault(); + defaultID = "lorem-ipsum-sin-dolor-amet"; + + // Remove if there is an incomplete new item + newItem = $("#" + defaultID); + if (newItem.length) { + newItem.remove(); + } + + block = $(this).parent().parent(); + blockType = block.data("type"); + blockID = block.attr("id"); + + // If the Block Type is an array + if (blockType == "array") { + newID = blockID + "[]"; + input = blockID; + input = input.replace(/\[/, '\\['); + input = input.replace(/\]/, '\\]'); + block.append('