npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-tinymce

v0.1.2

Published

HTML WYSIWYG for React Native, in pure JS. (Works in Expo apps!)

Downloads

58

Readme

react-native-tinymce

HTML WYSIWYG for React Native, in pure JS. (Works in Expo apps!)

Combine the power of TinyMCE with the usability of native UI.

Demo

A demo of the editor is included in this repo. You can run this in the iOS Simulator or on your native device using Expo in minutes.

# Clone down this repo.
git clone https://github.com/rmccue/react-native-tinymce.git
cd react-native-tinymce

# Install dependencies.
npm install

# Build the app using Expo.
npm start

Once the app has started, follow the instructions in the build tool to run in the simulator or on-device.

Usage

import React from 'react';
import { Editor, Provider, Tools } from 'react-native-tinymce';

const MyEditor = props => (
	<Provider>
		<Editor
			ref={ ref => this.editor = ref }
			value="<p>Hello world!</p>"
		/>

		<Tools />
	</Provider>
)

Place the Editor component wherever you want the main WYSIWYG editor view.

The Tools component must be placed in the view-root of the current screen, as it uses absolute positioning to attach to the keyboard.

The Provider must be a common ancestor to both the Editor and the Tools components; typically as a wrapper around your SafeAreaView or similar root.

Props

Pass the initial HTML content as the value prop to Editor.

To retrieve the content from the editor, call the getContent() method on the Editor instance. This returns a promise which will resolve to the HTML string.

Avoid changing the value prop too often, as it causes TinyMCE to re-parse and re-render the value unnecessarily.

Architecture

The main component is the Editor component. This renders a TinyMCE-based WYSIWYG into a webview, and sets up the interactions with it.

The Provider component contains the bulk of the logic for the editor, and it tracks state and actions. These are provided to the Editor and Tools components via context.

When focussed on the WYSIWYG, the Tools component renders the toolbar as a keyboard accessory view.

The toolbar can be overridden via the children render prop, and by default renders the included Toolbar component. Override this prop to add additional buttons as needed.

When the user presses the format button, the toolbar and keyboard are hidden, and the formatter pane is shown. This pane interacts with TinyMCE's underlying formatting utilities.

Icons

By default, react-native-tinymce uses a set of fallback icons.

To use native iOS icons, load in SF Symbols as a font using expo-font, with the name sfsymbols.

Credits

Copyright 2019 Ryan McCue

Licensed under the MIT license.