You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>
A
<commentid="e64dce95ad23165bb6aca6c5efb543636" type="start"></comment>
bcd
<commentid="e64dce95ad23165bb6aca6c5efb543636" type="end"></comment>
ef
</p>
Calling editor.setData( editor.getData() ) with throw an error. Why?
The whole data is removed, but the marker isn't removed it is actually moved to the graveyard. Then .setData() adds the marker with the same name second time which throws an error.
It feels incorrect that under any circumstances editor.setData( editor.getData() ) fails. Also, I think that it feels natural, that if the specified marker already exists in the editor, it should be moved to a new place. OTOH, we rather discourage using editor.setData() as it is rarely correct to do so.
What exactly happens is that DataController#set() uses model.Writer#insert() and the writer handles the markers insertions. We need to think about two things:
Maybe a marker should be automatically removed when it is moved to the graveyard. I already thought about it earlier and now @Reinmar also suggested that. As I think of it, it makes sense for all marker usages I can think of. We already need to write post-fixers which removes those markers after they end up in the graveyard! Mind, that auto-removing will not break undo.
If not, we should think whether this issue should be fixed in model.Writer#insert() or in DataController#set(). We need to think if the writer, on inserting, should handle existing markers or if it is strictly DataController#set() scenario and responsibility.
The text was updated successfully, but these errors were encountered:
scofalik
changed the title
DataController#set() throws when adding content with existing marker
DataController#set() throws when adding content with an existing marker
Apr 5, 2019
Assume editor data with a marker, for example:
Calling
editor.setData( editor.getData() )
with throw an error. Why?The whole data is removed, but the marker isn't removed it is actually moved to the graveyard. Then
.setData()
adds the marker with the same name second time which throws an error.It feels incorrect that under any circumstances
editor.setData( editor.getData() )
fails. Also, I think that it feels natural, that if the specified marker already exists in the editor, it should be moved to a new place. OTOH, we rather discourage usingeditor.setData()
as it is rarely correct to do so.What exactly happens is that
DataController#set()
usesmodel.Writer#insert()
and the writer handles the markers insertions. We need to think about two things:Maybe a marker should be automatically removed when it is moved to the graveyard. I already thought about it earlier and now @Reinmar also suggested that. As I think of it, it makes sense for all marker usages I can think of. We already need to write post-fixers which removes those markers after they end up in the graveyard! Mind, that auto-removing will not break undo.
If not, we should think whether this issue should be fixed in
model.Writer#insert()
or inDataController#set()
. We need to think if the writer, on inserting, should handle existing markers or if it is strictlyDataController#set()
scenario and responsibility.The text was updated successfully, but these errors were encountered: