Permalink
Branch: master
Find file Copy path
561dcdb Dec 23, 2018
3 contributors

Users who have contributed to this file

@aeneasr @PeterKottas @arekkas
2424 lines (1408 sloc) 57.3 KB

Table of Contents

updateCellContent

packages/core/lib/actions/cell/core.js:46-54

An action creator for updating a cell's content data.

Parameters

  • id string The id of the cell that should be updated

Examples

// const store = redux.createStore()
// const cell = { id: '1', ... }
store.dispatch(updateCellContent(cell.id, { foo: 'bar' }))

Returns Action

updateCellLayout

packages/core/lib/actions/cell/core.js:66-74

An action creator for updating a cell's layout data.

Parameters

  • id string The id of the cell that should be updated

Examples

// const store = redux.createStore()
// const cell = { id: '1', ... }
store.dispatch(updateCellLayout(cell.id, { foo: 'bar' }))

Returns Action

removeCell

packages/core/lib/actions/cell/core.js:87-95

An action creator for removing a cell.

Parameters

  • id string The id of the cell that should be removed.
  • ids string An array of IDs for new cells that might be created.

Examples

// const store = redux.createStore()
// const cell = { id: '1', ... }
store.dispatch(removeCell(cell.id, ['1', '2', '3', '4', ...]))

Returns Action

resizeCell

packages/core/lib/actions/cell/core.js:108-116

An action creator for resizing a cell.

Parameters

  • id string The id of the cell that should be removed.
  • size number The cell's new size.

Examples

// const store = redux.createStore()
// const cell = { id: '1', ... }
store.dispatch(resizeCell(cell.id)(size))

Returns Function

focusCell

packages/core/lib/actions/cell/core.js:120-128

Dispatch to focus a cell.

Parameters

  • id

focusNextCell

packages/core/lib/actions/cell/core.js:132-136

Dispatch to focus a cell.

Parameters

  • id

focusPreviousCell

packages/core/lib/actions/cell/core.js:140-144

Dispatch to focus a cell.

Parameters

  • id

blurCell

packages/core/lib/actions/cell/core.js:148-152

Dispatch to blur a cell.

Parameters

  • id

blurAllCells

packages/core/lib/actions/cell/core.js:156-159

Dispatch to blur all cells. For example when clicking on document body.

createFallbackCell

packages/core/lib/actions/cell/core.js:163-171

Creates a fallback cell, usually done when an editable is empty.

Parameters

  • fallback
  • editable

cellHover

packages/core/lib/actions/cell/drag.js:42-54

Creates a redux action for when a cell hovers another item.

Parameters

  • _a
  • _b
  • level number Set the level if the dragged cells should hover over an ancestor of hover.
  • position string Can be left, right, above, below.
  • drag Cell The cell that is currently being dragged.
  • hover Cell The cell that is being hovered by the dragged cell.

Examples

// const store = redux.createStore()
store.dispatch(cellHover(drag, hover, level, position))

Returns Action

cellHoverLeftOf

packages/core/lib/actions/cell/drag.js:67-67

Creates a redux action for when a cell is hovering another cell on the left.

Parameters

  • drag Cell The cell that is currently being dragged.
  • hover Cell The cell that is being hovered by the dragged cell.
  • level number Set the level if the dragged cells should hover over an ancestor of hover.

Examples

// const store = redux.createStore()
store.dispatch(cellHoverLeftOf(drag, hover, level))

Returns Action

cellHoverRightOf

packages/core/lib/actions/cell/drag.js:80-80

Creates a redux action for when a cell is hovering another cell on the right.

Parameters

  • drag Cell The cell that is currently being dragged.
  • hover Cell The cell that is being hovered by the dragged cell.
  • level number Set the level if the dragged cells should hover over an ancestor of hover.

Examples

// const store = redux.createStore()
store.dispatch(cellHoverRightOf(drag, hover, level))

Returns Action

cellHoverAbove

packages/core/lib/actions/cell/drag.js:93-95

Creates a redux action for when a cell is hovering another cell above.

Parameters

  • drag Cell The cell that is currently being dragged.
  • hover Cell The cell that is being hovered by the dragged cell.
  • level number Set the level if the dragged cells should hover over an ancestor of hover.

Examples

