Skip to content

Commit

Permalink
fix: tsc errors
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisyip committed Nov 13, 2019
1 parent d674bf8 commit 89ac1a4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ export default class CabinetBase {
}

protected insertAfter (referenceNode: HTMLElement, newNode: HTMLElement) {
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling)
referenceNode.parentNode!.insertBefore(newNode, referenceNode.nextSibling)
}
}
20 changes: 10 additions & 10 deletions document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export default class ShimoDocumentCabinet extends CabinetBase {
public initGallery (editor: ShimoSDK.Document.Editor): void {
const options: ShimoSDK.Document.GalleryOptions = {
editor,
downloadServer: this.editorOptions.downloadConfig.origin
downloadServer: this.editorOptions?.downloadConfig?.origin || ''
}
const gallery: ShimoSDK.Document.Gallery = new this.sdkDocument.plugins.Gallery(options)
gallery.render()
Expand All @@ -179,7 +179,7 @@ export default class ShimoDocumentCabinet extends CabinetBase {
const historyShowContainer = this.getDom('history-content')
history.render(historyShowContainer)

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

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

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

clickDom.addEventListener('click', () => {
historyContainer.style.display = 'block'
editor.comment.hide()
})

document.querySelector('.history-close-btn').addEventListener('click', () => {
document.querySelector('.history-close-btn')!.addEventListener('click', () => {
historyContainer.style.display = 'none'
editor.comment.show()
})
Expand Down Expand Up @@ -277,9 +277,9 @@ export default class ShimoDocumentCabinet extends CabinetBase {
const options: ShimoSDK.Document.UploaderOptions = {
editor,
container: '#sm-editor',
url: this.editorOptions.uploadConfig.origin,
accessToken: this.editorOptions.uploadConfig.token,
type: this.editorOptions.uploadConfig.server
url: this.editorOptions?.uploadConfig?.origin,
accessToken: this.editorOptions?.uploadConfig?.token,
type: this.editorOptions?.uploadConfig?.server
}

const uploader: ShimoSDK.Document.Uploader = new this.sdkDocument.plugins.Uploader(options)
Expand All @@ -291,10 +291,10 @@ export default class ShimoDocumentCabinet extends CabinetBase {
const options: ShimoSDK.Document.ShortcutOptions = {
editor,
plugins: {
demoScreen: null,
demoScreen: undefined,
revision: null,
history: null,
tableOfContent: null
history: undefined,
tableOfContent: undefined
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"ts-loader": "^5.3.3",
"tslint": "^5.15.0",
"tslint-config-standard": "^8.0.1",
"typescript": "^3.4.3",
"typescript": "^3.7.0",
"webpack": "^4.30.0",
"webpack-cli": "^3.3.0"
},
Expand Down

0 comments on commit 89ac1a4

Please sign in to comment.