Skip to content

Commit f1f0068

Browse files
authored
fix(code): fixed paste in code and block code (#370)
1 parent 88088ec commit f1f0068

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/extensions/behavior/Clipboard/clipboard.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,19 @@ export const clipboard = ({
129129
const codeType = isInsideCode(view.state);
130130
if (codeType) {
131131
const schema: Schema = view.state.schema;
132+
const insideCodeData = e.clipboardData.getData(DataTransferType.Text);
133+
132134
view.dispatch(
133135
trackTransactionMetrics(
134136
view.state.tr.replaceSelectionWith(
135-
schema.text(codeType === 'inline' ? data.trim() : data),
137+
schema.text(
138+
codeType === 'inline'
139+
? insideCodeData.trim()
140+
: insideCodeData,
141+
),
136142
),
137143
'paste',
138-
{clipboardDataFormat: dataFormat, code: codeType},
144+
{clipboardDataFormat: DataTransferType.Text, code: codeType},
139145
),
140146
);
141147
isPasteHandled = true;

0 commit comments

Comments
 (0)