@annotation-studio/plugin-core
Advanced tools
Comparing version 1.0.0-next.e33871a7 to 1.0.0-next.f614ef8b
@@ -38,3 +38,5 @@ var _class, _temp2; | ||
}, _this.warnUser = function (event) { | ||
var drafts = _this.props.drafts; | ||
var _this$props = _this.props, | ||
drafts = _this$props.drafts, | ||
disableCloseWarning = _this$props.disableCloseWarning; | ||
@@ -44,3 +46,11 @@ var changes = drafts ? Object.values(drafts).filter(function (draft) { | ||
}) : []; | ||
if (changes.length) { | ||
var changedValues = Object.values(drafts).map(function (draft) { | ||
return Object.values(draft.input).filter(function (e) { | ||
return e; | ||
}); | ||
}).filter(function (e) { | ||
return e.length; | ||
}); | ||
if (changes.length && changedValues.length && disableCloseWarning === false) { | ||
var message = 'You have ' + changes + ' unsaved annotation' + (changes.length > 1 ? 's' : null) + ', if you leave the page they will be lost.';; | ||
@@ -47,0 +57,0 @@ event.preventDefault(); |
@@ -17,4 +17,5 @@ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
elucidateServer = _ref.elucidateServer, | ||
disableCloseWarning = _ref.disableCloseWarning, | ||
locale = _ref.locale, | ||
unknownProps = _objectWithoutProperties(_ref, ['manifest', 'canvas', 'elucidateServer', 'locale']); | ||
unknownProps = _objectWithoutProperties(_ref, ['manifest', 'canvas', 'elucidateServer', 'disableCloseWarning', 'locale']); | ||
@@ -27,2 +28,3 @@ unknownPropertyWarning(unknownProps); | ||
var savedDraftList = localstorage.get('annotation-studio/' + url) || {}; | ||
var disableCloseWarningBoolean = disableCloseWarning ? disableCloseWarning === 'true' : false; | ||
@@ -33,2 +35,3 @@ var store = createStore(reducers, [], locale); | ||
manifest: manifest, | ||
disableCloseWarning: disableCloseWarningBoolean, | ||
savedDraftList: savedDraftList, | ||
@@ -35,0 +38,0 @@ elucidateServer: elucidateServer, |
@@ -51,3 +51,5 @@ 'use strict'; | ||
}, _this.warnUser = function (event) { | ||
var drafts = _this.props.drafts; | ||
var _this$props = _this.props, | ||
drafts = _this$props.drafts, | ||
disableCloseWarning = _this$props.disableCloseWarning; | ||
@@ -57,3 +59,11 @@ var changes = drafts ? Object.values(drafts).filter(function (draft) { | ||
}) : []; | ||
if (changes.length) { | ||
var changedValues = Object.values(drafts).map(function (draft) { | ||
return Object.values(draft.input).filter(function (e) { | ||
return e; | ||
}); | ||
}).filter(function (e) { | ||
return e.length; | ||
}); | ||
if (changes.length && changedValues.length && disableCloseWarning === false) { | ||
var message = 'You have ' + changes + ' unsaved annotation' + (changes.length > 1 ? 's' : null) + ', if you leave the page they will be lost.';; | ||
@@ -60,0 +70,0 @@ event.preventDefault(); |
@@ -38,4 +38,5 @@ 'use strict'; | ||
elucidateServer = _ref.elucidateServer, | ||
disableCloseWarning = _ref.disableCloseWarning, | ||
locale = _ref.locale, | ||
unknownProps = _objectWithoutProperties(_ref, ['manifest', 'canvas', 'elucidateServer', 'locale']); | ||
unknownProps = _objectWithoutProperties(_ref, ['manifest', 'canvas', 'elucidateServer', 'disableCloseWarning', 'locale']); | ||
@@ -48,2 +49,3 @@ (0, _core.unknownPropertyWarning)(unknownProps); | ||
var savedDraftList = _store2.default.get('annotation-studio/' + url) || {}; | ||
var disableCloseWarningBoolean = disableCloseWarning ? disableCloseWarning === 'true' : false; | ||
@@ -54,2 +56,3 @@ var store = (0, _redux.createStore)(_redux.reducers, [], locale); | ||
manifest: manifest, | ||
disableCloseWarning: disableCloseWarningBoolean, | ||
savedDraftList: savedDraftList, | ||
@@ -56,0 +59,0 @@ elucidateServer: elucidateServer, |
{ | ||
"name": "@annotation-studio/plugin-core", | ||
"version": "1.0.0-next.e33871a7", | ||
"version": "1.0.0-next.f614ef8b", | ||
"description": "Annotation studio core plugin", | ||
@@ -21,7 +21,5 @@ "main": "lib/index.js", | ||
}, | ||
"dependencies": { | ||
"@annotation-studio/bridge": "^1.0.0-next.e33871a7", | ||
"@annotation-studio/redux": "^1.0.0-next.e33871a7" | ||
}, | ||
"peerDependencies": { | ||
"@annotation-studio/bridge": "^1.0.0-rc.13", | ||
"@annotation-studio/redux": "^1.0.0-rc.13", | ||
"moment": "*", | ||
@@ -33,2 +31,4 @@ "react": "*", | ||
"devDependencies": { | ||
"@annotation-studio/bridge": "^1.0.0-next.f614ef8b", | ||
"@annotation-studio/redux": "^1.0.0-next.f614ef8b", | ||
"babel-cli": "^6.24.1", | ||
@@ -35,0 +35,0 @@ "babel-plugin-transform-flow-strip-types": "^6.22.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36018
754
13