From fb14b0aa8e25c6549e0b3c25bcff9a3bd8584099 Mon Sep 17 00:00:00 2001 From: Darginec05 Date: Fri, 17 May 2024 01:24:23 +0300 Subject: [PATCH 1/2] docs for paragraph --- CONTRIBUTING.md | 7 ++- README.md | 3 +- packages/plugins/paragraph/README.md | 75 ++++++++++++++++++++++++++-- 3 files changed, 75 insertions(+), 10 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8b8353027..bbb8588ef 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,12 +26,12 @@ We'd also love PRs. If you're thinking of a large PR, we advise opening up an is 1. Push to your fork and [submit a pull request][pr]. 1. Pat yourself on the back and wait for your pull request to be reviewed and merged. -[//]: # (1. Make sure the tests pass on your machine: `npm test`, note: these tests also apply the linter, so there's no need to lint separately.) -[//]: # (1. Make your change, add tests, and make sure the tests still pass.) +[//]: # "1. Make sure the tests pass on your machine: `yarn test`, note: these tests also apply the linter, so there's no need to lint separately." +[//]: # '1. Make your change, add tests, and make sure the tests still pass.' Here are a few things you can do that will increase the likelihood of your pull request being accepted: -- Follow the [style guide][style] which is using standard. Any linting errors should be shown when running `npm test`. +- Follow the [style guide][style] which is using standard. Any linting errors should be shown when running `yarn test`. - Write and update tests. - Keep your changes as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. - Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). @@ -53,4 +53,3 @@ We welcome everyone to review Pull Requests, it is a great way to learn, network - do not be rude, disrespectful or aggressive - do not repeat feedback, this creates more noise than value (check the existing conversation), use GitHub reactions if you agree/disagree with a comment - do not blindly approve pull requests to improve your GitHub contributors graph - diff --git a/README.md b/README.md index 982849611..16242f243 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ All of this is customizable, extensible, and easy to set up! - Plugins - - **@yoopta/paragraph** + - [**@yoopta/paragraph**](https://github.com/Darginec05/Yoopta-Editor/blob/master/packages/plugins/paragraph/README.md) - **@yoopta/blockquote** - **@yoopta/code** - **@yoopta/embed** @@ -317,6 +317,7 @@ If you have any questions or need assistance raise an issue in the GitHub reposi Let's create powerful and engaging editing experiences together with Yoopta-Editor! ## Project structure + ```text packages/ ├── core - core components of the editor diff --git a/packages/plugins/paragraph/README.md b/packages/plugins/paragraph/README.md index 177ded412..60861d683 100644 --- a/packages/plugins/paragraph/README.md +++ b/packages/plugins/paragraph/README.md @@ -1,11 +1,76 @@ -# `yoopta-paragraph` +# Paragraph plugin -> TODO: description +Paragraph is default plugin for Yoopta-Editor -## Usage +### Installation +```bash +yarn add @yoopta/paragraph ``` -const paragraph = require('yoopta-paragraph'); -// TODO: DEMONSTRATE API +### Usage + +```jsx +import Paragraph from '@yoopta/paragraph'; + +const plugins = [Paragraph]; + +const Editor = () => { + return ; +}; +``` + +### Default classnames + +- .yoopta-paragraph + +### Default options + +```js +const Paragraph = new YooptaPlugin({ + type: 'Paragraph', + elements: { + paragraph: { + render: ParagraphRender, + }, + }, + options: { + display: { + title: 'Text', + description: 'Start writing plain text.', + }, + shortcuts: ['p', 'text'], + }, + parsers: { + html: { + deserialize: { + nodeNames: ['P'], + }, + }, + }, +}); +``` + +### Options to extend + +```tsx +const plugins = [ + Paragraph.extend({ + renders: { + paragraph: (props) => + }, + options: { + shortcuts: [``], + align: 'left' | 'center' | 'right', + display: { + title: ``, + description: ``, + }, + HTMLAttributes: { + className: '', + // ...other HTML attributes + }, + }, + }); +]; ``` From 952bd930846b1de7a5e2ae85ec7a28fc32298698 Mon Sep 17 00:00:00 2001 From: Darginec05 Date: Fri, 17 May 2024 01:27:08 +0300 Subject: [PATCH 2/2] fix docs --- packages/plugins/paragraph/README.md | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/packages/plugins/paragraph/README.md b/packages/plugins/paragraph/README.md index 60861d683..1165d4501 100644 --- a/packages/plugins/paragraph/README.md +++ b/packages/plugins/paragraph/README.md @@ -28,12 +28,6 @@ const Editor = () => { ```js const Paragraph = new YooptaPlugin({ - type: 'Paragraph', - elements: { - paragraph: { - render: ParagraphRender, - }, - }, options: { display: { title: 'Text', @@ -41,13 +35,6 @@ const Paragraph = new YooptaPlugin({ }, shortcuts: ['p', 'text'], }, - parsers: { - html: { - deserialize: { - nodeNames: ['P'], - }, - }, - }, }); ```