Git Product home page Git Product logo

react-markdown-editor-lite's Issues

新增一个getNavigation获取h[1-6]标题,生成标题目录

可不可以新增一个getNavigation获取h[1-6]标题,生成标题目录,点击目录滚动到指定标题下,
image类似这种,这个是我看到别人的vue,但是我比较喜欢你的简洁,但是我是个后端人员,改不来您的代码,😂,谢谢

Support ref on Editor

I'm using unform for form management and trying to create a custom input for MdEditor. This seems to require a ref to the underlying input/textarea but I don't see a way to pass this through to to the editor (example using simple code editor w/ unform shows what I'm trying to do: unform react simple code editor example .

Configuring Theme

I'm using Material-UI on my project where I have configured a dark theme using Material UIs ThemeProvider.

When my theme is on darkmode this editor doesn't change to dark, it just remains white.

Is this editor configurable with themes or even override the css themes.

Thanks.

onImageUpload执行后的回调函数能单独提供吗?

onImageUpload={(file, callback) => void}

依照现在的做法,向callback传入url可以插入图片。

如果callback这个参数所使用的函数能单独提供出来的话,就能满足图片添加功能的二次开发,例如
做一个弹窗,能选择输入url链接或者上传图片。

同类比,工具栏上其他的功能是否也能单独提供这样的callback?
或者统一成一个方法,实现不同内容的插入?

textarea ignores 'y' and 'z'

With the upgrade from minor version 0.5.1. to 0.6.0, I've noticed that I can no longer type the characters 'y' and 'z' into the text area. Downgrading to 0.5.1 returns that functionality.

name is now a required property

I just upgraded this library to the latest version and now I got one error which is that name is now a required property of the MdEditor component.

I would like to know why the changes? Why is it required? And most importantly how does it affect my app?

Thank you, and thank you for this library.

Is there an example to use focus() to set focus on editor?

When I add a ref to the component, I see there is nodeMdText.current, but it always seems to be null.

I am adding ref like this...
ref={node => (this.mdEditor = node || undefined)}

...and then trying...
this.mdEditor.nodeMdText.current.focus();

only editor

有没有可能 只打开编辑器 不展示preview 也不让用户点击 ?想自定义 preview 发现就算设置了

view: { menu: true, md: true, html: false }

依然没办法保证只展示 eidtor

Image and table plugin configuration doesn't work

The configuration docs mentions the following editor configuration attributes: config.imageAccept, config.table.maxRow, config.table.maxCol, but currently none is respected (e.g. the official demo renders table plugin 6x6, even though the default configuration says 4x6).

The problem is that these plugins call getConfig:

accept={this.getConfig('imageAccept', '')}

maxRow={this.getConfig('maxRow', 6)}
maxCol={this.getConfig('maxCol', 6)}

But the getConfig function looks up the options in the plugin configuration, not the editor configuration:

protected getConfig(key: string, defaultValue?: any) {
return this.props.config && typeof this.props.config[key] !== 'undefined' && this.props.config[key] !== null
? this.props.config[key]
: defaultValue;
}

Either the plugins should use the global configuration, or the global configuration options should be removed in favor of plugin specific configuration (in that case it would be great to have an example of how to configure the built-in plugins).

Can't get the markdown

I'm trying to get the Markdown from the handleEditorChange as described in your first example but getting just undefined (whereas html is fine)...

handleEditorChange ({html, md}) {    
    console.log('handleEditorChange', html, md)
}

Any idea?

thanks in advance

_getDecoratedText报错

线上环境:user: zlx,pass: 123,当编辑器内无内容的时候,点击toolbar插入任何内容,都会报这个错:
image,我自己试了下,应该是mdEditor.js中value默认值的问题

  componentWillReceiveProps(nextProps) {
    if (nextProps.value === this.props.value) {
      return
    }   
    // let {value} = nextProps   //  value为undefined时,报错
    let {value = ''} = nextProps  // value给默认值,即可解决
    const {text} = this.state
    value = value && value.replace(//g, '\n')    
    this.setState({
      text: value,
      html: this.renderHTML(value)
    })
  }

如果可以,烦请修复一下。

版本计划

  • 重构工具栏部分,支持插拔,支持插件
  • 重构预览部分,并将预览按钮移动至工具栏
  • 改进渲染功能,支持诸如react-markdown这类将markdown渲染为ReactNode的渲染引擎
  • 功能:支持直接粘贴图片、图片拖拽
  • 功能:支持更多API,供插件使用

Remove display both editor and preview

I'm trying to hide the both preview and editor side-by-side view mode so I can have either full-view preview or full-view editor.
I don't see this option in the canView

Navigator not available when using SSR

My application renders react components in both server and client (SSR), and I'm transpiling my server as well as client code with Webpack.
I run into some problems compiling this package at the server because navigator is not available in NodeJS environment.

Is it possible to add an extra check on existence of the navigator variable, in order to avoid this compilation problem?
Thanks.

Typing errors - TS2314 and TS2694

After adding react-markdown-editor-lite through npm install I get two typing errors in /lib/index.d.ts
TS2694 (TS) Namespace 'React' has no exported member 'HTMLAttributes'. and TS2314 (TS) Generic type 'Promise<T>' requires 1 type argument(s)..

React versions:

  • react: 16.9.0
  • @types/react: 16.9.11

How to fix this errors?

Error: Cannot find module 'markdown-it'

My code is almost same like the example.

import React from 'react';
import MarkdownIt from 'markdown-it'
import MdEditor from 'react-markdown-editor-lite'
// import style manually
import 'react-markdown-editor-lite/lib/index.css';

const CreatePost = () => {
    const mdParser = new MarkdownIt(/* Markdown-it options */);

    const handleEditorChange = ({ html, text }) => {
        console.log('handleEditorChange', html, text)
    }
    return (
        <div>
            <MdEditor
                value=""
                renderHTML={(text) => mdParser.render(text)}
                onChange={handleEditorChange}
            />
        </div>
    );
}

export default CreatePost;

Image alt text issue

You are adding alt text to img tag which is selected on editor. It should be the name of image which is uploading. Can I get it fixed as soon as possible?

How to use getHtmlValue in react hooks

const handleGetHtmlValue = () => {    
    alert(MdEditor.getHtmlValue())
  }

<MdEditor **_ref={node => this.mdEditor = node}_** value={MOCK_DATA} style={{height: '400px'}} renderHTML={this.renderHTML} config={{ view: { menu: true, md: true, html: true, fullScreen: true }, imageUrl: 'https://octodex.github.com/images/minion.png' }} onChange={this.handleEditorChange} onImageUpload={this.handleImageUpload} // onCustomImageUpload={this.onCustomImageUpload} // if using onCustomImageUpload, onImageUpload will be not working onBeforeClear={this.onBeforeClear} />
showing error

Disable/hide full screen option

Is there a way to disable/hide full screen option from top menu? I went through the config options but couldn't find one.
image

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.