Skip to content

Use createElement for JSX#1150

Merged
zbeyens merged 3 commits intoudecode:mainfrom
tinacms:main
Oct 14, 2021
Merged

Use createElement for JSX#1150
zbeyens merged 3 commits intoudecode:mainfrom
tinacms:main

Conversation

@jeffsee55
Copy link
Contributor

Description

Closes #1127 by using the classic React.createElement function rather than the newer jsx-runtime transform.

Per babel docs: https://babeljs.io/docs/en/babel-preset-react#with-a-configuration-file-recommended

Issue

Fixes: #1127

Example
Now builds look like this:

const ToolbarAlign = ({
  type,
  unwrapTypes = KEYS_ALIGN,
  ...props
}) => {
  const editor = useStoreEditorState(useEventEditorId('focus'));
  return /*#__PURE__*/React.createElement(ToolbarButton, _extends({
    active: !!(editor !== null && editor !== void 0 && editor.selection) && !!type && someNode(editor, {
      match: {
        type
      }
    }),
    onMouseDown: editor ? getPreventDefaultHandler(upsertAlign, editor, {
      type,
      unwrapTypes
    }) : undefined
  }, props));
};

Checklist

  • The new code matches the existing patterns and styles.
  • The tests pass with yarn test.
  • The linter passes with yarn lint. (Fix errors with yarn lint --fix.)
  • The relevant examples still work: (Run examples with yarn docs.)

Note: running the docs instructions prompted a yarn install which altered the docs/yarn.lock (bumping all packages to 5.3.1). I've left that out of my PR, though

@jeffsee55 jeffsee55 requested a review from dylans as a code owner October 14, 2021 21:34
@changeset-bot
Copy link

changeset-bot bot commented Oct 14, 2021

🦋 Changeset detected

Latest commit: 8e7ece4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 54 packages
Name Type
@udecode/plate-autoformat Patch
@udecode/plate-break Patch
@udecode/plate-common Patch
@udecode/plate-core Patch
@udecode/plate-dnd Patch
@udecode/plate-alignment Patch
@udecode/plate-alignment-ui Patch
@udecode/plate-basic-elements Patch
@udecode/plate-block-quote Patch
@udecode/plate-block-quote-ui Patch
@udecode/plate-code-block Patch
@udecode/plate-code-block-ui Patch
@udecode/plate-excalidraw Patch
@udecode/plate-heading Patch
@udecode/plate-horizontal-rule Patch
@udecode/plate-horizontal-rule-ui Patch
@udecode/plate-image Patch
@udecode/plate-image-ui Patch
@udecode/plate-link Patch
@udecode/plate-link-ui Patch
@udecode/plate-list Patch
@udecode/plate-list-ui Patch
@udecode/plate-media-embed Patch
@udecode/plate-media-embed-ui Patch
@udecode/plate-mention Patch
@udecode/plate-mention-ui Patch
@udecode/plate-paragraph Patch
@udecode/plate-table Patch
@udecode/plate-table-ui Patch
@udecode/plate-find-replace Patch
@udecode/plate-find-replace-ui Patch
@udecode/plate-indent Patch
@udecode/plate-basic-marks Patch
@udecode/plate-font Patch
@udecode/plate-font-ui Patch
@udecode/plate-highlight Patch
@udecode/plate-kbd Patch
@udecode/plate-node-id Patch
@udecode/plate-normalizers Patch
@udecode/plate-placeholder Patch
@udecode/plate Patch
@udecode/plate-reset-node Patch
@udecode/plate-select Patch
@udecode/plate-ast-serializer Patch
@udecode/plate-csv-serializer Patch
@udecode/plate-html-serializer Patch
@udecode/plate-md-serializer Patch
@udecode/plate-serializer Patch
@udecode/plate-test-utils Patch
@udecode/plate-trailing-block Patch
@udecode/plate-combobox Patch
@udecode/plate-popper Patch
@udecode/plate-styled-components Patch
@udecode/plate-toolbar Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Oct 14, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/udecode/plate/HLxfcakUaKfjk9U4jrRd3ZHH8B4R
✅ Preview: https://plate-git-fork-tinacms-main-udecode.vercel.app

Copy link
Member

@zbeyens zbeyens left a comment

Choose a reason for hiding this comment

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

Nice fix, thanks for the PR!

@zbeyens zbeyens merged commit aba95e9 into udecode:main Oct 14, 2021
@jeffsee55
Copy link
Contributor Author

Thanks @zbeyens, loving this library so far!

@github-actions github-actions bot mentioned this pull request Oct 14, 2021
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.

React 16 is not supported even though peer deps say it is

2 participants