Skip to content

Commit

Permalink
FairCopy v1.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
NickLaiacona authored Feb 8, 2023
2 parents 40bb794 + aad4a10 commit c632b0a
Show file tree
Hide file tree
Showing 41 changed files with 867 additions and 397 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"windows": {
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
},
"env": { "FAIRCOPY_DEBUG_MODE": "true", "FAIRCOPY_DEV_VERSION": "1.1.3" },
"env": { "FAIRCOPY_DEBUG_MODE": "true", "FAIRCOPY_DEV_VERSION": "1.1.6" },
"program": "${workspaceRoot}/public/electron.js",
"protocol": "inspector",
}
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "faircopy",
"version": "1.1.4",
"version": "1.1.6",
"description": "A word processor for the humanities scholar.",
"main": "public/electron.js",
"private": true,
Expand Down Expand Up @@ -36,7 +36,6 @@
"@material-ui/core": "^4.9.14",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.53",
"react-spring": "9.5.5",
"@rails/actioncable": "^6.0.5",
"annotorious-openseadragon": "github:performant-software/annotorious-openseadragon",
"axios": "^0.19.2",
Expand Down Expand Up @@ -64,10 +63,12 @@
"react-beautiful-dnd": "^13.0.0",
"react-dom": "^16.13.1",
"react-force-graph-2d": "^1.13.6",
"react-hotkeys": "^2.0.0",
"react-markdown": "^6.0.0",
"react-scripts": "3.4.1",
"react-scroll": "1.8.3",
"react-split-pane": "^0.1.92",
"react-spring": "9.5.5",
"semver": "^7.3.5",
"uuid": "^8.1.0",
"w3c-xmlserializer": "^2.0.0",
Expand Down Expand Up @@ -106,7 +107,9 @@
"win": {
"icon": "build/icon.ico",
"certificateSubjectName": "Performant Software Solutions LLC",
"signingHashAlgorithms": ["sha256"],
"signingHashAlgorithms": [
"sha256"
],
"publisherName": "Performant Software Solutions LLC",
"signAndEditExecutable": true,
"target": [
Expand Down
17 changes: 17 additions & 0 deletions public/css/KeyBindingDialog.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#KeyBindingDialog .element-field {
display: inline-block;
}

#KeyBindingDialog .keystroke-record-button {
margin-top: 20px;
}

#KeyBindingDialog .record-icon {
margin-right: 5px;
color: red;
}

#KeyBindingDialog .error-message {
margin: 5px;
color: red;
}
15 changes: 15 additions & 0 deletions public/css/KeyBindingsTable.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#KeyBindingsTable {
margin: 20px;
}

#KeyBindingsTable .explanation {
margin-bottom: 50px;
}

#KeyBindingsTable th {
font-weight: bold;
}

#KeyBindingsTable .add-keybinding-button {
margin-top: 10px;
}
7 changes: 6 additions & 1 deletion public/css/ParameterDrawer.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,9 @@
#ParameterDrawer .edit-note-button {
margin-top: 30px;
margin-right: 20px;
}
}

#ParameterDrawer .drawer-pin {
float: right;
margin-right: 10px;
}
4 changes: 3 additions & 1 deletion public/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,6 @@
@import "SelectRemoteProjectPanel.css";
@import "ChooseLocalFilePanel.css";
@import "IIIFTreeView.css";
@import "IIIFImportDialog.css"
@import "IIIFImportDialog.css";
@import "KeyBindingsTable.css";
@import "KeyBindingDialog.css";
5 changes: 5 additions & 0 deletions public/main-process/FairCopyApplication.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ class FairCopyApplication {
this.exitApp()
}
})

ipcMain.on('reopenProject', (event) => {
this.fairCopySession.reopenProject()
})

ipcMain.on('addResource', (event, resourceEntry, resourceData, resourceMap) => { this.fairCopySession.addResource(resourceEntry,resourceData,resourceMap) })

