Open malueck opened 5 months ago
I've tested it with a simple editor with two text nodes as in the example and I can't reproduce those issues.
For me, it sounds like you are using the query list language and are showing the same node multiple times in the same editor. Then it is a known limitation that can only be influenced but not fixed by the duplicates safe property. The reason why it happens in those cases is that in some situations, the big cell (= top-most cell) of a node is queried from the editor component instead of direct usages of the correct editor cell. It always finds the cell for the second node and not the first one, that's why all the actions are working for the second text node.
If you are sure that it is a problem in the richtext language, you have to provide me with a sample project, so I can check it out.
Querylist is not involved in this problem. A made a small example.
Version info: MPS 2022.2.2 Build #MPS-222.4554.1547, built on December 13, 2023 Runtime version: 17.0.6+7-b469.82 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
The plugin "MPS Richtext Editor Component" is from the Marketplace i.e. in the "Downloaded" section of installed plugins and enabled.
I disabled all plugins except the dependencies of MPS Richtext and created a dummy concept. You can see the editor in the screenshot. It has two cells for the same Text child and two cells for a multiline property.
Observations:
Example project as a zip file.
Concept definition:
concept Dummy extends BaseConcept
implements <none>
instance can be root: true
alias: <no alias>
short description: <no short description>
properties:
str : string
children:
Text : Text[1]
references:
<< ... >>
Editor:
<default> editor for concept Dummy
node cell layout:
[/
% Text %
% Text %
<constant>
{ str }\n
{ str }\n
/]
inspected cell layout:
<choose cell model>
I just checked the implementation. To summarize in case we want to fix this:
ChildrenCollectionFinder#isMultipleCollectionCell
.EditorComponent#findNodeCell
finds the second cell instead of the first one. There are 14 usages of this method. I am not sure if this is fixable.
If a richtext Text node is shown in two cells, all sorts of problems appear. A simple case to reproduce is in a collection with just the Text nodes:
Found in MPS-richtext 2022.2.