编写一个简单的自定义编辑器需要多快?

发布于 2024-07-20 10:54:30 字数 265 浏览 4 评论 0原文

简单地说,我的意思是,有按钮:

  1. 粗体,
  2. 斜体,
  3. 编号列表项目
  4. 符号列表
  5. 缩进左
  6. 缩进右
  7. 拼写检查(显然由现成的js组件支持)

自定义我的意思是:有自定义图标 - 所以实际上只是自定义设计

没有框架,编写从头开始,轻量级,兼容主流浏览器

这是web应用程序的主要组件之一,所以它必须是超轻量级的,这就是为什么我不想要框架

by simple I mean, having buttons:

  1. bold,
  2. italic,
  3. numbered list
  4. bullet point list
  5. indent left
  6. indent right
  7. spell check (obviously supported by ready made js component)

by custom I mean: having custom icons - so really just custom design

no frameworks, written from scratch, lightweight, compatible with major browsers

this is one of the main components of the webapp, so it has to be super lightweight, that's why I don't want frameworks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

吹泡泡o 2024-07-27 10:54:30

除非您针对一种浏览器,否则编辑器是跨浏览器工作的极其复杂的组件。 除非您想学习,否则没有理由自己做。

使用允许自定义的众多可用选项之一:
tinymce,
fckeditor,
wysihat,
其他

Unless you are targeting one browser, editors are immensely complicated components to get to work cross browser. There's no reason to do it yourself, unless you want to learn.

Use one of the many available that allow customization:
tinymce,
fckeditor,
wysihat,
others

筑梦 2024-07-27 10:54:30

编写一个跨平台工作的编辑器可能很困难,但是,您应该在编写时创建自己的框架,因为这是一个大型项目。

如果您只想要自定义图标,这取决于您制作它们需要多长时间,但是,获得一些基本功能并不难,如果您知道自己在做什么,可能需要不到 40 小时的工作时间。

在 Unix 中,编写自己的 shell 曾经是一种仪式,在 javascript 中可能是编写自己的编辑器。 :)

棘手的是,如果我

<b>some text</b><i>more text</i>

决定从该文本中删除标签,那么如何修复它就会变得棘手。

如果您只想使用 css,那么当您对 span 标记中的文本进行分组并修复 css 类时,问题就更大了,而用户仍在继续进行更改。

我目前正在处理这个问题,因为我想要一个在 XHTML2.0 中工作的编辑器,这不是一个小问题,比在桌面应用程序中困难得多。

我建议先让它在 Firefox 3 和 Safari 上工作,然后,一旦工作正常,返回并添加代码以使其在 IE8 上工作,如果你想要 IE7,因为微软正在将 IE8 作为一个现在进行重要更新。

Writing an editor that works cross-platform can be difficult, but, you should create your own framework as you do it, as it is a large project.

If you just want custom icons, that will depend on how long it takes you to make them, but, to get some basic functionality isn't that hard, probably less than 40 hrs of work if you know what you are doing.

In Unix writing your own shell used to be a rite of passage, in javascript it may be writing your own editor. :)

Where it gets tricky is if I have

<b>some text</b><i>more text</i>

and I decide to remove the tags from this text, then how to fix it will get tricky.

If you want to use only css then it gets to be more of a problem as you are grouping text from span tags, and fixing css classes, while the user is continuing to make changes.

I am dealing with this currently as I want an editor that works in XHTML2.0, and it is not a trivial issue, much harder than it is to do in a desktop application.

I would suggest getting it to work on Firefox 3 and Safari first, then, once it is working, go back and add in the code to get it to work on IE8, and if you want IE7, since MS is pushing IE8 out as a critical update now.

若有似无的小暗淡 2024-07-27 10:54:30

不。

去获取其他东西(Jason 提到的任何一个,或者例如 SO 本身使用的东西,WMD)。 交换它的图像。 结束。

说真的,你不想编写自己的编辑器,除非你在功能上有很好的理由,而不仅仅是它的外观。

Don't.

Go get something else (any of those Jason mentioned, or e.g. what SO itself uses, WMD). Swap out its images. The end.

Seriously you don't want to write your own editor unless you have a very good reason for it functionally, not just what it looks like.

醉梦枕江山 2024-07-27 10:54:30

通读 emacs 教程的第一章,你会发现没有什么比“简单”的编辑器更好的了。 但谷歌会给你很多简单的可定制编辑器。

Read through the first chapters of the emacs tutorial, and you will see that there is not anything like a "simple" editor. But google will give you lots of easy customizable editors.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文