Giter VIP home page Giter VIP logo

nextlint's Introduction

Nextlint

Nextlint is a WYSIWYG (What You See Is What You Get) editor built using the "@tiptap" library and developed with Svelte. It provides a user-friendly interface for editing and formatting text, allowing users to create rich content effortlessly.

  • ๐Ÿ’ป Easy-to-use: The editor provides a simple and intuitive interface, making it easy for users to create and edit content without any technical knowledge.
  • โœ๏ธ Rich Text Editing: Users can format text using various styles such as bold, italic, underline, headings, lists, and more.
  • ๐Ÿงฑ Extensible: You can extend the editor's functionality by adding or creating custom extensions, allowing you to integrate additional features or customize the behavior of the editor.
  • ๐Ÿง  Integrate openAI,GPT functionality: Unlocking the Power of Creative and Swift Writing with OpenAI and GPT Support.

Features

Bubble Menu

Bubble Menu

Slash Menu

Slash Menu

Image

Support upload/embed/unsplash api

Image

GPT prompt

GPT prompt

... and many more.

Demo:

https://nextlint-editor.vercel.app/

You can find the implementation of the demo in the repostiory at: https://github.com/sveltor/nextlint/blob/main/packages/svelte/src/routes/%2Bpage.svelte

Quick start

Install the package:

//npm
npm install @nextlint/svelte

//yarn
yarn add @nextlint/svelte

//pnmp
npm add @nextlint/svelte

Setup

<script lang="ts">
  import {type Editor, EditorTheme, SvelteEditor} from '@nextlint/svelte';

  let editor: Editor;

  const submitPromt = async (prompt: string) => {
    // handle prompt for GPT plugin
    return '';
  };

  const handleUpload = async (file: File) => {
    // handle upload here
    const blob = new Blob([file]);
    const previewUrl = URL.createObjectURL(blob);
    return previewUrl;
  };

</script>

<EditorTheme>
  <SvelteEditor
    content={''}
    placeholder="Press 'space' GPT support, type '/' for help"
    onCreated={createdEditor => { editor = createdEditor }}
    onChange={nextEditor => { editor = nextEditor }}

    <!-- plugins config -->
    plugins={{
      selectImage: {
        handleUpload,
        unsplash: {
          accessKey: 'UNPLASH_API_KEY'
        }
      },
      gpt: {query: submitPromt}
    }}

  />
</EditorTheme>

Customize EditorTheme

Nextlint use svelteui to implement node view and editor components so we recommend using SvelteUI to implement a custom node view for a more consistent user interface. Default editor tokens.

:root {
      '--editor-font': "'Literata', serif",
      '--editor-font-heading': "'Bitter', serif",
      '--editor-font-code': "'Fira Code', monospace",
      '--editor-font-size': '1.1rem',
      '--editor-font-height': '1.7rem',
      '--editor-block-gap': '16px'
}

You can customize your content style by overriding the EditorTheme style via override props. The implementation can be found at.EditorTheme.svelte Default editor tokens

Override Editor Font

    <EditorTheme
      override={{
        '--editor-font': "'Roboto'",
        '--editor-font-size': '15px',
        '--editor-font-height': '22px',
        '--editor-block-gap': '8px',
      }}
    >
     <Editor/>
  </EditorTheme>

Override Editor Style

    <EditorTheme
      override={{
        '& .ProseMirror': {
           // customize blockquote
          '& blockquote':{
              backgroundColor:'teal',
              boxShadow:'...'
          },
           // customize block code
          '& pre':{
              backgroundColor:'#000',
              fontFamily:'FiraCode'
          }
        }
      }}
    >
     <Editor/>
  </EditorTheme>

Contributing

Please follow the contribute guideline

License

The MIT License (MIT). Please see License File for more information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.