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

How to use youtube plugin in React Viewer #1007

Closed
leeonfield opened this issue May 26, 2020 · 2 comments
Closed

How to use youtube plugin in React Viewer #1007

leeonfield opened this issue May 26, 2020 · 2 comments
Labels

Comments

@leeonfield
Copy link

Summary

How to use youtube plugin in React Viewer

Version

"@toast-ui/react-editor": "^2.1.2"

Additional context

In 1.x, i use Editor.factory and set viewer value true to display content

    this.editor = new Editor.factory({
      el: document.querySelector('#viewContainer'),
      viewer: true,
      initialValue: this.state.markdown,
      exts: [
        'videoPlugin',
      ],
    })

After upgrade to 2.x, is there a recommended way to use video plugin in Viewer ?

ToastEditor.codeBlockManager.setReplacer only work in Editor

@leeonfield
Copy link
Author

#899

@leeonfield
Copy link
Author

const videoPlugin = (editor) => {
  const { codeBlockManager } = Object.getPrototypeOf(editor).constructor
  codeBlockManager.setReplacer('youtube', function(sourceId) {
  ……
}

this way work in Editor and Viewer

js87zz pushed a commit that referenced this issue Jun 17, 2021
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