Skip to content

Dropping file with UploadBrowserFile always surrounds the file content with a markdown link  #196

@wilhelmberg

Description

@wilhelmberg

Example 3 which is not using UploadBrowserFile works as expected:

  • drag a file into the text area
  • just the file contents is shown, not [<file_name>](<file_contents>)

My setup is an InteractiveServer project using latest 0.8.12.

        <CodeMirror6Wrapper @bind-Doc=@Text
                            AutoFormatMarkdown=@false
                            TabSize=@TabSize
                            IndentationUnit=@TabSize
                            Theme=@Theme
                            Language=@Language
                            LintDocument=@LintDocument
                            Setup=@Setup
                            UploadBrowserFile=@UploadBrowserFile
                            EmbedUploadsAsDataUrls=@false
                            PreviewImages=@false
                            FullScreen=@FullScreen
                            MaxHeight="60em">
private CodeMirrorLanguage Language = CodeMirrorLanguage.PostgreSql;

private readonly CodeMirrorSetup Setup = new() {
    HighlightSelectionMatches = true,
    ScrollToStart = false,
    ScrollToEnd = false,
    BindMode = DocumentBindMode.OnDelayedInput
};
private async Task<string> UploadBrowserFile(IBrowserFile file) {
    using TextReader reader = new StreamReader(file.OpenReadStream());
    return await reader.ReadToEndAsync();
}

Dropping the file my-perfect.sql with contents select * from table always ends up as:

[my-perfect.sql](select * from table)

I've already tried various combinations of settings and also a FileUploadController - to no avail, always the same result.

The only thing that seems to make it display the contents only, is not defining UploadBrowserFile=@UploadBrowserFile.

But that isn't helpful for my scenario as I need to do some validations and edits on the dropped SQL before it gets passed to the text area.

Any hints/ideas/suggestions on how to "catch" the SQL after it has been dropped and how to get the "raw" SQL to show up?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions