Fixed form entries. Fixed error logs when canceling a modal.

This commit is contained in:
Benoit Schweblin 2017-10-02 20:09:39 +01:00
parent 73cea1879d
commit fb95df2e14
8 changed files with 132 additions and 100 deletions

View File

@ -224,4 +224,66 @@ export default {
margin-left: 5px; margin-left: 5px;
} }
} }
.form-entry {
margin: 1em 0;
}
.form-entry__label {
display: block;
font-size: 0.9rem;
color: #a0a0a0;
.form-entry--focused & {
color: darken($link-color, 10%);
}
}
.form-entry__field {
border: 1px solid #d8d8d8;
border-radius: $border-radius-base;
position: relative;
overflow: hidden;
.form-entry--focused & {
border-color: $link-color;
}
}
.form-entry__actions {
text-align: right;
margin: 0.25em;
}
.form-entry__button {
width: 38px;
height: 38px;
padding: 6px;
display: inline-block;
background-color: transparent;
opacity: 0.75;
&:active,
&:focus,
&:hover {
opacity: 1;
background-color: rgba(0, 0, 0, 0.1);
}
}
.form-entry__radio,
.form-entry__checkbox {
margin: 0.25em 1em;
input {
margin-right: 0.25em;
}
}
.form-entry__info {
font-size: 0.75em;
opacity: 0.5;
line-height: 1.4;
margin: 0.25em 0;
}
</style> </style>

View File

@ -29,10 +29,12 @@ export default {
methods: { methods: {
exportMarkdown() { exportMarkdown() {
const currentFile = this.$store.getters['file/current']; const currentFile = this.$store.getters['file/current'];
return exportSvc.exportToDisk(currentFile.id, 'md'); return exportSvc.exportToDisk(currentFile.id, 'md')
.catch(() => {}); // Cancel
}, },
exportHtml() { exportHtml() {
return this.$store.dispatch('modal/open', 'htmlExport'); return this.$store.dispatch('modal/open', 'htmlExport')
.catch(() => {}); // Cancel
}, },
exportPdf() { exportPdf() {
return this.$store.dispatch('modal/notImplemented'); return this.$store.dispatch('modal/notImplemented');

View File

@ -75,13 +75,17 @@ export default {
}), }),
signin() { signin() {
return googleHelper.signin() return googleHelper.signin()
.then(() => syncSvc.requestSync()); .then(
() => syncSvc.requestSync(),
() => {}, // Cancel
);
}, },
importFile() { importFile() {
return this.$store.dispatch('modal/notImplemented'); return this.$store.dispatch('modal/notImplemented');
}, },
fileProperties() { fileProperties() {
return this.$store.dispatch('modal/open', 'fileProperties'); return this.$store.dispatch('modal/open', 'fileProperties')
.catch(() => {}); // Cancel
}, },
}, },
}; };

View File

@ -42,15 +42,24 @@ export default {
methods: { methods: {
settings() { settings() {
return this.$store.dispatch('modal/open', 'settings') return this.$store.dispatch('modal/open', 'settings')
.then(settings => this.$store.dispatch('data/setSettings', settings)); .then(
settings => this.$store.dispatch('data/setSettings', settings),
() => {}, // Cancel
);
}, },
templates() { templates() {
return this.$store.dispatch('modal/open', 'templates') return this.$store.dispatch('modal/open', 'templates')
.then(({ templates }) => this.$store.dispatch('data/setTemplates', templates)); .then(
({ templates }) => this.$store.dispatch('data/setTemplates', templates),
() => {}, // Cancel
);
}, },
reset() { reset() {
return this.$store.dispatch('modal/reset') return this.$store.dispatch('modal/reset')
.then(() => localDbSvc.removeDb()); .then(
() => localDbSvc.removeDb(),
() => {}, // Cancel
);
}, },
about() { about() {
return this.$store.dispatch('modal/open', 'about'); return this.$store.dispatch('modal/open', 'about');

View File

@ -161,55 +161,69 @@ export default {
return this.$store.dispatch('modal/open', 'publishManagement'); return this.$store.dispatch('modal/open', 'publishManagement');
}, },
addGoogleDriveAccount() { addGoogleDriveAccount() {
return googleHelper.addDriveAccount(); return googleHelper.addDriveAccount()
.catch(() => {}); // Cancel
}, },
addDropboxAccount() { addDropboxAccount() {
return this.$store.dispatch('modal/open', { return this.$store.dispatch('modal/open', {
type: 'dropboxAccount', type: 'dropboxAccount',
onResolve: () => dropboxHelper.addAccount(!store.getters['data/localSettings'].dropboxRestrictedAccess), onResolve: () => dropboxHelper.addAccount(!store.getters['data/localSettings'].dropboxRestrictedAccess),
}); })
.catch(() => {}); // Cancel
}, },
addGithubAccount() { addGithubAccount() {
return this.$store.dispatch('modal/open', { return this.$store.dispatch('modal/open', {
type: 'githubAccount', type: 'githubAccount',
onResolve: () => githubHelper.addAccount(store.getters['data/localSettings'].githubRepoFullAccess), onResolve: () => githubHelper.addAccount(store.getters['data/localSettings'].githubRepoFullAccess),
}); })
.catch(() => {}); // Cancel
}, },
addWordpressAccount() { addWordpressAccount() {
return wordpressHelper.addAccount(); return wordpressHelper.addAccount()
.catch(() => {}); // Cancel
}, },
addBloggerAccount() { addBloggerAccount() {
return googleHelper.addBloggerAccount(); return googleHelper.addBloggerAccount()
.catch(() => {}); // Cancel
}, },
addZendeskAccount() { addZendeskAccount() {
return this.$store.dispatch('modal/open', { return this.$store.dispatch('modal/open', {
type: 'zendeskAccount', type: 'zendeskAccount',
onResolve: ({ subdomain, clientId }) => zendeskHelper.addAccount(subdomain, clientId), onResolve: ({ subdomain, clientId }) => zendeskHelper.addAccount(subdomain, clientId),
}); })
.catch(() => {}); // Cancel
}, },
publishGoogleDrive(token) { publishGoogleDrive(token) {
return openPublishModal(token, 'googleDrivePublish'); return openPublishModal(token, 'googleDrivePublish')
.catch(() => {}); // Cancel
}, },
publishDropbox(token) { publishDropbox(token) {
return openPublishModal(token, 'dropboxPublish'); return openPublishModal(token, 'dropboxPublish')
.catch(() => {}); // Cancel
}, },
publishGithub(token) { publishGithub(token) {
return openPublishModal(token, 'githubPublish'); return openPublishModal(token, 'githubPublish')
.catch(() => {}); // Cancel
}, },
publishGist(token) { publishGist(token) {
return openPublishModal(token, 'gistPublish'); return openPublishModal(token, 'gistPublish')
.catch(() => {}); // Cancel
}, },
publishWordpress(token) { publishWordpress(token) {
return openPublishModal(token, 'wordpressPublish'); return openPublishModal(token, 'wordpressPublish')
.catch(() => {}); // Cancel
}, },
publishBlogger(token) { publishBlogger(token) {
return openPublishModal(token, 'bloggerPublish'); return openPublishModal(token, 'bloggerPublish')
.catch(() => {}); // Cancel
}, },
publishBloggerPage(token) { publishBloggerPage(token) {
return openPublishModal(token, 'bloggerPagePublish'); return openPublishModal(token, 'bloggerPagePublish')
.catch(() => {}); // Cancel
}, },
publishZendesk(token) { publishZendesk(token) {
return openPublishModal(token, 'zendeskPublish'); return openPublishModal(token, 'zendeskPublish')
.catch(() => {}); // Cancel
}, },
}, },
}; };

View File

