1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-09 07:25:23 +02:00

can press return on updated mousetrap lib

This commit is contained in:
Harvey Kandola 2016-06-22 11:57:10 -07:00
parent 038e916db1
commit f53b911e50
5 changed files with 51 additions and 26 deletions

View file

@ -44,7 +44,7 @@
> .action {
float: right;
vertical-align: text-top;
margin-top: -8px;
@extend .cursor-pointer;
display: none;
color: $color-stroke;

View file

@ -37,7 +37,7 @@
> .dropdown-dialog {
@extend .clearfix;
.content {
.content {
> p {
margin: 7px 0;
font-size: 0.9em;
@ -48,7 +48,7 @@
}
}
> .actions {
.actions {
margin-top: 15px;
float: right;
}

View file

@ -1,21 +1,23 @@
<div id="{{contentId}}" class="dropdown-dialog">
<div class="content">
{{yield}}
</div>
<div class="actions">
{{#if showCancel}}
<div class="flat-button" {{action 'onCancel'}}>
cancel
</div>
{{/if}}
{{#if hasSecondButton}}
<div class="flat-button {{color2}}" {{action 'onAction2'}}>
{{button2}}
<form class="form" {{action 'onAction' on="submit"}}>
<div class="content">
{{yield}}
</div>
<div class="actions">
{{#if showCancel}}
<div class="flat-button" {{action 'onCancel'}}>
cancel
</div>
{{/if}}
{{#if hasSecondButton}}
<div class="flat-button {{color2}}" {{action 'onAction2'}}>
{{button2}}
</div>
{{/if}}
<div class="flat-button {{color}}" {{action 'onAction'}}>
{{button}}
</div>
{{/if}}
<div class="flat-button {{color}}" {{action 'onAction'}}>
{{button}}
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
</form>
</div>

View file

@ -9,7 +9,7 @@
<div class="input-control">
<label>New space</label>
<div class="tip">A repository for related documentation</div>
{{input type='text' id="new-folder-name" value=newFolder}}
{{input type='text' id="new-folder-name" class="mousetrap" value=newFolder}}
</div>
</div>
{{/dropdown-dialog}}

View file

@ -1,6 +1,6 @@
/*global define:false */
/**
* Copyright 2015 Craig Campbell
* Copyright 2016 Craig Campbell
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -17,11 +17,16 @@
* Mousetrap is a simple keyboard shortcut library for Javascript with
* no external dependencies
*
* @version 1.5.2
* @version 1.6.0
* @url craig.is/killing/mice
*/
(function(window, document, undefined) {
// Check if mousetrap is used inside browser, if not, return
if (!window) {
return;
}
/**
* mapping of special keycodes to their corresponding keys
*
@ -151,7 +156,13 @@
* loop through to map numbers on the numeric keypad
*/
for (i = 0; i <= 9; ++i) {
_MAP[i + 96] = i;
// This needs to use a string cause otherwise since 0 is falsey
// mousetrap will never fire for numpad 0 pressed as part of a keydown
// event.
//
// @see https://github.com/ccampbell/mousetrap/pull/258
_MAP[i + 96] = i.toString();
}
/**
@ -983,6 +994,18 @@
return self._handleKey.apply(self, arguments);
};
/**
* allow custom key mappings
*/
Mousetrap.addKeycodes = function(object) {
for (var key in object) {
if (object.hasOwnProperty(key)) {
_MAP[key] = object[key];
}
}
_REVERSE_MAP = null;
};
/**
* Init the global mousetrap functions
*
@ -1018,4 +1041,4 @@
return Mousetrap;
});
}
}) (window, document);
}) (typeof window !== 'undefined' ? window : null, typeof window !== 'undefined' ? document : null);