do not replace the selected text when insert file link.
This commit is contained in:
@ -65,6 +65,7 @@
|
|||||||
private string _message;
|
private string _message;
|
||||||
private bool _linkTextEditable;
|
private bool _linkTextEditable;
|
||||||
private FileManager _fileManager;
|
private FileManager _fileManager;
|
||||||
|
private File _previousFile;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
@ -93,11 +94,24 @@
|
|||||||
private void SelectFile()
|
private void SelectFile()
|
||||||
{
|
{
|
||||||
var file = _fileManager.GetFile();
|
var file = _fileManager.GetFile();
|
||||||
var url = file != null ? file.Url : string.Empty;
|
if(file != null)
|
||||||
var text = file != null && _linkTextEditable ? file.Name : string.Empty;
|
{
|
||||||
|
_linkAttributes.Href = file.Url;
|
||||||
|
if (string.IsNullOrWhiteSpace(_linkAttributes.InnerText) && _linkTextEditable)
|
||||||
|
{
|
||||||
|
_linkAttributes.InnerText = file.Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_linkAttributes.Href = string.Empty;
|
||||||
|
if (_linkAttributes.InnerText == _previousFile?.Name)
|
||||||
|
{
|
||||||
|
_linkAttributes.InnerText = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_previousFile = file;
|
||||||
|
|
||||||
_linkAttributes.Href = url;
|
|
||||||
_linkAttributes.InnerText = text;
|
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user