All Projects → wxik → React Native Rich Editor

wxik / React Native Rich Editor

Licence: mit
Lightweight React Native (JavaScript, H5) rich text editor

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Rich Editor

Ngx Quill Example
demo app for the advanced usage of ngx-quill module
Stars: ✭ 137 (-51.25%)
Mutual labels:  editor, wysiwyg
Smarteditor2
Javascript WYSIWYG HTML editor
Stars: ✭ 162 (-42.35%)
Mutual labels:  editor, wysiwyg
Cl Editor
Lightweight text editor built with svelte, typescript
Stars: ✭ 148 (-47.33%)
Mutual labels:  editor, wysiwyg
Django Tinymce4 Lite
TinyMCE 4 editor widget for Django
Stars: ✭ 121 (-56.94%)
Mutual labels:  editor, wysiwyg
Editor
A new type of WYSIWYG editor for Kirby
Stars: ✭ 209 (-25.62%)
Mutual labels:  editor, wysiwyg
Swiftlatex
SwiftLaTeX, a WYSIWYG Browser-based LaTeX Editor
Stars: ✭ 1,664 (+492.17%)
Mutual labels:  editor, wysiwyg
Pell
📝 the simplest and smallest WYSIWYG text editor for web, with no dependencies
Stars: ✭ 11,653 (+4046.98%)
Mutual labels:  editor, wysiwyg
Tiptap
The headless editor framework for web artisans.
Stars: ✭ 13,629 (+4750.18%)
Mutual labels:  editor, wysiwyg
Vditor
♏ 一款浏览器端的 Markdown 编辑器,支持所见即所得(富文本)、即时渲染(类似 Typora)和分屏预览模式。An In-browser Markdown editor, support WYSIWYG (Rich Text), Instant Rendering (Typora-like) and Split View modes.
Stars: ✭ 3,773 (+1242.7%)
Mutual labels:  editor, wysiwyg
Tui.editor
🍞📝 Markdown WYSIWYG Editor. GFM Standard + Chart & UML Extensible.
Stars: ✭ 14,016 (+4887.9%)
Mutual labels:  editor, wysiwyg
Awesome Wysiwyg
A curated list of awesome WYSIWYG editors.
Stars: ✭ 1,801 (+540.93%)
Mutual labels:  editor, wysiwyg
Medium Editor
Medium.com WYSIWYG editor clone. Uses contenteditable API to implement a rich text solution.
Stars: ✭ 15,421 (+5387.9%)
Mutual labels:  editor, wysiwyg
Tinymce
The world's #1 JavaScript library for rich text editing. Available for React, Vue and Angular
Stars: ✭ 10,179 (+3522.42%)
Mutual labels:  editor, wysiwyg
Phaser3 Particle Editor
A flexible editor for building phaser particles.
Stars: ✭ 131 (-53.38%)
Mutual labels:  editor, wysiwyg
Balsa
This repository holds source code of Balsa, a self hosted, privacy focused knowledgebase.
Stars: ✭ 93 (-66.9%)
Mutual labels:  editor, wysiwyg
Rich Markdown Editor
The open source React and Prosemirror based markdown editor that powers Outline. Want to try it out? Create an account:
Stars: ✭ 2,468 (+778.29%)
Mutual labels:  editor, wysiwyg
Wyg
A new WYSIWYG editing experience for the modern web
Stars: ✭ 73 (-74.02%)
Mutual labels:  editor, wysiwyg
Hypermd
A WYSIWYG Markdown Editor for browsers. Break the Wall between writing and previewing.
Stars: ✭ 1,258 (+347.69%)
Mutual labels:  editor, wysiwyg
Flutter Quill
Rich text editor for Flutter
Stars: ✭ 177 (-37.01%)
Mutual labels:  editor, wysiwyg
Editor.js
A block-styled editor with clean JSON output
Stars: ✭ 17,061 (+5971.53%)
Mutual labels:  editor, wysiwyg

React Native Rich Text Editor

NPM


A fully functional Rich Text Editor for both Android and iOS (macOS and windows)?

If you want to use flutter, you can check here to add flutter_rich_editor

yarn add react-native-pell-rich-editor
or
npm i react-native-pell-rich-editor

Also, follow instructions here to add the native react-native-webview dependency.

RichEditor

The editor component. Simply place this component in your view hierarchy to receive a fully functional Rich text Editor.

