Przeglądaj źródła

Update to Riot 3

cinaeco 8 lat temu
rodzic
commit
ab782b0846
5 zmienionych plików z 18 dodań i 19 usunięć
  1. 0 0
      css/vendor/skeleton.min.css
  2. 1 2
      js/pgfs.js
  3. 2 2
      js/pgsh.js
  4. 0 1
      js/vendor/riot+compiler.min.js
  5. 15 14
      tags/terminal-ui.tag

Plik diff jest za duży
+ 0 - 0
css/vendor/skeleton.min.css


+ 1 - 2
js/pgfs.js

@@ -16,8 +16,7 @@ var pgfs = {
         '1. Made by Weiyi Lou ' + new Date().getFullYear() + '\n' +
         '2. Done for fun.\n' +
         '3. Not a real terminal.\n' +
-        '4. But <a target="_blank" href="https://hyperterm.org/">this</a>' +
-          ' totally is.'
+        '4. But <a target="_blank" href="https://hyper.is/">this</a> is.'
     }
   },
   'mnt': {},

+ 2 - 2
js/pgsh.js

@@ -23,7 +23,7 @@ function pgsh(ev) {
       var code = e.keyCode || e.which
       // Tab for file path completion.
       if (code == 9) {
-        var input = ev.tags['command-line'].command.value.trim().split(' ')
+        var input = ev.tags['command-line'].refs.command.value.trim().split(' ')
         var command = input.shift()
         if (['cat', 'cd', 'ls'].indexOf(command) != -1) {
           var args = input.join(' ').trim()
@@ -212,7 +212,7 @@ function pgsh(ev) {
     }
   }
   this.version = function(args) {
-    show('Parsley Gardens Shell (pgsh) 1.1.0\nBuilt with: ' +
+    show('Parsley Gardens Shell (pgsh) 1.2.0\nBuilt with: ' +
          '<a target="_blank" href="http://riotjs.com">Riot</a> ' +
          '<a target="_blank" href="https://skeleton-framework.github.io">Skeleton</a> ' +
          '<a target="_blank" href="https://highlightjs.org">highlight.js</a>')

Plik diff jest za duży
+ 0 - 1
js/vendor/riot+compiler.min.js


+ 15 - 14
tags/terminal-ui.tag

@@ -65,13 +65,13 @@
 <command-line>
   <form autocomplete='off' onsubmit={ process } show={ visible }>
     <raw-html name='lhs' content={ prompt } show={ prompt_visible }>
-    </raw-html><input type='text' name='command' />
+    </raw-html><input type='text' ref='command' />
   </form>
 
   <style>
-    command-line input[name='command'],
-    command-line input[name='command']:hover,
-    command-line input[name='command']:focus {
+    command-line input[ref='command'],
+    command-line input[ref='command']:hover,
+    command-line input[ref='command']:focus {
       padding: 0; margin: 0; line-height: normal; font-size: 100%;
       background-color: transparent; border: none; outline: none;
       height: auto; width: 70%;
@@ -86,7 +86,7 @@
   this.visible = this.prompt_visible = true
   this.prompt = opts.prompt || '$ '
 
-  this.on('mount', function() { this.command.focus() })
+  this.on('mount', function() { this.refs.command.focus() })
 
   ev.on('prompt_set', function(text) { self.prompt = text })
 
@@ -94,15 +94,15 @@
 
   ev.on('prompt_show', function() { self.update({ prompt_visible: true }) })
 
-  ev.on('cmd_add', function(text) { self.command.value += text })
+  ev.on('cmd_add', function(text) { self.refs.command.value += text })
 
-  ev.on('cmd_set', function(text) { self.command.value = text })
+  ev.on('cmd_set', function(text) { self.refs.command.value = text })
 
   ev.on('cli_hide', function() { self.update({ visible: false }) })
 
   ev.on('cli_show', function() {
     self.update({ visible: true })
-    self.command.focus()
+    self.refs.command.focus()
   })
 
   ev.on('context_swap', function(name) {
@@ -119,19 +119,20 @@
     // Update the display.
     self.current = name
     if (self.visible) {
-      self.command.focus()
+      self.refs.command.focus()
     }
   })
 
-  process() {
+  process(event) {
     var prompt = this.prompt_visible ? this.prompt : ''
-    var command = this.encode(this.command.value)
+    var command = this.encode(this.refs.command.value)
     ev.trigger('disp_add', prompt + command + '\n')
     ev.trigger('cmd_entered', command)
-    this.command.value = ''
+    this.refs.command.value = ''
     // Refocus to scroll display and keep input in view.
-    this.command.blur()
-    this.command.focus()
+    this.refs.command.blur()
+    this.refs.command.focus()
+    event.preventDefault()
   }
 
   encode(text) {

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików