Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix attachment item ui in merge conflicts editor

ammarahm-ed4721b180a159
diff --git a/apps/mobile/android/app/src/main/assets/plaineditor.html b/apps/mobile/android/app/src/main/assets/plaineditor.html
index fb1d9d434..356bbc7b3 100644
--- a/apps/mobile/android/app/src/main/assets/plaineditor.html
+++ b/apps/mobile/android/app/src/main/assets/plaineditor.html
@@ -4,7 +4,7 @@
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8" />
- <title>Note Diff Preview</title>
+ <title>Note Preview</title>
<link rel="stylesheet" href="./index.css">
<link rel="stylesheet" href="./fonts.css">
<link id="dark_sheet" disabled rel="stylesheet" href="./dist/skins/notesnook-dark/content.min.css">
@@ -96,6 +96,92 @@
color: gray;
/* For Firefox */
}
+
+ span.attachment {
+ overflow: hidden;
+ position: relative;
+ z-index: 1;
+ user-select: none;
+ display: inline-flex;
+ align-items: center;
+ background-color: #f0f0f0;
+ padding: 0px 5px 0px 22px;
+ border-radius: 3px;
+ border: 1px solid var(--border);
+ font-size: 0.85rem;
+ cursor: pointer !important;
+ word-break: break-all;
+ max-width: 250px;
+ }
+
+ span.attachment .filename {
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ }
+
+ span.attachment:not([data-progress])::after {
+ content: attr(data-size);
+ color: gray;
+ margin-left: 5px;
+ font-size: 0.7rem;
+ white-space: nowrap;
+ }
+
+ span.attachment[data-progress]::after {
+ content: attr(data-progress);
+ color: gray;
+ margin-left: 5px;
+ font-size: 0.7rem;
+ white-space: nowrap;
+ }
+
+ span.attachment::before {
+ display: inline-block;
+ z-index: -1;
+ position: absolute;
+ top: 0;
+ left: 0;
+ content: "";
+ width: var(--progress, 0px);
+ height: 100%;
+ transition: width 100ms ease-in;
+ background-size: 15px 15px;
+ background-repeat: no-repeat;
+ background-position: 5px 1.5px;
+ background-color: var(--border);
+ }
+
+ span.attachment em::before {
+ content: "";
+ position: absolute;
+ width: 15px;
+ height: 15px;
+ left: 5px;
+ top: 1.5px;
+ background-color: #000000;
+ -webkit-mask-size: 15px 15px;
+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M7.5,18A5.5,5.5 0 0,1 2,12.5A5.5,5.5 0 0,1 7.5,7H18A4,4 0 0,1 22,11A4,4 0 0,1 18,15H9.5A2.5,2.5 0 0,1 7,12.5A2.5,2.5 0 0,1 9.5,10H17V11.5H9.5A1,1 0 0,0 8.5,12.5A1,1 0 0,0 9.5,13.5H18A2.5,2.5 0 0,0 20.5,11A2.5,2.5 0 0,0 18,8.5H7.5A4,4 0 0,0 3.5,12.5A4,4 0 0,0 7.5,16.5H17V18H7.5Z'%3E%3C/path%3E%3C/svg%3E");
+ mask-size: 15px 15px;
+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M7.5,18A5.5,5.5 0 0,1 2,12.5A5.5,5.5 0 0,1 7.5,7H18A4,4 0 0,1 22,11A4,4 0 0,1 18,15H9.5A2.5,2.5 0 0,1 7,12.5A2.5,2.5 0 0,1 9.5,10H17V11.5H9.5A1,1 0 0,0 8.5,12.5A1,1 0 0,0 9.5,13.5H18A2.5,2.5 0 0,0 20.5,11A2.5,2.5 0 0,0 18,8.5H7.5A4,4 0 0,0 3.5,12.5A4,4 0 0,0 7.5,16.5H17V18H7.5Z'%3E%3C/path%3E%3C/svg%3E");
+ }
+
+ .mce-content-body code[data-mce-selected="inline-boundary"] {
+ background-color: #f0f0f0 !important;
+ }
+
+ .mce-content-body code {
+ background-color: #f0f0f0 !important;
+ border: 1px solid var(--border);
+ border-radius: 5px;
+ padding: 3px 5px 0px 5px;
+ }
+
+ code {
+ font-family: ui-monospace, SFMono-Regular, SF Mono, Consolas, Liberation Mono,
+ Menlo, monospace !important;
+ font-size: 10pt !important
+ }
</style>
</head>
@@ -106,6 +192,9 @@
<script src="./listeners.js"></script>
<script src="./constants.js"></script>
<script>
+ if (window.location.href.includes("nocontenteditable")) {
+ document.querySelector(".htmldiff_div").setAttribute("contenteditable","false");
+ }
function reactNativeEventHandler(type, value) {
if (window.ReactNativeWebView) {
window.ReactNativeWebView.postMessage(
diff --git a/apps/mobile/html/Web.bundle/site/plaineditor.html b/apps/mobile/html/Web.bundle/site/plaineditor.html
index fb1d9d434..356bbc7b3 100644
--- a/apps/mobile/html/Web.bundle/site/plaineditor.html
+++ b/apps/mobile/html/Web.bundle/site/plaineditor.html
@@ -4,7 +4,7 @@
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8" />
- <title>Note Diff Preview</title>
+ <title>Note Preview</title>
<link rel="stylesheet" href="./index.css">
<link rel="stylesheet" href="./fonts.css">
<link id="dark_sheet" disabled rel="stylesheet" href="./dist/skins/notesnook-dark/content.min.css">
@@ -96,6 +96,92 @@
color: gray;
/* For Firefox */
}
+
+ span.attachment {
+ overflow: hidden;
+ position: relative;
+ z-index: 1;
+ user-select: none;
+ display: inline-flex;
+ align-items: center;
+ background-color: #f0f0f0;
+ padding: 0px 5px 0px 22px;
+ border-radius: 3px;
+ border: 1px solid var(--border);
+ font-size: 0.85rem;
+ cursor: pointer !important;
+ word-break: break-all;
+ max-width: 250px;
+ }
+
+ span.attachment .filename {
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ }
+
+ span.attachment:not([data-progress])::after {
+ content: attr(data-size);
+ color: gray;
+ margin-left: 5px;
+ font-size: 0.7rem;
+ white-space: nowrap;
+ }
+
+ span.attachment[data-progress]::after {
+ content: attr(data-progress);
+ color: gray;
+ margin-left: 5px;
+ font-size: 0.7rem;
+ white-space: nowrap;
+ }
+
+ span.attachment::before {
+ display: inline-block;
+ z-index: -1;
+ position: absolute;
+ top: 0;
+ left: 0;
+ content: "";
+ width: var(--progress, 0px);
+ height: 100%;
+ transition: width 100ms ease-in;
+ background-size: 15px 15px;
+ background-repeat: no-repeat;
+ background-position: 5px 1.5px;
+ background-color: var(--border);
+ }
+
+ span.attachment em::before {
+ content: "";
+ position: absolute;
+ width: 15px;
+ height: 15px;
+ left: 5px;
+ top: 1.5px;
+ background-color: #000000;
+ -webkit-mask-size: 15px 15px;
+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M7.5,18A5.5,5.5 0 0,1 2,12.5A5.5,5.5 0 0,1 7.5,7H18A4,4 0 0,1 22,11A4,4 0 0,1 18,15H9.5A2.5,2.5 0 0,1 7,12.5A2.5,2.5 0 0,1 9.5,10H17V11.5H9.5A1,1 0 0,0 8.5,12.5A1,1 0 0,0 9.5,13.5H18A2.5,2.5 0 0,0 20.5,11A2.5,2.5 0 0,0 18,8.5H7.5A4,4 0 0,0 3.5,12.5A4,4 0 0,0 7.5,16.5H17V18H7.5Z'%3E%3C/path%3E%3C/svg%3E");
+ mask-size: 15px 15px;
+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M7.5,18A5.5,5.5 0 0,1 2,12.5A5.5,5.5 0 0,1 7.5,7H18A4,4 0 0,1 22,11A4,4 0 0,1 18,15H9.5A2.5,2.5 0 0,1 7,12.5A2.5,2.5 0 0,1 9.5,10H17V11.5H9.5A1,1 0 0,0 8.5,12.5A1,1 0 0,0 9.5,13.5H18A2.5,2.5 0 0,0 20.5,11A2.5,2.5 0 0,0 18,8.5H7.5A4,4 0 0,0 3.5,12.5A4,4 0 0,0 7.5,16.5H17V18H7.5Z'%3E%3C/path%3E%3C/svg%3E");
+ }
+
+ .mce-content-body code[data-mce-selected="inline-boundary"] {
+ background-color: #f0f0f0 !important;
+ }
+
+ .mce-content-body code {
+ background-color: #f0f0f0 !important;
+ border: 1px solid var(--border);
+ border-radius: 5px;
+ padding: 3px 5px 0px 5px;
+ }
+
+ code {
+ font-family: ui-monospace, SFMono-Regular, SF Mono, Consolas, Liberation Mono,
+ Menlo, monospace !important;
+ font-size: 10pt !important
+ }
</style>
</head>
@@ -106,6 +192,9 @@
<script src="./listeners.js"></script>
<script src="./constants.js"></script>
<script>
+ if (window.location.href.includes("nocontenteditable")) {
+ document.querySelector(".htmldiff_div").setAttribute("contenteditable","false");
+ }
function reactNativeEventHandler(type, value) {
if (window.ReactNativeWebView) {
window.ReactNativeWebView.postMessage(
diff --git a/apps/mobile/src/components/MergeEditor/index.js b/apps/mobile/src/components/MergeEditor/index.js
index ab8f4ea58..0d7432d70 100644
--- a/apps/mobile/src/components/MergeEditor/index.js
+++ b/apps/mobile/src/components/MergeEditor/index.js
@@ -422,7 +422,7 @@ const MergeEditor = () => {
javaScriptEnabled={true}
cacheEnabled={true}
source={{
- uri: sourceUri + 'plaineditor.html'
+ uri: sourceUri + 'plaineditor.html?nocontenteditable=true'
}}
/>
</Animated.View>
@@ -554,7 +554,7 @@ const MergeEditor = () => {
javaScriptEnabled={true}
cacheEnabled={true}
source={{
- uri: sourceUri + 'plaineditor.html'
+ uri: sourceUri + 'plaineditor.html?nocontenteditable=true'
}}
/>
</Animated.View>