ipcMain.on('removeResources', (event, resourceIDs) => {
Expand Down
5 changes: 5 additions & 0 deletions public/main-process/FairCopySession.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ class FairCopySession {
if( this.remoteProject ) this.remoteProject.close()
}

reopenProject() {
this.remoteProject.open()
this.requestResourceView()
}

openImageResource(url) {
this.projectStore.openImageResource(url)
}
Expand Down
6 changes: 5 additions & 1 deletion public/main-process/RemoteProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class RemoteProject {
const {baseDir} = fairCopyApplication
this.fairCopySession = fairCopySession
this.initRemoteProjectWorker( baseDir, fairCopyApplication.isDebugMode(), userID, serverURL, projectID ).then(() => {
this.remoteProjectWorker.postMessage({ messageType: 'open' })
this.open()
})
}

Expand Down Expand Up @@ -81,6 +81,10 @@ class RemoteProject {
return this.remoteProjectWorker.start({userID, serverURL, projectID})
}

open() {
this.remoteProjectWorker.postMessage({ messageType: 'open' })
}

close() {
this.remoteProjectWorker.postMessage({ messageType: 'close' })
}
Expand Down
1 change: 1 addition & 0 deletions public/main-process/config/faircopy-config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"keybindings": {},
"menus": {
"mark": [
{
Expand Down
9 changes: 9 additions & 0 deletions public/main-process/data-migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ const migrateConfig = function migrateConfig( generatedWith, baseConfig, project
migrationRemoveElements(projectConfig,baseConfig)
migrationAddNewElements(baseConfig,projectConfig)

if( semver.lt(projectVersion,'1.1.6') ) {
migrationAddKeybindings(projectConfig)
log.info('applying migrations for v1.1.6')
}

if( semver.lt(projectVersion,'0.10.1') ) {
migrationAddMenus(projectConfig,baseConfig)
migrationAddActiveState(projectConfig)
Expand Down Expand Up @@ -65,6 +70,10 @@ exports.migrateManifestData = migrateManifestData

//// MIGRATIONS /////////////////////////////////////////////////

function migrationAddKeybindings(projectConfig) {
projectConfig.keybindings = {}
}

function migrationAddNewElements(baseConfig,projectConfig) {
const baseElements = Object.keys(baseConfig.elements)
const projectElements = Object.keys(projectConfig.elements)
Expand Down
11 changes: 11 additions & 0 deletions public/main-process/release-notes/latest.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

The release notes list the improvements and bug fixes included in each new version of the software.

## Version 1.1.6

### Improvements

* Users can now create hotkeys for their favorite Mark elements. Hotkeys must use at least one of: alt, control, meta, or option keys. When used in a remote project, the user must have project config privs to edit the hotkeys, which will be shared by all members of the project.
* User can now pin the attribute drawer in the open position, to prevent the editor from hopping around as they move between elements.

### Bug Fixes

* A number of issues have been addressed around log in to remote projects, include server side session time outs.

## Version 1.1.4

### Improvements
Expand Down
6 changes: 6 additions & 0 deletions src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React, { Component } from 'react'
import { configure } from 'react-hotkeys'

import MainWindow from './main-window/MainWindow'
import ImageWindow from './image-window/ImageWindow'
import ProjectWindow from './project-window/ProjectWindow'
Expand All @@ -12,6 +14,7 @@ import ImageView from '../model/ImageView'
import { initLicenseData, licenseLock } from '../model/license-key'
import { getConfigStatus } from '../model/faircopy-config'


const fairCopy = window.fairCopy

export default class App extends Component {
Expand Down Expand Up @@ -99,6 +102,9 @@ export default class App extends Component {
if( rootComponent === 'MainWindow' ) {
services.ipcRegisterCallback('projectOpened', (event, projectData) => this.openProject(projectData))
services.ipcRegisterCallback('projectIncompatible', (event, incompatInfo) => this.setState({ ...this.state, incompatInfo }) )

// configure hot keys to accept input from all element types
configure({ ignoreEventsCondition: () => false })
} else if( rootComponent === 'ImageWindow' ) {
services.ipcRegisterCallback('imageViewOpened', (event, imageViewData) => this.openImageView(imageViewData))
}
Expand Down
16 changes: 9 additions & 7 deletions src/components/main-window/MainWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,20 +398,21 @@ export default class MainWindow extends Component {
}

onLoggedIn = () => {
const { resourceViews } = this.state
const { currentView } = resourceViews
const resourceView = resourceViews[currentView]
const { indexParentID, parentEntry, currentPage } = resourceView
const resourceViewRequest = { currentView, indexParentID, parentEntry, currentPage }
this.setState( {...this.state, loginMode: false} )
fairCopy.services.ipcSend('requestResourceView', resourceViewRequest )
fairCopy.services.ipcSend('reopenProject')
}

onLogOut = () => {
const { resourceViews } = this.state
const { fairCopyProject } = this.props
const { userID, serverURL } = fairCopyProject
const { currentView } = resourceViews
const resourceView = resourceViews[currentView]
const { indexParentID, parentEntry, currentPage } = resourceView
const resourceViewRequest = { currentView, indexParentID, parentEntry, currentPage }
logout(userID, serverURL)
this.setState( {...this.state} )
fairCopy.services.ipcSend('requestResourceView', resourceViewRequest )
}

onEditResource = () => {
Expand Down Expand Up @@ -556,7 +557,8 @@ export default class MainWindow extends Component {
case 'delete':
{
const { fairCopyProject } = this.props
const alertOptions = { resourceIDs }
const { openResources } = this.state
const alertOptions = { resourceIDs, openResources }
if( fairCopyProject.areEditable( resourceEntries ) ) {
this.setState({ ...nextState, alertDialogMode: 'confirmDelete', alertOptions, ...closePopUpState })
} else {
Expand Down
13 changes: 11 additions & 2 deletions src/components/main-window/dialogs/AlertDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,19 @@ export default class AlertDialog extends Component {
renderConfirmDelete() {
const { alertOptions, onCloseAlert, closeResources, fairCopyProject } = this.props

const { resourceIDs } = alertOptions
const { resourceIDs, openResources } = alertOptions

const onDelete = () => {
closeResources(resourceIDs, false, false )
const closingResourceIDs = [ ...resourceIDs ]

// we need to see if any of the open resources have a doomed resource as a parent and add them to close list
for( const openResource of Object.values(openResources) ) {
if( resourceIDs.includes( openResource.parentEntry.id ) ) {
closingResourceIDs.push( openResource.resourceID )
}
}

closeResources(closingResourceIDs, false, false )
fairCopyProject.removeResources(resourceIDs)
}

Expand Down
7 changes: 6 additions & 1 deletion src/components/main-window/dialogs/LoginDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ export default class LoginDialog extends Component {
const value = e.currentTarget.value
this.setState({...this.state, email: value })
}
const onKeyPress = (e) => {
if( e.key === 'Enter' ) {
onLogin()
}
}

const { email, password } = this.state
const saveAllowed = ( password.length > 0 && email.length > 0 )
Expand All @@ -49,7 +54,7 @@ export default class LoginDialog extends Component {
aria-labelledby="login-title"
>
<DialogTitle id="login-title">Login to Remote Server</DialogTitle>
<DialogContent>
<DialogContent onKeyPress={onKeyPress}>
<ul>
<li>
<TextField
Expand Down
17 changes: 10 additions & 7 deletions src/components/main-window/resource-browser/ResourceBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Button, Card, TableContainer, Table, TableHead, TableRow, TableCell, Ta
import TitleBar from '../TitleBar'
import { getResourceIcon, getActionIcon, getResourceIconLabel } from '../../../model/resource-icon';
import { isEntryEditable, isCheckedOutRemote } from '../../../model/FairCopyProject'
import { isLoggedIn } from '../../../model/cloud-api/auth'
import { canCheckOut, canCreate, canDelete } from '../../../model/permissions'

export default class ResourceBrowser extends Component {
Expand Down Expand Up @@ -84,10 +83,8 @@ export default class ResourceBrowser extends Component {

renderLoginButton(buttonProps) {
const { onLogin, fairCopyProject, onLogout } = this.props
const { remote, userID, serverURL } = fairCopyProject
const loggedIn = remote ? isLoggedIn(userID, serverURL) : false

return loggedIn ?
return fairCopyProject.isLoggedIn() ?
<Button {...buttonProps} onClick={onLogout}>Log Out</Button> :
<Button {...buttonProps} onClick={onLogin}>Log In</Button>
}
Expand Down Expand Up @@ -279,13 +276,19 @@ export default class ResourceBrowser extends Component {
}

renderEmptyListMessage() {
const { resourceIndex, currentView } = this.props
if( resourceIndex.length > 0 || currentView !== 'home' ) return null
const { resourceIndex, currentView, fairCopyProject, resourceView } = this.props
if( resourceIndex.length > 0 || resourceView.loading ) return null

const message = currentView === 'home' ?
<Typography>There are no local resources. Click on the <i className="fa fa-home-alt"></i> icon to see resources on the server.</Typography> :
fairCopyProject.isLoggedIn() ?
<Typography>There are no remote resources. On the <i className="fa fa-home-alt"></i> Local page, you can create or import new resources to add to your project.</Typography> :
<Typography>You are not logged into the server. Click on the LOG IN button above.</Typography>

return (
<Card raised={true} className='empty-list-card'>
<CardContent>
<Typography>There are no local resources. Click on the <i className="fa fa-home-alt"></i> icon to see resources on the server.</Typography>
{ message }
</CardContent>
</Card>
)
Expand Down
Loading

0 comments on commit c632b0a

Please sign in to comment.