diff --git a/.eslintignore b/.eslintignore index 27df261cb..3b0e7bd19 100644 --- a/.eslintignore +++ b/.eslintignore @@ -151,7 +151,8 @@ ReactNativeClient/lib/services/keychain/KeychainServiceDriver.dummy.js ReactNativeClient/lib/services/keychain/KeychainServiceDriver.mobile.js ReactNativeClient/lib/services/keychain/KeychainServiceDriver.node.js ReactNativeClient/lib/services/keychain/KeychainServiceDriverBase.js -ReactNativeClient/lib/services/ResourceEditWatcher.js +ReactNativeClient/lib/services/ResourceEditWatcher/index.js +ReactNativeClient/lib/services/ResourceEditWatcher/reducer.js ReactNativeClient/lib/services/rest/actionApi.desktop.js ReactNativeClient/lib/services/rest/errors.js ReactNativeClient/lib/services/SettingUtils.js diff --git a/.gitignore b/.gitignore index 48a7faad3..857c3577f 100644 --- a/.gitignore +++ b/.gitignore @@ -142,7 +142,8 @@ ReactNativeClient/lib/services/keychain/KeychainServiceDriver.dummy.js ReactNativeClient/lib/services/keychain/KeychainServiceDriver.mobile.js ReactNativeClient/lib/services/keychain/KeychainServiceDriver.node.js ReactNativeClient/lib/services/keychain/KeychainServiceDriverBase.js -ReactNativeClient/lib/services/ResourceEditWatcher.js +ReactNativeClient/lib/services/ResourceEditWatcher/index.js +ReactNativeClient/lib/services/ResourceEditWatcher/reducer.js ReactNativeClient/lib/services/rest/actionApi.desktop.js ReactNativeClient/lib/services/rest/errors.js ReactNativeClient/lib/services/SettingUtils.js diff --git a/ElectronClient/app.js b/ElectronClient/app.js index 0da27feab..920c7ff13 100644 --- a/ElectronClient/app.js +++ b/ElectronClient/app.js @@ -21,7 +21,7 @@ const InteropServiceHelper = require('./InteropServiceHelper.js'); const ResourceService = require('lib/services/ResourceService'); const ClipperServer = require('lib/ClipperServer'); const ExternalEditWatcher = require('lib/services/ExternalEditWatcher'); -const ResourceEditWatcher = require('lib/services/ResourceEditWatcher').default; +const ResourceEditWatcher = require('lib/services/ResourceEditWatcher/index').default; const { bridge } = require('electron').remote.require('./bridge'); const { shell, webFrame, clipboard } = require('electron'); const Menu = bridge().Menu; @@ -1265,7 +1265,7 @@ class Application extends BaseApplication { ExternalEditWatcher.instance().setLogger(reg.logger()); ExternalEditWatcher.instance().dispatch = this.store().dispatch; - ResourceEditWatcher.instance().initialize(reg.logger(), this.store().dispatch); + ResourceEditWatcher.instance().initialize(reg.logger(), (action) => { console.info('ACTION', action); this.store().dispatch(action); }); RevisionService.instance().runInBackground(); diff --git a/ElectronClient/gui/NoteEditor/NoteEditor.tsx b/ElectronClient/gui/NoteEditor/NoteEditor.tsx index 23e3fe1d5..6262e00d7 100644 --- a/ElectronClient/gui/NoteEditor/NoteEditor.tsx +++ b/ElectronClient/gui/NoteEditor/NoteEditor.tsx @@ -17,7 +17,7 @@ import useMarkupToHtml from './utils/useMarkupToHtml'; import useFormNote, { OnLoadEvent } from './utils/useFormNote'; import styles_ from './styles'; import { NoteEditorProps, FormNote, ScrollOptions, ScrollOptionTypes, OnChangeEvent, NoteBodyEditorProps } from './utils/types'; -import ResourceEditWatcher from '../../lib/services/ResourceEditWatcher'; +import ResourceEditWatcher from '../../lib/services/ResourceEditWatcher/index'; import CommandService from '../../lib/services/CommandService'; const { themeStyle } = require('lib/theme'); @@ -480,6 +480,17 @@ function NoteEditor(props: NoteEditorProps) { ); } + function renderResourceWatchingNotification() { + if (!Object.keys(props.watchedResources).length) return null; + const resourceTitles = Object.keys(props.watchedResources).map(id => props.watchedResources[id].title); + return ( +
{_('The following attachments are being watched for changes:')} {resourceTitles.join(', ')}
+{_('The attachments will no longer be watched when you switch to a different note.')}
+