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-highlight-editor

v0.0.7

Published

React 환경에서 컴포넌트로 제어 가능한 editable container 입니다. 여러 하이라이트를 손쉽게 제어할 수 있습니다.

Downloads

332

Readme

React Highlight Editor

설명

content-editable 속성을 이용하여 간단하게 만든 만든 에디터입니다. 태그나 멘션과 같은 텍스트를 에디터 내에 추가 가능하며, 리액트 환경에 맞게 객체로 손쉽게 커스텀 가능합니다.

사용법

기본 사용법

미리 정의해둔 base tag로 스타일링 됩니다.

import {
  ReactHighlightEditor,
  useReactHighlightEditor,
} from 'react-highlight-editor';



const Component = () => {
  const useTagEditorBoxMethod = useReactHighlightEditor({});
  const { addHighlightSpan } = useTagEditorBoxMethod;

  return (
    <>
        <Button
            onClick={() => {addHighlightSpan({ text: '추가할 텍스트'})}}
        >
            아이템 추가
        </Button>
        <ReactHighlightEditor {...useTagEditorBoxMethod} />
    <>
  )
}

하이라이트 커스텀

미리 정의해둔 base tag로 스타일링 됩니다.

import {
  ReactHighlightEditor,
  useReactHighlightEditor,
} from 'react-highlight-editor';



const Component = () => {
  const useTagEditorBoxMethod = useReactHighlightEditor({
    highlightStyleProps: {
      second: {
        background: 'red',
      },

      other: {
        background: 'blues',
      },
    },
  });
  const { addHighlightSpan } = useTagEditorBoxMethod;

  return (
    <>
        <Button
            onClick={() => {addHighlightSpan({ text: '빨간바탕', spanProperty: 'second' })}}
        >
            second 추가
        </Button>

        <Button
            onClick={() => {addHighlightSpan({ text: '파란바탕', spanProperty: 'other' })}}
        >
            other 추가
        </Button>

        <ReactHighlightEditor {...useTagEditorBoxMethod} />
    <>
  )
}

이 외에도 spanProperty 를 이용하여 생성할 span 태그에 직접 값을 할당 가능합니다. readonly 및 이미 사용되는 값들은 지원하지 않습니다.