Uploaded image for project: '{RETIRED} CKEditor Integration'
  1. {RETIRED} CKEditor Integration
  2. CKEDITOR-293

Removing a paragraph between two inline editing macro led to NPE

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Major
    • None
    • 1.32, 1.33
    • None
    • None
    • Unknown
    • N/A
    • N/A

    Description

      Steps to reproduce (see the attached gif for more information):

      1. Open empty wiki with standard flavour
      2. Login as admin
      3. Create a new page "Foo"
      4. Type "some content" in the editor and enter to add a new line
      5. Add a first box with the content "foo"
      6. Insert a new line after the box by clicking on the red marker
      7. type "bar", select it and insert another box with this content
      8. insert a new line between the two boxes by clicking on the red marker
      9. type "toto" between the two boxes
      10. switch to source mode and back to WYSIWYG
      11. double click on "toto" to select it and hit "backward" key to delete it
      12. switch again to source mode and back to WYSIWYG: if there was an empty line such as
         {{box}}
        
         bar
         {{/box}}

        in the second box during step 10, repeat 9 to 12 once again.

      Expected result:

      • The box remains inline editable

      Obtained result:

      • The second box is not editable anymore, switching again to source shows some HTML and we obtain a NPE in the log trace.

      I reproduced the bug with 1.32 but with a bit more steps: I needed to select the second box macro before removing the text in the middle to have the error.

      Attachments

        Issue Links

          Activity

            [CKEDITOR-293] Removing a paragraph between two inline editing macro led to NPE
            surli Simon Urli added a comment -

            I tried to reproduced it on XWiki 12.10.7 (CKEditor 1.53.2) without success.

            surli Simon Urli added a comment - I tried to reproduced it on XWiki 12.10.7 (CKEditor 1.53.2) without success.
            surli Simon Urli added a comment -

            Indeed the diff is not the same for me:

            - <p>toto<br></p>
            + <br>

            Apparently the paragraph is removed. I don't have any Javascript exception on the console.

            surli Simon Urli added a comment - Indeed the diff is not the same for me: - <p>toto<br></p> + <br> Apparently the paragraph is removed. I don't have any Javascript exception on the console.

            surli I still cannot reproduce. The only difference I noticed by looking at the animated GIF is:

            the second macro moves upwards a bit when you delete the text between the macros. This doesn't happen in my case.

            So something wrong happens when you delete the selected text. Can you use the DOM inspector to copy the edited HTML before and after the delete? For instance I have this HTML before:

            <p>some content</p>
            <div tabindex="-1" data-cke-widget-wrapper="1" data-cke-filter="off" class="cke_widget_wrapper cke_widget_block cke_widget_xwiki-macro cke_widget_wrapper_macro" data-cke-display-name="macro:box" data-cke-widget-id="36" role="region" aria-label="macro:box widget" contenteditable="false">
              <div class="macro cke_widget_element" data-macro="startmacro:box|-||-|foo" data-cke-widget-data="%7B%22name%22%3A%22box%22%2C%22parameters%22%3A%7B%7D%2C%22content%22%3A%22foo%22%2C%22inline%22%3Afalse%2C%22classes%22%3A%7B%22macro%22%3A1%7D%7D" data-cke-widget-upcasted="1" data-cke-widget-keep-attr="0" data-widget="xwiki-macro">
                <div class="box">
                  <div data-xwiki-non-generated-content="java.util.List<org.xwiki.rendering.block.Block>" class="xwiki-metadata-container cke_widget_editable" data-cke-widget-editable="content" data-cke-enter-mode="1" data-cke-display-name="content" contenteditable="true">
                    <p>foo</p>
                  </div>
                </div>
              </div>
              <span class="cke_reset cke_widget_drag_handler_container" style="background: rgba(220, 220, 220, 0.5) url(&quot;http://localhost:8080/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.33/plugins/widget/images/handle.png&quot;) repeat scroll 0% 0%; top: -15px; left: 0px; display: block;"><img class="cke_reset cke_widget_drag_handler" data-cke-widget-drag-handler="1" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="Click and drag to move" role="presentation" width="15" height="15"></span>
            </div>
            <p>toto<br></p>
            <div tabindex="-1" data-cke-widget-wrapper="1" data-cke-filter="off" class="cke_widget_wrapper cke_widget_block cke_widget_xwiki-macro cke_widget_wrapper_macro" data-cke-display-name="macro:box" data-cke-widget-id="35" role="region" aria-label="macro:box widget" contenteditable="false">
              <div class="macro cke_widget_element" data-macro="startmacro:box|-||-|bar" data-cke-widget-data="%7B%22name%22%3A%22box%22%2C%22parameters%22%3A%7B%7D%2C%22content%22%3A%22bar%22%2C%22inline%22%3Afalse%2C%22classes%22%3A%7B%22macro%22%3A1%7D%7D" data-cke-widget-upcasted="1" data-cke-widget-keep-attr="0" data-widget="xwiki-macro">
                <div class="box">
                  <div data-xwiki-non-generated-content="java.util.List<org.xwiki.rendering.block.Block>" class="xwiki-metadata-container cke_widget_editable" data-cke-widget-editable="content" data-cke-enter-mode="1" data-cke-display-name="content" contenteditable="true">
                    <p>bar<br></p>
                  </div>
                </div>
              </div>
              <span class="cke_reset cke_widget_drag_handler_container" style="background: rgba(220, 220, 220, 0.5) url(&quot;http://localhost:8080/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.33/plugins/widget/images/handle.png&quot;) repeat scroll 0% 0%; top: -15px; left: 0px; display: block;"><img class="cke_reset cke_widget_drag_handler" data-cke-widget-drag-handler="1" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="Click and drag to move" role="presentation" width="15" height="15"></span>
            </div>
            

            And after the delete I have:

            <p>some content</p>
            <div tabindex="-1" data-cke-widget-wrapper="1" data-cke-filter="off" class="cke_widget_wrapper cke_widget_block cke_widget_xwiki-macro cke_widget_wrapper_macro" data-cke-display-name="macro:box" data-cke-widget-id="36" role="region" aria-label="macro:box widget" contenteditable="false">
              <div class="macro cke_widget_element" data-macro="startmacro:box|-||-|foo" data-cke-widget-data="%7B%22name%22%3A%22box%22%2C%22parameters%22%3A%7B%7D%2C%22content%22%3A%22foo%22%2C%22inline%22%3Afalse%2C%22classes%22%3A%7B%22macro%22%3A1%7D%7D" data-cke-widget-upcasted="1" data-cke-widget-keep-attr="0" data-widget="xwiki-macro">
                <div class="box">
                  <div data-xwiki-non-generated-content="java.util.List<org.xwiki.rendering.block.Block>" class="xwiki-metadata-container cke_widget_editable" data-cke-widget-editable="content" data-cke-enter-mode="1" data-cke-display-name="content" contenteditable="true">
                    <p>foo</p>
                  </div>
                </div>
              </div>
              <span class="cke_reset cke_widget_drag_handler_container" style="background: rgba(220, 220, 220, 0.5) url(&quot;http://localhost:8080/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.33/plugins/widget/images/handle.png&quot;) repeat scroll 0% 0%; top: -15px; left: 0px; display: block;"><img class="cke_reset cke_widget_drag_handler" data-cke-widget-drag-handler="1" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="Click and drag to move" role="presentation" width="15" height="15"></span>
            </div>
            <p><br></p>
            <div tabindex="-1" data-cke-widget-wrapper="1" data-cke-filter="off" class="cke_widget_wrapper cke_widget_block cke_widget_xwiki-macro cke_widget_wrapper_macro" data-cke-display-name="macro:box" data-cke-widget-id="35" role="region" aria-label="macro:box widget" contenteditable="false">
              <div class="macro cke_widget_element" data-macro="startmacro:box|-||-|bar" data-cke-widget-data="%7B%22name%22%3A%22box%22%2C%22parameters%22%3A%7B%7D%2C%22content%22%3A%22bar%22%2C%22inline%22%3Afalse%2C%22classes%22%3A%7B%22macro%22%3A1%7D%7D" data-cke-widget-upcasted="1" data-cke-widget-keep-attr="0" data-widget="xwiki-macro">
                <div class="box">
                  <div data-xwiki-non-generated-content="java.util.List<org.xwiki.rendering.block.Block>" class="xwiki-metadata-container cke_widget_editable" data-cke-widget-editable="content" data-cke-enter-mode="1" data-cke-display-name="content" contenteditable="true">
                    <p>bar<br></p>
                  </div>
                </div>
              </div>
              <span class="cke_reset cke_widget_drag_handler_container" style="background: rgba(220, 220, 220, 0.5) url(&quot;http://localhost:8080/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.33/plugins/widget/images/handle.png&quot;) repeat scroll 0% 0%; top: -15px; left: 0px; display: block;"><img class="cke_reset cke_widget_drag_handler" data-cke-widget-drag-handler="1" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="Click and drag to move" role="presentation" width="15" height="15"></span>
            </div>
            

            The only difference is:

            - <p>toto<br></p>
            + <p><br></p>
            

            which is what I expect. Can you also check the JavaScript console to see if there is any JavaScript exception logged while following the steps to reproduce the issue.

            mflorea Marius Dumitru Florea added a comment - surli I still cannot reproduce. The only difference I noticed by looking at the animated GIF is: the second macro moves upwards a bit when you delete the text between the macros. This doesn't happen in my case. So something wrong happens when you delete the selected text. Can you use the DOM inspector to copy the edited HTML before and after the delete? For instance I have this HTML before: <p>some content</p> <div tabindex="-1" data-cke-widget-wrapper="1" data-cke-filter="off" class="cke_widget_wrapper cke_widget_block cke_widget_xwiki-macro cke_widget_wrapper_macro" data-cke-display-name="macro:box" data-cke-widget-id="36" role="region" aria-label="macro:box widget" contenteditable="false"> <div class="macro cke_widget_element" data-macro="startmacro:box|-||-|foo" data-cke-widget-data="%7B%22name%22%3A%22box%22%2C%22parameters%22%3A%7B%7D%2C%22content%22%3A%22foo%22%2C%22inline%22%3Afalse%2C%22classes%22%3A%7B%22macro%22%3A1%7D%7D" data-cke-widget-upcasted="1" data-cke-widget-keep-attr="0" data-widget="xwiki-macro"> <div class="box"> <div data-xwiki-non-generated-content="java.util.List<org.xwiki.rendering.block.Block>" class="xwiki-metadata-container cke_widget_editable" data-cke-widget-editable="content" data-cke-enter-mode="1" data-cke-display-name="content" contenteditable="true"> <p>foo</p> </div> </div> </div> <span class="cke_reset cke_widget_drag_handler_container" style="background: rgba(220, 220, 220, 0.5) url(&quot;http://localhost:8080/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.33/plugins/widget/images/handle.png&quot;) repeat scroll 0% 0%; top: -15px; left: 0px; display: block;"><img class="cke_reset cke_widget_drag_handler" data-cke-widget-drag-handler="1" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="Click and drag to move" role="presentation" width="15" height="15"></span> </div> <p>toto<br></p> <div tabindex="-1" data-cke-widget-wrapper="1" data-cke-filter="off" class="cke_widget_wrapper cke_widget_block cke_widget_xwiki-macro cke_widget_wrapper_macro" data-cke-display-name="macro:box" data-cke-widget-id="35" role="region" aria-label="macro:box widget" contenteditable="false"> <div class="macro cke_widget_element" data-macro="startmacro:box|-||-|bar" data-cke-widget-data="%7B%22name%22%3A%22box%22%2C%22parameters%22%3A%7B%7D%2C%22content%22%3A%22bar%22%2C%22inline%22%3Afalse%2C%22classes%22%3A%7B%22macro%22%3A1%7D%7D" data-cke-widget-upcasted="1" data-cke-widget-keep-attr="0" data-widget="xwiki-macro"> <div class="box"> <div data-xwiki-non-generated-content="java.util.List<org.xwiki.rendering.block.Block>" class="xwiki-metadata-container cke_widget_editable" data-cke-widget-editable="content" data-cke-enter-mode="1" data-cke-display-name="content" contenteditable="true"> <p>bar<br></p> </div> </div> </div> <span class="cke_reset cke_widget_drag_handler_container" style="background: rgba(220, 220, 220, 0.5) url(&quot;http://localhost:8080/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.33/plugins/widget/images/handle.png&quot;) repeat scroll 0% 0%; top: -15px; left: 0px; display: block;"><img class="cke_reset cke_widget_drag_handler" data-cke-widget-drag-handler="1" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="Click and drag to move" role="presentation" width="15" height="15"></span> </div> And after the delete I have: <p>some content</p> <div tabindex="-1" data-cke-widget-wrapper="1" data-cke-filter="off" class="cke_widget_wrapper cke_widget_block cke_widget_xwiki-macro cke_widget_wrapper_macro" data-cke-display-name="macro:box" data-cke-widget-id="36" role="region" aria-label="macro:box widget" contenteditable="false"> <div class="macro cke_widget_element" data-macro="startmacro:box|-||-|foo" data-cke-widget-data="%7B%22name%22%3A%22box%22%2C%22parameters%22%3A%7B%7D%2C%22content%22%3A%22foo%22%2C%22inline%22%3Afalse%2C%22classes%22%3A%7B%22macro%22%3A1%7D%7D" data-cke-widget-upcasted="1" data-cke-widget-keep-attr="0" data-widget="xwiki-macro"> <div class="box"> <div data-xwiki-non-generated-content="java.util.List<org.xwiki.rendering.block.Block>" class="xwiki-metadata-container cke_widget_editable" data-cke-widget-editable="content" data-cke-enter-mode="1" data-cke-display-name="content" contenteditable="true"> <p>foo</p> </div> </div> </div> <span class="cke_reset cke_widget_drag_handler_container" style="background: rgba(220, 220, 220, 0.5) url(&quot;http://localhost:8080/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.33/plugins/widget/images/handle.png&quot;) repeat scroll 0% 0%; top: -15px; left: 0px; display: block;"><img class="cke_reset cke_widget_drag_handler" data-cke-widget-drag-handler="1" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="Click and drag to move" role="presentation" width="15" height="15"></span> </div> <p><br></p> <div tabindex="-1" data-cke-widget-wrapper="1" data-cke-filter="off" class="cke_widget_wrapper cke_widget_block cke_widget_xwiki-macro cke_widget_wrapper_macro" data-cke-display-name="macro:box" data-cke-widget-id="35" role="region" aria-label="macro:box widget" contenteditable="false"> <div class="macro cke_widget_element" data-macro="startmacro:box|-||-|bar" data-cke-widget-data="%7B%22name%22%3A%22box%22%2C%22parameters%22%3A%7B%7D%2C%22content%22%3A%22bar%22%2C%22inline%22%3Afalse%2C%22classes%22%3A%7B%22macro%22%3A1%7D%7D" data-cke-widget-upcasted="1" data-cke-widget-keep-attr="0" data-widget="xwiki-macro"> <div class="box"> <div data-xwiki-non-generated-content="java.util.List<org.xwiki.rendering.block.Block>" class="xwiki-metadata-container cke_widget_editable" data-cke-widget-editable="content" data-cke-enter-mode="1" data-cke-display-name="content" contenteditable="true"> <p>bar<br></p> </div> </div> </div> <span class="cke_reset cke_widget_drag_handler_container" style="background: rgba(220, 220, 220, 0.5) url(&quot;http://localhost:8080/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/1.33/plugins/widget/images/handle.png&quot;) repeat scroll 0% 0%; top: -15px; left: 0px; display: block;"><img class="cke_reset cke_widget_drag_handler" data-cke-widget-drag-handler="1" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="Click and drag to move" role="presentation" width="15" height="15"></span> </div> The only difference is: - <p>toto<br></p> + <p><br></p> which is what I expect. Can you also check the JavaScript console to see if there is any JavaScript exception logged while following the steps to reproduce the issue.
            iandriuta Ilie Andriuta added a comment -

            I also couldn't reproduce the issue (tested on XWiki 11.3, Firefox 66.0.5, Chrome 74 and Edge 18 using HSQL 2.4.1 on Windows 10).

            iandriuta Ilie Andriuta added a comment - I also couldn't reproduce the issue (tested on XWiki 11.3, Firefox 66.0.5, Chrome 74 and Edge 18 using HSQL 2.4.1 on Windows 10).
            ganechitoaei Gabriela Anechitoaei added a comment - - edited

            mflorea I've followed the steps above on XWiki 11.3 MySQL 5.7 with Firefox 66 and Chrome 74 - Windows 10 and couldn't reproduce this behavior

            ganechitoaei Gabriela Anechitoaei added a comment - - edited mflorea I've followed the steps above on XWiki 11.3 MySQL 5.7 with Firefox 66 and Chrome 74 - Windows 10 and couldn't reproduce this behavior
            surli Simon Urli added a comment -

            So I reproduce on two different computers on Firefox 66.0.5 on Archlinux and Fedora.

            surli Simon Urli added a comment - So I reproduce on two different computers on Firefox 66.0.5 on Archlinux and Fedora.

            ganechitoaei, iandriuta do you reproduce the problem?

            mflorea Marius Dumitru Florea added a comment - ganechitoaei , iandriuta do you reproduce the problem?

            surli I tried again following your steps exactly but I still can't reproduce, neither with Firefox (66.0.5) nor with Chrome (74.0.3729.131). I'm on Linux (Ubuntu).

            mflorea Marius Dumitru Florea added a comment - surli I tried again following your steps exactly but I still can't reproduce, neither with Firefox (66.0.5) nor with Chrome (74.0.3729.131). I'm on Linux (Ubuntu).
            surli Simon Urli added a comment -

            that you select the text using the keyboard but it's not clear how, and I don't see how exactly you delete the selected text.

            so actually no I selected it with the mouse by double-clicking on the word. And to delete it I just hit "backspace" on the keyboard.

            surli Simon Urli added a comment - that you select the text using the keyboard but it's not clear how, and I don't see how exactly you delete the selected text. so actually no I selected it with the mouse by double-clicking on the word. And to delete it I just hit "backspace" on the keyboard.

            surli I cannot reproduce. I tried both on Firefox and Chrome using XWiki 11.3 which has CKEditor Integration 1.33. The part that is not clear is the step before last step:

            remove what you typed between the two boxes

            I can see in the gif that you select the text using the keyboard but it's not clear how, and I don't see how exactly you delete the selected text. Can you be more explicit? Like what keys you type? I also noticed in the gif that the second macro moves upwards a bit when you delete the text between the macros. This doesn't happen in my case, so I must be doing something different.

            mflorea Marius Dumitru Florea added a comment - surli I cannot reproduce. I tried both on Firefox and Chrome using XWiki 11.3 which has CKEditor Integration 1.33. The part that is not clear is the step before last step: remove what you typed between the two boxes I can see in the gif that you select the text using the keyboard but it's not clear how, and I don't see how exactly you delete the selected text. Can you be more explicit? Like what keys you type? I also noticed in the gif that the second macro moves upwards a bit when you delete the text between the macros. This doesn't happen in my case, so I must be doing something different.

            People

              surli Simon Urli
              surli Simon Urli
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: