@makeen.io/material-ui-kit
Version:
Makeen UI components kit. Based on material-ui.
193 lines • 5.73 kB
JavaScript
;
// import React, { useEffect } from "react";
// import CKEditor from "@ckeditor/ckeditor5-react";
// //import CKEditorInspector from "@ckeditor/ckeditor5-inspector";
// import styled from "styled-components";
// let CustomEditor = require("makeen/custom-editor/build/customeditor");
//
// // THE CORONA VIRUS OF CODE
// if (CustomEditor.default) {
// CustomEditor = CustomEditor.default;
// } else {
// CustomEditor = window.CustomEditor.default;
// }
//
// //CustomEditor = window.CustomEditor.CustomEditor;
// const EditorWrapper = styled.div<any>`
// .editor__editable,
// /* Classic build. */
// main .ck-editor[role='application'] .ck.ck-content,
// /* Decoupled document build. */
// .ck.editor__editable[role='textbox'],
// .ck.ck-editor__editable[role='textbox'],
// /* Inline & Balloon build. */
// .ck.editor[role='textbox'] {
// width: 100%;
// background: #fff;
// font-size: 1em;
// line-height: 1.6em;
// min-height: var(--ck-sample-editor-min-height);
// padding: 0.5em 1em;
// }
//
// .ck.ck-editor__editable {
// background: #fff;
// border: 1px solid hsl(0, 0%, 70%);
// width: 100%;
// }
//
// .ck.ck-editor {
// /* To enable toolbar wrapping. */
// width: 100%;
// overflow-x: hidden;
// }
//
// .ck.ck-editor__editable {
// position: relative;
// z-index: 10;
// }
//
// body[data-editor="DecoupledDocumentEditor"] .document-editor__toolbar {
// width: 100%;
// }
//
// body[data-editor="DecoupledDocumentEditor"] .collaboration-demo__editable,
// body[data-editor="DecoupledDocumentEditor"] .row-editor .editor {
// height: 100%;
// padding: 20px 40px;
// margin: 0;
// border: 0;
// background-color: var(--ck-sample-color-white);
// box-shadow: 0 0 5px hsla(0, 0%, 0%, 0.1);
// }
//
// body[data-editor="DecoupledDocumentEditor"] .row-editor {
// display: flex;
// position: relative;
// justify-content: center;
// overflow-y: auto;
// background-color: #f2f2f2;
// border: 1px solid hsl(0, 0%, 77%);
// }
//
// body[data-editor="DecoupledDocumentEditor"] .sidebar {
// background: transparent;
// border: 0;
// box-shadow: none;
// }
//
// .ck.ck-toolbar {
// background-color: var(--ck-sample-color-white);
// display: ${props => (props.disabled ? "none" : "block")};
// }
//
// .ck.ck-toolbar .ck.ck-toolbar__separator {
// align-self: stretch;
// width: 1px;
// min-width: 1px;
// background: var(--ck-color-toolbar-border);
// margin: 5px 0;
// }
//
// .ck.ck-dropdown .ck-button.ck-dropdown__button .ck-button__label {
// width: auto;
// }
//
// .ck.ck-list__item .ck-button.ck-on {
// background: inherit !important;
// color: inherit !important;
// }
//
// .ck.ck-icon :not([fill]) {
// fill: none;
// }
//
// .ck.ck-button.ck-on svg.ck.ck-icon.ck-button__icon {
// filter: invert(60%) sepia(12%) saturate(6770%) hue-rotate(1deg)
// brightness(106%) contrast(103%);
// }
//
// .ck-content .image > figcaption {
// min-width: 150px;
// }
//
// [dir="ltr"] .ck.ck-link-actions .ck-button:not(:first-child) {
// display: ${props => {
// if (props.toolbarType && props.toolbarType === "mini") {
// return "none";
// } else {
// return "inline-block";
// }
// }};
// }
// `;
//
// const initiateEditor = (editor, onInitiate, toolbarType) => {
// console.log("Editor is ready to use!", editor);
// console.log(editor);
// //CKEditorInspector.attach(editor);
//
// editor.model.document.on("change:selection", evt => {});
//
// const targetNode = document.querySelector("div.ck-body-wrapper");
// const config = { childList: true, subtree: true };
// const callback = function(mutationsList, observer) {
// console.log(mutationsList);
// for (let mutation of mutationsList) {
// if (
// mutation.type === "childList" &&
// mutation.addedNodes.length > 0 &&
// mutation.addedNodes[0].className === "ck ck-link-actions"
// ) {
// const linkNode = mutation.addedNodes[0];
// if (
// document.querySelector(
// "div.announcement-message div.ck-content.ck-focused a.ck-link_selected"
// )
// ) {
// linkNode.childNodes[1].style.display = "none";
// linkNode.childNodes[2].style.display = "none";
// } else {
// linkNode.childNodes[1].style.display = "block";
// linkNode.childNodes[2].style.display = "block";
// }
// }
// }
// };
// const observer: any = new MutationObserver(callback);
// observer.observe(targetNode, config);
//
// window.selectionLinkObserver = observer;
//
// if (onInitiate) {
// onInitiate(editor);
// }
//
// // Insert the toolbar before the editable area.
// editor.ui
// .getEditableElement()
// .parentElement.insertBefore(
// editor.ui.view.toolbar.element,
// editor.ui.getEditableElement()
// );
// };
//
// export default ({ onInitiate, toolbarType, mode, ...rest }) => {
// useEffect(() => {
// return function cleanup() {
// window.selectionLinkObserver && window.selectionLinkObserver.disconnect();
// };
// }, []);
// const disabled = mode && mode === "preview" ? true : false;
// return (
// <EditorWrapper disabled={disabled} toolbarType={toolbarType}>
// <CKEditor
// onInit={editor => initiateEditor(editor, onInitiate, toolbarType)}
// editor={CustomEditor}
// disabled={disabled}
// {...rest}
// />
// </EditorWrapper>
// );
// };
//# sourceMappingURL=index.js.map