forked from mathquill/mathquill
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Release/0.10.1 10 #4
Open
Agapanthus
wants to merge
45
commits into
Agapanthus:master
Choose a base branch
from
CarnegieLearningWeb:release/0.10.1-10
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Release/0.10.1 10 #4
Agapanthus
wants to merge
45
commits into
Agapanthus:master
from
CarnegieLearningWeb:release/0.10.1-10
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Expose cursor methods for setting a selection based on a point (an object with x and y properties). Points are based on the page's coordinate system. - Note that innerWidth/innerHeight is used instead of width/height to include points in the padding - childForPoint also returns itself if none of its children match the point Also expose clearSelection to allow the cursor’s selection to be cleared programmatically.
Mistakenly committed childForPoint with the wrong call for each child in the tree; rectifying by making sure that each child of a node that contains a point calls chidForPoint so we can get the lowest node in the tree that contains the point.
Update ReadMe to include public methods for setting and clearing selection on static math.
This change makes it easier to select the contents inside of delimiters. When seeking where to put the cursor for a selection, the cursor will be placed inside the delimiters if the seek location is on the delimiter. If the cursor is to the left of the left delimiter or the right of the right delimiter, then the whole of the delimiter command will be selected. This does not affect keyboard-based selection.
Adds functionality to the API for editable fields within static math fields (inner math fields) to make them static or editable. makeStatic() changes the class of the editable field to “mq-editable-field-static”, removes its texture, and unbinds its event handlers. makeEditable() does the opposite. It wraps the functions for initializing an editable field in an easy-to-reference way. This approach maintains the existing tree structure and any references to the inner editable field in the static math wrapper’s inner fields array. This approach assumes that a static math field will take over the event handling for an editable field after it has been made static.
This commit adds another configuration parameter for the spaceBehavesLikeTab option. Previously, the only valid values were 'true' and 'false'. Where 'false' simply inserted spaces and 'true' made spaces behave like tab. It is now possible to add a string 'exceptRootBlock'. 'exceptRootBlock' behaves the same as 'true' unless the cursor is in the root block, where it will insert a space instead. This feature allows the entry of mixed fractions in the root block, which 'true' was unable to do. This feature is purposfully overloading the semantics of 'spaceBehavesLikeTab' to add a new configuration option because this causes the smallest divergeance from the MathQuill root project. All things being equal, however, the better change would be to rename the configuration option to 'spaceBehavior' and use strings for all options: 'default', 'asSpaces', 'asTabs', and 'asTabsExceptForRootBlock'. Where 'default' and 'asSpaces' are currently the same.
By default, MathQuill allows the browser to handle Tab in the standard way when the cursor is in the root block. This means that the user will move to the next focusable element in tab order. This behavior bypasses any templates between the current cursor position and the end. If templates are thought of as editable areas, like mini-textfields, this approach feels unexpected to keyboard users, who would expect 'focus' to traverse to the next 'field,' i.e. next template. This commit adds a new configuration property: tabAction. By default tabAction simply uses the current behavior. Users can specify a value of 'escapeAndTemplate' to allow Tabs from the root block to find the next template or to move outside of the MathQuill field if no templates exist.
Adjusting selections in a mathematically meaningful way around unary and binary operators. Expands selections to include sibling nodes around operators based on a few heuristics about what constitutes a meaningful expression with basic arithmetic operators. "Meaningful selection" is enabled with the strictOperatorSelection config flag, which can be used with both static and editable math. The static math API was changed to allow for config options.
Instead of specifying a default set of prefix and binary operators to use in strict operator selection, use the prefix and binary operator arrays passed in from the config. This changes the config option from a simple boolean (strictOperatorSelection: true) to an object with properties containing arrays of the control sequences we want to treat differently during selection: strictOperatorSelection: { prefixOperators: [‘-‘, ‘\\pm ‘], binaryOperators: [‘+’, ‘=‘] }
The bower version that this project uses is the base version of the release, the MathQuill release number in package.json, plus a revision number. Our revision number is continually increasing, such that 0.9.4-5 -> 0.10.1-6 in the next release. This allows us to track the main revision of MathQuill while also keeping track of our additional features that have not been accepted via pull request. We should never submit a pull request to MathQuill for bower.json.
When updating to the 0.10 release, I misresolved a conflict that led me to put the setSelection method next to the clearSelection method. While this seemed correct at the time, it was not. The problem with keeping the methods in EditableMath is that you cannot use them to create mouse selections in StaticMath. The select method, which is cursor-related cannot be used in the StaticMath fields and therefore was not moved. Updated the documentation to reflect the change in the movement of the API methods.
Adds functionality to the API for editable fields within static math fields (inner math fields) to make them static or editable. makeStatic() changes the class of the editable field to “mq-editable-field-static”, removes its texture, and unbinds its event handlers. makeEditable() does the opposite. It wraps the functions for initializing an editable field in an easy-to-reference way. This approach maintains the existing tree structure and any references to the inner editable field in the static math wrapper’s inner fields array. This approach assumes that a static math field will take over the event handling for an editable field after it has been made static.
…for strictOperatorSelection.
…first element in a style block. When a binary operator was the first block inside a style block (textcolor or class), the unary/binary check failed to determine the proper state because it did not check the block to the left of the style block. This fix recursively walks ancestor style blocks until none remain, then performs the original check. Added new unit tests to confirm this functionality.
This is simply another Style command with custom CSS to make curved border.
This is simply another Style command with custom CSS to make a line with an arrowhead at each end. There were a couple of small issues here: 1. :after is used to fill empty blocks, but I need :after for the right arrowhead. This was resolved by using min-width and min-height. Both are extremely common CSS at this point. 2. The original \overleftarrow and \overrightarrow work upon which this is based do not scale well. I made no effort to fix the scaling issue. The current arrows misalign with the line if the font-size changes even slightly. Using \overleftarrow in the visual test page, where the base font is .8em causes issues. Without using JavaScript to alter inline styles, I think that end users will have to write custom styles if they are using non-standard font sizes. This is no worse than the original implementation, so I feel confident that the \overleftrightarrow is as good as what currently exists for the other arrow types. 3. The collapsed arrowheads for \overleftrightarrow collapse on top of one another when the block is empty. It looks like an asterisk. The min-width could be made larger. This is part of a set of geometric markers that need at least two identifiers underneath. No line segment, ray, or line can be defined without at least two points. Given that the current \over* markers do not have enough space when empty for two characters, I concluded that two space was not necessary here either. The difference, however, is that the single-arrowhead lines do not present a visual miscue when collapsed to a single character width. This would be an easy change. Given the variable width nature of Symbola, I recommend that the min-width be set to 1.5em if this change is desired. Our custom CSS that we apply on top of MathQuill's base CSS for our product does use the 1.5em min-width.
Conflicts: - .gitignore accepted master - src/commands/math/commands.js kept simultaneous add used master order for isStyleBlock
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.