diff --git a/assets/public/css/styles.css b/assets/public/css/styles.css
index 8a609465..474575d6 100644
--- a/assets/public/css/styles.css
+++ b/assets/public/css/styles.css
@@ -99,10 +99,10 @@ button, input {
button, select {
text-transform: none
}
-button, html [type="button"], [type="reset"], [type="submit"] {
- -webkit-appearance: button;
+button, .button, html [type="button"], [type="reset"], [type="submit"] {
+ /* -webkit-appearance: button; */
text-decoration: none;
- color: #fff;
+ color: #fff !important;
background-color: #26a69a;
text-align: center;
letter-spacing: .5px;
@@ -121,11 +121,11 @@ button, html [type="button"], [type="reset"], [type="submit"] {
vertical-align: middle;
-webkit-tap-highlight-color: transparent;
}
-button::-moz-focus-inner, [type="button"]::-moz-focus-inner, [type="reset"]::-moz-focus-inner, [type="submit"]::-moz-focus-inner {
+button::-moz-focus-inner,.button::-moz-focus-inner, . [type="button"]::-moz-focus-inner, [type="reset"]::-moz-focus-inner, [type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0
}
-button:-moz-focusring, [type="button"]:-moz-focusring, [type="reset"]:-moz-focusring, [type="submit"]:-moz-focusring {
+button:-moz-focusring, .button:-moz-focusring,, [type="button"]:-moz-focusring, [type="reset"]:-moz-focusring, [type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText
}
fieldset {
@@ -380,21 +380,21 @@ header form input {
outline: 0;
background-color: transparent;
}
-::-webkit-input-placeholder {
+header form::-webkit-input-placeholder {
/* WebKit, Blink, Edge */
color: rgba(255, 255, 255, .5);
}
-:-moz-placeholder {
+header form:-moz-placeholder {
opacity: 1;
/* Mozilla Firefox 4 to 18 */
color: rgba(255, 255, 255, .5);
}
-::-moz-placeholder {
+header form::-moz-placeholder {
opacity: 1;
/* Mozilla Firefox 19+ */
color: rgba(255, 255, 255, .5);
}
-:-ms-input-placeholder {
+header form:-ms-input-placeholder {
/* Internet Explorer 10-11 */
color: rgba(255, 255, 255, .5);
}
@@ -507,20 +507,13 @@ header form input {
position: relative;
}
#listing .item .checkbox {
-
-position: absolute;
-
-top: 0;
-
-right: 0;
-
-border-radius: 50%;
-
-background: #000;
-
-border: 0;
-
--webkit-appearance: initial;
+ position: absolute;
+ top: 0;
+ right: 0;
+ border-radius: 50%;
+ background: #000;
+ border: 0;
+ -webkit-appearance: initial;
}
.item:hover {
box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .24) !important;
@@ -655,17 +648,27 @@ i.spin {
display: none;
}
#editor fieldset fieldset {
- margin-left: 1em;
+ margin-left: 1em;
}
#editor #submit span {
- vertical-align: middle;
- transition: 0.2s ease-in-out all;
+ vertical-align: middle;
+ transition: 0.2s ease-in-out all;
}
#editor #submit span i {
-
-vertical-align: sub;
-
-font-size: 1.3rem;
-
-margin-right: .2em;
+ vertical-align: sub;
+ font-size: 1.3rem;
+ margin-right: .2em;
+}
+#editor .group.temp {
+ background-color: #f5f5f5;
+}
+#editor .group.temp label {
+ font-weight: lighter;
+ font-size: .8em;
+ margin-bottom: 1em;
+ color: #7d7d7d;
+}
+
+#editor .group.temp input {
+ color: #212121;
}
diff --git a/assets/public/js/application.js b/assets/public/js/application.js
index 9e0a2d78..be19c825 100644
--- a/assets/public/js/application.js
+++ b/assets/public/js/application.js
@@ -379,6 +379,11 @@ document.addEventListener("DOMContentLoaded", function (event) {
});
document.getElementById("open").addEventListener("click", openEvent);
+ document.addEventListener('keydown', (event) => {
+ if (event.keyCode == 27) {
+ backEvent(event);
+ }
+ });
if (document.getElementById("back")) {
document.getElementById("back").addEventListener("click", backEvent)
};
@@ -517,9 +522,9 @@ const tempID = "_fm_internal_temporary_id"
var addFrontMatterItem = function(event) {
event.preventDefault();
- let newItem = document.getElementById(tempID)
- if (newItem) {
- newItem.remove();
+ let temp = document.getElementById(tempID)
+ if (temp) {
+ temp.remove();
}
let block = this.parentNode;
@@ -536,110 +541,102 @@ var addFrontMatterItem = function(event) {
block.querySelector('.group').insertAdjacentHTML('beforeend', `
-
`);
+
+ document.getElementById(`${fieldID}-${count}`).querySelector('input').focus();
+ document.querySelector(`div[data-delete="${fieldID}-${count}"]`).addEventListener('click', deleteFrontMatterItem);
}
+ if (type == "object" || type == "parent") {
+ let template = `
`;
+ if (type == "parent") {
+ document.querySelector('div.button.add').insertAdjacentHTML('beforebegin', template);
+ } else {
+ block.querySelector('.delete').insertAdjacentHTML('afterend', template);
+ }
-
- /*
-
-
- // Main add button, after all blocks
- if (block.is('div') && block.hasClass("frontmatter")) {
- block = $('.blocks');
- blockType = "object";
- }
-
- // If the Block is an object
- if (blockType == "object") {
- block.append('
');
-
- newItem = $("#" + defaultID);
- newItem.html('
');
- field = $("#name-" + defaultID);
-
- // Show a notification with some information for newbies
- if (!document.cookie.replace(/(?:(?:^|.*;\s*)placeholdertip\s*\=\s*([^;]*).*$)|^.*$/, "$1")) {
- var date = new Date();
- date.setDate(date.getDate() + 365);
- document.cookie = 'placeholdertip=true; expires=' + date.toUTCString + '; path=/';
-
- notification({
- text: 'Write the field name and then press enter. If you want to create an array or an object, end the name with ":array" or ":object".',
- type: 'information'
- });
- }
-
- $(field).keypress(function(event) {
- // When you press enter within the new name field:
- if (event.which == 13) {
- event.preventDefault();
- // This var should have a value of the type "name[:array, :object]"
- value = field.val();
-
- if (value == "") {
- newItem.remove();
- return false;
- }
-
- elements = value.split(":")
-
- if (elements.length > 2) {
- notification({
- text: "Invalid syntax. It must be 'name[:type]'.",
- type: 'error'
- });
- return false;
- }
-
- if (elements.length == 2 && elements[1] != "array" && elements[1] != "object") {
- notification({
- text: "Only arrays and objects are allowed.",
- type: 'error'
- });
- return false;
- }
-
- field.remove();
-
- if (typeof blockID === "undefined") {
- blockID = elements[0];
- } else {
- blockID = blockID + '[' + elements[0] + ']';
- }
-
- if (elements.length == 1) {
- newItem.attr('id', 'block-' + blockID);
- newItem.append('
');
- newItem.prepend('
');
- } else {
- type = "";
-
- if (elements[1] == "array") {
- type = "array";
- } else {
- type = "object"
+ let temp = document.getElementById(tempID);
+ let input = temp.querySelector('input');
+ input.focus();
+ input.addEventListener('keydown', (event) => {
+ if (event.keyCode == 27) {
+ event.preventDefault();
+ temp.remove();
}
- template = "
"
- template = template.replace("${blockID}", blockID);
- template = template.replace("${elements[0]}", elements[0]);
- template = template.replace("${type}", type);
- newItem.after(template);
- newItem.remove();
- }
+ if (event.keyCode == 13) {
+ event.preventDefault();
- return false;
- }
- });
+ let value = input.value;
+ if (value === '') {
+ temp.remove();
+ return true;
+ }
+
+ let name = value.substring(0, value.lastIndexOf(':'));
+ let newtype = value.substring(value.lastIndexOf(':') + 1, value.length);
+ if (newtype !== "" && newtype !== "array" && newtype !== "object") {
+ name = value;
+ }
+
+ name = name.replace(' ', '_');
+
+ let bid = name;
+ if (id != '') {
+ bid = id + "." + bid;
+ }
+
+ temp.remove();
+
+ switch (newtype) {
+ case "array":
+ case "object":
+ let template = `
`;
+
+ if (type == "parent") {
+ document.querySelector('div.button.add').insertAdjacentHTML('beforebegin', template);
+ } else {
+ block.insertAdjacentHTML('beforeend', template);
+ }
+
+ document.querySelector(`div[data-delete="${bid}"]`).addEventListener('click', deleteFrontMatterItem);
+ document.getElementById(bid).querySelector('.action.add').addEventListener('click', addFrontMatterItem);
+ break;
+ default:
+ block.querySelector('.group').insertAdjacentHTML('beforeend', `
+
+
+
+ close
+
+
`);
+
+ document.getElementById(bid).focus();
+ document.querySelector(`div[data-delete="block-${bid}"]`).addEventListener('click', deleteFrontMatterItem);
+ }
+ }
+ });
}
- return false;
- */
+
return false;
}
diff --git a/assets/templates/base.tmpl b/assets/templates/base.tmpl
index f2f3656c..229a670e 100644
--- a/assets/templates/base.tmpl
+++ b/assets/templates/base.tmpl
@@ -32,10 +32,10 @@