Skip to content

Commit d36e60c

Browse files
authored
Merge pull request #6930 from nextcloud/drop/vuex
drop/vuex
2 parents 7d9b968 + 837b035 commit d36e60c

25 files changed

+141
-218
lines changed

package-lock.json

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@
108108
"vue": "^2.7.16",
109109
"vue-click-outside": "^1.1.0",
110110
"vue-material-design-icons": "^5.3.1",
111-
"vuex": "^3.6.2",
112111
"webdav": "^5.7.1",
113112
"y-prosemirror": "^1.2.15",
114113
"y-protocols": "^1.0.6",

src/components/Editor/EditorOutline.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import { NcButton } from '@nextcloud/vue'
2525
import TableOfContents from './TableOfContents.vue'
2626
import { useOutlineStateMixin, useOutlineActions } from './Wrapper.provider.js'
2727
import { Close } from './../icons.js'
28-
import useStore from '../../mixins/store.js'
2928
import { useIsMobileMixin } from '../Editor.provider.js'
3029
3130
export default {
@@ -37,7 +36,6 @@ export default {
3736
},
3837
mixins: [
3938
useIsMobileMixin,
40-
useStore,
4139
useOutlineStateMixin,
4240
useOutlineActions,
4341
],

src/components/Editor/TableOfContents.vue

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,28 @@
2323
</template>
2424

2525
<script>
26-
import { mapState } from 'vuex'
27-
import { useEditorMixin } from '../Editor.provider.js'
28-
import useStore from '../../mixins/store.js'
26+
import { useEditorMixin } from '../../components/Editor.provider.js'
27+
import { headingAnchorPluginKey } from '../../plugins/headingAnchor.js'
2928
3029
export default {
3130
name: 'TableOfContents',
32-
mixins: [useStore, useEditorMixin],
31+
mixins: [useEditorMixin],
3332
data: () => ({
3433
initialRender: true,
34+
headings: [],
3535
}),
36-
computed: {
37-
...mapState({
38-
headings: (state) => state.text.headings,
39-
}),
40-
},
4136
mounted() {
37+
if (this.$editor) {
38+
this.$editor.on('update', this.updateHeadings)
39+
this.updateHeadings()
40+
}
4241
setTimeout(() => {
4342
this.initialRender = false
4443
}, 1000)
4544
},
45+
beforeDestroy() {
46+
this.$editor.off('update', this.updateHeadings)
47+
},
4648
methods: {
4749
goto(heading) {
4850
document.getElementById(heading.id).scrollIntoView()
@@ -51,6 +53,10 @@ export default {
5153
window.location.hash = heading.id
5254
})
5355
},
56+
updateHeadings() {
57+
this.headings = headingAnchorPluginKey
58+
.getState(this.$editor.state)?.headings ?? []
59+
},
5460
},
5561
}
5662
</script>

src/components/Editor/Wrapper.vue

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@
1717
<script>
1818
import { useIsRichEditorMixin, useIsRichWorkspaceMixin } from './../Editor.provider.js'
1919
import { OUTLINE_STATE, OUTLINE_ACTIONS, READ_ONLY_ACTIONS } from './Wrapper.provider.js'
20-
import useStore from '../../mixins/store.js'
21-
import { mapState } from 'vuex'
2220
2321
export default {
2422
name: 'Wrapper',
25-
mixins: [useStore, useIsRichEditorMixin, useIsRichWorkspaceMixin],
23+
mixins: [useIsRichEditorMixin, useIsRichWorkspaceMixin],
2624
provide() {
2725
const val = {}
2826
@@ -72,9 +70,6 @@ export default {
7270
}),
7371
7472
computed: {
75-
...mapState({
76-
viewWidth: (state) => state.text.viewWidth,
77-
}),
7873
showOutline() {
7974
return this.isAbleToShowOutline
8075
? this.outline.visible

src/components/Menu/ActionList.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import { BaseActionEntry } from './BaseActionEntry.js'
3838
import ActionListItem from './ActionListItem.vue'
3939
import { getActionState, getIsActive } from './utils.js'
4040
import { useOutlineStateMixin } from '../Editor/Wrapper.provider.js'
41-
import useStore from '../../mixins/store.js'
4241
import { useMenuIDMixin } from './MenuBar.provider.js'
4342
import debounce from 'debounce'
4443
@@ -50,7 +49,7 @@ export default {
5049
ActionListItem,
5150
},
5251
extends: BaseActionEntry,
53-
mixins: [useStore, useOutlineStateMixin, useMenuIDMixin],
52+
mixins: [useOutlineStateMixin, useMenuIDMixin],
5453
props: {
5554
forceEnabled: {
5655
type: Boolean,

src/components/Menu/BaseActionEntry.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import debounce from 'debounce'
1010
import { useEditorMixin, useIsMobileMixin } from '../Editor.provider.js'
1111
import { useOutlineActions, useOutlineStateMixin, useReadOnlyActions } from '../Editor/Wrapper.provider.js'
1212
import { getActionState, getKeys, getKeyshortcuts } from './utils.js'
13-
import useStore from '../../mixins/store.js'
1413

1514
import './ActionEntry.scss'
1615

@@ -21,7 +20,6 @@ const BaseActionEntry = {
2120
mixins: [
2221
useEditorMixin,
2322
useIsMobileMixin,
24-
useStore,
2523
useOutlineActions,
2624
useOutlineStateMixin,
2725
useReadOnlyActions,

src/editor.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*/
55

66
import Vue from 'vue'
7-
import store from './store/index.js'
87
import { subscribe } from '@nextcloud/event-bus'
98
import { EDITOR_UPLOAD, HOOK_MENTION_SEARCH, HOOK_MENTION_INSERT, ATTACHMENT_RESOLVER } from './components/Editor.provider.js'
109
import { ACTION_ATTACHMENT_PROMPT } from './components/Editor/MediaHandler.provider.js'
@@ -254,7 +253,6 @@ window.OCA.Text.createEditor = async function({
254253
scopedSlots,
255254
})
256255
},
257-
store,
258256
})
259257
return new TextEditorEmbed(vm, data)
260258
.onCreate(onCreate)

src/files.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,12 @@ document.addEventListener('DOMContentLoaded', async () => {
2222
if (workspaceAvailable && OCA && OCA?.Files?.Settings) {
2323
const { default: Vue } = await import('vue')
2424
const { default: FilesSettings } = await import('./views/FilesSettings.vue')
25-
const { default: store } = await import('./store/index.js')
2625

2726
Vue.prototype.t = window.t
2827
Vue.prototype.n = window.n
2928
Vue.prototype.OCA = window.OCA
3029
const vm = new Vue({
3130
render: h => h(FilesSettings, {}),
32-
store,
3331
})
3432
const el = vm.$mount().$el
3533
OCA.Files.Settings.register(new OCA.Files.Settings.Setting('text', {

src/helpers/files.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import axios from '@nextcloud/axios'
1616
import TextSvg from '@mdi/svg/svg/text.svg?raw'
1717

1818
import { openMimetypes } from './mime.js'
19-
import store from '../store/index.js'
2019

2120
const FILE_ACTION_IDENTIFIER = 'Edit with text app'
2221

@@ -205,7 +204,6 @@ export const FilesWorkspaceHeader = new Header({
205204
hasRichWorkspace,
206205
content,
207206
},
208-
store,
209207
}).$mount(el)
210208
})
211209
},

0 commit comments

Comments
 (0)