Commit 9d4f1361 by Рамис

new editor

parent 29c3e622
{ {
"name": "react-ag-qeditor", "name": "react-ag-qeditor",
"version": "0.0.15", "version": "1.0.1",
"description": "WYSIWYG html editor", "description": "WYSIWYG html editor",
"author": "atma", "author": "atma",
"license": "MIT", "license": "MIT",
......
...@@ -228,11 +228,6 @@ const QEditor = ({ value, onChange, style, uploadOptions }) => { ...@@ -228,11 +228,6 @@ const QEditor = ({ value, onChange, style, uploadOptions }) => {
} }
}) })
useEffect(()=>{
}, [])
const buildActionsModal = (buttons = []) => { const buildActionsModal = (buttons = []) => {
if (buttons.length === 0) { if (buttons.length === 0) {
return null; return null;
...@@ -344,14 +339,6 @@ const QEditor = ({ value, onChange, style, uploadOptions }) => { ...@@ -344,14 +339,6 @@ const QEditor = ({ value, onChange, style, uploadOptions }) => {
return isDisabled; return isDisabled;
} }
// useEffect(()=>{
// if(uploaderUid){
//
// }
//
// setModalIsOpen(false);
// }, [uploaderUid])
if (!editor) { if (!editor) {
return null return null
} }
...@@ -366,15 +353,10 @@ const QEditor = ({ value, onChange, style, uploadOptions }) => { ...@@ -366,15 +353,10 @@ const QEditor = ({ value, onChange, style, uploadOptions }) => {
<BubbleMenu editor={editor} shouldShow={({...o}) => { <BubbleMenu editor={editor} shouldShow={({...o}) => {
let items = []; let items = [];
console.log(editor.isActive('table'), o.from, o.to, o);
if(o.from !== o.to && editor.isActive('paragraph')){ if(o.from !== o.to && editor.isActive('paragraph')){
items = initialBubbleItems; items = initialBubbleItems;
console.log('das');
} }
if(editor.isActive('table')){ if(editor.isActive('table')){
if(o.from === o.to || document.querySelectorAll('.selectedCell').length > 0){ if(o.from === o.to || document.querySelectorAll('.selectedCell').length > 0){
if(items.length > 0){ if(items.length > 0){
...@@ -407,8 +389,6 @@ const QEditor = ({ value, onChange, style, uploadOptions }) => { ...@@ -407,8 +389,6 @@ const QEditor = ({ value, onChange, style, uploadOptions }) => {
} }
} }
if(editor.isActive('image') === true){ if(editor.isActive('image') === true){
setBubbleItems(['alignLeft', 'alignCenter', 'alignRight']); setBubbleItems(['alignLeft', 'alignCenter', 'alignRight']);
} }
...@@ -416,8 +396,6 @@ const QEditor = ({ value, onChange, style, uploadOptions }) => { ...@@ -416,8 +396,6 @@ const QEditor = ({ value, onChange, style, uploadOptions }) => {
setBubbleItems(items); setBubbleItems(items);
return true; return true;
} }
}} tippyOptions={{ duration: 100 }}> }} tippyOptions={{ duration: 100 }}>
<div className="atma-editor-bubble"> <div className="atma-editor-bubble">
{ {
...@@ -437,10 +415,6 @@ const QEditor = ({ value, onChange, style, uploadOptions }) => { ...@@ -437,10 +415,6 @@ const QEditor = ({ value, onChange, style, uploadOptions }) => {
}) })
} }
</div> </div>
{/* <button onClick={() => editor.commands.setTextAlign('left')}>left</button> */}
{/* <button onClick={() => editor.commands.setTextAlign('center')}>center</button> */}
{/* <button onClick={() => editor.commands.setTextAlign('right')}>right</button> */}
</BubbleMenu> </BubbleMenu>
<EditorContent <EditorContent
editor={editor} editor={editor}
...@@ -458,10 +432,6 @@ const QEditor = ({ value, onChange, style, uploadOptions }) => { ...@@ -458,10 +432,6 @@ const QEditor = ({ value, onChange, style, uploadOptions }) => {
title: 'Отмена', title: 'Отмена',
className: ' atma-editor-cancel', className: ' atma-editor-cancel',
onClick: () => { onClick: () => {
// const quill = this.quillRef.getEditor();
// let range = quill.getSelection();
// let index = range ? range.index : 0;
setUploaderUid(`uid${new Date()}`); setUploaderUid(`uid${new Date()}`);
setUploadedPaths([]); setUploadedPaths([]);
setModalIsOpen(false) setModalIsOpen(false)
...@@ -540,14 +510,9 @@ const QEditor = ({ value, onChange, style, uploadOptions }) => { ...@@ -540,14 +510,9 @@ const QEditor = ({ value, onChange, style, uploadOptions }) => {
setUploadedPaths([]); setUploadedPaths([]);
setModalTitle(''); setModalTitle('');
setModalIsOpen(false); setModalIsOpen(false);
}catch (err){ }catch (err){
console.log(err) console.log(err)
} }
}, },
disabled: isDisabledAction() disabled: isDisabledAction()
} }
......
import React, { Fragment, useState } from 'react' import React, { Fragment, useState } from 'react';
const ToolBar = ({ editor, toolsLib = [] }) => { const ToolBar = ({ editor, toolsLib = [] }) => {
if (!editor) { if (!editor) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment