@@ -57,6 +59,7 @@ import editorSvc from '../services/editorSvc';
import syncSvc from '../services/syncSvc';
import publishSvc from '../services/publishSvc';
import animationSvc from '../services/animationSvc';
+import tempFileSvc from '../services/tempFileSvc';
import utils from '../services/utils';
export default {
@@ -68,6 +71,7 @@ export default {
}),
computed: {
...mapState([
+ 'light',
'offline',
]),
...mapState('queue', [
@@ -178,9 +182,12 @@ export default {
}
this.titleInputElt.blur();
},
+ close() {
+ tempFileSvc.close();
+ },
},
created() {
- this.$store.watch(
+ this.$watch(
() => this.$store.getters['file/current'].name,
(name) => {
this.title = name;
@@ -255,6 +262,7 @@ $button-size: 36px;
.navigation-bar__button {
width: $button-size;
padding: 0 8px;
+ transition: opacity 0.25s;
.navigation-bar__inner--button & {
padding: 0 4px;
@@ -290,7 +298,7 @@ $button-size: 36px;
.navigation-bar__title {
margin: 0 4px;
- font-size: 22px;
+ font-size: 21px;
.layout--revision & {
position: absolute;
diff --git a/src/components/Preview.vue b/src/components/Preview.vue
index e0f41c32..d0833ad0 100644
--- a/src/components/Preview.vue
+++ b/src/components/Preview.vue
@@ -5,7 +5,7 @@
@@ -32,9 +32,14 @@ export default {
data: () => ({
previewTop: true,
}),
- computed: mapGetters('layout', [
- 'styles',
- ]),
+ computed: {
+ ...mapGetters('file', [
+ 'isCurrentTemp',
+ ]),
+ ...mapGetters('layout', [
+ 'styles',
+ ]),
+ },
methods: {
...mapActions('data', [
'toggleEditor',
diff --git a/src/components/StatusBar.vue b/src/components/StatusBar.vue
index 4f98dace..9224ad13 100644
--- a/src/components/StatusBar.vue
+++ b/src/components/StatusBar.vue
@@ -59,7 +59,7 @@ export default {
created() {
editorSvc.$on('sectionList', () => this.computeText());
editorSvc.$on('selectionRange', () => this.computeText());
- editorSvc.$on('previewText', () => this.computeHtml());
+ editorSvc.$on('previewCtx', () => this.computeHtml());
editorSvc.$on('previewSelectionRange', () => this.computeHtml());
},
@@ -92,7 +92,7 @@ export default {
this.htmlSelection = true;
if (!text) {
this.htmlSelection = false;
- text = editorSvc.previewText;
+ text = editorSvc.previewCtx.text;
}
if (text != null) {
this.htmlStats.forEach((stat) => {
diff --git a/src/components/Toc.vue b/src/components/Toc.vue
index 0b5d0941..9e6632cc 100644
--- a/src/components/Toc.vue
+++ b/src/components/Toc.vue
@@ -30,7 +30,7 @@ export default {
e.preventDefault();
const y = e.clientY - tocElt.getBoundingClientRect().top;
- editorSvc.sectionDescList.some((sectionDesc) => {
+ editorSvc.previewCtx.sectionDescList.some((sectionDesc) => {
if (y >= sectionDesc.tocDimension.endOffset) {
return false;
}
@@ -64,7 +64,7 @@ export default {
const updateMaskY = () => {
const scrollPosition = editorSvc.getScrollPosition();
if (scrollPosition) {
- const sectionDesc = editorSvc.sectionDescList[scrollPosition.sectionIdx];
+ const sectionDesc = editorSvc.previewCtx.sectionDescList[scrollPosition.sectionIdx];
this.maskY = sectionDesc.tocDimension.startOffset +
(scrollPosition.posInSection * sectionDesc.tocDimension.height);
}
diff --git a/src/components/common/PreviewClassApplier.js b/src/components/common/PreviewClassApplier.js
index 3a4ebbf2..f3ed7f14 100644
--- a/src/components/common/PreviewClassApplier.js
+++ b/src/components/common/PreviewClassApplier.js
@@ -23,7 +23,7 @@ export default class PreviewClassApplier {
this.lastEltCount = this.eltCollection.length;
this.restoreClass = () => {
- if (!editorSvc.sectionDescWithDiffsList) {
+ if (!editorSvc.previewCtxWithDiffs) {
this.removeClass();
} else if (!this.eltCollection.length || this.eltCollection.length !== this.lastEltCount) {
this.removeClass();
@@ -31,15 +31,17 @@ export default class PreviewClassApplier {
}
};
- editorSvc.$on('sectionDescWithDiffsList', this.restoreClass);
+ editorSvc.$on('previewCtxWithDiffs', this.restoreClass);
nextTick(() => this.applyClass());
}
applyClass() {
const offset = this.offsetGetter();
if (offset) {
- const offsetStart = editorSvc.getPreviewOffset(offset.start, editorSvc.sectionDescList);
- const offsetEnd = editorSvc.getPreviewOffset(offset.end, editorSvc.sectionDescList);
+ const offsetStart = editorSvc.getPreviewOffset(
+ offset.start, editorSvc.previewCtx.sectionDescList);
+ const offsetEnd = editorSvc.getPreviewOffset(
+ offset.end, editorSvc.previewCtx.sectionDescList);
if (offsetStart != null && offsetEnd != null && offsetStart !== offsetEnd) {
const start = cledit.Utils.findContainer(
editorSvc.previewElt, Math.min(offsetStart, offsetEnd));
@@ -63,8 +65,7 @@ export default class PreviewClassApplier {
}
stop() {
- editorSvc.$off('previewHtml', this.restoreClass);
- editorSvc.$off('sectionDescWithDiffsList', this.restoreClass);
+ editorSvc.$off('previewCtxWithDiffs', this.restoreClass);
nextTick(() => this.removeClass());
}
}
diff --git a/src/components/gutters/CommentList.vue b/src/components/gutters/CommentList.vue
index 99da80a3..525b2f04 100644
--- a/src/components/gutters/CommentList.vue
+++ b/src/components/gutters/CommentList.vue
@@ -163,9 +163,9 @@ export default {
() => this.updateSticky(),
{ immediate: true });
- // Move preview discussions once sectionDescWithDiffsList have been calculated
- if (!editorSvc.sectionDescWithDiffsList) {
- editorSvc.$once('sectionDescWithDiffsList', () => {
+ // Move preview discussions once previewCtxWithDiffs has been calculated
+ if (!editorSvc.previewCtxWithDiffs) {
+ editorSvc.$once('previewCtxWithDiffs', () => {
this.updateTops();
this.updateSticky();
});
diff --git a/src/components/gutters/CurrentDiscussion.vue b/src/components/gutters/CurrentDiscussion.vue
index a4d5a4a2..8fa8df66 100644
--- a/src/components/gutters/CurrentDiscussion.vue
+++ b/src/components/gutters/CurrentDiscussion.vue
@@ -48,6 +48,7 @@ export default {
'previousDiscussionId',
'nextDiscussionId',
'currentFileDiscussions',
+ 'currentDiscussionLastCommentId',
]),
...mapGetters('layout', [
'constants',
@@ -59,7 +60,7 @@ export default {
return this.nextDiscussionId && this.nextDiscussionId !== this.currentDiscussionId;
},
showRemove() {
- return this.currentFileDiscussions[this.currentDiscussionId];
+ return this.currentDiscussionLastCommentId;
},
},
methods: {
diff --git a/src/components/gutters/PreviewNewDiscussionButton.vue b/src/components/gutters/PreviewNewDiscussionButton.vue
index c66e45bf..b41f0921 100644
--- a/src/components/gutters/PreviewNewDiscussionButton.vue
+++ b/src/components/gutters/PreviewNewDiscussionButton.vue
@@ -28,7 +28,7 @@ export default {
) {
this.selection = editorSvc.getTrimmedSelection();
if (this.selection) {
- const text = editorSvc.previewTextWithDiffsList;
+ const text = editorSvc.previewCtxWithDiffs.text;
offset = editorSvc.getPreviewOffset(this.selection.end);
while (offset && text[offset - 1] === '\n') {
offset -= 1;
diff --git a/src/components/menus/HistoryMenu.vue b/src/components/menus/HistoryMenu.vue
index 5911f6a7..a757c11c 100644
--- a/src/components/menus/HistoryMenu.vue
+++ b/src/components/menus/HistoryMenu.vue
@@ -4,6 +4,12 @@
You have to sign in with Google to enable revision history.
Note: This will sync your main workspace.
+