Skip to content

Commit 437c060

Browse files
Merge branch 'hotfix/3.20.4'
2 parents e398e53 + e5b31d4 commit 437c060

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "worldbrain-extension",
3-
"version": "3.20.3",
3+
"version": "3.20.4",
44
"homepage": "https://memex.garden",
55
"repository": "https://github.com/WorldBrain/Memex",
66
"scripts": {

src/annotations/components/highlightColorPicker/index.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,14 @@ export default class HighlightColorPicker extends React.Component<
118118
}
119119

120120
componentWillUnmount(): void {
121-
if (this.state.highlightColorStateChanged) {
122-
this.saveHighlightColorSettings()
123-
}
121+
// if (this.state.highlightColorStateChanged) {
122+
// this.saveHighlightColorSettings()
123+
// }
124124
}
125125

126-
getHighlightColorSettings = async () => {
126+
getHighlightColorSettings = async (forceUpdate?) => {
127127
let highlightColors = this.state.highlightColorSettingState
128-
if (!highlightColors) {
128+
if (!highlightColors || forceUpdate) {
129129
highlightColors = await this.syncSettings.highlightColors.get(
130130
'highlightColors',
131131
)
@@ -176,6 +176,9 @@ export default class HighlightColorPicker extends React.Component<
176176
modifyDomHighlightColor(highlight, colorItem)
177177
}
178178
}
179+
this.setState({
180+
highlightColorSettingState: this.state.highlightColorSettingState,
181+
})
179182

180183
await this.syncSettings.highlightColors.set(
181184
'highlightColors',
@@ -195,11 +198,12 @@ export default class HighlightColorPicker extends React.Component<
195198
onClick={(event) => {
196199
event.stopPropagation()
197200
}}
201+
key={'ColorEditBox' + index}
198202
>
199203
<TopBarBox>
200204
<PrimaryAction
201205
label={'Cancel'}
202-
onClick={(event) => {
206+
onClick={async (event) => {
203207
let highlights: NodeListOf<Element> = document.querySelectorAll(
204208
'.' + DEF_HIGHLIGHT_CSS_CLASS,
205209
)
@@ -225,11 +229,10 @@ export default class HighlightColorPicker extends React.Component<
225229
const newShowEditColor = [
226230
...this.state.showEditColor,
227231
]
232+
233+
this.getHighlightColorSettings(true)
228234
newShowEditColor[index] = false
229235
this.setState({
230-
highlightColorSettingState: [
231-
...this.state.highlightColorSettingState,
232-
],
233236
showColorEditorPanel: false,
234237
showEditColor: newShowEditColor,
235238
})
@@ -465,6 +468,7 @@ export default class HighlightColorPicker extends React.Component<
465468
}}
466469
active={this.state.showEditColor[i]}
467470
selected={this.state.selectedRow === i}
471+
key={colorId}
468472
>
469473
<ColorPickerCircle
470474
backgroundColor={RGBAobjectToString(

0 commit comments

Comments
 (0)