@mantine/rte
Advanced tools
Comparing version 2.5.0-alpha.5 to 2.5.0
@@ -9,3 +9,3 @@ 'use strict'; | ||
["unorderedList", "orderedList"], | ||
["link", "image", "video"], | ||
["link", "image", "video", "blockquote"], | ||
["alignLeft", "alignCenter", "alignRight"], | ||
@@ -12,0 +12,0 @@ ["sup", "sub"] |
@@ -59,2 +59,9 @@ 'use strict'; | ||
replaceIcons.replaceIcons(icons); | ||
function defaultImageUpload(file) { | ||
return new Promise((resolve) => { | ||
const reader = new FileReader(); | ||
reader.onloadend = () => resolve(reader.result); | ||
reader.readAsDataURL(file); | ||
}); | ||
} | ||
function RichTextEditor(_a) { | ||
@@ -64,3 +71,3 @@ var _b = _a, { | ||
onChange, | ||
onImageUpload = () => Promise.resolve(null), | ||
onImageUpload = defaultImageUpload, | ||
sticky = true, | ||
@@ -67,0 +74,0 @@ stickyOffset = 0, |
@@ -85,2 +85,3 @@ 'use strict'; | ||
display: "inline-block", | ||
whiteSpace: "nowrap", | ||
textOverflow: "ellipsis", | ||
@@ -156,2 +157,7 @@ overflow: "hidden", | ||
}, | ||
"& ol, & ul": { | ||
marginTop: theme.spacing.sm, | ||
paddingLeft: theme.spacing.md * 2, | ||
listStylePosition: "outside" | ||
}, | ||
"& h1": { | ||
@@ -185,2 +191,10 @@ fontSize: theme.headings.sizes.h1.fontSize, | ||
}, | ||
"& blockquote": { | ||
marginTop: 0, | ||
marginLeft: 0, | ||
marginBottom: theme.spacing.sm, | ||
paddingLeft: theme.spacing.md, | ||
color: theme.colorScheme === "dark" ? theme.colors.dark[2] : theme.colors.gray[7], | ||
borderLeft: `4px solid ${theme.colorScheme === "dark" ? theme.colors.dark[4] : theme.colors.gray[4]}` | ||
}, | ||
"& img": { | ||
@@ -187,0 +201,0 @@ display: "block", |
@@ -116,2 +116,6 @@ 'use strict'; | ||
value: "sub" | ||
}, | ||
blockquote: { | ||
icon: radixIcons.QuoteIcon, | ||
controls: "blockquote" | ||
} | ||
@@ -118,0 +122,0 @@ }; |
@@ -17,3 +17,4 @@ 'use strict'; | ||
"header", | ||
"script" | ||
"script", | ||
"blockquote" | ||
]; | ||
@@ -20,0 +21,0 @@ function replaceIcons(quillIconsModule) { |
@@ -5,3 +5,3 @@ const DEFAULT_CONTROLS = [ | ||
["unorderedList", "orderedList"], | ||
["link", "image", "video"], | ||
["link", "image", "video", "blockquote"], | ||
["alignLeft", "alignCenter", "alignRight"], | ||
@@ -8,0 +8,0 @@ ["sup", "sub"] |
@@ -51,2 +51,9 @@ import React, { useRef, useMemo, useEffect } from 'react'; | ||
replaceIcons(icons); | ||
function defaultImageUpload(file) { | ||
return new Promise((resolve) => { | ||
const reader = new FileReader(); | ||
reader.onloadend = () => resolve(reader.result); | ||
reader.readAsDataURL(file); | ||
}); | ||
} | ||
function RichTextEditor(_a) { | ||
@@ -56,3 +63,3 @@ var _b = _a, { | ||
onChange, | ||
onImageUpload = () => Promise.resolve(null), | ||
onImageUpload = defaultImageUpload, | ||
sticky = true, | ||
@@ -59,0 +66,0 @@ stickyOffset = 0, |
@@ -81,2 +81,3 @@ import { createMemoStyles, getFontStyles } from '@mantine/core'; | ||
display: "inline-block", | ||
whiteSpace: "nowrap", | ||
textOverflow: "ellipsis", | ||
@@ -152,2 +153,7 @@ overflow: "hidden", | ||
}, | ||
"& ol, & ul": { | ||
marginTop: theme.spacing.sm, | ||
paddingLeft: theme.spacing.md * 2, | ||
listStylePosition: "outside" | ||
}, | ||
"& h1": { | ||
@@ -181,2 +187,10 @@ fontSize: theme.headings.sizes.h1.fontSize, | ||
}, | ||
"& blockquote": { | ||
marginTop: 0, | ||
marginLeft: 0, | ||
marginBottom: theme.spacing.sm, | ||
paddingLeft: theme.spacing.md, | ||
color: theme.colorScheme === "dark" ? theme.colors.dark[2] : theme.colors.gray[7], | ||
borderLeft: `4px solid ${theme.colorScheme === "dark" ? theme.colors.dark[4] : theme.colors.gray[4]}` | ||
}, | ||
"& img": { | ||
@@ -183,0 +197,0 @@ display: "block", |
@@ -1,2 +0,2 @@ | ||
import { FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, ListBulletIcon, Link1Icon, ImageIcon, TextNoneIcon, TextAlignCenterIcon, TextAlignLeftIcon, TextAlignRightIcon, VideoIcon } from '@modulz/radix-icons'; | ||
import { FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, ListBulletIcon, Link1Icon, ImageIcon, TextNoneIcon, TextAlignCenterIcon, TextAlignLeftIcon, TextAlignRightIcon, VideoIcon, QuoteIcon } from '@modulz/radix-icons'; | ||
import { OrderedList } from './icons/OrderedList.js'; | ||
@@ -112,2 +112,6 @@ import { H1 } from './icons/H1.js'; | ||
value: "sub" | ||
}, | ||
blockquote: { | ||
icon: QuoteIcon, | ||
controls: "blockquote" | ||
} | ||
@@ -114,0 +118,0 @@ }; |
@@ -13,3 +13,4 @@ const CLEANUP = [ | ||
"header", | ||
"script" | ||
"script", | ||
"blockquote" | ||
]; | ||
@@ -16,0 +17,0 @@ function replaceIcons(quillIconsModule) { |
@@ -104,4 +104,8 @@ /// <reference types="react" /> | ||
}; | ||
readonly blockquote: { | ||
readonly icon: ({ color, ...props }: import("@modulz/radix-icons/dist/types").IconProps) => JSX.Element; | ||
readonly controls: "blockquote"; | ||
}; | ||
}; | ||
export declare type ToolbarControl = keyof typeof CONTROLS; | ||
//# sourceMappingURL=controls.d.ts.map |
@@ -1,2 +0,1 @@ | ||
import { Quill } from 'react-quill'; | ||
interface Options { | ||
@@ -6,7 +5,7 @@ upload(file: File): Promise<string>; | ||
export declare class ImageUploader { | ||
quill: Quill; | ||
quill: any; | ||
options: Options; | ||
range: any; | ||
fileHolder: HTMLInputElement; | ||
constructor(quill: Quill, options: Options); | ||
constructor(quill: any, options: Options); | ||
selectLocalImage(): void; | ||
@@ -13,0 +12,0 @@ handleDrop(event: any): void; |
{ | ||
"name": "@mantine/rte", | ||
"description": "Rich text editor built with Mantine components", | ||
"version": "2.5.0-alpha.5", | ||
"version": "2.5.0", | ||
"main": "cjs/index.js", | ||
@@ -18,4 +18,4 @@ "module": "esm/index.js", | ||
"peerDependencies": { | ||
"@mantine/core": "2.5.0-alpha.5", | ||
"@mantine/hooks": "2.5.0-alpha.5", | ||
"@mantine/core": "2.5.0", | ||
"@mantine/hooks": "2.5.0", | ||
"react": ">=16.8.0", | ||
@@ -28,5 +28,5 @@ "react-dom": ">=16.8.0" | ||
"react-jss": "^10.7.1", | ||
"react-quill": "^1.3.5" | ||
"react-quill": "2.0.0-beta.4" | ||
}, | ||
"devDependencies": {} | ||
} |
# Mantine Rich Text Editor | ||
@mantine/rte is a rich text editor based on [Quill.js](https://quilljs.com/). | ||
[Read documentation on Mantine website](https://mantine.dev/others/rte/) | ||
![Demo](https://raw.githubusercontent.com/mantinedev/mantine/next-minor/.demo/rich-text-editor.png) | ||
## Installation | ||
Package depends on [react](https://www.npmjs.com/package/react), [react-dom](https://www.npmjs.com/package/react-dom), [@mantine/hooks](https://www.npmjs.com/package/@mantine/hooks), [@mantine/core](https://www.npmjs.com/package/@mantine/core). | ||
Install with npm: | ||
```sh | ||
npm install @mantine/rte @mantine/core @mantine/hooks | ||
``` | ||
Install with yarn: | ||
```sh | ||
yarn add @mantine/rte @mantine/core @mantine/hooks | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2
24
8
2238125
3943
+ Added@mantine/core@2.5.0(transitive)
+ Added@mantine/hooks@2.5.0(transitive)
+ Addedreact-dom@17.0.2(transitive)
+ Addedreact-quill@2.0.0-beta.4(transitive)
+ Addedscheduler@0.20.2(transitive)
- Removed@mantine/core@2.5.0-alpha.5(transitive)
- Removed@mantine/hooks@2.5.0-alpha.5(transitive)
- Removedcreate-react-class@15.7.0(transitive)
- Removedreact@16.14.0(transitive)
- Removedreact-dom-factories@1.0.2(transitive)
- Removedreact-quill@1.3.5(transitive)
Updatedreact-quill@2.0.0-beta.4