Skip to content

Commit 89ac1a4

Browse files
committed
fix: tsc errors
1 parent d674bf8 commit 89ac1a4

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

base.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ export default class CabinetBase {
1818
}
1919

2020
protected insertAfter (referenceNode: HTMLElement, newNode: HTMLElement) {
21-
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling)
21+
referenceNode.parentNode!.insertBefore(newNode, referenceNode.nextSibling)
2222
}
2323
}

document.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export default class ShimoDocumentCabinet extends CabinetBase {
152152
public initGallery (editor: ShimoSDK.Document.Editor): void {
153153
const options: ShimoSDK.Document.GalleryOptions = {
154154
editor,
155-
downloadServer: this.editorOptions.downloadConfig.origin
155+
downloadServer: this.editorOptions?.downloadConfig?.origin || ''
156156
}
157157
const gallery: ShimoSDK.Document.Gallery = new this.sdkDocument.plugins.Gallery(options)
158158
gallery.render()
@@ -179,7 +179,7 @@ export default class ShimoDocumentCabinet extends CabinetBase {
179179
const historyShowContainer = this.getDom('history-content')
180180
history.render(historyShowContainer)
181181

182-
const clickDom = this.getDom('ql-history', null, 'button')
182+
const clickDom = this.getDom('ql-history', undefined, 'button')
183183
clickDom.setAttribute('type', 'button')
184184
clickDom.classList.add('ql-history')
185185

@@ -194,14 +194,14 @@ export default class ShimoDocumentCabinet extends CabinetBase {
194194
toolbarContainer.appendChild(clickDom)
195195
}
196196

197-
const historyContainer: HTMLElement = document.querySelector('.history-container')
197+
const historyContainer: HTMLElement = document.querySelector('.history-container') as HTMLElement
198198

199199
clickDom.addEventListener('click', () => {
200200
historyContainer.style.display = 'block'
201201
editor.comment.hide()
202202
})
203203

204-
document.querySelector('.history-close-btn').addEventListener('click', () => {
204+
document.querySelector('.history-close-btn')!.addEventListener('click', () => {
205205
historyContainer.style.display = 'none'
206206
editor.comment.show()
207207
})
@@ -277,9 +277,9 @@ export default class ShimoDocumentCabinet extends CabinetBase {
277277
const options: ShimoSDK.Document.UploaderOptions = {
278278
editor,
279279
container: '#sm-editor',
280-
url: this.editorOptions.uploadConfig.origin,
281-
accessToken: this.editorOptions.uploadConfig.token,
282-
type: this.editorOptions.uploadConfig.server
280+
url: this.editorOptions?.uploadConfig?.origin,
281+
accessToken: this.editorOptions?.uploadConfig?.token,
282+
type: this.editorOptions?.uploadConfig?.server
283283
}
284284

285285
const uploader: ShimoSDK.Document.Uploader = new this.sdkDocument.plugins.Uploader(options)
@@ -291,10 +291,10 @@ export default class ShimoDocumentCabinet extends CabinetBase {
291291
const options: ShimoSDK.Document.ShortcutOptions = {
292292
editor,
293293
plugins: {
294-
demoScreen: null,
294+
demoScreen: undefined,
295295
revision: null,
296-
history: null,
297-
tableOfContent: null
296+
history: undefined,
297+
tableOfContent: undefined
298298
}
299299
}
300300

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"ts-loader": "^5.3.3",
1616
"tslint": "^5.15.0",
1717
"tslint-config-standard": "^8.0.1",
18-
"typescript": "^3.4.3",
18+
"typescript": "^3.7.0",
1919
"webpack": "^4.30.0",
2020
"webpack-cli": "^3.3.0"
2121
},

0 commit comments

Comments
 (0)