/*
* This file is part of ORY Editor.
*
* ORY Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ORY Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ORY Editor. If not, see .
*
* @license LGPL-3.0
* @copyright 2016-2018 Aeneas Rekkas
* @author Aeneas Rekkas
*
*/
import Subject from '@material-ui/icons/Subject';
import { compose, flatten, map, prop } from 'ramda';
import Html from 'slate-html-serializer';
import * as React from 'react';
import Component from './Component';
import Plugin from './plugins/Plugin';
import * as hooks from './hooks';
import parse5 from 'parse5';
import v002 from './migrations/v002';
import { Value } from 'slate';
import { PluginButtonProps } from './plugins/Plugin';
import { ContentPluginConfig } from 'ory-editor-core/lib/service/plugin/classes';
import { SlateState } from './types/state';
import { SlateProps } from './types/component';
import { SlateSettings } from './types/settings';
import { pathOr } from 'ramda/src/pathOr';
import { ActionTypes } from 'redux-undo';
import { AnyAction } from 'redux';
const createPlugins = compose(
flatten,
map(prop('plugins'))
);
export const createInitialState = hooks.createInitialState;
export const html = new Html({
rules: [...hooks.defaultPlugins, hooks.lineBreakSerializer],
parseHtml: parse5.parseFragment,
});
export const defaultPlugins = hooks.defaultPlugins;
export default (
plugins: Plugin[] = hooks.defaultPlugins
): ContentPluginConfig => {
let settings: SlateSettings = {};
settings.plugins = (plugins ? plugins : []).concat(createPlugins(plugins));
const HoverButtons = ({
editorState,
editor,
}: PluginButtonProps) => (