|
@@ -93,8 +93,22 @@ export default class RichTextEditor extends Component {
|
93
|
93
|
);
|
94
|
94
|
}
|
95
|
95
|
|
|
96
|
+ escapeJSONString = function(string) {
|
|
97
|
+ return string
|
|
98
|
+ .replace(/[\\]/g, '\\\\')
|
|
99
|
+ .replace(/[\"]/g, '\\\"')
|
|
100
|
+ .replace(/[\/]/g, '\\/')
|
|
101
|
+ .replace(/[\b]/g, '\\b')
|
|
102
|
+ .replace(/[\f]/g, '\\f')
|
|
103
|
+ .replace(/[\n]/g, '\\n')
|
|
104
|
+ .replace(/[\r]/g, '\\r')
|
|
105
|
+ .replace(/[\t]/g, '\\t');
|
|
106
|
+ };
|
|
107
|
+
|
96
|
108
|
_sendAction(action, data) {
|
97
|
|
- this.webviewBridge.sendToBridge(JSON.stringify({type: action, data}));
|
|
109
|
+ let jsonString = JSON.stringify({type: action, data});
|
|
110
|
+ jsonString = this.escapeJSONString(jsonString);
|
|
111
|
+ this.webviewBridge.sendToBridge(jsonString);
|
98
|
112
|
}
|
99
|
113
|
|
100
|
114
|
//-------------------------------------------------------------------------------
|