Skip to content

Commit 0a18ad3

Browse files
committed
chore(type) a few more files
Signed-off-by: Max <[email protected]>
1 parent a4a61c3 commit 0a18ad3

File tree

13 files changed

+50
-34
lines changed

13 files changed

+50
-34
lines changed

src/EditorFactory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import hljs from 'highlight.js/lib/core'
1010
import { createLowlight } from 'lowlight'
1111

1212
import { FocusTrap, PlainText, RichText } from './extensions/index.js'
13-
import { logger } from './helpers/logger.js'
13+
import { logger } from './helpers/logger.ts'
1414

1515
const lowlight = createLowlight()
1616

src/components/Editor.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ import { provideSaveService } from '../composables/useSaveService.ts'
106106
import { provideSyncService } from '../composables/useSyncService.ts'
107107
import { useSyntaxHighlighting } from '../composables/useSyntaxHighlighting.ts'
108108
import { CollaborationCursor } from '../extensions/index.js'
109-
import { exposeForDebugging, removeFromDebugging } from '../helpers/debug.js'
110-
import { logger } from '../helpers/logger.js'
109+
import { exposeForDebugging, removeFromDebugging } from '../helpers/debug.ts'
110+
import { logger } from '../helpers/logger.ts'
111111
import { setInitialYjsState } from '../helpers/setInitialYjsState.js'
112112
import { ERROR_TYPE, IDLE_TIMEOUT } from '../services/SyncService.ts'
113113
import { fetchNode } from '../services/WebdavClient.ts'

src/components/Editor/MediaHandler.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import {
3636
insertAttachmentFile,
3737
uploadAttachment,
3838
} from '../../apis/attach.ts'
39-
import { logger } from '../../helpers/logger.js'
39+
import { logger } from '../../helpers/logger.ts'
4040
4141
import { useEditor } from '../../composables/useEditor.ts'
4242
import { useFileMixin } from '../Editor.provider.ts'

src/files.js renamed to src/files.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,30 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55
import { loadState } from '@nextcloud/initial-state'
6+
import { initialize } from './oca.text'
67

78
// eslint-disable-next-line import/no-unresolved, n/no-missing-import
89
import 'vite/modulepreload-polyfill'
910

11+
initialize()
12+
1013
const workspaceAvailable = loadState('text', 'workspace_available')
11-
const workspaceEnabled = loadState('text', 'workspace_enabled')
12-
const openReadOnlyEnabled = loadState('text', 'open_read_only_enabled')
1314

1415
document.addEventListener('DOMContentLoaded', async () => {
15-
if (workspaceAvailable && OCA && OCA?.Files?.Settings) {
16+
if (workspaceAvailable && window.OCA && window.OCA.Files?.Settings) {
1617
const { default: Vue } = await import('vue')
1718
const { default: FilesSettings } = await import('./views/FilesSettings.vue')
1819

1920
const vm = new Vue({
2021
render: (h) => h(FilesSettings, {}),
2122
})
2223
const el = vm.$mount().$el
23-
OCA.Files.Settings.register(
24-
new OCA.Files.Settings.Setting('text', {
24+
window.OCA.Files.Settings.register(
25+
new window.OCA.Files.Settings.Setting('text', {
2526
el: () => {
2627
return el
2728
},
2829
}),
2930
)
3031
}
3132
})
32-
33-
OCA.Text = {
34-
RichWorkspaceEnabled: workspaceEnabled,
35-
OpenReadOnlyEnabled: openReadOnlyEnabled,
36-
}

src/helpers/debug.js renamed to src/helpers/debug.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@ if (!window.OCA.Text.debugYjs) {
5151

5252
/**
5353
* Expose editor component in OCA.Text.editorComponents
54-
* @param {object} component - the editor component to include in debug output
54+
* @param component - the editor component to include in debug output
5555
*/
56-
export function exposeForDebugging(component) {
56+
export function exposeForDebugging(component: object) {
5757
editorComponents.add(component)
5858
}
5959

6060
/**
6161
* Drop editor component from OCA.Text.editorComponents
62-
* @param {object} component - the editor component to remove from debug output
62+
* @param component - the editor component to remove from debug output
6363
*/
64-
export function removeFromDebugging(component) {
64+
export function removeFromDebugging(component: object) {
6565
editorComponents.delete(component)
6666
}

src/nodes/ImageView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ import ClickOutside from 'vue-click-outside'
143143
import { useAttachmentResolver } from '../components/Editor.provider.ts'
144144
import { TrashCan as DeleteIcon, Image as ImageIcon } from '../components/icons.js'
145145
import ShowImageModal from '../components/ImageView/ShowImageModal.vue'
146-
import { logger } from '../helpers/logger.js'
146+
import { logger } from '../helpers/logger.ts'
147147
148148
class LoadImageError extends Error {
149149
constructor(reason, imageUrl) {

src/oca.text.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
3+
* SPDX-License-Identifier: AGPL-3.0-or-later
4+
*/
5+
6+
import { loadState } from '@nextcloud/initial-state'
7+
8+
export interface OCA_Text {
9+
RichWorkspaceEnabled: boolean
10+
OpenReadOnlyEnabled: boolean
11+
}
12+
13+
/**
14+
* Initialize the global OCA.Text state
15+
*/
16+
export function initialize() {
17+
18+
window.OCA.Text = {
19+
RichWorkspaceEnabled: loadState<boolean>('text', 'workspace_available'),
20+
OpenReadOnlyEnabled: loadState<boolean>('text', 'open_read_only_enabled'),
21+
}
22+
23+
}

src/public.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/public.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
3+
* SPDX-License-Identifier: AGPL-3.0-or-later
4+
*/
5+
6+
import { initialize } from './oca.text'
7+
8+
initialize()

src/services/SyncServiceProvider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6-
import { logger } from '../helpers/logger.js'
6+
import { logger } from '../helpers/logger.ts'
77
import initWebSocketPolyfill from './WebSocketPolyfill.ts'
88
import { WebsocketProvider } from './y-websocket.js'
99

0 commit comments

Comments
 (0)