Skip to content

Commit

Permalink
feat: import Quill from quill instead of react-quill
Browse files Browse the repository at this point in the history
  • Loading branch information
robertu7 committed Dec 30, 2022
1 parent daa37d4 commit e6e1baa
Show file tree
Hide file tree
Showing 22 changed files with 40 additions and 40 deletions.
4 changes: 2 additions & 2 deletions demo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const App = () => {
titleDefaultValue=""
titleReadOnly={false}
/>

{/*
<br />
<MattersCommentEditor
Expand All @@ -114,7 +114,7 @@ const App = () => {
texts={{
COMMENT_PLACEHOLDER: 'custom placeholder\nand line break',
}}
/>
/> */}
</>
)
}
Expand Down
26 changes: 13 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@tippyjs/react": "^4.0.4",
"@types/classnames": "^2.2.10",
"@types/lodash": "^4.14.191",
"@types/quill": "^2.0.3",
"@types/quill": "^2.0.10",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.10",
"@types/uuid": "^9.0.0",
Expand Down
7 changes: 3 additions & 4 deletions src/article.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _debounce from 'lodash/debounce'
import Quill from 'quill'
import React from 'react'
import ReactQuill from 'react-quill'
import Quill from 'quill'

import Util from './blots/Util'
import MattersEditorMention from './components/Mention'
Expand Down Expand Up @@ -92,7 +92,7 @@ export class MattersArticleEditor extends React.Component<Props, State> {
initAudioPlayers()

// set init text
this.initText = this.instance.getText() || ''
this.initText = this.instance?.getText() || ''
}

componentDidUpdate(prevProps: Props, prevState: State) {
Expand Down Expand Up @@ -233,8 +233,7 @@ export class MattersArticleEditor extends React.Component<Props, State> {
texts: this.texts,
},
mention: {
mentionContainer:
this.mentionReference && this.mentionReference.current,
mentionContainer: this.mentionReference.current,
handleMentionChange: this.handleMentionChange,
storeMentionInstance: this.storeMentionInstance,
},
Expand Down
2 changes: 1 addition & 1 deletion src/blots/AudioFigure.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Quill } from 'react-quill'
import Quill from 'quill'

import BaseBlockEmbed from './BaseBlockEmbed'

Expand Down
2 changes: 1 addition & 1 deletion src/blots/BaseBlockEmbed.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Quill } from 'react-quill'
import Quill from 'quill'

const Parchment = Quill.import('parchment')
const BlockEmbed = Quill.import('blots/block/embed')
Expand Down
2 changes: 1 addition & 1 deletion src/blots/Divider.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Quill } from 'react-quill'
import Quill from 'quill'

import BaseBlockEmbed from './BaseBlockEmbed'

Expand Down
2 changes: 1 addition & 1 deletion src/blots/EmbedClipboard.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Quill } from 'react-quill'
import Quill from 'quill'

import { COLOR, KEYCODES, URL_LIKE_BUTTON } from '../enums/common'
import { TEXT } from '../enums/text'
Expand Down
2 changes: 1 addition & 1 deletion src/blots/EmbedCode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Quill } from 'react-quill'
import Quill from 'quill'

import BaseBlockEmbed from './BaseBlockEmbed'

Expand Down
2 changes: 1 addition & 1 deletion src/blots/EmbedVideo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Quill } from 'react-quill'
import Quill from 'quill'

import BaseBlockEmbed from './BaseBlockEmbed'

Expand Down
2 changes: 1 addition & 1 deletion src/blots/Figcaption.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Quill } from 'react-quill'
import Quill from 'quill'

import BaseBlockEmbed from './BaseBlockEmbed'

Expand Down
2 changes: 1 addition & 1 deletion src/blots/ImageFigure.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Quill } from 'react-quill'
import Quill from 'quill'

import BaseBlockEmbed from './BaseBlockEmbed'

Expand Down
2 changes: 1 addition & 1 deletion src/blots/Mention.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Quill } from 'react-quill'
import Quill from 'quill'

const Embed = Quill.import('blots/embed')

Expand Down
2 changes: 1 addition & 1 deletion src/blots/SmartBreak.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Quill } from 'react-quill'
import Quill from 'quill'

const Embed = Quill.import('blots/embed')

Expand Down
2 changes: 1 addition & 1 deletion src/blots/Source.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Quill } from 'react-quill'
import Quill from 'quill'

const BlockEmbed = Quill.import('blots/block/embed')

Expand Down
2 changes: 1 addition & 1 deletion src/blots/Tag.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Quill } from 'react-quill'
import Quill from 'quill'

const Embed = Quill.import('blots/embed')

Expand Down
2 changes: 1 addition & 1 deletion src/blots/Util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Quill } from 'react-quill'
import Quill from 'quill'

const Embed = Quill.import('blots/embed')

Expand Down
2 changes: 1 addition & 1 deletion src/comment.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _debounce from 'lodash/debounce'
import Quill from 'quill'
import React from 'react'
import Quill from 'quill'
import ReactQuill from 'react-quill'

import MattersEditorMention from './components/Mention'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Toolbar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames'
import Quill from 'quill'
import React from 'react'
import Quill from 'quill'

import { Texts } from '../../enums/text'
import SVGToolbarAdd from '../../icons/ToolbarAdd'
Expand Down
2 changes: 1 addition & 1 deletion src/matchers/createImage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Quill } from 'react-quill'
import Quill from 'quill'

//import IMAGE_PLACEHOLDER from '~/static/images/image-placeholder.svg'

Expand Down
2 changes: 1 addition & 1 deletion src/matchers/lineBreaker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Quill } from 'react-quill'
import Quill from 'quill'

const Delta = Quill.import('delta')

Expand Down
7 changes: 4 additions & 3 deletions src/modules/clipboard.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Quill } from 'react-quill'
import Quill from 'quill'

// import { docsSoap } from 'docs-soap'
import { soap } from '../utils/soap'
Expand Down Expand Up @@ -61,9 +61,10 @@ class RemadeClipboard extends Clipboard {
delta.insert(text, {
[CodeBlock.blotName]: formats[CodeBlock.blotName],
})
} else if (!clipboardData.types.includes("text/html") || !htmlRaw) {
} else if (!clipboardData.types.includes('text/html') || !htmlRaw) {
delta.insert(text)
} else { // text/html
} else {
// text/html
// add image matcher only when pasting html
this.addMatcher('IMG', createImageMatcher(this.upload))

Expand Down

0 comments on commit e6e1baa

Please sign in to comment.