diff --git a/browser/lib/htmlTextHelper.js b/browser/lib/htmlTextHelper.js index 49952fbd5..ccc545e35 100644 --- a/browser/lib/htmlTextHelper.js +++ b/browser/lib/htmlTextHelper.js @@ -13,7 +13,8 @@ export function decodeEntities (text) { ['amp', '&'], ['lt', '<'], ['gt', '>'], - ['#63', '\\?'] + ['#63', '\\?'], + ['#36', '\\$'] ] for (var i = 0, max = entities.length; i < max; ++i) { @@ -28,7 +29,8 @@ export function encodeEntities (text) { ['\'', 'apos'], ['<', 'lt'], ['>', 'gt'], - ['\\?', '#63'] + ['\\?', '#63'], + ['\\$', '#36'] ] entities.forEach((entity) => { diff --git a/tests/lib/html-text-helper-test.js b/tests/lib/html-text-helper-test.js index a476c0dd3..538b87570 100644 --- a/tests/lib/html-text-helper-test.js +++ b/tests/lib/html-text-helper-test.js @@ -12,7 +12,8 @@ test('htmlTextHelper#decodeEntities should return encoded text (string)', t => { ['var test = 'test'', 'var test = \'test\''], ['<a href='https://boostnote.io'>Boostnote', 'Boostnote'], ['<\\\\?php\n var = 'hoge';', '<\\\\?php\n var = \'hoge\';'], - ['&', '&'] + ['&', '&'], + ['a$'', 'a\\$\''] ] testCases.forEach(testCase => { @@ -27,7 +28,8 @@ test('htmlTextHelper#decodeEntities() should return decoded text (string)', t => ['Boostnote', '<a href='https://boostnote.io'>Boostnote'], - [' {