RichEditor takes the following optional props:

  • placeholder

    Wrap the editor content placeholder

  • initialContentHTML

    HTML that will be rendered in the content section on load.

  • initialFocus

  • Boolean value to Initial content request focus. The default value is false.

  • disabled

  • Boolean value to disable editor. The default value is false.

  • editorInitializedCallback

    A function that will be called when the editor has been initialized.

  • editorStyle

    Styling for container or for Rich Editor more dark or light settings. Object containing the following options:

    • backgroundColor: Editor background color
    • color: Editor text color
    • placeholderColor: Editor placeholder text color
    • contentCSSText: editor content css text(initial valid)
    • cssText: editor global css text(initial valid)
  • onChange Callback after editor data modification

  • onHeightChange Callback after height change

  • onMessage Callback outside postMessage internal type processing

    <img src="" onclick="_.sendEvent('ImgClick')" contenteditable="false"/>
    
  • command Execute JS in the editor

     // $ = document
     this.richText.current?.commandDOM('$.execCommand('insertHTML', false, "<br/>")');
    
  • commandDOM Manipulate the DOM in the editor

     // $ = document.querySelector
     this.richText.current?.commandDOM(`$('#title').style.color='${color}'`);
    
  • useContainer A boolean value that determines if a View container is wrapped around the WebView. The default value is true. If you are using your own View to wrap this library around, set this value to false.

  • initialHeight useContainer is false by inline view of initial height

  • pasteAsPlainText A boolean value (false as default) that determines if the clipboard paste will keep its format or it will be done as plain text

  • onPaste Callback clipboard paste value

  • onKeyUp Callback Keyup event

  • onKeyDown Callback Keydown event

  • onFocus Callback editor focus

  • onBlur Callback editor blur

RichEditor also has methods that can be used on its ref to set:

  • setContentHTML(html: string)
  • insertImage(url: string, style?: string)
  • insertLink(title: string, url: string)
  • insertText(text: string)
  • insertHTML(html: string)
  • insertVideo(url: string, style?: string)
  • setContentFocusHandler(handler: Function)
  • blurContentEditor()
  • focusContentEditor()

This method registers a function that will get called whenver the cursor position changes or a change is made to the styling of the editor at the cursor's position., The callback will be called with an array of actions that are active at the cusor position, allowing a toolbar to respond to changes.

  • registerToolbar(listener: Function)

Example Usage:

<RichEditor
  ref={(r) => this.richtext = r}
  initialContentHTML={'Hello <b>World</b> <p>this is a new paragraph</p> <p>this is another new paragraph</p>'}
  editorInitializedCallback={() => this.onEditorInitialized()}
/>

RichToolbar

This is a Component that provides a toolbar for easily controlling an editor. It is designed to be used together with a RichEditor component.

The RichToolbar has one required property:

  • getEditor()

Which must provide a function that returns a ref to a RichEditor component.

This is because the ref is not created until after the first render, before which the toolbar is rendered. This means that any ref passed directly will inevitably be passed as undefined.

Other props supported by the RichToolbar component are:

  • actions

    An array of actions to be provided by this toolbar. The default actions are:

    • actions.insertImage
    • actions.setBold
    • actions.setItalic
    • actions.insertBulletsList
    • actions.insertOrderedList
    • actions.insertLink
    • actions.keyboard
    • actions.setStrikethrough
    • actions.setUnderline
    • actions.removeFormat
    • actions.insertVideo
    • actions.checkboxList
    • actions.undo
    • actions.redo
  • onPressAddImage Functions called when the addImage actions are tapped.

  • onInsertLink Logic for what happens when you press on the add insert link button

  • disabled

  • Boolean value to disable editor. The default value is false.

  • iconTint

  • unselectedButtonStyle

  • selectedIconTint

  • selectedButtonStyle

  • disabledIconTint

  • disabledButtonStyle

    These provide options for styling action buttons.

  • iconSize

    Defines the size of the icon in pixels. Default is 50.

  • renderAction

    Altenatively, you can provide a render function that will be used instead of the default, so you can fully control the tollbar design.

  • iconMap

    RichTextToolbar comes with default icons for the default actions it renders. To override those, or to add icons for non-default actions, provide them in a dictionary to this prop.

Example Usage:

const richText = React.createRef() || useRef();
<RichToolbar editor={that.richText}/>

With Custom Action:

To define your own custom action:

  • Send your action name as string in the actions array.
  • Include an icon for it with the iconMap
  • Add a function prop with the same action name to be called on tap
<RichToolbar
    editor={that.richText}
	actions={[
		actions.setBold,
		actions.setItalic,
		actions.insertBulletsList,
		actions.insertOrderedList,
		actions.insertImage,
		'customAction',
	]}
	iconMap={{
		customAction: customIcon,
	}}
	customAction={this.handleCustomAction}
/>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].