A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
add support for longpress detection on tags in editor
ammarahm-ededc3be53a1e7
diff --git a/apps/mobile/android/app/src/main/assets/index.css b/apps/mobile/android/app/src/main/assets/index.cssindex e28e05807..7a47ebabb 100644--- a/apps/mobile/android/app/src/main/assets/index.css+++ b/apps/mobile/android/app/src/main/assets/index.css@@ -71,3 +71,14 @@ body {.visible {display: inline-flex !important;}+++.noselect {+ -webkit-touch-callout: none; /* iOS Safari */+ -webkit-user-select: none; /* Safari */+ -khtml-user-select: none; /* Konqueror HTML */+ -moz-user-select: none; /* Old versions of Firefox */+ -ms-user-select: none; /* Internet Explorer/Edge */+ user-select: none; /* Non-prefixed version, currently+ supported by Chrome, Edge, Opera and Firefox */+}diff --git a/apps/mobile/html/Web.bundle/site/constants.js b/apps/mobile/html/Web.bundle/site/constants.jsindex f81f60626..7aaccd2ce 100755--- a/apps/mobile/html/Web.bundle/site/constants.js+++ b/apps/mobile/html/Web.bundle/site/constants.js@@ -170,14 +170,28 @@ function setTheme() {align-items: center;}- .tag:active {+ .newtag {+ background-color: ${pageTheme.colors.nav};+ border-radius: 100px;+ margin-right: 5px;+ padding-left: 12px !important;+ padding-right: 12px !important;+ font-size: 12px;+ height: 30px;+ display: flex;+ align-items: center;+ }++ .tag:active,+ .tag:focus,+ .pressed {background-color: ${pageTheme.colors.transGray} !important;border-width: 2px;}.alttagnew {- padding-left: 6px !important;- padding-right: 12px !important;+ padding-left: 12px !important;+ padding-right: 6px !important;}.alttagnew svg {padding-right:3px;@@ -189,7 +203,8 @@ function setTheme() {color:${pageTheme.colors.pri}}- .tag svg {+ .tag svg,+ .newtag svg {fill: ${pageTheme.colors.accent};width: 20px;height: 20px;diff --git a/apps/mobile/html/Web.bundle/site/index.css b/apps/mobile/html/Web.bundle/site/index.cssindex 3c5c75128..221e607c1 100644--- a/apps/mobile/html/Web.bundle/site/index.css+++ b/apps/mobile/html/Web.bundle/site/index.css@@ -75,3 +75,13 @@ body {.visible {display: inline-flex !important;}++.noselect {+ -webkit-touch-callout: none; /* iOS Safari */+ -webkit-user-select: none; /* Safari */+ -khtml-user-select: none; /* Konqueror HTML */+ -moz-user-select: none; /* Old versions of Firefox */+ -ms-user-select: none; /* Internet Explorer/Edge */+ user-select: none; /* Non-prefixed version, currently+ supported by Chrome, Edge, Opera and Firefox */+}diff --git a/apps/mobile/html/Web.bundle/site/index.html b/apps/mobile/html/Web.bundle/site/index.htmlindex 39e4740f4..74b85ef82 100644--- a/apps/mobile/html/Web.bundle/site/index.html+++ b/apps/mobile/html/Web.bundle/site/index.html@@ -13,14 +13,13 @@<div class="app-main"><input id="image-input" accept='image/png, image/gif, image/jpeg, image/bmp, image/x-icon' type="file"name="name" style="display: none;" />- <div class="tag-bar-parent hidden">- <div style="margin: 0px !important;margin-right:5px !important;" class="tag newtag">- <p class="newtagp" ></p>+ <div class="tag-bar-parent hidden noselect">+ <div style="margin: 0px !important;margin-right:5px !important;" class="newtag">+ <p class="newtagp noselect"></p><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"width="24" height="24" viewBox="0 0 24 24"><path d="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z" /></svg>-</div><div class="tag-bar"></div></div>@@ -29,8 +28,6 @@<input maxlength="150" id="titleInput" placeholder="Note title"></input></div>--<div class="info-bar"><div style="display:flex;"><p id="infowords"></p>@@ -57,19 +54,37 @@attachMessageListener()</script><script>- document.querySelector(".newtag").onclick = function () {- reactNativeEventHandler("newtag", "new");++ function pressHandler(tag, action) {+ let time = 0;+ document.querySelector(tag).ontouchstart = function (event) {+ event.preventDefault();+ time = Date.now();+ }+ document.querySelector(tag).ontouchmove = function (event) {+ event.preventDefault();+ }++ document.querySelector(tag).ontouchend = function (event) {+ event.preventDefault();+ let diff = Date.now() - time;+ if (diff < 300) {+ action();+ };+ }+}++ pressHandler('.newtag', function () {+ reactNativeEventHandler("newtag", "new");+ })+function clearNode(selector) {let node = document.querySelector(selector);if (node) {node.innerHTML = "";}}- function onClick(event) {- event.preventDefault();- reactNativeEventHandler("notetag", event.target.dataset.tag);- }function renderChildernInNode(data, parent, nodeName, classes) {if (data.length === 0) {@@ -80,7 +95,6 @@}} else {let stag = document.querySelector(".newtagp");-stag.innerText = "";if (stag.parentElement.classList.contains('alttagnew')) {stag.parentElement.classList.remove("alttagnew")@@ -96,7 +110,9 @@for (var i = 0; i < classes.length; i++) {childNode.classList.add(classes[i]);}- childNode.ontouchend = onClick;+ pressHandler(".tag", function () {+ reactNativeEventHandler("notetag", event.target.dataset.tag);+ })parentNode.appendChild(childNode);})}diff --git a/apps/mobile/src/views/Editor/useEditorTags.js b/apps/mobile/src/views/Editor/useEditorTags.jsindex 273591ff4..19d26618a 100644--- a/apps/mobile/src/views/Editor/useEditorTags.js+++ b/apps/mobile/src/views/Editor/useEditorTags.js@@ -62,7 +62,7 @@ export const useEditorTags = () => {clearNode(".tag-bar");toggleNode(".tag-bar-parent","show")let items = ${JSON.stringify(tags)};- renderChildernInNode(items, ".tag-bar", "div", ["tag"]);+ renderChildernInNode(items, ".tag-bar", "div", ["tag","noselect"]);})();`;return [];