Last active
September 5, 2022 06:58
-
-
Save bwalex/9967004ee9b7deb36d1a19d7d8f87fdb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | |
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | |
var _withHandlers; | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | |
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | |
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | |
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | |
import * as React from 'react'; | |
import { Value, State } from 'slate'; | |
import { Editor as Slate, getEventTransfer } from 'slate-react'; | |
import EditList from 'slate-edit-list'; | |
import SoftBreak from 'slate-soft-break'; | |
import PasteLinkify from 'slate-paste-linkify'; | |
import CollapseOnEscape from 'slate-collapse-on-escape'; | |
import EditBlockquote from 'slate-edit-blockquote'; | |
import EditTable from 'slate-edit-table'; | |
import NoEmpty from 'slate-no-empty'; | |
// XXX: https://github.com/google/closure-compiler/issues/2634 | |
import * as TrailingBlock from 'slate-trailing-block'; | |
import * as omit from 'ramda/src/omit'; | |
import { compose, mapProps, withState, withHandlers, withStateHandlers } from 'recompose'; | |
import { isKeyHotkey } from 'is-hotkey'; | |
import SlateCodePlugin from './slate-code.js'; | |
import { EditorLink as EditorLink_, InsertLinkModal as InsertLinkModal_ } from "goog:dlt.components.editor.link"; | |
import { CheckListItem as CheckListItem_, CheckList } from "goog:dlt.components.editor.check"; | |
import { Toolbar as Toolbar_ } from "goog:dlt.components.editor.toolbar"; | |
var editorLineToBlock = function editorLineToBlock(text, marks) { | |
return { | |
"object": "block", | |
"type": "paragraph", | |
"nodes": [{ | |
"object": "text", | |
"leaves": [{ | |
"text": text, | |
"marks": marks ? marks.map(function (m) { | |
return { "type": m }; | |
}) : [] | |
}] | |
}] | |
}; | |
}; | |
var warningToBlock = function warningToBlock(text) { | |
return editorLineToBlock(text, ["highlighted"]); | |
}; | |
export var editorStateFromText = function editorStateFromText(text, warning) { | |
return JSON.stringify({ | |
"document": { | |
"nodes": [].concat(warning ? warningToBlock(warning) : [], text.split(/\n/).map(function (l) { | |
return editorLineToBlock(l, []); | |
})) | |
} | |
}); | |
}; | |
export var editorEmptyState = editorStateFromText("", null); | |
export function editorDeserialize(s) { | |
var t = typeof s === 'string' ? s : ""; | |
try { | |
return Value.fromJSON(JSON.parse(s)); | |
} catch (e) { | |
var msg = "WARNING: " + (e.message || "" + e); | |
var _s = JSON.parse(editorStateFromText(t, msg)); | |
return Value.fromJSON(_s); | |
} | |
} | |
export function editorSerialize(state) { | |
return JSON.stringify(state.toJSON()); | |
} | |
var DEFAULT_NODE = 'paragraph'; | |
var listPlugin = EditList({ | |
types: ['numbered-list', 'bulleted-list', 'check-list'], | |
typeItem: 'list-item', | |
typeDefault: DEFAULT_NODE | |
}); | |
var tablePlugin = EditTable({ | |
typeTable: 'table', | |
typeRow: 'table-row', | |
typeCell: 'table-cell', | |
typeDefault: DEFAULT_NODE | |
}); | |
var blockquotePlugin = EditBlockquote({ | |
type: 'block-quote' | |
}); | |
// XXX: add DropOrPasteImages | |
var plugins = [CollapseOnEscape(), listPlugin, blockquotePlugin, SlateCodePlugin({ | |
blockName: 'code' | |
}), SoftBreak({ | |
onlyIn: ['code', 'table-cell'] | |
}), tablePlugin, PasteLinkify({ | |
type: 'link', | |
collapseTo: 'end' | |
}), | |
//NoEmpty(DEFAULT_NODE), | |
TrailingBlock({ type: DEFAULT_NODE })]; | |
var EditorLink = compose(withHandlers((_withHandlers = {}, _defineProperty(_withHandlers, 'on-link-remove', function onLinkRemove(_ref) { | |
var editor = _ref.editor, | |
value = _ref.value; | |
return function () { | |
editor.change(function (change) { | |
change.unwrapInline('link'); | |
}); | |
}; | |
}), _defineProperty(_withHandlers, 'on-link-change', function onLinkChange(_ref2) { | |
var editor = _ref2.editor, | |
value = _ref2.value, | |
node = _ref2.node; | |
return function (newHref) { | |
editor.change(function (change) { | |
change.setNodeByKey(node.key, { | |
data: { | |
href: newHref | |
} | |
}); | |
}); | |
}; | |
}), _withHandlers)), mapProps(omit(['node', 'nodeKey', 'value', 'editor'])))(EditorLink_); | |
var InsertLinkModal = compose(mapProps(function (props) { | |
return _extends({}, props, _defineProperty({}, 'has-text', props.value.isExpanded)); | |
}), withHandlers(_defineProperty({}, 'on-submit', function onSubmit(_ref3) { | |
var value = _ref3.value, | |
onChange = _ref3.onChange, | |
onClose = _ref3.onClose; | |
return function (newText, url) { | |
var transform = value.change(); | |
if (value.isExpanded) { | |
transform = transform.wrapInline({ | |
type: 'link', | |
data: { href: url } | |
}); | |
} else { | |
transform = transform.insertText(newText).extend(0 - newText.length).wrapInline({ | |
type: 'link', | |
data: { href: url } | |
}).collapseToEnd(); | |
} | |
onClose(); | |
onChange(transform); | |
}; | |
})))(InsertLinkModal_); | |
function Table(_ref4) { | |
var children = _ref4.children, | |
node = _ref4.node, | |
otherProps = _objectWithoutProperties(_ref4, ['children', 'node']); | |
var childrenArray = React.Children.toArray(children); | |
var hasHeaders = !node.get('data').get('headless'); | |
var headerChildren = hasHeaders ? childrenArray.slice(0, 1) : []; | |
var bodyChildren = childrenArray.slice(hasHeaders ? 1 : 0); | |
return React.createElement( | |
'table', | |
null, | |
hasHeaders && React.createElement( | |
'thead', | |
null, | |
headerChildren | |
), | |
React.createElement( | |
'tbody', | |
null, | |
bodyChildren | |
) | |
); | |
} | |
var CheckListItem = compose(withHandlers(_defineProperty({}, 'on-change', function onChange(_ref5) { | |
var editor = _ref5.editor, | |
value = _ref5.value, | |
nodeKey = _ref5.nodeKey; | |
return function (checked) { | |
editor.change(function (change) { | |
change.setNodeByKey(nodeKey, { | |
data: { | |
checked: checked | |
} | |
}); | |
}); | |
}; | |
})), mapProps(omit(['node', 'nodeKey', 'value', 'editor'])))(CheckListItem_); | |
var renderNode = function renderNode(readOnly) { | |
return function (props) { | |
var type = props.node.type; | |
switch (type) { | |
case 'block-quote': | |
return React.createElement( | |
'blockquote', | |
props.attributes, | |
props.children | |
); | |
case 'code': | |
return React.createElement( | |
'pre', | |
props.attributes, | |
React.createElement( | |
'code', | |
null, | |
props.children | |
) | |
); | |
case 'divider': | |
return React.createElement('hr', props.attributes); | |
case 'link': | |
var node = props.node, | |
_props$editor = props.editor; | |
_props$editor = _props$editor === undefined ? {} : _props$editor; | |
var value = _props$editor.value; | |
var isSelected = !readOnly && value && value.isCollapsed && value.inlines.size === 1 && value.inlines.first().key === node.key; | |
return React.createElement( | |
EditorLink, | |
_extends({}, props.attributes, { 'is-selected': isSelected, node: props.node, value: props.editor.value, editor: props.editor, href: props.node.data.get('href'), title: props.node.data.get('title') }), | |
props.children | |
); | |
case 'image': | |
return React.createElement('img', _extends({}, props.attributes, { src: props.node.data.get('src'), title: props.node.data.get('title'), alt: props.node.data.get('alt') })); | |
case 'bulleted-list': | |
return React.createElement( | |
'ul', | |
props.attributes, | |
props.children | |
); | |
case 'check-list': | |
return React.createElement( | |
CheckList, | |
props.attributes, | |
props.children | |
); | |
case 'list-item': | |
var document = props.editor.value.document; | |
var parent = document.getParent(props.node.key); | |
var checkItem = parent.data.get('check'); | |
var checked = props.node.data.get('checked') || false; | |
if (checkItem) { | |
return React.createElement( | |
CheckListItem, | |
_extends({ disabled: readOnly, checked: checked, nodeKey: props.node.key, value: props.editor.value, editor: props.editor }, props.attributes), | |
props.children | |
); | |
} else { | |
return React.createElement( | |
'li', | |
props.attributes, | |
props.children | |
); | |
} | |
case 'numbered-list': | |
return React.createElement( | |
'ol', | |
props.attributes, | |
props.children | |
); | |
case 'heading-one': | |
return React.createElement( | |
'h1', | |
props.attributes, | |
props.children | |
); | |
case 'heading-two': | |
return React.createElement( | |
'h2', | |
props.attributes, | |
props.children | |
); | |
case 'heading-three': | |
return React.createElement( | |
'h3', | |
props.attributes, | |
props.children | |
); | |
case 'heading-four': | |
return React.createElement( | |
'h4', | |
props.attributes, | |
props.children | |
); | |
case 'heading-five': | |
return React.createElement( | |
'h5', | |
props.attributes, | |
props.children | |
); | |
case 'heading-six': | |
return React.createElement( | |
'h6', | |
props.attributes, | |
props.children | |
); | |
case 'paragraph': | |
return React.createElement( | |
'p', | |
props.attributes, | |
props.children | |
); | |
case 'table': | |
return React.createElement( | |
Table, | |
_extends({}, props.attributes, { node: props.node }), | |
props.children | |
); // XXX: align | |
case 'table-row': | |
return props.node.data.get('header') ? React.createElement( | |
'tr', | |
props.attributes, | |
props.children | |
) : React.createElement( | |
'tr', | |
props.attributes, | |
props.children | |
); | |
case 'table-cell': | |
var data = props.node.data; | |
var textAlign = ['left', 'right', 'center'].indexOf(data.get('textAlign')) === -1 ? 'left' : data.get('textAlign'); | |
return props.node.data.get('header') ? React.createElement( | |
'th', | |
_extends({ style: { textAlign: textAlign } }, props.attributes), | |
props.children | |
) : React.createElement( | |
'td', | |
_extends({ style: { textAlign: textAlign } }, props.attributes), | |
props.children | |
); | |
default: | |
return React.createElement( | |
'div', | |
null, | |
'Unknown node!' | |
); | |
} | |
}; | |
}; | |
function renderMark(props) { | |
var _markStyles; | |
var children = props.children, | |
mark = props.mark; | |
var markStyles = (_markStyles = {}, _defineProperty(_markStyles, 'bold', { | |
'fontWeight': 'bold' | |
}), _defineProperty(_markStyles, 'code', { | |
fontFamily: 'monospace', | |
backgroundColor: '#eee', | |
padding: '3px', | |
borderRadius: '4px' | |
}), _defineProperty(_markStyles, 'italic', { | |
fontStyle: 'italic' | |
}), _defineProperty(_markStyles, 'underlined', { | |
textDecoration: 'underline' | |
}), _defineProperty(_markStyles, 'strikethrough', { | |
textDecoration: 'line-through' | |
}), _defineProperty(_markStyles, 'highlighted', { | |
backgroundColor: 'yellow' | |
}), _markStyles); | |
var style = markStyles[mark.type]; | |
return React.createElement( | |
'span', | |
{ style: style }, | |
children | |
); | |
} | |
export var Editor = function (_React$Component) { | |
_inherits(Editor, _React$Component); | |
function Editor(props) { | |
_classCallCheck(this, Editor); | |
var _this = _possibleConstructorReturn(this, (Editor.__proto__ || Object.getPrototypeOf(Editor)).call(this, props)); | |
_this.editor = null; | |
_this.hasMark = function (type) { | |
return _this.props.value.marks.some(function (mark) { | |
return mark.type === type; | |
}); | |
}; | |
_this.hasBlock = function (type) { | |
return _this.props.value.blocks.some(function (node) { | |
return node.type === type; | |
}); | |
}; | |
_this.hasInline = function (type) { | |
return _this.props.value.inlines.some(function (inline) { | |
return inline.type === type; | |
}); | |
}; | |
_this.onChange = function (change) { | |
if (_this.props.onChange) _this.props.onChange(change.value); | |
}; | |
_this.toggleMark = function (type) { | |
var change = _this.props.value.change().toggleMark(type); | |
_this.onChange(change); | |
}; | |
_this.toggleBlock = function (type) { | |
var change = _this.props.value.change(); | |
var active = _this.hasBlock(type); | |
if (type === 'block-quote') { | |
if (blockquotePlugin.utils.isSelectionInBlockquote(_this.props.value)) change.call(blockquotePlugin.changes.unwrapBlockquote);else change.call(blockquotePlugin.changes.wrapInBlockquote); | |
} else if (type === 'code') { | |
change = change.setBlock(active ? DEFAULT_NODE : 'code'); | |
} else { | |
change = change.setBlock(active ? DEFAULT_NODE : type); | |
} | |
_this.onChange(change); | |
}; | |
_this.listOp = function (op) { | |
var change = _this.props.value.change(); | |
var inList = listPlugin.utils.isSelectionInList(_this.props.value); | |
switch (op) { | |
case 'bulleted-list': | |
case 'numbered-list': | |
case 'check-list': | |
if (inList) change.call(listPlugin.changes.unwrapList);else change.call(listPlugin.changes.wrapInList, op, { check: op === 'check-list' }); | |
break; | |
case 'increase': | |
change.call(listPlugin.changes.increaseItemDepth); | |
break; | |
case 'decrease': | |
change.call(listPlugin.changes.decreaseItemDepth); | |
break; | |
} | |
_this.onChange(change); | |
}; | |
_this.tableOp = function (op) { | |
var change = _this.props.value.change(); | |
var inTable = tablePlugin.utils.isSelectionInTable(_this.props.value); | |
switch (op) { | |
case 'insert-table': | |
tablePlugin.changes.insertTable(change, 2, 2); | |
break; | |
case 'insert-row': | |
tablePlugin.changes.insertRow(change); | |
break; | |
case 'insert-col': | |
tablePlugin.changes.insertColumn(change); | |
break; | |
case 'remove-table': | |
tablePlugin.changes.removeTable(change, 2, 2); | |
break; | |
case 'remove-row': | |
tablePlugin.changes.removeRow(change); | |
break; | |
case 'remove-col': | |
tablePlugin.changes.removeColumn(change); | |
break; | |
case 'align-left': | |
tablePlugin.changes.setColumnAlign(change, 'left'); | |
break; | |
case 'align-center': | |
tablePlugin.changes.setColumnAlign(change, 'center'); | |
break; | |
case 'align-right': | |
tablePlugin.changes.setColumnAlign(change, 'right'); | |
break; | |
} | |
_this.props.onChange(change.value); | |
}; | |
_this.focus = function () { | |
setTimeout(function () { | |
if (_this.editor) _this.editor.focus(); | |
}, 100); | |
}; | |
_this.handleMark = function (type) { | |
return function (ev) { | |
_this.toggleMark(type); | |
_this.focus(); | |
}; | |
}; | |
_this.handleBlock = function (type) { | |
return function (ev) { | |
_this.toggleBlock(type); | |
_this.focus(); | |
}; | |
}; | |
_this.handleListOpClick = function (op) { | |
return function (ev) { | |
_this.listOp(op); | |
_this.focus(); | |
}; | |
}; | |
_this.handleTableOpClick = function (op) { | |
return function (ev) { | |
_this.tableOp(op); | |
_this.focus(); | |
}; | |
}; | |
_this.handleHeading = function (type, ev) { | |
_this.toggleBlock('heading-' + type); | |
_this.focus(); | |
}; | |
_this.handleHideLinkModal = function (ev) { | |
return _this.setState({ showLinkModal: false }); | |
}; | |
_this.handleLinkButtonClick = function (ev) { | |
if (_this.hasInline('link')) { | |
var transform = _this.props.value.change().unwrapInline('link'); | |
_this.props.onChange(transform); | |
} else { | |
_this.setState({ | |
showLinkModal: true | |
}); | |
} | |
}; | |
_this.onKeyDown = function (e, change) { | |
var value = change.value; | |
var startBlock = value.startBlock, | |
isCollapsed = value.isCollapsed; | |
if (startBlock.type.startsWith('heading-')) { | |
if (isKeyHotkey('enter')(e)) { | |
e.preventDefault(); | |
return change.splitBlock().setBlock(DEFAULT_NODE); | |
} | |
} | |
if (isKeyHotkey('shift+enter')(e)) { | |
e.preventDefault(); | |
console.log("YO, shift+enter party"); | |
return change.insertText('\n'); | |
} else if (isKeyHotkey('mod+b')(e)) { | |
e.preventDefault(); | |
return change.toggleMark('bold'); | |
} else if (isKeyHotkey('mod+i')(e)) { | |
e.preventDefault(); | |
return change.toggleMark('italic'); | |
} else if (isKeyHotkey('mod+u')(e)) { | |
e.preventDefault(); | |
return change.toggleMark('underlined'); | |
} | |
}; | |
_this.renderToolbar = function () { | |
// XXX: have drop-down for emoticons | |
// XXX: jump before table? | |
// XXX: button for divider | |
var inList = listPlugin.utils.isSelectionInList(_this.props.value); | |
var currentList = listPlugin.utils.getCurrentList(_this.props.value); | |
var inBulletedList = currentList && currentList.type === "bulleted-list"; | |
var inNumberedList = currentList && currentList.type === "numbered-list"; | |
var inCheckList = currentList && currentList.type === "check-list"; | |
var inTable = tablePlugin.utils.isSelectionInTable(_this.props.value); | |
return React.createElement(Toolbar_, { | |
'heading-one-active': _this.hasBlock('heading-one'), | |
'heading-two-active': _this.hasBlock('heading-two'), | |
'heading-three-active': _this.hasBlock('heading-three'), | |
'heading-four-active': _this.hasBlock('heading-four'), | |
'heading-five-active': _this.hasBlock('heading-five'), | |
'heading-six-active': _this.hasBlock('heading-six'), | |
'on-heading': _this.handleHeading, | |
'bold-active': _this.hasMark('bold'), 'on-bold': _this.handleMark('bold'), | |
'italic-active': _this.hasMark('italic'), 'on-italic': _this.handleMark('italic'), | |
'underline-active': _this.hasMark('underlined'), 'on-underline': _this.handleMark('underlined'), | |
'strikethrough-active': _this.hasMark('strikethrough'), 'on-strikethrough': _this.handleMark('strikethrough'), | |
'highlight-active': _this.hasMark('highlighted'), 'on-highlight': _this.handleMark('highlighted'), | |
'code-mark-active': _this.hasMark('code'), 'on-code-mark': _this.handleMark('code'), | |
'on-link': _this.handleLinkButtonClick, | |
'bullet-list-active': inBulletedList, 'on-bullet-list': _this.handleListOpClick('bulleted-list'), | |
'number-list-active': inNumberedList, 'on-number-list': _this.handleListOpClick('numbered-list'), | |
'check-list-active': inCheckList, 'on-check-list': _this.handleListOpClick('check-list'), | |
'list-active': inList, | |
'on-outdent': _this.handleListOpClick('decrease'), | |
'on-indent': _this.handleListOpClick('increase'), | |
'blockquote-active': _this.hasBlock('block-quote'), 'on-blockquote': _this.handleBlock('block-quote'), | |
'code-active': _this.hasBlock('code'), 'on-code': _this.handleBlock('code'), | |
'table-active': inTable, 'on-table': _this.handleTableOpClick('insert-table'), | |
'on-insert-col': _this.handleTableOpClick('insert-col'), | |
'on-insert-row': _this.handleTableOpClick('insert-row'), | |
'on-delete-col': _this.handleTableOpClick('remove-col'), | |
'on-delete-row': _this.handleTableOpClick('remove-row'), | |
'on-delete-table': _this.handleTableOpClick('remove-table'), | |
'on-col-align-left': _this.handleTableOpClick('align-left'), | |
'on-col-align-center': _this.handleTableOpClick('align-center'), | |
'on-col-align-right': _this.handleTableOpClick('align-right') | |
}); | |
}; | |
_this.renderEditor = function () { | |
var style = { flex: 1, display: 'flex' }; | |
var innerStyle = { flex: 1 }; | |
return React.createElement( | |
'div', | |
{ style: style }, | |
React.createElement(Slate, { | |
spellCheck: true, | |
className: 'rich-text', | |
plugins: plugins, | |
placeholder: _this.props.readOnly ? "" : "Enter some rich text...", | |
renderNode: renderNode(_this.props.readOnly), | |
renderMark: renderMark, | |
decorateNode: function decorateNode() { | |
return undefined; | |
}, | |
value: _this.props.value, | |
onChange: _this.onChange, | |
onKeyDown: _this.onKeyDown, | |
onPaste: _this.onPaste, | |
readOnly: _this.props.readOnly, | |
style: innerStyle, | |
ref: function ref(v) { | |
_this.editor = v; | |
} }), | |
React.createElement(InsertLinkModal, { | |
'is-open': _this.state.showLinkModal, | |
value: _this.props.value, | |
'on-change': _this.onChange, | |
'on-close': _this.handleHideLinkModal }) | |
); | |
}; | |
_this.state = { | |
showLinkModal: false | |
}; | |
return _this; | |
} | |
_createClass(Editor, [{ | |
key: 'render', | |
value: function render() { | |
return React.createElement( | |
'div', | |
{ style: { display: "flex", flexDirection: "row", flexGrow: 1 } }, | |
this.renderEditor(), | |
!this.props.readOnly && this.renderToolbar() | |
); | |
} | |
}]); | |
return Editor; | |
}(React.Component); | |
/* XXX: | |
- grid system with resizing? | |
- images (with caption!) | |
- shortcuts for marks (mod+b, mod+i, mod+u?) | |
- table column alignment | |
- code highlighting with decoratNode, see https://github.com/ianstormtaylor/slate/blob/master/examples/code-highlighting/index.js | |
- google maps embed | |
- shift-enter, see below | |
if (data.isShift && data.key === 'enter') { | |
return state | |
.transform() | |
.insertText('\n') | |
.apply() | |
} | |
*/ | |
//# sourceMappingURL=editor.js.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
["^ ","~:resource-id",["~:shadow.build.classpath/resource","gen/editor.js"],"~:compiled-at",1524341079030,"~:js","var _createClass$$module$gen$editor = function() {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) {\n descriptor.writable = true;\n }\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n return function(Constructor, protoProps, staticProps) {\n if (protoProps) {\n defineProperties(Constructor.prototype, protoProps);\n }\n if (staticProps) {\n defineProperties(Constructor, staticProps);\n }\n return Constructor;\n };\n}();\nvar _extends$$module$gen$editor = Object.assign || function(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n};\nvar _withHandlers$$module$gen$editor;\nfunction _classCallCheck$$module$gen$editor(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\nfunction _possibleConstructorReturn$$module$gen$editor(self, call) {\n if (!self) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self;\n}\nfunction _inherits$$module$gen$editor(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, {constructor:{value:subClass, enumerable:false, writable:true, configurable:true}});\n if (superClass) {\n Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n }\n}\nfunction _objectWithoutProperties$$module$gen$editor(obj, keys) {\n var target = {};\n for (var i in obj) {\n if (keys.indexOf(i) >= 0) {\n continue;\n }\n if (!Object.prototype.hasOwnProperty.call(obj, i)) {\n continue;\n }\n target[i] = obj[i];\n }\n return target;\n}\nfunction _defineProperty$$module$gen$editor(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {value:value, enumerable:true, configurable:true, writable:true});\n } else {\n obj[key] = value;\n }\n return obj;\n}\nvar editorLineToBlock$$module$gen$editor = function editorLineToBlock(text, marks) {\n return {\"object\":\"block\", \"type\":\"paragraph\", \"nodes\":[{\"object\":\"text\", \"leaves\":[{\"text\":text, \"marks\":marks ? marks.map(function(m) {\n return {\"type\":m};\n }) : []}]}]};\n};\nvar warningToBlock$$module$gen$editor = function warningToBlock(text) {\n return editorLineToBlock$$module$gen$editor(text, [\"highlighted\"]);\n};\nvar editorStateFromText$$module$gen$editor = function editorStateFromText(text, warning) {\n return JSON.stringify({\"document\":{\"nodes\":[].concat(warning ? warningToBlock$$module$gen$editor(warning) : [], text.split(/\\n/).map(function(l) {\n return editorLineToBlock$$module$gen$editor(l, []);\n }))}});\n};\nvar editorEmptyState$$module$gen$editor = editorStateFromText$$module$gen$editor(\"\", null);\nfunction editorDeserialize$$module$gen$editor(s) {\n var t = typeof s === \"string\" ? s : \"\";\n try {\n return module$node_modules$slate$lib$slate.Value.fromJSON(JSON.parse(s));\n } catch (e) {\n var msg = \"WARNING: \" + (e.message || \"\" + e);\n var _s = JSON.parse(editorStateFromText$$module$gen$editor(t, msg));\n return module$node_modules$slate$lib$slate.Value.fromJSON(_s);\n }\n}\nfunction editorSerialize$$module$gen$editor(state) {\n return JSON.stringify(state.toJSON());\n}\nvar DEFAULT_NODE$$module$gen$editor = \"paragraph\";\nvar listPlugin$$module$gen$editor = module$node_modules$slate_edit_list$dist$index.default({types:[\"numbered-list\", \"bulleted-list\", \"check-list\"], typeItem:\"list-item\", typeDefault:DEFAULT_NODE$$module$gen$editor});\nvar tablePlugin$$module$gen$editor = module$node_modules$slate_edit_table$dist$index.default({typeTable:\"table\", typeRow:\"table-row\", typeCell:\"table-cell\", typeDefault:DEFAULT_NODE$$module$gen$editor});\nvar blockquotePlugin$$module$gen$editor = module$node_modules$slate_edit_blockquote$dist$index.default({type:\"block-quote\"});\nvar plugins$$module$gen$editor = [module$node_modules$slate_collapse_on_escape$lib$index.default(), listPlugin$$module$gen$editor, blockquotePlugin$$module$gen$editor, module$gen$slate_code.default({blockName:\"code\"}), module$node_modules$slate_soft_break$lib$index.default({onlyIn:[\"code\", \"table-cell\"]}), tablePlugin$$module$gen$editor, module$node_modules$slate_paste_linkify$lib$index.default({type:\"link\", collapseTo:\"end\"}), module$node_modules$slate_trailing_block$dist$index({type:DEFAULT_NODE$$module$gen$editor})];\nvar EditorLink$$module$gen$editor = module$node_modules$recompose$cjs$Recompose.compose(module$node_modules$recompose$cjs$Recompose.withHandlers((_withHandlers$$module$gen$editor = {}, _defineProperty$$module$gen$editor(_withHandlers$$module$gen$editor, \"on-link-remove\", function onLinkRemove(_ref) {\n var editor = _ref.editor;\n var value = _ref.value;\n return function() {\n editor.change(function(change) {\n change.unwrapInline(\"link\");\n });\n };\n}), _defineProperty$$module$gen$editor(_withHandlers$$module$gen$editor, \"on-link-change\", function onLinkChange(_ref2) {\n var editor = _ref2.editor;\n var value = _ref2.value;\n var node = _ref2.node;\n return function(newHref) {\n editor.change(function(change) {\n change.setNodeByKey(node.key, {data:{href:newHref}});\n });\n };\n}), _withHandlers$$module$gen$editor)), module$node_modules$recompose$cjs$Recompose.mapProps(module$node_modules$ramda$src$omit([\"node\", \"nodeKey\", \"value\", \"editor\"])))(dlt.components.editor.link.EditorLink);\nvar InsertLinkModal$$module$gen$editor = module$node_modules$recompose$cjs$Recompose.compose(module$node_modules$recompose$cjs$Recompose.mapProps(function(props) {\n return _extends$$module$gen$editor({}, props, _defineProperty$$module$gen$editor({}, \"has-text\", props.value.isExpanded));\n}), module$node_modules$recompose$cjs$Recompose.withHandlers(_defineProperty$$module$gen$editor({}, \"on-submit\", function onSubmit(_ref3) {\n var value = _ref3.value;\n var onChange = _ref3.onChange;\n var onClose = _ref3.onClose;\n return function(newText, url) {\n var transform = value.change();\n if (value.isExpanded) {\n transform = transform.wrapInline({type:\"link\", data:{href:url}});\n } else {\n transform = transform.insertText(newText).extend(0 - newText.length).wrapInline({type:\"link\", data:{href:url}}).collapseToEnd();\n }\n onClose();\n onChange(transform);\n };\n})))(dlt.components.editor.link.InsertLinkModal);\nfunction Table$$module$gen$editor(_ref4) {\n var children = _ref4.children;\n var node = _ref4.node;\n var otherProps = _objectWithoutProperties$$module$gen$editor(_ref4, [\"children\", \"node\"]);\n var childrenArray = module$node_modules$react$index.Children.toArray(children);\n var hasHeaders = !node.get(\"data\").get(\"headless\");\n var headerChildren = hasHeaders ? childrenArray.slice(0, 1) : [];\n var bodyChildren = childrenArray.slice(hasHeaders ? 1 : 0);\n return module$node_modules$react$index.createElement(\"table\", null, hasHeaders && module$node_modules$react$index.createElement(\"thead\", null, headerChildren), module$node_modules$react$index.createElement(\"tbody\", null, bodyChildren));\n}\nvar CheckListItem$$module$gen$editor = module$node_modules$recompose$cjs$Recompose.compose(module$node_modules$recompose$cjs$Recompose.withHandlers(_defineProperty$$module$gen$editor({}, \"on-change\", function onChange(_ref5) {\n var editor = _ref5.editor;\n var value = _ref5.value;\n var nodeKey = _ref5.nodeKey;\n return function(checked) {\n editor.change(function(change) {\n change.setNodeByKey(nodeKey, {data:{checked:checked}});\n });\n };\n})), module$node_modules$recompose$cjs$Recompose.mapProps(module$node_modules$ramda$src$omit([\"node\", \"nodeKey\", \"value\", \"editor\"])))(dlt.components.editor.check.CheckListItem);\nvar renderNode$$module$gen$editor = function renderNode(readOnly) {\n return function(props) {\n var type = props.node.type;\n switch(type) {\n case \"block-quote\":\n return module$node_modules$react$index.createElement(\"blockquote\", props.attributes, props.children);\n case \"code\":\n return module$node_modules$react$index.createElement(\"pre\", props.attributes, module$node_modules$react$index.createElement(\"code\", null, props.children));\n case \"divider\":\n return module$node_modules$react$index.createElement(\"hr\", props.attributes);\n case \"link\":\n var node = props.node;\n var _props$editor = props.editor;\n _props$editor = _props$editor === undefined ? {} : _props$editor;\n var value = _props$editor.value;\n var isSelected = !readOnly && value && value.isCollapsed && value.inlines.size === 1 && value.inlines.first().key === node.key;\n return module$node_modules$react$index.createElement(EditorLink$$module$gen$editor, _extends$$module$gen$editor({}, props.attributes, {\"is-selected\":isSelected, node:props.node, value:props.editor.value, editor:props.editor, href:props.node.data.get(\"href\"), title:props.node.data.get(\"title\")}), props.children);\n case \"image\":\n return module$node_modules$react$index.createElement(\"img\", _extends$$module$gen$editor({}, props.attributes, {src:props.node.data.get(\"src\"), title:props.node.data.get(\"title\"), alt:props.node.data.get(\"alt\")}));\n case \"bulleted-list\":\n return module$node_modules$react$index.createElement(\"ul\", props.attributes, props.children);\n case \"check-list\":\n return module$node_modules$react$index.createElement(dlt.components.editor.check.CheckList, props.attributes, props.children);\n case \"list-item\":\n var document = props.editor.value.document;\n var parent = document.getParent(props.node.key);\n var checkItem = parent.data.get(\"check\");\n var checked = props.node.data.get(\"checked\") || false;\n if (checkItem) {\n return module$node_modules$react$index.createElement(CheckListItem$$module$gen$editor, _extends$$module$gen$editor({disabled:readOnly, checked:checked, nodeKey:props.node.key, value:props.editor.value, editor:props.editor}, props.attributes), props.children);\n } else {\n return module$node_modules$react$index.createElement(\"li\", props.attributes, props.children);\n }\n case \"numbered-list\":\n return module$node_modules$react$index.createElement(\"ol\", props.attributes, props.children);\n case \"heading-one\":\n return module$node_modules$react$index.createElement(\"h1\", props.attributes, props.children);\n case \"heading-two\":\n return module$node_modules$react$index.createElement(\"h2\", props.attributes, props.children);\n case \"heading-three\":\n return module$node_modules$react$index.createElement(\"h3\", props.attributes, props.children);\n case \"heading-four\":\n return module$node_modules$react$index.createElement(\"h4\", props.attributes, props.children);\n case \"heading-five\":\n return module$node_modules$react$index.createElement(\"h5\", props.attributes, props.children);\n case \"heading-six\":\n return module$node_modules$react$index.createElement(\"h6\", props.attributes, props.children);\n case \"paragraph\":\n return module$node_modules$react$index.createElement(\"p\", props.attributes, props.children);\n case \"table\":\n return module$node_modules$react$index.createElement(Table$$module$gen$editor, _extends$$module$gen$editor({}, props.attributes, {node:props.node}), props.children);\n case \"table-row\":\n return props.node.data.get(\"header\") ? module$node_modules$react$index.createElement(\"tr\", props.attributes, props.children) : module$node_modules$react$index.createElement(\"tr\", props.attributes, props.children);\n case \"table-cell\":\n var data = props.node.data;\n var textAlign = [\"left\", \"right\", \"center\"].indexOf(data.get(\"textAlign\")) === -1 ? \"left\" : data.get(\"textAlign\");\n return props.node.data.get(\"header\") ? module$node_modules$react$index.createElement(\"th\", _extends$$module$gen$editor({style:{textAlign:textAlign}}, props.attributes), props.children) : module$node_modules$react$index.createElement(\"td\", _extends$$module$gen$editor({style:{textAlign:textAlign}}, props.attributes), props.children);\n default:\n return module$node_modules$react$index.createElement(\"div\", null, \"Unknown node!\");\n }\n };\n};\nfunction renderMark$$module$gen$editor(props) {\n var _markStyles;\n var children = props.children;\n var mark = props.mark;\n var markStyles = (_markStyles = {}, _defineProperty$$module$gen$editor(_markStyles, \"bold\", {\"fontWeight\":\"bold\"}), _defineProperty$$module$gen$editor(_markStyles, \"code\", {fontFamily:\"monospace\", backgroundColor:\"#eee\", padding:\"3px\", borderRadius:\"4px\"}), _defineProperty$$module$gen$editor(_markStyles, \"italic\", {fontStyle:\"italic\"}), _defineProperty$$module$gen$editor(_markStyles, \"underlined\", {textDecoration:\"underline\"}), _defineProperty$$module$gen$editor(_markStyles, \"strikethrough\", {textDecoration:\"line-through\"}), \n _defineProperty$$module$gen$editor(_markStyles, \"highlighted\", {backgroundColor:\"yellow\"}), _markStyles);\n var style = markStyles[mark.type];\n return module$node_modules$react$index.createElement(\"span\", {style:style}, children);\n}\nvar Editor$$module$gen$editor = function(_React$Component) {\n _inherits$$module$gen$editor(Editor, _React$Component);\n function Editor(props) {\n _classCallCheck$$module$gen$editor(this, Editor);\n var _this = _possibleConstructorReturn$$module$gen$editor(this, (Editor.__proto__ || Object.getPrototypeOf(Editor)).call(this, props));\n _this.editor = null;\n _this.hasMark = function(type) {\n return _this.props.value.marks.some(function(mark) {\n return mark.type === type;\n });\n };\n _this.hasBlock = function(type) {\n return _this.props.value.blocks.some(function(node) {\n return node.type === type;\n });\n };\n _this.hasInline = function(type) {\n return _this.props.value.inlines.some(function(inline) {\n return inline.type === type;\n });\n };\n _this.onChange = function(change) {\n if (_this.props.onChange) {\n _this.props.onChange(change.value);\n }\n };\n _this.toggleMark = function(type) {\n var change = _this.props.value.change().toggleMark(type);\n _this.onChange(change);\n };\n _this.toggleBlock = function(type) {\n var change = _this.props.value.change();\n var active = _this.hasBlock(type);\n if (type === \"block-quote\") {\n if (blockquotePlugin$$module$gen$editor.utils.isSelectionInBlockquote(_this.props.value)) {\n change.call(blockquotePlugin$$module$gen$editor.changes.unwrapBlockquote);\n } else {\n change.call(blockquotePlugin$$module$gen$editor.changes.wrapInBlockquote);\n }\n } else {\n if (type === \"code\") {\n change = change.setBlock(active ? DEFAULT_NODE$$module$gen$editor : \"code\");\n } else {\n change = change.setBlock(active ? DEFAULT_NODE$$module$gen$editor : type);\n }\n }\n _this.onChange(change);\n };\n _this.listOp = function(op) {\n var change = _this.props.value.change();\n var inList = listPlugin$$module$gen$editor.utils.isSelectionInList(_this.props.value);\n switch(op) {\n case \"bulleted-list\":\n case \"numbered-list\":\n case \"check-list\":\n if (inList) {\n change.call(listPlugin$$module$gen$editor.changes.unwrapList);\n } else {\n change.call(listPlugin$$module$gen$editor.changes.wrapInList, op, {check:op === \"check-list\"});\n }\n break;\n case \"increase\":\n change.call(listPlugin$$module$gen$editor.changes.increaseItemDepth);\n break;\n case \"decrease\":\n change.call(listPlugin$$module$gen$editor.changes.decreaseItemDepth);\n break;\n }\n _this.onChange(change);\n };\n _this.tableOp = function(op) {\n var change = _this.props.value.change();\n var inTable = tablePlugin$$module$gen$editor.utils.isSelectionInTable(_this.props.value);\n switch(op) {\n case \"insert-table\":\n tablePlugin$$module$gen$editor.changes.insertTable(change, 2, 2);\n break;\n case \"insert-row\":\n tablePlugin$$module$gen$editor.changes.insertRow(change);\n break;\n case \"insert-col\":\n tablePlugin$$module$gen$editor.changes.insertColumn(change);\n break;\n case \"remove-table\":\n tablePlugin$$module$gen$editor.changes.removeTable(change, 2, 2);\n break;\n case \"remove-row\":\n tablePlugin$$module$gen$editor.changes.removeRow(change);\n break;\n case \"remove-col\":\n tablePlugin$$module$gen$editor.changes.removeColumn(change);\n break;\n case \"align-left\":\n tablePlugin$$module$gen$editor.changes.setColumnAlign(change, \"left\");\n break;\n case \"align-center\":\n tablePlugin$$module$gen$editor.changes.setColumnAlign(change, \"center\");\n break;\n case \"align-right\":\n tablePlugin$$module$gen$editor.changes.setColumnAlign(change, \"right\");\n break;\n }\n _this.props.onChange(change.value);\n };\n _this.focus = function() {\n setTimeout(function() {\n if (_this.editor) {\n _this.editor.focus();\n }\n }, 100);\n };\n _this.handleMark = function(type) {\n return function(ev) {\n _this.toggleMark(type);\n _this.focus();\n };\n };\n _this.handleBlock = function(type) {\n return function(ev) {\n _this.toggleBlock(type);\n _this.focus();\n };\n };\n _this.handleListOpClick = function(op) {\n return function(ev) {\n _this.listOp(op);\n _this.focus();\n };\n };\n _this.handleTableOpClick = function(op) {\n return function(ev) {\n _this.tableOp(op);\n _this.focus();\n };\n };\n _this.handleHeading = function(type, ev) {\n _this.toggleBlock(\"heading-\" + type);\n _this.focus();\n };\n _this.handleHideLinkModal = function(ev) {\n return _this.setState({showLinkModal:false});\n };\n _this.handleLinkButtonClick = function(ev) {\n if (_this.hasInline(\"link\")) {\n var transform = _this.props.value.change().unwrapInline(\"link\");\n _this.props.onChange(transform);\n } else {\n _this.setState({showLinkModal:true});\n }\n };\n _this.onKeyDown = function(e, change) {\n var value = change.value;\n var startBlock = value.startBlock;\n var isCollapsed = value.isCollapsed;\n if (startBlock.type.startsWith(\"heading-\")) {\n if (module$node_modules$is_hotkey$lib$index.isKeyHotkey(\"enter\")(e)) {\n e.preventDefault();\n return change.splitBlock().setBlock(DEFAULT_NODE$$module$gen$editor);\n }\n }\n if (module$node_modules$is_hotkey$lib$index.isKeyHotkey(\"shift+enter\")(e)) {\n e.preventDefault();\n console.log(\"YO, shift+enter party\");\n return change.insertText(\"\\n\");\n } else {\n if (module$node_modules$is_hotkey$lib$index.isKeyHotkey(\"mod+b\")(e)) {\n e.preventDefault();\n return change.toggleMark(\"bold\");\n } else {\n if (module$node_modules$is_hotkey$lib$index.isKeyHotkey(\"mod+i\")(e)) {\n e.preventDefault();\n return change.toggleMark(\"italic\");\n } else {\n if (module$node_modules$is_hotkey$lib$index.isKeyHotkey(\"mod+u\")(e)) {\n e.preventDefault();\n return change.toggleMark(\"underlined\");\n }\n }\n }\n }\n };\n _this.renderToolbar = function() {\n var inList = listPlugin$$module$gen$editor.utils.isSelectionInList(_this.props.value);\n var currentList = listPlugin$$module$gen$editor.utils.getCurrentList(_this.props.value);\n var inBulletedList = currentList && currentList.type === \"bulleted-list\";\n var inNumberedList = currentList && currentList.type === \"numbered-list\";\n var inCheckList = currentList && currentList.type === \"check-list\";\n var inTable = tablePlugin$$module$gen$editor.utils.isSelectionInTable(_this.props.value);\n return module$node_modules$react$index.createElement(dlt.components.editor.toolbar.Toolbar, {\"heading-one-active\":_this.hasBlock(\"heading-one\"), \"heading-two-active\":_this.hasBlock(\"heading-two\"), \"heading-three-active\":_this.hasBlock(\"heading-three\"), \"heading-four-active\":_this.hasBlock(\"heading-four\"), \"heading-five-active\":_this.hasBlock(\"heading-five\"), \"heading-six-active\":_this.hasBlock(\"heading-six\"), \"on-heading\":_this.handleHeading, \"bold-active\":_this.hasMark(\"bold\"), \"on-bold\":_this.handleMark(\"bold\"), \n \"italic-active\":_this.hasMark(\"italic\"), \"on-italic\":_this.handleMark(\"italic\"), \"underline-active\":_this.hasMark(\"underlined\"), \"on-underline\":_this.handleMark(\"underlined\"), \"strikethrough-active\":_this.hasMark(\"strikethrough\"), \"on-strikethrough\":_this.handleMark(\"strikethrough\"), \"highlight-active\":_this.hasMark(\"highlighted\"), \"on-highlight\":_this.handleMark(\"highlighted\"), \"code-mark-active\":_this.hasMark(\"code\"), \"on-code-mark\":_this.handleMark(\"code\"), \"on-link\":_this.handleLinkButtonClick, \n \"bullet-list-active\":inBulletedList, \"on-bullet-list\":_this.handleListOpClick(\"bulleted-list\"), \"number-list-active\":inNumberedList, \"on-number-list\":_this.handleListOpClick(\"numbered-list\"), \"check-list-active\":inCheckList, \"on-check-list\":_this.handleListOpClick(\"check-list\"), \"list-active\":inList, \"on-outdent\":_this.handleListOpClick(\"decrease\"), \"on-indent\":_this.handleListOpClick(\"increase\"), \"blockquote-active\":_this.hasBlock(\"block-quote\"), \"on-blockquote\":_this.handleBlock(\"block-quote\"), \n \"code-active\":_this.hasBlock(\"code\"), \"on-code\":_this.handleBlock(\"code\"), \"table-active\":inTable, \"on-table\":_this.handleTableOpClick(\"insert-table\"), \"on-insert-col\":_this.handleTableOpClick(\"insert-col\"), \"on-insert-row\":_this.handleTableOpClick(\"insert-row\"), \"on-delete-col\":_this.handleTableOpClick(\"remove-col\"), \"on-delete-row\":_this.handleTableOpClick(\"remove-row\"), \"on-delete-table\":_this.handleTableOpClick(\"remove-table\"), \"on-col-align-left\":_this.handleTableOpClick(\"align-left\"), \n \"on-col-align-center\":_this.handleTableOpClick(\"align-center\"), \"on-col-align-right\":_this.handleTableOpClick(\"align-right\")});\n };\n _this.renderEditor = function() {\n var style = {flex:1, display:\"flex\"};\n var innerStyle = {flex:1};\n return module$node_modules$react$index.createElement(\"div\", {style:style}, module$node_modules$react$index.createElement(module$node_modules$slate_react$lib$slate_react.Editor, {spellCheck:true, className:\"rich-text\", plugins:plugins$$module$gen$editor, placeholder:_this.props.readOnly ? \"\" : \"Enter some rich text...\", renderNode:renderNode$$module$gen$editor(_this.props.readOnly), renderMark:renderMark$$module$gen$editor, decorateNode:function decorateNode() {\n return undefined;\n }, value:_this.props.value, onChange:_this.onChange, onKeyDown:_this.onKeyDown, onPaste:_this.onPaste, readOnly:_this.props.readOnly, style:innerStyle, ref:function ref(v) {\n _this.editor = v;\n }}), module$node_modules$react$index.createElement(InsertLinkModal$$module$gen$editor, {\"is-open\":_this.state.showLinkModal, value:_this.props.value, \"on-change\":_this.onChange, \"on-close\":_this.handleHideLinkModal}));\n };\n _this.state = {showLinkModal:false};\n return _this;\n }\n _createClass$$module$gen$editor(Editor, [{key:\"render\", value:function render() {\n return module$node_modules$react$index.createElement(\"div\", {style:{display:\"flex\", flexDirection:\"row\", flexGrow:1}}, this.renderEditor(), !this.props.readOnly && this.renderToolbar());\n }}]);\n return Editor;\n}(module$node_modules$react$index.Component);\n/** @const */ var module$gen$editor = {};\nmodule$gen$editor.editorStateFromText = editorStateFromText$$module$gen$editor;\nmodule$gen$editor.editorEmptyState = editorEmptyState$$module$gen$editor;\nmodule$gen$editor.editorDeserialize = editorDeserialize$$module$gen$editor;\nmodule$gen$editor.editorSerialize = editorSerialize$$module$gen$editor;\nmodule$gen$editor.Editor = Editor$$module$gen$editor;\n","~:source","var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _withHandlers;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport * as React from '/node_modules/react/index.js';\nimport { Value, State } from '/node_modules/slate/lib/slate.js';\nimport { Editor as Slate, getEventTransfer } from '/node_modules/slate-react/lib/slate-react.js';\nimport EditList from '/node_modules/slate-edit-list/dist/index.js';\nimport SoftBreak from '/node_modules/slate-soft-break/lib/index.js';\nimport PasteLinkify from '/node_modules/slate-paste-linkify/lib/index.js';\nimport CollapseOnEscape from '/node_modules/slate-collapse-on-escape/lib/index.js';\nimport EditBlockquote from '/node_modules/slate-edit-blockquote/dist/index.js';\nimport EditTable from '/node_modules/slate-edit-table/dist/index.js';\nimport NoEmpty from '/node_modules/slate-no-empty/lib/index.js';\n// XXX: https://github.com/google/closure-compiler/issues/2634\nimport * as TrailingBlock from '/node_modules/slate-trailing-block/dist/index.js';\nimport * as omit from '/node_modules/ramda/src/omit.js';\nimport { compose, mapProps, withState, withHandlers, withStateHandlers } from '/node_modules/recompose/cjs/Recompose.js';\nimport { isKeyHotkey } from '/node_modules/is-hotkey/lib/index.js';\nimport SlateCodePlugin from '/gen/slate-code.js';\n\nimport { EditorLink as EditorLink_, InsertLinkModal as InsertLinkModal_ } from \"goog:dlt.components.editor.link\";\n\nimport { CheckListItem as CheckListItem_, CheckList } from \"goog:dlt.components.editor.check\";\n\nimport { Toolbar as Toolbar_ } from \"goog:dlt.components.editor.toolbar\";\n\nvar editorLineToBlock = function editorLineToBlock(text, marks) {\n return {\n \"object\": \"block\",\n \"type\": \"paragraph\",\n \"nodes\": [{\n \"object\": \"text\",\n \"leaves\": [{\n \"text\": text,\n \"marks\": marks ? marks.map(function (m) {\n return { \"type\": m };\n }) : []\n }]\n }]\n };\n};\n\nvar warningToBlock = function warningToBlock(text) {\n return editorLineToBlock(text, [\"highlighted\"]);\n};\n\nexport var editorStateFromText = function editorStateFromText(text, warning) {\n return JSON.stringify({\n \"document\": {\n \"nodes\": [].concat(warning ? warningToBlock(warning) : [], text.split(/\\n/).map(function (l) {\n return editorLineToBlock(l, []);\n }))\n }\n });\n};\n\nexport var editorEmptyState = editorStateFromText(\"\", null);\n\nexport function editorDeserialize(s) {\n var t = typeof s === 'string' ? s : \"\";\n\n try {\n return Value.fromJSON(JSON.parse(s));\n } catch (e) {\n var msg = \"WARNING: \" + (e.message || \"\" + e);\n var _s = JSON.parse(editorStateFromText(t, msg));\n return Value.fromJSON(_s);\n }\n}\n\nexport function editorSerialize(state) {\n return JSON.stringify(state.toJSON());\n}\n\nvar DEFAULT_NODE = 'paragraph';\n\nvar listPlugin = EditList({\n types: ['numbered-list', 'bulleted-list', 'check-list'],\n typeItem: 'list-item',\n typeDefault: DEFAULT_NODE\n});\n\nvar tablePlugin = EditTable({\n typeTable: 'table',\n typeRow: 'table-row',\n typeCell: 'table-cell',\n typeDefault: DEFAULT_NODE\n});\n\nvar blockquotePlugin = EditBlockquote({\n type: 'block-quote'\n});\n\n// XXX: add DropOrPasteImages\n\nvar plugins = [CollapseOnEscape(), listPlugin, blockquotePlugin, SlateCodePlugin({\n blockName: 'code'\n}), SoftBreak({\n onlyIn: ['code', 'table-cell']\n}), tablePlugin, PasteLinkify({\n type: 'link',\n collapseTo: 'end'\n}),\n//NoEmpty(DEFAULT_NODE),\nTrailingBlock({ type: DEFAULT_NODE })];\n\nvar EditorLink = compose(withHandlers((_withHandlers = {}, _defineProperty(_withHandlers, 'on-link-remove', function onLinkRemove(_ref) {\n var editor = _ref.editor,\n value = _ref.value;\n return function () {\n editor.change(function (change) {\n change.unwrapInline('link');\n });\n };\n}), _defineProperty(_withHandlers, 'on-link-change', function onLinkChange(_ref2) {\n var editor = _ref2.editor,\n value = _ref2.value,\n node = _ref2.node;\n return function (newHref) {\n editor.change(function (change) {\n change.setNodeByKey(node.key, {\n data: {\n href: newHref\n }\n });\n });\n };\n}), _withHandlers)), mapProps(omit(['node', 'nodeKey', 'value', 'editor'])))(EditorLink_);\n\nvar InsertLinkModal = compose(mapProps(function (props) {\n return _extends({}, props, _defineProperty({}, 'has-text', props.value.isExpanded));\n}), withHandlers(_defineProperty({}, 'on-submit', function onSubmit(_ref3) {\n var value = _ref3.value,\n onChange = _ref3.onChange,\n onClose = _ref3.onClose;\n return function (newText, url) {\n var transform = value.change();\n\n if (value.isExpanded) {\n transform = transform.wrapInline({\n type: 'link',\n data: { href: url }\n });\n } else {\n transform = transform.insertText(newText).extend(0 - newText.length).wrapInline({\n type: 'link',\n data: { href: url }\n }).collapseToEnd();\n }\n onClose();\n onChange(transform);\n };\n})))(InsertLinkModal_);\n\nfunction Table(_ref4) {\n var children = _ref4.children,\n node = _ref4.node,\n otherProps = _objectWithoutProperties(_ref4, ['children', 'node']);\n\n var childrenArray = React.Children.toArray(children);\n var hasHeaders = !node.get('data').get('headless');\n\n var headerChildren = hasHeaders ? childrenArray.slice(0, 1) : [];\n var bodyChildren = childrenArray.slice(hasHeaders ? 1 : 0);\n\n return React.createElement(\n 'table',\n null,\n hasHeaders && React.createElement(\n 'thead',\n null,\n headerChildren\n ),\n React.createElement(\n 'tbody',\n null,\n bodyChildren\n )\n );\n}\n\nvar CheckListItem = compose(withHandlers(_defineProperty({}, 'on-change', function onChange(_ref5) {\n var editor = _ref5.editor,\n value = _ref5.value,\n nodeKey = _ref5.nodeKey;\n return function (checked) {\n editor.change(function (change) {\n change.setNodeByKey(nodeKey, {\n data: {\n checked: checked\n }\n });\n });\n };\n})), mapProps(omit(['node', 'nodeKey', 'value', 'editor'])))(CheckListItem_);\n\nvar renderNode = function renderNode(readOnly) {\n return function (props) {\n var type = props.node.type;\n switch (type) {\n case 'block-quote':\n return React.createElement(\n 'blockquote',\n props.attributes,\n props.children\n );\n case 'code':\n return React.createElement(\n 'pre',\n props.attributes,\n React.createElement(\n 'code',\n null,\n props.children\n )\n );\n case 'divider':\n return React.createElement('hr', props.attributes);\n case 'link':\n var node = props.node,\n _props$editor = props.editor;\n _props$editor = _props$editor === undefined ? {} : _props$editor;\n var value = _props$editor.value;\n\n var isSelected = !readOnly && value && value.isCollapsed && value.inlines.size === 1 && value.inlines.first().key === node.key;\n\n return React.createElement(\n EditorLink,\n _extends({}, props.attributes, { 'is-selected': isSelected, node: props.node, value: props.editor.value, editor: props.editor, href: props.node.data.get('href'), title: props.node.data.get('title') }),\n props.children\n );\n case 'image':\n return React.createElement('img', _extends({}, props.attributes, { src: props.node.data.get('src'), title: props.node.data.get('title'), alt: props.node.data.get('alt') }));\n case 'bulleted-list':\n return React.createElement(\n 'ul',\n props.attributes,\n props.children\n );\n case 'check-list':\n return React.createElement(\n CheckList,\n props.attributes,\n props.children\n );\n case 'list-item':\n var document = props.editor.value.document;\n\n var parent = document.getParent(props.node.key);\n\n var checkItem = parent.data.get('check');\n var checked = props.node.data.get('checked') || false;\n if (checkItem) {\n return React.createElement(\n CheckListItem,\n _extends({ disabled: readOnly, checked: checked, nodeKey: props.node.key, value: props.editor.value, editor: props.editor }, props.attributes),\n props.children\n );\n } else {\n return React.createElement(\n 'li',\n props.attributes,\n props.children\n );\n }\n case 'numbered-list':\n return React.createElement(\n 'ol',\n props.attributes,\n props.children\n );\n case 'heading-one':\n return React.createElement(\n 'h1',\n props.attributes,\n props.children\n );\n case 'heading-two':\n return React.createElement(\n 'h2',\n props.attributes,\n props.children\n );\n case 'heading-three':\n return React.createElement(\n 'h3',\n props.attributes,\n props.children\n );\n case 'heading-four':\n return React.createElement(\n 'h4',\n props.attributes,\n props.children\n );\n case 'heading-five':\n return React.createElement(\n 'h5',\n props.attributes,\n props.children\n );\n case 'heading-six':\n return React.createElement(\n 'h6',\n props.attributes,\n props.children\n );\n case 'paragraph':\n return React.createElement(\n 'p',\n props.attributes,\n props.children\n );\n case 'table':\n return React.createElement(\n Table,\n _extends({}, props.attributes, { node: props.node }),\n props.children\n ); // XXX: align\n case 'table-row':\n return props.node.data.get('header') ? React.createElement(\n 'tr',\n props.attributes,\n props.children\n ) : React.createElement(\n 'tr',\n props.attributes,\n props.children\n );\n case 'table-cell':\n var data = props.node.data;\n var textAlign = ['left', 'right', 'center'].indexOf(data.get('textAlign')) === -1 ? 'left' : data.get('textAlign');\n\n return props.node.data.get('header') ? React.createElement(\n 'th',\n _extends({ style: { textAlign: textAlign } }, props.attributes),\n props.children\n ) : React.createElement(\n 'td',\n _extends({ style: { textAlign: textAlign } }, props.attributes),\n props.children\n );\n default:\n return React.createElement(\n 'div',\n null,\n 'Unknown node!'\n );\n }\n };\n};\n\nfunction renderMark(props) {\n var _markStyles;\n\n var children = props.children,\n mark = props.mark;\n\n\n var markStyles = (_markStyles = {}, _defineProperty(_markStyles, 'bold', {\n 'fontWeight': 'bold'\n }), _defineProperty(_markStyles, 'code', {\n fontFamily: 'monospace',\n backgroundColor: '#eee',\n padding: '3px',\n borderRadius: '4px'\n }), _defineProperty(_markStyles, 'italic', {\n fontStyle: 'italic'\n }), _defineProperty(_markStyles, 'underlined', {\n textDecoration: 'underline'\n }), _defineProperty(_markStyles, 'strikethrough', {\n textDecoration: 'line-through'\n }), _defineProperty(_markStyles, 'highlighted', {\n backgroundColor: 'yellow'\n }), _markStyles);\n\n var style = markStyles[mark.type];\n return React.createElement(\n 'span',\n { style: style },\n children\n );\n}\n\nexport var Editor = function (_React$Component) {\n _inherits(Editor, _React$Component);\n\n function Editor(props) {\n _classCallCheck(this, Editor);\n\n var _this = _possibleConstructorReturn(this, (Editor.__proto__ || Object.getPrototypeOf(Editor)).call(this, props));\n\n _this.editor = null;\n\n _this.hasMark = function (type) {\n return _this.props.value.marks.some(function (mark) {\n return mark.type === type;\n });\n };\n\n _this.hasBlock = function (type) {\n return _this.props.value.blocks.some(function (node) {\n return node.type === type;\n });\n };\n\n _this.hasInline = function (type) {\n return _this.props.value.inlines.some(function (inline) {\n return inline.type === type;\n });\n };\n\n _this.onChange = function (change) {\n if (_this.props.onChange) _this.props.onChange(change.value);\n };\n\n _this.toggleMark = function (type) {\n var change = _this.props.value.change().toggleMark(type);\n\n _this.onChange(change);\n };\n\n _this.toggleBlock = function (type) {\n var change = _this.props.value.change();\n var active = _this.hasBlock(type);\n\n if (type === 'block-quote') {\n if (blockquotePlugin.utils.isSelectionInBlockquote(_this.props.value)) change.call(blockquotePlugin.changes.unwrapBlockquote);else change.call(blockquotePlugin.changes.wrapInBlockquote);\n } else if (type === 'code') {\n change = change.setBlock(active ? DEFAULT_NODE : 'code');\n } else {\n change = change.setBlock(active ? DEFAULT_NODE : type);\n }\n\n _this.onChange(change);\n };\n\n _this.listOp = function (op) {\n var change = _this.props.value.change();\n var inList = listPlugin.utils.isSelectionInList(_this.props.value);\n\n switch (op) {\n case 'bulleted-list':\n case 'numbered-list':\n case 'check-list':\n if (inList) change.call(listPlugin.changes.unwrapList);else change.call(listPlugin.changes.wrapInList, op, { check: op === 'check-list' });\n break;\n\n case 'increase':\n change.call(listPlugin.changes.increaseItemDepth);\n break;\n\n case 'decrease':\n change.call(listPlugin.changes.decreaseItemDepth);\n break;\n }\n\n _this.onChange(change);\n };\n\n _this.tableOp = function (op) {\n var change = _this.props.value.change();\n var inTable = tablePlugin.utils.isSelectionInTable(_this.props.value);\n\n switch (op) {\n case 'insert-table':\n tablePlugin.changes.insertTable(change, 2, 2);\n break;\n case 'insert-row':\n tablePlugin.changes.insertRow(change);\n break;\n case 'insert-col':\n tablePlugin.changes.insertColumn(change);\n break;\n case 'remove-table':\n tablePlugin.changes.removeTable(change, 2, 2);\n break;\n case 'remove-row':\n tablePlugin.changes.removeRow(change);\n break;\n case 'remove-col':\n tablePlugin.changes.removeColumn(change);\n break;\n case 'align-left':\n tablePlugin.changes.setColumnAlign(change, 'left');\n break;\n case 'align-center':\n tablePlugin.changes.setColumnAlign(change, 'center');\n break;\n case 'align-right':\n tablePlugin.changes.setColumnAlign(change, 'right');\n break;\n }\n\n _this.props.onChange(change.value);\n };\n\n _this.focus = function () {\n setTimeout(function () {\n if (_this.editor) _this.editor.focus();\n }, 100);\n };\n\n _this.handleMark = function (type) {\n return function (ev) {\n _this.toggleMark(type);\n _this.focus();\n };\n };\n\n _this.handleBlock = function (type) {\n return function (ev) {\n _this.toggleBlock(type);\n _this.focus();\n };\n };\n\n _this.handleListOpClick = function (op) {\n return function (ev) {\n _this.listOp(op);\n _this.focus();\n };\n };\n\n _this.handleTableOpClick = function (op) {\n return function (ev) {\n _this.tableOp(op);\n _this.focus();\n };\n };\n\n _this.handleHeading = function (type, ev) {\n _this.toggleBlock('heading-' + type);\n _this.focus();\n };\n\n _this.handleHideLinkModal = function (ev) {\n return _this.setState({ showLinkModal: false });\n };\n\n _this.handleLinkButtonClick = function (ev) {\n if (_this.hasInline('link')) {\n var transform = _this.props.value.change().unwrapInline('link');\n _this.props.onChange(transform);\n } else {\n _this.setState({\n showLinkModal: true\n });\n }\n };\n\n _this.onKeyDown = function (e, change) {\n var value = change.value;\n var startBlock = value.startBlock,\n isCollapsed = value.isCollapsed;\n\n\n if (startBlock.type.startsWith('heading-')) {\n if (isKeyHotkey('enter')(e)) {\n e.preventDefault();\n\n return change.splitBlock().setBlock(DEFAULT_NODE);\n }\n }\n\n if (isKeyHotkey('shift+enter')(e)) {\n e.preventDefault();\n console.log(\"YO, shift+enter party\");\n return change.insertText('\\n');\n } else if (isKeyHotkey('mod+b')(e)) {\n e.preventDefault();\n return change.toggleMark('bold');\n } else if (isKeyHotkey('mod+i')(e)) {\n e.preventDefault();\n return change.toggleMark('italic');\n } else if (isKeyHotkey('mod+u')(e)) {\n e.preventDefault();\n return change.toggleMark('underlined');\n }\n };\n\n _this.renderToolbar = function () {\n // XXX: have drop-down for emoticons\n // XXX: jump before table?\n // XXX: button for divider\n\n var inList = listPlugin.utils.isSelectionInList(_this.props.value);\n var currentList = listPlugin.utils.getCurrentList(_this.props.value);\n var inBulletedList = currentList && currentList.type === \"bulleted-list\";\n var inNumberedList = currentList && currentList.type === \"numbered-list\";\n var inCheckList = currentList && currentList.type === \"check-list\";\n\n var inTable = tablePlugin.utils.isSelectionInTable(_this.props.value);\n\n return React.createElement(Toolbar_, {\n 'heading-one-active': _this.hasBlock('heading-one'),\n 'heading-two-active': _this.hasBlock('heading-two'),\n 'heading-three-active': _this.hasBlock('heading-three'),\n 'heading-four-active': _this.hasBlock('heading-four'),\n 'heading-five-active': _this.hasBlock('heading-five'),\n 'heading-six-active': _this.hasBlock('heading-six'),\n 'on-heading': _this.handleHeading,\n 'bold-active': _this.hasMark('bold'), 'on-bold': _this.handleMark('bold'),\n 'italic-active': _this.hasMark('italic'), 'on-italic': _this.handleMark('italic'),\n 'underline-active': _this.hasMark('underlined'), 'on-underline': _this.handleMark('underlined'),\n 'strikethrough-active': _this.hasMark('strikethrough'), 'on-strikethrough': _this.handleMark('strikethrough'),\n 'highlight-active': _this.hasMark('highlighted'), 'on-highlight': _this.handleMark('highlighted'),\n 'code-mark-active': _this.hasMark('code'), 'on-code-mark': _this.handleMark('code'),\n 'on-link': _this.handleLinkButtonClick,\n 'bullet-list-active': inBulletedList, 'on-bullet-list': _this.handleListOpClick('bulleted-list'),\n 'number-list-active': inNumberedList, 'on-number-list': _this.handleListOpClick('numbered-list'),\n 'check-list-active': inCheckList, 'on-check-list': _this.handleListOpClick('check-list'),\n 'list-active': inList,\n 'on-outdent': _this.handleListOpClick('decrease'),\n 'on-indent': _this.handleListOpClick('increase'),\n 'blockquote-active': _this.hasBlock('block-quote'), 'on-blockquote': _this.handleBlock('block-quote'),\n 'code-active': _this.hasBlock('code'), 'on-code': _this.handleBlock('code'),\n 'table-active': inTable, 'on-table': _this.handleTableOpClick('insert-table'),\n 'on-insert-col': _this.handleTableOpClick('insert-col'),\n 'on-insert-row': _this.handleTableOpClick('insert-row'),\n 'on-delete-col': _this.handleTableOpClick('remove-col'),\n 'on-delete-row': _this.handleTableOpClick('remove-row'),\n 'on-delete-table': _this.handleTableOpClick('remove-table'),\n 'on-col-align-left': _this.handleTableOpClick('align-left'),\n 'on-col-align-center': _this.handleTableOpClick('align-center'),\n 'on-col-align-right': _this.handleTableOpClick('align-right')\n });\n };\n\n _this.renderEditor = function () {\n var style = { flex: 1, display: 'flex' };\n var innerStyle = { flex: 1 };\n\n return React.createElement(\n 'div',\n { style: style },\n React.createElement(Slate, {\n spellCheck: true,\n className: 'rich-text',\n plugins: plugins,\n placeholder: _this.props.readOnly ? \"\" : \"Enter some rich text...\",\n renderNode: renderNode(_this.props.readOnly),\n renderMark: renderMark,\n decorateNode: function decorateNode() {\n return undefined;\n },\n value: _this.props.value,\n onChange: _this.onChange,\n onKeyDown: _this.onKeyDown,\n onPaste: _this.onPaste,\n readOnly: _this.props.readOnly,\n style: innerStyle,\n ref: function ref(v) {\n _this.editor = v;\n } }),\n React.createElement(InsertLinkModal, {\n 'is-open': _this.state.showLinkModal,\n value: _this.props.value,\n 'on-change': _this.onChange,\n 'on-close': _this.handleHideLinkModal })\n );\n };\n\n _this.state = {\n showLinkModal: false\n };\n return _this;\n }\n\n _createClass(Editor, [{\n key: 'render',\n value: function render() {\n return React.createElement(\n 'div',\n { style: { display: \"flex\", flexDirection: \"row\", flexGrow: 1 } },\n this.renderEditor(),\n !this.props.readOnly && this.renderToolbar()\n );\n }\n }]);\n\n return Editor;\n}(React.Component);\n\n/* XXX:\n\n - grid system with resizing?\n\n - images (with caption!)\n\n - shortcuts for marks (mod+b, mod+i, mod+u?)\n\n - table column alignment\n\n - code highlighting with decoratNode, see https://github.com/ianstormtaylor/slate/blob/master/examples/code-highlighting/index.js\n\n - google maps embed\n\n - shift-enter, see below\n\n if (data.isShift && data.key === 'enter') {\n return state\n .transform()\n .insertText('\\n')\n .apply()\n }\n\n*/\n//# sourceMappingURL=editor.js.map\n","~:source-map-json","{\n\"version\":3,\n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,gBAAAA,GAAAA,kCAAAA;AA0TL4G,iBAAAA,OAAAA,GAAAA,yBAAAA;;\",\n\"sources\":[\"gen/editor.js\"],\n\"sourcesContent\":[\"var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\"value\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\\n\\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\\n\\nvar _withHandlers;\\n\\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\"Cannot call a class as a function\\\"); } }\\n\\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\\\"this hasn't been initialised - super() hasn't been called\\\"); } return call && (typeof call === \\\"object\\\" || typeof call === \\\"function\\\") ? call : self; }\\n\\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \\\"function\\\" && superClass !== null) { throw new TypeError(\\\"Super expression must either be null or a function, not \\\" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\\n\\nfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\\n\\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\\n\\nimport * as React from '/node_modules/react/index.js';\\nimport { Value, State } from '/node_modules/slate/lib/slate.js';\\nimport { Editor as Slate, getEventTransfer } from '/node_modules/slate-react/lib/slate-react.js';\\nimport EditList from '/node_modules/slate-edit-list/dist/index.js';\\nimport SoftBreak from '/node_modules/slate-soft-break/lib/index.js';\\nimport PasteLinkify from '/node_modules/slate-paste-linkify/lib/index.js';\\nimport CollapseOnEscape from '/node_modules/slate-collapse-on-escape/lib/index.js';\\nimport EditBlockquote from '/node_modules/slate-edit-blockquote/dist/index.js';\\nimport EditTable from '/node_modules/slate-edit-table/dist/index.js';\\nimport NoEmpty from '/node_modules/slate-no-empty/lib/index.js';\\n// XXX: https://github.com/google/closure-compiler/issues/2634\\nimport * as TrailingBlock from '/node_modules/slate-trailing-block/dist/index.js';\\nimport * as omit from '/node_modules/ramda/src/omit.js';\\nimport { compose, mapProps, withState, withHandlers, withStateHandlers } from '/node_modules/recompose/cjs/Recompose.js';\\nimport { isKeyHotkey } from '/node_modules/is-hotkey/lib/index.js';\\nimport SlateCodePlugin from '/gen/slate-code.js';\\n\\nimport { EditorLink as EditorLink_, InsertLinkModal as InsertLinkModal_ } from \\\"goog:dlt.components.editor.link\\\";\\n\\nimport { CheckListItem as CheckListItem_, CheckList } from \\\"goog:dlt.components.editor.check\\\";\\n\\nimport { Toolbar as Toolbar_ } from \\\"goog:dlt.components.editor.toolbar\\\";\\n\\nvar editorLineToBlock = function editorLineToBlock(text, marks) {\\n return {\\n \\\"object\\\": \\\"block\\\",\\n \\\"type\\\": \\\"paragraph\\\",\\n \\\"nodes\\\": [{\\n \\\"object\\\": \\\"text\\\",\\n \\\"leaves\\\": [{\\n \\\"text\\\": text,\\n \\\"marks\\\": marks ? marks.map(function (m) {\\n return { \\\"type\\\": m };\\n }) : []\\n }]\\n }]\\n };\\n};\\n\\nvar warningToBlock = function warningToBlock(text) {\\n return editorLineToBlock(text, [\\\"highlighted\\\"]);\\n};\\n\\nexport var editorStateFromText = function editorStateFromText(text, warning) {\\n return JSON.stringify({\\n \\\"document\\\": {\\n \\\"nodes\\\": [].concat(warning ? warningToBlock(warning) : [], text.split(/\\\\n/).map(function (l) {\\n return editorLineToBlock(l, []);\\n }))\\n }\\n });\\n};\\n\\nexport var editorEmptyState = editorStateFromText(\\\"\\\", null);\\n\\nexport function editorDeserialize(s) {\\n var t = typeof s === 'string' ? s : \\\"\\\";\\n\\n try {\\n return Value.fromJSON(JSON.parse(s));\\n } catch (e) {\\n var msg = \\\"WARNING: \\\" + (e.message || \\\"\\\" + e);\\n var _s = JSON.parse(editorStateFromText(t, msg));\\n return Value.fromJSON(_s);\\n }\\n}\\n\\nexport function editorSerialize(state) {\\n return JSON.stringify(state.toJSON());\\n}\\n\\nvar DEFAULT_NODE = 'paragraph';\\n\\nvar listPlugin = EditList({\\n types: ['numbered-list', 'bulleted-list', 'check-list'],\\n typeItem: 'list-item',\\n typeDefault: DEFAULT_NODE\\n});\\n\\nvar tablePlugin = EditTable({\\n typeTable: 'table',\\n typeRow: 'table-row',\\n typeCell: 'table-cell',\\n typeDefault: DEFAULT_NODE\\n});\\n\\nvar blockquotePlugin = EditBlockquote({\\n type: 'block-quote'\\n});\\n\\n// XXX: add DropOrPasteImages\\n\\nvar plugins = [CollapseOnEscape(), listPlugin, blockquotePlugin, SlateCodePlugin({\\n blockName: 'code'\\n}), SoftBreak({\\n onlyIn: ['code', 'table-cell']\\n}), tablePlugin, PasteLinkify({\\n type: 'link',\\n collapseTo: 'end'\\n}),\\n//NoEmpty(DEFAULT_NODE),\\nTrailingBlock({ type: DEFAULT_NODE })];\\n\\nvar EditorLink = compose(withHandlers((_withHandlers = {}, _defineProperty(_withHandlers, 'on-link-remove', function onLinkRemove(_ref) {\\n var editor = _ref.editor,\\n value = _ref.value;\\n return function () {\\n editor.change(function (change) {\\n change.unwrapInline('link');\\n });\\n };\\n}), _defineProperty(_withHandlers, 'on-link-change', function onLinkChange(_ref2) {\\n var editor = _ref2.editor,\\n value = _ref2.value,\\n node = _ref2.node;\\n return function (newHref) {\\n editor.change(function (change) {\\n change.setNodeByKey(node.key, {\\n data: {\\n href: newHref\\n }\\n });\\n });\\n };\\n}), _withHandlers)), mapProps(omit(['node', 'nodeKey', 'value', 'editor'])))(EditorLink_);\\n\\nvar InsertLinkModal = compose(mapProps(function (props) {\\n return _extends({}, props, _defineProperty({}, 'has-text', props.value.isExpanded));\\n}), withHandlers(_defineProperty({}, 'on-submit', function onSubmit(_ref3) {\\n var value = _ref3.value,\\n onChange = _ref3.onChange,\\n onClose = _ref3.onClose;\\n return function (newText, url) {\\n var transform = value.change();\\n\\n if (value.isExpanded) {\\n transform = transform.wrapInline({\\n type: 'link',\\n data: { href: url }\\n });\\n } else {\\n transform = transform.insertText(newText).extend(0 - newText.length).wrapInline({\\n type: 'link',\\n data: { href: url }\\n }).collapseToEnd();\\n }\\n onClose();\\n onChange(transform);\\n };\\n})))(InsertLinkModal_);\\n\\nfunction Table(_ref4) {\\n var children = _ref4.children,\\n node = _ref4.node,\\n otherProps = _objectWithoutProperties(_ref4, ['children', 'node']);\\n\\n var childrenArray = React.Children.toArray(children);\\n var hasHeaders = !node.get('data').get('headless');\\n\\n var headerChildren = hasHeaders ? childrenArray.slice(0, 1) : [];\\n var bodyChildren = childrenArray.slice(hasHeaders ? 1 : 0);\\n\\n return React.createElement(\\n 'table',\\n null,\\n hasHeaders && React.createElement(\\n 'thead',\\n null,\\n headerChildren\\n ),\\n React.createElement(\\n 'tbody',\\n null,\\n bodyChildren\\n )\\n );\\n}\\n\\nvar CheckListItem = compose(withHandlers(_defineProperty({}, 'on-change', function onChange(_ref5) {\\n var editor = _ref5.editor,\\n value = _ref5.value,\\n nodeKey = _ref5.nodeKey;\\n return function (checked) {\\n editor.change(function (change) {\\n change.setNodeByKey(nodeKey, {\\n data: {\\n checked: checked\\n }\\n });\\n });\\n };\\n})), mapProps(omit(['node', 'nodeKey', 'value', 'editor'])))(CheckListItem_);\\n\\nvar renderNode = function renderNode(readOnly) {\\n return function (props) {\\n var type = props.node.type;\\n switch (type) {\\n case 'block-quote':\\n return React.createElement(\\n 'blockquote',\\n props.attributes,\\n props.children\\n );\\n case 'code':\\n return React.createElement(\\n 'pre',\\n props.attributes,\\n React.createElement(\\n 'code',\\n null,\\n props.children\\n )\\n );\\n case 'divider':\\n return React.createElement('hr', props.attributes);\\n case 'link':\\n var node = props.node,\\n _props$editor = props.editor;\\n _props$editor = _props$editor === undefined ? {} : _props$editor;\\n var value = _props$editor.value;\\n\\n var isSelected = !readOnly && value && value.isCollapsed && value.inlines.size === 1 && value.inlines.first().key === node.key;\\n\\n return React.createElement(\\n EditorLink,\\n _extends({}, props.attributes, { 'is-selected': isSelected, node: props.node, value: props.editor.value, editor: props.editor, href: props.node.data.get('href'), title: props.node.data.get('title') }),\\n props.children\\n );\\n case 'image':\\n return React.createElement('img', _extends({}, props.attributes, { src: props.node.data.get('src'), title: props.node.data.get('title'), alt: props.node.data.get('alt') }));\\n case 'bulleted-list':\\n return React.createElement(\\n 'ul',\\n props.attributes,\\n props.children\\n );\\n case 'check-list':\\n return React.createElement(\\n CheckList,\\n props.attributes,\\n props.children\\n );\\n case 'list-item':\\n var document = props.editor.value.document;\\n\\n var parent = document.getParent(props.node.key);\\n\\n var checkItem = parent.data.get('check');\\n var checked = props.node.data.get('checked') || false;\\n if (checkItem) {\\n return React.createElement(\\n CheckListItem,\\n _extends({ disabled: readOnly, checked: checked, nodeKey: props.node.key, value: props.editor.value, editor: props.editor }, props.attributes),\\n props.children\\n );\\n } else {\\n return React.createElement(\\n 'li',\\n props.attributes,\\n props.children\\n );\\n }\\n case 'numbered-list':\\n return React.createElement(\\n 'ol',\\n props.attributes,\\n props.children\\n );\\n case 'heading-one':\\n return React.createElement(\\n 'h1',\\n props.attributes,\\n props.children\\n );\\n case 'heading-two':\\n return React.createElement(\\n 'h2',\\n props.attributes,\\n props.children\\n );\\n case 'heading-three':\\n return React.createElement(\\n 'h3',\\n props.attributes,\\n props.children\\n );\\n case 'heading-four':\\n return React.createElement(\\n 'h4',\\n props.attributes,\\n props.children\\n );\\n case 'heading-five':\\n return React.createElement(\\n 'h5',\\n props.attributes,\\n props.children\\n );\\n case 'heading-six':\\n return React.createElement(\\n 'h6',\\n props.attributes,\\n props.children\\n );\\n case 'paragraph':\\n return React.createElement(\\n 'p',\\n props.attributes,\\n props.children\\n );\\n case 'table':\\n return React.createElement(\\n Table,\\n _extends({}, props.attributes, { node: props.node }),\\n props.children\\n ); // XXX: align\\n case 'table-row':\\n return props.node.data.get('header') ? React.createElement(\\n 'tr',\\n props.attributes,\\n props.children\\n ) : React.createElement(\\n 'tr',\\n props.attributes,\\n props.children\\n );\\n case 'table-cell':\\n var data = props.node.data;\\n var textAlign = ['left', 'right', 'center'].indexOf(data.get('textAlign')) === -1 ? 'left' : data.get('textAlign');\\n\\n return props.node.data.get('header') ? React.createElement(\\n 'th',\\n _extends({ style: { textAlign: textAlign } }, props.attributes),\\n props.children\\n ) : React.createElement(\\n 'td',\\n _extends({ style: { textAlign: textAlign } }, props.attributes),\\n props.children\\n );\\n default:\\n return React.createElement(\\n 'div',\\n null,\\n 'Unknown node!'\\n );\\n }\\n };\\n};\\n\\nfunction renderMark(props) {\\n var _markStyles;\\n\\n var children = props.children,\\n mark = props.mark;\\n\\n\\n var markStyles = (_markStyles = {}, _defineProperty(_markStyles, 'bold', {\\n 'fontWeight': 'bold'\\n }), _defineProperty(_markStyles, 'code', {\\n fontFamily: 'monospace',\\n backgroundColor: '#eee',\\n padding: '3px',\\n borderRadius: '4px'\\n }), _defineProperty(_markStyles, 'italic', {\\n fontStyle: 'italic'\\n }), _defineProperty(_markStyles, 'underlined', {\\n textDecoration: 'underline'\\n }), _defineProperty(_markStyles, 'strikethrough', {\\n textDecoration: 'line-through'\\n }), _defineProperty(_markStyles, 'highlighted', {\\n backgroundColor: 'yellow'\\n }), _markStyles);\\n\\n var style = markStyles[mark.type];\\n return React.createElement(\\n 'span',\\n { style: style },\\n children\\n );\\n}\\n\\nexport var Editor = function (_React$Component) {\\n _inherits(Editor, _React$Component);\\n\\n function Editor(props) {\\n _classCallCheck(this, Editor);\\n\\n var _this = _possibleConstructorReturn(this, (Editor.__proto__ || Object.getPrototypeOf(Editor)).call(this, props));\\n\\n _this.editor = null;\\n\\n _this.hasMark = function (type) {\\n return _this.props.value.marks.some(function (mark) {\\n return mark.type === type;\\n });\\n };\\n\\n _this.hasBlock = function (type) {\\n return _this.props.value.blocks.some(function (node) {\\n return node.type === type;\\n });\\n };\\n\\n _this.hasInline = function (type) {\\n return _this.props.value.inlines.some(function (inline) {\\n return inline.type === type;\\n });\\n };\\n\\n _this.onChange = function (change) {\\n if (_this.props.onChange) _this.props.onChange(change.value);\\n };\\n\\n _this.toggleMark = function (type) {\\n var change = _this.props.value.change().toggleMark(type);\\n\\n _this.onChange(change);\\n };\\n\\n _this.toggleBlock = function (type) {\\n var change = _this.props.value.change();\\n var active = _this.hasBlock(type);\\n\\n if (type === 'block-quote') {\\n if (blockquotePlugin.utils.isSelectionInBlockquote(_this.props.value)) change.call(blockquotePlugin.changes.unwrapBlockquote);else change.call(blockquotePlugin.changes.wrapInBlockquote);\\n } else if (type === 'code') {\\n change = change.setBlock(active ? DEFAULT_NODE : 'code');\\n } else {\\n change = change.setBlock(active ? DEFAULT_NODE : type);\\n }\\n\\n _this.onChange(change);\\n };\\n\\n _this.listOp = function (op) {\\n var change = _this.props.value.change();\\n var inList = listPlugin.utils.isSelectionInList(_this.props.value);\\n\\n switch (op) {\\n case 'bulleted-list':\\n case 'numbered-list':\\n case 'check-list':\\n if (inList) change.call(listPlugin.changes.unwrapList);else change.call(listPlugin.changes.wrapInList, op, { check: op === 'check-list' });\\n break;\\n\\n case 'increase':\\n change.call(listPlugin.changes.increaseItemDepth);\\n break;\\n\\n case 'decrease':\\n change.call(listPlugin.changes.decreaseItemDepth);\\n break;\\n }\\n\\n _this.onChange(change);\\n };\\n\\n _this.tableOp = function (op) {\\n var change = _this.props.value.change();\\n var inTable = tablePlugin.utils.isSelectionInTable(_this.props.value);\\n\\n switch (op) {\\n case 'insert-table':\\n tablePlugin.changes.insertTable(change, 2, 2);\\n break;\\n case 'insert-row':\\n tablePlugin.changes.insertRow(change);\\n break;\\n case 'insert-col':\\n tablePlugin.changes.insertColumn(change);\\n break;\\n case 'remove-table':\\n tablePlugin.changes.removeTable(change, 2, 2);\\n break;\\n case 'remove-row':\\n tablePlugin.changes.removeRow(change);\\n break;\\n case 'remove-col':\\n tablePlugin.changes.removeColumn(change);\\n break;\\n case 'align-left':\\n tablePlugin.changes.setColumnAlign(change, 'left');\\n break;\\n case 'align-center':\\n tablePlugin.changes.setColumnAlign(change, 'center');\\n break;\\n case 'align-right':\\n tablePlugin.changes.setColumnAlign(change, 'right');\\n break;\\n }\\n\\n _this.props.onChange(change.value);\\n };\\n\\n _this.focus = function () {\\n setTimeout(function () {\\n if (_this.editor) _this.editor.focus();\\n }, 100);\\n };\\n\\n _this.handleMark = function (type) {\\n return function (ev) {\\n _this.toggleMark(type);\\n _this.focus();\\n };\\n };\\n\\n _this.handleBlock = function (type) {\\n return function (ev) {\\n _this.toggleBlock(type);\\n _this.focus();\\n };\\n };\\n\\n _this.handleListOpClick = function (op) {\\n return function (ev) {\\n _this.listOp(op);\\n _this.focus();\\n };\\n };\\n\\n _this.handleTableOpClick = function (op) {\\n return function (ev) {\\n _this.tableOp(op);\\n _this.focus();\\n };\\n };\\n\\n _this.handleHeading = function (type, ev) {\\n _this.toggleBlock('heading-' + type);\\n _this.focus();\\n };\\n\\n _this.handleHideLinkModal = function (ev) {\\n return _this.setState({ showLinkModal: false });\\n };\\n\\n _this.handleLinkButtonClick = function (ev) {\\n if (_this.hasInline('link')) {\\n var transform = _this.props.value.change().unwrapInline('link');\\n _this.props.onChange(transform);\\n } else {\\n _this.setState({\\n showLinkModal: true\\n });\\n }\\n };\\n\\n _this.onKeyDown = function (e, change) {\\n var value = change.value;\\n var startBlock = value.startBlock,\\n isCollapsed = value.isCollapsed;\\n\\n\\n if (startBlock.type.startsWith('heading-')) {\\n if (isKeyHotkey('enter')(e)) {\\n e.preventDefault();\\n\\n return change.splitBlock().setBlock(DEFAULT_NODE);\\n }\\n }\\n\\n if (isKeyHotkey('shift+enter')(e)) {\\n e.preventDefault();\\n console.log(\\\"YO, shift+enter party\\\");\\n return change.insertText('\\\\n');\\n } else if (isKeyHotkey('mod+b')(e)) {\\n e.preventDefault();\\n return change.toggleMark('bold');\\n } else if (isKeyHotkey('mod+i')(e)) {\\n e.preventDefault();\\n return change.toggleMark('italic');\\n } else if (isKeyHotkey('mod+u')(e)) {\\n e.preventDefault();\\n return change.toggleMark('underlined');\\n }\\n };\\n\\n _this.renderToolbar = function () {\\n // XXX: have drop-down for emoticons\\n // XXX: jump before table?\\n // XXX: button for divider\\n\\n var inList = listPlugin.utils.isSelectionInList(_this.props.value);\\n var currentList = listPlugin.utils.getCurrentList(_this.props.value);\\n var inBulletedList = currentList && currentList.type === \\\"bulleted-list\\\";\\n var inNumberedList = currentList && currentList.type === \\\"numbered-list\\\";\\n var inCheckList = currentList && currentList.type === \\\"check-list\\\";\\n\\n var inTable = tablePlugin.utils.isSelectionInTable(_this.props.value);\\n\\n return React.createElement(Toolbar_, {\\n 'heading-one-active': _this.hasBlock('heading-one'),\\n 'heading-two-active': _this.hasBlock('heading-two'),\\n 'heading-three-active': _this.hasBlock('heading-three'),\\n 'heading-four-active': _this.hasBlock('heading-four'),\\n 'heading-five-active': _this.hasBlock('heading-five'),\\n 'heading-six-active': _this.hasBlock('heading-six'),\\n 'on-heading': _this.handleHeading,\\n 'bold-active': _this.hasMark('bold'), 'on-bold': _this.handleMark('bold'),\\n 'italic-active': _this.hasMark('italic'), 'on-italic': _this.handleMark('italic'),\\n 'underline-active': _this.hasMark('underlined'), 'on-underline': _this.handleMark('underlined'),\\n 'strikethrough-active': _this.hasMark('strikethrough'), 'on-strikethrough': _this.handleMark('strikethrough'),\\n 'highlight-active': _this.hasMark('highlighted'), 'on-highlight': _this.handleMark('highlighted'),\\n 'code-mark-active': _this.hasMark('code'), 'on-code-mark': _this.handleMark('code'),\\n 'on-link': _this.handleLinkButtonClick,\\n 'bullet-list-active': inBulletedList, 'on-bullet-list': _this.handleListOpClick('bulleted-list'),\\n 'number-list-active': inNumberedList, 'on-number-list': _this.handleListOpClick('numbered-list'),\\n 'check-list-active': inCheckList, 'on-check-list': _this.handleListOpClick('check-list'),\\n 'list-active': inList,\\n 'on-outdent': _this.handleListOpClick('decrease'),\\n 'on-indent': _this.handleListOpClick('increase'),\\n 'blockquote-active': _this.hasBlock('block-quote'), 'on-blockquote': _this.handleBlock('block-quote'),\\n 'code-active': _this.hasBlock('code'), 'on-code': _this.handleBlock('code'),\\n 'table-active': inTable, 'on-table': _this.handleTableOpClick('insert-table'),\\n 'on-insert-col': _this.handleTableOpClick('insert-col'),\\n 'on-insert-row': _this.handleTableOpClick('insert-row'),\\n 'on-delete-col': _this.handleTableOpClick('remove-col'),\\n 'on-delete-row': _this.handleTableOpClick('remove-row'),\\n 'on-delete-table': _this.handleTableOpClick('remove-table'),\\n 'on-col-align-left': _this.handleTableOpClick('align-left'),\\n 'on-col-align-center': _this.handleTableOpClick('align-center'),\\n 'on-col-align-right': _this.handleTableOpClick('align-right')\\n });\\n };\\n\\n _this.renderEditor = function () {\\n var style = { flex: 1, display: 'flex' };\\n var innerStyle = { flex: 1 };\\n\\n return React.createElement(\\n 'div',\\n { style: style },\\n React.createElement(Slate, {\\n spellCheck: true,\\n className: 'rich-text',\\n plugins: plugins,\\n placeholder: _this.props.readOnly ? \\\"\\\" : \\\"Enter some rich text...\\\",\\n renderNode: renderNode(_this.props.readOnly),\\n renderMark: renderMark,\\n decorateNode: function decorateNode() {\\n return undefined;\\n },\\n value: _this.props.value,\\n onChange: _this.onChange,\\n onKeyDown: _this.onKeyDown,\\n onPaste: _this.onPaste,\\n readOnly: _this.props.readOnly,\\n style: innerStyle,\\n ref: function ref(v) {\\n _this.editor = v;\\n } }),\\n React.createElement(InsertLinkModal, {\\n 'is-open': _this.state.showLinkModal,\\n value: _this.props.value,\\n 'on-change': _this.onChange,\\n 'on-close': _this.handleHideLinkModal })\\n );\\n };\\n\\n _this.state = {\\n showLinkModal: false\\n };\\n return _this;\\n }\\n\\n _createClass(Editor, [{\\n key: 'render',\\n value: function render() {\\n return React.createElement(\\n 'div',\\n { style: { display: \\\"flex\\\", flexDirection: \\\"row\\\", flexGrow: 1 } },\\n this.renderEditor(),\\n !this.props.readOnly && this.renderToolbar()\\n );\\n }\\n }]);\\n\\n return Editor;\\n}(React.Component);\\n\\n/* XXX:\\n\\n - grid system with resizing?\\n\\n - images (with caption!)\\n\\n - shortcuts for marks (mod+b, mod+i, mod+u?)\\n\\n - table column alignment\\n\\n - code highlighting with decoratNode, see https://github.com/ianstormtaylor/slate/blob/master/examples/code-highlighting/index.js\\n\\n - google maps embed\\n\\n - shift-enter, see below\\n\\n if (data.isShift && data.key === 'enter') {\\n return state\\n .transform()\\n .insertText('\\\\n')\\n .apply()\\n }\\n\\n*/\\n//# sourceMappingURL=editor.js.map\\n\"],\n\"names\":[\"_createClass\",\"defineProperties\",\"target\",\"props\",\"i\",\"length\",\"descriptor\",\"enumerable\",\"configurable\",\"writable\",\"Object\",\"defineProperty\",\"key\",\"Constructor\",\"protoProps\",\"staticProps\",\"prototype\",\"_extends\",\"assign\",\"arguments\",\"source\",\"hasOwnProperty\",\"call\",\"_withHandlers\",\"_classCallCheck\",\"instance\",\"TypeError\",\"_possibleConstructorReturn\",\"self\",\"ReferenceError\",\"_inherits\",\"subClass\",\"superClass\",\"create\",\"constructor\",\"value\",\"setPrototypeOf\",\"__proto__\",\"_objectWithoutProperties\",\"obj\",\"keys\",\"indexOf\",\"_defineProperty\",\"editorLineToBlock\",\"text\",\"marks\",\"map\",\"m\",\"warningToBlock\",\"editorStateFromText\",\"warning\",\"JSON\",\"stringify\",\"concat\",\"split\",\"l\",\"editorEmptyState\",\"editorDeserialize\",\"s\",\"t\",\"Value\",\"fromJSON\",\"parse\",\"e\",\"msg\",\"message\",\"_s\",\"editorSerialize\",\"state\",\"toJSON\",\"DEFAULT_NODE\",\"listPlugin\",\"EditList\",\"types\",\"typeItem\",\"typeDefault\",\"tablePlugin\",\"EditTable\",\"typeTable\",\"typeRow\",\"typeCell\",\"blockquotePlugin\",\"EditBlockquote\",\"type\",\"plugins\",\"CollapseOnEscape\",\"SlateCodePlugin\",\"blockName\",\"SoftBreak\",\"onlyIn\",\"PasteLinkify\",\"collapseTo\",\"TrailingBlock\",\"EditorLink\",\"compose\",\"withHandlers\",\"onLinkRemove\",\"_ref\",\"editor\",\"change\",\"unwrapInline\",\"onLinkChange\",\"_ref2\",\"node\",\"newHref\",\"setNodeByKey\",\"data\",\"href\",\"mapProps\",\"omit\",\"EditorLink_\",\"InsertLinkModal\",\"isExpanded\",\"onSubmit\",\"_ref3\",\"onChange\",\"onClose\",\"newText\",\"url\",\"transform\",\"wrapInline\",\"insertText\",\"extend\",\"collapseToEnd\",\"InsertLinkModal_\",\"Table\",\"_ref4\",\"children\",\"otherProps\",\"childrenArray\",\"React\",\"Children\",\"toArray\",\"hasHeaders\",\"get\",\"headerChildren\",\"slice\",\"bodyChildren\",\"createElement\",\"CheckListItem\",\"_ref5\",\"nodeKey\",\"checked\",\"CheckListItem_\",\"renderNode\",\"readOnly\",\"attributes\",\"_props$editor\",\"undefined\",\"isSelected\",\"isCollapsed\",\"inlines\",\"size\",\"first\",\"title\",\"src\",\"alt\",\"CheckList\",\"document\",\"parent\",\"getParent\",\"checkItem\",\"disabled\",\"textAlign\",\"style\",\"renderMark\",\"_markStyles\",\"mark\",\"markStyles\",\"fontFamily\",\"backgroundColor\",\"padding\",\"borderRadius\",\"fontStyle\",\"textDecoration\",\"Editor\",\"_React$Component\",\"_this\",\"getPrototypeOf\",\"hasMark\",\"_this.hasMark\",\"some\",\"hasBlock\",\"_this.hasBlock\",\"blocks\",\"hasInline\",\"_this.hasInline\",\"inline\",\"_this.onChange\",\"toggleMark\",\"_this.toggleMark\",\"toggleBlock\",\"_this.toggleBlock\",\"active\",\"utils\",\"isSelectionInBlockquote\",\"changes\",\"unwrapBlockquote\",\"wrapInBlockquote\",\"setBlock\",\"listOp\",\"_this.listOp\",\"op\",\"inList\",\"isSelectionInList\",\"unwrapList\",\"wrapInList\",\"check\",\"increaseItemDepth\",\"decreaseItemDepth\",\"tableOp\",\"_this.tableOp\",\"inTable\",\"isSelectionInTable\",\"insertTable\",\"insertRow\",\"insertColumn\",\"removeTable\",\"removeRow\",\"removeColumn\",\"setColumnAlign\",\"focus\",\"_this.focus\",\"setTimeout\",\"handleMark\",\"_this.handleMark\",\"ev\",\"handleBlock\",\"_this.handleBlock\",\"handleListOpClick\",\"_this.handleListOpClick\",\"handleTableOpClick\",\"_this.handleTableOpClick\",\"handleHeading\",\"_this.handleHeading\",\"handleHideLinkModal\",\"_this.handleHideLinkModal\",\"setState\",\"showLinkModal\",\"handleLinkButtonClick\",\"_this.handleLinkButtonClick\",\"onKeyDown\",\"_this.onKeyDown\",\"startBlock\",\"startsWith\",\"isKeyHotkey\",\"preventDefault\",\"splitBlock\",\"console\",\"log\",\"renderToolbar\",\"_this.renderToolbar\",\"currentList\",\"getCurrentList\",\"inBulletedList\",\"inNumberedList\",\"inCheckList\",\"Toolbar_\",\"renderEditor\",\"_this.renderEditor\",\"flex\",\"display\",\"innerStyle\",\"Slate\",\"spellCheck\",\"className\",\"placeholder\",\"decorateNode\",\"onPaste\",\"ref\",\"v\",\"render\",\"flexDirection\",\"flexGrow\",\"Component\",\"exports\"]\n}\n"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var module$node_modules$react$index = shadow.js.require("module$node_modules$react$index", {}); | |
var module$node_modules$slate$lib$slate = shadow.js.require("module$node_modules$slate$lib$slate", {}); | |
var module$node_modules$slate_react$lib$slate_react = shadow.js.require("module$node_modules$slate_react$lib$slate_react", {}); | |
var module$node_modules$slate_edit_list$dist$index = shadow.js.require("module$node_modules$slate_edit_list$dist$index", {}); | |
var module$node_modules$slate_soft_break$lib$index = shadow.js.require("module$node_modules$slate_soft_break$lib$index", {}); | |
var module$node_modules$slate_paste_linkify$lib$index = shadow.js.require("module$node_modules$slate_paste_linkify$lib$index", {}); | |
var module$node_modules$slate_collapse_on_escape$lib$index = shadow.js.require("module$node_modules$slate_collapse_on_escape$lib$index", {}); | |
var module$node_modules$slate_edit_blockquote$dist$index = shadow.js.require("module$node_modules$slate_edit_blockquote$dist$index", {}); | |
var module$node_modules$slate_edit_table$dist$index = shadow.js.require("module$node_modules$slate_edit_table$dist$index", {}); | |
var module$node_modules$slate_no_empty$lib$index = shadow.js.require("module$node_modules$slate_no_empty$lib$index", {}); | |
var module$node_modules$slate_trailing_block$dist$index = shadow.js.require("module$node_modules$slate_trailing_block$dist$index", {}); | |
var module$node_modules$ramda$src$omit = shadow.js.require("module$node_modules$ramda$src$omit", {}); | |
var module$node_modules$recompose$cjs$Recompose = shadow.js.require("module$node_modules$recompose$cjs$Recompose", {}); | |
var module$node_modules$is_hotkey$lib$index = shadow.js.require("module$node_modules$is_hotkey$lib$index", {}); | |
var _createClass$$module$gen$editor = function() { | |
function defineProperties(target, props) { | |
for (var i = 0; i < props.length; i++) { | |
var descriptor = props[i]; | |
descriptor.enumerable = descriptor.enumerable || false; | |
descriptor.configurable = true; | |
if ("value" in descriptor) { | |
descriptor.writable = true; | |
} | |
Object.defineProperty(target, descriptor.key, descriptor); | |
} | |
} | |
return function(Constructor, protoProps, staticProps) { | |
if (protoProps) { | |
defineProperties(Constructor.prototype, protoProps); | |
} | |
if (staticProps) { | |
defineProperties(Constructor, staticProps); | |
} | |
return Constructor; | |
}; | |
}(); | |
var _extends$$module$gen$editor = Object.assign || function(target) { | |
for (var i = 1; i < arguments.length; i++) { | |
var source = arguments[i]; | |
for (var key in source) { | |
if (Object.prototype.hasOwnProperty.call(source, key)) { | |
target[key] = source[key]; | |
} | |
} | |
} | |
return target; | |
}; | |
var _withHandlers$$module$gen$editor; | |
function _classCallCheck$$module$gen$editor(instance, Constructor) { | |
if (!(instance instanceof Constructor)) { | |
throw new TypeError("Cannot call a class as a function"); | |
} | |
} | |
function _possibleConstructorReturn$$module$gen$editor(self, call) { | |
if (!self) { | |
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | |
} | |
return call && (typeof call === "object" || typeof call === "function") ? call : self; | |
} | |
function _inherits$$module$gen$editor(subClass, superClass) { | |
if (typeof superClass !== "function" && superClass !== null) { | |
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | |
} | |
subClass.prototype = Object.create(superClass && superClass.prototype, {constructor:{value:subClass, enumerable:false, writable:true, configurable:true}}); | |
if (superClass) { | |
Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | |
} | |
} | |
function _objectWithoutProperties$$module$gen$editor(obj, keys) { | |
var target = {}; | |
for (var i in obj) { | |
if (keys.indexOf(i) >= 0) { | |
continue; | |
} | |
if (!Object.prototype.hasOwnProperty.call(obj, i)) { | |
continue; | |
} | |
target[i] = obj[i]; | |
} | |
return target; | |
} | |
function _defineProperty$$module$gen$editor(obj, key, value) { | |
if (key in obj) { | |
Object.defineProperty(obj, key, {value:value, enumerable:true, configurable:true, writable:true}); | |
} else { | |
obj[key] = value; | |
} | |
return obj; | |
} | |
var editorLineToBlock$$module$gen$editor = function editorLineToBlock(text, marks) { | |
return {"object":"block", "type":"paragraph", "nodes":[{"object":"text", "leaves":[{"text":text, "marks":marks ? marks.map(function(m) { | |
return {"type":m}; | |
}) : []}]}]}; | |
}; | |
var warningToBlock$$module$gen$editor = function warningToBlock(text) { | |
return editorLineToBlock$$module$gen$editor(text, ["highlighted"]); | |
}; | |
var editorStateFromText$$module$gen$editor = function editorStateFromText(text, warning) { | |
return JSON.stringify({"document":{"nodes":[].concat(warning ? warningToBlock$$module$gen$editor(warning) : [], text.split(/\n/).map(function(l) { | |
return editorLineToBlock$$module$gen$editor(l, []); | |
}))}}); | |
}; | |
var editorEmptyState$$module$gen$editor = editorStateFromText$$module$gen$editor("", null); | |
function editorDeserialize$$module$gen$editor(s) { | |
var t = typeof s === "string" ? s : ""; | |
try { | |
return module$node_modules$slate$lib$slate.Value.fromJSON(JSON.parse(s)); | |
} catch (e) { | |
var msg = "WARNING: " + (e.message || "" + e); | |
var _s = JSON.parse(editorStateFromText$$module$gen$editor(t, msg)); | |
return module$node_modules$slate$lib$slate.Value.fromJSON(_s); | |
} | |
} | |
function editorSerialize$$module$gen$editor(state) { | |
return JSON.stringify(state.toJSON()); | |
} | |
var DEFAULT_NODE$$module$gen$editor = "paragraph"; | |
var listPlugin$$module$gen$editor = module$node_modules$slate_edit_list$dist$index.default({types:["numbered-list", "bulleted-list", "check-list"], typeItem:"list-item", typeDefault:DEFAULT_NODE$$module$gen$editor}); | |
var tablePlugin$$module$gen$editor = module$node_modules$slate_edit_table$dist$index.default({typeTable:"table", typeRow:"table-row", typeCell:"table-cell", typeDefault:DEFAULT_NODE$$module$gen$editor}); | |
var blockquotePlugin$$module$gen$editor = module$node_modules$slate_edit_blockquote$dist$index.default({type:"block-quote"}); | |
var plugins$$module$gen$editor = [module$node_modules$slate_collapse_on_escape$lib$index.default(), listPlugin$$module$gen$editor, blockquotePlugin$$module$gen$editor, module$gen$slate_code.default({blockName:"code"}), module$node_modules$slate_soft_break$lib$index.default({onlyIn:["code", "table-cell"]}), tablePlugin$$module$gen$editor, module$node_modules$slate_paste_linkify$lib$index.default({type:"link", collapseTo:"end"}), module$node_modules$slate_trailing_block$dist$index({type:DEFAULT_NODE$$module$gen$editor})]; | |
var EditorLink$$module$gen$editor = module$node_modules$recompose$cjs$Recompose.compose(module$node_modules$recompose$cjs$Recompose.withHandlers((_withHandlers$$module$gen$editor = {}, _defineProperty$$module$gen$editor(_withHandlers$$module$gen$editor, "on-link-remove", function onLinkRemove(_ref) { | |
var editor = _ref.editor; | |
var value = _ref.value; | |
return function() { | |
editor.change(function(change) { | |
change.unwrapInline("link"); | |
}); | |
}; | |
}), _defineProperty$$module$gen$editor(_withHandlers$$module$gen$editor, "on-link-change", function onLinkChange(_ref2) { | |
var editor = _ref2.editor; | |
var value = _ref2.value; | |
var node = _ref2.node; | |
return function(newHref) { | |
editor.change(function(change) { | |
change.setNodeByKey(node.key, {data:{href:newHref}}); | |
}); | |
}; | |
}), _withHandlers$$module$gen$editor)), module$node_modules$recompose$cjs$Recompose.mapProps(module$node_modules$ramda$src$omit(["node", "nodeKey", "value", "editor"])))(dlt.components.editor.link.EditorLink); | |
var InsertLinkModal$$module$gen$editor = module$node_modules$recompose$cjs$Recompose.compose(module$node_modules$recompose$cjs$Recompose.mapProps(function(props) { | |
return _extends$$module$gen$editor({}, props, _defineProperty$$module$gen$editor({}, "has-text", props.value.isExpanded)); | |
}), module$node_modules$recompose$cjs$Recompose.withHandlers(_defineProperty$$module$gen$editor({}, "on-submit", function onSubmit(_ref3) { | |
var value = _ref3.value; | |
var onChange = _ref3.onChange; | |
var onClose = _ref3.onClose; | |
return function(newText, url) { | |
var transform = value.change(); | |
if (value.isExpanded) { | |
transform = transform.wrapInline({type:"link", data:{href:url}}); | |
} else { | |
transform = transform.insertText(newText).extend(0 - newText.length).wrapInline({type:"link", data:{href:url}}).collapseToEnd(); | |
} | |
onClose(); | |
onChange(transform); | |
}; | |
})))(dlt.components.editor.link.InsertLinkModal); | |
function Table$$module$gen$editor(_ref4) { | |
var children = _ref4.children; | |
var node = _ref4.node; | |
var otherProps = _objectWithoutProperties$$module$gen$editor(_ref4, ["children", "node"]); | |
var childrenArray = module$node_modules$react$index.Children.toArray(children); | |
var hasHeaders = !node.get("data").get("headless"); | |
var headerChildren = hasHeaders ? childrenArray.slice(0, 1) : []; | |
var bodyChildren = childrenArray.slice(hasHeaders ? 1 : 0); | |
return module$node_modules$react$index.createElement("table", null, hasHeaders && module$node_modules$react$index.createElement("thead", null, headerChildren), module$node_modules$react$index.createElement("tbody", null, bodyChildren)); | |
} | |
var CheckListItem$$module$gen$editor = module$node_modules$recompose$cjs$Recompose.compose(module$node_modules$recompose$cjs$Recompose.withHandlers(_defineProperty$$module$gen$editor({}, "on-change", function onChange(_ref5) { | |
var editor = _ref5.editor; | |
var value = _ref5.value; | |
var nodeKey = _ref5.nodeKey; | |
return function(checked) { | |
editor.change(function(change) { | |
change.setNodeByKey(nodeKey, {data:{checked:checked}}); | |
}); | |
}; | |
})), module$node_modules$recompose$cjs$Recompose.mapProps(module$node_modules$ramda$src$omit(["node", "nodeKey", "value", "editor"])))(dlt.components.editor.check.CheckListItem); | |
var renderNode$$module$gen$editor = function renderNode(readOnly) { | |
return function(props) { | |
var type = props.node.type; | |
switch(type) { | |
case "block-quote": | |
return module$node_modules$react$index.createElement("blockquote", props.attributes, props.children); | |
case "code": | |
return module$node_modules$react$index.createElement("pre", props.attributes, module$node_modules$react$index.createElement("code", null, props.children)); | |
case "divider": | |
return module$node_modules$react$index.createElement("hr", props.attributes); | |
case "link": | |
var node = props.node; | |
var _props$editor = props.editor; | |
_props$editor = _props$editor === undefined ? {} : _props$editor; | |
var value = _props$editor.value; | |
var isSelected = !readOnly && value && value.isCollapsed && value.inlines.size === 1 && value.inlines.first().key === node.key; | |
return module$node_modules$react$index.createElement(EditorLink$$module$gen$editor, _extends$$module$gen$editor({}, props.attributes, {"is-selected":isSelected, node:props.node, value:props.editor.value, editor:props.editor, href:props.node.data.get("href"), title:props.node.data.get("title")}), props.children); | |
case "image": | |
return module$node_modules$react$index.createElement("img", _extends$$module$gen$editor({}, props.attributes, {src:props.node.data.get("src"), title:props.node.data.get("title"), alt:props.node.data.get("alt")})); | |
case "bulleted-list": | |
return module$node_modules$react$index.createElement("ul", props.attributes, props.children); | |
case "check-list": | |
return module$node_modules$react$index.createElement(dlt.components.editor.check.CheckList, props.attributes, props.children); | |
case "list-item": | |
var document = props.editor.value.document; | |
var parent = document.getParent(props.node.key); | |
var checkItem = parent.data.get("check"); | |
var checked = props.node.data.get("checked") || false; | |
if (checkItem) { | |
return module$node_modules$react$index.createElement(CheckListItem$$module$gen$editor, _extends$$module$gen$editor({disabled:readOnly, checked:checked, nodeKey:props.node.key, value:props.editor.value, editor:props.editor}, props.attributes), props.children); | |
} else { | |
return module$node_modules$react$index.createElement("li", props.attributes, props.children); | |
} | |
case "numbered-list": | |
return module$node_modules$react$index.createElement("ol", props.attributes, props.children); | |
case "heading-one": | |
return module$node_modules$react$index.createElement("h1", props.attributes, props.children); | |
case "heading-two": | |
return module$node_modules$react$index.createElement("h2", props.attributes, props.children); | |
case "heading-three": | |
return module$node_modules$react$index.createElement("h3", props.attributes, props.children); | |
case "heading-four": | |
return module$node_modules$react$index.createElement("h4", props.attributes, props.children); | |
case "heading-five": | |
return module$node_modules$react$index.createElement("h5", props.attributes, props.children); | |
case "heading-six": | |
return module$node_modules$react$index.createElement("h6", props.attributes, props.children); | |
case "paragraph": | |
return module$node_modules$react$index.createElement("p", props.attributes, props.children); | |
case "table": | |
return module$node_modules$react$index.createElement(Table$$module$gen$editor, _extends$$module$gen$editor({}, props.attributes, {node:props.node}), props.children); | |
case "table-row": | |
return props.node.data.get("header") ? module$node_modules$react$index.createElement("tr", props.attributes, props.children) : module$node_modules$react$index.createElement("tr", props.attributes, props.children); | |
case "table-cell": | |
var data = props.node.data; | |
var textAlign = ["left", "right", "center"].indexOf(data.get("textAlign")) === -1 ? "left" : data.get("textAlign"); | |
return props.node.data.get("header") ? module$node_modules$react$index.createElement("th", _extends$$module$gen$editor({style:{textAlign:textAlign}}, props.attributes), props.children) : module$node_modules$react$index.createElement("td", _extends$$module$gen$editor({style:{textAlign:textAlign}}, props.attributes), props.children); | |
default: | |
return module$node_modules$react$index.createElement("div", null, "Unknown node!"); | |
} | |
}; | |
}; | |
function renderMark$$module$gen$editor(props) { | |
var _markStyles; | |
var children = props.children; | |
var mark = props.mark; | |
var markStyles = (_markStyles = {}, _defineProperty$$module$gen$editor(_markStyles, "bold", {"fontWeight":"bold"}), _defineProperty$$module$gen$editor(_markStyles, "code", {fontFamily:"monospace", backgroundColor:"#eee", padding:"3px", borderRadius:"4px"}), _defineProperty$$module$gen$editor(_markStyles, "italic", {fontStyle:"italic"}), _defineProperty$$module$gen$editor(_markStyles, "underlined", {textDecoration:"underline"}), _defineProperty$$module$gen$editor(_markStyles, "strikethrough", {textDecoration:"line-through"}), | |
_defineProperty$$module$gen$editor(_markStyles, "highlighted", {backgroundColor:"yellow"}), _markStyles); | |
var style = markStyles[mark.type]; | |
return module$node_modules$react$index.createElement("span", {style:style}, children); | |
} | |
var Editor$$module$gen$editor = function(_React$Component) { | |
function Editor(props) { | |
_classCallCheck$$module$gen$editor(this, Editor); | |
var _this = _possibleConstructorReturn$$module$gen$editor(this, (Editor.__proto__ || Object.getPrototypeOf(Editor)).call(this, props)); | |
_this.editor = null; | |
_this.hasMark = function(type) { | |
return _this.props.value.marks.some(function(mark) { | |
return mark.type === type; | |
}); | |
}; | |
_this.hasBlock = function(type) { | |
return _this.props.value.blocks.some(function(node) { | |
return node.type === type; | |
}); | |
}; | |
_this.hasInline = function(type) { | |
return _this.props.value.inlines.some(function(inline) { | |
return inline.type === type; | |
}); | |
}; | |
_this.onChange = function(change) { | |
if (_this.props.onChange) { | |
_this.props.onChange(change.value); | |
} | |
}; | |
_this.toggleMark = function(type) { | |
var change = _this.props.value.change().toggleMark(type); | |
_this.onChange(change); | |
}; | |
_this.toggleBlock = function(type) { | |
var change = _this.props.value.change(); | |
var active = _this.hasBlock(type); | |
if (type === "block-quote") { | |
if (blockquotePlugin$$module$gen$editor.utils.isSelectionInBlockquote(_this.props.value)) { | |
change.call(blockquotePlugin$$module$gen$editor.changes.unwrapBlockquote); | |
} else { | |
change.call(blockquotePlugin$$module$gen$editor.changes.wrapInBlockquote); | |
} | |
} else { | |
if (type === "code") { | |
change = change.setBlock(active ? DEFAULT_NODE$$module$gen$editor : "code"); | |
} else { | |
change = change.setBlock(active ? DEFAULT_NODE$$module$gen$editor : type); | |
} | |
} | |
_this.onChange(change); | |
}; | |
_this.listOp = function(op) { | |
var change = _this.props.value.change(); | |
var inList = listPlugin$$module$gen$editor.utils.isSelectionInList(_this.props.value); | |
switch(op) { | |
case "bulleted-list": | |
case "numbered-list": | |
case "check-list": | |
if (inList) { | |
change.call(listPlugin$$module$gen$editor.changes.unwrapList); | |
} else { | |
change.call(listPlugin$$module$gen$editor.changes.wrapInList, op, {check:op === "check-list"}); | |
} | |
break; | |
case "increase": | |
change.call(listPlugin$$module$gen$editor.changes.increaseItemDepth); | |
break; | |
case "decrease": | |
change.call(listPlugin$$module$gen$editor.changes.decreaseItemDepth); | |
break; | |
} | |
_this.onChange(change); | |
}; | |
_this.tableOp = function(op) { | |
var change = _this.props.value.change(); | |
var inTable = tablePlugin$$module$gen$editor.utils.isSelectionInTable(_this.props.value); | |
switch(op) { | |
case "insert-table": | |
tablePlugin$$module$gen$editor.changes.insertTable(change, 2, 2); | |
break; | |
case "insert-row": | |
tablePlugin$$module$gen$editor.changes.insertRow(change); | |
break; | |
case "insert-col": | |
tablePlugin$$module$gen$editor.changes.insertColumn(change); | |
break; | |
case "remove-table": | |
tablePlugin$$module$gen$editor.changes.removeTable(change, 2, 2); | |
break; | |
case "remove-row": | |
tablePlugin$$module$gen$editor.changes.removeRow(change); | |
break; | |
case "remove-col": | |
tablePlugin$$module$gen$editor.changes.removeColumn(change); | |
break; | |
case "align-left": | |
tablePlugin$$module$gen$editor.changes.setColumnAlign(change, "left"); | |
break; | |
case "align-center": | |
tablePlugin$$module$gen$editor.changes.setColumnAlign(change, "center"); | |
break; | |
case "align-right": | |
tablePlugin$$module$gen$editor.changes.setColumnAlign(change, "right"); | |
break; | |
} | |
_this.props.onChange(change.value); | |
}; | |
_this.focus = function() { | |
setTimeout(function() { | |
if (_this.editor) { | |
_this.editor.focus(); | |
} | |
}, 100); | |
}; | |
_this.handleMark = function(type) { | |
return function(ev) { | |
_this.toggleMark(type); | |
_this.focus(); | |
}; | |
}; | |
_this.handleBlock = function(type) { | |
return function(ev) { | |
_this.toggleBlock(type); | |
_this.focus(); | |
}; | |
}; | |
_this.handleListOpClick = function(op) { | |
return function(ev) { | |
_this.listOp(op); | |
_this.focus(); | |
}; | |
}; | |
_this.handleTableOpClick = function(op) { | |
return function(ev) { | |
_this.tableOp(op); | |
_this.focus(); | |
}; | |
}; | |
_this.handleHeading = function(type, ev) { | |
_this.toggleBlock("heading-" + type); | |
_this.focus(); | |
}; | |
_this.handleHideLinkModal = function(ev) { | |
return _this.setState({showLinkModal:false}); | |
}; | |
_this.handleLinkButtonClick = function(ev) { | |
if (_this.hasInline("link")) { | |
var transform = _this.props.value.change().unwrapInline("link"); | |
_this.props.onChange(transform); | |
} else { | |
_this.setState({showLinkModal:true}); | |
} | |
}; | |
_this.onKeyDown = function(e, change) { | |
var value = change.value; | |
var startBlock = value.startBlock; | |
var isCollapsed = value.isCollapsed; | |
if (startBlock.type.startsWith("heading-")) { | |
if (module$node_modules$is_hotkey$lib$index.isKeyHotkey("enter")(e)) { | |
e.preventDefault(); | |
return change.splitBlock().setBlock(DEFAULT_NODE$$module$gen$editor); | |
} | |
} | |
if (module$node_modules$is_hotkey$lib$index.isKeyHotkey("shift+enter")(e)) { | |
e.preventDefault(); | |
console.log("YO, shift+enter party"); | |
return change.insertText("\n"); | |
} else { | |
if (module$node_modules$is_hotkey$lib$index.isKeyHotkey("mod+b")(e)) { | |
e.preventDefault(); | |
return change.toggleMark("bold"); | |
} else { | |
if (module$node_modules$is_hotkey$lib$index.isKeyHotkey("mod+i")(e)) { | |
e.preventDefault(); | |
return change.toggleMark("italic"); | |
} else { | |
if (module$node_modules$is_hotkey$lib$index.isKeyHotkey("mod+u")(e)) { | |
e.preventDefault(); | |
return change.toggleMark("underlined"); | |
} | |
} | |
} | |
} | |
}; | |
_this.renderToolbar = function() { | |
var inList = listPlugin$$module$gen$editor.utils.isSelectionInList(_this.props.value); | |
var currentList = listPlugin$$module$gen$editor.utils.getCurrentList(_this.props.value); | |
var inBulletedList = currentList && currentList.type === "bulleted-list"; | |
var inNumberedList = currentList && currentList.type === "numbered-list"; | |
var inCheckList = currentList && currentList.type === "check-list"; | |
var inTable = tablePlugin$$module$gen$editor.utils.isSelectionInTable(_this.props.value); | |
return module$node_modules$react$index.createElement(dlt.components.editor.toolbar.Toolbar, {"heading-one-active":_this.hasBlock("heading-one"), "heading-two-active":_this.hasBlock("heading-two"), "heading-three-active":_this.hasBlock("heading-three"), "heading-four-active":_this.hasBlock("heading-four"), "heading-five-active":_this.hasBlock("heading-five"), "heading-six-active":_this.hasBlock("heading-six"), "on-heading":_this.handleHeading, "bold-active":_this.hasMark("bold"), "on-bold":_this.handleMark("bold"), | |
"italic-active":_this.hasMark("italic"), "on-italic":_this.handleMark("italic"), "underline-active":_this.hasMark("underlined"), "on-underline":_this.handleMark("underlined"), "strikethrough-active":_this.hasMark("strikethrough"), "on-strikethrough":_this.handleMark("strikethrough"), "highlight-active":_this.hasMark("highlighted"), "on-highlight":_this.handleMark("highlighted"), "code-mark-active":_this.hasMark("code"), "on-code-mark":_this.handleMark("code"), "on-link":_this.handleLinkButtonClick, | |
"bullet-list-active":inBulletedList, "on-bullet-list":_this.handleListOpClick("bulleted-list"), "number-list-active":inNumberedList, "on-number-list":_this.handleListOpClick("numbered-list"), "check-list-active":inCheckList, "on-check-list":_this.handleListOpClick("check-list"), "list-active":inList, "on-outdent":_this.handleListOpClick("decrease"), "on-indent":_this.handleListOpClick("increase"), "blockquote-active":_this.hasBlock("block-quote"), "on-blockquote":_this.handleBlock("block-quote"), | |
"code-active":_this.hasBlock("code"), "on-code":_this.handleBlock("code"), "table-active":inTable, "on-table":_this.handleTableOpClick("insert-table"), "on-insert-col":_this.handleTableOpClick("insert-col"), "on-insert-row":_this.handleTableOpClick("insert-row"), "on-delete-col":_this.handleTableOpClick("remove-col"), "on-delete-row":_this.handleTableOpClick("remove-row"), "on-delete-table":_this.handleTableOpClick("remove-table"), "on-col-align-left":_this.handleTableOpClick("align-left"), | |
"on-col-align-center":_this.handleTableOpClick("align-center"), "on-col-align-right":_this.handleTableOpClick("align-right")}); | |
}; | |
_this.renderEditor = function() { | |
var style = {flex:1, display:"flex"}; | |
var innerStyle = {flex:1}; | |
return module$node_modules$react$index.createElement("div", {style:style}, module$node_modules$react$index.createElement(module$node_modules$slate_react$lib$slate_react.Editor, {spellCheck:true, className:"rich-text", plugins:plugins$$module$gen$editor, placeholder:_this.props.readOnly ? "" : "Enter some rich text...", renderNode:renderNode$$module$gen$editor(_this.props.readOnly), renderMark:renderMark$$module$gen$editor, decorateNode:function decorateNode() { | |
return undefined; | |
}, value:_this.props.value, onChange:_this.onChange, onKeyDown:_this.onKeyDown, onPaste:_this.onPaste, readOnly:_this.props.readOnly, style:innerStyle, ref:function ref(v) { | |
_this.editor = v; | |
}}), module$node_modules$react$index.createElement(InsertLinkModal$$module$gen$editor, {"is-open":_this.state.showLinkModal, value:_this.props.value, "on-change":_this.onChange, "on-close":_this.handleHideLinkModal})); | |
}; | |
_this.state = {showLinkModal:false}; | |
return _this; | |
} | |
_inherits$$module$gen$editor(Editor, _React$Component); | |
_createClass$$module$gen$editor(Editor, [{key:"render", value:function render() { | |
return module$node_modules$react$index.createElement("div", {style:{display:"flex", flexDirection:"row", flexGrow:1}}, this.renderEditor(), !this.props.readOnly && this.renderToolbar()); | |
}}]); | |
return Editor; | |
}(module$node_modules$react$index.Component); | |
/** @const */ var module$gen$editor = {}; | |
module$gen$editor.editorStateFromText = editorStateFromText$$module$gen$editor; | |
module$gen$editor.editorEmptyState = editorEmptyState$$module$gen$editor; | |
module$gen$editor.editorDeserialize = editorDeserialize$$module$gen$editor; | |
module$gen$editor.editorSerialize = editorSerialize$$module$gen$editor; | |
module$gen$editor.Editor = Editor$$module$gen$editor; | |
$CLJS.module$gen$editor=module$gen$editor; | |
//# sourceMappingURL=module$gen$editor.js.map |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment