Create mode + Source view + UI enhancements

This commit is contained in:
NGPixel
2016-08-29 22:19:47 -04:00
parent 0f06ab6dc8
commit 16f300f0d5
27 changed files with 437 additions and 84 deletions

16
client/js/helpers/form.js Normal file
View File

@@ -0,0 +1,16 @@
function setInputSelection(input, startPos, endPos) {
input.focus();
if (typeof input.selectionStart != "undefined") {
input.selectionStart = startPos;
input.selectionEnd = endPos;
} else if (document.selection && document.selection.createRange) {
// IE branch
input.select();
var range = document.selection.createRange();
range.collapse(true);
range.moveEnd("character", endPos);
range.moveStart("character", startPos);
range.select();
}
}

View File

@@ -0,0 +1,11 @@
function makeSafePath(rawPath) {
let rawParts = _.split(_.trim(rawPath), '/');
rawParts = _.map(rawParts, (r) => {
return _.kebabCase(_.deburr(_.trim(r)));
});
return _.join(_.filter(rawParts, (r) => { return !_.isEmpty(r); }), '/');
}