use string rather than boolean to send js event

This commit is contained in:
Satindar Dhillon 2023-02-09 17:55:48 -08:00
parent eddbcd293a
commit fc49c54867
4 changed files with 5 additions and 8 deletions

File diff suppressed because one or more lines are too long

View file

@ -505,7 +505,7 @@ public enum WebViewDispatchEvent {
case .annotate, .highlight, .setHighlightLabels, .share, .remove, .copyHighlight, .dismissHighlight:
return ""
case let .handleAutoHighlightModeChange(isEnabled: isEnabled):
return "event.enableHighlightOnRelease = '\(isEnabled)';"
return "event.enableHighlightOnRelease = '\(isEnabled ? "on" : "off")';"
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -151,14 +151,11 @@ export function ArticleContainer(props: ArticleContainerProps): JSX.Element {
}
interface UpdateHighlightModeEvent extends Event {
enableHighlightOnRelease?: boolean
enableHighlightOnRelease?: string
}
const updateHighlightMode = (event: UpdateHighlightModeEvent) => {
const isEnabled =
event.enableHighlightOnRelease !== undefined
? event.enableHighlightOnRelease
: false
const isEnabled = event.enableHighlightOnRelease === 'on'
setHighlightOnRelease(isEnabled)
}