Robert Carnecky 10 lat temu
rodzic
commit
48e04c1fe5
3 zmienionych plików z 36 dodań i 3 usunięć
  1. 8
    0
      generator/generate.html
  2. 15
    0
      generator/js/shortcut.d.ts
  3. 13
    3
      generator/js/ui.ts

+ 8
- 0
generator/generate.html Wyświetl plik

@@ -378,6 +378,14 @@
378 378
                             To learn about what features are available to define a card, inspect the sample deck or
379 379
                             read some basic documentation at the <a href="http://crobi.github.io/rpg-cards/">project site</a>.
380 380
                         </li>
381
+                        <li>
382
+                            The editor supports keyboard shortcuts:
383
+                            CTRL+M (toggle menu),
384
+                            CTRL+D (duplicate card),
385
+                            Delete (delete card),
386
+                            Up or Page-up (previous card),
387
+                            Down or Page-down (next card)
388
+                        </li>
381 389
                     </ul>
382 390
                 </div>
383 391
                 <div class="modal-footer">

+ 15
- 0
generator/js/shortcut.d.ts Wyświetl plik

@@ -0,0 +1,15 @@
1
+interface ShortcutOptions {
2
+    type?: string;
3
+    propagate?: boolean;
4
+    disable_in_input?: boolean;
5
+    target?: HTMLElement;
6
+    keycode?: boolean;
7
+}
8
+
9
+
10
+interface ShortcutStatic {
11
+    add(key_combination: string, callback: Function, opt?: ShortcutOptions);
12
+    remove(key_combination: string);
13
+}
14
+
15
+declare var shortcut: ShortcutStatic;

+ 13
- 3
generator/js/ui.ts Wyświetl plik

@@ -483,16 +483,26 @@ module RpgCardsUI {
483 483
         setTimeout(function () { tab.postMessage(card_html, '*') }, 500);
484 484
     }
485 485
 
486
-    export function collapse_menu() {
486
+    function collapse_menu() {
487 487
         $("#menu-column").hide();
488 488
         $("#card-column").removeClass("col-lg-5");
489 489
         $("#card-column").addClass("col-lg-8");
490
+        editor.resize();
490 491
     }
491 492
 
492
-    export function uncollapse_menu() {
493
+    function uncollapse_menu() {
493 494
         $("#menu-column").show();
494 495
         $("#card-column").removeClass("col-lg-8");
495 496
         $("#card-column").addClass("col-lg-5");
497
+        editor.resize();
498
+    }
499
+
500
+    export function toggle_menu() {
501
+        if ($("#menu-column").is(":visible")) {
502
+            collapse_menu();
503
+        } else {
504
+            uncollapse_menu();
505
+        }
496 506
     }
497 507
 
498 508
     // ============================================================================
@@ -511,7 +521,7 @@ module RpgCardsUI {
511 521
         (<any>editor).setOption("wrap", "free");
512 522
         editor.setTheme("ace/theme/chrome");
513 523
         editor.getSession().setMode("ace/mode/rpgcard");
514
-        editor.$blockScrolling = Infinity;
524
+        (<any>editor).$blockScrolling = Infinity;
515 525
 
516 526
         setup_color_selector();
517 527
         (<any>$('.icon-list')).typeahead({ source: icon_names });

Ładowanie…
Anuluj
Zapisz