mirror of
https://github.com/getformwork/formwork.git
synced 2025-01-17 21:49:04 +01:00
Add keyboard shortcut to all views with Save command
This commit is contained in:
parent
ef3f738bb3
commit
bebc4244d8
15
admin/assets/js/app.js
Executable file → Normal file
15
admin/assets/js/app.js
Executable file → Normal file
@ -20,6 +20,18 @@ var Formwork = {
|
||||
new Formwork.Notification($this.attr('content'), $this.data('type'), $this.data('interval'));
|
||||
$this.remove();
|
||||
});
|
||||
|
||||
if ($('[data-command=save]').length > 0) {
|
||||
$(document).keydown(function() {
|
||||
if (!event.altKey && (event.ctrlKey || event.metaKey)) {
|
||||
if (event.which == 83) { // ctrl/cmd + S
|
||||
$('[data-command=save]').click();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@ -167,9 +179,6 @@ Formwork.Editor = function(id) {
|
||||
case 73: // ctrl/cmd + I
|
||||
$('[data-command=italic]', $toolbar).click();
|
||||
return false;
|
||||
case 83: // ctrl/cmd + S
|
||||
$('[data-command=save]').click();
|
||||
return false;
|
||||
case 89: //ctrl/cmd + Y
|
||||
case 90: // ctrl/cmd + Z
|
||||
return false;
|
||||
|
2
admin/assets/js/app.min.js
vendored
Executable file → Normal file
2
admin/assets/js/app.min.js
vendored
Executable file → Normal file
File diff suppressed because one or more lines are too long
@ -85,9 +85,6 @@ Formwork.Editor = function(id) {
|
||||
case 73: // ctrl/cmd + I
|
||||
$('[data-command=italic]', $toolbar).click();
|
||||
return false;
|
||||
case 83: // ctrl/cmd + S
|
||||
$('[data-command=save]').click();
|
||||
return false;
|
||||
case 89: //ctrl/cmd + Y
|
||||
case 90: // ctrl/cmd + Z
|
||||
return false;
|
||||
|
@ -20,6 +20,18 @@ var Formwork = {
|
||||
new Formwork.Notification($this.attr('content'), $this.data('type'), $this.data('interval'));
|
||||
$this.remove();
|
||||
});
|
||||
|
||||
if ($('[data-command=save]').length > 0) {
|
||||
$(document).keydown(function() {
|
||||
if (!event.altKey && (event.ctrlKey || event.metaKey)) {
|
||||
if (event.which == 83) { // ctrl/cmd + S
|
||||
$('[data-command=save]').click();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -5,6 +5,6 @@
|
||||
<?= $fields ?>
|
||||
<div class="separator-l"></div>
|
||||
<input type="hidden" name="csrf-token" value="<?= $csrfToken ?>">
|
||||
<button class="button-accent button-save button-right" type="submit" tabindex="4"><i class="i-check"></i> <?= $this->label('modal.action.save') ?></button>
|
||||
<button class="button-accent button-save button-right" type="submit" tabindex="4" data-command="save"><i class="i-check"></i> <?= $this->label('modal.action.save') ?></button>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -5,6 +5,6 @@
|
||||
<?= $fields ?>
|
||||
<div class="separator-l"></div>
|
||||
<input type="hidden" name="csrf-token" value="<?= $csrfToken ?>">
|
||||
<button class="button-accent button-save button-right" type="submit" tabindex="4"><i class="i-check"></i> <?= $this->label('modal.action.save') ?></button>
|
||||
<button class="button-accent button-save button-right" type="submit" tabindex="4" data-command="save"><i class="i-check"></i> <?= $this->label('modal.action.save') ?></button>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -68,7 +68,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="csrf-token" value="<?= $csrfToken ?>">
|
||||
<button class="button-accent button-save button-right" type="submit" tabindex="4"><i class="i-check"></i> <?= $this->label('modal.action.save') ?></button>
|
||||
<button class="button-accent button-save button-right" type="submit" tabindex="4" data-command="save"><i class="i-check"></i> <?= $this->label('modal.action.save') ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user