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 🙏

© 2025 – Pkg Stats / Ryan Hefner

lexical-rich-editor

v0.0.4

Published

Bu proje, Lexical playground'ından türetilmiş yeniden kullanılabilir bir editör komponenti sağlar.

Readme

Reusable Lexical Editor

Bu proje, Lexical playground'ından türetilmiş yeniden kullanılabilir bir editör komponenti sağlar.

Özellikler

  • ✅ Value prop'u ile kontrol edilebilir
  • ✅ onChange callback'i ile değişiklikleri yakalayabilir
  • ✅ Placeholder desteği
  • ✅ Disabled/readonly mod
  • ✅ Tüm Lexical playground özelliklerine sahip
  • ✅ TypeScript desteği
  • ✅ ESM modül formatı

Kurulum

npm install lexical-rich-editor
# veya
yarn add lexical-rich-editor

Kullanım

Temel Kullanım

import React, {useState} from 'react';
import {ReusableLexicalEditor} from 'lexical-rich-editor';

function MyApp() {
  const [content, setContent] = useState('İlk metin içeriği');

  const handleContentChange = (value, editorState, editor) => {
    console.log('Editor içeriği değişti:', value);
    setContent(value);
  };

  return (
    <div>
      <h1>Lexical Editor Örneği</h1>
      <ReusableLexicalEditor
        value={content}
        onChange={handleContentChange}
        placeholder="Metninizi buraya yazın..."
      />

      <div style={{marginTop: 20, padding: 10, background: '#f5f5f5'}}>
        <h3>Güncel İçerik:</h3>
        <pre>{content}</pre>
      </div>
    </div>
  );
}

export default MyApp;

Gelişmiş Kullanım

import React, {useState} from 'react';
import {ReusableLexicalEditor} from 'lexical-rich-editor';
import type {ReusableLexicalEditorProps} from 'lexical-rich-editor';

function AdvancedEditor() {
  const [content, setContent] = useState('');
  const [isReadonly, setIsReadonly] = useState(false);

  const editorProps: ReusableLexicalEditorProps = {
    value: content,
    onChange: (value, editorState, editor) => {
      setContent(value);

      // Editor state ile ileri düzey işlemler yapabilirsiniz
      console.log('Editor State:', editorState);
      console.log('Editor Instance:', editor);
    },
    placeholder: isReadonly
      ? 'Bu editör sadece okunabilir'
      : 'Yazı yazmaya başlayın...',
    disabled: isReadonly,
    className: 'my-custom-editor',
    style: {
      border: '2px solid #ddd',
      borderRadius: '8px',
      minHeight: '200px',
    },
  };

  return (
    <div>
      <div style={{marginBottom: 16}}>
        <label>
          <input
            type="checkbox"
            checked={isReadonly}
            onChange={(e) => setIsReadonly(e.target.checked)}
          />
          Sadece Okunabilir Mod
        </label>
      </div>

      <ReusableLexicalEditor {...editorProps} />

      <div style={{marginTop: 20}}>
        <h3>Karakter Sayısı: {content.length}</h3>
        <details>
          <summary>Raw İçerik</summary>
          <pre style={{background: '#f8f8f8', padding: 10}}>
            {JSON.stringify(content, null, 2)}
          </pre>
        </details>
      </div>
    </div>
  );
}

export default AdvancedEditor;

API Referansı

ReusableLexicalEditor Props

| Prop | Tip | Varsayılan | Açıklama | | ------------- | --------------------------------------------------------------------------------------- | ---------------------- | -------------------------------------- | | value | string \| undefined | undefined | Editörün başlangıç değeri (plain text) | | onChange | (value: string, editorState: EditorState, editor: LexicalEditor) => void \| undefined | undefined | İçerik değiştiğinde çağrılan callback | | placeholder | string \| undefined | 'Enter some text...' | Placeholder metni | | disabled | boolean | false | Editörün düzenlenebilir olup olmadığı | | className | string \| undefined | '' | CSS sınıfı | | style | React.CSSProperties \| undefined | {} | Inline stil |

onChange Callback Parametreleri

  • value: string - Editörün güncel text içeriği
  • editorState: EditorState - Lexical EditorState objesi (ileri düzey kullanım için)
  • editor: LexicalEditor - Lexical Editor instance'ı (ileri düzey kullanım için)

CSS Sınıfları

Component otomatik olarak şu CSS sınıflarını ekler:

  • .reusable-lexical-editor - Ana container
  • .editor-shell - İç editor container'ı

Kendi stillerinizi eklemek için bu sınıfları kullanabilir veya className prop'u ile özel sınıf ekleyebilirsiniz.

Örnekler

Form Entegrasyonu

import React from 'react';
import {useForm, Controller} from 'react-hook-form';
import {ReusableLexicalEditor} from 'lexical-rich-editor';

function FormWithEditor() {
  const {control, handleSubmit, watch} = useForm({
    defaultValues: {
      title: '',
      content: '',
    },
  });

  const onSubmit = (data) => {
    console.log('Form data:', data);
  };

  return (
    <form onSubmit={handleSubmit(onSubmit)}>
      <div>
        <label>Başlık:</label>
        <Controller
          name="title"
          control={control}
          render={({field}) => <input {...field} placeholder="Başlık girin" />}
        />
      </div>

      <div>
        <label>İçerik:</label>
        <Controller
          name="content"
          control={control}
          render={({field}) => (
            <ReusableLexicalEditor
              value={field.value}
              onChange={(value) => field.onChange(value)}
              placeholder="İçerik yazın..."
            />
          )}
        />
      </div>

      <button type="submit">Gönder</button>
    </form>
  );
}

İki Editör Arasında Senkronizasyon

import React, {useState} from 'react';
import {ReusableLexicalEditor} from 'lexical-rich-editor';

function SyncedEditors() {
  const [sharedContent, setSharedContent] = useState(
    'Bu içerik iki editörde de görünür',
  );

  return (
    <div style={{display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 20}}>
      <div>
        <h3>Editör 1</h3>
        <ReusableLexicalEditor
          value={sharedContent}
          onChange={(value) => setSharedContent(value)}
          placeholder="İlk editör..."
        />
      </div>

      <div>
        <h3>Editör 2 (Senkronize)</h3>
        <ReusableLexicalEditor
          value={sharedContent}
          onChange={(value) => setSharedContent(value)}
          placeholder="İkinci editör..."
        />
      </div>
    </div>
  );
}

Teknik Detaylar

  • Framework: React 19+
  • Lexical Version: 0.37.0
  • TypeScript: Tam destek
  • Bundle Format: ESM
  • Peer Dependencies: React, ReactDOM, Lexical paketleri

Lisans

MIT - Orijinal Lexical projesi lisansını takip eder.