New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editing a note turns insignificant newlines into explicit line breaks #3304
Comments
Reported by |
Reported by |
Reported by |
Reported by
|
Reported by |
I have run into the same issues with automatic |
I have this problem as well. Not being able to edit a card from my phone without rendering it unreadable is a big pain. Anyone dealing with this would be a hero. |
I think the problem wont be solved until AnkiDroid supports HTML rendering when editing fields which would bring it inline with the desktop version. |
This is causing quite a lot of extra work to me as well, would be great to have this fixed. |
Same issue here. Updating a note in AnkiDroid inserts six additional The only way to see and fix these tags is to edit the card in the desktop client. |
It would indeed be great to "have this fixed" but no one has proposed a fix yet - we would welcome a fix for it https://github.com/ankidroid/Anki-Android/wiki/Contributing |
Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically |
shoo, shoo, stupid bot. still broken |
@MightyPork you might like the preview of the visual editor: #1377 (comment) |
Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically |
Oh my god! This bug is driving me crazy! |
@fireheart2008 we would love to see it fixed! Do you have a solution you could propose? |
Round 2 - let's add a preference. This should be viable now a user can add a custom toolbar button for |
Was this supposed to be fixed on 2.14? I'm still getting it on 2.15.4, in some situations, as I reported here. |
Have you tried the new preference mentioned here? #7692 |
I thought I had to have it on. I haven't read correctly, sorry. |
NINE YEAR PERSISTENT BUG! It's 2024 and I am still getting this bug in a HUGE way. Edited a note with a table, it generated a number of line breaks |
@david-allison, as the other user mentioned, this bug still persists. Turning off the option added in #7692 may solve it. But, this is not a good solution for most people because this would be moving a step away from a WYSIWYG editor (because all the <br> tags are visible). Also, I think that the title of the preference is misleading. I think that it should be "Replace HTML with newlines" because it replaces <br> tags with newlines when enabled. Example:AnkiDroid: (displays incorrectly) After syncing to Desktop without making any edit to the note on AnkiDroid, no change happens in the HTML. The linebreak in the HTML gets replaced by a <br> tag. Turning off the option added in #7692 solves the issue in the sense that the HTML is no longer altered after editing the card in AnkiDroid. However, the card still displays incorrectly on AnkiDroid (same as the second image above). Also, as mentioned above, it is a suboptimal solution because it takes the note editor one step away from a WYSIWYG editor. |
This comment was marked as resolved.
This comment was marked as resolved.
I think I have encountered the same bug - or more like logic issue - and reported it on the Anki forum at: https://forums.ankiweb.net/t/bug-report-newlines-duplicated-within-fields/40884 Newlines input into AnkiDroid fields are being converted to
Specifically in the function For reference, the code is: /**
* @param replaceNewlines Converts [FieldEditText.NEW_LINE] to HTML linebreaks
*/
@VisibleForTesting
@CheckResult
fun getFieldsAsBundleForPreview(editFields: List<NoteField?>?, replaceNewlines: Boolean): Bundle {
val fields = Bundle()
// Save the content of all the note fields. We use the field's ord as the key to
// easily map the fields correctly later.
if (editFields == null) {
return fields
}
for (e in editFields) {
if (e?.fieldText == null) {
continue
}
val fieldValue = convertToHtmlNewline(e.fieldText!!, replaceNewlines)
fields.putString(e.ord.toString(), fieldValue)
}
return fields
}
fun convertToHtmlNewline(fieldData: String, replaceNewlines: Boolean): String {
return if (!replaceNewlines) {
fieldData
} else {
fieldData.replace(FieldEditText.NEW_LINE, "<br>")
}
} This is being called from:
The code is: private fun shouldReplaceNewlines(): Boolean {
return AnkiDroidApp.instance.sharedPrefs()
.getBoolean(PREF_NOTE_EDITOR_NEWLINE_REPLACE, true)
} Looking through the interface, I found this option buried under:
The text of this option is:
Turing this off fixes the problem! But the logic seems reversed, as newlines are instead being converted to As a solution, could this option please be turned off by default? Having this option on by defaut is frighteningly confusing. And maybe the text of the option clarified by changing to:
|
Originally reported on Google Code with ID 2408
Reported by
post@johannesrohrer.de
on 2014-11-17 11:56:10The text was updated successfully, but these errors were encountered: