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

Replace JSX with tagged template literals #13

Open
brendancarney opened this issue Feb 19, 2019 · 2 comments
Open

Replace JSX with tagged template literals #13

brendancarney opened this issue Feb 19, 2019 · 2 comments
Labels

Comments

@brendancarney
Copy link
Collaborator

This provides a few benefits:

  • Can use React and convenient slate values in the same file
  • No transpilation required to create a slate value
  • Users don't need to use slate-hyperscript directly

Here's a potential API. The naming will almost surely change as I don't like it right now.

const structure = {
  blocks: {
    paragraph: "paragraph"
  },
  marks: {
    bold: "bold"
  }
}  

const { editor, html } = SlateTest({ plugins: Code() }, { structure });

const value = html`
  <paragraph>
    Some sample <bold>text</bold>
  </paragraph>
`

A few open questions:

  • Should this be completely outside of the SlateTest function? In other words, should it be a separate import?
  • The html name could be confusing, but it does automatically get you syntax highlighting depending on your editor setup.
@brendancarney
Copy link
Collaborator Author

@brendancarney
Copy link
Collaborator Author

After writing many tests for Slate code here and in other repositories, I'm convinced this is the way to go now.

@brendancarney brendancarney changed the title Consider replacing JSX with tagged template literals Replace JSX with tagged template literals Apr 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant