Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selection #2

Merged
merged 4 commits into from
Feb 20, 2014
Merged

Selection #2

merged 4 commits into from
Feb 20, 2014

Conversation

sstephenson
Copy link
Contributor

I renamed RichText.Renderer to RichText.DOM and implemented getSelectedRange and setSelectedRange methods there, since rendering and selection mapping are intimately related.

RichText.Controller has getPosition and getSelectedRange methods which delegate to RichText.DOM; the former returns a position if and only if the selection is collapsed, and the latter returns a range if and only if the selection is not collapsed.

The insertText and backspace methods now do the right thing depending on whether or not there's a selection.

@javan
Copy link
Contributor

javan commented Feb 20, 2014

Lovely!


range = document.createRange()
start = [startContainer, startOffset] = @findContainerAndOffsetForPosition(startPosition)
end = [endContainer, endOffset] = @findContainerAndOffsetForPosition(endPosition)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't look like start and end are used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops! Logging remnants.

@javan
Copy link
Contributor

javan commented Feb 20, 2014

I closed #1. Merge away.

sstephenson added a commit that referenced this pull request Feb 20, 2014
@sstephenson sstephenson merged commit e3687ff into master Feb 20, 2014
@sstephenson sstephenson deleted the selection branch February 20, 2014 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants