Skip to content

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

add word count

ammarahm-eda8f8c7666378
diff --git a/apps/mobile/src/components/SimpleList/index.js b/apps/mobile/src/components/SimpleList/index.js
index 1fea04b2e..c2d900d10 100644
--- a/apps/mobile/src/components/SimpleList/index.js
+++ b/apps/mobile/src/components/SimpleList/index.js
@@ -100,7 +100,7 @@ const SimpleList = ({
color: colors.accent,
fontSize: SIZE.xs,
}}>
- Search Results for {searchResults.keyword}
+ Showing Results for {searchResults.keyword}
</Text>
<Text
onPress={() => {
diff --git a/apps/mobile/src/views/Editor/InfoBar.js b/apps/mobile/src/views/Editor/InfoBar.js
index 09ab81086..598006fd1 100644
--- a/apps/mobile/src/views/Editor/InfoBar.js
+++ b/apps/mobile/src/views/Editor/InfoBar.js
@@ -11,14 +11,15 @@ export default class InfoBar extends React.Component {
this.state = {
dateEdited: null,
saving: false,
+ length: 0,
};
this.dateCreated = null;
}
- setDateEdited(id) {
- console.log(id);
+ setDateEdited(id, length) {
this.setState(
{
saving: true,
+ length: length,
},
() => {
setTimeout(() => {
@@ -48,18 +49,33 @@ export default class InfoBar extends React.Component {
paddingLeft: this.props.noMenu ? 12 : 12 + 50,
zIndex: 999,
}}>
- <Text
- onPress={() => {
- simpleDialogEvent(TEMPLATE_INFO(this.dateCreated));
- }}
- style={{
- color: this.props.colors.icon,
- fontSize: SIZE.xxs,
- textAlignVertical: 'center',
- fontFamily: WEIGHT.regular,
- }}>
- {timeConverter(this.state.dateEdited)}
- </Text>
+ {this.state.length ? (
+ <Text
+ style={{
+ color: this.props.colors.icon,
+ fontSize: SIZE.xxs,
+ textAlignVertical: 'center',
+ fontFamily: WEIGHT.regular,
+ marginRight: 5,
+ }}>
+ {this.state.length + ' words •'}
+ </Text>
+ ) : null}
+
+ {this.state.dateEdited ? (
+ <Text
+ onPress={() => {
+ simpleDialogEvent(TEMPLATE_INFO(this.dateCreated));
+ }}
+ style={{
+ color: this.props.colors.icon,
+ fontSize: SIZE.xxs,
+ textAlignVertical: 'center',
+ fontFamily: WEIGHT.regular,
+ }}>
+ {timeConverter(this.state.dateEdited)} •
+ </Text>
+ ) : null}
<View
style={{
@@ -69,9 +85,9 @@ export default class InfoBar extends React.Component {
}}>
{this.state.saving ? (
<ActivityIndicator
- style={{width: 16, height: 16, marginLeft: 10}}
+ style={{width: 14, height: 14, marginLeft: 10}}
color="white"
- size={16}
+ size={14}
/>
) : null}
<Text
diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.js
index acc857768..02e57acb1 100755
--- a/apps/mobile/src/views/Editor/index.js
+++ b/apps/mobile/src/views/Editor/index.js
@@ -312,7 +312,10 @@ const Editor = ({noMenu}) => {
eSendEvent(refreshNotesPage);
}
- InfoBarRef.current?.setDateEdited(db.notes.note(id).data.dateEdited);
+ InfoBarRef.current?.setDateEdited(
+ db.notes.note(id).data.dateEdited,
+ content?.text?.split(' ').length,
+ );
InfoBarRef.current?.setDateCreated(db.notes.note(id).data.dateCreated);
saveCounter++;
@@ -332,7 +335,10 @@ const Editor = ({noMenu}) => {
id: id,
});
}
- InfoBarRef.current?.setDateEdited(db.notes.note(id).data.dateEdited);
+ InfoBarRef.current?.setDateEdited(
+ db.notes.note(id).data.dateEdited,
+ content?.text?.split(' ').length,
+ );
InfoBarRef.current?.setDateCreated(db.notes.note(id).data.dateCreated);
}
};
@@ -382,10 +388,12 @@ const Editor = ({noMenu}) => {
const updateEditor = async () => {
title = note.title;
id = note.id;
- InfoBarRef.current?.setDateEdited(note.dateEdited);
- InfoBarRef.current?.setDateCreated(note.dateCreated);
+
content = {...note.content};
saveCounter = 0;
+ InfoBarRef.current?.setDateCreated(note.dateCreated);
+ let text = await db.notes.note(id).text();
+ InfoBarRef.current?.setDateEdited(note.dateEdited, text.split(' ').length);
if (title !== null || title === '') {
post({