minor cleanup

This commit is contained in:
Chen-I Lim 2020-10-15 11:59:56 -07:00
parent 93d3dd6ee2
commit fdc30d003a
6 changed files with 28 additions and 26 deletions

View file

@ -246,7 +246,7 @@ class BoardComponent extends React.Component<Props, State> {
if (boardTree.groupByProperty) {
card.properties[boardTree.groupByProperty.id] = groupByValue
}
await mutator.insertBlock(card, "add card", async () => { await this.setState({shownCard: card}) }, async () => { await this.setState({shownCard: undefined}) })
await mutator.insertBlock(card, "add card", async () => { this.setState({shownCard: card}) }, async () => { this.setState({shownCard: undefined}) })
}
async propertyNameChanged(option: IPropertyOption, text: string) {

View file

@ -48,12 +48,12 @@ class CardDialog extends React.Component<Props, State> {
this.cardListener = new OctoListener()
this.cardListener.open(this.props.card.id, async () => {
await cardTree.sync()
this.setState({cardTree: cardTree})
this.setState({ cardTree })
})
const cardTree = new CardTree(this.props.card.id)
cardTree.sync().then(() => {
this.setState({cardTree})
});
})
document.addEventListener("keydown", this.keydownHandler)
}

View file

@ -13,9 +13,11 @@ class FilterClause {
case "notIncludes": return "doesn't include"
case "isEmpty": return "is empty"
case "isNotEmpty": return "is not empty"
default: {
Utils.assertFailure()
return "(unknown)"
}
}
Utils.assertFailure()
return "(unknown)"
}
constructor(o: any = {}) {

View file

@ -14,9 +14,6 @@ import { Utils } from "./utils"
// It also ensures that the Undo-manager is called for each action
//
class Mutator {
constructor() {
}
async insertBlock(block: IBlock, description: string = "add", afterRedo?: () => Promise<void>, beforeUndo?: () => Promise<void>) {
await undoManager.perform(
async () => {
@ -510,21 +507,21 @@ class Mutator {
return block
}
async undo() {
await undoManager.undo()
}
async undo() {
await undoManager.undo()
}
undoDescription(): string | undefined {
return undoManager.undoDescription
}
undoDescription(): string | undefined {
return undoManager.undoDescription
}
async redo() {
await undoManager.redo()
}
async redo() {
await undoManager.redo()
}
redoDescription(): string | undefined {
return undoManager.redoDescription
}
redoDescription(): string | undefined {
return undoManager.redoDescription
}
}
const mutator = new Mutator()

View file

@ -1,7 +1,7 @@
interface UndoCommand {
checkpoint: number
undo: () => void
redo: () => void
undo: () => Promise<void>
redo: () => Promise<void>
description?: string
}
@ -54,8 +54,8 @@ class UndoManager {
}
async perform(
redo: () => void,
undo: () => void,
redo: () => Promise<void>,
undo: () => Promise<void>,
description?: string,
isDiscardable = false
): Promise<UndoManager> {
@ -64,7 +64,10 @@ class UndoManager {
}
registerUndo(
command: { undo: () => void; redo: () => void },
command: {
undo: () => Promise<void>,
redo: () => Promise<void>
},
description?: string,
isDiscardable = false
): UndoManager {

View file

@ -6,7 +6,7 @@
"no-bitwise": true,
"no-conditional-assignment": true,
"no-consecutive-blank-lines": true,
"indent": [true, "tabs"],
"indent": [false, "tabs"],
"member-access": [true, "no-public"],
"semicolon": [true, "never"],
"variable-name": [