diff --git a/ressources/components/App.js b/ressources/components/App.js index e8de0c7..79d0539 100644 --- a/ressources/components/App.js +++ b/ressources/components/App.js @@ -65,7 +65,8 @@ export default class App extends React.Component { } componentDidMount() { - window.SetSettings = json => { + window.SetSettings = base64json => { + const json = decodeURIComponent(window.atob(base64json)) this.setState(JSON.parse(json)) this.findIntput.focus() this.setState({ diff --git a/ressources/index.js b/ressources/index.js index 720768e..f82f514 100644 --- a/ressources/index.js +++ b/ressources/index.js @@ -6,11 +6,11 @@ let dark = true window.settings = {} -window.updateData = function(json) { +window.updateData = function(base64json) { if (typeof window.SetSettings == 'function') { - window.SetSettings(json) + window.SetSettings(base64json) } else { - setTimeout(() => window.updateData(json), 100) + setTimeout(() => window.updateData(base64json), 100) } } diff --git a/src/Find-and-replace.js b/src/Find-and-replace.js index f9040d1..b993ad3 100644 --- a/src/Find-and-replace.js +++ b/src/Find-and-replace.js @@ -207,9 +207,10 @@ export default function() { state = Object.assign({}, state, { init }) } if (isWebviewPresent(windowOptions.identifier)) { + let base64EncodedState = Buffer.from(encodeURIComponent(JSON.stringify(state))).toString("base64") sendToWebview( windowOptions.identifier, - `updateData('${JSON.stringify(state)}')` + `updateData('${base64EncodedState}')` ) } state = Object.assign({}, state, { init: false })