@@ -13,6 +13,7 @@ import { mapGetters } from 'vuex';
import CommentList from './gutters/CommentList';
import EditorNewDiscussionButton from './gutters/EditorNewDiscussionButton';
import store from '../store';
+import editorSvc from '../services/editorSvc';
export default {
components: {
@@ -30,7 +31,31 @@ export default {
'computedSettings',
]),
},
+ methods: {
+ setImgAndDoClick(items) {
+ let file = null;
+ if (!items || items.length === 0) {
+ return;
+ }
+ for (let i = 0; i < items.length; i += 1) {
+ if (items[i].type.indexOf('image') !== -1) {
+ file = items[i].getAsFile();
+ break;
+ }
+ }
+ if (!file) {
+ return;
+ }
+ store.dispatch('img/setImg', file);
+ editorSvc.pagedownEditor.uiManager.doClick('image');
+ },
+ },
mounted() {
+ // 当前选择的图片存储图床
+ const currImgStorageStr = localStorage.getItem('img/checkedStorage');
+ if (currImgStorageStr) {
+ store.commit('img/changeCheckedStorage', JSON.parse(currImgStorageStr));
+ }
const editorElt = this.$el.querySelector('.editor__inner');
const onDiscussionEvt = cb => (evt) => {
let elt = evt.target;
@@ -56,6 +81,15 @@ export default {
store.commit('discussion/setCurrentDiscussionId', discussionId);
}));
+ editorElt.addEventListener('drop', (event) => {
+ const transItems = event.dataTransfer.items;
+ this.setImgAndDoClick(transItems);
+ });
+ editorElt.addEventListener('paste', (event) => {
+ const pasteItems = (event.clipboardData || window.clipboardData).items;
+ this.setImgAndDoClick(pasteItems);
+ });
+
this.$watch(
() => store.state.discussion.currentDiscussionId,
(discussionId, oldDiscussionId) => {
diff --git a/src/components/Modal.vue b/src/components/Modal.vue
index 05fae4f7..164b0837 100644
--- a/src/components/Modal.vue
+++ b/src/components/Modal.vue
@@ -78,6 +78,7 @@ import ZendeskAccountModal from './modals/providers/ZendeskAccountModal';
import ZendeskPublishModal from './modals/providers/ZendeskPublishModal';
import CouchdbWorkspaceModal from './modals/providers/CouchdbWorkspaceModal';
import CouchdbCredentialsModal from './modals/providers/CouchdbCredentialsModal';
+import SmmsAccountModal from './modals/providers/SmmsAccountModal';
const getTabbables = container => container.querySelectorAll('a[href], button, .textfield, input[type=checkbox]')
// Filter enabled and visible element
@@ -139,6 +140,7 @@ export default {
ZendeskPublishModal,
CouchdbWorkspaceModal,
CouchdbCredentialsModal,
+ SmmsAccountModal,
},
computed: {
...mapGetters([
diff --git a/src/components/Tour.vue b/src/components/Tour.vue
index 38ab159d..c9ad7069 100644
--- a/src/components/Tour.vue
+++ b/src/components/Tour.vue
@@ -39,7 +39,7 @@
Enjoy!
-
如果您喜欢StackEdit,请在Chrome网络商店上给5颗星打分。
+
如果您喜欢StackEdit中文版,请在Gitee仓库上点一下starred,谢谢!
diff --git a/src/components/modals/AccountManagementModal.vue b/src/components/modals/AccountManagementModal.vue
index a175b996..293eb112 100644
--- a/src/components/modals/AccountManagementModal.vue
+++ b/src/components/modals/AccountManagementModal.vue
@@ -77,6 +77,10 @@
添加Zendesk账号
+
+
+ 添加SM.MS账号
+