nhn / tui.editor

🍞📝 Markdown WYSIWYG Editor. GFM Standard + Chart & UML Extensible.

Home Page:http://ui.toast.com/tui-editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request for plugin sample for tui-editor markdown

KesavanRadhakrishnan opened this issue · comments

Summary

Hi,

I am new to enter in tui-editor markdown control, I have go through your docs and editor behavior, I have some doubt on creating the plugins for tui-editor, can you please provide any sample to handle the custom syntax like ![test](https://test.com) to identify and parse the text and preview in markdown.

I have another doubt that can I reuse the popups in tui-editor or may I manually call and open the popups like image and table.

Screenshots

//

Version

//

Additional context

I have created some sample plugin, but I think it will be easy than my created sample

Here, I am using image(node) to identify the video link (![test](https://test.com)), but is it possible to declare and use my custom node identifier?

function videoPlugin(): PluginInfo {
  const toHTMLRenderers: CustomHTMLRenderer = {
    image(node, d) {
      if (d.entering) {
        let link = node.destination.replace(/!\[(\S+)\]/, '');
        link = link.replace(/[()]/g, '');
        link = link
          .trim()
          .replace(
            /^(!<iframe>)?(https:\/\/)?(www.)?(youtube.com|youtu.be)((\/)(watch[?]v=)?)/,
            ''
          );
        return [
          {
            type: 'openTag',
            tagName: 'iframe',
            outerNewLine: true,
            attributes: { src: `https://www.youtube.com/embed/${link}` },
          },
          { type: 'closeTag', tagName: 'iframe', outerNewLine: false },
        ];
      }
    },
  };

  return { toHTMLRenderers };
}

Hi team,

any update on this?

大家好,

这事有进一步更新吗?

请问这个视频的插件是怎么触发的呢

commented

This issue has been automatically marked as inactive because there hasn’t been much going on it lately. It is going to be closed after 7 days. Thanks!