Changes between Version 2 and Version 4 of Ticket #12019

Jun 25, 2014, 2:08:56 PM (9 years ago)
Piotrek Koszuliński

Again this turned out to be a problem with widgets in general, rather than with nested widgets. Pushed tests in branch:t/12019 that proves it.


  • Ticket #12019

    • Property Status changed from confirmed to assigned
    • Property Owner set to Piotrek Koszuliński
    • Property Summary changed from [Nested widgets] Format value is "Normal (div)" when nested block widget is selected to Styles yield to be applicable when block widget is selected
  • Ticket #12019 – Description

    v2 v4  
    1 Part of #10931.
     11. Open
     22. Focus one of block widgets.
     33. See format and styles drop-downs, basic styles, etc. All are enabled and many times values are incorrect - e.g. format is set to "normal div" for image2 inside nested editable (additionally, this is not consistent between framed and inline editors).
    3 1. Open plugins/widget/dev/nestedwidgets.html
    4 2. Click image2 (nested within simplebox).
    5 3. See format drop-down.
     5All these behaviours come from a decision we made while working on widget system. We decided that styles will be applicable to block widgets, because they may contain nested editables in which these styles may be applicable, even if they are not applicable to the widget itself (and besides widget styles they never are). This reasoning definitely makes sense - if I have 3 nested editables inside a widget and I want to make all text inside them bold I can focus widget and apply bold. Alternatively, I would have to apply bold three times. To make all this work we needed to modify style system so it traverse non-editable fragments of content, finds nested editables, retrieves their filter instances and asks them whether styles is allowed inside. This part works great.
     7Unfortunately, all the rest is a mess. Problems are caused by inability to correctly set style's command state and value. See the following scenarios.
     91. Focus captioned image2 and apply bold. Bold is applied in the caption. Now, try to remove the bold. You can't, because bold button is still off after applying bold. Why is it off? Because `<figure>` is not inside a `<strong>`. Are we able to set the state to on? I don't think so - this would mean traversing focused widget's DOM, finding nested editables and then what? Enabling style if it's applied to entire content of all nested editables? Or at the beginning of any editable? In any case this would be a performance killer, because we not only need to find editables, but also first editable place inside them (text node, image, space before `<br>`, widget, etc).
     102. Imagine the above scenario with captioned image2 nested in simple box. The algorithm will need to go inside that image2 when simple box is selected.
     113. What is the expected format drop-down's value when simplebox is focused and it its content there are headings and paragraphs? Simplebox has a header in which format should be disabled. Then it has content, which may start with a normal block (paragraph, heading) or for example a captioned image. Image does not allow changing format (so should drop-down be disabled?), but after image there may be paragraphs, so maybe format should be enabled (but then what with the value?).
     124. Imagine all these scenarios with widgets containing multiple nested editables of different types. User will never intuitively know what will happen and what's just happened.
     14And I'm sure that there are move lovely cases like these.
     16Therefore, I don't see other option than disabling styles when block widget is focused. Only widgets styles should be active.
     18Note that this won't change the behaviour of applying style to a selection containing some content outside a widget and a widget (e.g. bolding after doing `CTRL+A` on text with captioned images). Style will still be applied to all places in which it's allowed. There's a substantial difference between these cases - the start of selection. When selection does not contain only a widget, it starts in an editable place, so we can check style's state in that place.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy