Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

针对 editormd.js 中 md到Html 转换的函数形参进行了智能判断,使得其可以接收一个元素,而不仅仅是id #998

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BeardedManZhao
Copy link

@BeardedManZhao BeardedManZhao commented Dec 6, 2023

针对 editormd.js 中 md到Html 转换的函数形参进行了类型判断,使得其可以接收一个元素,而不仅仅只能接收id,下面是主要的变更信息。

新增函数

新增了一个字符串对象判断函数。

    /**
     * 判断一个对象是否为字符串
     * @param obj
     * @return {boolean}
     */
    const isString = (obj) => typeof obj === 'string' || obj instanceof String;

针对 editormd.markdownToHTML 函数进行了少量修改,使得其可以接收一个HTML的控件对象。

        var div           =  isString(id) ? $("#" + id) : $(id)

针对 editormd.js 中 md到Html 转换的函数形参进行了智能判断,使得其可以接收一个元素,而不仅仅是id,下面是主要的变更信息。

# 新增函数
新增了一个字符串对象判断函数。
```
    /**
     * 判断一个对象是否为字符串
     * @param obj
     * @return {boolean}
     */
    const isString = (obj) => typeof obj === 'string' || obj instanceof String;
```

# 针对 editormd.markdownToHTML 函数进行了少量修改,使得其可以接收一个HTML的控件对象。
```
        var div           =  isString(id) ? $("#" + id) : $(id)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant