mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
add authentication check for popup & add notification(clipboarded)
This commit is contained in:
@@ -26,9 +26,9 @@
|
||||
|
||||
<div class="right-pane">
|
||||
<div class="result-detail-control">
|
||||
<button id="btnClipboard" type="button" name="button" class="btn btn-default"><i class="fa fa-clipboard"></i></button>
|
||||
<button id="btnEdit" type="button" name="button" class="btn btn-default"><i class="fa fa-edit"></i></button>
|
||||
<button id="btnShare" type="button" name="button" class="btn btn-default"><i class="fa fa-share"></i></button>
|
||||
<button ng-click="writeCode(selectedItem.content)" id="btnClipboard" type="button" name="button" class="btn btn-default"><i class="fa fa-clipboard"></i></button>
|
||||
<!-- <button ng-click="editSnippet(selectedItem.id)" id="btnEdit" type="button" name="button" class="btn btn-default"><i class="fa fa-edit"></i></button> -->
|
||||
<!-- <button id="btnShare" type="button" name="button" class="btn btn-default"><i class="fa fa-share"></i></button> -->
|
||||
</div>
|
||||
<div id="aceView" class="result-detail-content"
|
||||
ui-ace="{
|
||||
|
||||
@@ -11,14 +11,9 @@ angular.module('codexen.popup', [
|
||||
'cfp.hotkeys'
|
||||
])
|
||||
.controller('PopUpController', function ($scope, Snippet, $auth, $window, hotkeys, $document, $filter) {
|
||||
|
||||
// For Dev
|
||||
$scope.toggleDev = function () {
|
||||
remote.getCurrentWindow().toggleDevTools()
|
||||
}
|
||||
|
||||
// Setup Events
|
||||
remote.getCurrentWindow().on('focus', function () {
|
||||
if (!$auth.isAuthenticated()) return hidePopUp()
|
||||
$scope.$apply(focusSearchInput)
|
||||
loadSnippets()
|
||||
})
|
||||
@@ -48,8 +43,7 @@ angular.module('codexen.popup', [
|
||||
e.preventDefault()
|
||||
})
|
||||
.add('enter', function (e) {
|
||||
console.log($scope.selectedItem.content)
|
||||
ipc.send('writeCode', $scope.selectedItem.content)
|
||||
writeCode($scope.selectedItem.content)
|
||||
e.preventDefault()
|
||||
})
|
||||
|
||||
@@ -95,6 +89,7 @@ angular.module('codexen.popup', [
|
||||
|
||||
$scope.selectSnippet = selectSnippet
|
||||
$scope.filterList = filterList
|
||||
$scope.writeCode = writeCode
|
||||
$scope.focusSearchInput = focusSearchInput
|
||||
|
||||
// Search Filter
|
||||
@@ -143,6 +138,10 @@ angular.module('codexen.popup', [
|
||||
selectSnippet()
|
||||
}
|
||||
|
||||
function writeCode (code) {
|
||||
ipc.send('writeCode', code)
|
||||
}
|
||||
|
||||
// Focusing Search Input
|
||||
function focusSearchInput () {
|
||||
document.getElementById('search-input').focus()
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* global angular */
|
||||
angular.module('codexen.popup')
|
||||
.constant('apiUrl', 'http://localhost:8000/')
|
||||
.config(function ($authProvider, $httpProvider) {
|
||||
$authProvider.baseUrl = 'http://localhost:8000/'
|
||||
.config(function ($authProvider, $httpProvider, apiUrl) {
|
||||
$authProvider.baseUrl = apiUrl
|
||||
|
||||
$httpProvider.defaults.useXDomain = true
|
||||
delete $httpProvider.defaults.headers.common['X-Requested-With']
|
||||
|
||||
14
main.js
14
main.js
@@ -13,8 +13,9 @@ var mainWindow = null
|
||||
// })
|
||||
|
||||
var clipboard = require('clipboard')
|
||||
|
||||
var Tray = require('tray')
|
||||
var notifier = require('node-notifier')
|
||||
|
||||
var appIcon = null
|
||||
|
||||
app.on('ready', function () {
|
||||
@@ -37,7 +38,8 @@ app.on('ready', function () {
|
||||
show: false,
|
||||
frame: false,
|
||||
'web-preferences': {
|
||||
'overlay-scrollbars': true
|
||||
'overlay-scrollbars': true,
|
||||
'skip-taskbar': true
|
||||
}
|
||||
})
|
||||
|
||||
@@ -70,8 +72,16 @@ app.on('ready', function () {
|
||||
ipc.on('hidePopUp', function () {
|
||||
hidePopUp()
|
||||
})
|
||||
|
||||
ipc.on('writeCode', function (e, code) {
|
||||
clipboard.writeText(code)
|
||||
notifier.notify({
|
||||
title: 'Write on clipboard!',
|
||||
message: 'Ready to paste',
|
||||
wait: false
|
||||
}, function (err, res) {
|
||||
|
||||
})
|
||||
hidePopUp()
|
||||
})
|
||||
|
||||
|
||||
18
package.json
18
package.json
@@ -39,17 +39,13 @@
|
||||
"angular-md5": "^0.1.7",
|
||||
"angular-sanitize": "^1.3.15",
|
||||
"angular-ui-router": "^0.2.15",
|
||||
"bootstrap-styl": "^4.0.4",
|
||||
"font-awesome": "^4.3.0",
|
||||
"moment": "^2.10.3",
|
||||
"robotjs": "^0.1.2",
|
||||
"satellizer": "^0.10.1",
|
||||
"ui-select": "^0.11.2",
|
||||
"bootstrap-sass": "^3.3.4",
|
||||
"bootstrap-styl": "^4.0.4",
|
||||
"del": "^1.2.0",
|
||||
"dotenv": "^1.1.0",
|
||||
"electron-prebuilt": "^0.27.2",
|
||||
"electron-rebuild": "^0.2.1",
|
||||
"font-awesome": "^4.3.0",
|
||||
"globby": "^2.0.0",
|
||||
"gulp": "^3.8.11",
|
||||
"gulp-angular-templatecache": "^1.6.0",
|
||||
@@ -65,8 +61,12 @@
|
||||
"gulp-template": "^3.0.0",
|
||||
"gulp-uglify": "^1.2.0",
|
||||
"merge-stream": "^0.1.7",
|
||||
"run-sequence": "^1.1.0"
|
||||
"moment": "^2.10.3",
|
||||
"node-notifier": "^4.2.1",
|
||||
"robotjs": "^0.1.2",
|
||||
"run-sequence": "^1.1.0",
|
||||
"satellizer": "^0.10.1",
|
||||
"ui-select": "^0.11.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
}
|
||||
"devDependencies": {}
|
||||
}
|
||||
|
||||
@@ -13,16 +13,6 @@ angular.module('codexen')
|
||||
vm.isLoaded = true
|
||||
})
|
||||
|
||||
// TODO: When deletion occurs, switch the next snippet
|
||||
// TODO: Add deletion confirmation modal
|
||||
vm.delete = function () {
|
||||
Snippet.delete(vm.snippet.id)
|
||||
.success(function () {
|
||||
$rootScope.$broadcast('snippetDeleted')
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
$scope.$on('taggingRequested', function (e) {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<small><span ng-bind="vm.snippet.updatedAt|fromNow"></span> <i class="fa fa-clock-o"></i></small>
|
||||
</span>
|
||||
<span class="detail-header-control pull-right">
|
||||
<button type="button" name="button" class="btn btn-default"><i class="fa fa-share"></i></button>
|
||||
<!-- <button type="button" name="button" class="btn btn-default"><i class="fa fa-share"></i></button> -->
|
||||
<button btn-edit-snippet="vm.snippet" type="button" name="button" class="btn btn-default"><i class="fa fa-edit"></i></button>
|
||||
<button btn-delete-snippet="vm.snippet" type="button" name="button" class="btn btn-danger"><i class="fa fa-trash"></i></button>
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user