1
1
import { createPlugins , ELEMENT_MEDIA_EMBED , ELEMENT_TABLE } from '@udecode/plate'
2
- import {
3
- MexEditor ,
4
- ComboboxKey ,
5
- QuickLinkElement ,
6
- ComboboxConfig ,
7
- ELEMENT_TAG ,
8
- ELEMENT_ILINK
9
- } from '@workduck-io/mex-editor'
10
2
import { useSpring } from 'react-spring'
11
3
import { useDebouncedCallback } from 'use-debounce'
12
4
13
- import React , { useState , useEffect , useMemo , useRef } from 'react'
14
- import styled from 'styled-components'
5
+ import React , { useState , useMemo } from 'react'
15
6
16
7
import { EditorStyles , useEditorChange } from '@mexit/shared'
17
8
import generatePlugins from '../../Utils/plugins'
@@ -22,11 +13,12 @@ import { useTagStore } from '../../Hooks/useTags'
22
13
23
14
import components from './Components'
24
15
import BallonMarkToolbarButtons from './BalloonToolbar/EditorBalloonToolbar'
25
- import { Tag , CaptureType , QuickLinkType , ActionType } from '@mexit/core'
16
+ import { Tag , QuickLinkType , ActionType , ELEMENT_TAG , ELEMENT_ILINK } from '@mexit/core'
26
17
import { useEditorContext } from '../../Hooks/useEditorContext'
27
- import { styleSlot } from '../../contentScript'
28
18
import useDataStore from '../../Stores/useDataStore'
29
- import { MexEditorOptions } from '@workduck-io/mex-editor/lib/types/editor'
19
+ import { ComboboxConfig , ComboboxKey } from '../../Editor/types'
20
+ import MexEditor from '../../Editor/MexEditor'
21
+ import { MexEditorOptions } from '../../Editor/types/editor'
30
22
31
23
interface EditorProps {
32
24
nodePath ?: string
@@ -43,12 +35,6 @@ const commands = [
43
35
icon : 'ri:table-line' ,
44
36
type : 'Quick Actions'
45
37
} ,
46
- // {
47
- // command: 'canvas',
48
- // text: 'Insert Drawing canvas',
49
- // icon: 'ri:markup-line',
50
- // type: 'Quick Actions'
51
- // },
52
38
{
53
39
command : 'webem' ,
54
40
text : 'Insert Web embed' ,
@@ -60,18 +46,11 @@ const commands = [
60
46
export const Editor : React . FC < EditorProps > = ( { readOnly, onChange } ) => {
61
47
const { searchResults, activeIndex, activeItem } = useSputlitContext ( )
62
48
const { previewMode, nodeContent, node, setPreviewMode } = useEditorContext ( )
63
- const currTabURL = window . location . href
64
- const [ pageMetaTags , setPageMetaTags ] = useState < any [ ] > ( [ ] )
65
- const [ userTags , setUserTags ] = useState < Tag [ ] > ( [ ] )
66
49
const ilinks = useDataStore ( ( store ) => store . ilinks )
67
50
68
51
const addTags = useTagStore ( ( store ) => store . addTags )
69
52
const tags = useTagStore ( ( store ) => store . tags )
70
53
71
- const plugins = createPlugins ( generatePlugins ( ) )
72
- const userDetails = useAuthStore ( ( store ) => store . userDetails )
73
- const workspaceDetails = useAuthStore ( ( store ) => store . workspaceDetails )
74
-
75
54
useEditorChange ( node . nodeid , nodeContent , onChange )
76
55
77
56
const comboboxConfig : ComboboxConfig = {
@@ -183,7 +162,7 @@ export const Editor: React.FC<EditorProps> = ({ readOnly, onChange }) => {
183
162
options = { editorOptions }
184
163
editorId = { node . nodeid }
185
164
value = { nodeContent }
186
- portalElement = { document . getElementById ( 'mexit' ) . shadowRoot . getElementById ( 'sputlit-main ' ) }
165
+ portalElement = { document . getElementById ( 'mexit' ) . shadowRoot . getElementById ( 'sputlit-container ' ) }
187
166
/>
188
167
</ EditorStyles >
189
168
</ EditorWrapper >
0 commit comments