Smart Selection

This commit is contained in:
2024-10-08 10:56:28 +02:00
parent 983b6e01fd
commit e8bd6bdbe5

View File

@@ -260,11 +260,20 @@ namespace BeWo.View.Detail
}
private void TemplatesTreeView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
var selection = TreeListControlTemplates.SelectedItem as PlatzhalterVM;
var platzhalter = TreeListControlTemplates.SelectedItem as PlatzhalterVM;
if (selection.Platzhalter != null)
if (platzhalter.Platzhalter != null)
{
EditorControl.Document.InsertText(EditorControl.Document.CaretPosition, "[" + selection.Platzhalter + "]");
var doc = EditorControl.Document;
var selection = doc.Selection;
if(selection.Length > 0)
{
doc.Delete(selection);
}
var range = EditorControl.Document.InsertText(EditorControl.Document.CaretPosition, "[" + platzhalter.Platzhalter + "]");
EditorControl.Document.Selection = range;
}
}
}