diff --git a/src/components/Explorer.vue b/src/components/Explorer.vue
index d8cde861..c2e3bd47 100644
--- a/src/components/Explorer.vue
+++ b/src/components/Explorer.vue
@@ -48,7 +48,7 @@ export default {
newItem(isFolder) {
let parentId = this.$store.getters['explorer/selectedNodeFolder'].item.id;
if (parentId === 'trash') {
- parentId = undefined;
+ parentId = null;
}
this.$store.dispatch('explorer/openNode', parentId);
this.$store.commit('explorer/setNewItem', {
@@ -92,6 +92,7 @@ export default {
id: selectedNode.item.id,
parentId: 'trash',
});
+ this.$store.commit('file/setCurrentId', this.$store.getters['data/lastOpenedIds'][1]);
}
}
});
diff --git a/src/components/ExplorerNode.vue b/src/components/ExplorerNode.vue
index 4d07331e..6f0abc45 100644
--- a/src/components/ExplorerNode.vue
+++ b/src/components/ExplorerNode.vue
@@ -58,7 +58,7 @@ export default {
return this.$store.state.explorer.newChildNode.item.name;
},
set(value) {
- this.$store.commit('explorer/setNewItemName', value && value.slice(0, 250));
+ this.$store.commit('explorer/setNewItemName', value);
},
},
editingNodeName: {
@@ -91,28 +91,18 @@ export default {
submitNewChild(cancel) {
const newChildNode = this.$store.state.explorer.newChildNode;
if (!cancel && !newChildNode.isNil && newChildNode.item.name) {
- const id = utils.uid();
if (newChildNode.isFolder) {
+ const id = utils.uid();
this.$store.commit('folder/setItem', {
...newChildNode.item,
id,
+ name: utils.sanitizeName(newChildNode.item.name),
});
+ this.select(id);
} else {
- // Add empty line at the end if needed
- const ensureFinalNewLine = text => `${text}\n`.replace(/\n\n$/, '\n');
- const text = ensureFinalNewLine(this.$store.getters['data/computedSettings'].newFileContent);
- const properties = ensureFinalNewLine(this.$store.getters['data/computedSettings'].newFileProperties);
- this.$store.commit('content/setItem', {
- id: `${id}/content`,
- text,
- properties,
- });
- this.$store.commit('file/setItem', {
- ...newChildNode.item,
- id,
- });
+ this.$store.dispatch('createFile', newChildNode.item)
+ .then(file => this.select(file.id));
}
- this.select(id);
}
this.$store.commit('explorer/setNewItem', null);
},
@@ -123,7 +113,7 @@ export default {
if (!cancel && id && value) {
this.$store.commit(editingNode.isFolder ? 'folder/patchItem' : 'file/patchItem', {
id,
- name: value.slice(0, 250),
+ name: utils.sanitizeName(value),
});
}
this.$store.commit('explorer/setEditingId', null);
diff --git a/src/components/NavigationBar.vue b/src/components/NavigationBar.vue
index 65a0e7db..3b0f3c66 100644
--- a/src/components/NavigationBar.vue
+++ b/src/components/NavigationBar.vue
@@ -80,6 +80,7 @@ import editorSvc from '../services/editorSvc';
import syncSvc from '../services/syncSvc';
import publishSvc from '../services/publishSvc';
import animationSvc from '../services/animationSvc';
+import utils from '../services/utils';
export default {
data: () => ({
@@ -171,7 +172,7 @@ export default {
} else {
const title = this.title.trim();
if (title) {
- this.$store.dispatch('file/patchCurrent', { name: title.slice(0, 250) });
+ this.$store.dispatch('file/patchCurrent', { name: utils.sanitizeName(title) });
} else {
this.title = this.$store.getters['file/current'].name;
}
@@ -342,9 +343,7 @@ export default {
}
.navigation-bar__title--input,
-.navigation-bar__inner--edit-buttons,
-.navigation-bar__inner--button,
-.navigation-bar__spinner {
+.navigation-bar__inner--edit-buttons {
display: none;
.navigation-bar--editor & {
@@ -355,6 +354,7 @@ export default {
.navigation-bar__button {
display: none;
+ .navigation-bar__inner--button &,
.navigation-bar--editor & {
display: inline-block;
}
@@ -374,13 +374,13 @@ $b: $d/10;
$t: 3000ms;
.navigation-bar__spinner {
- width: 22px;
+ width: 24px;
margin: 7px 0 0 8px;
color: #b2b2b2;
.icon {
- width: 22px;
- height: 22px;
+ width: 24px;
+ height: 24px;
color: transparentize($error-color, 0.5);
}
}
diff --git a/src/components/SplashScreen.vue b/src/components/SplashScreen.vue
index ea3c5408..b1ecd09e 100644
--- a/src/components/SplashScreen.vue
+++ b/src/components/SplashScreen.vue
@@ -1,6 +1,6 @@