Skip to content
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

Update DraftJS Mention Plugin. #529

Conversation

igorschoester
Copy link
Member

@igorschoester igorschoester commented May 15, 2018

Summary

This PR can be summarized in the following changelog entry:

  • N/A

Relevant technical choices:

  • Updated draft-js-mention-plugin to get rid of the console warning.
  • Refactored serialize and unserialize. Partly for the major version upgrade. And partly for the marking issue.
  • Now passes the tags along to ignore non-tag affix matches.

Test instructions

This PR can be tested by following these steps:

  • Run the tests.
  • Check in the stand-alone.
  • Link with the plugin and test.

Fixes Yoast/wordpress-seo#9684 and Yoast/wordpress-seo#9653

@abotteram
Copy link
Contributor

CR 👍

import sortedIndexBy from "lodash/sortedIndexBy";
import trim from "lodash/trim";

const AFFIX = "%%";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be renamed to CIRCUMFIX.

Copy link
Contributor

@boblinthorst boblinthorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issues are known, moving this along.

*
* @returns {Array} Array of found indices.
*/
const getIndicesOf = ( searchTerm, text ) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want to unit test this function in the future.

* @returns {Object} The raw data ready for convertFromRaw.
*/
export function unserializeEditor( content ) {
export function unserializeEditor( content, tags ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed in person. In the future, we're gonna want to extract some parts of this function to make ik more comprehensive.

@boblinthorst
Copy link
Contributor

Acceptance: ok 👍

@boblinthorst boblinthorst added this to the 3.6 milestone May 16, 2018
@boblinthorst boblinthorst merged commit 6331ac5 into develop May 16, 2018
@boblinthorst boblinthorst deleted the stories/fix-console-warning-when-opening-replace-var-suggestions-in-react-snippet-editor branch May 16, 2018 10:27
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.

Console warning when opening replace var suggestions in react snippet editor
3 participants