mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-11 07:13:09 +00:00
Update textbox_behavior.mixin.js
This commit is contained in:
parent
c943d369a2
commit
49b876a704
1 changed files with 1 additions and 36 deletions
|
|
@ -142,42 +142,7 @@
|
|||
map = this._styleMap[cursorLocation.lineIndex],
|
||||
lineIndex = map.line,
|
||||
charIndex = map.offset + cursorLocation.charIndex;
|
||||
|
||||
if (isBeginningOfLine) {
|
||||
var textOnPreviousLine = this._getTextOnPreviousLine(cursorLocation.lineIndex),
|
||||
newCharIndexOnPrevLine = textOnPreviousLine ? textOnPreviousLine.length : 0;
|
||||
|
||||
if (!this.styles[lineIndex - 1]) {
|
||||
this.styles[lineIndex - 1] = {};
|
||||
}
|
||||
|
||||
for (charIndex in this.styles[lineIndex]) {
|
||||
this.styles[lineIndex - 1][parseInt(charIndex, 10) + newCharIndexOnPrevLine]
|
||||
= this.styles[lineIndex][charIndex];
|
||||
}
|
||||
|
||||
this.shiftLineStyles(cursorLocation.lineIndex, -1);
|
||||
|
||||
}
|
||||
else {
|
||||
var currentLineStyles = this.styles[lineIndex];
|
||||
|
||||
if (currentLineStyles) {
|
||||
delete currentLineStyles[charIndex];
|
||||
//console.log('deleting', lineIndex, charIndex + offset);
|
||||
}
|
||||
|
||||
var currentLineStylesCloned = clone(currentLineStyles);
|
||||
|
||||
// shift all styles by 1 backwards
|
||||
for (var i in currentLineStylesCloned) {
|
||||
var numericIndex = parseInt(i, 10);
|
||||
if (numericIndex >= charIndex && numericIndex !== 0) {
|
||||
currentLineStyles[numericIndex - 1] = currentLineStylesCloned[numericIndex];
|
||||
delete currentLineStyles[numericIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
this._removeStyleObject(isBeginningOfLine, cursorLocation, lineIndex, charIndex);
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
|
|
|||
Loading…
Reference in a new issue