fix: preserve note id when changing style and preserve style when changing color, closes #252 (#436)
This commit is contained in:
@@ -357,6 +357,7 @@ const Annotator: React.FC<{ bookKey: string }> = ({ bookKey }) => {
|
||||
if (existingIndex !== -1) {
|
||||
views.forEach((view) => view?.addAnnotation(annotation, true));
|
||||
if (update) {
|
||||
annotation.id = annotations[existingIndex]!.id;
|
||||
annotations[existingIndex] = annotation;
|
||||
views.forEach((view) => view?.addAnnotation(annotation));
|
||||
} else {
|
||||
|
||||
@@ -37,8 +37,8 @@ const HighlightOptions: React.FC<HighlightOptionsProps> = ({
|
||||
onHandleHighlight(true);
|
||||
};
|
||||
const handleSelectColor = (color: HighlightColor) => {
|
||||
const style = globalReadSettings.highlightStyle;
|
||||
globalReadSettings.highlightStyles[style] = color;
|
||||
globalReadSettings.highlightStyle = selectedStyle;
|
||||
globalReadSettings.highlightStyles[selectedStyle] = color;
|
||||
setSettings(settings);
|
||||
setSelectedColor(color);
|
||||
onHandleHighlight(true);
|
||||
|
||||
Reference in New Issue
Block a user