react-headless-mde 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintrc.js ADDED
@@ -0,0 +1,24 @@
1
+ module.exports = {
2
+ parser: '@typescript-eslint/parser',
3
+ parserOptions: {
4
+ ecmaVersion: 'latest',
5
+ sourceType: 'module',
6
+ project: ['./tsconfig.json'], // Specify it only for TypeScript files
7
+ },
8
+ settings: {
9
+ react: {
10
+ version: 'detect',
11
+ },
12
+ },
13
+ env: {
14
+ browser: true,
15
+ es2021: true,
16
+ },
17
+ extends: ['plugin:react/recommended', 'standard-with-typescript', 'plugin:prettier/recommended'],
18
+ overrides: [],
19
+ plugins: ['react', 'import', 'simple-import-sort'],
20
+ rules: {
21
+ '@typescript-eslint/strict-boolean-expressions': 0,
22
+ '@typescript-eslint/explicit-function-return-type': 0,
23
+ },
24
+ };
@@ -4,11 +4,11 @@
4
4
  name: Publish
5
5
 
6
6
  on:
7
- push:
8
- branches:
9
- - 'main'
10
- # release:
11
- # types: [created]
7
+ release:
8
+ types: [created]
9
+ # push:
10
+ # branches:
11
+ # - 'main'
12
12
 
13
13
  jobs:
14
14
  build-and-publish:
@@ -22,5 +22,6 @@ jobs:
22
22
  - run: npm install
23
23
  - run: npm run build
24
24
  - run: npm publish
25
+ # - run: npm publish --tag next
25
26
  env:
26
27
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ node_modules/.bin/lint-staged
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ npm run check-types
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- Introduction
2
- ===
3
- A simple yet powerful and extensible **React Markdown Editor** that aims to have feature parity with the Github Markdown editor.
1
+ # Introduction
2
+
3
+ A simple yet powerful and extensible **React Markdown Editor** that aims to have feature parity with the Github Markdown editor.
4
4
  React-mde-headless has no 3rd party dependencies.
5
5
 
6
6
  ## [Demo](https://codesandbox.io/s/competent-jepsen-qyz51q?file=/src/index.tsx)
@@ -12,55 +12,63 @@ React-mde-headless has no 3rd party dependencies.
12
12
  ## Using
13
13
 
14
14
  ```jsx
15
- import {
16
- boldCommand,
17
- italicCommand,
18
- linkCommand,
19
- useTextAreaMarkdownEditor,
20
- } from 'react-mde-headless';
15
+ import { bold, italic, link, useTextAreaMarkdownEditor } from 'react-mde-headless';
21
16
 
22
17
  export const MarkdownEditor = () => {
23
- const { ref, commandController } = useTextAreaMarkdownEditor({
24
- commandMap: {
25
- bold: boldCommand,
26
- italic: italicCommand,
27
- link: linkCommand,
28
- },
29
- });
30
-
18
+ const { ref } = useTextAreaMarkdownEditor();
19
+
31
20
  return (
32
- <div className={'mb-4'}>
33
- <div className={'mb-3 gap-1 flex flex-wrap'}>
34
- <button
35
- onClick={() => {
36
- commandController.executeCommand('bold')
37
- }}
38
- >B</button>
39
- </div>
21
+ <div>
22
+ <button onClick={bold}>B</button>
40
23
 
41
24
  <textarea ref={ref} />
42
- </div>
25
+ </div>
43
26
  );
44
27
  };
45
28
  ```
29
+
30
+ ## Supported commands
31
+
32
+ - bold
33
+ - italic
34
+ - strikethrough
35
+ - headingLevel1
36
+ - headingLevel2
37
+ - headingLevel3
38
+ - headingLevel4
39
+ - headingLevel5
40
+ - headingLevel6
41
+ - link
42
+ - quote
43
+ - code
44
+ - codeBlock
45
+ - checkedList
46
+ - orderedList
47
+ - unorderedList
48
+ - image
49
+ - attachment
50
+
46
51
  ## Todo
47
52
 
48
- ### Add to awesome-react-headless-components on stable version
49
- https://github.com/jxom/awesome-react-headless-components
53
+ - Check execution on SSR (For example, Next.js) and, if necessary, regenerate eslint config, taking into account execution on node.js
54
+ - Add to awesome-react-headless-components on stable version https://github.com/jxom/awesome-react-headless-components
55
+ - peerDependencies React?
56
+ - heading undo
50
57
 
51
58
  ### Third party
59
+
52
60
  - https://github.com/grassator/insert-text-at-cursor by https://twitter.com/d_kubyshkin
53
61
 
54
62
  ### XSS concerns
55
63
 
56
64
  React-mde-headless does not automatically sanitize the HTML preview. If your using Showdown,
57
- this has been taken from [their documentation](https://github.com/showdownjs/showdown/wiki/Markdown's-XSS-Vulnerability-(and-how-to-mitigate-it)):
65
+ this has been taken from [their documentation](<https://github.com/showdownjs/showdown/wiki/Markdown's-XSS-Vulnerability-(and-how-to-mitigate-it)>):
58
66
 
59
67
  > Cross-side scripting is a well known technique to gain access to private information of the users
60
- of a website. The attacker injects spurious HTML content (a script) on the web page which will read
61
- the user’s cookies and do something bad with it (like steal credentials). As a countermeasure,
62
- you should filter any suspicious content coming from user input. Showdown doesn’t include an
63
- XSS filter, so you must provide your own. But be careful in how you do it…
68
+ > of a website. The attacker injects spurious HTML content (a script) on the web page which will read
69
+ > the user’s cookies and do something bad with it (like steal credentials). As a countermeasure,
70
+ > you should filter any suspicious content coming from user input. Showdown doesn’t include an
71
+ > XSS filter, so you must provide your own. But be careful in how you do it…
64
72
 
65
73
  You might want to take a look at [showdown-xss-filter](https://github.com/VisionistInc/showdown-xss-filter).
66
74
 
@@ -68,7 +76,6 @@ You might want to take a look at [showdown-xss-filter](https://github.com/Vision
68
76
 
69
77
  React-mde-headless is [MIT licensed](https://github.com/andrerpena/react-mde/blob/master/LICENSE).
70
78
 
71
- ## About the author
72
-
73
- Made with :heart: by André Pena and [other awesome contributors](https://github.com/andrerpena).
79
+ ## About the authors
74
80
 
81
+ Created by [André Pena](https://github.com/andrerpena). Maintained and developed by https://github.com/webbrother.