From 3eb9a2346ad05046e2ee88ddc1b2020c6e1a95f2 Mon Sep 17 00:00:00 2001 From: Cameron Sutter Date: Tue, 29 Oct 2019 00:05:43 -0600 Subject: [PATCH] fix problems with inputs --- bin/main.js | 13 +- example.pltr | 20 ++- package-lock.json | 120 +++++++++--------- package.json | 2 +- .../characters/characterListView.js | 8 +- .../components/characters/characterView.js | 11 +- src/app/components/colorpicker.js | 3 +- src/app/components/notes/noteView.js | 3 +- src/app/components/outline/cardView.js | 3 +- src/app/components/places/placeListView.js | 12 +- src/app/components/places/placeView.js | 9 +- src/app/components/tag/tagView.js | 4 +- src/app/components/timeline/cardDialog.js | 3 +- src/app/components/timeline/cardView.js | 3 +- src/app/components/timeline/lineView.js | 3 +- src/app/components/timeline/sceneView.js | 3 +- src/app/containers/Navigation.js | 3 +- src/app/index.js | 2 +- src/verify/VerifyView.js | 2 +- 19 files changed, 131 insertions(+), 96 deletions(-) diff --git a/bin/main.js b/bin/main.js index 3804953a9..04f890451 100644 --- a/bin/main.js +++ b/bin/main.js @@ -14,7 +14,7 @@ var { stringify } = require('dotenv-stringify') var i18n = require('format-message') const { autoUpdater } = require('electron-updater') if (process.env.NODE_ENV === 'dev') { - require('electron-reload')(path.join('..')) + // require('electron-reload')(path.join('..')) } const ENV_FILE_PATH = path.resolve(__dirname, '..', '.env') @@ -515,6 +515,11 @@ function openWindow (fileName, newFile = false) { } }) + newWindow.webContents.on('will-navigate', (event, string) => { + console.log("WILL NAVIGATE", string) + log.warn("WILL NAVIGATE") + }) + if (process.env.NODE_ENV === 'dev') { newWindow.openDevTools() } @@ -1069,6 +1074,12 @@ function buildViewMenu () { accelerator: 'CmdOrCtrl+P', click: takeScreenshot }] + if (process.env.NODE_ENV === 'dev') { + submenu.push({ + label: 'View Verify Window', + click: openVerifyWindow + }) + } return { label: i18n('View'), submenu: submenu diff --git a/example.pltr b/example.pltr index 5efe8fd63..ce63d3017 100644 --- a/example.pltr +++ b/example.pltr @@ -1,5 +1,15 @@ { "cards": [ + { + "characters": [], + "description": "stuff", + "id": 163, + "lineId": 27, + "places": [], + "sceneId": 107, + "tags": [], + "title": "new card" + }, { "characters": [], "description": "", @@ -634,9 +644,9 @@ }, "file": { "dirty": true, - "fileName": "/Users/cameron/github/plottr_electron/example.pltr", + "fileName": "/Users/sparrowhawk/github/plottr_electron/example.pltr", "loaded": true, - "version": "1.4.20" + "version": "1.4.24" }, "lines": [ { @@ -1084,9 +1094,11 @@ } ], "ui": { - "characterFilter": null, + "characterFilter": { + "age": [] + }, "characterSort": "name~asc", - "currentView": "timeline", + "currentView": "characters", "darkMode": false, "noteFilter": null, "noteSort": "title~asc", diff --git a/package-lock.json b/package-lock.json index 0220dab50..5c34883cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "plottr", - "version": "1.4.23", + "version": "1.4.24", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -4631,64 +4631,9 @@ }, "dependencies": { "@types/node": { - "version": "10.14.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.9.tgz", - "integrity": "sha512-NelG/dSahlXYtSoVPErrp06tYFrvzj8XLWmKA+X8x0W//4MqbUyZu++giUG/v0bjAT6/Qxa8IjodrfdACyb0Fg==", - "dev": true - }, - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "electron-download": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/electron-download/-/electron-download-4.1.1.tgz", - "integrity": "sha512-FjEWG9Jb/ppK/2zToP+U5dds114fM1ZOJqMAR4aXXL5CvyPE9fiqBK/9YcwC9poIFQTEJk/EM/zyRwziziRZrg==", - "dev": true, - "requires": { - "debug": "^3.0.0", - "env-paths": "^1.0.0", - "fs-extra": "^4.0.1", - "minimist": "^1.2.0", - "nugget": "^2.0.1", - "path-exists": "^3.0.0", - "rc": "^1.2.1", - "semver": "^5.4.1", - "sumchecker": "^2.0.2" - } - }, - "fs-extra": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", - "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "version": "10.17.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.0.tgz", + "integrity": "sha512-wuJwN2KV4tIRz1bu9vq5kSPasJ8IsEjZaP1ZR7KlmdUZvGF/rXy8DmXOVwUD0kAtvtJ7aqMKPqUXC0NUTDbrDg==", "dev": true } } @@ -4763,6 +4708,63 @@ "semver": "^5.3.0" } }, + "electron-download": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/electron-download/-/electron-download-4.1.1.tgz", + "integrity": "sha512-FjEWG9Jb/ppK/2zToP+U5dds114fM1ZOJqMAR4aXXL5CvyPE9fiqBK/9YcwC9poIFQTEJk/EM/zyRwziziRZrg==", + "dev": true, + "requires": { + "debug": "^3.0.0", + "env-paths": "^1.0.0", + "fs-extra": "^4.0.1", + "minimist": "^1.2.0", + "nugget": "^2.0.1", + "path-exists": "^3.0.0", + "rc": "^1.2.1", + "semver": "^5.4.1", + "sumchecker": "^2.0.2" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "fs-extra": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", + "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, "electron-json-storage": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/electron-json-storage/-/electron-json-storage-2.1.1.tgz", diff --git a/package.json b/package.json index f1b66b8e6..e5186510a 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "repository": "https://github.com/cameronsutter/plottr_electron.git", "private": true, "readme": "Copyright 2016 C. Louis S. (Cameron Sutter)", - "version": "1.4.24", + "version": "1.4.25", "author": { "name": "C. Louis S.", "email": "cameronsutter0@gmail.com", diff --git a/src/app/components/characters/characterListView.js b/src/app/components/characters/characterListView.js index 35feacf9e..e4298b4ed 100644 --- a/src/app/components/characters/characterListView.js +++ b/src/app/components/characters/characterListView.js @@ -1,5 +1,6 @@ import _ from 'lodash' import React, { Component } from 'react' +import ReactDOM from 'react-dom' import PropTypes from 'react-proptypes' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' @@ -51,8 +52,7 @@ class CharacterListView extends Component { componentDidUpdate () { if (this.refs.attrInput) { - var input = this.refs.attrInput.getInputDOMNode() - input.focus() + ReactDOM.findDOMNode(this.refs.attrInput).focus() } } @@ -119,7 +119,7 @@ class CharacterListView extends Component { } handleType = () => { - const attr = this.refs.attrInput.getValue() + const attr = ReactDOM.findDOMNode(this.refs.attrInput).value this.setState({addAttrText: attr}) } @@ -130,7 +130,7 @@ class CharacterListView extends Component { } saveAttr = () => { - const attr = this.refs.attrInput.getValue() + const attr = ReactDOM.findDOMNode(this.refs.attrInput).value this.props.customAttributeActions.addCharacterAttr(attr) this.setState({addAttrText: ''}) diff --git a/src/app/components/characters/characterView.js b/src/app/components/characters/characterView.js index 33ca01a1b..67073483e 100644 --- a/src/app/components/characters/characterView.js +++ b/src/app/components/characters/characterView.js @@ -1,5 +1,6 @@ import _ from 'lodash' import React, { Component } from 'react' +import ReactDOM from 'react-dom' import PropTypes from 'react-proptypes' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' @@ -49,8 +50,8 @@ class CharacterView extends Component { } saveEdit = () => { - var name = this.refs.nameInput.getValue() || this.props.character.name - var description = this.refs.descriptionInput.getValue() + var name = ReactDOM.findDOMNode(this.refs.nameInput).value || this.props.character.name + var description = ReactDOM.findDOMNode(this.refs.descriptionInput).value var notes = this.state.notes var attrs = {} this.props.customAttributes.forEach(attr => { @@ -58,7 +59,7 @@ class CharacterView extends Component { if (attrType == 'paragraph') { attrs[attrName] = this.state.description[attrName] } else { - const val = this.refs[`${attr}Input`].getValue() + const val = ReactDOM.findDOMNode(this.refs[`${attr}Input`]).value attrs[attr] = val } }) @@ -108,13 +109,13 @@ class CharacterView extends Component {
{i18n('Name')} - {i18n('Short Description')} - diff --git a/src/app/components/colorpicker.js b/src/app/components/colorpicker.js index 11e4a91f5..4106a79b3 100644 --- a/src/app/components/colorpicker.js +++ b/src/app/components/colorpicker.js @@ -1,4 +1,5 @@ import React, { Component } from 'react' +import ReactDOM from 'react-dom' import PropTypes from 'react-proptypes' import Modal from 'react-modal' import { reds, oranges, greens, blues, purples, grays, whites, browns } from '../constants/CSScolors' @@ -18,7 +19,7 @@ class ColorPicker extends Component { } showColor = () => { - var newColor = this.refs.hex.getValue() + var newColor = ReactDOM.findDOMNode(this.refs.hex).value var regex = /#?([0123456789abcdef]{6})/ var matches = regex.exec(newColor) if (matches) { diff --git a/src/app/components/notes/noteView.js b/src/app/components/notes/noteView.js index f1b499fa3..1ac83624c 100644 --- a/src/app/components/notes/noteView.js +++ b/src/app/components/notes/noteView.js @@ -1,5 +1,6 @@ import _ from 'lodash' import React, { Component } from 'react' +import ReactDOM from 'react-dom' import PropTypes from 'react-proptypes' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' @@ -32,7 +33,7 @@ class NoteView extends Component { } saveEdit = () => { - var title = this.refs.titleInput.getValue() || this.props.note.title + var title = ReactDOM.findDOMNode(this.refs.titleInput).value || this.props.note.title var content = this.state.content this.props.actions.editNote(this.props.note.id, {title, content}) } diff --git a/src/app/components/outline/cardView.js b/src/app/components/outline/cardView.js index 8268cc26a..4a3ed0c39 100644 --- a/src/app/components/outline/cardView.js +++ b/src/app/components/outline/cardView.js @@ -1,4 +1,5 @@ import React, { Component } from 'react' +import ReactDOM from 'react-dom' import PropTypes from 'react-proptypes' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' @@ -25,7 +26,7 @@ class CardView extends Component { } saveEdit = () => { - var newTitle = this.refs.titleInput.getValue() || this.props.card.title + var newTitle = ReactDOM.findDOMNode(this.refs.titleInput).value || this.props.card.title var newDescription = this.state.description this.saveCreatedLabels(newDescription) this.props.actions.editCard(this.props.card.id, newTitle, newDescription) diff --git a/src/app/components/places/placeListView.js b/src/app/components/places/placeListView.js index 7194bb76e..e12944c59 100644 --- a/src/app/components/places/placeListView.js +++ b/src/app/components/places/placeListView.js @@ -1,5 +1,6 @@ import _ from 'lodash' import React, { Component } from 'react' +import ReactDOM from 'react-dom' import PropTypes from 'react-proptypes' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' @@ -49,8 +50,7 @@ class PlaceListView extends Component { componentDidUpdate () { if (this.refs.attrInput) { - var input = this.refs.attrInput.getInputDOMNode() - input.focus() + ReactDOM.findDOMNode(this.refs.attrInput).focus() } } @@ -116,7 +116,7 @@ class PlaceListView extends Component { } handleType = () => { - const attr = this.refs.attrInput.getValue() + const attr = ReactDOM.findDOMNode(this.refs.attrInput).value this.setState({addAttrText: attr}) } @@ -127,11 +127,11 @@ class PlaceListView extends Component { } saveAttr = () => { - const attr = this.refs.attrInput.getValue() + const inputNode = ReactDOM.findDOMNode(this.refs.attrInput) + const attr = inputNode.value this.props.customAttributeActions.addPlaceAttr(attr) this.setState({addAttrText: ''}) - var input = this.refs.attrInput.getInputDOMNode() - input.focus() + inputNode.focus() } removeAttr (attr) { diff --git a/src/app/components/places/placeView.js b/src/app/components/places/placeView.js index 5d98cffd4..d9b00b794 100644 --- a/src/app/components/places/placeView.js +++ b/src/app/components/places/placeView.js @@ -1,4 +1,5 @@ import React, { Component } from 'react' +import ReactDOM from 'react-dom' import PropTypes from 'react-proptypes' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' @@ -30,12 +31,12 @@ class PlaceView extends Component { } saveEdit = () => { - var name = this.refs.nameInput.getValue() || this.props.place.name - var description = this.refs.descriptionInput.getValue() - var notes = this.refs.notesInput.getValue() + var name = ReactDOM.findDOMNode(this.refs.nameInput).value || this.props.place.name + var description = ReactDOM.findDOMNode(this.refs.descriptionInput).value + var notes = ReactDOM.findDOMNode(this.refs.notesInput).value var attrs = {} this.props.customAttributes.forEach(attr => { - const val = this.refs[`${attr}Input`].getValue() + const val = ReactDOM.findDOMNode(this.refs[`${attr}Input`]).value attrs[attr] = val }) this.props.actions.editPlace(this.props.place.id, {name, description, notes, ...attrs}) diff --git a/src/app/components/tag/tagView.js b/src/app/components/tag/tagView.js index ccf2e6f3f..693eab404 100644 --- a/src/app/components/tag/tagView.js +++ b/src/app/components/tag/tagView.js @@ -1,8 +1,8 @@ import React, { Component } from 'react' +import ReactDOM from 'react-dom' import PropTypes from 'react-proptypes' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' -import ReactDOM from 'react-dom' import { ButtonToolbar, ButtonGroup, Button, FormControl, FormGroup, ControlLabel, Glyphicon, DropdownButton, MenuItem } from 'react-bootstrap' import ColorPicker from '../colorpicker' @@ -40,7 +40,7 @@ class TagView extends Component { saveEdit () { let { title, id, color } = this.props.tag - var newTitle = this.refs.titleInput.getValue() || title + var newTitle = ReactDOM.findDOMNode(this.refs.titleInput).value || title this.props.actions.editTag(id, newTitle, color) this.setState({editing: false}) } diff --git a/src/app/components/timeline/cardDialog.js b/src/app/components/timeline/cardDialog.js index 16a2bbd9c..0d7c12100 100644 --- a/src/app/components/timeline/cardDialog.js +++ b/src/app/components/timeline/cardDialog.js @@ -1,4 +1,5 @@ import React, { Component } from 'react' +import ReactDOM from 'react-dom' import PropTypes from 'react-proptypes' import PureComponent from 'react.pure.component' import { connect } from 'react-redux' @@ -47,7 +48,7 @@ class CardDialog extends Component { } saveEdit = () => { - var newTitle = this.refs.titleInput.getValue() || this.props.card.title + var newTitle = ReactDOM.findDOMNode(this.refs.titleInput).value || this.props.card.title var newDescription = this.state.description || this.props.card.description this.saveCreatedLabels(newDescription) this.props.actions.editCard(this.props.card.id, newTitle, newDescription) diff --git a/src/app/components/timeline/cardView.js b/src/app/components/timeline/cardView.js index 812185353..14f3c98d6 100644 --- a/src/app/components/timeline/cardView.js +++ b/src/app/components/timeline/cardView.js @@ -1,4 +1,5 @@ import React, { Component } from 'react' +import ReactDOM from 'react-dom' import PropTypes from 'react-proptypes' import PureComponent from 'react.pure.component' import { connect } from 'react-redux' @@ -62,7 +63,7 @@ class CardView extends Component { } saveCreate = () => { - var newCard = this.buildCard(this.refs.titleInput.getValue()) + var newCard = this.buildCard(ReactDOM.findDOMNode(this.refs.titleInput).value) this.props.actions.addCard(newCard) this.setState({creating: false}) } diff --git a/src/app/components/timeline/lineView.js b/src/app/components/timeline/lineView.js index 4045a431d..e118ebbfc 100644 --- a/src/app/components/timeline/lineView.js +++ b/src/app/components/timeline/lineView.js @@ -1,5 +1,6 @@ import _ from 'lodash' import React, { Component } from 'react' +import ReactDOM from 'react-dom' import PropTypes from 'react-proptypes' import PureComponent from 'react.pure.component' import { connect } from 'react-redux' @@ -64,7 +65,7 @@ class LineView extends Component { editTitle = () => { var id = this.props.line.id - var newTitle = this.refs.titleInput.getValue() + var newTitle = ReactDOM.findDOMNode(this.refs.titleInput).value this.props.actions.editLineTitle(id, newTitle) this.setState({editing: false}) } diff --git a/src/app/components/timeline/sceneView.js b/src/app/components/timeline/sceneView.js index 9bca17a14..c2b617ff9 100644 --- a/src/app/components/timeline/sceneView.js +++ b/src/app/components/timeline/sceneView.js @@ -1,4 +1,5 @@ import React, { Component } from 'react' +import ReactDOM from 'react-dom' import PropTypes from 'react-proptypes' import PureComponent from 'react.pure.component' import { connect } from 'react-redux' @@ -17,7 +18,7 @@ class SceneView extends Component { editTitle = () => { var id = this.props.scene.id - var newTitle = this.refs.titleInput.getValue() + var newTitle = ReactDOM.findDOMNode(this.refs.titleInput).value this.props.actions.editSceneTitle(id, newTitle) this.setState({editing: false}) } diff --git a/src/app/containers/Navigation.js b/src/app/containers/Navigation.js index a927d6bc5..a166726c5 100644 --- a/src/app/containers/Navigation.js +++ b/src/app/containers/Navigation.js @@ -1,4 +1,5 @@ import React, { Component } from 'react' +import ReactDOM from 'react-dom' import PropTypes from 'react-proptypes' import { bindActionCreators } from 'redux' import { connect } from 'react-redux' @@ -80,7 +81,7 @@ class Navigation extends Component { } saveEdit = () => { - var newName = this.refs.storyNameInput.getValue() + var newName = ReactDOM.findDOMNode(this.refs.storyNameInput).value this.props.actions.changeStoryName(newName) this.setState({editing: false}) } diff --git a/src/app/index.js b/src/app/index.js index 48897846d..1a4ff819b 100644 --- a/src/app/index.js +++ b/src/app/index.js @@ -89,7 +89,7 @@ ipcRenderer.on('bought-in-app', (event, numOfDays) => { }) window.onerror = function (message, file, line, column, err) { - if (process.env.NODE_ENV !== 'dev') { + if (process.env.NODE_ENV !== 'development') { log.warn(err) rollbar.info(err) let newState = FileFixer(store.getState()) diff --git a/src/verify/VerifyView.js b/src/verify/VerifyView.js index 9bf7b924e..962e120b7 100644 --- a/src/verify/VerifyView.js +++ b/src/verify/VerifyView.js @@ -90,7 +90,7 @@ class VerifyView extends Component { handleVerify () { if (navigator.onLine) { - var input = ReactDOM.findDOMNode(this.refs.license).children[0] + var input = ReactDOM.findDOMNode(this.refs.license) var license = input.value.trim() if (license != '') { this.setState({spinnerHidden: false})