Simplemde-markdown-editor: readonly mode

Created on 8 Mar 2016  路  5Comments  路  Source: sparksuite/simplemde-markdown-editor

Hi,

I want to use _simplemde_ not only for editing but also for rendering the markdown. Therefore i disabled the status and toolbar and changed the css to hide the border-lines. But unfortunately _simplemde_ doesn't understand, when I set the readonly attribute to a textarea. How can I achieve a readonlystate?

question wontfix

Most helpful comment

I've created a wrapper of simplemde (I'm using Polymer), then accessed CodeMirror like this:.

this.simpleMde.codemirror.options.readOnly = true;

It works with me

All 5 comments

Don't use SimpleMDE for simply rendering Markdown. Use another library, like https://github.com/chjj/marked (which happens to be the library SimpleMDE uses).

I also need a read only mode, it is very usual option for every editor.
Use case: I need to show rendered and source markdown both, but do not allow editing until user click some button like "Copy and edit".

I need to show rendered and source markdown both, but do not allow editing until user click some button like "Copy and edit".

So use Marked to render, and show the source next to it, then add a button with onclick to activate SimpleMDE with the textarea, or add a new textarea and hide the old, or whatever.

The CodeMirror library already has support for readOnly option Configuration. Can't you allow passing that option from SimpleMde to CodeMirror?

I've created a wrapper of simplemde (I'm using Polymer), then accessed CodeMirror like this:.

this.simpleMde.codemirror.options.readOnly = true;

It works with me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

garethrbrown picture garethrbrown  路  5Comments

prologic picture prologic  路  4Comments

keioka picture keioka  路  5Comments

liniu picture liniu  路  3Comments

IonicaBizau picture IonicaBizau  路  3Comments