Skip to content
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

Add EasyMDE options #3373

Merged
merged 28 commits into from Feb 3, 2022
Merged

Conversation

WolfgangKluge
Copy link
Contributor

@WolfgangKluge WolfgangKluge commented Jan 29, 2022

closes #3297
closes #3361

I've added more options from https://github.com/Ionaru/easy-markdown-editor/#options-list

As discussed in #3361, it's a simple extension to the current implementation of the options.
So the new options work more or less as the current ones.

  • autofocus seems not to work in general (even the most easiest example)
    What I can see is, that the option is properly (and I think correctly) forwarded to the codemirror instance
    I've' opend a ticket for that: Options autofocus does not work Ionaru/easy-markdown-editor#399
  • autoRefresh: I have no idea how to test it, but what I can see is, that the option is properly (and I think correctly, too) forwarded to the codemirror instance
  • parsingConfig: The option underscoresBreakWords is not supported in CodeMirror.
    Readme: underscoresBreakWords does not exists in CodeMirror repository Ionaru/easy-markdown-editor#401
  • Fixes the option UploadImage, so this option has an effect at all (always true before)
  • I considered to implement status like the toolbar, but you want to have access to the codemirror instance in the functions there - and that's a bigger problem (would be very useful in the toolbar action, too)

Since it's a slightly larger PR, I've splitted the commits on every option..

Wolfgang Kluge and others added 27 commits January 28, 2022 10:56
EasyMDE allows string and string-array.
Since both are used as className, a space separated string is sufficient here.
There is a `sanitizerFunction`-option in the renderingConfig.
This function does not allow to return a Promise - thus, `dotNetObjectRef.invokeMethodAsync` cannot be used
here and the current dispatcher does not support synchronous calls from JS to .NET.
In contrast to EasyMDE, this defaults to `false` here.
EasyMDE allows a custom spellChecker function.. This is not supported, yet.
EasyMDE allows custom status bar items. This is not supported, yet.
In contrast to EasyMDE, the default value is `true`.
@stsrki
Copy link
Collaborator

stsrki commented Jan 31, 2022

From what I can see in the PR I think you have covered most of the missing stuff and you did an excellent job. The thing that you mention is not working we can leave them for later if needed. The API will not change so once EasyMDE fixes those we can include it in Blazorise.

Do you think that is OK? If you don't have any more work I think we can merge the PR.

@WolfgangKluge
Copy link
Contributor Author

Yes, sure it's ok. I don't have further work to do on that.

@stsrki stsrki merged commit 5ab36ca into Megabit:master Feb 3, 2022
@stsrki stsrki mentioned this pull request Feb 3, 2022
66 tasks
@WolfgangKluge WolfgangKluge deleted the dev-1.0-easymde-options branch February 3, 2022 10:34
@netz0
Copy link

netz0 commented Oct 1, 2022

It seems this also causes an issue with forms that have the required="" attribute with Chromium based browsers returning an error that the form control is invalid and not focusable.

@stsrki
Copy link
Collaborator

stsrki commented Oct 1, 2022

It seems this also causes an issue with forms that have the required="" attribute with Chromium based browsers returning an error that the form control is invalid and not focusable.

Can you open a new issue with code to reproduce it?

@netz0
Copy link

netz0 commented Oct 2, 2022

It seems this also causes an issue with forms that have the required="" attribute with Chromium based browsers returning an error that the form control is invalid and not focusable.

Can you open a new issue with code to reproduce it?

Since the auto focus does not work, if your text area has the required attribute Chromium based browsers like Chrome, Edge, Vivaldi, etc. will fail because they can't focus on the field that has the required field. I suspect this is related to the original issue that autofocus is not working.

Just add a require field to the text area:
<textarea id="easyMDE" name="easyMDE" required>{comment}</textarea>

Can't submit the form and browser fails with:
An invalid form control with name='easyMDE' is not focusable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Markdown: Full control over EasyMDE Markdown shortcuts
3 participants