|
@@ -234,7 +234,7 @@ const Utils = {
|
|
* @returns {string}
|
|
* @returns {string}
|
|
*/
|
|
*/
|
|
printable: function(str, preserveWs) {
|
|
printable: function(str, preserveWs) {
|
|
- if (typeof window !== "undefined" && window.app && !window.app.options.treatAsUtf8) {
|
|
|
|
|
|
+ if (ENVIRONMENT_IS_WEB() && window.app && !window.app.options.treatAsUtf8) {
|
|
str = Utils.byteArrayToChars(Utils.strToByteArray(str));
|
|
str = Utils.byteArrayToChars(Utils.strToByteArray(str));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -384,8 +384,12 @@ const Utils = {
|
|
let wordArray = CryptoJS.enc.Utf8.parse(str),
|
|
let wordArray = CryptoJS.enc.Utf8.parse(str),
|
|
byteArray = Utils.wordArrayToByteArray(wordArray);
|
|
byteArray = Utils.wordArrayToByteArray(wordArray);
|
|
|
|
|
|
- if (typeof window !== "undefined" && str.length !== wordArray.sigBytes) {
|
|
|
|
- window.app.options.attemptHighlight = false;
|
|
|
|
|
|
+ if (str.length !== wordArray.sigBytes) {
|
|
|
|
+ if (ENVIRONMENT_IS_WORKER()) {
|
|
|
|
+ self.setOption("attemptHighlight", false);
|
|
|
|
+ } else if (ENVIRONMENT_IS_WEB()) {
|
|
|
|
+ window.app.options.attemptHighlight = false;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return byteArray;
|
|
return byteArray;
|
|
},
|
|
},
|
|
@@ -448,8 +452,13 @@ const Utils = {
|
|
let wordArray = new CryptoJS.lib.WordArray.init(words, byteArray.length),
|
|
let wordArray = new CryptoJS.lib.WordArray.init(words, byteArray.length),
|
|
str = CryptoJS.enc.Utf8.stringify(wordArray);
|
|
str = CryptoJS.enc.Utf8.stringify(wordArray);
|
|
|
|
|
|
- if (typeof window !== "undefined" && str.length !== wordArray.sigBytes)
|
|
|
|
- window.app.options.attemptHighlight = false;
|
|
|
|
|
|
+ if (str.length !== wordArray.sigBytes) {
|
|
|
|
+ if (ENVIRONMENT_IS_WORKER()) {
|
|
|
|
+ self.setOption("attemptHighlight", false);
|
|
|
|
+ } else if (ENVIRONMENT_IS_WEB()) {
|
|
|
|
+ window.app.options.attemptHighlight = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return str;
|
|
return str;
|
|
} catch (err) {
|
|
} catch (err) {
|
|
// If it fails, treat it as ANSI
|
|
// If it fails, treat it as ANSI
|