Skip to content

Commit

Permalink
feat: attributes for text to be entered soon (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
devlzl authored Jan 3, 2024
1 parent 3efb6fa commit 7b90e60
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Kernel/Store/TextStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export class TextStore {
let currentAtom = this._store[0]
for (let i = 1; i < this._store.length; i++) {
const atom = this._store[i]
if (atom.text.length === 0) {
continue
}
if (JSON.stringify(currentAtom.attributes) === JSON.stringify(atom.attributes)) {
currentAtom.text += atom.text
} else {
Expand Down Expand Up @@ -80,7 +83,10 @@ export class TextStore {
}
const a2 = {
text: newAtom.text,
attributes: { ...atom.attributes, ...newAtom.attributes },
attributes: {
...newAtom.attributes,
...(delta > 0 ? atom.attributes : this._store[i - 1]?.attributes),
},
}
const a3 = {
text: atom.text.slice(delta),
Expand Down

0 comments on commit 7b90e60

Please sign in to comment.