public void UnsetLink() { if (_selection.IsEmpty) { var run = _target.GetInlineAt(_caretIndex) as Run; if (run != null) { var cmd = new SetLinkOfRunCommand(run, null); _executor.Execute(cmd); } } else { var cmd = new SetLinkCommand(_target, _selection.Range, null); _executor.Execute(cmd); } }
// --- link --- public void SetLink(string uri, string relationship) { var link = new Link(uri, relationship); if (_selection.IsEmpty) { var run = _target.GetInlineAt(_caretIndex) as Run; if (run != null) { var cmd = new SetLinkOfRunCommand(run, link); _executor.Execute(cmd); } } else { var cmd = new SetLinkCommand(_target, _selection.Range, link); _executor.Execute(cmd); } }