Closed minhhuynguyen91 closed 5 years ago
I am not sure what your problem is exactly, can you post your code here and the error that the browser is giving you?
For example:
content = 'This is `a` string with `backticks`';
new EasyMDE({
initialValue: content,
});
Hi @lonaru
content = 'This is a blocked string from the mongo database after finishing updating it
with so many lines
and backticks like this ````````````````````````. I cannot control it all
'
new EasyMDE({
initialValue: `content`,
});
with this input's case for easyMDE, it will crash the editor.
A string in JS using single quotes cannot be placed on multiple lines, this will probably give a syntax error and the lines below it aren't executed.
Also if you place ` content ` as initialValue
, it will just put the string "content" in the editor instead of the data in the variable.
hi @lonaru
Sorry for my lack of understanding. My current input is something like this
var content = 'Hello\r\n\r\n> Testing testing\r\n> hello\r\n\r\n* one two three\r\n\r\n - -Hello- '
new EasyMde({
initialValue: "content"
});
and the initialValue will have this actual content like this.
initialValue: "Hello
> Testing testing
> hello
* one two three
- Hello -"
As you said it would produce an error.
And I thought about using the blocked string in javascript, which leads to this SO page: https://stackoverflow.com/questions/805107/creating-multiline-strings-in-javascript
so that's why I set
initialValue: `content`
it work fines if I don't have any backticks in my content data. But it's not very desirable, can you help me to provide any other solutions? I will be very appreciated
Many thanks.
Try this:
var content = `Hello
> Testing testing
> hello
* one two three
- Hello -`;
new EasyMDE({
initialValue: content
});
Note the backticks are around the content
variable and not at initialValue
.
Thanks, it worked.
Hi, I am making a edit page to edit the record using html form.
Right now, I am setting the initialValue:
`article.content`
. It works fine if my article.content does not have the symbol`
, but when it does, it crashes the editor.I am not very good at js, I have looked some questions on SO, but I have no luck so far.
Can you provide me solution for that?
Thanks.