mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
add word count
This commit is contained in:
@@ -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={() => {
|
||||
|
||||
@@ -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,6 +49,20 @@ export default class InfoBar extends React.Component {
|
||||
paddingLeft: this.props.noMenu ? 12 : 12 + 50,
|
||||
zIndex: 999,
|
||||
}}>
|
||||
{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));
|
||||
@@ -58,8 +73,9 @@ export default class InfoBar extends React.Component {
|
||||
textAlignVertical: 'center',
|
||||
fontFamily: WEIGHT.regular,
|
||||
}}>
|
||||
{timeConverter(this.state.dateEdited)}
|
||||
{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
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user