From 96cd56548e58d537cff4757cc8ecd70effa255bc Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Thu, 17 Jan 2019 19:01:35 +0000 Subject: [PATCH] Desktop: Improve search keyword highlighting --- .gitignore | 1 + .../app/{compile-jsx.js => compile.js} | 5 +- ElectronClient/app/gui/note-viewer/index.html | 15 +++-- ElectronClient/app/package-lock.json | 2 +- ElectronClient/app/package.json | 4 +- ElectronClient/package-lock.json | 11 ++++ .../lib/services/SearchEngine.js | 4 +- ReactNativeClient/lib/string-utils-common.js | 55 ++++++++++++++++++ ReactNativeClient/lib/string-utils.js | 57 ++----------------- 9 files changed, 90 insertions(+), 64 deletions(-) rename ElectronClient/app/{compile-jsx.js => compile.js} (86%) create mode 100644 ElectronClient/package-lock.json create mode 100644 ReactNativeClient/lib/string-utils-common.js diff --git a/.gitignore b/.gitignore index ff2de5f05..eef4769b5 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,5 @@ Tools/github_oauth_token.txt _releases ReactNativeClient/lib/csstojs/ ElectronClient/app/gui/note-viewer/fonts/ +ElectronClient/app/gui/note-viewer/lib.js Tools/commit_hook.txt \ No newline at end of file diff --git a/ElectronClient/app/compile-jsx.js b/ElectronClient/app/compile.js similarity index 86% rename from ElectronClient/app/compile-jsx.js rename to ElectronClient/app/compile.js index 4663c7454..e605cc60e 100644 --- a/ElectronClient/app/compile-jsx.js +++ b/ElectronClient/app/compile.js @@ -2,6 +2,7 @@ const fs = require('fs-extra'); const spawnSync = require('child_process').spawnSync; const babelPath = __dirname + '/node_modules/.bin/babel' + (process.platform === 'win32' ? '.cmd' : ''); +const basePath = __dirname + '/../..'; const guiPath = __dirname + '/gui'; function fileIsNewerThan(path1, path2) { @@ -27,7 +28,7 @@ fs.readdirSync(guiPath).forEach((filename) => { if (fileIsNewerThan(jsxPath, jsPath)) { console.info('Compiling ' + jsxPath + '...'); - const result = spawnSync(babelPath, ['--presets', 'react', '--out-file',jsPath, jsxPath]); + const result = spawnSync(babelPath, ['--presets', 'react', '--out-file', jsPath, jsxPath]); if (result.status !== 0) { const msg = []; if (result.stdout) msg.push(result.stdout.toString()); @@ -38,3 +39,5 @@ fs.readdirSync(guiPath).forEach((filename) => { } } }); + +fs.copySync(basePath + '/ReactNativeClient/lib/string-utils-common.js', __dirname + '/gui/note-viewer/lib.js'); diff --git a/ElectronClient/app/gui/note-viewer/index.html b/ElectronClient/app/gui/note-viewer/index.html index 49a84f1e4..9616a4d21 100644 --- a/ElectronClient/app/gui/note-viewer/index.html +++ b/ElectronClient/app/gui/note-viewer/index.html @@ -37,6 +37,7 @@
+