Skip to content

[EuiMarkdownEditor] Markdown mentions - #5885

Closed
chandlerprall wants to merge 12 commits into
elastic:mainfrom
chandlerprall:markdown-mentions
Closed

chandlerprall wants to merge 12 commits into
elastic:mainfrom
chandlerprall:markdown-mentions

Conversation

@chandlerprall

@chandlerprall chandlerprall commented May 6, 2022 •

Copy link
Copy Markdown
Contributor

DRAFT PROPOSAL

SPEC: #5829

Curent statuses:

  • in design
  • api exploration
  • ux exploration
  • did I mention (ha!) exploration

Temporary caveats:

Summary

markdown_mentions_prototype.mov

Given a configuration,

src-docs/src/views/markdown_editor/markdown_editor.js

const parsingPlugins = getDefaultEuiMarkdownParsingPlugins();
const processingPlugins = getDefaultEuiMarkdownProcessingPlugins();
const uiPlugins = getDefaultEuiMarkdownUiPlugins();

const mentionsConfig = {
  options: [
    { label: 'miukimiu', data: { first: 'Elizabet' } },
    { label: 'chandlerprall', data: { first: 'Chandler' } },
    { label: 'thompsongl', data: { first: 'Greg' } },
    { label: 'cchaos', data: { first: 'Caroline' } },
    { label: '1copenut', data: { first: 'Trevor' } },
    { label: 'constancecchen', data: { first: 'Constance' } },
    { label: 'snide', data: { first: 'Dave' } },
  ],
};

parsingPlugins.push([MarkdownMentions.parser, mentionsConfig]);
processingPlugins[1][1].components.mentionsPlugin = MarkdownMentions.renderer;
uiPlugins.push(MarkdownMentions.plugin);

this parses @... as a mentionsPlugin node, passing the configuration options to an EuiSelectable while the textarea retains focus. The popover component attaches keyboard listeners to the textarea to handle up/down arrows, enter, and escape keys to manipulate the selectable component. The renderer renders the mentioned name and, if it matches a config option, adds the first name value as a tooltip.

Checklist

Checklist

  • Checked in both light and dark modes
  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • Props have proper autodocs and playground toggles
  • Added documentation
  • Checked Code Sandbox works for any docs examples
  • Added or updated jest and cypress tests
  • Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • Updated the Figma library counterpart
  • A changelog entry exists and is marked appropriately

@kibanamachine

Copy link
Copy Markdown
Contributor

@kibanamachine

Copy link
Copy Markdown
Contributor

@kibanamachine

Copy link
Copy Markdown
Contributor

@kibanamachine

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants