Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
a1f0679f
Commit
a1f0679f
authored
Nov 28, 2017
by
Sofiya Semenova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Educator 1552 - Implement roving tabindex for WYSIWYG editor for discussions
parent
f9623fc9
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
17 deletions
+58
-17
common/static/common/js/discussion/utils.js
+35
-0
common/static/common/js/discussion/views/discussion_thread_view.js
+4
-1
common/static/common/js/discussion/views/new_post_view.js
+4
-1
lms/static/js/Markdown.Editor.js
+14
-14
scripts/all-tests.sh
+1
-1
No files found.
common/static/common/js/discussion/utils.js
View file @
a1f0679f
...
...
@@ -7,6 +7,9 @@
DiscussionUtil
.
wmdEditors
=
{};
DiscussionUtil
.
leftKey
=
37
;
DiscussionUtil
.
rightKey
=
39
;
DiscussionUtil
.
getTemplate
=
function
(
id
)
{
return
$
(
'script#'
+
id
).
html
();
};
...
...
@@ -539,6 +542,38 @@
};
};
DiscussionUtil
.
handleKeypressInToolbar
=
function
(
event
)
{
var
$currentButton
,
$nextButton
,
$toolbar
,
$allButtons
,
keyPressed
,
nextIndex
,
currentButtonIndex
,
validKeyPress
,
toolbarHasButtons
;
$currentButton
=
$
(
event
.
target
);
keyPressed
=
event
.
which
||
event
.
keyCode
;
$toolbar
=
$currentButton
.
parent
();
$allButtons
=
$toolbar
.
children
(
'.wmd-button'
);
validKeyPress
=
keyPressed
===
this
.
leftKey
||
keyPressed
===
this
.
rightKey
;
toolbarHasButtons
=
$allButtons
.
length
>
0
;
if
(
validKeyPress
&&
toolbarHasButtons
)
{
currentButtonIndex
=
$allButtons
.
index
(
$currentButton
);
nextIndex
=
keyPressed
===
this
.
leftKey
?
currentButtonIndex
-
1
:
currentButtonIndex
+
1
;
nextIndex
=
Math
.
max
(
Math
.
min
(
nextIndex
,
$allButtons
.
length
-
1
),
0
);
$nextButton
=
$
(
$allButtons
[
nextIndex
]);
this
.
moveSelectionToNextItem
(
$currentButton
,
$nextButton
);
}
};
DiscussionUtil
.
moveSelectionToNextItem
=
function
(
prevItem
,
nextItem
)
{
prevItem
.
attr
(
'aria-selected'
,
'false'
);
prevItem
.
attr
(
'tabindex'
,
'-1'
);
nextItem
.
attr
(
'aria-selected'
,
'true'
);
nextItem
.
attr
(
'tabindex'
,
'0'
);
nextItem
.
focus
();
};
return
DiscussionUtil
;
}).
call
(
this
);
}).
call
(
window
);
common/static/common/js/discussion/views/discussion_thread_view.js
View file @
a1f0679f
...
...
@@ -62,7 +62,10 @@
DiscussionThreadView
.
prototype
.
events
=
{
'click .discussion-submit-post'
:
'submitComment'
,
'click .add-response-btn'
:
'scrollToAddResponse'
'click .add-response-btn'
:
'scrollToAddResponse'
,
'keydown .wmd-button'
:
function
(
event
)
{
return
DiscussionUtil
.
handleKeypressInToolbar
(
event
);
}
};
DiscussionThreadView
.
prototype
.
$
=
function
(
selector
)
{
...
...
common/static/common/js/discussion/views/new_post_view.js
View file @
a1f0679f
...
...
@@ -137,7 +137,10 @@
'change .post-option-input'
:
'postOptionChange'
,
'click .cancel'
:
'cancel'
,
'click .add-post-cancel'
:
'cancel'
,
'reset .forum-new-post-form'
:
'updateStyles'
'reset .forum-new-post-form'
:
'updateStyles'
,
'keydown .wmd-button'
:
function
(
event
)
{
return
DiscussionUtil
.
handleKeypressInToolbar
(
event
);
}
};
NewPostView
.
prototype
.
toggleGroupDropdown
=
function
(
$target
)
{
...
...
lms/static/js/Markdown.Editor.js
View file @
a1f0679f
...
...
@@ -1442,9 +1442,9 @@
buttonRow
.
className
=
'wmd-button-row'
;
buttonRow
=
buttonBar
.
appendChild
(
buttonRow
);
var
xPosition
=
0
;
var
makeButton
=
function
(
id
,
title
,
XShift
,
textOp
)
{
var
makeButton
=
function
(
id
,
title
,
XShift
,
textOp
,
tabIndex
)
{
var
button
=
document
.
createElement
(
'button'
);
button
.
tabIndex
=
0
;
button
.
tabIndex
=
tabIndex
;
button
.
className
=
'wmd-button'
;
button
.
style
.
left
=
xPosition
+
'px'
;
xPosition
+=
25
;
...
...
@@ -1468,35 +1468,35 @@
xPosition
+=
25
;
};
buttons
.
bold
=
makeButton
(
'wmd-bold-button'
,
gettext
(
'Bold (Ctrl+B)'
),
'0px'
,
bindCommand
(
'doBold'
));
buttons
.
italic
=
makeButton
(
'wmd-italic-button'
,
gettext
(
'Italic (Ctrl+I)'
),
'-20px'
,
bindCommand
(
'doItalic'
));
buttons
.
bold
=
makeButton
(
'wmd-bold-button'
,
gettext
(
'Bold (Ctrl+B)'
),
'0px'
,
bindCommand
(
'doBold'
)
,
0
);
buttons
.
italic
=
makeButton
(
'wmd-italic-button'
,
gettext
(
'Italic (Ctrl+I)'
),
'-20px'
,
bindCommand
(
'doItalic'
)
,
-
1
);
makeSpacer
(
1
);
buttons
.
link
=
makeButton
(
'wmd-link-button'
,
gettext
(
'Hyperlink (Ctrl+L)'
),
'-40px'
,
bindCommand
(
function
(
chunk
,
postProcessing
)
{
return
this
.
doLinkOrImage
(
chunk
,
postProcessing
,
false
);
}));
buttons
.
quote
=
makeButton
(
'wmd-quote-button'
,
gettext
(
'Blockquote (Ctrl+Q)'
),
'-60px'
,
bindCommand
(
'doBlockquote'
));
buttons
.
code
=
makeButton
(
'wmd-code-button'
,
gettext
(
'Code Sample (Ctrl+K)'
),
'-80px'
,
bindCommand
(
'doCode'
));
})
,
-
1
);
buttons
.
quote
=
makeButton
(
'wmd-quote-button'
,
gettext
(
'Blockquote (Ctrl+Q)'
),
'-60px'
,
bindCommand
(
'doBlockquote'
)
,
-
1
);
buttons
.
code
=
makeButton
(
'wmd-code-button'
,
gettext
(
'Code Sample (Ctrl+K)'
),
'-80px'
,
bindCommand
(
'doCode'
)
,
-
1
);
buttons
.
image
=
makeButton
(
'wmd-image-button'
,
gettext
(
'Image (Ctrl+G)'
),
'-100px'
,
bindCommand
(
function
(
chunk
,
postProcessing
)
{
return
this
.
doLinkOrImage
(
chunk
,
postProcessing
,
true
,
imageUploadHandler
);
}));
})
,
-
1
);
makeSpacer
(
2
);
buttons
.
olist
=
makeButton
(
'wmd-olist-button'
,
gettext
(
'Numbered List (Ctrl+O)'
),
'-120px'
,
bindCommand
(
function
(
chunk
,
postProcessing
)
{
this
.
doList
(
chunk
,
postProcessing
,
true
);
}));
})
,
-
1
);
buttons
.
ulist
=
makeButton
(
'wmd-ulist-button'
,
gettext
(
'Bulleted List (Ctrl+U)'
),
'-140px'
,
bindCommand
(
function
(
chunk
,
postProcessing
)
{
this
.
doList
(
chunk
,
postProcessing
,
false
);
}));
buttons
.
heading
=
makeButton
(
'wmd-heading-button'
,
gettext
(
'Heading (Ctrl+H)'
),
'-160px'
,
bindCommand
(
'doHeading'
));
buttons
.
hr
=
makeButton
(
'wmd-hr-button'
,
gettext
(
'Horizontal Rule (Ctrl+R)'
),
'-180px'
,
bindCommand
(
'doHorizontalRule'
));
})
,
-
1
);
buttons
.
heading
=
makeButton
(
'wmd-heading-button'
,
gettext
(
'Heading (Ctrl+H)'
),
'-160px'
,
bindCommand
(
'doHeading'
)
,
-
1
);
buttons
.
hr
=
makeButton
(
'wmd-hr-button'
,
gettext
(
'Horizontal Rule (Ctrl+R)'
),
'-180px'
,
bindCommand
(
'doHorizontalRule'
)
,
-
1
);
makeSpacer
(
3
);
buttons
.
undo
=
makeButton
(
'wmd-undo-button'
,
gettext
(
'Undo (Ctrl+Z)'
),
'-200px'
,
null
);
buttons
.
undo
=
makeButton
(
'wmd-undo-button'
,
gettext
(
'Undo (Ctrl+Z)'
),
'-200px'
,
null
,
-
1
);
buttons
.
undo
.
execute
=
function
(
manager
)
{
if
(
manager
)
manager
.
undo
();
};
var
redoTitle
=
/win/
.
test
(
nav
.
platform
.
toLowerCase
())
?
gettext
(
'Redo (Ctrl+Y)'
)
:
gettext
(
'Redo (Ctrl+Shift+Z)'
);
// mac and other non-Windows platforms
buttons
.
redo
=
makeButton
(
'wmd-redo-button'
,
redoTitle
,
'-220px'
,
null
);
buttons
.
redo
=
makeButton
(
'wmd-redo-button'
,
redoTitle
,
'-220px'
,
null
,
-
1
);
buttons
.
redo
.
execute
=
function
(
manager
)
{
if
(
manager
)
manager
.
redo
();
};
if
(
helpOptions
)
{
...
...
scripts/all-tests.sh
View file @
a1f0679f
...
...
@@ -13,7 +13,7 @@ set -e
# Violations thresholds for failing the build
export
LOWER_PYLINT_THRESHOLD
=
1000
export
UPPER_PYLINT_THRESHOLD
=
5900
export
ESLINT_THRESHOLD
=
9
134
export
ESLINT_THRESHOLD
=
9
543
export
STYLELINT_THRESHOLD
=
973
XSSLINT_THRESHOLDS
=
`
cat
scripts/xsslint_thresholds.json
`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment