/// <summary> /// Prepare the HTML selection to deal with keyboard navigation events. /// </summary> /// <param name="direction"></param> /// <param name="selectBlock"></param> private void PrepareForKeyboardNavigation(MarkupDirection direction, bool selectBlock) { if (direction == MarkupDirection.Left && selectBlock) { //HACK: make shift+Left keep the div selected by putting the selection at the //right-side of the div before the key event is handled. MarkupPointer caretPointer = EditorContext.MarkupServices.CreateMarkupPointer(HTMLElement, _ELEMENT_ADJACENCY.ELEM_ADJ_AfterEnd); EditorContext.MarkupServices.CreateMarkupRange(caretPointer, caretPointer).ToTextRange().select(); } else { ElementRange.ToTextRange().select(); } }
/// <summary> /// Prepare the HTML selection to deal with keyboard navigation events. /// </summary> /// <param name="direction"></param> /// <param name="selectBlock"></param> private void PrepareForKeyboardNavigation(MarkupDirection direction, bool selectBlock) { if (direction == MarkupDirection.Left && selectBlock) { //HACK: make shift+Left keep the div selected by putting the selection at the //right-side of the div before the key event is handled. MarkupPointer caretPointer = EditorContext.MarkupServices.CreateMarkupPointer(HTMLElement, _ELEMENT_ADJACENCY.ELEM_ADJ_AfterEnd); EditorContext.MarkupServices.CreateMarkupRange(caretPointer, caretPointer).ToTextRange().select(); } else { ElementRange.ToTextRange().select(); } }