Coder Social home page Coder Social logo

无法输入 '/' about editor.md HOT 11 CLOSED

pandao avatar pandao commented on May 12, 2024
无法输入 '/'

from editor.md.

Comments (11)

pandao avatar pandao commented on May 12, 2024

之前开发时也有遇到这个问题,没想到解决后又出现了。

from editor.md.

pandao avatar pandao commented on May 12, 2024

@tylerlong 我这边测试了一下,只要一开启自动闭合标签autoCloseTags : true,就会出现这个问题。
怀疑是CodeMirror的问题,更新到CodeMirror 5.0就不会有这个问题。

from editor.md.

tylerlong avatar tylerlong commented on May 12, 2024

用户如何更新CodeMirror? 下载最新的代码替换到lib目录?

能否单独配置CodeMirror的路径?

from editor.md.

pandao avatar pandao commented on May 12, 2024

文件结构会有变化,打算发布新版本。

from editor.md.

tylerlong avatar tylerlong commented on May 12, 2024

干脆把lib目录清空,然后在安装说明中写清楚都依赖哪些软件包,让用户自行下载管理。

如果每个软件包都能够配置路径的话,理论上讲是可以和任意包管理器兼容的(比如bower)。

用户通过包管理器(比如bower)下载各种软件包,然后把路径一配置,就能运行了。

那些不用包管理器的人,手工下载各种软件包,然后把路径一配置,也能运行了。

from editor.md.

pandao avatar pandao commented on May 12, 2024

跟lib目录没有关系。依赖的包太多了,不是每个都能通过bower安装,而且用的时候要引用很多文件,这个很烦人,所以我封装了一下。主要是希望不要重复安装步骤,一次下载就能用,一个安装命令bower install editor.md就能使用。

from editor.md.

tylerlong avatar tylerlong commented on May 12, 2024

用户怎么装其它的软件包不是你的软件包应该关心的。你现在剥夺了用户自由安装其它软件包的权利。你只要写清楚你的软件包依赖于什么软件包就行了。

如果剥离不出来,说明设计上太高耦合了。

from editor.md.

pandao avatar pandao commented on May 12, 2024

用户装其他什么包,Editor.md当然不用关心,但Editor.md必须关心它所依赖的包在哪里,有没有存在。

首先lib里依赖的模块都是可以自行安装(不提供通过Bower等包管理器安装,自行安装的可以通过提供手动加载模块的模式来加载),路径也是可以自定义的path: "xxxxxxxx",前提是你不想用Editor.md的自动加载模式,你想手动添加10几个文件,这样有没有做到低耦合、高内聚,充分自由安装的权利?

再者那么多包管理器,也不可能都提供支持吧?还有依赖的模块文件有的都没有对应的bower安装包,怎么提供bower.json?依赖什么包,README.md应该说的很清楚了。

再者也要兼顾到不想通过bower等包管理器安装的,所以预先在lib/目录里安装好所依赖的包,这样没错吧?

from editor.md.

tylerlong avatar tylerlong commented on May 12, 2024

path: "xxxx" 内部的相对路径是钉死的吧?就算想自行安装,也得严格模拟现有lib的目录结构才行。 这基本上就把所有的包管理器排除在外了,真的是“自行”安装。再有就是lib只包含了第三方库的js,css分散到了其它地方。 这意味自行安装也得按照你的分散方式把自行下载的CSS也分散下?

或者具体点, 怎么把lib里面的CodeMirror换成一个特定的版本?有没有简单的方法?

在一个大而全的,写死的系统上去做定制,往往还不如自己根据需求写一个刚刚好够用的系统省事。我下午自己写了个markdown编辑器: tylerlong/editor.markdown HTML + CSS + JS 一共100来行代码。 不是一个通用的东西,但能满足我的使用场景了。

我给editor.md的发展建议是:

  1. sensible defaults. 默认的配置应该是大部分人都想要的。 大部分人不用改任何东西就能用。
  2. 允许少部分人灵活定制软件的方方面面。

from editor.md.

pandao avatar pandao commented on May 12, 2024

@tylerlong 如果你使用手动加载依赖的模块完全不用遵循lib的目录结构,你想放哪里都可以,以什么版本无关。

我不知道你是想省掉安装的麻烦还是想避免重复安装、高复用公共模块? 目前几乎所有语言的包管理器都存在一个问题,重复安装,臃肿,每个都有bower_components / node_modules / vendor,一层套一层的。

Editor.md 把需要的精简到'lib/'目录里,如果你不需要预先安装好的模块,你完全可以自定义。

另外,被你看成是写死的,是你还不够了解。Editor.md 把依赖的50多个CodeMirror modes和addons文件,分别合并成两个文件addons.min.jsmodes.min.js,还不包括其他Marked等9个依赖模块(都进行过压缩处理),要实现这么多文件的最快最优化加载能不“写死”吗?还是那句话,如果你想使用Editor.md内建的自动加载就得按lib目录下的结构。

我认为Editor.md已经做你所给的所谓建议。

from editor.md.

pandao avatar pandao commented on May 12, 2024

@v1.3.0 fixed.

from editor.md.

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.