mirror of
https://gitee.com/mafgwo/stackedit
synced 2024-11-16 19:57:40 +08:00
Force signin before commenting
This commit is contained in:
parent
fdfafc9519
commit
217b17c279
|
@ -10,6 +10,7 @@ import editorSvc from '../../services/editorSvc';
|
|||
|
||||
export default {
|
||||
data: () => ({
|
||||
selection: null,
|
||||
coordinates: null,
|
||||
}),
|
||||
methods: {
|
||||
|
|
|
@ -10,6 +10,7 @@ import editorSvc from '../../services/editorSvc';
|
|||
|
||||
export default {
|
||||
data: () => ({
|
||||
selection: null,
|
||||
coordinates: null,
|
||||
}),
|
||||
methods: {
|
||||
|
|
|
@ -70,7 +70,7 @@ export default {
|
|||
color: darken($error-color, 10%);
|
||||
background-color: transparentize($error-color, 0.85);
|
||||
border-radius: $border-radius-base;
|
||||
padding: 1em 1.5em;
|
||||
padding: 0.75em 1.5em;
|
||||
margin-bottom: 1.2em;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -210,7 +210,7 @@ const editorSvc = Object.assign(new Vue(), editorSvcDiscussions, editorSvcUtils,
|
|||
this.$emit('previewText', this.previewText);
|
||||
// Debounce if sections have already been mesured
|
||||
this.measureSectionDimensions(!!this.sectionDescMeasuredList);
|
||||
this.makeTextToPreviewDiffs(true);
|
||||
this.makeTextToPreviewDiffs();
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import utils from '../services/utils';
|
||||
import googleHelper from '../services/providers/helpers/googleHelper';
|
||||
import syncSvc from '../services/syncSvc';
|
||||
|
||||
const idShifter = offset => (state, getters) => {
|
||||
const ids = Object.keys(getters.currentFileDiscussions);
|
||||
|
@ -115,8 +117,15 @@ export default {
|
|||
getters.currentDiscussionComments[getters.currentDiscussionLastCommentId],
|
||||
},
|
||||
actions: {
|
||||
createNewDiscussion({ commit, rootGetters }, selection) {
|
||||
if (selection) {
|
||||
createNewDiscussion({ commit, dispatch, rootGetters }, selection) {
|
||||
const loginToken = rootGetters['data/loginToken'];
|
||||
if (!loginToken) {
|
||||
dispatch('modal/signInForComment', null, { root: true })
|
||||
.then(() => googleHelper.signin())
|
||||
.then(() => syncSvc.requestSync())
|
||||
.then(() => dispatch('createNewDiscussion', selection))
|
||||
.catch(() => { }); // Cancel
|
||||
} else if (selection) {
|
||||
let text = rootGetters['content/current'].text.slice(selection.start, selection.end).trim();
|
||||
const maxLength = 80;
|
||||
if (text.length > maxLength) {
|
||||
|
|
|
@ -88,6 +88,12 @@ export default {
|
|||
resolveText: 'Ok, sign in',
|
||||
rejectText: 'Cancel',
|
||||
}),
|
||||
signInForComment: ({ dispatch }) => dispatch('open', {
|
||||
content: `<p>You have to sign in with <b>Google</b> to start commenting.</p>
|
||||
<div class="modal__info"><b>Note:</b> This will sync all your files and settings.</div>`,
|
||||
resolveText: 'Ok, sign in',
|
||||
rejectText: 'Cancel',
|
||||
}),
|
||||
sponsorOnly: ({ dispatch }) => dispatch('open', {
|
||||
content: '<p>This feature is restricted to <b>sponsor users</b> as it relies on server resources.</p>',
|
||||
resolveText: 'Ok, I understand',
|
||||
|
|
Loading…
Reference in New Issue
Block a user