// const store = redux.createStore()
store.dispatch(cellHoverAbove(drag, hover, level))

Returns Action

cellHoverBelow

packages/core/lib/actions/cell/drag.js:108-110

Creates a redux action for when a cell is hovering another cell below.

Parameters

  • drag Cell The cell that is currently being dragged.
  • hover Cell The cell that is being hovered by the dragged cell.
  • level number Set the level if the dragged cells should hover over an ancestor of hover.

Examples

// const store = redux.createStore()
store.dispatch(cellHoverBelow(drag, hover, level))

Returns Action

cellHoverInlineLeft

packages/core/lib/actions/cell/drag.js:122-124

Creates a redux action for when a cell is hovering another cell on the left, but inline (css floating).

Parameters

  • drag Cell The cell that is currently being dragged.
  • hover Cell The cell that is being hovered by the dragged cell.

Examples

// const store = redux.createStore()
store.dispatch(cellHoverInlineLeft(drag, hover))

Returns Action

cellHoverInlineRight

packages/core/lib/actions/cell/drag.js:136-138

Creates a redux action for when a cell is hovering another cell on the right, but inline (css floating).

Parameters

  • drag Cell The cell that is currently being dragged.
  • hover Cell The cell that is being hovered by the dragged cell.

Examples

// const store = redux.createStore()
store.dispatch(cellHoverInlineRight(drag, hover))

Returns Action

dragCell

packages/core/lib/actions/cell/drag.js:150-154

Creates a redux action for when a cell is being dragged.

Parameters

  • id string The id of the cell that is being dragged.

Examples

// const store = redux.createStore()
// const cell = { id: '1', ... }
store.dispatch(dragCell(cell.id))

Returns Action

clearHover

packages/core/lib/actions/cell/drag.js:160-163

Creates a redux action to clear hover state of all cells.

Returns Action

cancelCellDrag

packages/core/lib/actions/cell/drag.js:175-178

Creates a redux action for when cell dragging ends.

Parameters

Examples

// const store = redux.createStore()
// const cell = { id: '1', ... }
store.dispatch(cancelCellDrag(cell.id))

Returns Action

insertCellBelow

packages/core/lib/actions/cell/insert.js:80-80

Insert a cell below of the hovering cell.

insertCellAbove

packages/core/lib/actions/cell/insert.js:84-84

Insert a cell above of the hovering cell.

insertCellRightOf

packages/core/lib/actions/cell/insert.js:88-88

Insert a cell right of the hovering cell.

insertCellLeftOf

packages/core/lib/actions/cell/insert.js:92-92

Insert a cell left of the hovering cell.

insertCellLeftInline

packages/core/lib/actions/cell/insert.js:96-96

Insert a cell inside the hovering cell, on the left.

insertCellRightInline

packages/core/lib/actions/cell/insert.js:100-100

Insert a cell inside the hovering cell, on the right.

insertMode

packages/core/lib/actions/display.js:44-44

Dispatch to switch to insert display mode.

editMode

packages/core/lib/actions/display.js:48-48

Dispatch to switch to edit display mode.

previewMode

packages/core/lib/actions/display.js:52-52

Dispatch to switch to preview display mode.

layoutMode

packages/core/lib/actions/display.js:56-56

Dispatch to switch to layout display mode.

resizeMode

packages/core/lib/actions/display.js:60-60

Dispatch to switch to resize display mode.

previousMode

packages/core/lib/actions/display.js:64-67

Dispatch to switch to the last display mode, or the fallback if reverting is not possible.

Parameters

  • fallback

PureComponent

packages/core/lib/components/Cell/Content/index.js:62-121

PureComponent

packages/core/lib/components/Cell/Draggable/index.js:68-99

PureComponent

packages/core/lib/components/Cell/Droppable/index.js:65-84

PureComponent

packages/core/lib/components/Cell/index.js:85-105

PureComponent

packages/core/lib/components/Cell/Inner/index.js:65-90

PureComponent

packages/core/lib/components/Cell/Layout/index.js:67-132

PureComponent

packages/core/lib/components/Cell/Resizable/index.js:54-90

PureComponent

packages/core/lib/components/Cell/Rows/index.js:49-59

PureComponent

packages/core/lib/components/DragDropContext/index.js:57-66

PureComponent

