Issue #405Opened October 11, 2017by NicholasGati0 reactions

Can't drag list item inside of unordered list

Question

Ciao, spero che stai bene e grazie per GrapesJS! I am trying to create a way for users to create multiple choice questions. The first block below is the section that has a form with an unordered list inside of it. The unordered-list inside of the form should be able to accept a list item, which is another block in itself (the second block below). I am getting this error: "Invalid target position: Target collection not found, Target is not droppable...". I have set the data-gjs-draggable and data-gjs-droppable, so I am not sure why it is not working correctly. Any help would be much appreciated.

<section
  id="multiple-choice-question-text"
  class="theme-bg-1"
  data-gjs-type="dynamicOptions"
  data-gjs-style-class="true"
  data-gjs-removable="true"
  data-gjs-editable="true"
  data-gjs-parent-slide="true"
  data-gjs-slide-template="multiple-choice-question-text"
  data-gjs-draggable="#wrapper"
  data-gjs-highlightable="true"
  data-gjs-custom-name="Slide"
  data-gjs-stylable="<?php echo $gjsconfig['stylable']['background']?>"
  data-gjs-sectionID="<?php echo (isset($sectionData['id'])) ? $sectionData['id'] : ''; ?>">
    <div
      data-gjs-editable="false"
      data-gjs-droppable="false"
      data-gjs-draggable="false"
      data-gjs-removable="false"
      data-gjs-stylable="false"
      data-gjs-highlightable="false"
      data-gjs-copyable="false">
        <!-- START: SLIDE CONTENT -->
        <form
          data-gjs-sectionID="<?php echo (isset($sectionData['id'])) ? $sectionData['id'] : ''; ?>"
          class="multiple-choice-text-form"
          method="post"
          data-gjs-droppable="false"
          data-gjs-draggable="false">
          <!-- Question -->
          <?php require("components/multiple-choice-question.ctp"); ?>

          <!-- Answer Section -->
          <ul
            class="mc-option-list"
            id="question-answers"
            class="answer-section"
            data-gjs-editable="false"
            data-gjs-droppable=".mc-option"
            data-gjs-draggable="false"
            data-gjs-removable="false"
            data-gjs-stylable="false"
            data-gjs-highlightable="true"
            data-gjs-copyable="false">

            <!-- Answers/Options Go Here Dynamically. One is provided by default though.  -->
            <?php require("components/multiple-choice-option.ctp"); ?>
          </ul>

          <input
            data-gjs-editable="false"
            data-gjs-droppable="false"
            data-gjs-draggable="false"
            data-gjs-removable="false"
            data-gjs-stylable="false"
            data-gjs-highlightable="false"
            data-gjs-copyable="false"
            type="submit"
            name="submit"
            value="Submit">
          <!-- END: SLIDE CONTENT -->
        </form>
    </div>
</section>
<li
  class="radio mc-option"
  data-gjs-stylable="false"
  data-gjs-highlightable="true"
  data-gjs-editable="false"
  data-gjs-droppable="false"
  data-gjs-draggable=".mc-option-list"
  data-gjs-removable="true"
  data-gjs-copyable="false">
    <input
      type="radio"
      name="answersRadios"
      id="answersRadios"
      value="answersRadios"
      data-gjs-editable="false"
      data-gjs-droppable="false"
      data-gjs-draggable="false"
      data-gjs-removable="false"
      data-gjs-copyable="false"
      data-gjs-stylable="false"
      data-gjs-highlightable="false"/>
    <label
      class="theme-text-1"
      for="answersRadios"
      data-gjs-style-class="true"
      data-gjs-stylable="<?php echo $gjsconfig['stylable']['text']?>"
      data-gjs-editable="true"
      data-gjs-droppable="false"
      data-gjs-draggable="false"
      data-gjs-removable="false"
      data-gjs-copyable="false"
      data-gjs-fieldtype="text"
      data-gjs-saveable="true"
      data-gjs-sectionID="<?php echo (isset($sectionData['lesson_plan_slide_sections'][1]['id'])) ? $sectionData['lesson_plan_slide_sections'][1]['id'] : ''; ?>">
          <?php echo (isset($sectionData['lesson_plan_slide_sections'][1]['content'])) ? trim($sectionData['lesson_plan_slide_sections'][1]['content']) : $content[1]; ?>
    </label>
</li>

Answers (3)

artfOctober 11, 20170 reactions

Hi @NicholasGati I think it might be an issue with data-gjs-stylable="false" can you try to remove it from <ul> and <li> and check if it works

NicholasGatiOctober 11, 20170 reactions

Hey @artf, thanks for replying. I removed data-gjs-stylable="false" and it still does not work. I get the same error: 'Target collection not found, Target is not droppable...'.

artfOctober 12, 20170 reactions

Are you able to reproduce it by using something like jsfiddle/codesandbox?

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.