-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
191 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// ==LICENSE-BEGIN== | ||
// Copyright 2017 European Digital Reading Lab. All rights reserved. | ||
// Licensed to the Readium Foundation under one or more contributor license agreements. | ||
// Use of this source code is governed by a BSD-style license | ||
// that can be found in the LICENSE file exposed on Github (readium) in the project repository. | ||
// ==LICENSE-END== | ||
|
||
import { IHighlightDefinition } from "@r2-navigator-js/electron/common/highlight"; | ||
import { TPQueueState } from "readium-desktop/utils/redux-reducers/pqueue.reducer"; | ||
|
||
export type TAnnotationState = TPQueueState<number, IAnnotationState>; | ||
|
||
export interface IAnnotationState { | ||
uuid: string; | ||
name: string; // like bookmark name | ||
comment: string; // describe annotation mark | ||
hash: string; // sha256 ( base64 ( {href, def} )) | ||
href: string; // from IHighlightHandlerState | ||
def: IHighlightDefinition; // from IHighlightHandlerState | ||
} | ||
|
||
export type IAnnotationStateWithoutUUID = Partial<Pick<IAnnotationState, "uuid">> & Pick<IAnnotationState, "name" | "comment" | "def" | "hash" | "href">; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// ==LICENSE-BEGIN== | ||
// Copyright 2017 European Digital Reading Lab. All rights reserved. | ||
// Licensed to the Readium Foundation under one or more contributor license agreements. | ||
// Use of this source code is governed by a BSD-style license | ||
// that can be found in the LICENSE file exposed on Github (readium) in the project repository. | ||
// ==LICENSE-END== | ||
|
||
import * as pop from "./pop"; | ||
import * as push from "./push"; | ||
import * as update from "./update"; | ||
|
||
export { | ||
push, | ||
pop, | ||
update, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// ==LICENSE-BEGIN== | ||
// Copyright 2017 European Digital Reading Lab. All rights reserved. | ||
// Licensed to the Readium Foundation under one or more contributor license agreements. | ||
// Use of this source code is governed by a BSD-style license | ||
// that can be found in the LICENSE file exposed on Github (readium) in the project repository. | ||
// ==LICENSE-END== | ||
|
||
import { Action } from "readium-desktop/common/models/redux"; | ||
import { IAnnotationState } from "readium-desktop/common/redux/states/annotation"; | ||
|
||
export const ID = "READER_ANNOTATIONS_POP"; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
interface IPayload extends IAnnotationState { | ||
} | ||
|
||
export function build(param: IAnnotationState): | ||
Action<typeof ID, IPayload> { | ||
|
||
return { | ||
type: ID, | ||
payload: param, | ||
}; | ||
} | ||
build.toString = () => ID; // Redux StringableActionCreator | ||
export type TAction = ReturnType<typeof build>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// ==LICENSE-BEGIN== | ||
// Copyright 2017 European Digital Reading Lab. All rights reserved. | ||
// Licensed to the Readium Foundation under one or more contributor license agreements. | ||
// Use of this source code is governed by a BSD-style license | ||
// that can be found in the LICENSE file exposed on Github (readium) in the project repository. | ||
// ==LICENSE-END== | ||
|
||
import { Action } from "readium-desktop/common/models/redux"; | ||
import { IAnnotationStateWithoutUUID, IAnnotationState } from "readium-desktop/common/redux/states/annotation"; | ||
import { v4 as uuidv4 } from "uuid"; | ||
|
||
export const ID = "READER_ANNOTATIONS_PUSH"; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
interface IPayload extends IAnnotationState { | ||
} | ||
|
||
export function build(param: IAnnotationStateWithoutUUID): | ||
Action<typeof ID, IPayload> { | ||
|
||
param.uuid = param.uuid || uuidv4(); | ||
|
||
return { | ||
type: ID, | ||
payload: param as IAnnotationState, | ||
}; | ||
} | ||
build.toString = () => ID; // Redux StringableActionCreator | ||
export type TAction = ReturnType<typeof build>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// ==LICENSE-BEGIN== | ||
// Copyright 2017 European Digital Reading Lab. All rights reserved. | ||
// Licensed to the Readium Foundation under one or more contributor license agreements. | ||
// Use of this source code is governed by a BSD-style license | ||
// that can be found in the LICENSE file exposed on Github (readium) in the project repository. | ||
// ==LICENSE-END== | ||
|
||
import { Action } from "readium-desktop/common/models/redux"; | ||
import { IAnnotationState } from "readium-desktop/common/redux/states/annotation"; | ||
|
||
export const ID = "READER_ANNOTATIONS_UPDATE"; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
interface IPayload extends IAnnotationState { | ||
} | ||
|
||
export function build(param: IAnnotationState): | ||
Action<typeof ID, IPayload> { | ||
|
||
return { | ||
type: ID, | ||
payload: param, | ||
}; | ||
} | ||
build.toString = () => ID; // Redux StringableActionCreator | ||
export type TAction = ReturnType<typeof build>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters