feffery_utils_components 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESCRIPTION +1 -1
- package/NAMESPACE +1 -2
- package/Project.toml +1 -1
- package/feffery_utils_components/FefferyPasteImage.py +56 -0
- package/feffery_utils_components/__pycache__/FefferyCaptcha.cpython-37.pyc +0 -0
- package/feffery_utils_components/__pycache__/FefferyPasteImage.cpython-37.pyc +0 -0
- package/feffery_utils_components/__pycache__/FefferySyntaxHighlighter.cpython-37.pyc +0 -0
- package/feffery_utils_components/__pycache__/FefferyWaterMark.cpython-37.pyc +0 -0
- package/feffery_utils_components/__pycache__/__init__.cpython-37.pyc +0 -0
- package/feffery_utils_components/__pycache__/_imports_.cpython-37.pyc +0 -0
- package/feffery_utils_components/_imports_.py +2 -2
- package/feffery_utils_components/feffery_utils_components.min.js +1 -1
- package/feffery_utils_components/feffery_utils_components.min.js.LICENSE.txt +0 -16
- package/feffery_utils_components/metadata.json +41 -13
- package/feffery_utils_components/package-info.json +13 -11
- package/package.json +13 -11
- package/src/FefferyUtilsComponents.jl +4 -4
- package/src/jl/''_fefferypasteimage.jl +35 -0
- package/src/lib/components/FefferyPasteImage.react.js +168 -0
- package/src/lib/components/FefferySyntaxHighlighter.react.js +3 -3
- package/src/lib/components/styles.css +13 -0
- package/src/lib/index.js +4 -3
- package/usage.py +28 -170
- package/.Rbuildignore +0 -34
- package/.babelrc +0 -6
- package/feffery_utils_components/FefferyMarkdown.py +0 -50
- package/feffery_utils_components/__pycache__/FefferyContextMenu.cpython-37.pyc +0 -0
- package/feffery_utils_components/__pycache__/FefferyFefferySyntaxHighlighter.cpython-37.pyc +0 -0
- package/feffery_utils_components/__pycache__/FefferyMarkdown.cpython-37.pyc +0 -0
- package/feffery_utils_components/__pycache__/FefferyNprogress.cpython-37.pyc +0 -0
- package/feffery_utils_components/__pycache__/FefferyUtilsComponents.cpython-37.pyc +0 -0
- package/src/lib/components/FefferyMarkdown.react.js +0 -163
|
@@ -4,13 +4,6 @@
|
|
|
4
4
|
http://jedwatson.github.io/classnames
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
/*!
|
|
8
|
-
* Determine if an object is a Buffer
|
|
9
|
-
*
|
|
10
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
11
|
-
* @license MIT
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
7
|
/**
|
|
15
8
|
* @license
|
|
16
9
|
* Lodash <https://lodash.com/>
|
|
@@ -37,12 +30,3 @@
|
|
|
37
30
|
* This source code is licensed under the MIT license found in the
|
|
38
31
|
* LICENSE file in the root directory of this source tree.
|
|
39
32
|
*/
|
|
40
|
-
|
|
41
|
-
/** @license React v17.0.2
|
|
42
|
-
* react-is.production.min.js
|
|
43
|
-
*
|
|
44
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
45
|
-
*
|
|
46
|
-
* This source code is licensed under the MIT license found in the
|
|
47
|
-
* LICENSE file in the root directory of this source tree.
|
|
48
|
-
*/
|
|
@@ -98,51 +98,79 @@
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
},
|
|
101
|
-
"src/lib/components/
|
|
101
|
+
"src/lib/components/FefferyPasteImage.react.js": {
|
|
102
102
|
"description": "",
|
|
103
|
-
"displayName": "
|
|
103
|
+
"displayName": "FefferyPasteImage",
|
|
104
104
|
"methods": [],
|
|
105
105
|
"props": {
|
|
106
106
|
"id": {
|
|
107
107
|
"type": {
|
|
108
108
|
"name": "string"
|
|
109
109
|
},
|
|
110
|
-
"required":
|
|
110
|
+
"required": true,
|
|
111
111
|
"description": ""
|
|
112
112
|
},
|
|
113
|
-
"
|
|
113
|
+
"children": {
|
|
114
114
|
"type": {
|
|
115
|
-
"name": "
|
|
115
|
+
"name": "node"
|
|
116
116
|
},
|
|
117
117
|
"required": false,
|
|
118
|
-
"description": ""
|
|
118
|
+
"description": "The content of the tab - will only be displayed if this tab is selected"
|
|
119
119
|
},
|
|
120
|
-
"
|
|
120
|
+
"className": {
|
|
121
121
|
"type": {
|
|
122
122
|
"name": "string"
|
|
123
123
|
},
|
|
124
124
|
"required": false,
|
|
125
125
|
"description": "",
|
|
126
126
|
"defaultValue": {
|
|
127
|
-
"value": "'
|
|
127
|
+
"value": "'feffery-paste-image-container'",
|
|
128
128
|
"computed": false
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
|
-
"
|
|
131
|
+
"style": {
|
|
132
132
|
"type": {
|
|
133
|
-
"name": "
|
|
133
|
+
"name": "object"
|
|
134
134
|
},
|
|
135
135
|
"required": false,
|
|
136
136
|
"description": ""
|
|
137
137
|
},
|
|
138
|
-
"
|
|
138
|
+
"currentPastedImages": {
|
|
139
139
|
"type": {
|
|
140
|
-
"name": "
|
|
140
|
+
"name": "arrayOf",
|
|
141
|
+
"value": {
|
|
142
|
+
"name": "any"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"required": false,
|
|
146
|
+
"description": "",
|
|
147
|
+
"defaultValue": {
|
|
148
|
+
"value": "[]",
|
|
149
|
+
"computed": false
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"deletedIdx": {
|
|
153
|
+
"type": {
|
|
154
|
+
"name": "arrayOf",
|
|
155
|
+
"value": {
|
|
156
|
+
"name": "number"
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"required": false,
|
|
160
|
+
"description": "",
|
|
161
|
+
"defaultValue": {
|
|
162
|
+
"value": "[]",
|
|
163
|
+
"computed": false
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"imageHeight": {
|
|
167
|
+
"type": {
|
|
168
|
+
"name": "number"
|
|
141
169
|
},
|
|
142
170
|
"required": false,
|
|
143
171
|
"description": "",
|
|
144
172
|
"defaultValue": {
|
|
145
|
-
"value": "
|
|
173
|
+
"value": "200",
|
|
146
174
|
"computed": false
|
|
147
175
|
}
|
|
148
176
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "feffery_utils_components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Utility augments components of Dash!",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,9 +25,8 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@ant-design/pro-layout": "^6.24.0",
|
|
28
|
-
"@
|
|
28
|
+
"@charliewilco/gluejar": "^1.0.0",
|
|
29
29
|
"github-markdown-css": "^5.0.0",
|
|
30
|
-
"katex": "^0.15.1",
|
|
31
30
|
"less": "^3.13.1",
|
|
32
31
|
"less-loader": "^5.0.0",
|
|
33
32
|
"ramda": "^0.26.1",
|
|
@@ -35,13 +34,7 @@
|
|
|
35
34
|
"react-contexify": "^5.0.0",
|
|
36
35
|
"react-copy-to-clipboard": "^5.0.4",
|
|
37
36
|
"react-icons": "^4.3.1",
|
|
38
|
-
"react-
|
|
39
|
-
"react-syntax-highlighter": "^15.4.4",
|
|
40
|
-
"rehype-highlight": "^5.0.0",
|
|
41
|
-
"rehype-katex": "^6.0.1",
|
|
42
|
-
"rehype-raw": "^6.1.0",
|
|
43
|
-
"remark-gfm": "^3.0.1",
|
|
44
|
-
"remark-math": "^5.1.0"
|
|
37
|
+
"react-syntax-highlighter": "^15.4.4"
|
|
45
38
|
},
|
|
46
39
|
"devDependencies": {
|
|
47
40
|
"@babel/core": "^7.5.4",
|
|
@@ -71,8 +64,17 @@
|
|
|
71
64
|
"webpack-cli": "3.3.6",
|
|
72
65
|
"webpack-serve": "3.1.0"
|
|
73
66
|
},
|
|
67
|
+
"babel": {
|
|
68
|
+
"presets": [
|
|
69
|
+
"@babel/preset-react",
|
|
70
|
+
"@babel/preset-env"
|
|
71
|
+
],
|
|
72
|
+
"plugins": [
|
|
73
|
+
"@babel/plugin-transform-react-jsx"
|
|
74
|
+
]
|
|
75
|
+
},
|
|
74
76
|
"engines": {
|
|
75
77
|
"node": ">=8.11.0",
|
|
76
78
|
"npm": ">=6.1.0"
|
|
77
79
|
}
|
|
78
|
-
}
|
|
80
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "feffery_utils_components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Utility augments components of Dash!",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,9 +23,8 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@ant-design/pro-layout": "^6.24.0",
|
|
26
|
-
"@
|
|
26
|
+
"@charliewilco/gluejar": "^1.0.0",
|
|
27
27
|
"github-markdown-css": "^5.0.0",
|
|
28
|
-
"katex": "^0.15.1",
|
|
29
28
|
"less": "^3.13.1",
|
|
30
29
|
"less-loader": "^5.0.0",
|
|
31
30
|
"ramda": "^0.26.1",
|
|
@@ -33,13 +32,7 @@
|
|
|
33
32
|
"react-contexify": "^5.0.0",
|
|
34
33
|
"react-copy-to-clipboard": "^5.0.4",
|
|
35
34
|
"react-icons": "^4.3.1",
|
|
36
|
-
"react-
|
|
37
|
-
"react-syntax-highlighter": "^15.4.4",
|
|
38
|
-
"rehype-highlight": "^5.0.0",
|
|
39
|
-
"rehype-katex": "^6.0.1",
|
|
40
|
-
"rehype-raw": "^6.1.0",
|
|
41
|
-
"remark-gfm": "^3.0.1",
|
|
42
|
-
"remark-math": "^5.1.0"
|
|
35
|
+
"react-syntax-highlighter": "^15.4.4"
|
|
43
36
|
},
|
|
44
37
|
"devDependencies": {
|
|
45
38
|
"@babel/core": "^7.5.4",
|
|
@@ -69,8 +62,17 @@
|
|
|
69
62
|
"webpack-cli": "3.3.6",
|
|
70
63
|
"webpack-serve": "3.1.0"
|
|
71
64
|
},
|
|
65
|
+
"babel": {
|
|
66
|
+
"presets": [
|
|
67
|
+
"@babel/preset-react",
|
|
68
|
+
"@babel/preset-env"
|
|
69
|
+
],
|
|
70
|
+
"plugins": [
|
|
71
|
+
"@babel/plugin-transform-react-jsx"
|
|
72
|
+
]
|
|
73
|
+
},
|
|
72
74
|
"engines": {
|
|
73
75
|
"node": ">=8.11.0",
|
|
74
76
|
"npm": ">=6.1.0"
|
|
75
77
|
}
|
|
76
|
-
}
|
|
78
|
+
}
|
|
@@ -3,10 +3,10 @@ module FefferyUtilsComponents
|
|
|
3
3
|
using Dash
|
|
4
4
|
|
|
5
5
|
const resources_path = realpath(joinpath( @__DIR__, "..", "deps"))
|
|
6
|
-
const version = "0.0.
|
|
6
|
+
const version = "0.0.5"
|
|
7
7
|
|
|
8
8
|
include("jl/''_fefferycaptcha.jl")
|
|
9
|
-
include("jl/''
|
|
9
|
+
include("jl/''_fefferypasteimage.jl")
|
|
10
10
|
include("jl/''_fefferysyntaxhighlighter.jl")
|
|
11
11
|
include("jl/''_fefferywatermark.jl")
|
|
12
12
|
|
|
@@ -19,14 +19,14 @@ function __init__()
|
|
|
19
19
|
[
|
|
20
20
|
DashBase.Resource(
|
|
21
21
|
relative_package_path = "feffery_utils_components.min.js",
|
|
22
|
-
external_url = "https://unpkg.com/feffery_utils_components@0.0.
|
|
22
|
+
external_url = "https://unpkg.com/feffery_utils_components@0.0.5/feffery_utils_components/feffery_utils_components.min.js",
|
|
23
23
|
dynamic = nothing,
|
|
24
24
|
async = nothing,
|
|
25
25
|
type = :js
|
|
26
26
|
),
|
|
27
27
|
DashBase.Resource(
|
|
28
28
|
relative_package_path = "feffery_utils_components.min.js.map",
|
|
29
|
-
external_url = "https://unpkg.com/feffery_utils_components@0.0.
|
|
29
|
+
external_url = "https://unpkg.com/feffery_utils_components@0.0.5/feffery_utils_components/feffery_utils_components.min.js.map",
|
|
30
30
|
dynamic = true,
|
|
31
31
|
async = nothing,
|
|
32
32
|
type = :js
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
export ''_fefferypasteimage
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
''_fefferypasteimage(;kwargs...)
|
|
7
|
+
''_fefferypasteimage(children::Any;kwargs...)
|
|
8
|
+
''_fefferypasteimage(children_maker::Function;kwargs...)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
A FefferyPasteImage component.
|
|
12
|
+
|
|
13
|
+
Keyword arguments:
|
|
14
|
+
- `children` (a list of or a singular dash component, string or number; optional): The content of the tab - will only be displayed if this tab is selected
|
|
15
|
+
- `id` (String; required)
|
|
16
|
+
- `className` (String; optional)
|
|
17
|
+
- `currentPastedImages` (Array of Bool | Real | String | Dict | Arrays; optional)
|
|
18
|
+
- `deletedIdx` (Array of Reals; optional)
|
|
19
|
+
- `imageHeight` (Real; optional)
|
|
20
|
+
- `loading_state` (optional): . loading_state has the following type: lists containing elements 'is_loading', 'prop_name', 'component_name'.
|
|
21
|
+
Those elements have the following types:
|
|
22
|
+
- `is_loading` (Bool; optional): Determines if the component is loading or not
|
|
23
|
+
- `prop_name` (String; optional): Holds which property is loading
|
|
24
|
+
- `component_name` (String; optional): Holds the name of the component that is loading
|
|
25
|
+
- `style` (Dict; optional)
|
|
26
|
+
"""
|
|
27
|
+
function ''_fefferypasteimage(; kwargs...)
|
|
28
|
+
available_props = Symbol[:children, :id, :className, :currentPastedImages, :deletedIdx, :imageHeight, :loading_state, :style]
|
|
29
|
+
wild_props = Symbol[]
|
|
30
|
+
return Component("''_fefferypasteimage", "FefferyPasteImage", "feffery_utils_components", available_props, wild_props; kwargs...)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
''_fefferypasteimage(children::Any; kwargs...) = ''_fefferypasteimage(;kwargs..., children = children)
|
|
34
|
+
''_fefferypasteimage(children_maker::Function; kwargs...) = ''_fefferypasteimage(children_maker(); kwargs...)
|
|
35
|
+
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Card, Button } from 'antd';
|
|
4
|
+
import { Gluejar } from '@charliewilco/gluejar'
|
|
5
|
+
import { DeleteOutlined } from '@ant-design/icons';
|
|
6
|
+
import './styles.css'
|
|
7
|
+
import 'antd/dist/antd.css';
|
|
8
|
+
|
|
9
|
+
const urlToBase64 = (url) => {
|
|
10
|
+
return new Promise((resolve, reject) => {
|
|
11
|
+
let image = new Image();
|
|
12
|
+
image.onload = function () {
|
|
13
|
+
let canvas = document.createElement('canvas');
|
|
14
|
+
canvas.width = this.naturalWidth;
|
|
15
|
+
canvas.height = this.naturalHeight;
|
|
16
|
+
// 将图片插入画布并开始绘制
|
|
17
|
+
canvas.getContext('2d').drawImage(image, 0, 0);
|
|
18
|
+
// result
|
|
19
|
+
let result = canvas.toDataURL('image/png')
|
|
20
|
+
resolve(result);
|
|
21
|
+
};
|
|
22
|
+
// CORS 策略,会存在跨域问题https://stackoverflow.com/questions/20424279/canvas-todataurl-securityerror
|
|
23
|
+
image.setAttribute("crossOrigin", 'Anonymous');
|
|
24
|
+
image.src = url;
|
|
25
|
+
// 图片加载失败的错误处理
|
|
26
|
+
image.onerror = () => {
|
|
27
|
+
reject(new Error('urlToBase64 error'));
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// 定义图片粘贴组件FefferyPasteImage,api参数参考https://github.com/charliewilco/react-gluejar
|
|
34
|
+
const FefferyPasteImage = (props) => {
|
|
35
|
+
// 取得必要属性或参数
|
|
36
|
+
let {
|
|
37
|
+
id,
|
|
38
|
+
className,
|
|
39
|
+
style,
|
|
40
|
+
currentPastedImages,
|
|
41
|
+
deletedIdx,
|
|
42
|
+
imageHeight,
|
|
43
|
+
setProps
|
|
44
|
+
} = props;
|
|
45
|
+
|
|
46
|
+
const handlePaste = useCallback(async (files) => {
|
|
47
|
+
let results = []
|
|
48
|
+
for (let i = 0; i < files.images.length; i++) {
|
|
49
|
+
if (deletedIdx.indexOf(i) === -1) {
|
|
50
|
+
let result = await urlToBase64(files.images[i])
|
|
51
|
+
results.push(result)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
setProps({
|
|
55
|
+
currentPastedImages: results
|
|
56
|
+
})
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
const handleDelete = useCallback((idx) => {
|
|
60
|
+
if (!deletedIdx) {
|
|
61
|
+
deletedIdx = [idx]
|
|
62
|
+
} else if (deletedIdx.indexOf(idx) === -1) {
|
|
63
|
+
deletedIdx.push(idx)
|
|
64
|
+
}
|
|
65
|
+
setProps({
|
|
66
|
+
currentPastedImages: currentPastedImages.filter((value, idx) => deletedIdx.indexOf(idx) === -1),
|
|
67
|
+
deletedIdx: deletedIdx
|
|
68
|
+
})
|
|
69
|
+
}, []);
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<div id={id}
|
|
73
|
+
className={className}
|
|
74
|
+
style={style}>
|
|
75
|
+
<Gluejar
|
|
76
|
+
key={1}
|
|
77
|
+
onPaste={handlePaste}
|
|
78
|
+
container={document.getElementById(id)}
|
|
79
|
+
onError={err => console.error(err)}>
|
|
80
|
+
{({ images }) => {
|
|
81
|
+
if (images.length > 0) {
|
|
82
|
+
console.log('渲染!')
|
|
83
|
+
return (
|
|
84
|
+
<Card style={{ height: '100%', border: 'none' }}>
|
|
85
|
+
{
|
|
86
|
+
images.map((image, idx) => {
|
|
87
|
+
return deletedIdx.indexOf(idx) === -1 ? (
|
|
88
|
+
<Card.Grid
|
|
89
|
+
style={{ width: '25%', height: imageHeight, padding: 5, cursor: 'pointer', position: 'relative' }}
|
|
90
|
+
>
|
|
91
|
+
<Button shape="circle" size={"small"} icon={<DeleteOutlined />}
|
|
92
|
+
style={{ position: 'absolute', 'right': 10, top: 10 }}
|
|
93
|
+
onClick={() => handleDelete(idx)} />
|
|
94
|
+
<img src={image} key={image} alt={`Pasted: ${image}`}
|
|
95
|
+
style={{ borderTop: '1px solid #f0f0f0', height: '100%', width: '100%', objectFit: 'contain' }} />
|
|
96
|
+
</Card.Grid>
|
|
97
|
+
) : null
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
</Card>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
</Gluejar>
|
|
108
|
+
</div >
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// 定义参数或属性
|
|
113
|
+
FefferyPasteImage.propTypes = {
|
|
114
|
+
// 部件id
|
|
115
|
+
id: PropTypes.string.isRequired,
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The content of the tab - will only be displayed if this tab is selected
|
|
119
|
+
*/
|
|
120
|
+
children: PropTypes.node,
|
|
121
|
+
|
|
122
|
+
// css类名
|
|
123
|
+
className: PropTypes.string,
|
|
124
|
+
|
|
125
|
+
// 自定义css字典
|
|
126
|
+
style: PropTypes.object,
|
|
127
|
+
|
|
128
|
+
// 存储当前保存的所有图片的base64字符串
|
|
129
|
+
currentPastedImages: PropTypes.arrayOf(PropTypes.any),
|
|
130
|
+
|
|
131
|
+
// 记录生命周期内第几次接受新图片粘贴,进而辅助删除图片操作
|
|
132
|
+
deletedIdx: PropTypes.arrayOf(PropTypes.number),
|
|
133
|
+
|
|
134
|
+
// 设置每张图片块的像素高度,默认为200
|
|
135
|
+
imageHeight: PropTypes.number,
|
|
136
|
+
|
|
137
|
+
loading_state: PropTypes.shape({
|
|
138
|
+
/**
|
|
139
|
+
* Determines if the component is loading or not
|
|
140
|
+
*/
|
|
141
|
+
is_loading: PropTypes.bool,
|
|
142
|
+
/**
|
|
143
|
+
* Holds which property is loading
|
|
144
|
+
*/
|
|
145
|
+
prop_name: PropTypes.string,
|
|
146
|
+
/**
|
|
147
|
+
* Holds the name of the component that is loading
|
|
148
|
+
*/
|
|
149
|
+
component_name: PropTypes.string
|
|
150
|
+
}),
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Dash-assigned callback that should be called to report property changes
|
|
154
|
+
* to Dash, to make them available for callbacks.
|
|
155
|
+
*/
|
|
156
|
+
setProps: PropTypes.func
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// 设置默认参数
|
|
160
|
+
FefferyPasteImage.defaultProps = {
|
|
161
|
+
className: 'feffery-paste-image-container',
|
|
162
|
+
imageHeight: 200,
|
|
163
|
+
currentPastedImages: [],
|
|
164
|
+
deletedIdx: []
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
export default FefferyPasteImage;
|
|
@@ -62,9 +62,9 @@ const FefferySyntaxHighlighter = (props) => {
|
|
|
62
62
|
style={
|
|
63
63
|
{
|
|
64
64
|
position: 'absolute',
|
|
65
|
-
right: '
|
|
66
|
-
top: '
|
|
67
|
-
padding:
|
|
65
|
+
right: '2px',
|
|
66
|
+
top: '2px',
|
|
67
|
+
padding: 0,
|
|
68
68
|
margin: 0,
|
|
69
69
|
background: 'transparent',
|
|
70
70
|
border: 'none transparent',
|
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
.linenumber react-syntax-highlighter-line-number {
|
|
2
2
|
min-width: 2rem!important;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
.feffery-paste-image-container {
|
|
7
|
+
height: 400px;
|
|
8
|
+
overflow: auto;
|
|
9
|
+
border: 1px solid #d9d9d9;
|
|
10
|
+
transition: all .3s,height 0s;
|
|
11
|
+
cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAkdJREFUSEtjZMABcnNny3ByMpQyMzNpISv59u3XtokTM/tx6UMXZ4QJJCTM5+Dh+WIB4zMxMe83M1NhkJUVRdFz8eJ9hgcPXr/+9etXGEzi3z+mG9OmZb/AZinYgqbqqWVvvzC2Gyv8YgLxP3xjYvjwR4AhM8sTq0Obm1czmCj+gsu9+cx879MPxicNbTn2WH2Qnzftb5rTF7Dhh2+yM7z8yMzw8x8rgyAfKwPci1Cd/xkYGF69+8Ugwv2bQV3yN4OqxB+wzPaLnA+fvGdxmDAh8wGyJWD9teVT70dYflUAsb/+ZGTgZAMZQxgwIdl+9Bbbg0uPmBOnTMk9gNcCwsZiV0GRBTP38eC1l52dlYGL+efnt1/++5Hlg23XJRmi4/1xWjJ16jqGz5+/MTAw/N84aVJ2AMlBRMiCSZPWMLS3JzLk509nYGRknDZxYmY2zBKMSMbmTEIW9PevZOjqSgFrBVnCwMAwf9KkrCQQgyoW9PQsZ+jtTYO7DdkSqljQ2bmU4f9/rEm7iioWgJz+8+d3hl+/fsJ9cfHi7W+HDl3zppoF6JbQxAJkS2hmAcyS06evUD+IkJP44cNnvh4+fNWHqnGAbMGhQ+c/HzlyyQ9sQU3ZlIeRVt/kcJUFhDIaNn0oFlSXTX0UZfVVlmYWVJVNeRxk8l2GlQV7PbDrJv7CjhgfzFEQ/R0oyvtPCJvim+/FGWLjfUmqKlCCCKSzrHhyAA87QzA2U5i5RMKcXUzYSLHhwYNniEgmpLGsbG4XITXY5Lu6kssAynVWbI/9nxAAAAAASUVORK5CYII=), auto;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.feffery-paste-image-container:hover {
|
|
15
|
+
border: 1px solid rgb(64, 169, 255);
|
|
3
16
|
}
|
package/src/lib/index.js
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
import FefferyCaptcha from "./components/FefferyCaptcha.react";
|
|
3
3
|
import FefferyWaterMark from "./components/FefferyWaterMark.react";
|
|
4
4
|
import FefferySyntaxHighlighter from "./components/FefferySyntaxHighlighter.react";
|
|
5
|
-
import
|
|
5
|
+
import FefferyPasteImage from "./components/FefferyPasteImage.react";
|
|
6
|
+
|
|
6
7
|
|
|
7
8
|
export {
|
|
8
9
|
FefferyCaptcha,
|
|
9
10
|
FefferyWaterMark,
|
|
10
11
|
FefferySyntaxHighlighter,
|
|
11
|
-
|
|
12
|
-
};
|
|
12
|
+
FefferyPasteImage
|
|
13
|
+
};
|