Simplemde-markdown-editor: Add custom css class for editor-preview

Created on 11 Jul 2016  路  3Comments  路  Source: sparksuite/simplemde-markdown-editor

Is there a way to add a custom css class to the editor-preview?

question

Most helpful comment

I did this by overriding previewRender:

      previewRender: (plainText, previewArg) => {
        const preview = previewArg;
        setTimeout(() => {
          preview.innerHTML = `
            <div class="content">${marked(plainText)}</div>
          `;
        }, 1);

        return `Loading...`;
      }

All 3 comments

At this time, there is not. It comes standard with the editor-preview class.

Will this ever become a thing? It's quite handy if you already have styles defined for a specific container, so it will actually look like the preview when rendered there.

I did this by overriding previewRender:

      previewRender: (plainText, previewArg) => {
        const preview = previewArg;
        setTimeout(() => {
          preview.innerHTML = `
            <div class="content">${marked(plainText)}</div>
          `;
        }, 1);

        return `Loading...`;
      }
Was this page helpful?
0 / 5 - 0 ratings