New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Markdown: Full control over EasyMDE #3361
Comments
We tried to include as many features from MDE that we found interesting at the time, or that we needed for our own projects. Others will come in time, but v1.0 is already neer release and we cannot have much time for new features. Our focus is now is the stability and API cleaning. In case you have time to help with this it would be a lot faster. |
I'd be glad to. The only thing I'm struggling with is the very tight coupling between EasyMDE and Blazorise. |
One question before I can start. You repeat these default values in your implementation, e.g. Blazorise/Source/Extensions/Blazorise.Markdown/Markdown.razor.cs Lines 343 to 352 in a14106b
But you don't do that for all of the options, e.g.
(in fact, the whole ErrorMessages property is null by default) I think the repetition of the default value is superflous in every case. The only "benefit" is, that updates on the default value of EasyMDE does not bother the blazorise user. Sometimes this is good, sometimes you prevent the user from new features/bug fixes, sometimes you run into a new bug (value type of property has changed - but that's always an error no matter if optional or not). Personally, I would define every property as optional (even booleans with a default value of |
You should define them with the default value, same as in EasyMDE. If they are left to the C# defaults then EasyMDE might not be initialized properly once the options are assigned on the JS side. |
My C#-default would always be This could be solved by unsetting ( Ok, I'll take the same approach as in the current code :) |
Final question regarding to the same I figured out an approach to use This will also solve a problem (at least I think it is one) with https://github.com/Megabit/Blazorise/blob/master/Source/Extensions/Blazorise.Markdown/MarkdownErrorMessages.cs, where one cannot use this option like <Markdown
ErrorMessages="@(new() {
FileTooLarge = "Too large!"
})"/> (By using this, at the moment all the error messages but the given one are empty due to there are no default values). This would be true for every other complex option. The way would be:
At the end, with this solution there would be less repetitions in the code and you don't have to keep track of minor changes in the default values in EasyMDE. Alternatively, Blazorise has to provide default values for every configuration option - not only the root level ones. I know you've already answered, but I just have to ask again. (Sorry for that) |
Yes, by having an options class we would have more control over what and how they get serialized. I chose anonymous because it was easier to do at the time. Also, by having default values sent from the Blazorise side we have are more explicit by intention. Otherwise, we depend on what is the default by the EasyMDE which isn't always clear. All in all don't lose too much time on adding an option class. At least for now. We can always revisit it for next versions. |
Is your feature request related to a problem? Please describe.
I try to configure the MDE instance but I don't have full control over the options you provide to the EasyMDE constructor.
Especially I miss
spellChecker
(bit like #1316), but I'm interested instatus
andrenderingConfig
, too.Describe the solution you'd like
Every (or at least most) options EasyMDE provides, should be configurable by the Markdown editor.
https://github.com/Ionaru/easy-markdown-editor#options-list
The text was updated successfully, but these errors were encountered: