Skip to content

Commit

Permalink
images name filter
Browse files Browse the repository at this point in the history
  • Loading branch information
hinesboy committed Dec 6, 2017
1 parent 2cc0a2e commit e56ed53
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions LOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# 更新日志
- **2.4.10** 添加图片名正则过滤(17.12.6)
- **2.4.9** 删除上传图片时同时删除其文本(17.12.2)
- **2.4.8** 将链接打开方式调整为新界面打开, 整改图片上传样式, 增加直接添加链接方式(17.12.2)
- **2.4.7** 修改外链使用方式,将`katex`提取出来作为外链(17.11.27 [CHENXCHEN](https://github.com/CHENXCHEN))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ $ npm install mavon-editor --save

> [更多引入方式点击这里...](./doc/cn/use.md)
#### Images Upload & Preview
#### 图片上传&预览 例子

```javascript
<template>
Expand Down
2 changes: 1 addition & 1 deletion dist/mavon-editor.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion doc/cn/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

![PC](../../img/cn/cn-help.png)

#### 链接 & 图片
#### 链接 & 上传图片

![PC](../../img/cn/cn-link.gif)

![PC](../../img/cn/cn-drag.gif)

![PC](../../img/cn/cn-image.gif)

### 移动
Expand Down
4 changes: 3 additions & 1 deletion doc/en/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

![PC](../../img/en/en-help.png)

### Images Preview
### Link & Upload Images

![PC](../../img/en/en-link.gif)

![PC](../../img/en/en-drag.gif)

![PC](../../img/en/en-image.gif)

### Mobile
Expand Down
Binary file added img/cn/cn-drag.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/en/en-drag.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mavon-editor",
"version": "2.4.9",
"version": "2.4.10",
"description": "Vue markdown editor",
"main": "dist/mavon-editor.js",
"scripts": {
Expand Down
6 changes: 4 additions & 2 deletions src/mavon-editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@
$imgDel(file) {
this.s_markdown.image_del(file[0]);
// 删除所有markdown中的图片
let reg = new RegExp(`\\!\\[${file[1].name}\\]\\(\\${file[0]}\\)`, "g")
let reg = new RegExp(`\\!\\[${file[1]._name}\\]\\(\\${file[0]}\\)`, "g")
this.d_value = this.d_value.replace(reg, '');
this.iRender(this.d_value);
this.$emit('imgDel', file[0]);
Expand All @@ -379,9 +379,11 @@
$vm.s_markdown.image_add(pos, oFREvent.target.result);
$file.miniurl = oFREvent.target.result;
if (isinsert === true) {
// 去除特殊字符
$file._name = $file.name.replace(/[\[\]\(\)\.\+\{\}&\|\\\*^%$#@\-]/g, '');
$vm.insertText($vm.getTextareaDom(),
{
prefix: '\n![' + $file.name + '](' + pos + ')',
prefix: '\n![' + $file._name + '](' + pos + ')',
subfix: '',
str: ''
});
Expand Down

0 comments on commit e56ed53

Please sign in to comment.