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

@norlandsoft/tide

v0.0.6

Published

## 介绍

Downloads

6

Readme

@norlandsoft/tide

介绍

本包提供了 React 易于使用的编辑器组件。

安装

如果你不希望启用代码块的语法高亮功能,可以不安装 highlight.js

npm install --save @norlandsoft/tide @norlandsoft/tide-starter-kit highlight.js
# or
yarn add @norlandsoft/tide @norlandsoft/tide-starter-kit highlight.js
# or
pnpm add @norlandsoft/tide @norlandsoft/tide-starter-kit highlight.js

使用

import React, { useState } from 'react';
import { EditorRender, useEditor } from '@norlandsoft/tide';
import { StarterKit } from '@norlandsoft/tide-starter-kit';

import '@norlandsoft/tide/dist/style.css';
import 'highlight.js/styles/default.css';

function App() {
  const editor = useEditor({
    extensions: [StarterKit],
    content: '# Hello World!',
    onChange: (doc) => console.log('onChange', doc),
  });

  // Update editor content
  // editor.setContent('Changed content');

  return <EditorRender editor={editor} />;
}

如需自定义样式,可参考 @norlandsoft/tide-theme/dist/variable.less 中的 CSS Variables 进行覆盖。

配置

useEditor Options

| 配置 | 说明 | 类型 | 默认值 | | -------------------- | ------------------------ | -------------------------------------------------------- | ------- | | content | 内容 | HTMLContent \| JSONContent \| JSONContent[] \| null | - | | autofocus | 是否自动聚焦 | 'start' \| 'end' \| 'all' \| number \| boolean \| null | false | | editable | 是否允许编辑 | boolean | true | | fullscreen | 是否全屏模式 | boolean | false | | readOnlyEmptyView | 只读模式下无内容时的视图 | ReactNode | null | | readOnlyShowMenu | 只读模式下是否显示菜单栏 | boolean | false | | menuEnableUndoRedo | 菜单栏是否启用撤销重做 | boolean | true | | menuEnableFullscreen | 菜单栏是否启用全屏 | boolean | true | | onFullscreenChange | 全屏状态变更时的回调函数 | (fullscreen: boolean) => void | - | | onReady | 初始化完成后的回调函数 | (editor: TideEditor) => void | - | | onChange | 内容变更时的回调函数 | (doc: JSONContent, editor: TideEditor) => void | - |

更多配置可参考 TideEditorOptions 接口定义。

EditorRenderProps

| 属性 | 说明 | 类型 | 默认值 | | ---------------- | ------------------------ | --------------- | ------ | | className | 容器自定义 className | string | - | | style | 容器自定义 style | CSSProperties | - | | menuClassName | 菜单栏自定义 className | string | - | | menuStyle | 菜单栏自定义 style | CSSProperties | - | | contentClassName | 内容区自定义 className | string | - | | contentStyle | 内容区自定义 style | CSSProperties | - |