From bacccbadf3e450e99401af80beeef294b9b568fd Mon Sep 17 00:00:00 2001 From: Rokt33r Date: Fri, 5 Jun 2015 01:12:47 +0900 Subject: [PATCH] add 'enter to save clipboard' --- electron_src/popup/index.html | 19 ++-- electron_src/popup/popup.js | 158 ++++++++++++++++++++++++++++------ electron_src/popup/popup.scss | 30 ++++--- icon.png | Bin 0 -> 367 bytes main.js | 5 ++ src/directives/ui-ace.js | 6 ++ 6 files changed, 172 insertions(+), 46 deletions(-) create mode 100644 icon.png diff --git a/electron_src/popup/index.html b/electron_src/popup/index.html index 62339b93..ca91b3b5 100644 --- a/electron_src/popup/index.html +++ b/electron_src/popup/index.html @@ -17,26 +17,27 @@ -
+
-
    + -
    -
    - - - +
    +
    + + +
    -
    = ($scope.filteredSnippets.length -1)) { + if ($scope.selectIndex >= ($scope.filteredSnippets.length - 1)) { return } selectItem(++$scope.selectIndex) } function selectPriorItem () { - if ($scope.selectIndex == 0) { + if ($scope.selectIndex === 0) { focusSearchInput() return } selectItem(--$scope.selectIndex) } + // Focusing control + $scope.isFocusing = 0 + function focusSearchInput () { $scope.isFocusing = SEARCH_INPUT document.getElementById('search-input').focus() + + $scope.controlIndex = 0 } + $scope.focusSearchInput = focusSearchInput function focusList () { $scope.isFocusing = RESULT_LIST document.getElementById('search-input').blur() + + $scope.controlIndex = 0 } $scope.focusList = focusList - function focusDetail () { - $scope.isFocusing = RESULT_DETAIL - } - - function hidePopUp () { - remote.getCurrentWindow().hide() - } -}) -.directive('resultItem', function () { - return { - link: function (scope, el, attr) { - + function focusControl () { + if ($scope.controlIndex === 0) { + $scope.controlIndex = 1 } + $scope.isFocusing = RESULT_CONTROL + } + $scope.focusControl = focusControl + + function focusContent () { + angular.element(aceView).scope().focus() + $scope.isFocusing = RESULT_CONTENT + } + + $scope.controlIndex = 0 + + function nextControl () { + if ($scope.controlIndex === 3) { + $scope.controlIndex = 0 + focusContent() + return + } + $scope.controlIndex ++ + } + + function priorControl () { + if ($scope.controlIndex === 1) { + focusList() + return + } + $scope.controlIndex -- } }) .directive('searchInput', function () { diff --git a/electron_src/popup/popup.scss b/electron_src/popup/popup.scss index ef1e8856..eeb9b6a0 100644 --- a/electron_src/popup/popup.scss +++ b/electron_src/popup/popup.scss @@ -21,7 +21,7 @@ $focused-shadow-color: $brand-primary; bottom: 0; width: 100%; overflow: hidden; - .result-list{ + .left-pane{ margin: 0; position: absolute; left: 0; @@ -30,6 +30,9 @@ $focused-shadow-color: $brand-primary; width: 40%; overflow-y: auto; overflow-x: hidden; + + } + .result-list{ list-style:none; padding: 0; &.focused{ @@ -52,10 +55,7 @@ $focused-shadow-color: $brand-primary; } border-right: 1px solid $border-color; } - .result-detail{ - &.focused{ - border: solid 1px $brand-primary; - } + .right-pane{ position: absolute; left: 40%; top: 0; @@ -63,12 +63,20 @@ $focused-shadow-color: $brand-primary; width: 60%; overflow-y: auto; overflow-x: hidden; - .result-detail-cotent{ - position: absolute; - top: 34px; - bottom: 0; - width: 100%; - } + + } + + .result-detail-control{ + position: absolute; + top: 0; + width: 100%; + height: 34px; + } + .result-detail-content{ + position: absolute; + top: 34px; + bottom: 0; + width: 100%; } } diff --git a/icon.png b/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..c26ad86d5d0eb6a44c1514c73ab7b9d024f3a148 GIT binary patch literal 367 zcmV-#0g(QQP)Px#T~JI^MJGB=fQy#A!N*r-bt^woJWgOTL{}|9Qz$%7 zL{(-{VQ|#f+hlfxmY=98i?wxujHj=+!^zM8|NoJtviJD-K3#Gjn9Cxp^P31tQ@1a!2V+y>T})qZJtJ_%9atLpX*-7>HX@s_0Y7;^_#ql zY8e4B9?9pm4A~mkMj(wE`#d-XY8D_ACToxMX9*~c&LHIhzR~&r4?kvA2tkcWV50y4 N002ovPDHLkV1nAQpril* literal 0 HcmV?d00001 diff --git a/main.js b/main.js index f1106629..3e13070f 100644 --- a/main.js +++ b/main.js @@ -12,7 +12,12 @@ app.on('window-all-closed', function () { if (process.platform !== 'darwin') app.quit() }) +var Tray = require('tray') +var appIcon = null + app.on('ready', function () { + appIcon = new Tray('./icon.png') + appIcon.setToolTip('This is my application.') mainWindow = new BrowserWindow({width: 800, height: 600}) diff --git a/src/directives/ui-ace.js b/src/directives/ui-ace.js index f50ee49c..cc45e323 100644 --- a/src/directives/ui-ace.js +++ b/src/directives/ui-ace.js @@ -332,6 +332,12 @@ angular.module('ui.ace', []) scope.Infinity = -1 + scope.focus = function () { + acee.focus() + } + + scope.addCommand = acee.commands.addCommand + } }; }]);