@ -138,19 +138,22 @@ export default {
return this.$store.dispatch('modal/open', 'syncManagement'); return this.$store.dispatch('modal/open', 'syncManagement');
}, },
addGoogleDriveAccount() { addGoogleDriveAccount() {
return googleHelper.addDriveAccount(); return googleHelper.addDriveAccount()
.catch(() => {}); // Cancel
}, },
addDropboxAccount() { addDropboxAccount() {
return this.$store.dispatch('modal/open', { return this.$store.dispatch('modal/open', {
type: 'dropboxAccount', type: 'dropboxAccount',
onResolve: () => dropboxHelper.addAccount(!store.getters['data/localSettings'].dropboxRestrictedAccess), onResolve: () => dropboxHelper.addAccount(!store.getters['data/localSettings'].dropboxRestrictedAccess),
}); })
.catch(() => {}); // Cancel
}, },
addGithubAccount() { addGithubAccount() {
return this.$store.dispatch('modal/open', { return this.$store.dispatch('modal/open', {
type: 'githubAccount', type: 'githubAccount',
onResolve: () => githubHelper.addAccount(store.getters['data/localSettings'].githubRepoFullAccess), onResolve: () => githubHelper.addAccount(store.getters['data/localSettings'].githubRepoFullAccess),
}); })
.catch(() => {}); // Cancel
}, },
openGoogleDrive(token) { openGoogleDrive(token) {
return googleHelper.openPicker(token, 'doc') return googleHelper.openPicker(token, 'doc')
@ -163,16 +166,20 @@ export default {
() => dropboxProvider.openFiles(token, paths))); () => dropboxProvider.openFiles(token, paths)));
}, },
saveGoogleDrive(token) { saveGoogleDrive(token) {
return openSyncModal(token, 'googleDriveSync'); return openSyncModal(token, 'googleDriveSync')
.catch(() => {}); // Cancel
}, },
saveDropbox(token) { saveDropbox(token) {
return openSyncModal(token, 'dropboxSync'); return openSyncModal(token, 'dropboxSync')
.catch(() => {}); // Cancel
}, },
saveGithub(token) { saveGithub(token) {
return openSyncModal(token, 'githubSync'); return openSyncModal(token, 'githubSync')
.catch(() => {}); // Cancel
}, },
saveGist(token) { saveGist(token) {
return openSyncModal(token, 'gistSync'); return openSyncModal(token, 'gistSync')
.catch(() => {}); // Cancel
}, },
}, },
}; };

View File

@ -21,69 +21,3 @@ export default {
}, },
}; };
</script> </script>
<style lang="scss">
@import '../common/variables.scss';
.form-entry {
margin: 1em 0;
}
.form-entry__label {
display: block;
font-size: 0.9rem;
color: #a0a0a0;
.form-entry--focused & {
color: darken($link-color, 10%);
}
}
.form-entry__field {
border: 1px solid #d8d8d8;
border-radius: $border-radius-base;
position: relative;
overflow: hidden;
.form-entry--focused & {
border-color: $link-color;
}
}
.form-entry__actions {
text-align: right;
margin: 0.25em;
}
.form-entry__button {
width: 38px;
height: 38px;
padding: 6px;
display: inline-block;
background-color: transparent;
opacity: 0.75;
&:active,
&:focus,
&:hover {
opacity: 1;
background-color: rgba(0, 0, 0, 0.1);
}
}
.form-entry__radio,
.form-entry__checkbox {
margin: 0.25em 1em;
input {
margin-right: 0.25em;
}
}
.form-entry__info {
font-size: 0.75em;
opacity: 0.5;
line-height: 1.4;
margin: 0.25em 0;
}
</style>

View File

@ -231,12 +231,6 @@ module.exports = function (options) {
} }
var rest = {} var rest = {}
rest.code = {
pattern: /(`+)[\s\S]*?\1/g,
inside: {
'cl cl-code': /`/
}
}
if (options.maths) { if (options.maths) {
rest['math block'] = { rest['math block'] = {
pattern: /\\\\\[[\s\S]*?\\\\\]/g, pattern: /\\\\\[[\s\S]*?\\\\\]/g,
@ -278,6 +272,12 @@ module.exports = function (options) {
} }
} }
} }
rest.code = {
pattern: /(`+)[\s\S]*?\1/g,
inside: {
'cl cl-code': /`/
}
}
if (options.footnotes) { if (options.footnotes) {
rest.inlinefn = { rest.inlinefn = {
pattern: /\^\[.+?\]/g, pattern: /\^\[.+?\]/g,