packages/core/lib/components/Editable/index.js:53-94

PureComponent

packages/core/lib/components/Editable/Inner/index.js:56-91

PureComponent

packages/core/lib/components/Row/index.js:67-82

Component

packages/core/lib/components/Dimensions/index.js:66-129

Component

packages/core/lib/components/HotKey/Decorator.js:77-157

Component

packages/core/lib/components/Row/Droppable/index.js:61-73

PositionEnum

packages/core/lib/const.js:27-27

A list of positions in the layout space.

isProduction

packages/core/lib/const.js:39-39

Is true if built in production mode.

Editor

packages/core/lib/index.js:85-147

Editor is the core interface for dealing with the editor.

Editor

packages/core/lib/index.js:85-147

isHoveringThis

packages/core/lib/reducer/editable/helper/hover.js:17-27

Check if this item is currently being hovered.

Parameters

  • state
  • action

sumSizes

packages/core/lib/reducer/editable/helper/sizing.js:39-50

Sum up cell sizes: Σ(cell[size]).

Parameters

  • cells

computeBounds

packages/core/lib/reducer/editable/helper/sizing.js:54-60

Updates each cell's size boundaries.

Parameters

  • cells

computeResizeable

packages/core/lib/reducer/editable/helper/sizing.js:64-67

Computes if a cell is resizable.

Parameters

  • cells

computeInlines

packages/core/lib/reducer/editable/helper/sizing.js:71-84

Computes sizes an inline element was found.

Parameters

  • cells

resizeCells

packages/core/lib/reducer/editable/helper/sizing.js:88-106

Resize cells.

Parameters

  • cells
  • _a

computeSizes

packages/core/lib/reducer/editable/helper/sizing.js:113-123

Balance cell sizes.

Parameters

  • cells [...cell]

Returns [...cell]

ory

packages/core/src/reducer/index.js:48-48

Examples

import { oryReducer } from 'ory-editor-core'
const reducer = combineReducers({
  ory: oryReducer,
  // ...
})
const store = createStore(reducer, null, middleware)
new Editor({ store })

classes

packages/core/lib/service/hover/index.js:70-86

NO (None): No drop zone.

Corners are counted clockwise, beginning top left C1 (Corner top left): Position decided by top left corner function C2 (Corner top right): Position decided by top right corner function C3 (Corner bottom right): Position decided by bottom right corner function C4 (Corner bottom left): Position decided by bottom left corner function

Above: AH (Above here): above, same level AA (Above of self or some ancestor): Above, compute active level using classification functions, e.g. log, sin, mx + t

Below: BH (Below here) BA (Below of self or some ancestor)

Left of: LH (Left of here) LA (Left of self or some ancestor)

Right of: RH (Right of here) RA (Right of self or some ancestor)

Inside / inline IL (Inline left) IR (Inline right)

defaultMatrices

packages/core/lib/service/hover/index.js:93-126

A list of matrices that are used to define the callback function.

getRoomScale

packages/core/lib/service/hover/index.js:134-144

Computes the average width and height for cells in a room.

Parameters

  • _a
  • room
  • matrix

Returns {x: number, y: number}

defaultMatrices

packages/core/src/service/hover/index.js:99-132

A list of matrices that are used to define the callback function.

Type: MatrixList

getMouseHoverCell

packages/core/lib/service/hover/index.js:151-157

Returns the index of the hover cell.

Parameters

  • _a
  • mouse
  • scale

relativeMousePosition

packages/core/lib/service/hover/index.js:222-228

Return the mouse position relative to the cell.

Parameters

  • _a

computeLevel

packages/core/lib/service/hover/index.js:232-248

Computes the drop level based on the mouse position and the cell width.

Parameters

  • _a

computeHorizontal

packages/core/lib/service/hover/index.js:260-276

Computes the horizontal drop level based on the mouse position.

Parameters

  • _a
  • inv returns the inverse drop level. Usually true for left and above drop level computation.
  • mouse
  • position
  • hover
  • scale
  • level

Returns any number

computeVertical

packages/core/lib/service/hover/index.js:282-298

Computes the vertical drop level based on the mouse position.

Parameters

  • _a
  • inv

Returns any number

defaultCallbacks

packages/core/lib/service/hover/index.js:303-426

