You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-29 22:48:10 +02:00
All: Fix handling of new line escaping when using external edit
This commit is contained in:
@@ -260,7 +260,13 @@ class BaseItem extends BaseModel {
|
||||
propValue = `${propValue}`;
|
||||
}
|
||||
|
||||
return propValue.replace(/\n/g, '\\n').replace(/\r/g, '\\r');
|
||||
if (propName === 'body') return propValue;
|
||||
|
||||
return propValue
|
||||
.replace(/\\n/g, '\\\\n')
|
||||
.replace(/\\r/g, '\\\\r')
|
||||
.replace(/\n/g, '\\n')
|
||||
.replace(/\r/g, '\\r');
|
||||
}
|
||||
|
||||
static unserialize_format(type, propName, propValue) {
|
||||
@@ -281,7 +287,14 @@ class BaseItem extends BaseModel {
|
||||
propValue = Database.formatValue(ItemClass.fieldType(propName), propValue);
|
||||
}
|
||||
|
||||
return typeof propValue === 'string' ? propValue.replace(/\\n/g, '\n').replace(/\\r/g, '\r') : propValue;
|
||||
if (propName === 'body') return propValue;
|
||||
|
||||
return typeof propValue === 'string' ? propValue
|
||||
.replace(/\\n/g, '\n')
|
||||
.replace(/\\r/g, '\r')
|
||||
.replace(/\\\n/g, '\\n')
|
||||
.replace(/\\\r/g, '\\r')
|
||||
: propValue;
|
||||
}
|
||||
|
||||
static async serialize(item, shownKeys = null) {
|
||||
|
||||
Reference in New Issue
Block a user