I have a ckeditor5 custom plugin and I have to convert markers to data for saving into the database.
This is the model: X[Y]Z
The marker name is "my-highlight:1"
This is what I would like to have:
X<my-highlight-start name="1"></my-highlight-start><span class="my-highlight">Y</span><my-highlight-end name="1"></mű-highlight-end>Z
So I need both start/end tags at the beginning and at the end of the marker range and also spans around the text nodes.
What I can do:
X<my-highlight-start name="1"></my-highlight-start>Y<my-highlight-end name="1"></my-highlight-end>Z
or
X<span class="my-highlight">Y</span><Z
But not both at the same time.
I need spans because I have to highlight the text in browsers and I need start/end tags because highlights can be overlapped and user can add remarks for the highlights.
So my output after processing will be like this:
X(1)Y(1)Z
- User remark for Y
For overlapping cases:
X(1)(2)AB(2)C(3)D(1)Z(3)
- User remark for ABCD
- User remark for AB
- User remark for DZ
Here is a part of my plugin configuration:
editor.conversion.for('dataDowncast')
.markerToHighlight(data_markerToHighlightConfig)
.markerToData(data_markerToDataConfig);
Seems to me that both can not work like this. Here only markerToData works. If I add only one of them that works, so my configuration for markerToHighlight and markerToData can be OK. I debugged, and when I add both, only markerToData called.
Here are the configs:
const data_markerToDataConfig = {
model: "my-highlight"
};
const data_markerToHighlightConfig = {
model: "my-highlight",
view: { classes: "my-highlight" }
};
In action on-line: https://peterborkuti.github.io/ckeditor-bphighlight/
In action, see the console for the getData():
When both converters are enabled, only star/end markers are there (BAD)

When only markerToHighlight is enabled, only spans are there (OK)

When only markerToData is enabled, only start/end markers are there (OK)

Thank you in advance
I got the answer from ckeditor support. I am not sure, if I can share the original answer publicly, but the cause is:
markerToData and markerToHighlight can not be used together by design. This information is missing from the documentation. To deal with the situation, a custom converter should be written.
When I am done with the custom converter, I will share it here.