From 3772d97dfaafcebd1d918bdf7dda2f86fce37dde Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 6 Apr 2020 22:08:54 +0200 Subject: [PATCH] basic text preview implemented --- package-lock.json | 325 +++++++++--------- src/entities/entity_constructor.js | 9 + .../javascripts/services/tab_context.js | 1 + src/public/javascripts/widgets/note_detail.js | 16 + .../widgets/type_widgets/text_preview.js | 80 +++++ .../widgets/type_widgets/type_widget.js | 6 + src/services/notes.js | 6 +- 7 files changed, 276 insertions(+), 167 deletions(-) create mode 100644 src/public/javascripts/widgets/type_widgets/text_preview.js diff --git a/package-lock.json b/package-lock.json index 420a2f35f..f4cf8aa98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -178,23 +178,23 @@ } }, "@jimp/bmp": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.10.0.tgz", - "integrity": "sha512-CN3uTfm2NTeJ+l1MMP1O6VkjED+bJb1GVL8AegbUF1ZG4drfAyU74EuYOqqU39k0ws3rSnX8GIkZdOP2xZ88pw==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.10.1.tgz", + "integrity": "sha512-gy4ftMCgBZOx1e/Q+MaJlmU4qgqVqwGdf7G6byYTLEMUzzGK2Ipxf3nlXfkMOZqw7Bhc17zDnBIKluo7k0kX5Q==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "bmp-js": "^0.1.0", "core-js": "^3.4.1" } }, "@jimp/core": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.10.0.tgz", - "integrity": "sha512-oCvwNz5sASKzU526RP8ci6crdhLKuaGJmEobYFXTGR1ZjRNyIsecV9CnXHPj9dzIGhtbf92zYii7uXSdFQjikA==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.10.1.tgz", + "integrity": "sha512-ChyLkGb1+x2mRpsdcnQuRNb523qVqUc7+zCbuO/VAMaqvbMKuRalVz3aHXcVwNi8vOAOgce4LOBT7kjdKTtR/w==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "any-base": "^1.1.0", "buffer": "^5.2.0", "core-js": "^3.4.1", @@ -215,295 +215,295 @@ } }, "@jimp/custom": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.10.0.tgz", - "integrity": "sha512-dqzATumk1VN/ZFREqyH765urWKj8VNta+E9G0izY7XLwcq0FwCN0C/aiBmiunJdjGcdWVWHbjMreXsIzlKTONg==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.10.1.tgz", + "integrity": "sha512-hiiOL5sGcV1p8hCFTabALUOmXs4VP9VwhfBZtsFueKGbwWz6dmaZvkMBsk3Mz1ukBP3xb09goWG+zAIdTm88fw==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/core": "^0.10.0", + "@jimp/core": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/gif": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.10.0.tgz", - "integrity": "sha512-E4ZGaN3lMVqTzYaL2VmkjNK3iB8cuSEChXuBqSRnZbozG0+hoiJv0992Bj+2SX6+e8aJZCZGuf2gVXqRgoxj/Q==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.10.1.tgz", + "integrity": "sha512-xJwZ6JI6+GmrgTw///YdV8GY1z2dp4AAxEdm/KPozTvS2rygC8OZJcTmlswFws0UCH43rKzJlQUXa4Jb3ybB6w==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1", "omggif": "^1.0.9" } }, "@jimp/jpeg": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.10.0.tgz", - "integrity": "sha512-H78MgxGjljaTeHlkEsd2vL7CILv7/vqqN1AXSLTKOigXBQasef0/n5LUPnCbGzGbcjEVkC5f6zipULVbBJrHHQ==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.10.1.tgz", + "integrity": "sha512-PXxrBWZNNGpm7PRpdi2jt9fpTpQwe2Gf4juwuHXP/dBFHLk3wiI/npKkVITplwzzoQ6D4N0cb279c9bOpuQeJQ==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1", "jpeg-js": "^0.3.4" } }, "@jimp/plugin-blit": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.10.0.tgz", - "integrity": "sha512-37Zr9hmmXHm7nCE1SUFyaYHyy8Ci8uM7EDN2Vialq1zMjYJ4sgPl4410ykdRU6OtKtTqvF421NKsdmI3kEuKvw==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.10.1.tgz", + "integrity": "sha512-53647EfRvPQJKQCMBc5AJGSZHyl6eueaOQq7PrfxEEq9Q3IjVcikAWYrZ4bHSZY7J12IIuz/5bSLJJZfegNQtA==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugin-blur": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.10.0.tgz", - "integrity": "sha512-F+q2e23kGPXEUlfmk3L5QEHfdXt0yz9NzLJNJI+OmjqlmDt4szthC5/EJuNw0IKDup0PvYKYFTMCfJS5lfdNaA==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.10.1.tgz", + "integrity": "sha512-0PzdzPGuv8RlhiMbLcM0tIekkHhuaPTY+frEWmO8BuCeqW9Tg9W4RxdwZtMqIVRG+kZBgyltYee31Q4JWlu9Hg==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugin-circle": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.10.0.tgz", - "integrity": "sha512-NDAJy+Nw8X1YNM2nAwdmYnFP4M2lM4lOGIMSsBp8hd7OR2QD9iA1RlsfQC7zQDFSE8WapQwBDelouJKovu3lrQ==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.10.1.tgz", + "integrity": "sha512-sqiiEddN81N9xHZbPVjaJlbpQabaCeNGLW/x+0BfuNxnMPq7OkOx8IRpqIDYiGuuPhiR5hWxmmpws8ZAhjwsVw==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugin-color": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.10.0.tgz", - "integrity": "sha512-+FpVmEKQSyFzmxs9h5/B4XrrJmDaxNcHqeQe/RiEmpS/91SL0KpfAiHZGFke++OYKomxFcbxu5m/WPGyN669rQ==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.10.1.tgz", + "integrity": "sha512-SmW2+hFtNmQ33WYVsgKvreS8peCc5qItAvqGR58lKNoIMEZSNpyGwIu9g83HtDIImGsXpz3DWGMR1h8sLYCFcQ==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1", "tinycolor2": "^1.4.1" } }, "@jimp/plugin-contain": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.10.0.tgz", - "integrity": "sha512-ZH2+qbwumUMI/+l9TBf3ug94WXIAars7svEjNBFfB7aLQvJzFxLifsPxLnjfoNRFIkrolfQ1RzAModotycoliA==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.10.1.tgz", + "integrity": "sha512-1PkmUPd5iAicAI7QjO9r1Mp/Ia7ElJPwXTCNLsQkDxYS/L4u7vQ0xCkQkokAeR49Ul3GTWLqj9paWr7VSBG9Fg==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugin-cover": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.10.0.tgz", - "integrity": "sha512-BJZZtKkb9FNPyaiQm2cc/49Og+60njlqzLZxu0uMrDyGzVn/K1dkg3MS9BOQQi1BTyqXILk+EctlXVCaGXqxTQ==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.10.1.tgz", + "integrity": "sha512-fCiz+ugrRwffNixUHFxtRKhTYm8sFAoYbNNzV0WdiG8dS0qhoYjbOJPtLcIw9CyJbMZ5eXjGOTxhTAGzBng9DA==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugin-crop": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.10.0.tgz", - "integrity": "sha512-UWp7HNRVyAPx8YYgFfW9qOtx2JNXZq0q4M0IztPe9wOZ4RE45otK3pgxFglYAn2pxwSbaTP6bt+E7acRJIqBpw==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.10.1.tgz", + "integrity": "sha512-KjW+RuuNcsIvvNF1ejbBjcDNus/fLz69LGAU2gwhFzw7A0iOUEJJgTWzkGBLZ/YvUaWMDtPnznF3X3oYHeOj6A==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugin-displace": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.10.0.tgz", - "integrity": "sha512-IK/KuMWuC1rWLrkgTg5Xh7HLO7FaJ/+b84m1sidVRwJ1PTbWCnsf3f2KL9xmfzwdUXS4VE1E4Z2uUe1qsDx8Cg==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.10.1.tgz", + "integrity": "sha512-NUJcjMRb6iR9rwJSC7t8LMJgRs5Z0mzflYBymvttkjlcIoB4RPIOu3gWn5iT5IepB50YTy9zJuCaofMYn4DnaA==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugin-dither": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.10.0.tgz", - "integrity": "sha512-f11HgQr0i7UjHdeKg/6uQxRDFArHSPZrjYjtczCKB7XDE8Fs0BeaDGNr3oDiq3cFcn+533heYUtxYZMT2EZOnw==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.10.1.tgz", + "integrity": "sha512-V/PCL44R16w5EDCgMvFXBaWFQ0f3LLDD3CQxJFOw6awswkP60m13nUUtWHm7QB54Gghhgk8JEOD/mZo6JsnaBg==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugin-fisheye": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.10.0.tgz", - "integrity": "sha512-r7eADsfWL7ajvUwhU2MVw2s3zTovyEyGUsP4P4FqSXUnni7Vhjx1gIapC13V3N71xzeFhra0zlHYVFiRKTSHtw==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.10.1.tgz", + "integrity": "sha512-GgIAY6ryL+2RwRb6j+APo972f8VjftolnvjVM1ilxO4pdfJf7gdg3Bp4igka9fgW94BBgdJlCPUeWIVap3AYaA==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugin-flip": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.10.0.tgz", - "integrity": "sha512-VdaF4xzmGVekGPyyaYsb+8xGY25wzPjpA54iSbl/CzrDVMMCiqNX5Ti5tFiJnq4YHP1Dr75X3dxbpYUV8un2YQ==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.10.1.tgz", + "integrity": "sha512-CkSwULwmVYOo6ZY/QnR0/mrfMaf/3g+sDo7osAHaf0GvuoIw76NSh6LwaANAsLZ9erknZ67XuqCjZWoMwNrbaw==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugin-gaussian": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.10.0.tgz", - "integrity": "sha512-r/t5UQEnuCpZ5eqn4H8tPSBtz531utfhs5KbF9VbqyoqlhbFM5nCPNeScOY8LLuh+mIOqH2iqStzXcUTS6+wiA==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.10.1.tgz", + "integrity": "sha512-RnmIWUr9RB1RrgqXG2H7C3dyncak/D2CPoP2DehAgxxHprDdxm9HoFjhGQ9eh+Ygr0nXE7t2+fDE12U3VW3ApA==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugin-invert": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.10.0.tgz", - "integrity": "sha512-QpvABEakobueEoVuHRPOTH+Habf8yzjE5zLYPDApt0zG/u/dEsZuyWcUdzstDEn4paH49X4DED4odCbExX/mdw==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.10.1.tgz", + "integrity": "sha512-PpTUbnjsAkw0nZnbZWrKdsEW46MARhzzabBXy/XCjvutG3jzoO8EL19VeEtcrxBml9duJbaOzdzYmbFkQsNINQ==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugin-mask": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.10.0.tgz", - "integrity": "sha512-slp4H8QzJE4NHL9m1odHoswvrGJYNCM5YJ+UX50cHnFe1iJVBwJ+84Knwul1eRtFP0IJ1KJAG1ycObns/qWSMw==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.10.1.tgz", + "integrity": "sha512-Fm75MSucSGI19n9beXGVPSR98flXpzJLyOfSj0+zefXafrO+kmYO9eWtzNd3TE6jzyGe5y7mPJPHB0PWXKgw4g==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugin-normalize": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.10.0.tgz", - "integrity": "sha512-W5S8XuH+mOFKamGZ4YosF/1hxgV/edX3YKJuXTtXSsq4UgusscPy0CVafRuMgH5wJf9enGQgzzy0z5VojudSTw==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.10.1.tgz", + "integrity": "sha512-mxjRCmUB/yD973pgjAKb3HCYMyh1GvGtdo71+pJn+ChefvTJ0LDB1FknwTVjDtJuy4mBh0TkBqBp4PNAtdBL6w==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugin-print": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.10.0.tgz", - "integrity": "sha512-5taCmgZw+gNRQCYXmzYgJWoRimfyP6CM72LMPx5mfKONUrvu3Rj8tFQJMfbpf6AJOQp3mJPIYlcbZzozSDfjLg==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.10.1.tgz", + "integrity": "sha512-eSPTbdES/ISR9nMHV8e449UMs0Dx0eY9OixU7gIYTDnTmnhyYXq9bqIY/IXqVU3fOj330MIpIpi6pavmtJXdLA==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1", "load-bmfont": "^1.4.0" } }, "@jimp/plugin-resize": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.10.0.tgz", - "integrity": "sha512-sYcbeMKTYEVmkKLIHUoz3o4Ai86dr8RnZz85uMsRAim+KxRCHMLD1MFpHSJWpIfuoNzo2onLZ8h0qqdQdZ6GuQ==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.10.1.tgz", + "integrity": "sha512-aG42+tRmhAYKvybZteSD7s48dAcYSkipyM+e2aizRa0D0FHNIQlIHribiKfRTiX+ewx/fhHVu0vpFKOg0N2hDw==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugin-rotate": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.10.0.tgz", - "integrity": "sha512-/2N7tkHX0KDupfgxmamZPv1/ZuSwMcfeyZhjxIg2yFf4MXYKQYe3ByclrmNR7nkOAiD0Fa5NSIZ8tkIUBacWVg==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.10.1.tgz", + "integrity": "sha512-R+Qpb3cwKl6L5m9RUkJatY5D5JuPg/uUfFbdFPaBhc5infC46Rsyt0j923eUyXkisechRDmzoTbG3fcc1MjzSA==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugin-scale": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.10.0.tgz", - "integrity": "sha512-FSwW7rz0/EtnRpDa3YwQrdteYZw3ZWfs57MY6TYLcB3a9UlvGiGWiFnvoyu6tubjFi5uxDlkS6bLRH40UYdqAg==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.10.1.tgz", + "integrity": "sha512-MKmW3Rr0sSApglUYFqJ8LgGy9Nm9w2oRgSB2twxA5bp1waM9fdOILcRyEnltwHIIDSoyR0me8XmpuwpyqaqSdA==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugin-shadow": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.10.0.tgz", - "integrity": "sha512-+eXGK+Z5X99v3fHBpN35GIepfdZxF7V5gmFbCF4q7aIXLgNpVNM0j+g1wBFVqwSl97TpaD7Wbvh99zygWL/S6g==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.10.1.tgz", + "integrity": "sha512-H4JSVimD19vbFiX8SL3Ci5Htsbb3xG8zQrkjf+ui/2MXbeP0FyWlIv3g1Ahil4oE+5Wi4zbq20Dyba2GS4aINw==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugin-threshold": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.10.0.tgz", - "integrity": "sha512-m/oIgDfZ3wAAdpC4/JMgd+G3AvMcMCXmLkKh30JSwsPgIgsAZRiiGSdy3obXKLcEQ2eNWPIaCU1/qPVt6m2org==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.10.1.tgz", + "integrity": "sha512-o2nBEz2tLvfYNMdac9qho5SrjFoBfbJow8PWXMWz14N6zLKIw4DQT+inSbEKxbxlqKseds3zUsOIM+0hLbSDeQ==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1" } }, "@jimp/plugins": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.10.0.tgz", - "integrity": "sha512-pxBCETGOTwZ7rBbq5NtPY21NcGLEtY6HtCvcN/IUmUNhcuGcaM+YEjGYg7mAP9HNoP6e6UevA5aiouDA+lFVHw==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.10.1.tgz", + "integrity": "sha512-gpdoh7XITd33ZClObVKYV8ASpZnrwebNuY4C5njeJfLxfyRQ2wSK9TDAb/5OYcyrbMDIqBaKLg9AXHPBphwXtg==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/plugin-blit": "^0.10.0", - "@jimp/plugin-blur": "^0.10.0", - "@jimp/plugin-circle": "^0.10.0", - "@jimp/plugin-color": "^0.10.0", - "@jimp/plugin-contain": "^0.10.0", - "@jimp/plugin-cover": "^0.10.0", - "@jimp/plugin-crop": "^0.10.0", - "@jimp/plugin-displace": "^0.10.0", - "@jimp/plugin-dither": "^0.10.0", - "@jimp/plugin-fisheye": "^0.10.0", - "@jimp/plugin-flip": "^0.10.0", - "@jimp/plugin-gaussian": "^0.10.0", - "@jimp/plugin-invert": "^0.10.0", - "@jimp/plugin-mask": "^0.10.0", - "@jimp/plugin-normalize": "^0.10.0", - "@jimp/plugin-print": "^0.10.0", - "@jimp/plugin-resize": "^0.10.0", - "@jimp/plugin-rotate": "^0.10.0", - "@jimp/plugin-scale": "^0.10.0", - "@jimp/plugin-shadow": "^0.10.0", - "@jimp/plugin-threshold": "^0.10.0", + "@jimp/plugin-blit": "^0.10.1", + "@jimp/plugin-blur": "^0.10.1", + "@jimp/plugin-circle": "^0.10.1", + "@jimp/plugin-color": "^0.10.1", + "@jimp/plugin-contain": "^0.10.1", + "@jimp/plugin-cover": "^0.10.1", + "@jimp/plugin-crop": "^0.10.1", + "@jimp/plugin-displace": "^0.10.1", + "@jimp/plugin-dither": "^0.10.1", + "@jimp/plugin-fisheye": "^0.10.1", + "@jimp/plugin-flip": "^0.10.1", + "@jimp/plugin-gaussian": "^0.10.1", + "@jimp/plugin-invert": "^0.10.1", + "@jimp/plugin-mask": "^0.10.1", + "@jimp/plugin-normalize": "^0.10.1", + "@jimp/plugin-print": "^0.10.1", + "@jimp/plugin-resize": "^0.10.1", + "@jimp/plugin-rotate": "^0.10.1", + "@jimp/plugin-scale": "^0.10.1", + "@jimp/plugin-shadow": "^0.10.1", + "@jimp/plugin-threshold": "^0.10.1", "core-js": "^3.4.1", "timm": "^1.6.1" } }, "@jimp/png": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.10.0.tgz", - "integrity": "sha512-RA52BB9duNFCEu1UuGrho7IQ+XVWsp4e+9dBToKfV0qsWAAHAffYz1y2XqLc1iCWcw1voBmJgIOygRu0jEt2QQ==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.10.1.tgz", + "integrity": "sha512-/2CUaOjbq5GVaXKRGzM4nhhFpnVdWNazsuVZ3Et8sgMxJxep7v6k2hmvL8rr0/A4UPPWzEbFsagz/YBbN9fANw==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.10.0", + "@jimp/utils": "^0.10.1", "core-js": "^3.4.1", "pngjs": "^3.3.3" } }, "@jimp/tiff": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.10.0.tgz", - "integrity": "sha512-mD864zMb8gG5yRottcixbJj+AMrepGqYK+9guek1tVCuoOnWQzjwU3pbb59nqkbw3enf3XNmbK2f2TfE7s5Jbw==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.10.1.tgz", + "integrity": "sha512-lvCzid4RwCZr/Zz3W4xTD/UKe4xjVdPk2dGGozrW0Puo2TCz5L+ghXYEWxzoj/rm/wOFmQbaYdopv0UQ72HqWw==", "requires": { "@babel/runtime": "^7.7.2", "core-js": "^3.4.1", @@ -511,27 +511,28 @@ } }, "@jimp/types": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.10.0.tgz", - "integrity": "sha512-PABpDNQi20aKe6Xcc4l4gVI95ztlkmfSSlgHJrby/Cg2b0NzQF81rY1W0eLC2/8R6OGTgi5FtvKI59NDss8nPg==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.10.1.tgz", + "integrity": "sha512-PaPhpeHE41Yn6myvnHmrb1FNvn+XmF+EpizhP8JR3DmyveUPblrssM8qA5iMe+Q+wG3vJ02LHNgbfFCUYJr3zA==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/bmp": "^0.10.0", - "@jimp/gif": "^0.10.0", - "@jimp/jpeg": "^0.10.0", - "@jimp/png": "^0.10.0", - "@jimp/tiff": "^0.10.0", + "@jimp/bmp": "^0.10.1", + "@jimp/gif": "^0.10.1", + "@jimp/jpeg": "^0.10.1", + "@jimp/png": "^0.10.1", + "@jimp/tiff": "^0.10.1", "core-js": "^3.4.1", "timm": "^1.6.1" } }, "@jimp/utils": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.10.0.tgz", - "integrity": "sha512-a05KrUwDGuQn++gWyvQcWlFBXfyZXYpY/3Mde4i/HEIyzWrZSnSzppCssiKVXR5pSWSqfSsLDImrSuJRqtOVmQ==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.10.1.tgz", + "integrity": "sha512-Q0ZT2FGPQo3lXkUheAsg0dVWo0Ko+vYCVJLEUxQMxmPiDLUquE22iya+tMONPOaRj1GG3cznaSqaEHDNgoyYbw==", "requires": { "@babel/runtime": "^7.7.2", - "core-js": "^3.4.1" + "core-js": "^3.4.1", + "regenerator-runtime": "^0.13.3" } }, "@nodelib/fs.scandir": { @@ -2533,9 +2534,9 @@ } }, "dom-walk": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", - "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", + "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==" }, "domelementtype": { "version": "1.3.1", @@ -2683,9 +2684,9 @@ "integrity": "sha512-IncmUpn1yN84hy2shb0POJ80FWrfGNY0cxO9f4v+/sG7qcBvAtVWUA1IdzY/8EYUmOVhoKJVdJjNd3AZcnxOjA==" }, "electron": { - "version": "9.0.0-beta.13", - "resolved": "https://registry.npmjs.org/electron/-/electron-9.0.0-beta.13.tgz", - "integrity": "sha512-JW2KAUTqkSf//qy6kIFyoua1xkpxZ5loBT5bg+iLHop/684JUilb/KfDIjn5Lzt15eOCkwexSFN4HKJK7823ZA==", + "version": "9.0.0-beta.14", + "resolved": "https://registry.npmjs.org/electron/-/electron-9.0.0-beta.14.tgz", + "integrity": "sha512-zk0TcX5Id4pbROx70h2XZohxAh2rlhtQ60NJ8AkNyaBVfIZKa6v1Ss0RMuJTe1YUmtFgUtogLEWyq8+xdsdHrg==", "dev": true, "requires": { "@electron/get": "^1.0.1", @@ -3666,9 +3667,9 @@ "dev": true }, "mkdirp": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", - "integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", "dev": true, "requires": { "minimist": "^1.2.5" @@ -5380,14 +5381,14 @@ } }, "jimp": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.10.0.tgz", - "integrity": "sha512-PwTUye0Z721FGzNZhbf48U3CMFMbtQY+LEshUx72Z716ku+/SjI6XXfXhZyU3o/PR1TxoFFjyLlV1x8qg6ZF+A==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.10.1.tgz", + "integrity": "sha512-dRs9hdUXseS7y214GxZxeLiXNQZUXnjdzv9I5+FVWAnyK0bdIGgjUn5WLuNF4uAKkzIH3cFA24EbviOlBIpRDg==", "requires": { "@babel/runtime": "^7.7.2", - "@jimp/custom": "^0.10.0", - "@jimp/plugins": "^0.10.0", - "@jimp/types": "^0.10.0", + "@jimp/custom": "^0.10.1", + "@jimp/plugins": "^0.10.1", + "@jimp/types": "^0.10.1", "core-js": "^3.4.1", "regenerator-runtime": "^0.13.3" } diff --git a/src/entities/entity_constructor.js b/src/entities/entity_constructor.js index 1cdf4b90b..e2162b4ae 100644 --- a/src/entities/entity_constructor.js +++ b/src/entities/entity_constructor.js @@ -6,6 +6,7 @@ const RecentNote = require('../entities/recent_note'); const ApiToken = require('../entities/api_token'); const Option = require('../entities/option'); const repository = require('../services/repository'); +const cls = require('./cls'); const ENTITY_NAME_TO_ENTITY = { "attributes": Attribute, @@ -32,9 +33,13 @@ function createEntityFromRow(row) { if (row.attributeId) { entity = new Attribute(row); + + cls.setEntityToCache('attributes', row.attributeId, entity); } else if (row.noteRevisionId) { entity = new NoteRevision(row); + + cls.setEntityToCache('note_revisions', row.noteRevisionId, entity); } else if (row.branchId && row.notePath) { entity = new RecentNote(row); @@ -44,9 +49,13 @@ function createEntityFromRow(row) { } else if (row.branchId) { entity = new Branch(row); + + cls.setEntityToCache('branches', row.branchId, entity); } else if (row.noteId) { entity = new Note(row); + + cls.setEntityToCache('notes', row.noteId, entity); } else if (row.name) { entity = new Option(row); diff --git a/src/public/javascripts/services/tab_context.js b/src/public/javascripts/services/tab_context.js index 421ceb7a5..b17df18fd 100644 --- a/src/public/javascripts/services/tab_context.js +++ b/src/public/javascripts/services/tab_context.js @@ -57,6 +57,7 @@ class TabContext extends Component { this.noteId = noteId; this.autoBookDisabled = false; + this.textPreviewDisabled = false; setTimeout(async () => { // we include the note into recent list only if the user stayed on the note at least 5 seconds diff --git a/src/public/javascripts/widgets/note_detail.js b/src/public/javascripts/widgets/note_detail.js index c3491dbda..c135ae43b 100644 --- a/src/public/javascripts/widgets/note_detail.js +++ b/src/public/javascripts/widgets/note_detail.js @@ -18,6 +18,7 @@ import appContext from "../services/app_context.js"; import keyboardActionsService from "../services/keyboard_actions.js"; import noteCreateService from "../services/note_create.js"; import DeletedTypeWidget from "./type_widgets/deleted.js"; +import TextPreviewTypeWidget from "./type_widgets/text_preview.js"; const TPL = `
@@ -36,6 +37,7 @@ const typeWidgetClasses = { 'empty': EmptyTypeWidget, 'deleted': DeletedTypeWidget, 'text': TextTypeWidget, + 'text-preview': TextPreviewTypeWidget, 'code': CodeTypeWidget, 'file': FileTypeWidget, 'image': ImageTypeWidget, @@ -176,6 +178,14 @@ export default class NoteDetailWidget extends TabAwareWidget { } } + if (type === 'text' && !this.tabContext.textPreviewDisabled) { + const noteComplement = await this.tabContext.getNoteComplement(); + + if (noteComplement.content && noteComplement.content.length > 10000) { + type = 'text-preview'; + } + } + if (note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable()) { type = 'protected-session'; } @@ -252,6 +262,12 @@ export default class NoteDetailWidget extends TabAwareWidget { } } + textPreviewDisabledEvent({tabContext}) { + if (this.isTab(tabContext.tabId)) { + this.refresh(); + } + } + async cutIntoNoteCommand() { const note = appContext.tabManager.getActiveTabNote(); diff --git a/src/public/javascripts/widgets/type_widgets/text_preview.js b/src/public/javascripts/widgets/type_widgets/text_preview.js new file mode 100644 index 000000000..8872d5848 --- /dev/null +++ b/src/public/javascripts/widgets/type_widgets/text_preview.js @@ -0,0 +1,80 @@ +import TypeWidget from "./type_widget.js"; +import appContext from "../../services/app_context.js"; +import treeCache from "../../services/tree_cache.js"; + +const TPL = ` +
+ + +
+ Text preview is shown. Click here to edit the note. +
+ +
+
+`; + +export default class TextPreviewTypeWidget extends TypeWidget { + static getType() { return "text-preview"; } + + doRender() { + this.$widget = $(TPL); + this.$content = this.$widget.find('.note-detail-text-preview-content'); + + this.$widget.on("dblclick", "img", e => { + const $img = $(e.target); + const src = $img.prop("src"); + + const match = src.match(/\/api\/images\/([A-Za-z0-9]+)\//); + + if (match) { + const noteId = match[1]; + + appContext.tabManager.getActiveTabContext().setNote(noteId); + } + else { + window.open(src, '_blank'); + } + }); + + this.$widget.find('a.edit-note').on('click', () => { + this.tabContext.textPreviewDisabled = true; + + this.triggerEvent('textPreviewDisabled', {tabContext: this.tabContext}); + }); + + return this.$widget; + } + + cleanup() { + this.$content.html(''); + } + + scrollToTop() { + this.$content.scrollTop(0); + } + + async doRefresh(note) { + const noteComplement = await treeCache.getNoteComplement(note.noteId); + + this.$content.html(noteComplement.content); + } +} \ No newline at end of file diff --git a/src/public/javascripts/widgets/type_widgets/type_widget.js b/src/public/javascripts/widgets/type_widgets/type_widget.js index 17811a334..60755df36 100644 --- a/src/public/javascripts/widgets/type_widgets/type_widget.js +++ b/src/public/javascripts/widgets/type_widgets/type_widget.js @@ -42,4 +42,10 @@ export default class TypeWidget extends TabAwareWidget { this.refresh(); } } + + textPreviewDisabledEvent({tabContext}) { + if (this.isTab(tabContext.tabId)) { + this.refresh(); + } + } } \ No newline at end of file diff --git a/src/services/notes.js b/src/services/notes.js index 10c113a13..1aa251eec 100644 --- a/src/services/notes.js +++ b/src/services/notes.js @@ -544,22 +544,18 @@ async function deleteBranch(branch, deleteId, taskContext) { note.deleteId = deleteId; await note.save(); - console.log("Deleting note", note.noteId); + log.info("Deleting note " + note.noteId); for (const attribute of await note.getOwnedAttributes()) { attribute.isDeleted = true; attribute.deleteId = deleteId; await attribute.save(); - - console.log("Deleting note's", note.noteId, "attribute", attribute.attributeId); } for (const relation of await note.getTargetRelations()) { relation.isDeleted = true; relation.deleteId = deleteId; await relation.save(); - - console.log("Deleting note's", note.noteId, "target relation", relation.attributeId); } return true;