File tree 2 files changed +5
-4
lines changed
2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { wysiwygTransformer } from '@/editor/components/WysiwygEditor'
2
2
import type { CreateExtensionPlugin } from '@remirror/core'
3
3
import { PlainExtension } from '@remirror/core'
4
4
import type { Slice , Node } from '@remirror/pm/model'
5
- import { DOMSerializer , DOMParser } from '@remirror/pm/model'
5
+ import { DOMParser } from '@remirror/pm/model'
6
6
7
7
type UnknownRecord = Record < string , unknown >
8
8
function isPureText ( content : UnknownRecord | UnknownRecord [ ] | undefined | null ) : boolean {
@@ -57,11 +57,12 @@ export class ClipboardExtension extends PlainExtension {
57
57
58
58
const domParser = DOMParser . fromSchema ( schema )
59
59
let dom
60
- if ( html . length === 0 ) {
60
+ if ( text ) {
61
61
const slice = parser ?.( text )
62
62
if ( ! slice || typeof slice === 'string' ) return false
63
63
64
- dom = DOMSerializer . fromSchema ( schema ) . serializeFragment ( slice . content )
64
+ view . dispatch ( view . state . tr . replaceSelectionWith ( slice , true ) )
65
+ return true
65
66
} else {
66
67
const template = document . createElement ( 'template' )
67
68
template . innerHTML = html
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ export const rmeProsemirrorNodeToHtml = async (
92
92
93
93
try {
94
94
await Promise . all ( imageLoadTasks )
95
- return HTML . stringify ( fullAst )
95
+ return HTML . stringify ( fullAst ) as string
96
96
} catch ( error ) {
97
97
return html
98
98
}
You can’t perform that action at this time.
0 commit comments