Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大大大太阳yt
driver.js
提交
068c0639
D
driver.js
项目概览
大大大太阳yt
/
driver.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
driver.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
068c0639
编写于
4月 29, 2018
作者:
K
Kamran Ahmed
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add keyboardControl option and typo in readme
上级
42504d6f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
17 addition
and
5 deletion
+17
-5
index.html
index.html
+2
-1
readme.md
readme.md
+4
-3
src/common/constants.js
src/common/constants.js
+1
-0
src/index.js
src/index.js
+4
-1
types/index.d.ts
types/index.d.ts
+6
-0
未找到文件。
index.html
浏览文件 @
068c0639
...
@@ -278,6 +278,7 @@ driver.highlight({
...
@@ -278,6 +278,7 @@ driver.highlight({
nextBtnText: 'Next', // Next button text for this step
nextBtnText: 'Next', // Next button text for this step
prevBtnText: 'Previous', // Previous button text for this step
prevBtnText: 'Previous', // Previous button text for this step
showButtons: false, // Do not show control buttons in footer
showButtons: false, // Do not show control buttons in footer
keyboardControl: true, // Allow controlling through keyboard (escape to close, arrow keys to move)
scrollIntoViewOptions: {}, // We use `scrollIntoView()` when possible, pass here the options for it if you want any
scrollIntoViewOptions: {}, // We use `scrollIntoView()` when possible, pass here the options for it if you want any
onHighlightStarted: (Element) {}, // Called when element is about to be highlighted
onHighlightStarted: (Element) {}, // Called when element is about to be highlighted
onHighlighted: (Element) {}, // Called when element is fully highlighted
onHighlighted: (Element) {}, // Called when element is fully highlighted
...
@@ -322,7 +323,7 @@ driver.hasPreviousStep(); // Checks if there is previous step to move to
...
@@ -322,7 +323,7 @@ driver.hasPreviousStep(); // Checks if there is previous step to move to
// Gets the currently highlighted element on screen
// Gets the currently highlighted element on screen
const activeElement = driver.getHighlightedElement();
const activeElement = driver.getHighlightedElement();
const lastActiveElement = driver.getLastHighlightedElement();
const lastActiveElement = driver.getLastHighlightedElement();
activeElement.get
ScreenCoordinates
(); // Gets screen co-ordinates of the active element
activeElement.get
CalculatedPosition
(); // Gets screen co-ordinates of the active element
activeElement.hidePopover(); // Hide the popover
activeElement.hidePopover(); // Hide the popover
activeElement.showPopover(); // Show the popover
activeElement.showPopover(); // Show the popover
...
...
readme.md
浏览文件 @
068c0639
...
@@ -167,6 +167,7 @@ const driver = new Driver({
...
@@ -167,6 +167,7 @@ const driver = new Driver({
nextBtnText
:
'
Next
'
,
// Next button text for this step
nextBtnText
:
'
Next
'
,
// Next button text for this step
prevBtnText
:
'
Previous
'
,
// Previous button text for this step
prevBtnText
:
'
Previous
'
,
// Previous button text for this step
showButtons
:
false
,
// Do not show control buttons in footer
showButtons
:
false
,
// Do not show control buttons in footer
keyboardControl
:
true
,
// Allow controlling through keyboard (escape to close, arrow keys to move)
scrollIntoViewOptions
:
{},
// We use `scrollIntoView()` when possible, pass here the options for it if you want any
scrollIntoViewOptions
:
{},
// We use `scrollIntoView()` when possible, pass here the options for it if you want any
onHighlightStarted
:
(
Element
)
{},
// Called when element is about to be highlighted
onHighlightStarted
:
(
Element
)
{},
// Called when element is about to be highlighted
onHighlighted
:
(
Element
)
{},
// Called when element is fully highlighted
onHighlighted
:
(
Element
)
{},
// Called when element is fully highlighted
...
@@ -258,9 +259,9 @@ const activeElement = driver.getHighlightedElement();
...
@@ -258,9 +259,9 @@ const activeElement = driver.getHighlightedElement();
// Gets the last highlighted element, would be an instance of `/src/core/element.js`
// Gets the last highlighted element, would be an instance of `/src/core/element.js`
const
lastActiveElement
=
driver
.
getLastHighlightedElement
();
const
lastActiveElement
=
driver
.
getLastHighlightedElement
();
activeElement
.
get
ScreenCoordinates
();
// Gets screen co-ordinates of the active element
activeElement
.
get
CalculatedPosition
();
// Gets screen co-ordinates of the active element
activeElement
.
hidePopover
();
// Hide the popover
activeElement
.
hidePopover
();
// Hide the popover
activeElement
.
showPopover
();
// Show the popover
activeElement
.
showPopover
();
// Show the popover
activeElement
.
getNode
();
// Gets the DOM Element behind this element
activeElement
.
getNode
();
// Gets the DOM Element behind this element
```
```
...
...
src/common/constants.js
浏览文件 @
068c0639
...
@@ -3,6 +3,7 @@ export const OVERLAY_PADDING = 10;
...
@@ -3,6 +3,7 @@ export const OVERLAY_PADDING = 10;
export
const
SHOULD_ANIMATE_OVERLAY
=
true
;
export
const
SHOULD_ANIMATE_OVERLAY
=
true
;
export
const
SHOULD_OUTSIDE_CLICK_CLOSE
=
true
;
export
const
SHOULD_OUTSIDE_CLICK_CLOSE
=
true
;
export
const
ALLOW_KEYBOARD_CONTROL
=
true
;
export
const
SHOULD_OUTSIDE_CLICK_NEXT
=
false
;
export
const
SHOULD_OUTSIDE_CLICK_NEXT
=
false
;
export
const
ESC_KEY_CODE
=
27
;
export
const
ESC_KEY_CODE
=
27
;
...
...
src/index.js
浏览文件 @
068c0639
...
@@ -15,6 +15,7 @@ import {
...
@@ -15,6 +15,7 @@ import {
SHOULD_ANIMATE_OVERLAY
,
SHOULD_ANIMATE_OVERLAY
,
SHOULD_OUTSIDE_CLICK_CLOSE
,
SHOULD_OUTSIDE_CLICK_CLOSE
,
SHOULD_OUTSIDE_CLICK_NEXT
,
SHOULD_OUTSIDE_CLICK_NEXT
,
ALLOW_KEYBOARD_CONTROL
,
}
from
'
./common/constants
'
;
}
from
'
./common/constants
'
;
import
Stage
from
'
./core/stage
'
;
import
Stage
from
'
./core/stage
'
;
import
{
isDomElement
}
from
'
./common/utils
'
;
import
{
isDomElement
}
from
'
./common/utils
'
;
...
@@ -33,6 +34,7 @@ export default class Driver {
...
@@ -33,6 +34,7 @@ export default class Driver {
padding
:
OVERLAY_PADDING
,
// Spacing around the element from the overlay
padding
:
OVERLAY_PADDING
,
// Spacing around the element from the overlay
scrollIntoViewOptions
:
null
,
// Options to be passed to `scrollIntoView`
scrollIntoViewOptions
:
null
,
// Options to be passed to `scrollIntoView`
allowClose
:
SHOULD_OUTSIDE_CLICK_CLOSE
,
// Whether to close overlay on click outside the element
allowClose
:
SHOULD_OUTSIDE_CLICK_CLOSE
,
// Whether to close overlay on click outside the element
keyboardControl
:
ALLOW_KEYBOARD_CONTROL
,
// Whether to allow controlling through keyboard or not
overlayClickNext
:
SHOULD_OUTSIDE_CLICK_NEXT
,
// Whether to move next on click outside the element
overlayClickNext
:
SHOULD_OUTSIDE_CLICK_NEXT
,
// Whether to move next on click outside the element
stageBackground
:
'
#ffffff
'
,
// Background color for the stage
stageBackground
:
'
#ffffff
'
,
// Background color for the stage
onHighlightStarted
:
()
=>
{
// When element is about to be highlighted
onHighlightStarted
:
()
=>
{
// When element is about to be highlighted
...
@@ -137,7 +139,8 @@ export default class Driver {
...
@@ -137,7 +139,8 @@ export default class Driver {
* @private
* @private
*/
*/
onKeyUp
(
event
)
{
onKeyUp
(
event
)
{
if
(
!
this
.
isActivated
)
{
// If driver is not active or keyboard control is disabled
if
(
!
this
.
isActivated
||
!
this
.
options
.
keyboardControl
)
{
return
;
return
;
}
}
...
...
types/index.d.ts
浏览文件 @
068c0639
...
@@ -645,6 +645,12 @@ declare module 'driver.js' {
...
@@ -645,6 +645,12 @@ declare module 'driver.js' {
*/
*/
allowClose
?:
boolean
,
allowClose
?:
boolean
,
/**
* Whether to allow controlling steps through keyboard
* @default true
*/
keyboardControl
?:
boolean
,
/**
/**
* Clicking outside the highlighted element should move next
* Clicking outside the highlighted element should move next
* @default false
* @default false
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录