fix(widget-markdown): cut/copy selection only in raw mode (#3024)
This commit is contained in:
parent
32f49683b1
commit
1b755b3be8
@ -4,6 +4,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { ClassNames } from '@emotion/core';
|
import { ClassNames } from '@emotion/core';
|
||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
|
import { Value } from 'slate';
|
||||||
import { Editor as Slate, setEventTransfer } from 'slate-react';
|
import { Editor as Slate, setEventTransfer } from 'slate-react';
|
||||||
import Plain from 'slate-plain-serializer';
|
import Plain from 'slate-plain-serializer';
|
||||||
import isHotkey from 'is-hotkey';
|
import isHotkey from 'is-hotkey';
|
||||||
@ -52,7 +53,7 @@ export default class RawEditor extends React.Component {
|
|||||||
handleCopy = async (event, editor) => {
|
handleCopy = async (event, editor) => {
|
||||||
event.persist();
|
event.persist();
|
||||||
const { getAsset, resolveWidget } = this.props;
|
const { getAsset, resolveWidget } = this.props;
|
||||||
const markdown = Plain.serialize(editor.value);
|
const markdown = Plain.serialize(Value.create({ document: editor.value.fragment }));
|
||||||
const html = await markdownToHtml(markdown, { getAsset, resolveWidget });
|
const html = await markdownToHtml(markdown, { getAsset, resolveWidget });
|
||||||
setEventTransfer(event, 'text', markdown);
|
setEventTransfer(event, 'text', markdown);
|
||||||
setEventTransfer(event, 'html', html);
|
setEventTransfer(event, 'html', html);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user