-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto format fixes #2520
Auto format fixes #2520
Conversation
private handleEditorInputEvent(editor: IEditor, event: EditorInputEvent) { | ||
const rawEvent = event.rawEvent; | ||
if (rawEvent.inputType === 'insertText') { | ||
const { autoBullet, autoNumbering } = this.options; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this line down, only do this when you need it
private handleKeyDownEvent(editor: IEditor, event: KeyDownEvent) { | ||
const rawEvent = event.rawEvent; | ||
if (!rawEvent.defaultPrevented && !event.handledByEditFeature) { | ||
const { autoBullet, autoNumbering, autoUnlink, autoLink } = this.options; | ||
const { autoUnlink, autoLink } = this.options; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
const listItem = getFirstSelectedListItem(model); | ||
if (listItem) { | ||
const listItems = findListItemsInSameThread(model, listItem); | ||
const levelIndex = listItem.levels.length - 1; | ||
// If the index < 1, it is a new list, so it will be starting by 1, then no need to set startNumber | ||
if (index && index > 1 && isOrderedList) { | ||
const level = listItem?.levels[levelIndex]; | ||
if (level) { | ||
level.format.startNumberOverride = index; | ||
} | ||
} | ||
|
||
listItems.forEach(listItem => { | ||
const level = listItem.levels[levelIndex]; | ||
if (level) { | ||
updateListMetadata(level, metadata => | ||
Object.assign( | ||
{}, | ||
metadata, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these code copied from the format API? Can we try not duplicate the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I split in two apis
This PR includes the followings fixes:
keyboardListTrigger
function, then AutoFormatSettings plugin from OWA can recognize a list was triggered.