margox / braft-extensions Goto Github PK
View Code? Open in Web Editor NEWBraft Editor扩展模块包
Braft Editor扩展模块包
公司在开发一款编辑器,一定要用draft.js.,,,,,看到你这边已经支持了表格功能了...不过好像看不到例子
Hi, thanks for your great work, I have a problem with extension of code-highlighter. when I insert my code from my IDE(vscode) by copy (control
/command
+ C
),and the theme of my IDE was preserved in the codeblock of braft-editor.
here is, the theme of code is my IDE's theme, and the code style will be preserved in the html string, when I call this.state.editorState.toHTML()
however, the braft-editor code-highlighter default theme is prism-tomorrow
, and the expected result is:
编辑器里新添加表格没有问题,但是编辑 有表格 的内容时,表格没有正确显示
"braft-editor": "^2.2.9",
"braft-extensions": "0.0.18",
下方是书写的javascript所生成的一段html代码:
<pre data-lang="javascript" class="lang-javascript">
function helloworld() {
<br/>
console.log('hello world!');
<br/>
}
</pre>
按照prism官方推荐的code格式应该是这样的:
<pre><code class="language-css">p { color: red }</code></pre>
增加了预览的按钮,但是预览界面没有table样式了
margox/braft-editor#324
对于Mention功能,有什么进度么?
或者有什么方案?
不知道以下示例是否能提供帮助
https://ant.design/components/mentions-cn/
BraftEditor.use(Table({includeEditors:['xxx']}))设置后,相应的编辑器仍然没有插入表格项,只有BraftEditor.use(Table({xxx}))(table中设置不包括includeEditors或excludeEditors)是编辑器中才会出现表格插入图标
已升级为最新版
table中无法插入图片
定义好的react组件,渲染后查到编辑器中作为内容
在主流浏览器中都可以在初始化时显示表格但是在ie11中直接提示类型错误。只要加了{editorId:'editor-table'}参数找不到具体的原因导致的请帮忙看一下
表情包已经能展开了 但是插入到编辑器里面是一个空格 是为什么有什么解决办法吗
问题:加入color-picker扩展后,利用this.setState修改editorState的值,该状态会更新,但是编辑器的内容无法成功按照更新后的editorState的值渲染出来,但是编辑器内修改编辑器内容可以更新editorState的值,也就是数据流变成了单向
想法很好,市面上比较缺乏,希望抓紧完善,等着用
[我的需求是选中文字后,弹出一个下拉框,然后在下拉框里选择链接
我引入了
import 'braft-extensions/dist/table.css'
没有效果
输入字数限制模块 到达MaxLength之后中文输入法仍能继续输入 有解决办法吗?
colorpicker是否支持ts?
Hi,
I hope its ok to raise this in english.
I have just made a simple braftEditor component following the example in https://braft.margox.cn/demos/basic
And bold, italics seem to not be working. Is there a fix for this?
如题,readOnly={true}的editor组件中表格仍然可以操作编辑,不过更改并不会保存(并没有相应的处理相关事件)
请问作者有没有可配置属性 让enter回车可以直接触发提交事件 而不是换行
您好
当使用扩展表格功能后,edge浏览器无法将通过
BraftEditor.createEditorState(props.data, {....}) 创建包含数据的editorState ,editorState.toHTML()为空,与之前提问的ie出现的情况类似,打印了error
初次
SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at Function.editor_BraftEditor.createEditorState.external_draft_js_.EditorState.createFrom [as createEditorState] (index.js:6250)
at new Braft (BraftEditor.js:84)
at constructClassInstance (react-dom.development.js:11312)
at updateClassComponent (react-dom.development.js:14481)
at beginWork (react-dom.development.js:15438)
at performUnitOfWork (react-dom.development.js:19106)
at workLoop (react-dom.development.js:19146)
at renderRoot (react-dom.development.js:19229)
at performWorkOnRoot (react-dom.development.js:20136)
at performWork (react-dom.development.js:20048)
at performSyncWork (react-dom.development.js:20022)
at requestWork (react-dom.development.js:19891)
at scheduleWork (react-dom.development.js:19705)
at Object.enqueueSetState (react-dom.development.js:11141)
at DynamicComponent../node_modules/react/cjs/react.development.js.Component.setState (react.development.js:335)
at dynamic.js:91
之后
SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse ()
at Function.editor_BraftEditor.createEditorState.external_draft_js_.EditorState.createFrom [as createEditorState] (index.js:6250)
at BraftEditor.js:105
谷歌也会有这个error 但是加载显示无任何问题。
请问一下这个是否支持TypeScript,yarn add @types/braft-extensions 并没有这个
现在所有的表格都是同一个背景颜色,我们希望有个表头和 表体的区别,对第一行的表头设置背景颜色
在antd表单中使用getFieldDecorator绑定braft组件时,设置了CodeHighlighter代码高亮扩展功能,并且在getFieldDecorator的initialValue中按照官方案例初始化赋值,此时CodeHighlighter代码高亮功能失效。
请问是否此扩展功能无法和antd的getFieldDecorator功能一起使用?
详细代码:
`
BraftEditor.use(CodeHighlighter({ includeEditors: ['editor'] }));
export default class Publish extends PureComponent {
state = {
editorInitValue: BraftEditor.createEditorState('请输入正文', { editorId: 'editor' })
};
render () {
return (
<Form>
<Form.Item label='正文'>
{getFieldDecorator('content', {
// 初始化赋值无效
initialValue: editorInitValue,
validateTrigger: 'onBlur, onChange',
rules: [{
required: true,
validator: (_, value, callback) => {
if (!value) {
callback('正文内容不能为空');
} else {
console.log(value.toRAW());
callback();
}
}
}],
})(
<BraftEditor
id="editor"
className={style.editor}
/>
)}
</Form.Item>
</Form>
)
}
}
`
当我们写文章时,比如在语雀中,它会自动给h1-h3标题的块加上id属性,这样的话,通过元素类型和id属性,我们可以构造文档页面的锚点,并将页面锚点组织起来形成文档的大纲,对于文档系统来说,这简直是一大利器,非常好用
无奈,才疏学浅,看了Draft.js的默认块的定制,似乎没能找到hack进braft-editor来实现该功能的方法...
希望大神能指点一下解决思路,文档我自己看...
还有,上传图片的时候我希望能在数据库里面记录某文章中所有上传过的图片(文章的图片库),将图片库和组件的媒体库关联起来,这样,媒体库中文件删除时,我这边会按照数据库中记录的图片信息去云端删除该图片,减少无用图片的存储
但目前的问题是,没找到直接插入数据到媒体库的,根据数据库中的图片信息来初始化媒体库的方法...
大神,求指点...
编辑器里新添加表格没有问题,但是编辑 有表格 的内容时,表格没有正确显示
立秋习俗知多少
Hi!
looks great, any chance for English components?
Thanks!
在点击插入表格,弹框显示行列设置,点击确认后,触发了form的submit事件;需要将行列设置面板里的按钮加上属性type=“button”,防止意外提交
用了代码高亮模块,生成的代码里class前缀是lang-不是language-,展示页引入prism.js和prism.css无法高亮显示
在使用表格扩展的时候,editorState.toHTML()转化出来的html代码没有了表格的样式,表格的线条什么的都没有了,请问有什么方法取到对应的html代码吗?包的版本:"braft-convert": "^2.1.11","braft-editor": "^2.1.36","braft-extensions": "0.0.13","braft-utils": "^3.0.9"
Hi @margox
I want to create a extension for UnsplashFinder
This is my code:
import React from 'react';
import Unsplash from './Unsplash';
export default (config = {}) => {
const { includeEditors, apiKey, excludeEditors, id = 'unsplash' } = config;
return {
type: 'entity',
name: 'UNSPLASH',
mutability: 'IMMUTABLE',
includeEditors,
excludeEditors,
control: props => {
return {
key: 'unsplash',
type: 'modal',
title: 'Unsplash',
text: 'Unsplash',
modal: {
id: id,
title: 'Unsplash Finder',
showCancel: true,
showConfirm: true,
confirmable: true,
showFooter: true,
component: (
<Unsplash apiKey={apiKey} editor={props.editor} editorState={props.editorState} />
),
onConfirm: () => {
console.log(1111);
}
}
};
}
};
};
You can imagine it similar to Media
How can I insert my data from onConfirm?
I can submit it from Unsplash component but I can't find a closes modal method.
图片上传后可以一行显示吗
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.