fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Output formatting wip: keeping excessive white space at the end of text intact
[fnpeditor.git]
/
modules
/
documentCanvas
/
canvas
/
canvas.js
diff --git
a/modules/documentCanvas/canvas/canvas.js
b/modules/documentCanvas/canvas/canvas.js
index
079c229
..
b11432f
100644
(file)
--- a/
modules/documentCanvas/canvas/canvas.js
+++ b/
modules/documentCanvas/canvas/canvas.js
@@
-65,11
+65,11
@@
$.extend(Canvas.prototype, {
idx = parentContents.index(this),
next = idx < parentContents.length - 1 ? parentContents[idx+1] : null;
idx = parentContents.index(this),
next = idx < parentContents.length - 1 ? parentContents[idx+1] : null;
- var addInfo = function() {
+ var addInfo = function(
toAdd
) {
if(next) {
if(next) {
- $(next).data('orig-before',
oldText
);
+ $(next).data('orig-before',
toAdd
);
} else {
} else {
- parent.data('orig-append',
oldText
);
+ parent.data('orig-append',
toAdd
);
}
}
}
}
@@
-82,7
+82,12
@@
$.extend(Canvas.prototype, {
+ (endSpace && (spanParent || spanAfter) ? ' ' : '');
if(newText !== oldText) {
this.data = newText;
+ (endSpace && (spanParent || spanAfter) ? ' ' : '');
if(newText !== oldText) {
this.data = newText;
- addInfo();
+ if(endSpace) {
+ var toAdd = oldText.match(/\s+$/g)[0];
+ if(newText[newText.length - 1] === ' ' && toAdd[0] === ' ')
+ toAdd = toAdd.substr(1);
+ addInfo(toAdd);
+ }
}
} else {
}
} else {
@@
-90,7
+95,7
@@
$.extend(Canvas.prototype, {
if(this.data.length === 0 && oldLength > 0 && el.parent().contents().length === 1)
this.data = ' ';
if(this.data.length === 0) {
if(this.data.length === 0 && oldLength > 0 && el.parent().contents().length === 1)
this.data = ' ';
if(this.data.length === 0) {
- addInfo();
+ addInfo(
oldText
);
el.remove();
return true; // continue
el.remove();
return true; // continue