|
|
|
@ -173,9 +173,15 @@ class Document { |
|
|
|
|
for (int i = 0; i < ops.length; i++) { |
|
|
|
|
Operation op = ops[i]; |
|
|
|
|
res.push(op); |
|
|
|
|
bool nextOpIsImage = i + 1 < ops.length && |
|
|
|
|
ops[i + 1].isInsert && |
|
|
|
|
ops[i + 1].data is! String; |
|
|
|
|
_handleImageInsert(i, ops, op, res); |
|
|
|
|
} |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void _handleImageInsert( |
|
|
|
|
int i, List<Operation> ops, Operation op, Delta res) { |
|
|
|
|
bool nextOpIsImage = |
|
|
|
|
i + 1 < ops.length && ops[i + 1].isInsert && ops[i + 1].data is! String; |
|
|
|
|
if (nextOpIsImage && !(op.data as String).endsWith('\n')) { |
|
|
|
|
res.push(Operation.insert('\n', null)); |
|
|
|
|
} |
|
|
|
@ -190,8 +196,6 @@ class Document { |
|
|
|
|
res.push(Operation.insert('\n', null)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Object _normalize(Object data) { |
|
|
|
|
if (data is String) { |
|
|
|
|