Hi, I’m new to prosemirror, I want to understand the way it works, and sometimes it makes me mad. I’m trying to handle transactions and sometimes steps produced are very strange. Two examples:
Using backspace in editor to delete text in most cases produces step like this:
{
from: 99,
to: 100,
slice: {
size: 0,
content: {
content: [],
size: 0,
}
}
}
but pressing Backspace when the caret is placed on the left position of a marked text with SPACE character at the beginning the step would be:
{
from: 99,
to: 112,
slice: {
size: 12,
content: {
content: [
{
"type": "text",
"text": " marked text"
}
],
size: 12,
}
}
}
why? I just delete a character on the left of the marked.
Another example is more crazy. I have a mark at position: [50, 55], and a mark at position [100, 105]. When I select a text from 100 to 106 (should be a bit more than the range of a mark) and press a key to insert any character, for example “a”, I expect the text [100,106] to be deleted and “a” character to be inserted, it is ok. But the step has this:
{
from: 50,
to: 106,
content: {
content: [
{
marks: [Mark],
text: "mark1"
},
{
marks: [],
text: "text between two marks"
},
{
marks: [Mark, Mark], // two marks
text: "a" // inserted text
}
],
size: 56,
}
}
just why? I have selected only the second mark, why step has the first mark and the text between marks?