A list of callbacks.

generateMissingIds

packages/core/lib/service/plugin/index.js:57-66

Iterate through an editable content tree and generate ids where missing.

Parameters

  • props

last

packages/core/lib/service/hover/index.js:161-161

Used for caching.

HoverService

packages/core/lib/service/hover/index.js:432-450

The HoverService uses callbacks and matrices to compute hover logic.

HoverService

packages/core/lib/service/hover/index.js:432-450

I18n

packages/core/lib/service/i18n/index.js:24-29

Logger

packages/core/lib/service/logger/index.js:33-107

warn

packages/core/lib/service/logger/index.js:40-46

Logs a warning. Warnings are things that are exceptional, but easily to recover from.

debug

packages/core/lib/service/logger/index.js:51-57

Logs a debug message. Debug messages are things that help developers debugging things.

info

packages/core/lib/service/logger/index.js:62-68

Logs an info. Infos are things that might be interesting for someone who needs to take a closer look.

error

packages/core/lib/service/logger/index.js:73-80

Logs an error. Error are things that are exceptional, but can be recovered from.

fatal

packages/core/lib/service/logger/index.js:85-93

Logs a fatal error. Fatal errors are things that are exceptional and can not be recovered from.

log

packages/core/lib/service/logger/index.js:98-105

Logs a message.

Migration

packages/core/lib/service/plugin/classes.js:44-61

Migration

packages/core/lib/service/plugin/classes.js:44-61

Plugin

packages/core/lib/service/plugin/classes.js:67-162

serialize

packages/core/lib/service/plugin/classes.js:76-76

Serialize a the plugin state

Parameters

  • raw the raw state.

Returns any the serialized state.

unserialize

packages/core/lib/service/plugin/classes.js:83-83

Unserialize the plugin state.

Parameters

  • state the plugin state.

Returns any the unserialized state.

handleRemoveHotKey

packages/core/lib/service/plugin/classes.js:92-94

Will be called when the user presses the delete key. When returning a resolving promise, the cell will be removed. If the promise is rejected, nothing happens.

Parameters

  • e
  • props

Returns any a promise

handleFocusNextHotKey

packages/core/lib/service/plugin/classes.js:103-103

Will be called when the user presses the right or down key. When returning a resolving promise, the next cell will be focused. If the promise is rejected, focus stays the same.

Parameters

  • e
  • props

Returns any a promise

handleFocusPreviousHotKey

packages/core/lib/service/plugin/classes.js:112-112

Will be called when the user presses the left or up key. When returning a resolving promise, the next cell will be focused. If the promise is rejected, focus stays the same.

Parameters

  • e
  • props

Returns any a promise

handleFocus

packages/core/lib/service/plugin/classes.js:118-118

This function will be called when one of the plugin's cell is blurred.

Parameters

  • props
  • focusSource
  • ref

handleBlur

packages/core/lib/service/plugin/classes.js:124-124

This function will be called when one of the plugin's cell is focused.

Parameters

  • props

reducer

packages/core/lib/service/plugin/classes.js:132-132

Specify a custom reducer for the plugin's cell.

Parameters

  • state
  • action

Plugin

packages/core/lib/service/plugin/classes.js:67-162

serialize

packages/core/lib/service/plugin/classes.js:76-76

Serialize a the plugin state

Parameters

  • raw the raw state.

Returns any the serialized state.

unserialize

packages/core/lib/service/plugin/classes.js:83-83

Unserialize the plugin state.

Parameters

  • state the plugin state.

Returns any the unserialized state.

handleRemoveHotKey

packages/core/lib/service/plugin/classes.js:92-94

Will be called when the user presses the delete key. When returning a resolving promise, the cell will be removed. If the promise is rejected, nothing happens.

Parameters

  • e
  • props

Returns any a promise

handleFocusNextHotKey

packages/core/lib/service/plugin/classes.js:103-103

Will be called when the user presses the right or down key. When returning a resolving promise, the next cell will be focused. If the promise is rejected, focus stays the same.

Parameters

  • e
  • props

Returns any a promise

handleFocusPreviousHotKey

packages/core/lib/service/plugin/classes.js:112-112

Will be called when the user presses the left or up key. When returning a resolving promise, the next cell will be focused. If the promise is rejected, focus stays the same.

Parameters

  • e
  • props

Returns any a promise

handleFocus

packages/core/lib/service/plugin/classes.js:118-118

This function will be called when one of the plugin's cell is blurred.

Parameters

  • props
  • focusSource
  • ref

handleBlur

packages/core/lib/service/plugin/classes.js:124-124

This function will be called when one of the plugin's cell is focused.

Parameters

  • props

reducer

packages/core/lib/service/plugin/classes.js:132-132

Specify a custom reducer for the plugin's cell.

Parameters

  • state
  • action

Plugin

packages/core/lib/service/plugin/classes.js:168-196

serialize

packages/core/lib/service/plugin/classes.js:76-76

Serialize a the plugin state

Parameters

  • raw the raw state.

Returns any the serialized state.

unserialize

packages/core/lib/service/plugin/classes.js:83-83

Unserialize the plugin state.

Parameters

  • state the plugin state.

Returns any the unserialized state.

handleRemoveHotKey

packages/core/lib/service/plugin/classes.js:92-94

Will be called when the user presses the delete key. When returning a resolving promise, the cell will be removed. If the promise is rejected, nothing happens.

Parameters

  • e
  • props

Returns any a promise

handleFocusNextHotKey

packages/core/lib/service/plugin/classes.js:103-103

Will be called when the user presses the right or down key. When returning a resolving promise, the next cell will be focused. If the promise is rejected, focus stays the same.

Parameters

  • e
  • props

Returns any a promise

handleFocusPreviousHotKey

packages/core/lib/service/plugin/classes.js:112-112

Will be called when the user presses the left or up key. When returning a resolving promise, the next cell will be focused. If the promise is rejected, focus stays the same.

Parameters

  • e
  • props

Returns any a promise

handleFocus

packages/core/lib/service/plugin/classes.js:118-118

This function will be called when one of the plugin's cell is blurred.

Parameters

  • props
  • focusSource
  • ref

handleBlur

packages/core/lib/service/plugin/classes.js:124-124

This function will be called when one of the plugin's cell is focused.

Parameters

  • props

reducer

packages/core/lib/service/plugin/classes.js:132-132

Specify a custom reducer for the plugin's cell.

Parameters

  • state
  • action

Plugin

packages/core/lib/service/plugin/classes.js:202-229

serialize

packages/core/lib/service/plugin/classes.js:76-76

Serialize a the plugin state

Parameters

Returns Object the serialized state.

unserialize

packages/core/lib/service/plugin/classes.js:83-83

Unserialize the plugin state.

Parameters

  • state Object the plugin state.

Returns Object the unserialized state.

handleRemoveHotKey

packages/core/lib/service/plugin/classes.js:92-94

Will be called when the user presses the delete key. When returning a resolving promise, the cell will be removed. If the promise is rejected, nothing happens.

Parameters

  • e Event
  • props ContentPluginProps<any>

Returns Promise<any> a promise

handleFocusNextHotKey

packages/core/lib/service/plugin/classes.js:103-103

Will be called when the user presses the right or down key. When returning a resolving promise, the next cell will be focused. If the promise is rejected, focus stays the same.

Parameters

  • e Event
  • props ContentPluginProps<any>

Returns Promise<any> a promise

handleFocusPreviousHotKey

packages/core/lib/service/plugin/classes.js:112-112

Will be called when the user presses the left or up key. When returning a resolving promise, the next cell will be focused. If the promise is rejected, focus stays the same.

Parameters

  • e Event
  • props ContentPluginProps<any>

Returns Promise<any> a promise

handleFocus

packages/core/lib/service/plugin/classes.js:118-118

This function will be called when one of the plugin's cell is blurred.

Parameters

  • props
  • focusSource
  • ref

Returns void

handleBlur

packages/core/lib/service/plugin/classes.js:124-124

This function will be called when one of the plugin's cell is focused.

Parameters

  • props ContentPluginProps<any>

Returns void

reducer

packages/core/lib/service/plugin/classes.js:132-132

Specify a custom reducer for the plugin's cell.

Parameters

  • state any
  • action any

Plugin

packages/core/lib/service/plugin/classes.js:231-261

serialize

packages/core/lib/service/plugin/classes.js:76-76

Serialize a the plugin state

Parameters

  • raw the raw state.

Returns any the serialized state.

unserialize

packages/core/lib/service/plugin/classes.js:83-83

Unserialize the plugin state.

Parameters

  • state the plugin state.

Returns any the unserialized state.

handleRemoveHotKey

packages/core/lib/service/plugin/classes.js:92-94

Will be called when the user presses the delete key. When returning a resolving promise, the cell will be removed. If the promise is rejected, nothing happens.

Parameters

  • e
  • props

Returns any a promise

handleFocusNextHotKey

packages/core/lib/service/plugin/classes.js:103-103

Will be called when the user presses the right or down key. When returning a resolving promise, the next cell will be focused. If the promise is rejected, focus stays the same.

Parameters

  • e
  • props

Returns any a promise

handleFocusPreviousHotKey

packages/core/lib/service/plugin/classes.js:112-112

Will be called when the user presses the left or up key. When returning a resolving promise, the next cell will be focused. If the promise is rejected, focus stays the same.

Parameters

  • e
  • props

Returns any a promise

handleFocus

packages/core/lib/service/plugin/classes.js:118-118

This function will be called when one of the plugin's cell is blurred.

Parameters

  • props
  • focusSource
  • ref

handleBlur

packages/core/lib/service/plugin/classes.js:124-124

This function will be called when one of the plugin's cell is focused.

Parameters

  • props

reducer

packages/core/lib/service/plugin/classes.js:132-132

Specify a custom reducer for the plugin's cell.

Parameters

  • state any
  • action any

ContentPlugin

packages/core/lib/service/plugin/classes.js:168-196

createInitialState

packages/core/lib/service/plugin/classes.js:178-178

Create the plugin's initial state.

Returns any the initial state.

createInitialState

packages/core/lib/service/plugin/classes.js:211-211

Create the plugin's initial state.

Returns Object the initial state.

createInitialState

packages/core/lib/service/plugin/classes.js:247-247

Create the plugin's initial state.

Returns Object the initial state.

reducer

packages/core/lib/service/plugin/classes.js:186-186

Specify a custom reducer for the plugin's cell.

Parameters

  • state
  • action

createInitialChildren

packages/core/lib/service/plugin/classes.js:218-218

Create the plugin's initial children (rows/cells).

Returns Object the initial state.

createInitialChildren

packages/core/lib/service/plugin/classes.js:241-241

Create the plugin's initial children (rows/cells).

Returns any the initial state.

LayoutPlugin

packages/core/lib/service/plugin/classes.js:202-229

PluginService

packages/core/lib/service/plugin/index.js:70-285

PluginService is a registry of all content and layout plugins known to the editor.

findLayoutPlugin

packages/core/lib/service/plugin/index.js:135-146

Finds a layout plugin based on its name and version.

Parameters

  • name
  • version

findContentPlugin

packages/core/lib/service/plugin/index.js:150-161

Finds a content plugin based on its name and version.

Parameters

  • name
  • version

getRegisteredNames

packages/core/lib/service/plugin/index.js:165-171

Returns a list of all known plugin names.

PluginService

packages/core/lib/service/plugin/index.js:70-285

findLayoutPlugin

packages/core/lib/service/plugin/index.js:135-146

Finds a layout plugin based on its name and version.

Parameters

  • name
  • version

findContentPlugin

packages/core/lib/service/plugin/index.js:150-161

Finds a content plugin based on its name and version.

Parameters

  • name
  • version

getRegisteredNames

packages/core/lib/service/plugin/index.js:165-171

Returns a list of all known plugin names.

PluginService

packages/core/lib/service/plugin/index.js:74-283

Instantiate a new PluginService instance. You can provide your own set of content and layout plugins here.

Parameters

  • _a

findLayoutPlugin

packages/core/lib/service/plugin/index.js:135-146

Finds a layout plugin based on its name and version.

Parameters

  • name
  • version

findContentPlugin

packages/core/lib/service/plugin/index.js:150-161

Finds a content plugin based on its name and version.

Parameters

  • name
  • version

getRegisteredNames

packages/core/lib/service/plugin/index.js:165-171

Returns a list of all known plugin names.

default

packages/core/lib/store.js:33-42

Returns a new redux store.

Parameters

  • initialState
  • middleware