React-Web 편집자는 사용하기 쉽습니다. 사용자 친화적 인 설계되었습니다!
React-Web 편집자는 가볍고 단순합니다.
React-Web 편집자는 반응 친화적입니다. 자신의 구성 요소에 후크를 사용할 수 있습니다.
React-Web 편집기에는 사용자 정의 도구가 있습니다.
WebPack을 사용하여 구축되어 사용자 정의 설정으로 구성 관리 및 프로젝트 확장을 완전히 제어 할 수 있습니다.
npm - i react - web - editor import { StyleEditorBlock , TextEditorBlock , ... } from "react-web-editor;또는 아래와 같이 가져올 수 있습니다
import ReactWebEditor from "react-web-editor" ; | 버전 | 통나무 |
|---|---|
| 2.2.0 | UI 업그레이드, 고리 사용량 수정 |
| 2.1.0 | 드래그 앤 드롭 기능을 업그레이드합니다 |
| 2.0.0 | 편집 가능한 보드, 사소한 버그 업데이트를 만듭니다 |
| 1.2.0 | 옵션을 초기화하기 위해 텍스트 편집기를 업그레이드합니다 |
| 1.1.0 | "rem"과 같은 단위를 사용하려면 편집기 업그레이드 |
| ~ 1.0.5 | 헬멧을 사용하고 헬멧을 비동기로 업데이트하십시오 |
| ~ 1.0.2 | 드래그 앤 드롭 기능을 업그레이드하고 사소한 UI 버그를 해결하십시오 |
| 1.0.0 | 텍스트 편집기를 추가하십시오 |
| 0.1.6 | 업그레이드 스타일 편집기 기능 |
| ~ 0.1.5 | 다음을 해결하십시오. JS 글꼴 사라지는 버그가 사라집니다 |
이 구성 요소는 사용자 친화적으로 설계되었습니다. 소품 이상을 사용하여 구성 요소를 쉽게 제어합니다.
스타일 편집기 구성 요소 (SEC)는 구성 요소의 크기와 위치를 변경할 수있는 블록 구성 요소입니다. SEC의 또 다른 강력한 사용법은 화면에 이미지를 업로드하거나 구성 요소의 배경색을 변경하는 것입니다. 구성 요소를 SEC로 감고 구성 요소 '절대'위치를 설정함으로써 컴포넌트는 웹 사이트에서 편집 가능하게됩니다. 이 구성 요소는 자신의 구성 요소 없이도 사용할 수 있습니다.
구성 요소의 커서를 호버 할 때 화면에 두 개의 탭이 나타납니다. 첫 번째 탭은 업로드 이미지 탭으로 이미지를 추가하는 데 도움이됩니다. 두 번째 탭은 컬러 핸들러입니다. 구성 요소의 배경색을 변경합니다.
type StyledEditorBlockProps {
width: number ;
height: number ;
top: number ;
left: number ;
parentStyle ?: ParentStyle ; // It defines area where component can't escape. If you don't define it, then your component can move in all screen.
unit: string ;
initialColor ?: string ; // default: transparent
initialImage ?: string ; // default: none
}
type ParentStyle {
width: number ;
height: number ;
} import { StyleEditorBlock } from "react-web-editor"
...
return (
< StyleEditorBlock
width = { 200 }
height = { 300 }
left = { left }
top = { top }
parentStyle = { { width : 600 , height : 800 } }
unit = { "px" }
>
< YourOwnComponent color = { color } /> // It is just a option.
</ StyleEditorBlock >
) ; type TextEditorBlockProps {
width: number ;
height: number ;
top: number ;
left: number ;
parentStyle ?: ParentStyle ; // It defines area where component can't escape. If you don't define it, then your component can move in all screen.
unit: string ;
// Initial- props are options just for first rendering.
initialFontSize ?: number ; // default: 0.22
initialFontColor ?: string ; // default: "black"
initialFontStyle ?: InitialFontStyle ; // default: ""
initialText ?: string ; // default: ""
initialFontName ?: string ; // default: ""
}
type ParentStyle {
width: number ;
height: number ;
}
type InitialFontStyle = "twin-color-text" | "box-text" | "down-side-text" | "out-line-text" | "bubble-shadow-text" ;
type InitialFontName = "andada-pro" | "bebas-nenu" | "montecarlo" | "roboto" | "stix-two-text" | "style-script" ; import { TextEditorBlock } from "react-web-editor"
...
return (
< TextEditorBlock
width = { 200 }
height = { 300 }
left = { left }
top = { top }
parentStyle = { { width : 600 , height : 800 } }
unit = { "px" }
/>
) ; type DragAndDropTableProps {
color ?: string ;
isVertical: boolean ;
} import { DragAndDropTable } from "react-web-editor"
...
return (
< DragAndDropTable
color = { "pink" }
isVertical = { true }
>
< YourOwnComponent src = { cat } />
< YourOwnComponent src = { flower } />
< YourOwnComponent src = { bee } />
// These components can drag and drop in the DragAndDropTable component.
</ DragAndDropTable >
) ; type useDraggableProps {
left: number ;
top: number ;
width: number ;
height: number ;
dragBoardOption ?: DragBoardOption ;
unit: string ;
onDrag: Dispatcher < ComponentStyle > ; // It is a setState. Its state is Componentstyle.
}
type Dispatcher < S > = React . Dispatch < React . SetStateAction < S >> ;
type ComponentStyle {
left : number ;
top: number ;
width: number ;
height: number ;
}
type DragBoardOption {
width: number ;
height: number ;
}
// It's like a parentStyle. import { useState } from "react" ;
import { useDraggable } from "react-web-editor" ;
const [ componentStyle , setComponentStyle ] = useState ( {
width : 20 ,
height : 40 ,
top : 40 ,
left : 40 ,
} ) ;
// this state can be used for your own component.
const {
handleDragEnd , // onMouseUp handler
handleDragStart , // onMouseDown handler
} = useDraggable ( {
... componentStyle ,
onDrag : setComponentStyle ,
unit : "px" ,
} ) ;| 반품 | 용법 |
|---|---|
| HandledRagStart | Onmousedown 핸들러 |
| HandledRagend | Onmouseup handler |
이 구성 요소는 DraggableHandler 및 EditorBlockWrapper와 함께 사용할 수 있습니다.
크기 조정 핸들러를 반환합니다. 크기를 조정하는 도우미 구성 요소 인 "ResizeHandlerWrapper"와 함께 사용할 수 있습니다.
type useResizeProps {
left: number ;
top: number ;
width: number ;
height: number ;
resizeBoardOption ?: ResizeBoardOption ;
unit: string ;
onResize: Dispatcher < ComponentStyle > ; // It is a setState. Its state is Componentstyle.
}
type Dispatcher < S > = React . Dispatch < React . SetStateAction < S >> ;
type ComponentStyle {
left : number ;
top: number ;
width: number ;
height: number ;
}
type ResizeBoardOption {
width: number ;
height: number ;
}
// It's like a parentStyle. import { useState } from "react" ;
import { useResize , ResizeHandlerWrapper } from "react-web-editor" ;
const [ componentStyle , setComponentStyle ] = useState ( {
width : 20 ,
height : 40 ,
top : 40 ,
left : 40 ,
} ) ;
const { handleMouseDown } = useDraggable ( {
... componentStyle ,
onResize : setComponentStyle ,
unit : "px" ,
} ) ;| 반품 | 용법 |
|---|---|
| 손잡이 | Onmousedown 핸들러 |
이 구성 요소는 ResizeHandlerWrapper 및 EditorBlockWrapper와 함께 사용할 수 있습니다.
UseImage 후크는 화면에 이미지를 업로드하고 표시하는 데 도움이됩니다.
type UseImageProps {
initialImage ?: string ;
} import { useImage } from "react-web-editor" ;
...
const { imageSrc , handleImageChange } = useImage ( { initialImage } ) ;| 반품 | 용법 |
|---|---|
| imagesrc | 끈 |
| handleFileChange | 입력의 onchangehandler |
Usecolor Hook는 색상 변경 처리기를 반환합니다.
type UseColorProps {
initialColor ?: string ;
} import { useColor } from "react-web-editor" ;
...
const { color , handleColorChange } = useColor ( { initialColor } ) ;| 반품 | 용법 |
|---|---|
| 색상 | 끈 |
| HandleColorChange | 입력의 onchangehandler |
이 구성 요소는 자신의 구성 요소를 사용자 정의하고 생성하는 데 도움이됩니다. 이 기능을 사용하여 자신의 라이브러리를 만들 수 있습니다. 후크 및 편집기 구성 요소를 쉽게 처리 할 수 있습니다.
type EditableBoardProps {
width: number ;
height: number ;
backgroundColor: string ;
left ?: number ;
top ?: number ;
unit: string ;
} import { EditableBoard , StyleEditorBlock } from "react-web-editor"
...
const boardWidth = 500 ;
const boardHeight = 500 ;
const boardStyleUnit = "px" ;
return (
< EditableBoard
width = { boardWidth }
height = { boardHeight }
backgroundColor = { boardStyleUnit }
color = { "pink" }
left = { 20 }
top = { 20 }
>
< StyleEditorBlock
. . .
parentStyle = { {
width : boardWidth ,
height : boardHeight ,
} }
unit = { "px" }
/>
</ EditableBoard >
) ;편집기 블록 래퍼는 스타일 구성 요소입니다. 구성 요소의 크기와 위치는 소품으로 수신됩니다. 이 소품으로 스타일을 동적으로 변경합니다. useresize 및 usedRaggable과 함께 사용할 수 있습니다
type EditorBlockWrapperProps {
width: number ;
height: number ;
left: number ;
top: number ;
} import { useState } from "react" ;
import { EditorBlockWrapper , useDraggable } from "react-web-editor" ;
const [ componentStyle , setComponentStyle ] = useState ( {
width : 20 ,
height : 40 ,
top : 40 ,
left : 40 ,
} ) ;
// this state can be used for your own component.
const {
handleDragEnd , // onMouseUp handler
handleDragStart , // onMouseDown handler
} = useDraggable ( {
... componentStyle ,
onDrag : setComponentStyle ,
unit : "px" ,
} ) ;
return (
< EditorBlockWrapper
width = { componentStyle . width }
height = { componentStyle . height }
top = { componentStyle . top }
left = { componentStyle . left }
onMouseDown = { handleDragStart }
onMouseUp = { handleDragEnd }
>
< YourOwnComponent style = { { position : "absolute" } } >
</ EditorBlcokWrapper > // Now, This component dynamically change location.
);이 구성 요소는 Usesize Hook에 특화되어 있습니다. 구성 요소의 네 방향으로 정점을 생성합니다.
import { useState } from "react" ;
import { EditorBlockWrapper , ResizeHandlerWrapper , useResize } from "react-web-editor" ;
const [ componentStyle , setComponentStyle ] = useState ( {
width : 20 ,
height : 40 ,
top : 40 ,
left : 40 ,
} ) ;
// this state can be used for your own component.
const { handleMouseDown } = useDraggable ( {
... componentStyle ,
onResize : setComponentStyle ,
unit : "px" ,
} ) ;
return (
< EditorBlockWrapper
width = { componentStyle . width }
height = { componentStyle . height }
top = { componentStyle . top }
left = { componentStyle . left }
>
< ResizeHandlersWrapper >
{ DIRECTIIONS . map ( ( item ) => (
< div key = { item } className = { item } onMouseDown = { handleMouseDown } />
) ) }
</ ResizeHandlersWrapper >
</ EditorBlcokWrapper > // Now, This component can change size.
) ;