question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with SimpleMDE (format=markdown) in arrays

See original GitHub issue

Expected behavior

My test type is an array of objects, each having a property ‘bio’ of type ‘string’ and format ‘markdown’. When creating one item in the array, the SimpleMDE textarea appears, together with the text fields for the other properties. When deleting the item just created, both the text fields and the SimpleMDE textarea should disappear.

Actual behavior

The text fields do disappear, but the SimpleMDE textarea remains. The item is not removed from the value. I get the error message “this.SimpleMDE.destroy is not a function”.

Steps to reproduce the behavior

testType = {
  type: 'array',
  items: {
    type: 'object',
    properties: {
      name: { type: 'string' },
      web: { type: 'string', format: 'url' },
      mail: { type: 'string', format: 'email' },
      bio: { type:'string', format:'markdown' }
    }
  }
}
// and somewhere in my html page
var editor = new JSONEditor(document.getElementById('editor_holder'),{schema:testType})

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
pmk65commented, Feb 8, 2019

I can confirm the problem. SimpleMDE has no destroy() function. (Probably something leftover from when JSON-editor changed from EpicEditor to SimpleMDE)

According to this PR on the SimpleMDE repo, the way to remove the editor is like this:

    this.SimpleMDE.toTextArea();
    this.SimpleMDE = null;

@jmandreoli Try modifying the destroy function in “src/editors/string.js” and change this.SimpleMDE.destroy(); into the above and see if it helps.

0reactions
pmk65commented, Feb 8, 2019

@pmk65 This issue would be a nice use-case for https://pmk65.github.io/jedemov2/dist/demo.html

I have added the schema to the examples as “SimpleMDE”. But unfortunately the “prototype” override method doesn’t work on functions with calls to this._super() so it wan’t possible to test the fix using the Interactive playground.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues for SimpleMDE Markdown Editor | Drupal.org
Issues for SimpleMDE Markdown Editor ; "Warning: array_filter() expects parameter 1 to be array, null given" Warning Appears when Saving Text Format, Reviewed...
Read more >
JSON Editor - npm
The default array editor takes up a lot of screen real estate. The table and tabs formats provide more compact UIs for editing...
Read more >
simpleMDE set value not parsing properly - Stack Overflow
But the main issue is that the contents to set are not fixed. They are dynamically coming from the database and I'm using...
Read more >
How to Create Expandable Image Effect Using HTML CSS ...
This repository is a fork of SimpleMDE, made by Sparksuite. ... previewClass: A string or array of strings that will be applied to...
Read more >
Arduo Css Editor - OSCHINA - 中文开源技术交流社区
React SimpleMDE (EasyMDE) Markdown Editor React component wrapper for EasyMDE (the most fresh SimpleMDE ... Notes Issues and Pull Requests are welcome.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found