(I may have already reported this — if so, forgive the duplication.)
When I edit an RTF doc in DT to Go, it will occasionally lose all formatting (click edit, and the file opens with no formatting). This happens when the file ends on a character other than a line return. When the last line is an empty line return, the file retains its formatting.
This is repeatable:
create a new RTF in DT3, and end the doc on a character other than a line return (e.g. so the final position of the cursor is at the end of a word)
Save the file and sync DT3
open that file in DT2Go, and click edit: formatting will be lost. Close without making a change
return to DT3, open the file, and add an empty line return (hit return a couple times)
Save the file and sync DT3
open that file in DT2Go, and click edit: formatting is retained
If I add an open that file in DT3, add an empty line to the end of the doc, sync it, and
Yes, this is known. RTFs are not mobile-native and the third=party frameworks we employ have some issues. We are investigating better options for DEVONthink To Go 3. Thanks for your patience and understanding.
This is very annoying because it makes editing in DT2G always a “scary” thing to do, as it often loses its format. And I have to say that my primary use of DT resides into a vast collection of RTFs docs, for everything.
I hope this issue is taken into consideration soon.
Otherwise (not as a solution, but as general knowledge), if RTFs are not mobile-native, what’s the best format to use when you want to alternate between desktop and mobile?
It depends, but formatted notes are useful to many (though there is a size restriction of about 10MB due to iOS memory constraints).
Plain text is always a good option, as is Markdown.
Was thinking about a potential workaround. Since RTFs that end with a return character do not lose formatting, we could create a smart rule that triggers before syncing, scans all RTFs modified that day, and if the file does not end in a return character, add one (or two). Like this:
Once is usually enough, a habit I trained myself many years ago to do when editing text files.
Without a newline at the end, it implies to me that new text will be appended to the current line at the end and that’s not normally how I want it to behave.
Whoops - the script for my smart rule was wrong — it was just working on the open document, and I need to make it run on each matching document. So here’s the new setup:
And the script is:
on performSmartRule(theRecords)
tell application id "DNtp"
repeat with theRecord in theRecords
set alltext to plain text of theRecord
set lastchar to text -1 of alltext
if lastchar is not (ASCII character 10) and lastchar is not (ASCII character 13) then
tell text of theRecord
make new paragraph at end with data return & return & return & return
end tell
set logthis to 1
end if
end repeat
end tell
if logthis = 1 then
log message "Log Smart Rule: fix RTFs for iOS" info "triggered at: " & ((current date) as string)
end if
end performSmartRule
This smart rule will check every recently edited RTF document, and if it doesn’t end in a return or new-line, it adds several returns (several because I like having the extra space) before synchronizing. So when you then edit that file in DT2Go, it does not lose its formatting.
Seems to be working well on my side. Let me know if you find a bug.
Strangely, using text of is returning an invalid value. This may be a cached value from the index of the database but @cgrunenberg would have to confirm or deny this.
I’ve added a condition so it doesn’t look at files modified in the last hour. I was typing into an RTF file when the sync ran and the Smart Rule deleted the last few words and added 2 returns.
I tried using “Before Saving” as the trigger — sounds like it would be the right one to use, no? — but was getting strange results: sometimes it would work, then other times it would lose the last edit I made, and the script would seemingly run multiple times (e.g. adding 15 returns to the end).
Your approach is safer since it avoids messing with any active documents.