From 68fe31b2e42238b785e0569c1e3902315227d724 Mon Sep 17 00:00:00 2001 From: castroCrea Date: Wed, 4 Aug 2021 12:36:12 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Add=20it=20to=20the=20doc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/demos/Examples/Tables/React/index.jsx | 32 +++++++++++++++++++ .../docPages/api/commands/insert-content.md | 8 +++++ packages/core/src/commands/insertContentAt.ts | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/docs/src/demos/Examples/Tables/React/index.jsx b/docs/src/demos/Examples/Tables/React/index.jsx index 15702130..179c71cc 100644 --- a/docs/src/demos/Examples/Tables/React/index.jsx +++ b/docs/src/demos/Examples/Tables/React/index.jsx @@ -32,6 +32,31 @@ const CustomTableCell = TableCell.extend({ }, }) +export const tableHTML = ` + + + + + + + + + + + + + + + + + + + + + +
FirstnameLastnameAge
JillSmith50
EveJackson94
JohnDoe80
+` + const MenuBar = ({ editor }) => { if (!editor) { return null @@ -42,6 +67,13 @@ const MenuBar = ({ editor }) => { + diff --git a/docs/src/docPages/api/commands/insert-content.md b/docs/src/docPages/api/commands/insert-content.md index 147230a8..24059b37 100644 --- a/docs/src/docPages/api/commands/insert-content.md +++ b/docs/src/docPages/api/commands/insert-content.md @@ -16,6 +16,14 @@ editor.commands.insertContent('Example Text') // HTML editor.commands.insertContent('

Example Text

') +// HTML with trim white space +editor.commands.insertContent('

Example Text

', +{ + parseOptions: { + preserveWhitespace: false, + } +}) + // JSON/Nodes editor.commands.insertContent({ type: 'heading', diff --git a/packages/core/src/commands/insertContentAt.ts b/packages/core/src/commands/insertContentAt.ts index f5a1a4f1..db971232 100644 --- a/packages/core/src/commands/insertContentAt.ts +++ b/packages/core/src/commands/insertContentAt.ts @@ -23,7 +23,7 @@ export const insertContentAt: RawCommands['insertContentAt'] = (position, value, parseOptions: { preserveWhitespace: 'full', }, - ...(options || {}) + ...(options || {}), }) // don’t dispatch an empty fragment because this can lead to strange errors