From 27f898686662eead0a9aece82e714a78a690b51f Mon Sep 17 00:00:00 2001 From: domnantas Date: Mon, 20 Sep 2021 23:39:03 +0300 Subject: [PATCH] docs: Clear up Prosemirror EditorProps usage --- docs/api/editor.md | 9 ++++++--- docs/guide/custom-extensions.md | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/api/editor.md b/docs/api/editor.md index 5dac22d4c..2bb56e6d9 100644 --- a/docs/api/editor.md +++ b/docs/api/editor.md @@ -187,7 +187,7 @@ new Editor({ ``` ### Editor props -For advanced use cases, you can pass `editorProps` which will be handled by [ProseMirror](https://prosemirror.net/docs/ref/#view.EditorProps). Here is an example how you can pass a few [Tailwind](https://tailwindcss.com/) classes to the editor container, but there is a lot more you can do. +For advanced use cases, you can pass `editorProps` which will be handled by [ProseMirror](https://prosemirror.net/docs/ref/#view.EditorProps). Here is an example how you can pass a few [Tailwind](https://tailwindcss.com/) classes to the editor container, and transform pasted text, but there is a lot more you can do. ```js new Editor({ @@ -196,8 +196,11 @@ new Editor({ attributes: { class: 'prose prose-sm sm:prose lg:prose-lg xl:prose-2xl mx-auto focus:outline-none', }, - }, -}) + transformPastedText(text) { + return text.toUpperCase(); + } + } +}); ``` You can use that to hook into event handlers and pass - for example - a custom paste handler, too. diff --git a/docs/guide/custom-extensions.md b/docs/guide/custom-extensions.md index 0bf57de0b..9386ffb80 100644 --- a/docs/guide/custom-extensions.md +++ b/docs/guide/custom-extensions.md @@ -499,7 +499,9 @@ const History = Extension.create({ ``` #### Access the ProseMirror API -To hook into events, for example a click, double click or when content is pasted, you can pass event handlers as `editorProps` to the [editor](/api/editor). Or you can add them to a tiptap extension like shown in the below example. +To hook into events, for example a click, double click or when content is pasted, you can pass [event handlers](https://prosemirror.net/docs/ref/#view.EditorProps) to `editorProps` on the [editor](/api/editor). + +Or you can add them to a tiptap extension like shown in the below example. ```js import { Extension } from '@tiptap/core'