diff --git a/babel.config.js b/babel.config.js index 71e3e16ee133e18ccca49b8f41da25143ffc0c8f..982d91dfd242e84dc6d63343bb19126b68f525e8 100644 --- a/babel.config.js +++ b/babel.config.js @@ -47,44 +47,20 @@ module.exports = function (api) { const plugins = [ 'babel-plugin-macros', '@babel/plugin-transform-destructuring', - [ - '@babel/plugin-proposal-class-properties', - { - loose: true, - }, - ], - [ - '@babel/plugin-proposal-object-rest-spread', - { - useBuiltIns: true, - }, - ], - [ - '@babel/plugin-transform-runtime', - { - corejs: false, - helpers: false, // Needed to support IE/Edge - regenerator: true, - }, - ], - [ - '@babel/plugin-transform-regenerator', - { - async: false, - }, - ], - ['transform-react-remove-prop-types', - { - ignoreFilenames: ['node_modules'], - removeImport: true, - }, - ], - ['lodash', { - id: [ - 'lodash', - ], + // TODO loose: which options is ignored in depencies ? + ['@babel/plugin-proposal-private-methods', { loose: true }], + ['@babel/plugin-proposal-private-property-in-object', { loose: true }], + ['@babel/plugin-proposal-class-properties', { loose: true }], + ['@babel/plugin-proposal-object-rest-spread', { useBuiltIns: true }], + ['@babel/plugin-transform-runtime', { + corejs: false, + helpers: false, // Needed to support IE/Edge + regenerator: true, }, ], + ['@babel/plugin-transform-regenerator', { async: false }], + ['transform-react-remove-prop-types', { ignoreFilenames: ['node_modules'], removeImport: true }], + ['lodash', { id: ['lodash'] }], ].filter(Boolean); return { diff --git a/package.json b/package.json index b3c552136c271c16cd7dcc5653c084cd47bb3180..c7c58347a178b8a7426493c8f1d2ef912d82b466 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,6 @@ ], "sideEffects": false, "scripts": { - "prepare": "npm run clean && npm run build:es && npm run build:cjs", "clean": "rm -rf ./dist", "lint": "node_modules/.bin/eslint ./ && npm run lint:translations && npm run lint:containers", "lint:containers": "node ./scripts/container-lint.js", diff --git a/src/components/VideoViewer.js b/src/components/VideoViewer.js index d13ebbdafd40db0370f8fd8b840960ce6e03cdaf..6dd39e8be039efda095846e22dc77d4dd44b9125 100644 --- a/src/components/VideoViewer.js +++ b/src/components/VideoViewer.js @@ -5,6 +5,7 @@ import PropTypes from 'prop-types'; import AnnotationItem from '../lib/AnnotationItem'; import AnnotationsOverlayVideo from '../containers/AnnotationsOverlayVideo'; import WindowCanvasNavigationControlsVideo from '../containers/WindowCanvasNavigationControlsVideo'; +import { VideoViewersReferences } from '../plugins/VideoViewersReferences'; /** */ export class VideoViewer extends Component { @@ -12,6 +13,8 @@ export class VideoViewer extends Component { constructor(props) { super(props); this.videoRef = React.createRef(); + this.apiRef = React.createRef(); + VideoViewersReferences.set(props.windowId, this); this.state = { start: 0, @@ -156,7 +159,7 @@ export class VideoViewer extends Component { }; } return ( - <div className={classes.flexContainer}> + <div className={classes.flexContainer} ref={this.apiRef}> <div className={classes.flexFill}> { video && ( <> diff --git a/src/lib/AnnotationItem.js b/src/lib/AnnotationItem.js index d927ec07189fd880381d806ec074370cad70a6fe..0d5fcae8df046ee4ce360277a9d8e6356709b3c6 100644 --- a/src/lib/AnnotationItem.js +++ b/src/lib/AnnotationItem.js @@ -138,6 +138,7 @@ export default class AnnotationItem { break; case 'object': temporalfragmentSelector = selector.find(s => s.type && s.type === 'FragmentSelector'); + // TODO regex for t=5,10 t=,10 t=5 ? cf w3c media fragments match = temporalfragmentSelector && temporalfragmentSelector.value.match(/t=(.*?)(&|$)/); break; default: diff --git a/src/plugins/VideoViewersReferences.js b/src/plugins/VideoViewersReferences.js new file mode 100644 index 0000000000000000000000000000000000000000..1d6c0cf3a33440898a6cf8a699f39c14a30839b7 --- /dev/null +++ b/src/plugins/VideoViewersReferences.js @@ -0,0 +1,11 @@ +export const VideoViewersReferences = { + /** */ + get(windowId) { + return this.refs[windowId]; + }, + refs: {}, + /** */ + set(windowId, ref) { + this.refs[windowId] = ref; + }, +};