Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

md-editor-rt

Package Overview
Dependencies
Maintainers
1
Versions
231
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

md-editor-rt - npm Package Compare versions

Comparing version 1.5.1 to 1.6.0

lib/MdEditor/layouts/Catalog/index.d.ts

6

lib/MdEditor/Editor.d.ts

@@ -9,4 +9,10 @@ import React from 'react';

NormalToolbar: (props: import("./NormalToolbar").NormalToolbarProp) => JSX.Element;
Catalog: {
(props: import("./layouts/Catalog").CatalogProps): JSX.Element;
defaultProps: {
markedHeadingId: (text: string) => string;
};
};
};
export * from './type';
export default Editor;

2

lib/MdEditor/type.d.ts

@@ -167,2 +167,3 @@ import { CSSProperties, ReactElement } from 'react';

extensions?: Array<any>;
markedImage?: MarkedImage;
}

@@ -180,1 +181,2 @@ export interface ContentType {

}
export declare type MarkedImage = (href: string, title: string, desc: string) => string;

4

package.json
{
"name": "md-editor-rt",
"version": "1.5.1",
"version": "1.6.0",
"keywords": [

@@ -57,3 +57,3 @@ "react",

"@typescript-eslint/parser": "^4.29.0",
"@vavt/markdown-theme": "^0.0.6",
"@vavt/markdown-theme": "^0.0.7",
"@vitejs/plugin-react-refresh": "^1.3.6",

@@ -60,0 +60,0 @@ "axios": "^0.21.1",

@@ -23,3 +23,3 @@ # md-editor-rt

- Upload picture, paste or clip the picture and upload it.
- Render article directly(no editor,no event listener, only preview content).
- Render article directly(no editor, no event listener, only preview content).
- Preview themes, support `defalut`、`vuepress`、`github` styles(not identical).

@@ -29,3 +29,3 @@ - `mermaid`(>=1.3.0).

> More features are developing, if you have some ideas or find issues, please tell it to me~
> More features are developing, if you have some ideas or find issues, please tell me~

@@ -56,5 +56,5 @@ ## Preview

| language | String | 'zh-CN' | Build-in language('zh-CN','en-US') |
| languageUserDefined | Object | {key: StaticTextDefaultValue} | Expand language,update `language` api to your key |
| toolbars | Array | [toolbars] | Show some item of toolbars,all keys<sup>see `toolbars` below</sup> |
| toolbarsExclude | Array | [] | Don't show some item of toolbars,all keys`toolbars` |
| languageUserDefined | Object | {key: StaticTextDefaultValue} | Expand language, update `language` api to your key |
| toolbars | Array | [toolbars] | Show some item of toolbars, all keys<sup>see `toolbars` below</sup> |
| toolbarsExclude | Array | [] | Don't show some item of toolbars, all keys`toolbars` |
| prettier | Boolean | true | Use prettier to beautify content or not |

@@ -127,3 +127,3 @@ | prettierCDN | String | [standalone@2.4.0](https://cdn.jsdelivr.net/npm/prettier@2.4.0/standalone.js) | |

Expand language,you need to replace all the content here:
Expand language, you need to replace all the content here:

@@ -226,5 +226,5 @@ [StaticTextDefaultValue]

| onChange | (v: string) => void | Content changed event(bind to `oninput` of `textarea`) |
| onSave | (v: string) => void | Save Content event,`ctrl+s`and click button will trigger |
| onUploadImg | (files: FileList, callback: function) => void | Upload picture event,when picture is uploading the modal will not close,please provide right urls to the callback function |
| onHtmlChanged | (h: string) => void | Compile markdown successful event,you can use it to get the html code |
| onSave | (v: string) => void | Save Content event, `ctrl+s`and click button will trigger |
| onUploadImg | (files: FileList, callback: function) => void | Upload picture event, when picture is uploading the modal will not close, please provide right urls to the callback function |
| onHtmlChanged | (h: string) => void | Compile markdown successful event, you can use it to get the html code |
| onGetCatalog | (list: HeadList[]) => void | Get catalogue of article |

@@ -234,2 +234,3 @@ | markedHeading | (text: string,level: 1-6,raw: string, slugger: Slugger) => string | `marked` head renderer methods |

| sanitize | (html: string) => string | Sanitize the html, prevent XSS. |
| markedImage | (href: string, title: string, desc: string) => string | Overrides the html element structure of the default generated picture |

@@ -267,4 +268,35 @@ > If `markedHeading` is overridden, be sure to tell the editor the algorithm for generating the title ID by `marketheadingid`.

## Simple demo
## Internal components
Before 1.x, they are used as attributes of the editor component, eg: `Editor.DropdownToolbar`. For more examples, refer to [document](https://imzbf.github.io/md-editor-v3).
### NormalToolbar
`Editor.NormalToolbar`
- `title`: `string`, not necessary, the tips when hover toolbar;
- `trigger`: `string | JSX.Element`, necessary, it is usually an icon, which is displayed on the toolbar;
- `onClick`: `(e: MouseEvent) => void`, necessary.
### DropdownToolbar
`Editor.DropdownToolbar`
- `title`: `string`, not necessary, the tips when hover toolbar;
- `visible`: `boolean`, necessary;
- `trigger`: `string | JSX.Element`, necessary, it is usually an icon, which is displayed on the toolbar;
- `onChange`: `(visible: boolean) => void`, necessary;
- `overlay`: `string | JSX.Element`, necessary, contents in the drop-down box.
### Catalogue
`Editor.Catalog`
- `editorId`: `string`, necessary, editor's `editorId`, used to register listening events;
- `class`: `string`, not necessary;
- `markedHeadingId`: `MarkedHeadingId`, not necessary, same as editor;
- `scrollElement`: `string | HTMLElement`, not necessary, it is an element selector when its type is string. When `previewOnly` eq `true`, it is usually set to `document.documentElement`.
## Some examples
### Jsx module

@@ -293,3 +325,3 @@

> Tips:When you paste and upload GIF,it will upload a static picture. So you should upload it by file system!
> Tips:When you paste and upload GIF, it will upload a static picture. So you should upload it by file system!

@@ -296,0 +328,0 @@ ```js

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc