Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance no entities spike #226

Open
wants to merge 55 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
e8cae83
Merge pull request #2 from bbc/master
pietrop Oct 2, 2019
9a0d3db
Merge pull request #4 from bbc/master
pietrop Oct 7, 2019
2d771e9
Merge pull request #5 from bbc/master
pietrop Oct 7, 2019
8bfd069
rename repo @pietrop/ and published to npm
Jan 29, 2020
08f0ab3
added speaker batch change
Feb 21, 2020
759d6c4
Merge pull request #10 from pietrop/adding-speaker-batch-change
pietrop Feb 21, 2020
35a1dd9
how does it work fixed colour:
Feb 21, 2020
fbbe6f2
1.3.2
Feb 21, 2020
50da859
1.3.3
Feb 21, 2020
ae20053
1.3.4
Feb 21, 2020
aea2432
updated README to signal that analytics are not optional for keyboard…
Feb 21, 2020
e78696c
Remove uncessary comment
Mar 12, 2020
d974cfe
commented out auto save and entities-mto reduce some of the convertFr…
Mar 12, 2020
e9f62fc
saving progress
Mar 12, 2020
422932d
commentign out local storage for troubleshooting in demo
Mar 12, 2020
92c8416
made auto save in demo app to local storage optional
Mar 12, 2020
77ca865
Merge pull request #12 from pietrop/master
pietrop Mar 12, 2020
422391e
saving progress
Mar 13, 2020
bc0018c
remove entitines from stt align
Mar 13, 2020
09153fb
saving progress
Mar 13, 2020
8bdb216
Added paragraph level highlight
Mar 13, 2020
fed4bd2
Saved local storage
Mar 13, 2020
4ebda51
clean up
Mar 13, 2020
7234a3b
brought back timecodes at speaker level
Mar 13, 2020
b0cc657
Removed forced re-render
Mar 13, 2020
37dcb1a
generall fixes and clean up
Mar 13, 2020
6dec5cb
added FB 5h demo
Mar 16, 2020
6e62def
error handling local storage
Mar 16, 2020
14d6397
added a 2 hour example + various twwaks
Mar 16, 2020
2925925
show timecodes and speaker labels
Mar 16, 2020
08a46e5
exporting also save states-mexporting does an align before exporting,…
Mar 16, 2020
48294fc
Update packages/components/media-player/index.js
pietrop Mar 16, 2020
2ab3ee5
Update packages/components/media-player/index.js
pietrop Mar 16, 2020
e1d7b1d
Update packages/components/media-player/src/PlayerControls/index.js
pietrop Mar 16, 2020
be00506
Update packages/components/timed-text-editor/CustomEditor.js
pietrop Mar 16, 2020
f5244f5
Update packages/components/timed-text-editor/UpdateTimestamps/index.js
pietrop Mar 16, 2020
56d7477
Update packages/components/transcript-editor/index.js
pietrop Mar 16, 2020
106aee9
Update packages/components/transcript-editor/index.js
pietrop Mar 16, 2020
36688f0
Update packages/components/transcript-editor/index.js
pietrop Mar 16, 2020
2565010
Update packages/components/timed-text-editor/WrapperBlock.module.css
pietrop Mar 16, 2020
467f52b
Update packages/components/timed-text-editor/WrapperBlock.js
pietrop Mar 16, 2020
1835134
Update packages/components/timed-text-editor/WrapperBlock.js
pietrop Mar 16, 2020
76e807b
Merge branch 'performance-no-entities-spike' of github.com:pietrop/re…
Mar 16, 2020
e04e408
Renamed getWordsBeforeParagraphBlock
Mar 16, 2020
7c94716
requestIdleCallback
Mar 17, 2020
8abbaac
handle flag to make auto save optional
Mar 17, 2020
77bab6a
Removed unecessary console.log
Mar 17, 2020
5ce77c6
fixed css on firefox
Mar 17, 2020
8f78ee1
resmoved chat count nonsense
Mar 17, 2020
066b777
Removed unecessary console.log
Mar 17, 2020
dbfa68a
Refactored and re introduced scroll sync
Mar 17, 2020
2d9079c
fixed scrollsync paragraph level
Mar 17, 2020
d05876f
fixing Media component in storybook
Apr 23, 2020
cf8a9f7
added support for zero seconds
Apr 23, 2020
b1d66df
removing space in product name to see if it fixes with app cleaner no…
Apr 24, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**Is your Pull Request request related to another [issue](https://github.com/bbc/react-transcript-editor/issues) in this repository ?**
**Is your Pull Request request related to another issue in this repository ?**
<!-- _If so please link to other issues and PRs as appropriate_ -->

**Describe what the PR does**
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ By submitting code as an individual or as an entity you agree that your code is

## Pull requests and branching

1. [Feel free to start by raising an issue](https://github.com/bbc/react-transcript-editor/issues/new?template=feature_request.md) so that others can be aware of areas where there is active development, and if needed we can synchronies the effort.
1. [Feel free to start by raising an issue](https://github.com/pietrop/react-transcript-editor/issues/new?template=feature_request.md) so that others can be aware of areas where there is active development, and if needed we can synchronies the effort.

2. [Fork the repo](https://help.github.com/articles/fork-a-repo/)

3. Before working on a feature **always** create a new branch first. Createa a branch with a meaningful name.
4. Branches should be short lived - consider doing multiple PR breaking down functionalities as opposed to one big change.
5. If you've added code that should be tested, add tests, if you need help with automated testing, feel free to raise an [issue](https://github.com/bbc/react-transcript-editor/issues/new?template=feature_request.md).
5. If you've added code that should be tested, add tests, if you need help with automated testing, feel free to raise an [issue](https://github.com/pietrop/react-transcript-editor/issues/new?template=feature_request.md).
6. Ensure the test suite passes.
7. Make sure your code lints.
8. If you've changed APIs, consider [updating the documentation](https://github.com/bbc/react-transcript-editor#documentation) and QA Testing docs.
8. If you've changed APIs, consider [updating the documentation](https://github.com/pietrop/react-transcript-editor#documentation) and QA Testing docs.
9. Once the work is complete push the branch up on to GitHub for review. Make sure your branch is up to date with `master` before making a pull request. eg use [`git merge origin/master`](https://git-scm.com/docs/git-merge) or [rebase](https://git-scm.com/book/en/v2/Git-Branching-Rebasing)
10. Once a branch has been merged into `master`, delete it.

Expand All @@ -39,7 +39,7 @@ See [this blog post for more on this](https://medium.com/mindorks/how-to-write-c
- [ ] Ensure test suite passes (`npm run test`)
- [ ] Make sure your code lints. (`npm run lint`)
- [ ] consider re-factoring for code quality and readability
- [ ] Update documentation and QA docs where appropriate - [see updating the documentation](https://github.com/bbc/react-transcript-editor#documentation)
- [ ] Update documentation and QA docs where appropriate - [see updating the documentation](https://github.com/pietrop/react-transcript-editor#documentation)
- [ ] Setup your PR for review

<!--
Expand Down
58 changes: 37 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

A React component to make transcribing audio and video easier and faster.

[![install size](https://packagephobia.now.sh/badge?p=@bbc/react-transcript-editor)](https://packagephobia.now.sh/result?p=@bbc/react-transcript-editor)
<!-- [![install size](https://packagephobia.now.sh/badge?p=@bbc/react-transcript-editor)](https://packagephobia.now.sh/result?p=@bbc/react-transcript-editor) -->

<!-- The project uses [this github project boards to organise and the co-ordinate development](https://github.com/bbc/react-transcript-editor/projects). -->

The project uses [this github project boards to organise and the co-ordinate development](https://github.com/bbc/react-transcript-editor/projects).

_--> Work in progress <--_

<!-- _Screenshot of UI - optional_ -->

- [You can see a demo by clicking here](https://bbc.github.io/react-transcript-editor/iframe.html?id=demo--default) (and then click the `load demo` button)
- [You can see a demo by clicking here](https://pietrop.github.io/react-transcript-editor/iframe.html?id=demo--default) (and then click the `load demo` button)
- [And you can see a list of features here](./docs/features-list.md).

## Development env
Expand Down Expand Up @@ -49,14 +50,14 @@ Visit [http://localhost:6006](http://localhost:6006)

## Usage - production

Available on [npm - `@bbc/react-transcript-editor`](https://www.npmjs.com/package/@bbc/react-transcript-editor)
Available on [npm - `@pietrop/react-transcript-editor`](https://www.npmjs.com/package/@pietrop/react-transcript-editor)

```
npm install @bbc/react-transcript-editor
npm install @pietrop/react-transcript-editor
```

```js
import TranscriptEditor from "@bbc/react-transcript-editor";
import TranscriptEditor from "@pietrop/react-transcript-editor";
```

Minimal data needed for initialization
Expand All @@ -77,7 +78,7 @@ With more attributes
autoSaveContentType={'digitalpaperedit'}
isEditable={true}
spellCheck={false}
sttJsonType={"bbckaldi"}
sttJsonType={"pietropkaldi"}
handleAnalyticsEvents={this.handleAnalyticsEvents}
fileName={"ted-talk.mp4"}
title={"Ted Talk"}
Expand All @@ -91,28 +92,43 @@ With more attributes
| transcriptData | Transcript json | yes | Json |
| mediaUrl | string url to media file - audio or video | yes | String |
|`handleAutoSaveChanges`| returns content of transcription after a change | no | Function |
| isAutoSave | default to true, enable the auto save callback `handleAutoSaveChanges` | no | Boolean |
| autoSaveContentType | specify the file format for data returned by `handleAutoSaveChanges`,falls back on `sttJsonType`. or `draftjs` | no | string |
| isEditable | set to true if you want to be able to edit the text | no | Boolean |
| spellCheck | set to true if you want the browser to spell check this transcript | no | Boolean |
|`handleAnalyticsEvents`| if you want to collect analytics events. | no | Function |
| showTimecodes | set to true if you want to show timecodes in the transcript at paragraph level | no | Boolean |
| showSpeakers | set to true if you want to show speaker labels in the transcript at paragraph level | no | Boolean |
|`handleAnalyticsEvents`| if you want to collect analytics events. | yes | Function |
| fileName | used for saving and retrieving local storage blob files | no | String |
| title | defaults to empty string | no | String |
| ref | if you want to have access to internal functions such as retrieving content from the editor. eg to save to a server/db. | no | React ref |
| mediaType | can be `audio` or `video`, if not provided the component uses the url file type to determine and adjust use of the page layout | no | String |



See [`./demo/app.js` demo](./demo/app.js) as a more detailed example usage of the component.

_Note: `fileName` it is optional but it's needed if working with user uploaded local media in the browser, to be able to save and retrieve from local storage. For instance if you are passing a blob url to `mediaUrl` using `createObjectURL` this url is randomly re-generated on every page refresh so you wouldn't be able to restore a session, as `mediaUrl` is used as the local storage key. See demo app for more detail example of this[`./src/index.js`](./src/index.js)_

_Note: `mediaType` if not defined, the component uses the url to determine the type and adjust the layout accordingly, however this could result in a slight delay when loading the component as it needs to fetch the media to determine it's file type_

_Note: in current version you need to add `handleAnalyticsEvents` function to be able to use keyboard shortcuts. But you can also just add a placeholder function if you don't wish to implement analytics_

```js
<TranscriptEditor
transcriptData={someJsonFile}
mediaUrl={"https://download.ted.com/talks/KateDarling_2018S-950k.mp4"}
...
handleAnalyticsEvents = {()=>{console.log('handleAnalyticsEvents')}}
/>
```
### Typescript projects

If using in a parent project where [typescript](https://www.typescriptlang.org/) is being used you might need to add `//@ts-ignore` before the import statment like this

```js
//@ts-ignore
import { TranscriptEditor } from "@bbc/react-transcript-editor";
import { TranscriptEditor } from "@pietrop/react-transcript-editor";
```

#### Internal components
Expand All @@ -135,27 +151,27 @@ You can also import some of the underlying React components directly.
To import the components you can do as follows

```js
import TimedTextEditor from "@bbc/react-transcript-editor/TimedTextEditor";
import TimedTextEditor from "@pietrop/react-transcript-editor/TimedTextEditor";
```

```js
import { TimedTextEditor } from "@bbc/react-transcript-editor";
import { TimedTextEditor } from "@pietrop/react-transcript-editor";
```

However if you are not using `TranscriptEditor` it is recommended to follow the second option and import individual components like: `@bbc/react-transcript-editor/TimedTextEditor` rather than the entire library. Doing so pulls in only the specific components that you use, which can significantly reduce the amount of code you end up sending to the client. (Similarly to how [`react-bootstrap`](https://react-bootstrap.github.io/getting-started/introduction) works)
However if you are not using `TranscriptEditor` it is recommended to follow the second option and import individual components like: `@pietrop/react-transcript-editor/TimedTextEditor` rather than the entire library. Doing so pulls in only the specific components that you use, which can significantly reduce the amount of code you end up sending to the client. (Similarly to how [`react-bootstrap`](https://react-bootstrap.github.io/getting-started/introduction) works)

See [the storybook](https://bbc.github.io/react-transcript-editor) for each component details on optional and required attributes.
See [the storybook](https://pietrop.github.io/react-transcript-editor) for each component details on optional and required attributes.

You can also use this node modules as standalone

```js
import exportAdapter from "@bbc/react-transcript-editor/exportAdapter";
import exportAdapter from "@pietrop/react-transcript-editor/exportAdapter";
```

Converts from draftJs json format to other formats

```js
import sttJsonAdapter from "@bbc/react-transcript-editor/sttJsonAdapter";
import sttJsonAdapter from "@pietrop/react-transcript-editor/sttJsonAdapter";
```

Converts various stt json formats to draftJs
Expand All @@ -165,7 +181,7 @@ import {
secondsToTimecode,
timecodeToSeconds,
shortTimecode
} from "@bbc/react-transcript-editor/timecodeConverter";
} from "@pietrop/react-transcript-editor/timecodeConverter";
```

some modules to convert to and from timecodes
Expand Down Expand Up @@ -208,9 +224,9 @@ npm run build:component

## Demo & storybook

- **Storybook** can bew viewed at [https://bbc.github.io/react-transcript-editor/](https://bbc.github.io/react-transcript-editor/)
- **Storybook** can bew viewed at [https://pietrop.github.io/react-transcript-editor/](https://pietrop.github.io/react-transcript-editor/)

- **Demo** can be viewed at [https://bbc.github.io/react-transcript-editor/iframe.html?id=demo--default](https://bbc.github.io/react-transcript-editor/iframe.html?id=demo--default)
- **Demo** can be viewed at [https://pietrop.github.io/react-transcript-editor/iframe.html?id=demo--default](https://pietrop.github.io/react-transcript-editor/iframe.html?id=demo--default)

http://localhost:6006

Expand Down Expand Up @@ -267,13 +283,13 @@ npm run test:watch

## Travis CI

On commit this repo uses the [.travis.yml](./.travis.yml) config tu run the automated test on [travis CI](https://travis-ci.org/bbc/react-transcript-editor).
On commit this repo uses the [.travis.yml](./.travis.yml) config tu run the automated test on [travis CI](https://travis-ci.org/pietrop/react-transcript-editor).

## Deployment

<!-- _How to deploy the code/app into test/staging/production_ -->

To push to [npm - `@bbc/react-transcript-editor`](https://www.npmjs.com/package/@bbc/react-transcript-editor)
To push to [npm - `@pietrop/react-transcript-editor`](https://www.npmjs.com/package/@pietrop/react-transcript-editor)

```
npm publish:public
Expand All @@ -295,4 +311,4 @@ See [LICENCE](./LICENCE.md)

## Legal Disclaimer

_Despite using React and DraftJs, the BBC is not promoting any Facebook products or other commercial interest._
_Despite using React and DraftJs, the pietrop is not promoting any Facebook products or other commercial interest._
Loading