Merged
Conversation
Contributor
Reviewer's Guide by SourceryThis pull request introduces the AskAI extension, which includes a block handle extension with drag and drop functionality, slash command extension refactoring, and several file relocation and renaming operations. Additionally, it fixes a bug in event emitter disposal and updates the regular expression for localization. Sequence diagram for showing slash commandsequenceDiagram
participant Editor as Editor
participant EditorSlashCommandExtension as SlashCommand
participant BlockInsertPalette as Palette
Editor->>SlashCommand: onTextInput(e)
SlashCommand->SlashCommand: __tryShowSlashCommand(e)
alt isCursor && isEmptyBlock && isSlash
SlashCommand->Palette: render(position)
activate Palette
Palette-->>SlashCommand: Menu shown
deactivate Palette
SlashCommand->Editor: view.focus()
else not (isCursor && isEmptyBlock && isSlash)
SlashCommand-->>Editor: return
end
Sequence diagram for adding a block using the block handlesequenceDiagram
participant Editor as Editor
participant EditorBlockHandleExtension as BlockHandle
participant AddBlockButton as Button
participant ProseEditorView as View
Editor->>BlockHandle: onMouseMove(e)
BlockHandle->BlockHandle: _renderController.request({ event: e })
BlockHandle->BlockHandle: renderWidget(container, nodePosition, nodeElement)
BlockHandle->>Button: onDidClick()
Button->>View: view.dispatch(newTr)
View-->>Button: Update view
Button->>BlockHandle: extension.renderPalette(domPosition)
BlockHandle->>BlockInsertPalette: render(position)
activate BlockInsertPalette
BlockInsertPalette-->>BlockHandle: Palette shown
deactivate BlockInsertPalette
BlockHandle->>View: view.focus()
Updated class diagram for EditorSlashCommandExtensionclassDiagram
class EditorSlashCommandExtension {
- _palette: BlockInsertPalette
+ constructor(editorWidget: IEditorWidget, instantiationService: IInstantiationService)
- __tryShowSlashCommand(e: IOnTextInputEvent): void
}
EditorExtension <|-- EditorSlashCommandExtension
EditorSlashCommandExtension -- BlockInsertPalette : uses
Class diagram for BlockInsertPaletteclassDiagram
class BlockInsertPalette {
- _menuRenderer: SlashMenuRenderer
- _menuController: SlashMenuController
- _keyboardController: SlashKeyboardController
+ constructor(editorWidget: IEditorWidget, contextMenuService: IContextMenuService, i18nService: II18nService)
+ render(position: IPosition): void
+ focusPrev(): void
+ focusNext(): void
+ getFocus(): number
+ getAction(indexOrID: number | string): MenuAction | undefined
+ tryOpenSubmenu(): boolean
+ hasFocus(): boolean
+ destroy(): void
+ runFocus(): void
}
Disposable <|-- BlockInsertPalette
BlockInsertPalette -- SlashMenuRenderer : uses
BlockInsertPalette -- SlashMenuController : uses
BlockInsertPalette -- SlashKeyboardController : uses
class SlashMenuRenderer {
}
class SlashMenuController {
}
class SlashKeyboardController {
}
class Disposable {
}
class MenuAction {
}
class IPosition {
}
Class diagram for EditorBlockHandleExtensionclassDiagram
class EditorBlockHandleExtension {
- _currDropPosition?: number
- _widget?: IWidgetBar
- _renderController: RequestAnimateController
- _paletteRenderer: PaletteRenderer
+ constructor(editorWidget: IEditorWidget, instantiationService: IInstantiationService)
+ unrenderWidget(): void
+ renderWidget(container: HTMLElement, nodePosition: number, nodeElement: HTMLElement): void
+ renderPalette(position: IPosition): void
- __renderWidgetWithoutTarget(e: IEditorMouseEvent): void
- __initWidget(view: ProseEditorView): IWidgetBar
}
EditorExtension <|-- EditorBlockHandleExtension
EditorBlockHandleExtension -- PaletteRenderer : uses
EditorBlockHandleExtension -- IWidgetBar : uses
class PaletteRenderer {
- _palette: BlockInsertPalette
+ constructor(editorWidget: IEditorWidget, instantiationService: IInstantiationService)
+ render(position: IPosition): void
+ destroy(): void
}
Disposable <|-- PaletteRenderer
class IWidgetBar {
}
class RequestAnimateController {
}
class IPosition {
}
class IEditorMouseEvent {
}
class ProseEditorView {
}
class EditorExtension {
}
class BlockInsertPalette {
}
class Disposable {
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
…d integrate AI text service
…ctable, and atom properties
…introducing `IEditorInputEmulator`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Template
Environment Changes
Breaking Changes
Features
Fixes
Checklist
Summary by Sourcery
This pull request introduces a block handle extension that allows users to drag and drop blocks of text within the editor. It also adds a block insert palette that provides quick insertion of various document block types at the current cursor position. The slash command extension is refactored to use the new block insert palette.
New Features:
Enhancements: