Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@annotation-studio/plugin-core

Package Overview
Dependencies
Maintainers
1
Versions
176
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@annotation-studio/plugin-core - npm Package Compare versions

Comparing version 1.0.0-next.dc218a5f to 1.0.0-next.de7bb2aa

26

es/core.js

@@ -11,3 +11,3 @@ var _class, _temp2;

import { connector } from '@annotation-studio/redux';
import { changeFingerprintSource, changeFingerprintIdentity, changeFingerPrintCreator } from '@annotation-studio/redux/es/actions/drafts';
import { isSavedDraft, changeFingerprintSource, changeFingerprintIdentity, changeFingerPrintCreator } from '@annotation-studio/redux/es/actions/drafts';
import { getAllAnnotationsFromCollection } from '@annotation-studio/redux/es/lib/elucidate/index';

@@ -39,3 +39,5 @@ import { asyncForEach } from './core.utils';

}, _this.warnUser = function (event) {
var drafts = _this.props.drafts;
var _this$props = _this.props,
drafts = _this$props.drafts,
disableCloseWarning = _this$props.disableCloseWarning;

@@ -45,3 +47,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.';;

@@ -112,12 +122,2 @@ event.preventDefault();

var isSavedDraft = function isSavedDraft(annotation) {
if (annotation.motivation !== 'http://www.digirati.com/ns/crowds#drafting') {
return false;
}
if (Array.isArray(annotation.body)) {
return false;
}
return annotation.body.purpose === 'editing';
};
// Set collection.

@@ -124,0 +124,0 @@ createCollection(subject, subject).then(function (c) {

@@ -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.';;

@@ -124,12 +134,2 @@ event.preventDefault();

var isSavedDraft = function isSavedDraft(annotation) {
if (annotation.motivation !== 'http://www.digirati.com/ns/crowds#drafting') {
return false;
}
if (Array.isArray(annotation.body)) {
return false;
}
return annotation.body.purpose === 'editing';
};
// Set collection.

@@ -140,3 +140,3 @@ createCollection(subject, subject).then(function (c) {

return (0, _core.asyncForEach)(iterable, function (i) {
if (isSavedDraft(i)) {
if ((0, _drafts.isSavedDraft)(i)) {
var draft = JSON.parse(i.body.value);

@@ -143,0 +143,0 @@ var identity = i.id.substr(i.id.length - 1) === '/' ? i.id.substr(0, i.id.length - 1).split('/').pop() : i.id.split('/').pop();

@@ -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.dc218a5f",
"version": "1.0.0-next.de7bb2aa",
"description": "Annotation studio core plugin",

@@ -13,3 +13,3 @@ "main": "lib/index.js",

"scripts": {
"watch": "./bin/watch",
"watch": "nwb-watch-module",
"build": "nwb build-web-module --copy-files",

@@ -20,15 +20,15 @@ "clean": "nwb clean-module",

"test:watch": "echo \"No tests in this package\"",
"prepublish": "npm run build"
"prepublish": "NODE_ENV=production npm run build"
},
"dependencies": {
"@annotation-studio/bridge": "^1.0.0-next.dc218a5f",
"@annotation-studio/redux": "^1.0.0-next.dc218a5f"
},
"peerDependencies": {
"moment": "*",
"react": "*",
"react-dom": "*",
"@annotation-studio/bridge": "^1.0.0-rc.14",
"@annotation-studio/redux": "^1.0.0-rc.14",
"moment": "^2.20.1",
"react": "^15.6.2",
"react-dom": "^15.6.2",
"react-redux": "*"
},
"devDependencies": {
"@annotation-studio/bridge": "^1.0.0-next.de7bb2aa",
"@annotation-studio/redux": "^1.0.0-next.de7bb2aa",
"babel-cli": "^6.24.1",

@@ -42,4 +42,5 @@ "babel-plugin-transform-flow-strip-types": "^6.22.0",

"nwb": "^0.21.5",
"react": "*",
"react-dom": "*",
"nwb-watch": "^1.0.0-next.de7bb2aa",
"react": "^15.6.2",
"react-dom": "^15.6.2",
"react-redux": "*"

@@ -46,0 +47,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc