Skip to content

Port Emoji plugin to PickerPlugin handler model - #3420

Draft
JiuqingSong with Copilot wants to merge 2 commits into
masterfrom
copilot/port-emoji-plugin-to-use-pickerplugin
Draft

Port Emoji plugin to PickerPlugin handler model#3420
JiuqingSong with Copilot wants to merge 2 commits into
masterfrom
copilot/port-emoji-plugin-to-use-pickerplugin

Conversation

Copilot AI commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

The emoji suggest/insert flow in roosterjs-react was still implemented as a bespoke keydown/keyup state machine. This change migrates it to the shared PickerPlugin abstraction so emoji behavior uses the same picker lifecycle and keyboard model as other pickers.

  • PickerPlugin integration

    • Refactored EmojiPlugin to compose PickerPlugin(':', handler) and implement PickerHandler.
    • Delegated event processing (onPluginEvent, exclusive key handling) to PickerPlugin.
  • Emoji-specific handler behavior

    • Implemented picker callbacks in EmojiPlugin:
      • onTrigger opens emoji callout and initializes query.
      • onQueryStringChanged updates emoji pane search text.
      • onSelectionChanged maps picker movement modes to EmojiPane.navigate(...).
      • onSelect commits selected emoji or expands to full picker for MoreEmoji.
  • Content insertion path

    • Replaced manual selection/segment mutation with picker helper commit:
      • Build a minimal content model (Text(emoji) + SelectionMarker).
      • Commit via pickerHelper.replaceQueryString(...).
      • Close picker via helper, keeping behavior aligned with picker semantics.
this.pickerPlugin = new PickerPlugin(':', this);

public onSelect(): void {
    const selectedEmoji = this.paneRef.current?.getSelectedEmoji();
    if (selectedEmoji === MoreEmoji) {
        this.paneRef.current?.showFullPicker(this.queryString);
        return;
    }

    const model = createContentModelDocument();
    const paragraph = createParagraph();
    paragraph.segments.push(createText(selectedEmoji.codePoint), createSelectionMarker());
    model.blocks.push(paragraph);

    this.pickerHelper?.replaceQueryString(model, undefined, true);
    this.pickerHelper?.closePicker();
}

Copilot AI linked an issue Jul 29, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Port emoji plugin to use PickerPlugin Port Emoji plugin to PickerPlugin handler model Jul 29, 2026
Copilot AI requested a review from JiuqingSong July 29, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

port Emoji Plugin to use PickerPlugin

2 participants