Swap problem

From SuperMemopedia
Jump to navigation Jump to search

Question:

Pawel asked: When I Ctrl+Alt+S on an item that conains html/html elements after swap data is lost (see screenshots below) and I don't know why. Please help me to sort it out.


Before swap
After swap

Hint 1:

Try to redefine the order of components. The swap occurs between the first question and the first answer. There are some sound components visible in the background and these could participate in the swap (as either questions or as answers)

Hint 2:

Elimination of sound elements as questions and answers is the easiest solution to this problem.

Answer:

You must make sure that the components you want to swap are first in the order of components that qualify for a swap. This can be best done by defining the appropriate component order in your default item template.

Swap works as follows:

  1. find first question component that belongs to types: Text, Spell, Sound, RTF, or HTM
  2. find first answer component that belogs to Text, Spell, Sound, RTF, or HTM
  3. if no answer found, find any componenent of the Spell or Sound type
  4. swap the texts of components found in Step 1 with the component found in Steps 2-3
  5. if the title component is the same as the first question component change the title as well

(in the picture example, it is enough to make sure the components with question and the answer are at the top of the component list, e.g. by dragging components in Component Order Editor (Ctrl+Shift+O))