Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2021-01-13 21:18:04 +0300
committerJulius Härtl <jus@bitgrid.net>2021-01-13 21:34:03 +0300
commit43f443f380cf6e5f9825db10a15f2e73964dc2a3 (patch)
tree8357ea9b659d3806a9344d538213e3df6dc5c7fc /src
parent12b42d11f977f4895cb782dd0bcdfc756e9e6187 (diff)
Fix cases where vuex is not setup globally
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src')
-rw-r--r--src/components/EditorWrapper.vue2
-rw-r--r--src/components/SessionList.vue3
-rw-r--r--src/components/ViewerComponent.vue3
-rw-r--r--src/mixins/store.js36
4 files changed, 41 insertions, 3 deletions
diff --git a/src/components/EditorWrapper.vue b/src/components/EditorWrapper.vue
index 50331592a..9cea69aef 100644
--- a/src/components/EditorWrapper.vue
+++ b/src/components/EditorWrapper.vue
@@ -85,6 +85,7 @@ import { EditorContent } from 'tiptap'
import { Collaboration } from 'tiptap-extensions'
import { Keymap, UserColor } from './../extensions'
import isMobile from './../mixins/isMobile'
+import store from './../mixins/store'
import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip'
import { getVersion, receiveTransaction } from 'prosemirror-collab'
import { Step } from 'prosemirror-transform'
@@ -107,6 +108,7 @@ export default {
},
mixins: [
isMobile,
+ store,
],
props: {
initialSession: {
diff --git a/src/components/SessionList.vue b/src/components/SessionList.vue
index 701dffcd9..a05c25a6c 100644
--- a/src/components/SessionList.vue
+++ b/src/components/SessionList.vue
@@ -77,6 +77,7 @@
import Avatar from '@nextcloud/vue/dist/Components/Avatar'
import Popover from '@nextcloud/vue/dist/Components/Popover'
import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip'
+import store from '../mixins/store'
const COLLABORATOR_IDLE_TIME = 60
const COLLABORATOR_DISCONNECT_TIME = 90
@@ -90,6 +91,7 @@ export default {
directives: {
tooltip: Tooltip,
},
+ mixins: [store],
props: {
sessions: {
type: Object,
@@ -193,6 +195,7 @@ export default {
.session-menu {
max-width: 280px;
+ padding-top: 6px;
padding-bottom: 6px;
ul li {
diff --git a/src/components/ViewerComponent.vue b/src/components/ViewerComponent.vue
index bf86ff5c4..952f7b8b3 100644
--- a/src/components/ViewerComponent.vue
+++ b/src/components/ViewerComponent.vue
@@ -29,8 +29,6 @@
</template>
<script>
-import store from './../store'
-
export default {
name: 'ViewerComponent',
components: {
@@ -59,7 +57,6 @@ export default {
},
},
beforeMount() {
- this.$store = store
// FIXME Dirty fix to avoid recreating the component on stable16
if (typeof this.$parent.$parent !== 'undefined' && this.$parent.$parent.onResize) {
window.removeEventListener('resize', this.$parent.$parent.onResize)
diff --git a/src/mixins/store.js b/src/mixins/store.js
new file mode 100644
index 000000000..fb73617b6
--- /dev/null
+++ b/src/mixins/store.js
@@ -0,0 +1,36 @@
+/*
+ * @copyright Copyright (c) 2021 Julius Härtl <jus@bitgrid.net>
+ *
+ * @author Julius Härtl <jus@bitgrid.net>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+import store from '../store'
+
+/**
+ * This mixin is required since we cannot be sure that the root Vue instance has
+ * registered the global store. This might be the case if the text app components
+ * are mounted in other apps e.g. viewer
+ */
+export default {
+ beforeMount() {
+ if (typeof this.$store === 'undefined') {
+ this.$store = store
+ }
+ },
+}