25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

106 satır
2.8 KiB

3 yıl önce
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script src="bower_components/seajs/dist/sea.js"></script>
  5. <meta charset="utf-8">
  6. <link rel="stylesheet" href="hotbox.css" />
  7. <style>
  8. html, body {
  9. margin: 0;
  10. padding: 0;
  11. }
  12. .message {
  13. text-align: center;
  14. margin: 20px 0;
  15. }
  16. .editor {
  17. width: 1200px;
  18. height: 750px;
  19. position: relative;
  20. background: rgb(251, 251, 251);
  21. border: 1px solid #ccc;
  22. margin: 20px auto;
  23. overflow: hidden;
  24. }
  25. </style>
  26. </head>
  27. <body>
  28. <div class="message">编辑区域获得焦点时,按空格呼出热盒。主菜单的快捷键可以直接执行</div>
  29. <div class="editor"></div>
  30. </body>
  31. <script>
  32. /* global seajs */
  33. seajs.config({
  34. base: './src'
  35. });
  36. define('start', function(require) {
  37. var HotBox = require('hotbox');
  38. var hotbox = new HotBox('.editor');
  39. hotbox.control();
  40. hotbox.hintDeactiveMainState = true;
  41. hotbox.openOnContextMenu = true;
  42. var main = hotbox.state('main');
  43. main.button({
  44. position: 'center',
  45. label: '编辑',
  46. key: 'F2'
  47. });
  48. var ringButtons = '前移:Alt+Up|下级:Tab|同级:Enter|后移:Alt+Down|删除:Delete|归纳:Shift+Tab'.split('|');
  49. ringButtons.forEach(function(button) {
  50. main.button({
  51. position: 'ring',
  52. label: button.split(':')[0],
  53. key: button.split(':')[1]
  54. });
  55. });
  56. var topButtons = '超链接:H|图片:I|备注:N|优先级:P|进度:G|资源:R'.split('|');
  57. topButtons.forEach(function(button) {
  58. main.button({
  59. position: 'top',
  60. label: button.split(':')[0],
  61. key: button.split(':')[1],
  62. next: button.split(':')[1] == 'P' ? 'priority' : 'idle'
  63. });
  64. });
  65. var bottomButtons = '模板:T|布局:L|样式:S|展开:/|选择:M'.split('|');
  66. bottomButtons.forEach(function(button) {
  67. main.button({
  68. position: 'bottom',
  69. label: button.split(':')[0],
  70. key: button.split(':')[1]
  71. });
  72. });
  73. var priority = hotbox.state('priority');
  74. '123456789'.split('').forEach(function(p) {
  75. priority.button({
  76. position: 'ring',
  77. label: 'P' + p,
  78. key: p
  79. });
  80. });
  81. priority.button({
  82. position: 'center',
  83. label: '移除',
  84. key: 'Del',
  85. next: 'idle'
  86. });
  87. priority.button({
  88. position: 'top',
  89. label: '返回',
  90. key: 'Esc',
  91. next: 'back'
  92. });
  93. });
  94. seajs.use('start');
  95. </script>
  96. </html>