Skip to content

Commit

Permalink
Check if you need to save before exiting, also move attribute drawer …
Browse files Browse the repository at this point in the history
…away from caret.

* fix for issue #22

* comment out unused key commands

* attribute drawer moves based on caret

* make TEI template for new docs

* don't serialize empty attrs

* placeholder icon file blank facs

* save guard wip

* save before exit feature

* increment version
  • Loading branch information
NickLaiacona authored Nov 5, 2019
1 parent 0bb279e commit 66cdf2d
Show file tree
Hide file tree
Showing 9 changed files with 236 additions and 114 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "faircopy",
"version": "0.1.0",
"version": "0.3.0",
"description": "(The first of many) small sharp tools for digital scholarship in the humanities",
"main": "public/electron.js",
"private": true,
Expand Down Expand Up @@ -29,6 +29,7 @@
"dependencies": {
"@material-ui/core": "^4.5.0",
"@material-ui/icons": "^4.4.3",
"diff": "^4.0.1",
"prop-types": "^15.7.2",
"prosemirror-example-setup": "^1.0.1",
"prosemirror-model": "^1.7.0",
Expand All @@ -54,7 +55,7 @@
"build/**/*",
"node_modules/**/*"
],
"directories":{
"directories": {
"buildResources": "assets"
},
"mac": {
Expand Down
14 changes: 9 additions & 5 deletions public/css/TEIEditor.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,30 @@
min-width: calc( 100% - 12px);
}

.TEIEditor .dialogPlane {
.TEIEditor .dialogPlaneTop {
position: fixed;
top: 70px;
left: 30px;
width: 80%;
}

.TEIEditor .dialogPlaneNote {
.TEIEditor .dialogPlaneBottom {
position: fixed;
bottom: 0px;
margin-bottom: 5px;
left: 30px;
width: 80%;
}

.save-button {
.TEIEditor .save-button {
background: '#FAFAFA';
float: right;
}

.draggable {
.TEIEditor .toolbar button {
-webkit-app-region: no-drag;
}

.TEIEditor .draggable {
-webkit-app-region: drag
}
}
12 changes: 6 additions & 6 deletions src/components/ParameterDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ export default class ParameterDrawer extends Component {

changeAttributeHandler = ( element, attributeKey ) => {
return (e) => {
const {dispatch, editorState, teiDocumentFile} = this.props
const {dispatch, editorState, teiDocument} = this.props
const { $anchor } = editorState.selection
let {tr} = editorState
const {value} = e.target
if( element instanceof Node && element.type.name === 'note' && attributeKey === 'id') {
teiDocumentFile.moveSubDocument(element.attrs['id'], value)
teiDocument.moveSubDocument(element.attrs['id'], value)
}
tr = changeAttribute( element, attributeKey, value, $anchor, tr )
dispatch(tr)
Expand Down Expand Up @@ -55,9 +55,9 @@ export default class ParameterDrawer extends Component {
const {attrs} = element
const elementName = element.type.name
const keys = Object.keys(attrs)
const {teiDocumentFile} = this.props
const elementSpec = teiDocumentFile.elementSpecs[elementName]
const defaultAttrSpec = teiDocumentFile.defaultAttrSpec
const {teiDocument} = this.props
const elementSpec = teiDocument.elementSpecs[elementName]
const defaultAttrSpec = teiDocument.defaultAttrSpec

let attrFields = []
for( const key of keys ) {
Expand Down Expand Up @@ -117,7 +117,7 @@ export default class ParameterDrawer extends Component {
// }

renderElement(element,key) {
const { elementSpecs } = this.props.teiDocumentFile
const { elementSpecs } = this.props.teiDocument
const name = element.type.name

return (
Expand Down
Loading

0 comments on commit 66cdf2d

Please sign in to comment.