Skip to content

Commit 872f557

Browse files
author
Benoit Schweblin
committed
Added publish providers and templates
1 parent 0b0bec1 commit 872f557

File tree

94 files changed

+3935
-625
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+3935
-625
lines changed

build/dev-server.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ var proxyTable = config.dev.proxyTable
2323
var app = express()
2424
var compiler = webpack(webpackConfig)
2525

26+
// StackEdit custom middlewares
27+
require('./server')(app);
28+
2629
var devMiddleware = require('webpack-dev-middleware')(compiler, {
2730
publicPath: webpackConfig.output.publicPath,
2831
quiet: true

build/server.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
var qs = require('qs');
2+
var request = require('request');
3+
4+
function githubToken(clientId, code) {
5+
return new Promise(function (resolve, reject) {
6+
request({
7+
method: 'POST',
8+
url: 'https://github.com/login/oauth/access_token',
9+
qs: {
10+
client_id: clientId,
11+
client_secret: process.env.GITHUB_SECRET,
12+
code: code
13+
},
14+
}, function(err, res, body) {
15+
if (err) {
16+
reject(err);
17+
}
18+
console.log(body)
19+
var token = qs.parse(body).access_token;
20+
if (token) {
21+
resolve(token);
22+
} else {
23+
reject(res.statusCode);
24+
}
25+
});
26+
});
27+
}
28+
29+
module.exports = function (app) {
30+
app.get('/oauth2/githubToken', function (req, res) {
31+
githubToken(req.query.clientId, req.query.code)
32+
.then(function (token) {
33+
res.send(token);
34+
}, function (err) {
35+
res.status(400).send(err ? err.message || err.toString() : 'bad_code');
36+
});
37+
});
38+
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"normalize-scss": "^7.0.0",
3333
"prismjs": "^1.6.0",
3434
"raw-loader": "^0.5.1",
35+
"request": "^2.82.0",
3536
"vue": "^2.3.3",
3637
"vuex": "^2.3.1"
3738
},

src/assets/iconBlogger.svg

Lines changed: 13 additions & 0 deletions
Loading

src/assets/iconDropbox.svg

Lines changed: 9 additions & 0 deletions
Loading

src/assets/iconGithub.svg

Lines changed: 7 additions & 0 deletions
Loading

src/assets/iconGoogleDrive.svg

Lines changed: 8 additions & 0 deletions
Loading

src/assets/iconGooglePhotos.svg

Lines changed: 12 additions & 0 deletions
Loading

src/assets/iconStackedit.svg

Lines changed: 19 additions & 0 deletions
Loading

src/components/App.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<div v-if="ready" class="app" :class="{'app--loading': loading}">
33
<layout></layout>
44
<modal v-if="showModal"></modal>
5+
<notification></notification>
56
</div>
67
<div v-else class="app__spash-screen"></div>
78
</template>
@@ -11,6 +12,7 @@ import Vue from 'vue';
1112
import { mapState } from 'vuex';
1213
import Layout from './Layout';
1314
import Modal from './Modal';
15+
import Notification from './Notification';
1416
1517
// Global directives
1618
Vue.directive('focus', {
@@ -23,6 +25,7 @@ export default {
2325
components: {
2426
Layout,
2527
Modal,
28+
Notification,
2629
},
2730
computed: {
2831
...mapState([
@@ -32,7 +35,7 @@ export default {
3235
return !this.$store.getters['content/current'].id;
3336
},
3437
showModal() {
35-
return !!this.$store.state.modal.config;
38+
return !!this.$store.getters['modal/config'];
3639
},
3740
},
3841
};

src/components/ExplorerNode.vue

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<template>
22
<div class="explorer-node" :class="{'explorer-node--selected': isSelected, 'explorer-node--open': isOpen, 'explorer-node--drag-target': isDragTargetFolder}" @dragover.prevent @dragenter.stop="setDragTarget(node.item.id)" @dragleave.stop="isDragTarget && setDragTargetId()" @drop.prevent.stop="onDrop">
3-
<div v-if="isEditing" class="explorer-node__item-editor" :class="['explorer-node__item-editor--' + node.item.type]" :style="{'padding-left': leftPadding}">
3+
<div class="explorer-node__item-editor" v-if="isEditing" :class="['explorer-node__item-editor--' + node.item.type]" :style="{'padding-left': leftPadding}">
44
<input type="text" class="text-input" v-focus @blur="submitEdit()" @keyup.enter="submitEdit()" @keyup.esc="submitEdit(true)" v-model="editingNodeName">
55
</div>
6-
<div v-else class="explorer-node__item" :class="['explorer-node__item--' + node.item.type]" :style="{'padding-left': leftPadding}" @click="select(node.item.id)" draggable="true" @dragstart.stop="setDragSourceId" @dragend.stop="setDragTargetId()">
6+
<div class="explorer-node__item" v-else :class="['explorer-node__item--' + node.item.type]" :style="{'padding-left': leftPadding}" @click="select(node.item.id)" draggable="true" @dragstart.stop="setDragSourceId" @dragend.stop="setDragTargetId()">
77
{{node.item.name}}
8+
<icon-provider class="explorer-node__location" v-for="location in node.locations" :key="location.id" :provider-id="location.providerId"></icon-provider>
89
</div>
910
<div class="explorer-node__children" v-if="node.isFolder && isOpen">
1011
<explorer-node v-for="node in node.folders" :key="node.item.id" :node="node" :depth="depth + 1"></explorer-node>
@@ -112,10 +113,11 @@ export default {
112113
this.$store.commit('explorer/setNewItem', null);
113114
},
114115
submitEdit(cancel) {
115-
const id = this.$store.getters['explorer/editingNode'].item.id;
116+
const editingNode = this.$store.getters['explorer/editingNode'];
117+
const id = editingNode.item.id;
116118
const value = this.editingValue;
117119
if (!cancel && id && value) {
118-
this.$store.commit('file/patchItem', {
120+
this.$store.commit(editingNode.isFolder ? 'folder/patchItem' : 'file/patchItem', {
119121
id,
120122
name: value.slice(0, 250),
121123
});
@@ -166,6 +168,7 @@ $item-font-size: 14px;
166168
overflow: hidden;
167169
white-space: nowrap;
168170
text-overflow: ellipsis;
171+
padding-right: 5px;
169172
170173
.explorer-node--selected > & {
171174
background-color: rgba(0, 0, 0, 0.2);
@@ -179,6 +182,13 @@ $item-font-size: 14px;
179182
.explorer__tree--new-item & {
180183
opacity: 0.33;
181184
}
185+
186+
.explorer-node__location {
187+
float: right;
188+
width: 18px;
189+
height: 18px;
190+
margin: 2px 1px;
191+
}
182192
}
183193
184194
.explorer-node__item--folder,

src/components/Layout.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ export default {
9898
position: relative;
9999
width: 100%;
100100
height: 100%;
101-
-webkit-flex: none;
102101
flex: none;
103102
}
104103

src/components/Modal.vue

Lines changed: 70 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,22 @@
33
<file-properties-modal v-if="config.type === 'fileProperties'"></file-properties-modal>
44
<settings-modal v-else-if="config.type === 'settings'"></settings-modal>
55
<templates-modal v-else-if="config.type === 'templates'"></templates-modal>
6+
<html-export-modal v-else-if="config.type === 'htmlExport'"></html-export-modal>
67
<link-modal v-else-if="config.type === 'link'"></link-modal>
78
<image-modal v-else-if="config.type === 'image'"></image-modal>
89
<google-photo-modal v-else-if="config.type === 'googlePhoto'"></google-photo-modal>
9-
<html-export-modal v-else-if="config.type === 'htmlExport'"></html-export-modal>
10+
<sync-management-modal v-else-if="config.type === 'syncManagement'"></sync-management-modal>
11+
<publish-management-modal v-else-if="config.type === 'publishManagement'"></publish-management-modal>
12+
<google-drive-sync-modal v-else-if="config.type === 'googleDriveSync'"></google-drive-sync-modal>
13+
<google-drive-publish-modal v-else-if="config.type === 'googleDrivePublish'"></google-drive-publish-modal>
14+
<dropbox-sync-modal v-else-if="config.type === 'dropboxSync'"></dropbox-sync-modal>
15+
<dropbox-publish-modal v-else-if="config.type === 'dropboxPublish'"></dropbox-publish-modal>
16+
<github-sync-modal v-else-if="config.type === 'githubSync'"></github-sync-modal>
17+
<github-publish-modal v-else-if="config.type === 'githubPublish'"></github-publish-modal>
18+
<gist-sync-modal v-else-if="config.type === 'gistSync'"></gist-sync-modal>
19+
<gist-publish-modal v-else-if="config.type === 'gistPublish'"></gist-publish-modal>
20+
<blogger-publish-modal v-else-if="config.type === 'bloggerPublish'"></blogger-publish-modal>
21+
<blogger-page-publish-modal v-else-if="config.type === 'bloggerPagePublish'"></blogger-page-publish-modal>
1022
<div v-else class="modal__inner-1">
1123
<div class="modal__inner-2">
1224
<div class="modal__content" v-html="config.content"></div>
@@ -20,35 +32,56 @@
2032
</template>
2133

2234
<script>
23-
import { mapState, mapMutations } from 'vuex';
24-
import FilePropertiesModal from './FilePropertiesModal';
25-
import SettingsModal from './SettingsModal';
26-
import TemplatesModal from './TemplatesModal';
27-
import LinkModal from './LinkModal';
28-
import ImageModal from './ImageModal';
29-
import GooglePhotoModal from './GooglePhotoModal';
30-
import HtmlExportModal from './HtmlExportModal';
35+
import { mapGetters } from 'vuex';
3136
import editorEngineSvc from '../services/editorEngineSvc';
37+
import FilePropertiesModal from './modals/FilePropertiesModal';
38+
import SettingsModal from './modals/SettingsModal';
39+
import TemplatesModal from './modals/TemplatesModal';
40+
import HtmlExportModal from './modals/HtmlExportModal';
41+
import LinkModal from './modals/LinkModal';
42+
import ImageModal from './modals/ImageModal';
43+
import GooglePhotoModal from './modals/GooglePhotoModal';
44+
import SyncManagementModal from './modals/SyncManagementModal';
45+
import PublishManagementModal from './modals/PublishManagementModal';
46+
import GoogleDriveSyncModal from './modals/GoogleDriveSyncModal';
47+
import GoogleDrivePublishModal from './modals/GoogleDrivePublishModal';
48+
import DropboxSyncModal from './modals/DropboxSyncModal';
49+
import DropboxPublishModal from './modals/DropboxPublishModal';
50+
import GithubSyncModal from './modals/GithubSyncModal';
51+
import GithubPublishModal from './modals/GithubPublishModal';
52+
import GistSyncModal from './modals/GistSyncModal';
53+
import GistPublishModal from './modals/GistPublishModal';
54+
import BloggerPublishModal from './modals/BloggerPublishModal';
55+
import BloggerPagePublishModal from './modals/BloggerPagePublishModal';
3256
3357
export default {
3458
components: {
3559
FilePropertiesModal,
3660
SettingsModal,
3761
TemplatesModal,
62+
HtmlExportModal,
3863
LinkModal,
3964
ImageModal,
4065
GooglePhotoModal,
41-
HtmlExportModal,
66+
SyncManagementModal,
67+
PublishManagementModal,
68+
GoogleDriveSyncModal,
69+
GoogleDrivePublishModal,
70+
DropboxSyncModal,
71+
DropboxPublishModal,
72+
GithubSyncModal,
73+
GithubPublishModal,
74+
GistSyncModal,
75+
GistPublishModal,
76+
BloggerPublishModal,
77+
BloggerPagePublishModal,
4278
},
43-
computed: mapState('modal', [
79+
computed: mapGetters('modal', [
4480
'config',
4581
]),
4682
methods: {
47-
...mapMutations('modal', [
48-
'setConfig',
49-
]),
5083
onEscape() {
51-
this.setConfig();
84+
this.config.reject();
5285
editorEngineSvc.clEditor.focus();
5386
},
5487
onFocusInOut(evt) {
@@ -69,7 +102,7 @@ export default {
69102
}
70103
target = target.parentNode;
71104
}
72-
this.setConfig();
105+
this.config.reject();
73106
}
74107
},
75108
},
@@ -78,7 +111,7 @@ export default {
78111
window.addEventListener('focusout', this.onFocusInOut);
79112
const eltToFocus = this.$el.querySelector('input.text-input')
80113
|| this.$el.querySelector('.textfield')
81-
|| this.$el.querySelector('button.button');
114+
|| this.$el.querySelector('.button');
82115
if (eltToFocus) {
83116
eltToFocus.focus();
84117
}
@@ -103,7 +136,6 @@ export default {
103136
104137
.modal__inner-1 {
105138
margin: 0 auto;
106-
display: table;
107139
width: 100%;
108140
min-width: 320px;
109141
max-width: 500px;
@@ -142,10 +174,30 @@ export default {
142174
margin-top: 0;
143175
}
144176
177+
.modal__image {
178+
float: left;
179+
width: 64px;
180+
height: 64px;
181+
margin: 1.5em 1.5em 0.5em 0;
182+
183+
& + *::after {
184+
content: '';
185+
display: block;
186+
clear: both;
187+
}
188+
}
189+
145190
.modal__error {
146191
color: #de2c00;
147192
}
148193
194+
.modal__tip {
195+
background-color: transparentize(#ffd600, 0.85);
196+
border-radius: $border-radius-base;
197+
margin: 1.2em 0;
198+
padding: 0.75em 1.25em;
199+
}
200+
149201
.modal__button-bar {
150202
margin-top: 1.75rem;
151203
text-align: right;

0 commit comments

Comments
 (0)