2017-08-03 17:08:12 +00:00
|
|
|
<template>
|
2018-06-21 19:16:33 +00:00
|
|
|
<div class="modal" v-if="config" @keydown.esc="onEscape" @keydown.tab="onTab" @focusin="onFocusInOut" @focusout="onFocusInOut">
|
2018-03-14 00:42:26 +00:00
|
|
|
<component v-if="currentModalComponent" :is="currentModalComponent"></component>
|
2017-11-04 16:59:48 +00:00
|
|
|
<modal-inner v-else aria-label="Dialog">
|
2018-06-07 23:56:11 +00:00
|
|
|
<div class="modal__content" v-html="simpleModal.contentHtml(config)"></div>
|
2017-11-04 16:59:48 +00:00
|
|
|
<div class="modal__button-bar">
|
2018-06-07 23:56:11 +00:00
|
|
|
<button class="button" v-if="simpleModal.rejectText" @click="config.reject()">{{simpleModal.rejectText}}</button>
|
|
|
|
<button class="button" v-if="simpleModal.resolveText" @click="config.resolve()">{{simpleModal.resolveText}}</button>
|
2017-08-03 17:08:12 +00:00
|
|
|
</div>
|
2017-11-04 16:59:48 +00:00
|
|
|
</modal-inner>
|
2017-08-03 17:08:12 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2017-09-23 19:01:50 +00:00
|
|
|
import { mapGetters } from 'vuex';
|
2018-06-07 23:56:11 +00:00
|
|
|
import simpleModals from '../data/simpleModals';
|
2017-11-10 23:39:51 +00:00
|
|
|
import editorSvc from '../services/editorSvc';
|
2017-11-04 16:59:48 +00:00
|
|
|
import ModalInner from './modals/common/ModalInner';
|
2017-09-23 19:01:50 +00:00
|
|
|
import FilePropertiesModal from './modals/FilePropertiesModal';
|
|
|
|
import SettingsModal from './modals/SettingsModal';
|
|
|
|
import TemplatesModal from './modals/TemplatesModal';
|
2017-10-02 00:34:48 +00:00
|
|
|
import AboutModal from './modals/AboutModal';
|
2017-09-23 19:01:50 +00:00
|
|
|
import HtmlExportModal from './modals/HtmlExportModal';
|
2017-11-04 16:59:48 +00:00
|
|
|
import PdfExportModal from './modals/PdfExportModal';
|
|
|
|
import PandocExportModal from './modals/PandocExportModal';
|
2017-09-23 19:01:50 +00:00
|
|
|
import LinkModal from './modals/LinkModal';
|
|
|
|
import ImageModal from './modals/ImageModal';
|
|
|
|
import SyncManagementModal from './modals/SyncManagementModal';
|
|
|
|
import PublishManagementModal from './modals/PublishManagementModal';
|
2017-12-10 23:49:20 +00:00
|
|
|
import WorkspaceManagementModal from './modals/WorkspaceManagementModal';
|
2017-11-04 16:59:48 +00:00
|
|
|
import SponsorModal from './modals/SponsorModal';
|
|
|
|
|
|
|
|
// Providers
|
|
|
|
import GooglePhotoModal from './modals/providers/GooglePhotoModal';
|
2017-12-23 18:25:14 +00:00
|
|
|
import GoogleDriveAccountModal from './modals/providers/GoogleDriveAccountModal';
|
2017-11-04 16:59:48 +00:00
|
|
|
import GoogleDriveSaveModal from './modals/providers/GoogleDriveSaveModal';
|
2017-12-10 23:49:20 +00:00
|
|
|
import GoogleDriveWorkspaceModal from './modals/providers/GoogleDriveWorkspaceModal';
|
2017-11-04 16:59:48 +00:00
|
|
|
import GoogleDrivePublishModal from './modals/providers/GoogleDrivePublishModal';
|
|
|
|
import DropboxAccountModal from './modals/providers/DropboxAccountModal';
|
|
|
|
import DropboxSaveModal from './modals/providers/DropboxSaveModal';
|
|
|
|
import DropboxPublishModal from './modals/providers/DropboxPublishModal';
|
|
|
|
import GithubAccountModal from './modals/providers/GithubAccountModal';
|
|
|
|
import GithubOpenModal from './modals/providers/GithubOpenModal';
|
|
|
|
import GithubSaveModal from './modals/providers/GithubSaveModal';
|
2018-04-27 14:37:05 +00:00
|
|
|
import GithubWorkspaceModal from './modals/providers/GithubWorkspaceModal';
|
2017-11-04 16:59:48 +00:00
|
|
|
import GithubPublishModal from './modals/providers/GithubPublishModal';
|
|
|
|
import GistSyncModal from './modals/providers/GistSyncModal';
|
|
|
|
import GistPublishModal from './modals/providers/GistPublishModal';
|
|
|
|
import WordpressPublishModal from './modals/providers/WordpressPublishModal';
|
|
|
|
import BloggerPublishModal from './modals/providers/BloggerPublishModal';
|
|
|
|
import BloggerPagePublishModal from './modals/providers/BloggerPagePublishModal';
|
|
|
|
import ZendeskAccountModal from './modals/providers/ZendeskAccountModal';
|
|
|
|
import ZendeskPublishModal from './modals/providers/ZendeskPublishModal';
|
2018-01-24 07:31:54 +00:00
|
|
|
import CouchdbWorkspaceModal from './modals/providers/CouchdbWorkspaceModal';
|
|
|
|
import CouchdbCredentialsModal from './modals/providers/CouchdbCredentialsModal';
|
2017-08-03 17:08:12 +00:00
|
|
|
|
2017-10-07 11:22:24 +00:00
|
|
|
const getTabbables = container => container.querySelectorAll('a[href], button, .textfield')
|
|
|
|
// Filter enabled and visible element
|
2017-11-04 16:59:48 +00:00
|
|
|
.cl_filter(el => !el.disabled && el.offsetParent !== null && !el.classList.contains('not-tabbable'));
|
2017-10-07 11:22:24 +00:00
|
|
|
|
2017-08-03 17:08:12 +00:00
|
|
|
export default {
|
2017-09-17 15:32:39 +00:00
|
|
|
components: {
|
2017-11-04 16:59:48 +00:00
|
|
|
ModalInner,
|
2017-09-17 15:32:39 +00:00
|
|
|
FilePropertiesModal,
|
|
|
|
SettingsModal,
|
|
|
|
TemplatesModal,
|
2017-10-02 00:34:48 +00:00
|
|
|
AboutModal,
|
2017-09-23 19:01:50 +00:00
|
|
|
HtmlExportModal,
|
2017-11-04 16:59:48 +00:00
|
|
|
PdfExportModal,
|
|
|
|
PandocExportModal,
|
2017-09-17 15:32:39 +00:00
|
|
|
LinkModal,
|
|
|
|
ImageModal,
|
2017-09-23 19:01:50 +00:00
|
|
|
SyncManagementModal,
|
|
|
|
PublishManagementModal,
|
2017-12-10 23:49:20 +00:00
|
|
|
WorkspaceManagementModal,
|
2017-11-04 16:59:48 +00:00
|
|
|
SponsorModal,
|
|
|
|
// Providers
|
|
|
|
GooglePhotoModal,
|
2017-12-23 18:25:14 +00:00
|
|
|
GoogleDriveAccountModal,
|
2017-11-04 16:59:48 +00:00
|
|
|
GoogleDriveSaveModal,
|
2017-12-10 23:49:20 +00:00
|
|
|
GoogleDriveWorkspaceModal,
|
2017-09-23 19:01:50 +00:00
|
|
|
GoogleDrivePublishModal,
|
2017-09-26 22:54:26 +00:00
|
|
|
DropboxAccountModal,
|
2017-11-04 16:59:48 +00:00
|
|
|
DropboxSaveModal,
|
2017-09-23 19:01:50 +00:00
|
|
|
DropboxPublishModal,
|
2017-09-26 22:54:26 +00:00
|
|
|
GithubAccountModal,
|
2017-11-04 16:59:48 +00:00
|
|
|
GithubOpenModal,
|
|
|
|
GithubSaveModal,
|
2018-04-27 14:37:05 +00:00
|
|
|
GithubWorkspaceModal,
|
2017-09-23 19:01:50 +00:00
|
|
|
GithubPublishModal,
|
|
|
|
GistSyncModal,
|
|
|
|
GistPublishModal,
|
2017-09-26 22:54:26 +00:00
|
|
|
WordpressPublishModal,
|
2017-09-23 19:01:50 +00:00
|
|
|
BloggerPublishModal,
|
|
|
|
BloggerPagePublishModal,
|
2017-09-26 22:54:26 +00:00
|
|
|
ZendeskAccountModal,
|
|
|
|
ZendeskPublishModal,
|
2018-01-24 07:31:54 +00:00
|
|
|
CouchdbWorkspaceModal,
|
|
|
|
CouchdbCredentialsModal,
|
2017-08-03 17:08:12 +00:00
|
|
|
},
|
2018-03-13 20:41:41 +00:00
|
|
|
computed: {
|
|
|
|
...mapGetters('modal', [
|
|
|
|
'config',
|
|
|
|
]),
|
|
|
|
currentModalComponent() {
|
2018-03-14 00:42:26 +00:00
|
|
|
if (this.config.type) {
|
|
|
|
let componentName = this.config.type[0].toUpperCase();
|
|
|
|
componentName += this.config.type.slice(1);
|
|
|
|
componentName += 'Modal';
|
|
|
|
if (this.$options.components[componentName]) {
|
|
|
|
return componentName;
|
|
|
|
}
|
2018-03-13 20:41:41 +00:00
|
|
|
}
|
2018-03-14 00:42:26 +00:00
|
|
|
return null;
|
2018-03-13 20:41:41 +00:00
|
|
|
},
|
2018-06-07 23:56:11 +00:00
|
|
|
simpleModal() {
|
|
|
|
return simpleModals[this.config.type] || {};
|
|
|
|
},
|
2018-03-13 20:41:41 +00:00
|
|
|
},
|
2017-08-03 17:08:12 +00:00
|
|
|
methods: {
|
2017-09-17 15:32:39 +00:00
|
|
|
onEscape() {
|
2017-09-23 19:01:50 +00:00
|
|
|
this.config.reject();
|
2017-11-10 23:39:51 +00:00
|
|
|
editorSvc.clEditor.focus();
|
2017-09-17 15:32:39 +00:00
|
|
|
},
|
2017-10-07 11:22:24 +00:00
|
|
|
onTab(evt) {
|
|
|
|
const tabbables = getTabbables(this.$el);
|
|
|
|
const firstTabbable = tabbables[0];
|
|
|
|
const lastTabbable = tabbables[tabbables.length - 1];
|
|
|
|
if (evt.shiftKey && firstTabbable === evt.target) {
|
|
|
|
evt.preventDefault();
|
|
|
|
lastTabbable.focus();
|
|
|
|
} else if (!evt.shiftKey && lastTabbable === evt.target) {
|
|
|
|
evt.preventDefault();
|
|
|
|
firstTabbable.focus();
|
|
|
|
}
|
|
|
|
},
|
2017-09-17 15:32:39 +00:00
|
|
|
onFocusInOut(evt) {
|
|
|
|
const isFocusIn = evt.type === 'focusin';
|
|
|
|
if (evt.target.parentNode && evt.target.parentNode.parentNode) {
|
|
|
|
// Focus effect
|
2018-06-21 19:16:33 +00:00
|
|
|
if (evt.target.parentNode.classList.contains('form-entry__field')
|
|
|
|
&& evt.target.parentNode.parentNode.classList.contains('form-entry')) {
|
2017-09-17 15:32:39 +00:00
|
|
|
evt.target.parentNode.parentNode.classList.toggle('form-entry--focused', isFocusIn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (isFocusIn && this.config) {
|
2017-08-03 17:08:12 +00:00
|
|
|
const modalInner = this.$el.querySelector('.modal__inner-2');
|
2018-05-06 00:46:33 +00:00
|
|
|
let { target } = evt;
|
2017-08-03 17:08:12 +00:00
|
|
|
while (target) {
|
|
|
|
if (target === modalInner) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
target = target.parentNode;
|
|
|
|
}
|
2017-09-23 19:01:50 +00:00
|
|
|
this.config.reject();
|
2017-08-03 17:08:12 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
2018-06-07 23:56:11 +00:00
|
|
|
this.$watch(
|
|
|
|
() => this.config,
|
2018-06-21 19:16:33 +00:00
|
|
|
(isOpen) => {
|
|
|
|
if (isOpen) {
|
2018-06-07 23:56:11 +00:00
|
|
|
const tabbables = getTabbables(this.$el);
|
|
|
|
if (tabbables[0]) {
|
|
|
|
tabbables[0].focus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2018-06-21 19:16:33 +00:00
|
|
|
{ immediate: true },
|
2018-06-07 23:56:11 +00:00
|
|
|
);
|
2017-08-03 17:08:12 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
2018-05-06 00:46:33 +00:00
|
|
|
@import '../styles/variables.scss';
|
2017-08-03 17:08:12 +00:00
|
|
|
|
|
|
|
.modal {
|
|
|
|
position: absolute;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
2017-11-04 16:59:48 +00:00
|
|
|
background-color: rgba(160, 160, 160, 0.5);
|
2017-08-03 17:08:12 +00:00
|
|
|
overflow: auto;
|
2017-12-10 23:49:20 +00:00
|
|
|
|
2018-04-27 14:37:05 +00:00
|
|
|
p {
|
|
|
|
line-height: 1.5;
|
|
|
|
}
|
2017-08-03 17:08:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.modal__inner-1 {
|
|
|
|
margin: 0 auto;
|
2017-09-17 15:32:39 +00:00
|
|
|
width: 100%;
|
2017-08-03 17:08:12 +00:00
|
|
|
min-width: 320px;
|
2017-11-15 08:12:56 +00:00
|
|
|
max-width: 480px;
|
2017-08-03 17:08:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.modal__inner-2 {
|
2017-11-04 16:59:48 +00:00
|
|
|
margin: 40px 10px 100px;
|
2017-11-26 20:58:24 +00:00
|
|
|
background-color: #f8f8f8;
|
2017-09-17 15:32:39 +00:00
|
|
|
padding: 40px 50px 30px;
|
2017-08-03 17:08:12 +00:00
|
|
|
border-radius: $border-radius-base;
|
2017-09-17 15:32:39 +00:00
|
|
|
position: relative;
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
&::before {
|
|
|
|
content: '';
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
height: $border-radius-base;
|
|
|
|
width: 100%;
|
2018-04-15 17:13:03 +00:00
|
|
|
background-image: linear-gradient(to left, #ffd700, #ffd700 23%, #a5c700 27%, #a5c700 48%, #ff8a00 52%, #ff8a00 73%, #66aefd 77%);
|
2017-09-17 15:32:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
content: '';
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
height: $border-radius-base;
|
|
|
|
width: 100%;
|
2018-04-15 17:13:03 +00:00
|
|
|
background-image: linear-gradient(to right, #ffd700, #ffd700 23%, #a5c700 27%, #a5c700 48%, #ff8a00 52%, #ff8a00 73%, #66aefd 77%);
|
2017-09-17 15:32:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-04 16:59:48 +00:00
|
|
|
.modal__content > :first-child,
|
|
|
|
.modal__content > .modal__image:first-child + * {
|
2017-09-17 15:32:39 +00:00
|
|
|
margin-top: 0;
|
|
|
|
}
|
|
|
|
|
2017-09-23 19:01:50 +00:00
|
|
|
.modal__image {
|
|
|
|
float: left;
|
2018-04-27 14:37:05 +00:00
|
|
|
width: 60px;
|
|
|
|
height: 60px;
|
|
|
|
margin: 1.5em 1.2em 0.5em 0;
|
2017-09-23 19:01:50 +00:00
|
|
|
|
|
|
|
& + *::after {
|
|
|
|
content: '';
|
|
|
|
display: block;
|
|
|
|
clear: both;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-08 14:49:10 +00:00
|
|
|
.modal__title {
|
|
|
|
font-weight: bold;
|
|
|
|
font-size: 1.5rem;
|
|
|
|
line-height: 1.4;
|
|
|
|
margin-top: 2.5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.modal__sub-title {
|
|
|
|
opacity: 0.5;
|
|
|
|
font-size: 0.75rem;
|
|
|
|
margin-bottom: 1.5rem;
|
|
|
|
}
|
|
|
|
|
2017-09-17 15:32:39 +00:00
|
|
|
.modal__error {
|
|
|
|
color: #de2c00;
|
2017-08-03 17:08:12 +00:00
|
|
|
}
|
|
|
|
|
2017-10-05 07:18:21 +00:00
|
|
|
.modal__info {
|
|
|
|
background-color: $info-bg;
|
2017-09-23 19:01:50 +00:00
|
|
|
border-radius: $border-radius-base;
|
|
|
|
margin: 1.2em 0;
|
|
|
|
padding: 0.75em 1.25em;
|
2018-04-08 14:49:10 +00:00
|
|
|
font-size: 0.95em;
|
|
|
|
line-height: 1.6;
|
|
|
|
|
|
|
|
pre {
|
|
|
|
line-height: 1.5;
|
|
|
|
}
|
2017-09-23 19:01:50 +00:00
|
|
|
}
|
|
|
|
|
2018-04-27 14:37:05 +00:00
|
|
|
.modal__info--multiline {
|
|
|
|
padding-top: 0.1em;
|
|
|
|
padding-bottom: 0.1em;
|
|
|
|
}
|
|
|
|
|
2017-08-03 17:08:12 +00:00
|
|
|
.modal__button-bar {
|
|
|
|
margin-top: 1.75rem;
|
|
|
|
text-align: right;
|
|
|
|
}
|
2017-10-02 19:09:39 +00:00
|
|
|
|
|
|
|
.form-entry {
|
|
|
|
margin: 1em 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.form-entry__label {
|
|
|
|
display: block;
|
|
|
|
font-size: 0.9rem;
|
|
|
|
color: #a0a0a0;
|
|
|
|
|
|
|
|
.form-entry--focused & {
|
|
|
|
color: darken($link-color, 10%);
|
|
|
|
}
|
2017-10-07 11:22:24 +00:00
|
|
|
|
|
|
|
.form-entry--error & {
|
|
|
|
color: darken($error-color, 10%);
|
|
|
|
}
|
2017-10-02 19:09:39 +00:00
|
|
|
}
|
|
|
|
|
2018-04-08 14:49:10 +00:00
|
|
|
.form-entry__label-info {
|
|
|
|
font-size: 0.75rem;
|
|
|
|
}
|
|
|
|
|
2017-10-02 19:09:39 +00:00
|
|
|
.form-entry__field {
|
|
|
|
border: 1px solid #d8d8d8;
|
|
|
|
border-radius: $border-radius-base;
|
|
|
|
position: relative;
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
.form-entry--focused & {
|
|
|
|
border-color: $link-color;
|
|
|
|
}
|
2017-10-07 11:22:24 +00:00
|
|
|
|
|
|
|
.form-entry--error & {
|
|
|
|
border-color: $error-color;
|
|
|
|
}
|
2017-10-02 19:09:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.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;
|
|
|
|
}
|
2017-10-07 11:22:24 +00:00
|
|
|
|
|
|
|
.tabs {
|
|
|
|
border-bottom: 1px solid $hr-color;
|
2017-11-04 16:59:48 +00:00
|
|
|
margin: 1em 0 2em;
|
2017-10-07 11:22:24 +00:00
|
|
|
|
|
|
|
&::after {
|
|
|
|
content: '';
|
|
|
|
display: block;
|
|
|
|
clear: both;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.tabs__tab {
|
|
|
|
width: 50%;
|
|
|
|
float: left;
|
|
|
|
text-align: center;
|
|
|
|
line-height: 1.4;
|
|
|
|
font-weight: 400;
|
|
|
|
font-size: 1.1em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.tabs__tab > a {
|
|
|
|
width: 100%;
|
|
|
|
text-decoration: none;
|
|
|
|
padding: 0.67em 0.33em;
|
|
|
|
cursor: pointer;
|
|
|
|
border-bottom: 2px solid transparent;
|
|
|
|
border-top-left-radius: $border-radius-base;
|
|
|
|
border-top-right-radius: $border-radius-base;
|
|
|
|
color: $link-color;
|
|
|
|
|
|
|
|
&:hover,
|
|
|
|
&:focus {
|
2018-02-15 08:40:20 +00:00
|
|
|
background-color: rgba(0, 0, 0, 0.05);
|
2017-10-07 11:22:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.tabs__tab--active > a {
|
|
|
|
border-bottom: 2px solid $link-color;
|
|
|
|
color: inherit;
|
|
|
|
}
|
2017-08-03 17:08:12 +00:00
|
|
|
</style>
|