mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-11-05 18:13:17 +00:00
* remove blks first try * dprint.json seems to be OK, some forgotten functions * add some more space-after-keyword settings * server remove blks * add **/files to dprint exclude * dprint.js fixes a typo * add boot.js and bootprefix.js to dprint exclude * dprint change dprint.json * add dprint fmt as script * remove jslint comments * fix whitespace * fix whitespace * remove function-wrapper from geospatial plugin * fix whitespace * add function wrapper to dyannotate-startup * remove dpring.json
41 lines
894 B
JavaScript
41 lines
894 B
JavaScript
/*\
|
|
title: $:/core/modules/macros/displayshortcuts.js
|
|
type: application/javascript
|
|
module-type: macro
|
|
|
|
Macro to display a list of keyboard shortcuts in human readable form. Notably, it resolves named shortcuts like `((bold))` to the underlying keystrokes.
|
|
|
|
\*/
|
|
|
|
"use strict";
|
|
|
|
/*
|
|
Information about this macro
|
|
*/
|
|
|
|
exports.name = "displayshortcuts";
|
|
|
|
exports.params = [
|
|
{name: "shortcuts"},
|
|
{name: "prefix"},
|
|
{name: "separator"},
|
|
{name: "suffix"}
|
|
];
|
|
|
|
/*
|
|
Run the macro
|
|
*/
|
|
exports.run = function(shortcuts,prefix,separator,suffix) {
|
|
var shortcutArray = $tw.keyboardManager.getPrintableShortcuts($tw.keyboardManager.parseKeyDescriptors(shortcuts,{
|
|
wiki: this.wiki
|
|
}));
|
|
if(shortcutArray.length > 0) {
|
|
shortcutArray.sort(function(a,b) {
|
|
return a.toLowerCase().localeCompare(b.toLowerCase());
|
|
})
|
|
return prefix + shortcutArray.join(separator) + suffix;
|
|
} else {
|
|
return "";
|
|
}
|
|
};
|