Giter Site home page Giter Site logo

Comments (13)

margox avatar margox commented on May 18, 2024

有这个属性,不过暂时还没暴露出来,现在可以用下面的办法实现:

this.editorInstance.setEditorProp('disabled', true)

下一版本我把disabled属性暴露出来

from braft-editor.

margox avatar margox commented on May 18, 2024

另外,设置这个属性之后,控制按钮还是可用的,试试通过CSS隐藏控制栏吧。。。下一版本这一块需要统一处理一下了。。。。

from braft-editor.

ChinaBigPan avatar ChinaBigPan commented on May 18, 2024

谢谢了

from braft-editor.

ChinaBigPan avatar ChinaBigPan commented on May 18, 2024

本来想试试把所有的change事件都return false的

from braft-editor.

margox avatar margox commented on May 18, 2024

一个最简单的办法是你给编辑器容器设置CSS属性 pointer-events: none;

from braft-editor.

ChinaBigPan avatar ChinaBigPan commented on May 18, 2024

您好,您提供的方法不管用 this.refs.braftEditor.setEditorProp('disabled', true)

from braft-editor.

margox avatar margox commented on May 18, 2024

尴尬,记错了,是readOnly:

this.editorInstance.setEditorProp('readOnly', true)

from braft-editor.

ChinaBigPan avatar ChinaBigPan commented on May 18, 2024

还是不管用额。。。是我的版本问题么 我是1.1.14

from braft-editor.

margox avatar margox commented on May 18, 2024

脚本有报错么?看一下this.refs.braftEditor有没有setEditorProp这个方法

from braft-editor.

ChinaBigPan avatar ChinaBigPan commented on May 18, 2024

有是有,不过居然是 Cannot read property 'setEditorProp' of undefined....我的富文本编辑器明明已经渲染了。
难道要写到componentDidMount里?

from braft-editor.

margox avatar margox commented on May 18, 2024

恩,可能是时机问题,你也可以试试上面说的CSS属性 pointer-events: none;

<div className="editor-wrapper disabled"><BraftEditor /></div>
.editor-wrapper.disabled{
  opacity: .7;
  pointer-events: none;
}

这个也能有效,虽然不是那么严格。我明天发一个版本支持直接diasble吧

from braft-editor.

ChinaBigPan avatar ChinaBigPan commented on May 18, 2024

我试试吧 上方的小按钮 我直接传空数组了,这个我先用着,等明天的支持版,谢谢了

from braft-editor.

margox avatar margox commented on May 18, 2024

@ChinaBigPan 1.3.1已发布,新增了disabled属性,可以试试吼

from braft-editor.

Related Issues (20)

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.