Skip to content

Acciones

sonsoleslp edited this page Sep 6, 2018 · 15 revisions

As seen before, actions are simple objects with a unique identifier and can contain a payload property. i.e.: {type: ADD_BOX, payload: {ids, type, draggable, resizable, content, toolbar, config, state, initialParams}}

In the following table there is a summary of actions:

Type Payload Function Description
ADD_BOX {ids, draggable, resizable, content, toolbar, config, state, initialParams} addBox Adds a EditorBox.
ADD_NAV_ITEM { id, name, parent, type, position, hasContent, sortable_id } addNavItem Adds a view.
ADD_RICH_MARK { mark, view, toolbar } addRichMark Adds a mark.
CHANGE_BACKGROUND` { id, background } changeBackground Changes the background of a view.
CHANGE_BOX_LAYER {id, parent, container, value, boxes_array} changeBoxLayer Modifies the order of depth of the boxes in a slide.
CHANGE_COLS {id, parent, distribution, boxesAffected} changeCols Changes column distribution in a SortableContainer.
CHANGE_GLOBAL_CONFIG {prop, value} changeGlobalConfig Edits the global config.
CHANGE_ROWS {id, parent, column, distribution, boxesAffected} changeRows Changes rows distribution in a column from a SortableContainer.
CHANGE_SORTABLE_PROPS {id, parent, prop, value} changeSortableProps Updates state of a EditorBoxSortable.
CONFIG_SCORE {id, button, value, page} configScore Sets the score of an exercise or page.
DELETE_BOX {id, parent, container, children} deleteBox Deletes a EditorBox.
DELETE_CONTAINED_VIEW {ids, boxes, parent} deleteContainedView Deletes a contained view.
DELETE_FILE {id} deleteFile Deletes an uploaded file.
DELETE_NAV_ITEM { ids, parent, boxes, containedViews, linkedBoxes } deleteNavItem Deletes a view.
DELETE_RICH_MARK {mark} deleteRichMark Deletes a mark.
DELETE_SORTABLE_CONTAINER { id, parent, children, cvs, page } deleteSortableContainer Deletes a SortableContainer.
DROP_BOX { id, row, col, parent, container, oldParent, oldContainer, position, index } dropBox Drops a box in a new location.
DUPLICATE_NAV_ITEM { id, newId, boxes, suffix, linkedCvs } duplicateNavItem Duplicates a vista.
EDIT_RICH_MARK { parent, state, mark, oldConnection, newConnection } editRichMark Edits a mark.
EXPAND_NAV_ITEM {id, value} expandNavItem Expands a section.
IMPORT_STATE {state} importState Imports redux state.
INCREASE_LEVEL {} increaseBoxLevel Increase the depth level of box selection.
INDEX_SELECT {id} selectIndex Selects a view/contained view to edit it in the index.
MOVE_BOX {id, x, y, position, parent, container} moveBox Assigns a new position to a EditorBox.
PASTE_BOX {ids, box, toolbar, children, index, marks, score} pasteBox Pastes an EditorBox.
REORDER_BOXES { parent, container, order } reorderBoxes Reorders boxes inside the same parent.
REORDER_SORTABLE_CONTAINER { ids, parent } reorderSortableContainer Reorders diferent rows inside a EditorBoxSortable.
REORDER_NAV_ITEM { id, newParent, oldParent, idsInOrder, childrenInOrder } reorderNavItem Reorders views (parent relationships can be changed here).
RESIZE_BOX { id, structure } resizeBox Changes size of a EditorBox).
RESIZE_SORTABLE_CONTAINER {id, parent, height} resizeSortableContainer Changes size of a SortableContainer.
SELECT_BOX {id} selectBox Selects a EditorBox.
SELECT_CONTAINED_VIEW {id} selectContainedView Selects a contained view.
SELECT_NAV_ITEM {id} selectNavItem Selects a view.
SET_CORRECT_ANSWER {id, correctAnswer, page} setCorrectAnswer Determines the correct answer to an exercise.
SET_BUSY {value, msg} setBusy Sets server state to show to the user.
TOGGLE_NAV_ITEM { id } toggleNavItem Collapses/expands a section of the index.
TOGGLE_TEXT_EDITOR {caller, value} toggleTextEditor Set text edition to a EditorBox.
UPDATE_BOX {id, content, toolbar, state} updateBox Updates EditorBox content.
UPDATE_PLUGIN_TOOLBAR {id, tab, accordion, name, value, deletedBoxes} updatePluginToolbar Updates the toolbar of a box.
UPDATE_VIEW_TOOLBAR {id, ...elements} updateViewToolbar Updates the toolbar of a view.
UPLOAD_FILE {id, url, name, keywords, mimetype} uploadFile Uploads a new file.
VERTICALLY_ALIGN_BOX {id, verticalAlign} verticallyAlignBox Aligns vertically a EditorBox.

The following table shows a detailed list of "types" of the actions used in the project and a table with the different payloads with a brief description:

  • ADD_BOX

    • Description: Creates a EditorBox or a EditorBoxSortable.

    • Use: {type: ADD_BOX, payload: {ids, draggable, resizable, content, toolbar, config, state, initialParams}

      Property Description Example
      ids Unique identifiers of the parent, the container and the EditorBox itself {id: "bo-1503570010369", parent: "bs-1497983247797", container: "sc-1503570010368"}
      draggable Boolean value that tells if new box is draggable false
      resizable Boolean value that tells if new box is resizable false
      content Content to render in the box. It is obtain through Plugins API. ...
      toolbar Box toolbar. It is obtained through plugin API. main: {__name: "Main", accordions: {…}}
      config Initial plugin config. It is obtained through plugin API. {category: "image", displayName: "Imagen Básica", flavor: "react", icon: "image", ...}
      state Initial box state. It is obtained through plugin API. {url: "/images/placeholder.png"}
      initialParams Needed params to configure a box. It is obtained through plugin API. {position: 'relative', row: undefined, col: undefined, width: "25%", isDefaultPlugin: false, height: 'auto'}
  • ADD_NAV_ITEM

    • Description: Adds a view

    • Use: {type: ADD_NAV_ITEM, payload: { id, name, parent, type, position, hasContent, sortable_id }}

      Property Description Example
      id Unique identifier of the new view pa-542293423423482
      name Name of the new view Page 1
      parent First next view 0 (ninguna)
      type Type of NavItem: document, slide or section []
      position Position of the view tree 1
      hasContent If view could have any content true
      sortable_id Box-sortable included in the view bs-2343354645645645654
  • ADD_RICH_MARK

    • Description: Adds a mark

    • Use: {type: ADD_RICH_MARK, payload: {mark, view, toolbar}}

      Property Description Example
      mark Mark information { id: 'rm-123567890123', title: 'New mark', connectMode: 'existing', connection: 'pa-9862763413223', displayMode: 'navigate', value: '45.4,34.3', color: '#333333'}`
      view Object containing the target view of the mark {id: 'cv-2323423423423', type: 'slide', ... }
      toolbar Toolbar of the new target view {...}

    ***En la propiedad connection, las marcas que enlacen con nuevas vistas contenidas deberán Ver apartado de creación de marcas en Plugins Enriquecidos

  • CHANGE_BACKGROUND

    • Description: Changes the background of a view

    • Use: {type: CHANGE_BACKGROUND, payload: { id, background }}

      Property Description Example
      id Unique identifier of the view pa-542293423423482
      background Value of the background { background: "#ffffff", backgroundAttr: "full" }
  • CHANGE_BOX_LAYER

    • Description: Modifies the order of depth of the boxes in a slide

    • Use: {type: CHANGE_BOX_LAYER, payload: {id, parent, container, value, boxes_array}

      Property Description Example
      id Unique identifier of the box selected bo-542293423423482
      parent Unique identifier of the selected box's parent pa-23423423423432
      container Unique identifier of the selected box's container 0
      value Indicates whether it has been moved to the front, to the back, one position forward, etc. front, back, ahead, behind
      boxes_array Order of sibling boxes prior to the action ['bo-232324234234', 'bo-11221212121', 'bo-09898997979797']
  • CHANGE_COLS

    • Description: Changes column distribution inside of a SortableContainer.

    • Use: {type: CHANGE_COLS, payload: {id, parent, distribution, boxesAffected}}

      Property Description Example
      id Unique identifer of the SortableContainer when editing sc-313456765342
      parent Unique identifier of the EditorBoxSortable when editing bs-983456765342
      distribution Column array distribution Two columns 50% wide each [50,50]
      boxesAffected The EditorBox within the same SortableContainer ['bo-423423423], 'bo-1034934834']
  • CHANGE_GLOBAL_CONFIG

    • Description: Edits global configuration.

    • Use: {type: CHANGE_GLOBAL_CONFIG, payload: {prop, value}}

      Property Description Example
      prop Global property to be changed title
      value New property value Curso de programación

      ***In the GlobalConfig page all properties can be seen.

      ***If we want to modify the whole state in one time, we can pass prop "STATE" and as value, the new complete state.

  • CHANGE_ROWS

    • Description: Cambia la distribución de filas en una columna dada de un SortableContainer.

    • Use: {type: CHANGE_ROWS, payload: {id, parent, column, distribution, boxesAffected}}

      Property Description Example
      id Unique identifier of SortableContainer when editing sc-313456765342
      parent Unique identifier of EditorBoxSortable when editing bs-983456765342
      column Column number where this rows are located First column 0
      distribution Row distribution array Two rows with 50% height [50,50]
      boxesAffected The EditorBox in the same SortableContainer ['bo-423423423', 'bo-1034934834']
  • CHANGE_SORTABLE_PROPS

    • Description: Updates EditorBoxSortable state.

    • Use: {type: CHANGE_SORTABLE_PROPS, payload: {id, parent, prop, value}}

      Property Description Example
      id Unique identifier of SortableContainer when editing sc-313456765342
      parent Unique identifier of EditorBoxSortable when editing bs-983456765342
      prop Property to be modified textAlign
      value New value for this property left
  • CONFIG_SCORE

    • Description: Sets the score of an exercise or page.

    • Use: {type: CONFIG_SCORE, payload: { id, button, value, page }

      Property Description Example
      id Unique identifier of the box or page bo-1323423432424
      button Name of the modified field score
      value New value of the field 3
      page Unique identifier of the current page pa-1234234324234
  • DELETE_BOX

    • Description: Deletes a EditorBox.

    • Use: {type: DELETE_BOX, payload: {id, parent, container, children}}

      Property Description Example
      id Unique identifier of the EditorBox to be deletedd bo-4343253665656
      parent Unique identifier of the parnt of the EditorBox, can be EditorBoxSortable or a view of the type slide bs-4564564564456 o pa-3453453545654
      container Unique identifier of the EditorBox, can be a SortableContainer or 0 if a floating box (in slides) 0 or sc-55756755675
      children Descendants of a EditorBox []
  • DELETE_CONTAINED_VIEW

    • Description: Deletes a contained view.

    • Use: {type: DELETE_CONTAINED_VIEW, payload: {ids, boxes, parent}}

      Property Description Example
      ids Unique identifier of a contained view cv-6756847835673673
      boxes Boxes of the contained view ['bs-246525214562', 'bo-55645636345634', 'bo-75783686583568']
      parent EditorBox where contained view is linked bo-54545345353
  • DELETE_FILE

    • Description: Deletes an uploaded file.

    • Use: {type: DELETE_FILE, payload: { id }

      Property Description Example
      id Unique identifier of the file file-124345345345
  • DELETE_NAV_ITEM

    • Description: Deletes a view.

    • Use: {type: DELETE_NAV_ITEM, payload: { ids, parent, boxes, containedViews, linkedBoxes }}

      Property Description Example
      ids Array with deleted view (selected in first position and all its descendants) ['se-575675674343', 'pa-5645645645654', 'pa-45465464522'
      parent Parent element of the view is going to be deleted 0 if is not any, se-456456456456456 if section
      boxes All boxes contained in the deleted views ['bo-36565625633', 'bo-453645635634', 'bo-353453453453']
      containedViews Contained views that depend from the deleted view ['cv-45645646456456', 'cv-64645645645645']
      linkedBoxes All boxes that like any of the deleted views ['bo-34534534534534', 'bo-345345345345', 'bo-435345345434']
  • DELETE_RICH_MARK

    • Description: Deletes a mark.

    • Use: {type: DELETE_RICH_MARK, payload: { mark }

      Property Description Example
      mark Object that contains the mark {id: 'rm-121312312', .....}
  • DELETE_SORTABLE_CONTAINER

    • Description: Deletes a SortableContainer.

    • Use: {type: DELETE_SORTABLE_CONTAINER, payload: { id, parent, children, cvs, page }}

      Property Description Example
      id Unique identifier of the SortableContainer sc-35345345353453
      parent Unique identifier of the EditorBoxSortable that depends from the SortableContainer bs-3453453453345
      children Every EditorBox from this container ['bo-234243243244', 'bo-3434534534534534', 'bo-67657575675675']
      cvs Contained views associated with content from the deleted container ['cv-121213244', 'cv-23232534534534', 'cv-6222357575675675']
      page Page where the container is pa-32323232336564
  • DROP_BOX

    • Description: Drops a box in a new location

    • Use: {type: DROP_BOX, payload: {id, row, col, parent, container, oldParent, oldContainer, position, index }}

      Property Description Example
      id Unique identifier of the EditorBox moved bo-34534543534535
      row Number of the destination row 1
      col Number of the destination column 2
      parent New parent of the box pa-23243423423432
      container New container of the box 0
      oldParent Old parent of the box bo-12313123121
      oldContainer Old container of the box sc-234234223423
      position New position of the box {x: 20, y: 30}
      index Order that the box occupies within its new siblings 2
  • DUPLICATE_NAV_ITEM

    • Descripción: Duplicates a view

    • Uso: {type: DUPLICATE_NAV_ITEM, payload: { id, newId, boxes, suffix, linkedCvs }}

      Propiedad Descripción Ejemplo
      id Identifier of the duplicated view pa-34534543534535
      newId Identifier of the new view pa-292399230492034
      boxes Duplicated boxes (key= old value, value = new value) {bo-2323423411112: 'bo-23234234443433'}
      suffix Suffix to add to the duplicated marks 43423423432
      linkedCvs Contained views {...}
  • EDIT_RICH_MARK

    • Description: Edits a mark.

    • Use: {type: EDIT_RICH_MARK, payload: { parent, state, mark, oldConnection, newConnection }}

      Property Description Example
      parent Unique identifier of EditorBox that the mark belongs bo-3434344333434
      state New state of the EditorBox { ..., __marks: { ... }
      mark Unique identifier of the mark rm-434343344343443
      oldConnection Old mark's connection cv-435345345345345: {...}
      newConnection New mark's connection pa-223345345345345
  • EXPAND_NAV_ITEM

    • Description: Expands a section.

    • Use: {type: EXPAND_NAV_ITEM, payload: {id, value}}

      Property Description Example
      id Unique identifier of the section se-34334322434434
      value Boolean value: true to expand, false to shrink true
  • IMPORT_STATE

    • Description: Imports a state

    • Use: {type: IMPORT_STATE, payload: {state}}

      Property Description Example
      state State saved in a remote server {boxesById: {...}, navItemsById:{...}
  • INCREASE_LEVEL

    • Description: Increase the depth level of box selection.
    • Use: {type: INCREASE_LEVEL, payload: {}}
  • INDEX_SELECT

    • Description: Selects a view/contained view to edit it from the index.

    • Use: {type: IMPORT_STATE, payload: {id}}

      Property Description Example
      id Unique identifier of the view or contained view selected se-3453534543535 o pa-345345435344 o cv-3433453453453454
  • MOVE_BOX

    • Description: Asigns new position to EditorBox.

    • Use: {type: MOVE_BOX, payload: {id, x, y, position, parent, container}}

      Property Description Example
      id Unique identifier of the EditorBox 'bo-4534534534543535`
      x New coordinate x 50
      y New coordinate y 10
      position If it is a floating or ordered EditorBox absolute or relative
      parent Unique identifier of the EditorBox, it can be a EditorBoxSortable or a view of the slide bs-4564564564456 o pa-3453453545654
      container Unique identifier of the EditorBox, that can be a SortableContainer or 0 if it is a floating box (in slides) 0 ó sc-55756755675
  • PASTE_BOX

    • Description: Pastes an EditorBox.

    • Use: {type: PASTE_BOX, payload: {ids, box, toolbar, children, index, marks, score}

      Property Description Example
      ids Identificadores únicos del parent, el container y la EditorBox en sí {id: "bo-1503570010369", parent: "bs-1497983247797", container: "sc-1503570010368"}
      box Content of the pasted box {id: 'bo-1503570010369', position: {...}, ...}
      toolbar Toolbar of the pasted box {state: {...}, structure: {...}, ...}
      children Children of the pasted box ['bo-12345678', 'bo-45689232', 'bo-987654321']
      index Index that the box will occupy witin its siblings 2
      marks List of marks of the box ['rm-12312312312','rm-234234234234']
      score Score weight of the box if it is an exercise 10
  • REORDER_BOXES

    • Description: Reordes boxes inside of the same parent.

    • Use: {type: REORDER_BOXES, payload: { parent, container, order }}

      Property Description Example
      parent Unique identifier of the parent of the EditorBox, it can be a EditorBoxSortable or a same type slide bs-4564564564456 o pa-3453453545654
      container Unique identifier of the container of the EditorBox, it can be a SortableContainer or 0 if that is a floating box (en slides) 0 ó sc-55756755675
      order Array with all EditorBox descendants ordered ['bo-2334534534534', 'bo-5435345345345', 'bo-433534534534']
  • REORDER_NAV_ITEM

    • Description: Reorders views (parents relationship can be changed).

    • Use: {type: REORDER_NAV_ITEM, payload: { id, newParent, oldParent, idsInOrder, childrenInOrder }}

      Property Description Example
      id Unique identifier of the view to be reordered pa-111111111111111
      newParent New identifier of the parent of thew view se-4334534534534545
      oldParent Old identifier of the parent of thew view 0
      idsInOrder All the news of the new level ['pa-5435435345345', 'pa-111111111111111', 'pa-22112122121212' ]
      childrenInOrder All children views of the view moved [] (In this case none, because only sections have children)
  • REORDER_SORTABLE_CONTAINER

    • Description: Reorder different containers of a EditorBoxSortable.

    • Use: {type: REORDER_SORTABLE_CONTAINER, payload: { ids, parent }}

      Property Description Example
      ids Ordered list of the SortableContainer ['sc-43453453453', 'sc-23223232323', 'sc-121212121212']
      parent EditorBoxSortable parent bs-234423423423432
  • RESIZE_BOX

    • Description: Changes size of the EditorBox).

    • Use: {type: RESIZE_BOX, payload: { id, structure }}

      Property Description Example
      id Unique identifier of the EditorBox bo-232442342222
      structure Updated structure section of the toolbar {x: 0, y: 0, width: '20', height: 'auto', ... }
  • RESIZE_SORTABLE_CONTAINER

    • Description: Changes size of the SortableContainer.

    • Use: {type: RESIZE_SORTABLE_CONTAINER, payload: {id, parent, height}}

      Property Description Example
      id Unique identifier of the SortableContainer sc-232442342222
      parent EditorBoxSortable parent bs-234423423423432
      height New height (in px) 200
  • SELECT_BOX

    • Description: Selects a EditorBox.

    • Use: {type: SELECT_BOX, payload: {id, box }}

      Property Description Example
      id Unique identifier of the EditorBox selected bo-232442342222
      box Object that contains the box corresponding to the id { id: 'bo-232442342222', ...}
  • SELECT_CONTAINED_VIEW

    • Description: Selects contained view

    • Use: {type: SELECT_CONTAINED_VIEW, payload: {id}}

      Property Description Example
      id Unique identifier of the contained view selected cv-1832442342222
  • SELECT_NAV_ITEM

    • Description: Selects a view.

    • Use: {type: SELECT_NAV_ITEM, payload: {id}}

      Property Description Example
      id Unique identifier of the selected view pa-1832442342222
  • SET_BUSY

    • Description: Sets busy server state for messages.

    • Use: {type: SET_BUSY, payload: {value, msg}}

      Property Description Example
      value Boolean value that tells if server is busy or not true o false
      msg Message that shows to user after change 'Guardando...'
  • SET_CORRECT_ANSWER

    • Description: Sets the score of an exercise or page.

    • Use: {type: SET_CORRECT_ANSWER, payload: { id, correctAnswer, page }

      Property Description Example
      id Unique identifier of the box bo-1323423432424
      correctAnswer Correct answer of the exercise 3
      page Unique identifier of the current page pa-1234234324234
  • TOGGLE_NAV_ITEM

    • Descripción: Collapses/expands a section of the index.

    • Uso: {type: TOGGLE_NAV_ITEM, payload: { id }}

      Property Description Example
      id Unique identifier of the section to expand/collapse se-1832442342222
  • TOGGLE_TEXT_EDITOR

    • Description: Activates text edition of a EditorBox.

    • Use: {type: TOGGLE_TEXT_EDITOR, payload: {caller, value}}

      Property Description Example
      caller Unique identifier of the EditorBox that will toggle text edition bo-33434343343434
      value Boolean value that indicates if text edition is activated or deactivated true o false
  • UPDATE_BOX

    • Description: Updates content of a EditorBox.

    • Use: {type: UPDATE_BOX, payload: {id, content, toolbar, state}}

      Property Description Example
      id Unique identifier of a EditorBox to be updated bo-33434343343434
      content HTML Content generated by the plugins API. ...
      toolbar Updated toolbar {...}
      state Updated state {...}
  • UPDATE_PLUGIN_TOOLBAR

    • Description: Updates the toolbar of a box.

    • Use: {type: UPDATE_PLUGIN_TOOLBAR, payload: {id, tab, accordion, name, value, deletedBoxes}

      Property Description Example
      id Unique identifier of the box bo-124345345345
      tab Tab of the toolbar modified (always main) main
      accordion Accordion of the toolbar modified state
      name Name of the field modified url
      value New value of the field http://google.com
      deletedBoxes Boxes that are deleted as a result of the modification ['bo-1246662345','bo-432423423423']
  • UPDATE_VIEW_TOOLBAR

    • Description: Updates the toolbar of a view.

    • Use: {type: UPDATE_VIEW_TOOLBAR, payload: {id, ...elements}

      Property Description Example
      id Unique identifier of the view bo-13432553453453453
      elements Updated elements in the toolbar of the view {...}
  • UPLOAD_FILE

    • Description: Uploads a new file.

    • Use: {type: UPLOAD_FILE, payload: {id, url, name, keywords, mimetype}

      Property Description Example
      id Unique identifier of the file file-124345345345
      url URL of the file http://...
      name Name of the file My image
      keywords Related keywords url
      mimetype MIME type of the file image
  • VERTICALLY_ALIGN_BOX

    • Description: Vertically aligns a EditorBox.

    • Use: {type: CHANGE_ROWS, payload: {id, verticalAlign}}

      Property Description Example
      id EditorBox unique identifier bo-2323223254545
      verticalAlign Vertical alignment value (CSS) middle
Clone this wiki locally