Skip to content

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

fix note conflict editor

ammarahm-edd32f1972fe3a
diff --git a/apps/mobile/android/app/src/main/assets/listeners.js b/apps/mobile/android/app/src/main/assets/listeners.js
index c71c0241b..d5f268431 100644
--- a/apps/mobile/android/app/src/main/assets/listeners.js
+++ b/apps/mobile/android/app/src/main/assets/listeners.js
@@ -141,7 +141,7 @@ function attachEditorListeners() {
break;
case 'dateEdited':
linfo = document.querySelector(infoBar);
- info.querySelector('#infodate').innerText = value + ' - ';
+ info.querySelector('#infodate').innerText = value;
break;
case 'saving':
info = document.querySelector(infoBar);
@@ -153,7 +153,7 @@ function attachEditorListeners() {
setTimeout(() => {
info = document.querySelector(infoBar);
info.querySelector('#infowords').innerText =
- editor.getText().split(' ').length + ' words - ';
+ editor.getText().split(' ').length + ' words';
info.querySelector('#infosaved').innerText = 'Saved';
}, 100);
@@ -201,7 +201,7 @@ function attachEditorListeners() {
setTimeout(() => {
info = document.querySelector(infoBar);
info.querySelector('#infowords').innerText =
- editor.getText().split(' ').length + ' words - ';
+ editor.getText().split(' ').length + ' words';
info.querySelector('#infosaved').innerText = 'Saved';
document.body.scrollTop = 0; // For Safari
@@ -264,7 +264,7 @@ function attachEditorListeners() {
info = document.querySelector(infoBar);
let infowords = info.querySelector('#infowords');
if (infowords) {
- infowords.innerText = editor.getText().split(' ').length + ' words - ';
+ infowords.innerText = editor.getText().split(' ').length + ' words';
}
if (deltaTimeout) {
@@ -368,7 +368,7 @@ function attachMessageListener() {
setTimeout(() => {
info = document.querySelector(infoBar);
info.querySelector('#infowords').innerText =
- editor.getText().split(' ').length + ' words - ';
+ editor.getText().split(' ').length + ' words';
info.querySelector('#infosaved').innerText = 'Saved';
}, 100);
@@ -416,10 +416,10 @@ function attachMessageListener() {
setTimeout(() => {
info = document.querySelector(infoBar);
info.querySelector('#infowords').innerText =
- editor.getText().split(' ').length + ' words - ';
+ editor.getText().split(' ').length + ' words';
info.querySelector('#infosaved').innerText = 'Saved';
- document.body.scrollTop = 0; // For Safari
+ document.body.scrollTop = 0; // For Safari
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
}, 100);
autosize();
diff --git a/apps/mobile/android/app/src/main/assets/plaineditor.html b/apps/mobile/android/app/src/main/assets/plaineditor.html
index 19c6dd708..a351a42d9 100644
--- a/apps/mobile/android/app/src/main/assets/plaineditor.html
+++ b/apps/mobile/android/app/src/main/assets/plaineditor.html
@@ -35,7 +35,7 @@
<script src="image-resize.min.js"></script>
<script>
- let editor;
+ attachMessageListener()
function loadAction() {
setFonts();
Quill.register("modules/imageCompressor", imageCompressor);
@@ -55,20 +55,21 @@
},
imageResize: {
displaySize: true,
- }
+ },
+ magicUrl: true
},
- placeholder: ' ',
+ placeholder: 'Type something here',
});
let Font = Quill.import('formats/font');
Font.whitelist = fontNames;
Quill.register(Font, true);
- addLinkMatcher();
setTheme();
attachEditorListeners();
}
loadAction();
+
</script>
diff --git a/apps/mobile/android/app/src/main/assets/styles.css b/apps/mobile/android/app/src/main/assets/styles.css
index bee7f3821..e7757ce07 100644
--- a/apps/mobile/android/app/src/main/assets/styles.css
+++ b/apps/mobile/android/app/src/main/assets/styles.css
@@ -1138,16 +1138,24 @@
#infowords {
margin-right: 5px;
margin-left: 0px;
+ border-radius: 5;
+ background-color: #a9a9a9;
}
#infodate {
margin-right: 5px;
margin-left: 5px;
+
+ border-radius: 5;
+ background-color: #a9a9a9;
}
#infosaved {
margin-right: 5px;
margin-left: 5px;
+
+ border-radius: 5;
+ background-color: #a9a9a9;
}
.app-body {
diff --git a/apps/mobile/html/Web.bundle/site/listeners.js b/apps/mobile/html/Web.bundle/site/listeners.js
index 83754ce76..2c478ec72 100644
--- a/apps/mobile/html/Web.bundle/site/listeners.js
+++ b/apps/mobile/html/Web.bundle/site/listeners.js
@@ -132,7 +132,7 @@ function attachEditorListeners() {
let infowords = info.querySelector('#infowords');
if (infowords) {
infowords.innerText =
- editor.getText().split(' ').length + ' words - ';
+ editor.getText().split(' ').length + ' words';
}
if (deltaTimeout) {
@@ -223,7 +223,7 @@ function attachMessageListener() {
break;
case 'dateEdited':
linfo = document.querySelector(infoBar);
- info.querySelector('#infodate').innerText = value + " - ";
+ info.querySelector('#infodate').innerText = value;
break;
case 'saving':
info = document.querySelector(infoBar);
@@ -235,7 +235,7 @@ function attachMessageListener() {
setTimeout(() => {
info = document.querySelector(infoBar);
info.querySelector('#infowords').innerText =
- editor.getText().split(' ').length + ' words - ';
+ editor.getText().split(' ').length + ' words';
info.querySelector('#infosaved').innerText = 'Saved';
}, 100);
@@ -283,7 +283,7 @@ function attachMessageListener() {
setTimeout(() => {
info = document.querySelector(infoBar);
info.querySelector('#infowords').innerText =
- editor.getText().split(' ').length + ' words - ';
+ editor.getText().split(' ').length + ' words';
info.querySelector('#infosaved').innerText = 'Saved';
document.body.scrollTop = 0; // For Safari
diff --git a/apps/mobile/html/Web.bundle/site/plaineditor.html b/apps/mobile/html/Web.bundle/site/plaineditor.html
index 9c81bf924..288216e2e 100644
--- a/apps/mobile/html/Web.bundle/site/plaineditor.html
+++ b/apps/mobile/html/Web.bundle/site/plaineditor.html
@@ -25,15 +25,14 @@
<script>
let editor;
let isTablet = false;
- </script>
+</script>
<script src="quill.js"></script>
<script src="constants.js"></script>
<script src="module.js"></script>
<script src="magic-url.js"></script>
<script src="listeners.js"></script>
-<script src="image-resize.min.js"></script>
+<script src="image-resize.min.js"></script>
<script>
- let editor;
attachMessageListener();
function loadAction() {
@@ -56,9 +55,10 @@
},
imageResize: {
displaySize: true,
- }
+ },
+ magicUrl: true
},
- placeholder: ' ',
+ placeholder: 'Type something here',
});
let Font = Quill.import('formats/font');
@@ -66,10 +66,10 @@
Quill.register(Font, true);
addLinkMatcher();
- attachTitleInputListeners();
setTheme();
attachEditorListeners();
}
+ loadAction();
</script>
diff --git a/apps/mobile/src/components/MergeEditor/index.js b/apps/mobile/src/components/MergeEditor/index.js
index 1155dfe94..f564777f8 100644
--- a/apps/mobile/src/components/MergeEditor/index.js
+++ b/apps/mobile/src/components/MergeEditor/index.js
@@ -209,12 +209,12 @@ const MergeEditor = () => {
const show = async (item) => {
note = item;
- db.content;
let noteData = await db.content.raw(note.contentId);
+
switch (noteData.type) {
case 'delta':
primaryData = noteData;
- secondaryData = noteData;
+ secondaryData = noteData.conflicted;
}
setVisible(true);
firstWebViewHeight.setValue(dHeight / 2 - (50 + insets.top / 2));
diff --git a/apps/mobile/src/components/SelectionWrapper/index.js b/apps/mobile/src/components/SelectionWrapper/index.js
index 42bfb4d03..6b77bcdf1 100644
--- a/apps/mobile/src/components/SelectionWrapper/index.js
+++ b/apps/mobile/src/components/SelectionWrapper/index.js
@@ -80,7 +80,7 @@ const SelectionWrapper = ({
onPress={onPress}
customSelectedColor={currentEditingNote === item.id ? colors.accent : colors.nav}
customAlpha={!colors.night ? -0.02 : 0.02}
- customOpacity={currentEditingNote ? 0.15 : 1}
+ customOpacity={currentEditingNote === item.id ? 0.15 : 1}
customStyle={{
flexDirection: 'row',
justifyContent: 'space-between',
diff --git a/apps/mobile/src/components/SimpleList/NoteItemWrapper.js b/apps/mobile/src/components/SimpleList/NoteItemWrapper.js
index 1907db494..88066c81a 100644
--- a/apps/mobile/src/components/SimpleList/NoteItemWrapper.js
+++ b/apps/mobile/src/components/SimpleList/NoteItemWrapper.js
@@ -60,11 +60,13 @@ export const NoteItemWrapper = ({item, index, isTrash = false}) => {
dispatch({type: Actions.SELECTED_ITEMS, item: note});
};
- const onPress = async (event) => {
+ const onPress = async () => {
+
if (note.conflicted) {
eSendEvent(eShowMergeDialog, note);
return;
}
+
if (selectionMode) {
onLongPress();
return;
diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.js
index 18a81b2f0..9a87c5878 100644
--- a/apps/mobile/src/views/Editor/Functions.js
+++ b/apps/mobile/src/views/Editor/Functions.js
@@ -440,7 +440,6 @@ export let isFromIntent = false;
const loadNoteInEditor = async () => {
saveCounter = 0;
if (intent) {
- console.log("POSTING DELTA")
await sleep(1500);
post('delta', content.data);
intent = true;
@@ -448,9 +447,10 @@ const loadNoteInEditor = async () => {
} else if (note?.id) {
post('title', title);
intent = false;
- post('dateEdited', timeConverter(note.dateEdited));
setColors();
post('delta', content.data);
+ await sleep(100);
+ post('dateEdited', timeConverter(note.dateEdited));
}
await sleep(50);
post('clearHistory');