New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@recogito/recogito-client-core

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@recogito/recogito-client-core - npm Package Compare versions

Comparing version 0.2.6 to 0.3.0

2

package.json
{
"name": "@recogito/recogito-client-core",
"version": "0.2.6",
"version": "0.3.0",
"description": "Core functions, classes and components for RecogitoJS",

@@ -5,0 +5,0 @@ "main": "src/index.js",

# recogito-client-core
Core functions, classes and components for [RecogitoJS](https://github.com/recogito/recogito-js) and
[Annotorious](https://github.com/recogito/annotorious).
Core functions, classes and components for [RecogitoJS](https://github.com/recogito/recogito-js),
[Annotorious](https://github.com/recogito/annotorious) and [Annotorious OpenSeadragon](https://github.com/recogito/annotorious-openseadragon).
## Installing
To install `npm install @recogito/recogito-client-core`
Use `npm install @recogito/recogito-client-core`
## Contributing UI Translations
## Using
If you want to contribute UI translations to Annotorious or RecogitoJS, you've come to the right place.
In [this folder](https://github.com/recogito/recogito-client-core/tree/master/src/i18n)
you will find `messages` files, one file for each available translation.
For developer information and API Reference please
[visit the Wiki](https://github.com/recogito/recogito-client-core/wiki).
Each `messages` file is a dictionary of the default English labels and their translations. For example,
here's what the German translation file `messages_de.json` looks like.
```json
{
"Add a comment...": "Kommentar schreiben...",
"Add a reply...": "Antwort schreiben...",
"Add tag...": "Tag...",
"Cancel": "Abbrechen",
"Close": "Schliessen",
"Edit": "Bearbeiten",
"Delete": "Löschen",
"Ok": "Ok"
}
```
### To add a new translation
- Fork the this repository
- Add a message file to the [src/i18n folder](https://github.com/recogito/recogito-client-core/tree/master/src/i18n)
named `messages_{iso}.json`, where {iso} is the 2-character ISO code of the language.
- Copy the dictionary above, and replace the translations accordingly.
- [Send us a pull request](https://www.freecodecamp.org/news/how-to-make-your-first-pull-request-on-github-3/)
Many thanks in advance! If you have questions, do get in touch via the [Annotorious](https://gitter.im/recogito/annotorious) or
[RecogitoJS](https://gitter.im/recogito/recogito-js) chat on Gitter.

@@ -28,30 +28,8 @@ import React from 'preact/compat';

// Re-render: set derived annotation state & position the editor
// Set derived annotation state
useEffect(() =>
setCurrentAnnotation(props.annotation), [ props.annotation ]);
// Change editor position if element has moved
useEffect(() => {
// Shorthand: user wants a template applied and this is a selection
const shouldApplyTemplate = props.applyTemplate && props.annotation?.isSelection;
// Apply template if needed
const annotation = shouldApplyTemplate ?
props.annotation.clone({ body: [ ...props.applyTemplate ]}) :
props.annotation;
// The 'currentAnnotation' differs from props.annotation because
// the user has been editing. Moving the selection bounds will
// trigger the re-render effect, but we don't want to update the currentAnnotation
// on move. Therefore, don't update if a) props.annotation equals
// the currentAnnotation, or props.annotation and currentAnnotations are
// a selection, just created by the user.
const preventUpdate =
currentAnnotation && ( // Always update if there is no current annotation
(currentAnnotation.isSelection && annotation.isSelection) || // Don't update selection
(currentAnnotation.id === annotation.id) // Don't update if annotation ID is the same
)
if (!preventUpdate)
setCurrentAnnotation(annotation);
if (shouldApplyTemplate && props.applyImmediately)
props.onAnnotationCreated(annotation.toAnnotation());
if (element.current) {

@@ -61,3 +39,3 @@ // Note that ResizeObserver fires once when observation starts

}
}, [ props.annotation, props.selectedElement, bounds(props.selectedElement) ]);
}, [ bounds(props.selectedElement) ]);

@@ -64,0 +42,0 @@ const initResizeObserver = () => {

@@ -18,4 +18,2 @@ import React, { Component } from 'preact/compat';

selectedRelation: null,
applyTemplate: null,
headless: false

@@ -259,5 +257,2 @@ }

applyTemplate = (bodies, headless) =>
this.setState({ applyTemplate: bodies, headless })
render() {

@@ -273,3 +268,2 @@ return (

env={this.props.env}
applyTemplate={this.state.applyTemplate}
onAnnotationCreated={this.onCreateOrUpdateAnnotation('onAnnotationCreated')}

@@ -276,0 +270,0 @@ onAnnotationUpdated={this.onCreateOrUpdateAnnotation('onAnnotationUpdated')}

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