-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
issue-705: Leaf BlockSettings and InlineTools via keyboard #723
Merged
khaydarov
merged 51 commits into
release/2.14
from
issue-705-block-actions-from-keyboard
May 24, 2019
Merged
Changes from 42 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
84689b5
Do not start multi-block selection on UI elements (#662)
gohabereg d2cb37f
Add link to issue
gohabereg 7d1ce59
Merge branch 'release/2.12' of https://github.com/codex-team/codex.ed…
a750894
Fix loss of pointer (#666)
gohabereg 4073724
Update shortcuts module (#685)
khaydarov a146c2e
Remove margin top for inline-link icon (#690)
talyguryn f0d9548
Pull fresh tools
talyguryn d5bc6fa
Remove changelog contents from readme (#700)
kabachook 57b5a09
Merge branch 'master' of https://github.com/codex-team/codex.editor i…
gohabereg f554945
#665 API to open and close inline-toolbar (#711)
tanmayv 53df2d5
leaf buttons: initial
khaydarov ee9321a
leaf inline toolbar buttons
khaydarov 5f71c6f
Allow holderId work with ref on dom element (#710)
dimensi 00622cd
leaf inline tools and drop index after click
khaydarov b2d0acc
leaf toolbox and clear active button after activation
khaydarov 72c0987
debugging blockSettings
khaydarov 5f0d242
Activating Open Collective (#736)
monkeywithacupcake 800657e
Do not install editor.js as dev-dependency (#731)
davidsneighbour 2de4318
Move codex-notifier to dependencies for typescript declarations (#728)
gohabereg 27cbaa5
Close inline toolbar after creating new link by pressing ENTER (#722)
tanmayv ca58f74
Link Logo Image to homepage (#738)
goldensunliu 3befe95
Update README.md (#744)
neSpecc f518a67
Config minHeight option that allows to customize bottom zone (#745)
neSpecc 1cd6149
issue-739: allow Block's editable element selection (#747)
khaydarov 0ab6a29
Fix typo in example paragraph (#749)
stephan281094 4816fb4
minor release
neSpecc f25c497
Merge branch 'release/2.13' into issue-705-block-actions-from-keyboard
khaydarov b730ed8
done
khaydarov e99b21c
requested changes
khaydarov 1ca9b64
production build
khaydarov c5f1ba3
Merge branch 'release/2.14' into issue-705-block-actions-from-keyboard
khaydarov ffcf176
update package.json
khaydarov 9ebc7a4
some improvements
khaydarov 9d2a009
ready for testing
khaydarov e37b3bf
Merge branch 'release/2.14' into issue-705-block-actions-from-keyboard
khaydarov 0f68cfd
update
khaydarov 2bac1a6
ready
khaydarov 3d3e7f6
requested changes
khaydarov 14a3b30
updates
khaydarov 7ac2e42
use setToBlock instead of focus
khaydarov 1b176a5
active -> focused
khaydarov 5a734b3
update
khaydarov eb32095
refactor types
khaydarov 460bf4b
fix inline tools flipping
khaydarov 202f5eb
inhancements
khaydarov 369ce68
rm check for focus at the handleShowingEvent
neSpecc f4dd0c9
fix IT closing after second enter
neSpecc 092281e
add animation to settings buttons
khaydarov a7d5123
Click animation
neSpecc e64e948
Add changelog
neSpecc 031d687
do not patch version
neSpecc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -520,6 +520,80 @@ export default class Dom { | |
} | ||
|
||
/** | ||
* Leafs nodes inside the target list from active element | ||
* | ||
* @param {HTMLElement[]} nodeList - target list of nodes | ||
* @param {number} activeIndex — index of active node. By default it must be -1 | ||
* @param {string} direction - leaf direction. Can be 'left' or 'right' | ||
* @param {string} activeCSSClass - css class that will be added | ||
* | ||
* @return {Number} index of active node | ||
*/ | ||
public static leafNodesAndReturnIndex(nodeList, activeIndex, direction, activeCSSClass): number { | ||
/** | ||
* If activeButtonIndex === -1 then we have no chosen Tool in Toolbox | ||
*/ | ||
if (activeIndex === -1) { | ||
/** | ||
* Normalize "previous" Tool index depending on direction. | ||
* We need to do this to highlight "first" Tool correctly | ||
* | ||
* Order of Tools: [0] [1] ... [n - 1] | ||
* [0 = n] because of: n % n = 0 % n | ||
* | ||
* Direction 'right': for [0] the [n - 1] is a previous index | ||
* [n - 1] -> [0] | ||
* | ||
* Direction 'left': for [n - 1] the [0] is a previous index | ||
* [n - 1] <- [0] | ||
* | ||
* @type {number} | ||
*/ | ||
activeIndex = direction === 'right' ? -1 : 0; | ||
} else { | ||
/** | ||
* If we have chosen Tool then remove highlighting | ||
*/ | ||
(nodeList[activeIndex] as HTMLElement).classList.remove(activeCSSClass); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Нужно задать типы аргументов и не придется так писать |
||
} | ||
|
||
/** | ||
* Count index for next Tool | ||
*/ | ||
if (direction === 'right') { | ||
/** | ||
* If we go right then choose next (+1) Tool | ||
* @type {number} | ||
*/ | ||
activeIndex = (activeIndex + 1) % nodeList.length; | ||
} else { | ||
/** | ||
* If we go left then choose previous (-1) Tool | ||
* Before counting module we need to add length before because of "The JavaScript Modulo Bug" | ||
* @type {number} | ||
*/ | ||
activeIndex = (nodeList.length + activeIndex - 1) % nodeList.length; | ||
} | ||
|
||
if (Dom.isNativeInput(nodeList[activeIndex])) { | ||
/** | ||
* Focus input | ||
*/ | ||
nodeList[activeIndex].focus(); | ||
} | ||
|
||
/** | ||
* Highlight new chosen Tool | ||
*/ | ||
(nodeList[activeIndex] as HTMLElement).classList.add(activeCSSClass); | ||
|
||
/** | ||
* Return Active index | ||
*/ | ||
return activeIndex; | ||
} | ||
|
||
/* | ||
* Helper for get holder from {string} or return HTMLElement | ||
* @param element | ||
*/ | ||
|
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не нужно поднимать версию тут