GithubHelp home page GithubHelp logo

Comments (9)

balck-paint avatar balck-paint commented on June 9, 2024

上传了个视频链接您看看

from am-editor.

balck-paint avatar balck-paint commented on June 9, 2024

我在官网那个在线编辑器上试了一下,并不卡,这就奇怪了```````我等会把实例项目拉下来跑着试试

from am-editor.

big-camel avatar big-camel commented on June 9, 2024

复制再粘贴板里面有 html 和 text 两种类型,如果提示到检测到 markdown 那个可能是检测到 text 里面的文本有符合markdown 的语法,但是又不全部是。所以你选择转换其实就是把 text 里面的值粘贴进去了。

卡这个,看起来像是哪里死循环了,大概率是bug或者哪里使用造成了这种bug。另外如果 字体大小、字体 对文档来说不重要的发,可以把这两个插件再粘贴的时候排除也会有助于提高粘贴的速度,因为一般不管是word还是其它文档复制的时候总是带着一些微软雅黑或者其它的字体设置。

// 粘贴的时候过滤一些样式插件
    engine.on('paste:schema', schema => {
		const plugins = ['fontsize', 'fontfamily']
		plugins.forEach(pluginName => {
			const plugin = engine.plugin.components[pluginName]
			if(!plugin || plugin.kind !== 'mark') return
			const pluginSchema = (plugin as MarkPlugin).schema()
			const schemas: SchemaMark[] = []
			if(Array.isArray(pluginSchema)) {
				pluginSchema.forEach(schema => schemas.push(schema))
			} else {
				schemas.push(pluginSchema)
			}
			schemas.forEach(rule => {
				schema.remove(rule)
			})
		})
    })

from am-editor.

balck-paint avatar balck-paint commented on June 9, 2024

@yanmao-cc 我重启了电脑,另外重新把官网的示例拉下下跑了一下,好多了。之前可能是卡住了,然后我一直重试,然后越来越卡。
另外我测试了和其他的编辑器,确实相对比较卡,还是有优化空间的。
还有个问题,在你们的示例布局下我复制别的md文档,然后页面直接被撑到最大,顶部的菜单栏也看不见了,这个不清楚是怎么回事,是你们有检测如果空间不够自动全屏吗?
然后我自己改了布局样式,目前来说没有出现这个问题

from am-editor.

big-camel avatar big-camel commented on June 9, 2024

示例里面除了 react 是直接使用当前package里面的包执行的外,vue使用的仍然是上一个版本的文件。2.6 版本是做了一些机制改动,这两天累计了一些bug修复了再commit日志里,预计明天才会再发一个版本

from am-editor.

balck-paint avatar balck-paint commented on June 9, 2024

@yanmao-cc 看了下文档中的给出的接口,发现可扩展性真的很高,很强大,但是由于没有示例,所以在用法上还是有些疑惑

比如我现在有个需求,自定义一个toolbar,点击后在编辑器中插入相应的元素,比如说图片、表单、甚至更复杂的元素,然后这个是怎么做的呢?
文档中应该是推荐使用card或者block,我试图去创建它,但是都失败了,然后我只能退而其次,使用以下方式插入自定义内容

然后还有那个插件命令,不能在外部使用吗?只能在点击toolbar后触发吗?

可能是我文档阅读能力比较差,但是由于这个编辑器是一个比较新的开源项目,网上并没有相关的用法,所以只能来麻烦作者了,如果您有时间可以回答一下,期待您的回复

from am-editor.

big-camel avatar big-camel commented on June 9, 2024

使用引擎实例去调用插件的命令 engine.command.execute('插件名称'),toolbar 上的按钮单击也是这里调用这个命令

from am-editor.

balck-paint avatar balck-paint commented on June 9, 2024

@yanmao-cc
可以了,之前的命令第一次用不知道是那里没配好。刚才可以了,功能还是很强大的。真香
另外刚刚看到了插件开发,隐藏的比较深,得仔细研究一下,功能更强大。card插件好像是渲染一些比较复杂可以结合vue等使用外部ui库的,但是如果只是单纯的插入一些文本段落用什么方式呢
另外不知道有没有群,有不懂的可以问问群友

from am-editor.

big-camel avatar big-camel commented on June 9, 2024

可以试试这样
const fragment = doc.createDocumentFragment();
fragment.appendChild(...);
engine.change.insert(fragment)

一般情况下都是由插件去执行插入,因为插件有schema约束,不会造成未定义的节点出现在文档中

在Readme 里面有群号

from am-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.