diff --git a/.gitignore b/.gitignore index 16c1f4b..c626b0f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.min.js *.min.css +.httpserver index.html .vscode node_modules/ diff --git a/.prettierrc.yaml b/.prettierrc.yaml index c0e277f..b007fb1 100644 --- a/.prettierrc.yaml +++ b/.prettierrc.yaml @@ -2,7 +2,7 @@ jsxBracketSameLine: true jsxSingleQuote: true semi: false singleQuote: true -printWidth: 100 +printWidth: 80 useTabs: false tabWidth: 2 trailingComma: none diff --git a/package.json b/package.json index 2999118..a6a155e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bytedo/wcui", - "version": "1.0.6", + "version": "1.0.7", "type": "module", "description": "基于wc开发的一套UI库, 面向未来, 面向electron", "scripts": { diff --git a/src/editor/index.wc b/src/editor/index.wc index 9e7bc9e..63452f0 100644 --- a/src/editor/index.wc +++ b/src/editor/index.wc @@ -582,13 +582,33 @@ export default class Editor { var txt = ev.clipboardData.getData('text/plain') var items = ev.clipboardData.items + // 先文件判断, 避免右键单击复制图片时, 当成html处理 + if (items && items.length) { + let blob = null + for (let it of items) { + if (it.type.indexOf('image') > -1) { + blob = it.getAsFile() + } + } + + if (blob) { + return this._handleImage(blob) + } + } + if (html) { html = html .replace(/\t/g, ' ') .replace(/<\/?(meta|link|script)[^>]*?>/g, '') .replace(//g, '') - .replace(/]*? href\s?=\s?["']?([^"']*)["']?[^>]*?>/g, '') - .replace(/]*? src\s?=\s?["']?([^"']*)["']?[^>]*?>/g, '') + .replace( + /]*? href\s?=\s?["']?([^"']*)["']?[^>]*?>/g, + '' + ) + .replace( + /]*? src\s?=\s?["']?([^"']*)["']?[^>]*?>/g, + '' + ) .replace(/<(?!a|img)([\w\-]+)[^>]*>/g, '<$1>') .replace(/]*?>[\w\W]*?<\/xml>/g, '') .replace(/