Browse Source

Up Block doc

pull/4363/head
Artur Arseniev 4 years ago
parent
commit
c512ee25f5
  1. 14
      docs/api/block.md
  2. 4
      src/block_manager/model/Block.js

14
docs/api/block.md

@ -2,8 +2,6 @@
## Block ## Block
### Properties ### Properties
* `label` **[String][1]** Block label, eg. `My block` * `label` **[String][1]** Block label, eg. `My block`
@ -17,31 +15,31 @@
* `onClick` **[Function][5]?** Custom behavior on click, eg. `(block, editor) => editor.getWrapper().append(block.get('content'))` * `onClick` **[Function][5]?** Custom behavior on click, eg. `(block, editor) => editor.getWrapper().append(block.get('content'))`
* `attributes` **[Object][2]?** Block attributes to apply in the view element * `attributes` **[Object][2]?** Block attributes to apply in the view element
### getId ## getId
Get block id Get block id
Returns **[String][1]** Returns **[String][1]**
### getLabel ## getLabel
Get block label Get block label
Returns **[String][1]** Returns **[String][1]**
### getMedia ## getMedia
Get block media Get block media
Returns **[String][1]** Returns **[String][1]**
### getContent ## getContent
Get block content Get block content
Returns **([Object][2] | [String][1] | [Array][6]<([Object][2] | [String][1])>)** Component definition | HTML string Returns **([Object][2] | [String][1] | [Array][6]<([Object][2] | [String][1])>)**
### getCategoryLabel ## getCategoryLabel
Get block category label Get block category label

4
src/block_manager/model/Block.js

@ -12,6 +12,8 @@ import { isFunction } from 'underscore';
* @property {Boolean} [disable=false] Disable the block from being interacted * @property {Boolean} [disable=false] Disable the block from being interacted
* @property {Function} [onClick] Custom behavior on click, eg. `(block, editor) => editor.getWrapper().append(block.get('content'))` * @property {Function} [onClick] Custom behavior on click, eg. `(block, editor) => editor.getWrapper().append(block.get('content'))`
* @property {Object} [attributes={}] Block attributes to apply in the view element * @property {Object} [attributes={}] Block attributes to apply in the view element
*
* @module docsjs.Block
*/ */
export default class Block extends Model { export default class Block extends Model {
defaults() { defaults() {
@ -55,7 +57,7 @@ export default class Block extends Model {
/** /**
* Get block content * Get block content
* @returns {Object|String|Array<Object|String>} Component definition | HTML string * @returns {Object|String|Array<Object|String>}
*/ */
getContent() { getContent() {
return this.get('content'); return this.get('content');

Loading…
Cancel
Save