in fact, remove shortcuts altogether - we're not using formatting yet,

and it's borking firefox
This commit is contained in:
Tyler Renelle 2012-09-04 14:23:57 -04:00
parent 8930be1356
commit 0391cee8a5
2 changed files with 1 additions and 50 deletions

View file

@ -328,35 +328,7 @@ ready(function(model) {
exports.endOfDayTally = function(e, el) { exports.endOfDayTally = function(e, el) {
return scoring.tally(model); return scoring.tally(model);
}; };
exports.updateSchema = function(e, el) { return exports.updateSchema = function(e, el) {
return schema.updateSchema(model); return schema.updateSchema(model);
}; };
return exports.shortcuts = function(e) {
var code, command;
if (!(e.metaKey || e.ctrlKey)) {
return;
}
code = e.which;
if (!(command = ((function() {
switch (code) {
case 66:
return 'bold';
case 73:
return 'italic';
case 32:
return 'removeFormat';
case 220:
return 'removeFormat';
default:
return null;
}
})()))) {
return;
}
document.execCommand(command, false, null);
if (e.preventDefault) {
e.preventDefault();
}
return false;
};
}); });

View file

@ -278,24 +278,3 @@ ready (model) ->
exports.updateSchema = (e, el) -> exports.updateSchema = (e, el) ->
schema.updateSchema(model) schema.updateSchema(model)
# ========== SHORTCUTS ==========
exports.shortcuts = (e) ->
return unless e.metaKey || e.ctrlKey
code = e.which
return unless command = (switch code
when 66 then 'bold' # Bold: Ctrl/Cmd + B
when 73 then 'italic' # Italic: Ctrl/Cmd + I
when 32 then 'removeFormat' # Clear formatting: Ctrl/Cmd + Space
when 220 then 'removeFormat' # Clear formatting: Ctrl/Cmd + \
else null
)
document.execCommand command, false, null
e.preventDefault() if e.preventDefault
return false
# Tell Firefox to use elements for styles instead of CSS
# See: https://developer.mozilla.org/en/Rich-Text_Editing_in_Mozilla
# FIXME, removing for now - seems to break our app in FireFox
# document.execCommand 'useCSS', false, true
# document.execCommand 'styleWithCSS', false, false