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
c11d627c
Commit
c11d627c
authored
Feb 22, 2013
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Chrome/Safari don't use keypress for backspace and delete.
parent
f1c8301e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
cms/static/js/views/settings/advanced_view.js
+6
-2
No files found.
cms/static/js/views/settings/advanced_view.js
View file @
c11d627c
...
@@ -10,7 +10,10 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
...
@@ -10,7 +10,10 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
'click .new-button'
:
"addEntry"
,
'click .new-button'
:
"addEntry"
,
// update model on changes
// update model on changes
'change .policy-key'
:
"updateKey"
,
'change .policy-key'
:
"updateKey"
,
// keypress to catch alpha keys and backspace/delete on some browsers
'keypress .policy-key'
:
"showSaveCancelButtons"
,
'keypress .policy-key'
:
"showSaveCancelButtons"
,
// keyup to catch backspace/delete reliably
'keyup .policy-key'
:
"showSaveCancelButtons"
,
'focus :input'
:
"focusInput"
,
'focus :input'
:
"focusInput"
,
'blur :input'
:
"blurInput"
'blur :input'
:
"blurInput"
// TODO enable/disable save based on validation (currently enabled whenever there are changes)
// TODO enable/disable save based on validation (currently enabled whenever there are changes)
...
@@ -130,8 +133,9 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
...
@@ -130,8 +133,9 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
showSaveCancelButtons
:
function
(
event
)
{
showSaveCancelButtons
:
function
(
event
)
{
if
(
!
this
.
buttonsVisible
)
{
if
(
!
this
.
buttonsVisible
)
{
if
(
event
&&
event
.
type
===
'keypress'
)
{
if
(
event
&&
(
event
.
type
===
'keypress'
||
event
.
type
===
'keyup'
))
{
// check whether it's really an altering event
// check whether it's really an altering event: note, String.fromCharCode(keyCode) will
// give positive values for control/command/option-letter combos; so, don't use it
if
(
!
((
event
.
charCode
&&
String
.
fromCharCode
(
event
.
charCode
)
!==
""
)
||
if
(
!
((
event
.
charCode
&&
String
.
fromCharCode
(
event
.
charCode
)
!==
""
)
||
// 8 = backspace, 46 = delete
// 8 = backspace, 46 = delete
event
.
keyCode
===
8
||
event
.
keyCode
===
46
))
return
;
event
.
keyCode
===
8
||
event
.
keyCode
===
46
))
return
;
...
...
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